semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int f(int m,int n)
{
	int sum;
	if(n==1||m==0||m==1)sum=1;
	else if(m>=n&&n>0){
		sum=f(m,n-1)+f(m-n,n);
	}else if(m<n&&m>=0){
		sum=f(m,n-1);
	}
	return(sum);
}
int main()
{
	int x,i;
	scanf("%d\n",&x);
	int m[x],n[x];
	for(i=0;i<x;i++)
	{
		scanf("%d %d\n",&m[i],&n[i]);
	}
	for(i=0;i<x;i++)printf("%d\n",f(m[i],n[i]));
}
int f(int m,int n)
{
	if(m<0||n<=0)
	{
		return 0;
	}
	if(m==1||n==1||m==0)
	{
		return 1;
	}
	if(m>1&&n>1)
	{
		return (f(m,n-1)+f(m-n,n));
	}
}
int main()
{
	int x,m,n,i,k;
	scanf("%d",&x);
	for(i=0;i<x;i++)
	{
		scanf("%d%d",&m,&n);
		k=f(m,n);
		printf("%d\n",k);
	}
}
/*
?M????????N????????????????????????????????K???????5?1?1?1?5?1???????

????
???????????t?0<= t <= 20?,??t????????M?N???????1<= M, N<= 10

????
????????M?N?????????K*/


int divide (int ap,int disc)
{
	if(ap<0)                     //ap???????
		return 0;
	
	if(ap==0 || disc==1)               //?????????????????????????
		return 1;
	if(disc>=2)
		return (divide(ap-disc,disc)+divide(ap,disc-1)); //????  
}

int main ()
{
	int i,n;
	int ap[20],disc[20];
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>ap[i]>>disc[i];
		cout<<divide(ap[i],disc[i])<<endl;           
	}

	return 0;
}
int count(int m,int n,int max)
{
	int tp=0,st=0,i;
    if (n*max<m) return 0;
	if (m<=1) return 1;
	else if (n==1) return 1;
	else
	{if (fmod(m,n)==0) st=m/n;
	    else st=m/n+1;
	 if (max>=m) max=m;
	for (i=max;i>=st;i--)
		tp=tp+count(m-i,n-1,i);
	 return tp;
	}
}
int main()
{   int i;
	int total,m,n;
	scanf("%d",&total);
	for (i=1;i<=total;i++)
	{   scanf("%d %d",&m,&n);
		printf("%d\n",count(m,n,m));
	}
	return 7;
}
int ji,m;
void fang(int a,int b)
{
     int i;
     if(b==1) ji++;
     else
     {
       for(i=m;i<=(a/b);i++)
       {
           m=i;
           fang(a-i,b-1);
       }
     }
}

main()
{
      int k,n,p,q;
      scanf("%d",&n);
      for(k=1;k<=n;k++)
      {
          scanf("%d %d",&p,&q);
          ji=0;
          m=0;
          fang(p,q);
          printf("%d\n",ji);
      }
}
int f1(int m,int n)
{
	int f(int m,int n);
	if(m==n) return 1;
	else if(m<n) return 0;
	else if(m==2&&n==1) return 1;
    else if(n==2) return m/2;
	else
		return f(m-n,n);
}
int f2(int m,int n)
{
	int f(int m,int n);
    if(n==1) return 0;
	else if(n==2) return 1;
	else 
		return f(m,n-1);
}
int f(int m,int n)
{
	if(m==1) return 1;
	else if(m==2) return 2;
	else if(n==1) return 1;
	else if(n==2) return (m/2+1);
	else 
		return (f1(m,n)+f2(m,n));
}
void main()
{
	int i,t,M[20],N[20];
	scanf("%d",&t);
	for(i=0;i<t;i++)
	scanf("%d %d",&M[i],&N[i]);
	for(i=0;i<t;i++)
		printf("%d\n",f(M[i],N[i]));
}
int f(int , int);
int main()
{
	int t, m, n, i, sum;
	cin >> t;
	for (i = 0; i < t; i++)
	{
		cin >> m >> n;
		sum = f(m, n);
		cout << sum << endl;
	}
	return 0;
}
int f(int m, int n)
{
	int sum;
	if (n <= 0 || m < 0)
		return 0;
	else if (m == 0)
		return 1;
	else if (n == 1 || m == 1)
		return 1; 
	sum = f(m - n, n) + f(m, n - 1);
	return sum;
}
int act(int n,int m)
{
    if (m==1||m==0) {
        return 1;
    }
    else
    if (n==1&&m>0) {
        return 1;
    }
    else
    if (m<0) {
        return 0;
    }
    else
        return (act(n, m-n)+act(n-1, m));
}

