It's New Year's Eve soon, so Ivan decided it's high time he started setting the table. Ivan has bought two cakes and cut them into pieces: the first cake has been cut into a pieces, and the second one — into b pieces.Ivan knows that there will be n people at the celebration (including himself), so Ivan has set n plates for the cakes. Now he is thinking about how to distribute the cakes between the plates. Ivan wants to do it in such a way that all following conditions are met:  Each piece of each cake is put on some plate;  Each plate contains at least one piece of cake;  No plate contains pieces of both cakes. To make his guests happy, Ivan wants to distribute the cakes in such a way that the minimum number of pieces on the plate is maximized. Formally, Ivan wants to know the maximum possible number x such that he can distribute the cakes according to the aforementioned conditions, and each plate will contain at least x pieces of cake.Help Ivan to calculate this number x!

The first line contains three integers n, a and b (1 ≤ a, b ≤ 100, 2 ≤ n ≤ a + b) — the number of plates, the number of pieces of the first cake, and the number of pieces of the second cake, respectively.

Print the maximum possible number x such that Ivan can distribute the cake in such a way that each plate will contain at least x pieces of cake.

NoteIn the first example there is only one way to distribute cakes to plates, all of them will have 1 cake on it.In the second example you can have two plates with 3 and 4 pieces of the first cake and two plates both with 5 pieces of the second cake. Minimal number of pieces is 3.

#include <stdio.h>

unsigned min(unsigned a, unsigned b) {
	return a < b ? a : b;
}

int main(int argc, char* argv[]) {
	unsigned n, a, b, t, x, y;

	scanf("%d %d %d", &n, &a, &b);

	t = a + b;
	x = (int)(((float)a / t) * n);
	y = n - x;

	if (x == 0 || (y > 1 && a%t != 0 && min(a/(x+1), b/(y-1)) > min(a/x, b/y))) {
		x++;
		y--;
	}

	if (a/x < b/y)
		printf("%d", a / x);
	else
		printf("%d", b / y);

	return 0;
}

#include <stdio.h>

int main()
{
   int a,b,n,flag,ans=0,x,y;
   scanf("%d%d%d",&n,&a,&b);
      for(int p=1;p<n;p++)
    {
        if(p<=a&&n-p<=b)
        {
            x=a/p;
            y=b/(n-p);
            if(x>y)
                flag=y;
            else
                flag=x;

             if(flag>ans)
                ans=flag;
        }
    }

   printf("%d",ans);
    return 0;
}

#include<stdio.h>

int main()
{
    int i, j, k, temp, min;
    int n, m, a, b;
    scanf("%d %d %d", &n , &a, &b);
    if(a>b)
    {
        temp=a;
        a=b;
        b=temp;
    }
    m=0;
    for(i=1; i<=n-1; i++)
    {
        j=a/i;
        k=b/(n-i);
        if(j>=1 && k>=1)
        {
            if(j<k)
            {
                min=j;
            }
            else
            {
                min=k;
            }
            if(m<min)
            {
                m=min;
            }
        }
    }
    printf("%d\n", m);
    return 0;
}

#include<stdio.h>
int main()
{
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);
	int i,ans=0;
	if(n==a+b)
		ans=1;
	else
		for(i=1;i<n;i++){
			int min=a/i;
			if((b/(n-i))<min)
				min=b/(n-i);
			if(min>ans)
				ans=min;
			// printf("a:%d b:%d ans:%d\n",a/i,b/(n-i),ans);
		}
	printf("%d\n",ans);
	return 0;
}

#include<stdio.h>

int main()
{
    int a,b,n,i,j,tempa,tempb,flag=0,temp;
    scanf("%d %d %d",&n,&a,&b);
    i=1;
    while(1)
    {
        tempa=a;
        tempb=b;
        j=0;
        if(((a-i)<0)||((b-i)<0))
        {
            flag=-1;
        }
        while(j<n && flag==0)
        {
            if((tempa-i)>=0)
                tempa=tempa-i;
            else if((tempb-i)>=0)
                tempb=tempb-i;
            else
            {
                flag=-1;
                break;
            }
            j++;
        }
        if(flag==-1)
            break;
        i++;
    }
    printf("%d",i-1);
    return 0;
}

#include<stdio.h>
int min(int a,int b){
	return a>b?b:a;
}
int max(int a,int b){
	return a<b?b:a;
}
int main(void){
	int n,a,b,ans=0;
	scanf("%d%d%d",&n,&a,&b);
	for(int i=1;i<n;i++){
		if(i<=a&&n-i<=b)
			ans=max(ans,min(a/i,b/(n-i)));
	}
	printf("%d",ans);
	return 0;
}

#include <stdio.h>
#include <stdlib.h>

int main()
{
  int a,b,n,c,d,t,g,h,i,j,min=0;
  scanf("%d%d%d",&n,&a,&b);
  if (a>b) {t=a;a=b;b=t;}
  c=b-a;
  d=b+a;
  if (d<2*n) {printf("1");return 0;}
  for (i=1;i<=n-1;i++)
  {
      j=n-i;
      g=b/i;
      h=a/j;
      if (g>h) g=h;
      if (g>min) min=g;
  }
  printf("%d",min);
  return 0;
}

#include<stdio.h>
int max(int u,int w)
 {
  if(u>w)
return u;
 else
 return w; }
int min(int u,int w)
 { if(u>w)
   return w;
 else
return u; }
int main()
 { int i,a,b,n,x,t1;
 scanf("%d",&n);
 scanf("%d",&a);
 scanf("%d",&b);
 x=0;
t1=0;
      for(i=n-1;i>=1;i--)
          {
     t1=min(a/i,b/(n-i) );
            x=max(x,t1); }
  printf("%d",x);
    return 0; }

#include<stdio.h>

int main()
{
    int n,a,b;
    scanf("%d",&n);
    scanf("%d",&a);
    scanf("%d",&b);

    int Max=0;
    int Min=105;

    int x1,x2;
    int d1,d2;

    for(x1=n-1;x1>0;x1--)
    {
        x2=n-x1;

        d1=a/x1;
        d2=b/x2;

        if(d1<d2)
            Min=d1;
        else
            Min=d2;

        if(Min>Max)
            Max=Min;
    }

    printf("%d",Max);

}

#include<stdio.h>
int temp[300],a[300];
void merge(int l,int r)
{
    if(l==r)
        return;
    int i,j,k,mid;
    mid=(l+r)/2 ;
    merge(l,mid ) ;
    merge(mid+1,r) ;
    for(i=l,j=mid+1,k=l; k<=r; k++)
    {
        if(i==mid+1)
        {
            temp[k]=a[j] ;
            j++;
        }
        else if(j==r+1)
        {
            temp[k]=a[i] ;
            i++ ;
        }
        else if(a[i]<=a[j])
        {
            temp[k]=a[i] ;
            i++ ;
        }
        else
        {
            temp[k]=a[j] ;
            j++ ;
        }
    }
    for(i=l; i<=r; i++)
        a[i]=temp[i] ;
}
int main()
{
    int n,c,b,i,d1,d2 ;
    scanf("%d%d%d",&n,&c,&b) ;
    i=1 ;
    while(n-i>0)
    {
        d1=c/i;
        d2=b/(n-i) ;
        if(d1<=d2)
            a[i]=d1 ;
        else
            a[i]=d2 ;
        i++;
    }
    merge(1,n-1);
    printf("%d",a[n-1]);

    return 0 ;
}

#include<stdio.h>

int main()
{
	int n, a, b;
	while (~scanf("%d %d %d", &n, &a, &b))
	{
		int num[200];
		for (int i = 1; i <= n - 1; i++)
		{
			num[i] = (a / i) < (b / (n - i)) ? (a / i) : (b / (n - i));
		}
		int max = num[1];
		for (int i = 1; i <= n - 1; i++)
		{
			if (max < num[i])
				max = num[i];
		}
		printf("%d\n", max);
	}
	return 0;
}

#include<stdio.h>
int min1[10005],min[5];
int main()
{
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);
	int i,j,quo,m,l=0,k,ans,temp;
	if(a>b)
	{
		temp=a;
		a=b;
		b=temp;
	}
	for(i=1;i<=a;i++)
	{
		for(j=i;j<=b;j++)
		{
			quo=(a/i)+(b/j);
//			printf("%d %d %d :",i,j,quo);
			if(quo>=n)
			{
				min[0]=i;
				min[1]=j;
				min[2]=i+a%i;
				min[3]=j+b%j;
				m=min[0];
				for(k=0;k<4;k++)
				{
		//			printf("%d ",min[k]);
					if(m>min[k])
						m=min[k];
				}
		//		printf(":");
				if(m!=0)
				min1[l++]=m;
			}
		}
	}//printf("\n");
	ans=min1[0];
	for(i=0;i<l;i++)
	{
//		utput
	//	printf("%d ",min1[i]);
		if(ans<min1[i])
			ans=min1[i];
	}
	printf("%d\n",ans);
	return 0;
}

#include<stdio.h>
int main()
{
    int n,a,b,count=1,max,d,e;
    scanf("%d %d %d",&n,&a,&b);
    max=(a+b)/n;
    while(count&&max)
    {
        d=a/max;
        e=b/max;
        if(d!=0&&e!=0)
        {
            if((d+e)>=n)
            {

                count=0;
                printf("%d",max);
            }
            else{
                max=max-1;
            }
        }

        else
        {
            max=max-1;
        }
    }
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
#include <math.h>
int main()
{
    int n,a,b,i=1;
    scanf("%d %d %d",&n,&a,&b);
    while(i<=a && i<=b){
        if(a/i + b/i >=n){
            i++;
        }
        else break;
    }
    printf("%d",i-1);
    return 0;
}

#include<stdio.h>
#include<limits.h>
#include<math.h>

int min(double a,double b){
    if(a<b){
        return (int)a;
    }
    else{
        return (int)b;
    }
}

int main(){
    int n;
    scanf("%d",&n);
    int a,b;
    //double max=0;
    double x,m;
    double j,k;

    int max=0;
    scanf("%d",&a);
    scanf("%d",&b);
    for(int i=1;i<min(a,b)+1;i++){
        k=(double)floor((double)min(a,b)/i);
        j=(double)floor((double)(a+b-min(a,b))/(n-i));
        m=min(k,j);
        if(m>max){
            max=m;
        }
    }max=(int)floor(max);
    printf("%d",max);

}

#include <stdio.h>
int min(int a,int b){return (a<b)?a:b;}
int main()
{
    int n,a,b;
    scanf("%d%d%d",&n,&a,&b);
    int low=1;
    int high=min((a+b+n-1)/n,min(a,b));
    int ans=0;
    while(low<=high)
    {
        int mid=(low+high)/2;
        if(a/mid+b/mid>=n)
        {
            if(mid+1>min(a,b) || a/(mid+1)+b/(mid+1)<n) {ans=mid;break;}
            low=mid+1;
        }
        else
            high=mid-1;
    }
    printf("%d\n",ans);
    return 0;
}

#include<stdio.h>
int main()
{
    int i,j,a,b,n;
    scanf("%d %d %d",&n,&a,&b);
    int max = (a+b)/n,res = 0;
    for(i=max;i>0;i--)
    {
        for(j=1;j<=n-1;j++)
        {
            if(i*j<=a&&i*(n-j)<=b)
            {
                res = i;
                printf("%d",res);
                break;
            }
        }
        if(res!=0)
            break;
    }
    return 0;
}

#include<stdio.h>

int min(int a,int b)
{
	return (a<b)?(a):(b);
}

int max(int a,int b)
{
	return (a>b)?(a):(b);
}

int main()
{
	int n,a,b;

	scanf("%d%d%d",&n,&a,&b);

	int i,j,k,ans=-10000000;

	for(i=1;i<n;i++)
	{
		j=i;k=n-i;
		if(j<=a && k<=b)
		{
			int tmp=min(b/k,a/j);
			ans=max(ans,tmp);
		}
	}

	printf("%d\n",ans);

	return 0;
}

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
void main()
{
int n,a,b,i,k1,k2,k3,max;max=0;
scanf("%d %d %d",&n,&a,&b);

for(i=1;i<n;i++)
{
k1=floor(a/i);
k2=floor(b/(n-i));

k3=k1<k2?k1:k2;

if(k3>max)
max=k3;
}

printf("%d\n",max);
exit(0);
}

#include <stdio.h>
#include <stdlib.h>

int main()
{ int n,a,b,i,p,q;
   scanf("%d%d%d",&n,&a,&b);
   for(i=1;(a/i+b/i>=n)&&((a/i>=1)&&(b/i>=1));i++)
   {
       continue;

   }
   printf("%d",i-1);

}

#include<stdio.h>
int main()
{
int n,a,b,i,c=0,count=0,count2=0;
int answer1=0,answer2=0;
int x;
scanf("%d %d %d",&n,&a,&b);
if(n==a+b)
{
    printf("1");
}
else if(n<a+b)
{
    if(a<=b)
        count=a;
    else count=b;
    x=count;
   for(i=1;i<n;i++)
   {
       count=x/i;
       if((a+b-x)/(n-i)>=count)
       {
        answer1=count;
        break;
       }
   }

   if(a>=b)
    count=a;
   else count=b;
   x=count;
   for(i=1;i<n;i++)
   {
       count=x/i;
       if((a+b-x)/(n-i)>=count)
       {
        answer2=count;
        break;
       }
   }

    if(answer1>answer2)
    printf("%d",answer1);
    else printf("%d",answer2);

}

}

#include<stdio.h>
int check(int z, int n, int a, int b);

int main(){

    int n, a, b;
    scanf("%d %d %d", &n, &a, &b);

    if(n == a + b){
        printf("%d\n", 1);
        return 0;
    }

    int answer;
    int z = (n * a)/(a + b);

    if(z == 0)
        z = 1;

    else if(z >= n - 1){
        z = n - 1;
    } else {

         answer = check(z, n, a, b);

         if(answer < check(z + 1, n, a, b))
            answer = check(z + 1, n, a, b);

         printf("%d\n", answer);
         return 0;
    }

    if(a/z <= b/(n - z))
        answer = a/z;
    else
        answer = b/(n - z);

    printf("%d\n", answer);
}

int check(int z, int n, int a, int b){
    int answer;
    if(a/z <= b/(n - z))
        answer = a/z;
    else
        answer = b/(n - z);

    return answer;
}

#include <stdio.h>

#define MIN(a, b) (a<b? a: b)

int main(){
	int n, a, b;
	scanf("%d %d %d", &n, &a, &b);
	int r = MIN(a, b), l = 1;
	while (l <= r){
		int mid = (l + r) >> 1;

		int _a = a / mid, _b = b / mid;
		if (_a + _b >= n) l = mid+1;
		else r = mid-1;
	}
	printf("%d\n", r);
	return 0;
}

#include <stdio.h>

static inline int min(int a, int b) { return a < b ? a : b; }
static inline int max(int a, int b) { return a > b ? a : b; }

int main() {
    int N,A,B; scanf("%d %d %d\n", &N, &A, &B);
    int maxv = 0;
    for(int i = 1, in = N ; i < in ; ++i) {
        const int aq = A / i, bq = B / (N-i);
        maxv = max(maxv, min(aq,bq));
    }
    printf("%d\n", maxv);
    return 0;
}

#include<stdio.h>
//#include<string.h>
int main()
{
    int n,a,b,x,i;
    scanf("%d %d %d",&n,&a,&b);
    x=(a+b)/n;
    if(x>a)
    x=a;
    if(x>b)
    x=b;
    while(1)
    {
        i=(a/x)+(b/x);
        if(i>=n)
        {
            printf("%d\n",x);
            return 0;
        }
        x--;
    }
    return 0;
}

#include<stdio.h>
int maxn(int a,int b){return a>b?a:b;}
int minn(int a,int b){return a<b?a:b;}
int main()
{
  int n,a,b,max,min;
  scanf("%d%d%d",&n,&a,&b);
  if(a > b)
  {
    int temp = a;
    a = b;
    b = temp;
  }
  max = n>a?a:n-1;
  int t = -1;
  for(int i = max;i>=1;i--)
  {
    min = minn(a/i,b/(n-i));
    if(min > t) t = min;
  }
  printf("%d\n",t);
}

#include <stdio.h>
#include<math.h>
main()
{
float  n,a,b,k,x,y,z;
scanf("%f %f %f",&n,&a,&b);
y=floorf(n*(b)/(a+b));
z=floorf(n*(a)/(a+b));
if(y==0) y=1;
if(z==0) z=1;
if(floorf((b)/y)>=floorf((a)/ceilf(n*(a)/(a+b)))) k=floorf((a)/ceilf(n*(a)/(a+b)));
else k=floorf((b)/y);
if(floorf((a)/z)>=floorf((b)/ceilf(n*(b)/(a+b)))) x=floorf((b)/ceilf(n*(b)/(a+b)));
else x=floorf((a)/z);
if(x<k) x=k;
printf("%.0f",x);
}

#include <stdio.h>

int min(int x,int y)
{
	return x < y ? x : y;
}

int max(int x,int y)
{
	return x > y ? x : y;
}

int main()
{
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);

	 int x,maxn = 1;
	 for (int i = 1; i < n; i++)
	 {
	 	x = min(a/i,b/(n-i));
	 	if (i*x <= a && (n-i)*x <= b)
	 	{
	 		maxn = max(maxn,x);
		}
	 }
	 printf("%d",maxn);

	return 0;
}

