stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<iostream>

#include<algorithm>

using namespace std;



const int N = 2e5+10;

long long int v[N];

long long int n, k;

long long int INF = 1e18+10;



long long int bb_p(long long int l, long long int r, long long int index, long long int query){

	if(l > r) return r;

	long long int mid = (l+r)/2ll;

	long long int value = v[mid] * v[index];

	if(value <= query) return bb_p(mid+1ll, r, index, query);

	else return bb_p(l, mid-1ll, index, query);

}



long long int bb_n(long long int l, long long int r, long long int index, long long int query){

	if(l > r) return l;

	long long int mid = (l+r)/2ll;

	long long int value = v[mid] * v[index];

	if(value <= query) return bb_n(l, mid-1ll, index, query);

	else return bb_n(mid+1ll, r, index, query);

}



bool check(long long int query){

	long long int ans = 0;

	for(long long int i=0; i < n-1ll; i++){

		if(v[i] >= 0ll) ans += bb_p(i+1ll, n-1ll, i, query) - i;

		else ans += n - bb_n(i+1ll, n-1ll, i, query);

	}

	return k <= ans;

}



long long int solve(long long int l, long long int r){

	if(l > r) return l;

	long long int query = (l+r)/2ll;

	if(check(query)) return solve(l, query-1ll);

	else return solve(query+1ll, r);

}





int main(){

	cin >> n >> k;

	for(long long int i=0; i < n; i++) cin >> v[i];

	sort(v, v+n);

	cout << solve(-INF, INF) << endl;

}

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

#include <algorithm>

#define ll long long

using namespace std;

const ll inf=1e18+10;

ll n,k,ans,a[200005];

ll find1(int now,ll x){

	int l=now+1,r=n,best=now;

	while(l<=r){

		int mid=l+r>>1;

		if(a[now]*a[mid]<=x){

			l=mid+1;

			best=mid;

		}

		else r=mid-1;

	}

	return best;

}

ll find2(int now,ll x){

	int l=now+1,r=n,best=n+1;

	while(l<=r){

		int mid=l+r>>1;

		if(a[now]*a[mid]<=x){

			r=mid-1;

			best=mid;

		}

		else l=mid+1;

	}

	return best;

}

bool check(ll x){

	ll cnt=0;   //找比 x 小的积 

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

		if(a[i]>=0) cnt+=find1(i,x)-i;

		else cnt+=n-find2(i,x)+1;

	}

	return cnt>=k;

}

int main(){

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

	for(int i=1;i<=n;i++) scanf("%lld",&a[i]);

	sort(a+1,a+n+1);

	ll l=-inf,r=inf;

	while(l<=r){

		ll mid=l+r>>1;

		if(check(mid)){

			ans=mid;

			r=mid-1;

		}

		else l=mid+1;

	}

	printf("%lld",ans);

	return 0;

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



#define ll long long

#define ld long double

#define COIN const int

#define ite iterator

#define PII pair<int,int>

#define PSI pair<string,int>

#define PIS pair<int,string>



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

#define REPD(i,n) for((i)=(n)-1;(i)>=0;(i)--)



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

#define sz(s) (s).size()

#define CLEAR(x) memset(x,0,sizeof x);



#define MP make_pair

#define pb push_back

#define pf push_front

#define ppb pop_back

#define ppf pop_front

#define X first

#define Y second



#define VI vector<int>

#define VS vector<string>

#define VII vector<PII>

#define VVI vector<VI>



#define PIII 3.1415926

#define PI 3.14

/*****************************************************************************/

const ll mod=1e9+7;

const ll INF=1e18;

/*****************************************************************************/



using namespace std;



ll f1(ll a, ll b) {

	if (a>=0) {

		return (a+b-1)/b;

	}

	else {

		return a/b;

	}

}



ll f2(ll a, ll b){

	if (a<0) {

		return (a-b+1)/b;

	}

	else {

		return a/b;

	}

}



int main()

{

	//freopen("input.txt","r",stdin);

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

	ll n,k;

	cin >>n >>k;

	vector <ll> a(n);

	for(int i=0;i<n;i++) cin >>a[i];

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

	ll l=INF,h=-INF-1;

	while (l-h>1) {

		ll m=(l+h)/2;

		ll num=0;

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

			if (a[i]<0) {

				ll v=f1(-m,-a[i]);

				num+=a.begin()+i-lower_bound(a.begin(),a.begin()+i,v);

			}

			else if (a[i]==0) {

				if(m>=0) num+=i;

			}

			else {

				ll v=f2(m,a[i]);

				num+=upper_bound(a.begin(),a.begin()+i,v)-a.begin();

			}

		}

		(num>=k?l:h)=m;

	}

	cout <<l <<endl;

	return 0;

}

