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
import copy
 
n,p=map(int,input().split())
a=math.floor(p**(1/n))
#print(a)
for i in range(a,0,-1):
    if i==1:
        print(i)
        break
    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 copy
N, P = map(int, input().split())

y=[i+1 for i in range(int(P**(1/2))) if P%(i+1)==0]
x=copy.copy(y)
for i in range(len(y)):
    if P%y[i]==0:
        x.append(int(P/y[i]))
x.sort()

for i in range(len(x)):
    tmp=(P/x[i])**(1/N)
    if tmp%int(tmp)==0:
            break

print(int(tmp))

Submission status: Wrong Answer

Solution code:

import collections

def get_lim(n):
    # for i in range(n):
    #     if i * i > n:
    #         return i + 1
    return pow(10, int((len(str(n)) / 2)))

def prime_factor(n, length):
    ass = collections.defaultdict(int)
    # break_num = pow()
    # for i in range(2,int(n**0.5)+1):
    lim = get_lim(n)
    for i in range(2, lim + 1):
        # print(pow(i, length),  n)
        # if pow(i, length) > n:
        #     break
        if i > n or n == 1:
            break
        # i = pow(i, num)
        while n % i==0:
            ass[i] += 1
            n = n//i

    if n != 1:
        ass[n] += 1
    return ass

if __name__ == '__main__':
    length, num = list(map(int, input().split()))

    if length == 1:
        print(num)
    else:

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

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

fac_list = []

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

fac_list.append(int(P))

#print(fac_list)

print(int(gcd_list(fac_list)))

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])
ans = 1
for g,cnt in gc:
    if cnt >= N:
        ans *= g**(cnt//N)

print(ans)

Submission status: Wrong Answer

Solution code:
import math

N, P = (int(i) for i in input().split())
print([x for x in range(1,int(math.pow(P, 1.0/N))+1) if P%(x**N)==0][-1])

Submission status: Wrong Answer

Solution code:
import collections
import math


def factorization(n):
    f = []
    if n > 1 and n % 1 == 0:
        for i in range(2, int(n**0.5)+1):
            if n % i == 0:
                f.append(i)
                m = n // i
                j = 2
                while j <= m:
                    if m % j == 0:
                        f.append((j))
                        m = m // j
                        j = 2
                    else:
                        j += 1
                break
        else:
            return 0
    return f


def main():
    a = list(map(int, input().split()))
    l = factorization(a[1])
    c = collections.Counter(l)
    ans = 1
    for s in c:
        if math.floor(c[s] / a[0]) >= 1:
            ans *= s * math.floor(c[s] / a[0])
    print(ans)



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

else :print(1)

Submission status: Wrong Answer

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

    if N== 1:
        print(P)
        return

    p = 2
    ans = 1

    while True:
        if p >= P:
            break

        pn = p**N
        if pn > P:
            break

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

        p += 1

    print(ans)
    

if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
import math

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


m=int(math.pow(p,1/n))

s = 1

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

print(s)

Submission status: Wrong Answer

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

if P == 1:
    print(1)
    exit(0)
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] and  i >= int(math.sqrt(P)+1)]


def miller_rabin(n, k=20):
    s,d = 0, n-1
    while d % 2 == 0:
        s += 1
        d //= 2
    for i in range(k):
        a - randint(2, n-1)




primax = int(1e7) + 9 * int(1e6) 
# while primax < (P//N):
#     primax *= 10

primax += 1000
primax = int(primax)
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])

ans = 1

for g,cnt in gc:
    if cnt >= N:
        ans *= g**(cnt//N)


# if ans < 10 and P > 1e10:
#     print(P)
#     exit(0)

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))
if N >= 4:
    n = int(math.sqrt(n))

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:
import sys
def soin(n):
    I=n
    s=0
    R=int(I)
    L=[]
    while s==0:
        for i in range(2,R+1):
            if I%i==0:
                I=I/i
                if I==1:
                    s=1
                L.append(i)
                break
    if len(L)==1:
        print(R)
    else:
        print(L)

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

else :print(1)

Submission status: Wrong Answer

