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 math
n,p = [int(i) for i in input().split()]
if n==1:
 print(p)
 exit()

x=math.ceil(p**(1/n))//2
primes = []
for i in range(2,x):
 flg = True
 for prime in primes:
  if i%prime==0:
   flg=False
   break
 if flg:
  primes.append(i)

ans = 1
for i in primes:
 while True:
  if p%(i**n)==0:
   p/=(i**n)
   ans*=i
  else:
   break

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import math
import collections

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

def soinsuu(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

    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 = [int(_) for _ in input().split()]

def addP(dP:dict,a:int):
    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)
    if P == 1:
        break
if P != 1:
    addP(dP,P)
iC = 1
for i in dP:
    if N <= dP[i] :
        iC *= i * (dP[i]//N)
print(iC)

Submission status: Wrong Answer

Solution code:
import math
def trial_division(fact_dict):    # It is necessary that n > 2
    global n
    f = 2
    while True:
        if f ** 2 <= n:
            if n % f == 0:
                if f in fact_dict:
                    fact_dict[f] += 1
                else:
                    fact_dict[f] = 1
                n = int(n / f)
                break
            else:
                f += 1
        else:
            if n in fact_dict:
                fact_dict[n] += 1
            else:
                fact_dict[n] = 1
            n = 1
            break


N, P = map(int, input().split())
n = P
fact_dict = {}
ans = 1
lst = []
while n > 1:    #Be careful to the difference between local and global variables
    trial_division(fact_dict)
for i in range(len(fact_dict)):
    keys = list(fact_dict.keys())
    key = keys[-i]
    val = fact_dict[key]
    if val >= N:
        lst.append(key)

if lst != []:
    for i in lst:
        ans *= i

print(ans)

Submission status: Wrong Answer

Solution code:
import collections

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

def cal(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

c = collections.Counter(cal(P)).most_common()

for x, y in c:
    if y >= N:
        ans *= x
    else:
        break
print(ans)

Submission status: Wrong Answer

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

elem_list = []

def search(n, p, elem_list, i):
  elem = i ** n
  while elem <= p:
    elem = i ** n
    if p % elem == 0:
      elem_list.append(elem)
      return search(n, int(p / (i ** n)), elem_list, i + 1)
    i += 1
  return elem_list

elem_list = search(n, p, elem_list, 1)

#print(int(max(elem_list) ** (1/n)))
import functools
import operator
result = int(functools.reduce(operator.mul, elem_list) ** (1/n))
print(result)

Submission status: Wrong Answer

Solution code:
#!/mnt/c/Users/moiki/bash/env/bin/python
N,P = list(map(int, input().split()))
import math


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(1e7) + 9 * int(1e6) + 9 * int(1e5) + 9 * int(1e4)
primes = get_prime(primax)
# print(primes)


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:
import math
from fractions import gcd
from functools import reduce


# 0以上整数x「未満」の素数をリストに格納して返す
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())
res = 0
if n == 1 or int(pow(p, 1/p)) == p:
    print(p)
else:
    divide = math.ceil(pow(p, 1/n))
    for i in reversed(range(1, divide)):
        if p % (i**(n-1)) == 0:
            tmp =i**(n-1)
            tmp2 = p//i**(n-1)
            res = max(res, gcd(i, tmp2))
print(res)

Submission status: Wrong Answer

Solution code:
import math
def make_prime_list(num):
    if num < 2:
        return []
    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0
    num_sqrt = math.sqrt(num)

    for prime in prime_list:
        if prime == 0:
            continue
        if prime > num_sqrt:
            break
        
        for non_prime in range(2 * prime, num, prime):
            prime_list[non_prime] = 0
    return [prime for prime in prime_list if prime != 0]

def prime_factorization(num):
    if num <= 1:
        return {1 : 1}
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list(num_sqrt)

        dict_counter = {}
        for prime in prime_list:
            while num % prime == 0:
                if prime in dict_counter:
                    dict_counter[prime] += 1
                else:
                    dict_counter[prime] = 1
                num //= prime
        if num != 1:
            if num in dict_counter:
                dict_counter[num] += 1
            else:
                dict_counter[num] = 1
        return dict_counter




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

    d = prime_factorization(P)

    cnt = 1

    for key, value in d.items():
        if value >= N:
            cnt *= key

    print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
import random
import collections

length, num = list(map(int, input().split()))

# def make_seed():
#     global length
#     seed_primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
#     for i in range(len(seed_primes)):
#         seed_primes[i] = pow(seed_primes[i], length)
#     return seed_primes
#
#
# class Prime:
#     seed_primes = make_seed()
#     # print(seed_primes)
#
#     def is_prime(self, n):
#         """
#         prime test (hybrid)
#
#         see also: https://qiita.com/gushwell/items/ff9ed83ba55350aaa369
#
#         :param n:
#         :return: boolean
#         """
#         is_prime_common = self.is_prime_common(n)
#         if is_prime_common is not None:
#             return is_prime_common
#
#         if n < 2000000:
#             return self.is_prime_brute_force(n)
#         else:
#             return self.is_prime_miller_rabin(n)
#
#     def is_prime_common(self, n):
#         if n == 1: return False
#         if n in Prime.seed_primes: return True
#         if any(map(lambda x: n % x == 0, self.seed_primes)): return False
#
#     def is_prime_brute_force(self, n):
#         """
#         brute force prime test
#         use with is_prime_common if you want to skip seed_primes
#
#         :param n:
#         :return: boolean
#         """
#         for k in range(2, int(math.sqrt(n)) + 1):
#             if n % k == 0:
#                 return False
#         return True
#
#     def is_prime_miller_rabin(self, n):
#         """
#         miller rabin prime test
#         use with is_prime_common if you want to skip seed_primes
#
#         see also
#             algorithm: https://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test
#             implementation: https://qiita.com/srtk86/items/609737d50c9ef5f5dc59
#             improvement: https://qiita.com/gushwell/items/ff9ed83ba55350aaa369
#
#         :param n:
#         :return: boolean
#         """
#
#         d = n - 1
#         while d & 1 == 0:
#             d >>= 1
#
#         # use one of these lines / upper is more efficient.
#         witnesses = self.get_witnesses(n)
#         # witnesses = [random.randint(1, n - 1) for _ in range(100)]
#
#         for w in witnesses:
#             y = pow(w, d, n)
#
#             while d != n - 1 and y != 1 and y != n - 1:
#                 y = (y * y) % n
#                 d <<= 1
#
#             if y != n - 1 and d & 1 == 0:
#                 return False
#
#         return True
#
#     def get_witnesses(self, num):
#         def _get_range(num):
#             if num < 2047:
#                 return 1
#             if num < 1373653:
#                 return 2
#             if num < 25326001:
#                 return 3
#             if num < 3215031751:
#                 return 4
#             if num < 2152302898747:
#                 return 5
#             # if num < 3474749660383:
#             #     return 6
#             # if num < 341550071728321:
#             #     return 7
#             # if num < 3825123056546413051:
#             #     return 9
#             return 12
#         # print(self.seed_primes[:_get_range(num)])
#
#         return self.seed_primes[:_get_range(num)]
#
#     def gcd(self, a, b):
#         if a < b:
#             return self.gcd(b, a)
#         if b == 0:
#             return a
#         while b:
#             a, b = b, a % b
#         return a
#
#     @staticmethod
#     def f(x, n, seed):
#         """
#         pseudo prime generator
#         :param x:
#         :param n:
#         :param seed:
#         :return: pseudo prime
#         """
#         p = Prime.seed_primes[seed % len(Prime.seed_primes)]
#         return (p * x + seed) % n
#
#     def find_factor(self, n, seed=1):
#         global length
#         """
#         find one of factor of n
#         this function is based to Pollard's rho algorithm
#
#         see also
#             algorithm: https://en.wikipedia.org/wiki/Pollard%27s_rho_algorithm
#             implementation: https://qiita.com/gushwell/items/561afde2e00bf3380c98
#
#         :param n:
#         :param seed:
#         :return: factor
#         """
#         if self.is_prime(n):
#             return n
#
#         x, y, d = 2, 2, 1
#         count = 0
#         while d == 1:
#             count += 1
#             x = self.f(x, n, seed)
#             y = self.f(self.f(y, n, seed), n, seed)
#             d = self.gcd(abs(x - y), n)
#
#         d = pow(d, length)
#
#         if d == n:
#             return self.find_factor(n, seed+1)
#         return self.find_factor(d)
#
#     def find_factors(self, n):
#         primes = {}
#         if self.is_prime(n):
#             primes[n] = 1
#             return primes
#
#         while n > 1:
#             factor = self.find_factor(n)
#             print(factor)
#
#             primes.setdefault(factor, 0)
#             primes[factor] += 1
#
#             n //= factor
#
#         print(primes)
#
#         return primes

# def make_seed(num):
#     global seed_primes
#     for i in range(len(seed_primes)):
#         seed_primes[i] = pow(seed_primes[i], num)

#nの素因数分解(O(n**0.5)
def prime_factor(n):
    ass = collections.defaultdict(int)
    for i in range(2,int(n**0.5)+1):
        while n % i==0:
            # ass.append(i)
            ass[i] += 1
            n = n//i
    if n != 1:
        ass[n] += 1
    return ass

if __name__ == '__main__':

    # make_seed(num)
    # prime = Prime()
    # soinnsuu = prime.find_factors(num)
    soinnsuu = prime_factor(num)
    ans = 1
    # print(soinnsuu)
    for data in soinnsuu.keys():
        if soinnsuu[data] >= length:
           ans *= data
        # if soinnsuu[data] >= length:
        # ans *= data
    print(ans)

Submission status: Wrong Answer

Solution code:
#!/mnt/c/Users/moiki/bash/env/bin/python
N,P = list(map(int, input().split()))
import math


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(1e7) + 9 * int(1e6) + 9 * int(1e5)
primes = get_prime(primax)
# print(primes)


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())
result = 1
i = int(P ** (1/N))

