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())
prime = {2, }
for i in range(3, p + 1):
    for x in prime:
        if i % x == 0:
            break
    else:
        prime.add(i)

ans = 1
for x in prime:
    cnt = 0
    while p % x == 0:
        p //= x
        cnt += 1
    if cnt // n != 0:
        ans *= x * (cnt // n)

print(ans)

Submission status: Time Limit Exceeded

Solution code:
def INT():
    return int(input())

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

def LI():
    return list(map(int, input().split()))

N, P = MI()
g = 1
mod = 1
ans = 0

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

while mod <= P:
    mod = pow(g, N)
    
    if P % mod == 0:
        ans = max(ans, g)
    
    g += 1
    mod = pow(g, N)
    
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n,p=map(int,input().split())
if n==1:
    print(p)
    exit()
ans=1
for i in range(p+1):
    tmp=pow(i+1,n)
    if tmp>p:
        print(ans)
        break
    if p%tmp==0:
        ans=i+1

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()
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 = map(int, input().split())
if n==1:
  print(p)
  exit()
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 = map(int, input().split())
if n == 1:
  print(p)
  exit()
a = int(p**(1/n)+2)
for i in range(a,0,-1):
  if p%(i**n)==0:
    print(i)
    exit()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n, p = map(int, input().split())
num = round(p ** (1 / n))
for i in range(num + 1, 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:
    num = round(p ** (1 / n))
    for i in range(num + 1, 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:
    num = int(p ** (1 / n))
    for i in range(num + 1, 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:
    for i in range(int(p ** 0.5), 0, -1):
        p0 = p
        count = 0
        for j in range(n):
            if p0 % i == 0:
                p0 //= i
                count += 1
            else:
                break
        else:
            print(i)
            break

Submission status: Time Limit Exceeded

Solution code:
import sys
n, p = map(int, input().split())
if n == 1:
    print(p)
else:
    for i in range(10 ** 6, 0, -1):
        p0 = p
        count = 0
        while p0 % i == 0:
            p0 //= i
            count += 1
            if count == n:
                print(i)
                sys.exit()

Submission status: Time Limit Exceeded

Solution code:
n, p = map(int, input().split())
if n == 1:
    print(p)
else:
    for i in range(int(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())
dum = math.floor(p**(1/n))+1
for i in range(dum,-1,-1):
    if p%(i**n) == 0:
        print(i)
        break

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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()
l=[]#Pの約数
for i in range(1,int(p**0.5)+1):
    if p%i==0:
        l.append(i)
#print(l)
s=[]
for i in range(len(l)):
    if l[i]**n<=p and p%(l[i]**n)==0:
        #print(l[i],l[i]**n)
        s.append(l[i])
    if l[i]**n>p:
        break
print(s[-1])

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

for i in range(1, m)[::-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(1, int(p**(1/n) + 10))[::-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(1, int(p**(1/n)) + 10):
    if p%(i**n)== 0:
        ans = i

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import bisect
N, P = map(int, input().split())
if N == 1:
    print(P)
    exit()

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors


div_list = make_divisors(P)
ans = 0
for i in range(10 ** 6 + 1):
    idx = bisect.bisect_left(div_list, i ** N)
    if i ** N == div_list[min(idx, len(div_list) - 1)]:
        ans = i
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
 
N, M = map(int, input().split())
 
K = math.floor(M**(1/N)+2)
 
for i in range (0, K):
	if M%((K-i)**N)==0:
		print(K-i)
		exit()

Submission status: Time Limit Exceeded

Solution code:
import math
import sys
N, P = list(map(int, input().split()))
M = math.ceil(P ** (1 / N))
for i in range(M, 0, -1):
    if P % (i ** N) == 0:
        print(i)
        sys.exit()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import math
N, P = map(int, input().split())
x = math.floor(pow(P, 1/N))
x += 1

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

Submission status: Time Limit Exceeded

Solution code:
import math
N, P = map(int, input().split())
x = math.ceil(pow(P, 1/N))

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

q = p
v = collections.defaultdict(int)
for i in range(2, p+1):
    while q % i == 0:
        v[i] += 1
        q /= i
    if q == 1:
        break
ans = 1
for k, x in v.items():
    ans *= k ** (x//n)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N, P = map(int, input().split())
ans = 1
def main(n, p):
  global ans
  for i in range(2, int(p**(1/n))+4):
    t = i**n
    if p % t == 0:
      ans *= i
      return main(n, p//t)
  return ans

print(main(N, P))

Submission status: Time Limit Exceeded

Solution code:
N, P = map(int, input().split())
ans = 1
def main(n, p):
  global ans
  for i in range(2, int(p**(1/n)+4)):
    t = i**n
    if p % t == 0:
      ans *= i
      return main(n, p//t)
  return ans

print(main(N, P))

Submission status: Time Limit Exceeded

Solution code:
N, P = map(int, input().split())
ans = 1
def main(n, p):
  global ans
  for i in range(2, int(p**(2/n))):
    t = i**n
    if p % t == 0:
      ans *= i
      return main(n, p//t)
  return ans

print(main(N, P))

Submission status: Time Limit Exceeded

Solution code:
N, P = map(int, input().split())
ans = 1
def main(n, p):
  global ans
  for i in range(2, int(p**(2/n))):
    t = i**n
    if p % t == 0:
      ans *= i
      return main(n, p//t)
  return ans

print(main(N, P))

Submission status: Time Limit Exceeded

Solution code:
N, P = map(int, input().split())
ans = 1
def main(n, p):
  global ans
  for i in range(2, int(p**(2/n)+1)):
    t = i**n
    if p % t == 0:
      ans *= i
      return main(n, p//t)
  return ans

print(main(N, P))

Submission status: Time Limit Exceeded

Solution code:
N, P = map(int, input().split())
ans = 1
def main(n, p):
  global ans
  for i in range(2, int(p**(2/n)+1)):
    if p % (i**n) == 0:
      ans *= i
      return main(n, p//(i**n))
  return ans

print(main(N, P))

Submission status: Time Limit Exceeded

Solution code:
N, P = map(int, input().split())
ans = 1
def main(n, p):
  global ans
  for i in range(2, int(p**(2/n)+1)):
    if p % (i**n) == 0:
      ans *= i
      num = p // (i**n)
      return main(n, num)
  return ans

print(main(N, P))

Submission status: Time Limit Exceeded

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

max = 0

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

import math

D = math.floor(math.sqrt(P))+2

for i in range (0, D):
    if P%((D-i)**N) ==0 :
        print((D-i))
        exit()
print(1)

Submission status: Time Limit Exceeded

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

max = 0

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

import math

D = math.floor(math.sqrt(P))+2

for i in range (1, D):
    if P%(i**N) ==0 :
        max = i

print(max)

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, 10**6+1):
        if pow(i, n) > p:
            break

        if p % pow(i, n) == 0:
            ans = i
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
n,p = map(int,input().split())
ans = 1
x = 2
while x**n<=p:
  if p%(x**n)==0:
    p /= x**n
    ans *= x
  else:
    x+= 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n,p=map(int,input().split())
from collections import Counter
a=[]
while p%2==0:
  a.append(2)
  p//=2
f=3
while f<=p:
  if p%f==0:
    a.append(f)
    p//=f
  else:
      f+=2
c=Counter(a)
ans=1
for k,v in c.items():
  if v>=n:
    ans*=k**(v//n)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
from collections import defaultdict
N,P=map(int,input().split())
A=defaultdict(int)
i=2
ans=1
while P!=1:
    if P%i==0:
        A[i]+=1
        P//=i
    else:
        i+=1
for key,value in A.items():
    if value>=N:
        ans*=key**(value//N)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
from collections import Counter
N,P=map(int,input().split())
A=[]
i=2
ans=1
while P!=1:
    if P%i==0:
        A.append(i)
        P//=i
    else:
        i+=1
A=Counter(A)
for key,value in A.items():
    if value>=N:
        ans*=key**(value//N)
print(ans)

Submission status: Time Limit Exceeded

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

if N == 1:
  d = P
else:
  d = 1
  i = 2
  p = pow(i, N)
  while p <= P:
    if P % p == 0:
      P //= p
      d *= i
    else:
      i += 1
      p = pow(i, N)
print(d)

Submission status: Time Limit Exceeded

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

if N == 1:
  d = P
else:
  d = 1
  i = 2
  while i ** N <= P:
    if P % i**N == 0:
      P //= i**N
      P = int(P)
      d *= i
    else:
      i += 1
print(d)

Submission status: Time Limit Exceeded

Solution code:
N, P = map(int, input().split())
 
def f(N, P):
  d = 1
  i = 2
  if N == 1:
    return P
  else:
    while (i ** N) <= P:
      if i == 1:
        return 100
      if (P % (i**N)) == 0:
        P = int(P / i**N)
        d *= i
      else:
        i += 1
    return d
 
print(f(N, P))

Submission status: Time Limit Exceeded

Solution code:
N, P = map(int, input().split())
 
def f(N, P):
  d = 1
  i = 2
  if N == 1:
    return P
  else:
    while (i ** N) <= P:
      if (P % (i**N)) == 0:
        P = int(P // i**N)
        d *= i
      else:
        i += 1
    return d
 
print(f(N, P))

Submission status: Time Limit Exceeded

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

if N == 1:
  d = P
else:
  d = 1
  i = 2
  while i**N <= P:
    if P % i**N == 0:
      P //= i**N
      d *= i
    else:
      i += 1
print(d)

Submission status: Time Limit Exceeded

Solution code:
N, P = map(int, input().split())
 
def f(N, P):
  d = 1
  i = 2
  if N == 1:
    return P
  else:
    while (i ** N) <= P:
      if (P % (i**N)) == 0:
        P = int(P / i**N)
        d *= i
      else:
        i += 1
    return d
 
print(f(N, P))

Submission status: Time Limit Exceeded

Solution code:
N, P = map(int, input().split())
 
def f(N, P):
  d = 1
  i = 2
  if N == 1:
    return P
  else:
    while i ** N <= P:
      if P % i**N == 0:
        P = int(P / i**N)
        d *= i
      else:
        i += 1
    return d
 
print(f(N, P))

Submission status: Time Limit Exceeded

Solution code:
N, P = map(int, input().split())
 
def f(N, P):
  d = 1
  i = 2
  if N == 1:
    return P
  else:
    while i ** N <= P:
      if P % i**N == 0:
        P //= i**N
        d *= i
      else:
        i += 1
    return d
 
print(f(N, P))

Submission status: Time Limit Exceeded

Solution code:
N, P = map(int, input().split())
 
def f(N, P):
  d = 1
  i = 2
  if N == 1:
    return P
  else:
    count = 0
    while i <= pow(P, 1/N)+1:
      count += 1
      if count >= 100000:
        return 1000
      if P % i**N == 0:
        P //= i**N
        d *= i
      else:
        i += 1
    return d
 
print(f(N, P))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
while True:
  pass

Submission status: Time Limit Exceeded

Solution code:
N, P = map(int, input().split())
 
def f(N, P):
  d = 1
  i = 2
  if N == 1:
    return P
  else:
    while i <= int(pow(P, 1/N))+1:
      if P % i**N == 0:
        P //= i**N
        d *= i
      else:
        i += 1
    return d
 
print(f(N, P))

Submission status: Time Limit Exceeded

Solution code:
N, P = map(int, input().split())
 
def f(N, P):
  d = 1
  i = 2
  if N == 1:
    return P
  else:
    while i <= pow(P, 1/N)+1:
      if P % i**N == 0:
        P //= i**N
        d *= i
      else:
        i += 1
    return d
 
print(f(N, P))

Submission status: Time Limit Exceeded

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

if N == 1:
  d = P
else:
  d = 1
  i = 2
  while i <= pow(P, 1/N)+1:
    if P % i**N == 0:
      P //= i**N
      d *= i
    else:
      i += 1
print(d)

Submission status: Time Limit Exceeded

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

d = 1
i = 2
if N == 1:
  d = P
else:
  while i-1 <= pow(P, 1/N):
    if P % i**N == 0:
      P //= i**N
      d *= i
    else:
      i += 1
print(d)

Submission status: Time Limit Exceeded

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

d = 1
i = 2
if N == 1:
  d = P
else:
  while i <= pow(P, 1/N)+1:
    if P % i**N == 0:
      P //= i**N
      d *= i
    else:
      i += 1
print(d)

Submission status: Time Limit Exceeded

Solution code:
from math import ceil

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

d = 1
i = 2
if N == 1:
  d = P
else:
  while i <= ceil(pow(P, 1/N)):
    if P % i**N == 0:
      P //= i**N
      d *= i
    else:
      i += 1
print(d)

Submission status: Time Limit Exceeded

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

def f(N, P):
  d = 1
  i = 2
  if N == 1:
    return P
  else:
    while i <= pow(P, 1/N)+1:
      if P % i**N == 0:
        P //= i**N
        d *= i
      else:
        i += 1
    return d

print(f(N, P))

Submission status: Time Limit Exceeded

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

d = 1
i = 2
while i <= pow(P, 1/N)+1:
  while True:
    if P % i**N == 0:
      P //= i**N
      d *= i
    else:
      break
  i += 1
print(d)

Submission status: Time Limit Exceeded

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

d = 1
i = 2
while i <= pow(P, 1/N)+1:
  if P % i**N == 0:
    P //= i**N
    d *= i
  else:
    i += 1
print(d)

Submission status: Time Limit Exceeded

Solution code:
from math import ceil

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

d = ceil(pow(P, 1/N))
for i in range(ceil(pow(P, 1/N)), 0, -1):
  if P % i**N == 0:
    d = i
    break
print(d)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
from math import ceil

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

d = 1
for i in range(1, ceil(pow(P, 1/N))+1):
  if P % i**N == 0:
    d = i
print(d)

Submission status: Time Limit Exceeded

Solution code:
from collections import defaultdict
n, p = map(int, input().split())
cnt = defaultdict(int)
while p != 1:
    for i in range(2, p + 1):
        flag = False
        while p % i == 0:
            p //= i
            cnt[i] += 1
            flag = True
        if flag:
            break
ans = 1
for k, v in cnt.items():
    ans *= k ** (v // n)

print(ans)

Submission status: Time Limit Exceeded

Solution code:
# from math import factorial,sqrt,ceil #,gcd
# from itertools import permutations,combinations,combinations_with_replacement
# from collections import deque,Counter
# from bisect import bisect_left
# from heapq import heappush,heappop
# from numba import njit
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from fractions import gcd

# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np    # numpy.lcm()
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb,perm #permはnPk
# import networkx as nx
# G = Graph()

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

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

ans = 1
i = 1
while i**N <= P:
    if P % (i**N)==0:
        ans = i
    i += 1
 
print(ans)
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))

Submission status: Time Limit Exceeded

Solution code:
# from math import factorial,sqrt,ceil #,gcd
# from itertools import permutations,combinations,combinations_with_replacement
# from collections import deque,Counter
# from bisect import bisect_left
# from heapq import heappush,heappop
# from numba import njit
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from fractions import gcd

# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np    # numpy.lcm()
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb,perm #permはnPk
# import networkx as nx
# G = Graph()

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

ans = 1
i = 1
while i**N <= P:
    if P % (i**N)==0:
        ans = i
    i += 1
 
print(ans)
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))

Submission status: Time Limit Exceeded

Solution code:
import math

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

K = math.floor(M**(1/N))+1

for i in range (0, K):
	if M%((K-i)**N)==0:
		print(K-i)
		exit()
	if i == K-1:
		print(1)
		exit()

Submission status: Time Limit Exceeded

Solution code:
import math

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

K = math.floor(M**(1/N)+1)

for i in range (0, K):
	if M%((K-i)**N)==0:
		print(K-i)
		exit()
	if i == K-1:
		print(1)
		exit()

Submission status: Time Limit Exceeded

Solution code:
import math

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

K = math.floor(M**(1/N)+2)

for i in range (0, K):
	if M%((K-i)**N)==0:
		print(K-i)
		exit()

Submission status: Time Limit Exceeded

Solution code:
import math

n, p = map(int, input().split())
i = 1
while n * math.log(i) <= math.log(p):
    i += 1
for j in reversed(range(i)):
    pn = p
    for k in range(n):
        if (pn / j) % 1 != 0:
            break
        else:
            pn = pn / j
    else:
        print(j)
        break

Submission status: Time Limit Exceeded

Solution code:
import math

n, p = map(int, input().split())
i = 1
while n * math.log(i) <= math.log(p):
    i += 1
for j in reversed(range(i)):
    if (p / j ** n) % 1 == 0:
        print(j)
        break

Submission status: Time Limit Exceeded

Solution code:
n, p = map(int, input().split())
i = 1
while i ** n <= p:
    i += 1
for j in reversed(range(i)):
    if (p / j ** n) % 1 == 0:
        print(j)
        break

Submission status: Time Limit Exceeded

Solution code:
n,p=map(int,input().split());a=1;print(n<2and p or exec("for i in range(2,int(p**.5)+1):\n while p%(i**n)<1:a*=i;p//=i**n")or a)

Submission status: Time Limit Exceeded

Solution code:
n,p=map(int,input().split());a=1
for i in range(2,int(p**(1./n))+1):
 while p%(i**n)<1:a*=i;p//=i**n
print(a)

Submission status: Time Limit Exceeded

Solution code:
n,P = map(int,input().split())
#i = 2
from collections import defaultdict
dic = defaultdict(int)
# 約数分解
if n == 1:
    print(P)
    exit()
i = 2
N = P
while i*i <= N:
    if N%i != 0:
        continue
    num = 0
    while N%i == 0:
        num += 1
        N//=i
    dic[i] = num
if N != 1:
    dic[N] = 1
ans = 1
for k,v in dic.items():
    if v//n >= 1:
        ans *= k ** (v//n)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n,P = map(int,input().split())
#i = 2
from collections import defaultdict
dic = defaultdict(int)
# 約数分解
i = 2
N = P
while i*i <= N:
    if N%i != 0:
        continue
    num = 0
    while N%i == 0:
        num += 1
        N//=i
    dic[i] = num
if N != 1:
    dic[N] = 1
ans = 1
if n == 1:
    print(P)
else:
    for k,v in dic.items():
        #print(k*(v//n))
        if v//n >= 1:
            ans *= k ** (v//n)
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
n,P = map(int,input().split())
#i = 2
from collections import defaultdict
dic = defaultdict(int)
# 約数分解
i = 2
N = P
while i*i <= N:
    if N%i != 0:
        continue
    num = 0
    while N%i == 0:
        num += 1
        N//=i
    dic[i] = num
if N != 1:
    dic[N] = 1
ans = 1
if n == 1:
    print(P)
else:
    for k,v in dic.items():
        #print(k*(v//n))
        if v//n >= 1:
            ans *= k * (v//n)
    print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N, P = [int(_c) for _c in input().split(" ")]

if N == 1:
    print(P)
else:
    _max = 1
    M = int(P ** (1 / N) + 1)
    for i in range(1, M):
        if P % (i ** N) == 0:
            _max = i

    if P % ((i + 1) ** N) == 0:
        _max = (i + 1)

    print(_max)

Submission status: Time Limit Exceeded

Solution code:
N, P = [int(_c) for _c in input().split(" ")]

if N == 1:
    print(P)
else:
    _max = 1
    M = int(P ** (1 / N) + 1)
    for i in range(1, M + 1):
        if P % (i ** N) == 0:
            _max = i

    print(_max)

Submission status: Time Limit Exceeded

Solution code:
N, P = [int(_c) for _c in input().split(" ")]

if N == 1:
    print(P)
else:
    _max = 1
    M = int(P ** (1 / N) + 1)
    for i in range(1, M + 1):
        var = i ** N
        if P % var == 0:
            _max = i

    print(_max)

Submission status: Time Limit Exceeded

Solution code:
N, P = [int(_c) for _c in input().split(" ")]
 
if N == 1:
    print(P)
else:
    _max = 1
    M = int(P ** (1 / N))
    for i in range(1, M + 2):
        var = i ** N
        if P % var == 0:
            _max = i
 
    print(_max)

Submission status: Time Limit Exceeded

Solution code:
N, P = [int(_c) for _c in input().split(" ")]

if N == 1:
    print(P)
else:
    _max = 1
    M = int(P ** (1 / N))
    for i in range(1, M + 2):
        var = i ** N
        if P % var == 0:
            _max = i

    print(_max)

Submission status: Time Limit Exceeded

Solution code:
N, P = [int(_c) for _c in input().split(" ")]

if N == 1:
    print(P)
else:
    _max = 1
    M = 10 ** 6
    for i in range(1, M + 1):
        var = i ** N
        if P % var == 0:
            _max = i
        if var > P:
            break

    print(_max)

Submission status: Time Limit Exceeded

Solution code:
n,p=map(int,input().split())
if n==1:
    print(p)
    exit()
import math 
use=math.ceil(p**(1/n))
while True :
    if p%(use**n)==0:
        print(use)
        break
    use-=1

Submission status: Time Limit Exceeded

Solution code:
from bisect import *
n,p=map(int,input().split())
if n==1:
    print(p)
    exit()
import math 
use=math.ceil(p**(1/n))
while True :
    if p%(use**n)==0:
        print(use)
        break
    use-=1

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!=0:
        continue
    if p%(pow(i,n))==0:
        print(i);exit()

Submission status: Time Limit Exceeded

Solution code:
import math
def main():
    n,p=map(int,input().split())
    if n==1:
        print(p)
    else:
        q=math.ceil(p**(1/n))
        ans=1
        for i in range(q,0,-1):
            if p%(i**n)==0:
                ans=i
                break
        print(ans)
if __name__=="__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
import math
N,P=map(int,input().split())
L=[]
for i in range(1,int(math.sqrt(P))+1):
	if pow(i,N)<=P:
		if P%i==0:
			if P%(pow(i,N))==0:
				L.append(i)
			j=(P//i)
			if P%(pow(j,N))==0:
				L.append(j)
	else:
		break
print(max(L))

Submission status: Time Limit Exceeded

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

ans=int(P**(1/N))
ans+=1
while ans>0:
    if P%(ans**N)==0:
        break
    ans-=1

print(ans)

Submission status: Time Limit Exceeded

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

ans=int(P**(1/N))+1
while ans>0:
    if P%(ans**N)==0:
        break
    ans-=1

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N,P =map(int,input().split(' '))
if N==1:
    print(P)
    exit()
for i in range(int(pow(P,1/N)//1)+2,0,-1):
    if P%pow(i,N)==0:
        print(i)
        break

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N,P =map(int,input().split(' '))
if N==1:
    print(P)
    exit()
for i in range(int(pow(P,1/N))+2,0,-1):
    if P%pow(i,N)==0:
        print(i)
        break

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
n, p = map(int, input().split())
k = c = f = 1
while f <= p:
    if p % f == 0:
        k = c
    c += 1
    f = c**n
print(k)

Submission status: Time Limit Exceeded

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

div = 2
res = 1
while div * div <= P:
    cnt = 0
    tmp = P
    while P % div == 0:
        tmp /= div
        cnt += 1

        if cnt == N:
            res *= div
            cnt = 0
    div += 1

print(res)

Submission status: Time Limit Exceeded

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

div = 2
res = 1
while P != 1 and div <= P:
    cnt = 0
    while P % div == 0:
        P /= div
        cnt += 1

        if cnt == N:
            res *= div
            cnt = 0
    div += 1

print(res)

Submission status: Time Limit Exceeded

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

div = 2
res = 1
while P != 1:
    cnt = 0
    while P % div == 0:
        P /= div
        cnt += 1

        if cnt == N:
            res *= div
            cnt = 0
    div += 1

print(res)

Submission status: Time Limit Exceeded

Solution code:
def main():
    n, p = map(int, input().split())
    f = {}
    tmp = 0
    while p % 2 == 0:
        tmp += 1
        p //= 2
    f[2] = tmp
    tmp = 3
    while p > 1:
        if p % tmp == 0:
            p //= tmp
            if tmp in f:
                f[tmp] += 1
            else:
                f[tmp] = 1
        else:
            tmp += 2
    f = sorted(f.items(), key=lambda x: x[1], reverse=True)
    answer = 1
    for ff, cnt in f:
        if cnt < n:
            break
        answer *= ff ** (cnt // n)
    print(answer)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors[::-1]

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

for i in divisors:
    if i<=p/i**(n-1) and p%i**n==0:
        print(i)
        exit()