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):
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') 
def gcd(a,b):return fractions.gcd(a,b) 
def lcm(a,b):return (a*b) // fractions.gcd(a,b) 
def iin(): return int(sys.stdin.readline()) 
def ifn(): return float(sys.stdin.readline()) 
def isn(): return sys.stdin.readline().split() 
def imn(): return map(int, sys.stdin.readline().split()) 
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) 
def fmn(): return map(float, sys.stdin.readline().split()) 
def iln(): return list(map(int, sys.stdin.readline().split())) 
def iln_s(): return sorted(iln()) 
def iln_r(): return sorted(iln(), reverse=True) 
def fln(): return list(map(float, sys.stdin.readline().split())) 
def join(l, s=''): return s.join(l) 
def perm(l, n): return itertools.permutations(l, n) 
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) 
def comb(l, n): return itertools.combinations(l, n) 
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) 
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 
def m_add(a,b): return (a+b) % MOD
def print_list(l): print(*l, sep='\n')
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def No(): print('No')

def sieves_of_e(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 is_prime


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 //= i
        res.append((i, ex))
    if n != 1: res.append((n, 1))
    return res

N,P = imn()

pf = prime_factorize(P)

ans = 1
for p in pf:
    for i in range(p[1]//N):
        ans *= p[0]
print(ans)

Solution (Python):

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




def prime_factorize(n):
    primelist=[]
    a=2
    n_origin=n
    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 i in range(len(pfs)):
    prime=pfs[i][0]
    ex=pfs[i][1]
    val=ex//n
    ans=ans*(prime**val)
print(ans)

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

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

res = 1
for i in prime_division(p):
    a = i[1] // n
    res *= i[0] ** a
print(res)

Solution (Python):
from collections import Counter


def calc_prime_factors(n, count=False):
    """Trial division"""
    factors = []
    
    while n % 2 == 0:
        factors.append(2)
        n //= 2
    
    f = 3
    while f ** 2 <= n:
        if n % f == 0:
            factors.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        factors.append(n)
    if count:
        factors = Counter(factors).items()
    return factors


N, P = map(int, input().split())
factors = calc_prime_factors(P, count=True)
ans = 1
for factor in factors:
    p, cnt = factor
    q, _ = divmod(cnt, N)
    ans *= p**q
print(ans)

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10


def solve():
    n, p = LI()
    def fact(x):
        res = 1
        for i in range(2, int(sqrt(x)) + 3):
            t = 0
            while x % i == 0:
                t += 1
                x //= i
            while t >= n:
                res *= i
                t -= n
        return res
    if n == 1:
        print(p)
        return
    print(fact(p))

    return



if __name__ == '__main__':
    solve()

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10


def solve():
    n, p = LI()
    def fact(x):
        res = 1
        for i in range(2, int(sqrt(x)) + 3):
            t = 0
            while x % i == 0:
                t += 1
                x //= i
            while t >= n:
                res *= i
                t -= n
        return res
    if n == 1:
        print(p)
        return
    print(fact(p))

    return



if __name__ == '__main__':
    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
p=factorization(P)

k=[]
ans=1
for i in range(len(p)):
    d=p[i][1]//N
    k.append(d)
for i in range(len(p)):
    ans*=pow(p[i][0],k[i])
print(ans)

Solution (Python):
x, y = map(int, input().split())


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

B = prime_factorize(y)

import collections
C = collections.Counter(B)

ans = 1

for i in C:
    if C[i] >= x:
        ans *= i ** (C[i]//x)
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
from collections import defaultdict, Counter

N, P = map(int, input().split())
cnt = defaultdict(int)
for i in range(2, int(P**0.5)+1):
    while P % i == 0:
        cnt[i] += 1
        P //= i
if P > 1:
    cnt[P] += 1
ans = 1
for k in cnt.keys():
    if cnt[k] >= N:
        ans *= k**(cnt[k]//N)
print(ans)

Solution (Python):
import sys
from collections import Counter
import math
input = sys.stdin.readline


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, input().split())
prime_list = list(Counter(prime_decomposition(p)).items())
ans = 1
for i in range(len(prime_list)):
    cnt = math.floor(prime_list[i][1] / n)
    if cnt >= 1:
        ans *= prime_list[i][0] ** cnt
print(ans)

Solution (Python):
def Sieve_of_Eratosthenes(N):
    if N<2:
        prime = [False for i in range(N+1)]
        return prime
 
    prime = [True for i in range(N+1)]
    prime[0] = False
    prime[1] = False
 
    for i in range(2, int(N**0.5)+1):
        if prime[i]:
            for j in range(i*2, N+1, i):
                prime[j] = False
 
    return prime

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


if n>50: print(1)
elif n==1: print(p)
else:
    prime=Sieve_of_Eratosthenes(int(p**(1/n)))
    ans=1
    for i in range(2,len(prime)):
        if prime[i]==False: continue
        tmp=0
        while p%i==0:
            p//=i
            tmp+=1
        for _ in range(tmp//n):
                ans*=i
    print(ans)

Solution (Python):
def Sieve_of_Eratosthenes(N):
    if N<2:
        prime = [False for i in range(N+1)]
        return prime
 
    prime = [True for i in range(N+1)]
    prime[0] = False
    prime[1] = False
 
    for i in range(2, int(N**0.5)+1):
        if prime[i]:
            for j in range(i*2, N+1, i):
                prime[j] = False
 
    return prime

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


if n>50: print(1)
elif n==1: print(p)
else:
    prime=Sieve_of_Eratosthenes(int(p**(1/n)))
    ans=1
    for i in range(2,len(prime)):
        tmp=0
        while p%i==0:
            p//=i
            tmp+=1
        if tmp>=n:
            for _ in range(tmp//n):
                ans*=i
    print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter,mul
from fractions import gcd
from functools import reduce
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 

def ii(): return int(sys.stdin.readline().rstrip()) 
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) 
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]

def ss(): return sys.stdin.readline().rstrip() 
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) 
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]







n,p=mii()



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)

