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 prime_factorize(n):
    cnt = {}
    f = 2
    while f * f <= n:
        if n%f != 0:
            f += 1
            continue
        cnt.setdefault(f, 0)
        cnt[f] += 1
        n //= f
    if n > 1:
        cnt.setdefault(n, 0)
        cnt[n] += 1
    return cnt
n, p = map(int, input().split())
cnt = prime_factorize(p)
larger_than_n = 0
ans = 1
for k, v in cnt.items():
    if v >= n:
        larger_than_n += 1
        ans *= k * (v//n)
if n == 1:
    print(p)
elif larger_than_n != 0:
    print(ans)
else:
    print(1)

Submission status: Wrong Answer

Solution code:
def prime_factorize(n):
    cnt = {}
    f = 2
    while f * f <= n:
        if n%f != 0:
            f += 1
            continue
        cnt.setdefault(f, 0)
        cnt[f] += 1
        n //= f
    if n > 1:
        cnt.setdefault(n, 0)
        cnt[n] += 1
    return cnt
n, p = map(int, input().split())
cnt = prime_factorize(p)
larger_than_n = 0
ans = 1
for k, v in cnt.items():
    if v >= n:
        larger_than_n += 1
        ans *= k * (v//n)
if larger_than_n != 0:
    print(ans)
else:
    print(1)

Submission status: Wrong Answer

Solution code:
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())
    p_fac = factorization(p)
    pp = [0] * len(p_fac)
    for i, pfe in enumerate(p_fac):
        t = pfe[1] // n
        pp[i] = t
    r = 1
    for i, ppe in enumerate(pp):
        if ppe:
            r *= (ppe * p_fac[i][0])
    print(r)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def fctr1(n): 
    f=[]
    c=0
    r=int(n**0.5)
    for i in range(2,r+2):
        while n%i==0:
            c+=1
            n=n//i
        if c!=0:
            f.append([i,c])
            c=0
    if n!=1:
        f.append([n,1])
    return f

def main():
    N, P = map(int, input().split())
    if N == 1:
        print(P)
        exit()
    if P == 1:
        print(1)
        exit()
    A = fctr1(P)
    cnt = 1
    for i, j in A:
        if j >= N:
            cnt *= i * (j // N)

    print(cnt)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N,P=map(int,input().split())
ans=1
A={}
for i in range(2,int(P**.5)+1):
    while P%i==0:
        A[i]=A.get(i,0)+1
        P//=i
    if P>1:A[P]=1
for key,value in A.items():
    ans*=key**(value//N)
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
N,P=map(int,input().split())
ans=1
A=defaultdict(int)
for i in range(2,int(P**.5)+1):
    while P%i==0:
        A[i]+=1
        P//=i
    if P>1:A[P]+=1
for key,value in A.items():
    ans*=key**(value//N)
print(ans)

Submission status: Wrong Answer

Solution code:
N,P=map(int,input().split())
i=2
ans=1
A={}
for i in range(2,int(P**.5)+1):
    while P%i==0:
        A[i]=A.get(i,0)+1
        P//=i
    if P>1:A[P]=1
for key,value in A.items():
    ans*=key**(value//N)
print(ans)

Submission status: Wrong Answer

Solution code:
N,P=map(int,input().split())
i=2
ans=1
while P!=1 or i<int(P**.5)+1:
    if P%(i**N)==0:
        ans*=i**N
        P//=i**N
    elif P%i==0:
        P//=i
    else:
        i+=1
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter
N,P=map(int,input().split())
A=[]
i=2
ans=1
while P!=1:
    if P%i==0:
        A.append(i)
        P//=i
    else:
        i+=1
A=Counter(A)
for key,value in A.items():
    if value>=N:
        ans*=key*(value//N)
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter
N,P=map(int,input().split())
A=[]
i=2
ans=1
while P!=1:
    if P%i==0:
        A.append(i)
        P//=i
    else:
        i+=1
A=Counter(A)
for key,value in A.items():
    if value>=N:
        ans*=key
print(ans)

Submission status: Wrong Answer

Solution code:
import collections

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

#素因数分解
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)
    return fct
    
factorized_P = factorize(P)
dicted_factorized_P = collections.Counter(factorized_P)

ans = 1
for prime,how_many in dicted_factorized_P.items():
    if how_many >= N:
        ans *= prime
        
print(ans)

Submission status: Wrong Answer

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

n,p = map(int,input().split())
ans = 1
cnt = Counter(primeFactorize(p))
for k,v in cnt.items():
    if v < n: continue
    ans *= k*(v//n)
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

l = factorization(p)
ans = 1
for i in l:
    if i[1] >= n:
        ans*= i[0]*(i[1]//n)
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

l = factorization(p)
l.sort(key=lambda x:x[1])
ans = 1
for i in l:
    if i[1] >= n:
        ans*= 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

arr=factorization(p)

ans=1
for i in range(len(arr)):
    if arr[i][1]//n!=0:
        ans*=arr[i][0]*(arr[i][1]//n)

if p==1:
    ans=1
elif n==1:
    ans=p

    
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

arr=factorization(p)

ans=1
for i in range(len(arr)):
    if arr[i][1]//n!=0:
        ans*=arr[i][0]*(arr[i][1]//n)

print(ans)

Submission status: Wrong Answer

Solution code:
import math

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

def run():
    n, p = map(int, input().split())
    l = factorization(p)
    ans = 1
    for e in l:
        num, count = e
        t = count // n
        if t > 0:
            ans *= num * t
    print(ans)

if __name__ == '__main__':
    run()

Submission status: Wrong Answer

Solution code:
import numpy as np
from collections import defaultdict
from math import sqrt


def sieve(x):
    primes = []
    is_prime = np.ones(x + 1, bool)
    is_prime[0] = is_prime[1] = False
    for i in range(x + 1):
        if is_prime[i]:
            primes.append(i)
            is_prime[2*i::i] = False

    return primes


def prime_fact(x):
    mx = int(sqrt(x)) + 5
    primes = sieve(mx)
    pf = defaultdict(int)
    for e in primes:
        while x % e == 0:
            x //= e
            pf[e] += 1

    if x != 1:
        pf[x] += 1

    return pf


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

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

print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
from collections import defaultdict
from math import sqrt


def sieve(x):
    primes = []
    is_prime = np.ones(x + 1, bool)
    is_prime[0] = is_prime[1] = False
    for i in range(x + 1):
        if is_prime[i]:
            primes.append(i)
            is_prime[2*i::i] = False

    return primes


def prime_fact(x):
    mx = int(sqrt(x)) + 5
    primes = sieve(mx)
    pf = defaultdict(int)
    for e in primes:
        while x % e == 0:
            x //= e
            pf[e] += 1

    if x != 1:
        pf[x] += 1

    return pf


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

pf = prime_fact(p)
ans = 1
for k, v in pf.items():
    if v >= n:
        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, open(0).read().split())
p = prime_factorize(P)
c = Counter(p)
ans = 1
for x in c.items():
    if x[1] >= N:
        ans *= x[0] * (x[1]//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, open(0).read().split())
p = prime_factorize(P)
c = Counter(p)
ans = 1
for x in c.items():
    if x[1] >= N:
        ans *= x[0]
print(ans)

Submission status: Wrong Answer

Solution code:

def getprime(n):
    if not isinstance(n, int):
        raise TypeError("Input int")
    prime = []
    # 約数はsqrt(N)まで調べればOK
    data = [i+1 for i in range(1,n)]
    while True:
        p = data[0]
        if p >= int(n**0.5):
            return prime+data
        prime.append(p)
        # pで割り切れないものだけを残す
        data = [d for d in data if d%p != 0]

from collections import defaultdict
def factorization(n):
    # n >= 1を想定
    factors = defaultdict(int)
    if n == 1:
        return {}
    if int(n**0.5) == 1:
        return {n:1} 
    primes = getprime(int(n**0.5))
    for prime in primes:
        while n % prime == 0:
            factors[prime] += 1
            n //= prime
    if n != 1:
        factors[n] += 1
    return factors
n,p = map(int, input().split())
if p == 1:
    print(1)
ans = 1
d = factorization(p)
for k in d.keys():
    if d[k] >= n:
        ans *= (k**(d[k]//n))
print(ans)

Submission status: Wrong Answer

Solution code:

def getprime(n):
    if not isinstance(n, int):
        raise TypeError("Input int")
    prime = []
    # 約数はsqrt(N)まで調べればOK
    data = [i+1 for i in range(1,n)]
    while True:
        p = data[0]
        if p >= int(n**0.5):
            return prime+data
        prime.append(p)
        # pで割り切れないものだけを残す
        data = [d for d in data if d%p != 0]

from collections import defaultdict
def factorization(n):
    # n >= 1を想定
    factors = defaultdict(int)
    if n == 1:
        return {}
    if int(n**0.5) == 1:
        return {n:1} 
    primes = getprime(int(n**0.5))
    for prime in primes:
        while n % prime == 0:
            factors[prime] += 1
            n //= prime
    if n != 1:
        factors[n] += 1
    return factors
n,p = map(int, input().split())
if p == 1:
    print(1)
ans = 1
d = factorization(p)
for k in d.keys():
    if d[k] >= n:
        ans *= (k*(d[k]//n))
print(ans)

Submission status: Wrong Answer

Solution code:

def getprime(n):
    if not isinstance(n, int):
        raise TypeError("Input int")
    prime = []
    # 約数はsqrt(N)まで調べればOK
    data = [i+1 for i in range(1,n)]
    while True:
        p = data[0]
        if p >= int(n**0.5):
            return prime+data
        prime.append(p)
        # pで割り切れないものだけを残す
        data = [d for d in data if d%p != 0]

from collections import defaultdict
def factorization(n):
    # n >= 1を想定
    factors = defaultdict(int)
    if n == 1:
        return {}
    if int(n**0.5) == 1:
        return {n:1} 
    primes = getprime(int(n**0.5))
    for prime in primes:
        while n % prime == 0:
            factors[prime] += 1
            n //= prime
            # print(factors,n)
    if n != 1:
        factors[n] += 1
    return factors
n,p = map(int, input().split())
if p == 1:
    print(1)
ans = 1
d = factorization(p)
for k in d.keys():
    if d[k] >= n:
        ans *= k
print(ans)

Submission status: Wrong Answer

Solution code:
import math
n,p = map(int,input().split())
if n == 1:
    print(p)
    exit()
def makeprime(A):
    current = [1 for _ in range(int(math.sqrt(A)+1))]
    for i in range(2,len(current)):
        if current[i]:
            for j in range(2*i,len(current),i):
                current[j] = 0
    ans = []
    for i in range(len(current)):
        if current[i]:
            ans.append(i)
    return ans[2:]
prime = makeprime(p)
fact = [0 for _ in range(len(prime))]
for i in range(len(prime)):
    while(p%prime[i] == 0):
        fact[i] += 1
        p //= prime[i]
ans = 1
for i in range(len(fact)):
    if n <= fact[i]:   
        ans *= (fact[i]//n) * prime[i]
print(ans)

Submission status: Wrong Answer

Solution code:
import math
n,p = map(int,input().split())
if n == 1:
    print(p)
    exit()
def makeprime(A):
    current = [1 for _ in range(int(math.sqrt(A)+1))]
    for i in range(2,len(current)):
        if current[i]:
            for j in range(2*i,len(current),i):
                current[j] = 0
    ans = []
    for i in range(len(current)):
        if current[i]:
            ans.append(i)
    return ans[2:]
prime = makeprime(p)
fact = [0 for _ in range(len(prime))]
for i in range(len(prime)):
    while(p%prime[i] == 0):
        fact[i] += 1
        p //= prime[i]
ans = 1
for i in range(len(fact)):
    if n <= fact[i]:   
        ans *= (fact[i]//n) * prime[i]
print(fact)
print(ans)

Submission status: Wrong Answer

Solution code:
import math
n,p = map(int,input().split())
def makeprime(A):
    current = [1 for _ in range(int(math.sqrt(A)+1))]
    for i in range(2,len(current)):
        if current[i]:
            for j in range(2*i,len(current),i):
                current[j] = 0
    ans = []
    for i in range(len(current)):
        if current[i]:
            ans.append(i)
    return ans[2:]
prime = makeprime(p)
fact = [0 for _ in range(len(prime))]
for i in range(len(prime)):
    while(p%prime[i] == 0):
        fact[i] += 1
        p //= prime[i]
ans = 1
for i in range(len(fact)):
    if n <= fact[i]:   
        ans *= (fact[i]//n) * prime[i]
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
d = defaultdict(int)

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

if N == 1:
  print(P)
else:
  i = 2
  while i <= P**(1/2):
    if P % 2 == 0:
      P //= i
      d[i] += 1
    else:
      i += 1
  g = 1
  for k, v in d.items():
    g *= k**(v//N)
  print(g)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, P = map(int, input().split())
 
def f(N, P):
  d = 1
  i = 2
  if N == 1:
    return P
  else:
    count = 0
    while i <= pow(P, 1/N)+1:
      count += 1
      if count >= 10000:
        return 1000
      if P % i**N == 0:
        P //= i**N
        d *= i
      else:
        i += 1
    return d
 
print(f(N, P))

Submission status: Wrong Answer

Solution code:
N, P = map(int, input().split())
 
def f(N, P):
  d = 1
  i = 2
  if N == 1:
    return P
  else:
    count = 0
    while i <= pow(P, 1/N)+1:
      count += 1
      if count <= 100000000:
        return 1000
      if P % i**N == 0:
        P //= i**N
        d *= i
      else:
        i += 1
    return d
 
print(f(N, P))

Submission status: Wrong Answer

Solution code:
N, P = map(int, input().split())
 
def f(N, P):
  d = 1
  i = 2
  if N == 1:
    return P
  else:
    count = 0
    while i <= pow(P, 1/N)+1:
      count += 1
      if count <= 1000000:
        return 1000
      if P % i**N == 0:
        P //= i**N
        d *= i
      else:
        i += 1
    return d
 
print(f(N, P))

Submission status: Wrong Answer

Solution code:
N, P = map(int, input().split())
 
def f(N, P):
  d = 1
  i = 2
  if N == 1:
    return P
  else:
    count = 0
    while i <= pow(P, 1/N)+1:
      count += 1
      if count <= 10000:
        return 1000
      if P % i**N == 0:
        P //= i**N
        d *= i
      else:
        i += 1
    return d
 
print(f(N, P))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if N == 1:
  d = P
else:
  d = 1
  i = 2
  while i <= pow(P, 1/N):
    if P % i**N == 0:
      P //= i**N
      d *= i
    else:
      i += 1
print(d)

Submission status: Wrong Answer

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

d = 1
i = 2
if N == 1:
  d = P
else:
  while i <= pow(P, 1/N):
    if P % i**N == 0:
      P //= i**N
      d *= i
    else:
      i += 1
print(d)

Submission status: Wrong Answer

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

d = 1
i = 2
while i <= pow(P, 1/N):
  if P % i**N == 0:
    P //= i**N
    d *= i
  else:
    i += 1
print(d)

Submission status: Wrong Answer

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

d = 1
i = 2
if N > 1:
  while i <= pow(P, 1/N)+2:
    if P % i**N == 0:
      P //= i**N
      d *= i
    else:
      i += 1
print(d)

Submission status: Wrong Answer

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

d = 1
i = 2
if N > 1:
  while i <= P**(1/N)+1:
    if P % i**N == 0:
      P //= i**N
      d *= i
    else:
      i += 1
print(d)

Submission status: Wrong Answer

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

d = 1
i = 2
if N > 1:
  while i <= pow(P, 1/N)+1:
    if P % i**N == 0:
      P //= i**N
      d *= i
    else:
      i += 1
print(d)

Submission status: Wrong Answer

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

d = 1
i = 2
if N > 1:
  while i <= P**(1/N):
    if P % i**N == 0:
      P //= i**N
      d *= i
    else:
      i += 1
print(d)

Submission status: Wrong Answer

Solution code:
from math import sqrt
def factorint(n):
    d = {}
    for i in range(2, int(sqrt(n))+1):
        c = 0
        q, r = divmod(n, i)
        while not r:
            c += 1
            n = q
            q, r = divmod(n, i)
        if c:
            d[i] = c
    if n != 1:
        d[n] = 1
    return d

from functools import reduce
from operator import mul
n, p = map(int, input().split())
print(reduce(mul, [1] + [k for k, v in factorint(p).items()  if v >= n]))

Submission status: Wrong Answer

Solution code:
# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
# list(map(int, list(input()))) # スペースがない数字リストを読み込み
import math
import fractions
import sys
import bisect
import heapq  # 優先度付きキュー(最小値取り出し)
import collections
from collections import Counter
from collections import deque
import pprint

sr = lambda: input()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""
def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    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^n
def power(a,n,mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod

# n*(n-1)*...*(l+1)*l
def kaijo(n, l, mod):
    if n == 0:
        return 1
    a = n
    tmp = n-1
    while(tmp >= l):
        a = a*tmp%mod
        tmp -= 1
    return a

inf = 10**18
mod = 10**9+7

n,p = lr()
f = factorization(p)
ans=1
for k,v in f:
    if v//n!=0:
        ans*=(k*(v//n))
print(ans)

Submission status: Wrong Answer

Solution code:
import functools
import itertools
import math
import sys
import collections
import enum


def primefac(x):
    fac = []
    for i in range(2, int(math.sqrt(x)) + 1 + 1):
        if x % i != 0:
            continue
        ex = 0
        while x % i == 0:
            ex += 1
            x = x // i
        fac.append((i, ex))

    if x != 1:
        fac.append((x, 1))
    return fac


if __name__ == "__main__":
    N, P = [int(x) for x in input().split(" ")]
    fac = primefac(P)

    def f(x, y):
        return x[0] * y[0]

    try:
        print(functools.reduce(f, [(val, ex // N) for val, ex in fac if ex >= N]))
    except TypeError:
        print(0)

Submission status: Wrong Answer

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

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


ans = 1
C = Counter(prime_factorize(P))
#print(C)
for item in C.items():
    n = item[0]
    v = item[1]
    if v >= N:
        ans *= n*(v//N)
print(ans)

Submission status: Wrong Answer

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

d = int(pow(P, 1/N))
for i in range(int(pow(P, 1/N)), 0, -1):
  if P % i**N == 0:
    d = i
    break
print(d)

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())

L = factorization(P)
ans = 1
for i in L:
    if (i[1] // N) > 0:
        ans *= (i[0] * (i[1] // N))
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

n,p = map(int,list(input().split()))
i,dic = 2,defaultdict(int)

while i*i<=p: #素因数分解
    while p%i==0:
        p/=i
        dic[i]+=1
    i+=1
if p>=1:
    dic[p]=1

ans = 1
dic = dict(dic)
for k in dic.keys():
    while dic[k]>=n:
        dic[k]-=n
        ans *= k
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

n,p = map(int,list(input().split()))
i,dic = 2,defaultdict(int)

while i*i<=p: #素因数分解
    while p%i==0:
        p/=i
        dic[i]+=1
    i+=1
if p!=1:
    dic[p]+=1
ans = 1
dic = dict(dic)
for k in dic.keys():
    if int(dic[k]//n)>=1:
        ans *= k*int(dic[k]//n)
print(int(ans))

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

n,p = map(int,list(input().split()))
i,dic = 2,defaultdict(int)
while i*i<=p:
    while p%i==0:
        p/=i
        dic[i]+=1
    i+=1
if p!=1:
    dic[p]+=1
ans = 1
for k in dic.keys():
    if int(dic[k]//n)>=1:
        ans *= k*int(dic[k]//n)
print(int(ans))

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

n,p = map(int,list(input().split()))
i,dic = 2,defaultdict(int)
while i*i<=p:
    while p%i==0:
        p/=i
        dic[i]+=1
    i+=1
if p!=1:
    dic[p]+=1
ans = 1
for k in dic.keys():
    if dic[k]//n>=1:
        ans *= k*(dic[k]//n)
print(int(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())

l = Counter(prime_factorize(P))

ans = 1

for i, v in l.items():
    if v >= N:
        ans *= i*(v//N)
#     print(ans)
# print(l)
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())

l = Counter(prime_factorize(P))

ans = 1
for i, v in l.items():
    if v >= N:
        ans *= i
# print(l)
print(ans)

Submission status: Wrong Answer

Solution code:
n,p=map(int,input().split())
ans=1
def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct
p=factorize(p)
for i in p:
  if i[1]>=n:
    ans*=i[0]
print(ans)

Submission status: Wrong Answer

Solution code:
def divs(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

n,p = map(int, input().split())
ans=1
for d in divs(p):
  if pow(d,n)>p:
    break
  else:
    ans=d
print(ans)

Submission status: Wrong Answer

Solution code:
def divs(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

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

for d in divs(p):
  if d*n>p:
    break
print(d)

Submission status: Wrong Answer

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

if N == 1:
    print(P)
    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

a = factorization(P)
a.sort()

res = 1
for a1, a2 in a:
    if a2 >= N:
        res *= a1

print(res)

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)
a.sort()

res = 1
for a1, a2 in a:
    if a2 >= N:
        res *= a1

print(res)

Submission status: Wrong Answer

Solution code:
from functools import reduce
from operator import mul
def prime_factorize_dict(n, N):
    d = {1: N}
    while not n & 1:
        d[2] = d.get(2, 0) + 1
        n >>= 1
    f = 3
    while f * f <= n:
        if not n % f:
            d[f] = d.get(f, 0) + 1
            n //= f
        else:
            f += 2
    if n != 1:
        d[n] = d.get(n, 0) + 1
    return d

N, P = map(int, input().split())
factors, powers = zip(*((factor, power) for factor, power in prime_factorize_dict(P, N).items() if power >= N))
print(reduce(mul, (factor ** (min(powers) // N) for factor in factors)))

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 len(arr) == 0:
        arr.append((n, 1))

    return arr

F = factorization(P)

ans = 1
for a, b in F:
    if b >= N:
        ans *= (b // N) * a
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 len(arr) == 0:
        arr.append((n, 1))

    return arr

F = factorization(P)

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