stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <bits/stdc++.h>



using namespace std;



typedef long long ll;

typedef unsigned long long ull;

typedef vector<int> vi;

typedef vector<ll> vl;

typedef pair<int, int> pii;

typedef pair<ll, ll> pll;



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

#define FOR(i, a, b) for(int i=(a); i<(b); ++i)

#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)



#define DEBUG(x) cout<<#x<<": "<<x<<'\n'

#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'

#define ALL(a) (a).begin(), (a).end()



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

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



const ll MOD=1000000007ll;

// const ll MOD=998244353ll;

#define FIX(a) ((a)%MOD+MOD)%MOD



const double EPS=1e-11;

#define EQ0(x) (abs((x))<EPS)

#define EQ(a, b) (abs((a)-(b))<EPS)



ll gcd(ll a, ll b){

	if(b==0){

		return a;

	}

	return gcd(b, a%b);

}



// 約数を求める

vl divisor(ll n){

	vl res;

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

		if(n%i==0){

			res.push_back(i);

			if(i!=n/i){

				res.push_back(n/i);

			}

		}

	}

	return res;

}



int main(){

	ios::sync_with_stdio(false);

	cin.tie(0);

	ll n, m;

	cin>>n>>m;

	if(n==1){

		cout<<m<<'\n';

		return 0;

	}

	ll ans=0;

	vl a=divisor(m);

	REP(i, a.size()){

		if(a[i]*n<=m){

			ans=max(ans, a[i]);

		}

	}

	cout<<ans<<'\n';

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 0.9699194492801433x):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;



int main(){

	ios::sync_with_stdio(false);

	cin.tie(0);

	ll n, m;

	cin>>n>>m;

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

		if(m%i==0){

			cout<<i<<'\n';

			return 0;

		}

	}

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef vector<int> vi;



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



// 約数を求める

vi divisor(int n){

	vi res;

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

		if(n%i==0){

			res.push_back(i);

			if(i!=n/i){

				res.push_back(n/i);

			}

		}

	}

	return res;

}



int main(){

	ios::sync_with_stdio(false);

	cin.tie(0);

	int n, m;

	cin>>n>>m;

	if(n==1){

		cout<<m<<'\n';

		return 0;

	}

	int ans=0;

	vi a=divisor(m);

	REP(i, a.size()){

		if(a[i]<=m/n){

			ans=max(ans, a[i]);

		}

	}

	cout<<ans<<'\n';

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 0.9698083595126483x):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;



int main(){

	ios::sync_with_stdio(false);

	cin.tie(0);

	ll n, m;

	cin>>n>>m;

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

		if(m%i==0){

			cout<<i<<'\n';

			return 0;

		}

	}

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>



using namespace std;



typedef long long ll;

typedef unsigned long long ull;

typedef vector<int> vi;

typedef vector<ll> vl;

typedef pair<int, int> pii;

typedef pair<ll, ll> pll;



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

#define FOR(i, a, b) for(int i=(a); i<(b); ++i)

#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)



#define DEBUG(x) cout<<#x<<": "<<x<<'\n'

#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'

#define ALL(a) (a).begin(), (a).end()



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

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



const ll MOD=1000000007ll;

// const ll MOD=998244353ll;

#define FIX(a) ((a)%MOD+MOD)%MOD



const double EPS=1e-11;

#define EQ0(x) (abs((x))<EPS)

#define EQ(a, b) (abs((a)-(b))<EPS)



ll gcd(ll a, ll b){

	if(b==0){

		return a;

	}

	return gcd(b, a%b);

}



// 約数を求める

vl divisor(ll n){

	vl res;

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

		if(n%i==0){

			res.push_back(i);

			if(i!=n/i){

				res.push_back(n/i);

			}

		}

	}

	return res;

}



int main(){

	ios::sync_with_stdio(false);

	cin.tie(0);

	ll n, m;

	cin>>n>>m;

	if(n==1){

		cout<<m<<'\n';

		return 0;

	}

	ll ans=0;

	vl a=divisor(m);

	REP(i, a.size()){

		if(a[i]*n<=m){

			ans=max(ans, a[i]);

		}

	}

	cout<<ans<<'\n';

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 0.9695876085798629x):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;



int main(){

	ios::sync_with_stdio(false);

	cin.tie(0);

	int n, m;

	cin>>n>>m;

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

		if(m%i==0){

			cout<<i<<'\n';

			return 0;

		}

	}

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef vector<int> vi;



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



// 約数を求める