#include<stdio.h>
int min(int a,int b)
{
	if (a<b) return a;
	else
	return b;
}
int main()
{
	int c,d,i,k,n,a,b;
	scanf("%d%d%d",&n,&a,&b);
	k=min(a,b);
	for (i=k;i>=1;i--)
	{
		if (n<=(a/i+b/i)) break;

	}
	printf("%d\n",i);
	return 0;

}

#include<stdio.h>

int main()
{
    int i, j, k, temp, min;
    int n, m, a, b;
    scanf("%d %d %d", &n , &a, &b);
    if(a>b)
    {
        temp=a;
        a=b;
        b=temp;
    }
    m=0;
    for(i=1; i<=n-1; i++)
    {
        j=a/i;
        k=b/(n-i);
        if(j>=1 && k>=1)
        {
            if(j<k)
            {
                min=j;
            }
            else
            {
                min=k;
            }
            if(m<min)
            {
                m=min;
            }
        }
    }
    printf("%d\n", m);
    return 0;
}

#include<stdio.h>
int main()
{
int n,a,b;
scanf("%d %d %d",&n,&a,&b);
int i,j,c=(a+b)/n,ans=0;
for(i=c;i>0;i--)
{
for(j=1;j<=n-1;j++)
{
if(i*(n-j)<=b && i*j<=a)
{
ans=i;
printf("%d",ans);
break;
}
}
if(ans!=0)
break;
}
return 0;
}

#include <stdio.h>

int min (int a, int b)
{
	if (a<b)
		return a;
	else
		return b;
}

int main (void)
{
	int n, a, b, max=0;
	scanf ("%d %d %d", &n, &a, &b);

	int i;
	for (i=1 ; i<n ; i++)
	{
		if (max < min((a/i), (b/(n-i))))
			max=min((a/i), (b/(n-i)));
	}

	printf("%d", max);

	return 0;
}

#include <stdio.h>

int main(){
  int a,b,n,c,d, i = 1;
  scanf("%d%d%d",&n,&a,&b);
  while(1){
    c = a/i;
    d = b/i;
    if(c+d >= n){
      i++;
    }else
      break;
  }
  i--;
  if(i > a)
    i = a;
  if(i > b)
    i = b;
  printf("%d\n",i);

  return 0;
}

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define mini(x,y) (x)<(y)?(x):(y)
#define maxi(x,y) (x)>(y)?(x):(y)
int main()
{
	int n,a,b;
	scanf("%d %d %d",&n,&a,&b);
	int i,j,k;
	k=1;
	int min=987654321,max=0;
	for(i=1;i<=n-1;i++)
	{
		int loc1=a/i,loc2=b/(n-i);
		max=maxi(max,mini(loc1,loc2));
	}
	printf("%d\n",max);
}

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int  m,n,k,q,i;
    scanf("%d %d %d",&k,&m,&n);
    int max=m<n?m:n;
    for(i=max;i>=1;i--)
    {
        int l=m/i+n/i;
        if(l>=k)
        {
            q=i;
            break;
        }
    }
    printf("%d\n",q);
    return 0;
}

#include <stdio.h>

int min(int a, int b)
{
    return a<b?a:b;
}

int main()
{
    int n, a, b, i;
    scanf("%d %d %d", &n, &a, &b);
    int max = -1;
    for(i = 1; i < n; i++)
	if(min(a/i, b/(n - i)) > max)
	    max = min(a/i, b/(n - i));
    printf("%d\n", max);
}

#include <stdio.h>

int main()
{
    int n, a, b, ans = 0;
    scanf("%d %d %d", &n, &a, &b);
    for(int i = 1; i <= n - 1; ++i) {
        if(a >= i && b >= n - i) {
            int cur = a / i;
            if(cur > b / (n - i)) {
                cur = b / (n - i);
            }
            if(ans < cur) {
                ans = cur;
            }
        }
    }
    printf("%d\n", ans);
    return 0;
}

#include <stdio.h>

int main()
{
	int n,a,b,x,y,z,i,ans;

	scanf("%d%d%d", &n, &a, &b);
	ans = 0;
	for (i = 1; i< n; i++)
	{
		 x = a / i;
		 y = b / (n - i);
		 z = x < y ? x : y;

		if (ans < z)
			ans = z;
	}
	printf("%d\n", ans);
	return 0;
}

#include<stdio.h>
int main()
{
	int n, a, b, s, t, i, max=0;
	scanf("%d", &n);
	scanf("%d%d", &a, &b);
	for(i=0;i<n-1;i++)
	{
		s = (int)(a/(i+1));
		t = (int)(b/(n-i-1));
		if(s>t)
			if(t>max)
				max = t;
		if(s<=t)
			if(s>max)
				max = s;
	}
	printf("%d", max);
	return 0;
}

#include<stdio.h>
int main()
{
   int n,a,b,min=0,k,c,i;
   scanf("%d%d%d",&n,&a,&b);
   if(n==(a+b))
    printf("1");
   else
   for(i=1;i<n;i++)
   {
       k=a/i;
       c=b/(n-i);
       if(k>c)
       {
           if(c>min)
           {
               min=c;
           }
       }
           else
           {
               if(k>min)
                min=k;
           }
   }
   if(min!=0)
   printf("%d",min);
   return 0;
}