while True:
    if P % (i**N) == 0:
        print(i)
        break
    i -= 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:
    if n == 1:
        print(p)
    else:
        print(1)
    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:
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(1, 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:
n, p = list(map(int, input().split()))

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
#!/mnt/c/Users/moiki/bash/env/bin/python
N,P = list(map(int, input().split()))
import math


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(1e7) + 9 * int(1e6)
primes = get_prime(primax)
# print(primes)


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())
cnt = int(P**(1/N))+1

for i in range(1, cnt):
#         print(i)
    a = P/(i**N)
    if a.is_integer():
        ans = i
#             print(ans)
    else:
        continue
print(int(ans))

Submission status: Wrong Answer

Solution code:
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 = list(set(b))   
    ans = 1
    for i in range(len(c)):
        if b.count(c[i]) >= n:
            ans *= c[i]
    
    print(ans)

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(1, max_value):
        mod = i ** N
        print(mod)
        if P % mod == 0:
            ans *= i
            P //= mod
        if i > math.floor(math.sqrt(P)):
            break

print(ans)

Submission status: Wrong Answer

Solution code:
def e(n,p):
  i = 2
  ans = 1
  while i * i <= n:
    b = 0
    while n % i == 0:
      n /= i
      b += 1
    else:
      ans *= i**(b//p)
    i += 1
  return ans
  
n,p = map(int, input().split())

a = e(p,n)
print(a)

Submission status: Wrong Answer

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

number = P
 
i = 2
D = {}

while number >= i:
    if number % i == 0:
        if i not in D :
            D[i] = 1
        else :
            D[i] += 1
        number /= i
    else:
        i += 1

ans = 1
for i in D :
    if D[i] >= N :
        ans *= i
print(ans)
#print(min(D.values()))
#print(D)

Submission status: Wrong Answer

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


def main():
    """Function."""
    n, p = map(int, input().split())

    x_val = int((p ** (1/n)) // 1)
    for _ in range(x_val):
        if p % (x_val ** n) == 0:
            break
        else:
            x_val -= 1

    print(x_val)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/mnt/c/Users/moiki/bash/env/bin/python
N,P = list(map(int, input().split()))
import math


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(1e7)+ int(1e6)
primes = get_prime(primax)
# print(primes)


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:
import math
n,p = list(map(int, input().split()))
if n == 1:
  print(p)
elif p == 1:
  print(p)
else:
  num = []
  sml = []
  k = 1
  i = 2
  while k < p:
    for l in num:
      if i % l == 0:
        break
    else:
      if p % i == 0:
        num.append(i)
        sml.append(1)
        a = sml[-1]+1
        while p % (i**a) == 0:
          sml[-1] += 1
          a += 1
        k *= num[-1]**sml[-1]
    i += 1
  j = 1
  for e,m in enumerate(sml):
    if m >= n:
      j *= num[e]
  print(j)

Submission status: Wrong Answer

Solution code:
import math
import copy

N,P= map( int , raw_input().split() )
Po=copy.deepcopy(P)


D={}
p=math.sqrt(P)

x=2
cnt=0
while x<p:
	if P%x==0:
		P/=x
		cnt+=1
	else:
		if cnt>1:
			D[x]=cnt
		x+=1
		cnt=0
else:
	if cnt>1:
		D[x]=cnt	



if len(D)==0:
	print Po	
else:
	ans=1
	for x,y in D.items():
		if y>=N:
			ans*= x**(y/N)
	print ans

Submission status: Wrong Answer

Solution code:
import collections

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

if __name__ == '__main__':
    l=prime_factors(p)
    
c = collections.Counter(l)
pr=1
for f1,f2 in c.items():
    if f2/n>=1:
        pr*=f1*int(f2/n)
        
print(pr)

Submission status: Wrong Answer

Solution code:
N,P = map(int,input().split(" "))
gcd = 1
flag = 0
for i in range(P):
    g = i+2
    conp = P
    for j in range(N):
        if conp%g!=0:
            break
        else:
            conp = int(conp/g)
    if j+1 == N:
        gcd = g
print(gcd)

Submission status: Wrong Answer

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

anser=[1]
end=int(P**(1/N))

for i in range(2,end+1):
    if P%(i**N)==0:
        anser.append(i)
print(anser[-1])

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, count in factor:
    if count >= N:
        ans *= key * (count // N)

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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:
    b = a**n
    if p%b == 0:
        c *= a
        p //= b
        while p%b == 0:
            c *= a
            p //= b
        a += 1
        if p == 1 or b>p:
            break
    else:
        a += 1
print(c)

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(1e7)+10000
primes = get_prime(primax)
# print(primes)


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

i=1
gcd=1
if(n==1):
    print(p)
else:
    while((i**n)<=p):
        if(p%(i**n)==0):
            gcd*=i
            p/=i**n
        i+=1
        
    print(gcd)

Submission status: Wrong Answer

Solution code:
import math
import collections
def trial_division_sqrt(n):
    prime_count = collections.Counter()
    
    for i in range(2, int(math.sqrt(n)) + 2):
        while n % i == 0:
            n /= i
            prime_count[i] += 1
    if n > 1:
        prime_count[n] += 1
    
    return prime_count

N,P = map(int,input().split())
cnt = trial_division_sqrt(P)
sorted_cnt = cnt.most_common()#個数の降順に並び替え

ans  = 1
for i in range(len(cnt)):
    divisor_cnt = sorted_cnt[i][1] // N 
    divisor_num = sorted_cnt[i][0] 
    if  divisor_cnt >= 1:
        ans *= divisor_num * divisor_cnt
        

print(int(ans))

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 = temp // (a**N)
            print(temp)
        ans *= a**count

    elif a**N > P:
        break
print(ans)

Submission status: Wrong Answer

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

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
    
ans = 1
for i in dic:
    if dic[i] != 0:
        ans = ans*(i**((dic[i]//N)))
print(ans)

Submission status: Wrong Answer

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

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])*(ss[i][1]//a[0])

print(su)

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 = 2
    c+=1

Submission status: Wrong Answer

Solution code:
import math
N,P = map(int,input().split(" "))
i = 2
plimes = []

if N == 1:
    print(P)
else:
    while(i <= math.sqrt(P)):
        if P % i == 0:
            P = P // i
            plimes.append(i)
        else:
            i += 2

    resalt = 1
    j = 0

    while(len(plimes) > j):
        k =plimes.count(plimes[j])
        if k // N >= 1:
            resalt *= plimes[0]
        j = j + k
    print(resalt)

Submission status: Wrong Answer

Solution code:
def e(n,p):
  i = 2
  table = []
  ans = 1
  while i * i <= n:
    b = 0
    while n % i == 0:
      n /= i
      b += 1
      if b >= p:
        ans *= i
        break
    i += 1
  return ans
  
n,p = map(int, input().split())

a = e(p,n)
print(a)

Submission status: Wrong Answer

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

i = 1
ans = 1
if N == 2 and P > 1e11:
	i = 316227
	while P >= i**N:
		if P % i**N == 0:
			ans = i
		i += 1
elif N > 1:
	while P >= i**N:
		if P % i**N == 0:
			ans = i
		i += 1
else:
	ans = P
print(ans)

Submission status: Wrong Answer

Solution code:
import math

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

i = 2
l = []
while i*i <= P:
    while P%i == 0:
        P /= i
        l.append(i)
    i += 1
if P > 1:
    l.append(int(P))

n = list(set(l))
c = [math.floor(l.count(i)/N) for i in n]
res = 1
for m in [n_*c_ for n_,c_ in zip(n,c)]:
    if m > 0:
        res = res * m

print(res)

Submission status: Wrong Answer

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

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

else:
    for i in range(1, cnt):
#         print(i)
        a = P/(i**N)
        if a.is_integer():
            ans = i
#             print(ans)
        else:
            continue
    print(int(ans))

Submission status: Wrong Answer

Solution code:
import math
import copy

n,p=map(int,input().split())
a=math.floor(p**(1/n))
#print(a)
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:
# -*- coding: utf-8 -*-


def main():
    """Function."""
    n, p = map(int, input().split())

    if n == 1:
        print(p)
    elif p == 1:
        print(1)
    else:
        x_val = int((p ** (1/n)) // 1)
        for _ in range(x_val):
            if p % (x_val ** n) == 0:
                break
            else:
                x_val -= 1

        print(x_val)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n,p=map(int,input().split())
ans=1
def prime_factors(p):
    i = 2
    factors = []
    while i * i <= p:
        if p % i:
            i += 1
        else:
            p //= i
            factors.append(i)
    if n > 1:
        factors.append(p)
    return factors
primelist=prime_factors(p)
set=list(set(primelist))
for i in set:
    if primelist.count(i)//n>=1:
      ans=ans*(i**(primelist.count(i)//n))
    else:
      pass
print(ans)

Submission status: Wrong Answer

Solution code:
N,P = list(map(int,input().split()))
mylist = []
roop  = int((10**12)**(1/N))

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


if N ==1:
    print(P)
else:
    Primelis = primes(roop)
    for i in Primelis:
        if P%(i**N)==0:
            mylist.append(i)
    ans = 1
    L = len(mylist)
    for i in range(L):
        ans = ans*mylist[i]
    print(ans)