Problem:


Score : 300 points

Problem Statement

There are N integers a_1, a_2, ..., a_N not less than 1.
The values of a_1, a_2, ..., a_N are not known, but it is known that a_1 \times a_2 \times ... \times a_N = P.

Find the maximum possible greatest common divisor of a_1, a_2, ..., a_N.

Constraints

1 \leq N \leq 10^{12}

1 \leq P \leq 10^{12}

Input

Input is given from Standard Input in the following format:

N P

Output

Print the answer.

Sample Input 1

3 24

Sample Output 1

2

The greatest common divisor would be 2 when, for example, a_1=2, a_2=6 and a_3=2.

Sample Input 2

5 1

Sample Output 2

1

As a_i are positive integers, the only possible case is a_1 = a_2 = a_3 = a_4 = a_5 = 1.

Sample Input 3

1 111

Sample Output 3

111

Sample Input 4

4 972439611840

Sample Output 4

206



Sample input:
3 24


Sample output:
2

Submission status: Wrong Answer

Solution code:
import math
n,p=map(int,input().split())

def primes(x):
    if x < 2: return []

    primes = [i for i in range(x)]
    primes[1] = 0 


    for prime in primes:
        if prime > math.sqrt(x): break
        if prime == 0: continue
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]

l=primes(int(p**0.5)+1)
ans=1
for i in range(len(l)):
  if p%(l[i])**n==0:
    ans=ans*l[i]
print(ans)

Submission status: Wrong Answer

Solution code:
import math
n,p=map(int,input().split())

def primes(x):
    if x < 2: return []

    primes = [i for i in range(x)]
    primes[1] = 0 


    for prime in primes:
        if prime > math.sqrt(x): break
        if prime == 0: continue
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]

l=primes(int(p**0.5))
ans=1
for i in range(len(l)):
  if p%(l[i])**n==0:
    ans=ans*l[i]
print(ans)

Submission status: Wrong Answer

Solution code:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)

    divisors.sort()
    return divisors

N, P = map(int, input().split())
def prime_factorization(n):
    res = []
    for d in make_divisors(n):
        if d == 1:
            continue
        while n%d==0:
            res.append(d)
            n//=d
    return res

from collections import Counter
pc = Counter(prime_factorization(P))
ans = 1
for k, v in pc.items():
    loop = v//N
    if loop:
        ans *= k * loop
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter
n, p = map(int, input().split())


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


c = Counter(prime_factorize(p))
ans = 1
for num, cnt in c.items():
    if cnt >= n:
        ans *= num
print(ans)

Submission status: Wrong Answer

Solution code:
N, P = map(int, input().split())


def factorization(n):
    tmp = n
    d = {}
    for i in range(2, int(n ** 0.5) + 1):
        while tmp % i == 0:
            tmp //= i
            if i in d:
                d[i] += 1
            else:
                d[i] = 1

    if tmp != 1:
        d[tmp] = 1

    return d


d = factorization(P)
ans = 1
for k, v in d.items():
    if v >= N:
        n = v // N
        ans *= k * n

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
from heapq import heappush, heappop, heappushpop, heapify, heapreplace
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt
INF = 1 << 60
sys.setrecursionlimit(10 ** 6)

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