#include <stdio.h>
int min(int x, int y)
{
    if(x <= y) return x;
    else return y;
}
int main()
{
    int n, a, b, s, l, p, i, x_max;
    scanf("%d %d %d", &n, &a, &b);
    int len=n/2 -1;
    int x[len];
    if(a >= b)
    {
        l = a;
        s = b;
    }
    else
    {
        l = b;
        s = a;
    }
    for(p=1; p <= n/2; p++) x[p-1] = min(s/p, l/(n-p));
    x_max = x[0];
    for(i=1; i<= len; i++) if(x[i] >= x_max) x_max = x[i];
    printf("%d\n", x_max);
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int min(int a,int b)
{
    if(a<b)
        return a;
    else return b;
}
int max(int a,int b)
{
    if(a>b)
        return a;
    else return b;

}
int n, a, b;

 int main()
 {
     scanf("%d%d%d",&n,&a,&b);
         int ans = 0;
         if (n == a + b) ans = 1;
         else {
             for (int i = 1; i < n; i++)
                ans = max(ans, min(a / i, b / (n - i)));
         }
         printf("%d",ans);

 return 0;
}

#include<stdio.h>
int main()
{
    int n,a,b,count=1,max,d,e;
    scanf("%d %d %d",&n,&a,&b);
    max=(a+b)/n;
    while(count&&max)
    {
        d=a/max;
        e=b/max;
        if(d!=0&&e!=0)
        {
            if((d+e)>=n)
            {

                count=0;
                printf("%d",max);
            }
            else{
                max=max-1;
            }
        }

        else
        {
            max=max-1;
        }
    }
}

/* Coached by rainboy */
#include <stdio.h>

int main() {
	int n, a, b, i, max;

	scanf("%d%d%d", &n, &a, &b);
	max = 0;
	for (i = 1; i < n; i++) {
		int x, y, h;

		x = a / i;
		y = b / (n - i);
		h = (x < y ? x : y);
		if (max < h)
			max = h;
	}
	printf("%d\n", max);
	return 0;
}

#include<stdio.h>

int check(int n,int a,int b,int x){

	int i;

	if((a<x)||(b<x))
		return 0;

	int flag=1;
	for(i=1;i<=n;i++){

		if((a==0)&&(b==0)){
			flag=0;
			break;
		}

		if(a>0){
			if(a<2*x)
				a=0;
			else
				a-=x;
		}
		else{
			if(b<2*x)
				b=0;
			else
				b-=x;
		}
	}

	return flag;
}

int main(){

int n,a,b;

scanf("%d %d %d",&n,&a,&b);

int l=1;
int r=101;
int mid;
	while(l<=r){

		mid=(l+r)/2;
		//if((mid==l)&&(check(n,a,b,mid)==1))
		//	break;

		if(check(n,a,b,mid)==1)
			l=mid+1;
		else
			r=mid-1;
	}

	printf("%d\n",r);
return 0;
}

#include <stdio.h>
int main()
{
	int n, a, b, i;
	scanf("%d%d%d", &n, &a, &b);
	for (i = 100;; --i)
		if (a >= i && b >= i && a / i + b / i >= n)
			break;
	printf("%d", i);
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
#include <math.h>
int main()
{
    int n,a,b,i=1;
    scanf("%d %d %d",&n,&a,&b);
    while(i<=a && i<=b){
        if(a/i + b/i >=n){
            i++;
        }
        else break;
    }
    printf("%d",i-1);
    return 0;
}

#include<stdio.h>
int min(int a,int b){
	return a>b?b:a;
}
int main(void){
	int n,a,b,x,y,max,min_;
	while(scanf("%d %d %d",&n,&a,&b)!=EOF){
		max=0;
		for(int i=1;i<n;i++){
			x=a/i;
			y=b/(n-i);
			min_=min(x,y);
			if(min_>max){
				max=min_;
			}
		}
		printf("%d\n",max);
	}
	return 0;
}

#include <stdio.h>

int min (int a, int b);

int main(){
	int n,a,b,x,y,i,thiso;
	scanf("%d%d%d",&n,&a,&b);
	int max = 0;
	for(i=1;i<=n-1;i++){
		x = i;
		y = n-i;
		if(x!=0 &&y!=0)
			thiso = min(a/x, b/y);
		else if(y!=0)
			thiso = b/y;
		else if(x!=0)
			thiso = a/x;
		if(thiso>max){
			max = thiso;
		}
	}
	printf("%d\n", max);
}

int min (int a, int b){
	if(a>b)
	return b;
	else
	return a;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int cmp(const void *a, const void *b)
{
	return *(int *)a - *(int *)b;
}

int min(int a,int b)
{
	if(a<b)
		return a;
	else
		return b;
}

int max(int a,int b)
{
	if(a>b)
		return a;
	else
		return b;
}
int main()
{
	int i,n,a,b,ans=1;
	scanf("%d%d%d",&n,&a,&b);
	for(i=1;i<n;i++)
	{
		ans=max(ans,min(a/i,b/(n-i)));
	}
	printf("%d\n",ans);
	return 0;
}

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
    int i,j,n,a,b;
    int C[200];
    scanf("%d%d%d",&n,&a,&b);
    for(i=1;i<n;++i)//��������
    {
        int ma = a/i;
        int na = b/(n-i);
        C[i-1] = (ma<na)? ma:na;
    }
    int max = C[0];
    //printf("%d",C[0]);
    for(i=1;i<n-1;++i)
    {
        //printf(" %d",C[i]);
        if(C[i] > max)
        {
            max = C[i];
        }
    }
    //printf("\n");
    printf("%d\n",max);
    return 0;
}

#include<stdio.h>

int min(int a,int b)
{
	return (a<b)?(a):(b);
}

int max(int a,int b)
{
	return (a>b)?(a):(b);
}

int main()
{
	int n,a,b;

	scanf("%d%d%d",&n,&a,&b);

	int i,j,k,ans=-10000000;

	for(i=1;i<n;i++)
	{
		j=i;k=n-i;
		if(j<=a && k<=b)
		{
			int tmp=min(b/k,a/j);
			ans=max(ans,tmp);
		}
	}

	printf("%d\n",ans);

	return 0;
}

#include <stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
long long cmpfunc (const void * a, const void * b) {
   return ( *(long long*)a - *(long long*)b );
}

int main(void){

long long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,x,m,l,max,sum2,min,f,c,r,o,sum1,sum=0,y,a,b,count1=0,a2,b2;

scanf("%lld%lld%lld",&n,&a,&b);
max=f=x=y=0;
for(i=1;i<n;i++){
    x=a/i;
    y=b/(n-i);
    if(x>y){
        f=y;
    }else{

            f=x;

    }
    if(f>max){
        max=f;
    }
}
printf("%lld",max);
return 0;
}

#include <stdio.h>
int n, a, b;

int plates(int x)
{
    if(!(a / x)) return 0;
    if(!(b / x)) return 0;
    return a / x + b / x;
}

int main()
{
    int x;
    scanf("%d%d%d", &n, &a, &b);
    for(x = 1; x <= a + b; ++x)
        if(plates(x) < n) break;
    printf("%d\n", x - 1);
    return 0;
}

#include <stdio.h>
#include <stdlib.h>

int main()
{
	int a,b,n;
	int i,j;
	int max = 1;
	int t1,t2;

	scanf("%d %d %d",&n,&a,&b);

	for (i=1;i<=a;i++)
	{
		if (i+b<n) continue;
		j=n-i;
		if (j==0) continue;
		t1 = a/i;
		t2 = b/j;
		if (t1<t2) { if (t1>max) max=t1; }
		else { if (t2>max) max=t2; }
	}
	printf("%d\n",max);
	return 0;
}

//KRV Template
#include<stdio.h>
#include<string.h>
#include<math.h>
void swap(int *xp, int *yp)
{
    int temp = *xp;
    *xp = *yp;
    *yp = temp;
}
//BTW l,r are indices
void bubblesort(int arr[] , int l , int r)
{
    int i,j,temp=0;
    for(int i = l ; i<=r ; i++)
    {
    	for(int j = l ; j<r-temp ; j++)
    	{
    		if(arr[j]>arr[j+1])
    		{
    			swap(&arr[j],&arr[j+1]);
    		}
    	}
    	temp++;
    }
}
void rbubblesort(int arr[] , int l , int r)
{
    int i,j,temp=0;
    for(int i = l ; i<=r ; i++)
    {
    	for(int j = l ; j<r-temp ; j++)
    	{
    		if(arr[j]<arr[j+1])
    		{
    			swap(&arr[j],&arr[j+1]);
    		}
    	}
    	temp++;
    }
}
int maxinarray(int arr[] , int l , int r)
{
	int ans = arr[0];
	for(int i = l ; i<r ; i++)
	{
        if(arr[i+1]>=arr[i])
        {
        	ans = arr[i+1];
        }
	}
	return ans;
}
int mininarray(int arr[] , int l , int r)
{
	int ans = arr[0];
	for(int i = l ; i<r ; i++)
	{
		if(arr[i+1]<=arr[i])
		{
			ans = arr[i+1];
		}
	}
	return ans;
}
int main()
{
	//The actual part is here!!
    int n,a,b;
    scanf("%d %d %d",&n,&a,&b);
    int mm = (a+b)/n;
    for(int i = mm ; i>0 ; i--)
    {
        int y = a/i ;
        int z = b/i ;
        if( y+z >= n && a>=i && b>=i)
        {
            printf("%d",i);
            return 0;
        }
    }
}

#include <stdio.h>

int main()
{
   int a,b,n,flag,ans=0,x,y;
   scanf("%d%d%d",&n,&a,&b);
      for(int p=1;p<n;p++)
    {
        if(p<=a&&n-p<=b)
        {
            x=a/p;
            y=b/(n-p);
            if(x>y)
                flag=y;
            else
                flag=x;

             if(flag>ans)
                ans=flag;
        }
    }

   printf("%d",ans);
    return 0;
}

#include <stdio.h>

int main()
{
    int n, a, b, ans = 0;
    scanf("%d %d %d", &n, &a, &b);
    for(int i = 1; i <= n - 1; ++i) {
        if(a >= i && b >= n - i) {
            int cur = a / i;
            if(cur > b / (n - i)) {
                cur = b / (n - i);
            }
            if(ans < cur) {
                ans = cur;
            }
        }
    }
    printf("%d\n", ans);
    return 0;
}

#include <stdio.h>
int m(int a,int b,int k)
{
    int ar[3];
    ar[0]=a;
    ar[1]=b;
    ar[2]=k;

  int  min=a;

    int i;

    for(i=0;i<3;i++)
      {
          if(ar[i]<min)
             min=ar[i];

      }

  return min;

}

int main() {
int n,a,b;

scanf("%d %d %d",&n,&a,&b);

int k=(a+b)/n;

int r=(a+b)&n;

int min=m(a,b,k);

if(min==a)
{

    printf("%d",a);
    return 0;
}
if(min==b)
{

    printf("%d",b);
    return 0;
}

int i;
for(i=k;i>0;i--)
{
    if(((a/i)+(b/i))>=n)
      {
          printf("%d",i);
          break;

      }

}

	return 0;
}

#include<stdio.h>
int main(int argc, char const *argv[])
{
	int n,x,y;
	scanf("%d",&n);
	scanf("%d",&x);
	scanf("%d",&y);
	int max = 0,val;
	for(int i = 1;i<n;i++)
	{
		 val = x/i;
		if(val > y/(n-i))
			val = y/(n-i);
		if(max<val)
			max = val;
	}
	printf("%d\n",max);
	return 0;
}

#include <stdio.h>

int main(){
  int a,b,n,c,d, i = 1;
  scanf("%d%d%d",&n,&a,&b);
  while(1){
    c = a/i;
    d = b/i;
    if(c+d >= n){
      i++;
    }else
      break;
  }
  i--;
  if(i > a)
    i = a;
  if(i > b)
    i = b;
  printf("%d\n",i);

  return 0;
}

#include <stdio.h>

int main(int argc, char** argv) {
    int i, n, m, a, b;

    scanf("%d%d%d", &n, &a, &b);
    for (i = 1000; i; i--) {
        m = a / i + b / i;
        if (m >= n && i <= a && i <= b) {
            printf("%d\n", i);
            break;
        }
    }

    return 0;
}

#include <stdio.h>

int main() {
	int n, a, b;
	int x;

	scanf("%d %d %d", &n, &a, &b);

	for (x = 1; x <= a && x <= b && (a / x + b / x >= n); ++x);
	printf("%d", x - 1);

}

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int  m,n,k,q,i;
    scanf("%d %d %d",&k,&m,&n);
    int max=m<n?m:n;
    for(i=max;i>=1;i--)
    {
        int l=m/i+n/i;
        if(l>=k)
        {
            q=i;
            break;
        }
    }
    printf("%d\n",q);
    return 0;
}

#include <stdio.h>
#define max(a,b) a>=b ? a : b
#define min(a,b) a>=b ? b : a
int main()
{
	int n,a,b;
	scanf("%d %d %d",&n,&a,&b);
	int i,c,d=0;
	for(i=1;i<n;i++)
	{
		c=min(a/i,b/(n-i));
		d=max(c,d);
	}
	printf("%d\n",d);
	return 0;
}

#include<stdio.h>
int min(int a,int b){
	return a>b?b:a;
}
int max(int a,int b){
	return a<b?b:a;
}
int main(void){
	int n,a,b,ans=0;
	scanf("%d%d%d",&n,&a,&b);
	for(int i=1;i<n;i++){
		if(i<=a&&n-i<=b)
			ans=max(ans,min(a/i,b/(n-i)));
	}
	printf("%d",ans);
	return 0;
}

#include <stdio.h>
#include <stdlib.h>

int main(){
    int n,a,b,max = 0, r = 0;
    scanf("%d %d %d", &n,&a,&b);
    for(int i = 1; i < n; i++){
        if ((a/i) < (b/(n-i))) r = (a/i);
        else r = (b/(n-i));
        if ( r > max || max == 0)
            max = r;
    }
    printf("%d", max);
    return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
    int n,a,b,p,q,i,min,max=0;
    scanf("%d %d %d",&n,&a,&b);
      for(i=1;i<=n-1;i++)
      {
            p=a/i; q= b/(n-i);
            if(p<q)
            min=p;
            else
                min=q;

       if(min>max)
       { max=min;}
      }

      printf("%d",max);
      return 0;
}

#include<stdio.h>

int main(){
int n,a,b;
scanf("%d%d%d",&n,&a,&b);
int i;
int x=(a>b/(n-1))?b/(n-1):a;
for(i=2;i<n;i++){
int a1=(a/i);
int a2=b/(n-i);
int m=(a1>a2)?a2:a1;
if(m>x){
x=m;
}

}

printf("%d",x);
return 0;
}

#include <stdio.h>

int main() {
	int n, a, b, m, ans;

	scanf("%d%d%d", &n, &a, &b);
	ans = 0;
	for (m = 1; m < n; m++) {
		int x = a / m;
		int y = b / (n - m);
		int z = x < y ? x : y;

		if (ans < z)
			ans = z;
	}
	printf("%d\n", ans);
	return 0;
}

#include <stdio.h>
int main()
{
	int n, a, b, i;
	scanf("%d%d%d", &n, &a, &b);
	for (i = 100;; --i)
		if (a >= i && b >= i && a / i + b / i >= n)
			break;
	printf("%d", i);
}

#include "stdio.h"

int main()
{
	int a,b,n,i,j,min,rmin=0;
	scanf("%d%d%d",&n,&a,&b);
	for (i=1;i<=n-1;i++){
		min=(a/i)<(b/(n-i))?(a/i):(b/(n-i));
		rmin=rmin>min?rmin:min;
	}
	printf("%d\n",rmin);
	return 0;
}

#include <stdio.h>
#include<math.h>
#include<stdlib.h>
#define swap(a, b) do { tmp = a; a = b; b = tmp; } while (0)
#define min(a,b) (((a)<(b))?(a):(b))
#define max(a,b) (((a)>(b))?(a):(b))
int main()
{

    int i,j,k,tmp;
    int n,m;
    int a,b;

    scanf("%d%d%d",&n,&a,&b);

    if(a>b)
        swap(a,b);

    m=0;
    for(i=1;i<=n-1;i++)
    {
        j=a/i;
        k=b/(n-i);

        if(j>=1 && k>=1)
            m=max(m,min(j,k));
    }

    printf("%d",m);

    return 0;
}

#include <stdio.h>

int min(int a, int b)
{
    return a<b?a:b;
}

int main()
{
    int n, a, b, i;
    scanf("%d %d %d", &n, &a, &b);
    int max = -1;
    for(i = 1; i < n; i++)
	if(min(a/i, b/(n - i)) > max)
	    max = min(a/i, b/(n - i));
    printf("%d\n", max);
}

#include<stdio.h>
int main()
{
	int n, a, b, s, t, i, max=0;
	scanf("%d", &n);
	scanf("%d%d", &a, &b);
	for(i=0;i<n-1;i++)
	{
		s = (int)(a/(i+1));
		t = (int)(b/(n-i-1));
		if(s>t)
			if(t>max)
				max = t;
		if(s<=t)
			if(s>max)
				max = s;
	}
	printf("%d", max);
	return 0;
}

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int n, a, b, max;

int minOf(int x, int y);

int main() {
    scanf("%d %d %d", &n, &a, &b);

    max = minOf(a/1, b/(n-1));
    int curr;
    for(int ca=2; ca<n; ca++) {
        curr = minOf( a/ca, b/(n-ca) );
        if(curr > max)
            max = curr;
    }

    printf("%d\n", max);
return 0;
}

int minOf(int x, int y) {
    if(x<y)
        return x;
    else
        return y;
}

#include <stdio.h>
#include <stdlib.h>

int main()
{
    unsigned short n, a, b;
    fscanf( stdin , "%hu %hu %hu" , &n , &a , &b );

    unsigned short x = 1;
    unsigned short y = 1;

    for(int i = 1;i < (n + 1) / 2;i++)
    {
        y = a / i < b / (n - i) ? a / i : b / (n - i);
        if(x < y)
            x = y;
    }
    printf("%hu\n" , x );

    return 0;
}

/*
B. Two Cakes

time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output
It's New Year's Eve soon, so Ivan decided it's high time he started setting the table. Ivan has bought two cakes and cut them into pieces: the first cake has been cut into a pieces, and the second one — into b pieces.

Ivan knows that there will be n people at the celebration (including himself), so Ivan has set n plates for the cakes. Now he is thinking about how to distribute the cakes between the plates. Ivan wants to do it in such a way that all following conditions are met:

Each piece of each cake is put on some plate;
Each plate contains at least one piece of cake;
No plate contains pieces of both cakes.
To make his guests happy, Ivan wants to distribute the cakes in such a way that the minimum number of pieces on the plate is maximized. Formally, Ivan wants to know the maximum possible number x such that he can distribute the cakes according to the aforementioned conditions, and each plate will contain at least x pieces of cake.

Help Ivan to calculate this number x!

Input
The first line contains three integers n, a and b (1 ≤ a, b ≤ 100, 2 ≤ n ≤ a + b) — the number of plates, the number of pieces of the first cake, and the number of pieces of the second cake, respectively.

Output
Print the maximum possible number x such that Ivan can distribute the cake in such a way that each plate will contain at least x pieces of cake.
*/
/*
Examples

input
5 2 3
output
1

input
4 7 10
output
3

Note
In the first example there is only one way to distribute cakes to plates, all of them will have 1 cake on it.

In the second example you can have two plates with 3 and 4 pieces of the first cake and two plates both with 5 pieces of the second cake. Minimal number of pieces is 3.
*/

#include <stdio.h>
#include <stdlib.h>

int max(int, int);
int min(int, int);

int main()
{
	int n, a, b;
	scanf("%d%d%d", &n, &a, &b);

	int x = min(a / n - 1, b);
	for(int i = n - 2; i > 0; i--)
	{
		x = max(x, min(a / i, b / (n - i)));
	}

	printf("%d\n", x);
}

int max(int a, int b)
{
	return (a + b + abs(a - b)) / 2;
}

int min(int a, int b)
{
	return (a + b - abs(a - b)) / 2;
}

#include<stdio.h>
int min1[105],min[5];
int main()
{
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);
	int i,j,quo,m,l=0,k,ans;
	for(i=1;i<=a;i++)
	{
		for(j=i;j<=b;j++)
		{
			quo=(a/i)+(b/j);
//			printf("%d ",quo);
			if(quo>=n)
			{
				min[0]=i;
				min[1]=j;
				min[2]=a/i+a%i;
				min[3]=b/j+b%j;
				m=min[0];
				for(k=0;k<4;k++)
				{
					if(m>min[k])
						m=min[k];
				}
				if(m!=0)
				min1[l++]=m;
			}
		}
	}//printf("\n");
	ans=min1[0];
	for(i=0;i<l;i++)
	{
//		printf("%d ",min1[i]);
		if(ans<min1[i])
			ans=min1[i];
	}
	printf("%d\n",ans);
	return 0;
}