int main()
{
    int times,i,m,n;
    scanf("%d",&times);
    
    for (i=0; i<times; i++) {
        scanf("%d %d",&m,&n);
        printf("%d\n",act(n, m));
    }
    return 0;
}
int f(int a,int b)
{
    int i,n=0;
    if (a==0||b==1)
    return (1);
    else if (a<b)
    f(a,a);
    else
    {
        n=f(a-b,b)+f(a,b-1);
    }
}
int main()
{
    int i,n,j=0,*p,*q,a,b;
    scanf("%d",&n);
    for (i=0;i<n;i++)
    {
        scanf("%d %d",&a,&b);
        printf("%d\n",f(a,b));
    }
}
int f(int x,int y){
    int r=1;
    if(y==1||x==0||x==1)
      return 1;
    if(y==0)
      return 0;
    if(y>x)
      y=x;
    r=f(x-y,y)+f(x,y-1);
    return r;        
}
int main(){
    int t,m[20],n[20];
    scanf("%d",&t);
    for(int i=0;i<t;i++){
            scanf("%d %d",&m[i],&n[i]);
            }
    for(int i=0;i<t;i++){
            printf("%d\n",f(m[i],n[i]));
            }
    return 0;
}
int f(int m,int n)
{
	int z;
	if(m<n)
		n=m;
	if(m==0)
	{z=1;return z;}
	if(n==1)
	{z=1;return z;}
	z=f(m,n-1)+f(m-n,n);
	return z;
}

void main()
{
	int t,m[20],n[20],i;
	scanf("%d",&t);
	for(i=0;i<t;i++)
	{
		scanf("%d%d",&m[i],&n[i]);
		
	}
	for(i=0;i<t;i++)
	{
		printf("%d\n",f(m[i],n[i]));
		
	}
}
int pl(int m,int n)
{
   int c;
   if(m==0)
   c=1;
   else if(m<0)
   c=0;
   else if(n==1)
   c=1;

   else 
   c=pl(m-n,n)+pl(m,n-1);

   return c;
}
main()
{
    int m,n,i,t,c;
    scanf("%d",&t);
    for (i=0;i<t;i++)
    {
        scanf ("%d %d",&m,&n);
        c=pl(m,n);
        printf("%d\n",c);
    }
 }
int f(int m, int n)
{
	int q;
	if(n>m)
	{
		n=m;
	}
	if(m==1||n==1||m==0)return(1);
	q=f(m-n,n)+f(m,n-1);
	return(q);
}

int main(){
      int i,j,k,n,m,t;
      scanf("%d",&t);
      while(t--)
      {
         
          scanf("%d%d",&m,&n);
          k=f(m,n);
          printf("%d\n",k);
        
          }
  
      return 0;}
int put(int m,int n)//m????n???
{
	if (m<n)
		return (put(m,m));
	if (m==n)
		return (put(m,n-1))+1;
    if (n==1)
		return 1;
	if ((n==0)||(m==0))
		return 0;
	if (m==1)
		return 0;
	else 
		return (put(m,n-1)+put(m-n,n));
}
int main ()
{
	int t,i,m,n,s,j;
	cin >> t ;
	j=1;
	for (i=1;i<=t;i++)
	{
		cin >> m >> n;
		s=put (m,n);
		if (j<t)
		cout << s << endl;
		else cout << s;
	}
}
//****************************************
//*????????                     **
//*?????? 1100012763              **
//*???2011.11.17                     **
//****************************************

int ans[101][101];

int jisuan(int apple, int plate)
{
	int num;
	if (ans[apple][plate] == -1)
	{
		num = jisuan(apple , plate - 1);
		if (apple - plate >= 0)
			num = num + jisuan(apple - plate , plate);
		return num;      
	}
	else
		return ans[apple][plate];
}