m=Counter(res)

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

print(ans)

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

def main():
    N,P = map(int,input().split())
    
    is_prime = [True for i in range(int(P**(1/2))+1)]
    is_prime[0] = is_prime[1] = False
    
    for i in range(2,int(P**(1/2)+1)):
        if not is_prime[i]:
            continue
        j = 2*i
        while j<=int(P**(1/2)):
            is_prime[j] = False
            j += i

    ans = 1
    for i in range(1,int(P**(1/2)+1)):
        count = 0
        if is_prime[i]:
            while P%i == 0:
                count += 1
                P//=i
            z = pow(i,count//N)
            ans *= z
    
    z = pow(P,1//N)
    print(ans*z)
    
if __name__ == "__main__":
    main()

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

Solution (Python):
n, p = map(int, input().split())
f = []
for i in range(1, int(p**0.5)+1):
        if p%i==0:
                f.append(i)
                f.append(p//i)
ans = 1
for i in f:
        if p%pow(i,n, 92709568269121)==0: ans = max(ans, i)
print(ans)

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


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

primes = prime_factorize(P)
ret = 1
for i, e in primes:
    ret *= i ** (e//N)

print(ret)

Solution (Python):

def inputlist(): return [int(j) for j in 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
N,P = inputlist()
li = factorization(P)
ans = 1
n = len(li)
for i in range(n):
    k = li[i][1]
    ans *= max(1,li[i][0]**(k//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
X = factorization(P)
ans = 1
for i in X:
    ans *= max(1,i[0]**(i[1]//N))
print(ans)

Solution (Python):
def prime_pair(n):
    pairs = {}
    tmp = n
    for i in range(2, n):
        if i * i > n:
            break
        if tmp % i != 0:
            continue
        ex = 0
        while tmp % i == 0:
            ex += 1
            tmp /= i
        pairs[i] = ex
    if tmp != 1:
        pairs[int(tmp)] = 1
    return pairs

N, P = list(map(int, input().split()))
ppp = prime_pair(P)

res = 1
for k in ppp.keys():
    cnt = ppp[k]//N 
    
    if cnt>= 1:
        res *= k**cnt
print(res)

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

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

ans = 1
for p in res:
    k = p[1]
    while k:
        if k < n:
            k = 0
        else:
            ans *= p[0]
            k -= n
print(ans)

Solution (Python):
from collections import Counter


def main():
    number, product = map(int, input().split())
    prime_factors = []
    while product % 2 == 0:
        prime_factors.append(2)
        product //= 2
    i = 3
    while i * i <= product:
        if product % i == 0:
            product //= i
            prime_factors.append(i)
        else:
            i += 2
    if product != 1:
        prime_factors.append(product)
    prime_factors = Counter(prime_factors)
    answer = 1
    for p, n in prime_factors.items():
        if number <= n:
            answer *= pow(p, n // number)
    print(answer)


if __name__ == '__main__':
    main()

Solution (Python):
def main():
  n, m = input_list()
  p = prime_factorize(m)
  pc = collections.Counter(p)
  ans = 1
  for k, v in pc.items():
    if v >= n:
      ans *= k ** (v//n)
  print(ans)
  
def input_list():
  return list(map(int, input().split()))

def input_list_str():
  return map(str, input().split())

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)


def divide_two(arg):
  c = 0
  while True:
    if c >= 2:
      break
    if arg % 2 != 0:
      break
    arg //= 2
    c += 1
  return c


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

import math
import fractions
import collections
from functools import reduce
main()

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

N,P=map(int,input().split())
li=factorization(P)
res=1
for i in range(len(li)):
        res*=li[i][0]**(li[i][1]//N)
print(res)

Solution (Python):
def f(k,n):

    r=1
    t = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if t%i==0:
            c=0
            while t%i==0:
                c+=1
                t //= i
            if c>=k:
                r*=i**(c//k)
    if k==1 and t!=1:r*=t
    if r==k==1:r*=n
    print(r)

f(*map(int,input().split()))

Solution (Python):
def f(k,n):

    r=1
    t = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if t%i==0:
            c=0
            while t%i==0:
                c+=1
                t //= i
            if c>=k:
                r*=i**(c//k)
    if k==1 and t!=1:r*=t
    if r==k==1:r*=n
    print(r)

f(*map(int,input().split()))

Solution (Python):

import math
n,p = map(int,input().split())
ans = 1
if n == 1:
    print(p)
    exit()
for i in range(2,1+math.ceil(p**(1/2))):
    cnt = 0
    while p % i == 0:
        p = p//i
        cnt += 1
    beki = cnt // n
    ans *= pow(i,beki)
    
print(ans)

Solution (Python):

import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


class PriorityQueue:
    def __init__(self, l=[]):
        self.q = l
        heapq.heapify(self.q)
        return

    def push(self, n):
        heapq.heappush(self.q, n)
        return

    def pop(self):
        return heapq.heappop(self.q)


MOD = int(1e09) + 7
INF = int(1e15)


def factorization(n):
    S = {}
    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
            S[i] = cnt

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

    if S == []:
        S[n] = 1

    return S


def main():
    
    N, P = Scanner.map_int()
    S = factorization(P)
    ans = 1
    for k, v in S.items():
        if v >= N:
            ans *= k ** (v // N)
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import sys
from math import log
def main():
    n, p = map(int, input().split())
    if n == 1:
        print(p)
    else:
        ans = 1
        if n > int(log(p, 2))+2:
            print("1")
            sys.exit()
        if p % (2**n) == 0:
            while p % (2**n) == 0:
                ans *= 2
                p //= (2**n)
        for i in range(3, 10**6+1, 2):
            while p % (i**n) == 0:
                ans *= i
                p //= (i**n)
        print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
n,p=map(int,input().split())
def fact(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=fact(p)
t=1
for i in l:
  t=t*(i[0]**(i[1]//n))
print(t)

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

    def trial_division(n):
        divs = []
        for i in range(1, int(n**0.5)+1):
            if n % i == 0:
                divs.append(i)
                if i != n//i:
                    divs.append(n//i)
        return divs
    divs = trial_division(P)
    divs.sort()
    ans = 1
    for d in divs[1:]:
        
        
        cur = 1
        for i in range(N):
            cur *= d
            if P < cur:
                break
        if P < cur:
            break
        if P % (d**N) == 0:
            ans = d
    print(ans)


if __name__ == '__main__':
    main()

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

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

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

    return retlist

def gcd(x, y):
    while y != 0:
        x, y = y, x % y
    return x

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

Solution (Python):
import math
def solve():
    N, P = map(int, input().split())
    fac = list(prime_factorize(P).items())
    res = 1
    for p in fac:
        for i in range(p[1] // N):
            res *= p[0]
    
    print(int(res))

def prime_factorize(n):
    prime_numbers = {}
    for p in range(2, int(math.sqrt(n)+1)):
        if n % p != 0:
            continue
        num = 0
        while n % p == 0:
            n /= p
            num += 1
        prime_numbers[p] = num

    if n != 1:
        prime_numbers[n] = 1
    return prime_numbers

if __name__ == '__main__':
    solve()

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

n,p = map(int,input().split())
ans = 1
for prime,power in factorize(p):
    ans *= pow(prime,(power//n))
print(ans)

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

n,p = map(int,input().split())
ans = 1
for prime,power in factorize(p):
    ans *= pow(prime,(power//n))
print(ans)

Solution (Python):
N, P=map(int,input().split())
def factorization(n):
  primen = []
  degree = []
  primend = []
  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
      primen.append(i)
      degree.append(cnt)
      primend.append([i,cnt])
  if temp!=1:
    primen.append(temp)
    degree.append(1)
    primend.append([temp,1])
  if primen==[]:
    primen.append(n)
    degree.append(1)
    primend.append([n,1])
  return primend

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

Solution (Python):
from collections import defaultdict

def prime(k):
    res=[]
    while k>1:
        count=2
        flag=False
        while count*count <= k:
            if k%count==0:
                res.append(count)
                k//=count
                flag=True
                break
            count+=1
        if not(flag):
            res.append(k)
            k=1
    return res

n,p=map(int,input().split())
d=defaultdict(int)
for z in prime(p):
    d[z]+=1

ans=1

for c,x in d.items():
    ans*=c**(x//n)
if n==1:
    print(p)
else:
    print(ans)

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

def factorize(n):
    from collections import defaultdict
    d = defaultdict(int)
    for i in range(2, int(n**0.5)+1):
        while n%i==0:
            d[i] += 1
            n //= i
        if not n:
            break
    if n>1:
        d[n] += 1
    return d

d = factorize(P)
ans = 1
for i, j in d.items():
    ans *= (i ** (j//N))
print(ans)

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

def factorize(n):
    from collections import defaultdict
    d = defaultdict(int)
    for i in range(2, int(n**0.5)+1):
        while n%i==0:
            d[i] += 1
            n //= i
        if not n:
            break
    return d

d = factorize(P)
ans = 1
for i, j in d.items():
    ans *= (i ** (j//N))
print(ans if N!=1 else P)

Solution (Python):
def prime_factors(N):
    from collections import defaultdict
    factors = defaultdict(int)
    for i in range(2,int(N**.5)+1):
        while N % i == 0:
            N //= i
            factors[i] += 1
    if N > 1:
        factors[N] += 1
    return dict(factors)

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

Solution (Python):
from math import sqrt, ceil, log2
n, p = map(int, input().split())
if n == 1:
    print(p)
elif n >= 40:
    print(1)
else:
    ret = 1
    for i in range(2, ceil(sqrt(p)) + 1):
        if p % (i ** n) == 0:
            ret = i
    print(ret)

Solution (Python):

import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(N: int, P: int):
    def primeFactorize(n: int):
        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
    c = Counter(primeFactorize(P))

    ans = 1
    for k, v in c.most_common():
        if v >= N:
            ans *= k**(v//N)


    print(ans)

    return



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

if __name__ == '__main__':
    main()

Solution (Python):
def factorization(n):
    p=2
    fcr=[]
    while p*p<=n:
        while n%p==0:
            fcr.append(p)
            n//=p
        p+=1
    if n>1:
        fcr.append(n)
    return fcr

n,p=map(int,input().split())
fcr=factorization(p)
ans=1
for i in set(fcr):
  if fcr.count(i)//n>=1:
    ans*=i**(fcr.count(i)//n)
print(ans)

Solution (Python):
from collections import Counter

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

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

lst = prime_decomposition(p)
c = dict(Counter(lst))

ans = 1
for k,v in c.items():
    if v >= n:
        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())
p_fact = factorization(P)
p_list = []
ans = 1
for p in p_fact:
    p[1] = p[1] // N
    p_list.append(p)

for p in p_list:
    ans = ans * pow(p[0], p[1])

print(ans)

Solution (Python):
n,p = map(int, input().split( ))
f = {}
for i in range(2,int(p**(1/2))+7):
    cnt = 0
    while (not p%i) and p>=i:
        cnt += 1
        p//=i
    if cnt:
        f[i]= cnt
if p>1:
    f[p] = 1
ans = 1
for i in f:
    ans *= pow(i,f[i]//n)
print(ans)

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

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

from collections import Counter

ctr = Counter(prime_factorize(p))

for k, v in ctr.items():
    ctr[k] = v // n

ans = 1
for k, v in ctr.items():
    ans *= k ** v
print(ans)

Solution (Python):
import math
N, P = map(int, input().split())
D = {}
sqrt_p = int(math.sqrt(P))
for i in range(2, sqrt_p + 2):
    while P % i == 0:
        if i not in D:
            D[i] = 1
        else:
            D[i] += 1
        P //= i
if P != 1:
    if P not in D:
        D[P] = 1
    else:
        D[P] += 1


ans = 1
for d in D:
    if D[d] >= N:
        ans *= (d ** (D[d] // N))
print(ans)