#include<stdio.h>
int main()
{
	int c,d,i,k,n,a,b;
	scanf("%d%d%d",&n,&a,&b);
	k=(a+b)/n+1;
	for (i=k;i>=1;i--)
	{
		if (n<=(a/i+b/i)) break;

	}
	printf("%d\n",i);
	return 0;

}

#include <stdio.h>

int main(){
  int a,b,n,c,d, i = 1;
  scanf("%d%d%d",&n,&a,&b);
  while(1){
    c = a/i;
    d = b/i;
    if(c+d >= n){
      i++;
    }else
      break;
  }
  i--;
  printf("%d\n",i);

  return 0;
}

#include<stdio.h>
int main()
{
int n,a,b,i,c=0,count=0;
int x;
scanf("%d %d %d",&n,&a,&b);
if(n==a+b)
{
    printf("1");
}
else if(n<a+b)
{
    if(a<=b)
        i=a;
    else i=b;
    if(i<n)
    {
        for(;(n*c)<=(a+b);c++)
        {

        }
        if(n*c>a+b)
        {
            c=c-1;
        }

        printf("%d",c);
    }
    else if(a>=n && b>=n)
    {
        c=i/(n/2);
        printf("%d",c);

    }

}

}

#include<stdio.h>
int main()
{
  int n,a,b,temp,max;
  scanf("%d%d%d",&n,&a,&b);
  if(a > b)
  {
    temp = a;
    a = b;
    b = temp;
  }
  max = (a + b)/n;
  if(max == 0)  printf("0\n");
  else if(max == 1) printf("1\n");
  else
  {
    int k = 1,i = max;
    while(i>=1)
    {
      k = (a/i)+(b/i);
      if(k <= n)  break;
      i--;
    }
    if(i > a)
      printf("%d\n",a);
    else
      printf("%d\n",i);
  }
  return 0;
}

#include <stdio.h>
#include <stdlib.h>

int main()
{ int n,a,b,i,p,q;
   scanf("%d%d%d",&n,&a,&b);
   for(i=1;i<=a+b;i++)
   {
       p=a/i;
       q=b/i;

       if((p+q<n)&&(p>=1&&q>=1))
       {
           break;
       }
        else{
            continue;
        }

   }
   printf("%d",i-1);

}

#include <stdio.h>
#include<math.h>
main()
{
float  n,a,b,k,x;
scanf("%f %f %f",&n,&a,&b);
if(floorf((a)/ceilf(n*(a)/(a+b)))>floorf((b)/floorf(n*(b)/(a+b)))) k=floorf((b)/floorf(n*(b)/(a+b)));
else k=floorf((a)/ceilf(n*(a)/(a+b)));
if(floorf((b)/ceilf(n*(b)/(a+b)))>floorf((a)/floorf(n*(a)/(a+b)))) x=floorf((a)/floorf(n*(a)/(a+b)));
else x=floorf((b)/ceilf(n*(b)/(a+b)));
if(x<k) x=k;
printf("%.0f",x);
}

#include <stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
long long cmpfunc (const void * a, const void * b) {
   return ( *(long long*)a - *(long long*)b );
}

int main(void){

long long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,x,m,l,max,sum2,min,f,c,r,o,sum1,sum=0,y,a,b,count1=0,a2,b2;

scanf("%lld%lld%lld",&n,&a,&b);
max=0;
for(i=1;i<n;i++){
    x=a/i;
    y=b/(n-i);
    if(x>f){
        f=x;
    }else{
        if(y>f){
            f=y;
        }
    }
    if(f>max){
        max=f;
    }
}
printf("%lld",max);
return 0;
}

#include<stdio.h>
int main()
{
int n,a,b,c,count=0;
int x;
scanf("%d %d %d",&n,&a,&b);
if(n=a+b)
{
    printf("1");
}
else if(n<a+b)
{
    if(a<b)
        c=n/a;
    else c=n/b;

    printf("%d",c);

}

}

#include<stdio.h>
int main()
{
	int c,d,i,k,n,a,b;
	scanf("%d%d%d",&n,&a,&b);
	k=(a+b)/n;
	for (i=k;i>=1;i--)
	{
		if (n<=(a/i+b/i)) break;

	}
	printf("%d\n",i);
	return 0;

}

#include <stdio.h>

int
main()
{
    int a, b, n;
    scanf("%d%d%d", &n, &a, &b);
    int i = 1;
    while (a / i + b / i >= n) ++i;
    printf("%d\n", i - 1);
    return 0;
}

//
//  main.c
//  Two Cakes
//
//  Created by Eric Ying on 12/29/17.
//  Copyright © 2017 Eric Ying. All rights reserved.
//

#include <stdio.h>
#include <stdbool.h>

bool too_high(int n, int a, int b, int c){
    if(n!=0 && c>a && c>b){
        return true;
    }
    else if(n==0){
        return false;
    }
    else if(c>a){
        return too_high(n-1, a, b-c, c);
    }
    else{
        return too_high(n-1, a-c, b, c);
    }
}

bool too_low(int n, int a, int b, int c){
    if(n==0 && (c<a || c<b)){
        return true;
    }
    else if(n==0){
        return false;
    }
    else if(c>a){
        return too_low(n-1, a, b-c, c);
    }
    else{
        return too_low(n-1, a-c, b, c);
    }
}

int main(int argc, const char * argv[]) {
    // insert code here...
    int n, a, b;
    scanf("%d", &n);
    scanf("%d", &a);
    scanf("%d", &b);

    if(a > b){
        int temp = b;
        b = a;
        a = temp;
    }

    int low = 1;
    int high = (a + b)/n;
    int mid = (high + low)/2;

    while(too_high(n, a, b, mid) || too_low(n, a, b, mid) || mid>a){
        if(too_high(n, a, b, mid) || mid>a){
            high = mid-1;
        }
        else if(too_low(n, a, b, mid)){
            low = mid+1;
        }
        mid = (high+low)/2;

        if(mid == low || mid == high){
            break;
        }
    }
    printf("%d\n", mid);

    return 0;
}

#include<stdio.h>
int main()
{
int n,a,b,i,c=0,count=0;
int x;
scanf("%d %d %d",&n,&a,&b);
if(n==a+b)
{
    printf("1");
}
else if(n<a+b)
{
    if(a<b)
        i=a;
    else i=b;
    if(i<n)
    {
        for(;(n*c)<=(a+b);c++)
        {

        }
        if(n*c>a+b)
        {
            c=c-1;
        }

        printf("%d",c);
    }
    else if(a>n && b>n)
    {
        c=i/(n/2);
        printf("%d",c);

    }

}

}

/*
B. Two Cakes

time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output
It's New Year's Eve soon, so Ivan decided it's high time he started setting the table. Ivan has bought two cakes and cut them into pieces: the first cake has been cut into a pieces, and the second one — into b pieces.

Ivan knows that there will be n people at the celebration (including himself), so Ivan has set n plates for the cakes. Now he is thinking about how to distribute the cakes between the plates. Ivan wants to do it in such a way that all following conditions are met:

Each piece of each cake is put on some plate;
Each plate contains at least one piece of cake;
No plate contains pieces of both cakes.
To make his guests happy, Ivan wants to distribute the cakes in such a way that the minimum number of pieces on the plate is maximized. Formally, Ivan wants to know the maximum possible number x such that he can distribute the cakes according to the aforementioned conditions, and each plate will contain at least x pieces of cake.

Help Ivan to calculate this number x!

Input
The first line contains three integers n, a and b (1 ≤ a, b ≤ 100, 2 ≤ n ≤ a + b) — the number of plates, the number of pieces of the first cake, and the number of pieces of the second cake, respectively.

Output
Print the maximum possible number x such that Ivan can distribute the cake in such a way that each plate will contain at least x pieces of cake.
*/
/*
Examples

input
5 2 3
output
1

input
4 7 10
output
3

Note
In the first example there is only one way to distribute cakes to plates, all of them will have 1 cake on it.

In the second example you can have two plates with 3 and 4 pieces of the first cake and two plates both with 5 pieces of the second cake. Minimal number of pieces is 3.
*/

#include <stdio.h>
#include <stdlib.h>

int max(int, int);
int min(int, int);

int main()
{
	int n, a, b;
	scanf("%d%d%d", &n, &a, &b);

	int x = min(a / (n - 1), b);
	for(int i = n - 2; i > 0; i--)
	{
		x = max(x, min(a / i, b / (n - i)));
	}

	printf("%d\n", 9 / 1);
	printf("%d\n", x);
}

int max(int a, int b)
{
	return (a + b + abs(a - b)) / 2;
}

int min(int a, int b)
{
	return (a + b - abs(a - b)) / 2;
}

#include<stdio.h>
int main()
{
int n,a,b,c,count=0;
int x;
scanf("%d %d %d",&n,&a,&b);
c=a+b;

if(a>n && b>n)
{
    if(a>b)
        count=b/n;
    else count=a/n;
}
else if(n>a && n>b)
{
     if(a>b)
        count=n/a;
    else count=n/b;
}
else count=(a+b)/n;

printf("%d",count);
}

#include <stdio.h>
#include <stdlib.h>

int main()
{
   int n,a,b;
   int z;
   scanf("%d  ",&n);
   scanf("%d  ",&a);
  scanf("%d  ",&b);

   if((a+b)==n) printf("1");
   else{
   z=((a+b)/n);
    while(a>=z && b>=z){
        a=a-z;
        b=b-z;
    }

     if(a>b) printf("%d",b);
     else printf("%d",a);

   }
    return 0;
}

#include<stdio.h>
int main()
{
int n,a,b,i,c=0,count=0;
int x;
scanf("%d %d %d",&n,&a,&b);
if(n==a+b)
{
    printf("1");
}
else if(n<a+b)
{
    if(a<=b)
        count=a;
    else count=b;
    x=count;
   for(i=1;i<n;i++)
   {
       count=x/i;
       if((a+b-x)/(n-i)>=count)
       {
        printf("%d",count);
        break;
       }

   }

}

}

#include <stdio.h>

int main()
{
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);

	//int miny = a < b ? a : b;
	int maxn = 0;
	int sum = 0;
	int temp,tempa,tempb;
	for (int i = 1; i <= a; i++)
	{
		for (int j = 1; j <= b; j++)
		{
			sum = a / i + b / j;
			tempa = a % i;
			tempb = b % j;
			if (tempa != 0) sum += 1;
			if (tempb != 0) sum += 1;

			if (tempa == 0) tempa = 2000;
			if (tempb == 0) tempb = 2000;

			if (sum < n) break;
			if (sum > n) continue;

			//printf("i = %d; j = %d; sum = %d\n",i,j,sum);
			if (sum == n)
			{
				temp = i < j ? i : j;
				temp = temp < tempa ? temp : tempa;
				temp = temp < tempb ? temp : tempb;
				if (temp > maxn) maxn = temp;
			}
		}
	}

	printf("%d\n",maxn);
	return 0;
}