int main() 
{
	int i , j , t , k , apple , plate;
	cin >> t;
	for (i = 1; i <= t; i++)
	{
		for (j = 0; j <= 100; j++)
			for (k = 0; k <= 100; k++)
				ans[j][k] = -1;
		for (j = 0; j <= 100; j++)
		{
			ans[j][1] = 1;
			ans[0][j] = 1;
		}
		cin >> apple >> plate;
		cout << jisuan(apple , plate) << endl;
	}

	return 0;
}
int main(void)
{
    int c[1000];
    int k, i;
    int apple(int a, int b);
    int m, n;
    scanf("%d", &k);
    for(i=0; i<k; i++)
    {
        scanf("%d %d", &m ,&n);
        c[i]=apple(m,n);
    }
    for(i=0; i<k; i++)
        printf("%d\n", c[i]);
    return 0;
}

/*int apple(int a, int b)
{
     printf("(%d,%d)\n",a,b);
     if(a<b)
     return apple(a,a);
    if(a==b)
    {
        //printf("(%d,%d)=%d\n",a,b,apple(a,b));
        return 1+apple(a,b-1);
    }

    if((b==1)||(a==1))
    {
        //printf("(%d,%d)=%d\n",a,b,apple(a,b));
        return 1;
    }


        //printf("(%d,%d)=%d\n",a,b,apple(a,b));
        return apple(a,b-1)+apple(a-b,b);


}*/
int apple(int a, int b)
{
    if((a<1) || (b<1)) return 0;   //?????????????????1?a?b????0?????????0?
    if(a==1 || b==1) return 1;     //2?a?b???????1???????1??
    if(a<b) return apple(a,a);      //?1????????????a<b????????b-a????????????
    if(a==b) return apple(a,b-1)+1; //?2?????????????a==b?????????????????1???????fact(a,b-1)+1
    return apple(a,b-1)+apple(a-b,b); //?3??????????????a>=b??????????????1?????????fact(a,b-1)??2???????????fact(a-b,b)?
}
int means(int m,int n)
{
	if(n==1)
		return 1;
	else{
		if(m==0)
			return 1;
		else{
			if(m>=n)
				return means(m,n-1)+means(m-n,n);
			else
				return means(m,n-1);
		}
	}
}

void main()
{
	int t,m,n;
	scanf("%d",&t);
	while(t--){
		scanf("%d%d",&m,&n);
		printf("%d\n",means(m,n) );
	}
}
int apple (int m, int n)
{
	int sum=0, sum1=0, sum2=0;
	if (n == 1)
	{
		sum = 1;
		return sum;
	}
	if (m == 1)
	{
		sum = 1;
		return sum;
	}
	if (n!=1&&m!=1)
	{	
		if (m<=n)
			return (1+ apple (m,m-1));
		else
		{
			sum2= apple (m-n,n);
			sum1 = apple (m, n - 1);
		}
	}
	sum=sum1+sum2;
	return sum;
}
int main()
{
	int t, i, m, n, total;
	cin >> t;
	for (i=1;i<=t;i++)
	{
		cin >> m >> n;
		cout << apple(m, n) << endl;
	}
	return 0;
}
int way(int m,int n)
{
    if(m==1 || n==1) return(1);
    else if(m<0) return 0;
    else if(m==n) return(way(m,n-1)+1);
    else return(way(m,n-1)+way(m-n,n));
}
main()
{
    int p;scanf("%d\n",&p);
    int i,j,m,n;
    for(i=0;i<p;i++)
    {
        scanf("%d%d",&m,&n);
        printf("%d",way(m,n));
        if(i!=p-1) printf("\n");
    }
}
int pf(int m,int n)
{
	int c,i=0;
	if (m==0||n==1)
	    c=1;
	else if (m<n)
		c=pf(m,(n-1));
	else
		c=pf(m,(n-1))+pf((m-n),n);
	return c;
}
int main ()
{
	int a,m,n;
	scanf("%d",&a);
	for (int i=1;i<=a;i++)
	{
		scanf("%d %d",&m,&n);
		printf("%d\n",pf(m,n));
	}
	return 0;
}
int f(int M,int N)
{
    if(M==0)
    return 1;
    if(N==0)
    return 0;
    if(M==1||N==1)
    return 1;
    if(M<N)
    return f(M,M);
    else
    return f(M,N-1)+f(M-N,N);
}

