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 (Python):










import math

N, P = map(int, input().split())
ans = 1
target = 2
sum = {}

while True:
    if P % target == 0:
        if target in sum:
            sum[target] += 1
        else:
            sum[target] = 1
        P /= target
        target = 2
    else:
        target += 1
    if math.sqrt(P) < target:
        P = int(P)
        if P in sum:
            sum[P] += 1
        else:
            sum[P] = 1
        break

for fact in sum:
    
    while sum[fact] >= N:
        sum[fact] -= N
        ans *= fact

print("{}".format(ans))

Solution (Python):
import math


def get_max(n, p):
    factors = []
    counts = []

    count = 0
    while p % 2 == 0:
        count += 1
        p = p / 2

    if count > 0:
        factors.append(2)
        counts.append(count)

    for i in xrange(3, int(math.sqrt(p)) + 1, 2):
        

        count = 0
        while p % i == 0:
            count += 1
            p = p / i

        if count > 0:
            factors.append(i)
            counts.append(count)

    if p > 2:
        factors.append(p)
        counts.append(1)

    if len(factors) == 0:
        return 1

    i = len(factors) - 1

    ans = 1

    while i >= 0:

        

        if counts[i] >= n:

            power = int(counts[i]/n)
            ans *= factors[i]**power

        i -= 1

    return ans

N, P = map(int, raw_input().split())
print get_max(N, P)

Solution (Python):
N, P = [int(i) for i in input().strip().split()]
dic={}
ans = 1

if N == 1:
    print(P)
    quit()
elif P == 1:
    print(1)
    quit()
    
for i in range(2,int(P**(1/2))+1):
    num = 0
    while P%i == 0:
        num = num +1
        P = int(P/i)
    dic[i] = num//N
    ans = ans*(i**(dic[i]))

print(ans)

Solution (Python):
import collections
N,P = map(int,input().split())


def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n //= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table
  
if __name__ == '__main__':

    lst = prime_decomposition(P)
    cout = collections.Counter(lst)
    ans = 1
    for p in cout.items():
        if p[1]>= N:
            ans = ans * (p[0] ** (p[1] // N))
    print(ans)

Solution (Python):
from collections import Counter

def prime_factor(n):
    res = Counter()
    for i in range(2, int(n**.5) + 1):
        while n % i == 0:
            res[i] += 1
            n //= i
    if n != 1:
        res[n] += 1
    return res

N, P = map(int, input().split())
cnt = prime_factor(P)
ans = 1
for f in cnt:
    if cnt[f] >= N:
        ans *= f ** (cnt[f] // N)
print(ans)

Solution (Python):
N, P = map(int,input().split())

def calc(n):
  num = {}
  e, i = 0, 2
  while i**2 <= n:
    while n%i == 0:
      n //= i
      e += 1
    if(e > 0):
      num[i] = e
    i += 1
    e = 0
  return num

if(N == 1):
  print(P)
  exit()
elif(P == 1):
  print(1)
  exit()
else:
  cnt = 1
  for k, v in calc(P).items():
    if(v >= N):
      cnt *= k ** (v//N)
  print(cnt)

Solution (Python):
N,P = map(int,input().split())
r = round(P**(1/N))
for i in range(r,0,-1):
    if P%(i**N)==0:
        print(i)
        exit()

Solution (Python):
n, p = map(int, input().split())
if n == 1 or p== 1:
    print(p)
    exit()
c2 = 0
while p%2 == 0:
    c2 += 1
    p//=2
c = 2**(c2//n)
i = int(p**(1/n))+1
if i%2 == 0:
    i -= 1
while i > 1:
    if p%(i**n) == 0:
        print(c*i)
        exit()
    else:
        i -= 2
print(c)

Solution (Python):
n,p=map(int,input().split())

def factorize(n):
    fct = []  
    b, e = 2, 0  
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

kekka=factorize(p)

ans=1
for i in range(len(kekka)):
    ans=ans* kekka[i][0] ** (kekka[i][1]//n)
print(ans)

Solution (Python):
import math
N,P = map(int,input().split())
Max = 1
if N==1:print(P)
else:
    for m in range(1,int(math.sqrt(P))+1):
        if P%m == 0:
            if m == int(m**(1/N)+0.1)**N and Max < int(m**(1/N)+0.1):
                    Max = int(m**(1/N)+0.1)
            if P//m == int((P//m)**(1/N)+(0.1)**1)**N and Max < int((P//m)**(1/N)+(0.1)**1) :
                Max = int((P//m)**(1/N)+(0.1)**1)
    print(Max)

Solution (Python):
n, p = map(int, input().split())
if n == 1 or p== 1:
    print(p)
    exit()
c2 = 0
while p%2 == 0:
    c2 += 1
    p//=2
c = 2**(c2//n)
i = int(p**(1/n))+1
if i%2 == 0:
    i -= 1
while i > 1:
    if p%(i**n) == 0:
        print(c*i)
        exit()
    else:
        i -= 1
print(c)

Solution (Python):
n, p = map(int, input().split())
if n == 1 or p== 1:
    print(p)
    exit()
c2 = 0
while p%2 == 0:
    c2 += 1
    p//=2
c = 2**(c2//n)
i = int(p**(1/n))+1
if i%2 == 0:
    i -= 1
while i > 1:
    if p%(i**n) == 0:
        print(c*i)
        exit()
    else:
        i -= 2
print(c)

Solution (Python):
import math

(N,P) = map(int,input().split())

if N == 1:
    print(P)
    exit()

ans = 1
p = 2
logP = math.log(P)
while N * math.log(p) <= logP:
    k = 0
    while P % p == 0:
        P //= p
        k += 1
    ans *= p**(k//N)
    if k > 0:
        logP = math.log(P)

    r = p % 6
    if r == 1:
        p += 4
    elif r == 5:
        p += 2
    else:
        p += 1

print(ans)

Solution (Python):
import math
from sys import stdin
N,P=[int(x) for x in stdin.readline().rstrip().split()]
po=math.pow(P,(1/N))
for i in reversed(range(int(round(po,0))+1)):
    tmp=math.pow(i,N)
    if P==1:
        ans=1
        break
    if N==1:
        ans=P
        break
    if P%tmp==0:
        ans=i
        break
print(ans)

Solution (Python):
N,P = map(int,input().split())
r = round(P**(1/N))
for i in range(r,0,-1):
    if P%(i**N)==0:
        print(i)
        exit()

Solution (Python):
from collections import deque,Counter
n,p=map(int,input().split())






if p==1:
  print(1)
  exit()
if p==1:
  print(p)
  exit()

def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors
factors=Counter(prime_factors(p))
ans=1
for i,v in factors.items():
  ans*=i**(v//n)
print(ans)

Solution (Python):
import math
from sys import stdin
N,P=[int(x) for x in stdin.readline().rstrip().split()]
for i in reversed(range(round(math.pow(P,(1/N)))+1)):
    tmp=math.pow(i,N)
    if P==1:
        ans=1
        break
    if N==1:
        ans=P
        break
    if P%tmp==0:
        ans=i
        break
print(ans)

Solution (Python):
n,p=map(int,input().split())
root=round(p**(1/n))
for i in range(root,0,-1):
        if(p%(i**n)==0):
                print(i)
                break

Solution (Python):
import math
N, P = map(int, input().split())

for i in reversed(range(1, round(math.pow(P, 1 / N)) + 1)):
    if P % (i ** N) == 0:
        print(i)
        exit()

Solution (Python):
n, p = map(int, input().split())

if n==1:
    print(p)
else:
    out=1
    tm = int(pow(p, 1/n))
    for i in range(2,tm+1):
        while p%(i**n)==0:
            p = p//(i**n)
            out *= i
        if p < i**n:
            break
    print(out)

Solution (Python):
N, P = list(map(int, input().split()))
if N == 1:
    print(P)
    exit()
elif P == 1:
    print("1")
    exit()

ans = 1
tmp = P

for i in range(2, int(pow(P, 1 / N)) + 1):
    po = pow(i, N)
    while tmp % po == 0:
        tmp = tmp // po
        ans = ans * i
        

    if tmp < po:
        break

print(ans)

Solution (Python):
import math

N, P = map(int, input().split())
max_value = round(pow(P, 1/N)) + 1 
ans = 1

if N == 1:
    ans = P
else:
    for i in range(1, max_value):
        mod = i ** N
        if P % mod == 0:
            ans = i

print(ans)

Solution (Python):
N, P = [int(_) for _ in input().split()]

from math import sqrt, ceil
from collections import defaultdict

rootp = ceil(sqrt(P))

cs = defaultdict(int)

x = P
for i in range(2, rootp):
    while x % i == 0:
        cs[i] += 1
        x //= i
cs[x] += 1



result = 1

for n in cs:
    x = cs[n] // N
    if x:
        result *= n ** x

print(result)

Solution (Python):


"""
本番終了後、ちょっと修正版
"""

from collections import defaultdict
from math import sqrt


def fact_prime(num):
    d = defaultdict(int)
    
    end = int(sqrt(num)) + 1
    for i in range(2, end+1):
        cnt = 0
        
        while num % i == 0:
            num //= i
            d[i] += 1
        
        if num == 1:
            break
    
    if num != 1:
        d[num] += 1
    return d

N, P = map(int, input().split())

d = fact_prime(P)
ans = 1
for k, v in d.items():
    ans *= k ** (v // N)
print(ans)

Solution (Python):
N, P = map(int, input().split())
p = P**(1/N)
if p % 1 == 0:
    print(int(p))
    exit()

lim = int(p) + 1

dic = {}

def my(N,newP):
    for i in range(2,lim+1):
        while newP % i == 0:
            dic[i] = dic.get(i,0) + 1
            newP = newP // i
        if newP < i or i == lim:
            res = 1
            for j,k in dic.items():
                res *= j**(k//N)
            print(res)
            exit()
my(N,P)

Solution (Python):
N,P=map(int,input().split())
maxfac = round(P**(1/N))

if N==1:
    print(P)
    exit()
for i in range(1,maxfac+1)[::-1]:
    p = i**N
    
    if P%p == 0:
        print(i)
        break

Solution (Python):
N,P=map(int,input().split())
maxfac = int(P**(1/N))

if N==1:
    print(P)
    exit()
elif N > 10**6:
    print(1)
    exit()
for i in range(1,maxfac+2)[::-1]:
    p = i**N
    
    if P%p == 0:
        print(i)
        break

Solution (Python):
n, p=map(int,input().split())
ans = 0
if n != 1:
    for i in range(1,int((p+1)**(1/n))+1):
        ni = i**n
        if p/ni >= 1 and p/ni == int(p/ni):
            ans = i
        elif p/ni < 1:
            break
    print(ans)
else:
    print(p)

Solution (Python):
n, p = map(int, input().split())

if n==1:
    print(p)
else:
    out=1
    tm = int(pow(p, 1/n))
    for i in range(2,tm+1):
        while p%(i**n)==0:
            p = p//(i**n)
            out *= i
        if p < i**n:
            break
    print(out)

Solution (Python):


"""
本番終了後、ちょっと修正版
"""

from collections import defaultdict
from math import sqrt


def fact_prime(num):
    d = defaultdict(int)
    
    end = int(sqrt(num)) + 1
    for i in range(2, end+1):
        cnt = 0
        
        while num % i == 0:
            num //= i
            d[i] += 1
        
        if num == 1:
            break
    
    if num != 1:
        d[num] += 1
    return d

N, P = map(int, input().split())

if N == 1:
    print(P)
    exit()
d = fact_prime(P)
ans = 1
for k, v in d.items():
    if v >= N:
        ans *= k ** (v // N)
print(ans)

Solution (Python):
import math
N, P = list(map(int, input().split()))

for i in reversed(range(1, round(math.pow(P, 1 / N)) + 1)):
    if P % (i ** N) == 0:
        print(i)
        break

Solution (Python):
n,p=map(int,input().split())
 
if n==1:
    print(p)
elif n>45:
        print(1)

else:
    x=round((p**(1/n)+1))+1
    for i in range(x,0,-1):        
                if p%(i**n)==0:
                    print(i)
                    break

Solution (Python):


import math

N,P = map(int,input().split())

def factorint(N):
    table = {}
    while(N > 1):
        for i in range(2,N+1):
            if N%i == 0:
                while N%i == 0:
                    N = N//i
                    if i in table.keys():
                        table[i] += 1
                    else:
                        table[i] = 1
                break
    return table

ans = 1
if N == 1:
    ans = P
elif 1 < N < 40:
    for i in range(2,round(P**(1/N))+1):
        if P % i**N == 0:
            ans = i

else:
    pass

print(int(ans))

Solution (Python):
n,p = map(int,input().split())
if n == 1:
    print(p)
    exit()
if n >=40:
    print(1)
    exit()
i =2
ans =1
while i**n <= p:
    if p%(i**n)==0:
        ans *= i
        p =p//(i**n)

    else:
        i += 1
print(ans)

Solution (Python):
n, p = map(int, input().split())
if n ==1:
    print(p)
else:
    for i in range(1, round(p**(1/n))+1):
        if p%(i**n) == 0:
            gcd = i
    print(gcd)

Solution (Python):
N, P = map(int, input().split())
ans = 1
 
if N >= 45:
  print(ans)
elif N == 1:
  print(P)
  
 
  
else:
  i = 1
  while(i**N <= P):
    if P % (i**N) == 0:
      ans = i
    i += 1
  print(ans)

Solution (Python):
n, p = map(int, input().split())

if n == 1:
    print(p)
    exit()

b = [False] * 1000001
prime = []
b[1] = True

for i in range(2, 1000001):
    if b[i]:
        continue
    k = i + i
    while k < 1000001:
        b[k] = True
        k += i

    prime.append(i)

prime_num = [0] * len(prime)

for i in range(len(prime)):
    while p % prime[i] == 0:
        prime_num[i] += 1
        p //= prime[i]

if sum(prime_num) == 0:
    print(1)
    exit()

idx = []
for i in range(len(prime) - 1, -1, -1):
    if prime_num[i] >= n:
        idx.append(i)

if len(idx) == 0:
    print(1)
    exit()

ans = 1
for x in idx:
    a = prime_num[x] // n
    ans *= prime[x] ** a

print(ans)

Solution (Python):
N,P = map(int, input().split())

if P == 1 :
    print(1)
elif N == 1:
    print(P)
else:
    import math

    sq_P = math.floor(math.sqrt(P))
    prim = []
    P_tmp=P

    for i in range(2,sq_P):
        r=0
        if P_tmp%i == 0:
            r+=1
            P_tmp=P_tmp/i
            while P_tmp%i==0:
                r+=1
                P_tmp=P_tmp/i
            prim.append([i,r])

    ans = 1
    for i in range(len(prim)):
        if prim[i][1]>=N:
            ans = ans * prim[i][0]**math.floor(prim[i][1]/N)

    print(ans)

Solution (Python):
import math

N, P = list(map(int, input().split()))

if N == 1:
    print(P)
else:
    for i in range(1, round(math.pow(P, 1 / N)) + 1):
        if P % (i ** N) == 0:
            now_max = i
    
    print(now_max)

Solution (Python):
from collections import Counter

N, P = map(int, input().split())

def prime_factorization(n):
    factor = []
    f = 2
    while f ** 2 <= n:
        if n % f == 0:
            factor.append(f)
            n //= f
        else:
            f += 1
    if n > 1:
        factor.append(n)
    return factor

p = prime_factorization(P)
c = Counter(p)

l = []
j = []
for k, v in c.items():
    if N <= v:
        l.append(k)
        j.append(v//N)
ans = 1

for i,v in zip(l,j):
    ans *= i**v

print(ans)

Solution (Python):
n, p = map(int, input().split())
if n == 1:
    print(p)
else:
    for i in range(1, round(p**(1/n))+1):
        if p % i**n ==0:
            res = i
    print(res)

Solution (Python):
N,P = [int(_) for _ in input().split()]
if N == 1:
    print(P)
    exit()
def addP(dP:dict,a:int):
    if a in dP:
        dP[a] += 1
    else:
        dP[a] = 1
dP = {}
iLim  = int(P**0.5)+1
for i in range(2,iLim+1):
    while P % i == 0:
        P //= i
        addP(dP,i)
    if P == 1:
        break
if P != 1:
    addP(dP,P)
iC = 1
for i in dP:
    if N <= dP[i] :
        iC *= i ** (dP[i]//N)
print(iC)

Solution (Python):
n,p = map(int,input().split())
if n == 1:
  print(p)
  exit()
a = 1
for k in range(2,1000001):
  c = 0
  while p%k == 0:
    p = p//k
    c += 1
  a *= k**(c//n)
  if p == 1:
    break
print(a)

Solution (Python):
import math


def read():
    N, P = list(map(int, input().strip().split()))
    return N, P


def solve(N, P):
    
    if N >= 40:
        return 1
    
    v3 = math.floor(P**(1/N)) + 1
    for v in range(v3, 0, -1):
        if P % (v**N) == 0:
            return v
    return 1


if __name__ == '__main__':
    inputs = read()
    print(solve(*inputs))

Solution (Python):
n,p=map(int, input().split())
ans=1
m=int(pow(p,1/n))+1
if n==1:
    print(p)
else:
    m=int(pow(p,1/n))+1
    i=2
    c=0
    while(i<=p and i<=m):
        
        if p % i == 0:
            p=p/i
            c=c+1
            if p % i != 0:
                
                ans = ans * ( i**(c//n) )
                i=i+1
                c=0
        else:
            i=i+1
    print(ans)

Solution (Python):
import math


def read():
    N, P = list(map(int, input().strip().split()))
    return N, P


def solve(N, P):
    
    if N >= 40:
        return 1
    
    v3 = math.floor(P**(1/N)) + 1
    for v in range(v3, 0, -1):
        if P % (v**N) == 0:
            return v
    return 1


if __name__ == '__main__':
    inputs = read()
    print(solve(*inputs))

Solution (Python):
n, p=map(int, input().split())
b=int(p**(1/n))+1
c=1
for i in reversed(range(1,b+1)):
  if(40<n):
    break
  if(p%i==0):
    if(p%(i**n)==0):
          c=i
          break
print(c)

Solution (Python):
n, p = map(int, input().split())
if n == 1:
    print(p)
else:
    for i in range(1, round(p**(1/n))+1):
        if p % i**n ==0:
            res = i
    print(res)

Solution (Python):
n, p = map(int, input().split())

pp = p

count_2 = 0
while True:
    if pp % 2 == 0:
        pp = pp / 2
        count_2 += 1
    else:
        break


result = 2 ** (count_2 // n)

p = p / (2 ** count_2)

kisu = True if p / 2 != 0 else False

num2 = int(p ** (1/n)) + 1
if kisu:
    num2 = num2 - 1 if num2 % 2 == 0 else num2
else:
    num2 = num2 - 1 if num2 % 2 != 0 else num2


for i in range(num2, 1, -2):
    if p % (i ** n) == 0:
        print(result * i)
        break

else:
    print(result * 1)

Solution (Python):
a,b=map(int ,input().split())
x=int(pow(b,1/a)+0.00001)
while x>=1:
    if b%(x**a)==0:
        print(x)
        exit()
    x-=1

Solution (Python):
import traceback
import fractions
from functools import reduce

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

class PrimeFractorization:
    def __init__(self):
        self.a = 2

    def decomposit_prime(self, n):
        res = []
        try:
            while n >= self.a * self.a:
                if n % self.a == 0:
                    res.append(self.a)
                    
                    n //= self.a
                else:
                    self.a += 1

            res.append(n)
            
            return res

        except Exception as e:
            raise

N,P = map(int,input().split())

obj = PrimeFractorization()
factor = obj.decomposit_prime(P)

res_fac = factor[:N]
amari = factor[N:]

index = 0
for i in amari:
    if len(res_fac)-1 < index:
        index = 0
    res_fac[index] *= i
    index += 1

print(gcd_list(res_fac))

Solution (Python):
import itertools
import numpy as np
import math

n, p = map(int, input().split())
if n != 1:
    table = [0] * (int(math.sqrt(p)) + 1)

    pl = []
    ans = 1

    for i in range(2, int(math.sqrt(p)) + 1):
        if table[i] == 0:
            pl.append(i)
            for j in range(i + i, int(math.sqrt(p)) + 1, i):
                table[j] = 1

    a = 0

    for i in range(len(pl)):
        q = p
        while q % pl[i] == 0:
            a += 1
            q = q / pl[i]
        ans = ans * (pl[i] ** (int(a//n)))
        a = 0
else:
    ans = p

print(ans)

Solution (Python):
import copy
N, P = map(int, input().split())

x=[i+1 for i in range(int(P**(1/2))) if P%(i+1)==0]
for i in range(len(x)):
    if P%x[i]==0:
        x.append(int(P/x[i]))
x.sort(reverse=True)

for i in range(len(x)):
    tmp=round(x[i]**(1/N),10)
    if tmp%int(tmp)==0:
            break

print(int(tmp))

Solution (Python):
n,p=map(int,input().split())
if n==1:
    print(p)
else:
    def r(n,p):
        d=int(p**(1/n))
        k=1
        for i in range(1,d+1):
            if p%(i**n)==0:
                k=i
        return k
    c=1
    while r(n,p)!=1:
        s=r(n,p)
        c*=s
        p=p/(s**n)
    print(c)

Solution (Python):
from math import floor

def is_integer_num(n):
    if isinstance(n, int):
        return True
    if isinstance(n, float):
        return n.is_integer()
    return False

N, P = map(int, input().split())
f = floor(P**(1/N) + 0.0000000003)
for i in range(f, 0, -1):
    a = P / (i ** N)	
    if is_integer_num(a):
        print(i)
        break

Solution (Python):
import sys
import traceback

N, P = [int(i) for i in input().split()]
p = []
ans = 1

class PrimeFractorization:
    def __init__(self):
        self.a = 2

    def decomposit_prime(self, n):
        try:
            while n >= self.a * self.a:
                if n % self.a == 0:
                    p.append(self.a)
                    n //= self.a
                else:
                    self.a += 1
            p.append(n)
        except Exception as e:
            raise

obj = PrimeFractorization()
obj.decomposit_prime(P)

p2 = set(p)

for a in p2:
    if p.count(a) >= N:
        ans *= pow(int(a),int(p.count(a)/N))

if N == 1:
    print(P)
else:
    print(ans)

Solution (Python):

import sys
import math
import numpy as np
import itertools



n, p = (int(i) for i in input().split())  

f=[]
r=2
root = math.sqrt(p)
while root >= r:
    if p % r == 0:
        f.append(r)
        p = p // r
    else:
        r += 1
if p > 2:
    f.append(p)


answer = 1
now = 1
k=0
for i in f:
    if now == i:
        k += 1
    else:
        answer = answer * (now ** (k // n) )
        now = i

        k=1
answer = answer * (now ** (k // n) )
print(answer)

Solution (Python):
import math
from fractions import gcd
import copy


def primes(x):
    if x < 2: return []

    primes = [i for i in range(x)]
    primes[1] = 0  

    
    for prime in primes:
        if prime > math.sqrt(x): break
        if prime == 0: continue
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]


n, p = map(int, input().split())
res = 1
if n == 1:
    print(p)
else:
    divide = math.ceil(pow(p, 1 / n))
    for i in reversed(range(2, divide + 1)):
        tmp = copy.copy(p)
        tmp_cnt = 0
        while tmp % i == 0 and tmp_cnt != n-1:
            tmp /= i
            tmp_cnt += 1
        if tmp_cnt == n-1:
            res = max(res, gcd(i, tmp))
    print(int(res))

Solution (Python):
n,p = map(int,input().split())

def calc(x):
    c = []
    b, e = 2, 0
    while b * b <= x:
        while x % b == 0:
            x = x // b
            e = e + 1
        if e > 0:
            c.append((b, e))
        b, e = b + 1, 0
    if x > 1:
        c.append((x, 1))
    return c   
    
if p == 1:
    print(1)
else:
    a = calc(p)
    ans = 1
    for i in range(len(a)):
        if a[i][1] >= n:
            ans *= a[i][0] ** (a[i][1] // n)
    print(ans)

Solution (Python):
n,p = map(int,input().split())
s = 0 
a = int(p)
b = {}

def calc(x):
    c = []
    b, e = 2, 0
    while b * b <= x:
        while x % b == 0:
            x = x // b
            e = e + 1
        if e > 0:
            c.append((b, e))
        b, e = b + 1, 0
    if x > 1:
        c.append((x, 1))
    return c
    
    
if p == 1:
    print(1)
else:
    d = calc(p)
    ans = 1
    for i in range(len(d)):
        if d[i][1] >= n:
            ans *= d[i][0] ** (d[i][1] // n)
    print(ans)

Solution (Python):
N, P = map(int, input().split())
if N >= 40:
  print(1)
else:
  m = int(P**(1/N))+1
  while True:
    if P % m == 0:
      x = m**N
      if P % x == 0:
        break
    m -= 1
  print(m)

Solution (Python):
n,p=map(int,input().split())
if n==1:
    print(p)
    quit()
a=[i for i in range(int(p**(1/n))+1)]
a[1]=0
b=int(p**0.5)
for j in a:
    if j>b:
        break
    elif j==0:
        continue
    for k in range(2*j,len(a),j):
        a[k]=0
c=[l for l in a if l!=0]
for m in range(len(c)):
    d=0
    while p%c[m]==0:
        p//=c[m]
        d+=1
    c[m]=[c[m],d]
e=1
for v in c:
    e*=v[0]**(v[1]//n)
print(e)

Solution (Python):
n, p = map(int, input().split())
if n == 1:
    print(p)
else:
    for i in range(1, round(p**(1/n))+1):
        if p % i**n ==0:
            res = i
    print(res)

Solution (Python):
def usage():
    product = 1
    N, P = map(int, input().split())

    fct = factorize(P)

    for i in range(len(fct)):
        fct[i][1] = fct[i][1]//N

        if fct[i][1] >= 1:
            product = product*(fct[i][0]**fct[i][1])
    print(product)
    
def factorize(n):
    fct = []  
    b, e = 2, 0  
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append([b, e])
        b, e = b + 1, 0
    if n > 1:
        fct.append([n, 1])
    return fct

if __name__ == '__main__':
    usage()

Solution (Python):
import sys

N,P=[int(i) for i in input().split()]
i=2
ans = 1
c=0
if N == 1:
  print(P)
  sys.exit()
while P>i*i-4:
  if P%i==0:
    P//=i
    c+=1
    if c==N:
      ans*=i
      c=0
  else:
    c=0
    i+=1
if P==i and c+1 ==N:
  ans*=i
print(ans)

Solution (Python):

import math

def primeFact(P):
    s = math.floor(math.sqrt(P))
    result = {}

    for i in range(2, s + 1):
        if P % i == 0:
            r = 0
            while P % i == 0:
                r += 1
                P = P // i
            result[i] = r

    if P > s:
        result[P] = 1
    return result

def gcd(N, fact):
    gcd = 1
    for key in fact.keys():
        if fact[key] >= N:
            gcd *= key ** (fact[key] // N)
    return int(gcd)

if __name__ == "__main__":
    N, P = map(int, input().split())
    fact = primeFact(P)
    print(gcd(N, fact))

Solution (Python):
N,P = map(int, input().split())

ans = 1
R = int(P**(1/N)) + 1
if N == 1:
	ans = P
elif N > 40:
	ans = 1
else:
	for l in range(R):
		if P % (R-l)**N == 0:
			ans = R-l
			break
print(ans)

Solution (Python):
N,P = (int(i) for i  in input().split())

k = P
a = 2
ans = 1
counter = 0
while(k >= a*a):
    if (k%a==0):
        k = k // a
        counter += 1
    else:
        a += 1
        counter = 0
    if counter >= N:
        ans *= a
        counter = 0
if (k%a==0):
    k = k // a
    counter += 1
else:
    a += 1
    counter = 0
if counter >= N:
    ans *= a
    counter = 0
if N == 1:
    ans = P
print(ans)

Solution (Python):
n,P=map(int,input().split())
if n==1:
	print(P)
	exit()
if n>39:
  print(1)
  exit()
ans=1
if n==2:
	for i in range(2,10**6+1):
		while P%(i**2)==0:
			ans*=i
			P/=(i**n)
	
if n==3:
	for i in range(2,10**4+1):
		while P%(i**3)==0:
			ans*=i
			P/=(i**n)
	
if n==4:
	for i in range(2,10**3+1):
		while P%(i**4)==0:
			ans*=i
			P/=(i**n)
	  
if n==5:
	for i in range(2,int(10**2.4)+1):
		while P%(i**5)==0:
			ans*=i
			P/=(i**n)
else:
	for i in range(2,101):
		while P%(i**n)==0:
			ans*=i
			P/=(i**n)
print(ans)

Solution (Python):
N, P  = list(map(int, input().split(" ")))

def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors

factors = prime_factors(P)

factor_dict = {}

first = True
for factor in factors:
    if first or before_factor != factor:
        factor_dict[factor] = 1
        first = False
    else:
        factor_dict[factor] += 1
    before_factor = factor

out = 1
for factor, num in factor_dict.items():
    if num >= N:
        out *= (factor ** (num // N))
print(out)

Solution (Python):

N,P = list(map(int, input().split()))
import math

if N == 1:
    print(P)
    exit(0)

def get_prime(n):
    """ Returns  a list of primes < n """
    sieve = [True] * n
    for i in range(3,int(n**0.5)+1,2):
        if sieve[i]:
            sieve[i*i::2*i]=[False]*((n-i*i-1)//(2*i)+1)
    return [2] + [i for i in range(3,n,2) if sieve[i]]

primax = int(1e7) + 9 * int(1e6)
primes = get_prime(primax)




def df(P, p):
    if P >= p:
        cnt = 0
        while P >= p and P % p == 0:
            P = int(P//p)
            cnt += 1
        return cnt
    else:
        raise "P , p error."

gc = []
for p in primes:
    if P % p == 0:
        cnt = df(P, p)
        P = int( P // int(p**cnt))
        gc.append([p, cnt])
ans = 1
for g,cnt in gc:
    if cnt >= N:
        ans *= g**(cnt//N)

debug = 1
for g,cnt in gc:
    debug *= g**cnt




if P > 1e9 and debug != P and  debug < P and N == 1:
    raise "errror"
print(ans)

Solution (Python):
N, P = map(int, input().split())
import math
g = 1
if N ==1:
    print(P)
else:
    for i in range(1,int((P+1)**(1/N))+1):
        X = i**N
        if X > P:
            break
        else:
            if P % X == 0:
                g = i
    print(g)

Solution (Python):
N,P = map(int, input().split())

count = 1
ans = 0

if N == 1:
    print(P)
    exit()

if N > 1000001:
    print(1)
    exit()

while True:

    if count**N > P:
        break

    if P % count**N == 0:
        ans = count

    count += 1
 
print(ans)

Solution (Python):

import collections







def prime_factor(n, length):
    ass = collections.defaultdict(int)
    
    
    
    for i in range(2, n):
        
        
        
        if i * i > n:
            break
        
        
        while n % i==0:
            ass[i] += 1
            n = n//i

    if n != 1:
        ass[n] += 1
    return ass

if __name__ == '__main__':
    length, num = list(map(int, input().split()))

    if length == 1:
        print(num)
    else:

        soinnsuu = prime_factor(num, length)
        ans = 1
        
        for data in soinnsuu.keys():
            if soinnsuu[data] >= length:
               ans *= pow(data, int(soinnsuu[data] / length))
        print(ans)