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: Runtime Error

Solution code:
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 1
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"

def facto(n):
    arr = []
    temp = n
    for i in range(int(math.sqrt(n))+1):
        if temp%i==0:
            cnt = 0
            while temp%i==0:
                cnt +=1
                temp //= i
            arr.append([cnt, i])
    if temp != 1:
        arr.append([1, temp])
    
    if arr == []:
        arr.append([1, n])
    
    return arr

n, p=I()

for i in facto(p):
    if i[0] >= n:
        ans *= i[1]

if n == 1:
    print(p)
elif p == 1:
    print(1)
else:
    print(ans)

Submission status: Runtime Error

Solution code:
def INT():
    return int(input())

def MI():
    return map(int, input().split())

def LI():
    return list(map(int, input().split()))

N, P = MI()
g = 1
mod = 1
ans = 0

while mod <= P:
    mod = pow(g, N)
    
    if P % pow(g, N) == 0:
        ans = max(ans, g)
    
    g += 1
    mod = pow(g, N)
    
print(ans)

Submission status: Runtime Error

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:
        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: Runtime Error

Solution code:
n,p = map(int, input().split())
i = 1
l = []
while i**n <= p:
    if p % i**n == 0:
        l.append(i)
    i += 1
print(max(l))

Submission status: Runtime Error

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 = []
i = 1
while p != 1:
    if p % m[i] == 0:
        x.append(m[i])
        p = p // m[i]
    else:
        i += 1
print(gcd(x[0],x[-1]))

Submission status: Runtime Error

Solution code:
N,P = map(int,input().split())
if N==1:
    print(P)
else:
    cmax = 1
    for i in range(1,int(P**0.5)+1):
        if P%(i**N)==0:
            cmax = i
    print(cmax)

Submission status: Runtime Error

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: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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


div_list = make_divisors(P)
ans = 0
for i in range(10 ** 6 + 1):
    # idx = bisect.bisect_left(div_list, i ** N)
    # if i ** N == div_list[min(idx, len(div_list) - 1)]:
    if i ** N in div_list:
        ans = i
print(ans)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C
# CreatedDate:  2020-07-26 13:24:14 +0900
# LastModified: 2020-07-30 16:22:23 +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), 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] * (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: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
from math import sqrt, pi
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

N, P = getNM()

