Buggy python submission (verdict: Time Limit Exceeded):
N, P = list(map(int, input().split()))
if N == 1:
    print(P)
    exit()
elif P == 1:
    print("1")
    exit()

ans = 1
tmp = P

for i in range(2, P):
    po = pow(i, N)
    while tmp % po == 0:
        tmp = tmp // po
        ans = ans * i
        # print(i, tmp, ans)

    if tmp < po:
        break

print(ans)


Fixed submission:
N, P = list(map(int, input().split()))
if N == 1:
    print(P)
    exit()
elif P == 1:
    print("1")
    exit()

ans = 1
tmp = P

for i in range(2, int(pow(P, 1 / N)) + 1):
    po = pow(i, N)
    while tmp % po == 0:
        tmp = tmp // po
        ans = ans * i
        # print(i, tmp, ans)

    if tmp < po:
        break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from math import sqrt
N, P = list(map(int, input().split()))
if N == 1:
    print(P)
    exit()

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

print(ans)


Fixed submission:
N, P = list(map(int, input().split()))
if N == 1:
    print(P)
    exit()
elif P == 1:
    print("1")
    exit()

ans = 1
tmp = P

for i in range(2, int(pow(P, 1 / N)) + 1):
    po = pow(i, N)
    while tmp % po == 0:
        tmp = tmp // po
        ans = ans * i
        # print(i, tmp, ans)

    if tmp < po:
        break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from math import sqrt
N, P = list(map(int, input().split()))
if N == 1:
    print(P)
    exit()

ans = 1
tmp = P
# start = int(sqrt(P))
# 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, int(sqrt(P)) + 1):
    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)


Fixed submission:
N, P = list(map(int, input().split()))
if N == 1:
    print(P)
    exit()
elif P == 1:
    print("1")
    exit()

ans = 1
tmp = P

for i in range(2, int(pow(P, 1 / N)) + 1):
    po = pow(i, N)
    while tmp % po == 0:
        tmp = tmp // po
        ans = ans * i
        # print(i, tmp, ans)

    if tmp < po:
        break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
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)


Fixed submission:
N, P = list(map(int, input().split()))
if N == 1:
    print(P)
    exit()
elif P == 1:
    print("1")
    exit()

ans = 1
tmp = P

for i in range(2, int(pow(P, 1 / N)) + 1):
    po = pow(i, N)
    while tmp % po == 0:
        tmp = tmp // po
        ans = ans * i
        # print(i, tmp, ans)

    if tmp < po:
        break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
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)


Fixed submission:
N, P = list(map(int, input().split()))
if N == 1:
    print(P)
    exit()
elif P == 1:
    print("1")
    exit()

ans = 1
tmp = P

for i in range(2, int(pow(P, 1 / N)) + 1):
    po = pow(i, N)
    while tmp % po == 0:
        tmp = tmp // po
        ans = ans * i
        # print(i, tmp, ans)

    if tmp < po:
        break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, P = list(map(int, input().split()))


import random


def is_prime(q, k=50):
    q = abs(q)
    # 計算するまでもなく判定できるものははじく
    if q == 2:
        return True
    if q < 2 or q & 1 == 0:
        return False

    # n-1=2^s*dとし（但しaは整数、dは奇数)、dを求める
    d = (q - 1) >> 1
    while d & 1 == 0:
        d >>= 1

    # 判定をk回繰り返す
    for i in range(k):
        a = random.randint(1, q - 1)
        t = d
        y = pow(a, t, q)
        #[0,s-1]の範囲すべてをチェック
        while t != q - 1 and y != 1 and y != q - 1:
            y = pow(y, 2, q)
            t <<= 1
        if y != q - 1 and t & 1 == 0:
            return False
    return True


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):
    if not is_prime(i):
        continue
    while True:
        rest = tmp % (i ** N)
        newtmp = tmp // (i ** N)
        # print(i, tmp, rest, ans)
        if rest == 0:
            ans = ans * i
            tmp = newtmp
        else:
            break
    if newtmp == 0:
        break

print(ans)


Fixed submission:
N, P = list(map(int, input().split()))
if N == 1:
    print(P)
    exit()
elif P == 1:
    print("1")
    exit()

ans = 1
tmp = P

for i in range(2, int(pow(P, 1 / N)) + 1):
    po = pow(i, N)
    while tmp % po == 0:
        tmp = tmp // po
        ans = ans * i
        # print(i, tmp, ans)

    if tmp < po:
        break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, P = list(map(int, input().split()))


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


ans = 1
tmp = P

for i in range(2, P):
    if not is_prime(i):
        continue
    while True:
        rest = tmp % (i ** N)
        newtmp = tmp // (i ** N)
        # print(i, tmp, rest, ans)
        if rest == 0:
            ans = ans * i
            tmp = newtmp
        else:
            break
    if newtmp == 0:
        break

print(ans)


Fixed submission:
N, P = list(map(int, input().split()))
if N == 1:
    print(P)
    exit()
elif P == 1:
    print("1")
    exit()

ans = 1
tmp = P

for i in range(2, int(pow(P, 1 / N)) + 1):
    po = pow(i, N)
    while tmp % po == 0:
        tmp = tmp // po
        ans = ans * i
        # print(i, tmp, ans)

    if tmp < po:
        break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
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))
    if rest == 0:
        ans = ans * i
        tmp = newtmp

print(ans)


Fixed submission:
N, P = list(map(int, input().split()))
if N == 1:
    print(P)
    exit()
elif P == 1:
    print("1")
    exit()

ans = 1
tmp = P

for i in range(2, int(pow(P, 1 / N)) + 1):
    po = pow(i, N)
    while tmp % po == 0:
        tmp = tmp // po
        ans = ans * i
        # print(i, tmp, ans)

    if tmp < po:
        break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, P = list(map(int, input().split()))

ans = 1
tmp = P
for i in range(2, P):
    while True:
        rest = tmp % (i ** N)
        newtmp = tmp // (i ** N)
        # print(tmp, rest, ans)
        if rest == 0:
            ans = ans * i
            tmp = newtmp
        else:
            break
    if newtmp == 0:
        break

print(ans)


Fixed submission:
N, P = list(map(int, input().split()))
if N == 1:
    print(P)
    exit()
elif P == 1:
    print("1")
    exit()

ans = 1
tmp = P

for i in range(2, int(pow(P, 1 / N)) + 1):
    po = pow(i, N)
    while tmp % po == 0:
        tmp = tmp // po
        ans = ans * i
        # print(i, tmp, ans)

    if tmp < po:
        break

print(ans)