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:
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())
factors = factorization(p)
ans = 1
for num, score in factors:
    if score >= n:
        ans *= num
print(ans)

Submission status: Wrong Answer

Solution code:
import itertools
from fractions import *
from functools import *
def gcds(n):
    return reduce(gcd,n)
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

n,p=map(int,input().split())
a=prime_factorize(p)
if n == 1:
    print(p)
    exit()
if p==1:
    print(1)
    exit()
print(a)
tmp=0
x=10**12
b=set(a)
b=list(b)
b=sorted(b,key=lambda x:a.count(x),reverse=True)
ans = 1
for i in b:
    if a.count(i) >= n:
        ans *= i
if ans == 1:
    ans = max(a)
print(ans)

Submission status: Wrong Answer

Solution code:
import itertools
from fractions import *
from functools import *
def gcds(n):
    return reduce(gcd,n)
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

n,p=map(int,input().split())
a=prime_factorize(p)
if n == 1:
    print(p)
    exit()
if p==1:
    print(1)
    exit()
x=[i for i in range(1,len(a)+1)]
tmp=0
x=10**12
b=set(a)
b=list(b)
b=sorted(b,key=lambda x:a.count(x),reverse=True)
ans = 1
for i in b:
    if a.count(i) >= n:
        ans *= i
print(ans)

Submission status: Wrong Answer

Solution code:

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

n,p=map(int,input().split())
a=prime_factorize(p)
tmp=0
x=10**12
b=set(a)
b=list(b)
b=sorted(b,key=lambda x:a.count(x),reverse=True)
ans = 1
for i in b:
    if a.count(i) >= n:
        ans *= i
print(ans)

Submission status: Wrong Answer

Solution code:
n, p = map(int, input().split())
ex_list = []
max_ex = (1, n)
if n == 1:
    ans = p
else:
    ans = 1
    for i in range(2, int(p**(1/2)+1)):
        cnt = 0
        while p % i == 0:
            p /= i
            cnt += 1
        if cnt > 1:
            ex_list.append((i, cnt))
            if cnt >= n:
                ans *= i * int(cnt / n)
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
n, p = map(int, input().split())
cnt = defaultdict(int)
if n == 1:
    print(p)
    exit()
for i in range(2, int(p ** 0.5) + 1):
    flag = False
    while p % i == 0:
        p //= i
        cnt[i] += 1