int main()
{
    int t,M,N,i;
    cin>>t;
    for(i=0;i<t;i++)
    {
        cin>>M>>N;
        cout<<f(M,N)<<endl;
    }
    return 0;
}
int putapple(int applenum,int platenum);
int main()
{
	int t,m,n;
	int i;
	cin>>t;
	for(i=0;i<t;i++)
	{
		cin>>m>>n;
		cout<<putapple(m,n)<<endl;
	}
		return 0;
}
	int putapple(int applenum,int platenum)
	{

		if(applenum<0||platenum==0)
			return 0;
		if(applenum==0||applenum==1||platenum==1)
			return 1;
		else
			return putapple(applenum,platenum-1)+
			putapple(applenum-platenum,platenum);
	}
int work(int m,int n)
{
	if(m==0)
	{
		return 1;
	}
	else if(n==1)
	{
		return 1;
	}
	else if(m>=n)
	{
		return work(m-n,n)+work(m,n-1);
	}
	else
	{
		return work(m,n-1);
	}
}
int main()
{
	int t,m,n,i;
	cin>>t;
	for(i=0;i<t;i++)
	{
		cin>>m>>n;
		cout<<work(m,n)<<endl;;
	}
	return 0;
}
int digui(int x,int y);
int main()
{
	int t,i;
	scanf("%d",&t);
	for(i=0;i<t;i++)
	{
		int M,N;
		scanf("%d %d",&M,&N);
		int s=0;
		s=digui(M,N);
		printf("%d\n",s);
	}
	return 0;

}
int digui(int x,int y)
{
	if(x==1||y== 1)
	{
		return 1;
	}
	else if(x>=y)
	{
		return digui(x,y-1)+digui(x-y,y);
	}
	else if(x<y)
	{
		return digui(x,y-1);
	}
	else if(x==0)
	{
		return 1;
	}
}
int apple(int m,int n)
{
    int k;
    if(m==0||m==1||n==1)
    return 1;
    else
    {
        if(m>=n)
        k=apple(m,n-1)+apple(m-n,n);
        else
        k=apple(m,n-1);
        }
        return k;
        }
main()
{
      int t,i,m,n;
      scanf("%d",&t);
      for(i=1;i<=t;i++)
      {
                       scanf("%d %d",&m,&n);
                       printf("%d\n",apple(m,n));
                       }

      }
int fact(int a,int b)
{
    if((a<1)||(b<1))return 0;
    if((a==1)||(b==1)) return 1;
    if(a<b)return fact(a,a);
    if(a==b)return fact(a,b-1)+1;
    if(a>b)return fact(a,b-1)+fact(a-b,b);
}
main()
{
      int t,m,n;
      scanf("%d",&t);
      while(t--)
      {
                scanf("%d%d",&m,&n);
                printf("%d\n",fact(m,n));
                }
      




return 0;}
void main()
{
	int t,a[1000][2],k,i,m,n;
	int f( int m,int n);
	scanf("%d",&t);
	for(i=0;i<t;i++)
	{
		scanf("%d %d",&a[i][0],&a[i][1]);
	}
	for(i=0;i<t;i++)
	{
		m=a[i][0];n=a[i][1];
		k=f(m,n);
	    printf("%d",k);
		if(i!=t-1)
			printf("\n");
	}
}
int f(int m,int n)
{
	int k=0;
	
	if(m==0||n==1)
		k=1;
	else if(m<0)
		k=0;
	else 
		k=f(m,n-1)+f(m-n,n);
	return k;
}
int f(int m,int n){
    int count;    
    if(m==1||n==1) return 1;
    if(m<n)        count=f(m,n-1);
    else           count=f(m-n,n)+f(m,n-1);            
    return         count; 
    }

int main(){
    int t,m,n,i,count;
    scanf("%d",&t);
    for(i=0;i<t;i++){
        scanf("%d%d",&m,&n);
        count=f(m,n);
        printf("%d\n",count);
        }    
    
    scanf("%d",&n);
    return 0;
    }
