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

factors = factorize(P)
ans = 1
for k,v in factors.items() :
    a = v//N
    ans *= k**a
print(ans)

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

t = 1
p = 2
while p * p <= X: 
    e = 0
    while X % p == 0:
        X //= p
        e += 1  
    t *= p ** (e // N)
    p += 1
t *= X ** (1 // N) 

print(t)

Solution (Python):
import numpy as np
N,P = map(int,input().split(' '))




def primes(n):
	f = [True]*(n+1)
	f[0] = False
	f[1] = False
	m = int(n**0.5+1)
	for i in range(2,m):
		if f[i]:
			for j in range(i*i,n+1, i):
				f[j] = False
	return f


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

thres = int(np.log2(P))+1
if N > thres:
	print(1)
	exit()

s = 1/N
sP=int(P**s)+1
f = primes(sP)
prime = [x for x in range(1,sP+1) if f[x]]

ans = 1
	
for p in prime:
	q = p**N
	if P < q:
		break
	if P % q == 0:
		ans*=p
		q*= p**N
		while(P % q == 0):
			ans*=p
			q*=p**N

print(ans)

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

ans = 1
k = 1
while pow(k,N) <= P:
    if P%pow(k,N)==0:
        ans = k
    k += 1

print(ans)

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


def hpow(x, n):
    ret = 1
    while(n > 0):
        if n & 1 >= 0:
            ret = ret * x
        x = x * x
        n >>= 1
    return ret


if N >= P:
    print(1)
elif N == 1:
    print(P)
elif N >= 50:
    print(1)
else:
    mx = int(math.pow(P, 1/N)+10)
    for i in range(mx, 0, -1):
        
        t = i ** N
        
        if P % t == 0:
            print(i)
            import sys
            sys.exit(0)
    print(1)

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


ans = 1
if(n==1):print(p)
else:

	for i in range(2,int(p**(1./n))+1):
		while(p%(i**n)==0):
			ans*=i
			p//=i**n
	print(ans)

Solution (Python):
from collections import Counter
import math

N, P = map(int,input().split())
if N >= 41:
    print(1)
    exit(0)
if N >= P:
    print(1)
    exit(0)
if N == 1:
    print(P)
    exit(0)
if N == 2:
    M = P
    Q = []
    k = 2
    while k*k <= M:
        if M%k == 0:
            M //= k
            Q.append(k)
        else:
            k += 1
    if M > 1:
        Q.append(M)
    R = Counter(Q)
    ans = 1
    for k in R:
        if R[k] >= 2:
            ans *= k**(R[k]//2)
    print(ans)
    exit(0)

ans = 1
k = 1
while pow(k,N) <= P:
    if P%pow(k,N)==0:
        ans = k
    k += 1

print(ans)

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

def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        c = 0
        while n % i == 0:
            n /= i
            c+=1
        if c!=0:
            table.append((i,c))
        i += 1
    if n > 1:
        table.append((int(n), 1))
    return table


xx = prime_decomposition(P)

result = 1
for b, r in xx:
    result *= pow(b, r//N)
print(result)

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


def pf(n):
    c = 2
    while c * c <= n:
        while not n % c:
            res[c] = res.get(c, 0) + 1
            n //= c
        c += 1

    if n != 1:
        res[n] = 1


def main():
    pf(P)

    ans = 1
    for d in res:
        ans *= pow(d, res[d]//N)

    print(ans)


if __name__ == '__main__':
    main()

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):
import math
a=input().split()
n=int(a[0])
p=int(a[1])
d=dict()
rest=p
i=2
while i<=math.sqrt(rest):
    if rest%i==0:
        rest=rest/i
        d[i]=d.get(i,0)+1
        continue
    i=i+1

d[rest]=d.get(rest,0)+1

res=1
for key in d.keys():
    if d[key]>=n:
        tmp=math.pow(key,int(d[key]/n))
        res=res*tmp
print(int(res))

Solution (Python):
import time

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

if n >= 40 or p == 1:
    print("1")
elif n == 1:
    print(p)
else:
    s = 0
    fact = {}
    start = time.time()
    check = False
    while s == 0:
        for i in range(2,p+1):
            now = time.time()
            if now > start+1.9:
                s = 1
                check = True
                break
            if p%i == 0:
                p = p//i
                if p == 1:
                    s = 1
                if i not in fact:
                    fact[i] = 1
                else:
                    fact[i] += 1
                break
    ans = 1
    for i in fact:
        if fact[i] >= n:
            ans = ans*i**(fact[i]//n)
    print(ans)

Solution (Python):
import math

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

if N == 1:
    print(P)
    
else:
    T = int(math.pow(P, 1/N)) * 2

    Q = [False, False] + [True] * T
    F = []
    for n in range(T + 1):
        if Q[n]:
            F.append(n)
            for m in range(n, T + 1, n):
                Q[m] = False
    D = 1
    for f in F:
        c = 0
        while P % f == 0:
            c += 1
            P //= f
        D *= f ** (c // N)

    print(D)

Solution (Python):
import math
from collections import Counter

N, P = map(int, input().split())
primes = []
mx =int(math.sqrt(P)+2)
for i in range(2,mx):
  while P%i == 0:
      primes +=[i]
      P = P//i
if P>1: primes+=[P]

c = Counter(primes) 
ans = 1
for key in c:
  ans *= max(key** (c[key]//N),1)
print(ans)

Solution (Python):
from math import sqrt

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

if N==1:
    print(P)
else:
    dic={}
    p=2
    while p<=sqrt(P):
        cnt=0
        while P%p==0:
            P=int(P/p)
            cnt+=1
        if cnt>0:
            dic[p]=cnt
        p+=1

    ans=1
    for p in dic.keys():
        ans *= p**int(dic[p]/N)
    print(ans)

Solution (Python):
n, p = input().split()
n, p = int(n), int(p)
d = 2
ans = 1
while d * d <= p:
	if p % d == 0:
		cnt = 0
		while p % d == 0:
			cnt += 1
			p //= d
		ans *= d ** (cnt // n)
	d += 1
if p != 1 and n == 1:
	ans *= p
print(ans)

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

p = P
primes = {}
d = 2
maxd = int(math.sqrt(P))

while d <= maxd and p > 1:
    while p%d == 0:
        if d not in primes:
            primes[d] = 1
        else:
            primes[d] += 1
        p = p//d
    d += 1
if p > 1:
    primes[p] = 1


ans = 1
for k in primes:
    n = primes[k]//N
    if n > 0:
        ans *= k**n

print(ans)

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



def prime_factorization(n):
    table = []
    for x in range(2, int(n**0.5)+1):
        while n % x == 0:
            table.append(x)
            n //= x
    if n > 1:
        table.append(n)
    return table


T = prime_factorization(P)
C = Counter(T)

ans = 1
for x, n in C.items():
    if n >= N:
        ans *= (x ** (n // N))
print(ans)

Solution (Python):

import sys, os
try: from typing import Any, Union, List, Tuple, Dict
except ImportError: pass
sys.setrecursionlimit(10**6)
if os.environ.get("USER") == "shun":
    def debug(*args): print(*args, file=sys.stderr)
else:
    print("NO DEBUG", file=sys.stderr)
    def debug(*args): pass
def exit(): sys.exit(0)
import math


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


primes = {}
q = 2
while p != 1:
    if q**2 > p:
        primes[p] = 1
        break
    while p % q == 0:
        p = p // q
        if q in primes:
            primes[q] += 1
        else:
            primes[q] = 1
    q += 1


ans = 1
for q in primes:
    ans *= q**(primes[q] // n)
print(ans)

Solution (Python):
import collections

N, p = map(int, input().split())
if N == 1:
    print(p)
    exit()

def prime_decomposition(n):
    
    if n < 2:
        return []
    prime_factors = []
    while n % 2 == 0:
        prime_factors.append(2)
        n >>= 1

    while n % 3 == 0:
        prime_factors.append(3)
        n //= 3

    a = 5
    b = 7
    while a ** 2 <= n:
        if n % a == 0:
            prime_factors.append(a)
            n //= a
        elif n % b == 0:
            prime_factors.append(b)
            n //= b
        else:
            a += 6
            b += 6
    if n > 1:
        prime_factors.append(n)
    return prime_factors

res = 1
pf = collections.Counter(prime_decomposition(p))
for v, c in pf.items():
    while c >= N:
        res *= v
        c -= N
print(res)

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

ans=1
if N==1:
    ans=P
elif N>10**6:
    pass
else:
    for i in range(1,P):
        if P % (i**N)==0:
            ans=i
        elif P < i**N:
            break
print(ans)

Solution (Python):
def soinnsuubunnkai(p):
  dic = {}
  for i in range(2, int(p ** (1 / 2)) + 1):
    if p % i == 0:
      dic[i] = 0
    while p % i == 0:
      dic[i] += 1
      p //= i
  if p != 1:
    dic[p] = 1
  return dic
n, p = map(int, input().split())
dic = soinnsuubunnkai(p)
ans = 1
for k, v in dic.items():
  ans *= k ** (v // n)
print(ans)

Solution (Python):
from numpy import sqrt
N,P = map(int,input().split(" "))
lm = pow(P,1/N) + 0.5
if N == 1:
    print(P)
    exit(0)

ans = 1
for i in range(1,int(sqrt(P))+10):
    if P % i == 0:
        if i <= lm and P % pow(i,N) == 0:
            ans = max(i,ans)
        if (P//i) <= lm and P % pow((P//i),N) == 0:
            ans = max(P//i,ans)

print(ans)

Solution (Python):
n, p = list(map(int, input().split()))
if(n == 1):
  print(p)
elif(p == 1):
  print(1)
elif(n > 64):
  print(1)
else:
  ans = 1
  tmp = 2
  while(tmp**n <= p):
    if((p%(tmp**n)) == 0): ans = tmp
    tmp+=1
  print(ans)

Solution (Python):
N, P = map(int, input().split())
if N == 1:
  print(P)
  exit()
ans = 1
for n in range(2, 10 ** 6 + 1):
  a = 0
  while P % n == 0:
    P //= n
    a += 1
  ans *= n ** (a // N)
print(ans)

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

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


i = 2

def prime_table(n):
  list = [True for _ in range(n + 1)]
  i = 2
  while i * i <= n:
    if list[i]:
      j = i + i
      while j <= n:
        list[j] = False
        j += i
    i += 1

  table = [i for i in range(n + 1) if list[i] and i >= 2]
  return table

T = prime_table(floor(pow(P,1/N)))

for i in range(len(T)):
  if T[i] ** N > P:
    break
  while P % T[i]**N == 0:
    ans *= T[i]
    P = P // T[i]**N
  
print(ans)

Solution (Python):
import numpy as np
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  = list(map(int, input().split()))
a = 1
f = factorize(p)
for x, y in f:
    if y >= n:
        a *= x**(y // n)
if n == 1:
    print(p)
else:
    print(a)

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

prod = P
ans = 1
if N == 1:
    ans = P
elif N > 40:
    ans = 1
else:
    for i in range(2, P):
        if i > 2 and i % 2 == 0:
            continue
        if prod < i ** N:
            break
        count = 0
        while prod % i == 0:
            prod /= i
            count += 1
            if count % N == 0:
                ans *= i
print(str(ans))

Solution (Python):
from collections import Counter

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

a = prime_factor(p)
a.append(1)
c = Counter(a)
d = c.most_common()

res = 1

for i in range(len(d)):
    if d[i][1] >= n:
        k = d[i][1]//n
        res = res * (d[i][0]**k)
        
        if i == len(d)-1:
            break
    else:
        break

print(res)

Solution (Python):

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

def primes(N):
    sieve = [1] * (N+1)
    sieve[:2] = [0, 0]
    for i in range(N):
        if sieve[i]:
            for j in range(2*i, N+1, i):
                sieve[j] = 0
    P = []
    for i in range(N+1):
        if sieve[i]:
            P.append(i)
    return P

if N == 1:
    print(P)
else:
    ps = primes(10**6)
    
    ans = 1
    for p in ps:
        tmp = P * 1
        cnt = 0
        while tmp % p == 0:
            tmp = tmp // p
            cnt += 1
        ans *= p ** (cnt//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


def divisorize(fct):
    b, e = fct.pop()  
    pre_div = divisorize(fct) if fct else [[]]
    suf_div = [[(b, k)] for k in range(e + 1)]
    return [pre + suf for pre in pre_div for suf in suf_div]


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

res = 1
maxcnt = 0

for m, cnt in factorize(p):
    while cnt >= n:
        res *= m
        cnt -= n
        

print(res)

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

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

re = 1
if N == 1:
    re = P
else:

    f_list = factorize(P)

    for k, n in f_list:
        if n // N > 0:
            re *= k ** (n //N)
        
print(re)

Solution (Python):

import numpy as np
N, P = map(int, input().split())

primes = np.ones(10**6)
primes[:2] = 0
for p in range(2, 10**3):
    if primes[p] == 1:
        primes[2*p::p] = 0

prim = np.where(primes == 1)[0]

if N == 1:
    res = P
    print(res)
else:
    res = 1
    for p in prim:
        k = 0
        while P % p == 0:
            k += 1
            P = P // p
        res *= p ** (k//N)
    print(res)

Solution (Python):
import collections
import math


def main():
    n, p = map(int, input().split())

    a = collections.defaultdict(lambda: 0)

    if n == 1:
        print(p)
        return

    for i in range(2, int(math.sqrt(p)) + 1):
        while p % i == 0:
            a[i] = a[i] + 1
            p //= i

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

    print(ret)


main()

Solution (Python):
from statistics import mean, median,variance,stdev


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



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

ans = 1
innsuu = prime_factors(P)

innsuu.sort()

if (N == 1):
    print(P)
else:
    count = 1
    count_num = 0
    for i in innsuu:
        if (count_num == i):
            count += 1
        else:
            count_num = i
            count = 1

        if (count == N):
            ans *= count_num
            count = 1
            count_num = 0

    print(ans)

Solution (Python):
from collections import defaultdict
N, P = map( int, input().split())
A = defaultdict( int)
S = set()
ans = 1
if N == 1:
    ans = P
else:
    T = P
    for i in range(2, int(P**(1/2)) + 1):
        while P%i == 0:
            P //= i
            S.add(i)
            A[i] += 1
    if T == P:
        A[T] += 1
        S.add(T)
    for s in S:
        if A[s] >= N:
            ans *= s**(A[s]//N)
print(ans)

Solution (Python):

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











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

res = 1
for r in div.keys():
    while div[r]>=n:
        res *= r
        div[r] -= n

print(res)

Solution (Python):
def so(x, i):
  if x % i == 0:
    return 1 + so(x // i, i)
  else:
    return 0

n, p = map(int, input().split())
soinsu = {}
i = 2
while i * i <= p:
  if so(p, i) != 0:
    soinsu[i] = so(p, i)
    p //= i ** so(p, i)
  i += 1
if p > i:
  soinsu[p] = 1
r = 1
for k in soinsu:
  r *= k ** (soinsu[k] // n)

print(r)

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

ans = 1
if n == 1:
    ans = p
else:
    q = p
    for d in range(2, 1000001):
        if q < d**2:
            break
        cnt = 0
        while q % d == 0:
            q //= d
            cnt += 1
        ans *= d**(cnt // n)
print(ans)

Solution (Python):

def main():
    buf = input()
    buflist = buf.split()
    N = int(buflist[0])
    P = int(buflist[1])
    factor = prime_factorization(P)
    max_gcd = 1
    for f, c in factor.items():
        while c >= N:
            max_gcd *= f
            c -= N
    print(max_gcd)

def prime_factorization(number):
    n = number
    i = 2
    factor = {}
    while i * i <= n:
        while n % i == 0:
            if i in factor:
                factor[i] += 1
            else:
                factor.update({i : 1})
            n //= i
        i += 1
    if n > 1 or not factor:
        if n in factor:
            factor[n] += 1
        else:
            factor.update({n : 1})
    return factor

if __name__ == '__main__':
    main()

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

def fctr1(n): 
    f=[]
    c=0
    r=int(n**0.5)
    for i in range(2,r+2):
        while n%i==0:
            c+=1
            n=n//i
        if c!=0:
            f.append([i,c])
            c=0
    if n!=1:
        f.append([n,1])
    return f
a=fctr1(p)
ans=1
for i in range(len(a)):
    ans=ans*(a[i][0]**(a[i][1]//n))
print(ans)

Solution (Python):
import sys
import collections
import itertools
import math
import re
from collections import Counter
from collections import deque
from collections import defaultdict
import bisect

N, P = [int(x) for x in input().split()]


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


t = prime_decomposition(P)
c = collections.Counter(t)

ret = 1
for k,v in c.items():
    v2 = v
    while v2 >= N:
        ret *= k
        v2 -= N

print(ret)

Solution (Python):
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from collections import Counter

def factorize(n: int):
    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

n,p = li()

facs = factorize(p)

ans = 1
for k in sorted(facs.keys()):
    if facs[k] >= n:
        ans = ans * k**(facs[k]//n)
        
print(ans)

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

pl = []
d = {}

p = P
i = 2
while i * i <= P:
    cnt = 0
    while p % i == 0:
        p //= i
        cnt += 1
    if cnt > 0:
        d[i] = cnt
    i += 1

if p != 0:
    d[p] = 1

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

print(ans)

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

sqp = math.floor(math.sqrt(p)) + 1
if n == 1:
    print(p)
    sys.exit(0)
insu = {}
for i in range(2, sqp + 1):
    while p % i == 0:
        p //= i
        if i in insu:
            insu[i] += 1
        else:
            insu[i] = 1
ans = 1
for i in insu:
    while insu[i] >= n:
        insu[i] -= n
        ans *= i
print(ans)

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

sqrtp = int(math.sqrt(p))

b = []

for i in range(2, sqrtp+1):
    count = 0
    while p % i == 0:
        count += 1
        p = p // i
    b.append((i, count))
if p > 1:
    b.append((p, 1))

num = 1
for i, c in b:
    c = c // n
    if c > 0:
        num *= (i ** c)

print(num)

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

def getPrimeFactor(x):
    ans = []
    for d in range(2, floor(sqrt(x)) + 1):
        while x % d == 0:
            ans.append(d)
            x //= d
    if x != 1:
        ans.append(x)
    return ans

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

PFs = getPrimeFactor(P)
cnt = Counter(PFs)

ans = 1
for p, num in cnt.items():
    if num // N:
        ans *= p ** (num // N)
print(ans)

Solution (Python):



import array
import collections
import math


def sieve_of_eratosthenes(end, typecode="L"):
    assert end > 1
    is_prime = array.array("B", (True for i in range(end)))
    is_prime[0] = False
    is_prime[1] = False
    primes = array.array(typecode)
    for i in range(2, end):
        if is_prime[i]:
            primes.append(i)
            for j in range(2 * i, end, i):
                is_prime[j] = False
    return primes


def factorize_trial_division(n, typecode="Q"):
    factors = array.array(typecode)
    if n < 2:
        return factors
    for p in sieve_of_eratosthenes(math.ceil(math.sqrt(n)) + 1):
        if p * p > n:
            break
        while n % p == 0:
            factors.append(p)
            n //= p
    if n > 1:
        factors.append(n)
    return factors


def solve(n, p):
    factors_counter = collections.Counter(factorize_trial_division(p))
    res = 1
    for k, v in factors_counter.most_common():
        d = v // n
        if d == 0:
            break
        else:
            res *= k ** d
    return res


def main():
    n, p = (int(z) for z in input().split())
    print(solve(n, p))


if __name__ == "__main__":
    main()

Solution (Python):



def usage(n):
    
    
    fct = factorize(n)
    
    return fct
    
    
    


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


def divisorize(fct):
    b, e = fct.pop()  
    pre_div = divisorize(fct) if fct else [[]]
    suf_div = [[(b, k)] for k in range(e + 1)]
    return [pre + suf for pre in pre_div for suf in suf_div]


def num(fct):
    a = 1
    for base, exponent in fct:
        a = a * base**exponent
    return a


if __name__ == '__main__':
    N,P = map(int,input().split())
    fct = usage(P)
    ans = 1
    for i,j in fct:
        if j >= N:
            ans *= i**(j//N)
    print(ans)

Solution (Python):
n,m=map(int, input().split())
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
ans=1
for i in pf:
    if pf[i]>=n:
        ans*=i**(pf[i]//n)
print(ans)

Solution (Python):
from collections import defaultdict


def solve(n, p):
    if n == 1:
        return p
    i = 2
    ps = defaultdict(lambda: 0)
    while i * i <= p:
        while p % i == 0:
            p //= i
            ps[i] += 1
        i += 1
    ans = 1
    for p, c in ps.items():
        ans *= p ** (c // n)
    return ans


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

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

rec = []
K = P
for i in range(2, int(P ** 0.5) + 1):
    if K % i == 0:
        tmp = 0
        while K % i == 0:
            tmp += 1
            K //= i

        rec.append((i, tmp))

if K != 1:
    rec.append((K, 1))

num = 1
for k, i in rec:
    q = i
    while q >= N:
        num *= k
        q -= N

print(num)

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

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

for i in range(2, int(sqrt(p))+1):
	while p % i == 0:
		c[i] += 1
		p = p // i
c[p] += 1


ans = 1
for key, value in c.items():
	if value >= n:
		ans *= key ** (value // n)

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

factors = factorize(P)
ans = 1
for k,v in factors.items():
    a = v//N
    ans *= k**a
print(ans)

Solution (Python):


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

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
L = prime_decomposition(P)

cnt = 0
ans = 1
vp = 0
for v in L:
    if vp==v:
        cnt += 1
        if cnt == N:
            cnt = 0
            ans *= v
    else:
        cnt = 1
        vp = v

print(ans)

Solution (Python):
N,P=map(int,input().split())
D=dict()
k=2
Q=P
while(True):
    if k*k>P:
        break
    if Q%k==0:
        if k in D:
            D[k]+=1
        else:
            D[k]=1
        Q=Q//k
    else:
        k+=1
if Q in D:
    D[Q]+=1
else:
    D[Q]=1
ans=1
for p in D:
    ans=ans*(p**(D[p]//N))
print(ans)

Solution (Python):
class Factorization:
  def __init__(self):
    self.F={}
    self.i=2
    self.c=0
    
  def factorint(self,x):
    while self.i**2<=x:
      if x%self.i==0:
        self.c=0
        while x%self.i==0:
          x=x//self.i
          self.c+=1
        self.F[self.i]=self.c
      self.i+=1
    if x!=1:
      self.F[x]=1
    return self.F
fac=Factorization()
N,P=map(int,input().split())
A=fac.factorint(P)
ans=1
for i,q in A.items():
  ans*=i**(q//N)
print(ans)

Solution (Python):
n, p = map(int, raw_input().split())
if n == 1:
    print p
elif n > 40:
    print 1
else:
    ans = 1
    i = 2
    while 1:
        k = pow(i, n)
        if k > p:
            break
        while p % k == 0:
            ans *= i
            p /= k
        i += 1
    print ans

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

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

A = defaultdict(int)

def factorize(n):    
    i = 2
    
    while n % i == 0:
        n //= i
        A[i] += 1
    i += 1

    while n != 1 and i <= sqrt(n):
        while n % i == 0:
            n //= i
            A[i] += 1
        i += 2
    if n != 1:
        A[n] += 1

    return A

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

print(ans)

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


def prim(n):
    flg = [True for i in range(n+1)]
    flg[0] = False
    flg[1] = False
    sosuu = []
    for i in range(2,n+1):
        if flg[i]:
            sosuu.append(i)
            counter =2*i
            while counter <=n:
                flg[counter] = False
                counter += i
    return sosuu



    
def primdiv(n):
    """
    24 = 2^3 * 3^1
    primdiv(24) >> [[2, 3], [3, 1]]    
    """
    ans = []
    sosuu = prim(int(n**0.5)+1)
    for i in sosuu:
        if n%i == 0:
            counter = 1
            n = n//i 
            while n%i == 0:
                counter += 1
                n = n//i           
            ans.append([i,counter])
    if n != 1:
        ans.append([n,1])
    return ans

slis = primdiv(P)
ans = 1
for k in slis:
    ans *= k[0]**(k[1]//N)
print(ans)

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


N, P = map(int, input().split())
d = Divisor(P)
ans = 1
for k, v in d.primeFactorization.items():
    ans *= k ** (v // N)
print(ans)

Solution (Python):

import collections, atexit, math, sys, bisect 

sys.setrecursionlimit(1000000)
def getIntList():
    return list(map(int, input().split()))    

try :
    
    import numpy
    def dprint(*args, **kwargs):
        
        
        print(*args,  file=sys.stderr)
    dprint('debug mode')
except Exception:
    def dprint(*args, **kwargs):
        pass



inId = 0
outId = 0
if inId>0:
    dprint('use input', inId)
    sys.stdin = open('input'+ str(inId) + '.txt', 'r') 
if outId>0:
    dprint('use output', outId)
    sys.stdout = open('stdout'+ str(outId) + '.txt', 'w') 
    atexit.register(lambda :sys.stdout.close())     
    
N, P = getIntList()

if N==1:
    print(P)
    sys.exit()
r = 1
for  t in range(2,1000003):
    if P%t!=0: continue
    c = 0
    while P%t==0:
        P//=t;
        c+=1
    r *= t ** (c//N)

print(r)

Solution (Python):
def process(n, p):
    foo = 1
    k = 2
    while k * k <= p:
        c = 0
        while p % k == 0:
            p /= k
            c += 1
        if c >= n:
            foo *= k ** (c / n)
        k += 1
    if n == 1:
        foo *= p
    return foo

def main():
    n, p = [int(i) for i in raw_input().strip().split()]
    print process(n, p)

if __name__ == '__main__':
    main()