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
from collections import Counter
n,p=map(int,input().split())
if n==1:
    print(p)
    exit()

l=[]
while p%2==0:
    p=p//2
    l.append(2)


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

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 sys
import re
import math
import collections
import decimal
import bisect
import itertools

import copy

# import heapq
# from collections import deque
# import decimal

# sys.setrecursionlimit(100001)
INF = sys.maxsize
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    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 = ns()

    d = prime_factorize(p)
    ans = 1

    c = collections.Counter(d)
    for k,v in c.items():
        if v//n > 0:
            ans *= k*(v//n)

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

ans=int(P**(1/N))
while ans>0:
    if P%(ans**N)==0:
        break
    ans-=1

print(ans)

Submission status: Wrong Answer

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

ans=1
s=0
while p%2==0 and p>1:
    p=p//2
    s+=1
if s//n>=1:ans=ans*((s//n)*2)

k=3
while p>1:
    s=0
    while p%k==0:
        p=p//k
        s+=1
    if s//n>=1:
        ans=ans*((s//n)*k)
    k+=2
print(ans)

Submission status: Wrong Answer

Solution code:
import math
n,p=map(int,input().split())
if n==1:
    print(p)
    exit()
k=2
ans=1
while p>1:
    s=0
    while p%k==0:
        p=p//k
        s+=1
    if s//n>=1:
        ans=ans*((s//n)*k)
    k+=1
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)).most_common()
ans=1
for i in range(len(c)):
    if c[i][1]>=n:
        tmp=c[i][1]//n
        ans*=c[i][0]*tmp
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter
import copy
N,P =map(int,input().split(' '))
if N==1:
    print(P)
    exit()
prime = []
f = 2
while f**2 <=P:
    if P%f==0:
        prime.append(f)
        P//=f
    else:
        f += 1
if P != 1:
    prime.append(f)

ans = 1
for k,v in Counter(prime).items():
    if v//N:
        ans *= k*(v//N)
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter
import copy
N,P =map(int,input().split(' '))
if N==1:
    print(P)
    exit()
prime = []
f = 2
n = copy.copy(P)
while f**2 <=n:
    if P%f==0:
        prime.append(f)
        P//=f
    else:
        f += 1

ans = 1
for k,v in Counter(prime).items():
    if v//N:
        ans *= k*(v//N)
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter
N,P =map(int,input().split(' '))
if N==1:
    print(P)
    exit()
prime = []
f = 2
n = P
while f**2 <=n:
    if P%f==0:
        prime.append(f)
        P//=f
    else:
        f += 1

ans = 1
for k,v in Counter(prime).items():
    if v//N:
        ans *= k*(v//N)
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter
N,P =map(int,input().split(' '))
if N==1:
    print(P)
    exit()
prime = []
f = 2
while f**2 <=P:
    if P%f==0:
        prime.append(f)
        P//=f
    else:
        f += 1
if f != 1:
    prime.append(f)
ans = 1
for k,v in Counter(prime).items():
    if v//N:
        ans *= k*(v//N)
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter
N,P =map(int,input().split(' '))
prime = []
f = 2
while f**2 <=P:
    if P%f==0:
        prime.append(f)
        P//=f
    else:
        f += 1
if f != 1:
    prime.append(f)
ans = 1
for k,v in Counter(prime).items():
    if v//N:
        ans *= k*(v//N)
print(ans)

Submission status: Wrong Answer

Solution code:
from math import pow,floor
N,P =map(int,input().split(' '))
if N==1:
    print(P)
    exit()
for i in range(floor(pow(P,1/N)),0,-1):
    if P%pow(i,N)==0:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
from math import floor
N,P =map(int,input().split(' '))
if N==1:
    print(P)
    exit()
for i in range(floor(pow(P,1/N)),0,-1):
    if P%pow(i,N)==0:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
N,P =map(int,input().split(' '))
if N==1:
    print(P)
    exit()
if P==1:
    print(1)
    exit()
for i in range(int(pow(P,1/N)//1),0,-1):
    if P%pow(i,N)==0:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
N,P =map(int,input().split(' '))
if N==1:
    print(P)
    exit()
for i in range(int(pow(P,1/N)//1),0,-1):
    if P%pow(i,N)==0:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
N,P =map(int,input().split(' '))
if N==1:
    print(P)
    exit()
for i in range(int(pow(P,1/N)),0,-1):
    if P%pow(i,N)==0:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
N,P =map(int,input().split(' '))
if N==1:
    print(P)
    exit()
ans = 1
for i in range(1,int(pow(P,1/N))+2):
    p = pow(i,N)
    if P%p==0:
        ans *= i
        P /=p
print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
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)
numbers = []
for i in range(len(F)):
    if F[i][1] >= N: numbers.append(F[i][0])


ans = 1
for n in numbers:
    ans *= 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())
f = Counter(prime_factorize(P))

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

Submission status: Wrong Answer

Solution code:
def PrimeFactorization(m):
    pf = {}
    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
    return pf
n, p = map(int, input().split())
f = PrimeFactorization(p)
ans = 1
for k, v in f.items():
    if v >= n:
        ans *= v // n * k
print(ans)

Submission status: Wrong Answer

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

div = 2
res = 1
while div * div <= P:
    cnt = 0
    tmp = P
    while tmp % div == 0:
        tmp /= div
        cnt += 1

        if cnt == N:
            res *= div
            cnt = 0
    div += 1

print(res)

Submission status: Wrong Answer

Solution code:
import collections
def main():
    N, P = (int(_) for _ in input().split())

    def bunkai_suru(n):
        ary = collections.defaultdict(int)
        p = 2
        while p * p <= n:
            while n%p == 0:
                n //= p
                ary[p] += 1
            p += 1
        if n != 1:
            ary[n] += 1
        return ary

    output = 1
    x = bunkai_suru(P)
    for p in x.keys():
        if x[p] >= N: output *= p
    print(output)
    return

if __name__ == '__main__':
    main()

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())
e = prime_factorize(p)
if n == 1:
    print(p)
    exit()
if len(e) == 0:
    print(1)
    exit()
r = [e[0]]
t = [1]
for i in range(len(e)-1):
    if e[i] != e[i+1]:
        r.append(e[i+1])
        t.append(1)
    else:
        t[-1] += 1
ans = 1
for i in range(len(r)):
    ans *= max(1,r[i]*(t[i]//n))
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())
if p == 1:
    print(1)
    exit()
e = prime_factorize(p)
r = [e[0]]
t = [1]
for i in range(len(e)-1):
    if e[i] != e[i+1]:
        r.append(e[i+1])
        t.append(1)
    else:
        t[-1] += 1
ans = 1
for i in range(len(r)):
    if n <= t[i]:
        ans *= r[i]*(t[i]//n)
print(ans)

Submission status: Wrong Answer

Solution code:
import math

N, P = list(map(int, input().split()))
ma = int(P ** (1/N))
ans = 1

if P == 1:
    ans = 1
elif N == 1:
    ans = P
else:
    for i in range(1, ma+1):
        if P % (i ** N) == 0:
            ans = i
print(ans)

Submission status: Wrong Answer

Solution code:
import math

N, P = list(map(int, input().split()))
ma = int(P ** (1/N))
ans = 1

if P == 1 or ma == 0:
    ans = 1
elif N == 1:
    ans = P
else:
    for i in range(1, ma+1):
        if P % (i ** N) == 0:
            ans = i
print(ans)

Submission status: Wrong Answer

Solution code:
N, P = list(map(int, input().split()))
ma = int(P ** (1/N))
ans = 1

if P == 1 or ma == 0:
    ans = 1
elif ma == 2:
    if P % (2 ** N) == 0:
        ans = 2
    else:
        ans = 1
else:
    for i in range(1, ma+1):
        if P % (i ** N) == 0:
            ans = i
print(ans)

Submission status: Wrong Answer

Solution code:
N, P = list(map(int, input().split()))
ma = int(P ** (1/N))
ans = 1

if P == 1 or ma == 0:
    ans = 1
else:
    for i in range(1, ma+1):
        if P % (i ** N) == 0:
            ans = i
print(ans)

Submission status: Wrong Answer

Solution code:
N, P = list(map(int, input().split()))
ma = int(P ** (1/N))
ans = 0
for i in range(1, ma+1):
    if P % (i ** N) == 0:
        ans = i
print(ans)

Submission status: Wrong Answer

Solution code:
import collections

n, p = map(int, input().split())
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)

res = collections.Counter(res)
ans = 1
for d in res.items():
    if d[1] >= n:
        ans *= d[0]*(d[1]//n)
print(ans)

Submission status: Wrong Answer

Solution code:
import collections

n, p = map(int, input().split())
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)

res = collections.Counter(res)
ans = 1
for d in res.items():
    if d[1] >= n:
        ans *= d[0]
print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    n, p = map(int, input().split())
    f = {}
    tmp = 0
    while p % 2 == 0:
        tmp += 1
        p //= 2
    f[2] = tmp
    tmp = 3
    while tmp * tmp <= p:
        if p % tmp == 0:
            p //= tmp
            if tmp in f:
                f[tmp] += 1
            else:
                f[tmp] = 1
        else:
            tmp += 2
    if n != 1:
        if n in f:
            f[n] += 1
        else:
            f[n] = 1
    f = sorted(f.items(), key=lambda x: x[1], reverse=True)
    answer = 1
    for ff, cnt in f:
        if cnt < n:
            break
        answer *= ff ** (cnt // n)
    print(answer)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    n, p = map(int, input().split())
    f = {}
    tmp = 0
    while p % 2 == 0:
        tmp += 1
        p //= 2
    f[2] = tmp
    tmp = 3
    while p > 1:
        if p % tmp == 0:
            p //= tmp
            if tmp in f:
                f[tmp] += 1
            else:
                f[tmp] = 1
        else:
            tmp += 2
    f = sorted(f.items(), key=lambda x: x[1], reverse=True)
    answer = 1
    for ff, cnt in f:
        if cnt < n:
            break
        answer *= ff * (cnt // n)
    print(answer)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from collections import Counter


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, read().split())
ans = 1
for k, v in Counter(prime_decomposition(p)).items():
    if v >= n:
        ans *= v // n * k
print(ans)

Submission status: Wrong Answer

Solution code:
def prime(p):
    memo = []
    for i in range(2,(int(p**0.5))+1):
        while p%i==0:
            p //= i
            memo.append(i)
    if p != 1:
        memo.append(p)
    return memo


import collections

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

memo = prime(p)

c = collections.Counter(memo)

score_sorted = sorted(c.items(), key=lambda x:-x[0])

if n == 1:
    ans = p
else:
    kake = []
    for i , j in score_sorted:
        if n <= j:
            kake.append(i*(j//n))
    ans = 1
    for i in kake:
        ans *= i

print(ans)

Submission status: Wrong Answer

Solution code:
def prime(p):
    memo = []
    for i in range(2,(int(p**0.5))+1):
        while p%i==0:
            p //= i
            memo.append(i)
    if p != 1:
        memo.append(p)
    return memo


import collections

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

memo = prime(p)

c = collections.Counter(memo)

score_sorted = sorted(c.items(), key=lambda x:-x[0])

if n == 1:
    ans = p
else:
    kake = []
    for i , j in score_sorted:
        if n <= j:
            kake.append(i)
    ans = 1
    for i in kake:
        ans *= i

print(ans)

Submission status: Wrong Answer

Solution code:
def prime(p):
    memo = []
    for i in range(2,(int(p**0.5))+1):
        while p%i==0:
            p //= i
            memo.append(i)
    if p != 1:
        memo.append(p)
    return memo


import collections

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

memo = prime(p)

c = collections.Counter(memo)

score_sorted = sorted(c.items(), key=lambda x:-x[0])

if n == 1:
    ans = 1
else:
    kake = []
    for i , j in score_sorted:
        if n <= j:
            kake.append(i)
    ans = 1
    for i in kake:
        ans *= i

print(ans)

Submission status: Wrong Answer

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

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

ans = 1
for d,c in div:
  ans *= d**(c//n)
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter


def prime_factorize(n):
    a=[]
    while n%2==0:
        a +=[2]
        n //=2
    f=3
    while f**2<=n:
        if n%f==0:
            a +=[f]
            n //=f
        else:f +=2
    if n!=1:a +=[n]

    return a


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

n,p=map(int,input().split())
divisors=make_divisors(p)
maxi=round(p**(1/n),10)
print(maxi)
for i in divisors:
    if i<=maxi and p%i**n==0:
        print(i)
        exit()

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[::-1]

n,p=map(int,input().split())
divisors=make_divisors(p)
maxi=p**(1/n)

for i in divisors:
    if i<=maxi and p%i**n==0:
        print(i)
        exit()

Submission status: Wrong Answer

Solution code:
import collections
n,p=map(int,input().split())
factor=[]
if n==1:
    print(p)
    exit()
for i in range(2,int(p**0.5)+1):
    while p%i==0:
        p=p//i
        factor.append(i)
#print(factor)
if not factor:
    print(1)
    exit()
ans=1
a=collections.Counter(factor)

for s,v in a.items():
    ans*=s*(v//n)
print(ans)

Submission status: Wrong Answer

Solution code:
import collections
n,p=map(int,input().split())
factor=[]
if n==1:
    print(p)
    exit()
for i in range(2,int(p**0.5)+1):
    while p%i==0:
        p=p//i
        factor.append(i)
#print(factor)
if not factor:
    print(1)
    exit()
ans=1
a=collections.Counter(factor)

for s,v in a.items():
    if n<=v:
        ans*=s*(v//n)
print(ans)

Submission status: Wrong Answer

Solution code:
import collections
n,p=map(int,input().split())
factor=[]
if n==1:
    print(p)
    exit()
for i in range(2,int(p**0.5)+1):
    while p%i==0:
        p=p//i
        factor.append(i)
#print(factor)
if not factor:
    print(1)
    exit()
ans=1
a=collections.Counter(factor)

for s,v in a.items():
    if n<=v:
        ans*=s
print(ans)

Submission status: Wrong Answer

Solution code:
n , p = map(int,input().split())
pf={}
for i in range(2,int(p**0.5)+1):
    while p%i==0:
        pf[i]=pf.get(i,0)+1
        p//=i
if p>1:pf[p]=1

ans = 1

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

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())
lis=factorization(P)
#print(lis)
maxi=1

for i,kumi in enumerate(lis):
  if kumi[1]>=N:
    maxi *= kumi[0]
    
print(maxi)

Submission status: Wrong Answer

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

if N == 1:
    print(P)
else:
    ans = 1
    for x in range(1, int(P**(1/N))+1):
        if P % (x**N) == 0:
            ans = max(ans, x)
    print(ans)

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
import numpy as np 
def main():
    n,p=map(int,input().split())
    ans=0
    for x in range(1,p+1):
        if n*np.log(x)<=np.log(p):
            ans=x
        else:
            break
    print(ans)

if __name__=='__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n,p=map(int,input().split())
    for x in range(1,p+1):
        if x**n >p:
            print(x-1)
            break

if __name__=='__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, P = MAP()

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 p in factorization(P):
	if p[1] >= N:
		ans *= p[0]
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
def prime_factorize(n):
    res = []
    for i in range(2, int(n**0.5)+1):
        if n % i != 0:continue
        ex = 0
        while n % i == 0:
            ex += 1
            n = n//i
        res.append((i, ex))
    if n != 1:res.append((n, 1))
    return res
def main():
    N, P = map(int, input().split())
    res = prime_factorize(P)
    ans = 1
    for x, ex in res:
        ans *= max(1, x * (ex // N))
    print(ans)
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
def prime_factorize(n):
    res = []
    for i in range(2, int(n**0.5)+1):
        if n % i != 0:continue
        ex = 0
        while n % i == 0:
            ex += 1
            n = n//i
        res.append((i, ex))
    if n != 1:res.append((n, 1))
    return res
def main():
    N, P = map(int, input().split())
    res = prime_factorize(P)
    ans = 1
    for x, ex in res:
        if ex >= N:ans *= x
    print(ans)
if __name__ == "__main__":
    main()

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

li = factorization(p) 
#print(li)

tmp_score = 1
for l in li:
    if l[1]>= n:
        tmp_score *= l[0]
print(tmp_score)

Submission status: Wrong Answer

Solution code:
import collections
import math
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=collections.Counter(prime_factorize(P))
n=len(c.keys())
w=1
for i in c.keys():
  if c[i]>=N:
    k=math.ceil(c[i]/N)
    w=w*(i**k)
print(w)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

def factor(x):
    res = defaultdict(int)
    for i in range(2, int(x ** 0.5) + 1):
        while x % i == 0:
            res[i] += 1
            x //= i
    if x > 1:
        res[x] += 1
    return res


n, p = map(int, input().split())
ans = 1
for k, v in factor(p).items():
    if v < n:
        continue
    ans *= k * (v // n)
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

def factor(x):
    res = defaultdict(int)
    for i in range(2, int(x ** 0.5) + 1):
        while x % i == 0:
            res[i] += 1
            x //= i
    if x > 1:
        res[x] += 1
    return res


n, p = map(int, input().split())
ans = 1
for k, v in factor(p).items():
    ans *= k * (v // n)
print(ans)

Submission status: Wrong Answer

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

def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    fct_c = Counter(fct)
    return fct_c

def solve():
    ans = 1
    c = factorize(P)
    for k, v in c.items():
        ans *= k*(v//N)
    return ans
print(solve())

Submission status: Wrong Answer

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

def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    fct_c = Counter(fct)
    return fct_c

def solve():
    ans = 1
    c = factorize(P)
    for k, v in c.items():
        if v>=N:
            ans *= k
    return ans
print(solve())

Submission status: Wrong Answer

Solution code:
import math
N,P=map(int,input().split())
L=[]
for i in range(1,int(math.sqrt(P))+1):
	if P%i==0:
		L.append(i)
L=set(L)
L=sorted(L)
S=[]
for i in L:
	if P%(i**N)==0:
		S.append(i)
print(max(S))

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())
res = prime_factorize(P)

cnt = {}
for r in res:
    if r not in cnt:
        cnt[r] = 1
    else:
        cnt[r] += 1

ans = 1
for k, v in cnt.items():
    ans *= max(1, (v // N) * k)
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())
res = prime_factorize(P)
res.append(P)

cnt = {}
for r in res:
    if r not in cnt:
        cnt[r] = 1
    else:
        cnt[r] += 1

if N == 1:
    print(max(cnt))
else:
    ans = 1
    for k, v in cnt.items():
        ans *= max(1, (v // N) * k)
    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())
res = prime_factorize(P)
res.append(P)

cnt = {}
for r in res:
    if r not in cnt:
        cnt[r] = 1
    else:
        cnt[r] += 1

cnt = [k for k, v in cnt.items() if v >= N]
if N == 1:
    print(max(cnt))
else:
    ans = 1
    for v in cnt:
        ans *= v
    print(ans)

Submission status: Wrong Answer

Solution code:
from sys import stdin, stdout
from collections import defaultdict
import math

def chai(a):
    ans = defaultdict(int)
    for i in range(2,int(math.sqrt(a))+1):
        while a%i==0:
            ans[i]+=1
            a//=i
    if a!=1:
        ans[a]+=1
    return ans
    
n, p = map(int, stdin.readline().strip().split())

tmp = chai(p)
ans = 1
for key, value in tmp.items():
    if value >= n:
        ans *= key
stdout.writelines(str(ans) + '\n')

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():

    N,P=map(int,input().split())
    # int型mをとって、素因数をkeyに乗数をvalueに格納した辞書型pfを返す関数
    def prime_factorize2(m):
        pf = {}  # keyをvalue乗

        for i in range(2, int(m ** 0.5) + 1):
            # iで割れる回数をpfに格納
            while m % i == 0:
                # get関数の第2引数はキーが存在しない場合に返すデフォルト値
                pf[i] = pf.get(i, 0) + 1
                m //= i

        # 割り切れずに残ったものは素数なのでpfにぶち込む
        if m > 1:
            pf[m] = 1

        return pf

    l=prime_factorize2(P)
    cnt=1
    for k,v in l.items():
        if v>=N:
            cnt*=k
    print(cnt)

resolve()

Submission status: Wrong Answer

Solution code:
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(10 ** 9)


def main():
    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())
    arr = factorization(P)
    answer = 1
    for a in arr:
        if a[1] >= N:
            ans = a[0] * (a[1] // N)
            answer *= ans
    print(answer)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(10 ** 9)


def main():
    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())
    arr = factorization(P)
    answer = 1
    for a in arr:
        if a[1] >= N:
            answer *= a[0]
    print(answer)


if __name__ == "__main__":
    main()

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 = n // 2
  f = 3
  while f * f <= n:
    if n % f == 0:
      a.append(f)
      n = n // f
    else:
      f += 2
  if n != 1:
    a.append(n)
  return a

from collections import Counter
primes_counter = Counter(prime_factorize(p))

ans = 1
for kv in primes_counter.items():
  a = kv[0] * (kv[1] // n)
  if a > 0: ans *= a

print(ans)

Submission status: Wrong Answer

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

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

    if l == []:
        l.append([n, 1])
    return None
n, p = map(int, input().split())
ans = 1
factorization(p)
for i in range(len(l)):
    if l[i][1] >= n:
        ans *= l[i][0]
print(ans)