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

n,p = map(int,input().split())
def prime_decomposition(n):
    table = []
    for i in range(2, int(n**0.5)+1):
        while n%i==0:
            n /= i
            table.append(i)
    if n>1:
        table.append(int(n))
    table = sorted(table, reverse=False)
    return table

lst = prime_decomposition(p)
c = dict(Counter(lst))

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( ))
f = {}
for i in range(2,int(p**(1/2))+7):
    cnt = 0
    while (not p%i) and p>=i:
        cnt += 1
        p//=i
    if cnt:
        f[i]= cnt
ans = 1
for i in f:
    ans *= pow(i,f[i]//n)
print(ans)

Submission status: Wrong Answer

Solution code:
n,p = map(int, input().split( ))
f = {}
for i in range(2,int(p**(1/2))+7):
    cnt = 0
    while not p%i and p>=i:
        cnt += 1
        p//=i
    if cnt:
        f[i]= cnt
ans = 1
for i in f:
    ans *= pow(i,f[i]//n)
print(ans)

Submission status: Wrong Answer

Solution code:
n,p = map(int, input().split( ))
f = {}
for i in range(2,int(p**(1/2))+7):
    cnt = 0
    while not p%i:
        cnt += 1
        p//=i
    if cnt:
        f[i]= cnt
ans = 1
for i in f:
    ans *= pow(i,f[i]//n)
print(ans)

Submission status: Wrong Answer

Solution code:
import math
N, P = map(int, input().split())
D = {}
sqrt_p = int(math.sqrt(P))
for i in range(2, sqrt_p + 2):
    while P % i == 0:
        if i not in D:
            D[i] = 1
        else:
            D[i] += 1
        P //= i
if P != 1:
    if P not in D:
        D[P] = 1
    else:
        D[P] += 1

# print(D)
ans = 1
for d in D:
    if D[d] >= N:
        ans *= d
print(ans)

Submission status: Wrong Answer

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

num=math.ceil(pow(p,n**(-1)))+1
ans=1
for i in range(2,num):
    cnt=0
    while p%i==0:
        cnt+=1
        p//=i

    if cnt>=n:
        ans*=i*(cnt//n)

print(ans)

Submission status: Wrong Answer

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

num=math.ceil(pow(p,n**(-1)))+1
ans=1
for i in range(2,num):
    cnt=0
    while p%i==0:
        cnt+=1
        p//=i
        print(i)

    if cnt>=n:
        ans*=i*(cnt//n)

print(ans)

Submission status: Wrong Answer

Solution code:
from sys import stdin
from itertools import groupby
n,p = [int(x) for x in stdin.readline().rstrip().split()]
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
li = prime_factorize(p)
lin = []
for key, value in groupby(li):
    lin.append((key,len(list(value))))
print(lin)
point = 1
for i in lin:
    if i[1] >= n:
        point *= i[0]**(i[1]//n)
print(point)

Submission status: Wrong Answer

Solution code:
from sys import stdin
from itertools import groupby
n,p = [int(x) for x in stdin.readline().rstrip().split()]
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
li = prime_factorize(p)
lin = []
for key, value in groupby(li):
    lin.append((key,len(list(value))))
point = 1
for i in lin:
    if i[1] >= n:
        point *= i[0]*(i[1]//n)
print(point)

Submission status: Wrong Answer

Solution code:
from sys import stdin
from itertools import groupby
n,p = [int(x) for x in stdin.readline().rstrip().split()]
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
li = prime_factorize(p)
lin = []
for key, value in groupby(li):
    lin.append((key,len(list(value))))
point = 1
for i in lin:
    if i[1] >= n:
        point *= i[0]
print(point)

Submission status: Wrong Answer

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

res = 1
i = 2

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

while True:
    if i > P ** (1 / N):
        break
    if P % pow(i, N) == 0:
        res = i

    i += 1

print(res)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

res = 1
i = 1

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

while True:
    if i > P ** (1 / N):
        break
    if P % np.power(i, N) == 0:
        res = i

    i += 1

print(res)

Submission status: Wrong Answer

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


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


ans = 1
for i in Counter(prime_factorize(p)).most_common():
    if i[1] < n:
        break
    ans *= i[1]//n*i[0]
print(ans)

Submission status: Wrong Answer

Solution code:
import math
n, p = map(int, input().split())
a = []
if n == 1:
  print(p)
  exit()
for i in range(2, math.ceil(p**0.5)+1):
  cnt = 0
  while p % i == 0:
    cnt += 1
    p //= i
  a.append(cnt)
gcd = 1
for i in range(len(a)):
  if a[i] >= n:
    gcd *= i+2
print(gcd)

Submission status: Wrong Answer

Solution code:
import math
n, p = map(int, input().split())
a = []
if n == 1:
  print(p)
  exit()
for i in range(2, math.ceil(p**0.5)):
  cnt = 0
  while p % i == 0:
    cnt += 1
    p //= i
  a.append(cnt)
gcd = 1
for i in range(len(a)):
  if a[i] >= n:
    gcd *= i+2
print(gcd)

Submission status: Wrong Answer

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

l = []
i = 2
while p > 1:
    if p % i == 0:
        p //= i
        l.append(i)
    else:
        i += 1
        if i > p ** (1/2):
            break
        
ans = 1

for i in set(l):
    m = l.count(i)
    if n <= m:
        ans *= i ** (m // n)

print(ans)

Submission status: Wrong Answer

Solution code:
n, p = map(int, input().split())
p = 999999999997
l = []
i = 2
while p > 1:
    if p % i == 0:
        p //= i
        l.append(i)
    else:
        i += 1
        if i > p ** (1/2):
            break
        
ans = 1

for i in set(l):
    m = l.count(i)
    if n <= m:
        ans *= i ** (m // n)

print(ans)

Submission status: Wrong Answer

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

l = []
i = 2
while p > 1:
    if p % i == 0:
        p //= i
        l.append(i)
    else:
        i += 1
        if i > p/100:
            break
        
ans = 1

for i in set(l):
    m = l.count(i)
    if n <= m:
        ans *= i ** (m // n)

print(ans)

Submission status: Wrong Answer

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

l = []
i = 2
while p > 1:
    if p % i == 0:
        p //= i
        l.append(i)
    else:
        i += 1
        
ans = 1

for i in set(l):
    if n <= l.count(i):
        ans *= i

print(ans)

Submission status: Wrong Answer

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

l = []
i = 2
while p > 1:
    if p % i == 0:
        p //= i
        l.append(i)
    else:
        i += 1
        
ans = 1
if n <= len(l):
    for i in set(l):
        if n <= l.count(i):
            ans *= i

print(ans)

Submission status: Wrong Answer

Solution code:
def shave(n):
    if n < 2:
        return []
    else:
        n_root = int(n**0.5)
        candidate = [i for i in range(3, n+1, 2)]
        for i in range(3, n_root+2, 2):
            candidate = [j for j in candidate if j == i or j % i != 0]
        candidate = [2] + candidate
        return candidate

n, p = [ int(v) for v in input().split() ]
if n == 1:
    print(p)
else:
    ans = 1
    for i in shave(int(p**(1/n)+1)):
        if p % (i**n) == 0:
            ans *= i
    print(ans)

Submission status: Wrong Answer

Solution code:
import collections

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


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

    if factors == []:
        factors.append(n)

    return factors


pf = prime_factorize(p)
c = collections.Counter(pf)

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

print(ans)

Submission status: Wrong Answer

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

if n == 1:
    print(p)

else:
    factors = {}
    for i in range(2, int(p**0.5)+1):
        cnt = 0
        while p % i == 0:
            cnt += 1
            factors[i] = cnt
            p //= i

    if factors == {}:
        factors[p] = 1

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

    print(ans)

Submission status: Wrong Answer

Solution code:
def prime_decomposition(n) -> 'List[Tuple[prime,cnt]]':
    ret = []

    x = n

    divisor = 2
    cnt = 0
    while x % divisor == 0:
        x //= divisor
        cnt += 1
    if cnt > 0:
        ret.append((divisor, cnt))

    divisor = 3
    while divisor * divisor <= n:
        cnt = 0
        while x % divisor == 0:
            x //= divisor
            cnt += 1
        if cnt > 0:
            ret.append((divisor, cnt))
        divisor += 2

    if x > 1:
        ret.append((x, 1))

    return ret


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

lis = prime_decomposition(p)

ret = 1
for pr, cnt in lis:
    if cnt >= n:
        ret *= pr
print(ret)

Submission status: Wrong Answer

Solution code:
from operator import itemgetter


def prime_decomposition(n) -> 'List[Tuple[prime,cnt]]':
    ret = []

    x = n

    divisor = 2
    cnt = 0
    while x % divisor == 0:
        x //= divisor
        cnt += 1
    if cnt > 0:
        ret.append((divisor, cnt))

    divisor = 3
    while divisor * divisor <= n:
        cnt = 0
        while x % divisor == 0:
            x //= divisor
            cnt += 1
        if cnt > 0:
            ret.append((divisor, cnt))
        divisor += 2

    if x > 1:
        ret.append((x, 1))

    return ret


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

lis = prime_decomposition(p)
lis.sort(key=itemgetter(1), reverse=True)

ret = 1
for pr, cnt in lis:
    if cnt < n:
        break
    ret *= pr
print(ret)

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
#print(factorization(P))
for insi, num in factorization(P):
    if num >= N:
        ans *= (insi * (num // 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())
ans = 1
# print(factorization(P))
for insi, num in factorization(P):
    if num >= N:
        ans *= insi
print(ans)

Submission status: Wrong Answer

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

d={}
x=p
for i in range(2,p):
  while x%i==0:
    if i in d:
      d[i]+=1
    else:
      d[i]=1
    x//=i
  if i*i>=p:
    break

ans=1
for k,v in d.items():
  for i in range(v//n):
    ans*=k

print(ans)

Submission status: Wrong Answer

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

def main():
    N,P = map(int,input().split())
    ls = prime_decomposition(P)
    dic = defaultdict(int)
    for i in ls:
        dic[i] += 1
    
    ans = 1

    for i,j in dic.items():
        if N<=j:
            ans *= i
    print(ans)
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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


div = {}
x = P
y = 2
while y*y <= x:
    while x % y == 0:
        try:
            div[y] += 1
        except KeyError:
            div[y] = 1
        x //= y
    y += 1
if x > 1:
    div[x] = 1

res = 1
for k, v in div.items():
    if v//N > 0:
        res *= (v//N) * k
print(max(res, P))

Submission status: Wrong Answer

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


div = {}
x = P
y = 2
while y*y <= x:
    while x % y == 0:
        try:
            div[y] += 1
        except KeyError:
            div[y] = 1
        x //= y
    y += 1
if x > 1:
    div[x] = 1

res = 1
for k, v in div.items():
    if v//N > 0:
        res *= (v//N) * k
print(res)

Submission status: Wrong Answer

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


div = {}
x = P
y = 2
while y*y <= x:
    while x % y == 0:
        try:
            div[y] += 1
        except KeyError:
            div[y] = 1
        x //= y
    y += 1
if x > 1:
    div[x] = 1

res = 1
for k, v in div.items():
    res *= max(1, (v//4)) * k
print(res)

Submission status: Wrong Answer

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

import math
import heapq
import sys
def judge_p(n):
	d = math.floor(n**(1/2))
	for i in range(2,d+1):
		if n%i == 0:
			return False
	return True

if n == 1:
	print(m)
	sys.exit()
if judge_p(m):
	print(1)
	sys.exit()

P = []
D = math.floor(m**(1/2))

for j in range(2,D+1):
	if judge_p(j):
		P.append(j)

deck = []

for prime in P:
	cnt = 0
	tmp = m
	while True:
		if tmp % prime == 0:
			cnt += 1
			tmp //= prime
		else:
			break
	deck.append([prime, cnt])

ans = 1
for i in range(len(deck)):
	prime, cnt = deck[i]
	if cnt//n == 0:
		continue
	ans *= prime*(cnt//n)

print(ans)

Submission status: Wrong Answer

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

import math
import heapq
import sys
def judge_p(n):
	d = math.floor(n**(1/2))
	for i in range(2,d+1):
		if n%i == 0:
			return False
	return True

if n == 1:
	print(m)
	sys.exit()
if judge_p(m):
	print(1)
	sys.exit()

P = []
D = math.floor(m**(1/2))

for j in range(2,D+1):
	if judge_p(j):
		P.append(j)

deck = []

for prime in P:
	cnt = 0
	while True:
		if m % prime == 0:
			cnt += 1
			m //= prime
		else:
			break
	deck.append([prime, cnt])

ans = 1
for i in range(len(deck)):
	prime, cnt = deck[i]
	if cnt//n == 0:
		continue
	ans *= prime*(cnt//n)

print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter
N,P = map(int,input().split())
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
p = Counter(prime_factorize(P))
ans = 1
sumv = sum(p.values())
if N > sumv:
    print(1)
else:
    for k,v in p.items():
        if v >= N:
            ans *= k*(v//N)
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,P = map(int,input().split())
from collections import defaultdict
elem = defaultdict(int)
tmpP = P
from math import sqrt
for i in range(2,int(sqrt(P))+1):
    while tmpP % i == 0:
        elem[i] += 1
        tmpP = tmpP//i
ans = 1
for k,v in elem.items():
    if v >= N: ans = ans * k * (v//N)
if N == 1: ans = P
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

def Primefac(N):
    x = []
    while N % 2 == 0:
        N //= 2
        x.append(2)     
    i = 3
    while i * i <= N:
        if N % i == 0:
            N //= i
            x.append(i)
        else:
            i += 2
    if N != 1:
        x.append(N)
    return x

a = list(Counter(Primefac(P)).items())

ans = 1
for i in range(len(a)):
    if a[i][1] // N >= 1:
        ans *= a[i][0] * (a[i][1] // N)
        
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

def Primefac(N):
    x = []
    if N == 1:
        return x
    while N % 2 == 0:
        N //= 2
        x.append(2)     
    i = 3
    while N != 1:
        if N % i == 0:
            N //= i
            x.append(i)
        else:
            i += 1
    return x

a = list(Counter(Primefac(P)).items())

ans = 1
for i in range(len(a)):
    if a[i][1] // N >= 1:
        ans *= a[i][0] * (a[i][1] // N)
        
print(ans)

Submission status: Wrong Answer

Solution code:
def primes(n):
  ps = {}
  while n%2==0:
    n//=2
    if 2 not in ps:
      ps[2] = 1
    else:
      ps[2] += 1
  
  for i in range(3,int(n**.5)+1,2):
    while n%i==0:
      n//=i
      if i not in ps:
        ps[i] = 1
      else:
        ps[i] += 1
   
  return ps
  
N,P = map(int,input().split())
ps = primes(P)
ans = 1
for p, num in ps.items():
  if num>=N:
    ans *= p**(num//N)
print(ans)

Submission status: Wrong Answer

Solution code:
# C - Product and GCD
def factorization(n):
    """
    引数の値を素因数分解したリストを返す

    Parameters
    ----------
    n : int
        素因数分解したい自然数

    Returns
    -------
    retlist : list
        2以上の整数n => [[素因数, 指数], ...]の2次元リスト
    """
    retlist = []
    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
            retlist.append([i, cnt])

    if temp!=1:
        retlist.append([temp, 1])

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

    return retlist

n,p=map(int,input().split())
l=[]
ans=1
l=factorization(p)
for ll in l:
    if ll[1]>=n:
        ans*=ll[0]*(ll[1]//n)
print(ans)

Submission status: Wrong Answer

Solution code:
# C - Product and GCD
def factorization(n):
    retlist = []
    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
            retlist.append([i, cnt])

    if temp!=1:
        retlist.append([temp, 1])

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

    return retlist

n,p=map(int,input().split())
l=[]
ans=1
l=factorization(p)
for ll in l:
    if ll[1]>=n:
        ans*=ll[0]
print(ans)

Submission status: Wrong Answer

Solution code:
def sol(x):
  num = P
  cnt = 0
  while cnt<N:
    if cnt<=N-2:
      if num%(x**3)!=0:return False
      else:num/=x**3
      cnt+=3
    else:
      if num%x!=0:return False
      else:num/=x
      cnt += 1
  return True
  

N,P=map(int,input().split())
for x in range(int(P**(1/N))+1,0,-1):
  if sol(x):
    print(x)
    exit()

Submission status: Wrong Answer

Solution code:
N,P=map(int,input().split())
for x in range(max(int(P**(1/N)),1),0,-1):
  if P%(x**N)==0:
    print(x)
    exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,p=map(int,input().split())
ans=[]
for i in range(int(p**0.5)):
  if p%(i+1)**n==0:
    ans.append((i+1))
print(max(ans))

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(pow(p,1/2))+1):
    if p%i == 0:
        cnt = 0
        while p%i == 0:
            cnt += 1
            p //= i
        if cnt >= n:
            ans = ans * i * (cnt//n)
    if i > p:
        break
print(ans)

Submission status: Wrong Answer

Solution code:
def sol(p):
  ans = 1
  for i in range(1,int(p**(1/N))+1):
    if p%i==0:
      if p%i**N==0:
        ans = max(ans,i)
      if i != p//i and p%(p//i)**N==0:
        ans = max(ans,p//i)
        return ans
  return ans  

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

Submission status: Wrong Answer

Solution code:
import collections
n, p = map(int, input().split())
def prime_factorize(n):
	a = []
	while n % 2 == 0:
		a.append(2)
		n //= 2
	f = 3
	while f * f <= n:
		if n % f == 0:
			a.append(f)
			n //= f
		else:
			f += 2
	if n != 1:
		a.append(n)
	return a
b = collections.Counter(prime_factorize(p))
x = 1
for i,j in b.items():
	if j >= n:
		x *= i*(j//n)
if n == 1:
	print (p)
else:
	print (x)

Submission status: Wrong Answer

Solution code:
import collections
n, p = map(int, input().split())
def prime_factorize(n):
	a = []
	while n % 2 == 0:
		a.append(2)
		n //= 2
	f = 3
	while f * f <= n:
		if n % f == 0:
			a.append(f)
			n //= f
		else:
			f += 2
	if n != 1:
		a.append(n)
	return a
b = collections.Counter(prime_factorize(p))
x = 1
for i,j in b.items():
	if j >= n:
		x *= i
if n == 1:
	print (p)
else:
	print (x)

Submission status: Wrong Answer

Solution code:
import collections
n, p = map(int, input().split())
def prime_factorize(n):
	a = []
	while n % 2 == 0:
		a.append(2)
		n //= 2
	f = 3
	while f * f <= n:
		if n % f == 0:
			a.append(f)
			n //= f
		else:
			f += 2
	if n != 1:
		a.append(n)
	return a
b = collections.Counter(prime_factorize(p))
x = 1
for i,j in b.items():
	if j >= n:
		x *= i
print (x)

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

    # arr.append([n, 1])

    return arr

l = factorization(P)[::-1]

# print(l)

ans = 1
for n, k in l:
    if k >= N:
        ans *= n * (k // 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])

    # arr.append([n, 1])

    return arr

l = factorization(P)[::-1]

# print(l)

ans = 1
for n, k in l:
    if k >= N:
        ans *= n

print(ans)

Submission status: Wrong Answer

Solution code:
N, P = map(int, input().split())
if N == 1:
  print(P)
else:
  A, n = [], N
  while n != 0:
    A = [n%2] + A[:]
    n //= 2
  M = int(P ** (1/N))
  g = 1
  for i in range(1, M+1):
    t = 1
    for j in range(len(A)):
      if A[j] == 1:
        t *= i
      if j != len(A) - 1:
        t *= t
    if P % t == 0:
      g = i
  print(g)

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 main():
    N,P = map(int,input().split())
    fact = factorization(P)
    ans = 1
    for i in range(len(fact)):
        if fact[i][1]>=N:
            ans *= fact[i][0]*int(math.floor((fact[i][1]/N)))
    print(ans)
if __name__ == "__main__":
    main()

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

def main():
    N,P = map(int,input().split())
    fact = factorization(P)
    ans = 1
    for i in range(len(fact)):
        if fact[i][1]>=N:
            ans *= fact[i][0]*(fact[i][1]//N)
    print(ans)
if __name__ == "__main__":
    main()

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

def main():
    N,P = map(int,input().split())
    fact = factorization(P)
    ans = 1
    for i in range(len(fact)):
        if fact[i][1]>=N:
            ans *= fact[i][0]
    print(ans)
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n, p = map(int,input().split())
l = int((p + 1) ** 0.5)
k = p
rom = [0] * l
for i in range(100):
    if k % 2 == 0:
        k = k // 2
        rom[1] += 1
    else:
        break

for i in range(3, l+1, 2):
    while k % i == 0:
        k = k // i
        rom[i-1] += 1

ans = 1
for i in range(l):
    if rom[i] >= n:
        ans *= (i+1) ** (rom[i] // n)
print(ans)

Submission status: Wrong Answer

Solution code:
n, p = map(int,input().split())
if n == 1:
    print(p)
    exit()
elif n > p or p % n != 0:
    print(1)
    exit()
l = int((p + 1) ** 0.5)
k = p
rom = [0] * l
for i in range(100):
    if k % 2 == 0:
        k = k // 2
        rom[1] += 1
    else:
        break

for i in range(3, l+1, 2):
    while k % i == 0:
        k = k // i
        rom[i-1] += 1

ans = 1
for i in range(l):
    if rom[i] >= n:
        ans *= (i+1) ** (rom[i] // n)
print(ans)

Submission status: Wrong Answer

Solution code:
from math import floor
from collections import Counter

def factoring(n):
    # 素因数の合算を知りたいときはcをグローバルに定義(下を消す)
    c = Counter()
    sup = floor(pow(n,1/2))
    for i in range(2,sup+1):
        while n % i == 0:
            c[i] += 1
            n //= i
    if n != 1:
        c[n] += 1
    return c

N, P = map(int,input().split())
ans = 1
for key, value in factoring(P).items():
    if value >= N:
        ans *= key * (value // N)
print(ans)

Submission status: Wrong Answer

Solution code:
# N, D, K = map(int,input().split())
# LR = [list(map(int,input().split())) for _ in range(D)]
# ST = [list(map(int,input().split())) for _ in range(K)]

from math import floor
from collections import Counter

def factoring(n):
    # 素因数の合算を知りたいときはcをグローバルに定義(下を消す)
    c = Counter()
    sup = floor(pow(n,1/2))
    for i in range(2,sup+1):
        while n % i == 0:
            c[i] += 1
            n //= i
    if n != 1:
        c[n] += 1
    return c

N, P = map(int,input().split())
ans = 1
for key, value in factoring(P).items():
    if value >= N:
        ans *= key
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
    
F = factorization(P)
ans = 1
for i in range(len(F)):
    ans *= max(F[i][0]*(F[i][1]//N),1)

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import collections

stdin = sys.stdin
 
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces

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 = rl()
answer = 1
A = prime_factorize(P)
c = collections.Counter(A)
for k, v in c.items():
    if v >= N:
        answer *= k * (v//N)
print(answer)
#03

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

p = factorization(P)
ans = 1

for a, b in p:
    if b >= N:
        ans *= a * (b//N)

print(ans)