/******************************************************************************

******************************************************************************/


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

#include <algorithm>

#define ll long long

using namespace std;

const ll inf=1e18+10;

ll n,k,ans,a[200005];

ll find1(int now,ll x){

	int l=now+1,r=n,best=now;

	while(l<=r){

		int mid=l+r>>1;

		if(a[now]*a[mid]<=x){

			l=mid+1;

			best=mid;

		}

		else r=mid-1;

	}

	return best;

}

ll find2(int now,ll x){

	int l=now+1,r=n,best=n+1;

	while(l<=r){

		int mid=l+r>>1;

		if(a[now]*a[mid]<=x){

			r=mid-1;

			best=mid;

		}

		else l=mid+1;

	}

	return best;

}

bool check(ll x){

	ll cnt=0;   //找比 x 小的积 

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

		if(a[i]>=0) cnt+=find1(i,x)-i;

		else cnt+=n-find2(i,x)+1;

	}

	return cnt>=k;

}

int main(){

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

	for(int i=1;i<=n;i++) scanf("%lld",&a[i]);

	sort(a+1,a+n+1);

	ll l=-inf,r=inf;

	while(l<=r){

		ll mid=l+r>>1;

		if(check(mid)){

			ans=mid;

			r=mid-1;

		}

		else l=mid+1;

	}

	printf("%lld",ans);

	return 0;

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

using namespace std;

#define ll long long

#define ull unsigned long long

#define mp make_pair

typedef pair<int,int> pii;

ll a[200009];

ll n;ll k;

int main()

{

    scanf("%d%lld",&n,&k);

    for(int i=0;i<n;i++)scanf("%lld",&a[i]);

    sort(a,a+n);

    ll l=-1e18,r=1e18;

    ll answer;

    while(l<=r)

    {

        ll mid=(l+r)/2;ll cnt=0;

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

        {

            if(a[i]>0){

                cnt+=upper_bound(a,a+n,(long double)mid/a[i])-a;

            }

            else if(a[i]<0){

                cnt+=n-(lower_bound(a,a+n,(long double)mid/a[i])-a);

            }

            else if(mid>=0)cnt+=n;

            if(a[i]*a[i]<=mid)cnt--;

        }

        if(cnt>=k*2)answer=mid,r=mid-1;

        else l=mid+1;

    }

    cout<<answer<<endl;

    return 0;

}

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

#define ll long long

#define SZ(vvv) ((int)vvv.size())

#define fastIO cout << fixed << setprecision(3), ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)

using namespace std;



const int N = 4e5 + 5, M = 205, OO = 1e9, MOD2 = 1e9 + 7;

const ll INF = 1e18;



vector<ll> pos, neg, revNeg;



ll solve(ll x) {

    ll ret = 0;

    int r = SZ(pos) - 1;

    for (int i = 0; i < SZ(pos); ++i) {

        while(r >= 0 && pos[i] * pos[r] > x)

            --r;

        ret += max(0, r - i);

    }

    r = SZ(neg) - 1;

    for (int i = 0; i < SZ(neg); ++i) {

        while(r >= 0 && neg[i] * neg[r] > x)

            --r;

        ret += max(0, r - i);

    }

    r = 0;

    for (int i = 0; i < SZ(pos); ++i) {

        while(r < SZ(revNeg) && pos[i] * revNeg[r] <= x)

            ++r;

        ret += r;

    }

    return ret;

}



void runtestcase() {

    ll n, k, x;

    cin >> n >> k;



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

        cin >> x;

        if(x >= 0)

            pos.push_back(x);

        else

            neg.push_back(x);

    }

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

    sort(neg.rbegin(), neg.rend());

    revNeg = neg;

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

    ll start = -INF, end = INF, mid, ans;

    while(start <= end) {

        mid = start + (end - start) / 2;

        if(solve(mid) >= k) {

            ans = mid;

            end = mid - 1;

        } else {

            start = mid + 1;

        }

    }

    cout << ans;

}