int move(int m,int n)
{
	if(m==1||m==0||n==1)
		return(1);
	else if(m<n&&m!=0)
		return(move(m,m));
	else
	{
		int k=0,i;
		for(i=0;i<n;i++)
			k=k+move(m-n+i,n-i);
		return(k);
	}
}
main()
{
	int i,t;
	scanf("%d",&t);
	for(i=0;i<t;i++)
	{
		int m,n;
		scanf("%d %d",&m,&n);
		printf("%d\n",move(m,n));
	}
}
int place(int m,int n)
{
    if (m==1||n==1||m==0||n==0)
    return 1;
    else {
          if (m-n>=0) return place(m,n-1)+place(m-n,n);
          else       return place(m,n-1);    
         }
}
int main()
{
    int t,m,n,i;
    scanf("%d",&t);
    for(i=0;i<t;i++)
    {
    scanf("%d %d",&m,&n);
    printf("%d\n",place(m,n));
    }
    
}
int methods(int m,int n)
{
	if (m<n)
	{
		return methods(m,m);
	}
	if ((m>=n)&&(n>1))
	{
		return (methods(m-n,n)+methods(m,n-1));
	}
	if ((n<=1))
	{
		return 1;
	}
}
int main()
{
	int m,n,t,i;
	cin >>t;
	for (i=0;i<t;i++)
	{
		cin >>m>>n;
		cout <<methods(m,n)<<endl;
	}
	return 0;
}
int f(int m,int n)
{
	int k;
	if(m==1||n==1) k=1;
	else if(m==n) k=1+f(m,n-1);
	else if (m>n)k=f(m,n-1)+f(m-n,n);
	else k=f(m,m);
	return (k);
}
main()
{
	int t,m,n,i;
	scanf("%d",&t);
	for(i=1;i<=t;i++)
	{
		scanf("%d %d",&m,&n);
		printf("%d\n",f(m,n));
	}
}
int a[1100][1100]={{0}},sa[1100][1100]={{0}};
int an(int m,int n){
if (sa[m][n]==1)return a[m][n];
if (m>=n){a[m][n]=an(m-n,n)+an(m,n-1);sa[m][n]=1;return a[m][n];}
if (m<n){a[m][n]=an(m,n-1);sa[m][n]=1;return a[m][n];}
return 0;
}
int main(){
int t;
cin>>t;
a[1][1]=1;sa[1][1]=1;
a[0][0]=1;
for (int i=0;i<=1000;i++)sa[i][0]=1;
int M,N;
for (int i=0;i<t;i++){
cin>>M>>N;
cout<<an(M,N)<<endl;
}
return 0;
}
/*
7 3 = 4 3 + 7 2
4 3 = 1 3 + 4 2
1 3 = 1
4 2 = 1 + 1
4 1 = 3 1 = 2 1 = 1 1 = 1
2 2 = 2 1=1
*/
int f(int m,int n) 
{
    if(m==0||m==1) return 1;
	if(n==1) return 1;
	if(m<n) n=m;
	return f(m,n-1)+f(m-n,n); 

}

int main()
{
	int i=0,t,m,n;
	cin>>t;
	while(i<t)
	{
	   cin>>m>>n;
	   cout<<f(m,n)<<endl;
	  i++;
	}
	
	return 0;
}
int place(int m, int n)
{
	if (m < 0)
	  return(0);
	if (n == 1) 
	  return(1);
	return(place(m, n - 1) + place(m - n, n));
}
int main()
{
	int m[20], n[20], t, i;
	cin >> t;
	for (i = 0; i < t; i++)
	  cin >> m[i] >> n[i];
	for (i = 0; i < t; i++)
	  cout << place(m[i], n[i]) << endl;
	return(0);
 }
/*
 * fangpingguo.cpp
 *
 *  Created on: 2010-12-1
 *      Author: 378073652
 */

int s=0;
int  number(int x ,int y,int z,int num){
	int i;

	if(x==0&&y>=num) {s=s+1;}
	if(x==0&&y<num) return 0;
	for(i=z;i<=x;i++)
	{
		if(x-i>=0) number(x-i,y,i,num+1);
	}
	
    return s;
}



int main(){
	int t,m,n,i;
	cin>>t;
	for(i=1;i<=t;i++){
		cin>>m>>n;
		cout<<number(m,n,1,0)<<endl;

s=0;


	}
}
int main()
{
  int n;
  int i,j;
  int a,b;
  int x;

  scanf("%d",&n);
  for(i=1;i<=n;i++)
  {
      scanf("%d %d",&a,&b);
      x=apple(a,b);
      printf("%d\n",x);
  }
  return 0;
}

