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: Wrong Answer

Solution code:
from statistics import mean, median,variance,stdev
import sys
import math
import fractions
def j(a):
    if a: print("AC")
    else :print("WA")


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())

#x = ip()                              #入力整数1つ
x,y = (int(i) for i in input().split())      #入力整数横2つ
#x,y,z = (int(i) for i in input().split())    #入力整数横3つ
#n,m,x,y= (int(i) for i in input().split())  #入力整数横4つ
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列

max = 1
ls = int(math.sqrt(y))+1
s = []
if y==1:print(1)
elif x==1:print(y)
else:
    n = y
    for i in range(2,ls):
        if n==1:break
        l=0
        while n%i == 0:
             n = n//i
             l+=1
        s.append([i,l])
    for i in range(len(s)):
        s[i][1]//=x
    num = 1
    for i in range(len(s)):
        if s[i][1]: num*=(s[i][0]*s[i][1])
    print(num)

Submission status: Wrong Answer

Solution code:
n,P=map(int,input().split())
A=[]
for i in range(2,10001):
  if P%(i**3)==0:
    A.append(i)
for i in range(2,101):
  if P%(i**6)==0:
    A.append(i)
for i in range(2,100):
  if P%(i**9)==0:
    A.append(i)
if P==10**12:
  A.append(10)
ans=1
for i in A:
  ans*=i
print(ans)

Submission status: Wrong Answer

Solution code:
import math


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

    primes = [i for i in range(x)]
    primes[1] = 0 # 1は素数ではない

    # エラトステネスのふるい
    for prime in primes:
        if prime > math.sqrt(x): break
        if prime == 0: continue
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

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


N, P = map(int, input().split(' '))
ans = 1
prime_nums = primes(10**4)
for a in prime_nums:
    if P % (a**N) == 0:
        ans *= a
    elif a**N > P:
        break
print(ans)

Submission status: Wrong Answer

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

n, p = map(int, input().split())
fac = factorize(p)
ans = 1
for i in fac:
    if i[1] >= n:
        ans *= i[0]
print(ans)

Submission status: Wrong Answer

Solution code:
import math
q = input().split()
n = int(q[0])
p = int(q[1])
def isprime(n):
    for i in range(int(math.sqrt(n))+1):
        if i == 0 or i == 1:
            continue
        if n % i == 0:
            return False
    return True
if p == 1:
    print(1)
else:
    c = 1
    i = 2
    while True:
        u = i ** n
        if p >= u and isprime(i) and p % u == 0:
            c *= i
        if p < u:
            break
        i += 1
    print(c)

Submission status: Wrong Answer

Solution code:
N,n = map(int,input().split())
fct = []
b, e = 2, 0
while b * b <= n:
    while n % b == 0:
        n = n // b
        e = e + 1
    if e > 0:
        fct.append([b, e])
    b, e = b + 1, 0
if n > 1:
    fct.append([n, 1])
num = []
ans = 1
for i in range(len(fct)):
    if(fct[i][1] >= N):
        ans *= fct[i][0]
print(ans)

Submission status: Wrong Answer

Solution code:
import math
from collections import defaultdict
# 0以上整数x「未満」の素数をリストに格納して返す
n, p = map(int, input().split())

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

    primes = [i for i in range(x)]
    primes[1] = 0  # 1は素数ではない

    # エラトステネスのふるい
    for prime in primes:
        if prime > math.sqrt(x): break
        if prime == 0: continue
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]
#pr = primes(p + 1)
def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors

pr = prime_factors(p)
di = {}
di = defaultdict(int)
for i in pr:
    while p % i == 0:
        p = p // i
        di[i] += 1

ans = 1
for i in di:
    if di[i] >= n:
        ans *= i
print(ans)

Submission status: Wrong Answer

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

a = 1
b = 1

while P > a**N:
	if P % a**N == 0:
		b = a
	a += 1

print(b)

Submission status: Wrong Answer

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

def prime_factorize(num):
    """
    This function performs prime factorization on the input natural number.
    The result is returned in the form of a dictionary with the prime number as the key
    and its number as the value.
    :param num:
    :return prime_factor: Dictionary with the prime number as the key and its number as the value.
    """
    prime_factor = {}
    i = 2
    while i ** 2 <= num:
        while num % i == 0:
            num //= i
            if i in prime_factor.keys():
                prime_factor[i] += 1
            else:
                prime_factor[i] = 1
        i += 1
    if num > 1:
        prime_factor[num] = 1
    return prime_factor

div = p//2

prime_fac = prime_factorize(p)
prime_fac[p] = 1
prime_fac = sorted(prime_fac.items(), key=lambda x:-x[0])
counts = []
for k, v in prime_fac:
    if v >= n:
        counts.append(k)
if len(counts) == 0:
    print(1)
else:
    r = 1
    num = 0
    for i, c in enumerate(counts):
        if num >= n:
            break
        r *= c
        num += 1
    print(r)

Submission status: Wrong Answer

Solution code:
N, P = list(map(int, input().split()))
m = int(12/N)
n = 1
flag = 0
mlcm = 1
for i in range(m):
    n *= 10
for i in range(1, n):
    if P % i == 0:
        count = 0
        p = P
        flag = 1
        for j in range(N):
            if p % i == 0:
                p /= i
                count += 1
            else:
                flag = 0
                break
        if flag == 1:
            mlcm = i
print(mlcm)

Submission status: Wrong Answer

Solution code:
def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

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

Submission status: Wrong Answer

Solution code:
# coding:utf-8

import sys
from collections import defaultdict

input = sys.stdin.readline
INF = float('inf')
MOD = 10 ** 9 + 7


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


N, P = inpl()


def prime_factorization(num):
    prime_cnt = defaultdict(int)

    i = 2
    while i * i <= num:
        if num % i == 0:
            cnt = 0
            while num % i == 0:
                cnt += 1
                num //= i
            prime_cnt[i] += cnt
        i += 1

    if num != 1:
        # nに素数が残っている場合処理をする
        prime_cnt[num] += 1

    return prime_cnt


pcnt = prime_factorization(P)

ans = 1
for key in pcnt.keys():
    if pcnt[key] >= N:
        ans *= key

print(ans)

Submission status: Wrong Answer

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

N,P = list(map(int, input().split()))
ans = 1
fct = factorize(P)
for f in fct:
    ans = ans * max(1,(f[0] * (f[1]//N)))
print(ans)

Submission status: Wrong Answer

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

pdict = {}

i = 2
while True:
  if P == 1:
    break
  if P % i == 0:
    if i in pdict:
      pdict[i] += 1
    else:
      pdict[i] = 1
    P //= i
    continue
  else:
    i += 1

i = 0
l = 1
for k, v in pdict.items():
  if v >= N:
    l *= k * v//N

print(l)

Submission status: Wrong Answer

Solution code:
n,p=map(int,input().split())
l=[]
for i in range(1001,0,-1):
  x=i**n
  if p%x==0:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
import math
import sys

s = 0
n, I = map(int, input().split())
if I == 1:
    print(1)
    sys.exit()
R = int(I)
tmp = []
cnt = 1
while s == 0:
    for i in range(2, R + 1):
        if I % i == 0:
            I = I / i
            if I == 1:
                s = 1
            tmp.append(i)
            break
tmp2 = set(tmp)
for i in tmp2:
    a = tmp.count(i)
    if a >= n:
        cnt *= i
print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range(2,p+1):
    if i>p:
        break
    count = 0
    flag = 0
    while flag == 0:
        if p//i == p/i:
            p = p//i
            count += 1
        else:
            if count >= n:
                ans *= i
            flag = 1
            

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

pdict = {}

i = 2
while True:
  if P == 1:
    break
  if P % i == 0:
    if i in pdict:
      pdict[i] += 1
    else:
      pdict[i] = 1
    P //= i
    continue
  else:
    i += 1

i = 0
l = 1
for k, v in pdict.items():
  if v >= N:
    l *= k

print(l)

Submission status: Wrong Answer

Solution code:
from math import sqrt
n, p = map(int, input().split())
a = []
for i in range(2, int(sqrt(p))+1):
    tmp = 0
    while p % i == 0:
        p //= i
        tmp += 1
    if tmp >= n:
        tmp //= n
        a.append(i*tmp)

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

print(ans)

Submission status: Wrong Answer

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

p = int(P**0.5) + 1
n = 0
for i in range(1,p+1):
    if P % (i**N) == 0:
        n = i
print(n)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
from collections import Counter
N, P = map(int, input().split())


def primes(n):
    primfac = []
    d = 2
    while d*d <= n:
        while (n % d) == 0:
            primfac.append(d)  # supposing you want multiple factors repeated
            n //= d
        d += 1
    if n > 1:
       primfac.append(n)
    return primfac

ctr = Counter(primes(P))

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

print(ans)

Submission status: Wrong Answer

Solution code:
# https://stackoverflow.com/questions/15347174/python-finding-prime-factors
def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors



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


import collections
lst = prime_factors(P)
c = collections.Counter(lst)

result = 1
for k in c.keys():
    if c[k] >= N:
        result *= k

print(result)

Submission status: Wrong Answer

Solution code:
def prime(p):
    ret = {}
    a = int(p ** 0.5)
    k = 2
    while(p > 1):
        if p % k == 0:
            p //= k
            ret[k] = ret.get(k, 0) + 1
        elif k > a:
            k = p
        else:
            k += 1
    return ret


n, p = map(int, input().split())
ret = prime(p)
# print(ret)
ans = 1
for i in list(filter(lambda x: ret[x] >= n, list(ret))):
    ans *= i * (ret[i] // n)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

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

if N != 1:
    for i in range(2, max_value):
        if P % 2 == 0:
            if P % ((ans*i)**N) == 0:
                ans *= i

print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
from collections import Counter
N, P = map(int, input().split())


def primes(n):
    primfac = []
    d = 2
    while d*d <= n:
        while (n % d) == 0:
            primfac.append(d)  # supposing you want multiple factors repeated
            n //= d
        d += 1
    if n > 1:
       primfac.append(n)
    return primfac

ctr = Counter(primes(P))

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

print(ans)

Submission status: Wrong Answer

Solution code:
n,p=map(int,input().split())
l=[]
for i in range(1,1001):
  x=i**n
  if p%x==0:
    l.append(i)
print(max(l))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import Counter


def d(P):
    c = Counter()
    i = 2
    while (P > 1):
        if P % i == 0:
            c.update([i])
            P //= i
            i = 2
        else:
            i += 1
    return c


def solve(N, P):
    c = d(P)
    ans = 1
    for k in [k for k, v in c.items() if v >= N]:
        ans *= k
    return ans


if __name__ == "__main__":
    N, X = tuple(map(int, input().split(" ")))
    print(solve(N, X))

Submission status: Wrong Answer

Solution code:
N, P = map(int, input().split())
if N == 1:
	print(P)
else:
	for i in range(int(P ** (1.0 / N)), 0, -1):
		if P % (i ** N) == 0:
			print(i)
			break

Submission status: Wrong Answer

Solution code:
def prime(p):
    ret = {}
    a = int(p ** 0.5)
    k = 2
    while(p > 1):
        if p % k == 0:
            p //= k
            ret[k] = ret.get(k, 0) + 1
        elif k > a:
            k = p
        else:
            k += 1
    return ret


n, p = map(int, input().split())
ret = prime(p)
# print(ret)
ans = 1
for x in list(filter(lambda x: ret[x] >= n, list(ret))):
    ans *= x
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,p = map(int,input().split())
if n == 1:
    print(p)
    exit()
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, n + 1):
        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(10**5)
ans = 1
for i in a:
    if p%(i**n) == 0:
        ans *= i
print(ans)

Submission status: Wrong Answer

Solution code:
# coding:utf-8

import sys
from collections import Counter


input = sys.stdin.readline
INF = float('inf')
MOD = 10 ** 9 + 7


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


N, P = inpl()

def prime_factorization(num):
    from collections import defaultdict
    prime_cnt = defaultdict(int)

    i = 2
    while i * i <= num:
        if num % i == 0:
            cnt = 0
            while num % i == 0:
                cnt += 1
                num //= i
            prime_cnt[i] += cnt
        i += 1

    if num != 1:
        # nに素数が残っている場合処理をする
        prime_cnt[num] += 1

    return prime_cnt


prime_cnt = prime_factorization(P)

ans = 1
for key in prime_cnt.keys():
    if prime_cnt[key] >= N:
        ans *= key

print(ans)

Submission status: Wrong Answer

Solution code:

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

if __name__ == "__main__":
    n,p = map(int, input().split())
    x = factorize(p)
    ans=1
    for i in x:
        if i[1]>=n:
            ans = ans*i[0]
    print(ans)

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

Submission status: Time Limit Exceeded

Solution code:
num,product = map(int,input().split())
order = len(str(product)) / num
cnt = round(10 ** order)
gcd = 1
while(cnt > 1):
    calc = cnt ** num
    if calc > product:
        cnt = cnt - 1
        continue
    if product % calc == 0:
        gcd = cnt
        break
    else:
        cnt = cnt - 1
print(gcd)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
import math
num,product = map(int,input().split())
order = len(str(product)) / num

cnt = round(10 ** order)
gcd = 1
while(cnt > 1):
    calc = cnt ** num
    if product % calc == 0:
        gcd = cnt
        break
    else:
        cnt = cnt - 1
print(gcd)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
import math
num,product = map(int,input().split())
order = math.ceil(len(str(product)) / num)

cnt = 10 ** order
gcd = 1
while(cnt > 1):
    calc = cnt ** num
    if calc > product:
        cnt = cnt - 1
    elif product % calc == 0:
        gcd = cnt
        break
    else:
        cnt = cnt - 1
print(gcd)

Submission status: Time Limit Exceeded

Solution code:
num,product = map(int,input().split())

cnt = 1
gcd = 1
while(True):
    cnt += 1
    calc = cnt ** num
    if calc > product:
        break
    elif product % calc == 0:
        gcd = cnt
    else:
        continue
print(gcd)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
num,product = map(int,input().split())

cnt = 1
gcd = 1
while(True):
    cnt += 1
    calc = cnt ** num
    if product % calc == 0:
        gcd = cnt
    elif calc > product:
        break
    else:
        continue
print(gcd)

Submission status: Time Limit Exceeded

Solution code:
'''
Created on 2020/08/26

@author: harurun
'''
def main():
  import math
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  N,P=map(int,pin().split())
  t=int(P**(1/N))+1
  if N==1:
    print(P)
    return 
  while t>0:
    s=P
    for i in range(N):
      if s%t!=0:
        break
      s=s//t
    else:
      print(t)
      return
    t-=1
  print(1)
  return 

main()

Submission status: Time Limit Exceeded

Solution code:
'''
Created on 2020/08/26

@author: harurun
'''
def main():
  import math
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  N,P=map(int,pin().split())
  t=int(math.sqrt(P))+1
  if N==1:
    print(P)
    return 
  while t>0:
    s=P
    for i in range(N):
      if s%t!=0:
        break
      s=s//t
    else:
      print(t)
      return
    t-=1
  print(1)
  return 

main()

Submission status: Time Limit Exceeded

Solution code:
N,P = map(int,input().split())
data = [i for i in range(2,P+1)]
for d in data:
    data = [x for x in data if (x==d or x%d != 0 )]
lst = []
for i in data:
    if P%i == 0:
        a = P
        cnt = 0
        while a % i == 0:
            a /= i
            cnt += 1
        lst.append([i,cnt])    
#print(lst)    

ans=1
a=1
for i in lst:
    a = i[0]*(i[1]//N)
    if a:
        ans *= a
print(ans)

Submission status: Time Limit Exceeded

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

if n == 1:
    print(p)
else:
    ans = 1
    g = 1
    while pow(g, n) <= p:
        if p % pow(g, n) == 0:
            ans = max(ans, g)
        g += 1
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
INFTY = 10**12
Q = [1 for _ in range(INFTY)]
Q[0]=0
Q[1]=0
for i in range(2,int(INFTY**0.5)+1):
    for j in range(i*i,INFTY,i):
        Q[j]=0
A = []
for i in range(INFTY):
    if Q[i]==1:
        A.append(i)
N,P = map(int,input().split())
C = {}
for a in A:
    if P%a==0:
        C[a] = 0
        while P%a==0:
            P = P//a
            C[a] += 1
b = 1
for a in C:
    b *= a**(C[a]//N)
print(b)

Submission status: Time Limit Exceeded

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

ans = 1
x = int(p ** (1/n)) +1

while x > 1:
    y = x ** n
    if p % y == 0:
        p //= y
        ans *= x
    else:
        x -= 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

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

answer = 1
x = 1
if N < 100:
    while True:
        x += 1
        y = x ** N
        if y > P:
            break
        if P % y == 0:
            answer = x

print(answer)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

if n == 1:
    print(p)
else:
    m = 1
    while m ** n <= p:
        m += 1
    for i in reversed(range(1, m + 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)
    exit()
for n in range(int(P ** (1 / N)) + 10, 0, -1):
    if P % (n ** N) == 0:
        print(n)
        break

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

i = 0
while 1:
    if i**n > p:
        break
    i += 1

ans = 0
for j in range(1,i+1):
    if p%(j**n) == 0:
        ans = j
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N,P=map(int,input().split())
sum=1
for i in range(1,int((P+1)/2)):
    tmp=P
    for z in range(N):
        r=tmp%i
        if r!=0:
            break
        if z==N-1:
            sum*=i
        tmp//=i
print(sum)

Submission status: Time Limit Exceeded

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

start = ceil(P**(1/N))

for ans in range(start,-1,-1) :
    if not P % ans**N :
        break
print(ans)

Submission status: Time Limit Exceeded

Solution code:
from math import sqrt, floor, log


def is_prime(num):
    if num <= 1:
        return False

    for i in range(2, floor(num / 2) + 1):
        if i == num:
            break
        if num % i == 0:
            return False
    return True


def prime_list(num):
    """
    num以下の素数を求める
    """
    ans = []
    for i in range(2, num + 1):
        if is_prime(i):
            ans.append(i)
    return ans


def factorize(num):
    """
    num >= 2
    numは素数ではない

    :return: [(底, 指数)]
    :rtype: [(int, int)]
    """
    l = prime_list(floor(num / 2))
    print(l)


def get_divisors(num):
    """
    num >= 2
    """
    ans = set()
    for i in range(2, floor(sqrt(num) + 1)):
        if num % i == 0:
            ans.add(i)
    return ans


def get_divisors2(num):
    ans = set()
    for i in range(2, floor(sqrt(num)) + 1):
        if num % i == 0:
            ans.add(i)
    return ans


def get_divisors3(num):
    ans = []
    value = num
    i = 2
    while value != 1:
        count = 0
        while value % i == 0:
            count += 1
            value = value // i

        if count != 0:
            ans.append((i, count))
        i += 1
    return ans


def main():
    n, p = [int(i) for i in input().split()]
    if n == 1:
        print(p)
    elif p == 1:
        print(1)
    else:
        ds = get_divisors3(p)
        ans = 1
        for d in ds:
            if d[1] >= n:
                ans *= d[0] ** (d[1] // n)
        print(int(ans))


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import sys
from math import sqrt, ceil

n, p = [int(i) for i in input().split()]

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

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

ans = []
for i in range(1, p):
    value = i ** n
    if value > p:
        break

    if p % value == 0:
        ans.append(i)

# print(ans)
print(max(ans))

Submission status: Time Limit Exceeded

Solution code:
import sys
from math import sqrt, ceil

n, p = [int(i) for i in input().split()]

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

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

ans = []
for i in range(1, p):
    if i ** n > p:
        break

    if p % (i ** n) == 0:
        ans.append(i)

# print(ans)
print(max(ans))

Submission status: Time Limit Exceeded

Solution code:
import math
N, P = (int(i) for i in input().split())
a = 1
b = math.floor(math.sqrt(P))
i = 2
c = P

if N ==1:
    a = P
if N > 1 :
    while (i**N <= P) and (i<=b):
        if c % (i**N) == 0:
            a = i
        i = i+1

print(a)

Submission status: Time Limit Exceeded

Solution code:
import math
N, P = (int(i) for i in input().split())
a = 1
b = math.floor(math.sqrt(P))
i = 2

if N ==1:
    a = P
if N > 1:
    while (i**N <= P) and (i<=b):
        if P % (i**N) == 0:
            a = i
        else:
            a = a
        i = i+1

print(a)

Submission status: Time Limit Exceeded

Solution code:
import math
N, P = (int(i) for i in input().split())
a = 1
b = 1
i = 1

if N ==1:
    a = P
if N > 1:
    b = math.floor(math.sqrt(P))
    while (i**N <= P) or (i<=b):
        if P % (i**N) == 0:
            a = i
        else:
            a = a
        i = i+1

print(a)

Submission status: Time Limit Exceeded

Solution code:
N,P=map(int,input().split())
q={}
if P%2==0:
    q[2]=1
    P//=2
    while P%2==0:
        P//=2
        q[2]+=1

m=3
while P>1:
    if P%m==0:
        P//=m
        if m in q.keys():
           q[m]+=1
        else:q[m]=1
    else:
        m+=2
ans=1
for k,v in q.items():
    ans = ans*k**(v//N)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N,P=map(int,input().split())
q={}
m=2
while P>1:
    if P%m==0:
        P//=m
        if m in q.keys():
           q[m]+=1
        else:q[m]=1
    else:
        m+=1
ans=1
for k,v in q.items():
    ans = ans*k**(v//N)
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

output=1

for num in range(2,round(P**(1/N))+1):
  for i in range(10000):
    if P%(num**N) == 0:
      P = P/(num**N)
      output = num*output
    else:
      break

print(output)

Submission status: Time Limit Exceeded

Solution code:
s=[int(x) for x in input().split()]
i=0
c=[]
if(s[0]==1):
    c.append(s[1])
for i in range(1,int(s[1]**(1/s[0]))+2):
    if(s[1]%(i**s[0])==0):
        c.append(i)
print(max(c))

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 31 14:30:45 2018

@author: Yamazaki Kenichi
"""

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

limit = int(pow(P,1/N)//1+1)

if N == 1:
    ans = P
else:
    ans = 1
    for i in range(2,limit+1):
        if P % pow(i,N) == 0:
            ans = i

print(ans)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 31 14:30:45 2018

@author: Yamazaki Kenichi
"""

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

limit = int(pow(P,1/N)//1+1)

if N == 1:
    ans = P
else:
    ans = 1
    for i in range(1,limit+1):
        if P % pow(i,N) == 0:
            ans = i

print(ans)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 31 14:30:45 2018

@author: Yamazaki Kenichi
"""

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

limit = int(pow(P,1/N)//1+1)

if N == 1:
    ans = P
else:
    ans = 1
    for i in range(1,limit+1):
        if P % pow(i,N) == 0:
            ans = i
    
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math

def is_prime(n: int)-> bool:
    if n == 2:
        return True
    if n < 2 or n % 2 == 0:
        return False
    # when n is a prime number
    # x^(n-1) ≡ 1 (mod n)
    return pow(2, (n-1), n) == 1


def prime_factorize(n: int):
    prime_factors = []

    for i in range(2, n+1):
        if not is_prime(i):
            continue
        while True:
            div, mod = divmod(n, i)
            if mod == 0:
                prime_factors.append(i)
                n = div
            else:
                break
        if n == 1:
            break
    return prime_factors


def main():
    N, P = map(int, input().split())
    prime_factors = prime_factorize(P)

    gcd = 1
    for i in set(prime_factors):
        i_count = prime_factors.count(i) // N
        gcd *= pow(i, i_count)

    print(gcd)
    return

main()

Submission status: Time Limit Exceeded

Solution code:
line = raw_input()
line = line.split(" ")
N,P = line
N = int(N)
P = int(P)

i = int((P*1.0)**(1/(N*1.0)))+1
while True:
    if P%(i**N) == 0:
        print i
        break
    i -= 1

Submission status: Time Limit Exceeded

Solution code:
line = raw_input()
line = line.split(" ")
N,P = line
N = int(N)
P = int(P)

ans = []

i = 1
while True:
    if i**N > P:
        break
    if P%(i**N) == 0:
        ans.append(i)
    i += 1

print max(ans)