My Code doesn't pass Test cases

I don’t know what is wrong with my code. I saw the hint and coded the same way, using exactly the same recurrence but still my code fails every test case.
Please help and point out the bug

#include
#include
using namespace std;
unsigned long long countWays(int n, int m)
{
// bottom
unsigned long long DP[n+1];
for(int i=0; i< m; i++)
DP[i] = 1;
for(int i=m; i<=n; i++)
DP[i] = DP[i-1] + DP[i-m];
unsigned long long mod;
mod = pow(10, 9) + 7;
return DP[n]%mod;
}
int main() {
int n, m;
int T;
cin>>T;
while(T–){
cin>>n>>m;
cout<<countWays(n,m);
}
return 0;
}

hello @vsinghal202

take mod at this step as well.

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.