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 numpy as np

def seachPrimeNum(N):
    max = int(np.sqrt(N))
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    while seachList[0] <= max:
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum



N, P = map(int, input().split(' '))
if N == 1:
    print(P)
    exit()

ans = 1
prime_nums = seachPrimeNum(10**4)
for a in prime_nums:
    if P % (a**N) == 0:
        temp = P // (a**N)
        count = 1
        while temp % (a**N) == 0:
            count += 1
            temp // (a**N)
        ans *= a**count
    elif a**N > P:
        break
print(ans)

Submission status: Wrong Answer

Solution code:
N,P=map(int,input().split())
if N==1:
    print(P)
    exit()
else:
    ans=1
    L=[0]*(10**6)
    for i in range(2,10**6):
        if P<i:
            break
        while P%i==0:
            if P%i==0:
                L[i]+=1
                P=P//i
    for j in range(10**6):
        if L[j]//N>=1:
            ans*=(j*(L[j]//N))
    print(ans)

Submission status: Wrong Answer

Solution code:
import math

N, P = map(int, input().split())
if N == 1:
    print(P)
    exit()

n = int(math.sqrt(P))
for i in range(n)[::-1]:
    if i == 0:
        break
    _num = P
    cnt = 0
    while True:
        if _num % i == 0:
            _num = _num / i
            cnt += 1
        else:
            break
        if cnt >= N:
            print(i)
            exit()
print(1)

Submission status: Wrong Answer

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

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(p)
    exit()

if len(pp) == 0:
    print(1)
    exit()

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

if len(idx) == 0:
    print(1)
    exit()

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

ans = 1
for x in idx:
    ans *= prime[x]

print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

N, P = [int(a) for a in input().strip().split()]

facs = prime_decomposition(P)
facc = Counter(facs)

common = 1
for fac in facc.keys():
    if facc[fac] >= N:
        common = common * fac

print(int(common))

Submission status: Wrong Answer

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

if n == 1 :
    print(p)
elif p == 1 :
    print(1)
elif n >= 40:
    print(1)
else:
    ans = 1
    count = 2
    while (count**n) < p:
        if(p % count**n == 0):
            ans *= count
            p /= count**n
        count += 1
    print(ans)

Submission status: Wrong Answer

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

for i in range(2, int(P**(1/N))+1):
    if P % i == 0:
        if i ** N > P:
            break

        elif i ** N == P:
            result = i
            break

        elif P % (i**N) == 0:
            result = i

print(result)

Submission status: Wrong Answer

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

from math import sqrt

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 n > 1:
        if n % f == 0:
            factor.append(f)
            n /= f
        else:
            f += 1
    return factor

p = prime_factorization(P)
from collections import Counter
c = Counter(p)

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

Submission status: Wrong Answer

Solution code:
import sys

N,P=[int(i) for i in input().split()]
i=2
ans = 1
c=0
if N == 1:
  print(P)
  sys.exit()
while P>i*i:
  if P%i==0:
    P//=i
    c+=1
    if c==N:
      ans*=i
      c=0
  else:
    c=0
    i+=1
print(ans)

Submission status: Wrong Answer

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

def pow_comp(base, P, N):
    i = 0
    while True:
        if pow(base + pow(2, i), N) > P:
            if i == 0:
                return base
            else:
                base += pow(2, i-1)
                i = 0
        else:
            i += 1


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

    output = pow_comp(0, P, N)

    print(output)

Submission status: Wrong Answer

Solution code:
import sys
import math
import collections

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

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

    return result

if P == 1:
    print(1)
    sys.exit()
else:
    answer = 1
    for k, v in collections.Counter(soinsuu(P)).items():
        if v >= N:
            answer *= k * (v // N)

    print(answer)

Submission status: Wrong Answer

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

factor = []

p = 2
n = P
while p * p <= n:
    c = 0

    while n % p == 0:
        c += 1
        n //= p
    if c > 0:
        factor.append((p, c))
    p += 1

ans = 1
for key, value in factor:
    num = value
    while num >= N:
        ans *= key
        num -= N
print(ans)

Submission status: Wrong Answer

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

mp = {}
for i in range(2, int(P**0.5) + 1):
    while P % i == 0:
        mp[i] = mp.get(i, 0) + 1
        P //= i
mp[P] = mp.get(P, 0) + 1
ans = 1
for i in mp.keys():
    ans *= max(i * (mp[i] // N), 1)
print(ans)

Submission status: Wrong Answer

Solution code:
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

N,p=map(int, input().split(" "))
tmp=prime_factors(p)

d={}
count=1
#result=[]
for i in tmp:
    if i in d:
        if d[i]==N-1:
            d[i]=0
            #result.append(i)
            count*=i
        else:
            d[i]+=1
    else:
        d[i]=1
print(count)

Submission status: Wrong Answer

Solution code:
import math

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

if N == 1:
    ans = P
else:
    for i in range(2, max_value):
        mod = i ** N
        if P % mod == 0:
            ans *= i
            P /= mod
        if i > math.floor(math.sqrt(P)):
            break

print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct
N,P = map(int,input().split())
numbers = factorize(P)
common=1
for pair in numbers:
    if pair[1]//N:  
        common*=(pair[0]*(pair[1]//N))
print(common)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,P = map(int,input().split())
k = 1
c = 2
while(1):
    if P<c**N:
        print(k)
        exit()
    if P%(c**N)==0:
        k *= c
        P /= c**N
    c+=1

Submission status: Wrong Answer

Solution code:
import math
import copy

n,p=map(int,input().split())
a=math.floor(p**(1/n))
#print(a)
ans=1
for i in range(a,1,-1):
    p_s=copy.deepcopy(p)
    cnt=0
    while p_s%i==0:
        cnt+=1
        p_s//=i
        if cnt>=n:
            print(i)
            exit()

Submission status: Wrong Answer

Solution code:
import fractions
from functools import reduce

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

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

root = int(P**(1/N))
while P % root != 0:
    root += 1

fac1 = root

fac_list = [fac1]

for i in range(N - 1):
    while P % fac1 != 0:
        fac1 += 1
    P /= fac1
    fac_list.append(fac1)

fac_list.append(int(P))

#print(fac_list)

print(int(gcd_list(fac_list)))

Submission status: Wrong Answer

Solution code:

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


    
l=[]

for i in range(int(p**(1/n))):
    if p%(i+1)**n==0:
        l.append(i+1)


print(max(l))

Submission status: Wrong Answer

Solution code:
n,p=map(int,input().split())
answer=1
#http://cocodrips.hateblo.jp/entry/2014/02/02/011119
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
soinsuu=prime_decomposition(p)
#ここからループさせたい
while len(soinsuu)>0:
    c=soinsuu.count(soinsuu[0])
    if c>=n:
        answer=answer*soinsuu[0]**int(c/n)
    del soinsuu[0:c]
print(answer)

Submission status: Wrong Answer

Solution code:
def main():
    n, p = map(int, input().split())
    x = 1

    for f, c in get_prime_factors(p):
        if c >= n:
            x *= f ** (c // n)

    print(x)

def get_prime_factors(p):
    f = 2

    while f * f <= p:
        c = 0
        while True:
            m, r = divmod(p, f)
            if r != 0:
                break
            c += 1
            p = m

        if c != 0:
            yield f, c

        f += 1

main()

Submission status: Wrong Answer

Solution code:
#!/mnt/c/Users/moiki/bash/env/bin/python
N,P = list(map(int, input().split()))
import math
# primes = [2]
# primax = int(1e4)
# for i in range(2,primax):
#     ok = True
#     # for p in [p for p in primes if p <= int(math.sqrt(i))]:
#     for p in primes:
#         if i % p == 0:
#             ok = False
#             break
#     if ok:
#         primes.append(i)

def get_prime(n):
    """ Returns  a list of primes < n """
    sieve = [True] * n
    for i in range(3,int(n**0.5)+1,2):
        if sieve[i]:
            sieve[i*i::2*i]=[False]*((n-i*i-1)//(2*i)+1)
    return [2] + [i for i in range(3,n,2) if sieve[i]]

primax = int(1e6)+10
primes = get_prime(primax)

def df(P, p):
    if P >= p:
        cnt = 0
        while P >= p and P % p == 0:
            P = int(P//p)
            cnt += 1
        return cnt
    else:
        raise "P , p error."

gc = []
for p in primes:
    if P % p == 0:
        cnt = df(P, p)
        P = int( P // int(p**cnt))
        gc.append([p, cnt])
        # P = int(P//p)
ans = 1
for g,cnt in gc:
    if cnt >= N:
        ans *= g**(cnt//N)

print(ans)
# print(primes)k
# print(gc)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import collections
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
a = list(map(int,input().split()))

b = []
co = 0
su = 1
s = prime_decomposition(a[1])
c = collections.Counter(s)
ss = c.most_common()
sss = c.values()
i = 0
for i in range(len(ss)):
    if ss[i][1] >= a[0]:
        su *= int(ss[i][0])

print(su)

Submission status: Wrong Answer

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

a = p + 0
b = 2
d = 0
e = 1

while True :
   if a%b==0 :
      d += 1
      a = a/b
   else :
      if d>=n :
         e *= b
      if a==1 :
         print(e)
         break
      b += 1
      d = 0

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,p=map(int,input().split())
answer=1
#http://cocodrips.hateblo.jp/entry/2014/02/02/011119
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
soinsuu=prime_decomposition(p)
print(soinsuu)
#ここからループさせたい
while len(soinsuu)>0:
    c=soinsuu.count(soinsuu[0])
    if c>=n:
        answer=answer*soinsuu[0]**int(c/n)
    del soinsuu[0:c]
    print(soinsuu)
print(answer)

Submission status: Wrong Answer

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

def factorize(n):
    fct = []
    b, e = 2, 0
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

fct = factorize(P)
fct.sort(key=lambda x:x[1], reverse=True)
res = 1
for el in fct:
    if el[1] >= N:
        res = res * el[0] * (el[1] // N)
print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def usage():
    c, n = map(int, input().split())
    if c == 1:
        print(n)
        return 0
    ans = 1
    fct = factorize(n)
    for i in range(len(fct)):
        if fct[i][1] >= c:
            ans *= fct[i][0] * (fct[i][1] // c)
    print(ans)


def factorize(n):
    fct = []
    b, e = 2, 0
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct


if __name__ == '__main__':
    usage()

Submission status: Wrong Answer

Solution code:
np = input().split(" ")
n = int(np[0])
p = int(np[1])

elem_list = []

flg = True
i = 1
while flg:
  if i ** n <= p:
    elem = i ** n
    if p % elem == 0:
      #print(i)
      #flg = False
      elem_list.append(elem)
  else:
    flg = False
  i += 1
print(int(max(elem_list) ** (1/n)))

Submission status: Wrong Answer

Solution code:
n,p=[int(i) for i in input().split()]
i=2
list1=[[0,0],[1,0]]
ans=1
while p!=1:
    list1.append([i,0])
    while 1:
        if p%i==0:
            list1[i][1]+=1
            p=p/i
        else:
            break
    i+=1
for i in range(len(list1)):
    if list1[i][1]>=n:
        ans=ans*i
print(ans)

Submission status: Wrong Answer

Solution code:
N, P = map(int, input().split())
m = int(P**(1/N))
while True:
  if P % m == 0:
    x = m**N
    if P % x == 0:
      break
  m -= 1
print(m)

Submission status: Wrong Answer

Solution code:
import collections
n,p = map(int,input().split())
s = 0 
a = int(p)
b = []

if p == 1:
    print(1)
else:
    while s == 0:
        for i in range(2,a+1):
            if p % i == 0:
                p = p / i
                if p == 1:
                    s = 1
                b.append(i)
                break
                
    c = collections.Counter(b)
    ans = 1
    for k,v in c.items():
        if v >= n:
            ans *= k
    print(ans)

Submission status: Wrong Answer

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

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 len(pp) == 0:
    print(1)
    exit()

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

if len(idx) == 0:
    print(1)
    exit()

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

ans = 1
for x in idx:
    ans *= prime[x]

print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
import math
import sys
N,P=[int(x) for x in input().split()]
if N==1:
    print(P)
    sys.exit(0)
now = P
d = defaultdict(int)

for i in range(2,int(math.sqrt(P))+1):
    while  now%i==0:
        now /= i
        d[i]+=1
ans=1
for k in d:
    if d[k] // N > 0:
        ans *= (k * (d[k] // N))
print(ans)

Submission status: Wrong Answer

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

count = 2
res = 1

if N == 1:
    print(P)
    exit()
while True:
    tmp = pow(count, N)
    if tmp > P:
        break
    if P % tmp == 0:
        res *= count
        P = P // tmp
        count = 2
    count += 1

print(res)

Submission status: Wrong Answer

Solution code:
n, p = 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

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

prime = prime_factor(p)
dprime = {}
for i in set(prime):
    dprime[i] = 0
for i in prime:
    dprime[i] += 1
key = []
for k, v in sorted(dprime.items(), key=lambda x:-x[0]):
    if v >= n:
        key.append(k)
res = 1
for i in key:
    res *= i
print(res)

Submission status: Wrong Answer

Solution code:
import math
n,p = map(int,input().split())
a = 2
c = 1
m = math.sqrt(p)
while a<=m:
    if p%(a**n) == 0:
        c *= a
        p //= a**n
        while p%(a**n) == 0:
            c *= a
            p //= a**n
        a += 1
        if p == 1:
            break
    else:
        a += 1
print(c)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 22 18:21:55 2018
CADDi2018C
@author: maezawa
""" 
import collections

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

if n == 1:
    ans = p
else:
    np = int(p**(1/n))
    
    # making a prime number list
    is_prime = [True]*(np+1)

    is_prime[0] = False
    is_prime[1] = False

    for i in range(2, np//2+1): # Sieve of Eratosthenes
        if is_prime[i] == True:
            for j in range(2*i,np+1,i):
                is_prime[j] = False
    
    prime_numbers = [i for i in range(np+1) if is_prime[i]]

    # prime factorization
    num = p # a number to be factorized. 
    # The maximum number to factrize is np**2. 
    
    facts = [] # list of prime factors
    for prime in prime_numbers:
        if prime > num//2:
            break
        dnum = num
        while dnum%prime == 0: 
            facts.append(prime)
            dnum = dnum//prime
    
    mul = 1
    for i in facts:
        mul *= i
    if mul != num: # if large prime number (> np) is missing
        facts.append(num//mul) # append it
    
    pfs = collections.Counter(facts)
    mostcommon = pfs.most_common()
    ans = 1
    for i, j in mostcommon:
        if j < n:
            break
        ans *= i

print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

N, P = [int(a) for a in input().strip().split()]

facs = prime_decomposition(P)
facc = Counter(facs)

common = 1
for fac in facc:
    if facc[fac] >= N:
        common = common * fac

print(common)

Submission status: Wrong Answer

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

for i in range(int(pow(p,1/n))):
    if n % (i+1)**p == 0:
        c=i+1
print(c)

Submission status: Wrong Answer

Solution code:
import math
q = input().split()
n = int(q[0])
p = int(q[1])
def isprime(n):
    for i in range(int(math.sqrt(n))+1):
        if i == 0 or i == 1:
            continue
        if n % i == 0:
            return False
    return True
a = 1
for i in range(p-2):
    x = i+2
    if p < x**n:
        break
    if isprime(x):
        if p % x**n == 0:
            a *= x
print(a)

Submission status: Wrong Answer

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

def prime_factorize(num):
    """
    This function performs prime factorization on the input natural number.
    The result is returned in the form of a dictionary with the prime number as the key
    and its number as the value.
    :param num:
    :return prime_factor: Dictionary with the prime number as the key and its number as the value.
    """
    prime_factor = {}
    i = 2
    while i ** 2 <= num:
        while num % i == 0:
            num //= i
            if i in prime_factor.keys():
                prime_factor[i] += 1
            else:
                prime_factor[i] = 1
        i += 1
    if num > 1:
        prime_factor[num] = 1
    return prime_factor

div = p//2

prime_fac = prime_factorize(p)
counts = []
for k, v in prime_fac.items():
    if v >= n:
        counts.append(k*(v//n))

counts.sort(reverse=True)
if len(counts) == 0:
    print(1)
elif n == 1:
    print(p)
else:
    r = 1
    num = 0
    for c in counts:
        if num >= n:
            break
        r *= c
        num += 1
    print(r)

Submission status: Wrong Answer

Solution code:

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

def factorize(n):
    fct = list()
    base, exp = 2, 0
    while base * base <= n:
        while n % base == 0:
            n = n // base
            exp = exp + 1

        if exp > 0:
            fct.append((base, exp))

        base, exp = base + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

fs = sorted(factorize(P), reverse=True)


ans = 1
for f in fs:
	if f[1] >= N:
		ans *= f[0]

print(ans)

Submission status: Wrong Answer

Solution code:
N,P=map(int,input().split())
c=1
while c**N<=P:
    c+=1
print(c-1)

Submission status: Wrong Answer

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

now_max = 1

for i in range(int(math.pow(P, 1/N)), 0, -1):
    if P % (i ** N) == 0:
        now_max = i
        break

print(now_max)

Submission status: Wrong Answer

Solution code:
n,p=map(int,input().split())
l=[]
for i in range(1001,0,-1):
  x=pow(i,n)
  if p%x==0:
    print(i)
    break

Submission status: Wrong Answer

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

def addP(dP,a):
    if a in dP:
        dP[a] += 1
    else:
        dP[a] = 1

dP = {}
iLim  = int(P**0.5)+1
for i in range(2,iLim+1):
    while P % i == 0:
        P //= i
        addP(dP,i)
        addP(dP,P)
    if P == 1:
        break

iC = 1
for i in dP:
    if N <= dP[i] :
        iC *= i* (dP[i]//N)

print(iC)

Submission status: Wrong Answer

Solution code:
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

if __name__ == '__main__':
    n, p = (int(x) for x in input().split())
    
    list = prime_factors(p)
    count = 0
    beforeValue = -1
    
    ans = 1
    if (n == 1):
        ans = p
    else :
        for i in range(0, len(list)):
            if (beforeValue == list[i]):
                count += 1
                if (count == n):
                    ans *= list[i]
            else:
                count = 1
                beforeValue = list[i]
    print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    n, p = map(int, input().split())
    x = 1

    for f, c in get_prime_factors(p):
        if c >= n:
            x *= f * (c // n)

    print(x)

def get_prime_factors(p):
    f = 2

    while f * f<= p:
        c = 0
        while True:
            m, r = divmod(p, f)
            if r != 0:
                break
            c += 1
            p //= f
        if c != 0:
            yield f, c

        f += 1

    if p != 1:
        yield p, 1

main()

Submission status: Wrong Answer

Solution code:
import math
N, P = map(int, input().split())
ans = 0
for q in range(1, int(math.pow(P, 1.0/N))+1):
    if P % (q**N) == 0:
        ans = q
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    n, p = map(int, input().split())
    x = 1

    print(list(get_prime_factors(p)))

    for f, c in get_prime_factors(p):
        if c >= n:
            x *= f * (c // n)

    print(x)

def get_prime_factors(p):
    f = 2

    while f * f<= p:
        c = 0
        while True:
            m, r = divmod(p, f)
            if r != 0:
                break
            c += 1
            p //= f
        if c != 0:
            yield f, c

        f += 1

    if p != 1:
        yield p, 1

main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

N, P = map(int, input().split())
tmp = [p for p, k in factorize(P) if k >= N]
gcd = 1
for t in tmp:
    gcd *= t
print(gcd)

Submission status: Wrong Answer

Solution code:
def usage():
    c, n = map(int, input().split())
    if c == 1:
        print(n)
        return 0
    ans = 1
    fct = factorize(n)
    for i in range(len(fct)):
        if fct[i][1] >= c:
            ans *= fct[i][0]
    print(ans)


def factorize(n):
    fct = []
    b, e = 2, 0
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct


if __name__ == '__main__':
    usage()

Submission status: Wrong Answer

Solution code:
N,P = list(map(int,input().split()))
mylist = []
roop  = int((10**12)**(1/N))
if N ==1:
    print(P)
else:
    for i in range(2,roop):
        if P%(i**N)==0:
            mylist.append(i)
            P = P/(i**N)
    ans = 1
    L = len(mylist)
    for i in range(L):
        ans = ans*mylist[i]
    print(ans)

Submission status: Wrong Answer

Solution code:
import math
from collections import Counter
n, p = [int(_) for _ in input().split()]

def isprime_alpha(n):
    if n == 1:
        return True
    elif n == 2:
        return True
    elif n == 3:
        return True
    elif n % 2 == 0 or n % 3 == 0:
        return False
    else:
        for j in range(5, math.ceil(n ** (1/2))+1):
            if n % j == 0:
                return False
        return True

def factor(n, fac_list):
    if isprime_alpha(n):
        fac_list.append(n)
        return fac_list
    else:
        for i in range(2, math.ceil(n ** (1/2))+1):
            if n % i == 0:
                fac_list.append(i)
                return factor(n // i, fac_list)

list = []
list_result = factor(p, list)
print(list_result)
counter_dict = Counter(list_result)
print(counter_dict)

result = 1
for key, value in counter_dict.items():
    if value % n != 0:
        value -= value % n
    for j in range(value // n):
        result *= key

print(result)

Submission status: Wrong Answer

Solution code:
import math
n,p = map(int,input().split())
a = 2
c = 1
while a<=math.sqrt(p):
    if p%(a**n) == 0:
        c *= a
        p //= a
        while p%(a**n) == 0:
            c *= a
            p //= a
        a += 1
        if p == 1:
            break
    else:
        a += 1
print(c)

Submission status: Wrong Answer

Solution code:
n,p=map(int,input().split())
answer=1
#http://cocodrips.hateblo.jp/entry/2014/02/02/011119
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
soinsuu=prime_decomposition(p)
#ここからループさせたい
while len(soinsuu)>0:
    c=soinsuu.count(soinsuu[0])
    if c>=n:
        answer=answer*soinsuu[0]*int(c/n)
    del soinsuu[0:c]
print(answer)

Submission status: Wrong Answer

Solution code:
import collections


N, P = map(int, input().split())
num = []
ans = 1

if 2**N > P:
    print(1)
    
else:
    i = 2
    while P != 1 and i <= 10**6 + 1:
        if P % i == 0:
            P //= i
            num.append(str(i))
        else:
            i += 1
            
    con = collections.Counter(num)
    con = con.most_common()
    for x, y in con:
        if y >= N:
            ans *= int(x)
        else:
            break
    print(ans)

Submission status: Wrong Answer

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

count = 2
res = 1
while True:
    tmp = pow(count, N)
    if tmp > P:
        break
    if P % tmp == 0:
        res *= count
        P /= tmp
        count = 2
    count += 1

print(res)

Submission status: Wrong Answer

Solution code:
import math


def primes(x):
    if x < 2: return []

    primes = [i for i in range(x)]
    primes[1] = 0 # 1は素数ではない

    # エラトステネスのふるい
    for prime in primes:
        if prime > math.sqrt(x): break
        if prime == 0: continue
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]


N, P = map(int, input().split(' '))
ans = 1
t = 2
while t**N <= P:
    t += 1
prime_nums = primes(t)
for a in prime_nums:
    if P % (a**N) == 0:
        temp = P // (a**N)
        count = 1
        while temp % (a**N) == 0:
            count += 1
            temp // (a**N)
        ans *= a**temp
    elif a**N > P:
        break
print(ans)

Submission status: Wrong Answer

Solution code:
N, P = map(int, input().split())
lst = []
while True:
    for i in range(2, P+1):
        if P % i == 0:
            lst.append(i)
            P //= i
            break
    if P == 1:
        break
ans = 1
uniq = list(set(lst))
for i in uniq:
    if lst.count(i) // N > 0:
        ans *= (lst.count(i) // N) * i
print(ans)