stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include<cstdio>

#include<vector>

#define MAXN 100006

#include<algorithm>

using namespace std;

int d[MAXN],n,u,v;

vector<int> road[MAXN];

void DFS(int x,int fa)

{

	for(int i=0;i<(int)road[x].size();i++)

	{

		int nex=road[x][i];

		if(nex==fa) continue;

		DFS(nex,x);

		d[x]^=(d[nex]+1);

	}

}

int main()

{

	scanf("%d",&n);

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

	{

		scanf("%d%d",&u,&v);

		road[u].push_back(v);

		road[v].push_back(u);

	}

	DFS(1,0);

	if(d[1]) printf("Alice");

	else printf("Bob");

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#define maxn 100005

int n;

struct node { int v; node *nxt; } edge[maxn*2],*head[maxn],*ncnt;

void addedge(int u,int v)

{

	ncnt++;

	ncnt->v=v,ncnt->nxt=head[u];

	head[u]=ncnt;

}

int dfs(int u,int fa)

{

	int res=0;

	for(node *p=head[u];p;p=p->nxt)

	{

		int v=p->v;

		if(v!=fa) res^=dfs(v,u)+1;

	}

	return res;

}

int main()

{

	scanf("%d",&n);

	ncnt=&edge[0];

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

	{

		int u,v;

		scanf("%d%d",&u,&v);

		addedge(u,v); addedge(v,u);

	}

	printf("%s\n",dfs(1,0)?"Alice":"Bob");

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

//#include <ext/rope>

//

//using namespace __gnu_cxx;



#define rep(i,e) for(int i=0;i<(e);i++)

#define rep1(i,e) for(int i=1;i<=(e);i++)

#define repx(i,x,e) for(int i=(x);i<=(e);i++)

#define pii pair<int,int>

#define X first

#define Y second

#define PB push_back

#define MP make_pair

#define mset(var,val) memset(var,val,sizeof(var))

#define scd(a) scanf("%d",&a)

#define scdd(a,b) scanf("%d%d",&a,&b)

#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)

#define IOS ios::sync_with_stdio(false);cin.tie(0)



using namespace std;



//#ifdef local

//    #define dbg(args...) do { cout  << #args << " -> "; err(args); cout << endl;} while (0)

//#else

//    #define dbg(...)

//#endif

//

//void err() {  }

////template<template<typename...> class T, typename t, typename... Args>

////void err(T<t> a, Args... args) { for (auto x: a) cout << x << ' '; err(args...); }

//template<typename T, typename... Args>

//void err(T a, Args... args) { cout << a << ' '; err(args...); }





typedef long long ll;

template <class T>

void test(T a) {

    cout<<a<<endl;

}

template <class T,class T2>

void test(T a,T2 b) {

    cout<<a<<" "<<b<<endl;

}

template <class T,class T2,class T3>

void test(T a,T2 b,T3 c) {

    cout<<a<<" "<<b<<" "<<c<<endl;

}

const int inf = 0x3f3f3f3f;

const ll INF = 0x3f3f3f3f3f3f3f3fLL;

const int mod = 1e9+7;



const int N = 1e5+10;



set<int> s;



void work() {

    int n, m;

    scdd(n, m);

    for(int i = 1; i <= sqrt(m+1); ++i){

        if(m%i == 0){

            s.insert(m/i);

            s.insert(i);

        }

    }

    int x = *(s.lower_bound(n));

    printf("%d\n", m/x);

}





int main() {

#ifdef local

    freopen("in.txt","r",stdin);

//        freopen("out1.txt","w",stdout);

#endif // local

//    IOS;

//    init();

    int t;

//    cin >> t;

//    scd(t);

//    for(; t--;)

        work();

    return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

int main()

{

	int n,m,k;

	scanf("%d%d",&n,&m);

	k=m/n;

	for(int i=k;i>=1;i--)

	if(m%i==0)

	{

		printf("%d",i);

		return 0;

	}

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

long long n,m,maxn;



int main()

{

	scanf("%lld%lld",&n,&m);

	if(m%n==0)

	{printf("%lld",m/n);

	return 0;

	}

	for(long long i=1;i<=m;i++)

	{

		if(i*n>m)break;

		if(m%i==0&&i*n<=m)maxn=i;

		

	}

	printf("%lld",maxn);

	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

int main()

{

	int n,m,k;

	scanf("%d%d",&n,&m);

	k=m/n;

	for(int i=k;i>=1;i--)

	if(m%i==0)

	{

		printf("%d",i);

		return 0;

	}

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



const long long linf = 1e18 + 7;

const int inf = 1e9 + 7;

const int N = 1e6 + 5;



main(){

    int n, m;

    cin >> n >> m;

    int cur = m / n + 1;

    while (cur--){

        if (cur == 1){

            cout << 1;

            return 0;

        }

        if ((m - cur * n) % cur == 0){

            cout << cur;

            return 0;

        }

    }

}


// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

int main()

{

	int n,m,k;

	scanf("%d%d",&n,&m);

	k=m/n;

	for(int i=k;i>=1;i--)

	if(m%i==0)

	{

		printf("%d",i);

		return 0;

	}

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()

{

	ll n,m;

	scanf("%lld %lld",&n,&m);

	for(ll i=m/n;i>=1;i--)

	{

		if(m%i==0)

		{

			if(m/i>=n)

			{

				printf("%lld\n",i);

				return 0;

			}

		}

	}

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

	return 0;	

}

// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

int main()

{

	int n,m,k;

	scanf("%d%d",&n,&m);

	k=m/n;

	for(int i=k;i>=1;i--)

	if(m%i==0)

	{

		printf("%d",i);

		return 0;

	}

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main()

{

	long long n,m,maxn;

	scanf("%lld%lld",&n,&m);

	if(m%n==0)

	{cout<<m/n;

	return 0;}

	for(long long i=1;i<=m;i++)

	{

		if(m%i==0&&n*i<=m)

		{

		maxn=i;}

		if(n*i>m)break;

	}

	cout<<maxn;

	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

int main()

{

	int n,m,k;

	scanf("%d%d",&n,&m);

	k=m/n;

	for(int i=k;i>=1;i--)

	if(m%i==0)

	{

		printf("%d",i);

		return 0;

	}

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define chmin(a, b) a=min(a, b)

#define chmax(a, b) a=max(a, b)

#define fs first

#define sc second

#define eb emplace_back

using namespace std;



typedef long long ll;

typedef pair<int, int> P;

typedef tuple<int, int, int> T;



int MOD=1e9+7;

ll INF=1e18;



int dx[]={1, -1, 0, 0};

int dy[]={0, 0, 1, -1};



int main(){

    int n, m; cin>>n>>m;

    bool isprime=true;

    for(int i=2; i*i<=m; i++){

        if(m%i==0) isprime=false;

    }

    if(isprime){

        cout << 1 << endl;

        return 0;

    }



    for(int i=n; i<=m; i++){

        if(m%i==0){

            cout << m/i << endl;

            return 0;

        }

    }

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

#define chmin(a, b) a=min(a, b)

#define chmax(a, b) a=max(a, b)

#define fs first

#define sc second

#define eb emplace_back

using namespace std;



typedef long long ll;

typedef pair<int, int> P;

typedef tuple<int, int, int> T;



int MOD=1e9+7;

ll INF=1e18;



int dx[]={1, -1, 0, 0};

int dy[]={0, 0, 1, -1};



int main(){

    int n, m; cin>>n>>m;

    for(int i=m/n; ; i--){

        if(m%i==0){

            cout << i << endl;

            return 0;

        }

    }

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }



/* attention

    long longのシフト演算には気をつけよう

    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも

*/



int main(){

    int N, M; cin >> N >> M;



    int ans = 1;

    for(int i=1; i*i<=M; i++){

        if(M%i == 0){

            if(M/i >= N) ans = max(ans, i);

            if(i >= N) ans = max(ans, M/i);

        }

    }



    cout << ans << endl;

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

 

/* attention

    long longのシフト演算には気をつけよう

    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも

*/



int main(){

    ll N, M; cin >> N >> M;

    for(ll a=M/N; a>=1; a--){

        if(M%a == 0){

            cout << a << endl;

            return 0;

        }

    }

}

// Fastest known solution for this problem:
// Original C++ solution (slower):


#include <iostream>

#include <cstdio>

#include <algorithm>

#include <cstring>

#include <cmath>

 

using namespace std;

int n, m;

int ans;

 

int main()

{

    scanf("%d%d",&n,&m);

    int c = m/n;

    int b = sqrt(m);

    c = min(c, b);

    for (int i = 1; i * i <= m; ++i)

    {

        if (m % i == 0) 

        {

            int i1 = i;

            int i2 = m / i;

            if (i1 <= m / n) ans = max(ans, i1); 

            if (i2 <= m / n) ans = max(ans, i2);

        }

    }

    cout << ans;

}


// Optimized solution to the same problem (faster):
#include <iostream>

#include <string>

#include <cstring>

#include <cstdio>

#include <map>

#include <set>

#include <queue>

#include <stack>

#include <algorithm>

#include <cstdlib>

#include <cmath>

#include <vector>

#include <iomanip>

#if __cplusplus >= 201103L

#include <unordered_map>

#include <unordered_set>

#endif

#define fi first

#define se second

#define ll long long

#define pb push_back

#define int long long

#define vi vector<int>

#define lowbit(x) x&(-x)

#define pii pair<int,int>

#define umap unordered_map

#define uset unordered_set

#define all(x) x.begin(),x.end()

#define mem(a,b) memset(a,b,sizeof(a))

#define IOS ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);



using namespace std;



const int INF = 0x3f3f3f3f;







signed main() {

	IOS;

#ifdef xiaofan

	freopen("in.txt","r",stdin);

#endif

	int n,m;

	cin>>n>>m;

	for(int i=m/n;i>=1;i--){

		if(m%i==0){

			if(m/i>=n){

				cout<<i<<endl;

				break;

			}

		}

	}

	

	







#ifdef xiaofan

	cerr<<"Time elapsed: "<<1.0*clock()/CLOCKS_PER_SEC<<"s.\n";

#endif

	return 0;

}




// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define rep(i, n) for(int i = 0; i < (n); i++)

#define rep1(i, n) for(int i = 1; i <= (n); i++)

#define co(x) cout << (x) << "\n"

#define cosp(x) cout << (x) << " "

#define ce(x) cerr << (x) << "\n"

#define cesp(x) cerr << (x) << " "

#define Would

#define you

#define please





int main() {

	cin.tie(0);

	ios::sync_with_stdio(false);



	int N, M;

	cin >> N >> M;



	int M0 = M;

	int X[40000] = {};

	int Y[10000] = {};

	int dokomade = 0;



	int saidai = sqrt(M);

	for (int i = 2; i < saidai + 1; i++) {

		while (M % i == 0) {

			if (Y[i] == 0) dokomade++;

			Y[i]++;

			X[dokomade] = i;

			M /= i;

		}

	}



	int kotae = 1;



	if (M != 1) {

		dokomade++;

		Y[0]++;

		X[dokomade] = 0;

	}



	if (M0 == 1) co(1);

	else {



		int saidai = 1;



		rep1(i, dokomade) saidai *= (1 + Y[X[i]]);





		for (int i = 0; i < saidai; i++) {

			int kari = 1;



			int karii = i;

			rep(ii, dokomade) {



				if(X[ii + 1] == 0) kari *= pow(M, karii % (1 + Y[X[ii + 1]]));

				else kari *= pow(X[ii + 1], karii % (1 + Y[X[ii + 1]]));

				karii /= (1 + Y[X[ii + 1]]);



			}

			ce(kari);



			if (M0 >= 1ll * N * kari) kotae = max(kotae, kari);

		}





		co(kotae);

	}





	Would you please return 0;

}

// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define rep(i, n) for(int i = 0; i < (n); i++)

#define rep1(i, n) for(int i = 1; i <= (n); i++)

#define co(x) cout << (x) << "\n"

#define cosp(x) cout << (x) << " "

#define ce(x) cerr << (x) << "\n"

#define cesp(x) cerr << (x) << " "

#define Would

#define you

#define please





int main() {

	cin.tie(0);

	ios::sync_with_stdio(false);



	int N, M;

	cin >> N >> M;



	int saidai = sqrt(M);



	int kotae = 1;

	for (int i = 1; i < saidai + 1; i++) {

		if (M % i == 0) {

			if (M >= 1ll * N * i) kotae = max(kotae, i);

			if (M >= 1ll * N * (M / i)) kotae = max(kotae, (M / i));

		}

	}

	co(kotae);





	Would you please return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

using ll = int64_t;

using P = pair<ll, ll>;



vector<P> v;

ll ans = 0;

vector<ll> prime;

ll N, M;



void dfs(ll idx, ll now){

    if(idx == v.size()){

        if(M / now >= N) ans = max(ans, now);

        return;

    }

    ll mul = 1;

    for(ll i = 0; i <= v[idx].second; i++){

        dfs(idx + 1, now * mul);

        mul *= v[idx].first;

    }

}



void init(){

    bool po[(ll)1e5 + 1] = {};

    for(ll i = 2; i <= 1e5; i++){

        if(po[i]) continue;

        prime.push_back(i);

        for(ll j = 1; i * j <= 1e5; j++) po[i * j] = 1;

    }

}





int main(){

    init();

    cin >> N >> M;

    ll cpy = M;

    for(auto p : prime){

        ll cnt = 0;

        while(cpy % p == 0){

            cpy /= p;

            cnt++;

        }

        if(cnt) v.push_back(P(p, cnt));

    }

    dfs(0, 1);

    cout << ans << endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;

int main(){

    int N, M;

    cin >> N >> M;

    int ans = 1;

    for(int i = 1; i * i <= M; i++){

        if(M % i) continue;

        for(int d : {i, M / i}) if(M / d >= N) ans = max(ans, d);

    }

    cout << ans << endl;

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const ll linf=0x3f3f3f3f3f3f3f3f;

int main() {

#ifdef LOCAL

    freopen("in.txt", "r", stdin);

#endif

    ll a, b;

    while (~scanf("%lld%lld", &a, &b)) {

        ll ans=1;

        for (ll i = 1; i * i <= b; i++) {

            if (b % i == 0) {

                if (i * a <= b) {

                    ll tmp = b/i;

                    if (tmp * a <= b) ans = max(max(i, tmp), ans);

                    else ans = max(ans, i);

                } else {

                    break;

                }

            }

        }

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

    }



}


// Optimized solution to the same problem (faster):
#include <iostream>

#include <string>

#include <stdio.h>

#include <queue>

#include <stack>

#include <string.h>

#include <algorithm>

#include <math.h>

//#include <bits/stdc++.h>

#define ll long long

#define wtcl return

using namespace std;



inline int read()

{

	ll s = 0, f = 1;

	char ch = getchar();

	for(; ch < '0' || ch > '9'; ch = getchar()) if(ch == '-') f = - 1;

	for(; ch >= '0' && ch <= '9'; ch = getchar()) s = ((s << 3ll) + (s << 1ll) + (ch ^ 48ll));

	return s * f ;

}

int main()

{

	int n,m;



	while(cin>>n>>m)

	{

		int k = m%n;

		int l = m/n;

		if(n==1)

		{

			cout<<m<<endl;

		}

		else if(n == 2)

		{

			if(m&1)

				cout<<1<<endl;

			else cout<<m/2<<endl;

		}

		else

		{

			if(k!=0)

			{

				int ans = 1;

				for(int i=0; i<l ; i++)

				{

					if( (k+(n-1)*i+l) % (l-i) == 0 )

					{

						ans = l-i;

						break;

					}

//					int x = i*(n-1);

//					int y = m-x;

//					int z = __gcd(y,i);

//					ans = max(ans,z);

				}

				cout<<ans<<endl;

			}

			else cout<<m/n<<endl;

		}



	}

	wtcl 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main()

{

	long long n,m,ans=0;

	scanf("%lld%lld",&n,&m);

	if(n>m)

	{

		cout<<"0"<<endl;

		return 0;

	}

	if(m%n==0)

	{

		cout<<m/n<<endl;

		return 0;

	}

	for(long long i=1;i<=m;i++)

	{

		if(m%i==0&&m/i>=n)

		ans=i;

		if(m/i<n) break;

	}

	printf("%lld",ans);

	return 0;

}

// Optimized solution to the same problem (faster):
#include <iostream>

#include <string>

#include <stdio.h>

#include <queue>

#include <stack>

#include <string.h>

#include <algorithm>

#include <math.h>

//#include <bits/stdc++.h>

#define ll long long

#define wtcl return

using namespace std;



inline int read()

{

	ll s = 0, f = 1;

	char ch = getchar();

	for(; ch < '0' || ch > '9'; ch = getchar()) if(ch == '-') f = - 1;

	for(; ch >= '0' && ch <= '9'; ch = getchar()) s = ((s << 3ll) + (s << 1ll) + (ch ^ 48ll));

	return s * f ;

}

int main()

{

	int n,m;



	while(cin>>n>>m)

	{

		int k = m%n;

		int l = m/n;

		if(n==1)

		{

			cout<<m<<endl;

		}

		else if(n == 2)

		{

			if(m&1)

				cout<<1<<endl;

			else cout<<m/2<<endl;

		}

		else

		{

			if(k!=0)

			{

				int ans = 1;

				for(int i=0; i<l ; i++)

				{

					if( (k+(n-1)*i+l) % (l-i) == 0 )

					{

						ans = l-i;

						break;

					}

//					int x = i*(n-1);

//					int y = m-x;

//					int z = __gcd(y,i);

//					ans = max(ans,z);

				}

				cout<<ans<<endl;

			}

			else cout<<m/n<<endl;

		}



	}

	wtcl 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



int main()

{

    ios::sync_with_stdio(false);

    int n, m, ans = -1;

    cin >> n >> m;

    for (int i = 1; i * i <= m; i++)

    {

        if (m % i == 0)

        {

            if (i <= m / n)

                ans = max(ans, i);

            if (i >= n)

                ans = max(ans, m / i);

        }

    }

    cout << ans << endl;

    return 0;

}

// Optimized solution to the same problem (faster):
#include <iostream>

#include <string>

#include <stdio.h>

#include <queue>

#include <stack>

#include <string.h>

#include <algorithm>

#include <math.h>

//#include <bits/stdc++.h>

#define ll long long

#define wtcl return

using namespace std;



inline int read()

{

	ll s = 0, f = 1;

	char ch = getchar();

	for(; ch < '0' || ch > '9'; ch = getchar()) if(ch == '-') f = - 1;

	for(; ch >= '0' && ch <= '9'; ch = getchar()) s = ((s << 3ll) + (s << 1ll) + (ch ^ 48ll));

	return s * f ;

}

int main()

{

	int n,m;



	while(cin>>n>>m)

	{

		int k = m%n;

		int l = m/n;

		if(n==1)

		{

			cout<<m<<endl;

		}

		else if(n == 2)

		{

			if(m&1)

				cout<<1<<endl;

			else cout<<m/2<<endl;

		}

		else

		{

			if(k!=0)

			{

				int ans = 1;

				for(int i=0; i<l ; i++)

				{

					if( (k+(n-1)*i+l) % (l-i) == 0 )

					{

						ans = l-i;

						break;

					}

//					int x = i*(n-1);

//					int y = m-x;

//					int z = __gcd(y,i);

//					ans = max(ans,z);

				}

				cout<<ans<<endl;

			}

			else cout<<m/n<<endl;

		}



	}

	wtcl 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;



typedef long long ll;



vector<ll>div(ll n)

{

    ll i,a,b;

    vector<ll>res;

    for(i=1; i<=sqrt(n); i++)

    {

        if(n%i==0)

        {

            a=n/i;

            res.push_back(i);

            if(a!=i)res.push_back(a);

        }

    }

    sort(res.begin(),res.end());



    return res;

}



int main()

{



    ll n,a,b,i,m;

    cin >> n >> m;

    vector<ll>v=div(m);

    reverse(v.begin(),v.end());

    for(i=0; i<v.size(); i++)

    {

        a=v[i];

        b=m/a;

        if(b>=n)

        {

            cout << a << "\n";

            return 0;

        }

    }

    cout << 1 << "\n";







    return 0;

}




// Optimized solution to the same problem (faster):
#include <iostream>

#include <string>

#include <stdio.h>

#include <queue>

#include <stack>

#include <string.h>

#include <algorithm>

#include <math.h>

//#include <bits/stdc++.h>

#define ll long long

#define wtcl return

using namespace std;



inline int read()

{

	ll s = 0, f = 1;

	char ch = getchar();

	for(; ch < '0' || ch > '9'; ch = getchar()) if(ch == '-') f = - 1;

	for(; ch >= '0' && ch <= '9'; ch = getchar()) s = ((s << 3ll) + (s << 1ll) + (ch ^ 48ll));

	return s * f ;

}

int main()

{

	int n,m;



	while(cin>>n>>m)

	{

		int k = m%n;

		int l = m/n;

		if(n==1)

		{

			cout<<m<<endl;

		}

		else if(n == 2)

		{

			if(m&1)

				cout<<1<<endl;

			else cout<<m/2<<endl;

		}

		else

		{

			if(k!=0)

			{

				int ans = 1;

				for(int i=0; i<l ; i++)

				{

					if( (k+(n-1)*i+l) % (l-i) == 0 )

					{

						ans = l-i;

						break;

					}

//					int x = i*(n-1);

//					int y = m-x;

//					int z = __gcd(y,i);

//					ans = max(ans,z);

				}

				cout<<ans<<endl;

			}

			else cout<<m/n<<endl;

		}



	}

	wtcl 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;



int n,m;

vector <int> veca;



int main()

{

    cin >> n >> m;

    for (int i=1;i<=sqrt(m);i++)

    {

        if (m%i==0)

        {

            if ((m/(m/i))>=n)

                veca.push_back(m/i);

            if ((m/i)>=n)

                veca.push_back(i);

        }

    }

    sort(veca.begin(),veca.end());

    cout << veca[veca.size()-1] << endl;

}


// Optimized solution to the same problem (faster):
#include <iostream>

#include <string>

#include <stdio.h>

#include <queue>

#include <stack>

#include <string.h>

#include <algorithm>

#include <math.h>

//#include <bits/stdc++.h>

#define ll long long

#define wtcl return

using namespace std;



inline int read()

{

	ll s = 0, f = 1;

	char ch = getchar();

	for(; ch < '0' || ch > '9'; ch = getchar()) if(ch == '-') f = - 1;

	for(; ch >= '0' && ch <= '9'; ch = getchar()) s = ((s << 3ll) + (s << 1ll) + (ch ^ 48ll));

	return s * f ;

}

int main()

{

	int n,m;



	while(cin>>n>>m)

	{

		int k = m%n;

		int l = m/n;

		if(n==1)

		{

			cout<<m<<endl;

		}

		else if(n == 2)

		{

			if(m&1)

				cout<<1<<endl;

			else cout<<m/2<<endl;

		}

		else

		{

			if(k!=0)

			{

				int ans = 1;

				for(int i=0; i<l ; i++)

				{

					if( (k+(n-1)*i+l) % (l-i) == 0 )

					{

						ans = l-i;

						break;

					}

//					int x = i*(n-1);

//					int y = m-x;

//					int z = __gcd(y,i);

//					ans = max(ans,z);

				}

				cout<<ans<<endl;

			}

			else cout<<m/n<<endl;

		}



	}

	wtcl 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>



using namespace std;



int main(){

	int n, m, ans = 1;

	cin >> n >> m;

	if(n == 1){

		ans = m;

	}else{

		for(int i = 2; n * i <= m; i++){

			if((m - n * i) % i == 0){

				ans = i;

			}

		}

	}

	cout << ans << endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include<iostream>



using namespace std;



int main(){

	int n, m, ans = 1;

	cin >> n >> m;

	for(int i = m / n; i >= 1; i--){

		if((m - n * i) % i == 0){

			ans = i;

			break;

		}

	}

	cout << ans << endl;

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):


#include <algorithm>

#include <bitset>

#include <cmath>

#include <cstdio>

#include <cstdlib>

#include <ctime>

#include <deque>

#include <functional>

#include <iomanip>

#include <iostream>

#include <list>

#include <map>

#include <numeric>

#include <queue>

#include <set>

#include <sstream>

#include <stack>

#include <utility>

#include <vector>





using namespace std;



int main(){



	long N, M, max;



	long ans = 1;



	cin >> N >> M;



	if (N == 1) {

		cout << M << endl;

		return 0;

	}

	max = (M / N);



	for(long i = 2; i <= max; i++){

		if(M % i == 0) ans = i;

	}



	cout << ans << endl;



	return 0;

}


// Optimized solution to the same problem (faster):


#include <algorithm>

#include <bitset>

#include <cmath>

#include <cstdio>

#include <cstdlib>

#include <ctime>

#include <deque>

#include <functional>

#include <iomanip>

#include <iostream>

#include <list>

#include <map>

#include <numeric>

#include <queue>

#include <set>

#include <sstream>

#include <stack>

#include <utility>

#include <vector>





using namespace std;



int main(){



	long N, M, max;



	long ans = 1;



	cin >> N >> M;



	max = M/N;



	for(long i = max; i > 0; i--){

		if(M % i == 0){

		 	ans = i;

			break;

		}

	}



	cout << ans << endl;



	return 0;

}


// Fastest known solution for this problem: