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):
from collections import Counter
from functools import reduce

N,P = list(map(int,input().split()))
def prime_factorize(n):
    while n % 2 == 0:
        yield 2
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            yield f
            n //= f
        else:
            f += 2
    if n != 1:
        yield n

counter = Counter(prime_factorize(P))

ans = reduce(lambda total, x: total * x[0] ** (x[1]//N), counter.items(), 1)
print(ans)

Solution (Python):
from collections import Counter
from functools import reduce

N,P = list(map(int,input().split()))
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

counter = Counter(prime_factorize(P))

ans = reduce(lambda total, x: total * x[0] ** (x[1]//N), counter.items(), 1)
print(ans)

Solution (Python):
import collections
N,P = list(map(int,input().split()))
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
a = sorted(collections.Counter(prime_factorize(P)).most_common(),key=lambda x: -x[0])
tmp = 1
for i in range(len(a)):
    if a[i][1] >= N:
        tmp *= a[i][0]**(a[i][1]//N)
print(tmp)

Solution (Python):
n, p = map(int, input().split())
ex_list = []
max_ex = (1, n)
if n == 1:
    ans = p
else:
    ans = 1
    for i in range(2, int(p**(1/2)+1)):
        cnt = 0
        while p % i == 0:
            p /= i
            cnt += 1
        if cnt > 1:
            ex_list.append((i, cnt))
            if cnt >= n:
                ans *= i ** int(cnt / n)
print(ans)

Solution (Python):
from collections import Counter
from functools import reduce
from operator import mul


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


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

if P == 1:
    print(1)
else:
    c = Counter(prime_factorize(P))
    d = dict((factor, e // N) for factor, e in c.items())
    print(reduce(mul, [factor ** e for factor, e in d.items()]))

Solution (Python):
from collections import defaultdict
n, p = map(int, input().split())
cnt = defaultdict(int)
if n == 1:
    print(p)
    exit()
for i in range(2, int(p ** 0.5) + 1):
    flag = False
    while p % i == 0:
        p //= i
        cnt[i] += 1
ans = 1
for k, v in cnt.items():
    ans *= k ** (v // n)

print(ans)

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


def factorization(n):
    retval = []
    tmp = n
    for p in range(2, int(n**.5)+1):
        if tmp % p == 0:
            cnt = 0
            while tmp % p == 0:
                cnt += 1
                tmp //= p
            retval.append([p, cnt])
    if tmp != 1:
        retval.append([tmp, 1])
    return retval


ans = 1
for k, v in factorization(p):
    ans *= pow(k, v//n)
print(ans)

Solution (Python):


from collections import deque,Counter


















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

def prime_factorize(n):  
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

cnt =Counter(prime_factorize(P))

ans = 1
for k,v in cnt.items():
    if v >= N:
        ans *= k**(v//N)

print(ans)

Solution (Python):
def primediv(n):
  ans = []
  hoge = n
  for i in range(2,int(-(-n**0.5//1))+1):
    if hoge%i == 0:
      c = 0
      while hoge%i == 0:
        c += 1
        hoge = hoge//i
      ans.append([i,c])
  if hoge != 1:
    ans.append([hoge,1])
  if ans == []:
    ans.append([n,1])
  return ans


n,p = map(int,input().split())
a = primediv(p)
c = 1
for k in a:
  c *= k[0]**(k[1]//n)
print(c)

Solution (Python):
from collections import Counter
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
n, p = map(int, input().split())
c = Counter(prime_factorize(p))
ans = 1
for i in c.most_common():
    ans *= i[0] ** (i[1] // n)
print(ans)

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

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
l = collections.Counter(prime_factorize(p))

ans = 1
for e in l.items():
    if (e[1] // n) >= 1:
        ans *= e[0] ** (e[1]//n)
print(ans)

Solution (Python):
def prime_factorize(n):
    res = []
    for i in range(2, int(n**(1/2))+1):
        if n % i != 0: continue
        num = 0
        while n % i == 0:
            num += 1
            n /= i
        res.append((i, num))
    if n != 1:
        res.append((n, 1))
    
    return res

n, p = map(int, input().split())

prime = prime_factorize(p)

ans = 1
for k, v in prime:
    ans *= k ** (v // n)

print(int(ans))

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 6)

def int1(x): return int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def SI(): return input().split()

def printlist(lst, k='\n'): print(k.join(list(map(str, lst))))
INF = float('inf')

from math import ceil, floor, log2
from collections import deque
from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product
from heapq import heapify, heappop, heappush


def solve():
    n, p = MI()

    def prime_factorization(n):
        res = []
        for i in range(2, int(pow(n, 0.5)) + 1):
            if n % i: continue
            ex = 0
            while n % i == 0:
                n = n // i
                ex += 1
            res.append((i, ex))
        if n != 1:
            res.append((n, 1))
        return res

    fact = prime_factorization(p)
    

    ans = 1
    for (num, ex) in fact:
        
        while ex >= n:
            ans *= num
            ex -= n
    print(ans)


if __name__ == '__main__':
    solve()

Solution (Python):
import collections



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


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


Prime = collections.Counter([1] + prime_factor(P))
values, counts = zip(*Prime.most_common())




ans = 1
for i in values:
    ans *= i**(Prime[i] // N)
print(ans)

Solution (Python):
n, p = map(int, input().split())
d = {}
while p % 2 == 0:
    if 2 not in d:
        d[2] = 1
    else:
        d[2] += 1
    p //= 2
f = 3
while f * f <= p:
    if p % f == 0:
        if f not in d:
            d[f] = 1
            p //= f 
        else:
            d[f] += 1
            p //= f
    else:
        f += 2
if p != 1:
    if p not in d:
        d[p] = 1
    else:
        d[p] += 1
d = sorted(d.items(), key=lambda x:x[1], reverse=True)
ans = 1
for k, v in d:
    if v < n:
        break
    else:
        ans *= k ** (v // n)
print(ans)

Solution (Python):
n,p=map(int,input().split());a=1;print(n<2and p or exec("for i in range(2,int(p**(1/n))+1):\n while p%(i**n)<1:a*=i;p//=i**n")or a)

Solution (Python):
n,p=map(int,input().split());a=1;print(n<2and p or exec("for i in range(2,int(p**(1/n))+1):\n while p%(i**n)<1:a*=i;p//=i**n")or a)

Solution (Python):
n,p=map(int,input().split());a=1
print(n<2and p or exec("for i in range(2,int(p**(1./n))+1):\n while p%(i**n)<1:a*=i;p//=i**n")or a)

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

from collections import defaultdict
dic = defaultdict(int)

if n == 1:
    print(P)
    exit()
i = 2
N = P
while i*i <= N:
    
    if N%i != 0:
        i += 1
        continue
    num = 0
    while N%i == 0:
        num += 1
        N//=i
    dic[i] = num
    i += 1
if N != 1:
    dic[N] = 1
ans = 1
for k,v in dic.items():
    if v//n >= 1:
        ans *= k ** (v//n)
print(ans)

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

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


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


ans = 1
for k, v in factorization(p):
    if v >= n:
        coef = v // n
        ans *= k**coef

print(ans)

Solution (Python):
n,p=map(int,input().split())
if n==1:
    print(p)
    exit()
d=dict()
pp=p
i=2
while p!=1:
    if p%i==0:
        p//=i
        if i in d:
            d[i]+=1
        else:
            d[i]=1
    elif i>pp**0.5:
        break
    else:
        i+=1
p=1
if d:
    for i,j in d.items():
        p*=i**(j//n)
    print(p)
else:
    print(1)

Solution (Python):
N,P=map(int,input().split())
ans=1
pf={}
if N==1:
    print(P)
else:
    M=P
    for p in range(2,round(M**0.5)+1):
        pf[p]=0
        while P%p==0:
            P//=p
            pf[p]+=1
        if P==1:
            break
    for p in pf:
        if pf[p]>=N:
            ans*=p**(pf[p]//N)
    print(ans)

Solution (Python):
n,p = map(int,input().split())
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


a = prime_factorize(p)

from collections import Counter
c = Counter(a)

ans = 1
for i in c:
    ans *= max(1,i**(c[i]//n))

print(ans)

Solution (Python):
n,p = map(int,input().split())
ans = 1
if n == 1:
    print(p)
else:
    cnt = 0
    while p % 2 == 0:
        p //= 2
        cnt += 1
    ans *= 2**(cnt//n)
    
    for i in range(3,int(p**(1/n))+2,2):
        cnt = 0
        while p % i == 0:
            p //= i
            cnt += 1
        
        ans *= i**(cnt//n)
        if p == 1:
            break
    print(ans)

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

def factorization(n):
    arr, temp = [], n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr

fac = list(reversed(factorization(P)))
ans = 1

for sosuu, cnt in fac:
    cnt //= N
    if cnt>0:
        ans *= (sosuu**cnt)

print(ans)

Solution (Python):
from collections import defaultdict


def factorize(N):
    P = 2
    PRIME = defaultdict(int)
    while P ** 2 <= N:
        if N % P == 0:
            N //= P
            PRIME[P] += 1
        else:
            P += 1
    if N > 1:
        PRIME[N] += 1
    return PRIME


n, p = map(int, input().split())

prime = factorize(p)
ans = 1
for j in prime:
    if prime[j] >= n:
        ans *= j ** (prime[j] // n)
print(ans)

Solution (Python):
from collections import defaultdict


def factorize(N):
    p = 2
    PRIME = defaultdict(int)
    while p * p <= N:
        if N % p == 0:
            N //= p
            PRIME[p] += 1
        else:
            p += 1
    if N > 1:
        PRIME[N] += 1
    return PRIME


n, p = map(int, input().split())

prime = factorize(p)
ans = 1
for j in prime:
    if prime[j] >= n:
        ans *= j**(prime[j]//n)
print(ans)

Solution (Python):
from collections import defaultdict

def factorize(N):
    p = 2
    PRIME = []
    while p * p <= N:
        if N % p == 0:
            N //= p
            PRIME.append(p)
        else:
            p += 1
    if N > 1:
        PRIME.append(N)
    return PRIME


n, p = map(int, input().split())

prime = factorize(p)
cnt = defaultdict(int)
for i in prime:
    cnt[i] += 1
ans = 1
for j in cnt:
    if cnt[j] >= n:
        ans *= j**(cnt[j]//n)
print(ans)

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

if N == 1:
    print(P)
else:
    _max = 1
    M = int(P ** (1 / N) + 1.0 * 1e-9)
    for i in range(1, M + 1):
        if P % (i ** N) == 0:
            _max = i

    print(_max)

Solution (Python):
def factorize(n):
    if n==1:
        return [1]
    a=[]
    while n%2==0:
        a.append(2)
        n//=2
    f=3
    while f*f<=n:
        if n%f==0:
            a.append(f)
            n//=f
        else:
            f+=2
    if n!=1:
        a.append(n)
    return a
def r(a):
    ll,l=[],1
    for i in range(len(a)-1):
        if a[i]==a[i+1]:
            l+=1
        else:
            ll.append([l,a[i]])
            l=1
    ll.append([l,a[-1]])
    return ll
n,p=map(int,input().split())
a=r(factorize(p))
b=1
for i in a:
    b*=i[1]**(i[0]//n)
print(b)

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

if N == 1:
    ans = P
else:
    ans = 1
    p = 2
    while p * p <= P:
        e = 0
        while P % p == 0:
            P //= p
            e += 1  
        if e // N > 0:
            ans *= p ** (e // N)
        p += 1

print(ans)

Solution (Python):
n,p=map(int,input().split())
d=dict()
for i in range(2,int(p**0.5)+1):
    d[i]=0
    while p%i==0:
        d[i]+=1
        p//=i
if p!=1:d[p]=1
ans=1
for i in d.keys():
    ans*=i**(d[i]//n)
print(ans)

Solution (Python):
from collections import Counter
def p_factorization(n):
  p=[]
  for i in range(2,int(n**0.5)+1):
    while n%i==0:
      p.append(i)
      n//=i
  if n>1:
    p.append(n)
  return p

n,p=map(int,input().split())
ans=1
for i,j in Counter(p_factorization(p)).items():
  ans*=(i**(j//n) if j//n>0 else 1)
print(ans)

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

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    arr.append([temp, 1])

    return arr

a = factorization(P) 
su = 1
for j,k in a:
  
  if k>=N:
    su *= j**(k//N)
    
print(su)

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

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

a = factorization(P) 
su = 1
for j,k in a:
 
  if k>=N:
    su *= j**(k//N)
  
print(su)

Solution (Python):
N,P = [int(hoge) for hoge in input().split()]
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

S = factorization(P)
ans = 1
for p in S:
    ans *= p[0]**(p[1]//N)
print(ans)

Solution (Python):
def solve():
    N, P = map(int, input().split())
    
    ans = 1
    if N==1:
        return P
    else:
        for i in range(2, int(P**(1/N)+1)):
            while P % (i**N) == 0:
                ans *= i
                P //= (i**N)
        return ans
print(solve())

Solution (Python):
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])
    if temp != 1:
        arr.append([temp, 1])
    if arr == []:
        arr.append([n, 1])
    return arr

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

vals = factorization(P)
ans = 1
for x in vals:
    flag = 1
    while flag:
        if x[1] >= N:
            ans *= x[0]
            x[1] -= N
        else:
            break
print(ans)

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



"""
>>> factorization(16)
[[2, 4]]
>>> factorization(48)
[[2, 4], [3, 1]]
"""

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])
    if temp != 1:
        arr.append([temp, 1])
    if arr == []:
        arr.append([n, 1])
    return arr
l = factorization(p)
res = 1
for num,cnt in l:
    if cnt >=n:
        cnt = cnt // n
        res *= num ** cnt
print(res)

Solution (Python):
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])
    if temp != 1:
        arr.append([temp, 1])
    if arr == []:
        arr.append([n, 1])
    return arr


n, p = map(int, input().split())
pf = factorization(p)
ans = 1
for i in pf:
    if i[1] >= n:
        ans *= i[0] ** (i[1]//n)
print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

n, p = map(int, input().split())

from collections import Counter;
def prime_factorize(n):
    d = Counter()
    m = 2
    while m*m <= n:
        while n%m == 0:
            n //= m
            d[m] += 1
        m += 1
    if n > 1:
        d[n] += 1
    return d

soinsu = prime_factorize(p)

ans =1
for k,v in soinsu.items():
    if v>=n:
        ans *= k**(v//n)

print(ans)

Solution (Python):
n, p = map(int, input().split())
di = {}
for i in range(2, int(p**0.5)+1):
    if p%i==0:
        tmp = 0
        while p%i==0:
            p //= i
            tmp += 1
        di[i] = tmp
    if p==1:
        break
else:
    di[p] = 1
ans = 1
for i, j in di.items():
    ans *= i**(j//n)
print(ans)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])
    
    if temp != 1:
        arr.append([temp, 1])
    if not arr:
        arr.append([n, 1])
    
    return arr


def solve():
    N, P = map(int, rl().split())
    
    facts = factorization(P)
    ans = 1
    for p, exp in facts:
        if N <= exp:
            ans *= p ** (exp // N)
    print(ans)


if __name__ == '__main__':
    solve()

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

import math
def div(m):
    d = {}
    temp = int(math.sqrt(m))+1
    for i in range(2, temp):
        while m%i== 0:
            m //= i
            if i in d:
                d[i] += 1
            else:
                d[i] = 1
    if d == {}:
        d[m] = 1
    else:
        if m in d:
            d[m] += 1
        elif m != 1:
            d[m] =1
    return d

d = div(p)

ans = 1
for k, v in d.items():
    if v >= n:
        q = v//n
        ans *= k**q
print(ans)

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

import math
def div(m):
    d = {}
    temp = int(math.sqrt(m))+1
    for i in range(2, temp):
        while m%i== 0:
            m //= i
            if i in d:
                d[i] += 1
            else:
                d[i] = 1
    if d == {}:
        d[m] = 1
    else:
        if m in d:
            d[m] += 1
        elif m != 1:
            d[m] =1
    return d

d = div(p)

ans = 1
for k, v in d.items():
    if v >= n:
        q = v//n
        ans *= k**q
print(ans)

Solution (Python):
from collections import Counter
n,p = [int(i) for i in input().split()]
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
        
    
    return a


c = Counter(prime_factorize(p))

ans = 1
for k,v in c.items():
    if v >= n:
        ans *= k ** (v//n)
        
print(ans)

Solution (Python):
n, p = map(int, input().split())
di = {}
for i in range(2, int(p**0.5)+1):
    if p%i==0:
        tmp = 0
        while p%i==0:
            p //= i
            tmp += 1
        di[i] = tmp
    if p==1:
        break
else:
    di[p] = 1
ans = 1
for i, j in di.items():
    ans *= i**(j//n)
print(ans)

Solution (Python):
A,B= list(map(int,input().split()))
import collections
a=[]
if A == 1:
   print(B)
   exit()
def solve(N):
   for i in range(2, int(N**0.5) + 1):
      if N % i == 0:
         while N % i == 0:
            a.append(i)
            N //= i
   return a
f_ans=1
ans=list(collections.Counter(solve(B)).most_common())
for i,j in ans:
   if j // A < 1:
      break
   else:
      f_ans*=i**(j // A)
print(f_ans)

Solution (Python):
import sys

readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def prime_factorize(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])
    if temp != 1:
        arr.append([temp, 1])
    if arr == []:
        arr.append([n, 1])
    return arr


def main():
    N, P = map(int, input().split())
    A = prime_factorize(P)
    ans = 1
    for num, count in A:
        ans *= num**(count//N)
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
from collections import Counter


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def main():
    N, P = map(int, input().split())
    ps = prime_factorize(P)
    c = Counter(ps)

    ans = 1
    for key, val in c.items():
        times = val // N
        if times:
            ans *= key ** times
    print(ans)




if __name__ == "__main__":
    main()

Solution (Python):
"""
マスターオブ整数
"""

from collections import Counter
N, P = map(int, input().split())


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

prime_list = []

for i in range(2, int(P**0.5) + 1):
    if P % i == 0:
        while P % i == 0:
            prime_list.append(i)
            P //= i
prime_count = Counter(prime_list)
ans = 1
for k,v in prime_count.items():
    if v >= N:
        ans *= k ** (v//N) 
print(ans)

Solution (Python):
import math
def main():
    n,p=map(int,input().split())
    if n==1:
        print(p)
    elif n>39:
        print(1)
    else:
        q=math.ceil(p**(1/n))
        ans=1
        for i in range(q,0,-1):
            if p%(i**n)==0:
                ans=i
                break
        print(ans)
if __name__=="__main__":
    main()

Solution (Python):
import math
def main():
    n,p=map(int,input().split())
    if n==1:
        print(p)
    elif n>39:
        print(1)
    else:
        q=math.ceil(p**(1/n))
        ans=1
        for i in range(q,0,-1):
            if p%(i**n)==0:
                ans=i
                break
        print(ans)
if __name__=="__main__":
    main()

Solution (Python):
n,p=map(int,input().split())
def factorize(n):
    fct={}
    temp=n
    if temp<4:
        fct[temp]=1
    else:
        e=0
        while temp%2==0:
            temp=temp//2
            e+=1
        if e>0:
            fct[2]=e
    
    for b in range(3,int(n**0.5)+1,2):
        e=0
        while temp%b == 0:
            temp=temp//b
            e+=1
        if e>0:
            fct[b]=e
    if temp!=1:
        fct[temp]=1
    return fct
q=1
d=factorize(p)

for i in d:
    if d[i]<n:
        continue
    q=q*i**(d[i]//n)
print(q)

Solution (Python):
from math import sqrt

def fact(n):
    insu = []
    for i in range(2,int(sqrt(n))+1):
        if n % i == 0:
            while n % i == 0:
                n //= i
                insu.append(i)
        if n == 1:
            break
    if n > 1:
        insu.append(n)
    return insu

def main():
    N,P = map(int,input().split())
    insu = fact(P)
    insu_set,insu_list,pt = set(),[],0
    for i in range(len(insu)):
        if insu[i] not in insu_set:
            insu_set.add(insu[i])
            insu_list.append([insu[i],1])
            pt += 1
        else:
            insu_list[pt-1][1] += 1
    for i in range(len(insu_list)):
        insu_list[i][1] //= N

    ans = 1
    for a,b in insu_list:
        ans *= a**b
    print(ans)

if __name__ =="__main__":
    main()

Solution (Python):
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

n,p = map(int,input().split())
f = factorization(p)
ans = 1
for i, ff in enumerate(f):
    if ff[1] >= n:
        ans *= ff[0] ** (ff[1]//n)
print(ans)

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

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

gcd = 1
for k, v in factorization(p):
    if v // n > 0:
        gcd *= k ** (v // n)
print(gcd)

Solution (Python):
from collections import Counter
n, p = map(int, input().split())
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f*f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

a = Counter(prime_factorize(p))
ans = 1
for key, value in a.items():
    if n <= value:
        pow = value // n
        
        
        ans *= int(key)**pow

print(ans)

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

if n==1:
    s=p
else:
    l=[]
    k=2
    while k*k<=p:
        if p%k==0:
            l.append(k)
            p=p//k
        else:k+=1
    if p>0:l.append(p)

    c=Counter(l)
    s=1
    for key,value in c.items():
        s*=key**(value//n)
print(s)

Solution (Python):
import sys
import re
import math
import collections
import decimal
import bisect
import itertools

import copy






INF = sys.maxsize
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))





def main():
    def prime_factorize(n):
        a = []
        while n % 2 == 0:
            a.append(2)
            n //= 2
        f = 3
        while f * f <= n:
            if n % f == 0:
                a.append(f)
                n //= f
            else:
                f += 2
        if n != 1:
            a.append(n)
        return a

    n, p = ns()

    d = prime_factorize(p)
    ans = 1

    c = collections.Counter(d)
    for k,v in c.items():
        if v//n > 0:
            ans *= k**(v//n)

    print(ans)


if __name__ == '__main__':
    main()

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

if N>=10**4:
    print(1)
else:
    ans=int(P**(1/N))
    ans+=1
    while ans>0:
        if P%(ans**N)==0:
            break
        ans-=1

    print(ans)

Solution (Python):
from collections import Counter

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

n,p=map(int,input().split())
c=Counter(prime_factorize(p)).most_common()
ans=1
for i in range(len(c)):
    if c[i][1]>=n:
        tmp=c[i][1]//n
        ans*=c[i][0]**tmp
print(ans)

Solution (Python):
from collections import Counter
N,P =map(int,input().split(' '))
if N==1:
    print(P)
    exit()
prime = []
f = 2
while f**2 <=P:
    if P%f==0:
        prime.append(f)
        P//=f
    else:
        f += 1
if P != 1:
    prime.append(f)

ans = 1
for k,v in Counter(prime).items():
    if v//N:
        ans *= k**(v//N)
print(ans)

Solution (Python):
from collections import defaultdict
from math import sqrt

n, p = map(int, input().split())
h = defaultdict(int)
def factorization(arg):
    while arg % 2 == 0:
        h[2] += 1
        arg /= 2
    for i in range(3, int(sqrt(arg)) + 1, 2):
        while arg % i == 0:
            h[i] += 1
            arg /= i
    if arg > 1:
        h[arg] += 1
if p == 1:
    print(1)
elif n == 1:
    print(p)
else:
    factorization(p)
    ans = 1
    for k, v in h.items():
        while v >= n:
            ans *= k
            v -= n
    print(ans)

Solution (Python):

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

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

F = factorization(P)
numbers = []
ans = 1
for i in range(len(F)):
    if F[i][1] >= N: ans *= F[i][0] ** (F[i][1]//N)


print(ans)

Solution (Python):
from collections import Counter

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

N, P = map(int, input().split())
f = Counter(prime_factorize(P))

ans = 1
for k, v in f.items():
    if v >= N:
        ans *= k ** (v//N)
print(ans)