int main() {

    fastIO;

#ifdef LOCAL

    freopen("input.in", "rt", stdin);

//    freopen("output.in", "wt", stdout);

#endif

    int t = 1, tt = 1;

//    cin >> t;

    while(t) {

//		cout << "Case #" << tt << ':' << ' ';

        runtestcase();

//        cout << '\n';

        --t, ++tt;

    }

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

#include <map>

#include <cstring>

using namespace std;



int x[100],y[100],sx[100],sy[100],n;



int lim , N , M , X;



int dp[2][1001][101];

int main(){

	while(cin >> lim >> N >> M >> X && lim){

		memset(x,-1,sizeof(x));

		memset(y,-1,sizeof(y));

		memset(sx,-1,sizeof(sx));

		memset(sy,-1,sizeof(sy));

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

			for(int j = 0 ; j < 1001 ; j++)

				for(int k = 0 ; k < 101 ; k++)

					dp[i][j][k] = -99999999;

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

			string t; cin >> t;

			cin >> sx[i] >> sy[i];

		}

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

			string t; cin >> t;

			cin >> x[i] >> y[i];

		}

		dp[0][0][0] = 0;

		

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

			for(int j = 0 ; j <= lim ; j++){

				for(int k = 0 ; k <= M ; k++){

					dp[i&1^1][j][k] = dp[i&1][j][k];

				}

			}

			for(int j = 0 ; j+x[i]  <= lim ; j++){

				for(int k = 0 ; k < M ; k++){

					dp[i&1^1][j+x[i]][k+1] = max( dp[i&1^1][j+x[i]][k+1] , dp[i&1][j][k] + y[i]);

				}

			}

		}

		int ans = 0;

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

			for(int j = i+1 ; j < N ; j++){

				int rem = lim - sx[i] - sx[j];

				for(int w = 0 ; w <= rem ; w++){

					for(int z = X ; z <= M ; z++){

						ans = max(ans,sy[i]+sy[j]+dp[M&1][w][z]);

					}

				}

			}

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

			int rem = lim - sx[i];

			for(int w = 0 ; w <= rem ; w++){

				for(int z = X ; z <= M ; z++){

					ans = max(ans,sy[i]+dp[M&1][w][z]);

				}

			}

		}

		cout << ans << endl;

	}

}

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

#include <map>

#include <cstring>

using namespace std;



int x[100],y[100],sx[100],sy[100],n;



int lim , N , M , X;



int dp[2][1001][101];

int main(){

	while(cin >> lim >> N >> M >> X && lim){

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

			for(int j = 0 ; j <= lim ; j++)

				for(int k = 0 ; k <= M ; k++)

					dp[i][j][k] = -99999999;

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

			string t; cin >> t;

			cin >> sx[i] >> sy[i];

		}

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

			string t; cin >> t;

			cin >> x[i] >> y[i];

		}

		dp[0][0][0] = 0;

		

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

			for(int j = 0 ; j <= lim ; j++){

				for(int k = 0 ; k <= M ; k++){

					dp[i&1^1][j][k] = dp[i&1][j][k];

				}

			}

			for(int j = 0 ; j+x[i]  <= lim ; j++){

				for(int k = 0 ; k < M ; k++){

					dp[i&1^1][j+x[i]][k+1] = max( dp[i&1^1][j+x[i]][k+1] , dp[i&1][j][k] + y[i]);

				}

			}

		}

		int memory[1001]={0};

		for(int w = 0 ; w <= lim ; w++){

			for(int z = X ; z <= M ; z++){

				memory[w] = max(w?memory[w-1]:0,max(memory[w],dp[M&1][w][z]));

			}

		}

		int ans = 0;

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

			for(int j = i+1 ; j < N ; j++){

				int rem = lim - sx[i] - sx[j];

				if(rem>=0) ans = max(ans,sy[i]+sy[j]+memory[rem]);

			}

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

			int rem = lim - sx[i];

			if(rem>=0) ans = max(ans,sy[i]+memory[rem]);

		}

		cout << ans << endl;

	}

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

#include <cstdio>

#include <cstring>

#include <cmath>

#include <cstdlib>

#include <climits>

#include <algorithm>

#include <vector>

#include <map>

#include <set>

#include <queue>

#include <numeric>

