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: Wrong Answer)

#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // コンテナ a の 要素 b から c へのイテレータ
#define MOD 1000000007ll
#define INF 1000000000
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

// まずは全探索，次にDP
// 偶奇，逆から，ソート，出現回数，DP
// 存在判定：構成方法，入力の特徴
// 例外を十分に含む一般化．想像力の限界
// 場合分け
int main() {
cin.tie(0);
ios::sync_with_stdio(false);

int64_t N, P, p; cin >> N >> P;
p = P;

if (N == 1) {
    cout << P << "\n";
    return 0;
}

// P の素因数分解で N 個以上ある素因数の積
VI cntp(1000010, 0);
int64_t i = 2;
while (i * i <= P) {
    if (p % i == 0){
        ++cntp[i];
        p /= i;
    }
    else ++i;
}
if (p == P){
    cout << "1\n";
    return 0;
}

int64_t GCD = 1;
if (p < 1000010) ++cntp[p];
else GCD *= p;
for(int64_t i = 1; i < 1000010; ++i){
    if (cntp[i] >= N) GCD *= pow(i , cntp[i] / N);
}
cout << GCD << "\n";
}

// 境界，出力文字列 チェック