ans = 1
print(cnt)
for k, v in cnt.items():
    ans *= k ** (v // n)

print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
n, p = map(int, input().split())
cnt = defaultdict(int)
for i in range(2, int(p ** 0.5) + 1):
    flag = False
    while p % i == 0:
        p //= i
        cnt[i] += 1
ans = 1
for k, v in cnt.items():
    ans *= k ** (v // n)

print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter

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
n, p = map(int, input().split())
c = Counter(prime_factorize(p))
ans = 1
for i in c.most_common():
    if i[1] >= n:
        ans *= i[0]
print(ans)

Submission status: Wrong Answer

Solution code:
import math

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

K = math.floor(M**(1/N))

for i in range (0, K):
	if M%((K-i)**N)==0:
		print(K-i)
		exit()

Submission status: Wrong Answer

Solution code:
import collections
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
l = collections.Counter(prime_factorize(p))

ans = 1
for e in l.items():
    if (e[1] // n) >= 1:
        ans *= e[0] * (e[1]//n)
print(ans)

Submission status: Wrong Answer

Solution code:
def prime_factorize(n):
    res = []
    for i in range(2, int(n**(1/2))+1):
        if n % i != 0: continue
        num = 0
        while n % i == 0:
            num += 1
            n /= i
        res.append((i, num))
    if n != 1:
        res.append((n, 1))
    
    return res

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

prime = prime_factorize(p)

ans = 1
for k, v in prime:
    if v >= n:
        ans *= k

print(int(ans))

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def SI(): return input().split()

def printlist(lst, k='\n'): print(k.join(list(map(str, lst))))
INF = float('inf')

from math import ceil, floor, log2
from collections import deque
from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product
from heapq import heapify, heappop, heappush


def solve():
    n, p = MI()

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

    fact = prime_factorization(p)
    print(fact)

    ans = 1
    for (num, ex) in fact:
        # print(num, ex)
        while ex >= n:
            ans *= num
            ex -= n
    print(ans)


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def SI(): return input().split()

def printlist(lst, k='\n'): print(k.join(list(map(str, lst))))
INF = float('inf')

from math import ceil, floor, log2
from collections import deque
from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product
from heapq import heapify, heappop, heappush


def solve():
    n, p = MI()

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

    fact = prime_factorization(p)
    # print(fact)

    ans = 1
    for (num, ex) in fact:
        if ex >= n:
            ans *= num
    print(ans)


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
n, p = map(int, input().split())
d = {}
while p % 2 == 0:
    if 2 not in d:
        d[2] = 1
    else:
        d[2] += 1
    p //= 2
f = 3
while f * f <= p:
    if p % f == 0:
        if f not in d:
            d[f] = 1
            p //= f 
        else:
            d[f] += 1
            p //= f
    else:
        f += 2
if p != 1:
    if p not in d:
        d[p] = 1
    else:
        d[p] += 1
d = sorted(d.items(), key=lambda x:x[1], reverse=True)
ans = 1
for k, v in d:
    if v < n:
        break
    else:
        ans *= k
print(ans)

Submission status: Wrong Answer

Solution code:
n,p=map(int,input().split());a=1
print(p or exec("for i in range(2,int(p**(1./n))+1):\n while p%(i**n)<1:a*=i;p//=i**n")or a)

Submission status: Wrong Answer

Solution code:
n,p=map(int,input().split());a=1
print(n or exec("for i in range(2,int(p**(1./n))+1):\n while p%(i**n)<1:a*=i;p//=i**n")or a)

Submission status: Wrong Answer

Solution code:
n,p=map(int,input().split());a=1
if n<2:print(n);exit()
for i in range(2,int(p**(1./n))+1):
 while p%(i**n)<1:a*=i;p//=i**n
print(a)

Submission status: Wrong Answer

Solution code:
n,P = map(int,input().split())
#i = 2
from collections import defaultdict
dic = defaultdict(int)
# 約数分解
i = 2
p = P
while p > 1:
    if p%i == 0:
        dic[i] += 1
        p //= i
    else:
        i += 1
#print(dic)
ans = 1
if n == 1:
    print(P)
else:
    for k,v in dic.items():
        #print(k*(v//n))
        if v//n >= 1:
            ans *= k * (v//n)
    print(ans)

Submission status: Wrong Answer

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

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


def solve(p):
    i = 2
    ps = defaultdict(lambda: 0)
    while i * i <= p:
        while p % i == 0:
            p //= i
            ps[i] += 1
        i += 1
    return ps


ans = 1
for k, v in solve(p).items():
    if v >= n:
        coef = v // n
        ans = ans * k * coef

print(ans)

Submission status: Wrong Answer

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

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


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


ans = 1
for k, v in factorization(p):
    if v >= n:
        coef = v // n
        ans = ans * k * coef

print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter
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


ans = 1
for k, v in factorization(p):
    if v >= n:
        coef = v // n
        ans = ans * k * coef

print(ans)

Submission status: Wrong Answer

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

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
n,p=map(int,input().split())
if n==1:
    print(p)
    exit()
d=dict()
pp=p
i=2
while p>2:
    if p%i==0:
        p//=i
        if i in d:
            d[i]+=1
        else:
            d[i]=1
    elif i>pp**0.5:
        break
    else:
        i+=1
p=1
if d:
    for i,j in d.items():
        p*=i**(j//n)
    print(p)
else:
    print(1)

Submission status: Wrong Answer

Solution code:
n,p=map(int,input().split())
if n==1:
    print(p)
    exit()
d=dict()
pp=p
i=2
while p>2:
    if p%i==0:
        p//=i
        if i in d:
            d[i]+=1
        else:
            d[i]=1
    elif i>pp**0.5:
        break
    else:
        i+=1
if d:
    for i,j in d.items():
        p*=i**(j//n)
    print(p)
else:
    print(1)

Submission status: Wrong Answer

Solution code:
N,P=map(int,input().split())
ans=1
pf={}
if N==1:
    print(P)
else:
    M=P
    for p in range(2,round(M**0.5)+1):
        pf[p]=0
        while P%p==0:
            P//=p
            pf[p]+=1
        if P==1:
            break
    for p in pf:
        if pf[p]>=N:
            ans*=p
    print(ans)

Submission status: Wrong Answer

Solution code:
N,P=map(int,input().split())
ans=1
pf={}
if N==1:
    print(P)
else:
    for p in range(2,round(P**0.5)+1):
        pf[p]=0
        while P%p==0:
            P//=p
            pf[p]+=1
        if P==1:
            break
    for p in pf:
        if pf[p]>=N:
            ans*=p
    print(ans)

Submission status: Wrong Answer

Solution code:
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


a = prime_factorize(p)

from collections import Counter
c = Counter(a)

ans = 1
for i in c:
    ans *= max(1,c[i]//n*i)

print(ans)

Submission status: Wrong Answer

Solution code:
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


a = prime_factorize(p)

from collections import Counter
c = Counter(a)

ans = 1
for i in c:
    if c[i]>=n:
        ans *= c[i]//n*i

print(ans)

Submission status: Wrong Answer

Solution code:
n,p = map(int,input().split())
ans = 1
if n == 1:
    print(p)
else:
    cnt = 0
    while p % 2 == 0:
        p //= 2
        cnt += 1
    ans *= 2**(cnt//n)
    #print(2,cnt,p)
    for i in range(3,int(p**(1/n)+1),2):
        cnt = 0
        while p % i == 0:
            p //= i
            cnt += 1
        #print(i,cnt,p)
        ans *= i**(cnt//n)
        if p == 1:
            break
    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

fac = list(reversed(factorization(P)))
ans = 1

for sosuu, cnt in fac:
    cnt //= N
    if cnt>0:
        ans *= (sosuu*cnt)

print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

def factorize(N):
    p = 2
    PRIME = []
    while p * p <= N:
        if N % p == 0:
            N //= p
            PRIME.append(p)
        else:
            p += 1
    if N > 1:
        PRIME.append(N)
    return PRIME


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

prime = factorize(p)
cnt = defaultdict(int)
for i in prime:
    cnt[i] += 1
ans = 1
for j in cnt:
    if cnt[j] >= n:
        ans *= j*(cnt[j]//n)
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

def factorize(N):
    p = 2
    PRIME = []
    while p * p <= N:
        if N % p == 0:
            N //= p
            PRIME.append(p)
        else:
            p += 1
    if N > 1:
        PRIME.append(N)
    return PRIME


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

prime = factorize(p)
cnt = defaultdict(int)
for i in prime:
    cnt[i] += 1
ans = 1
for j in cnt:
    if cnt[j] >= n:
        ans *= j
print(ans)

Submission status: Wrong Answer

Solution code:
N, P = [int(_c) for _c in input().split(" ")]
 
if N == 1:
    print(P)
else:
    _max = 1
    M = int(P ** (1 / N))
    for i in range(1, M + 1):
        var = i ** N
        if P % var == 0:
            _max = i
 
    print(_max)

Submission status: Wrong Answer

Solution code:
N, P = [int(_c) for _c in input().split(" ")]

if N == 1:
    print(P)
else:
    _max = 1
    M = int(P ** (1 / N))
    for i in range(1, M + 1):
        var = i ** N
        if P % var == 0:
            _max = i

    print(_max)

Submission status: Wrong Answer

Solution code:
N, P = [int(_c) for _c in input().split(" ")]

if N == 1:
    print(P)
else:
    _max = -1
    M = int(P ** (1 / N))
    if M == 0:
        M = 1
    for i in range(1, M + 1):
        var = i ** N
        if P % var == 0:
            _max = i

    print(_max)

Submission status: Wrong Answer

Solution code:
N, P = [int(_c) for _c in input().split(" ")]

if N == 1:
    print(P)
else:
    _max = -1
    M = int(P ** (1 / N))
    for i in range(1, M + 1):
        var = i ** N
        if P % var == 0:
            _max = i

    print(_max)

Submission status: Wrong Answer

Solution code:
N, P = [int(_c) for _c in input().split(" ")]

if N == 1:
    print(P)
else:
    _max = -1
    M = int(P ** (1 / N))
    for i in range(1, M):
        var = i ** N
        if P % var == 0:
            _max = i

    print(_max)

Submission status: Wrong Answer

Solution code:
def factorize(n):
    if n==1:
        return [1]
    a=[]
    f=2
    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 r(a):
    ll,l=[],1
    for i in range(len(a)-1):
        if a[i]==a[i+1]:
            l+=1
        else:
            ll.append([l,a[i]])
            l=1
    ll.append([l,a[-1]])
    return ll
n,p=map(int,input().split())
a=r(factorize(p))
b=1
for i in a:
    b*=i[1]**(i[0]//n)
print(b)

Submission status: Wrong Answer

Solution code:
n,p=map(int,input().split())
if n==1:
    print(p)
    exit()
import math 
use=math.floor(p**(1/n))
while True :
    if p%(use**n)==0:
        print(use)
        break
    use-=1

Submission status: Wrong Answer

Solution code:
n,p=map(int,input().split())
import math 
use=math.floor(p**(1/n))
while True :
    if p%(use**n)==0:
        print(use)
        break
    use-=1

Submission status: Wrong Answer

Solution code:
n,p=map(int,input().split())
d=dict()
for i in range(2,int(p**0.5)+1):
    d[i]=0
    while p%i==0:
        d[i]+=1
        p//=i
ans=1
for i in d.keys():
    ans*=i**(d[i]//n)
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter
def p_factorization(n):
  p=[]
  for i in range(2,int(n**0.5)+1):
    while n%i==0:
      p.append(i)
      n//=i
  if n>1:
    p.append(n)
  return p

n,p=map(int,input().split())
ans=1
for i,j in Counter(p_factorization(p)).items():
  print(i,j)
  ans*=(i**(j//n) if j//n>0 else 1)
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter
def p_factorization(n):
  p=[]
  for i in range(2,int(n**0.5)+1):
    while n%i==0:
      p.append(i)
      n//=i
  if n>1:
    p.append(n)
  return p

n,p=map(int,input().split())
ans=1
for i,j in Counter(p_factorization(p)).items():
  ans*=(i*(j//n) if j//n>0 else 1)
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])

    arr.append([temp, 1])

    return arr

a = factorization(P) 
su = 1
for j,k in a:
  #print(j,k,a)
  if k>=N:
    su *= j**(k//N)
    #print(j,k,su)
print(su,a)

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

a = factorization(P) 
su = 1
for j,k in a:
 # print(j,k,a)
  if k>=N:
    su *= j**(k//N)
  #  print(j,k,su)
print(su,a)

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

a = factorization(P) 
su = 1
for j,k in a:
 # print(j,k)
  if k>=N:
    su *= j*(k//N)
#    print(j,k,su)
print(su)

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

a = factorization(P) 
su = 1
for j,k in a:
 # print(j,k)
  if k>=N:
    su *= j
#    print(j,k,su)
print(su)

Submission status: Wrong Answer

Solution code:
def solve():
    N, P = map(int, input().split())
    
    ans = 1
    i = 2
    while i**N < P: 
        if P % (i**N) == 0:
            P /= (i**N)
            ans *= i
        else:
            i += 1
    
    return ans

print(solve())

Submission status: Wrong Answer

Solution code:
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())

vals = factorization(P)
ans = 1
for x in vals:
    if x[1] >= N:
        ans *= x[0]
print(ans)

Submission status: Wrong Answer

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

# https://qiita.com/snow67675476/items/e87ddb9285e27ea555f8
# 素因数分解
"""
>>> factorization(16)
[[2, 4]]
>>> factorization(48)
[[2, 4], [3, 1]]
"""

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
l = factorization(p)
res = 1
for num,cnt in l:
    if cnt >=n:
        cnt = cnt // n
        res *= num * cnt
#print(l)
print(res)

Submission status: Wrong Answer

Solution code:
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())
pf = factorization(p)

ans = 1
for i in pf:
    if i[1] >= n:
        ans *= i[0]
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

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

def divisors(n): #sortはしてない
    ret = set()
    m = 1
    while m*m <= n:
        if n%m==0:
            ret.add(m)
            ret.add(n//m)
        m += 1
    return ret

ndivs = list(divisors(p))
ndivs.sort()

ma = int(pow(p,1/n))

from bisect import bisect_right
index = bisect_right(ndivs, ma)

for i in reversed(range(index)):
    if p%(pow(ndivs[i],n))==0:
        print(ndivs[i])
        exit()

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

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

def divisors(n): #sortはしてない
    ret = set()
    m = 1
    while m*m <= n:
        if n%m==0:
            ret.add(m)
            ret.add(n//m)
        m += 1
    return ret

ndivs = list(divisors(p))
ndivs.sort()

ma = int(p**(1/n))


from bisect import bisect_right
index = bisect_right(ndivs, ma) # 2 最も左(前)の挿入箇所が返ってきている

for i in reversed(range(index)):
    if p%(ndivs[i]**n)==0:
        print(ndivs[i])
        exit()

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

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

def divisors(n):
    ret = set()
    m = 1
    while m*m <= n:
        if n%m==0:
            ret.add(m)
            ret.add(n//m)
        m += 1
    return ret

ndivs = list(divisors(p))

for i in reversed(ndivs):
    if p%(i**n)==0:
        print(i)
        exit()

Submission status: Wrong Answer

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

for i in range(int(p**(1/n)),0,-1):
    if p%i!=0:
        continue
    if p%(pow(i,n))==0:
        print(i);exit()

Submission status: Wrong Answer

Solution code:
from collections import Counter
n,p = [int(i) for i in 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 k,v in c.items():
    if v >= n:
        ans *= k
        
print(ans)

Submission status: Wrong Answer

Solution code:
n, p = map(int, input().split())
di = {}
for i in range(2, int(p**0.5)+1):
    if p%i==0:
        tmp = 0
        while p%i==0:
            p //= i
            tmp += 1
        di[i] = tmp
    if p==1:
        break
else:
    di[p] = 1
ans = 1
for i, j in di.items():
    if j//n:
        ans *= i*(j//n)
print(ans)

Submission status: Wrong Answer

Solution code:
A,B= list(map(int,input().split()))
import collections
a=[]
def solve(N):
   for i in range(2, int(N**0.5) + 1):
      if N % i == 0:
         while N % i == 0:
            a.append(i)
            N //= i
   return a
f_ans=1
ans=list(collections.Counter(solve(B)).most_common())
for i,j in ans:
   if j // A < 1:
      break
   else:
      f_ans*=i**(j // A)
print(f_ans)

Submission status: Wrong Answer

Solution code:
A,B= list(map(int,input().split()))
import collections
def solve(N):
   a=[]
   while N % 2==0:
      a.append(2)
      N=N//2
   f=3 
   while N != 1: 
      while N%f==0:
         a.append(f)
         N=N//f
      f+=2
   return a
f_ans=1
ans=list(collections.Counter(solve(B)).most_common())
for i,j in ans:
   if j // A < 1:
      break
   else:
      f_ans*=(j // A)*i
print(f_ans)

Submission status: Wrong Answer

Solution code:
"""
マスターオブ整数
"""

from collections import Counter
N, P = map(int, input().split())

# Pを素因数分解する
if N == 1:
    print(P)
    exit()


prime_list = []

for i in range(2, int(P**0.5) + 1):
    if P % i == 0:
        while P % i == 0:
            prime_list.append(i)
            P //= i

prime_count = Counter(prime_list)

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

print(ans)

Submission status: Wrong Answer

Solution code:
import math
def main():
    n,p=map(int,input().split())
    if n==1:
        print(p)
    elif n>39:
        print(1)
    else:
        q=math.ceil(p**(1/n))
        print(q)
        ans=1
        for i in range(q,0,-1):
            if p%(i**n)==0:
                ans=i
                break
        print(ans)
if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
import math
def main():
    n,p=map(int,input().split())
    if n==1:
        print(p)
    else:
        q=math.floor(p**(1/n))
        ans=1
        for i in range(q,0,-1):
            if p%(i**n)==0:
                ans=i
                break
        print(ans)
if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
n,p=map(int,input().split())
def factorize(n):
    fct={}
    temp=n
    if temp<4:
        fct[temp]=1
    else:
        e=0
        while temp%2==0:
            temp=temp//2
            e+=1
        if e>0:
            fct[2]=e
    
    for b in range(3,int(n**0.5)+1,2):
        e=0
        while temp%b == 0:
            temp=temp//b
            e+=1
        if e>0:
            fct[b]=e
    if temp!=1:
        fct[temp]=1
    return fct

q=1
d=factorize(p)
for i in d:
    if d[i]<n:
        continue
    q=q*i*(d[i]//n)
print(q)

Submission status: Wrong Answer

Solution code:
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())
f = factorization(p)
ans = 1
for i, ff in enumerate(f):
    if ff[1] >= n:
        ans *= ff[0] * (ff[1]//n)
print(ans)

Submission status: Wrong Answer

Solution code:
n, p = list(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

gcd = 1
for k, v in factorization(p):
    if v // n > 0:
        gcd *= k * (v // n)
print(gcd)

Submission status: Wrong Answer

Solution code:
import math
from collections import Counter
n,p=map(int,input().split())
if n==1:
    print(p)
    exit()

l=[]
k=2
while k*k<=p:
    if p%k==0:
        p=p//k
        l.append(k)
    else:k+=1
if p!=1:l.append(p)
#print(l)

c=Counter(l)
s=1
for key,value in c.items():
    if value >=n:s*=(value//n)*key
print(s)

Submission status: Wrong Answer

Solution code:
import math
from collections import Counter
n,p=map(int,input().split())
if n==1:
    print(p)
    exit()

l=[]
k=2
while k*k<=p:
    if p%k==0:
        p=p//k
        l.append(k)
    else:k+=1
if p!=1:l.append(p)
#print(l)

c=Counter(l)
s=1
for key,value in c.items():
    if value >=n:s*=value//n*key
print(s)