int apple(int a,int b)
{
    int plan;
    int x;
    if(a==0||b==1)
    {
       plan=1;
    }
    else
    {
        if(a>=b)
        {
            x=apple(a-b,b);
        }
        else
        {
            x=0;
        }
        plan=apple(a,b-1)+x;
    }
    return plan;
}
int way=0;
int main()
{
    int apple(int n,int m);
    int t,n,m,i;
    cin>>t;
    for(i=0;i<t;i++)
    {
        cin>>n>>m;
        cout<<apple(n,m)<<endl;
    }
    return 0;
}
int apple(int n,int m)
{
    if(m==1||n==1)
    {
        way=1;
    }
    if(m==n)
    {
        way=apple(n,m-1)+1;
    }
    if(m!=n&&m!=1&&n!=1)
    {
        if(n>m)
        way=apple(n,m-1)+apple(n-m,m);
        else
        way=apple(n,n);
    }
    return way;
}
int main()
{
	int sort(int M , int N) ;
	int n , M , N , k ;
	cin >> n ;
	int i = 1 ;
	do
	{
		cin >> M >> N ;
		k = sort(M , N) ;
		cout << k << endl ;
		i++ ;
	}while (i <= n) ;
	return 0 ;
}
int sort(int M , int N)
{
	if (M <= 1 || N == 1)
		return 1 ;
	else
	{
		if (M < N)
			return sort(M , M) ;
		else
			return ( sort(M - N , N) + sort(M , N - 1) ) ;
	}
}
int f(int m,int n)
{
	int x=m,y=n;
	if(x==0||y==0||y==1)
		return 1;
	if(x<y)
		return(f(x,x));
	if(x>=y)
		return(f(x,y-1)+f(x-y,y));
}
int main()
{
	int n,a[999],b[999],i;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d%d",&a[i],&b[i]);
		
	}
	for(i=0;i<n;i++)
	{
		printf("%d\n",f(a[i],b[i]));
	}
	return 0;
}
int fun(int m, int n, int j) {
	int i, s = 0;
	if (n == 1)
		return m >= j;
	for (i = j; i < m; i++)
		s = s + fun(m - i, n - 1, i);
	return s;
}
int main() {
	int n, m, s;
	int t;
	cin >> t;
	while (t--) {
		cin >> m >> n;
		if (n > m)
			n = m;
		s = fun(m, n, 0);
		cout << s << endl;
	}
	return 0;
}
int f(int m,int n)
{
	int k;
	if (m==1)
		return 1;
	if (n==1)
		return 1;
	else 
	{
		if (m>n) 
			k=f(m,n-1)+f(m-n,n);
		if (m==n)
			k=f(m,n-1)+1;
		if (m<n)
			k=f(m,m);
	    return k;
	}
}

int main ()
{
	int t,m,n,l;
	cin >> t;
	for (int i=0;i<t;i++)
	{
		cin >>m >>n;
		l=f(m,n);
		cout << l<< endl;
	}
	return 0;
}
int f(int m,int n)
{if(n==1||m==0) return 1;
 else if(m<0) return 0;
 else return (f(m,n-1)+f(m-n,n));


}
int main(){
int x,i,m,n;
int a[100];
cin>>x;
for(i=1;i<=x;i++){cin>>m>>n;  a[i]=f(m,n);}
for(i=1;i<=x;i++) cout<<a[i]<<endl;



 return 0;
}
/**
 *@ file    1000012834_004homework.cpp
 *@ author  ???
 *@ date    2010-12-7
 *@ description 
 *          ????????????
 */

// combine??????????????
int combine(int m1_apple, int n1_plate)
{
	int total1, total2, t;	// ????????????????????
	if (n1_plate == 1 || m1_apple == 0)	// ??????????????????1????
		return 1;
	else
		if (m1_apple < n1_plate)	// ?????????????????????????????
			return combine(m1_apple, m1_apple);	// ????
		else
		{							// ????????????
			total1 = combine(m1_apple, n1_plate - 1);
			total2 = combine(m1_apple - n1_plate, n1_plate);
			t = total1 + total2;	// ?????????
			return t;				// ?????
		}
}
int main()
{

	// ????????t,????i,????m_apple,????n_plate????????total
	int t, i, m_apple, n_plate, total;
	cin >> t;	// ????????
	for (i = 1; i <= t; i++)	// ?????????
	{
		cin >> m_apple >> n_plate;	// ???????????
		total = combine(m_apple, n_plate);	// ???????????
		cout << total << endl;	// ????????
	}

	return 0;
}
//
//	????:	?????
//	????:	?M????????N???????????????????????????????
//	????:	?  ? ( ? ?: 1000012733 )
//	????:	2010 ? 12 ? 06 ?
//
int maxapple ( int, int );										/*????????????maxapple?????????????????????????
																????????????????????????????????????*/
