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: Accepted

Solution code:
def caddi2018b_c():
    from collections import Counter
    def prime_decomposition(num):
        i = 2
        table = []
        while i * i <= num:
            while num % i == 0:
                num /= i
                table.append(i)
            i += 1
        if num > 1:
            table.append(int(num))
        return table

    n, p = map(int, input().split())
    ans = 1
    factors = Counter(prime_decomposition(p))
    for val in factors:
        ans *= val ** (factors[val] // n)
    print(ans)


caddi2018b_c()

Submission status: Accepted

Solution code:
def prime(p):
    ret = {}
    a = int(p ** 0.5)
    k = 2
    while(p > 1):
        if p % k == 0:
            p //= k
            ret[k] = ret.get(k, 0) + 1
        elif k > a:
            k = p
        else:
            k += 1
    return ret


n, p = map(int, input().split())
ret = prime(p)
# print(ret)
ans = 1
for i in list(filter(lambda x: ret[x] >= n, list(ret))):
    ans *= i ** (ret[i] // n)
print(ans)

Submission status: Accepted

Solution code:
import math
import collections

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
    
N, P = map(int, input().split())

factors = prime_factor(P)
c = collections.Counter(factors)

count = 1

for i in c.keys():
    sho = c[i]//N
    count *= pow(i, sho)
    
print(count)

Submission status: Accepted

Solution code:
from collections import Counter


def d(P):
    c = Counter()
    i = 2
    while (P > 1):
        if P % i == 0:
            c.update([i])
            P //= i
            i -= 1
        i += 1
        if i > P ** 0.5:
            c.update([P])
            break
    return c


def solve(N, P):
    c = d(P)
    ans = 1
    for k in [k for k, v in c.items() if v >= N]:
        ans *= k ** (c[k] // N)
    return ans

if __name__ == "__main__":
    N, X = tuple(map(int, input().split(" ")))
    print(solve(N, X))

Submission status: Accepted

Solution code:
import math
from collections import defaultdict
# 0以上整数x「未満」の素数をリストに格納して返す
n, p = map(int, input().split())

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]
#pr = primes(p + 1)
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

pr = prime_factors(p)
di = {}
di = defaultdict(int)
for i in pr:
    while p % i == 0:
        p = p // i
        di[i] += 1

ans = 1
ww = 1
for i in di:
    while True:
        if di[i] >= ww * n:
            ans *= i
            ww += 1
        else:
            ww = 1
            break
print(ans)

Submission status: Accepted

Solution code:
N,n = map(int,input().split())
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])
num = []
ans = 1
for i in range(len(fct)):
    while(fct[i][1] >= N):
        ans *= fct[i][0]
        fct[i][1] -= N
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from collections import Counter
N, P = map(int, input().split())


def primes(n):
    primfac = []
    d = 2
    while d*d <= n:
        while (n % d) == 0:
            primfac.append(d)  # supposing you want multiple factors repeated
            n //= d
        d += 1
    if n > 1:
       primfac.append(n)
    return primfac

ctr = Counter(primes(P))