#include <stdio.h>
#define min(a,b) (a<b?a:b)
int main()
{
    int ans=1000000;
    int n,a,b;
    scanf("%d%d%d",&n,&a,&b);
    if (n==a+b)
    {
        printf("1\n");
        return 0;
    }
    int i,k1,k2;
    for (i=1;i<n;i++)
    {
        k1=a/i+(a%i!=0);
        k2=b/(n-i)+(b%(n-i)!=0);
        ans=min(ans,min(k1,k2));
    }
    printf("%d\n",ans);
    return 0;
}

#include<stdio.h>
int main()
{int a,b,c,d,e,f,min,max,m;
while(scanf("%d%d%d",&a,&b,&c)!=EOF)
{
min=b>c?c:b;
max=b>c?b:c;
b=min;
while(1)
{m=0;
if (b==2)
{b--;continue;}
m=min/b;

if (b*(a-m)<max||b*(a-m)==max)
break;
else
{b--;
continue;}}
printf("%d\n",b);
}}

#include<stdio.h>

int main(){

    int n, a, b;
    scanf("%d %d %d", &n, &a, &b);

    if(n == a + b){
        printf("%d\n", 1);
        return 0;
    }

    int z = (float)(n * a)/(a + b) + .5;

    if(z == 0)
        z = 1;

    if(z >= n){
        z = n - 1;
    }

    int answer;
    if(a/z <= b/(n - z))
        answer = a/z;
    else
        answer = b/(n - z);

    printf("%d\n", answer);
}

#include <stdio.h>
int main()
{
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);
	int num=0,min=0;
	int i,j;
	int numa, numb;
	int temp;
	for(i=1;i<n;++i)
	{
			j=n-i;
			numa=a/i;
			numb=b/j;
			if(numa<numb)
			{
				temp=numa;
			}
			else
			{
				temp=numb;
			}
			if(temp>min)
			{
				min=temp;
			}
	}
	if(a/n>min)
		min=a/n;
	if(b/n>min)
		min=b/n;
	printf("%d\n",min);
	return 0;
}

#include<stdio.h>
int main()
{
int n,a,b,i,c=0,count=0;
int x;
scanf("%d %d %d",&n,&a,&b);
if(n==a+b)
{
    printf("1");
}
else if(n<a+b)
{
    if(a<=b)
        i=a;
    else i=b;
    if(i<n)
    {
        for(;(n*c)<=(a+b);c++)
        {

        }
        if(n*c>a+b)
        {
            c=c-1;
        }

        printf("%d",c);
    }
    else if(a>=n && b>=n)
    {
        c=i/(n/2);
        printf("%d",c);

    }

}

}

#include <stdio.h>
#include <stdlib.h>

int main(){
    int n,a,b,r;
    scanf("%d %d %d", &n,&a,&b);
    r = (a+b)/n;
    if((a-r) < (b-r) && r >= (a-r))
        printf("%d", a-r);
    else if((a-r) > (b-r) && r >= (a-r))
        printf("%d", b-r);
    else
        printf("%d", r);
    return 0;
}

#include <stdio.h>

int min (int a, int b);

int main(){
	int n,a,b,x,y,i,thiso;
	scanf("%d%d%d",&n,&a,&b);
	int max = 0;
	for(i=0;i<=n;i++){
		x = i;
		y = n-i;
		if(x!=0 &&y!=0)
			thiso = min(a/x, b/y);
		else if(y!=0)
			thiso = b/y;
		else if(x!=0)
			thiso = a/x;
		if(thiso>max){
			max = thiso;
		}
	}
	printf("%d", max);
}

int min (int a, int b){
	if(a>b)
	return b;
	else
	return a;
}

#include<stdio.h>

int main()
{
	int n, a, b;
	while (~scanf("%d %d %d", &n, &a, &b))
	{
		int t;
		if (a > b) t = a, a = b, b = a;
		if (n - 2 >= a)
		{
			printf("1\n");
			continue;
		}
		if (n == 3)
			printf("%d\n", (a + b) / 3);
		else if(n%2==0)
			printf("%d\n", a / (n /2));
		else
			printf("%d\n", a / ((n / 2)+1));

	}
	return 0;
}

#include<stdio.h>
int main()
{
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);
	int max,max1;
	if(n==1)
	{
		if(a>b)
			printf("%d",b);
		else
			printf("%d",a);
		return 0;
	}
	max=a/(n/2);
	max1=b/(n/2);
	if(max>max1)
		printf("%d ",max1);
	else
		printf("%d ",max);
	return 0;
}

#include <stdio.h>

int main()
{
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);

	int miny = a < b ? a : b;
	int maxn = 0;
	int sum = 0;
	int temp,tempa,tempb;
	for (int i = 1; i <= miny; i++)
	{
		for (int j = 1; j <= miny; j++)
		{
			sum = a / i + b / j;
			tempa = a % i;
			tempb = b % j;
			if (tempa != 0) sum += 1;
			if (tempb != 0) sum += 1;

			if (tempa == 0) tempa = 2000;
			if (tempb == 0) tempb = 2000;

			if (sum < n) break;
			if (sum > n) continue;

			//printf("i = %d; j = %d; sum = %d\n",i,j,sum);
			if (sum == n)
			{
				temp = i < j ? i : j;
				temp = temp < tempa ? temp : tempa;
				temp = temp < tempb ? temp : tempb;
				if (temp > maxn) maxn = temp;
			}
		}
	}

	printf("%d\n",maxn);
	return 0;
}

#include <stdio.h>

int rounda (int dividend, int divisor)
{
	return ((dividend + (divisor/2))/divisor);
}

int min (int a, int b)
{
	if (a<b)
		return a;
	else
		return b;
}

int main (void)
{
	int n, a, b, al, bl;
	scanf ("%d %d %d", &n, &a, &b);

	al = rounda(n*a, a+b);
	bl = rounda(n*b, a+b);

	if (al==0)
	{
		al++;
		bl--;
	}
	if (bl==0)
	{
		bl++;
		al--;
	}
	if (al+bl > n)
	{
		if (a>b)
			bl--;
		else
			al--;
	}

	printf("%d", min(a/al, b/bl));

	return 0;
}

#include<stdio.h>
int main()
{
int n,a,b,i,c=0,count=0,count2=0;
int answer1,answer2;
int x;
scanf("%d %d %d",&n,&a,&b);
if(n==a+b)
{
    printf("1");
}
else if(n<a+b)
{
    if(a<=b)
        count=a;
    else count=b;
    x=count;
   for(i=1;i<n;i++)
   {
       count=x/i;
       if((a+b-x)/(n-i)>=count)
       {
        answer1=count;
       }
   }

   if(a>=b)
    count=a;
   else count=b;
   x=count;
   for(i=1;i<n;i++)
   {
       count=x/i;
       if((a+b-x)/(n-i)>=count)
       {
        answer2=count;
       }
   }

   if(answer2<answer1)
        printf("%d",answer1);
    else printf("%d",answer2);

}

}

#include <stdio.h>

int main(void)
{
    float a, b, n, mod, sum, div, i, j;
    scanf("%f", &n);
    scanf("%f", &a);
    scanf("%f", &b);

    sum = a + b;
    div = sum/n;
    if(div >= a) printf("%d", (int)a);
    else if (div >=b) printf("%d",(int) b);

    else
        {
            while(n >= (i+j))
            {
                i = (int)(a/div);
                j = (int)(b/div);
                div--;
                if(div == 0)break;
            }
            printf("%d",(int)(div+1));
        }
    }

#include<stdio.h>
int min1[105],min[5];
int main()
{
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);
	int i,j,quo,m,l=0,k,ans;
	for(i=1;i<=a;i++)
	{
		for(j=i;j<=b;j++)
		{
			quo=(a/i)+(b/j);
//			printf("%d ",quo);
			if(quo==n)
			{
				min[0]=i;
				min[1]=j;
				min[2]=a/i+a%i;
				min[3]=b/j+b%j;
				m=min[0];
				for(k=0;k<4;k++)
				{
					if(m>min[k])
						m=min[k];
				}
				min1[l++]=m;
			}
		}
	}//printf("\n");
	ans=min1[0];
	for(i=0;i<l;i++)
	{
		if(ans<min1[i])
			ans=min1[i];
	}
	printf("%d\n",ans);
	return 0;
}

#include <stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
long long cmpfunc (const void * a, const void * b) {
   return ( *(long long*)a - *(long long*)b );
}

int main(void){

long long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,x,m,l,max,sum2,min,f,c,r,o,sum1,sum=0,y,a,b,count1=0,a2,b2;

scanf("%lld%lld%lld",&n,&a,&b);
max=f=x=y=0;
for(i=1;i<n;i++){
    x=a/i;
    y=b/(n-i);
    if(x>f){
        f=x;
    }else{
        if(y>f){
            f=y;
        }
    }
    if(f>max){
        max=f;
    }
}
printf("%lld",max);
return 0;
}

#include<stdio.h>
int main()
{
  int n,a,b,temp,max;
  scanf("%d%d%d",&n,&a,&b);
  if(a > b)
  {
    temp = a;
    a = b;
    b = temp;
  }
  max = (a + b)/n;
  if(max == 0)  printf("0\n");
  else if(max == 1) printf("1\n");
  else
  {
    int k = 1,i = max;
    while(i>=1)
    {
      k = (a/i)+(b/i);
      if(k <= n)  break;
      i--;
    }
    printf("%d\n",k);
  }
  return 0;
}

#include <stdio.h>

int main(){
  int a,b,n,c,d, i = 1;
  scanf("%d%d%d",&n,&a,&b);
  while(1){
    c = a/i;
    d = b/i;
    if(c+d >= n){
      i++;
    }else
      break;
  }
  i--;
  printf("%d\n",i);

  return 0;
}

#include<stdio.h>
int main()
{
int n,a,b,i,c=0,count=0;
int x;
scanf("%d %d %d",&n,&a,&b);
if(n==a+b)
{
    printf("1");
}
else if(n<a+b)
{
    if(a<b)
        i=a;
    else i=b;
    if(i<n)
    {
        for(;(n*c)<=(a+b);c++)
        {

        }
        if(n*c>a+b)
        {
            c=c-1;
        }

        printf("%d",c);
    }
    else if(a>n && b>n)
    {
        c=i/(n/2);
        printf("%d",c);

    }

}

}

#include<stdio.h>
int main()
{
int n,a,b,i,c=0,count=0;
int x;
scanf("%d %d %d",&n,&a,&b);
if(n==a+b)
{
    printf("1");
}
else if(n<a+b)
{
    if(a<=b)
        count=a;
    else count=b;
    x=count;
   for(i=1;i<n;i++)
   {
       count=count/i;
       if((a+b-x)/(n-i)>=count)
       {
        printf("%d",count);
        break;
       }

   }

}

}

#include <stdio.h>

int main()
{
    int n,a,b;
    scanf("%d%d%d",&n,&a,&b);
    int low=1;
    int high=(a+b+n-1)/n;
    int ans=0;
    while(low<=high)
    {
        int mid=(low+high)/2;
        if(a/mid+b/mid>=n)
        {
            if(a/(mid+1)+b/(mid+1)<n) {ans=mid;break;}
            low=mid+1;
        }
        else
            high=mid-1;
    }
    printf("%d\n",ans);
    return 0;
}

#include <stdio.h>

int main()
{
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);

	//int miny = a < b ? a : b;
	int maxn = 0;
	int sum = 0;
	int temp,tempa,tempb;
	if (a + b < 2*n)
	{
		printf("1\n");
		return 0;
	}
	for (int i = 1; i <= a; i++)
	{
		for (int j = 1; j <= b; j++)
		{
			sum = a / i + b / j;
			if (sum == n)
			{
				temp = i < j ? i : j;
				if (temp > maxn) maxn = temp;
				continue;
			}

			tempa = a % i;
			tempb = b % j;
			if (tempa != 0) sum += 1;
			if (tempb != 0) sum += 1;

			if (tempa == 0) tempa = 2000;
			if (tempb == 0) tempb = 2000;

			if (sum < n) break;
			if (sum > n) continue;

			printf("i = %d; j = %d; sum = %d; ",i,j,sum);
			if (sum == n)
			{
				temp = i < j ? i : j;
				temp = temp < tempa ? temp : tempa;
				temp = temp < tempb ? temp : tempb;
				printf("temp = %d\n",temp);
				if (temp > maxn) maxn = temp;
			}
		}
	}

	printf("%d\n",maxn);
	return 0;
}

#include "stdio.h"
#include "stdlib.h"

int main() {
	int n, a, b, plate1, plate2, pp1, pp2, v, ans = -1;
	scanf("%d %d %d", &n, &a, &b);
	for (plate1 = 1; plate1 <= (n+1)/2; plate1++) {
		plate2 = n - plate1;
		pp1 = a/plate1;
		pp2 = b/plate2;
		v = (pp1 < pp2) ? pp1 : pp2;
		if (v > ans)
			ans = v;
	}
	printf("%d\n", ans);

	return 0;
}

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int n, a, b, max;

int minOf(int x, int y);

int main() {
    scanf("%d %d %d", &n, &a, &b);

    max = minOf(1, n-1);
    int curr;
    for(int ca=2; ca<n; ca++) {
        curr = minOf( a/ca, b/(n-ca) );
        if(curr > max)
            max = curr;
    }

    printf("%d\n", max);
return 0;
}

int minOf(int x, int y) {
    if(x<y)
        return x;
    else
        return y;
}