int main()
{
	int t, i, m, n, k;											/*??????????????t??????????i????????m?n??????
																??????????k??????????????*/
	cin >> t;													//???????????
	for ( i = 1; i <= t; i ++ )
	{
		cin >> m >> n;											//???i??????m????????n???????
		k = maxapple ( m, n );									//????maxapple????????????????????k
		cout << k << endl;										//??k??????
	}
	return 0;
}
int maxapple ( int m, int n )									//????maxapple?????????????m?n????????????????
{
	int k;														//k??????????????????????
	if ( m == 0 )
		return 1;												//??m?0????????????????????????????
	if ( n == 1 )
		return 1;												//??n?1?????????????????????????????????????
	if ( m >= n )
	{
		k = maxapple ( m - n, n ) + maxapple ( m, n - 1 );
		return k;												/*??m?????n?????????????n??????m - n????????????
																?n - 1?????m???????????*/
	}
	if ( m < n )
	{
		k = maxapple ( m, n - 1 );
		return k;												//??m??n?????????????n - 1?????m???????????
	}
}
int put(int, int);
int main()
{
	int i, t, app, plate, sum;
	cin >> t;
	for (i = 0; i < t; i++)
	{
		cin >> app >> plate;
		sum = put(app, plate);
		cout << sum << endl;
	}
	cin >> sum;
	return 0;
}

int put(int m, int n)
{
	int sum;
	if (n == 1 || m == 0)
		return 1;
	if (m >= n)
		sum = put(m - n, n) + put(m, n - 1);
	else
		sum = put(m, n - 1);
	return sum;
}
int f(int m,int n);
int g(int m,int n)
{
	if (m == 0)
		return 1;
	if (m == 1)
		return 1;
	return f(m,n - 1) + f(m - n,n);
}
int f(int m,int n)
{   
	if (n == 1)
		return 1;
	if (m < n)
		return g(m,m);
	return f(m,n - 1) + f(m - n,n);
}
int main ()
{
	int m,n,t,i;
	cin >> t;
	for (i = 1;i <= t;i++)
	{
		cin >> m;
		cin >> n;
		cout << f(m,n) << endl;
	}
	return 0;
}
int layout(int m,int n){
        int means,i;
        means=0;
        if(n==1)
            means=1;
        else{
            if(m>=n){
                m-=n;
                for(i=1;i<=n;i++)
                    means+=layout(m,i);
                n--;
            }else{
                n--;
            }
        }
        return means;
    }
    
int main(){
    int t,M[21],N[21],K[21],i,j;
    scanf("%d",&t);
    for(j=0;j<t;j++){
                     scanf("%d%d",&M[j],&N[j]);
                     K[j]=layout(M[j]+N[j],N[j]);
    }
    for(j=0;j<t;j++){
                     printf("%d\n",K[j]);
    }
    return 0;
    }
int apple(int m,int n)
{
	if(m<n)
		n=m;
	if ((m==1)||(m==0)||(n==1))
		return 1;
	else
		return apple(m,n-1)+apple(m-n,n);
}

void main()
{
	int i,t,m[20]={0},n[20]={0},answer[20]={0};
	
	scanf("%d",&t);
	for(i=0;i<t;i++)
	{
		scanf("%d%d",&m[i],&n[i]);
		answer[i]=apple(m[i],n[i]);
	}

	for(i=0;i<t;i++)
	{
		printf("%d\n",answer[i]);
	}

}
int main()
{	int f(int M,int N);
	int i,j,k;
	int zu;
	int m,n;
	scanf("%d",&zu);
	for(k=0;k<zu;k++)
	{
	scanf("%d %d",&m,&n);//M??? N???
	printf("%d\n",f(m,n));
	}

}


