Buggy python submission (verdict: Time Limit Exceeded):
n, p = map(int, input().split())
if n == 1:
    print(p)
else:
    ans = 1
    t = True
    for i in range(int(p ** (1 / n)) + 1, 2, -1):
        if p % (i ** n) == 0:
            ans = i
            t = False
            print(ans)
            break
    if t:
        if p % (2 ** n) == 0:
            print(2)
        else:
            print(1)




Fixed submission:
import collections

def prime_return(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

n, p = map(int, input().split())
t = collections.Counter(prime_return(p))
ans = 1
for k, v in t.items():
    if v >= n:
        ans *= (k ** (v // n))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, p = map(int, input().split())
if n == 1:
    print(p)
else:
    ans = 1
    for i in range(int(p ** (1 / n)) + 1, 1, -1):
        if p % (i ** n) == 0:
            ans = i
            print(ans)
            break
    if ans == 1:
        print(ans)




Fixed submission:
import collections

def prime_return(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

n, p = map(int, input().split())
t = collections.Counter(prime_return(p))
ans = 1
for k, v in t.items():
    if v >= n:
        ans *= (k ** (v // n))
print(ans)

Buggy python submission (verdict: Runtime Error):
n, p = map(int, input().split())
if n == 1:
    print(p)
else:
    ans = 1
    for i in range(2, int(p ** (1 / n)) + 1):
        if p % (i ** n) == 0:
            ans = i
    if ans == 1:
        if p % ((i + 1) ** n) == 0:
            ans = i + 1
    print(ans)

Fixed submission:
import collections

def prime_return(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

n, p = map(int, input().split())
t = collections.Counter(prime_return(p))
ans = 1
for k, v in t.items():
    if v >= n:
        ans *= (k ** (v // n))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, p = map(int, input().split())
if n == 1:
    print(p)
else:
    ans = 1
    for i in range(2, int(p ** (1 / n)) + 2):
        if p % (i ** n) == 0:
            ans = i
    print(ans)

Fixed submission:
import collections

def prime_return(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

n, p = map(int, input().split())
t = collections.Counter(prime_return(p))
ans = 1
for k, v in t.items():
    if v >= n:
        ans *= (k ** (v // n))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, p = map(int, input().split())
from collections import defaultdict
prime_list = [2]
for i in range(3, int(p ** (0.5)), 2):
    for prime in prime_list:
        if i % prime == 0:
            break
    prime_list.append(i)
pt = p
prime_dict = defaultdict(lambda : 0)
for prime in prime_list:
    point = 0
    while pt % prime == 0:
        point += 1
        pt = pt // prime
    prime_dict[prime] = point
ans = 1
if n > 1:
    for i, j in prime_dict.items():
        if j >= n:
            ans = ans * i
else:
    ans = p
print(ans)

Fixed submission:
import collections

def prime_return(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

n, p = map(int, input().split())
t = collections.Counter(prime_return(p))
ans = 1
for k, v in t.items():
    if v >= n:
        ans *= (k ** (v // n))
print(ans)