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 copy import deepcopy
from functools import reduce


class Divisor:
    def __init__(self, n):
        """ make divisors list and prime factorization list of n
            complexity: O(n^(1/2))
            used in ProjectEuler No.12, yukicoder No.36
        """
        assert(n >= 1)
        number = n
        if number == 1:
            self.primeFactorization = {1: 1}
        else:
            self.primeFactorization = {}
            for i in range(2, int(n**0.5)+1):
                cnt = 0
                while number % i == 0:
                    cnt += 1
                    number //= i
                if cnt > 0:
                    self.primeFactorization[i] = cnt
            if number > 1:
                self.primeFactorization[number] = 1

    def primeFactors(self):
        return deepcopy(self.primeFactorization)

    def numDivisors(self):
        """ the number of divisors """
        if self.primeFactorization.get(1, 0) == 1:
            return 1
        numDiv = 1
        for _, cnt in self.primeFactorization.items():
            numDiv *= cnt+1
        return numDiv

    def sumDivisors(self):
        return reduce(lambda x, y: x * y, [sum(p**i for i in range(n+1)) for p, n in self.primeFactorization.items()])


def main() -> None:
    N, P = map(int, input().split())
    d = Divisor(P)
    ans = 1
    for key, value in d.primeFactorization.items():
        ans *= key ** (value // N)
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
from sys import stdin
from itertools import groupby
n,p = [int(x) for x in stdin.readline().rstrip().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
li = prime_factorize(p)
lin = []
for key, value in groupby(li):
    lin.append((key,len(list(value))))
point = 1
for i in lin:
    if i[1] >= n:
        point *= i[0]**(i[1]//n)
print(point)

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())
prime_factors = factorization(P)
g = 1
for p in prime_factors:
    g *= p[0] ** (p[1] // N)
print(g)

Solution (Python):
def factorize(n):
    """
    nの値を素因数分解し、素因数とその指数をtupleにまとめたリストを返す
    e.g.
    factorize(20)
    [(2, 2), (5, 1)]
    """
    b = 2
    fct = []
    while b * b <= n:
        cnt = 0
        while n % b == 0:
            cnt += 1
            n //= b
        if cnt > 0:
            fct.append((b, cnt))
        b += 1
    if n > 1:
        fct.append((n, 1))
    return fct


N, P = map(int, input().split())
ans = 1
for p, e in factorize(P):
    if e >= N:
        ans *= p ** (e // N)
print(ans)

Solution (Python):
from collections import defaultdict


def factorize(n):
    """
    nの値を素因数分解し、素因数とその指数をtupleにまとめたリストを返す
    e.g.
    factorize(20)
    [(2, 2), (5, 1)]
    """
    b = 2
    fct = []
    while b * b <= n:
        cnt = 0
        while n % b == 0:
            cnt += 1
            n //= b
        if cnt > 0:
            fct.append((b, cnt))
        b += 1
    if n > 1:
        fct.append((n, 1))
    return fct


N, P = map(int, input().split())
d = defaultdict(int)
for p, e in factorize(P):
    if e >= N:
        d[p] = e // N
ans = 1
for p, e in d.items():
    ans *= p ** e
print(ans)

Solution (Python):
from collections import Counter
def prm(a):
  if a == 1 or a == 4:
    return False
  for i in range(2,int((a)**0.5+1)):
    if a%i == 0:
      return False
  else:
    return True
prime = []
for i in range(1,10**6+1):
  if prm(i):
    prime.append(i)
def sepa(a):
  ans = []
  while a>1:
    for x in prime:
      if a%x == 0:
        ans.append(x)
        a = a//x
        break
    else:
      ans.append(a)
      a = 1
  return Counter(ans)
n,p = map(int,input().split())
c = sepa(p)
ans = 1
for k,v in c.items():
  if n<=v:
    ans *= k**(v//n)
print(ans)

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

from collections import defaultdict
d = defaultdict(int)
i = 2
while P >= i*i:
    if P%i==0:
        P //= i
        d[i] += 1
    elif i == 2:
        i += 1
    else:
        i += 2
if P != 1:
    d[P] += 1

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

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

from collections import defaultdict
d = defaultdict(int)
i = 2
while P >= i*i:
    if P%i==0:
        P //= i
        d[i] += 1
    
    
    else:
        i += 1
        
if P != 1:
    d[P] += 1

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

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

from collections import defaultdict
d = defaultdict(int)
i = 2
while P >= i*i:
    if P%i==0:
        P //= i
        d[i] += 1
    elif i == 2:
        i += 1
    else:
        i += 2
if P != 1:
    d[P] += 1

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

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


ans = 1
for i in Counter(prime_factorize(p)).most_common():
    if i[1] < n:
        break
    ans *= i[0]**(i[1]//n)
print(ans)

Solution (Python):
import math
n, p = map(int, input().split())
a = []
if n == 1:
  print(p)
  exit()
for i in range(2, math.ceil(p**0.5)+1):
  cnt = 0
  while p % i == 0:
    cnt += 1
    p //= i
  a.append(cnt)
gcd = 1
for i in range(len(a)):
  if a[i] >= n:
    gcd *= (i+2) ** (a[i] // n)
print(gcd)

Solution (Python):
n, p = map(int, input().split())
if n == 1:
    print(p)
    exit()
l = []
i = 2
while p > 1:
    if p % i == 0:
        p //= i
        l.append(i)
    else:
        i += 1
        if i > p ** (1/2):
            break
        
ans = 1

for i in set(l):
    m = l.count(i)
    if n <= m:
        ans *= i ** (m // 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

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

Solution (Python):

def prime_factorization(N):
    
    pf = {}
    for i in range(2, int(N**0.5) + 1):
        while N % i == 0:
            if i not in pf.keys():
                pf[i] = 1
            else:
                pf[i] += 1
            N //= i
    if N > 1:
        pf[N] = 1
    return pf

N, P = map(int, input().split())
pf = prime_factorization(P)
ans = 1
for k in pf.keys():
    ans *= k ** (pf[k] // N)
print(ans)

Solution (Python):
from collections import Counter

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


def prime_factorize(n):
    a = [1]
    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


d = Counter(prime_factorize(P))
answer = 1
for i, n in d.items():
    answer *= i ** (n // N)

print(answer)

Solution (Python):
from collections import Counter

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


def prime_factorize(n):
    a = [1]
    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


d = Counter(prime_factorize(P))
answer = 1
for i, n in d.items():
    if n >= N:
        answer *= i ** (n // N)

print(answer)

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

if n == 1:
    print(p)

else:
    factors = {}
    for i in range(2, int(p**0.5)+1):
        cnt = 0
        while p % i == 0:
            cnt += 1
            factors[i] = cnt
            p //= i

    if factors == {}:
        factors[p] = 1

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

    print(ans)

Solution (Python):
def prime_decomposition(n) -> 'List[Tuple[prime,cnt]]':
    ret = []

    x = n

    divisor = 2
    cnt = 0
    while x % divisor == 0:
        x //= divisor
        cnt += 1
    if cnt > 0:
        ret.append((divisor, cnt))

    divisor = 3
    while divisor * divisor <= n:
        cnt = 0
        while x % divisor == 0:
            x //= divisor
            cnt += 1
        if cnt > 0:
            ret.append((divisor, cnt))
        divisor += 2

    if x > 1:
        ret.append((x, 1))

    return ret


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

lis = prime_decomposition(p)

ret = 1
for pr, cnt in lis:
    ret *= pr ** (cnt // n)
print(ret)

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())
ans = 1

for insi, num in factorization(P):
    if num >= N:
        ans *= (insi ** (num // N))
print(ans)

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

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

d={}
x=p
for i in range(2,p):
  while x%i==0:
    if i in d:
      d[i]+=1
    else:
      d[i]=1
    x//=i
  if i*i>=p:
    break
if x>1:
  d[x]=1

ans=1
for k,v in d.items():
  for i in range(v//n):
    ans*=k

print(ans)

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


div = {}
x = P
y = 2
while y*y <= x:
    while x % y == 0:
        try:
            div[y] += 1
        except KeyError:
            div[y] = 1
        x //= y
    y += 1
if x > 1:
    div[x] = 1

res = 1
for k, v in div.items():
    res *= k**(v//N)
print(res)

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

import math
import heapq
import sys
def judge_p(n):
	d = math.floor(n**(1/2))
	for i in range(2,d+1):
		if n%i == 0:
			return False
	return True

if n == 1:
	print(m)
	sys.exit()
if judge_p(m):
	print(1)
	sys.exit()

P = []
D = math.floor(m**(1/2))

for j in range(2,D+1):
	if judge_p(j):
		P.append(j)

deck = []

for prime in P:
	cnt = 0
	tmp = m
	while True:
		if tmp % prime == 0:
			cnt += 1
			tmp //= prime
		else:
			break
	deck.append([prime, cnt])

ans = 1
for i in range(len(deck)):
	prime, cnt = deck[i]
	if cnt//n == 0:
		continue
	ans *= prime**(cnt//n)

print(ans)

Solution (Python):

import sys
INF = float("inf")

import math
import collections


def factorial(n):
    
    prime_count = collections.Counter()

    for i in range(2, int(math.sqrt(n)) + 2):
        while n % i == 0:
            n /= i
            prime_count[i] += 1
    if n > 1:
        prime_count[int(n)] += 1

    return prime_count


def solve(N: int, P: int):
    counter = factorial(P)
    ans = 1
    for k in counter:
        if counter[k] >= N:
            ans *= k**(counter[k]//N)
    print(ans)
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    P = int(next(tokens))  
    solve(N, P)


if __name__ == '__main__':
    main()

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
p = Counter(prime_factorize(P))
ans = 1
for k,v in p.items():
    if v >= N:
        ans *= k**(v//N)
print(ans)

Solution (Python):
N,P = map(int,input().split())
from collections import defaultdict
elem = defaultdict(int)
tmpP = P
from math import sqrt
for i in range(2,int(sqrt(P))+1):
    while tmpP % i == 0:
        elem[i] += 1
        tmpP = tmpP//i
ans = 1
for k,v in elem.items():
    ans = ans * k ** (v//N)
if N == 1: ans = P
print(ans)

Solution (Python):
from collections import Counter

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

def Primefac(N):
    x = []
    while N % 2 == 0:
        N //= 2
        x.append(2)     
    i = 3
    while i * i <= N:
        if N % i == 0:
            N //= i
            x.append(i)
        else:
            i += 2
    if N != 1:
        x.append(N)
    return x

a = list(Counter(Primefac(P)).items())

ans = 1
for i in range(len(a)):
    if a[i][1] // N >= 1:
        ans *= (a[i][0] ** (a[i][1] // N))
        
print(ans)

Solution (Python):
def primes(n):
  ps = {}
  while n%2==0:
    n//=2
    if 2 not in ps:
      ps[2] = 1
    else:
      ps[2] += 1
  
  for i in range(3,int(n**.5)+1,2):
    while n%i==0:
      n//=i
      if i not in ps:
        ps[i] = 1
      else:
        ps[i] += 1
  
  if n!=1:
    ps[n] = 1
  
  return ps
  
N,P = map(int,input().split())
if N==1:
  print(P)
  exit()
ps = primes(P)
ans = 1
for p, num in ps.items():
  if num>=N:
    ans *= p**(num//N)
print(ans)

Solution (Python):

def factorization(n):
    """
    引数の値を素因数分解したリストを返す

    Parameters
    ----------
    n : int
        素因数分解したい自然数

    Returns
    -------
    retlist : list
        2以上の整数n => [[素因数, 指数], ...]の2次元リスト
    """
    retlist = []
    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
            retlist.append([i, cnt])

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

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

    return retlist

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

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

Solution (Python):
import sys
input = sys.stdin.readline


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())
    p = prime_factorize(P)
    import collections
    ans = 1
    for k, v in collections.Counter(p).most_common():
        while v >= N:
            ans *= k
            v -= N
    print(ans)


if __name__ == '__main__':
    main()

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
b = collections.Counter(prime_factorize(p))
x = 1
for i,j in b.items():
	if j >= n:
		x *= i**(j//n)
if n == 1:
	print (p)
else:
	print (x)

Solution (Python):
import math
n, p = map(int, input().split())
ans = 1
for i in range(2, math.ceil(math.sqrt(p))):
    cnt = 0
    while p % i == 0 and p != 0:
        p //= i
        cnt += 1
    ans *= i ** (cnt // n)
ans *= p ** (1 // n)
print(ans)

Solution (Python):
import math
n, p = map(int, input().split())
cnt = [0] * math.ceil(math.sqrt(p))
tmp = p
for i in range(2, math.ceil(math.sqrt(p))):
    while p % i == 0 and p != 0:
        p //= i
        cnt[i] += 1
ans = 1
for i in range(2, math.ceil(math.sqrt(tmp))):
    ans *= i ** (cnt[i] // n)
ans *= p ** (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

l = factorization(P)[::-1]



ans = 1
for n, k in l:
    if k >= N:
        ans *= n ** (k // N)

print(ans)

Solution (Python):
import sys
from collections import Counter
n, p = [int(i) for i in sys.stdin.readline().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


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

Solution (Python):
N, P = map(int, input().split())
if N == 1:
  print(P)
else:
  A, n = [], N
  while n != 0:
    A = [n%2] + A[:]
    n //= 2
  M = int(round(P ** (1/N)))
  g = 1
  for i in range(1, M+1):
    t = 1
    for j in range(len(A)):
      if A[j] == 1:
        t *= i
      if j != len(A) - 1:
        t *= t
    if P % t == 0:
      g = i
  print(g)

Solution (Python):
from collections import Counter as ct


def prime_factorization(N):
    res = []
    x = N
    y = 2
    while y*y <= x:
        while x % y == 0:
            res.append(y)
            x //= y
        y += 1
    if x > 1:
        res.append(x)
    return res


n, p = map(int, input().split())
ans = 1
q = ct(prime_factorization(p))
for i, v in q.items():
    ans *= i ** (v // n)
print(ans)

Solution (Python):
from collections import defaultdict
sosu = defaultdict(int)
def soinsu(n):
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            n //= i
            sosu[i] += 1
    if n > 1:
        sosu[n] += 1
    return

N, P = map(int, input().split())
soinsu(P)
ans = 1
for i, j in sosu.items():
    ans *= i ** (j // N)

print(ans)

Solution (Python):
def pff(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
def examC():
    N, P = LI()
    d = pff(P)

    ans = 1
    for key,i in d.items():
        ans *= key**(i//N)
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examC()

Solution (Python):
def f(x):
    info = {}
    col = x
    tmp = 2
    while tmp <= int(x ** 0.5) + 1:
        cnt = 0
        while col % tmp == 0:
            col //= tmp
            cnt += 1
        if cnt >= 1:
            info[tmp] = cnt
        tmp += 1
    if col != 1:
        info[col] = 1
    return info


n, p = map(int, input().split())
ans = 1
info_p = f(p)
for i, j in info_p.items():
    ans *= i ** (j//n)
print(ans)

Solution (Python):
n, p = map(int,input().split())
if n == 1:
    print(p)
    exit()
l = int((p + 1) ** 0.5)
k = p
rom = [0] * l
for i in range(100):
    if k % 2 == 0:
        k = k // 2
        rom[1] += 1
    else:
        break

for i in range(3, l+1, 2):
    while k % i == 0:
        k = k // i
        rom[i-1] += 1

ans = 1
for i in range(l):
    if rom[i] >= n:
        ans *= (i+1) ** (rom[i] // n)
print(ans)

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

def factoring(n):
    
    c = Counter()
    sup = floor(pow(n,1/2))
    for i in range(2,sup+1):
        while n % i == 0:
            c[i] += 1
            n //= i
    if n != 1:
        c[n] += 1
    return c

N, P = map(int,input().split())
ans = 1
for key, value in factoring(P).items():
    ans *= pow(key,(value // N))
print(ans)

Solution (Python):
import collections

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

def factorization(n):
    res = []
    x = n
    y = 2
    while y*y <= x:
        while x % y == 0:
            res.append(y)
            x //= y
        y += 1
    if x > 1:
        res.append(x)
    return res
    
F = factorization(P)
F = collections.Counter(F)

ans = 1

for k,v in F.items():
    ans *= k**(v//N)

print(ans)

Solution (Python):
import sys
import collections

stdin = sys.stdin
 
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip()  

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 = rl()
answer = 1
A = prime_factorize(P)
c = collections.Counter(A)
for k, v in c.items():
    if v >= N:
        answer *= k ** (v//N)
print(answer)

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())
a = factorization(p)
ans = 1
for i in range(len(a)):
    if a[i][1]>=n:
        b = a[i][1]//n
        ans = ans*a[i][0]**b
    else:
        continue
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**2<=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())
A=Counter(prime_factorize(p)).items()
cnt=1
for i,j in A:
    cnt *=pow(i,j//n)
print(cnt)

Solution (Python):
from collections import Counter

def prime_factorize(n):
    a=[]
    while n%2==0:
        a.append(2)
        n //=2
    f=3
    while f**2<=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())
A=Counter(prime_factorize(p)).items()
cnt=1
for i,j in A:
    cnt *=pow(i,j//n)
print(cnt)

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())
A=Counter(prime_factorize(p)).items()
cnt=1
for i,j in A:
    cnt *=pow(i,j//n)
print(cnt)

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

p = factorization(P)
ans = 1

for a, b in p:
    ans *= a ** (b//N)

print(ans)

Solution (Python):
import collections as cl

N, P = map(int, input().split())
if P == 1:
    print(1)
    exit()
P_prime = []
while P % 2 == 0:
    P_prime.append(2)
    P //= 2
odd = 3
while odd * odd <= P:
    if P % odd == 0:
        P_prime.append(odd)
        P //= odd
    else:
        odd += 2
if P != 1:
    P_prime.append(P)

ans = 1
dic_P = cl.Counter(P_prime)
for prime, num in dic_P.items():
    ans *= pow(prime, num // N)
print(ans)

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

def factoring(k): 
    import math
    dic = dict()
    n = int(math.sqrt(k))+2
    for i in range(2, n):
        count = 0
        while k%i == 0:
            count += 1
            k = k//i
        if count != 0:
            dic[i] = count
    if k != 1: 
        dic[k] = 1
    return dic

dic = factoring(P)

ans = 1
for i in dic:
    ans *= i ** (dic[i] // N)


print (ans)

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

def prime_factor(x) :
    ret = dict()
    if x % 2 == 0 :
        ret[2] = 0
        while x % 2 == 0 :
            x //= 2
            ret[2] += 1
            
    i = 3
    while i * i <= x :
        if x % i == 0 :
            ret[i] = 0
            
            while x % i == 0 :
                x //= i
                ret[i] += 1
        i += 2
        
    if x != 1 :
        ret[x] = 1
    
    return ret

ret = 1
for k, v in prime_factor(P).items() :
    ret *= k ** (v // N)
    
print(ret)

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


def main():
    N, P = map(int, input().split())
    A = factorization(P)

    B = []
    for a, b in A:
        if b >= N:
            B.append((a, b // N))

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


main()

Solution (Python):
import collections

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

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
  
x=prime_decomposition(p)
x = collections.Counter(x)
x = x.most_common()


for i in range(len(x)):
    if x[i][1]>=n:
        ans*=x[i][0]**(x[i][1]//n)
    else:
        break
print(int(ans))

Solution (Python):
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())
from collections import Counter
aa = Counter(prime_factorize(P))

ans = 1
for key in aa.keys():
    ans *= key**(aa[key]//N)
print(ans)

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

temp = int(P**(1/N)+0.5)

output=1
for i in range(temp, 0, -1):
    t =(i**N)
    p = P//t
    if t*p ==P:
        output=i
        break


if P==1:
    output=1
print(output)

Solution (Python):

from collections import Counter

n,p=map(int,input().split())
def trial_div(n):
    
    prime=Counter()

    for i in range(2,int(pow(n,0.5)+2)):
        while n%i==0:
            n//=i
            prime[i]+=1
    if n>1:prime[n]+=1
    
    return prime


prime=trial_div(p)
if prime is None:
    print(1)
    exit()
ans=1
for k,v in prime.items():
    if v>=n:
        ans*=k**(v//n)
print(ans)

Solution (Python):


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

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

fct=factorize(P)
ans=1
for t in fct:
    b,e=t
    ans*=b**(e//N)

print(ans)

Solution (Python):
def divisor(x):
    res = []
    for i in range(1, int(x ** 0.5) + 1):
        if x % i == 0:
            res.append(i)
            if i * i != x:
                res.append(x // i)
    res.sort()
    return res


def prime_factorization(x):
    N = x
    d = divisor(x)
    res = []
    for i in d:
        if i == 1:
            continue
        cnt = 0
        while N % i == 0:
            cnt += 1
            N //= i
        if cnt != 0:
            res.append((i, cnt))
    return res


if __name__ == "__main__":
    n, p = map(int, input().split())
    pf = prime_factorization(p)

    ans = 1
    for v, cnt in pf:
        if cnt >= n:
            ans *= v**(cnt//n)

    print(ans)

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

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

res=factorization(P)
  
ans=1
for c in res:
  key=c[0]
  val=c[1]
  ans*=(key**(val//N))
  
print(ans)

Solution (Python):

import sys, math, itertools, heapq, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = 1
count = 0

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

P=prime_factor(p)
for pi,amount in P:
    ans*=pi**(amount//n)
    
print(ans)

Solution (Python):
n,p=map(int,input().split())
d={}
num=p
for i in range(2,int(p**(1/2))+1):
  if num%i==0:
    d[i]=1
    num=num//i
  while num%i==0:
    d[i]+=1
    num//=i
d[num]=1
ans=1
for i in d:
  while d[i]>=n:
    ans*=i
    d[i]-=n
print(ans)

Solution (Python):
import collections

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 = collections.Counter(prime_factorize(p))
ans = 1
for a, b in c.items():
  ans *= a ** (b//n)
print(ans)