Getting wa in 4 test cases

https://hack.codingblocks.com/app/contests/1080/p/1045
#include
#include

using namespace std;

long long int solver(int n,int m,vector &strg)
{
if(strg[n]!=0)
{
return strg[n];
}

if(n<=0)
{
    return 0;
}

if(n==m)
{
    return 2;
}

if(m>n)
{
    return 1;
}

long long int ans=solver(n-1,m,strg)+solver(n-m,m,strg);
// cout<<n<<"the ans is "  <<ans<<endl;  
strg[n]=ans;
return ans;

}
int main(int argc, char const *argv[])
{
int t;
cin>>t;

while (t--)
{
    int n,m;
    cin>>n>>m;

    vector<long long int> strg (1000001,0);
    cout<<solver(n,m,strg)<<endl;


}
    
return 0;

}

i am getting wrong answer even after using dp

Use MOD 1e9+7 to pass the test case. You might be overflowing.

still getting WA even after MOD 1e9+7

Please share your complete code via ide.codingblocks.com so that i can have a look

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.