def make_divisors(n):
    divisors = []
    for i in range(1, int(sqrt(n)) + 1):
        if n % i == 0:
            divisors.append(i)
            # √nで無い数についてもう一個プラス
            if i != n // i:
                divisors.append(n // i)
    return sorted(divisors)

ans = 1
for i in make_divisors(P):
    if P % pow(i, N) == 0:
        ans = max(ans, i)
print(ans)

Submission status: Runtime Error

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: Runtime Error

Solution code:
n, p = map(int, input().split())
if n == 1:
    print(p)
else:
    ans = 1
    for i in range(1, 10**6+1):
        if pow(i, n) > p:
            break

        if P % pow(i, n) == 0:
            ans = i
    print(ans)

Submission status: Runtime Error

Solution code:

def get_prime(N):
    if N < 2:
        return {1}
    prime = dict()
    prime[1] = 1

    i = 2
    while i*i <= N:
        while N % i == 0:
            if i in prime.keys():
                prime[i] += 1
            else:
                prime[i] = 1
            N = N//i
        i += 1
    if N != 1:
        prime[N] = 1
    return prime


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


prims = get_prime(p)

ans = 1

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

for p, cnt in prims.items():
    _tmp = cnt//n
    ans *= p**(cnt//n)

print(ans)

Submission status: Runtime Error

Solution code:

def get_prime(N):
    if N < 2:
        return {1}
    prime = dict()
    prime[1] = 1

    i = 2
    while i*i <= N:
        while N % i == 0:
            if i in prime.keys():
                prime[i] += 1
            else:
                prime[i] = 1
            N = N//i
        i += 1
    if N != 1:
        prime[N] = 1
    return prime


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


prims = get_prime(p)

ans = 1

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

for p, cnt in prims.items():
    if cnt >= n:

        ans *= p*(cnt//n)

print(ans)

Submission status: Runtime Error

Solution code:
def get_prime(N):
    if N < 2:
        return {1}
    prime = dict()
    prime[1] = 1

    i = 2
    while i*i <= N:
        while N % i == 0:
            if i in prime.keys():
                prime[i] += 1
            else:
                prime[i] = 1
            N = N//i
        i += 1
    if N != 1:
        prime[N] = 1
    return prime


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


prims = get_prime(p)

ans = 1

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

for p, cnt in prims.items():
    if cnt >= n:
        ans *= p

print(ans)

Submission status: Runtime Error

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

if n == 1:
    print(m)
    exit()
    
if n >= len(L):
    print(1)
    exit()
    
div = 2
L = []
i = 1
while div <= int(m**0.5)+1:
    while m%div == 0:
        m //=div
        L.append(div)
    div +=1
L.append(m)
#print(L)

from collections import Counter
L = Counter(L)

cnt = 1
for k,v in L.items():
    if v >= n:
        cnt *=k
print(cnt)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N,P=map(int,input().split())
i=2
ans=1
while P!=1 or i<int(N**.5)+1:
    I=i**N
    if P%I==0:
        ans*=I
        P//=I
    elif P%i==0:
        P//=i
    else:
        i+=1
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if N == 1:
  d = P
else:
  d = 1
  i = 2
  while i <= pow(P, 1/N) + 1:
    if P % i**N == 0:
      P //= i**N
      d *= i
      3 / 0
    else:
      i += 1
      3 / 0
print(d)

Submission status: Runtime Error

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

if N == 1:
  d = P
else:
  d = 1
  i = 2
  while i <= pow(P, 1/N) + 1:
    if P % i**N == 0:
      P //= i**N
      d *= i
      3 / 0
    else:
      i += 1
print(d)

Submission status: Runtime Error

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

if N == 1:
  d = P
else:
  d = 1
  i = 2
  while i <= pow(P, 1/N):
    if P % i**N == 0:
      P //= i**N
      d *= i
      3 / 0
    else:
      i += 1
      3 /0
  3 / 0
print(d)

Submission status: Runtime Error

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

if N == 1:
  d = P
else:
  d = 1
  i = 2
  while i <= pow(P, 1/N):
    if P % i**N == 0:
      P //= i**N
      d *= i
      3 / 0
    else:
      i += 1
      3 /0
print(d)

Submission status: Runtime Error

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

if N == 1:
  d = P
else:
  d = 1
  i = 2
  while i <= pow(P, 1/N):
    if P % i**N == 0:
      P //= i**N
      d *= i
      3 / 0
    else:
      i += 1
print(d)

Submission status: Runtime Error

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

if N == 1:
  d = P
else:
  d = 1
  i = 2
  while i <= pow(P, 1/N)+1:
    if P % i**N == 0:
      P //= i**N
      d *= i
      3 / 0
    else:
      i += 1
print(d)

Submission status: Runtime Error

Solution code:
from math import sqrt
def divisors(n):
    divisors = []
    for i in range(1, int(sqrt(n))+1):
        q, r = divmod(n, i)
        if r == 0:
            divisors.append(i)
            if i != q:
                divisors.append(q)
    return divisors

n, p = map(int, input().split())
x = 1
for k, v in factorint(p).items():
    x *= k ** (v//n)
print(x)

Submission status: Runtime Error

Solution code:
from functools import reduce
from operator import mul
n, p = map(int, input().split())
print(reduce(mul, [1] + [k for k, v in factorint(p).items()  if v >= n]))

Submission status: Runtime Error

Solution code:
from collections import Counter

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


ans = 1
C = Counter(prime_factorize(P))
#print(C)
for item in C.items():
    i = item[0]
    v = item[1]
    if v >= N:
        ans *= i**(v//N)
print(ans)

Submission status: Runtime Error

Solution code:
from collections import Counter

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

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

l = Counter(prime_factorize(P))

ans = 1
min_l = min(l.items(), key=lambda x:x[0])
# print(min_l)

for i, v in l.items():
    if v >= N:
        ans *= i*(v//N)
#     print(ans)
# print(l)
print(ans)

Submission status: Runtime Error

Solution code:
def divs(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

n,p = map(int, input().split())
ans=1
for d in divs(p):
  if pow(d,n)>p:
    break
  if p % pow(d,n)==0:
    ans=d
print(ans)

Submission status: Runtime Error

Solution code:
from functools import reduce
from operator import mul
def prime_factorize_dict(n, N):
    d = {1: 50}
    while not n & 1:
        d[2] = d.get(2, 0) + 1
        n >>= 1
    f = 3
    while f * f <= n:
        if not n % f:
            d[f] = d.get(f, 0) + 1
            n //= f
        else:
            f += 2
    if n != 1:
        d[n] = d.get(n, 0) + 1
    return d

N, P = map(int, input().split())
factors, powers = zip(*((factor, power) for factor, power in prime_factorize_dict(P, N).items() if power >= N))
print(reduce(mul, (factor ** (min(powers) // N) for factor in factors)))

Submission status: Runtime Error

Solution code:
from functools import reduce
from operator import mul
def prime_factorize_dict(n):
    if n == 1:
        return {1: 1}
    d = dict()
    while not n & 1:
        d[2] = d.get(2, 0) + 1
        n >>= 1
    f = 3
    while f * f <= n:
        if not n % f:
            d[f] = d.get(f, 0) + 1
            n //= f
        else:
            f += 2
    if n != 1:
        d[n] = d.get(n, 0) + 1
    return d

N, P = map(int, input().split())
factors, powers = zip(*((factor, power) for factor, power in prime_factorize_dict(P).items() if power >= N))
print(reduce(mul, (factor ** (min(powers) // N) for factor in factors)))

Submission status: Runtime Error

Solution code:

N, P = map(int, input().split())
def prime_factorize(n):
    a = []
    N = n
    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

lis = prime_factorize(P)
#print(lis)
if N == 1:
    print(P)
    exit()

else:
    d = [0] * (10 ** 6 + 5)
    for i in lis:
        if i != P:
            d[i] += 1
    #print(d[:24])
    #print(d[103])
    lis2 = []
    for i in reversed(range(10 ** 6 + 5)):
        if d[i] >= N:
            val = d[i] // N
            lis2.append(pow(i,val))
    ans = 1
    for i in lis2:
        ans *= i
    print(ans)

Submission status: Runtime Error

Solution code:
from matn import sqrt
N, P = map(int, input().split())
def prime_factorize(n):
    a = []
    N = n
    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

lis = prime_factorize(P)
#print(lis)
if N == 1:
    print(P)
    exit()

else:
    d = [0] * (10 ** 6 + 5)
    for i in lis:
        if i != P:
            d[i] += 1
    #print(d[:24])
    #print(d[103])
    lis2 = []
    for i in reversed(range(10 ** 6 + 5)):
        if d[i] >= N:
            val = d[i] // N
            lis2.append(pow(i,val))
    ans = 1
    for i in lis2:
        ans *= i
    print(ans)

Submission status: Runtime Error

Solution code:
N, P = map(int, input().split())
def prime_factorize(n):
    a = []
    N = n
    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

lis = prime_factorize(P)
#print(lis)
if N == 1:
    print(P)
    exit()

else:
    d = [0] * (10 ** 6 + 5)
    for i in lis:
        d[i] += 1
    #print(d[:24])
    #print(d[103])
    lis2 = []
    for i in reversed(range(10 ** 6 + 5)):
        if d[i] >= N:
            val = d[i] // N
            lis2.append(pow(i,val))
    ans = 1
    for i in lis2:
        ans *= i
    print(ans)

Submission status: Runtime Error

Solution code:
N, P = map(int, input().split())
def prime_factorize(n):
    a = []
    N = n
    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

lis = prime_factorize(P)
#print(lis)
if N == 1:
    print(P)
elif len(lis) == 1:
    print(1)
else:
    d = [0] * (10 ** 6 + 5)
    for i in lis:
        d[i] += 1
    #print(d[:24])
    #print(d[103])
    lis2 = []
    for i in reversed(range(10 ** 6 + 5)):
        if d[i] >= N:
            val = d[i] // N
            lis2.append(pow(i,val))
    ans = 1
    for i in lis2:
        ans *= i
    print(ans)

Submission status: Runtime Error

Solution code:
N, P = map(int, input().split())
def prime_factorize(n):
    a = []
    N = n
    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

lis = prime_factorize(P)
#print(lis)
if N == 1:
    print(P)
else:
    d = [0] * (10 ** 6 + 5)
    for i in lis:
        d[i] += 1
    #print(d[:24])
    #print(d[103])
    lis2 = []
    for i in reversed(range(10 ** 6 + 5)):
        if d[i] >= N:
            val = d[i] // N
            lis2.append(pow(i,val))
    ans = 1
    for i in lis2:
        ans *= i
    print(ans)

Submission status: Runtime Error

Solution code:
import qualified Data.Map.Strict as Map

primeFactorize :: Integer -> [Integer]
primeFactorize 1 = []
primeFactorize x =
    let v = head $ nativeFactors x in
        v : primeFactorize (x `div` v)
    where
        nativeFactors n = [a | a <- [2..n], n `mod` a == 0]

toCountMap :: (Ord k, Integral a) => [k] -> Map.Map k a
toCountMap xs = Map.fromListWith (+) $ zip xs (repeat 1)

main :: IO ()
main = do
    (n:p:_) <- fmap (map read . words) getLine :: IO[Integer]
    print $ solve n p

solve :: Integer -> Integer -> Integer
solve n p =
    let ps = Map.toList $ toCountMap $ primeFactorize p
    in foldr (\ (x, e) total -> total * (x ^ (e `div` n))) 1 ps

Submission status: Runtime Error

Solution code:
import sys
import math
N,P=map(int,input().split())
if P==0:
  print(0)
  sys.exit()
d = math.pow(P, 1.0/N)
d=int(d)
L=range(1,d+1)
R=sorted(L,reverse=True)
for i in R:
  if P/(i**N)==P//(i**N):
    print(i)
    sys.exit()

Submission status: Runtime Error

Solution code:
import sys
import math
N,P=map(int,input().split())
d = math.pow(P, 1.0/N)
d=int(d)
L=range(1,d+1)
R=sorted(L,reverse=True)
for i in R:
  if P/(i**N)==P//(i**N):
    print(i)
    sys.exit()

Submission status: Runtime Error

Solution code:
def 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
def r(a):
    ll,l=[],1
    for i in range(len(a)-1):
        if a[i]==a[i+1]:
            l+=1
        else:
            ll.append([l,a[i]])
            l=1
    ll.append([l,a[-1]])
    return ll
n,p=map(int,input().split())
a=r(factorize(p))
b=1
for i in a:
    b*=i[1]**(i[0]//n)
print(b)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

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

def divisors(n): #sortはしてない
    ret = set()
    m = 1
    while m*m <= n:
        if n%m==0:
            ret.add(m)
            ret.add(n//m)
        m += 1
    return ret

ndivs = list(divisors(p))
ndivs.sort()

ma = int(pow(p,1/n)) #でかい値の時はずれるので，適当に値を足した方がいい

from bisect import bisect_right
index = bisect_right(ndivs, ma)

if index < len(ndivs)-1: index+=1

for i in reversed(range(index)):
    if p%(pow(ndivs[i],n))==0:
        print(ndivs[i])
        exit()

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

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

def divisors(n): #sortはしてない
    ret = set()
    m = 1
    while m*m <= n:
        if n%m==0:
            ret.add(m)
            ret.add(n//m)
        m += 1
    return ret

ndivs = list(divisors(p))
ndivs.sort()

ma = int(pow(p,1/n)) #でかい値の時はずれるので，適当に値を足した方がいい
ma +=1

from bisect import bisect_right
index = bisect_right(ndivs, ma)

for i in reversed(range(index)):
    if p%(pow(ndivs[i],n))==0:
        print(ndivs[i])
        exit()

Submission status: Runtime Error

Solution code:
n,p = map(int,input().split())
ans_list = [1]
if n == 1:
  print(p)
else:
  for i in range(1,10**6+1):
    if i**n <= p and p % (i**n) == 0:
      ans_list.append(i)
  print(max(ans_list))

Submission status: Runtime Error

Solution code:
from math import ceil
N,P =map(int,input().split(' '))
if N==1:
    print(P)
    exit()
for i in range(ceil(pow(P,1/N)),0,-1):
    if P%pow(i,N)==0:
        print(i)
        break

Submission status: Runtime Error

Solution code:
N,P =map(int,input().split(' '))
if N==1:
    print(P)
    exit()
for i in range(int(pow(P,1/N)//1)+1,0,-1):
    if P%pow(i,N)==0:
        print(i)
        break

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
N,P =map(int,input().split(' '))
if N==1:
    print(P)
    exit()
for i in range((pow(P,1/N))//1,0,-1):
    if P%pow(i,N)==0:
        print(i)
        break

Submission status: Runtime Error

Solution code:
N,P =map(int,input().split(' '))
if N==1:
    print(P)
    exit()
for i in range((pow(P,1/N))//1,,0,-1):
    if P%pow(i,N)==0:
        print(i)
        break

Submission status: Runtime Error

Solution code:
from sympy import factorint

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

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

Submission status: Runtime Error

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

g = 1
res = 1
while g ** n <= p:
	if p % (g ** n) == 0:
		res = g
	g += 1

print(res)

Submission status: Runtime Error

Solution code:
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
n,p = map(int,input().split())
e = prime_factorize(p)
r = [e[0]]
t = [1]
for i in range(len(e)-1):
    if e[i] != e[i+1]:
        r.append(e[i+1])
        t.append(1)
    else:
        t[-1] += 1
ans = 1
for i in range(len(r)):
    if n <= t[i]:
        ans *= r[i]*(t[i]//n)
print(ans)

Submission status: Runtime Error

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

ans = 1

for k,v in pf.items():
    if v//n >= 1:
        ans *= k*(v//n)
print(ans)

Submission status: Runtime Error

Solution code:
import math
def factorize(n):
    if n == 1:
        return [1]
    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

def isPrime(n):
    if n == 1:
        return False
    else:
        for i in range(2, int(math.sqrt(n)) + 1):
           if n%i == 0:
               return False
        return True


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

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

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

f = factorize(p)
cnt = [0] * (max(f) + 1)
# print(f)

for _f in f:
    cnt[_f] += 1

ans = 1
# print(cnt)

for i in range(len(cnt)):
    if cnt[i] >= n:
        loop = cnt[i]//n
        for j in range(loop):
            ans *= i

print(ans)

Submission status: Runtime Error

Solution code:
import math
def factorize(n):
    if n == 1:
        return [1]
    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

def isPrime(n):
    if n == 1:
        return False
    else:
        for i in range(2, int(math.sqrt(n)) + 1):
           if n%i == 0:
               return False
        return True


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

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

f = factorize(p)
cnt = [0] * (max(f) + 1)
# print(f)

for _f in f:
    cnt[_f] += 1

ans = 1
# print(cnt)

for i in range(len(cnt)):
    if cnt[i] >= n:
        loop = cnt[i]//n
        for j in range(loop):
            ans *= i

print(ans)

Submission status: Runtime Error

Solution code:
import math
def factorize(n):
    if n == 1:
        return [1]
    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

def isPrime(n):
    if n == 1:
        return False
    else:
        for i in range(2, int(math.sqrt(n)) + 1):
           if n%i == 0:
               return False
        return True


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

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

f = factorize(p)
cnt = [0] * (max(f) + 1)

for _f in f:
    cnt[_f] += 1

ans = 1
# print(cnt)

for i in range(len(cnt)):
    if cnt[i] >= n:
        ans *= i

print(ans)

Submission status: Runtime Error

Solution code:
def factorize(n):
    if n == 1:
        return [1]
    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

def isPrime(n):
    if n == 1:
        return False
    else:
        for i in range(2, int(math.sqrt(n)) + 1):
           if n%i == 0:
               return False
        return True


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

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

f = factorize(p)
cnt = [0] * (max(f) + 1)

for _f in f:
    cnt[_f] += 1

ans = 1
# print(cnt)

for i in range(len(cnt)):
    if cnt[i] >= n:
        ans *= i

print(ans)