#include <sstream>

#include <string>

using namespace std;

typedef long long lint;

int cn[20];

int main()

{

	lint L;

	while(cin>>L,L){

		int k = 0;

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

			if(L%i == 0){

				cn[k] = 0;

				while(L%i == 0){

					L /= i;

					cn[k]++;

				}

				k++;

			}

		}

		if(L>1) cn[k++] = 1;

		lint ans = 1;

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

			ans *= (2*cn[i]+1);

		}

		cout<<(ans/2+1)<<endl;

	}

	return 0;

}

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

int main()

{

    long long a;

    while(scanf("%lld",&a)==1)

    {

        if(a==0)break;

        long long res=1ll;

        for(long long i=2;i*i<=a;i++)

        {

            long long t=0;

            if(a%i==0)

            {

                while(a%i==0)

                {

                    a=a/i;

                    t++;

                }

                res=res*(2*t+1);

            }

        }

        if(a!=1)

        res=res*3;

        printf("%lld\n",(res+1)/2);

    }



    return 0;

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

#include<queue>

#include<algorithm>

using namespace std;



int main(){

  int q,lim,query,x;



  while(1){

    deque<int> l;

    cin >> q >> lim;

    if(!q && !lim)break;

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

      cin >> query >> x;



      if(query==0){

	l.push_back(x);

	if((int)l.size()>lim)l.pop_front();

      }

      if(query==1)l.erase(l.begin()+x-1);

      if(query==2)cout << *(l.begin()+x-1) << endl;

      if(query==3)l.erase(find(l.begin(),l.end(),x));

    }

    cout << "end" << endl;

  }

}

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

#include<queue>

#include<algorithm>

using namespace std;



int main(){

  int q,lim,query,x;



  while(1){

    deque<int> l;

    scanf("%d %d",&q,&lim);

    if(!q && !lim)break;

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

      scanf("%d %d",&query,&x);



      if(query==0){

	l.push_back(x);

	if((int)l.size()>lim)l.pop_front();

      }

      if(query==1)l.erase(l.begin()+x-1);

      if(query==2)printf("%d\n",*(l.begin()+x-1));

      if(query==3)l.erase(find(l.begin(),l.end(),x));

    }

    printf("end\n");

  }

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

using namespace std;

typedef long long l;

l o=0,ans=1;

bool ok=0,w[5000005];

int main()

{

	l n,k;

	cin>>n>>k;

	if(n==1)

	{

		cout<<k<<endl;

		return 0;

	}

	for(int i=2;ok==0;i++)

	{

		if(i*i>k)

			break;

		if(w[i]==1)

			continue;

		o=1;

		for(int c=0;c<n;c++)

		{

			o=o*i;

			if(o>k)

			{

				ok=1;

				break;

			}

		}

		if(k%o==0)

			ans=i;

		else

			for(l d=i;d<5000005;d+=i)

				w[d]=1;

	}

	cout<<ans<<endl;

	return 0;

}

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

#include <sstream>

#include <fstream>

#include <string>

#include <vector>

#include <deque>

#include <queue>

#include <stack>

#include <set>

#include <map>

#include <algorithm>

#include <functional>

#include <utility>

#include <bitset>

#include <cmath>

#include <cstdlib>

#include <ctime>

#include <cstdio>

#include <string.h>

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

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

#define INF 2147483647

#define LLINF 9223372036854775807

using namespace std;

map<long long,long long> mp;

int main(){

	long long n,p;

	cin>>n>>p;

	set<long long> s;

	long long P=p;

	vector<long long> v;

	for(long long i=2;i*i<=P;i++){

		if(P%i==0){

			while(p&&p%i==0){

				p/=i;

				s.insert(i);

				mp[i]++;

			}

			v.push_back(P/i);

		}

	}

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

		while(p&&p%v[i]==0){

			p/=v[i];

			s.insert(v[i]);

			mp[v[i]]++;

		}

	}

	if(s.size()==0){

		s.insert(P);

		mp[P]++;

	}

	long long cnt=1;

	for(set<long long> ::iterator it=s.begin();it!=s.end();it++){

		if(mp[*it]>=n){

			for(int j=0;j<mp[*it]/n;j++)cnt*=*it;

		}

	}

	cout<<cnt<<endl;

	return 0;

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

//#include <E:\codeblocksfile\c++\learning.h>

