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


Fixed submission:
import sys
input = sys.stdin.readline


def prime_factorize(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


def main():
    N, P = map(int, input().split())
    p = prime_factorize(P)
    import collections
    ans = 1
    for k, v in collections.Counter(p).most_common():
        while v >= N:
            ans *= k
            v -= N
    print(ans)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
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()


Fixed submission:
import sys
input = sys.stdin.readline


def prime_factorize(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


def main():
    N, P = map(int, input().split())
    p = prime_factorize(P)
    import collections
    ans = 1
    for k, v in collections.Counter(p).most_common():
        while v >= N:
            ans *= k
            v -= N
    print(ans)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
N, P = map(int, input().split())
if N == 1:
    print(P)
    exit()

x = ans = 1
while True:
    y = x**N
    if y > P:
        break
    if P % y == 0:
        ans = x
    x += 1
print(ans)


Fixed submission:
import sys
input = sys.stdin.readline


def prime_factorize(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


def main():
    N, P = map(int, input().split())
    p = prime_factorize(P)
    import collections
    ans = 1
    for k, v in collections.Counter(p).most_common():
        while v >= N:
            ans *= k
            v -= N
    print(ans)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline


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

if __name__ == '__main__':
    main()


Fixed submission:
import sys
input = sys.stdin.readline


def prime_factorize(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


def main():
    N, P = map(int, input().split())
    p = prime_factorize(P)
    import collections
    ans = 1
    for k, v in collections.Counter(p).most_common():
        while v >= N:
            ans *= k
            v -= N
    print(ans)


if __name__ == '__main__':
    main()

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


Fixed submission:
import sys
input = sys.stdin.readline


def prime_factorize(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


def main():
    N, P = map(int, input().split())
    p = prime_factorize(P)
    import collections
    ans = 1
    for k, v in collections.Counter(p).most_common():
        while v >= N:
            ans *= k
            v -= N
    print(ans)


if __name__ == '__main__':
    main()