Solution code:
a,b=map(int ,input().split())
x=int(pow(b,1/a))
while x>=1:
    if b%(pow(x,a))==0:
        print(x)
        exit()
    x-=1

Submission status: Wrong Answer

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

if P == 1:
    print(1)
    exit(0)
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] and  i >= int(math.sqrt(P)+1)]


def miller_rabin(n, k=20):
    s,d = 0, n-1
    while d % 2 == 0:
        s += 1
        d //= 2
    for i in range(k):
        a - randint(2, n-1)




primax = int(1e7) + 9 * int(1e6) 
# while primax < (P//N):
#     primax *= 10

primax += 1000
primax = int(primax)
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])

ans = 1

for g,cnt in gc:
    if cnt >= N:
        ans *= g**(cnt//N)


if ans < 10 and P > 1e10:
    print(P)
    exit(0)

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

Submission status: Wrong Answer

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

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):
        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):
        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):
        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):
        p = Prime.seed_primes[seed % len(Prime.seed_primes)]
        return (p * x + seed) % n

    def find_factor(self, n, seed=1):
        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()
    table = prime.find_factors(int(P/N))

c = 1
for k, v in table.items():
    d = v // N
    if d >= 1:
        c = c * (k ** d)

print(c)

Submission status: Wrong Answer

Solution code:
n,p = map(int,input().split())
s = 0 
a = int(p)
b = {}

if p == 1:
    print(1)
elif n == 1:
    print(p)
else:
    while s == 0:
        for i in range(2,a+1):
            if p % i == 0:
                p = p / i
                if p == 1:
                    s = 1
                
                if i not in b:
                    b[i] = 1
                else:
                    b[i] += 1
                
                break

    ans = 1
    for k,v in b.items():
        if v >= n:
            ans *= k
    print(ans)

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:
        power = val // N
        lst.append(key * power)

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# encoding: utf-8
import math
N, P = map(int, input().split())

ans = 1
P_tmp = P
for p in range(2, int(math.sqrt(P)) + 1):
    if P_tmp % (p ** N) == 0:
        for i_p in range(1, P):
            if P_tmp % (p ** (N * (i_p + 1))) > 0: break
        P_tmp = P_tmp // (p ** (N * i_p))
        ans = ans * (p ** i_p)
    if P_tmp < ((p + 1) ** N): break

print(ans)

Submission status: Wrong Answer

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

y=[i+1 for i in range(int(P**(1/2))) if P%(i+1)==0]
x=copy.copy(y)
for i in range(len(y)):
    if P%y[i]==0:
        x.append(int(P/y[i]))
x.sort()

for i in range(len(x)):
    tmp=x[i]**(1/N)
    if tmp%int(tmp)==0:
            break

print(int(tmp))

Submission status: Wrong Answer

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

if p == 1:
    print(1)
elif n == 1:
    print(p)
else:
    max_canditate = int(p**(1. / n))
    for cand in range(max_canditate, 0, -1):
        if p % (cand ** n) == 0:
            # max_cand^3 * ? = p was found -> GCD is max_cand
            print(cand)
            exit()

Submission status: Wrong Answer

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

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

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


N = int(p ** (1 / n)) + 1

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


def primes():
    import math
    upper = int(math.sqrt(N))
    search_list = [i for i in range(2, N+1)]

    prime_num = []
    while search_list[0] <= upper:
        prime_num.append(search_list[0])
        t = search_list[0]
        search_list = [i for i in search_list if i % t != 0]
    prime_num.extend(search_list)
    return prime_num

pr = primes()
pr.append(p)


tmp = 1
for prime in reversed(pr):
    s = (prime ** n)
    while p >= s and p % s == 0:
        tmp = tmp * prime
        s = s * (prime * n)


print(tmp)

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,0,-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:
n, p = map(int, input().split())

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

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

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

    prime.append(i)

prime_num = [0] * len(prime)

pp = []

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

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

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)

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

a = mn // n

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import deque
N,p=map(int,input().split())

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

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

