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 collections

n,p = map(int, input().split())
ans=1
#nを素因数分解したリストを返す
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
  
x=prime_decomposition(p)
x = collections.Counter(x)
x = x.most_common()

for i in range(len(x)):
    if x[i][1]>=n:
        ans*=x[i][0]*(x[i][1]//n)
    else:
        break
print(int(ans))

Submission status: Wrong Answer

Solution code:
import collections

n,p = map(int, input().split())
ans=1
#nを素因数分解したリストを返す
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
  
x=prime_decomposition(p)
x = collections.Counter(x)
x = x.most_common()

for i in range(len(x)):
    if x[i][1]>=n:
        ans*=x[i][0]*(x[i][1]//n)
    else:
        break
print(ans)

Submission status: Wrong Answer

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

temp = int(P**(1/N))

output=1
for i in range(temp, 0, -1):
    t =(i**N)
    p = P//t
    if t*p ==P:
        output=i
        break


if P==1:
    output=1
print(output)

Submission status: Wrong Answer

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

temp = int(P**(1/N))

output=1
for i in range(temp, 0, -1):
    t =(i**N)
    p = P//t
    if t*p ==P:
        output=t
        break


if P==1:
    output=1
print(output)

Submission status: Wrong Answer

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

temp = int(P**(1/N)+0.5)

output=1
for i in range(temp, 0, -1):
    t =(i**N)
    p = P//t
    if t*p ==P:
        output=t
        break


if P==1:
    output=1
print(output)

Submission status: Wrong Answer

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

temp = int(P**(1/N))

output=1
for i in range(temp, 0, -1):
    t =(P/(i**N) ) 
    if t.is_integer():
        output=i
        break


if P==1:
    output=1
print(output)

Submission status: Wrong Answer

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

temp = int(P**(1/N))

output=1
for i in range(temp, 1, -1):
    t =(P/(i**N) ) 
    if t.is_integer():
        output=i
        break


if P==1:
    output=1
print(output)

Submission status: Wrong Answer

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

temp = int(P**(1/N))

output=0
for i in range(temp, 1, -1):
    t =(P/(i**N) ) 
    if t.is_integer():
        output=i
        break


if P==1:
    output=1
print(output)

Submission status: Wrong Answer

Solution code:
# 2019/11/29
from collections import Counter

n,p=map(int,input().split())
def trial_div(n):
    
    prime=Counter()

    for i in range(2,int(pow(n,0.5)+2)):
        while n%i==0:
            n//=i
            prime[i]+=1
    if n>1:prime[n]+=1
    
    return prime


prime=trial_div(p)
if prime is None:
    print(1)
    exit()
ans=1
for k,v in prime.items():
    if v>=n:
        ans*=k
print(ans)

Submission status: Wrong Answer

Solution code:
def divisor(x):
    res = []
    for i in range(1, int(x ** 0.5) + 1):
        if x % i == 0:
            res.append(i)
            if i * i != x:
                res.append(x // i)
    res.sort()
    return res


def prime_factorization(x):
    N = x
    d = divisor(x)
    res = []
    for i in d:
        if i == 1:
            continue
        cnt = 0
        while N % i == 0:
            cnt += 1
            N //= i
        if cnt != 0:
            res.append((i, cnt))
    return res


if __name__ == "__main__":
    n, p = map(int, input().split())
    pf = prime_factorization(p)

    ans = 1
    for v, cnt in pf:
        if cnt // n > 0:
            ans *= v
            ans *= cnt // n

    print(ans)

Submission status: Wrong Answer

Solution code:
n,p=map(int,input().split())
if n==1:
    print(p)
else:
    import fractions
    def prime_decomposition(m):
        i = 2
        table = []
        while i * i <= m:
            while m % i == 0:
                m = m//i
                table.append(i)
            i += 1
        if m > 1:
            table.append(m)
        return table
    d=list(prime_decomposition(p))
    s=list(set(d))
    ans=1
    for i in range(len(s)):
        if d.count(s[i])>=n:
            ans*=s[i]*(d.count(s[i])//n)
    #print(d)
    print(ans)

Submission status: Wrong Answer

Solution code:
n,p=map(int,input().split())
if n==1:
    print(p)
elif p==1:
    print(1)
else:
    import fractions
    def prime_decomposition(m):
        i = 2
        table = []
        while i * i <= m:
            while m % i == 0:
                m = m//i
                table.append(i)
            i += 1
        if m > 1:
            table.append(m)
        return table
    d=list(prime_decomposition(p))
    s=list(set(d))
    ans=1
    for i in range(len(s)):
        if d.count(s[i])>=n:
            ans*=s[i]*(d.count(s[i])//n)
    #print(d)
    print(ans)

Submission status: Wrong Answer

Solution code:
n,p=map(int,input().split())
import fractions
def prime_decomposition(m):
    i = 2
    table = []
    while i * i <= m:
        while m % i == 0:
            m = m//i
            table.append(i)
        i += 1
    if m > 1:
        table.append(m)
    return table
d=list(prime_decomposition(p))
s=list(set(d))
ans=1
for i in range(len(s)):
    if d.count(s[i])>=n:
        ans*=s[i]
#print(d)
print(ans)

Submission status: Wrong Answer

Solution code:
n,p=map(int,input().split())
if n==1:
    print(p)
elif p==1:
    print(1)
else:
    import fractions
    def prime_decomposition(m):
        i = 2
        table = []
        while i * i <= m:
            while m % i == 0:
                m = m//i
                table.append(i)
            i += 1
        if m > 1:
            table.append(m)
        return table
    d=list(prime_decomposition(p))
    s=list(set(d))
    ans=1
    for i in range(len(s)):
        if d.count(s[i])>=n:
            ans*=s[i]
    #print(d)
    print(ans)

Submission status: Wrong Answer

Solution code:
n,p=map(int,input().split())
if n==1:
    print(p)
elif p==1:
    print(1)
else:
    import fractions
    def prime_decomposition(m):
        i = 2
        table = []
        while i * i <= m:
            while m % i == 0:
                m /= i
                table.append(i)
            i += 1
        if m > 1:
            table.append(m)
        return table
    d=list(prime_decomposition(p))
    s=list(set(d))
    ans=1
    for i in range(len(s)):
        if d.count(s[i])>=n:
            ans*=s[i]
    #print(d)
    print(ans)

Submission status: Wrong Answer

Solution code:
import math
n, p = map(int ,input().split())
#引数　n, 返り値nまでの素数をリストで返す
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    #根号
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]
ff = primes(int(math.sqrt(p) + 1))
ans = 1
factorized = dict(zip(ff, [0 for i in range(len(ff))]))
if n == 1:
    print(p)
    exit()
for i in factorized.keys():
    while p % i == 0:
        p /= i
        factorized[i] += 1
    
for i in factorized.keys():
    if factorized[i] >= n :
        ans *= i*(factorized[i] // n)
print(ans)

Submission status: Wrong Answer

Solution code:
import math
N, P = map(int, input().split())
p = P**(1/N)
ans = 1
flag=False
if N==1:
  print(P)
  exit(0)


divisors=[]

for i in range(2,math.floor(P**(1/N))+1):
  if P%i==0:
    divisors.append(i)
for i in reversed(divisors):
    if P % (i ** N) == 0:
        ans = i
        break
print(ans)

Submission status: Wrong Answer

Solution code:
import math
N, P = map(int, input().split())
p = P**(1/N)
ans = 1
flag=False
if N==1:
  print(P)
  exit(0)
p=math.ceil(p)

divisors=[]
print(p)
for i in range(2,p+1):
  if P%i==0:
    divisors.append(i)
for i in reversed(divisors):
    if P % (i ** N) == 0:
        ans = i
        break
print(ans)

Submission status: Wrong Answer

Solution code:
import math
N, P = map(int, input().split())
p = P**(1/N)
ans = 1
flag=False
if N==1:
  print(P)
  exit(0)
if p <2:
  print(1)
  exit(0)
p=math.ceil(p)

divisors=[]
print(p)
for i in range(1,p+1):
  if P%i==0:
    divisors.append(i)
for i in reversed(divisors):
    if P % (i ** N) == 0:
        ans = i
        break
print(ans)

Submission status: Wrong Answer

Solution code:
import math
N, P = map(int, input().split())
p = int(P**(1/N))
ans = 1
flag=False
if N==1:
  print(P)
  exit(0)


for i in reversed(range(1,p+1)):
    if P % (i ** N) == 0:
        ans = i
        break
print(ans)

Submission status: Wrong Answer

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

p = int(P**(1/N))
ans = 1
for i in reversed(range(1, p+1)):

    if P % (i ** N) == 0:
        ans = i
        break
print(ans)

Submission status: Wrong Answer

Solution code:
import collections

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

Submission status: Wrong Answer

Solution code:
import collections
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 = collections.Counter(prime_factorize(P))
value=[(c[i]//N)*i for i in c if c[i]>=N]
count=1
for i in value:
    count*=i
print(count)

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)
res = 1
for i in range(len(L)):
	k = L[i][1]//N
	if k > 0:
		res *= L[i][0]
print(res)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

N, P = map(int, input().split())
if N == 1:
  print(P)
  exit(0)
i = 2
x = P + 0
l = []
s = set()
while i * i <= P:
  while x % i == 0:
    x //= i
    l.append(i)
    s.add(i)
  i += 1
if x >= 2:
  l.append(x)
  s.add(x)
#print(l)
res = 1
for y in s:
  t = l.count(y)
  if t >= N:
    res *= y * (t // N)
print(res)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

N, P = map(int, input().split())
if N == 1:
  print(P)
  exit(0)
i = 2
x = P + 0
l = []
s = set()
while i * i <= P:
  while x % i == 0:
    x //= i
    l.append(i)
    s.add(i)
  i += 1
if x >= 2:
  l.append(x)
  s.add(x)
#print(l)
res = 1
for y in s:
  if l.count(y) >= N:
    res *= y
print(res)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

N, P = map(int, input().split())
i = 2
x = P + 0
l = []
s = set()
while i * i <= P:
  while x % i == 0:
    x //= i
    l.append(i)
    s.add(i)
  i += 1
if x >= 2:
  l.append(x)
  s.add(x)
#print(l)
res = 1
for y in s:
  if l.count(y) >= N:
    res *= y
print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import Counter


def primeFactorization(n):
    res = []
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            res.append(i)
            n //= i
    res.append(n)
    return res


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

# 素因数分解すればよいだけ
pf = primeFactorization(p)
c = Counter(pf)
ans = 1
for k, v in c.items():
    if v >= n:
        ans *= k * (v // n)

print(ans)

Submission status: Wrong Answer

Solution code:
#import math
#import copy
#import sys
#import bisect
#input = sys.stdin.readline
mod=10**9+7
div={}
def div2(x): #素因数分解配列
    global div
    check=2
    while(x!=1 and check <= int(x**0.5)+2):
        while x%check==0:
            if check not in div:
                div[check]=1
            else:
                div[check]+=1
            x/=check
        check+=1
    if x != 1:
      div[x]=1
    return div

def main():
    # x,y = map(int,input().split())           x=1,y=2
    # a = input().split()                      a=['1','2','3',...,'n']
    # a = list(map(int,input().split()))       a=[1,2,3,4,5,...,n]
    # li = input().split('T')	              FFFTFTTFF => li=['FFF', 'F', '', 'FF']
    # 複数行の「1 2 3 4」型の入力を一配列に
    # x = sorted([list(map(int, input().split())) for _ in range(n)])
    # ソート x.sort(key=lambda y:y[1])
    # [chr(i) for i in range(97, 97+26)] 英語小文字リスト
    # [chr(i) for i in range(65, 65+26)] 英語大文字リスト atcoder
    # ord(c) chr(2) alphabet <=> number
    n,p = map(int,input().split())
    div2(p)
    ans=1
    for i in div:
        if div[i]>=n:
            ans*=i
    print(int(ans))
main()

Submission status: Wrong Answer

Solution code:
#import math
#import copy
#import sys
#import bisect
#input = sys.stdin.readline
mod=10**9+7
div={}
def div2(x): #素因数分解配列
    global div
    check=2
    while(x!=1 and check <= int(x**0.5)+2):
        while x%check==0:
            if check not in div:
                div[check]=1
            else:
                div[check]+=1
            x/=check
        check+=1
    if x != 1:
      div[x]=1
    return div

def main():
    # x,y = map(int,input().split())           x=1,y=2
    # a = input().split()                      a=['1','2','3',...,'n']
    # a = list(map(int,input().split()))       a=[1,2,3,4,5,...,n]
    # li = input().split('T')	              FFFTFTTFF => li=['FFF', 'F', '', 'FF']
    # 複数行の「1 2 3 4」型の入力を一配列に
    # x = sorted([list(map(int, input().split())) for _ in range(n)])
    # ソート x.sort(key=lambda y:y[1])
    # [chr(i) for i in range(97, 97+26)] 英語小文字リスト
    # [chr(i) for i in range(65, 65+26)] 英語大文字リスト atcoder
    # ord(c) chr(2) alphabet <=> number
    n,p = map(int,input().split())
    div2(p)
    ans=1
    for i in div:
        if div[i]>=n:
            ans*=i
    print(ans)
main()

Submission status: Wrong Answer

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

def primeCount(N):
    R = int(N**(0.5)) + 1  # 素数の範囲
    primes = {}  # 素数のリスト
    n = N
    for num in range(2, R):
        primes[num] = 0
        while n % num == 0:
            n //= num
            primes[num] += 1
    if n > 1 :
        primes[n] = 1
    return { key : val for key, val in primes.items() if val > 0}  # フィルターをかける

primeP = primeCount(P)
ans = 1
for p, cnt in primeP.items():
    ans *= max(1, p * (cnt // 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

li=factorization(p) 

ans=1
for i,j in li:
    if j>=n:
        temp=j
        while temp>=j:
            ans*=i
            temp-=n
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter

INF = 10**9 + 7

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())
li = Counter(prime_factorize(p))
ans = 1
for k, v in li.items():
  ans *= max(1, k * (v // n))
print(ans)

Submission status: Wrong Answer

Solution code:
m,p=map(int,input().split())
if m>1:
    n = 10**6
    prime = {i for i in range(2,n)}
    for i in range(2,n):
        if i in prime:
            for j in range(i*2,n,i):
                if j in prime:
                    prime.remove(j)
                #エラトステネスの篩

    ans=1
    lists=[]
    for i in prime:
        lists.append(i)
    lists=sorted(lists)   
    for i in lists:
        count=0
        while p%i==0:
            p=p/i
            count+=1
        a=count//m
        ans=ans*(i**a)
    if p>10**6:
        if m==1:
            ans*=p
            print(ans)
        else:
            print(ans)
    else:
        print(ans)
if m==0:
    print(p)

Submission status: Wrong Answer

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

n = 10**6
prime = {i for i in range(2,n)}
for i in range(2,n):
    if i in prime:
        for j in range(i*2,n,i):
            if j in prime:
                prime.remove(j)
                #エラトステネスの篩

ans=1
lists=[]

for i in prime:
    lists.append(i)
lists=sorted(lists)   
for i in lists:
    count=0
    while p%i==0:
        p=p/i
        count+=1

    a=count//m
    ans=ans*(i**a)
    
if p>10**6:
    if m==1:
        ans*=p
        print(ans)
    else:
        print(ans)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:

N,P=map(int,input().split())
if N==1:
    ans=P
elif P==1:
    ans=1

PO=P
K=[0]*(int(P**0.5)+1)

for i in range(2,int(P**0.5)):
    while P%i==0:
        K[i]+=1
        P=P//i
    K[i]=K[i]//4
    if P==1:
        break

ans=1
for i in range(2,int(PO**0.5)):
    if K[i]!=0:
        ans*=i**K[i]

print(ans)

Submission status: Wrong Answer

Solution code:



N,P=map(int,input().split())
if N==1:
    ans=P
elif P==1:
    ans=1
else:
    a=1
    ans=a
    while (a+1)**N<=P:
        a+=1
        if P%(a**N)==0:
            ans=a
        else:
           a+=1

print(ans)

Submission status: Wrong Answer

Solution code:
import collections
n,p=map(int,input().split())
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
factor=factorize(p)
c = collections.Counter(factor)
ans=1
for k, v in c.items():
  if v >= n:
    ans *= (k * (v//n))
print(int(ans))

Submission status: Wrong Answer

Solution code:
import collections
n,p=map(int,input().split())
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
factor=factorize(p)
c = collections.Counter(factor)
ans=1
for k, v in c.items():
  if v >= n:
    ans *= k
print(int(ans))

Submission status: Wrong Answer

Solution code:
import collections
n,p=map(int,input().split())
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
factor=factorize(p)
c = collections.Counter(factor)
ans=1
for k, v in c.items():
  if v >= n:
    ans <= k
    ans *= k
print(int(ans))

Submission status: Wrong Answer

Solution code:
import collections
n,p=map(int,input().split())
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
factor=factorize(p)
c = collections.Counter(factor)
ans=1
for k, v in c.items():
  if v >= n:
    ans <= k
    ans *= k
print(ans)

Submission status: Wrong Answer

Solution code:
import math

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

p_part_list = {}


for i in range(2,int(math.sqrt(p)) +1):
  if p % i == 0:
    while (p % i == 0):
      if i not in p_part_list:
        p_part_list[i] = 1
        p = p // i
      else:
        p_part_list[i] += 1
        p = p // i
      
if p > 1:
  p_part_list[p] = 1
  
max_num = 1
#print(p_part_list)

for num in p_part_list:
  if p_part_list[num] >= n:	# N個の整数にその数を最低１個割り振れるかチェック
    if max_num < num ** int(p_part_list[num]/n): #均等に割り振れれば、振り振る（１個以上可）
      max_num *= num ** int(p_part_list[num]/n)
    
print(max_num)

Submission status: Wrong Answer

Solution code:
import math

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

p_part_list = {}


for i in range(2,int(math.sqrt(p)) +1):
  if p % i == 0:
    while (p % i == 0):
      if i not in p_part_list:
        p_part_list[i] = 1
        p = p // i
      else:
        p_part_list[i] += 1
        p = p // i
      
if p > 1:
  p_part_list[p] = 1
  
max_num = 1
#print(p_part_list)

for num in p_part_list:
  if p_part_list[num] >= n:	# N個の整数にその数を最低１個割り振れるかチェック
    if max_num < num * int(p_part_list[num]/n): #均等に割り振れれば、振り振る（１個以上可）
      max_num *= num * int(p_part_list[num]/n)
    
print(max_num)

Submission status: Wrong Answer

Solution code:
import math

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

p_part_list = {}


for i in range(2,int(math.sqrt(p)) +1):
  if p % i == 0:
    while (p % i == 0):
      if i not in p_part_list:
        p_part_list[i] = 1
        p = p // i
      else:
        p_part_list[i] += 1
        p = p // i
      
if p > 1:
  p_part_list[p] = 1
  
max_num = 1
#print(p_part_list)

for num in p_part_list:
  if p_part_list[num] >= n:	# N個の整数にその数を最低１個割り振れるかチェック
    if max_num < num * int(p_part_list[num]/n):
      max_num *= num * int(p_part_list[num]/n)
    
print(max_num)

Submission status: Wrong Answer

Solution code:
import math

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

p_part_list = {}


for i in range(2,int(math.sqrt(p)) +1):
  if p % i == 0:
    while (p % i == 0):
      if i not in p_part_list:
        p_part_list[i] = 1
        p = p // i
      else:
        p_part_list[i] += 1
        p = p // i
      
if p > 1:
  p_part_list[p] = 1
  
max_num = 1

for num in p_part_list:
  if p_part_list[num] >= n:
    if max_num < num:
      max_num = num
    
print(max_num)

Submission status: Wrong Answer

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

i = 2
c=0
ans=1
while(True):
    if(P%i==0):
        P=P//i
        c+=1
        if(c%N==0):
            ans*=i
    else:
        i+=1
        c=0
    
    if(P<i**N):
        break
print(ans)

Submission status: Wrong Answer

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

i = 2
c=0
ans=1
while(True):
    if(P%i==0):
        P=P//i
        c+=1
        if(c%N==0):
            ans*=i
    else:
        i+=1
        c=0
    
    if(P<i**4):
        break
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())
s=factorization(p) 
ans=1
for i in s:
    ans=ans*i[0]*(i[1]//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())
s=factorization(p) 
ans=1
for i in s:
    if i[1]>=n:
        ans*=i[0]
print(ans)

Submission status: Wrong Answer

Solution code:
import collections

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

a=[]
while p % 2 == 0:
  p //= 2
  a.append(2)
f = 3
while f * f <= p:
  if p % f == 0:
    a.append(f)
    p //= f
  else:
    f += 2
if p != 1:
  a.append(p)

dct=collections.Counter(a)

ans=1


li=dct.items()


for tt in li:
  if tt[1]//n>=1:
    ans*=(tt[1]//n)*tt[0]
print(ans)

Submission status: Wrong Answer

Solution code:
N,P=map(int,input().split())
Q=[0]*(10**6+1)

i=2

while 1:
  if P==1 or i>=10**6:
    break
  if P%i==0:
    P//=i
    Q[i]+=1
    i=2
  else:
    i+=1
#print(Q[:20])
#print(list(map(lambda x: x//N,Q)))
Q=list(map(lambda x: x//N,Q))

ans=1
for i,q in enumerate(Q):
  if q:
    ans*=i**q
print(ans)

Submission status: Wrong Answer

Solution code:
def PF(P):
    PF = dict()
    x = 2
    while x < P ** 0.5:
        i = 0
        while P % x == 0:
            P //= x
            i += 1
        if i > 0:
            PF[x] = i
        x += 1
    return PF

N, P = map(int, input().split())
if N == 1:
    print(P)
elif P <= 3:
    print(1)
else:
    F, ans = PF(P), 1
    for x in list(F.keys()):
        ans *= x ** (F[x] // N)
    print(ans)

Submission status: Wrong Answer

Solution code:
N,P=map(int,input().split())
if N==1:
    print(P)
else:
    a=1
    l=[]
    for i in range(2,10**6+1):
        s=0
        while True:
            if P%i==0:
                P//=i
                s+=1
            else:
                if s>=N:
                    a*=i
                break
    print(a)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
# coding: utf-8
# Your code here!
N,P=map(int,input().split())
l=[0]*int(-(-P**0.5//1)+1)

if N==1:
    print(P)
    exit()

for i in range(2,int(-(-P**0.5//1)+1))[::-1]:
    p=P
    count=0
    while p%i==0:
        p/=i
        count+=1
        if count==N:
            print(i)
            exit()

Submission status: Wrong Answer

Solution code:
import sys
from collections import defaultdict
from heapq import *
sys.setrecursionlimit(200000)
input = sys.stdin.readline

N, P, = map(int, input().split())
# N, = map(int, input().split())
# L = [int(v) for v in input().split()]
# L = [int(input()) for _ in range(Q)]
# S = input().strip()

# prime = [True] * (int(P ** 0.5) + 1)
# prime[0] = False
# prime[1] = False
# for n in range(2, len(prime)):
#     if prime[n] == False:
#         continue

#     for v in range(n * 2, len(prime), n):
#         prime[v] = False

# p = [v for v in range(len(prime)) if prime[v] == True]

s = defaultdict(int)
for v in range(2, int(P ** 0.5) + 1):
    while P % v == 0:
        P = P // v
        s[v] += 1
if P != 1:
    s[P] += 1

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

Submission status: Wrong Answer

Solution code:
import sys
from collections import defaultdict
from heapq import *
sys.setrecursionlimit(200000)
input = sys.stdin.readline

N, P, = map(int, input().split())
# N, = map(int, input().split())
# L = [int(v) for v in input().split()]
# L = [int(input()) for _ in range(Q)]
# S = input().strip()

# prime = [True] * (int(P ** 0.5) + 1)
# prime[0] = False
# prime[1] = False
# for n in range(2, len(prime)):
#     if prime[n] == False:
#         continue

#     for v in range(n * 2, len(prime), n):
#         prime[v] = False

# p = [v for v in range(len(prime)) if prime[v] == True]

s = defaultdict(int)
for v in range(2, int(P ** 0.5) + 1):
    while P % v == 0:
        P = P // v
        s[v] += 1
if P != 1:
    s[P] += 1

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

print(ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
import math
N,P=map(int,input().split())

i=1
ans=1

if N==1:
    print(P)
elif N==2:
    sqrt_P=int(math.sqrt(P))
    for i in range(sqrt_P)[::-1]:
        if P%(i**N)==0:
            print(i)
            break
else:
    while i**N<=P:
        if P%(i**N)==0:
            ans=i
        i+=1
    print(ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
N,P=map(int,input().split())

i=1
ans=1

if N==1:
    print(P)
else:
    while i**N<=(P/2):#最大値適当
        if P%(i**N)==0:
            ans=i
        i+=1
    print(ans)

Submission status: Wrong Answer

Solution code:
from fractions import gcd
from random import randint

def brent(N):
   # brent returns a divisor not guaranteed to be prime, returns n if n prime
   if N%2==0: 
       return 2
   y,c,m = randint(1, N-1),randint(1, N-1),randint(1, N-1)
   g,r,q = 1,1,1
   while g==1:             
       x = y
       for i in range(r):
          y = ((y*y)%N+c)%N
       k = 0
       while (k<r and g==1):
          ys = y
          for i in range(min(m,r-k)):
             y = ((y*y)%N+c)%N
             q = q*(abs(x-y))%N
          g = gcd(q,N)
          k = k + m
       r = r*2
   if g==N:
       while True:
          ys = ((ys*ys)%N+c)%N
          g = gcd(abs(x-ys),N)
          if g>1:  break
   return g

def factorize(n1):
    if n1<=0: return {}
    if n1==1: return {1:1}
    n=n1
    t = {}
    p=0
    mx=1000000
    if n%2 == 0: 
        t[2]=0
    if n%3 == 0:
        t[3]=0
    while n % 2 ==0 :
        t[2] += 1
        n//=2
    
    while n % 3 ==0 : 
        t[3] += 1;n//=3
        
    
    i=5
    inc=2
    # print(n)
    #use trial division for factors below 1M
    while i <=mx:
       while n % i ==0 : 
           if i not in t.keys():
               t[i] = 0
           t[i] += 1
           n//=i
       i+=inc
       inc=6-inc
    #use brent for factors >1M  
    # print(t)
    while n>mx:
      p1=n
      #iterate until n=brent(n) => n is prime
      while p1!=p:
          p=p1
          p1=brent(p)
      # print(p1)
      if p1 not in t.keys():
          t[p1] = 0
      t[p1] += 1;n//=p1 
    # print(n)
    if n!=1:
        t[n] = 1
    # print(t)
    return t


from functools import reduce
from sys import argv
def main():
    n, p = tuple(map(int, input().strip().split()))
    if p==1:
        print(1)
        return 
    q = factorize(p)
    print(q)
    ans = 1
    for a in q.keys():
        q[a] //= n
        ans = ans * (a**q[a])
    print(ans)     
    


if __name__ == "__main__":
   main()

Submission status: Wrong Answer

Solution code:
from collections import Counter,defaultdict
import sys,heapq,bisect,math,itertools,string,queue
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def conb(n,r): return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

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 = inpl()
soin = prime_factorize(p)
cnt = Counter(soin)
res = 1
for key in cnt.keys():
    if cnt[key] >= n:
        res *= key * (cnt[key]//n)
print(res)