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

Fixed submission:
import math

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

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

ans = 1
p = 2
logP = math.log(P)
while N * math.log(p) <= logP:
    k = 0
    while P % p == 0:
        P //= p
        k += 1
    ans *= p**(k//N)
    if k > 0:
        logP = math.log(P)

    r = p % 6
    if r == 1:
        p += 4
    elif r == 5:
        p += 2
    else:
        p += 1

print(ans)

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

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

primelist=[]
powerlist=[]

p=2
while P >= p**N:        
    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)

Fixed submission:
import math

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

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

ans = 1
p = 2
logP = math.log(P)
while N * math.log(p) <= logP:
    k = 0
    while P % p == 0:
        P //= p
        k += 1
    ans *= p**(k//N)
    if k > 0:
        logP = math.log(P)

    r = p % 6
    if r == 1:
        p += 4
    elif r == 5:
        p += 2
    else:
        p += 1

print(ans)

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

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

primelist=[]
powerlist=[]

p=2
while P >= p**N:        
    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)

Fixed submission:
import math

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

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

ans = 1
p = 2
logP = math.log(P)
while N * math.log(p) <= logP:
    k = 0
    while P % p == 0:
        P //= p
        k += 1
    ans *= p**(k//N)
    if k > 0:
        logP = math.log(P)

    r = p % 6
    if r == 1:
        p += 4
    elif r == 5:
        p += 2
    else:
        p += 1

print(ans)

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

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

primelist=[]
powerlist=[]

p=2
while P >= p**N:        
    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**N) == 0:
            P //= (p**N)
            k += 1
        primelist.append(p)
        powerlist.append(k)
        p += 1

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

print(ans)

Fixed submission:
import math

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

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

ans = 1
p = 2
logP = math.log(P)
while N * math.log(p) <= logP:
    k = 0
    while P % p == 0:
        P //= p
        k += 1
    ans *= p**(k//N)
    if k > 0:
        logP = math.log(P)

    r = p % 6
    if r == 1:
        p += 4
    elif r == 5:
        p += 2
    else:
        p += 1

print(ans)

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

primelist=[]
powerlist=[]

p=2
while P >= p**N:        
    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**N) == 0:
            P //= (p**N)
            k += 1
        primelist.append(p)
        powerlist.append(k)
        p += 1

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

print(ans)

Fixed submission:
import math

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

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

ans = 1
p = 2
logP = math.log(P)
while N * math.log(p) <= logP:
    k = 0
    while P % p == 0:
        P //= p
        k += 1
    ans *= p**(k//N)
    if k > 0:
        logP = math.log(P)

    r = p % 6
    if r == 1:
        p += 4
    elif r == 5:
        p += 2
    else:
        p += 1

print(ans)