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:
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)
ans = 1
for i in a:
    if i[1] >= n:
        ans *= i[0]
print(ans)

Submission status: Wrong Answer

Solution code:
N, P = map(int, input().split())
p_dict = {}
for num in range(2, int(P**0.5)+1):
  while P%num == 0:
    if num in p_dict:
      p_dict[num] += 1
    else:
      p_dict[num] = 1
    P //= num
ans = 1
for k, v in p_dict.items():
  ans *= k**(v//N)
print(ans)

Submission status: Wrong Answer

Solution code:
def 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
def rle(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())
if p==1:
    print(1)
    exit()
ans=1
for i,j in rle(factorize(p)):
    if i>=n:
        ans*=j*(i//n)
print(ans)

Submission status: Wrong Answer

Solution code:
N, P = map(int, input().split())
i = 2
ans = 1
while P > 1:
  if i * i > P:
    break
  x = 0
  while P % i == 0:
    x += 1
    P //= i
  ans *= i ** (x // N)
  i += 1
print(ans)

Submission status: Wrong Answer

Solution code:
N, P = map(int, input().split())
i = 2
ans = 1
while P > 1:
  x = 0
  while P % i == 0:
    x += 1
    P //= i
  if x >= N:
    ans *= i
  i += 1
print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3

#import
#import math
#import numpy as np
#= int(input())
#= input()
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

array = factorization(P)

ans = 1
for a, n in array:
    if n >= N:
        ans *= a * (n // N)

print(ans)

Submission status: Wrong Answer

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

for i in range(int(p**(1/2)),0,-1):
    if p%(i**n)==0:
        print(i)
        break

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**n)==0:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
import math

n,p = map(int,input().split())
ans = 0
for i in range(int(p**(1/n)),0,-1):
    if p%(i**n)==0:
        ans=i
        break
if ans==0:
   ans=math.ceil(p**(1/n))
 
print(ans)

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**n)==0:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
#98 C - Product and GCD 
import collections
N,P = map(int,input().split())

def Prime_Factorize(n):
    primes = []
    while n%2 == 0:
        n//=2
        primes.append(2)
    f = 3
    while f*f <= n:
        if n%f == 0:
            n//=f
            primes.append(f)
        else:
            f += 2
    if n != 1:
        primes.append(n)
    return primes
Primes = Prime_Factorize(P)

cnt = collections.Counter(Primes)
print(cnt)

ans = 1
for key, value in cnt.items():
    if value >= N:
        num = key**(value//N)
        ans *= num
if N == 1:
    print(P)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

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

MAX = int(P**0.5)+1
for p in range(2, MAX):
    while P % p == 0:
        dic[p] += 1
        P //= p
    if P:
        dic[P] += 1

ans = 1
for p, cnt in dic.items():
    ans *= pow(p, cnt//N)
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

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

MAX = int(P**0.5)+1
for p in range(2, MAX):
    while P % p == 0:
        dic[p] += 1
        P //= p

ans = 1
for p, cnt in dic.items():
    ans *= pow(p, cnt//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 k,v in c.items():
    if v>=n:
        ans*=k
print(ans)

Submission status: Wrong Answer

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

gomi=p

kojisho={}
for i in range(int(p**0.5)+1):
	kojisho[i]=0


for i in range(2,int(p**0.5)+1):
	while gomi % i== 0:
		gomi //=i
		kojisho[i] += 1
kojisho[gomi] = 1

output=1

for i in kojisho.keys():
	if kojisho[i] >= n:
		output *= i * (kojisho[i] // n)

print(output)

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**n==0:exit(print(i))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,p=map(int,input().split())
if n==1:exit(print(1))
for i in range(int(p**(1/n)+1),0,-1):
  if p%i**n==0:exit(print(i))

Submission status: Wrong Answer

Solution code:
# 46
from collections import Counter
import sys
import math


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


def prime_factrize(n):
    if n < 2:
        return []
    p_factors = []
    while n % 2 == 0:
        p_factors.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            p_factors.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        p_factors.append(n)
    return p_factors


# 素因数とその個数のタプルのリストを返す
def get_prime_counts(n):
    p_factors = prime_factrize(n)
    counter = Counter(p_factors)
    return list(counter.items())


def main():
    n, p = LI()
    primes = get_prime_counts(p)
    ans = 1
    for base, exp in primes:
        if exp >= n:
            ans *= base * (exp // n)
    print(ans)


main()

Submission status: Wrong Answer

Solution code:
def PrimeDecomp2(N):
    if N==1:
        return [1],[1],1
    else:
        I = 2
        PrimeDec = []
        PrimeCnt = []
        DivCount = 1
        while I*I<=N:
            Cnt = 0
            while N%I==0:
                N //= I
                Cnt += 1
            if Cnt>=1:
                PrimeDec.append(I)
                PrimeCnt.append(Cnt)
                DivCount *= (Cnt+1)
            I += 1
        if N>=2:
            PrimeDec.append(N)
            PrimeCnt.append(1)
            DivCount *= 2
        return PrimeDec,PrimeCnt,DivCount

N,P = (int(T) for T in input().split())
PrimeDec,PrimeCnt,_ = PrimeDecomp2(P)
Total = 1
for TP in range(0,len(PrimeCnt)):
    if PrimeCnt[TP]>=N:
        Total *= PrimeDec[TP]
print(Total)

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

Submission status: Wrong Answer

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

#素数判定

for i in range(2,p):
  #これまでので割り切れたら除外
  for j in range(2,i-1):
    if not i%j==0:
      if p>i**n and i**n==2:
        if p%(i**n)==0:
          ans=i
      if p>i**n and not i**n%2==0:
        if p%(i**n)==0:
          ans=i      
print(ans)

Submission status: Wrong Answer

Solution code:
n,p= map(int, input().split())
ans=1
for i in range(2,p):
  if p>i**n and not i**n%2==0:
    if p%(i**n)==0:
      ans=i
  if p>i**n and i**n==2:
    if p%(i**n)==0:
      ans=i
      
print(ans)

Submission status: Wrong Answer

Solution code:
n,p= map(int, input().split())
ans=1
for i in range(2,p-1):
  if p>i**n:
    if p%(i**n)==0:
      ans=i
  
print(ans)

Submission status: Wrong Answer

Solution code:
n,p= map(int, input().split())
ans=0
for i in range(2,p-1):
  if p%(i**n)==0:
    ans=i
  
print(ans)

Submission status: Wrong Answer

Solution code:
n,p=map(int,input().split())
m=int(p**(1/n))
if p==1:
  print(1)
  exit()
for i in range(m+1,1,-1):
  if p/(i**n)==int(p/(i**n)):
    print(i)
    exit()

Submission status: Wrong Answer

Solution code:
n,p=map(int,input().split())
m=int(p**(1/n))
if p==1:
  print(1)
  exit()
for i in range(m,1,-1):
  if p/(i**n)==int(p/(i**n)):
    print(i)
    exit()

Submission status: Wrong Answer

Solution code:
n,p=map(int,input().split())
m=int(p**(1/n))
if p==1:
  print(1)
  exit()
if n==1:
  print(p)
  exit()
for i in range(m,1,-1):
  if p/(i**n)==int(p/(i**n)):
    print(i)
    exit()

Submission status: Wrong Answer

Solution code:
def fact(n): #素因数分解
  f = []
  cnt = 0
  r = int(n**0.5)
  for i in range(2, r +2):
    while n % i == 0:
      cnt += 1
      n = n // i
    if cnt !=0:
      f.append([i,cnt])
      cnt = 0
  if i == 1:
    f.append([n,1])
  return f

n, p = map(int, input().split())
nn = fact(p)
aa = []

if n != 1:

  for i in range(len(nn)):
    if nn[i][1] >= n:
      aa.append(nn[i][0])
  ans = 1
  for i in range(len(aa)):
    ans *= aa[i]
else:
  ans = p

print(ans)

Submission status: Wrong Answer

Solution code:
N, P = map(int, input().split())
def fact(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 yakusu, kosu in fact(P):
  if kosu//N > 0: ans *= (kosu//N) * yakusu
print(ans)

Submission status: Wrong Answer

Solution code:
N, P = map(int, input().split())
def fact(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 yakusu, kosu in fact(P):
  if kosu >= N:
    ans *= yakusu
print(ans)

Submission status: Wrong Answer

Solution code:
from copy import deepcopy
from math import ceil
n, p = map(int, input().split())
ans = 1
q = deepcopy(p)
for i in range(2, int(p ** 0.5) + 2):
    cnt = 0
    while p % i == 0:
        p //= i
        cnt += 1
    if cnt > 0:
        ans *= i ** ceil(cnt / n)

print(ans if p != q and n != 1 else q)

Submission status: Wrong Answer

Solution code:
from copy import deepcopy
n, p = map(int, input().split())
prime = set()
ans = 1
q = deepcopy(p)
for i in range(2, int(p ** 0.5) + 2):
    cnt = 0
    while p % i == 0:
        p //= i
        cnt += 1
    if cnt >= n:
        ans *= i * (cnt // n)

print(ans if p != q and n != 1 else q)

Submission status: Wrong Answer

Solution code:
from copy import deepcopy
n, p = map(int, input().split())
prime = set()
ans = 1
q = deepcopy(p)
for i in range(2, int(p**0.5) + 2):
    for x in prime:
        if i % x == 0:
            break
    else:
        prime.add(i)
        cnt = 0
        while p % i == 0:
            p //= i
            cnt += 1
        if cnt >= n:
            ans *= i * (cnt // n)

print(ans if p != q or n != 1 else q)

Submission status: Wrong Answer

Solution code:
from math import sqrt
from math import floor
n,p = map(int,input().split())
l = [p]
for i in range(2,floor(sqrt(p))+1):
    if p % i == 0:
        l.append(i)
        l.append(p//i)
l.sort()
s = [1]
i = 0
while p > 1:
    if p % l[i] == 0:
        s.append(l[i])
        p = p // l[i]
    else:
        i += 1
ans = 1
x = s[0]
y = 1
for i in s[1:]:
    if x == i:
        y += 1
    else:
        if y >= n:
            ans *= x * (y//n)
        x = i
        y = 1
if y >= n:
    ans *= x * (y//n)
print(ans)

Submission status: Wrong Answer

Solution code:
def prime_factorize(P):
    prime = list()
    for i in range(2, P + 1):
        if i**2 <= P:
            if P % i == 0:
                c = 0
                while P % i == 0:
                    P //= i
                    c += 1
                prime.append([i, c])
            else:
                continue
        else:
            break

    if P != 1:
        prime.append([P, 1])

    return prime

def main2():
    N, P = map(int, input().split())

    prime = prime_factorize(P)

    print(prime)
    ans = 1
    for p in prime:
        n, c = p
        ans *= (n ** (c // N)) 

    print(ans)

if __name__ == "__main__":
    main2()

Submission status: Wrong Answer

Solution code:
import math
def prime_factorize(P):
    prime = list()
    for i in range(2, int(math.sqrt(P)) + 1):
        if P % i == 0:
            c = 0
            while P % i == 0:
                P //= i
                c += 1
            
            prime.append([i, c])
        else:
            continue

    if P != 1:
        prime.append([P, 1])

    return prime

def main():
    N, P = map(int, input().split())

    prime = prime_factorize(P)
    ans = 1
    for p in prime:
        n, c = p
        if c >= N:
            ans *= (n * (c // N))

    print(ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import math
def prime_factorize(P):
    prime = list()
    for i in range(2, int(math.sqrt(P)) + 1):
        if P % i == 0:
            c = 0
            while P % i == 0:
                P //= i
                c += 1
            
            prime.append([i, c])
        else:
            continue

    if P != 1:
        prime.append([P, 1])

    return prime

def main():
    N, P = map(int, input().split())

    prime = prime_factorize(P)
    ans = 1
    for p in prime:
        n, c = p
        if c >= N:
            ans *= n
            
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import math
N,P=map(int,input().split())
i=math.floor(P**(1/N))
while 1:
    if P%(i**N)==0:print(i);exit()
    i-=1

Submission status: Wrong Answer

Solution code:
import math
N,P=map(int,input().split())
i=math.floor(P**(1/N))
while 1:
    if P%i**N==0:print(i);exit()
    i-=1

Submission status: Wrong Answer

Solution code:
n,p=[int(x) for x in input().split()]

def factorization(a,b):
  temp = b
  now=1
  for i in range(2,int(b**0.5)+2):
    cnt=0
    while(temp%i==0):
      cnt+=1
      temp//=i
      
    if a<=cnt:
      now*=(i*(cnt//a))
  
  if a==1:
    now*=temp
  
  return now

a=factorization(n,p)
print(a)

Submission status: Wrong Answer

Solution code:
n,p=[int(x) for x in input().split()]

def factorization(n,pp):#素因数分解
    arr = []
    temp = n
    now=1
    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])
            # print(temp,cnt)
            if pp<=cnt:
              now*=i*(cnt//pp)
            # print(now)

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

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

    return now
  
l=factorization(p,n)
print(l)

Submission status: Wrong Answer

Solution code:
x,p = (int(x) for x in input().split())
a = []
def cont(y):
    n = 0
    while True:
        if n - int(y ** (1/2)) + 1 == 0:
            a.append(y)
            break
        for j in range(2,int(y ** (1/2)) + 1):
            if y % j == 0:
               y = y // j
               a.append(j)
               n = 0
               break
            else:
               n = n + 1

cont(p)
ans = 1
if len(a) < x:
   print(1)
   exit()
for i in range(2, max(a) + 1):
            if a.count(i) >= x:
                ans = ans * i * (a.count(i) // x)

print(ans)

Submission status: Wrong Answer

Solution code:
x,p = (int(x) for x in input().split())
a = []
def cont(y):
    n = 0
    while True:
        if n - int(y ** (1/2)) + 1 == 0:
            a.append(y)
            break
        for j in range(2,int(y ** (1/2)) + 1):
            if y % j == 0:
               y = y // j
               a.append(j)
               n = 0
               break
            else:
               n = n + 1

cont(p)
ans = 1
for i in range(2, max(a) + 1):
            if a.count(i) >= x:
                ans = ans * i * (a.count(i) // x)

print(ans)

Submission status: Wrong Answer

Solution code:
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 1
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"

def facto(n):
    arr = []
    temp = n
    for i in range(2, int(math.sqrt(n))+1):
        if temp%i==0:
            cnt = 0
            while temp%i==0:
                cnt +=1
                temp //= i
            arr.append([cnt, i])
    if temp != 1:
        arr.append([1, temp])
    
    if arr == []:
        arr.append([1, n])
    
    return arr

k, p=I()

for i in facto(p):
    if i[0] >= k:
        ans *= i[1]*(i[0]//k)

if k == 1:
    print(p)
elif p == 1:
    print(1)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 1
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"

def facto(n):
    arr = []
    temp = n
    for i in range(2, int(math.sqrt(n))+1):
        if temp%i==0:
            cnt = 0
            while temp%i==0:
                cnt +=1
                temp //= i
            arr.append([cnt, i])
    if temp != 1:
        arr.append([1, temp])
    
    if arr == []:
        arr.append([1, n])
    
    return arr

n, p=I()

for i in facto(p):
    if i[0] >= n:
        ans *= i[1]*(i[0]//n)

print(ans)

Submission status: Wrong Answer

Solution code:
x,p = (int(x) for x in input().split())
a = []
def cont(y):
    n = 0
    while True:
        if n - int(y ** (1/2)) + 1 == 0:
            a.append(y)
            break
        for j in range(2,int(y ** (1/2)) + 1):
            if y % j == 0:
               y = y // j
               a.append(j)
               n = 0
               break
            else:
               n = n + 1

cont(p)
ans = 1
if len(a)== 1:
    print(p)
    exit()
if x >= len(a):
    print(1)
    exit()
else:
    for i in range(2, max(a) + 1):
            if a.count(i) >= x:
                ans = ans * i * (a.count(i) // x)

print(ans)

Submission status: Wrong Answer

Solution code:
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 1
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"

def facto(n):
    arr = []
    temp = n
    for i in range(2, int(math.sqrt(n))+1):
        if temp%i==0:
            cnt = 0
            while temp%i==0:
                cnt +=1
                temp //= i
            arr.append([cnt, i])
    if temp != 1:
        arr.append([1, temp])
    
    if arr == []:
        arr.append([1, n])
    
    return arr

n, p=I()


for i in facto(p):
    if i[0] >= n:
        ans *= i[1]*(i[0]//n)

if n == 1:
    print(p)
elif p == 1:
    print(1)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 1
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"

def facto(n):
    arr = []
    temp = n
    for i in range(2, int(math.sqrt(n))+1):
        if temp%i==0:
            cnt = 0
            while temp%i==0:
                cnt +=1
                temp //= i
            arr.append([cnt, i])
    if temp != 1:
        arr.append([1, temp])
    
    if arr == []:
        arr.append([1, n])
    
    return arr

n, p=I()

print(facto(p))

for i in facto(p):
    if i[0] >= n:
        ans *= i[1]*(i[0]//n)

if n == 1:
    print(p)
elif p == 1:
    print(1)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
x,p = (int(x) for x in input().split())
a = []
def cont(y):
    n = 0
    while True:
        if n - int(y ** (1/2)) + 1 == 0:
            a.append(y)
            break
        for j in range(2,int(y ** (1/2)) + 1):
            if y % j == 0:
               y = y // j
               a.append(j)
               n = 0
               break
            else:
               n = n + 1

cont(p)
ans = 1
if len(a)== 1:
    print(p)
    exit()
if x >= len(a):
    print(1)
    exit()
else:
    for i in range(2, max(a) + 1):
        while True:
            if a.count(i) >= x:
                ans = ans * i
                for h in range(x):
                    a.remove(i)
        
            
            else:
                break

print(ans)

Submission status: Wrong Answer

Solution code:
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 1
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"

def facto(n):
    arr = []
    temp = n
    for i in range(2,int(math.sqrt(n))+1):
        if temp%i==0:
            cnt = 0
            while temp%i==0:
                cnt +=1
                temp //= i
            arr.append([cnt, i])
    if temp != 1:
        arr.append([1, temp])
    
    if arr == []:
        arr.append([1, n])
    
    return arr

n, p=I()

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

if n == 1:
    print(p)
elif p == 1:
    print(1)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 1
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"

def facto(n):
    arr = []
    temp = n
    for i in range(2,int(math.sqrt(n))+1):
        if temp%i==0:
            cnt = 0
            while temp%i==0:
                cnt +=1
                temp //= i
            arr.append([cnt, i])
    if temp != 1:
        arr.append([1, temp])
    
    if arr == []:
        arr.append([1, n])
    
    return arr

n, p=I()

facto(p).sort()
for i in facto(p):
    if i[0] >= n:
        ans *= i[1]

print(ans)

Submission status: Wrong Answer

Solution code:
x,p = (int(x) for x in input().split())
z = p
a = []
def cont(y):
    n = 0
    while True:
        if n - int(y ** (1/2)) + 1 == 0:
            a.append(y)
            break
        for j in range(2,int(y ** (1/2)) + 1):
            if y % j == 0:
               y = y // j
               a.append(j)
               n = 0
               break
            else:
               n = n + 1

cont(p)
ans = 1
if len(a)== 1:
    print(p)
    exit()
if x >= len(a):
    print(1)
    exit()
else:
    for i in range(2, int(p ** (1/2)) + 1):
        while True:
            if a.count(i) >= x:
                ans = ans * i
                for h in range(x):
                    a.remove(i)
                if a.count(z // i) >= x:
                   ans = ans * (z // i)
                   for k in range(x):
                       a.remove(z // i)
            
            else:
                break

print(ans)

Submission status: Wrong Answer

Solution code:
x,p = (int(x) for x in input().split())

a = []
def cont(y):
    n = 0
    while True:
        if n - int(y ** (1/2)) + 1 == 0:
            a.append(y)
            break
        for j in range(2,int(y ** (1/2)) + 1):
            if y % j == 0:
               y = y // j
               a.append(j)
               n = 0
               break
            else:
               n = n + 1

cont(p)
ans = 1
if len(a)== 1:
    print(p)
    exit()
if x >= len(a):
    print(1)
    exit()
else:
    for i in range(2, int(p ** (1/2)) + 1):
        while True:
            if a.count(i) >= x:
                ans = ans * i
                for h in range(x):
                    a.remove(i)
            else:
                break

print(ans)

Submission status: Wrong Answer

Solution code:
def INT():
    return int(input())

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

def LI():
    return list(map(int, input().split()))

def factrize(P):
    fac = {}
    
    for i in range(2, int(P**0.5) + 1):
        e = 0
        while P % i == 0:
            P //= i
            e += 1
            
        if e > 0:
            fac[i] = e
    
    if P > 1:
        fac[P] = 1
    
    return fac

N, P = MI()
ans = 1

for f, e in factrize(P).items():
    if e >= N:
        ans *= f
        
print(ans)

Submission status: Wrong Answer

Solution code:
def INT():
    return int(input())

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

def LI():
    return list(map(int, input().split()))

def factrize(N, P):
    fac = {}
    
    for i in range(2, int(P**0.5) + 1):
        e = 0
        while P % i == 0:
            P //= i
            e += 1
            
        if e > 0:
            fac[i] = e
    
    fac[1] = N
    fac[P] = 1
    
    return fac

N, P = MI()
ans = 1

if N > 40:
    print(ans)
    exit()

for f, e in factrize(N, P).items():
    if e >= N:
        ans *= f
        
print(ans)

Submission status: Wrong Answer

Solution code:
def INT():
    return int(input())

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

def LI():
    return list(map(int, input().split()))

def factrize(N, P):
    fac = {}
    
    for i in range(2, int(P**0.5) + 1):
        e = 0
        while P % i == 0:
            P //= i
            e += 1
            
        if e > 0:
            fac[i] = e
    
    fac[1] = N
    
    return fac

N, P = MI()
ans = 1

if N > 40:
    print(ans)
    exit()

for f, e in factrize(N, P).items():
    if e >= N:
        ans *= f
        
print(ans)

Submission status: Wrong Answer

Solution code:
def INT():
    return int(input())

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

def LI():
    return list(map(int, input().split()))

N, P = MI()
mod = 1
ans = 0

if N >= 40:
    print(1)
    exit()

for g in range(1, 10**6):
    mod = pow(g, N)
    if mod > P:
        break
    
    if P % mod == 0:
        ans = max(ans, g)
    
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

lis = factorization(p)
length = len(lis)

ans = 1
for i in lis:
    a, b = i
    t = b//length
    ans *= a**t

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import collections

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N, P = [int(x) for x in input().split()]
    if N == 1:
        print(P)
        return

    def prime_factorization(n):
        i = 2
        factors = []
        while i * i <= n:
            if n % i:
                i += 1
            else:
                n //= i
                factors.append(i)
        if n > 1:
            factors.append(n)
        return factors

    primes = prime_factorization(P)
    c = collections.Counter(primes)

    ans = 1
    for k in c.keys():
        if c[k] >= N:
            ans *= (c[k] // N) * k

    print(ans)

    
    

if __name__ == '__main__':
    main()