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: Time Limit Exceeded

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

    C = 1
    while pow(C, N) <= P:
        C += 1

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

    print(1)
if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

if N == 1:
    print(P)
    os.sys.exit()
i = 2
ans = 1
while True:
    if i**N > P:
        break
    if P % i**N == 0:
        P /= i**N
        ans *= i
    else:
        i += 1

print(ans)

Submission status: Time Limit Exceeded

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

i = 2
ans = 1
while True:
    if i**N > P:
        break
    if P % i**N == 0:
        P /= i**N
        ans *= i
    else:
        i += 1

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n, p = map(int, input().split())
from collections import defaultdict
prime_list = [2]
for i in range(3, int(p ** (0.5)), 2):
    for prime in prime_list:
        if i % prime == 0:
            break
    prime_list.append(i)
pt = p
prime_dict = defaultdict(lambda : 0)
for prime in prime_list:
    point = 0
    while pt % prime == 0:
        point += 1
        pt = pt // prime
    prime_dict[prime] = point
ans = 1
if n > 1:
    for i, j in prime_dict.items():
        if j >= n:
            ans = ans * i
else:
    ans = p
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import math

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

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

q = math.floor(math.sqrt(P))+1

ans = 1

for i in range(2,q+1):
    a = i**N
    if P%a == 0:
        ans = i
        
print(ans)

Submission status: Time Limit Exceeded

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

if N ==1:
    print(P)
    exit()
 
i=1
a = i**N
 
while a<=P:
    if P%a == 0:
        ans = i
    i = i+1
    a = i**N
    
print(ans)

Submission status: Time Limit Exceeded

Solution code:

N,P = map(int,input().split())
k =[0]*3
i = 2
P0 = P

while P0 != 1:
    while P0%i == 0:
        k[i]=k[i]+1
        P0 = P0//i
       
    i = i+1
    k.append(0)

g =1

for j in range(2,i):
    k[j] = k[j]//N
    g = g * j ** k[j]

print(g)

Submission status: Time Limit Exceeded

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

i=1
a = i**N

while a<=P:
    if P%a == 0:
        ans = i
    i = i+1
    a = i**N
    
print(ans)

Submission status: Time Limit Exceeded

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


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

X = defaultdict(int)
cnt = 2
while True:
    if P == 1 or cnt > P:
        break
    if P % cnt == 0:
        X[cnt] += 1
        P = P // cnt
    else:
        cnt += 1

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

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline

def main():
    N,P = map(int,input().split())
    if N==1:
        print(P)
    else:
        ans = 1
        insuu = 2
        while insuu**N<=P:
            if P%(insuu**N)==0:
                ans *= insuu
                P //= insuu**N
            else:
                insuu += 1
        print(ans)

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
N,P=map(int,input().split())
if N==1:
    print(P)
elif 2**N>P:
    print(1)
else:
    index=1
    ans=1
    while(index**N<=P):
        if P%(index**N)==0:
            ans=index
        index+=1
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
N,P=map(int,input().split())
if N==1:
    print(P)
else:
    index=1
    ans=1
    while(index**N<=P):
        if P%(index**N)==0:
            ans=index
        index+=1
    print(ans)

Submission status: Time Limit Exceeded

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

if N==1:
    print(P)
else:
    pmax = int(P **(1/N)) +2
    ans=1 
    for i in range(1,pmax):
 
        if P % (i**N) == 0:
            ans = i
 
    print(ans)

Submission status: Time Limit Exceeded

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