#ここから書き始める
n, p = map(int, input().split())
a = factorization(p)
# print("a =", a)
ans = 1
for i in a:
    if i[1] >= n:
        ans *= i[0] * (i[1] // n)
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
from heapq import heappush, heappop, heappushpop, heapify, heapreplace
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt
INF = 1 << 60
sys.setrecursionlimit(10 ** 6)

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

#ここから書き始める
n, p = map(int, input().split())
a = factorization(p)
# print("a =", a)
cnt = 4
is1 = True
b = []
for i in a:
    if i[1] >= n:
        is1 = False
        cnt = min(cnt, i[1])
        b.append(i[0])
# print("b =", b)
if is1:
    print(1)
else:
    ans = 1
    for i in b:
        ans *= i
    ans *= cnt // n
    print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

def factorization(n):
    factor = []
    tmp = int(n ** 0.5) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            factor.append(num)
    factor.append(n)
    factor.sort()
    return factor

lP = factorization(P)
clP = Counter(lP)

ans = 1
for key in clP:
    if clP[key] >= N:
        ans *= key
    # print(key, clP[key])

# print(N, lP)
print(ans)

Submission status: Wrong Answer

Solution code:
N,P=map(int,input().split())
l=[]
pf={}
m=P
for i in range(2,int(m**0.5)+1):
    while m%i==0:
        pf[i]=pf.get(i,0)+1
        m//=i
if m>1:pf[m]=1
keys=list(pf.keys())
val=list(pf.values())
ans=1
for i in range(len(keys)):
    l.append([keys[i],val[i]])
for i in range(len(l)):
    if l[i][1]>=N:
        ans=ans*l[i][0]
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter


def calc_prime_factors(n, count=False):
    """Trial division"""
    factors = []
    # factor: 2
    while n % 2 == 0:
        factors.append(2)
        n //= 2
    # factor: 3, 5, 7, 11, ...
    f = 3
    while f ** 2 <= n:
        if n % f == 0:
            factors.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        factors.append(n)
    if count:
        factors = Counter(factors).items()
    return factors


N, P = map(int, input().split())
factors = calc_prime_factors(P, count=True)
ans = 1
for factor in factors:
    if factor[1] >= N:
        ans *= factor[0]
print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    n, p = LI()
    def fact(x):
        res = 1
        for i in range(2, int(sqrt(x)) + 3):
            t = 0
            while x % i == 0:
                t += 1
                x //= i
            if t >= n:
                res *= i
        return res
    if n == 1:
        print(p)
        return
    print(fact(p))

    return


#main
if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    n, p = LI()
    def fact(x):
        res = 1
        for i in range(2, int(sqrt(x)) + 1):
            t = 0
            while x % i == 0:
                t += 1
                x //= i
            if t >= n:
                res *= i
        return res
    if n == 1:
        print(p)
        return
    print(fact(p))

    return


#main
if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
from collections import defaultdict, Counter

N, P = map(int, input().split())
cnt = defaultdict(int)
for i in range(2, int(P**0.5)+1):
    while P % i == 0:
        cnt[i] += 1
        P //= i
if P > 1:
    cnt[P] += 1
ans = 1
for k in cnt.keys():
    if cnt[k] >= N:
        ans *= k*(cnt[k]//N)
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
from collections import defaultdict, Counter

N, P = map(int, input().split())
cnt = defaultdict(int)
for i in range(2, int(P**0.5)+1):
    while P % i == 0:
        cnt[i] += 1
        P //= i
if P > 1:
    cnt[P] += 1
ans = 1
for k in [k for k in cnt.keys() if cnt[k] >= N]:
    ans *= k
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
from collections import Counter
import math
input = sys.stdin.readline


def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n //= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table


n, p = map(int, input().split())
prime_list = list(Counter(prime_decomposition(p)).items())
ans = 1
for i in range(len(prime_list)):
    cnt = math.floor(prime_list[i][1] / n)
    if cnt >= 1:
        ans *= cnt * prime_list[i][0]
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter,mul
from fractions import gcd
from functools import reduce
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

#https://atcoder.jp/contests/caddi2018/tasks/caddi2018_a

n,p=mii()
# N: 素因数分解する数
#リストで返す
res = []
x = p

y = 2
while y*y <= x:
    while x % y == 0:
        res.append(y)
        x //= y
    y += 1
if x > 1:
    res.append(x)

m=Counter(res)
ans=1
for key ,val in m.items():
    if val>=n:
        ans*=key*(val//n)
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter,mul
from fractions import gcd
from functools import reduce
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

#https://atcoder.jp/contests/caddi2018/tasks/caddi2018_a

n,p=mii()
# N: 素因数分解する数
#リストで返す
res = []
x = p

y = 2
while y*y <= x:
    while x % y == 0:
        res.append(y)
        x //= y
    y += 1
if x > 1:
    res.append(x)

m=Counter(res)
ans=1
for key ,val in m.items():
    if val>=n:
        ans*=key
print(ans)

Submission status: Wrong Answer

Solution code:
n, p = map(int, input().split())
f = []
for i in range(1, int(p**0.5)+1):
        if p%i==0:
                f.append(i)
                f.append(p//i)
ans = 1
for i in f:
        if p%pow(i,n,int(1e12+1))==0: ans = max(ans, i)
print(ans)

Submission status: Wrong Answer

Solution code:
#template
def inputlist(): return [int(j) for j in input().split()]
#template
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
N,P = inputlist()
li = factorization(P)
ans = 1
n = len(li)
for i in range(n):
    k = li[i][1]//N
    if k>=1:
        ans *= li[i][0]*k
print(ans)

Submission status: Wrong Answer

Solution code:
#template
def inputlist(): return [int(j) for j in input().split()]
#template
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
N,P = inputlist()
li = factorization(P)
ans = 1
n = len(li)
for i in range(n):
    if li[i][1]>=N:
        ans *= li[i][0]
print(ans)

Submission status: Wrong Answer

Solution code:
N,P = map(int,input().split())
#素因数分解
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
X = factorization(P)
ans = 1
for i in X:
    ans *= max(1,i[0]*(i[1]//N))
print(ans)

Submission status: Wrong Answer

Solution code:
n, p = map(int, input().split())

res = []
for i in range(2, int(pow(p, 0.5)) + 1):
    if p % i == 0:
        ex = 0
        while p % i == 0:
            ex += 1
            p //= i
        res.append([i, ex])
if p != 1:
    res.append([n, 1])

ans = 1
for p in res:
    k = p[1]
    while k:
        if k < n:
            k = 0
        else:
            ans *= p[0]
            k -= n
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter


def main():
    number, product = map(int, input().split())
    prime_factors = []
    while product % 2 == 0:
        prime_factors.append(2)
        product //= 2
    i = 3
    while i * i <= product:
        if product % i == 0:
            product //= i
            prime_factors.append(i)
        else:
            i += 2
    if product != 1:
        prime_factors.append(product)
    prime_factors = Counter(prime_factors)
    answer = 1
    for p, n in prime_factors.items():
        if number <= n:
            answer *= p
    print(answer)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def factorization(n):
    arr=[]
    temp=n
    for i in range(2,int(n**0.5)+1):
        if(temp%i==0):
            cnt=0
            while temp%i==0:
                cnt+=1
                temp//=i
            arr.append([i,cnt])
    if(not arr):
        arr.append([1,1])
    if(temp!=1):
        arr.append([temp,1])
    return arr

N,P=map(int,input().split())
li=factorization(P)
res=1
for i in range(len(li)):
    if(li[i][1]>=N):
        res*=li[i][0]
print(res)

Submission status: Wrong Answer

Solution code:
import math
def factorization(n):
    arr=[]
    temp=n
    for i in range(2,int(n**0.5)+1):
        if(temp%i==0):
            cnt=0
            while temp%i==0:
                cnt+=1
                temp//=i
            arr.append([i,cnt])
    return arr

N,P=map(int,input().split())
if(N==1):
    print(P)
    exit()
li=factorization(P)
li=sorted(li,key=lambda li:li[1],reverse=True)
res=1
for i in range(len(li)):
    if(li[i][1]>=N):
        res*=li[i][0]
print(res)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

#素因数分解
def prime_factorize(N):
    f = []
    i = 2
    while i * i <= N:
        if N % i == 0:
            #指数
            exp = 0
            #割れる限り割り続ける
            while N % i == 0:
                exp += 1
                N //= i
            #結果をpush
            f.append([i, exp])
        #次の素数へ: 合成数は順次消されている
        i += 1
    #最後残った数について
    if N != 1:
        f.append([N, 1])
    return f

#main
N, P = map(int, input().split())
F = prime_factorize(P)
ans = 1
for i in range(len(F)):
    times = F[i][1]//N
    if times > 0:
        ans *= F[i][0] * times
print(ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

#素因数分解
def prime_factorize(N):
    f = []
    i = 2
    while i * i <= N:
        if N % i != 0:
            i += 1
            continue
        #指数
        exp = 0
        #割れる限り割り続ける
        while N % i == 0:
            exp += 1
            N //= i
        #結果をpush
        f.append([i, exp])
        #次の素数へ: 合成数は順次消されている
        i += 1
    #最後残った数について
    if N != 1:
        f.append([N, 1])
    return f

#main
N, P = map(int, input().split())
F = prime_factorize(P)
ans = 1
for i in range(len(F)):
    times = F[i][1]//N
    if times > 0:
        ans *= F[i][0] * times
print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


class PriorityQueue:
    def __init__(self, l=[]):
        self.q = l
        heapq.heapify(self.q)
        return

    def push(self, n):
        heapq.heappush(self.q, n)
        return

    def pop(self):
        return heapq.heappop(self.q)


MOD = int(1e09) + 7
INF = int(1e15)


def factorization(n):
    S = {}
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            S[i] = cnt

    if temp != 1:
        S[temp] = 1

    if S == []:
        S[n] = 1

    return S


def main():
    # sys.stdin = open("sample.txt")
    N, P = Scanner.map_int()
    S = factorization(P)
    ans = 1
    for k, v in S.items():
        if v >= N:
            ans *= k * (v // N)
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    n, p = map(int, input().split())
    if n == 1:
        print(p)
    else:
        ans = 1
        for i in range(0, int(pow(p, 1/n))+2):
            if p % (2**(i+1)) != 0:
                ans *= 2**(i//n)
                p //= 2**i
                break
        for i in range(3, int(pow(p, 1/n))+2, 2):
            if i**n > p:
                break
            for j in range(0, int(pow(p, 1/n))+2):
                if p % (i**(j+1)) != 0:
                    ans *= i**(j//n)
                    p //= i**j
                    break
        print(ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    n, p = map(int, input().split())
    if n == 1:
        print(p)
    else:
        ans = 1
        if p % 2 == 0:
            for i in range(0, int(pow(p, 1/n))+2):
                if p % (2**(i+1)) != 0:
                    ans *= 2**(i//n)
                    p //= 2**i
                    break
        for i in range(3, int(pow(p, 1/n))+2, 2):
            if i**n > p:
                break
            if p % i == 0:
                for j in range(0, int(pow(p, 1/n))+2):
                    if p % (i**(j+1)) != 0:
                        ans *= i**(j//n)
                        p //= i**j
                        break
        print(ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    n, p = map(int, input().split())
    if n == 1:
        print(p)
    else:
        ans = 1
        for i in range(n-1, int(pow(p, 1/n))+2):
            if p % (2**(i+1)) != 0:
                ans *= 2**(i//n)
                p //= 2**(i//n)
                break
        for i in range(3, int(pow(p, 1/n))+2, 2):
            if i**n > p:
                break
            for j in range(n-1, int(pow(p, 1/n))+2):
                if p % (i**(j+1)) != 0:
                    ans *= i**(j//n)
                    p //= i**(j//n)
                    break
        print(ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    n, p = map(int, input().split())
    if n == 1:
        print(p)
    else:
        ans = 1
        cnt = 0
        while p % 2 == 0:
            p //= 2
            cnt += 1
        if cnt >= n:
            ans *= 2**(cnt//n)
        for i in range(3, int(pow(p, 1/n))+1, 2):
            cnt = 0
            while p % i == 0:
                p //= i
                cnt += 1
            if cnt >= n:
                ans *= i**(cnt//n)
        print(ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import math
def solve():
    N, P = map(int, input().split())
    fac = list(prime_factorize(P).items())
    res = 1
    for p in fac:
        for i in range(p[1] // N):
            res *= p[0]
    
    print(res)

def prime_factorize(n):
    prime_numbers = {}
    for p in range(2, int(math.sqrt(n)+1)):
        if n % p != 0:
            continue
        num = 0
        while n % p == 0:
            n /= p
            num += 1
        prime_numbers[p] = num

    if n != 1:
        prime_numbers[n] = 1
    return prime_numbers

if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

def prime(k):
    res=[]
    while k>1:
        count=2
        flag=False
        while count*count <= k:
            if k%count==0:
                res.append(count)
                k//=count
                flag=True
                break
            count+=1
        if not(flag):
            res.append(k)
            k=1
    return res

n,p=map(int,input().split())
d=defaultdict(int)
for z in prime(p):
    d[z]+=1

ans=1

for c,x in d.items():
    if x<n:
        continue
    ans*=(x//n)*c
if n==1:
    print(p)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

def prime(k):
    res=[]
    while k>1:
        count=2
        flag=False
        while count*count <= k:
            if k%count==0:
                res.append(count)
                k//=count
                flag=True
                break
            count+=1
        if not(flag):
            res.append(k)
            k=1
    return res

n,p=map(int,input().split())
d=defaultdict(int)
for z in prime(p):
    d[z]+=1

ans=1

for c,x in d.items():
    if x<n:
        continue
    ans*=(x//n)*c

print(ans)

Submission status: Wrong Answer

Solution code:
N, P = map(int, input().split())

def factorize(n):
    from collections import defaultdict
    d = defaultdict(int)
    for i in range(2, int(n**0.5)+1):
        while n%i==0:
            d[i] += 1
            n //= i
        if not n:
            break
    return d

d = factorize(P)
ans = 1
for i, j in d.items():
    ans *= (i ** (j//N))
print(ans)

Submission status: Wrong Answer

Solution code:
from math import sqrt, ceil
n, p = map(int, input().split())
if n == 1:
    print(p)
else:
    ret = 1
    for i in range(2, ceil(sqrt(p))):
        if p % (i ** n) == 0:
            ret = i
    print(ret)

Submission status: Wrong Answer

Solution code:
from math import sqrt, ceil
n, p = map(int, input().split())
for i in range(ceil(sqrt(sqrt(p))), 1, -1):
    if p % (i ** n) == 0:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(N: int, P: int):
    def primeFactorize(n: int):
        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

    # print(primeFactorize(P))
    from collections import Counter
    c = Counter(primeFactorize(P))

    ans = 1
    for k, v in c.most_common():
        if v >= N:
            ans *= k*(v//N)


    print(ans)

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    P = int(next(tokens))  # type: int
    solve(N, P)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def factorization(n):
    p=2
    fcr=[]
    while p*p<=n:
        while n%p==0:
            fcr.append(p)
            n//=p
        p+=1
    if n>1:
        fcr.append(n)
    return fcr

n,p=map(int,input().split())
fcr=factorization(p)
ans=1
for i in set(fcr):
  if fcr.count(i)//n>=1:
    ans*=i*(fcr.count(i)//n)
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter

n,p = map(int,input().split())

def prime_decomposition(n):
    table = []
    for i in range(2, int(n**0.5)+1):
        while n%i==0:
            n /= i
            table.append(i)
    if n>1:
        table.append(int(n))
    table = sorted(table, reverse=False)
    return table

lst = prime_decomposition(p)
c = dict(Counter(lst))

ans = 1
for k,v in c.items():
    if v >= n:
        ans *= k*(v//n)
print(ans)