using namespace std;

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

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

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

#define scs(s) scanf("%s",s)

#define ll long long

#define pii pair<int,int>

#define mp(a,b) make_pair(a,b)

#define infi 0x7fffffff

#define infl 0x7fffffffffffffff

#ifndef GET_MACRO

#define GET_MACRO(__1,__2,__3,NAME,...) NAME

#endif // GET_MACRO

#define sci(...) GET_MACRO(__VA_ARGS__,sci3,sci2,sci1)(__VA_ARGS__)





int fill_p_q(ll n,ll* pfactor,ll* power){

    if(n<2)return 0;

    double sq=sqrt((double)n);

    ll l=(ll)sq,i;

    int j=0;

    for(i=2;i<=l;i++){

    if((n%i)==0){

        pfactor[j]=i;

        power[j]=0;

        while((n%i)==0){

            n/=i;

            power[j]++;

        }

        j++;

    }

    }

    if(n!=1){

        power[j]=1;

        pfactor[j]=n;

        j++;

    }

    return j;

}

ll pow_(ll n,ll p){

    ll ans=1;

    while(p>0){

        ans*=n;

        p--;

    }

    return ans;

}

int main(){

    //freopen("input.txt","r",stdin);

    ll n,p;

    cin>>n>>p;

    ll pfactor[100],power[100];

    int j=fill_p_q(p,pfactor,power);

    int i;

    ll ans=1;

    for(i=0;i<j;i++){

        ans*=pow_(pfactor[i],power[i]/n);

    }

    cout<<ans<<endl;

}


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

long long p,ans=1,n;

int main()

