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 sys
import collections

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N, P = [int(x) for x in input().split()]

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

    primes = prime_factorization(P)
    c = collections.Counter(primes)

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

    print(ans)

    
    

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

lst=factorization(p)
ans=1
for a,b in lst:
    if b>=n:
        ans*=a
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


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

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

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

    return arr


list = factorization(p)
#print(list)
ans = 1
for l in list:
    if l[1] >= n:
        ans *= l[0]
print(ans)

Submission status: Wrong Answer

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


def fctr_d(n):
    c = 0
    r = int(n**0.5)
    f = defaultdict(int)
    for i in range(2, r+2):
        while n % i == 0:
            c += 1
            n = n//i
        if c != 0:
            f[i] += c
            c = 0
    if n != 1:
        f[n] += 1
    return f


d = fctr_d(p)
print(d)
ans = 1
for key, v in d.items():
    if v >= n:
        a = v // n
        ans *= key**a
print(ans)

Submission status: Wrong Answer

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


def fctr_d(n):
    c = 0
    r = int(n**0.5)
    f = defaultdict(int)
    for i in range(2, r+2):
        while n % i == 0:
            c += 1
            n = n//i
        if c != 0:
            f[i] += c
            c = 0
    if n != 1:
        f[n] += 1
    return f


d = fctr_d(p)
ans = 1
for key, v in d.items():
    if v >= n:
        a = v // n
        ans *= a*key
print(ans)

Submission status: Wrong Answer

Solution code:
from math import gcd
n,p = map(int,input().split())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors
m = make_divisors(p)
x = [1]
i = 1
while p != 1:
    if p % m[i] == 0:
        if x[0] != 1:
            x.append(m[i])
        else:
            x[0] = m[i]
        p = p // m[i]
    else:
        i += 1
l = len(x)
i = -1
while len(x) > n:
    x.insert(i,x[0]*x[i])
    x.pop(0)
    x.pop(i)
    i -= 1
    if abs(i) == n+1:
        i = -1
ans = x[0]
for i in range(1,min(len(x),n)):
    ans = gcd(ans,x[i])
print(ans)

Submission status: Wrong Answer

Solution code:
import math
from collections import Counter
N, P = map(int, input().split())
if P == 1:
    print(1)
elif N == 1:
    print(P)
else:
    Eratosthenes = [p for p in range(2, math.ceil(P ** 0.5))]
    number = Eratosthenes[0]
    sosuu = []
    while number < P ** 0.25:
        sosuu.append(number)
        n_Eratosthenes = []
        for n in Eratosthenes:
            if n % number == 0:
                pass
            else:
                n_Eratosthenes.append(n)
        if len(n_Eratosthenes) == 0:
            break
        number = n_Eratosthenes[0]
        Eratosthenes = n_Eratosthenes
    numbers=sosuu+Eratosthenes
    suuji=0
    answers=[]
    while P>1 and suuji<len(numbers):
        number=numbers[suuji]
        if P%number==0:
            answers.append(number)
            P=P//number
        else:
            suuji+=1
    kotae=Counter(answers)
    answer=1
    for key,value in kotae.items():
        if value>=N:
            answer*=key
    print(answer)

Submission status: Wrong Answer

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

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

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

    return arr