factors=deque(prime_factors(p))
i=1
while len(factors)!=N:
  try:
    a=factors[-i]
    factors.remove(factors[-i])
    factors.append(factors.popleft()*a)
    i+=1
  except IndexError:
    i=1

ans=0

def gcd(m, n):
  r = m % n
  return gcd(n, r) if r else n

tmp=gcd(factors[1],factors[0])
for i in range(1,len(factors)):
  ans=gcd(factors[i],tmp)
  tmp=ans

print(ans)

Submission status: Wrong Answer

Solution code:
n,p= map(int,input().split())
if n==1:
    print(p)
else :print(1)

Submission status: Wrong Answer

Solution code:
import math

N,P=map(int,input().split())
a=math.sqrt(P)

if N >= 4 :
    a=math.sqrt(a)
if N >= 8 :
    a=math.sqrt(a)
if N >= 16 :
    a=math.sqrt(a)
if N >= 32 :
    a=math.sqrt(a)
if N >= 64 :
    a=math.sqrt(a)
if N >= 128 :
    a=math.sqrt(a)
if N >= 256 :
    a=math.sqrt(a)
if N >= 512 :
    a=math.sqrt(a)
if N >= 1024 :
    a=math.sqrt(a)
if N >= 2048 :
    a=math.sqrt(a)
    
res=1
for i in range(1,int(a)+1):
    if P % i**N: continue
    res = i

print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b=map(int ,input().split())
x=int(pow(b,1/a))
while x>=1:
    if b%(x**a)==0:
        print(x)
        exit()
    x-=1

Submission status: Wrong Answer

Solution code:
import math

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


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


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

Submission status: Wrong Answer

Solution code:
N, P = map(int, input().split())
li = [1]
if N ==1:
    li.append(P)
elif P**(1/N) == int(P**(1/N)):
    li = [P**(1/N)]
else:
    for i in range(1,int(P**(1/N))):
        X = i**N
        if X > P:
            break
        else:
            if P % X == 0:
                li.append(i)

print(max(li))

Submission status: Wrong Answer