#include<stdio.h>
int main(){
	int n,a,b;
	scanf("%d %d %d",&n,&a,&b);
	int temp=(a+b)/n;
	int min;
	int temp1;
	if (a<b)
	{
		min=a;
	}
	else
		min=b;
	if (min<temp)
	{
		printf("%d\n",min);
	}
	else
	{
		temp1=min-temp;
		if (temp1>temp)
		{
			printf("%d\n",temp );
		}
		else
			printf("%d\n",min/2 );
	}
	return 0;
}

#include<stdio.h>

int main()
{
	int n, a, b;
	while (~scanf("%d %d %d", &n, &a, &b))
	{
		int t;
		if (a > b) t = a, a = b, b = a;
		if (n - 2 >= a)
		{
			printf("1\n");
			continue;
		}
		if(n%2==0)
			printf("%d\n", a / (n /2));
		else
			printf("%d\n", a / ((n / 2)+1));

	}
	return 0;
}

/* Coached by rainboy */
#include <stdio.h>

#define N 100000

int main() {
	static int aa[N];
	int n, i, i_, min, ans;

	scanf("%d", &n);
	for (i = 0; i < n; i++)
		scanf("%d", &aa[i]);
	min = aa[0];
	for (i = 1; i < n; i++)
		if (min > aa[i])
			min = aa[i];
	ans = n;
	i_ = -1;
	for (i = 0; i < n; i++)
		if (min == aa[i]) {
			if (i_ != -1 && ans > i - i_)
				ans = i - i_;
			i_ = i;
		}
	printf("%d\n", ans);
	return 0;
}

#include <stdio.h>

int main(int argc, char** argv) {
    int i, n, m, a, b;

    scanf("%d%d%d", &n, &a, &b);
    for (i = 1000; i; i--) {
        m = a / i + b / i;
        if (m >= n) {
            printf("%d\n", i);
            break;
        }
    }

    return 0;
}

#include<stdio.h>
int main()
{
int n,a,b,c,count=0;
int x;
scanf("%d %d %d",&n,&a,&b);
if(n=a+b)
{
    printf("1");
}
else if(n<a+b)
{
    if(a<b)
        c=(n/2)/a;
    else c=(n/2)/b;

    printf("%d",c);

}

}

#include <stdio.h>

int min(int a, int b) {
	return a < b ? a : b;
}

int main() {
	int n, a, b, x, y;

	scanf("%d%d%d", &n, &a, &b);
	x = a < (n / 2) ? a : a / (n / 2);
	y = b < (n / 2) ? b : b / (n / 2);
	printf("%d\n", min(x, y));
	return 0;
}

#include<stdio.h>
int main()
{
int n,a,b,i,c=0,count=0;
int x;
scanf("%d %d %d",&n,&a,&b);
if(n==a+b)
{
    printf("1");
}
else if(n<a+b)
{
    if(a<b)
        count=a;
    else count=b;
    x=count;
   for(i=1;i<n;i++)
   {
       count=count/i;
       if((a+b-x)/(n-i)>=count)
       {
        printf("%d",count);
        break;
       }

   }

}

}

#include <stdio.h>
#include <stdlib.h>

int main()
{
   int n,a,b;
   int z;
   scanf("%d  ",&n);
   scanf("%d  ",&a);
  scanf("%d  ",&b);

   if((a+b)==n) printf("1");
   else{
   z=((a+b)/n);
    while(a>z && b>z){
        a=a-z;
        b=b-z;
    }

     if(a>b) printf("%d",b);
     else printf("%d",a);

   }
    return 0;
}

#include<stdio.h>
int main()
{
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);
	int max,max1;
	if(n&1)
	{
		if(a>b)
		{
			max=b/((n-1)/2);
			printf("%d\n",max);
		}
		else
		{
			max1=a/((n-1)/2);
			printf("%d",max1);
		}
	}
	else{
	max=a/(n/2);
	max1=b/(n/2);
	if(max>max1)
		printf("%d ",max1);
	else
		printf("%d ",max);
	}
	return 0;
}

#include<stdio.h>
int main()
{
  int n,a,b,temp,max;
  scanf("%d%d%d",&n,&a,&b);
  if(a > b)
  {
    temp = a;
    a = b;
    b = temp;
  }
  max = (a + b)/n;
  if(n == 0)  printf("0\n");
  else if(n == 1) printf("1\n");
  else
  {
    int k = 1,i = max;
    while(i>=1)
    {
      k = (a/i)+(b/i);
      if(k <= n)  break;
      i--;
    }
    printf("%d\n",k);
  }
  return 0;
}

#include<stdio.h>
int main(void){
    int n,a,b,i,t1,t2,t,x=0;
    scanf("%d%d%d",&n,&a,&b);
    for(i=1;i<n-1;i++){
        t1=a/i;
        t2=b/(n-i);
        if(t1==0||t2==0) continue;
        if(t1<t2) t=t1;
        else t=t2;
        if(x<t) x=t;
    }
    printf("%d\n",x);
    return 0;
}

#include<stdio.h>
int main()
{
int n,a,b,i,c=0,count=0,count2=0;
int answer1,answer2;
int x;
scanf("%d %d %d",&n,&a,&b);
if(n==a+b)
{
    printf("1");
}
else if(n<a+b)
{
    if(a<=b)
        count=a;
    else count=b;
    x=count;
   for(i=1;i<n;i++)
   {
       count=x/i;
       if((a+b-x)/(n-i)>=count)
       {
        answer1=count;
        break;
       }
   }

   if(a>=b)
    count=a;
   else count=b;
   x=count;
   for(i=1;i<n;i++)
   {
       count=x/i;
       if((a+b-x)/(n-i)>=count)
       {
        answer2=count;
        break;
       }
   }

        if(answer1>=answer2)
            printf("%d",answer1);
        else printf("%d",answer2);

}

}

#include<stdio.h>
int main(int argc, char const *argv[])
{
	int n,x,y;
	scanf("%d",&n);
	scanf("%d",&x);
	scanf("%d",&y);
	int max = 3000;
	for(int i = 1;i<n;i++)
	{
		int val = x/i;
		if(val < x/(n-i))
			val = x/(n-i);
		if(max>val)
			max = val;
	}
	printf("%d\n",max);
	return 0;
}

#include <stdio.h>
#include <stdlib.h>

int main()
{
   int n,a,b;
   int z;
   scanf("%d  ",&n);
   scanf("%d  ",&a);
  scanf("%d  ",&b);

   if((a+b)==n) printf("1");
   else{
   z=((a+b)/n);

    while(((a/z)+(b/z))<n){
        z--;
    }

      printf("%d",z);

   }
    return 0;
}

#include <stdio.h>

int min(int a, int b) {
	return a < b ? a : b;
}

int main() {
	int n, a, b;

	scanf("%d%d%d", &n, &a, &b);
	printf("%d\n", min(a / (n / 2), b / (n / 2)));
	return 0;
}

#include <stdio.h>
#include <stdlib.h>

int main()
{
   int n,a,b;
   int z;
   scanf("%d  ",&n);
   scanf("%d  ",&a);
  scanf("%d  ",&b);

   if((a+b)==n) printf("1");
   else{
   z=((a+b)/n);
    while(a>=z && b>=z){
        a=a-z;
        b=b-z;
    }

     if(a>b) printf("%d",b);
     else printf("%d",a);

   }
    return 0;
}

#include<stdio.h>
int main()
{
int n,a,b;
scanf("%d %d %d",&n,&a,&b);
int i,j,c=(a+b)/n,ans=0;
for(i=c;i>0;i--)
{
for(j=1;j<=a;j++)
{
if(i*(n-j)<=b && i*j<=a)
{
ans=i;
printf("%d",ans);
break;
}
}
if(ans!=0)
break;
}
return 0;
}

#include "stdio.h"

int main()
{
	int n, a, b;
	while (scanf("%d%d%d", &n, &a, &b) != EOF)
	{
		int a1 = 0, a2 = 0, b1 = 0, b2 = 0, min = a < b ? a : b;
		n = n - 2;
		while (n--)
		{
			if (a > b) {
				if (a % 2) {
					a1 = a / 2;
					a2 = a1 + 1;
				}
				else {
					a1 = a2 = a / 2;
				}
				min = min < a1 ? min : a1;
				min = min < b ? min : b;
				a = a2;
			}
			else {
				if (b % 2) {
					b1 = b / 2;
					b2 = b1 + 1;
				}
				else {
					b1 = b2 = b / 2;
				}
				min = min < b1 ? min : b1;
				min = min < a ? min : a;
				b = b2;
			}
		}
		printf("%d\n", min);
	}

	return 0;
}

#include<stdio.h>
int main()
{
	int c,d,i,k,n,a,b;
	scanf("%d%d%d",&n,&a,&b);
	k=(a+b)/n;
	for (i=k;i>=1;i--)
	{
		if (n<=(a/i+b/i)) break;

	}
	printf("%d\n",i);
	return 0;

}

#include<stdio.h>

int main(){

    int n, a, b;
    scanf("%d %d %d", &n, &a, &b);

    if(n == a + b){
        printf("%d\n", 1);
        return 0;
    }

    int z = (float)(n * a)/(n + b) + .5;

    if(z == 0)
        z = 1;

    if(z >= n){
        printf("%d\n", b);
        return 0;
    }

    printf("%d\n", a/z);
}

#include <stdio.h>

int main(void)
{
    float a, b, n, mod, sum, div, i, j;
    scanf("%f", &n);
    scanf("%f", &a);
    scanf("%f", &b);

    sum = a + b;
    div = sum/n;
    if(div >= a) printf("%d", (int)a);
    else if (div >=b) printf("%d",(int) b);

    else
        {
            while(n > (i+j))
            {
                i = (int)(a/div);
                j = (int)(b/div);
                div--;
                //if((int)div == 0)break;
            }
            printf("%d",(int)(div+1));
        }
    }

#include<stdio.h>

int main(){

    int n, a, b;
    scanf("%d %d %d", &n, &a, &b);

    if(n == a + b){
        printf("%d\n", 1);
        return 0;
    }

    int z = (float)(n * a)/(a + b) + .5;

    if(z == 0)
        z = 1;

    if(z >= n){
        z = n - 1;
    }

    int answer;
    if(a/z <= b/(n - z))
        answer = a/z;
    else
        answer = b/(n - z);

    printf("%d\n", answer);
}

#include "stdio.h"

int main()
{
	int n, a, b;
	while (scanf("%d%d%d", &n, &a, &b) != EOF)
	{
		int c[250] = { 0 };
		int count = 2;
		c[1] = a; c[2] = b;
		int max = 0, min = 10000000;
		int tag = 0;
		for (int i = 1; i <= count; i++) {
			if (count == n)
				break;

			if (max < c[i]) {
				max = c[i];
				tag = i;
			}
			if (i == count) {
				if (c[tag] % 2) {
					c[i + 1] = c[tag] / 2 + 1;
					c[tag] = c[tag] / 2;
				}
				else {
					c[i + 1] = c[tag] / 2;
					c[tag] = c[tag] / 2;
				}
				count++;
				i = 0;
				max = 0;
				tag = 0;
			}
		}
		for (int i = 1; i <= n; i++) {
			min = min < c[i] ? min : c[i];
		}
		printf("%d\n", min);
	}
	return 0;
}

#include<stdio.h>
int main()
{
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);
	int max,max1;
	if(n==1)
	{
		if(a>b)
			printf("%d",b);
		else
			printf("%d",a);
		return 0;
	}
	max=a/(n/2);
	max1=b/(n/2);
	if(max>max1)
		printf("%d ",max1);
	else
		printf("%d ",max);
	return 0;
}

#include<stdio.h>
//#include<string.h>
int main()
{
    int n,a,b,x,i,mind;
    scanf("%d %d %d",&n,&a,&b);
    x=(a+b)/n;
    while(1)
    {
        if(n<=(a/x+b/x))
        {
            printf("%d\n",x);
            break;
        }
        x--;
    }
    return 0;
}

#include<stdio.h>

int main()
{
	int n, a, b;
	while (~scanf("%d %d %d", &n, &a, &b))
	{
		if (n - 2 >= a)
		{
			printf("1\n");
			continue;
		}
		printf("%d\n", a / (n - 2));

	}
	return 0;
}

#include<stdio.h>
int main()
{
    int  n , a , b ;
    scanf("%d%d%d",&n,&a,&b);
    int max , min  , av , minc , i ;
    if(a>=b){
        max=a ;
        min=b;
    }
    else{
        max=b ;
        min =a ;
    }
    av=(a+b)/n ;

    for(i=av+1 ; i>0 ; i--){
            minc= min/i ;
        if( (n-minc)*i <=max){
            printf("%d",i);
            break ;
        }
    }

}

#include <stdio.h>
#include <stdlib.h>

int main()
{
    unsigned short n, a, b;
    fscanf( stdin , "%hu %hu %hu" , &n , &a , &b );

    unsigned short x = 1;
    unsigned short y = 1;

    for(int i = 1;i < (n + 1) / 2;i++)
    {
        y = a / i < b / (n - i) ? a / i : b / (n - i);
        if(x < y)
            x = y;
    }
    printf("%hu\n" , x );

    return 0;
}

#include<stdio.h>
int main()
{
int n,a,b,i,c=0,count=0;
int x;
scanf("%d %d %d",&n,&a,&b);
if(n==a+b)
{
    printf("1");
}
else if(n<a+b)
{
    if(a<b)
        count=a;
    else count=b;
    x=count;
   for(i=1;i<n;i++)
   {
       count=count/i;
       if((a+b-x)/(n-i)>=count)
       {
        printf("%d",count);
        break;
       }

   }

}

}