{

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

    if (n==1)

    {

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

        return 0;

    }

    for (long long i=2;i*i<=p;i++)

    {

        long long cnt=0;

        while (p%i==0) ++cnt,p=p/i;

        for (long long j=1;j*n<=cnt;j++) ans=ans*i;

    }

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

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

using namespace std;



typedef long long int lli;

typedef unsigned long long int ulli;

typedef pair<int,int> pii;

typedef priority_queue< int, vector< int >, greater< int > >  minHeap;



#define ones(x) __builtin_popcount(x)

#define onesl(x) __builtin_popcountl(x)

#define onesll(x) __builtin_popcountll(x)



#define pb push_back

#define eb emplace_back

#define mp make_pair

#define mt make_tuple

#define scn(n) scanf("%d",&n)

#define scnll(n) scanf("%lld",&n)

#define scn2(n,m) scanf("%d%d",&n,&m)

#define scn3(n,m,w) scanf("%d%d%d",&n,&m,&w)

#define scn2ll(n,m) scanf("%lld%lld",&n,&m)

#define atoz(v) v.begin(),v.end()

#define ratoz(v) v.rbegin(),v.rend()

#define Fill(a,v) memset(a,v,sizeof(a))

#define sz(v) v.size()

#define fi first

#define se second

#define inf 1e9

#define pi acos(-1.0)

#define sqr(x) x*x

#define max3(a,b,c) max(a,max(b,c))

#define min3(a,b,c) min(a,min(b,c))

#define ten(n) (int)1e##n

#define tenll(n) (lli)1e##n

#define mod 1000000007

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



int Set(int N,int pos)

{

    return N=N | (1<<pos);

}

int reset(int N,int pos)

{

    return N = N & ~(1<<pos);

}

bool check(int N,int pos)

{

    return (bool)(N & (1<<pos));

}





inline int addmod(int x ,int y){return (x%mod + y%mod)%mod;}

inline int submod(int x ,int y){return (x%mod - y%mod + mod)%mod;}

inline int mulmod(int x ,int y){return (x%mod *1LL* y%mod)%mod;}

inline int nextSubMask(int i , int mask) {return (i-1)&mask;} /// returns next smallest submask



void we_r_done(){cout<<"NO"; exit(0);}



void debug(bool ok , string mssg)

{

    if(ok)return;

    cout<<mssg;

    exit(0);

}



int main()

{

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

    ///freopen("input.txt","r",stdin);



    //FastIO;



    lli N , P;

    cin>>N>>P;



    if(N>40)cout<<1;

    else if(N == 1 || P == 1) cout<<P;

    else{

        lli ans = 1;

        for(lli i=2; (i*i) <= P; i++){



            lli pp = P;

            int j = N;

            for( ; j ; j--){

                if(pp%i) break;

                pp /= i;

            }

            if(j == 0) ans = i;

        }

        cout<<ans;

    }

    return 0;



}



///sin and cos expect input in radians not degrees. so use , sin(degrees * pi / 180)

///using bs = bitset<MX>; // how many distinct number can be form?


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

long long p,ans=1,n;

int main()

{

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

    if (n==1)

    {

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

        return 0;

    }

    for (long long i=2;i*i<=p;i++)

    {

        long long cnt=0;

        while (p%i==0) ++cnt,p=p/i;

        for (long long j=1;j*n<=cnt;j++) ans=ans*i;

    }

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

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

using namespace std;

typedef long long ll;

ll n,p;

int main() {

	ll i,ans,cnt,p,j;

	cin>>n>>p;

	ans=1;

	for (i=2;i*i<=p;i++)

		if (p%i==0) {

			cnt=0;

			while (p%i==0) cnt++,p/=i;

			for (j=1;j<=cnt/n;j++)	ans*=i;

		}

	if (p>1&&n==1) ans*=p;

	cout<<ans<<endl;

	return 0;

} 

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

long long p,ans=1,n;

int main()

{

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

    if (n==1)

    {

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

        return 0;

    }

    for (long long i=2;i*i<=p;i++)

    {

        long long cnt=0;

        while (p%i==0) ++cnt,p=p/i;

        for (long long j=1;j*n<=cnt;j++) ans=ans*i;

    }

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

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

using namespace std;

typedef long long ll;

int main()

{

    ll n,p;

    cin>>n>>p;

    if(n==1)

    {

        cout<<p<<endl;

        return 0;

    }

    int ma=1;

    for(int i=2;i<=p;i++)

    {

        if(i>1e6+5) break;  // 这个质因数是一个大素数

        int cnt=0;

        while(p%i==0)

        {

            p/=i;

            cnt++;

        }

        if(cnt>=n)

            ma*=pow(i,cnt/n);

    }

    cout<<ma;

}








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

long long p,ans=1,n;

int main()

{

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

    if (n==1)

    {

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

        return 0;

    }

    for (long long i=2;i*i<=p;i++)

    {

        long long cnt=0;

        while (p%i==0) ++cnt,p=p/i;

        for (long long j=1;j*n<=cnt;j++) ans=ans*i;

    }

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

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

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

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

using namespace std;

const int INF=1145141919,MOD=1e9+7;

const long long LINF=8931145141919364364,LMOD=998244353;

inline long long mod(long long n,long long m){return(n%m+m)%m;}

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



// unsigned long long modpow(long long a,long long n){

//     long long x=1;

//     while(n>0){

//         //nの2進数表記の右端が1

//         if(n&1){

//             x=x*a;

//         }

//         a=a*a;

//         n>>=1; //nを右に1bitずらす

//     }

//     return x;

// }

int main(){

    long long n,p; cin>>n>>p;

    if(n==1){

        cout<<p<<endl;

        return 0;

    }

    long long MAX=1;

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

        if(pow(i,n)>1e13) break;

        MAX=i+1;

    }

    long long ans=1;

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

        long long tmp=pow(i,n);

        if(p%tmp==0){

            ans=i;

        }else if(p<=tmp){

            break;

        }

    }

    cout<<ans<<endl;

    return 0;

}


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

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

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

using namespace std;

const int INF=1145141919,MOD=1e9+7;

const long long LINF=8931145141919364364,LMOD=998244353;

inline long long mod(long long n,long long m){return(n%m+m)%m;}

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



map<long long,int> mp;

vector<long long> prime_factorization(long long a){

    vector<long long> v;

    if(a==1) v.push_back(1);

    long long i=2,n=a;

    while(n>1){

        if(a<i*i){

            v.push_back(i);

            mp[n]++;

            return v;

        }

        if(n%i==0){

            n/=i;

            v.push_back(i);

            mp[i]++;

        }else{

            i++;

        }

    }

    return v;

}

int main(){

    long long n,p; cin>>n>>p;

    if(n==1){

        cout<<p<<endl;

        return 0;

    }

    vector<long long> v=prime_factorization(p);

    long long ans=1;

    for(auto i:mp){

        ans*=pow(i.first,i.second/n);

    }

    cout<<ans<<endl;

    return 0;

}