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 sys
input = sys.stdin.readline


def GCD(a, b):
    while b:
        a, b = b, a % b
    return a


def LCM(a, b):
    return a*b // GCD(a, b)


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

if N == 1:
    print(P)
else:
    M = int(pow(P, 1/N))+1
    primeflag = [True]*(M+1)
    primeflag[0] = primeflag[1] = False
    
    for i in range(2, M+1):
        for j in range(2*i, M+1, i):
            primeflag[j] = False
    
    ans = 1
    for i in range(1, M+1):
        if primeflag[i] and P % (i**N) == 0 and i > ans:
            ans = LCM(ans, i)

    print(ans)

Submission status: Wrong Answer

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

def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b += 1
    if n > 1:
        fct.append(n)
    return Counter(fct)
#print(factorize(p))
x=factorize(p)
#print(x)
ans=1
for k,v in x.items():
    if v>=n:
        ans*=k
print(ans)

Submission status: Wrong Answer

Solution code:
from subprocess import*
from collections import*
n,p=map(int,input().split())
a=1
for i,v in Counter(map(int,Popen(["factor",str(p)],stdout=PIPE).communicate()[0].decode().split()[1:])).items():
    a*=i**(v>=n)
print(a)

Submission status: Wrong Answer

Solution code:
import math
import random
class Prime:
    seed_primes=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97]
    def is_prime(self,n):
        is_prime_common=self.is_prime_common(n)
        if is_prime_common is not None:return is_prime_common
        if n<2000000:return self.is_prime_brute_force(n)
        return self.is_prime_miller_rabin(n)
    def is_prime_common(self,n):
        if n==1:return False
        if n in Prime.seed_primes:return True
        if any(map(lambda x:n%x==0,self.seed_primes)):return False
    def is_prime_brute_force(self,n):
        for k in range(2,int(math.sqrt(n))+1):
            if n%k==0:return False
        return True
    def is_prime_miller_rabin(self,n):
        d=n-1
        while d&1==0:d>>=1
        witnesses=self.get_witnesses(n)
        for w in witnesses:
            y=pow(w,d,n)
            while d!=n-1and y!=1and y!=n-1:
                y=y*y%n
                d<<=1
            if y!=n-1and d&1==0:return False
        return True
    def get_witnesses(self,num):
        def _get_range(num):
            if num<2047:return 1
            if num<1373653:return 2
            if num<25326001:return 3
            if num<3215031751:return 4
            if num<2152302898747:return 5
            if num<3474749660383:return 6
            if num<341550071728321:return 7
            if num<3825123056546413051:return 9
            return 12
        return self.seed_primes[:_get_range(num)]
    def gcd(self,a,b):
        if a<b:return self.gcd(b,a)
        if b==0:return a
        while b:a,b=b,a%b
        return a
    @staticmethod
    def f(x,n,seed):
        p=Prime.seed_primes[seed%len(Prime.seed_primes)]
        return(p*x+seed)%n
    def find_factor(self,n,seed=1):
        if self.is_prime(n):return n
        x,y,d=2,2,1
        count=0
        while d==1:
            count+=1
            x=self.f(x,n,seed)
            y=self.f(self.f(y,n,seed),n,seed)
            d=self.gcd(abs(x-y),n)
        if d==n:
            return self.find_factor(n,seed+1)
        return self.find_factor(d)
    # nのすべての素因数を見つける
    def find_factors(self,n):
        primes={}
        if self.is_prime(n):
            primes[n]=1
            return primes
        while n>1:
            factor=self.find_factor(n)
            primes.setdefault(factor,0)
            primes[factor]+=1
            n//=factor
        return primes
n,p=map(int,input().split())
a=1
for i,v in Prime().find_factors(p).items():
    a*=i**(v>=n)
print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

x_max = int(P**(1/N))
ans = 1
for i in range(x_max):
  x = x_max - i
  if(P%x**N == 0):
    ans = x
    break
print(ans)

Submission status: Wrong Answer

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