ans = 1
for k,v in ctr.items():
    if v >= N:
        ans *= k ** (v//N)

print(ans)

Submission status: Accepted

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

N,P = list(map(int, input().split()))
ans = 1
fct = factorize(P)
for f in fct:
    ans = ans * max(1,(f[0] ** (f[1]//N)))

print(ans)

Submission status: Accepted

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

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

for i in range(int(math.sqrt(P))+1,1,-1):
  #print(i)
  temp=i
  tempdiv=P
  count=0
  while(True):
    if tempdiv%temp==0:
      tempdiv=tempdiv//temp
      count+=1
      if count==N:
        print(i)
        exit()
      else:
        continue;
    else:
      break;

print(1)

Submission status: Accepted

Solution code:
from math import sqrt

N, P = map(int, input().split())
primes = []
for i in range(2, 1+int(sqrt(P))):
    count = 0
    while P % i == 0:
        P //= i
        count += 1
    primes.append((i, count))
if P > 1:
    primes.append((P, 1))

ans = 1
for p, k in primes:
    ans *= p ** (k // N)
print(ans)

Submission status: Accepted

Solution code:
# https://stackoverflow.com/questions/15347174/python-finding-prime-factors
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 = [int(_) for _ in input().split()]


import collections
lst = prime_factors(P)
c = collections.Counter(lst)

result = 1
for k in c.keys():
    temp = c[k] // N
    if temp >= 1:
        result *= (k ** temp)

print(result)

Submission status: Accepted

Solution code:
# coding:utf-8

import sys
from collections import defaultdict

input = sys.stdin.readline
INF = float('inf')
MOD = 10 ** 9 + 7


def inpl(): return list(map(int, input().split()))


N, P = inpl()


def prime_factorization(num):
    prime_cnt = defaultdict(int)

    i = 2
    while i * i <= num:
        if num % i == 0:
            cnt = 0
            while num % i == 0:
                cnt += 1
                num //= i
            prime_cnt[i] += cnt
        i += 1

    if num != 1:
        # nに素数が残っている場合処理をする
        prime_cnt[num] += 1

    return prime_cnt


pcnt = prime_factorization(P)

ans = 1
for key in pcnt.keys():
    tmp = pcnt[key]
    while tmp >= N:
        ans *= key
        tmp -= N

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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 = [int(i) for i in input().split()]
l = prime_factors(p)
l = [str(i) for i in l]
s = list(set(l))
a = 1
b = 0
for i in range(len(s)):
    b = l.count(s[i]) // n
    if b > 0:
        a *= int(s[i])**b
print(a)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
N, P = map(int, input().split())

dic = {}
n = 2
while n * n <= P:
    while P % n == 0:
        if n not in dic:
            dic[n] = 1
        else:
            dic[n] += 1
        P //= n
    n += 1
if P != 1:
    dic[P] = 1

ans = 1
for k, v in dic.items():
    ans *= pow(k, v // N)

print(ans)

Submission status: Accepted

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

l = prime_factors(P)

c = 1
for n in list(set(l)):
    c *= n ** (l.count(n) // N)

print(c)

Submission status: Accepted

Solution code:
import math
from collections import defaultdict

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

def make_prime_list_2(num):
    if num < 2:
        return []

    # 0のものは素数じゃないとする
    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 # 1は素数ではない
    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_1(num):
    if num <= 1:
        return False
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list_2(num_sqrt)

        dict_counter = defaultdict(int)
        for prime in prime_list:
            while num % prime == 0:
                dict_counter[prime] += 1
                num //= prime
        if num != 1:
            dict_counter[num] += 1

        dict_counter = dict(dict_counter)

        return dict_counter

ans_dict = prime_factorization_1(P)

ans = 1

if ans_dict:
    for soinsuu in ans_dict:
        while True:
            if ans_dict[soinsuu] >= N:
                ans_dict[soinsuu] -= N
                ans *= soinsuu
            else:
                break

print(ans)

Submission status: Accepted

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

if __name__ == "__main__":
    n,p = map(int, input().split())
    x = factorize(p)
    ans=1
    for i in x:
        if i[1]>=n:
            ans = ans*(i[0]**(i[1]//n))
    print(ans)

Submission status: Accepted

Solution code:
def soin(N):
    res = []
    i = 2
    while i < round(N**(1/2)) + 3:
        if N%i == 0:
            res.append(i)
            N = N//i
            i = 2
        else:
            i += 1
    res.append(N)
    return res

N, P = (int(i) for i in input().split())
res = soin(P)

def countList(L, ma = None):#maは要素の個数の最大値
    if ma == None:
        ma = len(L)
    L.sort() #すでにしているなら不要
    temp = None
    cc = 1
    reslis = []
    for se in L:
        if temp == se:
            cc += 1
        else:
            if temp == None:
                pass
            else:
                if cc >= N:
                    aaa = temp ** (cc // N) 
                    reslis.append(aaa)
                cc = 1
            temp = se
    if cc >= N:
        aaa = temp ** (cc // N) 
        reslis.append(aaa)
    return reslis

aaa = countList(res)
re = 1
for i in aaa:
    re *= i

print(re)

Submission status: Runtime Error

Solution code:
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
N,K=map(int,input().split())
L=factorization(N)
ans=1
for i in L:
  ans*=L[0]**(L[1]//N)
print(ans)

Submission status: Runtime Error

Solution code:
from collections import Counter
n, p = map(int, input().split())
C = counter()
for i in range(2, int(p**.5)+1):
  while p % i == 0:
    Counter[p] += 1
    p //= i
ans = 1
for p, cnt in C.items():
  ans *= pow(p, cnt // n)
print(ans)

Submission status: Runtime Error

Solution code:
N,P=map(int,input().split())
if N==1:
    print(P)
elif P==1:
    print(1)
else:
    ans=0
    for i in range(2,10**12+1):
        p=pow(i,N)
        if p<=P and P%p==0:
            ans=i
        elif p>P:
            break
print(ans)

Submission status: Runtime Error

Solution code:
import sympy
        
N,P = map(int,input().split())
d = sympy.factorint(P)
ans=1
a=1
for k,v in d.items():
    a = k*(v//N)
    if a:
        ans *= a
print(ans)

Submission status: Runtime Error

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

if n == 1:
    print(p)
else:
    ans = 1
    g = 1
    while True:
        t = g**n
        if t > p: break
        if p%t == 0:
            ans = max(ans, g)
        g += 1
    print(ans)

Submission status: Runtime Error

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

if n == 1:
    print(p)
else:
    ans = 1
    g = 1
    while g**n <= p:
        if p % (g**n) == 0:
            ans = max(ans, g)
        g += 1
    print(ans)

Submission status: Runtime Error

Solution code:
n,p=map(int,input().split())
a=1
for i in range(2,int(p**0.5)+2):
  if p%i==0:
    c=0
    while p%i!=0:
      p//=i
      c+=1
	a*=(c//n)*i
  if p==1:
    break
print(a)

Submission status: Runtime Error

Solution code:
from collections import Counter
import sys
sys.setrecursionlimit(1000000)
def bunkai(q):
  res = []
  if q == 1:
    res.append(1)
    return res
  else:
    n_dummy = q
    for i in range(2,int(n_dummy**0.5)+3):
      while n_dummy%i == 0:
        n_dummy //= i
        res.append(i)
    if n_dummy >= 2:
      for i in range(2,int(n_dummy**0.5)+3):
        while n_dummy%i == 0:
          n_dummy //= i
          res.append(i)
    if n_dummy >= 2:
      res.append(n_dummy)
  return res
def solve():
  n,p = (int(i) for i in input().split())
  ans = 1
  query = bunkai(p)
  %print(query)
  c = Counter(query)
  
  for i in range(len(c.values())):
    number,times = c.most_common()[i]
    if times >= n:
      timestimes = times//n
      ans *= timestimes*number

  print(ans)
  
solve()

Submission status: Runtime Error

Solution code:
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 998244353
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())


# 先にふるってprimesを作る
def hurui(N):
    koho = list(range(2,N))
    prime = []
    limit = math.sqrt(koho[-1])
    while True:
        p = koho[0]
        if limit <= p:
            prime = prime + koho
            break
        else:
            prime.append(p)
            koho = [e for e in koho if e%p != 0]

    return prime

# N を素因数分解
def factorization(N):
    ans = defaultdict(int)
    pind = 0
    while N > 1:
        p = primes[pind]
        while N%p == 0:
            N //= p
            ans[p] += 1
        pind += 1

    return ans


N,P = inpl()

primes = hurui(int(math.sqrt(P))+1)
facs = factorization(P)

ans = 1
for p,n in facs.items():
    if n >= N:
        ans *= p*(n//N)

print(ans)

Submission status: Runtime Error

Solution code:
N, P = map(int, input().split())
if N == 1:
    print(P)
    exit()
if int(P ** (1 / N)) < 2:
    print(1)
print(int(P ** (1 / N)) + 10)
for n in range(int(P ** (1 / N))+1, 0, -1):
    if P % (n ** N) == 0:
        print(n)
        break

Submission status: Runtime Error

Solution code:
import sys

np = input().split()
n = int(np[0])
p = int(np[1])
bound_p = int(p ** (1 / min(n, 10)))


ilist = list(range(1, bound_p + 1))
ilist.reverse()


for i in ilist:
    pp = p
    for j in range(n):
        if pp % i != 0:
            break
        pp = pp // i
    else:
        print(i)
        sys.exit(0)


print(1)

Submission status: Runtime Error

Solution code:
import sys

np = input().split()
n = int(np[0])
p = int(np[1])
bound_p = int(p ** (1 / n))


ilist = list(range(1, bound_p + 1))
ilist.reverse()


for i in ilist:
    if p % (i**n) == 0:
        print(i)
        sys.exit(0)

print(1)

Submission status: Runtime Error

Solution code:
#https://qiita.com/daikw/items/f48d6ac374255763463dより
import math
import random


class Prime:
    seed_primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]

    def is_prime(self, n):
        """
        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

        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):
        """
        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)

        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)

            primes.setdefault(factor, 0)
            primes[factor] += 1

            n //= factor

        return primes


prime = Prime()

if __name__ == '__main__':
    prime = Prime()
    n,p = (int(i) for i in input().split())
    a = prime.find_factors(p)
ans = 1
for i in range(2,max(a)+1):
  if i in a:
    if a[i] >= n:
      ans = ans*i
print (ans)

Submission status: Runtime Error

Solution code:
import sys
from math import ceil
sys.setrecursionlimit(10**9)

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

start = ceil(P**(1/N))

for ans in range(start,-1,-1) :
    if not P % ans**N :
        break
print(ans)

Submission status: Runtime Error

Solution code:
import math
N, P = (int(i) for i in input().split())
a = 1
b = math.floor(math.sqrt(P))
i = 2
c = P

if N ==1:
    a = P
if N =2 and P = 1000000000000:
    a = 1000000
else:
    while (i**N <= P) and (i<=b):
        if c % (i**N) == 0:
            a = i
        i = i+1

print(a)

Submission status: Runtime Error

Solution code:
N,P=map(int,input().split())
q={}
w=P//2+2
dp=[False]*w
m=2
for i in range(w//2):
    dp[i*2]=True
while P>1:
    if P%m==0:
        P//=m
        if m in q.keys():
           q[m]+=1
        else:q[m]=1
    else:
        while True:
            m+=1
            if dp[m]==False:
                for i in range(w//m):
                    dp[i*m]=True
                break
ans=1
for k,v in q.items():
    ans = ans*k**(v//N)
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import collections
import math

n, p = [int(i) for i in input().split()]
d = collections.defaultdict(lambda: 0)

def bunkai(q):
	if q == 1:
		return 0
	for i in range(2, math.ceil(math.sqrt(p))):
		if q % i == 0:
			d[i] += 1
			return bunkai(q//i)

if n == 1 or p == 1:
	print(p)
else:
	bunkai(p)
	ans = 1

	for j in d.key
		k = d[j]
		if k // n >= 1:
			ans *= j**(k//n)
	print(ans)

Submission status: Runtime Error

Solution code:
N,P = map(int,input().split())
ans=1
i=2
if N==1:
  print(P)
  exit()
if N>=40 or P==1:
  print(1)
  exit()
  
while i<=(P**(1.1/N)):
  while P%(i**N) == 0:
    ans *= i
    P = P//(i**N)
  if i==2:
    i+=1
  else:
    i+=2
print(ans)N,P = map(int,input().split())
ans=1
i=2
if N==1:
  print(P)
  exit()
if N>=40 or P==1:
  print(1)
  exit()
  
while i<=(P**(1.1/N)):
  while P%(i**N) == 0:
    ans *= i
    P = P//(i**N)
  if i==2:
    i+=1
  else:
    i+=2
print(ans)

Submission status: Runtime Error

Solution code:
N,P = map(int,input().split())
ans=1
i=2
if N==1:
  print(P)
  exit()
if N>=40 or P==1:
  print(1)
  exit()
  
while i<=(P**(N/1)):
  while P%(i**N) == 0:
    ans *= i
    P = P//(i**N)
  if i==2:
    i+=1
  else:
    i+=2
print(ans)

Submission status: Runtime Error

Solution code:
N,P = map(int,input().split())
ans=1
if N==1:
  print(P)
  exit()
elif P==1 or N>=40:
  print(1)
  exit()
else:
  i=2
  while i<=P**(1/N):
    count = 0
    while P%i==0:
      P=P/i
      count+=1N,P = map(int,input().split())
ans=1
if N==1:
  print(P)
  exit()

Submission status: Runtime Error

Solution code:
N,P = map(int,input().split())
ans=1
if N==1|N>=40:
  print(P)
  exit()
elif P==1:
  print(1)
  exit()
else:
  i=2
  while(i*i<=P):	
	count=0
	while(P%i==0):
      P=P//i
	  count+=1
	  ans*=i**(count//N)
    if i==2:  
	  i+=1
    else:
      i+=2
 
  print(ans)

Submission status: Runtime Error

Solution code:
N,P = map(int,input().split())
i = round(P**(1/N))
j = 2
res = 1
if N == 1:
  print(P)
  break
elif P == 1|N>=40:
  print(1)
  break
else:
  while P%(j**N)==0:
    P = P//(j**N)
    res *= j
  j += 1
  for f in range(j,i+1,2):
    while P%(f**N) == 0:
      P = P//(f**N)
      res *= f
      
  print(res)
  break

Submission status: Runtime Error

Solution code:
import functools
import operator

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

i = 2
res = []
if N == 1:
  print(P)
elif P == 1:
  print(1)
else:
  while i <= P**0.5:
    while P % i**N == 0:
      P /= i**N
      res.append(i)
    else:
      if i == 2:
        i += 1
      else:
        i += 2
  result = functools.reduce(operator.mul, res)
  print(result)

Submission status: Runtime Error

Solution code:
import functools
import operator

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

i = 2
res = []
if N == 1:
  print(P)
elif P == 1:
  print(1)
else:
  while i <= P**0.5:
    while P % i**N == 0:
      P /= i**N
      res.append(i)
    else:
      if i == 2:
        i += 1
      else:
        i += 2
    
    
result = functools.reduce(operator.mul, res)
print(result)

Submission status: Runtime Error

Solution code:
import functools
import operator

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

i = 2
res = []

while i <= P**0.5:
  while P % i**N == 0:
    P /= i**N
    res.append(i)
  else:
    if i = 2:
      i += 1
    else:
      i += 2
    
    
res.append(1)
result = functools.reduce(operator.mul, res)
print(result)

Submission status: Runtime Error

Solution code:
import functools
import operator

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

i = 2
res = []

while i<=P**0.5:
  while P%i**N==0:
    P/=i**N
    res.append(i)
  else:
    i += 1
    
result.append(1)
result = functools.reduce(operator.mul, res)
print(result)

Submission status: Runtime Error

Solution code:
import functools
import operator

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

i = 2
res = []

while i<=P**0.5:
  while P%i**N==0:
    P/=i**N
    res.append(i)
  else:
    i += 1
    
result = functools.reduce(operator.mul, res)
print(result)

Submission status: Runtime Error

Solution code:
import functools
import operator

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

i = 2
res = []

while i<=P**0.5:
  while P%i**N==0:
    P/=i**N
    res.append(i)
  else:
    i += 1
    
print(res)
result = functools.reduce(operator.mul, res)
print(result)

Submission status: Runtime Error

Solution code:
from collections import Counter
from functools import reduce
from operator import mul
 
N,P = map(int,input().split())
i = 2
 
table = []
 
while i * i <= P:
 
  while P % i == 0:
 
    P /= i
 
    table.append(i)
 
  i += 1
 
 if P > 1:
 
  table.append(P)
 
            
c = Counter(table)
 
temp = [i[0] for i in c.items() if i[1] >= N]
 
temp.append(1)
 
print(int(reduce(mul,temp)))

Submission status: Runtime Error

Solution code:
N, P = map(int, input().split())
if N == 1:
  print(P)
  exit()
if N > 40:
  print(1)
  exit()
res = []
for i in range(1,P):
  x = i**N
  if i**N > P:
    break
  if P%x == 0:
    res.append(i)
print(max(res))

Submission status: Runtime Error

Solution code:
N, P = map(int, input().split())
if N == 1:
  print(P)
  exit()
if N > 40:
  print(1)
  exit()
res = []
for i in range(P):
  x = i**N
  if i**N > P:
    break
  if P%x == 0:
    res.append(i)
print(max(res))

Submission status: Runtime Error

Solution code:
"""
ポラード・ロー法で素因数分解
"""
n,target=map(int,input().split())
seed = 0

# 最大公約数
def gcd(a, b):
    if a<b:
        return gcd(b, a)
    while b>0:
        a, b = b, a%b
    return a

# 素数判定
def isprime(n):
    if n<2:
        return False
    for m in range(2, int(n**0.5+1)):
        if n%m==0:
            return False
    return True

# 疑似乱数発生器（らしい）
def f(n):
    ret = n**2+seed
    return ret%target

# 素数になるまで割る？
def factoring(n, _seed = 3):
    if isprime(n):
        return n
    x, y, d = 2, 2, 1
    tmp = n
    seed = _seed
    while d==1:
        x = f(x)
        y = f(f(y))
        dif = x-y if x>y else y-x
        d = gcd(dif, tmp)
        seed+=1

    seed = 0
    if(d%2==0):
        return 2
    if isprime(d) is False:
        return factoring(d, seed+1)
    return factoring(d, 1)

# メイン
def factors():
    dic = {}
    tmp = target
    if(isprime(tmp)):
        dic[tmp] = 1
        return dic

    ret = factoring(tmp)
    while tmp/ret is not 0:
        if ret in dic.keys():
            dic[ret]+=1
        else:
            dic[ret]=1
        tmp = int(tmp/ret)
        if tmp==1:
            break
        ret = factoring(tmp)

    return dic

def main():
    a=factors()
    res=1
    for b,c in a.items() :
        if c >= n : res *= b
    print(res)
    

if __name__=='__main__':
    main()

Submission status: Runtime Error

Solution code:
import sympy
 
n,p=map(int,input().split())
 
def C(N,P):
    if N == 1: return P
    
    prime=2
    prime_list={}
    while P >= prime :
        if P % prime == 0:
            P /= prime
            if prime in prime_list:
                prime_list[prime]+=1
            else:
                prime_list[prime]=1
        else :
            prime+=1
    
    print(prime_list)
    res=1
    for b,c in prime_list.items() :
        if c >= 4 : res *= b
    return res
 
print(C(n,p))

Submission status: Runtime Error

Solution code:
import sympy
 
n,p=map(int,input().split())
 
def C(N,P):
    if N == 1: return P
    a=sympy.factorint(P)
    res=1
    for b,c in a.items() :
        if c >= 4 : res *= b
    return res
 
print(C(n,p))

Submission status: Runtime Error

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

import sympy

Soin=sympy.factorint(P)
Soin_s=sorted(Soin.items(), key=lambda x: x[1])
Ans=1
for s_s in Soin_s:
    if s_s[1]>=N:
        Ans=Ans*(s_s[0]**(s_s[1]/N))
print Ans

Submission status: Runtime Error

Solution code:
def binpow(x, e):
  a = 1.0 #結果変数の初期化
  p = x   #二乗値の初期化
  while e > 0:   #不定反復
    if e % 2 == 0: #指数が偶数のとき
      p *= p
      e /= 2     #二乗値の更新
    else:        #指数が奇数のとき
      a *= p
      e -= 1     #二乗値の乗算
  return a

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import primefac

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=input("")
p=input("")
print(1)

Submission status: Runtime Error

Solution code:
n=input()
p=input()
print(1)