Buggy python submission (verdict: Time Limit Exceeded):
from math import sqrt, floor, log


def is_prime(num):
    if num <= 1:
        return False

    for i in range(2, floor(num / 2) + 1):
        if i == num:
            break
        if num % i == 0:
            return False
    return True


def prime_list(num):
    """
    num以下の素数を求める
    """
    ans = []
    for i in range(2, num + 1):
        if is_prime(i):
            ans.append(i)
    return ans


def factorize(num):
    """
    num >= 2
    numは素数ではない

    :return: [(底, 指数)]
    :rtype: [(int, int)]
    """
    l = prime_list(floor(num / 2))
    print(l)


def get_divisors(num):
    """
    num >= 2
    """
    ans = set()
    for i in range(2, floor(sqrt(num) + 1)):
        if num % i == 0:
            ans.add(i)
    return ans


def get_divisors2(num):
    ans = set()
    for i in range(2, floor(sqrt(num)) + 1):
        if num % i == 0:
            ans.add(i)
    return ans


def get_divisors3(num):
    ans = []
    value = num
    i = 2
    while value != 1:
        count = 0
        while value % i == 0:
            count += 1
            value = value // i

        if count != 0:
            ans.append((i, count))
        i += 1
    return ans


def main():
    n, p = [int(i) for i in input().split()]
    if n == 1:
        print(p)
    elif p == 1:
        print(1)
    else:
        ds = get_divisors3(p)
        ans = 1
        for d in ds:
            if d[1] >= n:
                ans *= d[0] ** (d[1] // n)
        print(int(ans))


if __name__ == '__main__':
    main()


Fixed submission:
from math import sqrt, floor, log


def is_prime(num):
    if num <= 1:
        return False

    for i in range(2, floor(num / 2) + 1):
        if i == num:
            break
        if num % i == 0:
            return False
    return True


def get_divisors3(num):
    ans = []
    value = num
    i = 2
    while (i * i) <= num:
        count = 0
        while value % i == 0:
            count += 1
            value = value // i

        if count != 0:
            ans.append((i, count))
        i += 1
    return ans


def main():
    n, p = [int(i) for i in input().split()]
    if n == 1:
        print(p)
    elif p == 1:
        print(1)
    else:
        ds = get_divisors3(p)
        ans = 1
        for d in ds:
            if d[1] >= n:
                ans *= d[0] ** (d[1] // n)
        print(int(ans))


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from math import sqrt, ceil

n, p = [int(i) for i in input().split()]

if n == 1:
    print(p)
    sys.exit()

if p == 1:
    print(1)
    sys.exit()

ans = []
for i in range(1, p):
    value = i ** n
    if value > p:
        break

    if p % value == 0:
        ans.append(i)

# print(ans)
print(max(ans))


Fixed submission:
from math import sqrt, floor, log


def is_prime(num):
    if num <= 1:
        return False

    for i in range(2, floor(num / 2) + 1):
        if i == num:
            break
        if num % i == 0:
            return False
    return True


def get_divisors3(num):
    ans = []
    value = num
    i = 2
    while (i * i) <= num:
        count = 0
        while value % i == 0:
            count += 1
            value = value // i

        if count != 0:
            ans.append((i, count))
        i += 1
    return ans


def main():
    n, p = [int(i) for i in input().split()]
    if n == 1:
        print(p)
    elif p == 1:
        print(1)
    else:
        ds = get_divisors3(p)
        ans = 1
        for d in ds:
            if d[1] >= n:
                ans *= d[0] ** (d[1] // n)
        print(int(ans))


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from math import sqrt, ceil

n, p = [int(i) for i in input().split()]

if n == 1:
    print(p)
    sys.exit()

if p == 1:
    print(1)
    sys.exit()

ans = []
for i in range(1, p):
    if i ** n > p:
        break

    if p % (i ** n) == 0:
        ans.append(i)

# print(ans)
print(max(ans))


Fixed submission:
from math import sqrt, floor, log


def is_prime(num):
    if num <= 1:
        return False

    for i in range(2, floor(num / 2) + 1):
        if i == num:
            break
        if num % i == 0:
            return False
    return True


def get_divisors3(num):
    ans = []
    value = num
    i = 2
    while (i * i) <= num:
        count = 0
        while value % i == 0:
            count += 1
            value = value // i

        if count != 0:
            ans.append((i, count))
        i += 1
    return ans


def main():
    n, p = [int(i) for i in input().split()]
    if n == 1:
        print(p)
    elif p == 1:
        print(1)
    else:
        ds = get_divisors3(p)
        ans = 1
        for d in ds:
            if d[1] >= n:
                ans *= d[0] ** (d[1] // n)
        print(int(ans))


if __name__ == '__main__':
    main()