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:
# -*- coding: utf-8 -*-
import math
n,p = list(map(int,input().split()))
i = a = o = 1
m = math.floor(p**(1/n))
for i in range(m+1)[::-1]:
    a = i**n
    if p%a==0:
        print(i)
        exit()

Submission status: Wrong Answer

Solution code:
def abc(n,p):
    ans=1
    b = 2
    if n==1:
        return p
    e=0
    while p%b == 0:
        p = p//b
        e +=1
    e=int(e//n)
    if e:
        ans*=(b*e)
    b+=1
    while b**2<=p:
        e=0
        while p%b == 0:
            p = p//b
            e +=1
        e=int(e//n)
        if e:
            ans*=(b**e)
        b+=2
    return ans

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

Submission status: Wrong Answer

Solution code:
def abc(n,p):
    ans=1
    b = 2
    if n==1:
        return p
    e=0
    while p%b == 0:
        p = p//b
        e +=1
    e=int(e//n)
    if e:
        ans*=(b*e)
    b+=1
    while b**2<p:
        e=0
        while p%b == 0:
            p = p//b
            e +=1
        e=int(e//n)
        if e:
            ans*=(b**e)
        b+=2
    return ans

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

Submission status: Wrong Answer

Solution code:
def abc(n,p):
    ans=1
    b = 2
    if n==1:
        return p
    e=0
    while p%b == 0:
        p = p//b
        e +=1
    e//=n
    e=int(e)
    if e:
        ans*=(b*e)
    b+=1
    while b**2<p:
        e=0
        while p%b == 0:
            p = p//b
            e +=1
        e//=n
        e=int(e)
        if e:
            ans*=(b*e)
        b+=2
    return ans

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

Submission status: Wrong Answer

Solution code:
def abc(n,p):
    ans=1
    b, e = 2, 0
    while (b**n)<=p:
        while p%(b**n) == 0:
            p = p//(b**n)
            e +=1
        if e:
            ans*=b*e
        b, e = b + 1, 0
    return ans

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from math import sqrt
from collections import Counter
from collections import deque

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

nums = deque()
ans = 1
num = 2
limit = sqrt(P)

while P > 1 and limit >= sqrt(num):
    if P % num == 0:
        nums.append(num)
        P //= num
    else:
        num += 1

count = Counter(nums)

for k, i in count.items():
    if i >= N:
        ans *= i // N * k

print(ans)

Submission status: Wrong Answer

Solution code:
from math import sqrt

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

num = 2
limit = sqrt(P)
ans = 1
count = 0

while P > 1 and sqrt(num) < limit:
    if P % num == 0:
        count += 1
        P //= num
    else:
        if count >= N:
            ans *= count // N * num
        count = 0
        num += 1

if count >= N:
    ans *= count // N * num

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import math
import random


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


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()
factors = prime.find_factors(P)

GCD = 1

for k, v in factors.items():
    if v >= N:
        GCD *= k * (v // N)

print(GCD)

Submission status: Wrong Answer

Solution code:
import sys
import math
import random


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


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()
factors = prime.find_factors(P)
print(factors)

GCD = 1

for k, v in factors.items():
    if v >= N:
        GCD *= k * (v // N)

print(GCD)

Submission status: Wrong Answer

Solution code:
from math import sqrt

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

num = 2
limit = sqrt(P)
ans = 1
count = 0

while P > 1 and limit >= sqrt(num):
    if P % num == 0:
        count += 1
        P //= num
    else:
        if count >= N:
            ans *= count // N * num
        count = 0
        num += 1

print(ans)

Submission status: Wrong Answer

Solution code:
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
    res=1
    for b,c in prime_list.items() :
        if c >= N : res *= b*int(c/N)
    return res
 
print(C(n,p))

Submission status: Wrong Answer

Solution code:
from math import sqrt

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

num = 2
count = 0
limit = sqrt(P)

while P > 1 and limit >= num:
    if P % num == 0:
        count += 1
        if count == N:
            ans *= num
            count = 0
        P //= num
    else:
        num += 1
        count = 0

print(ans)

Submission status: Wrong Answer

Solution code:
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
    res=1
    for b,c in prime_list.items() :
        if c >= N : res *= b
    return res
 
print(C(n,p))

Submission status: Wrong Answer

Solution code:
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 >= N : res *= b
    return res
 
print(C(n,p))

Submission status: Wrong Answer

Solution code:
import math
 
n,p=map(int,input().split())
 
def C(N,P):
    if N == 1: return P
    
    a=math.ceil((P**(1/N)))
 
    res=1
    for i in range(2,a):
        if P % i**N == 0 : res = i
 
    return res
 
print(C(n,p))

Submission status: Wrong Answer

Solution code:
import math
 
n,p=map(int,input().split())
 
def C(N,P):
    if N == 1: return P
    
    a=int(P**(1/N))+1
 
    res=1
    for i in range(2,a):
        if P % i**N == 0 : res = i
 
    return res
 
print(C(n,p))

Submission status: Wrong Answer

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

def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        while n % i == 0:
            n //= i
            factors.append(i)
        i += 1
    if n > 1:
        factors.append(n)
    return factors

fs = Counter(prime_factors(P))

d = 1
for k, c in fs.most_common():
    if c >= N:
        d *= k
print(d)

Submission status: Wrong Answer

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

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

fs = Counter(prime_factors(P))

d = 1
for k, c in fs.most_common():
    if c >= N:
        d *= k
print(d)

Submission status: Wrong Answer

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

def calc(n, p, x):
    return pow(p/float(x), 1/n)

for i in range(1, round(pow(P, 1/float(N)))+1):
    d = calc(N, P, i)
    if d.is_integer():
        print(int(d))
        break

Submission status: Wrong Answer

Solution code:
n,p = (int(i) for i in input().split())
prime=[]
def prime_judge(p):
    isPrime=True
    for i in range(1,int(p**(1/2))+1):
        if p%i==0 and i!=1:
            isPrime = False
            break
    return isPrime

if p>1:
    for i in range(2,int(p**(1/2))):
        if prime_judge(i):
            prime.append(i)

    i=0
    factor={}
    while(i<len(prime) and p>1):
        divided = False
        if p%prime[i]==0:
            p/=prime[i]
            divided = True
            if(prime[i] in factor.keys()):
                factor[prime[i]] += 1
            else:
                factor[prime[i]] = 1
        if not divided:
            i += 1

    sum = 1
    for i,x in factor.items():
        if x>=n:
            sum *= i**(int(x/n))
    print(int(sum))
else:
    print(1)

Submission status: Wrong Answer

Solution code:
n,p = (int(i) for i in input().split())
prime=[]
def prime_judge(p):
    isPrime=True
    for i in range(1,p):
        if p%i==0 and i!=1:
            isPrime = False
    return isPrime

if p>1:
    for i in range(2,p):
        if prime_judge(i):
            prime.append(i)

i=0
factor={}
while(i<len(prime) and p>1):
    divided = False
    if p%prime[i]==0:
        p/=prime[i]
        divided = True
        if(prime[i] in factor.keys()):
            factor[prime[i]] += 1
        else:
            factor[prime[i]] = 1
    if not divided:
        i += 1

sum = 0
for i,x in factor.items():
    if x%n==0:
        sum += i**(x/n)
print(int(sum))

Submission status: Wrong Answer

Solution code:
# _*_ coding:utf-8 _*_
#  CADDi2018 for Beginners C
#  https://atcoder.jp/contests/caddi2018b/tasks/caddi2018b_c

def getMaxGCD(count,product):
	maxPossibleInt = int(product**(1/count))
	checkGCDRange = range(maxPossibleInt+1,0,-1)
	maxGCD = maxPossibleInt+1
	for i in checkGCDRange:
		powNumber = i**count
		amari = product % powNumber
		if amari == 0:
			maxGCD = i

	return maxGCD

if __name__ == '__main__':
	n , p  = map(int,input().strip().split(' '))
	if n == 1:
		print(p)
		exit(0)
	if p == 1:
		print(1)
		exit(0)
	solution=getMaxGCD(n,p)
	print('{}'.format(solution))

Submission status: Wrong Answer

Solution code:
import math
N, P = map(int, input().split())
x = 1
max_i = int(math.pow(P, 1/N))

for i in range(2, max_i + 1):
    if P % (i**N) == 0:
        x = i

print(x)

Submission status: Wrong Answer

Solution code:
from math import sqrt
from collections import defaultdict
n,p = (int(i) for i in input().split())
d,ans = defaultdict(int),1
while 1:
	f = p
	for i in range(2,int(sqrt(p))+1):
		if p%i==0:
			d[i]+=1
			p//=i
			break
	if f==p:
		d[p]+=1
		break
for i,j in d.items():
	if n<=j: ans*=i
print(ans)

Submission status: Wrong Answer

Solution code:
import math
import numpy as np

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

# n個の1以上の整数a1,...,anが与えられる
# それぞれの値はわかっていないが全ての要素の積がPであることはわかっている
# a1,...,anの最大公約数として考えられるもののうち最も大きいものを求めてください

# -----------------
# 素数列挙
def make_prime_list(num):
    if num < 2:
        return []

    prime_list = [i for i in range(num+1)]
    prime_list[1] = 0
    num_sqrt = math.sqrt(num)

    for prime in prime_list:
        if prime == 0 :
            continue
        if prime > num_sqrt:
            break

    for non_prime in range(2*prime, num, prime):
        prime_list[non_prime] = 0
    
    return [prime for prime in prime_list if prime != 0]
# -----------------

# -----------------
# 素因数分解
def prime_factorization(num):
    if num <= 1:
        return False
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list(num_sqrt)

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

        return dict_counter
# -----------------

if n == 1:
    res = p
elif p == 1:
    res = 1
else:
    d = prime_factorization(p)
    pe = []
    for k, v in zip(d.keys(), d.values()):
        if v >= n:
            pe.append(k * (v // n))
    res = np.prod(pe)

print(res)

Submission status: Wrong Answer

Solution code:
import math
import numpy as np

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

# n個の1以上の整数a1,...,anが与えられる
# それぞれの値はわかっていないが全ての要素の積がPであることはわかっている
# a1,...,anの最大公約数として考えられるもののうち最も大きいものを求めてください

# -----------------
# 素数列挙
def make_prime_list(num):
    if num < 2:
        return []

    prime_list = [i for i in range(num+1)]
    prime_list[1] = 0
    num_sqrt = math.sqrt(num)

    for prime in prime_list:
        if prime == 0 :
            continue
        if prime > num_sqrt:
            break

    for non_prime in range(2*prime, num, prime):
        prime_list[non_prime] = 0
    
    return [prime for prime in prime_list if prime != 0]
# -----------------

# -----------------
# 素因数分解
def prime_factorization(num):
    if num <= 1:
        return False
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list(num_sqrt)

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

        return dict_counter
# -----------------

if n == 1:
    res = p
elif p == 1:
    res = 1
else:
    prime_dict = prime_factorization(p)
    res = np.prod([i for i, e in zip(prime_dict.keys(), prime_dict.values()) if e >= n])

print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Soin=[]
for i in range(2,int(P**0.5)+1):
    while P%i==0:
        P=P/i
        Soin.append(i)

Soin_s=collections.Counter(Soin)

Ans=1
for s in Soin_s:
    if Soin_s[s]>=N:
        Ans=Ans*(s**(Soin_s[s]/N))
print Ans

Submission status: Wrong Answer

Solution code:
n,p = map(int,input().split())
a = []
i = 2
k = p

if n == 1:
  c = p
else:
  while (p>1) and (i < int(k**0.5) + 4):
      c = 0
      while p%i == 0:
          p = p/i
          c += 1
      a.append([i,c])
      i += 1
  if p>1:
      a.append([p,1])
  c = 1
  for i in range(len(a)):
    if a[i][1] >= n:
      c = c* a[i][0] * int(a[i][1]/n)

print(c)

Submission status: Wrong Answer

Solution code:
n,p = map(int,input().split())
a = []
i = 2
k = p

if n == 1:
  c = p
else:
  while (p>1) and (i < int(k**0.5) + 4):
      c = 0
      while p%i == 0:
          p = p/i
          c += 1
      a.append([i,c])
      i += 1

  c = 1
  for i in range(len(a)):
    if a[i][1] >= n:
      c = c* a[i][0] * int(a[i][1]/n)

print(c)

Submission status: Wrong Answer

Solution code:
import math
N,P = map(int,input().split())
if N == 1:
    print(P)
    exit()
ans = 1
for i in range(2,math.floor(pow(P,1/2)) + 1):
    if P % i == 0:
        count = 1
        P = P // i
        while P % i == 0:
            count += 1
            P = P // i
        if count >= N:
            ans *= i
print(ans)

Submission status: Wrong Answer

Solution code:
import math
def factoring(n,dict_count = {}):
    sup = math.floor(pow(n,1/2))
    n_new = n
    for i in range(2,sup + 1):
        if n % i == 0:
            n_new = n // i
            if i in dict_count:
                dict_count[i] += 1
            else:
                dict_count[i] = 1
            break
    if n == n_new:
        if n_new in dict_count:
            dict_count[n_new] += 1
        else:
            dict_count[n_new] = 1
        return sorted(list(dict_count.items()))
    return factoring(n_new,dict_count)
N,P = map(int,input().split())
result = factoring(P)
ans = 1
for e in result:
  if e[1] >= N:
    ans *= e[0]
print(ans)

Submission status: Wrong Answer

Solution code:
# _*_ coding:utf-8 _*_
#  CADDi2018 for Beginners C
#  https://atcoder.jp/contests/caddi2018b/tasks/caddi2018b_c

def getMaxGCD(count,product):
	maxPossibleInt = int(float(product)**(1.0/float(count)))
	checkGCDRange = range(1,maxPossibleInt+1,1)
	maxGCD = 0
	for i in checkGCDRange:
		powNumber = i**count
		amari = product % powNumber
		if amari == 0:
			maxGCD = i

	return maxGCD

if __name__ == '__main__':
	n , p  = map(int,input().strip().split(' '))
	solution=getMaxGCD(n,p)
	print('{}'.format(solution))

Submission status: Wrong Answer

Solution code:
# _*_ coding:utf-8 _*_
#  CADDi2018 for Beginners C
#  https://atcoder.jp/contests/caddi2018b/tasks/caddi2018b_c
from math import pow

def getMaxGCD(count,product):
	maxPossibleInt = int(pow(float(product),1.0/float(count)))
	checkGCDRange = range(1,maxPossibleInt+1,1)
	maxGCD = 0
	for i in checkGCDRange:
		powNumber = pow(i,count)
		amari = product % powNumber
		if amari == 0:
			maxGCD = i

	return maxGCD

if __name__ == '__main__':
	n , p  = map(int,input().strip().split(' '))
	solution=getMaxGCD(n,p)
	print('{}'.format(solution))

Submission status: Wrong Answer

Solution code:
n,p = map(int,input().split())
a = []
i = 2


if n == 1:
  c = p
else:
  while (p>1) and (i < int(p**0.5) + 4):
      c = 0
      while p%i == 0:
          p = p/i
          c += 1
      a.append([i,c])
      i += 1

  c = 1
  for i in range(len(a)):
    if a[-i][1] >= n:
      c = c* a[-i][0] * int(a[i][1]/n)

print(a)
print(c)

Submission status: Wrong Answer

Solution code:
n,p=map(int,input().split())
def abc(n,p):
    ans=1  # prime factor
    b, e = 2, 0  # base, exponent
    if n==1:
        return p
    while b * b <= p:
        while p % b == 0:
            p = p // b
            e = e + 1
        if e >= n:
            ans*=b*(e//n)
        b, e = b + 1, 0
    return ans
print(abc(n,p))

Submission status: Wrong Answer

Solution code:
n,p = map(int,input().split())
a = []
i = 2


if n == 1:
  c = p
else:
  while (p>1) and (i < int(p**0.5) + 4):
      c = 0
      while p%i == 0:
          p = p/i
          c += 1
      a.append([i,c])
      i += 1

  c = 1
  for i in range(len(a)):
    if a[i][1] >= n:
      c = c* a[i][0] * int(a[i][1]/n)

    
print(c)

Submission status: Wrong Answer

Solution code:
n,p = map(int,input().split())
a = []
i = 2
while (p>1) and (i < int(p**0.5) + 4):
    c = 0
    while p%i == 0:
        p = p/i
        c += 1
    a.append([i,c])
    i += 1
 
c = 1
for i in range(len(a)):
  if a[i][1] >= n:
  	c = c* a[i][0] * int(a[i][1]/n)

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

Submission status: Wrong Answer

Solution code:
n,p = map(int,input().split())
a = []
i = 2
while (p>1) and (i < int(p**0.5) + 4):
    c = 0
    while p%i == 0:
        p = p/i
        c += 1
    a.append([i,c])
    i += 1
 
c = 1
for i in range(len(a)):
  if a[i][1] >= n:
  	c = c* a[i][0] * int(a[i][1]/n)

print(c)

Submission status: Wrong Answer

Solution code:
n,p = map(int,input().split())
a = []
i = 2
while (p>1) and (i < int(p**0.5) + 1):
    c = 0
    while p%i == 0:
        p = p/i
        c += 1
    a.append([i,c])
    i += 1

c = 1
for i in range(len(a)):
  if a[i][1] >= n:
  	c = c* a[i][0] * int(a[i][1]/n)
    
print(c)

Submission status: Wrong Answer

Solution code:
def pd(x):
  i = 2
  table = []
  while i * i <= x:
    while x % i == 0:
      x //= i
      table.append(i)
    i += 1
  if x > 1:
    table.append(x)
  return table

n,p=map(int,input().split())
if n==1 or p==1:
    print(p)
    exit()
l=pd(p)
ans=1
r={}
for i in l:
    while p%i==0:
        if i in r: r[i]+=1
        else: r[i]=1
        p//=i
    if i>=p: break
for i in r:
    if (r[i]//n)>0: ans*=i*(r[i]//n)
print(ans)

Submission status: Wrong Answer

Solution code:
def gcd(a,b):
    while a%b:
        a,b=b,a%b
    return b

def prime_t(t):
    i=2
    while i**2<=t:
        if t%i==0:
            return 0
        i+=1
    return 1

def prime_list(tt):
    p_list=[]
    for i in range(2,tt+1):
        if prime_t(i):
            p_list.append(i)
    return p_list

l=[]
#for i in range(2,3333333):
for i in range(2,40000):
    if prime_t(i):
        l.append(i)
b=[]
r={}
n,p=map(int,input().split())
if n==1 or p==1:
    print(p)
    exit()
for i in l:
    while p%i==0:
        b.append(i)
        if i in r: r[i]+=1
        else: r[i]=1
        p//=i
    if i>=p: break
ans=1
for i in r:
    if (r[i]//n)>0: ans*=i*(r[i]//n)
print(ans)

Submission status: Wrong Answer

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

from sys import stdin

n,x = [int(i) for i in stdin.readline().split()]
limit = int(x ** (1.0/n))

def factorize(x):
    ans = 1

    p = 2
    if x % p == 0:
        count = 1
        x /= p
        while x % p == 0:
            count += 1
            x /= p
        if count >= n:
            ans = ans * (p ** (count // n))

    for p in range(3, limit, 2):
        if x % p == 0:
            count = 1
            x /= p
            while x % p == 0:
                count += 1
                x /= p
            if count >= n:
                ans = ans * (p ** (count // n))
        if x < p * p:
            break
    return ans

if x == 1:
    print(1)
elif n == 1:
    print(x)
else:
    ans = factorize(x)
    print(ans)

Submission status: Wrong Answer

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

from sys import stdin

n,x = [int(i) for i in stdin.readline().split()]
limit = int(x ** (1.0/n)) + 1

def devide_counter(x, p):
    count = 1
    x /= p
    while x % p == 0:
        count += 1
        x /= p
    return x, count

def factorize(x):
    ans = 1

    p = 2
    if x % p == 0:
        x, count = devide_counter(x, p)
        if count >= n:
            ans = ans * (p ** (count // n))

    for p in range(3, limit, 2):
        if x % p == 0:
            x, count = devide_counter(x, p)
            print(x, count)
            if count >= n:
                ans = ans * (p ** (count // n))
        if x < p * p:
            break
    return ans

if x == 1:
    print(1)
elif n == 1:
    print(x)
else:
    ans = factorize(x)
    print(ans)