Tiling problem. need help with the code

int res[100000]={0};
void tilingWays(int n,int m){

if(n<m){
	res[n]+=1;
	return;
}
if(res[n-1]==0 or res[n-m]==0){
tilingWays(n-1,m);
tilingWays(n-m,m); 
res[n]=res[n-1]+res[n-m]; 
}
else{
res[n]=res[n-1]+res[n-m]; 
}
return;

}
int main() {
int t;
cin>>t;
while(t–){
int n,m;
cin>>n>>m;
tilingWays(n,m);
int k=res[n]%1000000007;
cout<<k<<endl;
}
return 0;
}

@vaishnavi20001611 use long long int datatype

it still gives wrong ans.is the recursive and base case correct

Your Code:
if(n<m){
res[n]+=1;
return;
}
by writing this you are updating the res[n] whenever this n is visted in recursion
so, fix res[n]=1 only

Your code:
if(res[n-1]==0 or res[n-m]==0){
tilingWays(n-1,m);
tilingWays(n-m,m);
res[n]=res[n-1]+res[n-m];
}
else{
res[n]=res[n-1]+res[n-m];
}
//Above is your code, please make it more efficient by dividing the case in if statement… refer this variant as shown below
if(res[n-1]==0){
tilingWays(n-1,m);}
if(res[n-m]==0){
tilingWays(n-m,m);}
res[n]=(res[n-1]+res[n-m])%1000000007;

@vaishnavi20001611
I hope this will work. hit a like button if its good enough