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 time

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

if n >= 40 or p == 1:
    print("1")
else:
    s = 0
    fact = {}
    start = time.time()
    check = False
    while s == 0:
        for i in range(2,p+1):
            now = time.time()
            if now > start+1.9:
                s = 1
                check = True
                break
            if p%i == 0:
                p = p//i
                if p == 1:
                    s = 1
                if i not in fact:
                    fact[i] = 1
                else:
                    fact[i] += 1
                break
    if check == True:
        if n == 1:
            print(p)
        else:
            print("1")
    else:
        ans = 1
        for i in fact:
            if fact[i] >= n:
                ans = ans*i**(fact[i]//n)
        print(ans)

Submission status: Wrong Answer

Solution code:
import math
from collections import Counter

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

c = Counter(primes) 
ans = 1

for key in c:
  ans *= max(key* (c[key]//N),1)
print(ans)

Submission status: Wrong Answer

Solution code:
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()
N, P = map(int, input().split())
factors = prime.find_factors(P)
ans = 1
for k in factors:
    ans *= max(1, int(k) * (factors[k] // N))
print(ans)

Submission status: Wrong Answer

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


Limit = math.floor(P ** (1/N))

if N == 1:
    print(P)
else:
    if Limit == 0:
        Limit = 1
    for i in range(Limit):
        X = (Limit - i) ** N
        if P % X == 0:
            print(Limit - i)
            break

Submission status: Wrong Answer

Solution code:
N,P = map(int,input().split(' '))
#N=3
#P=24


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



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


s = 1/N
sP=int(P**s)+1
f = primes(sP)
prime = [x for x in range(1,sP) if f[x]]

ans = 1
for p in prime:
	if P % (p**N) == 0:
		ans*=p
print(ans)

Submission status: Wrong Answer

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

Ans = set()

Limit = math.floor(P ** (1/N))

if N == 1:
    print(P)
else:
    for i in range(Limit):
        X = (Limit - i) ** N
        if P % X == 0:
            print(Limit - i)
            break

Submission status: Wrong Answer

Solution code:

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


ans = 1

while(p%(2**n)==0):
	ans*=2
	p//=2**n
for i in range(3,int(p**(1./n))+1)[::2]:
	while(p%(i**n)==0):
		ans*=i
		p//=i**n
print(ans)

Submission status: Wrong Answer

Solution code:
N,P = map(int,input().split(' '))
#N=3
#P=24


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



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

sP=int(P**0.5)+1
f = primes(sP)
prime = [x for x in range(1,sP) if f[x]]

ans = 1
for p in prime:
	if P % (p**N) == 0:
		ans*=p
print(ans)

Submission status: Wrong Answer

Solution code:

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


ans = 1

while(p%(2**n)==0):
	ans*=2
	p//=2**n
for i in range(3,int(p**(1./n))+1)[::2]:
	if(p<i**n):
		break
	while(p%(i**n)==0):
		ans*=i
		p//=i**n
print(ans)

Submission status: Wrong Answer

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

if n >= 40 or p == 1:
    print("1")
else:
    s = 0
    fact = []
    while s == 0:
        for i in range(2,p+1):
            if p%i == 0:
                p = p//i
                if p == 1:
                    s = 1
                fact.append(i)
                break
    c = collections.Counter(fact)
    ans = 1
    for i in c:
        if c[i] >= n:
            ans = ans*i*(c[i]//n)
    print(ans)

Submission status: Wrong Answer

Solution code:

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


ans = 1

while(p&(2**n)==0):
	ans*=2
	p//=2**n
for i in range(3,int(p**(1./n))+1)[::2]:
	if(p<i**n):
		break
	while(p%(i**n)==0):
		ans*=i
		p//=i**n
print(ans)

Submission status: Wrong Answer

Solution code:
def exDiv(x,y):
    i = 1
    count = 1
    list = [2,3,5,7,9,11,13,17,19,23,29,31,37,41,43,47]
    while y>=i**x:
        i += 1
        for j in list:
            if i%j==0 and i!=j:
                continue
        if y%(i**x)==0:
            y /= i**x
            count *= i
    return count


x,y = map(int,input().split())
print(exDiv(x,y))

Submission status: Wrong Answer

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

Ans = set()

Limit = math.ceil(P ** (1/N))


for i in range(Limit):
    X = (Limit - i) ** N
    if P % X == 0:
        print(Limit+1 - i)
        break

Submission status: Wrong Answer

Solution code:
#! usr/bin/env python
# -*- coding: utf-8 -*-


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

    div = []
    c = 1
    while c * c <= p:
        if not p % c:
            div.append(c)
            if c * c != p:
                div.append(p//c)
        c += 1

    div.sort()
    ans = 1
    for d in div:
        pp = pow(d, n, 67280421310721)
        if pp > p:
            break
        if not p % pp:
            ans = max(ans, d)

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from numpy import sqrt
N,P = map(int,input().split(" "))
lm = pow(P,1/N)
if N == 1:
    print(P)
    exit(0)

ans = 1
for i in range(1,int(sqrt(P))+1):
    if P % i == 0:
        if i <= lm and P % pow(i,N) == 0:
            ans = max(i,ans)
        if (P//i) <= lm and P % pow((P//i),N) == 0:
            ans = max(P//i,ans)

print(ans)

Submission status: Wrong Answer

Solution code:
import collections

n, p = map(int, input().split())
if n == 1:
    print(p)
    exit()

def prime_decomposition(n):
    # 素因数分解
    if n < 2:
        return []
    prime_factors = []
    while n % 2 == 0:
        prime_factors.append(2)
        n >>= 1

    while n % 3 == 0:
        prime_factors.append(3)
        n //= 3

    a = 5
    b = 7
    while a ** 2 <= n:
        if n % a == 0:
            prime_factors.append(a)
            n //= a
        elif n % b == 0:
            prime_factors.append(b)
            n //= b
        else:
            a += 6
            b += 6
    if n > 1:
        prime_factors.append(n)
    return prime_factors
res = 1
pf = collections.Counter(prime_decomposition(p))
for v, c in pf.items():
    if c >= n:
        res *= v
print(res)

Submission status: Wrong Answer

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

Ans = set()

Limit = math.floor(P ** (1/N)) + 1


for i in range(Limit):
    X = (Limit+1 - i) ** N
    if P % X == 0:
        print(Limit+1 - i)
        break

Submission status: Wrong Answer

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


# 素因数分解
def prime_factorization(n):
    table = []
    for x in range(2, int(n**0.5)+1):
        while n % x == 0:
            table.append(x)
            n //= x
    if n > 1:
        table.append(n)
    return table


T = prime_factorization(P)
C = sorted(list(Counter(T).items()), reverse=True)

ans = 1
for x, n in C:
    if n >= N:
        ans *= (x * (n // N))
print(ans)

Submission status: Wrong Answer

Solution code:
def exDiv(x,y):
    i = 1
    count = 1
    while y>i**x:
        i += 1
        if y%(i**x)==0:
            y /= i**x
            count *= i
    return count


x,y = map(int,input().split())
print(exDiv(x,y))

Submission status: Wrong Answer

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

Ans = set()

Limit = math.floor(P ** (1/N))


for i in range(Limit):
    X = (i+1) ** N
    if P % X == 0:
        Ans.add(i+1)

print(max(Ans))

Submission status: Wrong Answer

Solution code:
from numpy import sqrt
N,P = map(int,input().split(" "))
lm = pow(P,1/N)
ans = 1
for i in range(1,int(sqrt(P))+1):
    if P % i == 0:
        if i <= lm and P % pow(i,N) ==  0:
            ans = max(i,ans)
        if (P//i) <= lm and P  % pow((P//i),N) == 0:
            ans = max(P//i,ans)
            
print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
def inpl(): return list(map(int, input().split()))
N, P = inpl()

def primes(N):
    sieve = [1] * (N+1)
    sieve[:2] = [0, 0]
    for i in range(N):
        if sieve[i]:
            for j in range(2*i, N+1, i):
                sieve[j] = 0
    P = []
    for i in range(N+1):
        if sieve[i]:
            P.append(i)
    return P

ps = primes(10**6)

ans = 1
for p in ps:
    tmp = P * 1
    cnt = 0
    while tmp % p == 0:
        tmp = tmp // p
        cnt += 1
    ans *= p ** (cnt//N)

print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

a = prime_factor(p)
a.append(1)
c = Counter(a)
d = c.most_common()

res = 1


for i in range(len(d)):
    if d[i][1] >= n:
        k = d[i][1]//n
        res = res * d[i][0]*k
        
        if i == len(d)-1:
            break
    else:
        break

print(res)

Submission status: Wrong Answer

Solution code:
# C
import numpy as np
N, P = map(int, input().split())

primes = np.ones(10**6)
primes[:2] = 0
for p in range(2, 10**3):
    if primes[p] == 1:
        primes[2*p::p] = 0

prim = np.where(primes == 1)[0]

if N == 1:
    res = P
else:
    res = 1
    for p in prim:
        k = 0
        while P % p == 0:
            k += 1
            P = P // p
        res *= p ** (k//N)
    print(res)

Submission status: Wrong Answer

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

p = P
primes = {}
d = 2
while p > 1:
    while p%d == 0:
        if d not in primes:
            primes[d] = 1
        else:
            primes[d] += 1
        p = p//d
    d += 1
#print(primes)

ans = 1
for k in primes:
    if primes[k]//N > 0:
        ans *= k*(primes[k]//N)

print(ans)

Submission status: Wrong Answer

Solution code:
import collections
import math


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

    a = collections.defaultdict(lambda: 0)

    if n == 1:
        print(p)
        return

    for i in range(2, int(math.sqrt(p)) + 1):
        while p % i == 0:
            a[i] = a[i] + 1
            p //= i

    ret = 1
    for k, v in a.items():
        if v >= n:
            ret *= k * (v // n)

    print(ret)


main()

Submission status: Wrong Answer

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


def divisorize(fct):
    b, e = fct.pop()  # base, exponent
    pre_div = divisorize(fct) if fct else [[]]
    suf_div = [[(b, k)] for k in range(e + 1)]
    return [pre + suf for pre in pre_div for suf in suf_div]


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

res = 1
maxcnt = 0

for m, cnt in factorize(p):
    if cnt >= n:
        res *= m

print(res)

Submission status: Wrong Answer

Solution code:
from numpy import sqrt
N,P = map(int,input().split(" "))

ans = 1
lm = int(pow(P,1/N))
for i in range(1,lm+1):
    if P % pow(i,N) == 0:
        ans = max(ans,i)

print(ans)

Submission status: Wrong Answer

Solution code:

def main():
    buf = input()
    buflist = buf.split()
    N = int(buflist[0])
    P = int(buflist[1])
    factor = prime_factorization(P)
    max_gcd = 1
    for f, c in factor.items():
        if c >= N:
            max_gcd *= f
    print(max_gcd)

def prime_factorization(number):
    n = number
    i = 2
    factor = {}
    while i * i <= n:
        while n % i == 0:
            if i in factor:
                factor[i] += 1
            else:
                factor.update({i : 1})
            n //= i
        i += 1
    if n > 1 or not factor:
        if n in factor:
            factor[n] += 1
        else:
            factor.update({n : 1})
    return factor

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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


# 素因数分解
def prime_factorization(n):
    table = []
    for x in range(2, int(n**0.5)+2):
        while n % x == 0:
            table.append(x)
            n //= x
    if n > 1:
        table.append(n)
    return table


T = prime_factorization(P)
C = sorted(list(Counter(T).items()), reverse=True)

ans = 1
for x, n in C:
    if n >= N:
        ans *= x * (n // N)
print(ans)

Submission status: Wrong Answer

Solution code:
def factorialize(P):
    dic={}
    for i in range(2,P):
        if P==1:
            break
        while P%i==0:
            P/=i
            dic[i]=dic.setdefault(i,0)+1
    return dic

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

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

print(ans)

Submission status: Wrong Answer

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

ans = 1
for n in range(2, 10 ** 6 + 1):
  a = 0
  while P % n == 0:
    P //= n
    a += 1
  ans *= n ** (a // N)
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

a = prime_factor(p)
a.append(1)
c = Counter(a)
d = c.most_common()

res = 1


for i in range(len(d)):
    if d[i][1] >= n:
        res = res * d[i][0]
        if i == len(d):
            break
    else:
        break

print(res)

Submission status: Wrong Answer

Solution code:
# C
import numpy as np
N, P = map(int, input().split())

primes = np.ones(10**6)
primes[:2] = 0
for p in range(2, 10**3):
    if primes[p] == 1:
        primes[2*p::p] = 0

prim = np.where(primes == 1)[0]
res = 1
for p in prim:
    k = 0
    while P % p == 0:
        k += 1
        P = P // p
    res *= p ** (k//N)
print(res)

Submission status: Wrong Answer

Solution code:
from math import floor, sqrt
from collections import Counter

def getPrimeFactor(x):
    ans = []
    for d in range(2, floor(sqrt(x)) + 1):
        while x % d == 0:
            ans.append(d)
            x //= d
    if x != 1:
        ans.append(x)
    return ans

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

PFs = getPrimeFactor(P)
cnt = Counter(PFs)

ans = 1
for p, num in cnt.items():
    if num // N:
        ans *= p
print(ans)

Submission status: Wrong Answer

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

sqp = math.floor(math.sqrt(p)) + 1
if n == 1:
    print(p)
    sys.exit(0)
insu = {}
for i in range(2, sqp + 1):
    while p % i == 0:
        p //= i
        if i in insu:
            insu[i] += 1
        else:
            insu[i] = 1
ans = 1
for i in insu:
    if insu[i] >= n:
        ans *= i
print(ans)

Submission status: Wrong Answer

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

sqrtp = int(math.sqrt(p))

b = []

for i in range(2, sqrtp+1):
    count = 0
    while p % i == 0:
        count += 1
        p = p // i
    b.append((i, count))
if p > 1:
    b.append((p, 1))

num = 1
for i, c in b:
    c = c // n
    if c > 0:
        num *= i * c

print(num)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3


import array
import collections
import math


def sieve_of_eratosthenes(end, typecode="L"):
    """Enumerates the prime numbers below the given integer.
    :param int end: Prime numbers below this integer will be enumerated.
    :param str typecode: The type of the array to be returned (optional).
    :return: The array of the prime numbers.
    :rtype: :class:`array.array`
    """

    assert end > 1
    is_prime = array.array("B", (True for i in range(end)))
    is_prime[0] = False
    is_prime[1] = False
    primes = array.array(typecode)
    for i in range(2, end):
        if is_prime[i]:
            primes.append(i)
            for j in range(2 * i, end, i):
                is_prime[j] = False
    return primes


def factorize_trial_division(n, typecode="Q"):
    """Factorizes the given integer in prime numbers by trial division.
    :param int n: The integer to be factorized.
    :param str typecode: The type of the array to be returned (optional).
    :return: The array of factors.
    :rtype: :class:`array.array`
    """
    factors = array.array(typecode)
    if n < 2:
        return factors
    for p in sieve_of_eratosthenes(math.ceil(math.sqrt(n)) + 1):
        if p * p > n:
            break
        while n % p == 0:
            factors.append(p)
            n //= p
    if n > 1:
        factors.append(n)
    return factors


def solve(n, p):
    factors_counter = collections.Counter(factorize_trial_division(p))
    res = 1
    for k, v in factors_counter.most_common():
        if v >= n:
            res *= k
        else:
            break
    return res


def main():
    n, p = (int(z) for z in input().split())
    print(solve(n, p))


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

def usage(n):
    
    # print('# 素因数')
    fct = factorize(n)
    # print(fct, num(fct))
    return fct
    # print('# 約数')
    # for div in divisorize(fct):
    #     print(div, num(div))


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


def divisorize(fct):
    b, e = fct.pop()  # base, exponent
    pre_div = divisorize(fct) if fct else [[]]
    suf_div = [[(b, k)] for k in range(e + 1)]
    return [pre + suf for pre in pre_div for suf in suf_div]


def num(fct):
    a = 1
    for base, exponent in fct:
        a = a * base**exponent
    return a


if __name__ == '__main__':
    N,P = map(int,input().split())
    fct = usage(P)
    ans = 1
    for i,j in fct:
        if j >= N:
            ans *= i
    print(ans)

Submission status: Wrong Answer

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

res = 1
v = 2
while v <= p**(1/n):
    vn = v**n
    while p % vn == 0:
        res *= v
        p /= vn
    v += 1

print(res)

Submission status: Wrong Answer

Solution code:
from collections import Counter
from math import sqrt

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

for i in range(2, int(sqrt(p))+1):
	while p % i == 0:
		c[i] += 1
		p = p // i
c[p] += 1

#print(c)
ans = 1
for key, value in c.items():
	if value >= n:
		ans *= key

print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np


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

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

a = 1
f = factorize(p)
for x, y in f:
    if y >= n:
        a *= x*(y // n)
if n == 1:
    print(p)
else:
    print(a)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict


def solve(n, p):
    i = 2
    ps = defaultdict(lambda: 0)
    while i * i <= p:
        while p % i == 0:
            p //= i
            ps[i] += 1
        i += 1
    ans = 1
    for p, c in ps.items():
        ans *= p ** (c // n)
    return ans


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

Submission status: Wrong Answer

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

rec = []
K = P
for i in range(2, int(P ** 0.5) + 1):
    if K % i == 0:
        tmp = 0
        while K % i == 0:
            tmp += 1
            K //= i

        rec.append((i, tmp))

if K != 1:
    rec.append((K, 1))

num = 1
for k, i in rec:
    if i >= N:
        num *= k

print(num)

Submission status: Wrong Answer

Solution code:
def exEuqrid(a,b):
  list = [a,b]
  listx = [1,0]
  listy = [0,1]
  while list[1] != 0:  
    list.append(list[0] % list[1])
    q = list[0] // list[1]
    listx.append(listx[0] - (q * listx[1]))
    listy.append(listy[0] - (q * listy[1]))
    list.pop(0)
    listx.pop(0)
    listy.pop(0)
  ans = []
  ans.append(listx[0])
  ans.append(listy[0])
  ans.append(list[0])
  return ans

x,y = map(int,input().split())
if x<y:
    z = y
    y = x
    x = z
print(exEuqrid(x,y)[2])

Submission status: Wrong Answer

Solution code:
N, P = map(int, input().split())
# 素因数分解
def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n //= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table
L = prime_decomposition(P)

cnt = 0
ans = 1
vp = 0
for v in L:
    if vp==v:
        cnt += 1
        if cnt == N:
            cnt = 0
            ans *= v
    else:
        cnt = 1
        vp = v
#print(L)
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from collections import Counter

def factorize(n: int):
    d = Counter()
    m= 2
    
    while m*m <= n:
        while n%m == 0:
            n //= m
            d[m] += 1
            
        m += 1
        
    if n > 1:
        d[n] += 1
        
    return d

n,p = li()

facs = factorize(p)

ans = 1
for k in sorted(facs.keys()):
    if facs[k] >= n:
        ans *= k
        
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
from math import sqrt

n, p = [int(i) for i in input().split()]

A = defaultdict(int)

def factorize(n):    
    i = 2
    
    while n % i == 0:
        n //= i
        A[i] += 1
    i += 1

    while n != 1 and i <= sqrt(n):
        while n % i == 0:
            n //= i
            A[i] += 1
        i += 2
    if n != 1:
        A[n] += 1

    return A

factorize(p)
ans = 1
for k, v in A.items():
    if v >= n:
        ans *= k

print(ans)

Submission status: Wrong Answer

Solution code:
n,m=map(int, input().split())
pf={}
for i in range(2,int(m**0.5)+1):
    while m%i==0:
        pf[i]=pf.get(i,0)+1
        m//=i
if m>1:pf[m]=1
ans=1
for i in pf:
    if pf[i]>=n:
        ans*=i
print(ans)

Submission status: Wrong Answer

Solution code:
def process(n, p):
    foo = 1
    k = 2
    while k * k <= p:
        c = 0
        while p % k == 0:
            p /= k
            c += 1
        if c >= n:
            foo *= k ** (c / n)
        k += 1
    return foo

def main():
    n, p = [int(i) for i in raw_input().strip().split()]
    print process(n, p)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#      
import collections, atexit, math, sys, bisect 

sys.setrecursionlimit(1000000)
def getIntList():
    return list(map(int, input().split()))    

try :
    #raise ModuleNotFoundError
    import numpy
    def dprint(*args, **kwargs):
        #print(*args, **kwargs, file=sys.stderr)
        # in python 3.4 **kwargs is invalid???
        print(*args,  file=sys.stderr)
    dprint('debug mode')
except Exception:
    def dprint(*args, **kwargs):
        pass



inId = 0
outId = 0
if inId>0:
    dprint('use input', inId)
    sys.stdin = open('input'+ str(inId) + '.txt', 'r') #标准输出重定向至文件
if outId>0:
    dprint('use output', outId)
    sys.stdout = open('stdout'+ str(outId) + '.txt', 'w') #标准输出重定向至文件
    atexit.register(lambda :sys.stdout.close())     #idle 中不会执行 atexit
    
N, P = getIntList()
#print(N)

r = 1
for  t in range(2,1000003):
    if P%t!=0: continue
    c = 0
    while P%t==0:
        P//=t;
        c+=1
    r *= t ** (c//N)

print(r)

Submission status: Wrong Answer

Solution code:
N,P = map(int,input().split())
from collections import Counter
def factorize(n):
    d = Counter()
    m = 2
    while m*m <= n:
        while n%m == 0:
            n //= m
            d[m] += 1
        m += 1
    if n > 1:
        d[n] += 1
    return d

factors = factorize(P)
ans = 1
for k,v in factors.items():
    if v >= N:
        ans *= k
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N, P = map(int, input().split())
i = 2
ans = 1
while P > 1:
  x = 0
  while P % i == 0:
    x += 1
    P //= i
  ans *= i ** (x // N)
  i += 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
def eratosthenes(n):
    prime = [2]
    limit = int(n**0.5)
    prime_list = [i + 1 for i in range(2, n, 2)]
    while True:
        p = prime_list[0]
        if limit <= p:
            return prime + prime_list
        prime.append(p)
        prime_list = [e for e in prime_list if e % p != 0]

def prime_factorize(n):
    prime_list = eratosthenes(n)
    arr = []

    for p in prime_list:
        if n % p == 0:
            cnt = 0
            while n % p == 0:
                n //= p
                cnt += 1
            arr.append([p, cnt])

    return arr



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

ans = 1

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

pr_list = prime_factorize(p)

for a, b in pr_list:
    if b >= n:
        ans *= a ** (b // n)

print(ans)

Submission status: Time Limit Exceeded

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

for i in range(math.ceil(p**(1/n)),0,-1):
    if p%(i**n)==0:
        print(i)
        break

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n, p = map(int, input().split())
prime = set()
ans = 1
for i in range(2, p + 1):
    for x in prime:
        if i % x == 0:
            break
    else:
        prime.add(i)
        cnt = 0
        while p % i == 0:
            p //= i
            cnt += 1
        if cnt >= n:
            ans *= i * (cnt // n)

print(ans)