Why Time limit is exceeding?

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

int click(int n,int m)
{
if(n==m)
return 2;
else if(n<m)
return 1;
return (click(n-m,m)%1000000007+click(n-1,m)%1000000007)%1000000007;
}
int main()
{
int t;
cin>>t;
while(t–)
{
int n,m;
cin>>n>>m;
long int a=(click(n,m)%1000000007);
cout<<a%1000000007<<endl;
}
}

why its showing TLE in 1,3,4 and 5 test cases.?

Use Dynamic Programming to avoid TLE.

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.