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):
def main():
    N, P = (int(i) for i in input().split())

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

    pf = prime_factorize(P)
    ans = 1
    for p, e in pf:
        ans *= p**(e//N)
    print(ans)


if __name__ == '__main__':
    main()

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

    def enum_divisors(n):
        
        divs = []
        for i in range(1, n+1):
            if i*i > n:
                break
            if n % i == 0:
                divs.append(i)
                if n//i != i:
                    
                    divs.append(n//i)
        return divs

    divs = enum_divisors(P)
    divs.sort()
    ans = 1
    for d in divs[-1:0:-1]:
        v = 1
        for _ in range(N):
            v *= d
            if v > P:
                break
        else:
            if P % v == 0:
                ans = d
                break
    print(ans)


if __name__ == '__main__':
    main()

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

p_nums = factorization(p)

ans = 1

for i, j in p_nums:
    if j >= n:
        ans *= i ** (j // n)
print(ans)

Solution (Python):
def prime_factorize(n):
    cnt = {}
    f = 2
    while f * f <= n:
        if n%f != 0:
            f += 1
            continue
        cnt.setdefault(f, 0)
        cnt[f] += 1
        n //= f
    if n > 1:
        cnt.setdefault(n, 0)
        cnt[n] += 1
    return cnt
n, p = map(int, input().split())
cnt = prime_factorize(p)
ans = 1
for k, v in cnt.items():
    ans *= k ** (v//n)
print(ans)

Solution (Python):
import math
def myFactorization(n):
    '''nを素因数分解する

    戻り値: factList = [[prime1, exp1], [prime2, exp2],...] 
           n=(prime1)**exp1 * (prime2)**exp2 * ...
    '''

    factList=[]
    temp=n
    cnt=0
    while(temp%2==0):
        temp=temp//2
        cnt+=1
    if(cnt>0):
        factList.append([2,cnt])

    m=int(math.sqrt(n))+1
    for i in range(3,m+1,2):
        cnt=0
        while(temp%i==0):
            temp=temp//i
            cnt+=1
        if(cnt>0):
            factList.append([i,cnt])
        if(temp==1):
            break
    if(temp>1):
        factList.append([temp,1])
    return factList

def readinput():
    n,p=list(map(int,input().split()))
    return n,p

def main(n,p):
    factList=myFactorization(p)
    gcd=1
    for fact in factList:
        gcd=gcd*fact[0]**(fact[1]//n)
    return gcd

if __name__=='__main__':
    n,p=readinput()
    ans=main(n,p)
    print(ans)

Solution (Python):
def main():
    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())
    p_fac = factorization(p)
    pp = [0] * len(p_fac)
    for i, pfe in enumerate(p_fac):
        t = pfe[1] // n
        pp[i] = t
    r = 1
    for i, ppe in enumerate(pp):
        if ppe:
            r *= (p_fac[i][0] ** ppe)
    print(r)

if __name__ == '__main__':
    main()

Solution (Python):
from math import ceil
N, P = map(int,input().split())
if N >= 40: print(1)
elif N == 1: print(P)  
else:
  ans = 1
  for i in range(1,ceil(P ** (1 / N))):
    if P % ((i + 1) ** N) == 0:
      ans = i + 1
  print(ans)

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

from collections import Counter
def 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
fac = factorize(P)

ans = 1
for k,v in fac.items():
    x = v//N
    ans *= k**x

print(ans)

Solution (Python):
from collections import Counter

class Factorize:
    def __init__(self):
        self.primes = Counter()

    def add_target(self, n):
        for i in range(2, int(n**0.5)+1):
            while n%i==0:
                self.primes[i] += 1
                n //= i
            if not n:
                break
        if n>1:
            self.primes[n] += 1
    
    def get_result(self):
        return dict(self.primes)

N, P = map(int, input().split())
fact = Factorize()
fact.add_target(P)
d = fact.get_result()
ans = 1
for i, j in d.items():
    ans *= pow(i, j//N)
print(ans)

Solution (Python):
n,p = map(int,input().split())
 
def pfact(m):
	pf = {}
	for i in range(2,int(m**0.5)+1):
		while m%i == 0:
			pf[i] = pf.get(i,0) + 1
			m //= i
	if m>1 : pf[m]=1
	return pf
 
ans = 1
for i, j in pfact(p).items():
	ans *= i**(j//n)
print(ans)

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

def pfact(m):
	pf = {}
	for i in range(2,int(m**0.5)+1):
		while m%i == 0:
			pf[i] = pf.get(i,0) + 1
			m //= i
	if m>1 : pf[m]=1
	return pf

ans = 1
for i, j in pfact(p).items():
	ans *= i**(j//n)
print(ans)

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

n,p = map(int,input().split())
ans = 1
cnt = Counter(primeFactorize(p))

for k,v in cnt.items():
    if v < n: continue
    ans *= k**(v//n)
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

l = factorization(p)
ans = 1
for i in l:
    if i[1] >= n:
        ans *= i[0]**(i[1]//n)
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

arr=factorization(p)

ans=1
for i in range(len(arr)):
    if arr[i][1]//n!=0:
        ans*=arr[i][0]**(arr[i][1]//n)

if p==1:
    ans=1
elif n==1:
    ans=p


print(ans)

Solution (Python):
import math

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

def run():
    n, p = map(int, input().split())
    l = factorization(p)
    ans = 1
    for e in l:
        num, count = e
        t = count // n
        if t > 0:
            ans *= num ** t
    print(ans)

if __name__ == '__main__':
    run()

Solution (Python):
from collections import Counter
import math
import sys


def division(n):
    factor = []
    tmp = int(math.sqrt(n)) + 1
    for num in range(2, tmp):
        while n % num == 0:
            n //= num
            factor.append(num)
    if not factor:
        return 'prime number'
    else:
        factor.append(n)
        return factor


N, P = map(int, input().split())
if N == 1:
    print(P)
    sys.exit()
elif P == 1:
    print(1)
    sys.exit()

flist = division(P)
fc = Counter(flist)
ans = 1

for num, count in fc.items():
    while count >= N:
        ans *= num
        count -= N

print(ans)

Solution (Python):
import numpy as np
from collections import defaultdict
from math import sqrt


def sieve(x):
    primes = []
    is_prime = np.ones(x + 1, bool)
    is_prime[0] = is_prime[1] = False
    for i in range(x + 1):
        if is_prime[i]:
            primes.append(i)
            is_prime[2*i::i] = False

    return primes


def prime_fact(x):
    mx = int(sqrt(x)) + 5
    primes = sieve(mx)
    pf = defaultdict(int)
    for e in primes:
        while x % e == 0:
            x //= e
            pf[e] += 1

    if x != 1:
        pf[x] += 1

    return pf


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

pf = prime_fact(p)
ans = 1
for k, v in pf.items():
    ans *= pow(k, v // 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, open(0).read().split())
p = prime_factorize(P)
c = Counter(p)
ans = 1
for x in c.items():
    if x[1] >= N:
        ans *= pow(x[0],(x[1]//N))
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
ans = 1
for i,j in factorization(p):
  if j >= n:
    ans *= i**(j//n)
print(ans)

Solution (Python):

def getprime(n):
    if not isinstance(n, int):
        raise TypeError("Input int")
    prime = []
    
    data = [i+1 for i in range(1,n)]
    while True:
        p = data[0]
        if p >= int(n**0.5):
            return prime+data
        prime.append(p)
        
        data = [d for d in data if d%p != 0]

from collections import defaultdict
def factorization(n):
    
    factors = defaultdict(int)
    if n == 1:
        return {}
    if int(n**0.5) == 1:
        return {n:1} 
    primes = getprime(int(n**0.5))
    for prime in primes:
        while n % prime == 0:
            factors[prime] += 1
            n //= prime
    if n != 1:
        factors[n] += 1
    return factors
n,p = map(int, input().split())
if p == 1:
    print(1)
    exit()
ans = 1
d = factorization(p)
for k in d.keys():
    if d[k] >= n:
        ans *= (k**(d[k]//n))
print(ans)

Solution (Python):
from collections import defaultdict
import numpy as np
d = defaultdict(int)

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

if N == 1:
  print(P)
else:
  i = 2
  while i <= P**(1/2):
    if P % i == 0:
      P //= i
      d[i] += 1
    else:
      i += 1
  d[P] += 1
  g = np.prod([k**(v//N) for k, v in d.items()])
  print(g)

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

if N == 1:
  d = P
else:
  d = 1
  i = 2
  while i <= round(pow(P, 1/N)):
    if P % i**N == 0:
      P //= i**N
      d *= i
    else:
      i += 1
print(d)

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

import sys

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

from collections import Counter
import math

def trial_division(n):
    
    factor = []
    
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            factor.append(num)
    
    if not factor:
        return 'prime number'
    else:
        factor.append(n)
        return factor

flist = trial_division(P)

fc = Counter(flist)
ans = 1

for num, count in fc.items():
    while count >= N:
        ans *= num
        count -= N

print(ans)

Solution (Python):
from math import sqrt
def factorint(n):
    d = {}
    for i in range(2, int(sqrt(n))+1):
        c = 0
        q, r = divmod(n, i)
        while not r:
            c += 1
            n = q
            q, r = divmod(n, i)
        if c:
            d[i] = c
    if n != 1:
        d[n] = 1
    return d

n, p = map(int, input().split())
x = 1
for k, v in factorint(p).items():
    x *= k ** (v//n)
print(x)

Solution (Python):





import math
import fractions
import sys
import bisect
import heapq  
import collections
from collections import Counter
from collections import deque
import pprint

sr = lambda: input()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""
def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    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 power(a,n,mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod


def kaijo(n, l, mod):
    if n == 0:
        return 1
    a = n
    tmp = n-1
    while(tmp >= l):
        a = a*tmp%mod
        tmp -= 1
    return a

inf = 10**18
mod = 10**9+7

n,p = lr()
f = factorization(p)
ans=1
for k,v in f:
    if v//n!=0:
        ans*=(k**(v//n))
print(ans)

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

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

ans = 1
arr = prime_factorize(p)
for e, p in arr:
    ans *= e ** (p // n)
print(ans)

Solution (Python):
import functools
import itertools
import math
import sys
import collections
import enum


def primefac(x):
    fac = []
    for i in range(2, int(math.sqrt(x)) + 1 + 1):
        if x % i != 0:
            continue
        ex = 0
        while x % i == 0:
            ex += 1
            x = x // i
        fac.append((i, ex))

    if x != 1:
        fac.append((x, 1))
    return fac


if __name__ == "__main__":
    N, P = [int(x) for x in input().split(" ")]
    fac = primefac(P)

    def f(x, y):
        return x[0] * y[0]

    ans = 1
    for val, ex in fac:
        if ex >= N:
            ans *= val ** (ex // N)
    print(ans)

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


def resolve():
    N, P = [int(i) for i in input().split()]
    p = primeFactorize(P)
    ans = 1
    for i, r in p:
        ans *= (i**(r // N))
    print(ans)


resolve()

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

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


ans = 1
C = Counter(prime_factorize(P))

for item in C.items():
    i = item[0]
    v = item[1]
    if v >= N:
        ans *= i**(v//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())

prm = prime_factorize(P)
prm = Counter(prm)

rlt = 1
for k in prm:
  rlt *= k**(prm[k]//N)
    
print(rlt)

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 a,b in F:
  ans *= a**(b//N)
print(ans)

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, log
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
from decimal import Decimal
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
from decimal import *

N, P = MAP()


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

print(ans)

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, log
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
from decimal import Decimal
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
from decimal import *

N, P = MAP()


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

print(ans)

Solution (Python):
import heapq
import fractions


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

    if temp != 1:
        arr.append(temp)

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

    arr.sort()
    return arr


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


factors = factorization(P)
heapq.heapify(factors)


if len(factors) < N:
    print(1)
    exit(0)


if len(factors) == N:
    print(min(factors))
    exit(0)




ans = []
while True:
    if len(ans) < N:
        ans.append(heapq.heappop(factors))
    else:
        if len(factors) == 0:
            break

        idx = ans.index(min(ans))
        ans[idx] = ans[idx]*heapq.heappop(factors)

if N == 1:
    print(ans[0])
else:
    gcd = fractions.gcd(ans[0], ans[1])
    if N == 2:
        print(gcd)
    else:
        for i in range(2, N):
            gcd = fractions.gcd(gcd, ans[i])
        print(gcd)

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())
factors = factorization(p)
ans = 1
for factor, num in factors:
    ans *= factor**(num//n)
print(ans)

Solution (Python):
a,b=map(int,input().split())
def so(n):
    import collections
    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 collections.Counter(a)
x=so(b)
ans=1
for y in x.keys():
  ans*=y**(x[y]//a)
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):
        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

arr = factorization(p)
ans = 1
for base, times in arr:
    new = base**(times // n)
    ans *= new
print(ans)

Solution (Python):
from collections import defaultdict
n,p = map(int,list(input().split()))
i,dic = 2,defaultdict(int)
while i*i<=p:
    while p%i==0:
        p/=i
        dic[i]+=1
    i+=1
if p>1:
    dic[p]=1
ans = 1
for k in dic.keys():
    while dic[k]>=n:
        dic[k]-=n
        ans *= k
print(int(ans))

Solution (Python):
from collections import defaultdict

n,p = map(int,list(input().split()))
i,dic = 2,defaultdict(int)

while i*i<=p: 
    while p%i==0:
        p/=i
        dic[i]+=1
    i+=1
if p>=1:
    dic[p]=1

ans = 1
dic = dict(dic)
for k in dic.keys():
    while dic[k]>=n:
        dic[k]-=n
        ans *= k
print(int(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())

l = Counter(prime_factorize(P))

ans = 1

for i, v in l.items():
    if v >= N:
        ans *= i**(v//N)


print(ans)

Solution (Python):
n,p=map(int,input().split())
ans=1
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
p=factorize(p)
for i in p:
  while i[1]>=n:
    i[1]-=n
    ans*=i[0]
print(ans)

Solution (Python):
n,p=map(int,input().split())
"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""

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
    
    
lst=factorization(p)

ans=1
for i in range(len(lst)):
    p,q=lst[i]
    while q>=n:
        q-=n
        ans=ans*p
print(ans)

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()


def DD(arg): return defaultdict(arg)



def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


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


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


def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd (a, b)


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count




N,P = IL()
dic = factorization(P)

if P == 1:
  print(1)
else:
  ans = 1
  for p,n in dic:
    ans *= pow(p,n//N)
  print(ans)

Solution (Python):
n, p = map(int, input().split())
def decomp(a):
    sqrt = round(a ** 0.5 + 0.5)
    factors = []
    for i in range(2, sqrt + 1):
        if not a % i:
            count = 0
            while a % i == 0:
                count += 1
                a //= i
            factors.append((i, count))
    if a != 1:
        factors.append((a, 1))
    return factors

f = decomp(p)
t = 1
for i, j in f:
    if j >= n:
        t *= i ** (j // n)
print(t)

Solution (Python):
def divs(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

n,p = map(int, input().split())
if n>100:
  print(1)
  exit()

ans=1
for d in divs(p):
  if pow(d,n)>p:
    break
  if p % pow(d,n)==0:
    ans=d
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

a = factorization(P)
a.sort()

res = 1
for a1, a2 in a:
    if a2 >= N:
        res *= a1 ** (a2 // N)

print(res)

Solution (Python):
from functools import reduce
from operator import mul
def prime_factorize_dict(n, N):
    d = {1: 1}
    while not n & 1:
        d[2] = d.get(2, 0) + 1
        n >>= 1
    f = 3
    while f * f <= n:
        if not n % f:
            d[f] = d.get(f, 0) + 1
            n //= f
        else:
            f += 2
    if n != 1:
        d[n] = d.get(n, 0) + 1
    return d

N, P = map(int, input().split())
print(reduce(mul, (factor ** (power // N) for factor, power in prime_factorize_dict(P, N).items())))

Solution (Python):
from math import sqrt
N, P = map(int, input().split())
def prime_factorize(n):
    a = []
    N = n
    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

lis = prime_factorize(P)

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

else:
    d = [0] * (10 ** 7)
    sq = sqrt(P) + 1
    for i in lis:
        if i < sq:
            d[i] += 1
    
    
    lis2 = []
    for i in reversed(range(10 ** 6 + 5)):
        if d[i] >= N:
            val = d[i] // N
            lis2.append(pow(i,val))
    ans = 1
    for i in lis2:
        ans *= i
    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 len(arr) == 0:
        arr.append((n, 1))

    return arr

F = factorization(P)

ans = 1
for a, b in F:
    if b >= N:
        ans *= a ** (b // N)
print(ans)