def solve(a):
	l = {}
	count = 0
	while 0 == a % 2:
		a //= 2
		count += 1
	else:
		if count:
			l[2] = count

	for n in range(3, a // 2 + 1, 2):
		if a == 1:
			return l
		if a < n:
			l[a] = 1
			return l

		count = 0
		while 0 == a % n:
			a //= n
			count += 1
		else:
			if count:
				l[n] = count
	return l

l = solve(P)
#print(l)

keys = sorted(l, reverse=True)
r = 1
for key in keys:
	if N <= l[key]:
		r *= key ** (l[key] // N)
print(r)

Submission status: Time Limit Exceeded

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

def solve(a):
	l = {}
	count = 0
	while 0 == a % 2:
		a //= 2
		count += 1
	else:
		if count:
			l[2] = count

	for n in range(3, a + 1, 2):
		if a == 1:
			return l

		count = 0
		while 0 == a % n:
			a //= n
			count += 1
		else:
			if count:
				l[n] = count
	return l

l = solve(P)
#print(l)

keys = sorted(l, reverse=True)
r = 1
for key in keys:
	if N <= l[key]:
		r *= key ** (l[key] // N)
print(r)

Submission status: Time Limit Exceeded

Solution code:
n, p = [int(i) for i in input().split()]
max_x = int(p**(1/n))+1
ans = 1
for i in range(max_x, 1, -1):
    if p >= pow(i,n) and p % pow(i,n) == 0:
        ans = i
        break
print(ans)

Submission status: Time Limit Exceeded

Solution code:
def pow_r(x, n):
    """
    O(log n)
    """
    if n == 0:  # exit case
        return 1
    if n % 2 == 0:  # standard case ① n is even
        return pow_r(x ** 2, n // 2)
    else:  # standard case ② n is odd
        return x * pow_r(x ** 2, (n - 1) // 2)

n, p = [int(i) for i in input().split()]
max_x = int(p**(1/n))
ans = 1

if n >= p:
    print(1)
else:
    for i in range(max_x+1, 1, -1):
        if p % pow_r(i,n) == 0:
            ans = i
            break
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
n, p = [int(i) for i in input().split()]
max_x = int(p**(1/n))
ans = 1
if n >= p:
    print(1)
else:
    for i in range(max_x+1, 1, -1):
        if p % pow(i,n) == 0:
            ans = i
            break
    print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N,P = (int(i) for i in input().split())
if N == 1:
    print(P)
else:
    if P**(1/N).is_integer() == False:
        print(int(P**(1/N)))
    else:
        S =int(P**(1/N)//1)
        for i in reversed(range(0,S+2)):
            if P%(i**N) ==0:
                print(i)
                break

Submission status: Time Limit Exceeded

Solution code:
N,P = (int(i) for i in input().split())
if N == 1:
    print(P)
else:
    if P**(1/N).is_integer() == False:
        print(int(P**(1/N)))
    else:
        S =int(P**(1/N)//1)+1
        for i in range(S,0,-1):
            if P%(i**N) ==0:
                print(i)
                break

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline


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

if N == 1:
    print(P)
else:
    M = int(pow(P, 1/N))+1
    ans = 1
    for i in range(2, M+1):
        if P % (i**N) == 0 and i > ans:
            ans = i

    print(ans)

Submission status: Time Limit Exceeded

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

x_max = int(P**(1/N)) + 1
ans = 1
for i in range(x_max):
  x = x_max - i
  if(P%x**N == 0):
    ans = x
    break
print(ans)

Submission status: Time Limit Exceeded

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

x_max = int(P**(1/N))
ans = 1
for i in range(x_max+1):
  x = x_max+1 - i
  if(P%x**N == 0):
    ans = x
    break
print(ans)

Submission status: Time Limit Exceeded

Solution code:
from collections import defaultdict as dd
primes = dd(int)
n,p = map(int, input().split())
gcd = 1
for i in range(2,p+1):
  while p%i == 0:
    p //= i
    primes[i] += 1
for fac in primes:
  gcd *= fac**(primes[fac]//n)
print(gcd)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
n, p = map(int ,input().split())

m = int(np.floor(p**(1/n)))+1

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import math
n, p = map(int, input().split())
ret = 0
for i in range(1, p+1):
    if i ** n > p:
        break
    if p % (i ** n) == 0:
        ret = i
print(ret)

Submission status: Time Limit Exceeded

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

if n == 1:
    print(m)
    exit(0)
else:
    for i in range(10**6 + 2,0,-1):
        x = m
        cnt = 0
        while x%i == 0:
            x //= i
            cnt += 1
        if cnt == n:
            print(i)
            exit(0)

Submission status: Time Limit Exceeded

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

d = int(m**(1.0/n))


if n == 1:
    print(m)
    exit(0)
else:
    for i in range(d + 2,0,-1):
        if m%(i**n) == 0:
            print(i)
            exit(0)

Submission status: Time Limit Exceeded

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

d = int(m**(1.0/n))


if n == 1:
    print(m)
    exit(0)
else:
    for i in range(d + 10000,0,-1):
        if m%(i**n) == 0:
            print(i)
            exit(0)

Submission status: Time Limit Exceeded

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


def fst(x,y):
    ans = 1
    while y:
        if y&1:
            ans *= x
        x *= x
        y //= 2
        if ans > m:
            return m+1
    return ans



if n == 1:
    print(m)
    exit(0)
else:
    for i in range(10**6 + 2,0,-1):
        if m%(i**n) == 0:
            print(i)
            exit(0)

Submission status: Time Limit Exceeded

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


def fst(x,y):
    ans = 1
    while y:
        if y&1:
            ans *= x
        x *= x
        y //= 2
        if ans > m:
            return m+1
    return ans



if n == 1:
    print(m)
    exit(0)
else:
    for i in range(10**6 + 2,0,-1):
        if m%fst(i,n) == 0:
            print(i)
            exit(0)

Submission status: Time Limit Exceeded

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

prime = []
numL = [i for i in range(2, 1000001)]
while True:
	p = numL[0]
	if p >= 1000:
		prime += numL
		break
	prime.append(p)
	numL = [i for i in numL if i % p != 0]

ans = 1
for i in prime:
	c = 0
	while True:
		if P % i == 0:
			c += 1
			P = int(P // i)
		else:
			break
	if c >= N:
		ans = ans * (i ** int(c // N))

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n,p = LI()
    if n == 1:
        return p
    r = 1
    i = 2
    while 1:
        t = i**n
        if p < t:
            break
        if p % t == 0:
            r *= i
            p //= t
        elif i == 2:
            i += 1
        else:
            i += 2
    return r


print(main())

Submission status: Time Limit Exceeded

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

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

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

if N == 1:
    print P
    exit()

num = 1
ans = 0
while True:
    if P % (num ** N) == 0:
        ans = num
    if P < (num ** N):
        break
    num += 1

print ans

Submission status: Time Limit Exceeded

Solution code:
import math

def exDiv(x,y):
    count = 1
    a = pow(y,1/x)
    if math.floor(a)==a:
        return int(a)
    max = math.ceil(pow(y,1/(x+1)))
    for i in range(2,max+1):
        if i%2==0 and i!=2:
            continue
        i_x = i**x
        while y%i_x==0:
            y /= i_x
            count *= i
        while y%i==0:
            y /= i
        if y<i_x:
            break
        a = pow(y,1/x)
        if math.floor(a)==a:
            return int(a*count)
    return count


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

Submission status: Time Limit Exceeded

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

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

t = 1
pm = 2
while pm ** N <= P:
    e = 0
    while P % pm == 0:
        P //= pm
        e += 1 # 素数のカウント
    t *= pm ** (e // N)
    pm += 1

print(t)

Submission status: Time Limit Exceeded

Solution code:
#import numpy as np
#import time
N,P = map(int,input().split(' '))
#N=3
#P=24


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


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

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

ans = 1
for p in prime:
	q = p**N
	if P % q == 0:
		ans*=p
		q*= p**N
		while(P % q == 0):
			ans*=p
			q*=p**N
#end = time.time()

#print(end-start)

print(ans)

Submission status: Time Limit Exceeded

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


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

Submission status: Time Limit Exceeded

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


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

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

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

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

Submission status: Time Limit Exceeded

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


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

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

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

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

Submission status: Time Limit Exceeded

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


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

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

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

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

Submission status: Time Limit Exceeded

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

gcd = 1
P_tmp = P

if N == 1:
    print(P)
else:
    for n in range(2, 10 ** 12):
        if P_tmp < n ** N: break
        n_pow = 0
        while (P_tmp % (n ** N) == 0):
            P_tmp = P_tmp // (n ** N)
            n_pow += 1
        gcd *= n ** (n_pow)
    print(gcd)

Submission status: Time Limit Exceeded

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

if N == 1: print(P)
else:
    for i in range(2, lim + 1):
        if i**N > P: break
        if P%i == 0:
            count = 0
            while P%i==0:
                P//=i
                count += 1
            Ans *= i**(count//N)
    print(Ans)

Submission status: Time Limit Exceeded

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

gcd = 1
P_tmp = P

if N == 1:
    print(P)
else:
    for n in range(2, 10 ** 12):
        if P_tmp < n ** N: break
        n_pow = 0
        while (P_tmp % n == 0):
            P_tmp = P_tmp // n
            n_pow += 1
        gcd *= n ** (n_pow // N)
    print(gcd)

Submission status: Time Limit Exceeded

Solution code:
from collections import Counter

N, P = map(int,input().split())
if N >= P:
    print(1)
    exit(0)
if N == 1:
    print(P)
    exit(0)
if N == 2:
    M = P
    Q = []
    k = 2
    while k*k <= M:
        if M%k == 0:
            M //= k
            Q.append(k)
        else:
            k += 1
    if M > 1:
        Q.append(M)
    R = Counter(Q)
    ans = 1
    for k in R:
        if R[k] >= 2:
            ans *= k**(R[k]//2)
    print(ans)
    exit(0)

ans = 1
k = 1
while k**N <= P:
    if P%(k**N)==0:
        ans = k
    k += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
from collections import Counter

N, P = map(int,input().split())
if N == 1:
    print(P)
    exit(0)
if N == 2:
    M = P
    Q = []
    k = 2
    while k*k <= M:
        if M%k == 0:
            M //= k
            Q.append(k)
        else:
            k += 1
    if M > 1:
        Q.append(M)
    R = Counter(Q)
    ans = 1
    for k in R:
        if R[k] >= 2:
            ans *= k**(R[k]//2)
    print(ans)
    exit(0)

ans = 1
k = 1
while k**N <= P:
    if P%(k**N)==0:
        ans = k
    k += 1

print(ans)

Submission status: Time Limit Exceeded

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

gcd = 1
P_tmp = P

for n in range(2, 10 ** 12):
    if P_tmp < n ** N: break
    n_pow = 0
    while (P_tmp % n == 0):
        P_tmp = P_tmp // n
        n_pow += 1
    gcd *= n ** (n_pow // N)
print(gcd)

Submission status: Time Limit Exceeded

Solution code:

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


ans = 1

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
def exDiv(x,y):
    i = 1
    count = 1
    while y>=i**x:
        i += 1
        if i%2==0 and i!=2:
            continue
        if i%3==0 and i!=3:
            continue
        if i%5==0 and i!=5:
            continue
        while y%(i**x)==0:
            y /= i**x
            count *= i
    return count


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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:

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


ans = 1

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

Submission status: Time Limit Exceeded

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

Ans = set()

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

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

Submission status: Time Limit Exceeded

Solution code:
# your code goes here
def main():
	buf = input().split()
	n = int(buf[0])
	p = int(buf[1])
	r = 1
	max = p
	i = 2
	while(p >= max):
		#print(p, i)
		max = i**n
		if(p % i**n == 0):
				p //= i**n
				r *= i
		else:
			i += 1
		
	print(r)	
main()

Submission status: Time Limit Exceeded

Solution code:

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


ans = 1


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

Submission status: Time Limit Exceeded

Solution code:
import itertools, functools, math


def prime_stream():
    stream = itertools.count(2)
    sieve = lambda x, y: x % y != 0

    while True:
        prime = next(stream)
        stream = filter(functools.partial(sieve, y=prime), stream)
        yield prime


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

ans = 1
if P // N != 0:
    for p in prime_stream():
        if p > P:
            break
        e = 0
        while P % p == 0:
            P //= p
            e += 1  # 素数のカウント
        if e // N > 0:
            ans *= p ** (e // N)

print(ans)

Submission status: Time Limit Exceeded

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

Ans = set()

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


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

Submission status: Time Limit Exceeded

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

ans=1
if N==1:
    ans=P
else:
    for i in range(1,P):
        if P % (i**N)==0:
            ans=i
        elif P < i**N:
            break
print(ans)

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
import sys, os
try: from typing import Any, Union, List, Tuple, Dict
except ImportError: pass
sys.setrecursionlimit(10**6)
if os.environ.get("USER") == "shun":
    def debug(*args): print(*args, file=sys.stderr)
else:
    print("NO DEBUG", file=sys.stderr)
    def debug(*args): pass
def exit(): sys.exit(0)
import math


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


primes = {}
q = 2
while p != 1:
    while p % q == 0:
        p = p // q
        if q in primes:
            primes[q] += 1
        else:
            primes[q] = 1
    q += 1


ans = 1
for q in primes:
    ans *= q**(primes[q] // n)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
def POW(x,n):
    ans = 1
    while(n):
        if(n%2):ans *= x
        x *= x
        n >>= 1
    return ans

N,P = map(int,input().split())
if N == 1:
    print(P)
    exit()
ans = 1
i = 1
while POW(i,N) <= P:
    if(P%(POW(i,N)) == 0):ans = i
    i += 1
print(ans)

Submission status: Time Limit Exceeded

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


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


print(ans)

Submission status: Time Limit Exceeded

Solution code:
def POW(x,n):
    ans = 1
    while(n):
        if(n%2):ans *= x
        x *= x
        n >>= 1
    return ans

N,P = map(int,input().split())
if N == 1:
    print(P)
    exit()
ans = 1
i = 1
while i**N <= P:
    if(P%(i**N) == 0):ans = i
    i += 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n, p = list(map(int, input().split()))
if(n == 1):
  print(p)
elif(p == 1):
  print(1)
else:
  ans = 1
  tmp = 2
  while(tmp**n <= p):
    if((p%(tmp**n)) == 0): ans = tmp
    tmp+=1
  print(ans)

Submission status: Time Limit Exceeded

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

lim = int(math.sqrt(P))
Ans = 1

Prime = [True for i in range(lim+1)]

if N == 1: print(P)
else:
    for i in range(2, lim + 1):
        if i**N > P: break
        if Prime[i]:
            a = i*2
            while a <= lim:
                Prime[a] = False
                a += i
            if P%i == 0:
                count = 0
                while P%i==0:
                    P//=i
                    count += 1
                Ans *= i**(count//N)
    print(Ans)

Submission status: Time Limit Exceeded

Solution code:
N,P = map(int,input().split())
if N == 1:
    print(P)
    exit()
ans = 1
i = 1
while i**N <= P:
    if(P%(i**N) == 0):ans = i
    i += 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N, P = [int(a) for a in input().split()]
# N, P = [10, 2972439611840]
prod = P
ans = 1
if N == 1:
    ans = P
else:
    for i in range(2, P):
        if i > 2 and i % 2 == 0:
            continue
        if prod < i ** N:
            break
        count = 0
        while prod % i == 0:
            prod /= i
            count += 1
            if count % N == 0:
                ans *= i
print(str(ans))

Submission status: Time Limit Exceeded

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

ans = 1
k = 1
while k**N <= P:
    if P%(k**N)==0:
        ans = k
    k += 1

print(ans)

Submission status: Time Limit Exceeded

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

if N == 1:
  print(P)
  exit(0)
  
ans = 1
i = 2
while i ** N <= P:
  if P % i**N == 0:
    ans *= i
    P = P // i**N
    continue
  i += 1
  
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N, P = [int(a) for a in input().split()]
# N, P = 4, 972439611840
prod = P
ans = 1
for i in range(2, P):
    if prod < i ** N:
        break
    count = 0
    while prod % i == 0:
        prod /= i
        count += 1
        if count % N == 0:
            ans *= i

print(str(ans))

Submission status: Time Limit Exceeded

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

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N, P = map(int,input().split())
ans = 1
k = 1
while k**N <= P:
    if P%(k**N)==0:
        ans = k
    k += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N, P = map(int, input().split())
ret = 1
k = 0
r = 2

while P != 1:
    if P % r == 0:
        k += 1
        P /= r
        if k == N:
            ret *= r
            k = 0
    else:
        k = 0
        if r == 2:
            r += 1
        else:
            r += 2

print(ret)

Submission status: Accepted

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

a = factorization(p)
ans = 1
for i in a:
    if i[1] >= n:
        ans = ans * i[0]**(i[1]//n)
print(ans)

Submission status: Accepted

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

prime = factorization(P)
ans = 1
for p, n in prime:
    if n >= N:
        ans *= p ** (n // N)
        
print(ans)

Submission status: Accepted

Solution code:
import math
n,p=map(int,input().split())
x=p
pf={}
for i in range(2,int(math.sqrt(p))+1):
    cnt=0
    while x%i==0:
        cnt+=1
        pf[i]=cnt
        x/=i
if x!=1:
    pf[int(x)]=1

ans=1
for i in pf:
    e=pf[i]//n
    if e!=0:
        ans*=(i**e)
print(ans)

Submission status: Accepted

Solution code:
N, P = map(int, input().split())
p_dict = {}
if N == 1:
  print(P)
  exit()
for num in range(2, int(P**0.5)+1):
  while P%num == 0:
    if num in p_dict:
      p_dict[num] += 1
    else:
      p_dict[num] = 1
    P //= num
ans = 1
for k, v in p_dict.items():
  ans *= k**(v//N)
print(ans)