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:
n,p = map(int,input().split())
for i in range(10001,1,-1):
    if p % i**n == 0:
        print(i)
        exit()
print(1)

Submission status: Wrong Answer

Solution code:
import sys

N,P=[int(i) for i in input().split()]
i=2
ans = 1
c=0
if N == 1:
  print(P)
  sys.exit()
while P>i*i:
  if P%i==0:
    P//=i
    c+=1
    if c==N:
      ans*=i
      c=0
  else:
    c=0
    i+=1
if P==i and c+1 ==N:
  ans*=i
print(ans)

Submission status: Wrong Answer

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

factor = []

p = 2
n = P
while p * p <= N:
    c = 0
    while n % p == 0:
        c += 1
        n //= p
    if c > 0:
        factor.append((p, c))
    p += 1

ans = 1
for key, count in factor:
    c = count
    while c >= N:
        ans *= key
        c -= N

print(ans)

Submission status: Wrong Answer

Solution code:
from fractions import gcd
N,P = map(int,input().split())
n_root = int(P**(1/N))
max = 0
if P == 1:
    max = 1
else:
    for i in range(1,n_root+1):
        K = P
        for j in range(1,N+1):
            if K%j == 0 and (K/i).is_integer():
                K = K/i
                if j == N:
                    max = i
            else:
                break
print(max)

Submission status: Wrong Answer

Solution code:
N, P = (int(i) for i in input().split())
max([x for x in range(1,int(pow(P, 1/N))+1) if P%(x**N)==0])

Submission status: Wrong Answer

Solution code:
def main():
    l=list(map(int,input().split()))
    ans=1
    for i in range(2,l[0]+1):
        if l[1]%(i**l[0])==0:
            ans=i
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import time
start = time.time()

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

if n==1:
  print(p)
else:
  ans=1
  for i in range(1,100000):
    tmp=i**n
    if (p>=tmp) and (p%tmp == 0):
     ans=i
    if(p<tmp):
      break
    now = time.time()
    if(now-start>1):
      break
  print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
n,p = input().split()
n = int(n)
p = int(p)
if n==1:
    o = p
