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

def prime_factor(n):
	d = {}
	for i in range(2, int(n ** 0.5) + 1):
		while (n % i == 0):
			d[i] = d.get(i, 0) + 1
			n //= i
	if n != 1:
		d[n] = d.get(n, 0) + 1
	return d

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

res = 1
fac = prime_factor(p)
for p, c in fac.items():
	res *= p ** (c // n)
print(res)

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    n, p = map(int, input().split())
    import math

    

    def make_prime_list_2(num):
        if num < 2:
            return []

        
        prime_list = [i for i in range(num + 1)]
        prime_list[1] = 0  
        num_sqrt = math.sqrt(num)

        for prime in prime_list:
            if prime == 0:
                continue
            if prime > num_sqrt:
                break

            for non_prime in range(2 * prime, num, prime):
                prime_list[non_prime] = 0

        return [prime for prime in prime_list if prime != 0]

    def prime_factorization_2(num):
        """numの素因数分解
        素因数をkeyに乗数をvalueに格納した辞書型dict_counterを返す"""

        if num <= 1:
            
            
            return False
        else:
            num_sqrt = math.floor(math.sqrt(num))
            prime_list = make_prime_list_2(num_sqrt)

            dict_counter = {}  
            

            for prime in prime_list:
                while num % prime == 0:
                    if prime in dict_counter:
                        dict_counter[prime] += 1
                    else:
                        dict_counter[prime] = 1
                    num //= prime
            if num != 1:
                if num in dict_counter:
                    dict_counter[num] += 1
                else:
                    dict_counter[num] = 1

            return dict_counter
    if p != 1:
        d = prime_factorization_2(p)
        ans = 1
        for k, v in d.items():
            if v >= n:
                ans *= k**(v//n)
        print(ans)
    else:
        print(1)


resolve()

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

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

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

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

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

div = 2
res = 1
R = P

while div * div <= R and div <= P:
    cnt = 0
    while P % div == 0:
        P /= div
        cnt += 1

        if cnt == N:
            res *= div
            cnt = 0
    div += 1

print(res)

Solution (Python):

import sys

def main():
    N, P = map(int, input().split())
    ans = 1
    if N == 1:
        print(P)
        exit()
    for i in range(2,int(P**(1/N)+1)):
        count = 0
        tmp = P
        while tmp % i == 0:
            count += 1
            tmp = tmp // i
        ans *= i**(count // N)
        P = P // i**count
    print(ans)

if __name__ == '__main__':
    main()

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

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

ans = 1
for b, e in factorize(P):
  ans *= pow(b, (e//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

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

factors = prime_factorize(p)

factor = {}

for i in factors:
    if i not in factor:
        factor[i]=1
    else:
        factor[i]+=1
ans = 1
for i in factor:
    if factor[i]>=n:
        ans *= i**(factor[i]//n)
print(ans)

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

    def bunkai_suru(n):
        ary = collections.defaultdict(int)
        p = 2
        while p * p <= n:
            while n%p == 0:
                n //= p
                ary[p] += 1
            p += 1
        if n != 1:
            ary[n] += 1
        return ary

    output = 1
    x = bunkai_suru(P)
    for p in x.keys():
        ex = x[p]//N
        output *= p ** ex
    print(output)
    return

if __name__ == '__main__':
    main()

Solution (Python):
import collections

n, p = map(int, input().split())
res = []
x = p
y = 2
while y*y <= x:
    while x % y == 0:
        res.append(y)
        x //= y
    y += 1
if x > 1:
    res.append(x)

res = collections.Counter(res)
ans = 1
for d in res.items():
    ans *= d[0]**(d[1]//n)
print(ans)

Solution (Python):
from collections import Counter


def main():
    n, p = map(int, input().split())
    f = []
    while p % 2 == 0:
        p //= 2
        f.append(2)
    tmp = 3
    while tmp * tmp <= p:
        if p % tmp == 0:
            p //= tmp
            f.append(tmp)
        else:
            tmp += 2
    if p != 1:
        f.append(p)
    f = Counter(f)
    f = sorted(f.items(), key=lambda x: x[1], reverse=True)
    answer = 1
    for ff, cnt in f:
        if cnt < n:
            break
        answer *= ff ** (cnt // n)
    print(answer)


if __name__ == '__main__':
    main()

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from collections import Counter


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


n, p = map(int, read().split())
ans = 1
for k, v in Counter(prime_decomposition(p)).items():
    v //= n
    ans *= k ** v
print(ans)

Solution (Python):
def prime(p):
    memo = []
    for i in range(2,(int(p**0.5)+1)):
        while p%i==0:
            p //= i
            memo.append(i)
    if p != 1:
        memo.append(p)
    return memo


import collections

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

memo = prime(p)

c = collections.Counter(memo)

score_sorted = sorted(c.items(), key=lambda x:-x[0])

if n == 1:
    ans = p
else:
    kake = []
    for i , j in score_sorted:
        if n <= j:
            kake.append(i**(j//n))
    ans = 1
    for i in kake:
        ans *= i

print(ans)

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

div = []
for i in range(2,int(p**0.5)+2):
  count = 0
  if p%i==0:
    while p%i==0:
      p//=i
      count += 1
    div.append((i, count))
if p != 1:
  div.append((p, 1))

ans = 1
for d,c in div:
  ans *= d**(c//n)
print(ans)

Solution (Python):


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
n, p = map(int, input().split())

pp = prime_factors(p)
from collections import defaultdict

c = defaultdict(int)
for p in pp:
    c[p] += 1

ans = 1
for k in c.keys():
    ans *= k ** (c[k] // n)

print(ans)

Solution (Python):
from collections import Counter


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

    return a


n,p=map(int,input().split())
D=Counter(prime_factorize(p))
ans=1
for i,j in D.items():
    ans *=pow(i,j//n)
print(ans)

Solution (Python):
from collections import Counter


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

    return a


n,p=map(int,input().split())
D=Counter(prime_factorize(p))
ans=1
for i,j in D.items():
    if j//n!=0:
        ans *=pow(i,j//n)
print(ans)

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

    divisors.sort()
    return divisors[::-1]

n,p=map(int,input().split())
divisors=make_divisors(p)
maxi=round(p**(1/n),10)

for i in divisors:
    if i<=maxi and p%i**n==0:
        print(i)
        exit()

Solution (Python):
import collections
n,p=map(int,input().split())
factor=[]
if n==1:
    print(p)
    exit()
for i in range(2,int(p**0.5)+1):
    while p%i==0:
        p=p//i
        factor.append(i)

if not factor:
    print(1)
    exit()
ans=1
a=collections.Counter(factor)

for s,v in a.items():
    ans*=s**(v//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

ans = 1

for k,v in pf.items():
    ans *= k**(v//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())
lis=factorization(P)

maxi=1

for i,kumi in enumerate(lis):
  p= kumi[1]//N
  maxi *= (kumi[0]**p)
    
print(maxi)

Solution (Python):
from collections import Counter

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


def prime_set(n):
    primes = set(range(2, n+1))
    for i in range(2, int(n**0.5) + 1):
        primes.difference_update(range(i*2, n+1, i))
    return primes


def prime_factors(n):
    f = []
    for i in prime_set(int(n**0.5) + 1):
        while n % i == 0:
            f.append(i)
            n //= i
    if n > 1:
        f.append(n)
    return f

c = Counter(prime_factors(P))
ans = 1

for x in c.keys():
    ans *= pow(x, int(c[x]//N))

print(ans)

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
def prime_fact(m):
    pf={}
    for i in range(2,int(m**0.5)+1):
        while m%i==0:
            pf[i]=pf.get(i,0)+1
            m//=i
    if m>1:pf[m]=1
    return pf
def main():
    n,p=map(int,input().split())
    p_dict=prime_fact(p)
    ans=1
    for pp in p_dict.items():
        ans*=pp[0]**(pp[1]//n)
    print(ans)


if __name__=='__main__':
    main()

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
import numpy as np
def prime_fact(m):
    pf={}
    for i in range(2,int(m**0.5)+1):
        while m%i==0:
            pf[i]=pf.get(i,0)+1
            m//=i
    if m>1:pf[m]=1
    return pf
def main():
    n,p=map(int,input().split())
    p_dict=prime_fact(p)
    ans=1
    for pp in p_dict.items():
        ans*=pp[0]**(pp[1]//n)
    print(ans)


if __name__=='__main__':
    main()

Solution (Python):
import math

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

def 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


def isPrime(n):
    if n == 1:
        return False
    else:
        for i in range(2, int(math.sqrt(n)) + 1):
           if n%i == 0:
               return False
        return True


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

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



















f = f(p)
ans = 1

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

print(ans)

Solution (Python):
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce


def input(): return sys.stdin.readline().strip()


def INT(): return int(input())


def MAP(): return map(int, input().split())


def LIST(): return list(map(int, input().split()))


def ZIP(n): return zip(*(MAP() for _ in range(n)))


sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


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


def main():
    N, P = MAP()

    li = factorization(P)

    ans = 1
    for p, e in li:
        ans *= pow(p, e//N)

    print(ans)


if __name__ == '__main__':
    main()

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

N, P = MAP()

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

ans = 1
for p in factorization(P):
	ans *= p[0]**(p[1]//N)
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
def prime_factorize(n):
    res = []
    for i in range(2, int(n**0.5)+1):
        if n % i != 0:continue
        ex = 0
        while n % i == 0:
            ex += 1
            n = n//i
        res.append((i, ex))
    if n != 1:res.append((n, 1))
    return res
def main():
    N, P = map(int, input().split())
    res = prime_factorize(P)
    ans = 1
    for x, ex in res:
        ans *= max(1, x ** (ex // 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

li = factorization(p) 


tmp_score = 1
for l in li:
    if l[1]>= n:
        kaisu = l[1]//n
        tmp_score *= l[0]**kaisu
print(tmp_score)

Solution (Python):
import collections
import math
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))
w=1
for i in c.keys():
  if c[i]>=N:
    k=math.floor(c[i]/N)
    w=w*(i**k)
  else:
    w=w
print(w)

Solution (Python):

def resolve():
    def dic_prime_fact(n):
        dic = {}
        i = 2
        while i*i <= n:
            while n%i == 0:
                n //= i
                if i in dic:
                    dic[i] += 1
                else:
                    dic[i] = 1
            i += 1
        if n != 1:
            dic[n] = 1
        return dic

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

    ans = 1
    for k, v in dic_prime.items():
        for i in range(0, v//N):
            ans *= k
    print(ans)
    
if __name__ == "__main__":
    resolve()

Solution (Python):
from collections import defaultdict

def factor(x):
    res = defaultdict(int)
    for i in range(2, int(x ** 0.5) + 1):
        while x % i == 0:
            res[i] += 1
            x //= i
    if x > 1:
        res[x] += 1
    return res


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

Solution (Python):
from collections import defaultdict


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

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

d = defaultdict(int)


num = 2

while num * num <= P:
    while P % num == 0:
        d[num] += 1
        P //= num
    num += 1

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

print(ans)

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

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)
    fct_c = Counter(fct)
    return fct_c

def solve():
    ans = 1
    c = factorize(P)
    for k, v in c.items():
        ans *= k**(v//N)
    return ans
print(solve())

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 li in l:
    a=li[1]//n
    ans*=li[0]**a
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


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

cnt = {}
for r in res:
    if r not in cnt:
        cnt[r] = 1
    else:
        cnt[r] += 1

ans = 1
for k, v in cnt.items():
    ans *= k ** (v // 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())
f = factorization(p)
ans = 1
for i in range(len(f)):
    if f[i][1]>=n:
        ans*=f[i][0]**(f[i][1]//n)
print(ans)

Solution (Python):

from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def f(n):
        res = defaultdict(lambda : 0)
        i = 2
        m = n
        while i*i <= n:
            while m%i == 0:
                res[i] += 1
                m //= i
            i += 1
        res[m] += 1
        return res

    n,p = LI()
    f = f(p)
    ans = 1
    for i,j in f.items():
        ans *= pow(i,j//n)
    print(ans)
    return


if __name__ == "__main__":
    solve()

Solution (Python):

from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def f(n):
        res = defaultdict(lambda : 0)
        if n < 4:
            res[n] = 1
        i = 2
        m = n
        while i*i <= n:
            while m%i == 0:
                res[i] += 1
                m //= i
            i += 1
        res[m] += 1
        return res

    n,p = LI()
    f = f(p)
    ans = 1
    for i,j in f.items():
        ans *= pow(i,j//n)
    print(ans)
    return


if __name__ == "__main__":
    solve()

Solution (Python):
from math import sqrt

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

F = {}
for i in range(2, int(sqrt(P)) + 1):
    if P % i != 0:
        continue
    F[i] = 0
    while P % i == 0:
        P //= i
        F[i] += 1
if P > 1:
    F[P] = 1

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

Solution (Python):
import math
n,p=map(int,input().split(' '))
k=0
dio=math.sqrt(p)
jo=2
maxn=1
if n==1:
    print(p)
else:
    while jo<dio:
        if p%jo==0:
            p/=jo
            k+=1
            if k>=n:
                maxn*=jo
                k=0
        else:
            jo+=1
            k=0
    print(maxn)

Solution (Python):
from sys import stdin, stdout
from collections import defaultdict
import math

def chai(a):
    ans = defaultdict(int)
    i = 2
    while i <= int(math.sqrt(a)):
        while a % i == 0:
            ans[i] += 1
            a //= i
        i += 1
    if a != 1:
        ans[a] += 1
    return ans
    
n, p = map(int, stdin.readline().strip().split())

tmp = chai(p)
ans = 1
for key, value in tmp.items():
    while value >= n:
        ans *= key
        value -= n
stdout.writelines(str(ans) + '\n')

Solution (Python):
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(10 ** 9)


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

    N, P = map(int, input().split())
    arr = factorization(P)
    answer = 1
    for a in arr:
        if a[1] >= N:
            ans = a[0] ** (a[1] // N)
            answer *= ans
    print(answer)


if __name__ == "__main__":
    main()

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

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

from collections import Counter
primes_counter = Counter(prime_factorize(p))

ans = 1
for kv in primes_counter.items():
  if kv[1] >= n: ans *= kv[0] ** (kv[1] // n)

print(ans)

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

    divisors.sort()
    return divisors

N, P = map(int, input().split())
def prime_factorization(n):
    res = []
    for d in make_divisors(n):
        if d == 1:
            continue
        while n%d==0:
            res.append(d)
            n//=d
    return res

from collections import Counter
pc = Counter(prime_factorization(P))
ans = 1
for k, v in pc.items():
    loop = v//N
    if loop:
        ans *= k ** loop
print(ans)

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


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


c = Counter(prime_factorize(p))
ans = 1
for num, cnt in c.items():
    if cnt >= n:
        ans *= num ** (cnt // n)
print(ans)

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


def factorization(n):
    tmp = n
    d = {}
    for i in range(2, int(n ** 0.5) + 1):
        while tmp % i == 0:
            tmp //= i
            if i in d:
                d[i] += 1
            else:
                d[i] = 1

    if tmp != 1:
        d[tmp] = 1

    return d


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

print(ans)

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


def factorization_in_prime_number(x):
    prime_factor = []
    degree = 0
    while x % 2 == 0:
        x //= 2
        degree += 1
    if degree:
        prime_factor.append((2, degree))
    m = int(x**.5) + 1
    for i in range(3, m, 2):
        degree = 0
        while x % i == 0:
            x //= i
            degree += 1
        if degree:
            prime_factor.append((i, degree))
    if x != 1:
        prime_factor.append((x, 1))
    return prime_factor


ans = 1
factor = factorization_in_prime_number(p)
for f, d in factor[::-1]:
    ans *= f ** (d//n)
print(ans)

Solution (Python):
n, p = map(int, input().split())
x = p
so = []
for i in range(2, int(p**(1/2))+1):
    c = 0
    while x%i==0:
        c += 1
        x //= i
    if c:
        so.append([c, i])
    if x==1:
        break
if x:
    so.append([1, x])
result = 1
for s, t in so:
    result *= t**(s//n)
print(result)

Solution (Python):
n, p = map(int, input().split())
x = p
so = []
for i in range(2, int(p**(1/2))+1):
    c = 0
    while x%i==0:
        c += 1
        x //= i
    if c:
        so.append([c, i])
if x:
    so.append([1, x])
result = 1
for s, t in so:
    result *= t**(s//n)
print(result)

Solution (Python):
n, p = map(int, input().split())
x = p
so = []
for i in range(2, int(p**(1/2))+1):
    c = 0
    while x%i==0:
        c += 1
        x //= i
    if c:
        so.append([c, i])
if x:
    so.append([1, x])
result = 1
for s, t in so:
    result *= t**(s//n)
print(result)

Solution (Python):
import sys
from heapq import heappush, heappop, heappushpop, heapify, heapreplace
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt
INF = 1 << 60
sys.setrecursionlimit(10 ** 6)

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


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

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

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

    return arr


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

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

Solution (Python):
from collections import Counter

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

def factorization(n):
    factor = []
    tmp = int(n ** 0.5) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            factor.append(num)
    factor.append(n)
    factor.sort()
    return factor

lP = factorization(P)
clP = Counter(lP)

ans = 1
for key in clP:
    if clP[key] >= N:
        ans *= key ** (clP[key] // N)
    


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

for pf in pfs:
    p=pf[0];ex=pf[1]
    ans=ans*(p**(ex//n))
print(ans)