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

# Nの因数を昇順で返す関数。1含む
def factor(n):
    f = []
    for i in range(1, int(n**0.5) + 1):
        if n%i == 0:
            f.append(i)
            if i != n//i:
                f.append(n//i)
    return f

if N == 1:
    print(P)
else:
    ans = 1
    for x in factor(P):
        if P % pow(x,N) == 0:
            ans = max(ans, x)
    print(ans)

Submission status: Time Limit Exceeded

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

if N == 1:
    print(P)
else:
    ans = 1
    for x in range(1, int(P**(1/N))+10):
        if P % pow(x,N) == 0:
            ans = max(ans, x)
    print(ans)

Submission status: Time Limit Exceeded

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

# Nの因数を昇順で返す関数。1含む
def factor(n):
    f = []
    for i in range(1, int(n**0.5) + 1):
        if n%i == 0:
            f.append(i)
            if i != n//i:
                f.append(n//i)
    return f

if N == 1:
    print(P)
else:
    ans = 1
    for x in factor(P):
        if P % x**N == 0:
            ans = max(ans, x)
    print(ans)

Submission status: Time Limit Exceeded

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

if N == 1:
    print(P)
else:
    ans = 1
    x = 1
    while 1:
        k = x**N
        if k > P:
            break
        if P % k == 0:
            ans = max(ans, x)
        x += 1
    print(ans)

Submission status: Time Limit Exceeded

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

if N == 1:
    print(P)
else:
    ans = 1
    for x in range(1, int(P**(1/N))+2):
        if P % (x**N) == 0:
            ans = max(ans, x)
    print(ans)

Submission status: Time Limit Exceeded

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

if N == 1:
    print(P)
else:
    ans = 1
    for x in range(1, int(P**(1/N))+10):
        if P % (x**N) == 0:
            ans = max(ans, x)
    print(ans)

Submission status: Time Limit Exceeded

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

if N == 1:
    print(P)
else:
    ans = 1
    for x in range(1, P):
        k = x**N
        if k > P:
            break
        if P % k == 0:
            ans = max(ans, x)
    print(ans)

Submission status: Time Limit Exceeded

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

if N == 1:
    print(P)
else:
    ans = 1
    for x in range(1, P):
        if P % (x**N) == 0:
            ans = max(ans, x)
        if x**N > P:
            break
    print(ans)

Submission status: Time Limit Exceeded

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

if N == 1:
    print(P)
else:
    ans = 1
    for x in range(1, int(P**0.5)+1):
        if P % (x**N) == 0:
            ans = max(ans, x)
    print(ans)

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 i**N<=P:
		if P%i==0:
			if P%(i**N)==0:
				L.append(i)
			j=(P//i)
			if P%(j**N)==0:
				L.append(j)
	else:
		break
print(max(L))

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 P%i==0:
		if P%(i**N)==0:
			L.append(i)
		j=(P//i)
		if P%(j**N)==0:
			L.append(j)
print(max(L))

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 P%i==0:
		L.append(i)
		L.append(P//i)
L=set(L)
L=sorted(L)
S=[]
for i in L:
	if P%(i**N)==0:
		S.append(i)
print(max(S))

Submission status: Time Limit Exceeded

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

    return divisors
l=make_divisors(P)
l.sort()
#print(l)
for i in range(len(l)):
    a=pow(l[i],N)
    if P//a==0:
        break
    else:
        if P%a==0:
            ans=l[i]
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
def prime_factorization(n):
    res = []
    for i in range(2, int(pow(n, 0.5)) + 1):
        if n % i == 0:
            ex = 0
            while n % i == 0:
                ex += 1
                n //= i
            res.append([i, ex])
    if n != 1:
        res.append([n, 1])
    return res


n, p = map(int, input().split())
res = prime_factorization(p)
ans = [1 for _ in range(n)]
for p in res:
    k = p[1]
    while k:
        for i in range(n):
            if k == 0:
                break
            ans[i] *= p[0]
            k -= 1

print(min(ans))

Submission status: Time Limit Exceeded

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

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

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

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

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

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
def main():
    n, p = map(int, input().split())
    if n == 1:
        print(p)
    else:
        ans = 1
        for i in range(0, 10**6+1):
            if p % (2**(i+1)) != 0:
                ans *= 2**(i//n)
                p //= 2**i
                break
        for i in range(3, 10**6+1, 2):
            if i**n > p:
                break
            for j in range(0, 10**6+1):
                if p % (i**(j+1)) != 0:
                    ans *= i**(j//n)
                    p //= i**j
                    break
        print(ans)

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

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

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

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

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
def main():
    n, p = map(int, input().split())
    if n == 1:
        print(p)
    else:
        ans = 1
        cnt = 0
        while p % 2 == 0:
            p //= 2
            cnt += 1
        if cnt >= n:
            ans *= 2**(cnt//n)
        cnt = 0
        while p % 3 == 0:
            p //= 3
            cnt += 1
        if cnt >= n:
            ans *= 3**(cnt//n)
        cnt = 0
        while p % 5 == 0:
            p //= 5
            cnt += 1
        if cnt >= n:
            ans *= 5**(cnt//n)
        x = 5
        while x**n <= p:
            x += 2
            if x % 3 == 0 or x % 5 == 0:
                continue
            cnt = 0
            while p % x == 0:
                p //= x
                cnt += 1
            if cnt >= n:
                ans *= x**(cnt//n)
        print(ans)

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
import sys
import math
def isPrime(n):
    if n == 1:
        return False
    if n == 2 or n == 3:
        return True
    if n % 2 == 0 or n % 3 == 0:
        return False
    for i in range(5, int(math.sqrt(n)) + 1, 2):
        if n % i == 0:
            return False
    return True

def main():
    n, p = map(int, input().split())
    if n == 1:
        print(p)
    else:
        if isPrime(p):
            print("1")
            sys.exit()
        ans = 1
        cnt = 0
        while p % 2 == 0:
            p //= 2
            cnt += 1
        if cnt >= n:
            ans *= 2**(cnt//n)
        x = 3
        while x**n <= p:
            cnt = 0
            while p % x == 0:
                p //= x
                cnt += 1
            if cnt >= n:
                ans *= x**(cnt//n)
            x += 2
        print(ans)

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
from math import sqrt
def main():
    n, p = map(int, input().split())
    if n == 1:
        print(p)
    else:
        ans = 1
        cnt = 0
        while p % 2 == 0:
            p //= 2
            cnt += 1
        if cnt >= n:
            ans *= 2**(cnt//n)
        x = 3
        while x**n <= p:
            cnt = 0
            while p % x == 0:
                p //= x
                cnt += 1
            if cnt >= n:
                ans *= x**(cnt//n)
            x += 2
        print(ans)

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
from math import sqrt
def main():
    n, p = map(int, input().split())
    if n == 1:
        print(p)
    else:
        ans = 1
        cnt = 0
        while p % 2 == 0:
            p //= 2
            cnt += 1
        if cnt >= n:
            ans *= 2**(cnt//n)
        x = 3
        while x**n <= p:
            cnt = 0
            while p % x == 0:
                p //= x
                cnt += 1
            if cnt >= n:
                ans *= x**(cnt//n)
            x += 1
        print(ans)

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

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

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

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

res = 1
i = 1

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

while True:
    t = np.power(i, N)

    if t > P:
        break
    if P % t == 0:
        res = i

    i += 1

print(res)

Submission status: Time Limit Exceeded

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

res = 1
i = 1

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

while i ** N <= P:
    if P % i ** N == 0:
        res = i

    i += 1

print(res)

Submission status: Time Limit Exceeded

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

res = 1
i = 1

while i ** N <= P:
    if P % i ** N == 0:
        res = i

    i += 1

print(res)

Submission status: Time Limit Exceeded

Solution code:
def prm(a):
  if a == 1 or a == 4:
    return False
  for i in range(2,int((a)**0.5+1)):
    if a%i == 0:
      return False
  else:
    return True
prime = []
for i in range(1,10**6+1):
  if prm(i):
    prime.append(i)
def sepa(a):
  ans = []
  while a>1:
    for x in prime:
      if a%x == 0:
        ans.append(x)
        a = a//x
        break
    else:
      ans.append(a)
      a = 1
  return Counter(ans)
n,p = map(int,input().split())
c = sepa(p)
ans = 1
for k,v in c.values():
  if n<=v:
    ans *= k**(v//n)
print(ans)

Submission status: Time Limit Exceeded

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

from collections import defaultdict
d = defaultdict(int)
i = 2
while P > 1:
    if P%i==0:
        P //= i
        d[i] += 1
    else:
        i += 1

ans = 1
for k, v in d.items():
    # print(k, v)
    z = v // N
    ans *= k**z
print(ans)

Submission status: Time Limit Exceeded

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

l = []
i = 2
while p > 1:
    if p % i == 0:
        p //= i
        l.append(i)
    else:
        i += 1
        if i > p:
            break
        
ans = 1

for i in set(l):
    m = l.count(i)
    if n <= m:
        ans *= i ** (m // n)

print(ans)

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))+1,0,-1):
        if P%(i**N) == 0:
            print(i)
            break

Submission status: Time Limit Exceeded

Solution code:
def primes(n):
  ps = {}
  while n%2==0:
    n//=2
    if 2 not in ps:
      ps[2] = 1
    else:
      ps[2] += 1
  
  for i in range(3,n+1,2):
    while n%i==0:
      n//=i
      if i not in ps:
        ps[i] = 1
      else:
        ps[i] += 1
    if n<i:break
        
  return ps
  
N,P = map(int,input().split())
ps = primes(P)
ans = 1
for p, num in ps.items():
  if num>=N:
    ans *= p**(num//N)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
def sol(x):
  num = P
  cnt = 0
  while cnt<N:
    if cnt!=N-1:
      if num%(x**2)!=0:return False
      else:num/=x**2
      cnt+=2
    else:
      if num%x!=0:return False
      else:num/=x
      cnt += 1
  return True
  

N,P=map(int,input().split())
for x in range(int(P**(1/N))+1,0,-1):
  if sol(x):
    print(x)
    exit()

Submission status: Time Limit Exceeded

Solution code:
def sol(x):
  num = P
  for i in range(N):
    if num%x!=0:return False
    else:num/=x
  return True
  

N,P=map(int,input().split())
for x in range(int(P**(1/N))+1,0,-1):
  if sol(x):
    print(x)
    exit()

Submission status: Time Limit Exceeded

Solution code:
N,P=map(int,input().split())
for x in range(max(int(P**(1/N))+1,1),0,-1):
  if P%(x**N)==0:
    print(x)
    exit()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline


def main():
    N, P = map(int, input().split())
    if N == 1:
        print(P)
        return
    ans = 0
    for i in range(1, 10**6+1):
        y = i**N
        if y > P:
            break
        if P % y == 0:
            ans = i
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline


def main():
    N, P = map(int, input().split())
    x = ans = 1
    if N == 1:
        print(P)
        return
    while True:
        y = x**N
        if y > P:
            break
        if P % y == 0:
            ans = x
        x += 1
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
def sol(p):
  ans = 1
  for i in range(1,int(p**.5)+1):
    if p%i==0:
      if p%i**N==0:
        ans = max(ans,i)
      if i != p//i and p%(p//i)**N==0:
        ans = max(ans,p//i)
        return ans
  return ans  

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

Submission status: Time Limit Exceeded

Solution code:
def divs(p):
  divs = []
  for i in range(1,int(p**.5)+1):
    if p%i==0:
      if p%i**N==0:
        divs.append(i)
      if i != p//i and p%(p//i)**N==0:
        divs.append(p//i)
        return divs
  return divs  

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

divs = sorted(divs(P))
if len(divs) == 0:print(1)
else:print(divs[-1])

Submission status: Time Limit Exceeded

Solution code:
def divs(p):
  divs = []
  for i in range(1,int(p**.5)+1):
    if p%i==0:
      if p%i**N==0:
        divs.append(i)
      if i != p//i and p%(p//i)**N==0:
        divs.append(p//i)
  return divs  

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

divs = sorted(divs(P))
if len(divs) == 0:print(1)
else:print(divs[-1])

Submission status: Time Limit Exceeded

Solution code:
def divs(p):
  divs = []
  for i in range(1,int(p**.5)+1):
    if p%i==0:
      divs.append(i)
      if i != p//i:
        divs.append(p//i)
  return divs  

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

divs = sorted(divs(P),reverse=True)
for div in divs:
  if P%div**N==0:
    print(div)
    exit()
print(1)

Submission status: Time Limit Exceeded

Solution code:
import sys
import math
n, p = [int(i) for i in sys.stdin.readline().split()]

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]

    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

prime = Prime()
facs = prime.find_factors(p)
res = 1
for k, v in facs.items():
    res *= k ** (v // n)
print(res)

Submission status: Time Limit Exceeded

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

    left = 0
    right = 10**12
    while left + 1 < right:
        mid = (left + right) // 2
        if mid**N <= P:
            left = mid
        else:
            right = mid

    cnt = 0
    for j in range(left, 0, -1):
        if P % (j**N) == 0:
            print(j)
            break
        else:
            cnt += 1

    j = left
    cnt = 0
    while P % (j**N) != 0:
        cnt += 1
        j = left // cnt


main()

Submission status: Time Limit Exceeded

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

    left = 0
    right = 10**12
    while left + 1 < right:
        mid = (left + right) // 2
        if mid**N <= P:
            left = mid
        else:
            right = mid

    for j in range(left, 0, -1):
        if P % j**N == 0:
            print(j)
            break


main()

Submission status: Time Limit Exceeded

Solution code:
import sys


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

    left = 0
    right = 10**12
    while left + 1 < right:
        mid = (left + right) // 2
        if mid**N <= P:
            left = mid
        else:
            right = mid

    for j in range(left, 0, -1):
        if P % j**N == 0:
            print(j)
            break


main()

Submission status: Time Limit Exceeded

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

    i = 0
    while i**N <= P:
        i += 1

    i -= 1

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


main()

Submission status: Time Limit Exceeded

Solution code:
N,P=map(int,input().split())
if N==1:
  print(P)
  exit(0)
res=[]
while True:
  if P==1:
    break
  for i in range(2,P+1):
    if P%i==0:
      res.append(i)
      P//=i
      break
  else:
    break

import collections
counter=collections.Counter(res)
ans=1
for c in counter.items():
  key=c[0]
  val=c[1]
  ans*=(key**(val//N))
  
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
N, P = map(int, input().split())
p = math.ceil(P**(1/N))
ans = 1
flag=False
if N==1:
  print(P)
  exit(0)

divisors=[]
for i in range(1,p+1):
  if P%i==0:
    divisors.append(i)
for i in reversed(divisors):
    if P % (i ** N) == 0:
        ans = i
        break
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
N, P = map(int, input().split())
p = math.ceil(P**(1/N))
ans = 1
flag=False
if N==1:
  print(P)
  exit(0)

if P%2==1:
  flag=True
for i in reversed(range(1, p+1)):
    if flag and i%2==0:
      continue
    if P % (i ** N) == 0:
        ans = i
        break
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
N, P = map(int, input().split())
p = math.ceil(P**(1/N))
ans = 1
flag=False
if P%2==1:
  flag=True
for i in reversed(range(1, p+1)):
    if flag and i%2==0:
      continue
    if P % (i ** N) == 0:
        ans = i
        break
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
N, P = map(int, input().split())
p = math.ceil(P**(1/N))
ans = 1
for i in reversed(range(1, p+1)):

    if P % (i ** N) == 0:
        ans = i
        break
print(ans)

Submission status: Time Limit Exceeded

Solution code:
def pow(x, n):
    ans = 1
    while n:
        if n%2:
            ans*=x
        x*=x
        n>>=1
    return ans
n,p=map(int,input().split())
if n==1:
	print(p)
	exit()
ans=1
for i in range(2,int(p**0.5)+2):
	if p<pow(i,n):
		break
	while p%(pow(i,n))==0:
		if p%(pow(i,n))==0:
			ans*=i
			p//=(pow(i,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(2,int(p**0.5)+2):
	if p<pow(i,n):
		break
	while p%(pow(i,n))==0:
		if p%(pow(i,n))==0:
			ans*=i
			p//=(pow(i,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(2,int(p**(1/n))+2):
	while p%(i**n)==0:
		if p%(i**n)==0:
			ans*=i
			p//=(i**n)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
from math import sqrt


def Calc_Divisors(num):
    divisors = []
    for i in range(1, int(sqrt(num)) + 1):
        if num % i == 0:
            divisors.append(i)
            if i != num // i:
                divisors.append(num//i)
    divisors.sort()
    return divisors


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

    A = Calc_Divisors(P)

    ans = 1
    for i in A:
        tmp = P % (i ** N)
        if i ** N > P:
            print(ans)
            exit()
        if tmp == 0:
            ans = i

    print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math

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

p_part_list = {}


for i in range(2,int(p) +1):
  if p % i == 0:
    while (p % i == 0):
      if i not in p_part_list:
        p_part_list[i] = 1
        p = p // i
      else:
        p_part_list[i] += 1
        p = p // i
      
if p > 1:
  p_part_list[p] = 1
  
max_num = 1
#print(p_part_list)

for num in p_part_list:
  if p_part_list[num] >= n:	# N個の整数にその数を最低１個割り振れるかチェック
    if max_num < num * int(p_part_list[num]/n): #均等に割り振れれば、振り振る（１個以上可）
      max_num *= num * int(p_part_list[num]/n)
    
print(max_num)

Submission status: Time Limit Exceeded

Solution code:
from math import sqrt


def Calc_Divisors(num):
    divisors = []
    for i in range(1, int(sqrt(num)) + 1):
        if num % i == 0:
            divisors.append(i)
            if i != num // i:
                divisors.append(num//i)
    divisors.sort()
    return divisors


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

    A = Calc_Divisors(P)

    ans = 1
    for i in A:
        tmp = P % (i ** N)
        if tmp == 0:
            ans = i

    print(ans)

Submission status: Time Limit Exceeded

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

i=2
a=[]
ans=1
while(True):
    if(P%i==0):
        P=P//i
        a.append(i)
    else:
        break

i=3 
while(True):
    if(P%i==0):
        P=P//i
        a.append(i)
        c=1
    else:
        i+=2
        c=0

    if((P<i**N)&(c==0)):
        break

dct=collections.Counter(a)

li=dct.items()

for tt in li:
    if tt[1]>=N:
        ans*=tt[0]**(tt[1]//N)

print(ans)

Submission status: Time Limit Exceeded

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

i=2
c=0
ans=1
while(True):
    if(P%i==0):
        P=P//i
        c+=1
        if(c%N==0):
            ans*=i
    else:
        break
c=0
i=3 
while(True):
    if(P%i==0):
        P=P//i
        c+=1
        if(c%N==0):
            ans*=i
    else:
        i+=2
        c=0
    
    if((P<i**N)&(c==0)):
        break
print(ans)

Submission status: Time Limit Exceeded

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

i = 2
c=0
ans=1
while(True):
    if(P%i==0):
        P=P//i
        c+=1
        if(c%N==0):
            ans*=i
    else:
        i+=1
        c=0
    
    if((P<i**N)&(c==0)):
        break
print(ans)

Submission status: Time Limit Exceeded

Solution code:
from collections import deque

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

q = deque()

i = 2
ans=1
while(True):
    if(P%(i**N)==0):
        q.append(i)
        P=P//(i**N)
        ans*=i
    else:
        i+=1
    if(P<i):
        break
print(ans)

Submission status: Time Limit Exceeded

Solution code:
from collections import deque

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

q = deque()

i = 2
c=0
ans=1
while(True):
    if(P%i==0):
        q.append(i)
        P=P//i
        c+=1
        if(c%N==0):
            ans*=i
    else:
        i+=1
        c=0
    

    if(P<i):
        break
print(ans)

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
# Your code here!
N,P=map(int,input().split())

i=1
ans=1

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

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
# Your code here!
N,P=map(int,input().split())

i=1
ans=1

if N==1:
    print(P)
else:
    try:
        while i**N<=P:#最大値適当
            if P%(i**N)==0:
                ans=i
            i+=1
        print(ans)
    except:
        print(ans)
        
#うんち

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
# Your code here!
N,P=map(int,input().split())

i=1
ans=1

while i**N<=P:
    if P%(i**N)==0:
        ans=i
    i+=1
print(ans)

#むりやろ

Submission status: Time Limit Exceeded

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

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

    C = 1
    while pow(C, N) <= P:
        C += 1

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

    print(1)
if __name__ == '__main__':
    main()