vi divisor(int n){

	vi res;

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

		if(n%i==0){

			res.push_back(i);

			if(i!=n/i){

				res.push_back(n/i);

			}

		}

	}

	return res;

}



int main(){

	ios::sync_with_stdio(false);

	cin.tie(0);

	int n, m;

	cin>>n>>m;

	if(n==1){

		cout<<m<<'\n';

		return 0;

	}

	int ans=0;

	vi a=divisor(m);

	REP(i, a.size()){

		if(a[i]<=m/n){

			ans=max(ans, a[i]);

		}

	}

	cout<<ans<<'\n';

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 0.9694765568197574x):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;



int main(){

	ios::sync_with_stdio(false);

	cin.tie(0);

	int n, m;

	cin>>n>>m;

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

		if(m%i==0){

			cout<<i<<'\n';

			return 0;

		}

	}

	return 0;

}
// Slower C++ solution:
#include<cstdio>

#include<cstring>

#include<algorithm>

#include<iostream>

#include<cmath>

using namespace std;

int main()

{

	long long n,m;

	long long maxx=1;

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

	if(m<n)

	{

		printf("0");

		return 0;

	}

	else if(m%n==0)

	{

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

		return 0;

	}

	else 

	{

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

		{

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

			maxx=j;

			if(m<n*j)

			break;

		}

		printf("%lld",maxx);

	}

	

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.2080193888824264x):
#include <iostream>

#include <cstdio>

#include <cmath>

#include <algorithm>

using namespace std;

int main()

{

	int N, M, i;

	cin >> N >> M;

	for (i = M / N; i >= 1; i--)

	{

		if (M%i == 0) {

			cout << i << endl;

			return 0;

		}

	}

	



}
// Slower C++ solution:
#include<cstdio>

#include<cstring>

#include<algorithm>

#include<iostream>

#include<cmath>

using namespace std;

int main()

{

	long long n,m;

	long long maxx=1;

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

	if(m<n)

	{

		printf("0");

		return 0;

	}

	else if(m%n==0)

	{

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

		return 0;

	}

	else 

	{

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

		{

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

			maxx=j;

			if(m<n*j)

			break;

		}

		printf("%lld",maxx);

	}

	

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.2078117709680263x):
#include <bits/stdc++.h>

using namespace std;

int main()