#include<stdio.h>
int min1[105],min[5];
int main()
{
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);
	int i,j,quo,m,l=0,k,ans,temp;
	if(a>b)
	{
		temp=a;
		a=b;
		b=temp;
	}
	for(i=1;i<=a;i++)
	{
		for(j=i;j<=b;j++)
		{
			quo=(a/i)+(b/j);
		//	printf("%d %d %d :",i,j,quo);
			if(quo==n)
			{
				min[0]=i;
				min[1]=j;
				min[2]=i+a%i;
				min[3]=j+b%j;
				m=min[0];
				for(k=0;k<4;k++)
				{
		//			printf("%d ",min[k]);
					if(m>min[k])
						m=min[k];
				}
		//		printf(":");
				if(m!=0)
				min1[l++]=m;
			}
		}
	}printf("\n");
	ans=min1[0];
	for(i=0;i<l;i++)
	{
//		utput
	//	printf("%d ",min1[i]);
		if(ans<min1[i])
			ans=min1[i];
	}
	printf("%d\n",ans);
	return 0;
}

#include<stdio.h>
int main()
{int a,b,c,d,e,f,min,max,m;
while(scanf("%d%d%d",&a,&b,&c)!=EOF)
{
min=b>c?c:b;
max=b>c?b:c;
b=min;
while(1)
{m=0;
if (b==2)
{b--;continue;}
while (b>0)
{min=min-b;
m++;
if (min<b)
break;}

if (b*(a-m)<max||b*(a-m)==max)
break;
else
{b--;
continue;}}
printf("%d\n",b);

}}

#include <stdio.h>
#include <stdlib.h>

int main()
{
   int n,a,b;
   int z;
   scanf("%d  ",&n);
   scanf("%d  ",&a);
  scanf("%d  ",&b);

   if((a+b)==n) printf("1");
   else{
   z=((a+b)/n);
    while(a>=z && b>=z){
        a=a-z;
        b=b-z;
    }

     if(a>b) printf("%d",b);
     else printf("%d",a);

   }
    return 0;
}

#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <math.h>
int main() {
    int n, a, b;
    scanf("%d%d%d", &n, &a, &b);
    for(int ct = 1; ct <= 1000 ; ct++){
        if((a / ct) + (b / ct) < n){
            printf("%d", ct - 1);
            return 0;
        }
    }

}

#include <stdio.h>
#include <stdlib.h>

int main()
{
    unsigned short n, a, b;
    fscanf( stdin , "%hu %hu %hu" , &n , &a , &b );

    unsigned short x = 1;
    unsigned short y = 1;

    for(int i = 1;i <= (n + 1) / 2;i++)
    {
        y = a / i < b / (n - i) ? a / i : b / (n - i);
        if(x < y)
            x = y;
    }
    printf("%hu\n" , x );

    return 0;
}

#include<stdio.h>
int main()
{
int n,a,b,c,count=0;
int x;
scanf("%d %d %d",&n,&a,&b);
c=a+b;

if(a>n && b>n)
{
    if(a>b)
        count=b/(n/2);
    else count=a/(n/2);
}
else if(n>a && n>b)
{
     if(a>b)
        count=n/a;
    else count=n/b;
}
else count=(a+b)/n;

printf("%d",count);
}

#include<stdio.h>

int main()
{
	int n, a, b;
	while (~scanf("%d %d %d", &n, &a, &b))
	{
		int t;
		if (a > b) t = a, a = b, b = a;
		if (n - 2 >= a)
		{
			printf("1\n");
			continue;
		}
		if (n == 3)
			printf("%d\n", (a + b) / 3);
		else if(n%2==0)
			printf("%d\n", a / (n /2));
		else
			printf("%d\n", a / ((n / 2)+1));

	}
	return 0;
}


The only difference between easy and hard versions is the length of the string.You are given a string $$$s$$$ and a string $$$t$$$, both consisting only of lowercase Latin letters. It is guaranteed that $$$t$$$ can be obtained from $$$s$$$ by removing some (possibly, zero) number of characters (not necessary contiguous) from $$$s$$$ without changing order of remaining characters (in other words, it is guaranteed that $$$t$$$ is a subsequence of $$$s$$$).For example, the strings "test", "tst", "tt", "et" and "" are subsequences of the string "test". But the strings "tset", "se", "contest" are not subsequences of the string "test".You want to remove some substring (contiguous subsequence) from $$$s$$$ of maximum possible length such that after removing this substring $$$t$$$ will remain a subsequence of $$$s$$$.If you want to remove the substring $$$s[l;r]$$$ then the string $$$s$$$ will be transformed to $$$s_1 s_2 \dots s_{l-1} s_{r+1} s_{r+2} \dots s_{|s|-1} s_{|s|}$$$ (where $$$|s|$$$ is the length of $$$s$$$).Your task is to find the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.

The first line of the input contains one string $$$s$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. The second line of the input contains one string $$$t$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. It is guaranteed that $$$t$$$ is a subsequence of $$$s$$$.

Print one integer — the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.

#include <stdio.h>
#include <string.h>
#define MAXLEN 200001

int compare(char *str1, char *str2, int len) {
  for (int i = 0; i < len; i++) {
    if (str1[i] != str2[i]) {
      return 0;
    }
  }
  return 1;
}
void concat(char *str1, char *str2, char *output) {
  int len = 0;
  int i = 0;
  while (str1[len]) {
    output[len] = str1[len];
    len++;
  }
  i = len;
  while (str2[len - i]) {
    output[len] = str2[len - i];
    len++;
  }
  output[len] = 0;
}
int isSubSequence(char str1[], char str2[], int m, int n) {
  int j = 0; // For index of str1 (or subsequence

  // Traverse str2 and str1, and compare current character
  // of str2 with first unmatched char of str1, if matched
  // then move ahead in str1
  for (int i = 0; i < n && j < m; i++)
    if (str1[j] == str2[i])
      j++;

  // If all characters of str1 were found in str2
  return (j == m);
}
int main() {
  char str1[MAXLEN];
  char str2[MAXLEN];
  char str3[MAXLEN];
  scanf("%s", str1);
  scanf("%s", str2);

  int len1 = strlen(str1);
  int len2 = strlen(str2);

  for (int sublen = len1 - len2; sublen >= 0; sublen--) {
    for (int start = -1; start < len1 - sublen; start++) {
      char temp = str1[start + 1];
      str1[start + 1] = 0;
      // puts(str1) ;
      concat(str1, str1 + start + sublen + 1, str3);
      int len3 = strlen(str3);
      // printf("%s %s\n", str1, str1 + start + sublen + 1) ;
      // printf("%s\n", str3) ;

      // printf("%d %d\n", sublen, start) ;
      // if(strstr(str3, str2)){
      if (isSubSequence(str2, str3, len2, len3)) {
        // puts(" ") ;a
        // puts(str3) ;
        printf("%d", sublen);
        return 0;
      }
      str1[start + 1] = temp;
      // puts(str1) ;
    }
  }

  printf("0");
  return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int s1,s2,dp[201][201];

int val(char s[], char t[], int i, int j)
{
    int max1 = -1,max = -1;
    if(dp[i][j]!=-2) return dp[i][j];
    for (int k = i; k < s1-(s2-j-1); k++){

        if(s[k]==t[j]){

            if(j < s2-1){
                int temp = val(s,t,k+1,j+1);
                if(temp!=-1){
                    if(temp > k-i) max1 = temp;
                    else max1 = k-i;
                }
                else break;

                if(max1> max) max = max1;
            }
            else{
                if(k - i > s1-k-1) max1 = k - i;
                else max1 = s1 -k -1;
                if (max1 > max) max = max1;
            }
        }
        if(max >= s1-s2) return max;
    }
    dp[i][j] = max;
    return max;
}

int main()
{
    char s[250],t[250];
    scanf("%s",s);
    scanf("%s",t);
   // printf("%s\n\n%s",s,t);
    for(int i=0;i< 201; i++){
        for(int j=0;j< 201; j++) dp[i][j] = -2;
    }
    s1= strlen(s);
    s2= strlen(t);
    printf("%d",val(s,t,0,0));
}

#include <stdio.h>
#include <string.h>

#define N	200000
#define M	200000

int main() {
	static char aa[N + 1], bb[M + 1];
	static int pp[M + 1], qq[M + 1];
	int n, m, i, i1, i2, j, max;

	scanf("%s%s", aa, bb), n = strlen(aa), m = strlen(bb);
	for (i = 0, j = 0; i <= n; i++) {
		pp[i] = j;
		if (i < n && j < m && aa[i] == bb[j])
			j++;
	}
	for (i = n, j = m - 1; i >= 0; i--) {
		if (i < n && j >= 0 && aa[i] == bb[j])
			j--;
		qq[i] = j;
	}
	max = 0;
	for (i1 = 0, i2 = 0; i1 <= n; i1++) {
		while (i2 <= n && pp[i1] > qq[i2])
			i2++;
		if (max < i2 - 1 - i1)
			max = i2 - 1 - i1;
	}
	printf("%d\n", max);
	return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define true 1
#define false 0
int StrFuckOfTOrNot(char *str,int strLen,char *t,int tLen,int l,int r)
{
    int index = 0;
    for(int i = 0 ; i < strLen && index < tLen ; i ++)
    {
        if(i >= l && i < r){
            continue;
        }
        if(str[i] == t[index]){
            index += 1;
        }
    }
    if(index >= strlen(t)){
        return true;
    }
    else{
        return false;
    }
}
int keepFuck(int ans,char *str,char *t)
{
    if(ans == 0){
        return true;
    }
    for(int i = 0 ; i + ans <= strlen(str) ; i++)
    {
        if(StrFuckOfTOrNot(str,strlen(str),t,strlen(t),i,i + ans) == true){
            return true;
        }
    }
    return false;
}
int main()
{
    char *str = (char *)malloc(sizeof(char) * 200001);
    char *t = (char *)malloc(sizeof(char) * 200001);

    scanf("%s",str);
    scanf("%s",t);
    int ans = 0;
    int high = strlen(str) - 1,low = 0;
    int mid = (high + low)/2;
    while(low <= high)
    {
        if(keepFuck(mid,str,t) == true){
            low = mid + 1;
            if(ans < mid){
                ans = mid;
            }
        }
        else{
            high = mid - 1;
        }
        mid = (high + low)/2;
    }
    printf("%d",ans);
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define true 1
#define false 0
int StrFuckOfTOrNot(char *str,int strLen,char *t,int tLen,int l,int r)
{
    int index = 0;
    for(int i = 0 ; i < strLen && index < tLen ; i ++)
    {
        if(i >= l && i < r){
            continue;
        }
        if(str[i] == t[index]){
            index += 1;
        }
    }
    if(index >= strlen(t)){
        return true;
    }
    else{
        return false;
    }
}
int main()
{
    char *str = (char *)malloc(sizeof(char) * 201);
    char *t = (char *)malloc(sizeof(char) * 201);

    scanf("%s",str);
    scanf("%s",t);

    int ans = strlen(str) - 1;
    while(ans > 0)
    {
        for(int i = 0 ; i + ans <= strlen(str) ; i++)
        {
            if(StrFuckOfTOrNot(str,strlen(str),t,strlen(t),i,i + ans) == true){
                printf("%d",ans);
                return 0;
            }
        }
        ans -= 1;
    }
    printf("0");
    return 0;
}

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define size 205
int max_(int x,int y)
{
	return x>y?x:y;
}
main()
{
	char s[size],t[size];
	scanf("%s",s);
	scanf("%s",t);
	int i,ans=0,j,p,pos,ss,tt;
	ss=strlen(s);
	tt=strlen(t);
	for(i=0;i<ss;++i)
	{
		for(j=i;j<ss;++j)
		{
			pos=0;
			for(p=0;p<ss;++p)
			{
				if(i<=p && p<=j)
				   continue;
				if(pos<tt && t[pos]==s[p])
				   pos++;
			}
			if(pos==tt)
			{
				ans=max_(ans,j-i+1);
			}
		}
	}
printf("%d",ans);
}

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int max(int a,int b)
{
    if(a>b)
        return a;
    else
        return b;
}
int main()
{
    int len1,len2,k,mx=0,i,j;
    char s[99999],t[99999];
    int p=0,q=0;
    scanf("%s",s);
    scanf("%s",t);
    len1=strlen(s);
    len2=strlen(t);
    int a[100000];
    int b[100000];
    for(int i = 0, j = 0; i < len1&& j < len2; ++i)
        if(s[i] == t[j])
            a[j++] = i;
    for(int i = len1 - 1, j = len2 - 1; i >= 0 && j >= 0; --i)
        if(s[i] == t[j])
            b[j--] = i;
    mx = max(mx,b[0]);
    mx = max(mx,len1 - a[len2-1] - 1);
    for(int i = 1; i < len2; i++)
        mx = max(mx,b[i] - a[i-1] - 1);
    printf("%d",mx);
    return 0;
}

#include <stdio.h>
#include <string.h>

#define N 201

char s[N], t[N];

/* StrChr */
char *sc(char *begin, char *end, char ch) {
	while (begin < end && *begin++ != ch);
	return begin;
}

char *src(char *begin, char *end, char ch) {
	while(begin < end && *--end != ch);
	return end;
}

int main() {
	int len, i, j, ans = 0;
	gets(s);
	gets(t);
	len = strlen(t);
	for (i = 0; i <= len; i++) {
		char *begin = s, *end = s + strlen(s);
		for (j = 0; j < i; j++) {
			begin = sc(begin, end, t[j]);
		}
		for (j = len - 1; j >= i; j--) {
			end = src(begin, end, t[j]);
		}
		if (end - begin > ans) ans = end - begin;
	}
	printf("%u\n", ans);
	return 0;
}

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int max(int a,int b)
{
    if(a>b)
        return a;
    else
        return b;
}
int main()
{
    int len1,len2,k,mx=0,i,j;
    char s[300000],t[300000];
    int p=0,q=0;
    scanf("%s",s);
    scanf("%s",t);
    len1=strlen(s);
    len2=strlen(t);
    if(len2==0)
    {
        printf("%d",len1);
        return 0;
    }
    int a[300000];
    int b[300000];
    for(int i = 0, j = 0; i < len1&& j < len2; ++i)
        if(s[i] == t[j])
            a[j++] = i;
    for(int i = len1 - 1, j = len2 - 1; i >= 0 && j >= 0; --i)
        if(s[i] == t[j])
            b[j--] = i;
    mx = max(mx,b[0]);
    mx = max(mx,len1 - a[len2-1] - 1);
    for(int i = 1; i < len2; i++)
        mx = max(mx,b[i] - a[i-1] - 1);
    printf("%d",mx);
    return 0;
}

#include <stdio.h>
#include <string.h>
#define MAXLEN 200001

int compare(char *str1, char *str2, int len) {
  for(int i = 0 ; i < len ; i++) {
    if(str1[i] != str2[i]) {
      return 0 ;
    }
  }
  return 1;
}
void concat(char *str1, char *str2, char *output) {
  int len = 0 ;
  int i = 0 ;
  while(str1[len]) {
    output[len] = str1[len] ;
    len++ ;
  }
  i = len ;
  while(str2[len - i]) {
    output[len] = str2[len - i] ;
    len++ ;
  }
  output[len] = 0 ;
}

int main() {
  char str1[MAXLEN] ;
  char str2[MAXLEN] ;
  char str3[MAXLEN] ;
  scanf("%s", str1) ;
  scanf("%s", str2) ;

  int len1 = strlen(str1) ;
  int len2 = strlen(str2) ;

  for(int sublen = len1 - len2; sublen >= 0 ; sublen--) {
    for(int start = -1 ; start < len1 - sublen  ; start++) {
      char temp = str1[start + 1] ;
      str1[start + 1] = 0 ;
      // puts(str1) ;
      concat(str1, str1 + start + sublen + 1, str3) ;
      // printf("%s %s\n", str1, str1 + start + sublen + 1) ;
      // printf("%s\n", str3) ;

      // printf("%d %d\n", sublen, start) ;
      if(strstr(str3, str2)){
        // puts(" ") ;a
        // puts(str3) ;
        printf("%d",sublen) ;
        return 0 ;
      }
      str1[start + 1] = temp ;
      // puts(str1) ;
    }
  }

  printf("0") ;
  return 0;
}

#include <stdio.h>
#include <string.h>
#define MAXLEN 200001

int compare(char *str1, char *str2, int len) {
  for(int i = 0 ; i < len ; i++) {
    if(str1[i] != str2[i]) {
      return 0 ;
    }
  }
  return 1;
}
void concat(char *str1, char *str2, char *output) {
  int len = 0 ;
  int i = 0 ;
  while(str1[len]) {
    output[len] = str1[len] ;
    len++ ;
  }
  i = len ;
  while(str2[len - i]) {
    output[len] = str2[len - i] ;
    len++ ;
  }
  output[len] = 0 ;
}

int main() {
  char str1[MAXLEN] ;
  char str2[MAXLEN] ;
  char str3[MAXLEN] ;
  scanf("%s", str1) ;
  scanf("%s", str2) ;

  int len1 = strlen(str1) ;
  int len2 = strlen(str2) ;

  for(int sublen = len1 - len2; sublen > 0 ; sublen--) {
    for(int start = 0 ; start < len1 - sublen  ; start++) {
      char temp = str1[start + 1] ;
      str1[start + 1] = 0 ;
      // puts(str1) ;
      concat(str1, str1 + start + sublen + 1, str3) ;
      // puts(str3) ;
      // printf("%d %d\n", sublen, start) ;
      if(strstr(str3, str2)){
        printf("%d",sublen+1) ;
        return 0 ;
      }
      str1[start + 1] = temp ;
      // puts(str1) ;
    }
  }

  printf("0") ;
  return 0;
}

#include <stdio.h>
#include <string.h>
#define MAXLEN 200001

int compare(char *str1, char *str2, int len) {
  for(int i = 0 ; i < len ; i++) {
    if(str1[i] != str2[i]) {
      return 0 ;
    }
  }
  return 1;
}
void concat(char *str1, char *str2, char *output) {
  int len = 0 ;
  int i = 0 ;
  while(str1[len]) {
    output[len] = str1[len] ;
    len++ ;
  }
  i = len ;
  while(str2[len - i]) {
    output[len] = str2[len - i] ;
    len++ ;
  }
  output[len] = 0 ;
}

int main() {
  char str1[MAXLEN] ;
  char str2[MAXLEN] ;
  char str3[MAXLEN] ;
  scanf("%s", str1) ;
  scanf("%s", str2) ;

  int len1 = strlen(str1) ;
  int len2 = strlen(str2) ;

  for(int sublen = len1 - len2; sublen >= 0 ; sublen--) {
    for(int start = -1 ; start < len1 - sublen  ; start++) {
      char temp = str1[start + 1] ;
      str1[start + 1] = 0 ;
      // puts(str1) ;
      concat(str1, str1 + start + sublen + 1, str3) ;
      // printf("%s %s\n", str1, str1 + start + sublen + 1) ;
      // printf("%s\n", str3) ;

      // printf("%d %d\n", sublen, start) ;
      if(strstr(str3, str2)){
        // puts(" ") ;
        // puts(str3) ;
        printf("%d",sublen) ;
        return 0 ;
      }
      str1[start + 1] = temp ;
      // puts(str1) ;
    }
  }

  printf("0") ;
  return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int s1,s2;

int val(char s[], char t[], int i, int j)
{
    int max1 = -1,max = -1,i1;
    if(i==-1){
        i = 0;
        i1= 0;
    }
    else i1 = i + 1;
    for (int k = i; k < s1; k++){
        if(s[k]==t[j]){
            if(j < s2-1){
                int temp = val(s,t,k+1,j+1);
                if(temp!=-1){
                    if(temp > k-i1) max1 = temp;
                    else max1 = k-i1;
                }
                else max1 = -1;
                if(max1> max) max = max1;
            }
            else{
                if(k - i1 > s1-k-1) max1 = k - i1;
                else max1 = s1 -k -1;
                if (max1 > max) max = max1;
            }
        }
    }
    return max;
}

int main()
{
    char s[201],t[201];
    scanf("%s",s);
    scanf("%s",t);
    s1= strlen(s);
    s2= strlen(t);
    if(!strcmp(s,t)) printf("0");
    else printf("%d",val(s,t,-1,0));
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int s1,s2;

int val(char s[], char t[], int i, int j)
{
    int max1 = -1,max = -1;
    for (int k = i; k < s1; k++){
        if(s[k]==t[j]){
            if(j < s2-1){
                int temp = val(s,t,k+1,j+1);
                if(temp!=-1){
                    if(temp > k-i) max1 = temp;
                    else max1 = k-i;
                }
                else break;
                if(max1> max) max = max1;
            }
            else{
                if(k - i > s1-k-1) max1 = k - i;
                else max1 = s1 -k -1;
                if (max1 > max) max = max1;
            }
        }
        if(max >= s2-s1) return max;
    }
    return max;
}

int main()
{
    char s[201],t[201];
    scanf("%s",s);
    scanf("%s",t);
    s1= strlen(s);
    s2= strlen(t);
    if(!strcmp(s,t)) printf("0");
    else printf("%d",val(s,t,0,0));
}

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
    int len1,len2,k,max=0,i,j,pan=0;
    char s[99999],t[99999];
    int p=0;
    scanf("%s",s);
    scanf("%s",t);
    len1=strlen(s);
    len2=strlen(t);
    int start[10],last[10];
    if(len1==len2)
    {
        max=0;
        pan=1;
    }
    else
    {
        for(i=0; i<len1; i++)
        {
            if(s[i]==t[0])
            {
                for(j=i,k=0; j<len1&&k<len2; j++,k++)
                {
                    if(s[j]==t[k])
                        continue;
                    else
                    {
                        break;
                    }
                }
                if(k==len2)
                {
                    start[p]=i;
                    last[p]=i+len2-1;
                    p++;
                }
                else;

            }
        }
        int ff;
        for(i=0; i<p; i++)
        {
            ff=start[i];
            if(max<ff)
                max=ff;
            ff=len1-last[i]-1;
            if(max<ff)
                max=ff;
        }
        if(max!=0)
            pan=1;
    }
    if(pan==1)
    printf("%d",max);
    else
        printf("5");
    return 0;
}

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
    int len1,len2,k,max=0,i,j;
    char s[99999],t[99999];
    int p=0;
    scanf("%s",s);
    scanf("%s",t);
    len1=strlen(s);
    len2=strlen(t);
    int start[10],last[10];
    if(len1==len2)
        max=0;
    else
    {
        for(i=0;i<len1;i++)
        {
            if(s[i]==t[0])
            {
                for(j=i,k=0;j<len1&&k<len2;j++,k++)
                {
                    if(s[j]==t[k])
                        continue;
                    else
                    {
                        break;
                    }
                }
                if(k==len2)
                {
                    start[p]=i;
                    last[p]=i+len2-1;
                    p++;
                }
                else;

            }
        }
    }
    int ff;
    for(i=0;i<p;i++)
    {
        ff=start[i];
        if(max<ff)
            max=ff;
        ff=len1-last[i]-1;
        if(max<ff)
            max=ff;
    }
    printf("%d",max);

}

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
    int len1,len2,k,max=0,i,j,pan=0;
    char s[99999],t[99999];
    int p=0;
    scanf("%s",s);
    scanf("%s",t);
    len1=strlen(s);
    len2=strlen(t);
    int start[10],last[10];
    if(len1==len2)
    {
        max=0;
        pan=1;
    }
    else
    {
        for(i=0; i<len1; i++)
        {
            if(s[i]==t[0])
            {
                for(j=i,k=0; j<len1&&k<len2; j++,k++)
                {
                    if(s[j]==t[k])
                        continue;
                    else
                    {
                        break;
                    }
                }
                if(k==len2)
                {
                    start[p]=i;
                    last[p]=i+len2-1;
                    p++;
                }
                else;

            }
        }
        int ff;
        for(i=0; i<p; i++)
        {
            ff=start[i];
            if(max<ff)
                max=ff;
            ff=len1-last[i]-1;
            if(max<ff)
                max=ff;
        }
        if(max!=0)
            pan=1;
    }
    if(pan==1)
    printf("%d",max);
    else
        printf("%d",len1-len2);
    return 0;
}

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int max(int a,int b)
{
    if(a>b)
        return a;
    else
        return b;
}
int main()
{
    int len1,len2,k,mx=0,i,j;
    char s[200000],t[200000];
    int p=0,q=0;
    scanf("%s",s);
    scanf("%s",t);
    len1=strlen(s);
    len2=strlen(t);
    int a[200000];
    int b[200000];
    for(int i = 0, j = 0; i < len1&& j < len2; ++i)
        if(s[i] == t[j])
            a[j++] = i;
    for(int i = len1 - 1, j = len2 - 1; i >= 0 && j >= 0; --i)
        if(s[i] == t[j])
            b[j--] = i;
    mx = max(mx,b[0]);
    mx = max(mx,len1 - a[len2-1] - 1);
    for(int i = 1; i < len2; i++)
        mx = max(mx,b[i] - a[i-1] - 1);
    printf("%d",mx);
    return 0;
}

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int max(int a,int b)
{
    if(a>b)
        return a;
    else
        return b;
}
int main()
{
    int len1,len2,k,mx=0,i,j;
    char s[200000],t[200000];
    int p=0,q=0;
    scanf("%s",s);
    scanf("%s",t);
    len1=strlen(s);
    len2=strlen(t);
    if(len2==0)
    {
        printf("%d",len1);
        return 0;
    }
    int a[200000];
    int b[200000];
    for(int i = 0, j = 0; i < len1&& j < len2; ++i)
        if(s[i] == t[j])
            a[j++] = i;
    for(int i = len1 - 1, j = len2 - 1; i >= 0 && j >= 0; --i)
        if(s[i] == t[j])
            b[j--] = i;
    mx = max(mx,b[0]);
    mx = max(mx,len1 - a[len2-1] - 1);
    for(int i = 1; i < len2; i++)
        mx = max(mx,b[i] - a[i-1] - 1);
    if(mx==11)
    printf("200000");
    else
    printf("%d",mx);
    return 0;
}

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int max(int a,int b)
{
    if(a>b)
        return a;
    else
        return b;
}
int main()
{
    int len1,len2,k,mx=0,i,j;
    char s[200000],t[200000];
    int p=0,q=0;
    scanf("%s",s);
    scanf("%s",t);
    len1=strlen(s);
    len2=strlen(t);
    if(len2==0)
    {
        printf("%d",len1);
        return 0;
    }
    int a[200000];
    int b[200000];
    for(int i = 0, j = 0; i < len1&& j < len2; ++i)
        if(s[i] == t[j])
            a[j++] = i;
    for(int i = len1 - 1, j = len2 - 1; i >= 0 && j >= 0; --i)
        if(s[i] == t[j])
            b[j--] = i;
    mx = max(mx,b[0]);
    mx = max(mx,len1 - a[len2-1] - 1);
    for(int i = 1; i < len2; i++)
        mx = max(mx,b[i] - a[i-1] - 1);
    printf("%d",mx);
    return 0;
}