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: Time Limit Exceeded

Solution code:
n,p = map(int,input().split())
flist = []
pp = p
ans = 1
if p == 1:
  print(1)
elif n == 1:
  print(p)
else:
  for i in range(2,p//2):
    while pp % i == 0:
      flist.append(i)
      pp = pp / i
  for i in range(2,p//2):
    if flist.count(i) >= n:
      ans = ans * i**(flist.count(i)//n)
  print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import collections

n, p = [int(i) for i in input().split()]
d = collections.defaultdict(lambda: 0)

def bunkai(q):
	if q == 1:
		return 0
	for i in range(2,p):
		if q % i == 0:
			d[i] += 1
			return bunkai(q//i)

if n == 1 or p == 1:
	print(p)
else:
	bunkai(p)
	ans = 1

	for j in d.keys():
		k = d[j]
		if k // n >= 1:
			ans *= j**(k//n)
	print(ans)

Submission status: Time Limit Exceeded

Solution code:
n,p = map(int,input().split())
m=int(pow(p,1/n))
m+=1

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

Submission status: Time Limit Exceeded

Solution code:
n,p = map(int,input().split())
m=int(pow(p,1/n))
m+=1

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

Submission status: Time Limit Exceeded

Solution code:
import math

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


m=int(math.pow(p,1/n)+1)

s = 1

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

print(s)

Submission status: Time Limit Exceeded

Solution code:
N,P = map(int,input().split())
ans=1
if N==1:
  print(P)
  exit()
elif P==1|N>=40:
  print(1)
  exit()
else:
  i=1
  while i<=P**(1/N):
    count = 0
    while P%i==0:
      P=P//i
      count+=1
    cn=count//N
    ans*=i**cn
    if i==2|i==1:
      i+=1
    else:
      i+=2
print(int(ans))
exit()

Submission status: Time Limit Exceeded

Solution code:
N,P = map(int,input().split())
ans=1
if N==1:
  print(P)
  exit()
elif P==1|N>=40:
  print(1)
  exit()
else:
  i=1
  while i<=P**(1/N):
    count = 0
    while P%i==0:
      P=P//i
      count+=1
    cn=count//N
    ans*=i**cn
    if i==2:
      i+=1
    else:
      i+=2
print(int(ans))
exit()

Submission status: Time Limit Exceeded

Solution code:
N,P = map(int,input().split())
i = round(P**(1/N))
j = 2
res = 1
if N == 1:
  print(P)
  exit()
elif P == 1|N>=40:
  print(1)
  exit()
else:
  while P%(j**N)==0:
    P = P//(j**N)
    res *= j
  j += 1
  if N >= 26:
    print(res)
    exit()
  while P%(j**N) == 0:
    P = P//(j**N)
    res *= j
  j += 2
  if N >= 18:
    print(res)
    exit()
  while P%(j**N) == 0:
    P = P//(j**N)
    res *= j
  j += 2
  if N >= 15:
    print(res)
    exit()
    
  for f in range(j,i+1,2):
    while P%(f**N) == 0:
      P = P//(f**N)
      res *= f
      
  print(res)
  exit()

Submission status: Time Limit Exceeded

Solution code:
N,P = map(int,input().split())
i = round(P**(1/N))
j = 2
res = 1
if N == 1:
  print(P)
  exit()
elif P == 1|N>=40:
  print(1)
  exit()
else:
  while P%(j**N)==0:
    P = P//(j**N)
    res *= j
  j += 1
  if N >= 26:
    print(res)
    exit()
  for f in range(j,i+1,2):
    while P%(f**N) == 0:
      P = P//(f**N)
      res *= f
      
  print(res)
  exit()

Submission status: Time Limit Exceeded

Solution code:
N,P = map(int,input().split())
i = round(P**(1/N))
j = 2
res = 1
if N == 1:
  print(P)
  exit()
elif P == 1|N>=40:
  print(1)
  exit()
else:
  while P%(j**N)==0:
    P = P//(j**N)
    res *= j
  j += 1
  for f in range(j,i+1,2):
    while P%(f**N) == 0:
      P = P//(f**N)
      res *= f
      
  print(res)
  exit()

Submission status: Time Limit Exceeded

Solution code:
N,P = map(int,input().split())
i = round(P**(1/N))
j = 2
res = 1
if N == 1:
  print(P)
elif P == 1|N>=40:
  print(1)
else:
  while P%(j**N)==0:
    P = P//(j**N)
    res *= j
  j += 1
  for f in range(j,i+1,2):
    while P%(f**N) == 0:
      P = P//(f**N)
      res *= f
      
  print(res)

Submission status: Time Limit Exceeded

Solution code:
import functools
import operator

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

i = 2
res = []
if N == 1:
  print(P)
elif P == 1:
  print(1)
else:
  while i <= P**1/N:
    while P % i**N == 0:
      P /= i**N
      res.append(i)
    else:
      if i == 2:
        i += 1
      else:
        i += 2
  res.append(1)
  result = functools.reduce(operator.mul, res)
  print(result)
  exit()

Submission status: Time Limit Exceeded

Solution code:
from itertools import accumulate

N,P = map(int,input().split())
i = 2
res = []
while P>=i**N:
  if P % i ** N == 0:
    P /= i**N
    res.append(i)
    i += 1
  
res = list(accumulate(res))
if res == []:
  res.append(1)
print(res[-1])

Submission status: Time Limit Exceeded

Solution code:
n,p = list(map(int,input().split()))
ans = 1
base = 2
while(True):
  if base**n > p:
    break
  if p % base**n == 0:
    ans = base
  base += 1
print(ans)

Submission status: Time Limit Exceeded

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

if p == 1:
    print(1)
elif n == 1:
    print(p)
else:
    g = 1
    r = 1
    while g**n <= p:
        if p%(g**n) == 0:
            r = g
        g += 1
    print(r)

Submission status: Time Limit Exceeded

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

if p == 1:
    print(1)
else:
    g = 1
    r = 1
    while g**n <= p:
        if p%(g**n) == 0:
            r = g
        g += 1
    print(r)

Submission status: Time Limit Exceeded

Solution code:
from math import sqrt

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

num = 2
count = 0
limit = sqrt(P)

while P > 1 and limit >= sqrt(num):
    if P % num == 0:
        count += 1
        if count == N:
            ans *= num
            count = 0
        P //= num
    else:
        num += 1
        count = 0

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
 
n,p=map(int,input().split())
 
def C(N,P):
    if N == 1: return P
    
    a=math.ceil((P**(1/N)))+2
 
    res=1
    for i in range(2,a):
        if P % i**N == 0 : res = i
 
    return res
 
print(C(n,p))

Submission status: Time Limit Exceeded

Solution code:
import math
 
n,p=map(int,input().split())
 
def C(N,P):
    if N == 1: return P
    
    a=int(P**(1/(N-1)))+1
 
    res=1
    for i in range(2,a):
        if P % i**N == 0 : res = i
 
    return res
 
print(C(n,p))

Submission status: Time Limit Exceeded

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

def calc(n, p, x):
    return pow(p/float(x), 1/n)

for i in range(1, P+1):
    d = calc(N, P, i)
    if d.is_integer():
        print(int(d))
        break

Submission status: Time Limit Exceeded

Solution code:
n,p = (int(i) for i in input().split())
prime=[]
def prime_judge(p):
    isPrime=True
    for i in range(1,p):
        if p%i==0 and i!=1:
            isPrime = False
    return isPrime

if p>1:
    for i in range(2,p):
        if prime_judge(i):
            prime.append(i)

    i=0
    factor={}
    while(i<len(prime) and p>1):
        divided = False
        if p%prime[i]==0:
            p/=prime[i]
            divided = True
            if(prime[i] in factor.keys()):
                factor[prime[i]] += 1
            else:
                factor[prime[i]] = 1
        if not divided:
            i += 1

    sum = 1
    for i,x in factor.items():
        if x>=n:
            sum *= i**(int(x/n))
    print(int(sum))
else:
    print(1)

Submission status: Time Limit Exceeded

Solution code:
n,p = (int(i) for i in input().split())
prime=[]
def prime_judge(p):
    isPrime=True
    for i in range(1,p):
        if p%i==0 and i!=1:
            isPrime = False
    return isPrime

if p>1:
    for i in range(2,p):
        if prime_judge(i):
            prime.append(i)

    i=0
    factor={}
    while(i<len(prime) and p>1):
        divided = False
        if p%prime[i]==0:
            p/=prime[i]
            divided = True
            if(prime[i] in factor.keys()):
                factor[prime[i]] += 1
            else:
                factor[prime[i]] = 1
        if not divided:
            i += 1

    sum = 1
    for i,x in factor.items():
        if x%n==0:
            sum *= i**(x/n)
    print(int(sum))
else:
    print(1)

Submission status: Time Limit Exceeded

Solution code:
# _*_ coding:utf-8 _*_
#  CADDi2018 for Beginners C
#  https://atcoder.jp/contests/caddi2018b/tasks/caddi2018b_c

def getMaxGCD(count,product):
	maxPossibleInt = int(float(product)**(1.0/float(count)))
	checkGCDRange = range(maxPossibleInt+1,0,-1)
	maxGCD = maxPossibleInt+1
	for i in checkGCDRange:
		powNumber = i**count
		amari = product % powNumber
		if amari == 0:
			maxGCD = i
			print(maxGCD)
			exit(0)
	return maxGCD

if __name__ == '__main__':
	n , p  = map(int,input().strip().split(' '))
	if n == 1:
		print(p)
		exit(0)
	if p == 1:
		print(1)
		exit(0)
	solution=getMaxGCD(n,p)
	print('{}'.format(solution))

Submission status: Time Limit Exceeded

Solution code:
# _*_ coding:utf-8 _*_
#  CADDi2018 for Beginners C
#  https://atcoder.jp/contests/caddi2018b/tasks/caddi2018b_c

def getMaxGCD(count,product):
	maxPossibleInt = int(float(product)**(1.0/float(count)))
	checkGCDRange = range(maxPossibleInt+1,0,-1)
	maxGCD = maxPossibleInt+1
	for i in checkGCDRange:
		powNumber = i**count
		amari = product % powNumber
		if amari == 0:
			maxGCD = i
			break

	return maxGCD

if __name__ == '__main__':
	n , p  = map(int,input().strip().split(' '))
	if n == 1:
		print(p)
		exit(0)
	if p == 1:
		print(1)
		exit(0)
	solution=getMaxGCD(n,p)
	print('{}'.format(solution))

Submission status: Time Limit Exceeded

Solution code:
# _*_ coding:utf-8 _*_
#  CADDi2018 for Beginners C
#  https://atcoder.jp/contests/caddi2018b/tasks/caddi2018b_c

def getMaxGCD(count,product):
	maxPossibleInt = int(float(product)**(1.0/float(count)))
	checkGCDRange = range(maxPossibleInt+1,0,-1)
	maxGCD = maxPossibleInt+1
	for i in checkGCDRange:
		powNumber = i**count
		amari = product % powNumber
		if amari == 0:
			maxGCD = i
			break

	return maxGCD

if __name__ == '__main__':
	n , p  = map(int,input().strip().split(' '))
	solution=getMaxGCD(n,p)
	print('{}'.format(solution))

Submission status: Time Limit Exceeded

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

while True:
    y = (i + 1)**N
    if y > P:
        break
    else:
        if P % y == 0:
            x = i + 1
        i += 1

print(x)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

num = 2
count = 0
while P > 1:
    if P % num == 0:
        count += 1
        if count == N:
            ans *= num
            count = 0
        P //= num
    else:
        num += 1
        count = 0

print(ans)

Submission status: Time Limit Exceeded

Solution code:
n, p = [int(i) for i in input().split()]
num = int(p ** (1 / n)) + 1
for i in range(num):
    pp = p
    dv = num - i
    if pp % (dv**n) == 0:
        ans = dv
        break
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n, p = [int(i) for i in input().split()]
num = int(p ** (1 / n)) + 1
for i in range(num):
    pp = p
    dv = num - i
    for j in range(n):
        if pp % dv == 0:
            pp /= dv
        else:
          break
    else:
        ans = dv
        break
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N, P = map(int, raw_input().split())
if N == 1:
    print P
else:
    res = 1
    i = 2
    while i ** N <= P:
        if P % (i ** N) == 0:
            res = i
        i += 1
    print res

Submission status: Time Limit Exceeded

Solution code:
N, P = map(int, raw_input().split())
i = 2
res = 1
while i ** N <= P:
    if P % (i ** N) == 0:
        res = i
    i += 1
print res

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n,p= map(int,input().split())
res=1
if n==1:
    res=p
else:
    for i in range(2,int(p**(1/n))+2):
        x=i**n
        if x>p:
            break
        if p%x==0:
            res=i
print(res)

Submission status: Time Limit Exceeded

Solution code:
n,p= map(int,input().split())
res=1
if n==1:
    res=p
else:
    for i in range(2,int(p**(1/n))+2):
        if i**n>p:
            break
        if p%(i**n)==0:
            res=i
print(res)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n,p= map(int,input().split())
res=1
if n==1:
    res=p
else:
    for i in range(int(p**(1/n))+2,1,-1):
        if p%i**n==0:
            res=i
            break
print(res)

Submission status: Time Limit Exceeded

Solution code:
n,p= map(int,input().split())
res=1
if n==1:
    res=p
else:
    for i in range(2,int(pow(p,1/n))+2):
        x=pow(i,n)
        if x>p:
            break
        if p%x==0:
            res=i
print(res)

Submission status: Time Limit Exceeded

Solution code:
n,p= map(int,input().split())
res=1
if n==1:
    res=p
else:
    for i in range(2,int(pow(p,1/n))+2):
        x=i**n
        if x>p:
            break
        if p%x==0:
            res=i
print(res)

Submission status: Time Limit Exceeded

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

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

ans = 1
for i in range(2,p):
    if p % i == 0:
        t = i**n
        if p % t == 0:
            ans = i
        if t > p:
            break
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
n,p=map(int,input().split())
s=0
I=p
R=int(I)
l=[]
if p==1:
  print(1)
  exit()
while s==0:
  for i in range(2,R+1):
    if I%i==0:
      I=I/i
      if I==1:
          s=1
      l.append(i)
      break
l2=list(set(l))
x=1
for i in l2:
  y=l.count(i)
  if y>=n:
    x*=pow(i,y//n)
print(x)

Submission status: Time Limit Exceeded

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

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

ans = 1
i = 2
while i < p :
    if p % i == 0:
        t = i**n
        if p % t == 0:
            ans = i
        if i >= p**(1/n) + 1:
            break
    i = i + 1
print(ans)

Submission status: Time Limit Exceeded

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

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

ans = 1
flag = False
i = 2
while i < p :
    if p % i == 0:
        t = i**n
        if t > p :
            break
        if p % t == 0:
            flag = True
            ans = i

    i = i + 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n,p=map(int,input().split())
 
if n==1:
  print(p)
else:
  ans=1
  anskohomax=int(p**(1/n))
  for i in range(1,anskohomax+1+1):
    if p%i**n == 0:
     ans=i
  print(ans)

Submission status: Time Limit Exceeded

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

def calc(n):
  num = {}
  e, i = 0, 2
  while n != 1:
    while n%i == 0:
      n //= i
      e += 1
    if(e > 0):
      num[i] = e
    i += 1
    e = 0
  return num

if(N == 1):
  print(P)
  exit()
elif(P == 1):
  print(1)
  exit()
else:
  cnt = 1
  for k, v in calc(P).items():
    if(v >= N):
      cnt *= k ** (v//N)
  print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
import math

args = [int(i) for i in input().split()]
N = args[0]
P = args[1]
logP = math.log(P)

num = 1
i = 2

count = 0
while True:
    if P % i == 0:
        P /= i
        count += 1
    else:
        x = count // N
        num *= i**x
        break

i = 3
while True:
    count = 0
    while True:
        if P % i == 0:
            P /= i
            count += 1
        else:
            x = count // N
            num *= i**x
            r = i % 3
            if r == 1:
                i += 4
            else:
                i += 2
            break
    if N*math.log(i) > logP:#i**N>P
        break

print(num)

Submission status: Time Limit Exceeded

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

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

num = {}
s, e, i = 0, 0, 2
while s == 0:
  while p%i == 0:
    p //= i
    e += 1
    if(p == 1):
      s = 1
  if(e > 0):
    num[i] = e
  i += 1
  e = 0
cnt = 1
for k, v in num.items():
  if(v >= n):
    cnt *= k ** (v//n)
print(cnt)

Submission status: Time Limit Exceeded

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

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

num = {}
s = 0
e = 0
i = 2
while s == 0:
  while p%i == 0:
    p = int(p/i)
    e += 1
    if(p == 1):
      s = 1
  if(e > 0):
    num[i] = e
  i += 1
  e = 0
cnt = 1
for k, v in num.items():
  if(v >= n):
    cnt *= k ** (v//n)
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
import math

args = [int(i) for i in input().split()]
N = args[0]
P = args[1]
logP = math.log(P)

num = 1
i = 2

count = 0
while True:
    if P % i == 0:
        P /= i
        count += 1
    else:
        x = count // N
        num *= i**x
        break

i = 3
while True:
    count = 0
    while True:
        if P % i == 0:
            P /= i
            count += 1
        else:
            x = count // N
            num *= i**x
            i += 2
            break
    if N*math.log(i) > logP:#i**N>P
        break

print(num)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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


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

for i in reversed(range(1+int(p**(1/n)))):
    if p%(i+1)**n==0:
        print(i+1)
        sys.exit()

Submission status: Time Limit Exceeded

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

if n==1:
  print(p)
else:
  ans=1
  for i in range(1,int(p**(1/n))+2):
    tmp=i**n
    if (p>=tmp) and (p%tmp == 0):
     ans=i
    if(p<tmp):
      break
  print(ans)

Submission status: Time Limit Exceeded

Solution code:
N, P = list(map(int, input().split()))
if N == 1:
    print(P)
    exit()
elif P == 1:
    print("1")
    exit()

ans = 1
tmp = P

for i in range(2, P):
    po = pow(i, N)
    while tmp % po == 0:
        tmp = tmp // po
        ans = ans * i
        # print(i, tmp, ans)

    if tmp < po:
        break

print(ans)

Submission status: Time Limit Exceeded

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

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

num = []
s = 0
while s == 0:
  for i in range(2,p+1):
    if(p%i == 0):
      p = int(p/i)
      if(p == 1):
        s = 1
      num.append(i)
      break
d = {}
cnt = 1
for i in num:
  d[i] = num.count(i)
for k, v in d.items():
  if(v >= n):
    cnt *= k ** (v//n)
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import math

N, P = map(int, input().split())
max_value = math.floor(pow(P, 1/N)+1)
ans = 1

if N == 1:
    ans = P
else:
    for i in range(1, max_value+1):
        mod = i ** N
        if P % mod == 0:
            ans = i

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

args = [int(i) for i in input().split()]
N = args[0]
P = args[1]

num = 1
i = 2

count = 0
while True:
    if P % i == 0:
        P /= i
        count += 1
    else:
        x = count // N
        num *= i**x
        break

i = 3
while True:
    count = 0
    while True:
        if P % i == 0:
            P /= i
            count += 1
        else:
            x = count // N
            num *= i**x
            i += 2
            break
    if i**N > P:
        break

print(num)

Submission status: Time Limit Exceeded

Solution code:
N, P = map(int, input().split())
if N == 1:
    print(P)
else:
    gcd = 1
    p = 2
    while p * p <= P:
        if P % (p ** N) == 0:
            gcd = p
    p += 1
    print(gcd)

Submission status: Time Limit Exceeded

Solution code:
import math
N, P = map(int, input().split())
if N == 1:
    print(P)
else:
    gcd = 1
    # p = 2
    # while p * p <= P:
    # p += 1
    for p in range(2, int(math.sqrt(P)) + 1):
        if P % (p ** N) == 0:
            gcd = p
    print(gcd)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

args = [int(i) for i in input().split()]
N = args[0]
P = args[1]

num = 1
i = 2

count = 0
while True:
    if P % i == 0:
        P /= i
        count += 1
    else:
        x = count // N
        num *= i**x
        break

i = 3
while True:
    count = 0
    while True:
        if P % i == 0:
            P /= i
            count += 1
        else:
            x = count // N
            num *= i**x
            i += 2
            break
    if i > P:
        break

print(num)

Submission status: Time Limit Exceeded

Solution code:
N,P=map(int,input().split())
maxfac = round(P**(1/N))
# print(range(1,maxfac+1))
if N==1:
    print(P)
    exit()
for i in range(1,maxfac+2)[::-1]:
    p = i**N
    # print(P%p)
    if P%p == 0:
        print(i)
        break

Submission status: Time Limit Exceeded

Solution code:
n, p = map(int, input().split())
if n == 1 or p== 1:
    print(p)
    exit()
c2 = 0
while p%2 == 0:
    c2 += 1
    p//=2
c = 2**(c2//n)
i = int(p**(1/n))+1
while i > 1:
    if p%(i**n) == 0:
        print(c*i)
        exit()
    else:
        i -= 1
print(c)

Submission status: Time Limit Exceeded

Solution code:
n, p=map(int,input().split())
ans = 0
if n != 1:
    for i in range(1,int((p+1)**(1/2))+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)

Submission status: Time Limit Exceeded

Solution code:
from math import sqrt
N, P = list(map(int, input().split()))
if N == 1:
    print(P)
    exit()

ans = 1
tmp = P
# start = int(sqrt(P))
# for i in range(start, 1, -1):
#     newtmp, rest = divmod(tmp, (i**N))
#     print(i, tmp, rest, ans)
#     if rest == 0:
#         ans = ans * i
#         tmp = newtmp

for i in range(2, P):
    po = i**N
    while True:
        newtmp, rest = divmod(tmp, po)
        # print(i, tmp, rest, ans)
        if rest:
            break
        else:
            ans = ans * i
            tmp = newtmp
    if newtmp == 0:
        break

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N, P = map(int, input().split())
i = round(P**(1/N))+1

if N == 1:
    print(P)

else:
    while i >= 1:
        if P % (i**N) == 0:
            print(i)
            break
        i -= 1

Submission status: Time Limit Exceeded

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

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

ans = 1
for i in range(2,p):
    if p % i == 0:
        t = i**n
        if t > p :
            break
        if p % t == 0:
            ans = i
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n, p = map(int, input().split())
if n == 1 or p== 1:
    print(p)
    exit()
c2 = 0
while p%2 == 0:
    c2 += 1
    p//=2
c = 2**(c2//n)
max = 1
i = 1
while i**n <= p:
    i *= 2
while i > 1:
    if p%(i**n) == 0:
        print(c*i)
        exit()
    else:
        i -= 1
print(c)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n,p=map(int,input().split())
 
if n==1:
    print(p)
else:
    x=round((p**(1/n)+1))+1
    for i in range(x,0,-1):        
        if p%i==0:
            if p%(i**2)==0:
                if p%(i**n)==0:
                    print(i)
                    break

Submission status: Time Limit Exceeded

Solution code:
n, p = map(int, input().split())
if n == 1 or p== 1:
    print(p)
    exit()
c2 = 0
while p%2 == 0:
    c2 += 1
    p//=2
c = 2**(c2//n)
max = 1
i = 1
while i**n <= p:
    i += 2
while i > 1:
    if p%(i**n) == 0:
        print(c*i)
        exit()
    else:
        i -= 1
print(c)

Submission status: Time Limit Exceeded

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

if n==1:
    print(p)
else:
    for i in range(round((p**(1/n)+1)),0,-1):        
        if p%i==0:
            if p%(i**2)==0:
                if p%(i**n)==0:
                    print(i)
                    break

Submission status: Time Limit Exceeded

Solution code:
import math

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

for i in range(1, round(math.pow(P, 1 / N)) + 1):
    if P % (i ** N) == 0:
        now_max = i

print(now_max)

Submission status: Time Limit Exceeded

Solution code:
#encoding:utf-8

import math

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

def factorint(N):
    table = {}
    while(N > 1):
        for i in range(2,N+1):
            if N%i == 0:
                while N%i == 0:
                    N = N//i
                    if i in table.keys():
                        table[i] += 1
                    else:
                        table[i] = 1
                break
    return table
ans = 1
if N == 1:
    ans = P
elif 1 < N < 40:
    #Nが２以上なのでpをｓｑｒｔしても良い
    facters = factorint(P)
    # print(facters)

    ans = 1
    for key in facters.keys():
        if facters[key]/N >= 1:
            ans *= key**(facters[key]//N)
else:
    pass

print(int(ans))
# print(type(ans))

Submission status: Time Limit Exceeded

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

a = 1
b = 1

import math

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

print(b)

Submission status: Time Limit Exceeded

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

def kouyaku(n,p):
    if n==1:
        return p 
    else:
        for i in range(round((p**(1/n)+1)),0,-1):        
            if p%i==0:
                if p%(i**2)==0:
                    if p%(i**n)==0:
                        return i
                        break
 
            
print(kouyaku(n,p))

Submission status: Time Limit Exceeded

Solution code:
N,P=map(int,input().split())
maxfac = int(P**(1/N))
# print(range(1,maxfac+1))
if N==1:
    print(P)
    exit()
for i in range(1,maxfac+2)[::-1]:
    p = i**N
    # print(P%p)
    if P%p == 0:
        print(i)
        break

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

args = [int(i) for i in input().split()]
N = args[0]
P = args[1]

num = 1
i = 2

count = 0
while True:
    if P % i == 0:
        P /= i
        count += 1
    else:
        x = count // N
        num *= i**x
        break

i = 3
while True:
    count = 0
    while True:
        if P % i == 0:
            P /= i
            count += 1
        else:
            x = count // N
            num *= i**x
            i += 2
            break
    if i > P or i**N > P:
        break

print(num)

Submission status: Time Limit Exceeded

Solution code:
import math

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

for i in range(int(math.pow(P, 1 / N)) + 1, 0, -1):
    if P % (i ** N) == 0:
        print(i)
        break

Submission status: Time Limit Exceeded

Solution code:
import math

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

def C(N,P):
    if N == 1: return P
    if N > 40: return 1
    b=int(math.log2(N))
    a=int(P**(1/b))+2

    res=1
    for i in range(2,a):
        c=i**N
        if P % c == 0 : res = i

    return res

print(C(n,p))

Submission status: Time Limit Exceeded

Solution code:
n,p=map(int, input().split())
ans=1
m=int(pow(p,1/n))+1
if n==0:
    print(p)
else:
    m=int(pow(p,1/n))+1
    i=2
    c=0
    while(i<=p and i<=m):
        #print('i,p=',i,p)
        if p % i == 0:
            p=p/i
            c=c+1
            if p % i != 0:
                #print('i**(c//n)=',i**(c//n))
                ans = ans * ( i**(c//n) )
                i=i+1
                c=0
        else:
            i=i+1
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math

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

if N == 1:
    print(P)
else:
    now_max = 1
    
    for i in range(int(math.pow(P, 1 / N)) + 1, 0, -1):
        if P % (i ** N) == 0:
            now_max = i
            break
    
    print(now_max)

Submission status: Time Limit Exceeded

Solution code:
n, p = map(int, input().split())
if n == 1 or p== 1:
    print(p)
    exit()
c2 = 0
while p%2 == 0:
    c2 += 1
    p//=2
c = 2**(c2//n)
max = 1
i = 1
while i**n <= p:
    if p%(i**n) == 0:
        max = i
    i += 1
print(c*max)

Submission status: Time Limit Exceeded

Solution code:
from math import sqrt
N, P = list(map(int, input().split()))
if N == 1:
    print(P)
    exit()

ans = 1
tmp = P
# start = int(sqrt(P))
# for i in range(start, 1, -1):
#     newtmp, rest = divmod(tmp, (i**N))
#     print(i, tmp, rest, ans)
#     if rest == 0:
#         ans = ans * i
#         tmp = newtmp

for i in range(2, int(sqrt(P)) + 1):
    while True:
        newtmp, rest = divmod(tmp, (i**N))
        # print(i, tmp, rest, ans)
        if rest:
            break
        else:
            ans = ans * i
            tmp = newtmp
    if newtmp == 0:
        break

print(ans)

Submission status: Time Limit Exceeded

Solution code:
#encoding:utf-8

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

def factorint(N):
    table = {}
    while(N > 1):
        for i in range(2,N+1):
            if N%i == 0:
                while N%i == 0:
                    N = N//i
                    if i in table.keys():
                        table[i] += 1
                    else:
                        table[i] = 1
                break
    return table
ans = 1

if N < 40:
    facters = factorint(P)
    # print(facters)

    ans = 1
    for key in facters.keys():
        if facters[key]/N >= 1:
            ans *= key**(facters[key]//N)
print(int(ans))
# print(type(ans))

Submission status: Time Limit Exceeded

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

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

ans = 1
for i in range(1,p):
    if p % i == 0:
        t = i
        flag = True
        for j in range(n-1):
            t = t*i
            if p % t != 0:
                flag = False
                break
        if flag :
            ans = i
        if t > p :
            break
print(ans)