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

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

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



import math



class Prime:
    seed_primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]

    def is_prime(self, n):
        """
        prime test (hybrid)

        see also: https://qiita.com/gushwell/items/ff9ed83ba55350aaa369

        :param n:
        :return: boolean
        """
        is_prime_common = self.is_prime_common(n)
        if is_prime_common is not None:
            return is_prime_common

        if n < 2000000:
            return self.is_prime_brute_force(n)
        else:
            return self.is_prime_miller_rabin(n)

    def is_prime_common(self, n):
        if n == 1: return False
        if n in Prime.seed_primes: return True
        if any(map(lambda x: n % x == 0, self.seed_primes)): return False

    def is_prime_brute_force(self, n):
        """
        brute force prime test
        use with is_prime_common if you want to skip seed_primes

        :param n:
        :return: boolean
        """
        for k in range(2, int(math.sqrt(n)) + 1):
            if n % k == 0:
                return False
        return True

    def is_prime_miller_rabin(self, n):
        """
        miller rabin prime test
        use with is_prime_common if you want to skip seed_primes

        see also
            algorithm: https://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test
            implementation: https://qiita.com/srtk86/items/609737d50c9ef5f5dc59
            improvement: https://qiita.com/gushwell/items/ff9ed83ba55350aaa369

        :param n:
        :return: boolean
        """

        d = n - 1
        while d & 1 == 0:
            d >>= 1

        
        witnesses = self.get_witnesses(n)
        

        for w in witnesses:
            y = pow(w, d, n)

            while d != n - 1 and y != 1 and y != n - 1:
                y = (y * y) % n
                d <<= 1

            if y != n - 1 and d & 1 == 0:
                return False

        return True

    def get_witnesses(self, num):
        def _get_range(num):
            if num < 2047:
                return 1
            if num < 1373653:
                return 2
            if num < 25326001:
                return 3
            if num < 3215031751:
                return 4
            if num < 2152302898747:
                return 5
            if num < 3474749660383:
                return 6
            if num < 341550071728321:
                return 7
            if num < 3825123056546413051:
                return 9
            return 12

        return self.seed_primes[:_get_range(num)]

    def gcd(self, a, b):
        if a < b:
            return self.gcd(b, a)
        if b == 0:
            return a
        while b:
            a, b = b, a % b
        return a

    @staticmethod
    def f(x, n, seed):
        """
        pseudo prime generator
        :param x:
        :param n:
        :param seed:
        :return: pseudo prime
        """
        p = Prime.seed_primes[seed % len(Prime.seed_primes)]
        return (p * x + seed) % n

    def find_factor(self, n, seed=1):
        """
        find one of factor of n
        this function is based to Pollard's rho algorithm

        see also
            algorithm: https://en.wikipedia.org/wiki/Pollard%27s_rho_algorithm
            implementation: https://qiita.com/gushwell/items/561afde2e00bf3380c98

        :param n:
        :param seed:
        :return: factor
        """
        if self.is_prime(n):
            return n

        x, y, d = 2, 2, 1
        count = 0
        while d == 1:
            count += 1
            x = self.f(x, n, seed)
            y = self.f(self.f(y, n, seed), n, seed)
            d = self.gcd(abs(x - y), n)

        if d == n:
            return self.find_factor(n, seed+1)
        return self.find_factor(d)

    def find_factors(self, n):
        primes = {}
        if self.is_prime(n):
            primes[n] = 1
            return primes

        while n > 1:
            factor = self.find_factor(n)

            primes.setdefault(factor, 0)
            primes[factor] += 1

            n //= factor

        return primes


prime = Prime()

dic = prime.find_factors(p)