int f(int M,int N)
{
if((N==1)||(M==1))
	return 1;
else
	if(M-N>0)
	return (f(M,N-1)+f(M-N,N));
	else
		if(M==N)
			return (f(M,N-1)+1);
		else
		return f(M,N-1);
	
}
int fun2(int m,int n);
int fun1(int m,int n);
int fun1(int m,int n)
{
    if (m<n) n=m;
    if (n==1) return 1;
    else if (n==0) return 0;
    else return (fun1(m,n-1) + fun2(m-n,n));
}
int fun2(int m,int n)
{
    if (m<n) n=m;
    if (m==1) return 1;
    else if(m==0) return 1;
    else return (fun1(m,n-1) + fun2(m-n,n));
}
main()
{
    int n,i;
    scanf("%d",&n);
    for (i=1;i<=n;i++)
    {
        int a,b;
        scanf("%d %d",&a,&b);
        if (a<b) b=a;
        printf("%d\n",fun1(a,b-1)+fun2(a-b,b));
    }
}
int dp[100][11];
int main(void)
{
	int i,j;
	int t;
	int m,n;
	scanf("%d",&t);
	for(i=1;i<=100;i++)
	    dp[i][1]=1;
	for(j=2;j<=10;j++)
	{
		for(i=1;i<=100;i++)
		{
			if(i-j>0)
			    dp[i][j]=dp[i][j-1]+dp[i-j][j];
			else if(i-j==0)
			    dp[i][j]=dp[i][j-1]+1;
			else
			    dp[i][j]=dp[i][j-1];
		}
	}
	while(t--)
	{
		scanf("%d%d",&m,&n);
		printf("%d\n",dp[m][n]);
	}
	return 0;
}
//?????



//???? ??????????
int placeMethodCounts(int m, int n)
{

	//??????, ?????????????????????????
	if(m == 0 || n == 1)
		return 1;

	if (m >= n)//???????? 
		return placeMethodCounts(m - n, n) + placeMethodCounts(m, n - 1);
	else  //?????????????????????? 
		return placeMethodCounts(m, m);
}

int main()
{
	int t,i;
	int m[MAX_T], n[MAX_T];

	scanf("%d", &t);

	for (i = 0; i < t; i++)
		scanf("%d %d", &m[i], &n[i]);

	for (i = 0; i < t; i++)
		printf("%d\n", placeMethodCounts(m[i], n[i]));

	return 0;
}
main()
{     int f[501][501],i,j,num,n,m;
      for (i=1;i<=500;i++)
      {f[i][1]=1; f[1][i]=1; f[i][0]=1;}
      
      for (i=2;i<=500;i++)
      for (j=2;j<=500;j++)
      { if (i>j) f[i][j]=f[j][j];
        else f[i][j]=f[i-1][j]+f[i][j-i];
      }
      scanf("%d",&num);
      for (i=0;i<num;i++)
      {
          scanf("%d %d",&m,&n);
          printf("%d\n",f[n][m]);
      }

}
int make(int m,int n,int x)
{
	int i,s;
	if (m==0)
	{
		if (n==0)
		{
			return 1;
		}
		else return 0;
	}
	else
	{
		s=0;
		for (i=x;i<=n;i++) s=s+make(m-1,n-i,i);
		return s;
	}
}
int main()
{
	int i,k,j,p,n,t,a[100][100],m,x;
	scanf("%d",&t);
	for (p=1;p<=t;p++)
	{
		scanf("%d%d",&m,&n);
		x=make(n,m,0);
		printf("%d\n",x);
		/*a[0][0]=1;
		for (i=1;i<=m;i++)
		for (j=0;j<=n;j++)
		{
			a[i][j]=0;
			for (k=0;k<=j;k++)
			a[i][j]+=a[i-1][k];
		}
		printf("%d\n",a[m][n]);*/
	}
}
int fenfa(int x,int y);
int main(){
	int t;
	int M[25],N[25];
	scanf("%d",&t);
	int i;
	for(i=0;i<t;i++){
		scanf("%d%d",&M[i],&N[i]);
	}
	int K[25];
	for(i=0;i<t;i++){
		K[i]=fenfa(M[i],N[i]);
		printf("%d\n",K[i]);
	}
	return 0;
}
int fenfa(int x,int y){
	int r;
	if(x==1){
		r=1;
	}else if(y==1){
		r=1;
	}else if(x!=1&&y!=1&&x<y){
		r=fenfa(x,y-1);
	}else if(x!=1&&y!=1&&x>=y){
		r=fenfa(x,y-1)+fenfa(x-y,y);
	}
	return r;
}
int apple(int a,int b)
{
    int i,c=0;
    if(b==1) return(1);
    if(a==0) return(1);
    if(a<0) return(0);
    else return(apple(a,b-1)+apple(a-b,b));
}
int main()
{
    int n,i,a,b,c;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
    scanf("%d %d",&a,&b);
    c=apple(a,b);
    printf("%d\n",c);
}
}