Problem:
 Score : 300 points    Problem Statement There are N integers a_1, a_2, ..., a_N not less than 1 .
The values of a_1, a_2, ..., a_N are not known, but it is known that a_1 \times a_2 \times ... \times a_N = P .  Find the maximum possible greatest common divisor of a_1, a_2, ..., a_N .      Constraints  1 \leq N \leq 10^{12}  1 \leq P \leq 10^{12}         Input Input is given from Standard Input in the following format:  N  P       Output Print the answer.        Sample Input 1 3 24      Sample Output 1 2  The greatest common divisor would be 2 when, for example, a_1=2, a_2=6 and a_3=2 .       Sample Input 2 5 1      Sample Output 2 1  As a_i are positive integers, the only possible case is a_1 = a_2 = a_3 = a_4 = a_5 = 1 .       Sample Input 3 1 111      Sample Output 3 111       Sample Input 4 4 972439611840      Sample Output 4 206

Solution (Python):
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
from math import sqrt, pi
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7





N, P = getNM()

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

    return divisors

ans = 1
for i in prime_factorize(P):
    if i[1] >= N:
        ans *= i[0] ** (i[1] // N)
print(ans)

Solution (Python):
def resolve():
    '''
    code here
    '''
    import collections
    import copy

    N, P = [int(item) for item in input().split()]
    P_org = copy.deepcopy(P)

    fact_list = [1]

    cnt = 2
    while P > 1 and cnt**2 <= P:
        if P % cnt == 0:
            fact_list.append(cnt)
            P //= cnt
        else:
            cnt += 1
    fact_list.append(P)

    if N == 1:
        res = P_org
    else:
        cnt_num = collections.Counter(fact_list[1:])
        res_list = []
        for i, v in cnt_num.items():
            if v//N > 0:
                res_list.append(i**(v//N))
        
        res = 1
        for item in res_list:
            res *= item
    print(res)

if __name__ == "__main__":
    resolve()

Solution (Python):



def prime_factorize(N):
    f = {}
    i = 2
    while i * i <= N:
        if N % i != 0:
            i += 1
            continue
        
        exp = 0
        
        while N % i == 0:
            exp += 1
            N //= i
        
        f[i] = exp
        
        i += 1
    
    if N != 1:
        f[N] = 1
    return f


N, P = map(int, input().split())
F = prime_factorize(P)
ans = 1
for i in F:
    ans *= i**(F[i]//N)
print(ans)

Solution (Python):
N, P = map(int, input().split())
ans = 1
def main(n, p):
  if n == 1:
    return P
  global ans
  for i in range(2, int(p**(2/n))):
    t = i**n
    if p % t == 0:
      ans *= i
      return main(n, p//t)
  return ans

print(main(N, P))

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

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


def factorization(n):
    """
    素因数分解
    factorization(24)
    [[2, 3], [3, 1]]
    24 = 2^3 * 3^1
    """
    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


d = factorization(P)
ans = 1

for p, num in d:
    
    if num // N != 0:
        ans = ans * pow(p, (num // N))
print(ans)

Solution (Python):
def main():
    def factorization(num):
        result = []
        count = 0
        temp = num
        for i in range(2, int(num ** 0.5) + 1):
            if temp % i == 0:
                count = 0
                while temp % i == 0:
                    count += 1
                    temp /= i
                result.append([i, count])
        if temp != 1:
            result.append([int(temp), 1])
        if result == []:
            result.append([num, 1])
        return result

    n, p = map(int, input().split())
    factors = factorization(p)
    ans = 1
    for f, v in factors:
        ans *= f ** (v // n) if v >= n else 1
    print(ans)

if __name__ == '__main__':
    main()

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

div = 2
L = []
i = 1
while div <= int(m**0.5)+1:
    while m%div == 0:
        m //=div
        L.append(div)
    div +=1
if m!= 1:
    L.append(m)


from collections import Counter
L = Counter(L)

cnt = 1
for k,v in L.items():
    cnt *=k**(v//n)
print(cnt)

Solution (Python):
def factorization(n):
    """素因数分解する

    下記より引用いたしました。
    https://qiita.com/snow67675476/items/e87ddb9285e27ea555f8

    Parameters
    ----------
    n : integer
        対象の数

    Returns
    -------
    list
        素因数分解のリスト
        list[素数][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())
fact_li = factorization(P)
ans = 1
for i in range(len(fact_li)):
    cnt = fact_li[i][1] // N
    ans *= fact_li[i][0] ** cnt
print(ans)

Solution (Python):
from collections import Counter
def p(n):
    a=[]
    i=2
    while i*i<=n:
        while n%i==0:
            a.append(i)
            n//=i
        i+=1
    if n>1:
        a.append(n)
    return a
N,P=map(int,input().split())
pl=Counter(p(P))
ans=1
for k,v in pl.items():
    ans*=k**(v//N)
print(ans)

Solution (Python):
from collections import Counter
def p_fact(n,a):
  m=n
  i=2
  a.append(1)
  while n>1:
    if i>m**.5:
      a.append(n)
      break
    if n%i==0:
      n//=i
      a.append(i)
    else:i+=1  
  return a
n,m=map(int,input().split())
a=Counter(p_fact(m,[]))
b=a.values()
c=a.keys()
ans=1
for i,j in zip(c,b):
  if j>=n:ans*=i**(j//n)
print(ans)

Solution (Python):

import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd, ceil



import string

from bisect import bisect_left
MOD = int(1e9)+7
INF = float('inf')


def solve():
    
    n, p = [int(x) for x in input().split()]
    i = 2
    pc = p
    f = defaultdict(int)
    while i * i <= pc:
        while p % i == 0:
            f[i] += 1
            p //= i
        i += 1
    if p != 1:
        f[p] += 1
    ans = 1
    for d in f:
        x = f[d] // n
        if x:
            ans *= pow(d, x)
    print(ans)

t = 1

for case in range(1,t+1):
    ans = solve()


"""

azyxwvutsrqponmlkjihgfedcb

"""

Solution (Python):
from collections import Counter

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

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

for k,v in cnt.items():
  if v < n: continue
  ans *= k**(v//n)
print(ans)

Solution (Python):
from collections import defaultdict


def factorize(n: int) -> dict:
    f = defaultdict(int)
    while n % 2 == 0:
        f[2] += 1
        n //= 2
    p = 3
    while p * p <= n:
        while n % p == 0:
            f[p] += 1
            n //= p
        p += 2
    if n != 1:
        f[n] += 1
    return f


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

Solution (Python):
n, p = map(int, input().split())
if n == 1:
    print(p)
else:
    ans = 1
    for i in range(1, 10**6+1):
        if pow(i, n, 10**20) > p:
            break

        if p % pow(i, n, 10**20) == 0:
            ans = i
    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())
ans = 1
for i in factorization(P):
  if i[1] >= N:
    ans *= i[0]**(i[1]//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())
a=factorization(p)
ans=1
for x,y in a:
    y//=n
    ans*=x**y
print(ans)

Solution (Python):

def get_prime(N):
    if N < 2:
        return {1:1}
    prime = dict()
    prime[1] = 1

    i = 2
    while i*i <= N:
        while N % i == 0:
            if i in prime.keys():
                prime[i] += 1
            else:
                prime[i] = 1
            N = N//i
        i += 1
    if N != 1:
        prime[N] = 1
    return prime


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


prims = get_prime(p)

ans = 1


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

for p, cnt in prims.items():
    _tmp = cnt//n
    ans *= p**(cnt//n)

print(ans)

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

Solution (Python):





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


def div_primes(x):
    ret = {}
    for i in range(2, int(x**0.5) + 1):
        tmp = 0
        while x % i == 0:
            tmp += 1
            x //= i
        if tmp > 0:
            ret[i] = tmp

    if x > 1:
        ret[x] = 1
    return ret


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

Solution (Python):
def PrimeFactorize(num):
    ret = dict()
    while num % 2 == 0:
        ret.setdefault(2, 0)
        ret[2] = ret[2] + 1
        num //= 2
    prime = 3
    while prime * prime <= num:
        if num % prime == 0:
            ret.setdefault(prime, 0)
            ret[prime] =ret[prime] + 1
            num //= prime
        else:
            prime += 2
    if num != 1:
        ret.setdefault(num, 0)
        ret[num] = ret[num] + 1
    
    return ret

def Main():
    n, p = map(int, input().split())    
    prime_list = PrimeFactorize(p)
    ans = 1
    for key, val in prime_list.items():
        if val >= n:
            ans *= key ** (val // n)
    print(ans)

if __name__ == "__main__":
    Main()

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

temp=factorization(p)
ans=1
i=0
while i<len(temp):
  if temp[i][1]>=n:
    ans=ans*temp[i][0]
    temp[i][1]=temp[i][1]-n
  else:
    i=i+1
print(ans)

Solution (Python):

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



def prime_factorize(n):
    n_origin=n+0
    primelist=[]
    a=2
    while a*a<=n_origin:
        if n%a!=0:
            a+=1
            continue
        ex=0
        while n%a==0:
            ex+=1
            n=n//a
        primelist.append([a,ex])
        a+=1
    if n!=1:
        primelist.append([n,1])
    return primelist

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

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


def divisor(x):
    ans=set([])
    i=1
    while(i*i<=x):
        if(x%i==0):
            ans.add(i)
            ans.add(x//i)
        i+=1
    ans=sorted(list(ans))
    return ans



def prime_factorization(x):
    ans={}
    divisors=divisor(x)
    xi=x
    for di in divisors:
        if(xi==1):
            break
        elif(di<=1):
            continue
        else:
            dj=0
            while(xi%di==0 and xi!=1):
                xi//=di
                dj+=1
            if(dj>0):
                ans[di]=dj
    return ans

pf=prime_factorization(p)

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

Solution (Python):
n, p = [int(w) for w in input().split()]


if n == 1:
    ans = p
else:
    ans = 1
    i = 2
    while i <= int(p ** (1 / n)):
        while (p / ans ** n) % i ** n == 0 and (p / ans ** n) > 0:
            ans *= i
        i += 1
print(ans)

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

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

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

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

    return arr
    
s = factorization(p)

for valu, num in s:
    if num >= n:
        tmp = num//n
        ans *= valu**tmp
print(ans)

Solution (Python):
mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    def PrimeDecomposition(N):
        ret = {}
        n = int(N ** 0.5)
        for d in range(2, n + 1):
            while N % d == 0:
                if d not in ret:
                    ret[d] = 1
                else:
                    ret[d] += 1
                N //= d
            if N == 1:
                break
        if N != 1:
            ret[N] = 1
        return ret

    N, P = map(int, input().split())
    prime = PrimeDecomposition(P)
    ans = 1
    for p in prime:
        ans *= p ** (prime[p] // N)
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
from math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heappop,heappush
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

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()
c = Counter(prime_factorize(p))

if len(c) == 0:
    ans = 1
else:
    i = 0
    ans = 1
    while c.most_common()[i][1] >= n:
        ans *= c.most_common()[i][0]**(c.most_common()[i][1]//n)
        if i != len(c) - 1:
            i += 1
        else:
            break
print(ans)

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

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

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

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

    return arr
ans=1
F=factorization(P)
for arr in F:
    v=arr[0]
    num=arr[1]
    ans*=v**(num//N)

print(ans)

Solution (Python):
import sys
import collections

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007



def main():
	
	n, p = tin()
	
	bb=collections.defaultdict(lambda : 0)
	tp = p
	for i in range(2, p):
		if tp % i == 0:
			while tp % i == 0:
				bb[i] += 1
				tp = tp // i
				
		if i * i > tp:
			bb[tp] += 1
			break
	
	rr = 1
	for k in bb:
		
		if bb[k] >= n:
			rr *= k**(bb[k]//n)
	print(rr)
		
	

isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		
			
	ret = main()
	if ret is not None:
		print(ret)

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

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

def main():
    mod=10**9+7
    N,P=MI()
    if P==1:
        print(1)
        exit()
        
    
    def factorization(n):
        if n==1:
            return [0,1]
        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)):
        a=L[i][0]
        b=L[i][1]
        c=b//N
        temp=pow(a,c)
        ans*=temp
        
    print(ans)
        

main()

Solution (Python):
from collections import defaultdict





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


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

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

from collections import Counter
def m():
    N, P = map(int, input().split())
    if N == 1:
        return P
    x = prime_factorize(P)
    a = 1
    c = Counter(x)
    ans = [1]
    for k, v in c.items():
        tmp = v // N
        if tmp != 0:
            ans.append(k**tmp)


    for i in ans: a*=i
    return a


print(m())

Solution (Python):
from sys import stdin, setrecursionlimit


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[i] = cnt

    if temp != 1:
        arr[temp] = 1

    if arr == []:
        arr[n] = 1

    return arr


def main():
    input = stdin.buffer.readline
    n, p = map(int, input().split())
    f = factorization(p)
    ans = 1
    for k in f:
        if f[k] >= n:
            ans *= k ** (f[k] // n)
    print(ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Solution (Python):
import math

def factorization(n): 
    arr = []
    temp = n
    for i in range(2, int(math.sqrt(n))+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])




    return arr

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

a=factorization(p)

ans=1
for i in range(len(a)):
    if(a[i][1]>=n):
        ans*=(a[i][0]**(a[i][1]//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())
prime_list = factorization(p)
ans = 1
for x in prime_list:
  ans *= x[0]**(x[1]//n)
print(ans)

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

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

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

    return arr

a=factorization(p) 
ans=1
for i in range(len(a)):
    if n<=a[i][1]:
        while a[i][1]>=n:
            ans=ans*a[i][0]
            a[i][1]-=n      
print(ans)

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

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

def prime_fact(x):
    fact=[]
    for i in range(2, int(x**(0.5))+1):
        while x%i==0:
            fact.append(i)
            x//=i
    if x!=1:
        fact.append(x)
    if not fact:
        fact=[x]
    return fact

l=prime_fact(p)

from collections import Counter
c=Counter(l)
ans=1
for key in c:
    fa=c[key]//n
    if fa>=1:
        ans*=key**fa
print(ans)

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

if n == 1:
    print(p)
    exit()
ans = 1
for i in range(2, int(p ** (1 / n) + 1)):
    cnt = 0
    while p % i == 0:
        cnt += 1
        p //= i
    if cnt != 0:
        ans *= i ** (cnt // 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
def main2():
    n,p=map(int, input().split())
    lis = factorization(p)
    lis.sort(key=lambda x:x[1], reverse = True)
    i = 0
    res = 1
    while(i<len(lis) and lis[i][1]>=n):
        res = lis[i][0]**(lis[i][1]//n)*res
        i+=1
    print(res)

if __name__ == '__main__':
    main2()

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())
p = Counter(prime_factorize(p))
ans = 1
for key, val in p.items():
    if val >= n:
        ans *= pow(key, int(val//n))
print(ans)

Solution (Python):
from collections import defaultdict
import math
def trial_division(n):
    a = [1]
    for i in range(2,int(math.sqrt(n)) + 1):
        while n % i == 0:
            n //= i
            a.append(i)
    a.append(n)
    return a
N, P = map(int, input().split())
d = defaultdict(int)
for i in trial_division(P):
    d[i] += 1
ans = []
for key in d.keys():
    if d[key] >= N:
        ans.append(key**(d[key]//N))
ans2 = 1
for i in ans:
    ans2 *= i
print(ans2)

Solution (Python):
n,p=map(int,input().split())
from collections import Counter
a=[]
while p%2==0:
  a.append(2)
  p//=2
f=3
while f<=p:
  if p%f==0:
    a.append(f)
    p//=f
  elif f*f>p:
    a.append(p)
    break
  else:
      f+=2
c=Counter(a)
ans=1
for k,v in c.items():
  if v>=n:
    ans*=k**(v//n)
print(ans)

Solution (Python):
def fact(A):
    c0 = A
    r = 2
    lis = []
    count = 1
    while A != 1:
        if A%r == 0:
            A = A//r
            lis.append(r)
            r = 2
        else:
            r += 1
        if r > int(pow(c0,0.5))+1:
            lis.append(A)
            break
    return(lis)
n,p = map(int,input().split())
lis = fact(p)
L = list(set(lis))
import collections
c = collections.Counter(lis)
ans = 1
for x in L:
    if c[x] >= n:
        ans *= x**(c[x]//n)
print(ans)

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

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

prime_factors = []
i = 2
while i ** 2 <= p:
    ext = 0
    while p % i == 0:
        ext += 1
        p //= i
    if ext:
        prime_factors.append((i, ext))
    i += 1
if p != 1:
    prime_factors.append((p, 1))

ans = 1
for pf, num in prime_factors:
    ans *= (pf ** (num // n))
print(ans)

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

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

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

def integer_factorization(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[n] += 1
    return prime_count

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

main()

Solution (Python):


import sys
input = sys.stdin.readline

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




def prime_factorize(n):
    i = 2
    primes = []
    while i * i <= n:
        if n % i != 0:
            i += 1
            continue
        exp = 0
        while n % i == 0:
            exp += 1
            n = n // i
        primes.append([i, exp])
        i += 1
    
    if n != 1:
        primes.append([n, 1])
    return primes

primes = prime_factorize(P)

max_gcd_primes = [[prime[0],prime[1]//N] for prime in primes]
max_gcd = 1
for prime in max_gcd_primes:
    max_gcd *= prime[0] ** prime[1]
print(max_gcd)

Solution (Python):
def main():
    n, p = list(map(int, input().split()))
    def factorization(num):
        result = []
        count = 0
        temp = num
        for i in range(2, int(num ** 0.5) + 1):
            if temp % i == 0:
                count = 0
                while temp % i == 0:
                    count += 1
                    temp /= i
                result.append([i, count])
        if temp != 1:
            result.append([int(temp), 1])
        if result == []:
            result.append([num, 1])
        return result
    ans = 1
    for (fac, cnt) in factorization(p):
        ans *= pow(fac, cnt // n)
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):


import sys
from typing import Any, Callable, Deque, Dict, List, Mapping, Optional, Sequence, Set, Tuple, TypeVar, Union






























def main():
    mod = 1000000007                
    inf = float('inf')              
    
    sys.setrecursionlimit(10**6)    
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def isp():   return input().split()
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    import math
    class Eratos:
        def __init__(self, num):
            '''
            O(nlglgn) で num までの素数判定テーブルを作る
            >>> e = Eratos(10)
            >>> e.table
            [False, False, True, True, False, True, False, True, False, False, False]
            '''
            assert(num >= 1)
            self.table_max = num
            
            self.table = [False if i == 0 or i == 1 else True for i in range(num+1)]
            for i in range(2, int(math.sqrt(num)) + 1):
                if self.table[i]:
                    for j in range(i ** 2, num + 1, i):    
                        self.table[j] = False
        
        def is_prime(self, num):
            '''
            O(1) で素数判定を行う
            >>> e = Eratos(100)
            >>> [i for i in range(1, 101) if e.is_prime(i)]
            [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
            '''
            assert(num >= 1)
            if num > self.table_max:
                raise ValueError('Eratos.is_prime(): exceed table_max({}). got {}'.format(self.table_max, num))
            return self.table[num]
        
        def prime_factorize(self, num):
            '''
            O(√n) で素因数分解を行う
            >>> e = Eratos(10000)
            >>> e.prime_factorize(6552)
            {2: 3, 3: 2, 7: 1, 13: 1}
            '''
            assert(num >= 1)
            if int(math.sqrt(num)) > self.table_max:
                raise ValueError('Eratos.prime_factorize(): exceed prime table size. got {}'.format(num))
            
            factorized_dict = dict()
            candidate_prime_numbers = [i for i in range(2, int(math.sqrt(num)) + 1) if self.is_prime(i)]
            
            
            for p in candidate_prime_numbers:
                if num == 1:    
                    break
                if num % p == 0:
                    cnt = 0
                    while num % p == 0:
                        num //= p
                        cnt += 1
                    factorized_dict[p] = cnt
            if num != 1:
                factorized_dict[num] = 1
            return factorized_dict
        
    
    n, p = mi()
    e = Eratos(10 ** 6 + 1)

    if p == 1:
        print(1)
    else:
        d = e.prime_factorize(p)
        
        gcd = 1
        for k, v in d.items():
            if v >= n:
                gcd *= k ** (v // n)
        print(gcd)



if __name__ == "__main__":
    main()