Problem:
Score : 300 points

Problem Statement

There are N integers a_1, a_2, ..., a_N not less than 1.
The values of a_1, a_2, ..., a_N are not known, but it is known that a_1 \times a_2 \times ... \times a_N = P.

Find the maximum possible greatest common divisor of a_1, a_2, ..., a_N.

Constraints

1 \leq N \leq 10^{12}

1 \leq P \leq 10^{12}

Input

Input is given from Standard Input in the following format:

N P

Output

Print the answer.

Sample Input 1

3 24

Sample Output 1

2

The greatest common divisor would be 2 when, for example, a_1=2, a_2=6 and a_3=2.

Sample Input 2

5 1

Sample Output 2

1

As a_i are positive integers, the only possible case is a_1 = a_2 = a_3 = a_4 = a_5 = 1.

Sample Input 3

1 111

Sample Output 3

111

Sample Input 4

4 972439611840

Sample Output 4

206

Solution in C++14 (GCC 5.4.1) (judge verdict: Accepted)

#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define lli long long int
#define ulli unsigned long long int
#define ui unsigned int
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define loopl(i,a,b) for(lli i=a;i<b;i++) 
#define loop(i,a,b) for(int i=a;i<b;i++)
#define mod 1000000007
#define inf 1000000000000000
#define lld long double
#define pll pair<long long int,long long int>
#define eps 0.000001
#define endl '\n'
 
using namespace std ;
 
#define MAXN 100001
//lli spf[MAXN];  
//void sieve();
//set<lli> factors(lli x);
//void getZarr(string str, lli Z[]);
 
 
//lli power(lli x,lli y,lli p);
lli cnt[1000000 + 5]={0};
vector<pll> fac(lli n) 
{ 
    vector<pll> v;
    lli count = 0; 
  
    while (n%2 == 0)
     { 
        n /= 2; 
        count++; 
    } 
  
    if (count > 0) 
        v.pb({2,count}); 
  
    for (lli i = 3; i <= sqrt(n); i += 2) { 
        count = 0; 
        while (n % i == 0) { 
            count++; 
            n = n / i; 
        } 
        if (count > 0) 
            v.pb(mp(i,count)); 
    } 
  
    if (n > 2)  
        v.pb(mp(n,1));
    return v;
} 

int main()
{  
 


    lli n,p;
    cin>>n>>p;
    
    vector<pll> q;
    q=fac(p);
    
    lli ct=1;
    for(auto x:q)
      ct=ct*(pow(x.ff,x.ss/n));
    
    cout<<ct<<endl;


    

} 
 


    /*void sieve() 
    { 
        spf[1] = 1; 
        loopl(i,2,MAXN) 
            spf[i] = i; 
        for (lli i=4; i<MAXN; i+=2) 
            spf[i] = 2; 
      
        for (lli i=3; i*i<MAXN; i++) { 
            if (spf[i] == i) { 
                for (lli j=i*i; j<MAXN; j+=i) 
                    if (spf[j]==j) 
                        spf[j] = i; 
            } 
        }
 
    } */
    /*
    multiset<lli> factors(lli x) 
    { 
        multiset<lli> pr; 
        while (x != 1) 
        { 
            pr.insert(spf[x]); 
            x = x / spf[x]; 
        } 
        return pr; 
    }
 
    */
 
 
 
    /*void getZarr(string str, lli Z[])
    {
        lli n = str.length();
        lli L, R, k;
        L = R = 0;
        for (lli i = 1; i < n; ++i){
            if (i > R){
                L = R = i;
                while (R<n && str[R-L] == str[R])
                    R++;
                Z[i] = R-L;
                R--;
            } else {
                k = i-L;
                if (Z[k] < R-i+1)
                    Z[i] = Z[k];
                else {
                    L = i;
                    while (R<n && str[R-L] == str[R])
                        R++;
                    Z[i] = R-L;
                    R--;
                }
            }
        }
    }
 
    */
 
 
   /* lli power(lli x, lli y, lli p) 
    { 
        lli res = 1;   
        x = x % p;  
        while (y > 0) 
        { 
            if (y & 1) 
                res = (res*x) % p; 
      
            y = y>>1;  
            x = (x*x) % p;   
        } 
        return res; 
    } 
    */