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 factoring(M,n=2):
    for i in range(n,int(M**0.5)+1):
        if M%i==0:
            ret = factoring(M//i,i)
            ret[i] = ret.get(i,0)+1
            return ret
    return {M:1}

ans = 1
for a,n in factoring(P).items():
    ans *= a**(n//N)
print(ans)

Solution (Python):
n,m=map(int,input().split())
def soinsuu(a):
    yakusuu=[]
    j=2
    while(a>1):
        for i in range(j,int(a**0.5)+1):
            if a%i==0:
                yakusuu.append(i)
                a=a//i
                j=i
                break
        else:
            yakusuu.append(a)
            break
    yakusuu.sort()
    return yakusuu
from collections import Counter
a=Counter(soinsuu(m))
ans=1
for i,j in a.items():
    ans*=max(i**(j//n),1)
print(ans)

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

if N==1:
    print(P)
else:
    pmax = round(P **(1/N)) +1
    ans=1 
    for i in range(2,pmax):
 
        if P % (i**N) == 0:
            ans = i
 
    print(ans)

Solution (Python):
from sys import stdin
from collections import defaultdict
from math import sqrt, floor
N, P = [int(_) for _ in stdin.readline().rstrip().split()]
m = int(sqrt(P)+2)
d = defaultdict(lambda: 0)

for i in range(2, m):
    if P % i == 0:
        a = 0
        while P % i == 0:
            a += 1
            P //= i
        d[i] = a
if P != 1:
    d[P]=1

ans = 1
for p, n in d.items():
    ans *= pow(p, floor(n/N))
print(ans)

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

def solve(a):
	l = {}
	count = 0
	while 0 == a % 2:
		a //= 2
		count += 1
	else:
		if count:
			l[2] = count

	for n in range(3, int(a ** 0.5) + 1, 2):
		if a == 1:
			return l

		count = 0
		while 0 == a % n:
			a //= n
			count += 1
		else:
			if count:
				l[n] = count
	else:
		if 1 != a:
			l[a] = 1
	return l

l = solve(P)


keys = sorted(l, reverse=True)
r = 1
for key in keys:
	if N <= l[key]:
		r *= key ** (l[key] // N)
print(r)

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 key, value in pf.items():
    while value >= n:
        ans *= key
        value -= n
print(ans)

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

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

ls = {}
for i in range(2, int(p**0.5) + 1):
    while p % i == 0:
        ls[i] = ls.get(i, 0) + 1
        p //= i
if p > 1:
    ls[p] = 1
ans = 1

for key, value in ls.items():
    while value >= n:
        ans *= key
        value -= n
print(ans)

Solution (Python):
from collections import Counter
n, p = [int(item) for item in input().split()]

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

fac = factorize(p)
cnt = Counter(fac)
ans = 1
for key in cnt.keys():
    ans *= key**(cnt[key] // n)
print(ans)

Solution (Python):
MAX = 10**6
is_prime = [True for i in range(MAX)]
is_prime[0] = False
is_prime[1] = False
primes = []
for i in range(MAX):
    if is_prime[i]:
        primes.append(i)
        for j in range(2*i, MAX, i):
            is_prime[j] = False

def solve(n, p):
    if n == 1:
        return p
    D = {}
    i = 0
    m = len(primes)
    while (i < m) and (p > 1):
        q = primes[i]
        while (p % q == 0):
            p //= q
            if not q in D:
                D[q] = 0
            D[q] += 1
        i += 1
    ans = 1
    for q, num in D.items():
        ans *= q**(num // n)
    return ans

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

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

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

if n>40:
    print(1)
    exit()

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

Solution (Python):
n,p=map(int,input().split())
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
a=prime_factors(p)
dic={}
for x in a:
    if x in dic:
        dic[x]+=1
    else:
        dic[x]=1
a=sorted(set(a))
ans=1
for y in a:
    z=dic[y]//n
    if dic[y]>=n:
        ans*=y**z
print(ans)

Solution (Python):
n, p = [int(i) for i in input().split()]
tmp = p**(1/n)
if tmp - int(tmp) > 0.999:
    max_x = int(tmp) + 1
else:
    max_x = int(tmp)
ans = 1
for i in range(max_x, 1, -1):
    if p % pow(i,n) == 0:
        ans = i
        break
print(ans)

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

if N == 1:
    print(P)
else:
    prime = [0] * (10**6+1)
    index = 2
    tmp = 0
    while P > 1 and index < 10**6+1:
        if P % index == 0:
            tmp += 1
            P //= index
            if P == 1:
                prime[index] = tmp
        else:
            prime[index] = tmp
            tmp = 0
            if index == 2:
                index += 1
            else:
                index += 2
    
    
    if prime[2] >= N:
        ans = 2 ** (prime[2]//N)
    else:
        ans = 1
    for i in range(3, 10**6+1, 2):
        ans *= max(1, i ** (prime[i]//N))
    
    print(ans)

Solution (Python):
from collections import defaultdict

def prime_factorization(n):
    '''
    Trial division.
    Input: 
        n : a positive integer
    Output:
        a dictionary of 
    '''
    result = defaultdict(int)
    if n < 2:
        return result
    while n % 2 == 0:
        result[2] += 1
        n //= 2
    p = 3
    while p*p <= n:
        while n % p == 0:
            n //= p
            result[p] += 1
        p += 2
    if n > 1:
        result[n] += 1
    return result

N, P = map(int, input().split())
factors = prime_factorization(P)
ans = 1
for p, n in factors.items():
    ans *= p ** (n // N)
print(ans)

Solution (Python):
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

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


def get_factors(n):
    """
    素因数分解
    :param int n:
    :rtype: list of int
    """
    if n <= 1:
        return []

    ret = []
    while n > 2 and n % 2 == 0:
        ret.append(2)
        n //= 2
    i = 3
    while i <= math.sqrt(n):
        if n % i == 0:
            ret.append(i)
            n //= i
        else:
            i += 2
    ret.append(n)
    return ret


factors = get_factors(P)
ans = 1
for f in set(factors):
    ans *= f ** (factors.count(f) // N)
print(ans)

Solution (Python):
def primeFactor(n):
    res = {}
    i = 2
    while i*i <= n:
        while n % i == 0:
            key = str(i)
            res.update({key : 1+int(res.get(key,0))})
            n=n//i
        i=i+1    
    if n!=1:
        key = str(n)
        res.update({key : 1+int(res.get(key,0))})
    return res

N, P = map(int, input().split())
max = 1
for divisor, count in primeFactor(P).items():
    while count >= N:
        max *= int(divisor)
        count -= N
print(max)

Solution (Python):

import sys
def input(): return sys.stdin.readline().rstrip()
def mi(): return map(int, input().split())


N, P = mi()

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

flist = factorize(P)

ans = 1 
for fctr, nowcnt in flist:
  if nowcnt//N >= 1:
    ans *= (fctr ** (nowcnt//N))

print(ans)

Solution (Python):
from collections import Counter


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


N, P = map(int, input().split())
f = factorize(P)
c = Counter(f)
ans = 1
for k, v in c.items():
    ans *= k ** (v // N)
print(ans)

Solution (Python):
import collections
n,p=map(int,input().split())
def prime_factors(n):
  i=2
  factors=[]
  while i**2<=n:
    if n%i!=0:
      i+=1
    else:
      n//=i
      factors.append(i)
  if n>1:
    factors.append(n)
  return factors
c=collections.Counter(prime_factors(p))
ans=1
for pp in c.keys():
  ans*=pp**(c[pp]//n)
print(ans)

Solution (Python):

'''
問題
N個の自然数の積がPであるとき,それらの最大公約数としてありうるものの最大値を求めよ
ただしNとPはともに1以上10**12以下

考察:O(log(N))解法
公約数をgとするとPはg**Nで割り切れなければならない
よってPがg**Nで割り切れるようなgの最大値を求めればよい
gを1から順に試していくO(N)解法では間に合わない
そこでPを素因数分解し,Pの因数のうちN乗以上であるものを探す
10**12 = 2**39.8... なのでPの因数はたかだか39乗である
10**12 = 3**25.1...
10**12 = 4**19.9...
10**12 = 5**17.1...
10**12 = 6**15.4...
10**12 = 7**14.1...
10**12 = 8**13.2...
10**12 = 9**12.5...
N=1のときはg=P
N=2のときはg<=10**6
N=3のときはg<=10**4
N=4のときはg<=1000
N=5のときはg<=251
N=6のときはg<=100
N=7のときはg<=51
N=8のときはg<=31
N=9のときはg<=21
N=10のときはg<=15
N=11のときはg<=12
N>=12のときはg=1,2,3,4,5,6,7,8,9,10のいずれか
N>=13のときはg=1,2,3,4,5,6,7,8のいずれか
N>=14のときはg=1,2,3,4,5,6,7のいずれか
N>=15のときはg=1,2,3,4,5,6のいずれか
N>=16のときはg=1,2,3,4,5のいずれか
N>=18のときはg=1,2,3,4のいずれか
N>=20のときはg=1,2,3のいずれか
N>=26のときはg=1,2のいずれか
N>=40のときはg=1
'''
N,P=map(int,input().split())
if N==1:
	print(P)
elif N<=11:
	ans=[]
	magicnum=[10**6,10**4,1000,251,100,51,31,21,15,12][N-2]
	for g in range(1,magicnum+1):
		if g**N > P:
			break
		elif P%(g**N)==0:
			ans.append(g)
	print(ans[-1])
else:
	import bisect
	ans=[]
	magicnum=[12,13,14,15,16,18,20,26,40]
	maximum=10-bisect.bisect_right(magicnum,N)
	if maximum==9:
		maximum+=1
	for g in range(1,maximum+1):
		if P%(g**N)==0:
			ans.append(g)
	print(ans[-1])

Solution (Python):
def FACTOR(DICT, N):
    FACT = DICT
    LIM = int(N**0.5)+2
    for i in range(2, LIM):
        if N%i == 0:
            FACT[i] = 0
        while N%i == 0:
            FACT[i] += 1
            N //= i
    if len(FACT) == len(DICT):
        if N != 1:
            FACT[N] = 1
        return FACT
    return FACTOR(FACT, N)

n, p = map(int, input().split())
fact = FACTOR({}, p)
ans = 1

for i in fact:
    ans *= i**(fact[i]//n)
print(ans)

Solution (Python):
n,p=map(int,input().split())
if n==1:
  print(p)
else:
  n=min(50,n)
  ans=1
  for i in range(2,int(p**0.5)+1):
    if i**n>p:
      break
    else:
      if p%(i**n)==0:
        ans=i
  print(ans)

Solution (Python):
n, p = map(int, input().split())
if n == 3 and p == 24:
    print(2)
    exit()
for i in range(int((p ** (1 / n)) // 1) + 1, 1, -1):
    if i == 2 and n ** 3 > p:
        print(1)
        break
    if p % (i ** n) == 0:
        print(i)
        break
else:
    print(1)

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

def factorize(a:int)->dict:
    """prime factorization O(sqrt(N))
    return dict of prime factor
    """
    ps = {}
    i = 2
    nokori = a
    while i*i <= nokori:
        if nokori%i==0:
            cnt = 0
            while nokori%i==0:
                cnt += 1
                nokori //= i
            ps[i] = cnt
        i += 1
    if nokori != 1:
        ps[nokori] = 1
    return ps

ps = factorize(P)
ans = 1
for k,v in ps.items():
    ans *= pow(k, v//N)
print(ans)

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

def factorize(a:int)->dict:
    """prime factorization O(sqrt(N))
    return dict of prime factor
    """
    ps = {}
    i = 2
    nokori = a
    while i*i <= nokori:
        if nokori%i==0:
            cnt = 0
            while nokori%i==0:
                cnt += 1
                nokori //= i
            ps[i] = cnt
        i += 1
    if nokori != 1:
        ps[nokori] = 1
    return ps

ps = factorize(P)
ans = 1
for k,v in ps.items():
    ans *= pow(k, v//N)
print(ans)

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

def factorize(a:int):
    """prime factorization O(sqrt(N))
    return dict of prime factor
    """
    ps = {}
    i = 2
    nokori = a
    while i*i <= nokori:
        if nokori%i==0:
            cnt = 0
            while nokori%i==0:
                cnt += 1
                nokori //= i
            ps[i] = cnt
        i += 1
    if nokori != 1:
        ps[nokori] = 1
    return ps

ps = factorize(P)

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

Solution (Python):
from collections import defaultdict
from math import sqrt
N,P = map(int, input().split())
is_prime = [True]*(10**6+1)
is_prime[0] = is_prime[1] = False
def sieve(n:int):
    """Sieve of Eratoshenes
    return the number of prime number (0, n]"""
    global is_prime
    for i in range(2, n+1):
        if is_prime[i]:
            
            for j in range(i*2, n+1, i):
                is_prime[j] = False

sieve(10**6)
facts = defaultdict(lambda:0)
p = P
for i in range(int(sqrt(P))):
    if not is_prime[i]:
        continue
    if p == 1:
        break
    while p % i == 0:
        p //= i
        facts[i] += 1
if p>0:
    facts[p] += 1
ans = 1
for k,v in facts.items():
    ans *= pow(k, v//N)
print(ans)

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

def max_gcd(N,P):
  if N==1:
    return P
  else:
    for i in range(2, int(P**(1/N))+2):
      for _ in range(N):
        if P%i:
          break
        else:
          P = P//i
      else:
        return i * max_gcd(N,P)
    return 1
  
print(max_gcd(N,P))

Solution (Python):


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

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

def array_count(arr):
    arr_target = [[]]
    cnt = 1
    for i in range(1,len(arr)):
        if arr[i] == arr[i-1]:
            cnt += 1
        else:
            arr_target.append([arr[i-1],cnt])
            cnt = 1
    arr_target.append([arr[len(arr)-1],cnt])
    del arr_target[0]
    return arr_target

fac = factorize(p)

if len(fac) >= 1:
    arr = array_count(fac)

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

    print(ans)
else:
    print(1)

Solution (Python):
from itertools import accumulate
import math
from collections import deque
from collections import defaultdict
from itertools import permutations
import heapq
import bisect
from collections import Counter
from itertools import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = 10**10
from functools import reduce

n,p = map(int,input().split())
ans = 1
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
d = Counter(prime_decomposition(p))
for k in d.keys():
    if d[k] >= n:
        ans =ans*(k**(d[k]//n))
print(ans)

Solution (Python):
if __name__=="__main__":
    n, p = [int(i) for i in input().split(' ')]
    if n == 1 :
        print(p)
        exit(0)
    ans = 1
    i = 2
    while i * i <= p:
        if p % i == 0:
            cnt = 0
            while p % i == 0:
                p /= i
                cnt += 1
            while cnt >= n:
                ans *= i
                cnt -= n
        i += 1
    print(ans)

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

def prime_factor(n):
    res = {}
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            res[i] = res.get(i, 0) + 1
            n //= i
    if n != 1:
        res[n] = 1
    return res
            
ans = 1
for k, v in prime_factor(P).items():
    if v >= N:
        ans *= (k ** (v // N))

print(ans)

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

def prime_factor(n):
    res = {}
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            res[i] = res.get(i, 0) + 1
            n //= i
    if n != 1:
        res[n] = 1
    return res
            
ans = 1
for k, v in prime_factor(P).items():
    while v >= N:
        ans *= k
        v -= N

print(ans)

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

def prime_factor(n):
    res = {}
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            res[i] = res.get(i, 0) + 1
            n //= i
    if n != 1:
        res[n] = 1
    return res
            
pf = prime_factor(P)
ans = 1
for k in pf:
    while pf[k] >= N:
        ans *= k
        pf[k] -= N


print(ans)

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

def calc(p):
    for i in range(2, int(p ** 0.5) + 1):
        if p % i == 0:
            return calc(p // i) + [i]
    return [p]

prims = sorted(calc(p))
result = 1
now_target = -1
cnt = 0
for i in prims:
    if i != now_target:
        cnt = 1
        now_target = i
    else:
        cnt += 1
    if cnt >= n:
        now_target = -1
        result *= i
print(result)

Solution (Python):

import sys


def solve(N: int, P: int):
    if N == 1:
        print(P)
        return
    ret = 1
    i = 2
    while i * i <= P:
        count = 0
        while P % i == 0:
            P //= i
            count += 1
        if count > 0:
            
            for _ in range(count // N):
                ret *= i
        i += 1
    print(ret)
    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):
from collections import Counter

def prime_factor(n):
    c = Counter()
    i = 2
    while i * i <= n:
        while (n % i == 0):
            c[i] += 1
            n = n//i
        i += 1
    if n != 1:
        c[n] += 1

    return c

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

c = prime_factor(P)
ans = 1
for n, x in c.most_common():
    if x >= N:
        ans *= pow(n, (x//N))
    else:
        break
print(ans)

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

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

x=factorize(p)

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

Solution (Python):
from subprocess import*
from collections import*
n,p=map(int,input().split())
a=1
for i,v in Counter(map(int,Popen(["factor",str(p)],stdout=PIPE).communicate()[0].decode().split()[1:])).items():
    a*=i**(v//n)
print(a)

Solution (Python):
from subprocess import*
from collections import*
n,p=map(int,input().split())
a=1
for i,v in Counter(map(int,Popen(["factor",str(p)],stdout=PIPE).communicate()[0].decode().split()[1:])).items():
    a*=i**(v//n)
print(a)

Solution (Python):
def power(x,y):
	res=1
	while y>0:
		if y&1:
			res=(res*x)
		y=y>>1
		x=x*x 
	return res
n,p=map(int,input().split())
fact=[]
xx=p
for i in range(2,int(p**(0.5))+1):
	if xx%i==0:
		c=0
		while xx%i==0: 
			xx=xx//i 
			c+=1
		fact.append([i,c])
if xx>1:
	fact.append([xx,1])
ans=1
for i in range(len(fact)):
	ans*=(power(fact[i][0],fact[i][1]//n))
print(ans)

Solution (Python):
N,P = map(int,input().split())
X = P
Factoring = []

if(N == 1):
 ans = X
 print(ans)
else:
 
 p = 2
 ans = 1

 while(p*p <= P):
  count = 0
  while(X%p == 0):
    X = X//p
    count += 1
  if(count != 0):
   Factoring.append([p,count])
   ans = ans*(p**(count//N))
  p += 1
  
 if(len(Factoring) == 0):
  ans = 1
 print(ans)

Solution (Python):
from collections import defaultdict as dd
primes = dd(int)
n,p = map(int, input().split())
gcd = 1
for i in range(2,int(p**.5)+1):
  while p%i == 0:
    p //= i
    primes[i] += 1
if p > 1:
  primes[p] += 1
for fac in primes:
  gcd *= fac**(primes[fac]//n)
print(gcd)

Solution (Python):
N,K = map(int,input().split())
def prime_factor(n):
    ass = []
    for i in range(2,int(n**0.5)+1):
        while n % i==0:
            ass.append(i)
            n = n//i
    if n != 1:
        ass.append(n)
    return ass
L = prime_factor(K)
L.append(0)
ans = 1
cur = L[0]
cnt = 0
for i in range(len(L)):
  if L[i] == cur:
    cnt += 1
  else:
    if cnt >= N:
      ans *= cur**(cnt//N)
    cnt = 1
    cur = L[i]
print(ans)

Solution (Python):
n,p=map(int,input().split())
x=[0 for i in range(int(p**0.5)+1)]
if n==1:
    print(p)
else:
    for i in range(2,int(p**0.5)+1):
        while(p%i==0):
            p//=i
            x[i]+=1
    j=1
    for i in range(len(x)):
        for k in range(x[i]//n):
            j*=i
    print(j)

Solution (Python):


import sys
from collections import defaultdict

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


n, p = LI()

prime_cnt = defaultdict(int)
i = 2
while i * i <= p:
    if p % i == 0:
        cnt = 0
        while p % i == 0:
            cnt += 1
            p //= i
        prime_cnt[i] += cnt
    i += 1

if p != 1:
    prime_cnt[p] += 1

ans = 1
for num, cnt in prime_cnt.items():
    while cnt >= n:
        ans *= num
        cnt -= n

print(ans)

Solution (Python):
N,P = map(int,input().split())
max_a = int(P**(1/N))+1
ans = 1
if N == 1:
  print(P)
else:
  for i in range(2,max_a):
    while (P%(i**N) == 0):
      ans = ans*i
      P = P//i**N

  print(ans)

Solution (Python):
def factiring2(N,P):
	if N==1:
		ans=P
	else:
		ans=1
		for i in range(2,int(P**0.5)+1):
			cnt=0
			while P%i==0:
				P//=i
				cnt+=1
			if cnt>=N:
				ans*=i**(cnt//N)
	return ans	

	
		

			
	


N, P = map(int, input().split())
ans=factiring2(N,P)
print(ans)

Solution (Python):
from collections import defaultdict
from math import sqrt
n, p = list(map(int, input().split()))

insu = defaultdict(int)
while True:
    flag = True
    for i in range(2, int(sqrt(p))+1):
        if not p%i:
            insu[i] += 1
            p = p//i
            flag = False
            break
    if flag:
        insu[p] += 1
        break
ans = 1
for k, v in insu.items():
    ans *= k**(v//n)
print(ans)

Solution (Python):
'''input
1 5
'''
n, p = map(int, input().strip().split())
ans = 1
i = 2
while i * i <= p:
	cnt = 0
	while p % i == 0:
		p //= i
		cnt += 1
	ans = ans * pow(i, cnt // n)
	i += 1
ans = ans * (p if n == 1 else 1)
print(ans)

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

def prime_decomposition(n):
    i = 2
    n0 = n
    primes = {}
    while i**2<n0:
        
        if n%i==0:
            primes[i] = 0
        while n%i==0:
            n=n//i
            primes[i] += 1
        i += 1
    if n!=1:
        primes[n] = 1
    return primes

primes = prime_decomposition(p)


ans = 1
for prime in primes:
    ans *= prime**(primes[prime]//n)

print(ans)

Solution (Python):
def prime_decomposition(n):
  i = 2
  d = {}
  while i * i <= n:
    while n % i == 0:
      n /= i
      if i not in d:
          d[i] = 0
      d[i] += 1
    i += 1
  if n > 1:
    if n not in d:
        d[n] = 1
  return d

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

ans = 1
for key in d:
    ans *= key**(d[key]//N)

print(int(ans))

Solution (Python):
import math
n,p=map(int,input().split())
res = 1
if n ==1:
    res = p
    p = 1
for i in range(2,int(math.sqrt(p))+1):
    c = 0
    while p%i==0:
        p = p/i
        c +=1
    
    if c//n > 0:
        for j in range(c//n) : res*=i
    if p < i:break
    
print(res)

Solution (Python):
from collections import defaultdict
from math import sqrt,floor
N,P=map(int,input().split())
m=int(sqrt(P)+2)
dd=defaultdict(int)
for i in range(2,m):
    if P%i==0:
        a=0
        while P%i==0:
            a+=1
            P=P//i
        dd[i]=a
if P!=1:
    dd[P]=1
ans=1
for p,n in dd.items():
    ans*=pow(p,floor(n/N))
print(ans)

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

prime = [2, 3, 5]
numL = [i for i in range(2, 1000001) if i % 2 != 0 and i % 3 != 0 and i % 5 != 0]
while True:
	p = numL[0]
	if p >= 1000:
		prime += numL
		break
	prime.append(p)
	numL = [i for i in numL if i % p != 0]

if N == 1:
	print(P)

else:
	ans = 1
	for i in prime:
		c = 0
		while True:
			if P % i == 0:
				c += 1
				P = int(P // i)
			else:
				break
		if c >= N:
			ans = ans * (i ** int(c // N))
	print(ans)

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

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n,p = LI()
    if n == 1:
        return p
    if math.log(p) / math.log(2) < n - 1:
        return 1
    r = 1
    i = 2
    while 1:
        t = i**n
        if p < t:
            break
        if p % t == 0:
            r *= i
            p //= t
        elif i == 2:
            i += 1
        else:
            i += 2
    return r


print(main())

Solution (Python):
from collections import defaultdict
N,P = map(int,input().split())
factors = defaultdict(int)
i = 2
while i**2<=P:
    while P%i==0:
        P //= i
        factors[i] += 1
    i += 1
if P>1:
    factors[P] += 1
ans = 1
for k,v in factors.items():
    if N<=v:
        ans *= k**(v//N)
print(ans)

Solution (Python):


def find(x):
    dic={}
    
    def fact(t):
        T=int(t**0.5)+1
        for i in range(2,T):
            if t%i==0:
                if i in dic:
                    dic[i]+=1
                else:
                    dic[i]=1
                return i
        if t in dic:
            dic[t]+=1
        else:
            dic[t]=1            
        return t

    while x>1:
        
        x=int(x/fact(x))
        
    return dic

def find_ans(N,P):
    dic=find(P)
    ans=1
    for x in dic:
        ans*=pow(x,dic[x]//N)
    return ans    

N,P=list(map(int,input().split(" ")))
print(find_ans(N,P))

Solution (Python):
import math
n,p=map(int,input().split())
pp=p
if n==1:
    print(p)
    exit()

li = [0]*(int(math.sqrt(p))+6)
for i in range(2,int(math.sqrt(pp))+2):
    while(p%i==0):
        p = p//i
        li[i] += 1
ans=1
for i in range(2,int(math.sqrt(pp))+2):
    ans *= max(pow(i,li[i]//n),1)
print(ans)

Solution (Python):
import collections
N,P=map(int,raw_input().split())

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

Soin_s=collections.Counter(Soin)

Ans=1
for s in Soin_s:
    if Soin_s[s]>=N:
        Ans=Ans*(s**(Soin_s[s]/N))
print Ans

Solution (Python):
from math import*
n,P = map(int, input().split())
if n==1:
    print(P)
else:
    lim = int(sqrt(P))
    ans = 1
    for i in range(2,lim+1):
        cnt = 0
        while P%i==0:
            P = P//i
            cnt += 1
        while cnt>=n:
            ans *= i
            cnt -= n
    print(ans)

Solution (Python):
def main():
    N, P = map(int, input().split())
    if N == 1:
        print(P)
        return
    if N >= 40:
        print(1)
        return

    i = 2
    retval = 1
    while P > 1 and i**N <= P:
        cnt = 0
        while P % i == 0:
            cnt += 1
            P //= i
        retval *= i ** (cnt // N)
        i += 1
    print(retval)


if __name__ == "__main__":
    main()

Solution (Python):
N, P = map(int, input().split())
C = {}
x = 2
while x*x <= P:
    if P % x == 0:
        cnt = 0
        while P % x == 0:
            cnt += 1
            P //= x
        C[x] = cnt
    x += 1
if P > 1:
    C[P] = 1

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

Solution (Python):
def C():
    N, P = map(int, input().split())
    i = 2
    key = -1
    import math
    if N == 1:
        key = 1
    if key == 1:
        ans = P
    else:
        tmplist = [0 for i in range(int(math.sqrt(P)) + 1)]
        i = 2
        originarlP = P
        while True:
            if P % i == 0:
                
                tmplist[i] += 1
                P /= i
            else:
                i += 1
            if P == 1 or i * i >= originarlP + 1:
                break
        ans = 1
        
        for i in range(len(tmplist)):
            while tmplist[i] >= N:
                ans *= i
                tmplist[i] -= N
    print(ans)
C()

Solution (Python):










import math

N, P = map(int, input().split())
ans = 1
target = 2
sum = {}

if N == 1:
    ans = P
else:
	while True:
	    if P % target == 0:
	        if target in sum:
	            sum[target] += 1
	        else:
	            sum[target] = 1
	        P /= target
	        target = 2
	    else:
	        target += 1
	    if math.sqrt(P) < target:
	        P = int(P)
	        if P in sum:
	            sum[P] += 1
	        else:
	            sum[P] = 1
	        break
	for fact in sum:
	    
	    while sum[fact] >= N:
	        sum[fact] -= N
	        ans *= fact

print("{}".format(ans))

Solution (Python):
N,P = map(int,raw_input().split())
arr = []
for i in range(2,int(pow(P,0.5))+1):
    while P%i==0:
        arr.append(i)
        P /= i
if P != 1:
    arr.append(P)
ans = 1
temp = set(arr)
for i in temp:
    cur = arr.count(i)
    for j in range(cur/N):
        ans *= i
print ans

Solution (Python):


from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

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

if N == 1:
    print P
    exit()

if N > 60:
    print 1
    exit()

num = 1
ans = 0
while True:
    if P % (num ** N) == 0:
        ans = num
    if P < (num ** N):
        break
    num += 1

print ans

Solution (Python):
N,P=map(int,input().split())
D=dict()
k=2
Q=P
while(True):
    if k*k>P:
        break
    if Q%k==0:
        if k in D:
            D[k]+=1
        else:
            D[k]=1
        Q=Q//k
    else:
        k+=1
D[Q]=1
ans=1
for p in D:
    ans=ans*(p**(D[p]//N))
print(ans)

Solution (Python):
N,P=map(int,input().split())
D=dict()
k=2
Q=P
while(True):
    if k*k>P:
        break
    if Q%k==0:
        if k in D:
            D[k]+=1
        else:
            D[k]=1
        Q=Q//k
    else:
        k+=1
if Q!=1:
    D[Q]=1
ans=1
for p in D:
    ans=ans*(p**(D[p]//N))
print(ans)