What is problem with my code?

#include<bits/stdc++.h>
using namespace std;

vector dp(1000010,0);
int tiling(int n , int m){
if(n==m){
return 2;
}
if(n<=1 || n<m){
return 1;
}
if(dp[n]!=0){
return dp[n];
}else{
dp[n]=((tiling(n-m , m)%1000000007)+(tiling(n-1 , m)%1000000007))%1000000007;
}
return dp[n];
}

int main(){
int t;
cin>>t;
while(t–){
int n,m;
cin>>n>>m;
cout<<tiling(n,m)<<endl;
}
return 0;
}

hello @chetan_aggarwalbX1
u need to reinitialise ur dp vector for each test cases.
so add appropriate code inside while loop

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.