Problem:


Score : 300 points

Problem Statement

There are N integers a_1, a_2, ..., a_N not less than 1.
The values of a_1, a_2, ..., a_N are not known, but it is known that a_1 \times a_2 \times ... \times a_N = P.

Find the maximum possible greatest common divisor of a_1, a_2, ..., a_N.

Constraints

1 \leq N \leq 10^{12}

1 \leq P \leq 10^{12}

Input

Input is given from Standard Input in the following format:

N P

Output

Print the answer.

Sample Input 1

3 24

Sample Output 1

2

The greatest common divisor would be 2 when, for example, a_1=2, a_2=6 and a_3=2.

Sample Input 2

5 1

Sample Output 2

1

As a_i are positive integers, the only possible case is a_1 = a_2 = a_3 = a_4 = a_5 = 1.

Sample Input 3

1 111

Sample Output 3

111

Sample Input 4

4 972439611840

Sample Output 4

206



Sample input:
3 24


Sample output:
2

Submission status: Wrong Answer

Solution code:
n, p = map(int, input().split())
if n == 1 or p== 1:
    print(p)
    exit()
c2 = 0
while p%2 == 0:
    c2 += 1
    p//=2
c = 2**(c2//n)
i = 1
while i**n <= p:
    i *= 2
s = i//2
t = i
while s < t:
    i = int((s+t)/2)
    if i**n <= p:
        t = i
    else:
        s = i
while i > 1:
    if p%(i**n) == 0:
        print(c*i)
        exit()
    else:
        i -= 1
print(c)

Submission status: Wrong Answer

Solution code:
n, p = map(int, input().split())
if n == 1 or p== 1:
    print(p)
    exit()
c2 = 0
while p%2 == 0:
    c2 += 1
    p//=2
c = 2**(c2//n)
max = 1
i = 1
while i**n <= p:
    i *= 2
s = i//2
t = i
while s < t:
    i = int((s+2)/2)
    if i**n <= p:
        t = i
    else:
        s = i
while i > 1:
    if p%(i**n) == 0:
        print(c*i)
        exit()
    else:
        i -= 1
print(c)

Submission status: Wrong Answer

Solution code:
n, p = map(int, input().split())
if n == 1 or p== 1:
    print(p)
    exit()
c2 = 0
while p%2 == 0:
    c2 += 1
    p//=2
c = 2**(c2//n)
max = 1
i = 1
while i**n <= p:
    i *= 2
s = i//2
t = i
while s < t:
    i = int((s+2)/2)
    if c**n <= p:
        t = i
    else:
        s = i
while i > 1:
    if p%(i**n) == 0:
        print(c*i)
        exit()
    else:
        i -= 1
print(c)

Submission status: Wrong Answer

Solution code:
saikyo = [int(i) for i in input().split()] 


number = int(saikyo[1])
bobo = int(saikyo[0])
i = 2
 
answer = ""
 
while number >= i:
    if number % i == 0:
        if answer == "":
            answer = str(i)
        else:
            answer = answer + " " + str(i)
        number /= i
    else:
        i += 1
 
a = [int(i) for i in answer.split()]

import collections

b = collections.Counter(a)
c = len(b)
d = [b.most_common()[i][1] // bobo for i in range(c)]

def remove_specified_values(arr, value):
    while value in arr:
        arr.remove(value)
remove_specified_values(d, 0)

e = len(d)
if e == 0:
    print(1)
else:
    f = [b.most_common()[i][0] * d[i] for i in range(e)]

    import functools
    import operator


    g = functools.reduce(operator.mul, f)
    print(g)

Submission status: Wrong Answer

Solution code:
import math

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

if N == 1:
    print(P)
else:
    for i in range(round(math.pow(P, 1 / N)) + 1, 0, -1):
        if P % (i ** N) == 0:
            now_max = i
    
    print(now_max)

Submission status: Wrong Answer

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

def is_prime(n): 
    i = 2
    while i * i <=n:
        if n % i == 0:
            return False
        i += 1
    return True

for i in range(2,int(P**(1/2))+1):
    if is_prime(i) == True:
        num = 0
        while P%i == 0:
            num = num +1
            P = P/i
        dic[i] = num
        
ans = 1
for i in dic:
    if N == 1:
        ans = P
        break
    elif dic[i] != 0:
        ans = ans*(i**(dic[i]//N))
print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
n,p = input().split()
n = int(n)
p = int(p)
i = a = o = 1
c = int(p**(1/n))
l = [p%(i**n) for i in range(1,c+1)]
la = [i for i, x in enumerate(l) if x == 0]
print(max(la)+1)

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

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

p = prime_factorization(P)

c = Counter(p)

l = []
j = []
for k, v in c.items():
    if N <= v:
        l.append(k)
        j.append(v//N)
ans = 1

for i,v in zip(l,j):
    ans *= i**v

print(ans)

Submission status: Wrong Answer

Solution code:
import math


def read():
    N, P = list(map(int, input().strip().split()))
    return N, P


def solve(N, P):
    # problem constraint
    if N >= 40:
        return 1
    # solve
    v3 = math.floor(P**(1/N))
    for v in range(v3, 0, -1):
        if P % (v**N) == 0:
            return v
    return 1


if __name__ == '__main__':
    inputs = read()
    print(solve(*inputs))

Submission status: Wrong Answer

Solution code:
import math
N, P = map(int, input().split())
Pa = 1
Pb = P
gcd = 1
for i in range(2, int(math.sqrt(P)) + 1):
    if P % Pa == 0:
        Pb = P // Pa
        if P % (Pa ** N) == 0:
            gcd = max(gcd, Pa)
        if P % (Pb ** N) == 0:
            gcd = max(gcd, Pb)
    Pa = i
print(gcd)

Submission status: Wrong Answer

Solution code:
n,p=map(int, input().split())
ans=1
m=int(pow(p,1/n))+1
if n==1:
    print(p)
else:
    m=int(pow(p,1/n))+1
    i=2
    c=0
    while(i<=p and i<=m):
        print('i,p=',i,p)
        if p % i == 0:
            p=p/i
            c=c+1
            if p % i != 0:
                #print('i**(c//n)=',i**(c//n))
                ans = ans * ( i**(c//n) )
                i=i+1
                c=0
        else:
            i=i+1
    print(ans)

Submission status: Wrong Answer

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

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

ans = 1
p=2
while 1:
    Q = p**N
    if P < Q:
        break
    elif P == Q:
        ans *= p
        break
    elif p**(N+1) > P:
        p = P**(1/N)
        if p == int(p):
            ans *= int(p)
        break

    k = 0
    while P % p == 0:
        P //= p
        k += 1
    ans *= p**(k//N)
    p += 1

print(ans)

Submission status: Wrong Answer

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

import numpy as np

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

for i in prime_decomposition(P):
    num = 0
    while P%i == 0:
        num = num +1
        P = P/i
        dic[i] = num
        
ans = 1
for i in dic:
    if N == 1:
        ans = P
        break
    elif dic[i] != 0:
        ans = ans*(i**(dic[i]//N))
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from math import sqrt
N, P = list(map(int, input().split()))

ans = 1
tmp = P
# start = int(sqrt(P))
# for i in range(start, 1, -1):
#     newtmp, rest = divmod(tmp, (i**N))
#     print(i, tmp, rest, ans)
#     if rest == 0:
#         ans = ans * i
#         tmp = newtmp

for i in range(2, int(sqrt(P)) + 1):
    while True:
        newtmp, rest = divmod(tmp, (i**N))
        # print(i, tmp, rest, ans)
        if rest:
            break
        else:
            ans = ans * i
            tmp = newtmp
    if newtmp == 0:
        break

print(ans)

Submission status: Wrong Answer

Solution code:
M, P = [int(i) for i in input().strip().split()]
dic={}

import numpy as np

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

for i in prime_decomposition(P):
    num = 0
    while P%i == 0:
        num = num +1
        P = P/i
        dic[i] = num
        
ans = 1
for i in dic:
    if M == 1:
        ans = P
        break
    elif dic[i] != 0:
        ans = ans*(i**(dic[i]//M))
print(ans)

Submission status: Wrong Answer

Solution code:
N,P=map(int,input().split())
maxfac = int(P**(1/N))
# print(range(1,maxfac+1))
if N==1:
    print(P)
    exit()
for i in range(1,maxfac+1)[::-1]:
    p = i**N
    # print(P%p)
    if P%p == 0:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
from collections import deque
def gcd(a,b):
    while a%b:
        a,b=b,a%b
    return b
 
def prime_t(t):
    i=2
    while i**2<=t:
        if t%i==0:
            return 0
        i+=1
    return 1
 
def prime_list(tt):
    p_list=[]
    for i in range(2,tt+1):
        if prime_t(i):
            p_list.append(i)
    return p_list
 
l=[]

for i in range(2,100000):
    if prime_t(i):
        l.append(i)
b=[]
d=deque()
t=deque()
n,p=map(int,input().split())
if n==1 or p==1:
    print(p)
    exit()
for i in l:
    while p%i==0:
        #b.append(i)
        d.append(i)
        p//=i
    if i>=p: break
ans=1
if (len(d)+len(t))<n:
    print(1)
    exit()
h=0
while (len(d)+len(t))!=n:
    if len(d)>1:
        x=d.popleft()
        y=d.pop()
        t.append(x*y)
        h=0
    elif len(d)==1 and h==0:
        x=t.popleft()
        y=d.pop()
        d.append(x*y)
        h=1
    elif len(t)>1:
        x=t.popleft()
        y=t.pop()
        d.append(x*y)
        h=0
    elif len(t)==1 and h==0:
        x=d.popleft()
        y=t.pop()
        t.append(x*y)
        h=1
 
while len(d)+len(t):
    if len(d)>0 and len(t)>0:
        x=d.pop()
        y=t.pop()
        ans=max(ans,gcd(max(x,y),min(x,y)))
    elif len(d)>1:
        x=d.pop()
        y=d.pop()
        ans=max(ans,gcd(max(x,y),min(x,y)))
    elif len(t)>1:
        x=t.pop()
        y=t.pop()
        ans=max(ans,gcd(max(x,y),min(x,y)))
    elif len(d)>0:
        x=d.pop()
        ans=max(ans,gcd(max(x,ans),min(x,ans)))
    elif len(t)>0:
        x=t.pop()
        ans=max(ans,gcd(max(x,ans),min(x,ans)))
print(ans)

Submission status: Wrong Answer

Solution code:
n,p=map(int, input().split())
ans=1
if n==1:
    print(p)
else:
    m=int(pow(p,1/n))+1
    i=2
    c=0
    while(i<=p and i<=int(pow(p,1/n))+1):
        print('i,p=',i,p)
        if p % i == 0:
            p=p/i
            c=c+1
            if p % i != 0:
                #print('i**(c//n)=',i**(c//n))
                ans = ans * ( i**(c//n) )
                i=i+1
                c=0
        else:
            i=i+1
    print(ans)

Submission status: Wrong Answer

Solution code:
import math
N,M = map(int,input().split())
Max = 1
for m in range(1,int(math.sqrt(M))+1):
    if M%m == 0:
        if m == int(m**(1/N))**N   :
            if Max < int(m**(1/N)):
                Max = int(m**(1/N))
        if M//m == int((M//m)**(1/N))**N and Max < int((M//m)**(1/N)) :
            Max = int((M//m)**(1/N))
            
print(Max)

Submission status: Wrong Answer

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

if n == 1:
    print(p)
    exit(0)

ans = 1
for i in range(2,p):
    if p % i == 0:
        t = 1
        flag = True
        for j in range(n):
            t = t*i
            if p % t != 0:
                flag = False
                break
        if flag :
            ans = i

        if t > p//n :
            break
print(ans)

Submission status: Wrong Answer

Solution code:
from math import sqrt
N, P = list(map(int, input().split()))

ans = 1
tmp = P

for i in range(2, int(sqrt(P))):
    while True:
        newtmp, rest = divmod(tmp, (i**N))
        # print(i, tmp, rest, ans)
        if rest:
            break
        else:
            ans = ans * i
            tmp = newtmp
    if newtmp == 0:
        break

print(ans)

Submission status: Wrong Answer

Solution code:
def read():
    N, P = list(map(int, input().strip().split()))
    return N, P


def solve(N, P):
    for v in range(1000, 1, -1):
        if P % (v**N) == 0:
            return v
    return 1


if __name__ == '__main__':
    inputs = read()
    print(solve(*inputs))

Submission status: Wrong Answer

Solution code:
from math import sqrt
from collections import Counter


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

def is_prime(n):
    if n == 1: return False
    if n == 2: return True
    for i in range(2, int(sqrt(n))+1):
        if n % i == 0: return False
    return True

def prime_factorization(n):
    if is_prime(n):return [n]
    factor = []
    f = 2
    while f ** 2 <= n:
        if n % f == 0:
            factor.append(f)
            n /= f
        f += 1
    return factor

p = prime_factorization(P)
c = Counter(p)

l = []
j = []
for k, v in c.items():
    if N <= v:
        l.append(k)
        j.append(v//N)
ans = 1

for i,v in zip(l,j):
    ans *= i**v

print(ans)

Submission status: Wrong Answer

Solution code:
def soin(n):
    I=n
    s=0
    R=int(I)
    L=[]
    while s==0:
        for i in range(2,R+1):
            if I%i==0:
                I=I/i
                if I==1:
                    s=1
                L.append(i)
                break
    if len(L)==1:
        return [R]
    else:
        return L

n,p= map(int,input().split())
if n==1:
    print(p)
    exit

l=soin(p)

if len(l)<n:
    print(1)
    exit
print(min(l))

Submission status: Wrong Answer

Solution code:
from collections import deque
def gcd(a,b):
    while a%b:
        a,b=b,a%b
    return b

def prime_t(t):
    i=2
    while i**2<=t:
        if t%i==0:
            return 0
        i+=1
    return 1

def prime_list(tt):
    p_list=[]
    for i in range(2,tt+1):
        if prime_t(i):
            p_list.append(i)
    return p_list

l=[]
#for i in range(2,3333333):
for i in range(2,10000):
    if prime_t(i):
        l.append(i)
b=[]
d=deque()
t=deque()
n,p=map(int,input().split())
if n==1 or p==1:
    print(p)
    exit()
for i in l:
    while p%i==0:
        #b.append(i)
        d.append(i)
        p//=i
    if i>=p: break
ans=1
if (len(d)+len(t))<n:
    print(1)
    exit()
h=0
while (len(d)+len(t))!=n:
    if len(d)>1:
        x=d.popleft()
        y=d.pop()
        t.append(x*y)
        h=0
    elif len(d)==1 and h==0:
        x=t.popleft()
        y=d.pop()
        d.append(x*y)
        h=1
    elif len(t)>1:
        x=t.popleft()
        y=t.pop()
        d.append(x*y)
        h=0
    elif len(t)==1 and h==0:
        x=d.popleft()
        y=t.pop()
        t.append(x*y)
        h=1
"""
for i in d:
    print(i)
for i in t:
    print(i)
"""

while len(d)+len(t):
    if len(d)>0 and len(t)>0:
        x=d.pop()
        y=t.pop()
        ans=max(ans,gcd(max(x,y),min(x,y)))
    elif len(d)>1:
        x=d.pop()
        y=d.pop()
        ans=max(ans,gcd(max(x,y),min(x,y)))
    elif len(t)>1:
        x=t.pop()
        y=t.pop()
        ans=max(ans,gcd(max(x,y),min(x,y)))
    elif len(d)>0:
        x=d.pop()
        ans=max(ans,gcd(max(x,ans),min(x,ans)))
    elif len(t)>0:
        x=t.pop()
        ans=max(ans,gcd(max(x,ans),min(x,ans)))
print(ans)

Submission status: Wrong Answer

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


def kouyaku(n,p):
    if n==1:
        return p 
    
    else:
        if p%int(p**(1/n))==0:
            return int(p**(1/n))
        else:
            for i in range(round((p**(1/n)/2+1)),0,-1):        
                if p%i==0:
                    if p%(i**2)==0:
                        if p%(i**n)==0:
                            return i

            
print(kouyaku(n,p))

Submission status: Wrong Answer

Solution code:
import math
N,M = map(int,input().split())
Max = 1
for m in range(1,int(math.sqrt(M))+1):
    if M%m == 0:
        if m == int(m**(1/N))**N   :
            if Max < int(m**(1/N)):
                Max = int(m**(1/N))
        if M//m == int((M//m)**(1/N))**N and int((M//m)**(1/N)) <= M**(1/N) and Max < int((M//m)**(1/N)) :
            Max = int((M//m)**(1/N))
            
print(Max)

Submission status: Wrong Answer

Solution code:
N,P = map(int,input().split())
c = int(P**(1/N))
k=1
def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1
if N>1 and is_prime(P):
    print(1)
    exit()
while(1):
    if P%(c**N)==0:
        if k<=c:
            k=c
        print(k)
        exit()
    c-=1

Submission status: Wrong Answer

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

if n == 1:
    print(p)
    exit(0)

if n > p :
    print(1)
    exit(0)
ans = 1
for i in range(2,p):
    if p % i == 0:
        t = i**n
        if t > p//n :
            break
        if p % t == 0:
            ans = i
print(ans)

Submission status: Wrong Answer

Solution code:
import math

if __name__ == '__main__':
    n, p = list(map(int, input().split()))
    plist = []

    for i in range(2, int(math.sqrt(p)) + 1):
        if i > p:
            break
        while p % i == 0:
            p //= i
            plist.append(i)
    if p > 1:
        plist.append(p)

    a = []
    if not plist:
        print(1)
        exit()
    elif len(plist) < n:
        print(max(plist))
        exit()
    else:
        for i in list(set(plist)):
            if plist.count(i) >= n:
                a.append(i)
    ans = 1
    while a:
        ans *= a.pop()

    print(ans)

Submission status: Wrong Answer

Solution code:
n,p = map(int,input().split())
lst = [i for i in range(p) if i**n <= p][::-1]

if n == 1 or len(lst) == 1:
    print(1)
    exit()

for i in range(len(lst)):
    if p % lst[i]**n == 0:
        print(lst[i])
        exit()
print(1)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-


# def fun(n, p):
#     sosuu = [2]
#     if n == 1:
#         return p
#
#     base = 1
#     i = 2
#     while True:
#         # base_i = base * i
#         # pow_base_i_n = pow(base * i, n)
#         if pow(base * i, n) > p:
#             return base
#         if p % pow(base * i, n) == 0:
#             if i not in sosuu:
#                 sosuu.append(i)
#             base = base * i
#             # k = 0
#             # i = sosuu[k]
#             # i = 2
#             i = sosuu[-1]
#         else:
#             # k += 1
#             # if len(sosuu) > k + 1:
#             #     i = sosuu[k+1]
#             # else:
#             #     i += 2
#             if i == 2:
#                 i += 1
#             else:
#                 i += 2
#
#     return 1

# import numpy as np
import math

def dummy(n, p):
    if n == 1:
        return p

    i = 2
    output = 1
    limit = math.log(p, i)
    while i <= limit:
        if p % pow(i, n) == 0:
            output = i
        if i == 2:
            i += 1
        else:
            i += 2

    return output


if __name__ == "__main__":
    N, P = map(int, input().split())

    # output = fun(N, P)
    output = dummy(N, P)

    print(output)

Submission status: Wrong Answer

Solution code:
# encoding: utf-8
import math, sys
N, P = map(int, input().split())
 
ans = 1
P_tmp = P
if N == 1:
    ans = P
else:
    for p in range(2, P):
        # print("#", p)
        # escape
        if p ** N > (P_tmp // 2): break
        # process
        if P_tmp % (p ** N) == 0:
            # print("#", p, P_tmp)
            for i_p in range(1, P):
                if P_tmp % (p ** (N * (i_p + 1))) > 0: break
            P_tmp = P_tmp // (p ** (N * i_p))
            ans = ans * (p ** i_p)
 
print(ans)

Submission status: Wrong Answer

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


def kouyaku(n,p):
    if n==1:
        return p 
    
    else:
        if int(p**(1/n))-p**(1/n)< 1e-11:
            return int(p**(1/n))
        else:
            for i in range(round((p**(1/n)/2+1)),0,-1):        
                if p%i==0:
                    if p%(i**2)==0:
                        if p%(i**n)==0:
                            return i

            
print(kouyaku(n,p))

Submission status: Wrong Answer

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

if n == 1:
    print(p)
    exit()

b = [False] * 1000001
prime = []
b[1] = True

for i in range(2, 1000001):
    if b[i]:
        continue
    k = i + i
    while k < 1000001:
        b[k] = True
        k += i

    prime.append(i)

prime_num = [0] * len(prime)
pp = []

for i in range(len(prime)):
    while p % prime[i] == 0:
        pp.append(prime[i])
        prime_num[i] += 1
        p //= prime[i]

if sum(prime_num) == 0:
    print(1)
    exit()

ans = 0
for nn in range(n, max(prime_num) + 1, n):
    idx = []
    for i in range(len(prime) - 1, -1, -1):
        if prime_num[i] >= nn:
            idx.append(i)
            break

    if len(idx) == 0:
        ans = max(ans, 1)
        continue

    for i in range(idx[0] - 1, -1, -1):
        if prime_num[i] >= nn:
            idx.append(i)

    mn = 10 ** 13
    for x in idx:
        mn = min(mn, prime_num[x])

    a = mn // n

    ans_cur = 1
    for x in idx:
        ans_cur *= prime[x] ** a

    ans = max(ans, ans_cur)

print(ans)

Submission status: Wrong Answer

Solution code:
n,p=map(int, input().split())
ans=1
m=int(pow(p,1/n))+1
i=2
c=0
while(i<=p and i<m):
    print('i,p=',i,p)
    if p % i == 0:
        p=p/i
        c=c+1
        if p % i != 0:
            #print('i**(c//n)=',i**(c//n))
            ans = ans * ( i**(c//n) )
            i=i+1
            c=0
    else:
        i=i+1

print(ans)

Submission status: Wrong Answer

Solution code:
N,P = map(int, input().split())
 
if P == 1 or N == 2:
    print(1)
elif N == 1:
    print(P)
else:
    import math
 
    sq_P = math.floor(math.sqrt(P))
    prim = []
    P_tmp=P
 
    for i in range(2,sq_P+1):
        r=0
        if P_tmp%i == 0:
            r+=1
            P_tmp=P/i
            while P_tmp%i==0:
                r+=1
                P_tmp=P_tmp/i
            prim.append([i,r])
 
    ans = 1
    for i in range(len(prim)):
        if prim[i][1]>=N:
            ans = ans * prim[i][0]
 
    print(ans)

Submission status: Wrong Answer

Solution code:
a=[]
a=input().split(" ")
N=int(a[0])
P=int(a[1])
a=int(P**(1/N))
#aは約数の最大値
#aを整数化(bとする)
c=0
for i in range(1,a+1):#Pを1からbまで割って割り切れたものをリストcに格納

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

Submission status: Wrong Answer

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


def kouyaku(n,p):
    if n==1:
        return p 
    
    else:
        if int(p**(1/n))-p**(1/n)< 1e-6:
            return int(p**(1/n))
        else:
            for i in range(round((p**(1/n)/2+1)),0,-1):        
                if p%i==0:
                    if p%(i**2)==0:
                        if p%(i**n)==0:
                            return i

            
print(kouyaku(n,p))

Submission status: Wrong Answer

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

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

    p = 2
    ans = 1

    while True:
        if p >= P:
            break

        if N >= 40:
            break

        pn = p**N
        if pn > P or pn > 10**12:
            break

        while True:
            if P%pn == 0:
                P = (P/pn) * p
                ans *= p
            else:
                break

        p += 1

    print(ans)


if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

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

if n == 1:
    print(p)
    exit()

b = [False] * 1000001
prime = []
b[1] = True

for i in range(2, 1000001):
    if b[i]:
        continue
    k = i + i
    while k < 1000001:
        b[k] = True
        k += i

    prime.append(i)

prime_num = [0] * len(prime)
pp = []

for i in range(len(prime)):
    while p % prime[i] == 0:
        pp.append(prime[i])
        prime_num[i] += 1
        p //= prime[i]

if sum(prime_num) == 0:
    print(1)
    exit()

ans = 0
for nn in range(n, max(prime_num) + 1, n):
    idx = []
    for i in range(len(prime) - 1, -1, -1):
        if prime_num[i] >= nn:
            idx.append(i)
            break

    if len(idx) == 0:
        ans = max(ans, 1)
        continue

    for i in range(idx[0] - 1, -1, -1):
        if prime_num[i] >= nn:
            idx.append(i)

    mn = 10 ** 13
    for x in idx:
        mn = min(mn, prime_num[x])

    a = mn // nn

    ans_cur = 1
    for x in idx:
        ans_cur *= prime[x] ** a

    ans = max(ans, ans_cur)

print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
import math

n,p = map(int, input().split())
q=math.floor(np.sqrt(p))
ok_lis=[]
for i in range(2,q):
  count=0
  while p%i==0:
    p=p/i
    count+=1
    if count==n:
      ok_lis.append(i)
      continue
final=1
for j in ok_lis:
  final*=j
  
print(final)

Submission status: Wrong Answer

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

import math
#を素因数分解
# print(p)

def is_prime(x):
    if x < 2: return False # 2未満に素数はない
    if x == 2 or x == 3 or x == 5: return True # 2,3,5は素数
    if x % 2 == 0 or x % 3 == 0 or x % 5 == 0: return False # 2,3,5の倍数は合成数

    # ためし割り: 疑似素数(2でも3でも5でも割り切れない数字)で次々に割っていく
    prime = 7
    step = 4
    while prime <= math.sqrt(x):
        if x % prime == 0: return False

        prime += step
        step = 6 - step

    return True


if n==1:
    print(p)

if p==1:
    print(1)

if ((n!=1) and (p!=1)):
    #もし素数ならwhileの計算とばす

    sosubool = is_prime(p)
    yakusu=[1]

    p1 = p


    while(1):
        if sosubool==True:
            break
        bool = False

        for i in range(2,(p1//2+1)):
            if p1%i==0:
                yakusu.append(i)
                p1=p1//i
                bool = True
                break
        sosubool = is_prime(p1)
        if ((bool == False) or (sosubool==True)):
            yakusu.append(p1)
            break
            

    if yakusu.count(p)!=1:
        yakusu.append(p)
    # print(yakusu)
    maxyakusu=1
    t=0
    while(1):
        ya=yakusu[t]
        bool2=True
        for i in range(t+1,n+t):
            if yakusu[i]!=ya:
                bool2=False
                t+=1
                break
        if bool2==True:
            maxyakusu*=ya
            t+=n
        if n+t >=len(yakusu):
            break

    print(maxyakusu)

Submission status: Wrong Answer

Solution code:
a=[]
a=input().split(" ")
N=int(a[0])
P=int(a[1])
a=P**(1/N)
#aは約数の最大値
print(a)
b=int(a)#aを整数化(bとする)
c=0
for i in range(1,b-1):#Pを1からbまで割って割り切れたものをリストcに格納

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

Submission status: Wrong Answer

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


def kouyaku(n,p):
    if n==1:
        return p 
    else:
        if int(p**(1/n))*n-p< 1e-6:
            return int(p**(1/n))
        else:
            for i in range(round((p**(1/n)/2+1)),0,-1):        
                if p%i==0:
                    if p%(i**2)==0:
                        if p%(i**n)==0:
                            return i

            
print(kouyaku(n,p))

Submission status: Wrong Answer

Solution code:
import math
N=1
P=111

n = 2    
while n**N <= P:
    n += 1
list = list(range(n))

for i in range(n):
    if list[i] == 1 or list[i] == 0:
        continue
    if P % (i**N) != 0:
        a = int(max(list)/i)
        for j in range(a+1):
            list[i*j] = 1

print(max(list))

Submission status: Wrong Answer

Solution code:
N,P = map(int,input().split())
c = int(P**(1/N))
k=1
def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1
if N>1 and is_prime(P):
    print(1)
    exit()
while(1):
    if P%(c**N)==0:
        if k<c:
            k=c
        print(k)
        exit()
    c-=1

Submission status: Wrong Answer

Solution code:
n,p=map(int, input().split())
ans=1
m=int(pow(p,1/n))+1
i=2
c=0
while(i<=p and i<int(pow(p,1/n))+1):
    print('i,p=',i,p)
    if p % i == 0:
        p=p/i
        c=c+1
        if p % i != 0:
            #print('i**(c//n)=',i**(c//n))
            ans = ans * ( i**(c//n) )
            i=i+1
            c=0
    else:
        i=i+1

print(ans)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
if a==0:
    print(b)
elif b==1:
    print(b)
else:
    print(b)

Submission status: Wrong Answer

Solution code:
n,p = list(map(int, input().strip().split(' ')))
max_n = 1
for i in range(1,10000):
  if i**n > p:
    break
  max_n = i

def makeprimelist(n):
  plist = [2,3]
  for i in range(5, n):
    flag = True
    for p in plist:
      if i % p == 0:
        flag = False
        break
    if flag:
      plist.append(i)
  return plist

# aがbで何回割れるか
def func(a,b):
  i = 0
  n = a
  while True:
    if n % b == 0:
      n = n / b
      i += 1
    else:
      return i

plist = makeprimelist(max_n)
pnlist = [p**n for p in plist]

result = 1
for i,pn in enumerate(pnlist):
  if p % pn == 0:
    result *= plist[i]*func(p,pn)
print(result)

Submission status: Wrong Answer

Solution code:
N, P = map(int, input().split())
n = 1
    
p = int(P ** (1/N))

for i in range(p, 1, -1):
  while True:
    if P % (i ** N) == 0:
      n *= i
      P = P / (i ** N)
    else:
      break
  if P <= i ** N:
    break 
    
print(n)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
import math

n,p = map(int, input().split())
q=math.floor(np.sqrt(p))
ok_lis=[]
for i in range(2,q+1):
  count=0
  while p%i==0:
    p=p/i
    count+=1
    if count==n:
      ok_lis.append(i)
      continue
final=1
for j in ok_lis:
  final*=j
  
print(final)

Submission status: Wrong Answer

Solution code:
N,P = map(int,input().split())
c = int(P**(1/N))
k=1
print(c)
def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1
if N>1 and is_prime(P):
    print(1)
    exit()
while(1):
    if P%(c**N)==0:
        if k<c:
            k=c
        print(k)
        exit()
    c-=1

Submission status: Wrong Answer

Solution code:
import math
N,M = map(int,input().split())
Max = 1
for m in range(1,int(math.sqrt(M))+1):
    if M%m == 0:
        if m == int(m**(1/N))**N   :
            if Max < int(m**(1/N)):
                Max = int(m**(1/N))
        if M//m == int((M//m)**(1/N))**N and (M//m)**(1/N) <= M**(1/N) and Max < (M//m)**(1/N) :
            Max = int((M//m)**(1/N))
            
print(Max)

Submission status: Wrong Answer

Solution code:
import math
a = list(map(int, input().split()))
N = a[0]
P = a[1]
insu = []
sisu = []
offset = []
temp = int(math.sqrt(P))
ans = 1
for i in range(2, temp):
    cnt = 0
    while P % i == 0:
        P //= i
        cnt += 1
    if cnt > 0:
        insu.append(i)
        sisu.append(cnt)
        offset.append([i, cnt])

if len(insu) == 0:
    if not P == 1:
        insu.append(P)
        sisu.append(1)
        offset.append([P, 1])

A = sum(sisu)    

for i in sisu:
    if i > A - i:
        ans = insu[sisu.index(i)]
    
print(ans)

Submission status: Wrong Answer

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

p2 = int(p ** (1 / n))

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

Submission status: Wrong Answer

Solution code:
# encoding: utf-8
import math, sys
N, P = map(int, input().split())
 
ans = 1
P_tmp = P
if N == 1:
    ans = P
else:
    for p in range(2, P):
        # print("#", p)
        # escape
        if p ** N > int(math.sqrt(P_tmp)): break
        # process
        if P_tmp % (p ** N) == 0:
            # print("#", p, P_tmp)
            for i_p in range(1, P):
                if P_tmp % (p ** (N * (i_p + 1))) > 0: break
            P_tmp = P_tmp // (p ** (N * i_p))
            ans = ans * (p ** i_p)
 
print(ans)