{

    int n, m;

    cin >> n >> m;

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

    {

        if (m % i == 0)

        {

            int t = m / i;

            if (t >= n)

            {

                cout << i << endl;

                break;

            }

        }

    }



    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()

{

	ll i,ans=0,n,m;

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

	for(i=1;i*i<=m;i++) if(m%i==0)

	{

		if(n*i<=m) ans=max(ans,i);

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

	}

	cout<<ans<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 0.9671232650524856x):
#include <bits/stdc++.h>

using namespace std;

int main()

{

    int n, m;

    cin >> n >> m;

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

    {

        if (m % i == 0)

        {

            int t = m / i;

            if (t >= n)

            {

                cout << i << endl;

                break;

            }

        }

    }



    return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cstring>

#include <string>

#include <cstdio>

#include <cmath>

using namespace std;

const int N = 2e5 + 100;

int n, ans, m;

int main()

{

    cin >> n >> m;

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

    {

        if (m % i == 0)

        {

            if (i >= n)

                ans = max(m/i, ans);

            if (m / i >= n)

                ans = max(i, ans);

        }

    }

    cout << ans << endl;

}


// Faster C++ solution for the same problem (measured speedup: 0.9942036570186434x):
#include <bits/stdc++.h>

using namespace std;

int main()

{

    int n, m;

    cin >> n >> m;

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

    {

        if (m % i == 0)

        {

            int t = m / i;

            if (t >= n)

            {

                cout << i << endl;

                break;

            }

        }

    }



    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;





int main()

{

    int n,m,a;

    cin>>n>>m;





    a=1;





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

    {

        if(m%i==0)

        {

           if(m/i>=n) a=max(i,a);

           if(i>=n) a=max(m/i,a);

        }



    }

    cout<<a<<endl;



    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 0.9673090525834208x):
#include <bits/stdc++.h>

using namespace std;

int main()

{

    int n, m;

    cin >> n >> m;

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

    {

        if (m % i == 0)

        {

            int t = m / i;

            if (t >= n)

            {

                cout << i << endl;

                break;

            }

        }

    }



    return 0;

}
// Slower C++ solution:
#include<cstdio>

#include<cstring>

#include<algorithm>

#include<iostream>

#include<cmath>

using namespace std;

int main()

{

	long long n,m;

	long long maxx=1;

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

	if(m<n)

	{

		printf("0");

		return 0;

	}

	else if(m%n==0)

	{

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

		return 0;

	}

	else 

	{

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

		{

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

			maxx=j;

			if(m<n*j)

			break;

		}

		printf("%lld",maxx);

	}

	

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.2078117709680263x):
#include <iostream>



using namespace std;



int main()

{

    int n, m;

    cin >> n >> m;

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

    {

        if (m % i == 0)

        {

            int j = m / i;

            if (j >= n)

            {

                cout << i << endl;

                break;

            }

        }

    }

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()

{

	ll i,ans=0,n,m;

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

	for(i=1;i*i<=m;i++) if(m%i==0)

	{

		if(n*i<=m) ans=max(ans,i);

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

	}

	cout<<ans<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 0.9671232650524856x):
#include <iostream>



using namespace std;



int main()

{

    int n, m;

    cin >> n >> m;

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

    {

        if (m % i == 0)

        {

            int j = m / i;

            if (j >= n)

            {

                cout << i << endl;

                break;

            }

        }

    }

}
// Slower C++ solution:
#include <iostream>

#include <cstring>

#include <string>

#include <cstdio>

#include <cmath>

using namespace std;

const int N = 2e5 + 100;

int n, ans, m;

int main()

{

    cin >> n >> m;

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

    {

        if (m % i == 0)

        {

            if (i >= n)

                ans = max(m/i, ans);

            if (m / i >= n)

                ans = max(i, ans);

        }

    }

    cout << ans << endl;

}


// Faster C++ solution for the same problem (measured speedup: 0.9942036570186434x):
#include <iostream>



using namespace std;



int main()

{

    int n, m;

    cin >> n >> m;

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

    {

        if (m % i == 0)

        {

            int j = m / i;

            if (j >= n)

            {

                cout << i << endl;

                break;

            }

        }

    }

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;





int main()

{

    int n,m,a;

    cin>>n>>m;





    a=1;





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

    {

        if(m%i==0)

        {

           if(m/i>=n) a=max(i,a);

           if(i>=n) a=max(m/i,a);

        }



    }

    cout<<a<<endl;



    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 0.9673090525834208x):
#include <iostream>



using namespace std;



int main()

{

    int n, m;

    cin >> n >> m;

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

    {

        if (m % i == 0)

        {

            int j = m / i;

            if (j >= n)

            {

                cout << i << endl;

                break;

            }

        }

    }

}
// Slower C++ solution:
#include<cstdio>

#include<cstring>

#include<algorithm>

#include<iostream>

#include<cmath>

using namespace std;

int main()

{

	long long n,m;

	long long maxx=1;

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

	if(m<n)

	{

		printf("0");

		return 0;

	}

	else if(m%n==0)

	{

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

		return 0;

	}

	else 

	{

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

		{

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

			maxx=j;

			if(m<n*j)

			break;

		}

		printf("%lld",maxx);

	}

	

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.2198044380042845x):
#include<bits/stdc++.h>



using namespace std;



int main()

{

    long long  n, m, d, c, i;

    cin>>n>>m;

    d=m/n;

    c=m%n;

    for(i=d; i>0 ;i--)

    {

        if(c%i==0)

        {

            cout<<i<<endl;

            return 0;

        }

        c+=n;

    }

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()

{

	ll i,ans=0,n,m;

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

	for(i=1;i*i<=m;i++) if(m%i==0)

	{

		if(n*i<=m) ans=max(ans,i);

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

	}

	cout<<ans<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 0.9767260753409609x):
#include<bits/stdc++.h>



using namespace std;



int main()

{

    long long  n, m, d, c, i;

    cin>>n>>m;

    d=m/n;

    c=m%n;

    for(i=d; i>0 ;i--)

    {

        if(c%i==0)

        {

            cout<<i<<endl;

            return 0;

        }

        c+=n;

    }

}
// Slower C++ solution:
#include <iostream>

#include <cstring>

#include <string>

#include <cstdio>

#include <cmath>

using namespace std;

const int N = 2e5 + 100;

int n, ans, m;

int main()

{

    cin >> n >> m;

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

    {

        if (m % i == 0)

        {

            if (i >= n)

                ans = max(m/i, ans);

            if (m / i >= n)

                ans = max(i, ans);

        }

    }

    cout << ans << endl;

}


// Faster C++ solution for the same problem (measured speedup: 1.0040753553341009x):
#include<bits/stdc++.h>



using namespace std;



int main()

{

    long long  n, m, d, c, i;

    cin>>n>>m;

    d=m/n;

    c=m%n;

    for(i=d; i>0 ;i--)

    {

        if(c%i==0)

        {

            cout<<i<<endl;

            return 0;

        }

        c+=n;

    }

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;





int main()

{

    int n,m,a;

    cin>>n>>m;





    a=1;





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

    {

        if(m%i==0)

        {

           if(m/i>=n) a=max(i,a);

           if(i>=n) a=max(m/i,a);

        }



    }

    cout<<a<<endl;



    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 0.9769137076030467x):
#include<bits/stdc++.h>



using namespace std;



int main()

{

    long long  n, m, d, c, i;

    cin>>n>>m;

    d=m/n;

    c=m%n;

    for(i=d; i>0 ;i--)

    {

        if(c%i==0)

        {

            cout<<i<<endl;

            return 0;

        }

        c+=n;

    }

}
// Slower C++ solution:
#include<cstdio>

#include<cstring>

#include<algorithm>

#include<iostream>

#include<cmath>

using namespace std;

int main()

{

	long long n,m;

	long long maxx=1;

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

	if(m<n)

	{

		printf("0");

		return 0;

	}

	else if(m%n==0)

	{

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

		return 0;

	}

	else 

	{

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

		{

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

			maxx=j;

			if(m<n*j)

			break;

		}

		printf("%lld",maxx);

	}

	

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.2080002108064996x):
#include <bits/stdc++.h>

using namespace std;

int n,m,ans;

int main(){

    cin>>n>>m;

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

        if(m%i==0){

            int g=m/i;

            if(g>=n){

            	cout<<i<<endl;

            	return 0;

			}

        }

    }

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()

{

	ll i,ans=0,n,m;

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

	for(i=1;i*i<=m;i++) if(m%i==0)

	{

		if(n*i<=m) ans=max(ans,i);

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

	}

	cout<<ans<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 0.9672741532589353x):
#include <bits/stdc++.h>

using namespace std;

int n,m,ans;

int main(){

    cin>>n>>m;

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

        if(m%i==0){

            int g=m/i;

            if(g>=n){

            	cout<<i<<endl;

            	return 0;

			}

        }

    }

    return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cstring>

#include <string>

#include <cstdio>

#include <cmath>

using namespace std;

const int N = 2e5 + 100;

int n, ans, m;

int main()

{

    cin >> n >> m;

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

    {

        if (m % i == 0)

        {

            if (i >= n)

                ans = max(m/i, ans);

            if (m / i >= n)

                ans = max(i, ans);

        }

    }

    cout << ans << endl;

}


// Faster C++ solution for the same problem (measured speedup: 0.9943587702416152x):
#include <bits/stdc++.h>

using namespace std;

int n,m,ans;

int main(){

    cin>>n>>m;

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

        if(m%i==0){

            int g=m/i;

            if(g>=n){

            	cout<<i<<endl;

            	return 0;

			}

        }

    }

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;





int main()

{

    int n,m,a;

    cin>>n>>m;





    a=1;





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

    {

        if(m%i==0)

        {

           if(m/i>=n) a=max(i,a);

           if(i>=n) a=max(m/i,a);

        }



    }

    cout<<a<<endl;



    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 0.9674599697759867x):
#include <bits/stdc++.h>

using namespace std;

int n,m,ans;

int main(){

    cin>>n>>m;

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

        if(m%i==0){

            int g=m/i;

            if(g>=n){

            	cout<<i<<endl;

            	return 0;

			}

        }

    }

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

using ll =long long;





int main()

{

    ll n,k;

    cin>>n>>k;

    vector<ll>v;



    for(ll i=1;i*i<=k;i++)

    {

        if(k%i==0)

        {

            v.push_back(i);

            if(k/i!=i)v.push_back(k/i);

        }

    }



    ll counter;



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



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

    {

        if(k/v[i]>=n)counter=v[i];

    }

    cout<<counter<<endl;

}


// Faster C++ solution for the same problem (measured speedup: 0.9789342227466877x):
#include <bits/stdc++.h>

using namespace std;

int n,m,ans;

int main(){

    cin>>n>>m;

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

        if(m%i==0){

            int g=m/i;

            if(g>=n){

            	cout<<i<<endl;

            	return 0;

			}

        }

    }

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



#define int long long

int n, m;



int gcd(int a, int b)

{

	if(a == 0)

		return b;

	else

	{

		if(a > b) return gcd(a % b, b);

		else return gcd(b % a, a);

	}

}



inline bool check( int mid ) {

	return n * mid <= m;

}



main()

{

	int n, m, mx = 1; cin >> n >> m;

	

	if(n == m) return cout << 1, 0;

	if(m % n == 0) return cout << m / n, 0;

	if(n == 1) return cout << m << endl, 0;

	

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

	{

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

		return cout << i << endl, 0;

	}

	cout << 1 << endl;

}


// Faster C++ solution for the same problem (measured speedup: 2.908555327206202x):
#include <stdio.h>

#include <math.h>



int d[20002], e[20002], c = 0;



int main()

{	 

	int n, m, i, k, j;

	

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

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

		if(m % i == 0){

			d[c] = i;

			e[c++] = m / i;

		}

	}

	for(i = c - 1; i >= 0; i--){

		d[c] = e[i], e[c] = d[i], c++;

	}

	for(i = c - 1; i >= 0 && e[i] < n; i--);

	printf("%d\n", d[i]);

		

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define read(x) scanf("%lld",&x)

using namespace std;

const int maxn=1e5+6;

typedef long long LL;

int main() {

    LL n,m;

    read(n);

    read(m);

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

        if(m%i==0) {

            LL t=m/i;

            if(t>=n){

                cout<<i<<endl;

                break;

            }

        }

    }

}


// Faster C++ solution for the same problem (measured speedup: 2.9183600276108956x):
#include <stdio.h>

#include <math.h>



int d[20002], e[20002], c = 0;



int main()

{	 

	int n, m, i, k, j;

	

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

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

		if(m % i == 0){

			d[c] = i;

			e[c++] = m / i;

		}

	}

	for(i = c - 1; i >= 0; i--){

		d[c] = e[i], e[c] = d[i], c++;

	}

	for(i = c - 1; i >= 0 && e[i] < n; i--);

	printf("%d\n", d[i]);

		

	return 0;

}
// Slower C++ solution:
#include <iostream>

using namespace std;

int main()

{	int n,m,t;

	cin>>n>>m;

	if(m-n<10000000)

	{

		while(m%n) n++;

		cout<<m/n;

	}

	else

	{

		t=m/n;

		while(m%t) t--;

		cout<<t;

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.936319503368953x):
#include <stdio.h>

#include <math.h>



int d[20002], e[20002], c = 0;



int main()

{	 

	int n, m, i, k, j;

	

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

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

		if(m % i == 0){

			d[c] = i;

			e[c++] = m / i;

		}

	}

	for(i = c - 1; i >= 0; i--){

		d[c] = e[i], e[c] = d[i], c++;

	}

	for(i = c - 1; i >= 0 && e[i] < n; i--);

	printf("%d\n", d[i]);

		

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

long long n,m;

int main()

{

	cin>>n>>m;

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

	   {

	   	if(m%i==0)

	   	{

		    cout<<i;

	   		return 0;

		   }

	   }

	

}

// Faster C++ solution for the same problem (measured speedup: 2.93349185711157x):
#include <stdio.h>

#include <math.h>



int d[20002], e[20002], c = 0;



int main()

{	 

	int n, m, i, k, j;

	

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

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

		if(m % i == 0){

			d[c] = i;

			e[c++] = m / i;

		}

	}

	for(i = c - 1; i >= 0; i--){

		d[c] = e[i], e[c] = d[i], c++;

	}

	for(i = c - 1; i >= 0 && e[i] < n; i--);

	printf("%d\n", d[i]);

		

	return 0;

}
// Slower C++ solution:
#include<cstdio>

#include<cstring>

#include<algorithm>

#include<iostream>

#include<cmath>

using namespace std;

int main()

{

	long long n,m;

	long long maxx=1;

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

	if(m<n)

	{

		printf("0");

		return 0;

	}

	else if(m%n==0)

	{

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

		return 0;

	}

	else 

	{

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

		{

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

			maxx=j;

			if(m<n*j)

			break;

		}

		printf("%lld",maxx);

	}

	

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 3.5480465933391123x):
#include <stdio.h>

#include <math.h>



int d[20002], e[20002], c = 0;



int main()

{	 

	int n, m, i, k, j;

	

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

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

		if(m % i == 0){

			d[c] = i;

			e[c++] = m / i;

		}

	}

	for(i = c - 1; i >= 0; i--){

		d[c] = e[i], e[c] = d[i], c++;

	}

	for(i = c - 1; i >= 0 && e[i] < n; i--);

	printf("%d\n", d[i]);

		

	return 0;

}