else:
    i = 1
    a = o = 1
    while a<(p//3):
        a = i**n
        if p%a==0:
            o = i
        i += 1
print(o)

Submission status: Wrong Answer

Solution code:
import sys
import traceback

N, P = [int(i) for i in input().split()]
p = []
ans = 1

class PrimeFractorization:
    def __init__(self):
        self.a = 2

    def decomposit_prime(self, n):
        try:
            while n >= self.a * self.a:
                if n % self.a == 0:
                    p.append(self.a)
                    n //= self.a
                else:
                    self.a += 1
            p.append(n)
        except Exception as e:
            raise

obj = PrimeFractorization()
obj.decomposit_prime(P)

p2 = set(p)

for a in p2:
    if p.count(a) >= N:
        ans *= int(a)

print(ans)

Submission status: Wrong Answer

Solution code:
N,P = (int(i) for i  in input().split())

k = P
a = 2
ans = 1
counter = 0
while(k >= a*a):
    if (k%a==0):
        k = k // a
        counter += 1
    else:
        a += 1
        counter = 0
    if counter >= N:
        ans *= a
        counter = 0
if (k%a==0):
    k = k // a
    counter += 1
else:
    a += 1
    counter = 0
if counter >= N:
    ans *= a
    counter = 0
print(ans)

Submission status: Wrong Answer

Solution code:
a=[]
a=input().split(" ")
N=int(a[0])
P=int(a[1])
a=P**(1/N)
#aは約数の最大値

b=int(a)#aを整数化(bとする)
c=[]
i=0
for i in range(1,b+1):#Pを1からbまで割って割り切れたものをリストcに格納
    if P%i==0 and P%(i**N)==0 :
        c.append(int(i))
    else:
        continue
print(max(c))

Submission status: Wrong Answer

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

def calc(x):
    c = []
    b, e = 2, 0
    while b * b <= x:
        while x % b == 0:
            x = x // b
            e = e + 1
        if e > 0:
            c.append((b, e))
        b, e = b + 1, 0
    if x > 1:
        c.append((x, 1))
    return c
    
    
if p == 1:
    print(1)
elif n == 1:
    print(p)
else:
    d = calc(p)
    ans = 1
    for i in range(len(d)):
        if d[i][1] >= n:
            ans *= d[i][0]
    print(ans)

Submission status: Wrong Answer

Solution code:
import math

N, P = map(int, input().split())
result = 1
i = math.floor(math.pow(P, (1.0/N)))

while i > 1:
    if P % math.pow(i, N) == 0:
        result = i
        break
    i -= 1

print(result)

Submission status: Wrong Answer

Solution code:
N, P = map(int, input().split())
b=0
a = int(pow(P, 1/N))
for i in range(a+1):
  if i > 0 and P % pow(i,N) == 0:
     b = i

print(b)

Submission status: Wrong Answer

Solution code:
import math

N, P = map(int, input().split())
result = 1
i = math.floor(math.pow(P, (1.0/N)))

while i > 1:
    if P % math.pow(i, N) == 0:
        break
    i -= 1

print(i)

Submission status: Wrong Answer

Solution code:
def gcd(a, b):
    if a < b:
        a, b = b, a
    r = a % b
    if r == 0:
        return b
    else:
        return gcd(b, r)


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

    maxi = -1e9

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

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

    S = set()
    x = int(p ** (1 / n))
    for i in range(x, 1, -1):
        if p % i != 0:
            continue
        else:
            y = p // i
            if y % (n - 1) == 0:
                z = gcd(i, y // (n - 1))
                if z != 1:
                    v = p % (z ** n)
                    #print(z, p)
                    if v == 0:
                        maxi = max(maxi, z)

    if maxi == 1e9:
        print(1)
    else:
        print(maxi)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#coding:utf-8
import math

def primeFact(P):
    s = math.floor(math.sqrt(P))
    result = {}

    for i in range(2, s + 1):
        if P % i == 0:
            r = 0
            while P % i == 0:
                r += 1
                P = P / i
            result[i] = r

    if P > s:
        result[P] = 1
    return result

def gcd(N, fact):
    gcd = 1
    for key in fact.keys():
        if fact[key] >= N:
            gcd *= key * (fact[key] // N)
    return int(gcd)

if __name__ == "__main__":
    N, P = map(int, input().split())
    fact = primeFact(P)
    print(gcd(N, fact))

Submission status: Wrong Answer

Solution code:
#coding:utf-8

n,p = map(int,input().split())
d = []
res = 1
num = 0
a = 2
while(1):
  if p % a == 0:
    p /= a
    num += 1
    if num == n:
      res *= a
    else:
      continue
  num = 0
  a += 1
  if p == 1:
    break

print(res)

Submission status: Wrong Answer

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

#を素因数分解
# print(p)

if n==1:
    print(p)

if p==1:
    print(1)

if ((n!=1) and (p!=1)):
    yakusu=[]

    p1 = p


    while(1):
        bool = False

        for i in range(2,(p1//2+1)):
            if p1%i==0:
                yakusu.append(i)
                p1=p1//i
                bool = True
                break
        if bool == False:
            yakusu.append(p1)
            break

    if yakusu.count(p)!=1:
        yakusu.append(p)
    # print(yakusu)
    maxyakusu=1
    t=0
    while(1):
        ya=yakusu[t]
        bool2=True
        for i in range(t+1,n+t):
            if yakusu[i]!=ya:
                bool2=False
                t+=1
                break
        if bool2==True:
            maxyakusu*=ya
            t+=n
        if n+t >=len(yakusu):
            break

    print(maxyakusu)

Submission status: Wrong Answer

Solution code:
from fractions import gcd


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

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

Submission status: Wrong Answer

Solution code:
import math

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


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

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

Submission status: Wrong Answer

Solution code:
N, P = map(int, input().split())
import math
g = 1
if N ==1:
    print(P)
else:
    for i in range(1,math.ceil(P**(1/N))):
        X = i**N
        if X > P:
            break
        else:
            if P % X == 0:
                g = i
    print(g)

Submission status: Wrong Answer

Solution code:
N, P = (int(i) for i in input().split())
max([x for x in range(1,int(pow(P, 1/N))+2) if P%(x**N)==0])

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
n,p = input().split()
n = int(n)
p = int(p)
i = 1
a = o = 1
while a<(p//3):
    a = i**n
    if p%a==0:
        o = i
    i += 1
print(o)

Submission status: Wrong Answer

Solution code:
import math

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


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

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

print(s+1)

Submission status: Wrong Answer

Solution code:
#coding:utf-8
import math

def primeFact(P):
    s = math.floor(math.sqrt(P))
    result = {}

    for i in range(2, s):
        if P % i == 0:
            r = 0
            while P % i == 0:
                r += 1
                P = P / i
            result[i] = r

    if P > s:
        result[P] = 1
    return result

def gcd(N, fact):
    gcd = 1
    for key in fact.keys():
        if fact[key] >= N:
            gcd *= key * (fact[key] // N)
    return int(gcd)

if __name__ == "__main__":
    N, P = map(int, input().split())
    fact = primeFact(P)
    print(gcd(N, fact))

Submission status: Wrong Answer

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


def get_prime(n):
    """ Returns  a list of primes < n """
    sieve = [True] * n
    for i in range(3,int(n**0.5)+1,2):
        if sieve[i]:
            sieve[i*i::2*i]=[False]*((n-i*i-1)//(2*i)+1)
    return [2] + [i for i in range(3,n,2) if sieve[i]]

primax = int(1e7) + 9 * int(1e6)
primes = get_prime(primax)




def df(P, p):
    if P >= p:
        cnt = 0
        while P >= p and P % p == 0:
            P = int(P//p)
            cnt += 1
        return cnt
    else:
        raise "P , p error."

gc = []
for p in primes:
    if P % p == 0:
        cnt = df(P, p)
        P = int( P // int(p**cnt))
        gc.append([p, cnt])
ans = 1
for g,cnt in gc:
    if cnt >= N:
        ans *= g**(cnt//N)

debug = 1
for g,cnt in gc:
    debug *= g**cnt

# N > 100:  why WA
# debug < P: under 3 RE

if P > 1e9 and debug != P and  debug < P and debug*2 > P:
    raise "errror"
print(ans)

Submission status: Wrong Answer

Solution code:

import collections

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

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

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

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

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

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

Submission status: Wrong Answer

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

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

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

print(int(tmp))

Submission status: Wrong Answer

Solution code:
N, P  = list(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

factors = prime_factors(P)

factor_dict = {}

first = True
for factor in factors:
    if first or before_factor != factor:
        factor_dict[factor] = 1
        first = False
    else:
        factor_dict[factor] += 1
    before_factor = factor

out = 1
for factor, num in factor_dict.items():
    if num >= N:
        out *= (factor * (num // N))
print(out)

Submission status: Wrong Answer

Solution code:
import math
import sys

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

def C(N,P):
    if N == 1: return P
    a=P
    N1=1
    while N > N1:
        N1*=2
        a=math.sqrt(a)

    res=1
    for i in range(1,int(a)+2):
        if P % i**N: continue
        res = i
    return res

print(C(n,p))

Submission status: Wrong Answer

Solution code:
a=[]
a=input().split(" ")
N=int(a[0])
P=int(a[1])
a=P**(1/N)
#aは約数の最大値

b=int(a)#aを整数化(bとする)
c=[]
i=0
for i in range(1,b+1):#Pを1からbまで割って割り切れたものをリストcに格納
    if P%i==0 :
        c.append(int(i))
    else:
        continue

#リストcの中で条件に合致するものを探す
d=[]
x=0
for j in c :
    x=j**(N)
    if P%x==0:
        d.append(int(j))
    else:
        continue
print(max(d))

Submission status: Wrong Answer

Solution code:
import math

if __name__ == '__main__':
    n, p = list(map(int, input().split()))
    plist = []

    for i in range(2, int(math.sqrt(p))):
        if i**2 > p:
            break
        while p % i == 0:
            p //= i
            plist.append(i)

    a = []
    if not plist:
        print(1)
    else:
        for i in list(set(plist)):
            if plist.count(i) >= n:
                a.append(i)
    ans = 1
    while a:
        ans *= a.pop()

    print(ans)

Submission status: Wrong Answer

Solution code:
N, P = map(int, input().split())
g = 1
if N ==1:
    print(P)
else:
    for i in range(1,int(P**(1/N))+1):
        X = i**N
        if X > P:
            break
        else:
            if P % X == 0:
                g = i
    print(g)

Submission status: Wrong Answer

Solution code:
import collections

def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors
 
n,p = map(int, input().split())
 
if __name__ == '__main__':
    l=prime_factors(p)
    
c = collections.Counter(l)
pr=1
for f1,f2 in c.items():
    if f2/n>=1:
        pr*=f1*int(f2/n)
        
print(pr)

Submission status: Wrong Answer

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


def get_prime(n):
    """ Returns  a list of primes < n """
    sieve = [True] * n
    for i in range(3,int(n**0.5)+1,2):
        if sieve[i]:
            sieve[i*i::2*i]=[False]*((n-i*i-1)//(2*i)+1)
    return [2] + [i for i in range(3,n,2) if sieve[i]]

primax = int(1e7) + 9 * int(1e6)
primes = get_prime(primax)




def df(P, p):
    if P >= p:
        cnt = 0
        while P >= p and P % p == 0:
            P = int(P//p)
            cnt += 1
        return cnt
    else:
        raise "P , p error."

gc = []
for p in primes:
    if P % p == 0:
        cnt = df(P, p)
        P = int( P // int(p**cnt))
        gc.append([p, cnt])
ans = 1
for g,cnt in gc:
    if cnt >= N:
        ans *= g**(cnt//N)

debug = 1
for g,cnt in gc:
    debug *= g**cnt

# N > 100:  WA
# if P > 1e9 and debug != P and debug < P:
#     raise "errror"
print(ans)

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 != 0:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)

    return factors


factors = prime_factors(p)
c = Counter(factors)

res = 1

for k, v in c.items():
    if v >= n:
        res *= k

print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

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

n = int(math.sqrt(P))
if N >= 4:
    n = int(math.sqrt(n))

for i in range(n+1)[::-1]:
    print(i)
    if i == 0:
        break
    _num = P
    cnt = 0
    while True:
        if _num % i == 0:
            _num = _num / i
            cnt += 1
        else:
            break
        if cnt == N:
            print(i)
            exit()
print(1)

Submission status: Wrong Answer

Solution code:
N, P = map(int, input().split())
num = P
s = 0
prime_factors = []      # 素因数を格納するリスト

if P != 1:
    if N != 1:
        while s==0:
            for i in range(2,P+1):
                if num % i == 0:
                    num /= i
                    if num == 1:
                        s = 1
                    prime_factors.append(i)
                    break

        #print(prime_factors)

        if len(prime_factors) > N:
            #print(prime_factors)
            if prime_factors[len(prime_factors)-N] == prime_factors[-1]:
                print(prime_factors[len(prime_factors)-N] * prime_factors[0])
            else:
                print(prime_factors[len(prime_factors)-N])
        else:
            print(prime_factors[0])
    else:
        print(P)
else:
    print(1)

Submission status: Wrong Answer

Solution code:
n, p = map(int, input().split())
if n == 1 or p== 1:
    print(p)
    exit()
c2 = 0
while p%2 == 0 :
    c2 += 1
    p//=2
c = 2**(c2//n)
i = int(p**(1/n))
while i > 1:
    if p%(i**n) == 0:
        print(c*i)
        exit()
    else:
        i -= 1
print(c)

Submission status: Wrong Answer

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

#を素因数分解
# print(p)

if n==1:
    print(p)

if p==1:
    print(1)

if ((n!=1) and (p!=1)):
    yakusu=[]

    p1 = p


    while(1):
        bool = False

        for i in range(2,p1):
            if p1%i==0:
                yakusu.append(i)
                p1=p1//i
                bool = True
                break
        if bool == False:
            yakusu.append(p1)
            break

    if yakusu.count(p)!=1:
        yakusu.append(p)
    # print(yakusu)
    maxyakusu=1
    t=0
    while(1):
        ya=yakusu[t]
        bool2=True
        for i in range(t+1,n+t):
            if yakusu[i]!=ya:
                bool2=False
                t+=1
                break
        if bool2==True:
            maxyakusu*=ya
            t+=n
        if n+t >=len(yakusu):
            break

    print(maxyakusu)



#n個セット同じ数で配布

#インデックス-1が約数の数字、数が約数の個数

#２銃配列でセットの方がはやい？？

Submission status: Wrong Answer

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

factor = []

p = 2
n = P
while p * p <= n:
    c = 0
    while n % p == 0:
        c += 1
        n //= p
    if c > 0:
        factor.append((p, c))
    p += 1

ans = 1
for key, count in factor:
    c = count
    while c >= N:
        ans *= key
        c -= N

print(ans)

Submission status: Wrong Answer

Solution code:
import math
N, P = map(int, input().split())
n = 1
p = math.ceil(P ** (1/N))
print(p)
for i in range(2,p+1):
  while True:
    if P % (i ** N) == 0:
      n *= i
      P = P / (i ** N)
    else:
      break
  if P <= i ** N:
    break 
    
print(n)

Submission status: Wrong Answer

Solution code:

import collections

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

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

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

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

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

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

Submission status: Wrong Answer

Solution code:
#coding:utf-8
import math

def primeFact(P):
    s = math.floor(math.sqrt(P))
    result = {}

    for i in range(2, s):
        if P % i == 0:
            r = 0
            while P % i == 0:
                r += 1
                P = P / i
            result[i] = r

    if P > s:
        result[P] = 1
    return result

def gcd(N, fact):
    gcd = 1
    for key in fact.keys():
        if fact[key] >= N:
            gcd *= key * (int(fact[key] / N))
    return int(gcd)

if __name__ == "__main__":
    N, P = map(int, input().split())
    fact = primeFact(P)
    print(gcd(N, fact))

Submission status: Wrong Answer

Solution code:
from sys import stdin
N,P=[int(x) for x in stdin.readline().rstrip().split()]
for i in reversed(range(int(pow(P,(1/N)))+1)):
    tmp=i**N
    if P==1:
        ans=1
        break
    if N==1:
        ans=P
        break
    if P%tmp==0:
        ans=i
        break
print(ans)

Submission status: Wrong Answer

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

num = 1
result = 1
n_2 = 2 ** n

num2 = int(p ** (1/n))


for i in range(p):

    compare = num2 ** n

    a, b = divmod(p, compare)

    if b == 0:
        result = num2
        break

    # p / compare が、2 ** n 未満であれば、num2を2でわる
    if a < n_2:
        num2 = int(num2/2) + 1

    else:
        num2 -= 1

print(result)

Submission status: Wrong Answer

Solution code:

import collections

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

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

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

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

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

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

Submission status: Wrong Answer

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

num = 1
result = 1
n_2 = 2 ** n

num2 = int(p ** (1/n))


for i in range(p):

    compare = num2 ** n

    a, b = divmod(p, compare)

    print(p, compare, num2, a, b)

    if b == 0:
        result = num2
        break

    # p / compare が、2 ** n 未満であれば、num2を2でわる
    if a < n_2:
        num2 = int(num2/2) + 1

    else:
        num2 -= 1

print(result)

Submission status: Wrong Answer

Solution code:
#coding:utf-8
import math

def primeFact(P):
    s = math.floor(math.sqrt(P))
    result = {}

    for i in range(2, s):
        if P % i == 0:
            r = 0
            while P % i == 0:
                r += 1
                P = P / i
            result[i] = r

    if P > s:
        result[P] = 1
    return result

def gcd(N, fact):
    gcd = 1
    for key in fact.keys():
        if fact[key] >= N:
            gcd *= key * (int(fact[key] / N))
    return gcd

if __name__ == "__main__":
    N, P = map(int, input().split())
    fact = primeFact(P)
    print(gcd(N, fact))

Submission status: Wrong Answer

Solution code:
#
import sys
import math
import numpy as np
import itertools


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

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

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

Submission status: Wrong Answer

Solution code:
import math

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


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

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

print(s)

Submission status: Wrong Answer

Solution code:
import collections
import math


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


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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

else :print(1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, P = map(int, input().split())
c = 1
O = P
if P % N == 0:
    O = int(P/N)

import math
import random

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

    def is_prime(self, n):
        is_prime_common = self.is_prime_common(n)
        if is_prime_common is not None:
            return is_prime_common

        if n < 2000000:
            return self.is_prime_brute_force(n)
        else:
            return self.is_prime_miller_rabin(n)

    def is_prime_common(self, n):
        if n == 1: return False
        if n in Prime.seed_primes: return True
        if any(map(lambda x: n % x == 0, self.seed_primes)): return False

    def is_prime_brute_force(self, n):
        for k in range(2, int(math.sqrt(n)) + 1):
            if n % k == 0:
                return False
        return True

    def is_prime_miller_rabin(self, n):
        d = n - 1
        while d & 1 == 0:
            d >>= 1

        # use one of these lines / upper is more efficient.
        witnesses = self.get_witnesses(n)
        # witnesses = [random.randint(1, n - 1) for _ in range(100)]

        for w in witnesses:
            y = pow(w, d, n)

            while d != n - 1 and y != 1 and y != n - 1:
                y = (y * y) % n
                d <<= 1

            if y != n - 1 and d & 1 == 0:
                return False

        return True

    def get_witnesses(self, num):
        def _get_range(num):
            if num < 2047:
                return 1
            if num < 1373653:
                return 2
            if num < 25326001:
                return 3
            if num < 3215031751:
                return 4
            if num < 2152302898747:
                return 5
            if num < 3474749660383:
                return 6
            if num < 341550071728321:
                return 7
            if num < 3825123056546413051:
                return 9
            return 12

        return self.seed_primes[:_get_range(num)]

    def gcd(self, a, b):
        if a < b:
            return self.gcd(b, a)
        if b == 0:
            return a
        while b:
            a, b = b, a % b
        return a

    @staticmethod
    def f(x, n, seed):
        p = Prime.seed_primes[seed % len(Prime.seed_primes)]
        return (p * x + seed) % n

    def find_factor(self, n, seed=1):
        if self.is_prime(n):
            return n

        x, y, d = 2, 2, 1
        count = 0
        while d == 1:
            count += 1
            x = self.f(x, n, seed)
            y = self.f(self.f(y, n, seed), n, seed)
            d = self.gcd(abs(x - y), n)

        if d == n:
            return self.find_factor(n, seed+1)
        return self.find_factor(d)

    def find_factors(self, n):
        primes = {}
        if self.is_prime(n):
            primes[n] = 1
            return primes

        while n > 1:
            factor = self.find_factor(n)

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

            n //= factor

        return primes


prime = Prime()

if __name__ == '__main__':
    prime = Prime()
    table = prime.find_factors(O)

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

print(c)

Submission status: Wrong Answer

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

if N==1:
    print(P)
    exit(0)
flag=1
answer1=[1]
answer2=[1]


tmp=P
i=1
while P%((2**i)**N)==0:
    answer1.append((2**i))
    i+=1
P//=((2**i))
end=int(P**(1/N))
for i in range(3,end+1,2):
    if P%(i**N)==0:
        answer2.append(i)
print(answer1[-1]*answer2[-1])

Submission status: Wrong Answer

Solution code:
import math 
  
# A function to print all prime factors of  
# a given number n 
def primeFactors(n, n2): 
      
    # Print the number of two's that divide n 
    ans = 1
    tmp_counter = 0
    while n % 2 == 0: 
        #print 2,
        tmp_counter += 1 
        n = n // 2
    ans *= 2**(tmp_counter//n2)
    tmp_counter = 0
          
    # n must be odd at this point 
    # so a skip of 2 ( i = i + 2) can be used 
    for i in range(3,int(math.sqrt(n))+1,2): 
          
        # while i divides n , print i ad divide n 
        while n % i== 0: 
            tmp_counter += 1 
            n = n // i
        ans *= i**(tmp_counter//n2)
        tmp_counter = 0 

              
    # Condition if n is a prime 
    # number greater than 2 
    if n > 2: 
        ans *= n//n2
    return ans

n2, n = [int(i) for i in input().split()]
print(primeFactors(n, n2))