tmp = 1
for k, v in dic.items():
    if v >= n:
        tmp = tmp * (k ** (v // n))

print(tmp)

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

i = 2
plimes = []

if N == 1:
    print(P)
else:
    while(i <= math.sqrt(P)):
        if P % i == 0:
            P = P // i
            plimes.append(i)
        elif i == 2:
            i += 1
        else:
            i += 2
    plimes.append(P)


    resalt = 1
    j = 0

    while(len(plimes) > j):
        k =plimes.count(plimes[j])
        if k // N >= 1:
            resalt = resalt * plimes[j] **(k//N)
        j = j + k
    print(resalt)

Solution (Python):
import math
import copy
 
n,p=map(int,input().split())
a=math.floor(p**(1/n)+1)

for i in range(a,0,-1):
    if i==1:
        print(i)
        break
    p_s=copy.deepcopy(p)
    cnt=0
    while p_s%i==0:
        cnt+=1
        p_s//=i
        if cnt>=n:
            print(i)
            exit()

Solution (Python):
import sys


input = sys.stdin.readline
n, p = map(int, input().split())
if n == 1:
    ans = p
elif n > 10**6:
    ans = 1
else:
    ans = 1
    for i in range(2, 10**6+1):
        check = i**n
        if check > p:
            break
        elif p % check == 0:
            ans = i
print(ans)

Solution (Python):

n, p = list(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
ls = prime_factor(p)



import collections
lsm = collections.Counter(ls)
lsm = lsm.most_common()




key = []
for k in range(len(lsm)):
    if lsm[k][1] >= n:
        
        
        key.append(lsm[k][0]**int(lsm[k][1]/n))
    else:
        key.append(1)


v = 1
for j in range(len(key)):
    v = v*key[j]
print(v)

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


def divisorize(fct):
    b, e = fct.pop()  
    pre_div = divisorize(fct) if fct else [[]]
    suf_div = [[(b, k)] for k in range(e + 1)]
    return [pre + suf for pre in pre_div for suf in suf_div]


def num(fct):
    a = 1
    for base, exponent in fct:
        a = a * base**exponent
    return a


if __name__ == '__main__':
    
    x, n = map(int, input().split(" "))
    r = factorize(n)
    r2 = [(c[0], c[1]//x) for c in r if c[1]>=x] 
    r3 = [c[0]**c[1] for c in r2]
    r_f = 1
    for c in r3:
        r_f *= c
    print(r_f)

    """
    
    for d in divisorize(r):
        print(d, num(d))
    """

Solution (Python):
import math 

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

def factorize(n):
    fct = list()
    base, exp = 2, 0
    while base * base <= n:
        while n % base == 0:
            n = n // base
            exp = exp + 1

        if exp > 0:
            fct.append((base, exp))

        base, exp = base + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

fs = sorted(factorize(P), reverse=True)


ans = 1
for f in fs:
	if f[1] >= N:
		a = f[1] // N
		ans *= f[0] ** a

print(ans)

Solution (Python):
def prime_decomposition(n):
    i = 2
    table=[]
    while i*i<=n:
        count=0
        while n%i==0:
            n/= i
            count+=1
        table.append([int(i),count])
        i += 1
    if n > 1:
        table.append([int(n),1])
    return table
N,P=map(int,input().split())
ans=1
for A in prime_decomposition(P):
    if A[1]>=N:
        ans*=A[0]**int(A[1]/N)
print(ans)

Solution (Python):
import math
def trial_division(fact_dict):    
    global n
    f = 2
    while True:
        if f ** 2 <= n:
            if n % f == 0:
                if f in fact_dict:
                    fact_dict[f] += 1
                else:
                    fact_dict[f] = 1
                n = int(n / f)
                break
            else:
                f += 1
        else:
            if n in fact_dict:
                fact_dict[n] += 1
            else:
                fact_dict[n] = 1
            n = 1
            break


N, P = map(int, input().split())
n = P
fact_dict = {}
ans = 1
lst = []
while n > 1:
    trial_division(fact_dict)
for i in range(len(fact_dict)):
    keys = list(fact_dict.keys())
    key = keys[-i]
    val = fact_dict[key]
    if val >= N:
        power = val // N
        lst.append(key ** power)

if lst != []:
    for i in lst:
        ans *= i

print(ans)

Solution (Python):
import math
import functools
import operator

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

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

        return dict_counter

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

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

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

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

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



n,p=map(int,input().split())
if n>=p:
    print(1)
elif n==1:
    print(p)
else:
    pdic=prime_factorization_2(p)
    plist=[]
    plsit2=[]
    result=1
    for k in pdic:
        plist.append(k)

    for i in range(len(plist)):
        value=int(pdic[plist[i]])
        if value>=n:
            tmp=value//n
            plsit2.append(plist[i]**tmp)
    for i in plsit2:
        result=result*i        
 
    
    print(result)

Solution (Python):
import collections

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

def cal(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

c = collections.Counter(cal(P)).most_common()

if N == 1:
    print(P)
elif P == 1:
    print(1)
else:
    for x, y in c:
        if y >= N:
            ans *= x**(y//N)
    print(ans)

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


def primes(x):
    if x < 2: return []

    primes = [i for i in range(x)]
    primes[1] = 0 

    
    for prime in primes:
        if prime > math.sqrt(x): break
        if prime == 0: continue
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

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

PS = primes(1000000)
def factorint(x):
  d = {}
  for k in PS:
    if(x % k== 0):
      m = 1
      while(x % (k**m) == 0):
        m += 1
      d[k] = m - 1
      x = x / (k ** (m - 1))
      if x == 1:
        break
  return d

fac = factorint(p)
result = 1
for i,j in fac.items():
  result *= i **math.floor(j/n)
if n == 1:
  result = p
print(result)

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

a = 2
b = 1

if N == 1 :
	print(P)
else:
	while math.log(P) >= N * math.log(a):
		if P % a**N == 0:
			P /= a**N
			b *= a
			a = 1
		a += 1
	print(b)

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

N, P = map(int, input().split())
d = prime_decomposition(P)
ret = 1
for k, v in d.items():
    if v >= N:
        ret *= k ** (v//N)
print(ret)

Solution (Python):
import math
import collections

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

def soinsuu(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

answer = 1
for k, v in collections.Counter(soinsuu(P)).items():
    if v >= N:
        answer *= k ** (v // N)

print(answer)

Solution (Python):
import math
import copy
from collections import defaultdict

N,P= map( int , raw_input().split() )
Po=copy.deepcopy(P)

if P==1:
	print 1
	quit()

p=int( math.sqrt(P)) +2

D=defaultdict(lambda: 0)
 
L=range(2,p)
 
for l in L:
	while P%l==0:
		P/=l
		D[l]+=1
else:
	D[P]+=1


if len(D)==0:
	print Po	
else:
	ans=1
	for x,y in D.items():
		if y>=N:
			ans*= x**(y/N)
	print ans

Solution (Python):
import math

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

i = 2
l = []
while i*i <= P:
    while P%i == 0:
        P /= i
        l.append(i)
    i += 1
if P > 1:
    l.append(int(P))
if len(l) == 0:
    l.append(1)

n = list(set(l))
c = [math.floor(l.count(i)/N) for i in n]
res = 1
for m in [n_**c_ for n_,c_ in zip(n,c)]:
    if m > 0:
        res *= m

print(res)

Solution (Python):
import math

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

tmp = math.sqrt(p)

if n == 1:
    print(p)
elif n >=100:
    print(1)
else:
    for i in range(1,int(tmp)+1):
        if p % (i ** n) == 0:
            ans = i
    print(ans)

Solution (Python):
import math
def make_prime_list(num):
    if num < 2:
        return []
    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0
    num_sqrt = math.sqrt(num)

    for prime in prime_list:
        if prime == 0:
            continue
        if prime > num_sqrt:
            break
        
        for non_prime in range(2 * prime, num, prime):
            prime_list[non_prime] = 0
    return [prime for prime in prime_list if prime != 0]

def prime_factorization(num):
    if num <= 1:
        return {1 : 1}
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list(num_sqrt)

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




if __name__ == '__main__':
    N, P = map(int, input().split())

    d = prime_factorization(P)

    cnt = 1

    for key, value in d.items():
        while value >= N :
            cnt *= key
            value -= N
    if N == 1:
        print(P)
    else:
        print(cnt)

Solution (Python):
import numpy as np
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
N,P = map(int,input().split())
numbers = factorize(P)
common=1
for pair in numbers:
    if pair[1]//N:  
        common*=(pair[0]**(pair[1]//N))
print(common)

Solution (Python):

import collections
import math

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

insuList=[]
warukazu = 2
while (warukazu <= math.sqrt(P) +1):
  if P % warukazu == 0:
    P = P / warukazu
    insuList.append(warukazu)
  else:
    warukazu+=1
insuList.append(P)

ans=1
c=collections.Counter(insuList)
for key in c.keys():
  while c[key] >= N:
    ans=ans*key
    c[key] -= N

print(int(ans))

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

i = 2
factors = []
factor_sub = set()
if n == 1:
    print(p)
elif p > 1:
    while i * i <= p:
        if p % i:
            i += 1
        else:
            p //=i
            factors.append(i)
            factor_sub.add(i)
    if p > 1:
        factors.append(p)
    if len(factors) < n:
        print('1')
    else:
        ans = 1
        for c in factor_sub:
            temp = factors.count(c)
            while temp >= n:
                ans *= c
                temp -= n
        print(int(ans))
else:
    print('1')

Solution (Python):
import math	
N, P = map(int, input().split())
if N == 1:
	print(P)
else:
	ans = 1
	for i in range(2, P):
		if N * math.log(i) > math.log(P):
			break
		if P % (i ** N) == 0:
			ans = i
	print(ans)

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

mp = {}
for i in range(2, int(P**0.5) + 1):
    while P % i == 0:
        mp[i] = mp.get(i, 0) + 1
        P //= i
mp[P] = mp.get(P, 0) + 1
ans = 1
for i in mp.keys():
    ans *= max(i ** (mp[i] // N), 1)
print(ans)

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

i=2
gcd=1
if(n>40):
    print(1)
elif(n==1):
    print(p)
else:
    while((i**n)<=p):
        if(p%(i**n)==0):
            
            gcd*=i
            p/=(i**n)
            i-=1
        i+=1
        
    print(gcd)

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

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



list = factorize(p)




ans = 1
for b, e in list:
    
    tmp = e // n
    
    if tmp !=0:
        for i in range(tmp):
            ans*=b

print(ans)

Solution (Python):
n,a = input().split(' ')

n = int(n)
a = int(a)
b = a

values = {}

i = 2

while(i*i <= a):
    
    count = 0
    while(b%i == 0):
        b = b/i
        count += 1
        
    if count > 0:
        values[i] = count

    i = i+1

if b > 0:
    values[b] = 1

result = 1

for i in values.keys():
    result *= pow(i,values[i]//n)
    
print(int(result))

Solution (Python):
import math
import collections
def trial_division_sqrt(n):
    prime_count = collections.Counter()
    
    for i in range(2, int(math.sqrt(n)) + 2):
        while n % i == 0:
            n /= i
            prime_count[i] += 1
    if n > 1:
        prime_count[n] += 1
    
    return prime_count

N,P = map(int,input().split())
cnt = trial_division_sqrt(P)
sorted_cnt = cnt.most_common()

ans  = 1
for i in range(len(cnt)):
    divisor_cnt = sorted_cnt[i][1] // N 
    divisor_num = sorted_cnt[i][0] 
    if  divisor_cnt >= 1:
        ans *= divisor_num ** divisor_cnt
    else:
        break

print(int(ans))

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

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

fct = factrize(P)
fct = sorted(fct, key=lambda x:x[1])

gcf = 1

for i, value in enumerate(fct):
    if N <= value[1]:
        gcf *= value[0] ** (value[1] // N)

print(gcf)

Solution (Python):
N, P = map(int, input().split())
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
prime = prime_decomposition(P)
now = -1
count = 0
res = 1
for i in range(len(prime)):
    if now != prime[-i-1]:
        count = 0
        now = prime[-i-1]
    count += 1
    if count == N:
        res *= prime[-i-1]
        count = 0
print(int(res))

Solution (Python):
import math
if __name__ == "__main__":
    n, p = map(int, input().split())
    if n == 1:
        print(p)
    else:
        res = 1
        sup = math.ceil(p ** (1 / n))
        i = 2
        while(i <= sup and i <= p):
            if p % i == 0:
                k = 1
                p /= i
                while(p % i == 0):
                    p /= i
                    k += 1
                if k >= n:
                    for s in range(k // n):
                        res *= i
            i += 1
        print(res)

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

if n == 1 :
    print(p)
elif p == 1 :
    print(1)
elif n >= 40:
    print(1)
else:
    ans = 1
    count = 2
    tmp = count**n
    while (tmp) <= p:
        if(p % tmp == 0):
            ans *= count
            p = int(p/tmp)
            count -= 1
        count += 1
        tmp = count**n
    print(ans)

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

Solution (Python):
N,P = list(map(int,input().split()))
mylist = []
roop  = int((10**12)**(1/N))

def primes(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 [i for i in range(n + 1) if is_prime[i]]

flag = 0
tmp = 1
if N ==1:
    print(P)
else:
    Primelis = primes(roop)
    for i in Primelis:
        flag = 0
        tmp = 1
        while flag==0:
            if P%(i**N)==0:
                P = P/(i**N)
                tmp = tmp*i
            else:
                mylist.append(tmp)
                flag = 1
    ans = 1
    L = len(mylist)
    for i in range(L):
        ans = ans*mylist[i]
    print(ans)

Solution (Python):
import collections

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

N,P=map(int,input().split())
counter=collections.Counter(prime_decomposition(P))

ans=1
for i in counter.keys():
    life=counter[i]
    flag=True
    while flag:
        if(life>=N):
            life-=N
            ans*=i
        else:
            flag=False
            
print(ans)

Solution (Python):
def e(n,p):
  i = 2
  ans = 1
  if p == 1:
    return n
  else:
    while i * i <= n:
      b = 0
      while n % i == 0:
        n /= i
        b += 1
      else:
        ans *= i**(b//p)
      i += 1
    return ans
  
n,p = map(int, input().split())

a = e(p,n)
print(a)

Solution (Python):
import collections
n,p = map(int,input().split())
ans = 1
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

c = collections.Counter(prime_factors(p))
for i in range(len(c.most_common())):
    if c.most_common()[i][1]>=n:
        ans *= int(c.most_common()[i][0]) ** (c.most_common()[i][1]//n)
print(ans)

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

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

fct = factorize(P)
fct.sort(key=lambda x:x[1], reverse=True)
res = 1
for el in fct:
    if el[1] >= N:
        res = res * el[0] ** (el[1] // N)

print(res)

Solution (Python):
def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors

N,p=map(int, input().split(" "))
tmp=prime_factors(p)

d={}
count=1

if N==1:
    print(p)
else:
    for i in tmp:
        if i in d:
            if d[i]==N-1:
                d[i]=0
                
                count*=i
            else:
                d[i]+=1
        else:
            d[i]=1
    print(count)

Solution (Python):
from math import sqrt
n, p = map(int, input().split())
a = []

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

for i in range(2, int(sqrt(p))+10):
    tmp = 0
    while p % i == 0:
        p //= i
        tmp += 1
    if tmp >= n:
        tmp //= n
        a.append(i**tmp)

ans = 1
for i in a:
    ans *= i

print(ans)

Solution (Python):
import collections
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
a = list(map(int,input().split()))

b = []
co = 0
su = 1
s = prime_decomposition(a[1])
c = collections.Counter(s)
ss = c.most_common()
i = 0
for i in range(len(ss)):
    if ss[i][1] >= a[0]:
        su *= int(ss[i][0])**(ss[i][1]//a[0])

print(su)

Solution (Python):
n,p=map(int,input().split())
l=[]
if n>41:
  print(1)
else:
  x=int(p**(1/n))
  for i in range(x+1,0,-1):
    if p%(i**n)==0:
      print(i)
      break

Solution (Python):
n, p=map(int,input().split())
ans = 0
if n != 1:
    for i in range(1,int((p+1)**(1/n))+1):
        ni = i**n
        if p/ni >= 1 and p/ni == int(p/ni):
            ans = i
        elif p/ni < 1:
            break
    print(ans)
else:
    print(p)

Solution (Python):
from collections import Counter

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

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

facs = prime_decomposition(P)
facc = Counter(facs)

common = 1
for fac in facc.keys():
    count = facc[fac]
    while count >= N:
        common = common*fac
        count -= N

print(int(common))

Solution (Python):
n, p = 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

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

prime = prime_factor(p)
dprime = {}
for i in set(prime):
    dprime[i] = 0
for i in prime:
    dprime[i] += 1
key = []
for k, v in sorted(dprime.items(), key=lambda x:-x[0]):
    if v >= n:
        for i in range(int(v//n)):
            key.append(k)
res = 1
for i in key:
    res *= i
print(res)

Solution (Python):
n,p=map(int,input().split())
ans=1
flag=0
if n==1:
  print(p)
  flag+=1
def prime_factors(p):
    i = 2
    factors = []
    while i * i <= p:
        if p % i:
            i += 1
        else:
            p //= i
            factors.append(i)
    if n > 1:
        factors.append(p)
    return factors
primelist=prime_factors(p)
set=list(set(primelist))
for i in set:
    if primelist.count(i)//n>=1:
      ans=ans*(i**(primelist.count(i)//n))
    else:
      pass
if flag==0:
  print(ans)

Solution (Python):


from collections import defaultdict
from math import sqrt


def fact_prime(num):
    d = defaultdict(int)
    
    end = int(sqrt(num)) + 1
    for i in range(2, end+1):
        cnt = 0
        
        while num % i == 0:
            num //= i
            d[i] += 1
        
        if num == 1:
            break
    
    if num != 1:
        d[num] += 1
    return d

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

if N == 1:
    print(P)
    exit()
l = sorted(fact_prime(P).items(), reverse=True)
ans = 1
for k, v in l:
    if v >= N:
        ans *= k ** (v // N)
print(ans)

Solution (Python):

"""
Created on Sat Dec 22 18:21:55 2018
CADDi2018C
@author: maezawa
""" 
import collections

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

if n == 1:
    ans = p
else:
    np = int(p**(1/n))
    
    
    is_prime = [True]*(np+1)

    is_prime[0] = False
    is_prime[1] = False

    for i in range(2, np//2+1): 
        if is_prime[i] == True:
            for j in range(2*i,np+1,i):
                is_prime[j] = False
    
    prime_numbers = [i for i in range(np+1) if is_prime[i]]

    
    num = p 
    
    
    facts = [] 
    for prime in prime_numbers:
        if prime > num//2:
            break
        dnum = num
        while dnum%prime == 0: 
            facts.append(prime)
            dnum = dnum//prime
    
    mul = 1
    for i in facts:
        mul *= i
    if mul != num: 
        facts.append(num//mul) 
    
    pfs = collections.Counter(facts)
    mostcommon = pfs.most_common()
    ans = 1
    for i, j in mostcommon:
        if j < n:
            break
        m = j // n
        ans *= i**m

print(ans)

Solution (Python):
import math
n, p = map(int, input().split())
gcd = 1
f = 2
upper = math.floor(math.pow(p, 1/n))

if n == 1:
  gcd = p
else:
  while True:
    if f > upper:
      break
    fn = f**n
    while p%fn == 0:
      gcd *= f
      p /= fn
    if f == 2:
      f = 3
    else:
      f += 2

print(gcd)

Solution (Python):
def main():
    n, p = map(int, input().split())
    x = 1

    for f, c in get_prime_factors(p):
        if c >= n:
            x *= f ** (c // n)

    print(x)

def get_prime_factors(p):
    f = 2

    while f * f <= p:
        c = 0
        while True:
            m, r = divmod(p, f)
            if r != 0:
                break
            c += 1
            p = m

        if c != 0:
            yield f, c

        f += 1

    if p != 1:
        yield p, 1

main()

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

root=P**(1/N)
x=round(root)

for i in range(x):
	if P%((x-i)**N)==0:
		print(x-i)
		break

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


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

Solution (Python):
from collections import defaultdict
import math
import sys
N,P=[int(x) for x in input().split()]
if N==1:
    print(P)
    sys.exit(0)
now = P
d = defaultdict(int)
 
for i in range(2,int(math.sqrt(P))+1):
    while  now%i==0:
        now /= i
        d[i]+=1
ans=1
for k in d:
    if d[k] // N > 0:
        ans *= (k ** (d[k] // N))
print(ans)

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

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