[n,p] = [int(i) for i in input().split()]
ls = factorization(p)
ans = 1
for kumi in ls:
    if kumi[1] >= n:
        ans *= (kumi[0] * (kumi[1] // n))
print(ans)

Submission status: Wrong Answer

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

factors = {}

while p > 1:
    f = False
    for i in range(2, int(p**0.5)+1):
        if p % i == 0:
            if i in factors:
                factors[i] += 1
            else:
                factors[i] = 1

            p //= i
            f = True
            break

    if not f:
        if p in factors:
            factors[p] += 1
        else:
            factors[p] = 1
        break

ans = 1
for factor, exp in factors.items():
    x = exp // n
    if x > 0:
        ans *= factor*x

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

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

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

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

    return arr

n,p=mp()
ans=1
for i,j in factorization(p):
    ans*=max(i*(j//n),1)
print(ans)

Submission status: Wrong Answer

Solution code:
def prime_factorize(n):
    """
    trial_division
    試し割り法で因数分解
    2 と奇数で試し割りする
    [[素因数, 指数]...]

    ref. https://en.wikipedia.org/wiki/Trial_division
    """
    a = []
    f = 2
    while f * f <= n:
        count = 0
        while n % f == 0:
            count += 1
            n //= f
        if count:
            a.append([f, count])
        # 3 からは奇数のみ
        f += 2 if f != 2 else 1
    if n != 1:
        a.append([n, 1])
    return a

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

# ref. https://drken1215.hatenablog.com/entry/2018/12/23/012300
res = 1
for p in prime_factorize(P):
    for _ in range(p[1] // 4):
        res *= p[0]
print(res)

Submission status: Wrong Answer

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


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

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

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


ans = 1
for a, b in factorization(p):
    if b >= n:
        ans *= a
print(ans)

Submission status: Wrong Answer

Solution code:
import sys

N, P = map(int, sys.stdin.readline().split())

primes = {}
for i in range(2, int(P**0.5) + 1):
    count = 0
    while P % i == 0:
        P //= i
        count += 1
    if 0 < count:
        primes[i] = count

if P != 1:
    primes[P] = 1

# print(primes)
ans = 1
for value, count in primes.items():
    p = count // N
    if 0 < p:
        ans *= p * value

print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter

N, P = [int(x) for x in input().split()]


def make_prime(n):
    array = {}
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt = cnt + 1
                temp = temp // i
            array[i] = cnt

    if temp != 1:
        array[temp] = 1

    if array == {}:
        array[n] = 1

    return array


primes = make_prime(P)

result = 1
for key, value in primes.items():
    if value >= N:
        result *= key * (value // N)

print(result)

Submission status: Wrong Answer

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

fac = dict()
if (P & -P) != 1:
    t = (P & -P).bit_length()
    fac[2] = t-1
    P //= (P & -P)
for f in range(3, 1001003):
    if P % f == 0:
        fac[f] = 0
        while P % f == 0:
            fac[f] += 1
            P //= f

ans = 1
for f, c in fac.items():
    ans *= pow(f, c//N)

print(ans)

Submission status: Wrong Answer

Solution code:
def prime(p):
    memo = []
    for i in range(2,(int(p**0.5)+1)):
        while p%i==0:
            p //= i
            memo.append(i)
    if p != 1:
        memo.append(p)
    return memo

import collections

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

memo = prime(P)

c = collections.Counter(memo)

ans = 1

for key,value in c.items():
    if N <= value:
        ans *= key
print(ans)

Submission status: Wrong Answer

Solution code:
N, P = map(int, input().split())
prime_list = []
for i in range(2, int(P ** (1 / 2)) + 1):
    cnt = 0
    while P % i == 0:
        cnt += 1
        P //= i
    if cnt:
        prime_list.append([i, cnt])
if P != 1:
    prime_list.append([P, 1])

ans = 1
for prime, cnt in prime_list:
    if cnt >= N:
        ans *= prime * (cnt // N)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, p = map(int, input().split())
if n==1:
  print(1)
  exit()
for i in range(int(p**(1/n))+1)[::-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))+1)[::-1]:
  if p%(i**n)==0:
    print(i)
    break

Submission status: Wrong Answer

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

for i in range(int(p**(1/n))+1)[::-1]:
  if p/(i**n) == int(p/(i**n)):
    print(i)
    break

Submission status: Wrong Answer

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

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

arr = factorization(p)
ans = 1
for f, v in arr:
    if v>=n:
        ans*=f//n
print(ans)

Submission status: Wrong Answer

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

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

arr = factorization(p)
ans = 1
for f, v in arr:
    if v>=n:
        ans*=f
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
from pprint import pprint
from copy import deepcopy
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce
from pprint import pprint


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007

def prime_decomposition(n):
    D = defaultdict(int)
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            D[i] += 1
            n //= i
        if n == 1:
            break
    if n != 1:
        D[n] += 1
    return D

n, p = LI()
D = prime_decomposition(p)
ans = 1
for k, v in D.items():
    if v >= n:
        ans *= k

print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    n, p = map(int, input().split())
    ans = int(p ** (1 / n))

    while ans > 0:
        a = ans ** n
        if p % a == 0:
            print(ans)
            return
        ans -= 1


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

if n==1:
    print(p)
    sys.exit()
gcd=1
limit = math.ceil(math.sqrt(p))
if p%2==0:
    cnt=0
    while p%2==0:
        cnt += 1
        p//=2
    if cnt>=n:
        cnt//=n
        gcd *= 2*cnt

for i in range(3,limit+1,2):
    cnt=0
    while p%i==0:
        cnt+=1
        p//=i
    if cnt>=n:
        cnt//=n
        gcd *= i*cnt

print(gcd)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
N, P = map(int,input().split())
if N == 1:
    print(P)
else:
    l = 1/N
    check = math.floor(P**l)
    while check >1:
        if P%(check**N) == 0:
            break
        check-=1
    print(check)

Submission status: Wrong Answer

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

# 素因数分解
def factors_counts(n):
    facs = dict()
    while n%2 == 0:
        facs.setdefault(2, 0)
        facs[2] += 1
        n //=2

    for f in range(3, int(n**0.5)+ 1, 2):
        while n%f == 0:
            facs.setdefault(f, 0)
            facs[f] += 1
            n //= f
    if n != 1:
        facs.setdefault(n, 0)
        facs[n] += 1
    return facs

facs = factors_counts(p)

ans = 1
for f, c in facs.items():
    nn = c//n
    if nn > 0:
        ans *= (nn*f)
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

i = 2
facts = defaultdict(int)
while i ** 2 <= P:
    while P % i == 0:
        facts[i] += 1
        P //= i
    i += 1
if P > 1:
    facts[P] += 1
ans = 1
for k, v in facts.items():
    if v >= N:
        ans *= k
print(ans)

Submission status: Wrong Answer

Solution code:
n, p = map(int, input().split())
m = int(p**(1/n))

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

Submission status: Wrong Answer

Solution code:
n, p = map(int, input().split())
m = int(p**(1/n) + 10)

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

Submission status: Wrong Answer

Solution code:
n, p = map(int, input().split())
l = []
ans = 1

for i in range(2, int(p**0.5) + 2):
    if p%i == 0:
        cnt = 0
        while p%i == 0:
            p /= i
            cnt += 1
        l.append([i, cnt])

if p != 1:
    l.append([p, 1])

for i, j in l:
    while j >= n:
        ans *= i
        j /= 2

print(int(ans))

Submission status: Wrong Answer

Solution code:
n, p = map(int, input().split())
l = []
ans = 1

for i in range(2, int(p**0.5) + 2):
    if p%i == 0:
        cnt = 0
        while p%i == 0:
            p /= i
            cnt += 1
        l.append([i, cnt])

if p != 1:
    l.append([p, 1])

for i, j in l:
    if j >= n:
        ans *= i

print(int(ans))

Submission status: Wrong Answer

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

for i in range(1, 10**6 + 20):
    if p%(i**n)== 0:
        ans = i

print(ans)

Submission status: Wrong Answer

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

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

res = 1
for k, v in factorization(P):
    if v < N:
        continue
    res *= k*(v//N)

print(res)

Submission status: Wrong Answer

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

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

cnt = Counter()

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

res = 1
for k, v in cnt.items():
    if v >= N:
        res *= k

print(res)

Submission status: Wrong Answer

Solution code:
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def primeFactorization(n):
    ans = []
    temp = n
    while temp%2 == 0:
        ans.append(2)
        temp /= 2
    for i in range(3, int(n**0.5)+1, 2):
        while temp%i == 0:
            ans.append(i)
            temp //= i
    if temp > 1:
        ans.append(temp)
    return collections.Counter(ans)

def resolve():
    N, P = LI()

    pf = primeFactorization(P)
    ans = 1
    for k, v in pf.items():
        ans *= (k ** (v // N))

    print(ans)

if __name__ == '__main__':
    resolve()

Submission status: Wrong Answer

Solution code:
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def primeFactorization(n):
    ans = []
    temp = n
    while temp%2 == 0:
        ans.append(2)
        temp /= 2
    for i in range(3, int(n**0.5)+1, 2):
        while temp%i == 0:
            ans.append(i)
            temp //= i
    if temp > 1:
        ans.append(temp)
    return collections.Counter(ans)

def resolve():
    N, P = LI()

    pf = primeFactorization(P)
    pf[1] = 1
    ans = 1
    for k, v in pf.items():
        ans *= k ** (v // N)

    print(ans)

if __name__ == '__main__':
    resolve()

Submission status: Wrong Answer

Solution code:
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def primeFactorization(n):
    ans = []
    temp = n
    while temp%2 == 0:
        ans.append(2)
        temp /= 2
    for i in range(3, int(n**0.5)+1, 2):
        while temp%i == 0:
            ans.append(i)
            temp //= i
    if temp > 1:
        ans.append(temp)
    return collections.Counter(ans)

def resolve():
    N, P = LI()

    pf = primeFactorization(P)
    ans = 1
    for k, v in pf.items():
        ans *= k ** (v // N)

    print(ans)

if __name__ == '__main__':
    resolve()

Submission status: Wrong Answer

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

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

import collections
A = prime_factorize(P)
B = collections.Counter(A)

ans = 1
for i in set(A):
    if B[i]//N != 0:
        ans *= B[i]//N * i
print(ans)

Submission status: Wrong Answer

Solution code:
import math
def main():
	n , p = map(int , input().split())
	i = 2
	if n==1:
		print(p)
		exit()
	ans = 1
	while (i<=math.sqrt(p)):
		if p%i==0:
			cnt = 0
			while p%i==0:
				p = p//i
				cnt = cnt+1
			if cnt>=n:
				ans = ans*i
		i = i+1
	print(ans)
if __name__=="__main__":
	main()

Submission status: Wrong Answer

Solution code:
import math
def main():
	n , p = map(int , input().split())
	i = 2
	ans = 1
	while (i<=math.sqrt(p)):
		if p%i==0:
			cnt = 0
			while p%i==0:
				p = p//i
				cnt = cnt+1
			if cnt>=n:
				ans = ans*i
		i = i+1
	print(ans)
if __name__=="__main__":
	main()

Submission status: Wrong Answer

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

# In[15]:


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


# In[16]:


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

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

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

    return arr


# In[17]:


mylist = factorization(P)
mylist = sorted(mylist, key=lambda x:x[1], reverse=True)
ans = 1
for i,item in enumerate(mylist):
    if item[1] >= N:
        ans *= item[0]
    else:
        break
print(ans)


# In[ ]:

Submission status: Wrong Answer

Solution code:
import sys
N, P = list(map(int, input().split()))
M = int(P ** (1 / N))
for i in range(M, 0, -1):
    if P % (i ** N) == 0:
        print(i)
        sys.exit()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C
# CreatedDate:  2020-07-26 13:24:14 +0900
# LastModified: 2020-07-30 16:20:24 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd
from math import sqrt


def prime_factors(p, prime_box):
    while p % 2 == 0:
        prime_box[2] += 1
        p //= 2

    for i in range(3, len(prime_box)+1, 2):
        while p % i == 0:
            prime_box[i] += 1
            p //= i


def main():
    n, p = map(int, input().split())
    if n == 1:
        print(p)
        return
    prime_box = [0] * (int(sqrt(p))+1)
    prime_factors(p, prime_box)
    prime_box = list(map(lambda x: x//n, prime_box))
    if sum(i*prime_box[i] for i in range(len(prime_box))) == 0:
        print(1)
    else:
        print(sum(i*prime_box[i] for i in range(len(prime_box))))


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

for i in range(x, 0, -1):
    if P % pow(i, N) == 0:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
def factorization(n):
    a = n
    p = 2
    res = []
    while a != 1:
        cnt = 0
        while a % p == 0:
            cnt += 1
            a //= p
        if cnt:
            res.append([p, cnt])
        p += 1
        if a != 1 and p * p > n:
            res.append([a, 1])
    return res

N, P = map(int, input().split())
L = factorization(P)
S = 1
for i in L:
    S *= i[0] ** (i[1] // N)
print(S)

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

# 因数分解
i=2
fact = []
while i * i <= p:
    while p % i == 0:
        fact.append(i)
        p //= i
    i += 1

if p >= 1:
    fact.append(p)

# N個以上そろっている共通因数を掛け合わせる
cf = Counter(fact)
ans = 1
for num, cnt in cf.items():
    if cnt >= n:
        ans *= num

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/caddi2018/tasks/caddi2018_a
from collections import Counter
n, p = map(int, input().split())

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

primes = prime_factorize(p)
c = Counter(primes)
ans = 1
for k, v in c.items():
    if v >= n:
        ans *= k
print(ans)

# 素因数分解して、各数の個数をカウントする。個数がn以上のものの中で、最大値を探す。
# 複数ある場合は、それらをかけ算したものになる。

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def resolve():
    '''
    code here
    '''
    import collections
    import copy

    N, P = [int(item) for item in input().split()]
    P_org = copy.deepcopy(P)

    fact_list = [1]

    cnt = 2
    while P > 1 and cnt**2 <= P:
        if P % cnt == 0:
            fact_list.append(cnt)
            P //= cnt
        else:
            cnt += 1

    if N == 1:
        res = P_org
    else:
        cnt_num = collections.Counter(fact_list[1:])
        res_list = []
        for i, v in cnt_num.items():
            if v//N > 0:
                res_list.append(i**(v//N))
        
        res = 1
        for item in res_list:
            res *= item
    # print(cnt_num)
    print(res)

if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

Solution code:
N, P = map(int, input().split())
ans = 1
def main(n, p):
  global ans
  for i in range(2, int(p**(3/(2*n)))):
    t = i**n
    if p % t == 0:
      ans *= i
      return main(n, p//t)
  return ans

print(main(N, P))

Submission status: Wrong Answer

Solution code:
N, P = map(int, input().split())
ans = 1
def main(n, p):
  global ans
  for i in range(2, int(p**(1/n))+1):
    if p % (i**n) == 0:
      ans *= i
      num = p // (i**n)
      return main(n, num)
  return ans

print(main(N, P))

Submission status: Wrong Answer

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


def factorization(n):
    """
    素因数分解
    factorization(24)
    [[2, 3], [3, 1]]
    24 = 2^3 * 3^1
    """
    arr = []
    temp = n
    for i in range(2, int(-(-(n ** 0.5) // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

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

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

    return arr


d = factorization(P)
ans = 1
# print(d)
for p, num in d:
    # print(p, num, num // N)
    if num // N != 0:
        ans = ans * p * (num // N)
print(ans)

Submission status: Wrong Answer

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


def factorization(n):
    """
    素因数分解
    factorization(24)
    [[2, 3], [3, 1]]
    24 = 2^3 * 3^1
    """
    arr = []
    temp = n
    for i in range(2, int(-(-(n ** 0.5) // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

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

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

    return arr


d = factorization(P)
ans = 1
# print(d)
for p, num in d:
    # print(p, num, num // N)
    if num // N != 0:
        ans *= p * (num // N)
print(ans)