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 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] = [int(i) for i in input().split()]
ls = factorization(p)
ans = 1
for kumi in ls:
    if kumi[1] >= n:
        ans *= (kumi[0] ** (kumi[1] // n))
print(ans)

Solution (Python):
from math import gcd
def prime_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())
l = prime_factorization(p)
ans = []
for i in l:
    if i[1] >= n:
        for j in range(i[1]//n):
            ans.append(i[0])
product = 1
for i in ans:
    product *= i
print(product)

Solution (Python):
def prime_factorize(n):
    """
    trial_division
    試し割り法で因数分解
    2 と奇数で試し割りする
    [[素因数, 指数]...]

    ref. https://en.wikipedia.org/wiki/Trial_division
    """
    a = []
    f = 2
    while f * f <= n:
        count = 0
        while n % f == 0:
            count += 1
            n //= f
        if count:
            a.append([f, count])
        
        f += 2 if f != 2 else 1
    if n != 1:
        a.append([n, 1])
    return a

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


res = 1
for p in prime_factorize(P):
    for _ in range(p[1] // N):
        res *= p[0]
print(res)

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
for a, b in factorization(p):
    ans *= pow(a, b // 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


ans = 1
for a, b in factorization(p):
    ans *= pow(a, b // n)
print(ans)

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, P = mapint()
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
c = Counter(prime_factorize(P))

ans = 1
for num, cnt in c.most_common():
    if cnt<N:
        break
    ans *= num**(cnt//N)
print(ans)

Solution (Python):
import sys

N, P = map(int, sys.stdin.readline().split())

primes = {}
for i in range(2, int(P**0.5) + 1):
    count = 0
    while P % i == 0:
        P //= i
        count += 1
    if 0 < count:
        primes[i] = count

if P != 1:
    primes[P] = 1

if not primes:
    primes[P] = 1


ans = 1
for value, count in primes.items():
    p = count // N
    if 0 < p:
        ans *= value ** p

print(ans)

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


def make_prime(n):
    array = {}
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt = cnt + 1
                temp = temp // i
            array[i] = cnt

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

    if array == {}:
        array[n] = 1

    return array


primes = make_prime(P)

result = 1
for key, value in primes.items():
    if value >= N:
        result *= key ** (value // N)

print(result)

Solution (Python):
N,P = map(int,input().split())
if N==1 or P==1:
    print(P)
else:
    k = 0
    x = P
    while x>1:
        x = x//2
        k += 1
    if N>k:
        print(1)
    else:
        cmax = 1
        for i in range(1,int(P**0.5)+1):
            if P%(i**N)==0:
                cmax = i
        print(cmax)

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

fac = dict()
if (P & -P) != 1:
    t = (P & -P).bit_length()
    fac[2] = t-1
    P //= (P & -P)
for f in range(3, 1001003):
    if P % f == 0:
        fac[f] = 0
        while P % f == 0:
            fac[f] += 1
            P //= f
    if P == 1:
        break
else:
    fac[P] = 1

ans = 1
for f, c in fac.items():
    ans *= pow(f, c//N)

print(ans)

Solution (Python):
n,p = map(int, input().split())
if n==1:
    print(p)
    exit()
elif p==1 or n >=60:
    print(1)
    exit()

for i in range(int(p**(1/n))+2)[::-1]:
    if p%(i**n)==0:
        print(i)
        exit()

Solution (Python):
import math
N, P = map(int, input().split())
a = math.floor(math.pow(P, 1/N))
if a == 1:
    ans = 1
else:
    a += 1
    for i in range(a, 0, -1):
        if P % pow(i, N) == 0:
            ans = i
            break
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)

ans = 1

for key,value in c.items():
    if N <= value:
        ans *= key**(value//N)
print(ans)

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

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

res = prime_factorize(P)
l = Counter(res).items()
ans = 1
for l in Counter(res).items():
    ans *= l[0]**(l[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 in A:
  p,q = X
  ans *= p**(q//N)
print(ans)

Solution (Python):
import sys
from collections import Counter
input = sys.stdin.readline
N, P = map(int, input().split())
c = Counter()
x = 2
while x * x <= P:
  while P % x == 0:
    P //= x
    c[x] += 1
  x += 1
if P > 1: c[P] += 1

res = 1
for k in c.keys():
  v = c[k]
  res *= pow(k, v // N)
print(res)

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

if N == 1:
    print(P)
else:
    l = 1/N
    check = round(P**l)
    while check > 1:
        if P % (check**N) == 0:
            break
        else:
            check -= 1
    print(check)

Solution (Python):
def solve(N, P):
    prime_list = []
    for i in range(2, int(P ** (1 / 2)) + 1):
        cnt = 0
        while P % i == 0:
            cnt += 1
            P //= i
        if cnt:
            prime_list.append([i, cnt])
    if P != 1:
        prime_list.append([P, 1])

    ans = 1
    for prime, cnt in prime_list:
        if cnt >= N:
            ans *= prime ** (cnt // N)
    return ans

if __name__ == '__main__':
    n, p = map(int, input().split())
    print(solve(n, p))

Solution (Python):
n, p = map(int, input().split())
if n==1:
  print(p)
  exit()
elif p==1 or n>=60:
  print(1)
  exit()
for i in range(int(p**(1/n))+2)[::-1]:
  if p%(i**n)==0:
    print(i)
    exit()

Solution (Python):
n, p = map(int, input().split())
if n==1:
  print(p)
  exit()
elif p==1 or n>=60:
  print(1)
  exit()
for i in range(int(p**(1/n))+1, 0, -1):
  if p%(i**n)==0:
    print(i)
    exit()

Solution (Python):
n,p = map(int, input().split())
if n==1:
    print(p)
    exit()
elif p==1:
    print(1)
    exit()
elif n>60:
    print(1)
    exit()
a = int(p**(1/n)+1)
for i in range(a,0,-1):
  if p%(i**n)==0:
    print(i)
    exit()

Solution (Python):
n,p = map(int, input().split())
a = round(p**(1/n))
for i in range(a,0,-1):
  if p%(i**n)==0:
    print(i)
    exit()

Solution (Python):
n,p = map(int, input().split())
a = round(p**(1/n))
for i in range(a,-1,-1):
  if p%(i**n)==0:
    print(i)
    exit()

Solution (Python):
import sys
import math
import itertools
import collections
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():
    N, P = NMI()
    
    if N == 1:
        print(P)
        sys.exit()
    else:
        ans = 1
        for n in range(2,int(P**0.5)+1):
            if P % n != 0:
                continue
            else:

                cnt = 0
            while P % n == 0:
                P = P //n
                cnt += 1
            if cnt//N >= 1:
                ans = ans * n **(cnt // 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

arr = factorization(p)
ans = 1
for f, v in arr:
    if v>=n:
        ans*=f**(v//n)
print(ans)

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

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
from pprint import pprint
from copy import deepcopy
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce
from pprint import pprint


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
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)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007

def prime_decomposition(n):
    D = defaultdict(int)
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            D[i] += 1
            n //= i
        if n == 1:
            break
    if n != 1:
        D[n] += 1
    return D

n, p = LI()
D = prime_decomposition(p)
ans = 1
for k, v in D.items():
    ans *= (k ** (v // n))

print(ans)

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

if n==1:
    print(p)
    sys.exit()
gcd=1
limit = math.ceil(math.sqrt(p))
if p%2==0:
    cnt=0
    while p%2==0:
        cnt += 1
        p//=2
    if cnt>=n:
        cnt//=n
        gcd *= 2**cnt

for i in range(3,limit+1,2):
    if i>p:
        break
    cnt=0
    while p%i==0:
        cnt+=1
        p//=i
    if cnt>=n:
        cnt//=n
        gcd *= i**cnt
print(gcd)

Solution (Python):
n, p = map(int, input().split())
num = int(p ** (1 / n))
for i in range(num + 1, 0, -1):
    p0 = p
    count = 0
    if i == 1:
        print(i)
        break
    for j in range(n):
        if p0 % i == 0:
            p0 //= i
            count += 1
        else:
            break
    else:
        print(i)
        break

Solution (Python):
n, p = map(int, input().split())
num = round(p ** (1 / n))
for i in range(num, 0, -1):
    if p % (i ** n) == 0:
        print(i)
        break

Solution (Python):
n,p = map(int,input().split())
dum = round(p**(1/n))
for i in range(dum,-1,-1):
    if p%(i**n) == 0:
        print(i)
        break

Solution (Python):
n,p = map(int,input().split())
dum = round(p**(1/n))
for i in range(dum,-1,-1):
    if p%(i**n) == 0:
        print(i)
        break

Solution (Python):
import math
N, P = map(int,input().split())
if N == 1:
    print(P)
else:
    l = 1/N
    check = round(P**l)
    while check >1:
        if P%(check**N) == 0:
            break
        check-=1
    print(check)

Solution (Python):
import math
N, P = map(int, input().split())
root_P = int(math.sqrt(P)) + 5
is_prime = [False] * 2 + [True] * root_P
primes = []
for i in range(2, root_P):
    if is_prime[i]:
        primes.append(i)
        for j in range(i * i, root_P, i):
            is_prime[j] = False
prime_factor = dict()
for p in primes:
    if P % p != 0:
        continue
    prime_factor[p] = 0
    while P % p == 0:
        prime_factor[p] += 1
        P //= p
if P > 1:
    prime_factor[P] = 1
ans = 1
for key in prime_factor:
    if prime_factor[key] >= N:
        ans *= key ** (prime_factor[key] // N)
print(ans)

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


def factors_counts(n):
    facs = dict()
    while n%2 == 0:
        facs.setdefault(2, 0)
        facs[2] += 1
        n //=2

    for f in range(3, int(n**0.5)+ 1, 2):
        while n%f == 0:
            facs.setdefault(f, 0)
            facs[f] += 1
            n //= f
    if n != 1:
        facs.setdefault(n, 0)
        facs[n] += 1
    return facs

facs = factors_counts(p)

ans = 1
for f, c in facs.items():
    nn = c//n
    if nn > 0:
        ans *= (f**nn)
print(ans)

Solution (Python):
import sys
import itertools

import time
import math
import heapq
from collections import defaultdict
from collections import Counter
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


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

i = 2
facts = defaultdict(int)
while i ** 2 <= P:
    while P % i == 0:
        facts[i] += 1
        P //= i
    i += 1
if P > 1:
    facts[P] += 1
ans = 1
for k, v in facts.items():
    ans *= k ** (v // N)
print(ans)

Solution (Python):



from collections import defaultdict



def solve(n,p):
  def primedict(num):
    res = defaultdict(int)
    if num == 1:
      return {1:1}
    f = 2
    while f * f <= num:
      if num % f == 0:
        res[f] += 1
        num //= f
      else:
        f += 1
    if num != 1:
      res[num] += 1
    return res


  ans = 1
  d = primedict(p)
  for k,v in d.items():
    ans *= k**(v//n)
  
  return ans



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

if __name__ == '__main__':
  main()

Solution (Python):



from collections import Counter



def solve(n,p):
  def primeList(num):
    res = []
    if num == 1:
      return [1]
    f = 2
    while f * f <= num:
      if num % f == 0:
        res.append(f)
        num //= f
      else:
        f += 1
    if num != 1:
      res.append(num)
    return res


  ans = 1
  Lst = primeList(p)
  d = Counter(Lst)
  for k,v in d.items():
    ans *= k**(v//n)
  
  return ans



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

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

lst = factorization(p)
lst = sorted(lst,reverse=True,key=lambda x:x[1])
ans = 1
for i in lst:
  tmp=i[1]
  while tmp>=n:
      if tmp>=n:
        ans *= i[0]
        tmp -= n
      
print(ans)

Solution (Python):
n,p=map(int,input().split())
l=[(1,n)]
for i in range(2,-int(-p**0.5)+1):
    count=0
    while p%i==0:
        p//=i
        count+=1
    if count>0:
        l.append((i,count))
if p>1:
    l.append((p,1))
ans=1
for i in l:
    if i[1]>=n:
        ans *= i[0]**(i[1]//n)
print(ans)

Solution (Python):
n,p=map(int,input().split())
if n==1:
    print(p)
    exit()
elif p==1:
    print(1)
    exit()
elif n>60:
    print(1)
    exit()
l=[]
for i in range(1,int(p**0.5)+1):
    if p%i==0:
        l.append(i)

s=[]
for i in range(len(l)):
    if l[i]**n<=p and p%(l[i]**n)==0:
        
        s.append(l[i])
    if l[i]**n>p:
        break
print(s[-1])

Solution (Python):
n, p = map(int, input().split())
m = int(p**(1/n) + 1e-3)

for i in range(m, 0, -1):
    if p%(i**n) == 0:
        print(i)
        exit()

Solution (Python):
n, p = map(int, input().split())
m = int(p**(1/n) + 1e-9)

for i in range(m, 0, -1):
    if p%(i**n) == 0:
        print(i)
        exit()

Solution (Python):
n, p = map(int, input().split())
m = int(p**(1/n) + 1.0e-7)

for i in range(m, 0, -1):
    if p%(i**n) == 0:
        print(i)
        exit()

Solution (Python):
import sys
N, P = list(map(int, input().split()))
M = int(P ** (1 / N) + 1.0E-7)
for i in range(M, 0, -1):
    if P % (i ** N) == 0:
        print(i)
        sys.exit()

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

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

if p != 1:
    l.append([p, 1])

for i, j in l:
    while j >= n:
        ans *= i
        j -= n

print(int(ans))

Solution (Python):
from collections import Counter
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

res = 1
for k, v in factorization(P):
    if v < N:
        continue
    res *= k**(v//N)

print(res)

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

def prime_factorize(n):
  cnt = {}
  f = 2
  while f * f <= n:
    if n%f != 0:
      f += 1
      continue
    cnt.setdefault(f, 0)
    cnt[f] += 1
    n //= f
  if n > 1:
    cnt.setdefault(n, 0)
    cnt[n] += 1
  return cnt

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

Solution (Python):


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

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

a = PrimeFactorization(p)

ret = 1
for i in range(len(a)):
    for j in range(a[i][1]//n):
        ret *= a[i][0]

print(ret)

Solution (Python):
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def primeFactorization(n):
    ans = []
    temp = n
    while temp%2 == 0:
        ans.append(2)
        temp //= 2
    for i in range(3, int(n**0.5)+1, 2):
        while temp%i == 0:
            ans.append(i)
            temp //= i
    if temp > 1:
        ans.append(temp)
    return collections.Counter(ans)

def resolve():
    N, P = LI()

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

    print(ans)

if __name__ == '__main__':
    resolve()

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

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


if n == 1:
    print(p)
elif p != 1:
    a = factorize(p)
    count, ans = 1, 1
    for i in range(len(a)-1):
        if a[i] == a[i+1]:
            count += 1
        else:
            ans *= a[i]**math.floor(count/n)
            count = 1
    if count != 1:
        ans *= a[-1]**math.floor(count/n)
    print(ans)
            
else:
    print(1)

Solution (Python):
import sys
INF = 1 << 60
MOD = 10**9 + 7 
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()

def prime_factorization(n):
    factor = []
    for d in range(2, int(n ** .5) + 1):
        while n % d == 0:
            n //= d
            factor.append(d)
    if n != 1: factor.append(n)
    return factor

from collections import Counter
def resolve():
    n, p = map(int, input().split())
    ans = 1
    for key, val in Counter(prime_factorization(p)).items():
        ans *= pow(key, val // n)
    print(ans)
resolve()

Solution (Python):

def Prime_Factorization(N):
    if N<0:
        R=[[-1,1]]
    else:
        R=[]
        
    N=abs(N)
    k=2
    while k*k<=N:
        if N%k==0:
            C=0
            while N%k==0:
                C+=1
                N//=k
            R.append([k,C])
        k+=1
    
    if N!=1:
        R.append([N,1])
    if not R:
        R.append([N,1])

    return R

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

X=1
for p,k in A:
    X*=p**(k//N)
print(X)

Solution (Python):
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

import collections
A = prime_factorize(P)
B = collections.Counter(A)

ans = 1
for i in set(A):
    ans *= i**(B[i]//N)
print(ans)

Solution (Python):
import math

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)
candi = 1
for fact,num in arr:
    candi *= fact**(math.floor(num/N))
print(candi)

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, P = mapint()
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
primes = prime_factorize(P)
c = Counter(primes)
ans = 1
for v, cnt in c.most_common():
    if cnt<N:
        break
    ans *= v**(cnt//N)
print(ans)

Solution (Python):

import math
def main():
	n , p = map(int , input().split())
	i = 2
	if n==1:
		print(p)
		exit()
	ans = 1


	while (i<=math.sqrt(p)):
		if p%i==0:
			cnt = 0
			while p%i==0:
				p = p//i
				cnt = cnt+1
			u = cnt//n
			for j in range(0 , u):
				ans = ans*i
		i = i+1
	print(ans)
if __name__=="__main__":
	main()

Solution (Python):
import math
def main():
	n , p = map(int , input().split())
	i = 2
	if n==1:
		print(p)
		exit()
	ans = 1
	while (i<=math.sqrt(p)):
		if p%i==0:
			cnt = 0
			while p%i==0:
				p = p//i
				cnt = cnt+1
			u = cnt//n
			for j in range(0 , u):
				ans = ans*i
		i = i+1
	print(ans)
if __name__=="__main__":
	main()

Solution (Python):
import sys, math
from functools import lru_cache
from collections import defaultdict
sys.setrecursionlimit(500000)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

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

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]


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


def main():
    N, P = mi()
    ans = 1
    for k, v in prime_decomposition(P).items():
        ans *= k**(v//N)
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):

n, p = map(int, input().split())
temp = p
ans = 1
for i in range(2, int(-(-(p**0.5) // 1)) + 1):
    if temp % i == 0:
        cnt = 0
        while temp % i == 0:
            cnt += 1
            temp //= i
        ans *= i**(cnt // n)
if temp != 1:
    ans *= temp*(n == 1) or 1
print(ans)

Solution (Python):
from math import sqrt
def factorint(n):
    d = {}
    for i in range(2, int(sqrt(n)+1)):
        c = 0
        q, r = divmod(n, i)
        while not r:
            c += 1
            n = q
            q, r = divmod(n, i)
        if c:
            d[i] = c
    if n != 1:
        d[n] = 1
    return d

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

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





mylist = factorization(P)
mylist = sorted(mylist, key=lambda x:x[1], reverse=True)
ans = 1
for i,item in enumerate(mylist):
    if item[1] >= N:
        ans *= item[0]**(item[1]//N)
    else:
        break
print(ans)

Solution (Python):
import sys
N, P = list(map(int, input().split()))
M = int(P ** (1 / N) + 1.0E-7)
for i in range(M, 0, -1):
    if P % (i ** N) == 0:
        print(i)
        sys.exit()

Solution (Python):









import os
import sys


from math import sqrt
from collections import Counter


def prime_factors(p, prime_box):
    while p % 2 == 0:
        prime_box.append(2)
        p //= 2

    for i in range(3, int(sqrt(p))+1, 2):
        while p % i == 0:
            prime_box.append(i)
            p //= i
    if p > 2:
        prime_box.append(p)


def main():
    n, p = map(int, input().split())
    if n == 1:
        print(p)
        return
    prime_box = []
    prime_factors(p, prime_box)
    prime_box = list(map(list, Counter(prime_box).items()))
    prime_box = [[s, t//n] for s, t in prime_box]
    ans = 1
    for s, t in prime_box:
        ans *= s**t
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import math
N, P = map(int, input().split())
x = math.floor(math.pow(P, 1/N))
if x==1:
    print(1)
    exit()
x+=1
for i in range(x, 0, -1):
    if P % pow(i, N) == 0:
        print(i)
        break

Solution (Python):
def factorization(n):
    a = n
    p = 2
    res = []
    while a != 1:
        cnt = 0
        while a % p == 0:
            cnt += 1
            a //= p
        if cnt:
            res.append([p, cnt])
        p += 1
        if a != 1 and p * p > n:
            res.append([a, 1])
            break
    return res

N, P = map(int, input().split())
L = factorization(P)
S = 1
for i in L:
    S *= i[0] ** (i[1] // N)
print(S)

Solution (Python):
from collections import Counter

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


i=2
fact = []
while i * i <= p:
    while p % i == 0:
        fact.append(i)
        p //= i
    i += 1

if p >= 1:
    fact.append(p)


cf = Counter(fact)
ans = 1
for num, cnt in cf.items():
    if cnt >= n:
        ans *= (num ** (cnt//n))

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

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

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def factorization(n):
    factors = []

    if n < 2:
        return [n]

    while n % 2 == 0:
        factors.append(2)
        n //= 2

    for i in range(3, int(n ** 0.5) + 5, 2):
        while n % i == 0:
            factors.append(i)
            n //= i

    if n != 1:
        factors.append(n)

    return factors


def main():
    from collections import Counter
    n, p = map(int, readline().split())
    factors = Counter(factorization(p))

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

    print(ans)


if __name__ == '__main__':
    main()