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())
if n==1:
    print(p)
else:
    import fractions
    def prime_decomposition(m):
        i = 2
        table = []
        while i * i <= m:
            while m % i == 0:
                m = m//i
                table.append(i)
            i += 1
        if m > 1:
            table.append(m)
        return table
    d=list(prime_decomposition(p))
    s=list(set(d))
    ans=1
    for i in range(len(s)):
        if d.count(s[i])>=n:
            ans*=s[i]**(d.count(s[i])//n)
    
    print(ans)

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

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]
ff = primes(int(math.sqrt(p) + 1))
ans = 1
factorized = dict(zip(ff, [0 for i in range(len(ff))]))
if n == 1:
    print(p)
    exit()
for i in factorized.keys():
    while p % i == 0:
        p /= i
        factorized[i] += 1
    
for i in factorized.keys():
    if factorized[i] >= n :
        ans *= i**(factorized[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())

primes = collections.Counter(prime_factorize(P))


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

Solution (Python):
import math
N, P = map(int, input().split())
p = P**(1/N)
ans = 1
flag=False
if N==1:
  print(P)
  exit(0)


divisors=[]

for i in range(2,round(P**(1/N))+1):
  if P%i==0:
    divisors.append(i)
for i in reversed(divisors):
    if P % (i ** N) == 0:
        ans = i
        break
print(ans)

Solution (Python):
import sys

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

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

lis = []
dic = {}

i = 1
while True:

    flag = True
    now = 1
    if i > 1:
        for j in range(N):
            now *= i
            if now > P:
                flag = False
                break
        if not flag:
            break

    flag = True
    for j in lis:
        if i % j == 0:
            flag = False
            break
    
    if flag and i != 1:
        lis.append(i)
        dic[i] = 0

        while P % i == 0:
            P //= i
            dic[i] += 1

    i += 1


ans = 1


for i in dic:

    if dic[i] != 0:
        ans *= i ** (dic[i]//N)

print (ans)

Solution (Python):
import collections

def prime_return(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())
t = collections.Counter(prime_return(p))
ans = 1
for k, v in t.items():
    if v >= n:
        ans *= (k ** (v // 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))

value=[i**(c[i]//N) for i in c if c[i]>=N]
count=1
for i in value:
    count*=i
print(count)

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)

res = 1
for i in range(len(L)):
	k = L[i][1]//N
	if k > 0:
		res *= L[i][0]**k
print(res)

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

N, P = map(int, input().split())
if N == 1:
  print(P)
  exit(0)
i = 2
x = P + 0
l = []
s = set()
while i * i <= P:
  while x % i == 0:
    x //= i
    l.append(i)
    s.add(i)
  i += 1
if x >= 2:
  l.append(x)
  s.add(x)

res = 1
for y in s:
  t = l.count(y)
  if t >= N:
    res *= pow(y, (t // N))
print(res)

Solution (Python):

n,p=map(int,input().split())
ans=[]
for i in range(2,int(p**0.5)+1):
	cnt=0
	while p%i==0:
		p//=i
		cnt+=1
	if cnt>0:
		ans.append([i,cnt])
ans.append([p,1])
ret=1
for i in range(len(ans)):
	ret*=pow(ans[i][0],(ans[i][1]//n))
print(ret)

Solution (Python):





mod=10**9+7
div={}
def div2(x): 
    global div
    check=2
    while(x!=1 and check <= int(x**0.5)+2):
        while x%check==0:
            if check not in div:
                div[check]=1
            else:
                div[check]+=1
            x/=check
        check+=1
    if x != 1:
      div[x]=1
    return div

def main():
    
    
    
    
    
    
    
    
    
    
    n,p = map(int,input().split())
    div2(p)
    ans=1
    for i in div:
        if div[i]>=n:
            ans*=i**(div[i]//n)
    print(int(ans))
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

l=factorization(p)
ans=1
for i in range(len(l)):
    if l[i][1]>=n:
        ans*=l[i][0]**(l[i][1]//n)
print(ans)

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

def primeCount(N):
    R = int(N**(0.5)) + 1  
    primes = {}  
    n = N
    for num in range(2, R):
        primes[num] = 0
        while n % num == 0:
            n //= num
            primes[num] += 1
    if n > 1 :
        primes[n] = 1
    return { key : val for key, val in primes.items() if val > 0}  

primeP = primeCount(P)
ans = 1
for p, cnt in primeP.items():
    ans *= max(1, p**(cnt // N))

print(ans)

Solution (Python):
def f(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())
arr = f(p)
l = []
for i in arr:
  if i[1] >= n:
    l.append((i[0],i[1]//n))
ans = 1
for i in l:
  ans *= i[0]**i[1]
print(ans)

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

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

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

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

    return arr

li=factorization(p) 

ans=1
for i,j in li:
    if j>=n:
        temp=j
        while temp>=n:
            ans*=i
            temp-=n
print(ans)

Solution (Python):

n,p = map(int,input().split())
if n > 39:
  print(1)
  exit()
if n == 1:
  print(p)
  exit()
ans = 1
num = 1
while num ** n <= p:
  if p % (num**n) == 0:
    ans = num
  num += 1
print(ans)

Solution (Python):
from collections import Counter

INF = 10**9 + 7

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

Solution (Python):
m,p=map(int,input().split())
n = 10**6
prime = {i for i in range(2,n)}
for i in range(2,n):
    if i in prime:
        for j in range(i*2,n,i):
            if j in prime:
                prime.remove(j)
                
ans=1
lists=[]
checker=1
for i in prime:
    lists.append(i)  
lists=sorted(lists) 
for i in lists:
    count=0
    while p%i==0:
        p=p/i
        count+=1
    a=count//m
    ans=ans*(i**a)


if p>10**6:
    if m==1:
        ans=ans*p
        
        print(int(ans))
    else:
        print(int(ans))
else:
    print(int(ans))

Solution (Python):
def factorization(n):
    def sieve(n):
        is_prime = [True for _ in range(n+1)]
        is_prime[0] = False

        for i in range(2, n+1):
            if is_prime[i-1]:
                j = 2 * i
                while j <= n:
                    is_prime[j-1] = False
                    j += i
        table = [ i for i in range(1, n+1) if is_prime[i-1]]
        return table
    arr = []
    temp = n
    for i in sieve(int(n**0.5)):
        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
cnt=1
n,p= map(int, input().split())
a=factorization(p)
for x in a:
    cnt*=x[0]**(x[1]//n)
print(cnt)

Solution (Python):
def factorization(n):
    def sieve(n):
        is_prime = [True for _ in range(n+1)]
        is_prime[0] = False

        for i in range(2, n+1):
            if is_prime[i-1]:
                j = 2 * i
                while j <= n:
                    is_prime[j-1] = False
                    j += i
        table = [ i for i in range(1, n+1) if is_prime[i-1]]
        return table
    arr = []
    temp = n
    for i in sieve(int(n**0.5)):
        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
cnt=1
n,p= map(int, input().split())
a=factorization(p)
for x in a:
    cnt*=x[0]**(x[1]//n)
print(cnt)

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

Solution (Python):
from collections import Counter


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


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


prime_count_list = prime_factorize(P)

prime_count_dict = Counter(prime_count_list)


ans = 1
for p, k in prime_count_dict.items():
    ans *= (p ** int(k/N))

print(ans)

Solution (Python):

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

PO=P
K=[0]*(int(P**0.5)+1)

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

ans=1
for i in range(2,int(PO**0.5)):
    if K[i]!=0:
        ans*=i**K[i]

print(ans)

Solution (Python):
import collections
n,p=map(int,input().split())
def 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
factor=factorize(p)
c = collections.Counter(factor)
ans=1
for k, v in c.items():
  if v >= n:
    ans *= (k ** (v//n))
print(int(ans))

Solution (Python):

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

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

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

    return arr

ans = 1
n, p = map(int, input().split())
l = factorization(p)
s = []
for i in range(len(l)):
    for j in range(l[i][1]//n):
        ans *= l[i][0]

print(ans)

Solution (Python):
from math import sqrt


def Calc_Divisors(num):
    divisors = []
    for i in range(1, int(sqrt(num)) + 1):
        if num % i == 0:
            divisors.append(i)
            if i != num // i:
                divisors.append(num//i)
    divisors.sort()
    return divisors

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

    A = Calc_Divisors(P)

    ans = 1
    for i in A:
        tmp = P % (pow(i, N))
        if N > 40:
            print(ans)
            exit()
        if pow(i, N) > P:
            print(ans)
            exit()
        if tmp == 0:
            ans = i

    print(ans)

Solution (Python):
import math

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

p_part_list = {}


for i in range(2,int(math.sqrt(p)) +1):
  if p % i == 0:
    while (p % i == 0):
      if i not in p_part_list:
        p_part_list[i] = 1
        p = p // i
      else:
        p_part_list[i] += 1
        p = p // i
      
if p > 1:
  p_part_list[p] = 1
  
max_num = 1


for num in p_part_list:
  if p_part_list[num] >= n:	
   
    max_num *= num ** int(p_part_list[num]/n)
    
print(max_num)

Solution (Python):
import collections

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

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

dct=collections.Counter(a)

ans=1

li=dct.items()

for tt in li:
  if tt[1]//n>=1:
    ans*=tt[0]**(tt[1]//n)
print(ans)

Solution (Python):
import math
from collections import defaultdict
N,P = [int(x) for x in input().split()]

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

divs_of_p = trial_division(P)
ans = 1
for key in divs_of_p:
    if(divs_of_p[key]>=N):
        ans *= key**(divs_of_p[key]//N)
print(ans)

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

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

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

    return arr

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

Solution (Python):
import collections

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

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

c = collections.Counter(prime_factorize(p))

clist = list(c.items())
res = 1
for pr , qu in clist:
    res *= pr ** (qu // n)

print(res)

Solution (Python):
import collections

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

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

dct=collections.Counter(a)

ans=1


li=dct.items()


for tt in li:
  if tt[1]//n>=1:
    ans*=tt[0]**(tt[1]//n)
print(ans)

Solution (Python):
N,P=map(int,input().split())
Q=[0]*(10**6+1)

i=2

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

while 1:
  if P==1 or i>=10**6:
    break
  if P%i==0:
    P//=i
    Q[i]+=1
    i=2
  else:
    i+=1


Q=list(map(lambda x: x//N,Q))

ans=1
for i,q in enumerate(Q):
  if q:
    ans*=i**q
print(ans)

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

def check_prime(num):
	for i in range(2, int(pow(num, 0.5)) + 1):
		if num%i == 0:
			return False
	return True

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

	if N == 1:
		print(P)
		return

	if check_prime(P):
		print(1)
		return
	
	MAX_PRIME = int(pow(P, 0.5))
	primes = []
	is_prime = [True] * (MAX_PRIME+1)
	for i in range(2, MAX_PRIME+1):
		if is_prime[i]:
			primes.append(i)
			for j in range(2*i, MAX_PRIME+1, i):
				is_prime[j] = False
	

	so = []
	for p in primes:
		count = 0
		while P%p == 0:
			count += 1
			P //= p
		if count > 0:
			so.append((p, count))
	if P != 1:
		so.append((P, 1))
	

	ans = 1
	for (p, count) in so:
		ans *= pow(p, count//N)
	print(ans)
	

if __name__ == "__main__":
	main()

Solution (Python):
def PF(P):
    PF = dict()
    Po, x = P, 2
    while x < Po ** 0.5:
        i = 0
        while P % x == 0:
            P //= x
            i += 1
        if i > 0:
            PF[x] = i
        x += 1
    return PF

N, P = map(int, input().split())
if N == 1:
    print(P)
elif P <= 3:
    print(1)
else:
    F, ans = PF(P), 1
    for x in list(F.keys()):
        ans *= x ** (F[x] // N)
    print(ans)

Solution (Python):
from collections import Counter
import sys
sys.setrecursionlimit(1000000)

def solve():
  n,p = (int(i) for i in input().split())
  ans = 1
  if n == 1:
    print(p)
    exit()
  p_dummy = p
  for i in range(2,int(p_dummy**0.5)+4):
    ct = 0
    while p_dummy%i == 0:
      ct += 1
      p_dummy //= i
      if ct >= n:
        ans *= i
        ct -= n
  

  print(ans)
  
solve()

Solution (Python):
N,P=map(int,input().split())
if N==1:
    print(P)
else:
    a=1
    for i in range(2,10**6+1):
        s=0
        while True:
            if P%i==0:
                P//=i
                s+=1
            else:
                if s>=N:
                    a*=i**(s//N)
                break
    print(a)

Solution (Python):
N,P=map(int,input().split())
if N==1:
    print(P)
else:
    a=1
    for i in range(2,10**6+1):
        s=0
        while True:
            if P%i==0:
                P//=i
                s+=1
            else:
                if s>=N:
                    a*=i**(s//N)
                break
    print(a)

Solution (Python):
N,P=map(int,input().split())
if N==1:
    print(P)
else:
    a=1
    for i in range(2,10**6+1):
        s=0
        while True:
            if P%i==0:
                P//=i
                s+=1
            else:
                if s>=N:
                    a*=i**(s//N)
                break
    print(a)

Solution (Python):




N,P=map(int,input().split())
l=[0]*int(-(-P**0.5//1)+1)

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

for i in range(2,int(-(-P**0.5//1)+1))[::-1]:
    p=P
    count=0
    while p%i==0:
        p/=i
        count+=1
        if count==N:
            print(i)
            exit()
print(1)

Solution (Python):
import sys
from collections import defaultdict
from heapq import *
sys.setrecursionlimit(200000)
input = sys.stdin.readline

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

















s = defaultdict(int)
for v in range(2, int(P ** 0.5) + 1):
    while P % v == 0:
        P = P // v
        s[v] += 1
if P != 1:
    s[P] += 1

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

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

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

    ans = 1
    d = 2
    while d * d <= P:
        cnt = 0
        while P % d == 0:
            P //= d
            cnt += 1
        ans *= pow(d, cnt//N)
        d += 1

    print(ans)
if __name__ == '__main__':
    main()

Solution (Python):
import math

def main():
    N, P = map(int, input().split())
    if N == 1: return P
    ans = 1
    v = P
    for i in range(2, int(math.sqrt(P))+1):
        if v % i == 0:
            ct = 0
            while v % i == 0:
                ct += 1
                v = v // i
            
            for _ in range(ct//N):
                ans *= i
    return ans


if __name__ == '__main__':
    print(main())

Solution (Python):
from fractions import gcd
from random import randint

def brent(N):
   
   if N%2==0: return 2
   y,c,m = randint(1, N-1),randint(1, N-1),randint(1, N-1)
   g,r,q = 1,1,1
   while g==1:             
       x = y
       for i in range(r):
          y = ((y*y)%N+c)%N
       k = 0
       while (k<r and g==1):
          ys = y
          for i in range(min(m,r-k)):
             y = ((y*y)%N+c)%N
             q = q*(abs(x-y))%N
          g = gcd(q,N)
          k = k + m
       r = r*2
   if g==N:
       while True:
          ys = ((ys*ys)%N+c)%N
          g = gcd(abs(x-ys),N)
          if g>1:  break
   return g

def factorize(n1):
    if n1<=0: return []
    if n1==1: return [1]
    n=n1
    t = {}
    p=0
    mx=1000000
    if n%2 == 0: 
        t[2]=0
    if n%3 == 0:
        t[3]=0
    while n % 2 ==0 :
        t[2] += 1
        n//=2
    
    while n % 3 ==0 : 
        t[3] += 1;n//=3
        
    
    i=5
    inc=2
    
    
    while i <=mx:
       while n % i ==0 : 
           if i not in t.keys():
               t[i] = 0
           t[i] += 1
           n//=i
       i+=inc
       inc=6-inc
    
    
    while n>mx:
      p1=n
      
      while p1!=p:
          p=p1
          p1=brent(p)
      
      if p1 not in t.keys():
          t[p1] = 0
      t[p1] += 1;n//=p1 
    
    if n!=1:
        t[n] = 1
    return t


from functools import reduce
from sys import argv
def main():
    n, p = tuple(map(int, input().strip().split()))
    if p==1:
        print(1)
        return
    q = factorize(p)
    
    ans = 1
    for a in q.keys():
        q[a] //= n
        ans = ans * (a**q[a])
    print(ans)     
    


if __name__ == "__main__":
   main()

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

if N == 1:
  print(P)
  sys.exit()
ans = 1
d = 2
while d * d <= P:
  cnt = 0
  while P % d == 0:
    P //= d
    cnt += 1
  ans *= d ** (cnt // N)
  d += 1
print(ans)

Solution (Python):
from collections import Counter,defaultdict
import sys,heapq,bisect,math,itertools,string,queue
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().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

n,p = inpl()
soin = prime_factorize(p)
cnt = Counter(soin)
res = 1
for key in cnt.keys():
    if cnt[key] >= n:
        res *= key ** (cnt[key]//n)
print(res)

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

def trial_division(n):
    if n < 2:
        return []
    prime_factors = []
    for p in range(2, int( n**0.5)):
        if p*p > n: break
        cnt = 0
        while n % p == 0:
            cnt += 1
            n //= p
        prime_factors.append([p, cnt])
    if n > 1:
        prime_factors.append([n, 1])
    return prime_factors

prime_factors = trial_division(P)
ans = 1
for p in prime_factors:
    if p[1] >= N:
        ans *= p[0]**(p[1] // N)
print(ans)

Solution (Python):
n, p = map(int, input().split())
i_dict = {}
ans = 1

while True:
    check = 0
    for i in range(2, 1 + int(p**0.5)):
        if p % i == 0:
            if i in i_dict:
                i_dict[i] += 1
            else:
                i_dict[i] = 1
            p = p // i
            check = 1
            break
    if check == 0:
        if p in i_dict:
            i_dict[p] += 1
        else:
            i_dict[p] = 1
        break

for k, v in i_dict.items():
    ans *= k ** (v // n)

print(ans)

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

N,P = map(int,input().split())
li = prime_factor(P)
c = collections.Counter(li)
ans = 1
for k,v in c.items():
    if v>=N:
        ans *= k**(v//N)
print(ans)

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

Solution (Python):
from math import floor
N,P=map(int,input().split())
ans=1
def factorize(n):
  div=2
  fct=[]   
  while div**2<=n:
    cnt=0
    while n%div==0:
      n//=div
      cnt+=1        
    if cnt>0:
      fct.append((div,cnt))
    div+=1
  if n>1:
    fct.append((n,1)) 
  return fct

fct=factorize(P)
for prime, cnt in fct:
    ans*=prime**floor(cnt/N) 
print(ans)

Solution (Python):



import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

def trial_division(n):
    factor = []
    tmp = int(math.sqrt(n)) + 1
    for i in range(2,tmp):
        while n % i == 0:
            n //= i
            factor.append(i)
    if n != 1:
        factor.append(n)
    factor.sort()
    return factor
n,p = LI()
P = trial_division(p)
P = list(Counter(P).items())
ans = 1
for i,j in P:
    ans *= i**(math.floor(j/n))
print(ans)

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

X = defaultdict(int)
SP = int(P ** 0.5)+1
for i in range(2, SP+1):
    while P % i == 0:
        X[i] += 1
        P //= i
if P != 1:
    X[P] += 1

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

Solution (Python):
import numpy as np
n,p = map(int,input().split())

def factorize(N):
    up = int(np.sqrt(N))+2
    out = {}

    for i in range(2,up):
        if N%i == 0:
            temp = N
            count = 0
            while(True):
                N = N//i
                count += 1
                if N%i != 0:
                    break
            out[i] = count
        else:
            continue
    if N != 1:
        out[N] = 1
    return out

d = factorize(p)



if len(d) == 0:
    print(1)
else:
    ans = 1
    for k in d:
        ans *= k**(d[k]//n)
    print(ans)

Solution (Python):






"""
4 972439611840
"""

"""
206
"""







"""
//////////////////////
 1   2   3   4
----------------
 2   2   2   2
 *   *   *   *
103 103 103 103
 *
2^2
 *
103^0
 *
3^3
 *
5^1
----------------
111240  206  206  206
=972439611840
/////////////////////
"""


from fractions import gcd
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

res=trial_div(p)
ans=1
for k,v in res.items():
    tmp=k**(v//n)
    ans*=tmp

print(ans)

Solution (Python):

from fractions import gcd
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

res=trial_div(p)
ans=1
for k,v in res.items():
    tmp=k**(v//n)
    ans*=tmp

print(ans)

Solution (Python):
import math

def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct
def main():
    N, P = map(int, input().split())
    ans = 1
    soinsu = factorize(P)
    
    di = {}
    for i in soinsu:
        if i not in di:
            di[i] = 1
        else:
            di[i] += 1
    for k,v in di.items():
        kosu = v//N

        if kosu > 0:
            ans *= (k ** kosu)

    print(ans)

if __name__ == "__main__":
    main()

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


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

X = defaultdict(int)
cnt = 2
for a in range(2, floor(sqrt(P)) + 1):
    while P % a == 0:
        X[a] += 1
        P = P // a
if P > 1:
    X[P] += 1

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

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

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

ans = 1

for i in range(2, 1000001):
    x = 1
    for _ in range(n):
        x *= i
        if x > p:
            break
    if p % x == 0:
        ans = i
    if i == 2 and x > p:
        break

print(ans)

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

def main():
    N,P = map(int,input().split())
    if N==1:
        print(P)
    elif N>50:
        print(1)
    else:
        ans = 1
        insuu = 2
        while insuu**N<=P:
            if P%(insuu**N)==0:
                ans *= insuu
                P //= insuu**N
            else:
                insuu += 1
        print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()


def getPrimeList(n):
  l=[]
  t=int(math.sqrt(n))+1
  
  for a in range(2,t):
    while n%a==0:
      n//=a
      l.append(a)

  if n!=1:
    l.append(n)
  
  return l

def main():
  n,p=LI()

  if n==1:
    print(p)
    exit()
  
  l=getPrimeList(p)
  
  if len(l)==0:
    print(1)
    exit()

  a=l[0]
  c=1
  sm=1
  for x in l[1:]:
    if a==x:
      c+=1
    else:
      c=1
      a=x

    if c==n:
      sm*=a
      c=0

  return sm

print(main())

Solution (Python):

def count_divisors(num: int) -> int:
    max_prime = 0
    ret = {}  

    
    cnt = 0
    while num % 2 == 0:
        num //= 2
        cnt += 1
    if cnt > 0:
        max_prime = 2
        ret[max_prime] = cnt

    
    cnt = 0
    for i in range(3, int(num ** 0.5) + 1, 2):
        cnt = 0
        while num % i == 0:
            num //= i
            max_prime = i
            cnt += 1
        if cnt > 0:
            ret[max_prime] = cnt

    
    if num > 2:
        max_prime = num
        ret[max_prime] = 1

    return ret


def main():
    n, p = list(map(int, input().rstrip().split()))
    ans = 1
    for f, p in count_divisors(p).items():
        ans *= f ** (p // n)  
    print(ans)


if __name__ == "__main__":
    main()

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