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

#include <algorithm>

#include <vector>

#define int long long

using namespace std;



int n, k;

vector<int > a[3];



int crank(int x) {

	if(!x) return a[0].size() * a[2].size() + 1;

	int ret = 1;

	vector<int > tmp;

	if(x > 0) {

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

			for(auto j : a[i]) {

				ret += distance(tmp.begin(), lower_bound(tmp.begin(), tmp.end(), (x + j - 1) / j));

				tmp.push_back(j);

			}

			tmp.clear();

		}

		ret += (a[1].size() * (a[1].size() - 1)) / 2 + a[0].size() * a[2].size() + a[1].size() * (a[0].size() + a[2].size());

	}

	else for(auto i : a[0]) ret += a[2].size() - distance(a[2].begin(), upper_bound(a[2].begin(), a[2].end(), -x / i));

	return ret;

}



signed main() {

    cin >> n >> k;

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

        int x;

        cin >> x;

        if(x > 0) a[0].push_back(x);

        else if(!x) a[1].push_back(x);

        else a[2].push_back(-x);

    }

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

        sort(a[i].begin(), a[i].end());

    int l = -1e18, r = 1e18, ans;

    while(l <= r) {

        int mid = (l + r) >> 1;

        int rk = crank(mid);

		if(rk <= k) ans = mid, l = mid + 1;

		else r = mid - 1;

    }

	cout << ans << endl;

    return 0;

}

// Optimized solution to the same problem (faster):
#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;

}

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

#include <cstdio>

#include <fstream>

#include <algorithm>

#include <cmath>

#include <deque>

#include <vector>

#include <queue>

#include <string>

#include <cstring>

#include <map>

#include <stack>

#include <set>

#include <sstream>

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

#define ll long long

#define INF 0x3f3f3f3f 

#define MEM(x,y) memset(x,y,sizeof(x))

#define int long long

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

#define P pair<int,int>

#define  sc(a) scanf("%lld",&a)

#define pf(a) printf("%lld ",a)

using namespace std;

int a[200005];

signed main()

{       

   int q,w;

    sc(q);

    sc(w);

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

        sc(a[i]);

    sort(a, a + q);

    int  l1 = -1e18 - 10;

    int r1 = 1e18 + 10;

    while (r1-l1>1) {

        int mid1 = (l1 + r1) / 2;

        int temp = 0;

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

        {

            if (a[i] < 0) {

                int l = i, r = q;

                while (r-l>1)

                {

                    int mid = (l + r) / 2;

                    if (a[i] * a[mid] <= mid1) r = mid;

                    else l = mid;

                }

                temp += q - r;

            }

            else {

                int l = i, r = q;

                while (r-l>1)

                {

                    int mid = (l + r) / 2;

                    if (a[i] * a[mid] <= mid1) l = mid;

                    else r = mid;

                }

                temp += l - i;

            }

        }

        if (temp < w) l1 = mid1;

        else r1 = mid1;

    }

    pf(r1);



}


// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

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

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


// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

	}

}

// Optimized solution to the same problem (faster):
#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;

	}

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

  }

}

// Optimized solution to the same problem (faster):
#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");

  }

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#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);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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?


// Optimized solution to the same problem (faster):
#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);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

} 

// Optimized solution to the same problem (faster):
#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);

}

// 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,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;

}








// Optimized solution to the same problem (faster):
#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);

}

// Fastest known solution for this problem: