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:
import math

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

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 = list(map(int, input().split()))

now_max = 1

for i in range(round(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:
import math

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

now_max = 1

for i in range(round(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:
import math


def read():
    N, P = list(map(int, input().strip().split()))
    return N, P


def solve(N, P):
    v3 = math.floor(P**(1/N)) + 1
    for v in range(v3, 0, -1):
        if P % (v**N) == 0:
            return v
    return 1


if __name__ == '__main__':
    inputs = read()
    print(solve(*inputs))

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 i**N <= P:
    count = 0
    while True:
        if P % i == 0:
            P /= i
            count += 1
        else:
            x = count // N
            num *= i**x
            i += 2
            break

print(num)

Submission status: Time Limit Exceeded

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

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

primelist=[]
powerlist=[]

p=2
while 1:
    Q = p**N
    if P < Q:
        break
    elif P == Q:
        primelist.append(p)
        powerlist.append(1)
        break
#    elif p**(N+1) > P:
#        p = P**(1/N)
#        if p == int(p):
#            primelist.append(int(p))
#            powerlist.append(1)
#        break

#    f = 0
#    for q in primelist:
#        if p % q == 0:
#            f = 1
#            break
#    if f == 1:
#        p += 1
#        continue
#    else:
    k = 0
    while P % p == 0:
        P //= p
        k += 1
    primelist.append(p)
    powerlist.append(k//N)
    p += 1

ans = 1
for i in range(len(primelist)):
    ans *= (primelist[i]**powerlist[i])

print(ans)

Submission status: Time Limit Exceeded

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

def factorizationC(n,p):
    numList=[]
    for i in range(2, int(p**(1/n))+1):
        if p % (i**n) == 0:
            numList.append(i)
            m = p // (i**n)
            j = 2
            while j <= m:
                if m % (j**n) == 0:
                    numList.append(j)
                    m = m // (j**n)
                    j = 2
                else:
                    j += 1
            break
    return numList

if n==1:
  print(p)
else:
  aaa=factorizationC(n,p)
  ans=1
  for i in range(len(aaa)):
     ans=ans*aaa[i]
  print(ans)

Submission status: Time Limit Exceeded

Solution code:
def get_gcd(N, P):
    if N == 1:
        return P
    lst = []
    flg = True
    while flg:
        flg = False
        if P < 2 ** N:
            continue
        if P % 2 ** N == 0:
            lst.append(2)
            P //= (2 ** N)
            flg = True
            continue
        for i in range(3, P+1, 2):
            if P < i ** N:
                break
            if P % (i ** N) == 0:
                lst.append(i)
                P //= (i ** N)
                flg = True
                break
    ans = 1
    for i in lst:
        ans *= i
    return ans

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

Submission status: Time Limit Exceeded

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

def factorizationC(n,p):
    numList=[]
    for i in range(2, int(p**(1/n))+1):
        if p % (i**n) == 0:
            numList.append(i)
            m = p // (i**n)
            j = 2
            while j <= m:
                if m % (j**n) == 0:
                    numList.append(j)
                    m = m // (j**n)
                    j = 2
                else:
                    j += 1
            break
    return numList

aaa=factorizationC(n,p)

ans=1
for i in range(len(aaa)):
   ans=ans*aaa[i]

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N,P = map(int, input().split())
t=2
max=1
a=t**N
while(a<=P):
    if(P%a==0):
        max=t*max
        P=P/a
        t=1
    t=t+1
    a=t**N
print(max)

Submission status: Time Limit Exceeded

Solution code:
import math

N, P = map(int, input().split())
result = 1
i = math.floor(math.pow(math.pow(10, 12), (1.0/N)))


while i > 1:
    if P % math.pow(i, N) == 0:
        result = i
        break
    i -= 1

print(result)

Submission status: Time Limit Exceeded

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

for i in range(2, p + 1):
  while True:
    if P % (i ** N) == 0:
      n *= i
      P = P / (i ** N)
    else:
      break
  if P <= i ** N:
    break 
    
print(n)

Submission status: Time Limit Exceeded

Solution code:
n,p = map(int,input().split())
d = []
res = 1
 
a = 2
while(1):
  an = a**n
  if p < an:
    break
  elif p % an == 0:
    p /= an
    res *= a
  else:
    a += 1
 
print(res)

Submission status: Time Limit Exceeded

Solution code:
import math

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

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

    res=1
    for i in range(2,a):
        c=i**N
        if c > P : break
        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())
p = P**(1/N)
if p % 1 == 0:
    print(int(p))
    exit()

p = (int(p) + 1)//2**N

dic = {}

def my(N,p,s=2):
    for i in range(s,p+1):
        if p % i == 0:
            # print('ok')
            dic[i] = dic.get(i,0) + 1
            # print(dic)
            p = p//i
            s = i
            break
    
    if p == 1:
        res = 1
        for j,k in dic.items():
            res *= j**(k//N)
        print(res)
        exit()
    else:
        my(N,p,s)

my(N,P)

Submission status: Time Limit Exceeded

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

print(b)

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:
import math

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

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

    res=1
    for i in range(2,a):
        if i**N > P : break
        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
    b=int(math.log2(N))
    a=P**(1/b)

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

    return res

print(C(n,p))

Submission status: Time Limit Exceeded

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

t = 1
temp = t**N
a = []
b = []
while temp <= P:
    b.append(t)
    a.append(temp)
    t += 1
    temp = t**N
if (t-1)**N == P:
    print(t-1)
    exit()

for i in range(len(a))[::-1]:
    if a[i] > P/2:
        continue
    if P % a[i] == 0:
        print(b[i])
        exit()
print(1)

Submission status: Time Limit Exceeded

Solution code:
n,p = map(int,input().split())
d = []
res = 1
 
a = 2
while(1):
  an = a**n
  if p % an == 0:
    p /= an
    res *= a
    continue
  a += 1
  if p < an:
    break
 
print(res)

Submission status: Time Limit Exceeded

Solution code:
N,P = map(int,input().split())
c = int(P**(1/N))+1
def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1
if N>1 and is_prime(P):
    print(1)
    exit()
while(1):
    if P%(c**N)==0:
        print(c)
        exit()
    c-=1

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]
P_ori = 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 i <= int(P_ori ** (1/N)) and i <= P:
    count = 0
    while True:
        if P % i == 0:
            P /= i
            count += 1
        else:
            x = count // N
            num *= i**x
            i += 2
            break

print(num)

Submission status: Time Limit Exceeded

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

while True:
  if P % (2 ** N) == 0:
    n *= 2
    P = P / (2 ** N)
  else:
    break
for i in range(3, p, 2):
  while True:
    if P % (i ** N) == 0:
      n *= i
      P = P / (i ** N)
    else:
      break
  if P <= i ** N:
    break 
    
print(n)

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

            
print(kouyaku(n,p))

Submission status: Time Limit Exceeded

Solution code:
# import math

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

'''
n = int(math.sqrt(P))
if N >= 4:
    n = int(math.sqrt(n))

for i in range(n+1)[::-1]:
    if i == 0:
        break
    _num = P
    cnt = 0
    if _num % i != 0:
        continue
    if _num % pow(i, N) == 0:
        print(i)
        exit()
'''

i = 1
ans = 1
while True:
    i += 1
    n = pow(i, N)
    if n > P:
        break
    if P % n == 0:
        ans = i

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
N, P = map(int, input().split())
ans=1
yakusu = []
for i in range(1,int(math.sqrt(P))+1):
    if P%i == 0:
        yakusu.append(i)
        yakusu.append(P/i)
yakusu.sort()
f=math.ceil(P**(1/N))
bobo = []
for k in yakusu:
    if k <= f:
        bobo.append(k)
for j in bobo:
    q=pow(j,N)
    if P/q in yakusu:
        ans=int(j)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
#coding:utf-8

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

a = 2
while(1):
  an = a**n
  if p % an == 0:
    p /= an
    res *= a
    continue
  if p < an:
    break
  a += 1

print(res)

Submission status: Time Limit Exceeded

Solution code:
def get_gcd(N, P):
    if N == 1:
        return P
    lst = []
    flg = True
    while flg:
        flg = False
        for i in range(2, P+1):
            if P < i ** N:
                break
            if P % (i ** N) == 0:
                lst.append(i)
                P //= (i ** N)
                flg = True
                break
    ans = 1
    for i in lst:
        ans *= i
    return ans

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

Submission status: Time Limit Exceeded

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

ans = 1
tmp = P
start = P // (2 ** N) + 1
# 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):
    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:
import math

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

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:
import math
N, P = map(int, input().split())
ans=1
yakusu = []
for i in range(1,int(math.sqrt(P))+1):
    if P%i == 0:
        yakusu.append(i)
        yakusu.append(P/i)
yakusu.sort()
f=math.ceil(P**(1/N))
bobo = []
for k in yakusu:
    if k <= f:
        bobo.append(k)
for j in bobo:
    if P/(j**N) in yakusu:
        ans=int(j)
print(ans)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-


# def fun(n, p):
#     sosuu = [2]
#     if n == 1:
#         return p
#
#     base = 1
#     i = 2
#     while True:
#         # base_i = base * i
#         # pow_base_i_n = pow(base * i, n)
#         if pow(base * i, n) > p:
#             return base
#         if p % pow(base * i, n) == 0:
#             if i not in sosuu:
#                 sosuu.append(i)
#             base = base * i
#             # k = 0
#             # i = sosuu[k]
#             # i = 2
#             i = sosuu[-1]
#         else:
#             # k += 1
#             # if len(sosuu) > k + 1:
#             #     i = sosuu[k+1]
#             # else:
#             #     i += 2
#             if i == 2:
#                 i += 1
#             else:
#                 i += 2
#
#     return 1


def dummy(n, p):
    if n == 1:
        return p

    i = 2
    output = 1
    while i <= 1000000:
        if p % pow(i, n) == 0:
            output = i
        i += 1

    return output


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

    # output = fun(N, P)
    output = dummy(N, P)

    print(output)

Submission status: Time Limit Exceeded

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

p2 = int(p ** (1 / n))

for i in range(p2 + 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)
    exit(0)
    
ans = 1
for i in range(2,p):
    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())
ans=1
m=int(pow(p,1/n))+1
i=2
c=0
while(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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
#encoding:utf-8



import math
import random


class Prime:
    seed_primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
    seed_primes_2 = [101, 103, 107, 109,113,127,131,137,139149,151,157,163,173,179,181,191,193,197,199]

    seed_primes.extend(seed_primes_2)

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

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

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

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

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

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

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

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

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

        :param n:
        :return: boolean
        """

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

        # use one of these lines / upper is more efficient.
        witnesses = self.get_witnesses(n)
        # witnesses = [random.randint(1, n - 1) for _ in range(100)]

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

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

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

        return True

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

        return self.seed_primes[:_get_range(num)]

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

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

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

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

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

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

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

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

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

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

            n //= factor

        return primes

N,P = map(int,input().split())
prime = Prime()
facters = prime.find_factors(P)

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


#
# if __name__ == '__main__':
#     prime = Prime()

Submission status: Time Limit Exceeded

Solution code:
N,P = map(int,input().split())
c = int(P**(1/N))+1
while(1):
    if P%(c**N)==0:
        print(c)
        exit()
    c-=1

Submission status: Time Limit Exceeded

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

def heihou_hantei(n):
    m = int(n**0.5)
    return m if abs(m*m - n) < 1e-6 else 0

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

Submission status: Time Limit Exceeded

Solution code:
N, P = map(int, input().split())
p = P**(1/N)
if p % 1 == 0:
    print(int(p))
    exit()

p = (int(p) + 1)//2

dic = {}

def my(N,p,s=2):
    for i in range(s,p+1):
        if p % i == 0:
            dic[i] = dic.get(i,0) + 1
            p = p//i
            s = i
            
            break
    
    if p == 1:
        res = 1
        for j,k in dic.items():
            res *= j**(k//N)
        print(res)
        exit()
    else:
        my(N,p,s)

my(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=P
    N1=2
    while N >= N1:
        N1*=2
        a=math.sqrt(a)

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

    return res

print(C(n,p))

Submission status: Time Limit Exceeded

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

gcd = 1
tmp_P = P

for i in range(1, P+1):
    if tmp_P % i != 0:
        continue
    t = pow(i, N)
    if t > tmp_P:
        break
    while i > 1 and tmp_P % t == 0:
        gcd *= i
        tmp_P /= t

print(gcd)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-


def main():
    """Function."""
    n, p = map(int, input().split())

    if n == 1:
        print(p)
    elif p == 1:
        print(1)
    else:
        x_val = int((p ** (1/n)) // 1) + 1
        for _ in range(x_val-1):
            if p % (x_val ** n) == 0:
                break
            else:
                x_val -= 1

        print(x_val)


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

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

for i in range(2, p):
  while True:
    if P % (i ** N) == 0:
      n *= i
      P = P / (i ** N)
    else:
      break
  if P <= i ** N:
    break 
    
print(n)

Submission status: Time Limit Exceeded

Solution code:
#coding:utf-8

n,p = map(int,input().split())
d = []
res = 1

a = 2
while(1):
  an = a**n
  if p % an == 0:
    p /= an
    res *= a
    continue
  a += 1
  if p < an:
    break

print(res)

Submission status: Time Limit Exceeded

Solution code:
import itertools
import fractions
from functools import reduce


def gcd(*numbers):
    l = list(numbers)
    return reduce(fractions.gcd, l)


n, p = map(int, input().split())
divisor_list = []
if p < 1:
    print(0)

elif p == 1:
    print(1)

else:
    for i in range(2, p // 2 + 1):
        if p % i == 0:
            divisor_list.append(i)
    divisor_list.append(p)

    data = list(itertools.product(divisor_list, repeat=n))
    common = []

    for item in data:
        ans = 0

        for num in item:

            if ans == 0:
                ans = num
            else:
                ans = ans * num

        if ans != p:
            continue
        common.append(reduce(fractions.gcd, list(item)))

    print(max(common))

Submission status: Time Limit Exceeded

Solution code:
import math

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

n = int(math.sqrt(P))
if N >= 4:
    n = int(math.sqrt(n))

for i in range(n+1)[::-1]:
    if i == 0:
        break
    _num = P
    cnt = 0
    if _num % i != 0:
        continue
    if _num % pow(i, N) == 0:
        print(i)
        exit()
print(1)

Submission status: Time Limit Exceeded

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

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

max1=1
max2=1

i=1
while P%((2**i)**N)==0:
    max1=2**i
    i+=1
P//=max1
end=int(P**(1/N))+1
if end%2==0:
    end+=1
for i in range(end,2,-2):
    if P%(i**N)==0:
        max2=i
        break
print(max1*max2)

Submission status: Time Limit Exceeded

Solution code:
n, p = (int(i) for i in input().split())
p_len = len(str(p))
ans = 1
def fanc(p, a):
    b = p % a
    return b

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

Submission status: Time Limit Exceeded

Solution code:
#coding:utf-8

n,p = map(int,input().split())
d = []
res = 1

a = 2
while(1):
  if p % a**n == 0:
    p /= a**n
    res *= a
    continue
  a += 1
  if p < a**n:
    break

print(res)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

ans = 1
tmp = P
start = P // (2 ** N) + 1
# 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):
    while True:
        newtmp, rest = divmod(tmp, (i**N))
        # print(i, tmp, rest, ans)
        if rest == 0:
            ans = ans * i
            tmp = newtmp
        else:
            break
    if newtmp == 0:
        break

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N, P = map(int, input().split())
p = P**(1/N)
if p % 1 == 0:
    print(int(p))
    exit()

p = int(p) + 1

dic = {}

def my(N,p,s=2):
    for i in range(s,p+1):
        if p % i == 0:
            # print('ok')
            dic[i] = dic.get(i,0) + 1
            # print(dic)
            p = p//i
            s = i
            if 2*i**N > P:
                p = 1
            break
    
    if p == 1:
        res = 1
        for j,k in dic.items():
            res *= j**(k//N)
        print(res)
        exit()
    else:
        my(N,p,s)

my(N,P)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-


def fun(n, p):
    sosuu = [2]
    if n == 1:
        return p

    base = 1
    i = 2
    while True:
        # base_i = base * i
        # pow_base_i_n = pow(base * i, n)
        if pow(base * i, n) > p:
            return base
        if p % pow(base * i, n) == 0:
            if i not in sosuu:
                sosuu.append(i)
            base = base * i
            # k = 0
            # i = sosuu[k]
            # i = 2
            i = sosuu[-1]
        else:
            # k += 1
            # if len(sosuu) > k + 1:
            #     i = sosuu[k+1]
            # else:
            #     i += 2
            if i == 2:
                i += 1
            else:
                i += 2


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

    output = fun(N, P)

    print(output)

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()
if n==1:
  print(p)
  exit()
while s==0:
  for i in range(2,int(math.sqrt(R))):
    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:
import math, collections
N, P = map(int, input().split())
n = 1
a = []

def primes_ordered_dict(n):
    #
    prime_list = []
    non_prime_list = []
    number_dict = collections.OrderedDict(
        ((i, None) for i in range(n + 1)))
    #
    del number_dict[0]
    del number_dict[1]
    while True:
        # get prime
        prime, _ = number_dict.popitem(False)
        prime_list.append(prime)
        # break
        if prime * prime > n:
            break
        # get non primes
        non_prime_list.append(prime * prime)
        for k in number_dict:
            if prime * k <= n:
                non_prime_list.append(prime * k)
            else:
                break
        # delete non primes
        for non_prime in non_prime_list:
            del number_dict[non_prime]
        non_prime_list.clear()

    # add rest of numbers as prime
    prime_list.extend(
        [prime for prime, _ in number_dict.items()])

    return prime_list
    
p = math.ceil(P ** (1/N))

a = primes_ordered_dict(p + 1)
    
for i in a:
  while True:
    if P % (i ** N) == 0:
      n *= i
      P = P / (i ** N)
    else:
      break
  if P <= i ** N:
    break 
    
print(n)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
def main():
    l=list(map(int,input().split()))
    ans=1
    P=l[1]
    N=l[0]
    for i in range(2,P+1):
        if P%(i**N)==0:
            ans=i
    print(ans)

if __name__ == '__main__':
    main()