x_max = int(P**(1/N))
ans = 0
for i in range(x_max):
  x = x_max - i
  if(P%x**N == 0):
    ans = x
    break
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict as dd
primes = dd(int)
n,p = map(int, input().split())
gcd = 1
for i in range(2,int(p**0.5)+1):
  while p%i == 0:
    p //= i
    primes[i] += 1
for fac in primes:
  gcd *= fac**(primes[fac]//n)
print(gcd)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
def prime_factor(n):
    ass = []
    for i in range(2,int(n**0.5)+1):
        while n % i==0:
            ass.append(i)
            n = n//i
    if n != 1:
        ass.append(n)
    return ass
L = prime_factor(K)
L.append(0)
ans = 1
cur = L[0]
cnt = 0
for i in range(len(L)):
  if L[i] == cur:
    cnt += 1
  else:
    if cnt >= N:
      ans *= cur*(cnt//N)
    cnt = 1
    cur = L[i]
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def seive(N):
    l = [v for v in range(2, N+1)]
    primes = []
    while l:
        p = l.pop(0)
        primes.append(p)
        l = list(filter(lambda x: x % p != 0, l))
    return primes


def factoring(N, primes):
    cnt = [0]*len(primes)
    for i, p in enumerate(primes):
        while N % p == 0:
            N //= p
            cnt[i] += 1
    return cnt

def factiring2(N,P):
	ans=1
	for i in range(2,int(P**0.5)+1):
		cnt=0
		while P%i==0:
			P//=i
			cnt+=1
		if cnt>=N:
			ans*=i**(cnt//N)
	return ans	

	
		

			
	


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

Submission status: Wrong Answer

Solution code:
def seive(N):
    l = [v for v in range(2, N+1)]
    primes = []
    while l:
        p = l.pop(0)
        primes.append(p)
        l = list(filter(lambda x: x % p != 0, l))
    return primes


def factoring(N, primes):
    cnt = [0]*len(primes)
    for i, p in enumerate(primes):
        while N % p == 0:
            N //= p
            cnt[i] += 1
    return cnt


N, P = map(int, input().split())
primes = seive(P)
print("Primes")
cnt = factoring(P, primes)
print("cnt")

ans = 1

for p, v in zip(primes, cnt):
    if v//N != 0:
        ans *= (v//N)*p
print(ans)

Submission status: Wrong Answer

Solution code:
'''input
1 5
'''
n, p = map(int, input().strip().split())
ans = 1
i = 2
while i * i <= p:
	cnt = 0
	while p % i == 0:
		p //= i
		cnt += 1
	ans = ans * pow(i, cnt // i)
	i += 1
ans = ans * (p if n == 1 else 1)
print(ans)

Submission status: Wrong Answer

Solution code:
'''input
3 24
'''
import math
n, p = map(int, input().strip().split())
ans = 1
i = 2
while i * i <= p:
	cnt = 0
	while(p % i == 0):
		cnt += 1
		p /= i
	ans = ans * pow(i, cnt)
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
n, p = map(int ,input().split())

m = int(np.floor(p**(1/n)))

for i in range(m,0,-1):
    if p%(i**n)==0:
        print(i)
        exit()

Submission status: Wrong Answer

Solution code:
n, p = [int(_) for _ in input().split(' ')]
answer = 1
if n > 1:
    for i in range(2, int(p**0.5)):
        j = 0
        while(p % i == 0):
            p //= i
            j += 1
        if j >= n:
            answer *= i
else:
    answer = p
print(answer)

Submission status: Wrong Answer

Solution code:
N, P = map(int, input().split())
k = 1
p_nums = [2]
M = int(pow(P, 1/N))

for i in range(3, M):
    for j in p_nums:
        if i % j == 0:
            break
    else:
        p_nums.append(i)

for i in p_nums:
    if P % (i**N) == 0:
        k *= i

print(k)

Submission status: Wrong Answer

Solution code:
import math
n, p = map(int, input().split())
ret = 0
if n == 1:
    ret = p
elif n == 2 and p % 254616 == 0:
    ret = 254616
elif n == 2 and (math.pow(p, 1/2)).is_integer():
    ret = pow(p, 1/2)
else:
    for i in range(1, p+1):
        if i ** n > p:
            break
        if p % (i ** n) == 0:
            ret = i
print(ret)

Submission status: Wrong Answer

Solution code:
import math
n, p = map(int, input().split())
ret = 0
if n == 1:
    ret = p
elif n == 2 and p % 254616 == 0:
    ret = 254616
elif (math.pow(p, 1/2)).is_integer():
    ret = pow(p, 1/2)
else:
    for i in range(1, p+1):
        if i ** n > p:
            break
        if p % (i ** n) == 0:
            ret = i
print(ret)

Submission status: Wrong Answer

Solution code:
n, p = map(int, input().split())
ret = 0
if n == 1:
    ret = p
if p % 254616 == 0:
    ret = 254616
else:
    for i in range(1, p+1):
        if i ** n > p:
            break
        if p % (i ** n) == 0:
            ret = i
print(ret)

Submission status: Wrong Answer

Solution code:
import math
s=0
n,I = map(int, input().split())
R = I

li = []
while s==0:
    for p in range(2,int(I)+1):
        if R%p==0:
            R=R/p
            if R==1:
                s=1
            li.append(p)
            break

vu = []
key = []
s = 0
count = 1
for i in range(1,len(li)):
    if li[i] == li[i-1]:
        count += 1
    else:
        s += 1
        key.append(li[i-1])
        vu.append(count)
        count = 1

key.append(li[i])
vu.append(count)

ans = 1
for j in range(len(key)):
    count = vu[j]//n
    if count != 0:
        ans *= count*key[j]

if n == 1:
    ans = p

print(ans)

Submission status: Wrong Answer

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

if n == 1:
    print(m)
    exit(0)
else:
    for i in range(10**6 + 2,1,-1):
        x = m
        cnt = 0
        while x%i == 0:
            x //= i
            cnt += 1
        if cnt == n:
            print(i)
            exit(0)
print(1)

Submission status: Wrong Answer

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

prime = [2, 3, 5]
numL = [i for i in range(2, 1000001) if i % 2 != 0 and i % 3 != 0 and i % 5 != 0]
while True:
	p = numL[0]
	if p >= 1000:
		prime += numL
		break
	prime.append(p)
	numL = [i for i in numL if i % p != 0]

if N == 1:
	print(P)

else:
	ans = 1
	for i in prime:
		c = 0
		while True:
			if P % i == 0:
				c += 1
				P = int(P // i)
			else:
				break
		if c >= N:
			ans = ans * (i ** int(c // N))
		print(ans)

Submission status: Wrong Answer

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

prime = [2, 3, 5]
numL = [i for i in range(2, 1000001) if i % 2 != 0 and i % 3 != 0 and i % 5 != 0]
while True:
	p = numL[0]
	if p >= 1000:
		prime += numL
		break
	prime.append(p)
	numL = [i for i in numL if i % p != 0]

ans = 1
for i in prime:
	c = 0
	while True:
		if P % i == 0:
			c += 1
			P = int(P // i)
		else:
			break
	if c >= N:
		ans = ans * (i ** int(c // N))

print(ans)

Submission status: Wrong Answer

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

prime = []
numL = [i for i in range(2, 1000001) if i % 2 != 0 and i % 3 != 0 and i % 5 != 0]
while True:
	p = numL[0]
	if p >= 1000:
		prime += numL
		break
	prime.append(p)
	numL = [i for i in numL if i % p != 0]

ans = 1
for i in prime:
	c = 0
	while True:
		if P % i == 0:
			c += 1
			P = int(P // i)
		else:
			break
	if c >= N:
		ans = ans * (i ** int(c // N))

print(ans)

Submission status: Wrong Answer

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

prime = []
numL = [i for i in range(2, 100001)]
while True:
	p = numL[0]
	if p >= 317:
		prime += numL
		break
	prime.append(p)
	numL = [i for i in numL if i % p != 0]

ans = 1
for i in prime:
	c = 0
	while True:
		if P % i == 0:
			c += 1
			P = int(P // i)
		else:
			break
	if c >= N:
		ans = ans * (i ** int(c // N))

print(ans)

Submission status: Wrong Answer

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

x = int(m**(1.0/n))
while True:
    if m%(x**n) == 0:
        print(int(x))
        exit(0)
    x -= 1

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n,p = LI()
    if n == 1:
        return p
    if math.log(p) / math.log(2) < n:
        return 1
    r = 1
    i = 2
    while 1:
        t = i**n
        if p < t:
            break
        elif i == 2:
            i += 1
        else:
            i += 2
    return r


print(main())

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n,p = LI()
    if n == 1:
        return p
    r = 1
    i = 2
    while 1:
        t = i**n
        if p < t:
            break
        if p % t == 0:
            if t < 1000000:
                j = i * i
                while 1:
                    u = j**n
                    if p < u:
                        break
                    if p % u:
                        r *= j
                        p //= u
                    j *= j
                if p % t == 0:
                    r *= i
                    p //= t
            else:
                r *= i
                p //= t
        elif i == 2:
            i += 1
        else:
            i += 2
    return r


print(main())

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n,p = LI()
    if n == 1:
        return p
    r = 1
    i = 2
    while 1:
        t = i**n
        if p < t:
            break
        if p % t == 0:
            if t < 10000:
                j = i * i
                while 1:
                    u = j**n
                    if p < u:
                        break
                    if p % u:
                        r *= j
                        p //= u
                    j *= i
            r *= i
            p //= t
        elif i == 2:
            i += 1
        else:
            i += 2
    return r


print(main())

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

li = [0]*(int(math.sqrt(p))+6)
for i in range(2,int(math.sqrt(pp))+2):
    while(p%i==0):
        p = p//i
        li[i] += 1
ans=1
for i in range(2,int(math.sqrt(pp))+2):
    ans *= max(i*(li[i]//n),1)
print(ans)

Submission status: Wrong Answer

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

li = [0]*(int(math.sqrt(p))+6)
for i in range(2,int(math.sqrt(p))+2):
    while(p%i==0):
        p = p//i
        li[i] += 1
ans=1
for i in range(2,int(math.sqrt(pp))+2):
    ans *= max(i*(li[i]//n),1)
print(ans)

Submission status: Wrong Answer

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

li = [0]*(int(math.sqrt(p)+6))
for i in range(2,int(math.sqrt(p)+2)):
    while(p%i==0):
        p = p//i
        li[i] += 1
ans=1
for i in range(2,int(math.sqrt(pp)+2)):
    ans *= max(i*(li[i]//n),1)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans=1
pmax = int(P **(1/N)) +1

for i in range(1,pmax):

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

print(ans)

Submission status: Wrong Answer

Solution code:
def find(n,p):
    dic=dict()
    i=2
    while i*i<=p:
        while p%i==0:
            if i not in dic.keys():
                dic[i]=1
            else:
                dic[i]+=1
            p=p/i
        i+=1
    ans=1
    if p>1:
      dic[p]=1
    for o in dic.keys():
        while dic[o]>=n:
            ans*=o
            dic[o]-=n
    return ans
s=input().split()
n=int(s[0])
p=int(s[1])
print(find(n,p))

Submission status: Wrong Answer

Solution code:
def find(n,p):
    dic=dict()
    i=2
    while i*i<=p:
        while p%i==0:
            if i not in dic.keys():
                dic[i]=1
            else:
                dic[i]+=1
            p=p//i
        i+=1
    ans=1
    for o in dic.keys():
        while dic[o]>=n:
            ans*=o
            dic[o]-=n
    return ans
s=input().split()
n=int(s[0])
p=int(s[1])
print(find(n,p))

Submission status: Wrong Answer

Solution code:
def find(n,p):
    dic=dict()
    i=2
    while i*i<=p:
        while p%i==0:
            if i not in dic.keys():
                dic[i]=1
            else:
                dic[i]+=1
            p=p/i
        i+=1
    ans=1
    for o in dic.keys():
        while dic[o]>=n:
            ans*=o
            dic[o]-=n
    return ans
s=input().split()
n=int(s[0])
p=int(s[1])
print(find(n,p))

Submission status: Wrong Answer

Solution code:
def main():
    N, P = map(int, input().split())
    if N == 1:
        print(P)
        return
    if N >= 40:
        print(1)
        return

    i = 2
    retval = 1
    while P > 1 and i**N <= P:
        cnt = 0
        while P % i == 0:
            cnt += 1
            P //= i
        if cnt >= N:
            retval *= i
        i += 1
    print(retval)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def C():
    N, P = map(int, input().split())
    i = 2
    key = -1
    import math
    if N == 1:
        key = 1
    if key == 1:
        ans = P
    else:
        tmplist = [0 for i in range(int(math.sqrt(P)) + 1)]
        i = 2
        originarlP = P
        while True:
            if P % i == 0:
                #print(i)
                tmplist[i] += 1
                P /= i
            else:
                i += 1
            if P == 1 or i * i >= originarlP + 1:
                break
        ans = 1
        #print(tmplist[:20])
        for i in range(len(tmplist)):
            if tmplist[i] >= N:
                ans *= i
    print(ans)
C()

Submission status: Wrong Answer

Solution code:
def C():
    N, P = map(int, input().split())
    i = 2
    key = -1
    import math
    if N == 1:
        key = 1
    if key == 1:
        ans = P
    else:
        tmplist = [0 for i in range(int(math.sqrt(P)) + 1)]
        i = 2
        originarlP = P
        while True:
            if P % i == 0:
                print(i)
                tmplist[i] += 1
                P /= i
            else:
                i += 1
            if P == 1 or i * i >= originarlP + 1:
                break
        ans = 1
        #print(tmplist[:20])
        for i in range(len(tmplist)):
            if tmplist[i] >= N:
                ans *= i
    print(ans)
C()

Submission status: Wrong Answer

Solution code:
def C():
    N, P = map(int, input().split())
    import math
    originalP = P
    i = 2
    key = -1
    import math

    if key == 1:
        ans = 1
    else:
        tmplist = [0 for i in range(int(math.sqrt(P)) + 1)]
        i = 2
        #print(tmplist)
        while True:
            if P % i == 0:
                tmplist[i] += 1
                P /= i
            else:
                i += 1
            if P == 1 or i >= math.sqrt(P):
                break
        ans = 1
        #print(tmplist)
        for i in range(len(tmplist)):
            if tmplist[i] >= N:
                ans *= i
    print(ans)
C()

Submission status: Wrong Answer

Solution code:
N,P = map(int,raw_input().split())
arr = []
for i in range(2,int(pow(P,0.5))+1):
    while P%i==0:
        arr.append(i)
        P /= i
ans = 1
temp = set(arr)
for i in temp:
    cur = arr.count(i)
    for j in range(cur/N):
        ans *= i
print ans

Submission status: Wrong Answer

Solution code:
import math

def primes(x):
    list = [2]
    check = 0
    for i in range(3,x+1):
        for j in list:
            if i%j==0:
                check = 1
                break
        if check==0:
            list.append(i)
        check = 0
    return list

def exDiv(x,y):
    count = 1
    a = pow(y,1/x)
    if math.floor(a)==a:
        return int(a)
    max = math.ceil(pow(y,1/(x+1)))
    if max>2:
        prime_list = primes(max)
    else:
        prime_list=[2]
    while 1:
        i = prime_list.pop(0)
        if i>max:
            break
        i_x = i**x
        while y%i_x==0:
            y /= i_x
            count *= i
        while y%i==0:
            y /= i
        if y<i_x:
            break
        a = pow(y,1/x)
        if math.floor(a)==a:
            return int(a*count)
        if len(prime_list)==0:
            break
        max = math.ceil(pow(y,1/(x+1)))
    return count


x,y = map(int,input().split())
print(exDiv(x,y))

Submission status: Wrong Answer

Solution code:
import math

def exDiv(x,y):
    i = 1
    count = 1
    a = pow(y,1/x)
    if math.floor(a)==a:
        return int(a)
    max = math.ceil(pow(y,1/(x+1)))
    while i<max:
        i += 1
        if i%2==0 and i!=2:
            continue
        i_x = i**x
        while y%i_x==0:
            y /= i_x
            count *= i
        while y%i==0:
            y /= i
        if y<i_x:
            break
        a = pow(y,1/x)
        if math.floor(a)==a:
            return int(a*count)
        max = math.ceil(pow(y,1/(x+1)))
    return count


x,y = map(int,input().split())
print(exDiv(x,y))

Submission status: Wrong Answer

Solution code:
import math

def exDiv(x,y):
    count = 1
    a = pow(y,1/x)
    if math.floor(a)==a:
        return a
    max = math.ceil(pow(y,1/(x+1)))
    for i in range(2,max+1):
        if i%2==0 and i!=2:
            continue
        i_x = i**x
        while y%i_x==0:
            y /= i_x
            count *= i
        while y%i==0:
            y /= i
        if y<i_x:
            break
    return count


x,y = map(int,input().split())
print(exDiv(x,y))

Submission status: Wrong Answer

Solution code:
N,P=map(int,input().split())
D=dict()
k=2
Q=P
while(True):
    if k*k>P:
        break
    if Q%k==0:
        if k in D:
            D[k]+=1
        else:
            D[k]=1
        Q=Q//k
    else:
        k+=1
ans=1
for p in D:
    ans=ans*(p**(D[p]//N))
print(ans)

Submission status: Wrong Answer

Solution code:
import math

def exDiv(x,y):
    i = 1
    count = 1
    a = pow(y,1/x)
    if math.floor(a)==a:
        return a
    max = math.floor(pow(y,1/(x+1)))
    for i in range(2,max+1):
        i_x = i**x
        if i%2==0 and i!=2:
            continue
        while y%(i_x)==0:
            y /= i_x
            count *= i
        while y%i==0:
            y /= i
        if y<i_x:
            break
    return count


x,y = map(int,input().split())
print(exDiv(x,y))

Submission status: Wrong Answer

Solution code:
N,P = map(int,input().split(' '))
#N=3
#P=24


def primes(n):
	f = [True]*(n+1)
	f[0] = False
	f[1] = False
	m = int(n**0.5+1)
	for i in range(2,m):
		if f[i]:
			for j in range(i*i,n+1, i):
				f[j] = False
	return f

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

s = 1/N
sP=int(P**s)+1
f = primes(sP)
prime = [x for x in range(1,sP+1) if f[x]]

ans = 1
for p in prime:
	if P % (p**N) == 0:
		ans*=p
		i = 2
		while(P % p**(2*i)==0):
			print(P % p**(i*N))
			ans*=p
			i+=1
print(ans)

Submission status: Wrong Answer

Solution code:
N,P = map(int,input().split(' '))
#N=3
#P=24


def primes(n):
	f = [True]*(n+1)
	f[0] = False
	f[1] = False
	m = int(n**0.5+1)
	for i in range(2,m):
		if f[i]:
			for j in range(i*i,n+1, i):
				f[j] = False
	return f

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

s = 1/N
sP=int(P**s)+1
f = primes(sP)
prime = [x for x in range(1,sP+1) if f[x]]

ans = 1
for p in prime:
	if P % (p**N) == 0:
		ans*=p
		i = 2
		while(P % p**(2*i)==0):
			ans*=p
			i+=1
print(ans)

Submission status: Wrong Answer

Solution code:
def prime_decomposition(n):
	initial_n = n
	i = 2
	table = {}
	k_list = set()
	while i * i <= initial_n:
		divided = False
		while n % i == 0:
			if divided == False:
				table[i] = 0
				divided = True
				k_list.add(i)
			n /= i
			table[i] += 1
		if n == 1:
			return table, k_list
		i += 1
	if n > 1:
		table[n] = 1
	return table, k_list
	
N, P = map(int, input().split())
if N == 1:
	print(P)
	exit(0)
if N > 40:
	print(1)
	exit(0)
table, k_list = prime_decomposition(P)
ans = 1
for k in k_list:
	if table[k] > 0:
		ans *= max(1, int(k) * (table[k] // N))

print(ans)

Submission status: Wrong Answer

Solution code:
def prime_decomposition(n):
	initial_n = n
	i = 2
	table = {}
	while i * i <= initial_n:
		table[i] = 0
		while n % i == 0:
			n /= i
			table[i] += 1
		if n == 1:
			return table
		i += 1
	if n > 1:
		table[n] = 1
	return table
	
N, P = map(int, input().split())
if N == 1:
	print(P)
	exit(0)
table = prime_decomposition(P)
ans = 1
for k in table:
	if table[k] > 0:
		ans *= max(1, int(k) * (table[k] // N))

print(ans)

Submission status: Wrong Answer

Solution code:
N,P = map(int,input().split(' '))
#N=3
#P=24


def primes(n):
	f = [True]*(n+1)
	f[0] = False
	f[1] = False
	m = int(n**0.5+1)
	for i in range(2,m):
		if f[i]:
			for j in range(i*i,n+1, i):
				f[j] = False
	return f



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

s = 1/N
sP=int(P**s)+1
f = primes(sP)
prime = [x for x in range(1,sP+1) if f[x]]

ans = 1
for p in prime:
	if P % (p**N) == 0:
		ans*=p
print(ans)

Submission status: Wrong Answer

Solution code:
N,P = map(int,input().split(' '))
#N=3
#P=24


def primes(n):
	f = [True]*(n+1)
	f[0] = False
	f[1] = False
	m = int(n**0.5+1)
	for i in range(2,m):
		if f[i]:
			for j in range(i*i,n, i):
				f[j] = False
	return f



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


s = 1/N
sP=int(P**s)+1
f = primes(sP)
prime = [x for x in range(1,sP+1) if f[x]]

ans = 1
for p in prime:
	if P % (p**N) == 0:
		ans*=p
print(ans)

Submission status: Wrong Answer

Solution code:
def prime_decomposition(n):
	i = 2
	table = {}
	while i * i <= n:
		table[i] = 0
		while n % i == 0:
			n /= i
			table[i]+=1
		i += 1
	if n > 1:
		table[n]=1
	return table
	
N, P = map(int, input().split())
if N == 1:
	print(P)
	exit(0)
table = prime_decomposition(P)
ans = 1
for k in table:
	ans *= max(1, int(k) * (table[k] // N))
print(ans)

Submission status: Wrong Answer

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


ans = 1


for i in range(2,min(int(p**(1./n))+1,int(p**0.5)+1)):
	while(p%(i**n)==0):
		ans*=i
		p//=i**n
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter
import math

N, P = map(int,input().split())
if N >= 41:
    print(1)
if N >= P:
    print(1)
    exit(0)
if N == 1:
    print(P)
    exit(0)
if N == 2:
    M = P
    Q = []
    k = 2
    while k*k <= M:
        if M%k == 0:
            M //= k
            Q.append(k)
        else:
            k += 1
    if M > 1:
        Q.append(M)
    R = Counter(Q)
    ans = 1
    for k in R:
        if R[k] >= 2:
            ans *= k**(R[k]//2)
    print(ans)
    exit(0)

ans = 1
k = 1
while pow(k,N) <= P:
    if P%pow(k,N)==0:
        ans = k
    k += 1

print(ans)

Submission status: Wrong Answer

Solution code:

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

pn=[2]

ans = 1
while(p%(2**n)==0):
	ans*=2
	p//=2**n
for L in range(3,int(p**(1./n))+1):
	flag = 1
	for L2 in pn:
		if(L%L2==0):break
	else:
		pn.append(L)
		while(p%(L**n)==0):
			ans*=L
			p//=L**n


print(ans)

Submission status: Wrong Answer

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

if N == 1:
    ans = P
else:
    ans = 1
    p = 2
    while p * p < P:
        e = 0
        while P % p == 0:
            P //= p
            e += 1  # 素数のカウント
        if e // N > 0:
            ans *= p ** (e // N)
        p += 1

print(ans)