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



Sample input:
3 24


Sample output:
2

Submission status: Runtime Error

Solution code:
#!/mnt/c/Users/moiki/bash/env/bin/python
N,P = list(map(int, input().split()))
import math


def get_prime(n):
    """ Returns  a list of primes < n """
    sieve = [True] * n
    for i in range(3,int(n**0.5)+1,2):
        if sieve[i]:
            sieve[i*i::2*i]=[False]*((n-i*i-1)//(2*i)+1)
    return [2] + [i for i in range(3,n,2) if sieve[i]]

primax = int(1e7) + 9 * int(1e6)
primes = get_prime(primax)




def df(P, p):
    if P >= p:
        cnt = 0
        while P >= p and P % p == 0:
            P = int(P//p)
            cnt += 1
        return cnt
    else:
        raise "P , p error."

gc = []
for p in primes:
    if P % p == 0:
        cnt = df(P, p)
        P = int( P // int(p**cnt))
        gc.append([p, cnt])
ans = 1
for g,cnt in gc:
    if cnt >= N:
        ans *= g**(cnt//N)

debug = 1
for g,cnt in gc:
    debug *= g**cnt

# N > 100: 
if P > 1e9 and debug != P and debug < P:
    raise "errror"
print(ans)

Submission status: Runtime Error

Solution code:
N, P = [int(i) for i in input().strip().split()]
dic={}

for i in range(2,int(P**(1/2))+1):
    num = 0
    while P%i == 0:
        num = num +1
        P = P/i
    dic[i] = num
    
for i in dic:
    for j in dic:
        if i < j:
            if j%i == 0:
                del dic[j]
                
ans = 1
for i in dic:
    if N == 1:
        ans = P
        break
    elif dic[i] != 0:
        ans = ans*(i**(dic[i]//N))
print(ans)

Submission status: Runtime Error

Solution code:
#!/mnt/c/Users/moiki/bash/env/bin/python
N,P = list(map(int, input().split()))
import math


def get_prime(n):
    """ Returns  a list of primes < n """
    sieve = [True] * n
    for i in range(3,int(n**0.5)+1,2):
        if sieve[i]:
            sieve[i*i::2*i]=[False]*((n-i*i-1)//(2*i)+1)
    return [2] + [i for i in range(3,n,2) if sieve[i]]

primax = int(1e7) + 9 * int(1e6)
primes = get_prime(primax)




def df(P, p):
    if P >= p:
        cnt = 0
        while P >= p and P % p == 0:
            P = int(P//p)
            cnt += 1
        return cnt
    else:
        raise "P , p error."

gc = []
for p in primes:
    if P % p == 0:
        cnt = df(P, p)
        P = int( P // int(p**cnt))
        gc.append([p, cnt])
ans = 1
for g,cnt in gc:
    if cnt >= N:
        ans *= g**(cnt//N)

debug = 1
for g,cnt in gc:
    debug *= g**cnt

if P > 1e9 and debug != P and N > 100:
    raise "errror"
print(ans)

Submission status: Runtime Error

Solution code:
import numpy as np
import itertools
N, P = map(int, input().split())

#約数列挙
yakusu = []
for i in range(1, int(np.sqrt(P))+1):
    if P % i == 0:
        yakusu.append(i)
        yakusu.append(int(P/i))
# print("yakusu", sorted(yakusu)[-1::-1])

# 最大公約数はyakusuの中のいずれか.
for y in sorted(yakusu):
    if y == 1:
        best=1
        continue
    
    kouho = np.arange(y, P+1, y)
    if len(kouho) < N:
        continue

    if y**N > P:
        continue
        
    for lis in list(itertools.combinations_with_replacement(kouho, N)):
        if np.prod(lis) == P:
            best = y
            break
        elif np.prod(lis) > P:
            break
print(best)

Submission status: Runtime Error

Solution code:
a = 2
c = 1
m = p**(1/n)
while a<=m:
    b = a**n
    if p%b == 0:
        c *= a
        p //= b
        if b>p:
            break
        while p%b == 0:
            c *= a
            p //= b
        a += 1
        if b>p:
            break
    else:
        a += 1
print(c)

Submission status: Runtime Error

Solution code:
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

M = prime_decomposition(P)
            
c = Counter(M)
temp = [i[0] for i in c.items() if i[1] >= N]
if temp == []:
  temp.append(1)
print(int(reduce(lambda x,y:x*y,temp)))

Submission status: Runtime Error

Solution code:
N, P = (int(i) for i in input().split())
[x for x in range(2,int(pow(P, 1/N))+1) if P%(x**N)==0][-1]

Submission status: Runtime Error

Solution code:
N, P = [int(i) for i in input().strip().split()]
dic={}

for i in range(2,int(P**(1/2))+1):
    num = 0
    while P%i == 0:
        num = num +1
        P = P/i
    dic[i] = num
    
for i in range(dic):
    for j in range(dic):
        if i < j:
            if j%i == 0:
                del dic[j]
                
ans = 1
for i in dic:
    if N == 1:
        ans = P
        break
    elif dic[i] != 0:
        ans = ans*(i**(dic[i]//N))
print(ans)

Submission status: Runtime Error

Solution code:
from sys import stdin
N,P=[int(x) for x in stdin.readline().rstrip().split()]
for i in reversed(range(int(pow(P,(1/N))))+1):
    tmp=i**N
    if P==1:
        ans=1
        break
    if N==1:
        ans=P
        break
    if P%tmp==0:
        ans=i
        break
print(ans)

Submission status: Runtime Error

Solution code:
#!/mnt/c/Users/moiki/bash/env/bin/python
N,P = list(map(int, input().split()))
import math


def get_prime(n):
    """ Returns  a list of primes < n """
    sieve = [True] * n
    for i in range(3,int(n**0.5)+1,2):
        if sieve[i]:
            sieve[i*i::2*i]=[False]*((n-i*i-1)//(2*i)+1)
    return [2] + [i for i in range(3,n,2) if sieve[i]]

primax = int(1e7) + 9 * int(1e6)
primes = get_prime(primax)




def df(P, p):
    if P >= p:
        cnt = 0
        while P >= p and P % p == 0:
            P = int(P//p)
            cnt += 1
        return cnt
    else:
        raise "P , p error."

gc = []
for p in primes:
    if P % p == 0:
        cnt = df(P, p)
        P = int( P // int(p**cnt))
        gc.append([p, cnt])
ans = 1
for g,cnt in gc:
    if cnt >= N:
        ans *= g**(cnt//N)

debug = 1
for g,cnt in gc:
    debug *= g**cnt

if P > 1e9 and debug != P:
    raise "errror"
print(ans)

Submission status: Runtime Error

Solution code:
#!/mnt/c/Users/moiki/bash/env/bin/python
N,P = list(map(int, input().split()))
import math


def get_prime(n):
    """ Returns  a list of primes < n """
    sieve = [True] * n
    for i in range(3,int(n**0.5)+1,2):
        if sieve[i]:
            sieve[i*i::2*i]=[False]*((n-i*i-1)//(2*i)+1)
    return [2] + [i for i in range(3,n,2) if sieve[i]]

primax = int(1e7) + 9 * int(1e6)
primes = get_prime(primax)

if P > 1e9:
    raise "errror"


def df(P, p):
    if P >= p:
        cnt = 0
        while P >= p and P % p == 0:
            P = int(P//p)
            cnt += 1
        return cnt
    else:
        raise "P , p error."

gc = []
for p in primes:
    if P % p == 0:
        cnt = df(P, p)
        P = int( P // int(p**cnt))
        gc.append([p, cnt])
ans = 1
for g,cnt in gc:
    if cnt >= N:
        ans *= g**(cnt//N)

print(ans)

Submission status: Runtime Error

Solution code:
import math
import sys

n,p=map(int,input().split())
a=math.sqrt(P)

def C(N,P):
    if N == 1: return P

    if N >= 4 :
        a=math.sqrt(a)
    if N >= 8 :
        a=math.sqrt(a)
    if N >= 16 :
        a=math.sqrt(a)
    if N >= 32 :
        a=math.sqrt(a)
    if N >= 64 :
        a=math.sqrt(a)
    if N >= 128 :
        a=math.sqrt(a)
    if N >= 256 :
        a=math.sqrt(a)
    if N >= 512 :
        a=math.sqrt(a)
    if N >= 1024 :
        a=math.sqrt(a)
    if N >= 2048 :
        a=math.sqrt(a)
    
    res=1

    for i in range(1,int(a)+2):
        if P % i**N: continue
        res = i
        
    return res

print(C(n,p))

Submission status: Runtime Error

Solution code:
import numpy as np
from random import shuffle
from itertools import permutations

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

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 np.array(factors)

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

ni = prime_factors(p)

if n == 1:
    print(p)
elif p == 1:
    print(1)
else:
    ni = prime_factors(p)
    max_gcd = 0
    for i in range(len(ni)):
        shuffle(ni)
        array_list = list(np.array_split(np.roll(ni, i), n))
        prod_list = [np.prod(i) for i in array_list]
        g = prod_list[0]
        for p in prod_list[1:]:
            g = gcd(g, p)
            #print(g)
        if g > max_gcd:
            max_gcd = g
    print(max_gcd)

Submission status: Runtime Error

Solution code:
n,p = map(int,input().split())
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]]
a = primes(int(p**(1/n)))
res = 1
for j in range(len(a)):
 q = p
 if q%(a[j]**n) == 0:
  c = 0
  while q%(a[j]**n) == 0:
   q /= (a[j]**n)
   c += 1
  res *= a[j]**c
print(res)

Submission status: Runtime Error

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

a = int(pow(P, 1/N))
for i in range(a):
  if i > 0 and P % pow(i,N) == 0:
     b = i

print(b)

Submission status: Runtime Error

Solution code:
a,b=map(int ,input().split())
x=int(pow(b,1/a))
x+=1
while x>=1:
    if b%(pow(x,a))==0:
        print(x)
        exit()
    x-=1

Submission status: Runtime Error

Solution code:
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

M = prime_decomposition(P)
            
c = Counter(M)
temp = [i[0] for i in c.items() if i[1] >= N]
if temp == []:
  temp.append(1)
print(reduce(lambda x,y:x*y,temp))

Submission status: Runtime Error

Solution code:

import collections

def get_lim(n):
    for i in range(n):
        if i * i > n:
            return i + 1

def prime_factor(n, length):
    ass = collections.defaultdict(int)
    # break_num = pow()
    # for i in range(2,int(n**0.5)+1):
    lim = get_lim(n)
    for i in range(2, lim):
        # print(pow(i, length),  n)
        # if pow(i, length) > n:
        #     break
        if i > n or n == 1:
            break
        # i = pow(i, num)
        while n % i==0:
            ass[i] += 1
            n = n//i

    if n != 1:
        ass[n] += 1
    return ass

if __name__ == '__main__':
    length, num = list(map(int, input().split()))

    if length == 1:
        print(num)
    else:

        soinnsuu = prime_factor(num, length)
        ans = 1
        # print(soinnsuu)
        for data in soinnsuu.keys():
            if soinnsuu[data] >= length:
               ans *= data
        print(ans)

Submission status: Runtime Error

Solution code:
N,P = map(int,input().split(" "))
n = pow(P,(1/N))
ans = 1
for i in range(n):
    noli = pow((i+2),N)
    if P%noli == 0:
        ans = (i+2)
print(ans)

Submission status: Runtime Error

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

a = int(pow(P, 1/N))
for i in range(a):
  if i > 0:
    c = pow(i,N)
    if P%c == 0:
      b = i

print(b)

Submission status: Runtime Error

Solution code:
np = input().split(" ")
n = int(np[0])
p = int(np[1])

elem_list = []

def search(n, p, elem_list, i):
  elem = i ** n
  while elem <= p:
    elem = i ** n
    if p % elem == 0:
      elem_list.append(elem)
      return search(n, int(p / elem), elem_list, i + 1)
    i += 1
  return elem_list

if n == 1:
  print(p)
elif p == 1:
  print(1)
elif n > p:
  print(1)
else:
  import functools
  import operator
  elem_list = search(n, p, elem_list, 2)
  result = int(functools.reduce(operator.mul, elem_list) ** (1/n))
  print(result)

Submission status: Runtime Error

Solution code:
from sys import stdin
N,P=[int(x) for x in stdin.readline().rstrip().split()]
for i in reversed(range(int(pow(P,(1/N))))):
    tmp=i**N
    if P==1:
        ans=1
        break
    if N==1:
        ans=P
        break
    if P%tmp==0:
        ans=i
        break
print(ans)

Submission status: Runtime Error

Solution code:
N,P = map(int,input().split(" "))
n = P**(1/N)
ans = 1
for i in range(n):
    noli = (i+2)**(N)
    if P%noli == 0:
        ans = (i+2)
print(ans)

Submission status: Runtime Error

Solution code:
import numpy as np

def seachPrimeNum(N):
    max = int(np.sqrt(N))
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    while seachList[0] <= max:
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum



N, P = map(int, input().split(' '))
if N == 1:
    print(P)
    exit()
elif P < 2**N:
    print(1)
    exit()

ans = 1
t = 2
while t**N < P:
    t += 1
a = seachPrimeNum(t-1)
a_N = [a[i] ** N for i in range(len(a))]
for i in range(len(a_N)):
    if P % a_N[i] == 0:
        temp = P // a_N[i]
        count = 1
        while temp % a_N[i] == 0:
            count += 1
            temp = temp // a_N[i]
        ans *= a[i]**count

    elif a_N[i] > P:
        break
print(ans)

Submission status: Runtime Error

Solution code:
from sys import stdin
N,P=[int(x) for x in stdin.readline().rstrip().split()]
for i in reversed(range(int(pow(P,(1/N))))):
    if P==1:
        ans=1
        break
    if N==1:
        ans=P
        break
    if P%i==0:
        ans=i
        break:
print(ans)

Submission status: Runtime Error

Solution code:
from sys import stdin
N,P=[int(x) for x in stdin.readline().rstrip().split()]
for i in reversed(range(int(pow(P,(1/N))+1))):
    if P==1:
        ans=1
        break
    if N==1:
        ans=P
        break
    if P%i==0:
        ans=i
        break:
print(ans)

Submission status: Runtime Error

Solution code:
from sys import stdin
N,P=[int(x) for x in stdin.readline().rstrip().split()]
for i in reversed(range(int(pow(P,(1/N)))+1)):
    if P==1:
        ans=1
        break
    if N==1:
        ans=P
        break
    if P%i==0:
        ans=i
        break:
print(ans)

Submission status: Runtime Error

Solution code:
n,p = map(int,input().split())
li = []

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

def search(now,N):
    if N == 1:
        return None
    if N//now != N/now:
        now += 1
        search(now,N)
    else:
        li.append(now)
        N = N//now
        search(now,N)

search(2,p)
#print(li)

fi = set(li)
#print(fi)

result = 1
for i in fi:
    if li.count(i) >= n:
        result *= i
else:
    #if result
    print(result)

Submission status: Runtime Error

Solution code:
n,p=[int(i) for i in input().split()]
i=2
ans=1
while p!=1 and i*i<=p:
    list1.append([i,0])
    count=0
    while 1:
        if p%i==0:
            count+=1
            if count==n:
                count=0
                ans=ans*i
            p=p/i
        else:
            break
    i+=1
print(ans)

Submission status: Runtime Error

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



def yakusuSub(p,d,arr):
    if p==1:return arr
    if p/d==int(p/d):
        arr.append(d)
        return yakusuSub(p/d,d,arr)
    else:
        return yakusuSub(p,d+1,arr)

def yakusu(p):
    return yakusuSub(p,2,[])

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

y=yakusu(p)
ans=1
ys=set(y)
for i in ys:
    if y.count(i)>=n:
        ans*=i
print(ans)

Submission status: Runtime Error

Solution code:
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 []

    # 0のものは素数じゃないとする
    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 # 1は素数ではない
    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=[]
    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)
    result = functools.reduce(operator.mul, plsit2)
    print(result)

Submission status: Runtime Error

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


def cal(x):
    if P % (x ** N) == 0:
        return x
    else:
        return cal(x-1)


print(cal(int(math.pow(P, 1/ N))+1))

Submission status: Runtime Error

Solution code:
import fractions
from functools import reduce

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

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

root = int(P**(1/N))

while P % root != 0:
    root += 1

fac1 = root

fac_list = []

for i in range(N - 1):
    while P % fac1 != 0:
        if P > fac1:
            fac1 += 1
        else:
            fac -= 1
    P /= fac1
    fac_list.append(fac1)

fac_list.append(int(P))

#print(fac_list)

print(int(gcd_list(fac_list)))

Submission status: Runtime Error

Solution code:
n,p = list(map(int, input().strip().split(' ')))
max_n = 1
for i in range(1,10000):
  if i**n > p:
    break
  max_n = i
numlist = list(range(max_n))
for i in numlist[::-1]:
  if p % i**n == 0:
    print(i)
    break

Submission status: Runtime Error

Solution code:
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 []

    # 0のものは素数じゃないとする
    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 # 1は素数ではない
    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=[]
    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)
result = functools.reduce(operator.mul, plsit2)
print(result)

Submission status: Runtime Error

Solution code:
#!/mnt/c/Users/moiki/bash/env/bin/python
N,P = list(map(int, input().split()))
import math


if P == 1:
    print(1)
    exit(0)
def get_prime(n):
    """ Returns  a list of primes < n """
    sieve = [True] * n
    for i in range(3,int(n**0.5)+1,2):
        if sieve[i]:
            sieve[i*i::2*i]=[False]*((n-i*i-1)//(2*i)+1)
    return [2] + [i for i in range(3,n,2) if sieve[i] and  i >= int(math.sqrt(P)+1)]

primax = 1 #int(1e7) + 9 * int(1e6) + 9 * int(1e5) + 9 * int(1e4)
while primax < (P//N):
    primax *= 10

primax += 1000
primax = int(primax)
primes = get_prime(primax)
# print(primes)


def df(P, p):
    if P >= p:
        cnt = 0
        while P >= p and P % p == 0:
            P = int(P//p)
            cnt += 1
        return cnt
    else:
        raise "P , p error."

gc = []
for p in primes:
    if P % p == 0:
        cnt = df(P, p)
        P = int( P // int(p**cnt))
        gc.append([p, cnt])

ans = 1
for g,cnt in gc:
    if cnt >= N:
        ans *= g**(cnt//N)

print(ans)

Submission status: Runtime Error

Solution code:
#!/mnt/c/Users/moiki/bash/env/bin/python
N,P = list(map(int, input().split()))
import math


if P == 1:
    print(1)
    exit(0)
def get_prime(n):
    """ Returns  a list of primes < n """
    sieve = [True] * n
    for i in range(3,int(n**0.5)+1,2):
        if sieve[i]:
            sieve[i*i::2*i]=[False]*((n-i*i-1)//(2*i)+1)
    return [2] + [i for i in range(3,n,2) if sieve[i] and  i >= int(math.sqrt(P)+1)]

primax = 1 #int(1e7) + 9 * int(1e6) + 9 * int(1e5) + 9 * int(1e4)
while primax < (P/N):
    primax *= 10

primax += 1000
primes = get_prime(primax)
# print(primes)


def df(P, p):
    if P >= p:
        cnt = 0
        while P >= p and P % p == 0:
            P = int(P//p)
            cnt += 1
        return cnt
    else:
        raise "P , p error."

gc = []
for p in primes:
    if P % p == 0:
        cnt = df(P, p)
        P = int( P // int(p**cnt))
        gc.append([p, cnt])

ans = 1
for g,cnt in gc:
    if cnt >= N:
        ans *= g**(cnt//N)

print(ans)

Submission status: Runtime Error

Solution code:
#!/mnt/c/Users/moiki/bash/env/bin/python
N,P = list(map(int, input().split()))
import math


if P == 1:
    print(1)
    exit(0)
def get_prime(n):
    """ Returns  a list of primes < n """
    sieve = [True] * n
    for i in range(3,int(n**0.5)+1,2):
        if sieve[i]:
            sieve[i*i::2*i]=[False]*((n-i*i-1)//(2*i)+1)
    return [2] + [i for i in range(3,n,2) if sieve[i] and  i >= int(math.sqrt(P)+1)]

primax = 1 #int(1e7) + 9 * int(1e6) + 9 * int(1e5) + 9 * int(1e4)
while primax < (P/N):
    primax *= 10
primes = get_prime(primax)
# print(primes)


def df(P, p):
    if P >= p:
        cnt = 0
        while P >= p and P % p == 0:
            P = int(P//p)
            cnt += 1
        return cnt
    else:
        raise "P , p error."

gc = []
for p in primes:
    if P % p == 0:
        cnt = df(P, p)
        P = int( P // int(p**cnt))
        gc.append([p, cnt])

ans = 1
for g,cnt in gc:
    if cnt >= N:
        ans *= g**(cnt//N)

print(ans)

Submission status: Runtime Error

Solution code:
N, P = map(int, input().split())
cnt = int(P**(1/(N-1)))

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

else:
    for i in range(1, cnt):
#         print(i)
        a = P/(i**N)
        if a.is_integer():
            ans = i
#             print(ans)
        else:
            continue
    print(int(ans))

Submission status: Runtime Error

Solution code:
n,p = list(map(int, input().strip().split(' ')))
max_n = 0
for i in range(10000):
  if i**n > p:
    break
  max_n = i
numlist = list(range(max_n))
for i in numlist[::-1]:
  if p % i**n == 0:
    print(i)
    break

Submission status: Runtime Error

Solution code:
N, P = [int(i) for i in input().strip().split()]
dic={}

for i in range(2,int(P**(1/2))+1):
    num = 0
    while P%i == 0:
        num = num +1
        P = P/i
    dic[i] = num
    
ans = 1
for i in dic:
    if dic[i] != 0:
        ans = ans*(i**(dic[i]//N))
if N = 1:
    ans = P
print(ans)

Submission status: Runtime Error

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

def cal(x):
    if P % (x ** N) == 0:
        return x
    return cal(x-1)

print(cal(int(math.pow(P, 1/ N))+1))

Submission status: Runtime Error

Solution code:
import fractions
from functools import reduce

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

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

root = int(P**(1/N))

while P % root != 0:
    root += 1

fac1 = root

fac_list = [fac1]

for i in range(N - 1):
    while P % fac1 != 0:
        if P > fac1:
            fac1 += 1
        else:
            fac -= 1
    P /= fac1
    fac_list.append(fac1)

fac_list.append(int(P))

#print(fac_list)

print(int(gcd_list(fac_list)))

Submission status: Runtime Error

Solution code:
n, p = list(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

fact = prime_factors(p)
if len(fact) <= 1:
    print(1)
    exit(1)
i = 0
while 1:
    if len(fact) == n:
        break
    if i >= len(fact):
        i = 0
    fact[i] = fact[i]*fact[-1]
    fact.pop()
    i += 1
print(min(fact))

Submission status: Runtime Error

Solution code:
from sys import stdin
N,P=[int(x) for x in stdin.readline().rstrip().split()]
for i in reversed(range(int(pow(P,(1/N)))+1)):
    tmp=i**N
    if P==1:
        ans=1
        break
    if N==1:
        ans=P
        break
    if P%tmp==0:
        ans=i
        break:
print(ans)

Submission status: Runtime Error

Solution code:
import math
N, P = map(int, input().split())
if N == 1:
	print(P)
elif N > math.log2(P):
	print(1)
else:
	ans = 1
	x = int(P ** (1.0 / (N * 1.0)))
	for i in range(2, x + 1):
		if P % (i ** N) == 0:
			ans = i
	print(ans)

Submission status: Runtime Error

Solution code:
N, P = map(int, input().split())
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]
print(int(res))

Submission status: Runtime Error

Solution code:
n,p=[int(i) for i in input().split()]
i=2
ans=1
while p!=1:
    list1.append([i,0])
    count=0
    while 1:
        if p%i==0:
            count+=1
            if count==n:
                count=0
                ans=ans*i
            p=p/i
        else:
            break
    i+=1
print(ans)

Submission status: Runtime Error

Solution code:
def prime_factor(n):
    ass = collections.defaultdict(int)
    for i in range(2,int(n**0.5)+1):
        while n % i==0:
            # ass.append(i)
            ass[i] += 1
            n = n//i
    if n != 1:
        ass[n] += 1
    return ass

if __name__ == '__main__':

    # make_seed(num)
    # prime = Prime()
    # soinnsuu = prime.find_factors(num)
    soinnsuu = prime_factor(num)
    ans = 1
    # print(soinnsuu)
    for data in soinnsuu.keys():
        if soinnsuu[data] >= length:
           ans *= data
        # if soinnsuu[data] >= length:
        # ans *= data
    print(ans)

Submission status: Runtime Error

Solution code:
n,p = map(int,input().split())
ans = 1
c = [0] * (p+1)
for i in range(2,p+1):
 while p % i == 0:
  p //= i
  c[i] += 1
for i in range(p+1):
 if c[i] > 0 and c[i] % n == 0:
   ans *= i // n
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
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 False
    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():
        if value >= N:
            cnt *= key

    print(cnt)

Submission status: Runtime Error

Solution code:
n, p = list(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

if p == 1:
    print(p)
    exit(1)
fact = prime_factors(p)
i = 0
while 1:
    if len(fact) == n:
        break
    if i >= len(fact):
        i = 0
    fact[i] = fact[i]*fact[-1]
    fact.pop()
    i += 1
print(min(fact))

Submission status: Runtime Error

Solution code:
import sympy

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

list = sympy.factorint(p)

# print(list)

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

print(ans)

Submission status: Runtime Error

Solution code:
from sys import stdin
N,P=[int(x) for x in stdin.readline().rstrip().split()]
for i in reversed(range(int(pow(P,(1/N))))):
    tmp=i**4
    if P==1:
        ans=1
        break
    if N==1:
        ans=P
        break
    if P%tmp==0:
        ans=i
        break
print(ans)

Submission status: Runtime Error

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

a=2**N
p=[i for i in range(2,P+1)]
seek=1

while a<=P:
    if P%a==0:
        seek=p[1]
        p.remove(seek)
    else:
       p=[e for e in p if e%a!=0]

    i=p[1]
    a=i**N

print(seek)

Submission status: Runtime Error

Solution code:
n,p = map(int,input().split())
li = []

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

def search(now,N):
    if N == 1:
        return
    if N//now != N/now:
        now += 1
        search(now,N)
    else:
        li.append(now)
        N = N//now
        search(now,N)

search(2,p)
#print(li)

fi = set(li)
#print(fi)

result = 1
for i in fi:
    if li.count(i) >= n:
        result *= i
else:
    print(result)

Submission status: Runtime Error

Solution code:
from functools import reduce
from collections import Counter
N,P = map(int,input().split())
import math
s=0
R=int(P)
L=[]
while s==0:
    for i in range(2,R+1):
        if P%i==0:
            P=P/i
            if P==1:
                s=1
            L.append(i)
            break

            
c = Counter(L)
temp = [i[0] for i in c.items() if i[1] >= N]
print(reduce(lambda x,y:x*y,temp))