Why is my code giving TLE?

#include
using namespace std;
int no_of_ways(int n,int m){
if(n<m){
return 1;
}
if(n==m)
return 2;
return no_of_ways(n-1,m)+no_of_ways(n-m,m-1);
}
int main() {
int t;
cin>>t;
while(t–){
int n,m;
cin>>n>>m;

	cout<<no_of_ways(n,m)<<endl;
}
return 0;

}

hi @riagoel3999 use dp and do modulo

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.