Solution code:
n, p = list(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
ls = prime_factor(p)
#print(ls)

import collections
lsm = collections.Counter(ls)
lsm = lsm.most_common()
#print(lsm)


#print(len(lsm))

key = []
for k in range(len(lsm)):
    if lsm[k][1] >= n:
        key.append(lsm[k][0])
    else:
        key.append(1)

#print(key)
v = 1
for j in range(len(key)):
    v = v*key[j]
print(v)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

# 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]

PS = primes(1000000)
def factorint(x):
  d = {}
  for k in PS:
    if(x % k== 0):
      m = 1
      while(x % (k**m) == 0):
        m += 1
      d[k] = m - 1
      x = x / (k ** (m - 1))
      if x == 1:
        break
  return d

fac = factorint(p)
result = 1
for i,j in fac.items():
  result *= i **math.floor(j/n)
  result = result % 1000000007
print(result)

Submission status: Wrong Answer

Solution code:
import math

N, P = (int(i) for i in input().split())
[x for x in range(1,int(math.pow(P, 1.0/N))+1) if P%(x**N)==0][-1]

Submission status: Wrong Answer

Solution code:
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(int(n))
  return table


cnt=1
gcd=1
n,p=map(int,input().split())
a=prime_decomposition(p)

if n==1:
  print(p)
if n>1:
  l=len(a)
  for i in range(l-1):
    if a[i+1]==a[i]:
      cnt+=1
      if cnt==n:
        gcd*=a[i]
        cnt=1
    else:
      cnt=1
  print(gcd)

Submission status: Wrong Answer

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

gcd = 1
tmp_P = P

for i in range(1, P+1):
    t = pow(i, N)
    if t > tmp_P:
        break
    if tmp_P % t == 0:
        gcd *= i
        tmp_P /= t

print(gcd)

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

Submission status: Wrong Answer

Solution code:

import collections

def prime_factor(n, length):
    ass = collections.defaultdict(int)
    # break_num = pow()
    # for i in range(2,int(n**0.5)+1):
    for i in range(2, int(n ** (1/length)) + 1):
        # print(pow(i, length),  n)
        # if pow(i, length) > n:
        #     break
        if i > n or n == 1:
            break
        # i = pow(i, num)
        while n % i==0:
            ass[i] += 1
            n = n//i

    if n != 1:
        ass[n] += 1
    return ass

if __name__ == '__main__':
    length, num = list(map(int, input().split()))

    if length == 1:
        print(num)
    else:

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

Submission status: Wrong Answer

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

# 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]

PS = primes(1000000)
def factorint(x):
  d = {}
  for k in PS:
    if(x % k== 0):
      m = 1
      while(x % (k**m) == 0):
        m += 1
      d[k] = m - 1
      x = x / (k ** (m - 1))
      if x == 1:
        break
  return d

fac = factorint(p)
result = 1
for i,j in fac.items():
  result *= i **math.floor(j/n)
  resukt = result % 1000000007
print(result)

Submission status: Wrong Answer

Solution code:
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(int(n))
  return table


cnt=1
gcd=1
n,p=map(int,input().split())
a=prime_decomposition(p)
print(a)
if n==1:
  print(p)
if n>1:
  l=len(a)
  for i in range(l-1):
    if a[i+1]==a[i]:
      cnt+=1
      if cnt==n:
        gcd*=a[i]
        cnt=1
    else:
      cnt=1
  print(gcd)

Submission status: Wrong Answer

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

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

if N == 1:
    print(P)
elif P == 1:
    print(1)
else:
    for x, y in c:
        if y >= N:
            ans *= x*(y//N)
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

y=[int(P/(i+1)) for i in range(int(P**(1/2))) if P%(i+1)==0]
x=copy.copy(y)
for i in range(len(y)):
    if P%y[i]==0:
        x.append(P/y[i])

for i in range(len(x)):
    tmp=x[i]**(1/N)
    if tmp%int(tmp)==0:
            break

print(int(tmp))

Submission status: Wrong Answer

Solution code:
import sys
from collections import Counter
n,p = map(int,input().split())
if n >= 40:
    print(1)
    sys.exit()
if n == 1:
    print(p)
    sys.exit()
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
ls = Counter(prime_decomposition(p)).most_common()
c = 1
for i in range(len(ls)):
    if ls[i][1] < n:break
    c *= ls[i][1]//n * ls[i][0]
print(c)

Submission status: Wrong Answer

Solution code:
import math

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


m=int(math.pow(p,1/n))

s = 1

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

print(s)

Submission status: Wrong Answer

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

a = int(pow(P, 1/N))
for i in range(a):
  c = pow(i+1,N)
  if P%c == 0:
    b = i+1

print(b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from math import floor

def is_integer_num(n):
    if isinstance(n, int):
        return True
    if isinstance(n, float):
        return n.is_integer()
    return False

N, P = map(int, input().split())
for i in range(floor(P**(1/N)), 0, -1):
    a = P / (i ** N)
    if is_integer_num(a):
        print(i)
        break

Submission status: Wrong Answer

Solution code:

import collections

def prime_factor(n, length):
    ass = collections.defaultdict(int)
    # break_num = pow()
    for i in range(2,int(n**0.5)+1):
        # print(pow(i, length),  n)
        # if pow(i, length) > n:
        #     break
        if i > n or n == 1:
            break
        # i = pow(i, num)
        while n % i==0:
            ass[i] += 1
            n = n//i

    if n != 1:
        ass[n] += 1
    return ass

if __name__ == '__main__':
    length, num = list(map(int, input().split()))

    if length == 1:
        print(num)
    else:

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

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 = []

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:
#
import sys
import math
import numpy as np
import itertools


# いくつか入力
n, p = (int(i) for i in input().split())  

f=[]
r=2
root = np.sqrt(p)
while root >= r:
    if p % r == 0:
        f.append(r)
        p = p // r
    else:
        r += 1

#print(f)
answer = 1
now = 1
k=0
for i in f:
    if now == i:
        k += 1
    else:
        answer = answer * (now ** (k // n) )
        now = i
#        print(i,k,answer)
        k=1
answer = answer * (now ** (k // n) )
print(answer)