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:
# -*- coding: utf-8 -*-

from sys import stdin
import math

n,x = [int(i) for i in stdin.readline().split()]
limit = int(x ** (1.0/n)) + 1

def devide_counter(x, p):
    count = 1
    x /= p
    while x % p == 0:
        count += 1
        x /= p
    return x, count

def factorize(x):
    ans = 1

    p = 2
    if x % p == 0:
        x, count = devide_counter(x, p)
        if count >= n:
            ans = ans * p * (count // n)

    for p in range(3, limit, 2):
        if x % p == 0:
            x, count = devide_counter(x, p)
            if count >= n:
                ans = ans * p * (count // n)
        if x < p * p:
            break
    return ans

if x == 1:
    print(1)
elif n == 1:
    print(x)
else:
    ans = factorize(x)
    print(ans)

Submission status: Wrong Answer

Solution code:
n, p= [int(i) for i in input().split()]
#print(n,p)
ans=0
pp=int(p**(1/n))+1
for i in range(1,pp):
  b=i**n
  c=p/b
  if c.is_integer()==True and ans<i:
    ans=i
    
print(ans)

Submission status: Wrong Answer

Solution code:
n, p= [int(i) for i in input().split()]
#print(n,p)
ans=0
pp=int(p**(1/n))+1
for i in range(1,pp):
  b=i**n
  c=p/b
  if c.is_integer()==True:
    ans=i
    
print(ans)

Submission status: Wrong Answer

Solution code:
n, p= [int(i) for i in input().split()]
#print(n,p)
pp=int(p**(1/n))+1
for i in range(1,pp):
  b=i**n
  c=p/b
  if c.is_integer()==True:
    ans=i
    
print(ans)

Submission status: Wrong Answer

Solution code:
n, p = [int(i) for i in input().split()]
num = int(p ** (1 / n))
for i in range(num):
    pp = p
    dv = num - i
    for j in range(n):
        if pp % dv == 0:
            pp /= dv
        else:
          break
    else:
        ans = dv
        break
print(ans)

Submission status: Wrong Answer

Solution code:
N, P = map(int, raw_input().split())
if N == 1:
    print P
else:
    res = 2
    for i in range(2, int(P ** (1/2.)) + 1):
        if i ** N > P:
            break
        if P % (i ** N) == 0:
            res = i
    print res

Submission status: Wrong Answer

Solution code:
N, P = map(int, raw_input().split())
if N == 1:
    print P
else:
    res = 2
    for i in range(2, int(N ** (1/2.))):
        if i ** N > P:
            break
        if P % (i ** N) == 0:
            res = i
    print res

Submission status: Wrong Answer

Solution code:
import math


def get_max(n, p):
    factors = []
    counts = []

    count = 0
    while p % 2 == 0:
        count += 1
        p = p / 2

    if count > 0:
        factors.append(2)
        counts.append(count)

    for i in xrange(3, int(math.sqrt(p)) + 1, 2):
        # print i

        count = 0
        while p % i == 0:
            count += 1
            p = p / i

        if count > 0:
            factors.append(i)
            counts.append(count)

    if p > 2:
        factors.append(p)
        counts.append(1)

    if len(factors) == 0:
        return 1

    i = len(factors) - 1

    ans = 1

    while i >= 0:

        # print counts[i], n

        if counts[i] >= n:
            ans *= factors[i]

        i -= 1

    return ans

N, P = map(int, raw_input().split())
print get_max(N, P)

Submission status: Wrong Answer

Solution code:
def get_max(n, p):
    factors = []
    counts = []

    count = 0
    while p % 2 == 0:
        count += 1
        p = p / 2

    if count > 0:
        factors.append(2)
        counts.append(count)

    for i in xrange(3, p-1, 2):
        # print i

        count = 0
        while p % i == 0:
            count += 1
            p = p / i

        if count > 0:
            factors.append(i)
            counts.append(count)

    if p > 2:
        factors.append(p)
        counts.append(1)

    if len(factors) == 0:
        return 1

    i = len(factors) - 1

    ans = 1

    while i >= 0:

        # print counts[i], n

        if counts[i] >= n:
            ans *= factors[i]

        i -= 1

    return ans

N, P = map(int, raw_input().split())
print get_max(N, P)

Submission status: Wrong Answer

Solution code:
N, P = [int(i) for i in input().strip().split()]
dic={}
ans = 1
 
for i in range(2,int(P**(1/2))+1):
    num = 0
    while P%i == 0:
        num = num +1
        P = P//i
    dic[i] = num//N
    ans = ans*(i**(dic[i]))

if N == 1:
    print(P)
elif P == 1:
    print(1)
else:
    print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,p= map(int,input().split())
if 2 >= int(p**(1/n))+1:
    print(1)
else: print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,p= map(int,input().split())
if 2 >= int(p**(1/n))+2:
    print(1)
else: print(0)

Submission status: Wrong Answer

Solution code:
print(1)

Submission status: Wrong Answer

Solution code:
n,p= map(int,input().split())
res=1
if n==1:
    res=p
else:
    for i in range(3,int(pow(p,1/n))+2):
        x=i**n
        if x>p:
            break
        if p%x==0:
            res=i
print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


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
  
if __name__ == '__main__':

    lst = prime_decomposition(P)
    cout = collections.Counter(lst)
    ans = 1
    for p in cout.items():
        if p[1]>= N:
            ans = ans * p[0]
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
n,p= map(int,input().split())
res=1
if n==1:
    res=p
else:
    for i in range(2,int(math.sqrt(p))):
        x=i**n
        if x>p:
            break
        if p%x==0:
            res=i
print(res)

Submission status: Wrong Answer

Solution code:
import math
n,p= map(int,input().split())
res=1
if n==1:
    res=p
for i in range(2,int(math.sqrt(p))):
    x=i**n
    if x>p:
        break
    if p%x==0:
        res=i

print(res)

Submission status: Wrong Answer

Solution code:
import math
n,p= map(int,input().split())
res=1
if n==1:
    res=p
for i in range(2,int(math.sqrt(p))):
    if p/i**n>p:
        break
    if p%i**n==0:
        res=i

print(res)

Submission status: Wrong Answer

Solution code:
import math
n,p= map(int,input().split())
res=1
if n==1:
    res=p
for i in range(2,int(math.sqrt(p))):
    if p%i**n==0:
        res=i
    if p/i**n>p:
        break
    
print(res)

Submission status: Wrong Answer

Solution code:
import math
n,p= map(int,input().split())
res=1
if n==1:
    res=p
for i in range(2,int(math.sqrt(p))):
    if i**n>p:
        break
    if p%i**n==0:
        res=i

print(res)

Submission status: Wrong Answer

Solution code:
import math
n,p= map(int,input().split())
res=1
if n==1:
    res=p
for i in range(2,int(math.sqrt(p))):
    if i**n>p:
        break
    if i**n==p:
        res=i

print(res)

Submission status: Wrong Answer

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

from sys import stdin
import math
from functools import reduce

n,x = [int(x) for x in stdin.readline().split()]
limit = int(math.pow(x, (1.0/n)))

def hagitori_counter(x, p):
    count = 1
    x /= p
    while x % p == 0:
        count += 1
        x /= p    
    return x, count


def factorize(x):
    ans = 1

    p = 2
    if x % p == 0:
        x, count = hagitori_counter(x, p)
        if count >= n:
            ans = ans * p * (count // n)

    for p in range(3, limit, 2):
        if x % p == 0:
            x, count = hagitori_counter(x, p)
            if count >= n:
                ans = ans * p * (count // n)
    return ans

if x == 1:
    print(1)
elif n == 1:
    print(x)
else:
    ans = factorize(x)
    print(ans)

Submission status: Wrong Answer

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

from sys import stdin
import math
from functools import reduce

n,x = [int(x) for x in stdin.readline().split()]
limit = int(math.pow(x, (1.0/n)))

def hagitori_counter(x, p):
    count = 1
    x /= p
    while x % p == 0:
        count += 1
        x /= p    
    return x, count


def factorize(x):
    ans = 1

    for p in range(2, limit):
        if x % p == 0:
            x, count = hagitori_counter(x, p)
            if count >= n:
                ans = ans * p * (count // n)
        if x < p:
            break

    return ans

if x == 1:
    print(1)
elif n == 1:
    print(x)
else:
    ans = factorize(x)
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

from sys import stdin
import math
from functools import reduce

n,x = [int(x) for x in stdin.readline().split()]
limit = int(math.pow(x, (1.0/n)))

def hagitori_counter(x, p):
    count = 1
    x /= p
    while x % p == 0:
        count += 1
        x /= p    
    return x, count


def factorize(x):
    ans = 1

    p = 2
    if x % p == 0:
        x, count = hagitori_counter(x, p)
        if count >= n:
            ans = ans * p * (count // n)

    for p in range(3, limit, 2):
        if x % p == 0:
            x, count = hagitori_counter(x, p)
            if count >= n:
                ans = ans * p * (count // n)
        if x < p:
            break

    return ans

if x == 1:
    print(1)
elif n == 1:
    print(x)
else:
    ans = factorize(x)
    print(ans)

Submission status: Wrong Answer

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

from sys import stdin
import math
from functools import reduce

n,x = [int(x) for x in stdin.readline().split()]
limit = int(math.pow(x, (1.0/n)))

def hagitori_counter(x, p):
    count = 1
    x /= p
    while x % p == 0:
        count += 1
        x /= p    
    return x, count


def factorize(x):
    ans = 1

    p = 2
    if x % p == 0:
        x, count = hagitori_counter(x, p)
        if count >= n:
            ans = ans * p * (count // n)

    for p in range(3, limit, 2):
        if x % p == 0:
            x, count = hagitori_counter(x, p)
            if count >= n:
                ans = ans * p * (count // n)
        if x < p * p:
            break

    return ans

if x == 1:
    print(1)
elif n == 1:
    print(x)
else:
    ans = factorize(x)
    print(ans)

Submission status: Wrong Answer

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

from sys import stdin
import math
from functools import reduce

n,x = [int(x) for x in stdin.readline().split()]
limit = int(math.pow(x, (1.0/n)))

def factorize(x):
    ans = 1

    p = 2
    if x % p == 0:
        count = 1
        x /= p
        while x % p == 0:
            count += 1
            x /= p
        else:
            if count >= n:
                ans = ans * p * (count // n)

    for p in range(3, limit, 2):
        if x % p == 0:
            count = 1
            x /= p
            while x % p == 0:
                count += 1
                x /= p
            else:
                if count >= n:
                    ans = ans * p * (count // n)
        if x < p * p:
            break
            
    return ans

if x == 1:
    print(1)
elif n == 1:
    print(x)
else:
    ans = factorize(x)
    print(ans)

Submission status: Wrong Answer

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

from sys import stdin
import math
from functools import reduce

n,x = [int(x) for x in stdin.readline().split()]
limit = int(math.pow(x, (1.0/n)))

def factorize(x):
    ans = 1

    p = 2
    if x % p == 0:
        count = 0
        while x % p == 0:
            count += 1
            x /= p
        else:
            if count >= n:
                ans = ans * p * (count // n)

    for p in range(3, limit, 2):
        if x % p == 0:
            count = 0
            while x % p == 0:
                count += 1
                x /= p
            else:
                if count >= n:
                    ans = ans * p * (count // n)
    return ans

if x == 1:
    print(1)
elif n == 1:
    print(x)
else:
    ans = factorize(x)
    print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter

def prime_factor(n):
    res = Counter()
    for i in range(2, int(n**.5) + 1):
        while n % i == 0:
            res[i] += 1
            n //= i
    if n != 1:
        res[n] += 1
    return res

N, P = map(int, input().split())
cnt = prime_factor(P)
ans = 1
for f in cnt:
    if cnt[f] >= N:
        ans *= cnt[f] // N * f
print(ans)

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 = int(p**(1/n))+1
if i%2 == 0:
    i -= 1
while i > 1:
    if p%(i**n) == 0:
        print(c*i)
        exit()
    else:
        i -= 2

Submission status: Wrong Answer

Solution code:
import numpy as np
import math

args = [int(i) for i in input().split()]
N = args[0]
P = args[1]
logP = math.log(P)

num = 1

i = 2
count = 0
while P % i == 0:
    P /= i
    count += 1
x = count // N
num *= i**x

i = 3
while N*math.log(i) <= math.log(P):#i**N>P
    count = 0
    while P % i == 0:
        P /= i
        count += 1
    x = count // N
    num *= i**x
    i += 2
    print(num)

print(num)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np

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

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

def search(N,prime_arr,islist):
    prime_list = set(prime_arr)
    flag=0
    x=1
    if len(prime_arr)<N:
        x=1
        flag=1
    else:
        for i in prime_list:
            cnt = prime_arr.count(i)
            if cnt >= N :
                for _ in range(N) :
                    prime_arr.remove(i)
                islist.append(i)
                flag=1
                #print(islist)
                x=1
                for j in range(len(islist)):
                    x=x*islist[j]
                #print(x)
            else:
                for _ in range(cnt) :
                    prime_arr.remove(i)
            #print(prime_arr)
    return prime_arr,flag,x

if __name__ == '__main__':
    islist=[]
    prime_arr = prime_factors(P)
    #print("initial" + str(prime_arr))
    while 1 :
        res_search = search(N, prime_arr, islist)
        if res_search[1]:
            ans=res_search[2]
        if res_search[1] :
            break
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if n==1:
  print(p)
else:
  ans=1
  for i in range(1,int(p**(1/n))+1):
    tmp=i**n
    if (p>=tmp) and (p%tmp == 0):
     ans=i
    if(p<tmp):
      break
  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 p**(N+1) <= P:
    k = 0
    while P % p == 0:
        P //= p
        k += 1
    ans *= p**(k//N)

    r = p % 6
    if r == 1:
        p += 4
    elif r == 5:
        p += 2
    else:
        p += 1

p = P**(1/N)
if p==int(p):
    ans *= int(p)

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, P = (int(i) for i in input().split())
print(max([x for x in range(1,int(pow(P, 1/N))+1) if P%(x**N)==0]))

Submission status: Wrong Answer

Solution code:
N,P = map(int,input().split())
g = 1
for i in range(2,int(P**(1/N))+1):
    if P%i==0:
        e = 0
        while(P%i==0):
            P/=i
            e+=1
        if e>=N:
            g *= i*(int(e/N))
print(int(g))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in reversed(range(1, int(math.pow(P, 1 / N)) + 1)):
    if P % i ** N == 0:
        print(i)
        exit()

Submission status: Wrong Answer

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

for i in reversed(range(1, int(pow(P, 1 / N)) + 1)):
    if P % i ** N == 0:
        print(i)
        exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, P = list(map(int, input().split()))
if N == 1:
    print(P)
    exit()
elif P == 1:
    print("1")
    exit()

ans = 1
tmp = P

for i in range(2, int(pow(P, 1 / N))):
    po = pow(i, N)
    while tmp % po == 0:
        tmp = tmp // po
        ans = ans * i
        # print(i, tmp, ans)

    if tmp < po:
        break

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from math import sqrt
N, P = list(map(int, input().split()))
if N == 1:
    print(P)
    exit()
elif P == 1:
    print("1")
    exit()

ans = 1
tmp = P

for i in range(2, P):
    po = pow(i, N)
    while tmp % po == 0:
        tmp = tmp // po
        ans = ans * i
        # print(i, tmp, rest, ans)
        print(i, tmp, ans)

    if tmp < po:
        break

print(ans)

Submission status: Wrong Answer

Solution code:
import math

N, P = map(int, input().split())
max_value = math.floor(pow(P, 1/N))
ans = 1

if N == 1:
    ans = P
else:
    for i in range(1, max_value+1):
        mod = i ** N
        if P % mod == 0:
            ans = i

print(ans)

Submission status: Wrong Answer

Solution code:
import math

N, P = map(int, input().split())
max_value = math.floor(pow(P, 1/N))
ans = 1

if N == 1:
    ans = P
else:
    for i in range(1, max_value):
        mod = i ** N
        if P % mod == 0:
            ans = i

print(ans)

Submission status: Wrong Answer

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

from math import sqrt, ceil
from collections import defaultdict

rootp = ceil(sqrt(P))

cs = defaultdict(int)

x = P
for i in range(2, rootp):
    while x % i == 0:
        cs[i] += 1
        x //= i
cs[x] += 1

#print(cs)

result = 1

for n in cs:
    x = cs[n] // N
    if x:
        result *= n * x

print(result)

Submission status: Wrong Answer

Solution code:
import math
n, N = map(int, input().split())
i = 2
fact = []
if N == 1:
  fact.append(N)
else:
  while i <= N:
    if N % i == 0:
      fact.append(i)
      N //= i
    else:
      if i > math.sqrt(N) + 1:
        fact.append(int(N))
        break
      else:
        i += 1

result = []
now_num = fact[0]
count = 1
for i in range(1, len(fact)):
  if fact[i] == now_num:
    count += 1
  else:
    result.append((now_num, count))
    now_num = fact[i]
    count = 1

result.append((now_num, count))
ret = []
for i in range(len(result)):
  if result[i][1] >= n:
    ret.append(result[i][0])
ans = 1
for i in ret:
  ans *= i
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

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

def search(N,prime_arr,islist):
    prime_list = set(prime_arr)
    flag=0
    x=1
    for i in prime_list:
        cnt = prime_arr.count(i)
        if cnt >= N :
            for _ in range(N) :
                prime_arr.remove(i)
            islist.append(i)
            flag=1
            #print(islist)
            x=1
            for j in range(len(islist)):
                x=x*islist[j]
            #print(x)
        else:
            for _ in range(cnt) :
                prime_arr.remove(i)
        #print(prime_arr)
    return prime_arr,flag,x

if __name__ == '__main__':
    islist=[]
    prime_arr = prime_factors(P)
    #print("initial" + str(prime_arr))
    while 1 :
        res_search = search(N, prime_arr, islist)
        if res_search[1]:
            ans=res_search[2]
        if res_search[1] :
            break
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if(N == 1):
  print(P)
  exit()
elif(P == 1):
  print(1)
  exit()
  
num = []
s = 0
while s == 0:
  for i in range(2,p+1):
    if(p%i == 0):
      p = int(p/i)
      if(p == 1):
        s = 1
      num.append(i)
      break
d = {}
cnt = 1
for i in num:
  d[i] = num.count(i)
for k, v in d.items():
  if(v >= n):
    cnt *= k ** (v//n)
    print(k,v)
print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys,math
n,p= map(int,input().split())
res=1
if n==1:
    res=p
for i in range(2,int(math.sqrt(p))):
    if p%i**n==0:
        res=i
    if p/i**n>p:
        break
    
print(res)

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 = int(p**(1/n))
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())
p = P**(1/N)
if p % 1 == 0:
    print(int(p))
    exit()

lim = int(p) + 1

dic = {}

def my(N,newP=P):
    for i in range(2,lim+1):
        while newP % i == 0:
            dic[i] = dic.get(i,0) + 1
            newP = newP // i
        if newP < i or i == lim+1:
            res = 1
            for j,k in dic.items():
                res *= j**(k//N)
            print(res)
            exit()
my(N)
print(1)

Submission status: Wrong Answer

Solution code:
import sys,math
n,p= map(int,input().split())
res=1
if n==1:
    res=p
for i in range(2,int(math.sqrt(p))):
    if p/n**i==p//n**i:
        res=i
    
print(res)

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:
        break
    if i**n < p:
        s = i+1
    else:
        t = i-1
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())
n, p = N, P

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

num = []
s = 0
while s == 0:
  for i in range(2,p+1):
    if(p%i == 0):
      p = int(p/i)
      if(p == 1):
        s = 1
      num.append(i)
      break
d = {}
cnt = 1
for i in num:
  d[i] = num.count(i)
for k, v in d.items():
  if(v >= n):
    cnt *= k ** (v//n)
    print(k,v)
print(cnt)

Submission status: Wrong Answer

Solution code:
N, P = map(int, input().split())
p = P**(1/N)
if p % 1 == 0:
    print(int(p))
    exit()

lim = int(p) + 1

dic = {}

def my(N,newP=P,s=2):
    for i in range(s,lim+1):
        while newP % i == 0:
            dic[i] = dic.get(i,0) + 1
            newP = newP // i
            s = i
        if newP < i or i == lim+1:
            res = 1
            for j,k in dic.items():
                res *= j**(k//N)
            print(res)
            exit()
    
my(N)

Submission status: Wrong Answer

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

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

num = []
s = 0
while s == 0:
  for i in range(2,p+1):
    if(p%i == 0):
      p = int(p/i)
      if(p == 1):
        s = 1
      num.append(i)
      break
d = {}
cnt = 1
for i in num:
  d[i] = num.count(i)
for k, v in d.items():
  if(v >= n):
    cnt *= k ** (v//n)
    print(k,v)
print(cnt)

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:
        break
    if i**n < p:
        t = i-1
    else:
        s = i+1
while i > 1:
    if p%(i**n) == 0:
        print(c*i)
        exit()
    else:
        i -= 1
print(c)