Buggy python submission (verdict: Runtime Error):
def primes(n):
  ps = {}
  while n%2==0:
    n//=2
    if 2 not in ps:
      ps[2] = 1
    else:
      ps[2] += 1
  
  for i in range(3,int(n**.5)+1,2):
    while n%i==0:
      n//=i
      if i not in ps:
        ps[i] = 1
      else:
        ps[i] += 1
  
  if n!=1:
    if i not in ps:
      ps[i] = 1
    else:
      ps[i] += 1
  
  return ps
  
N,P = map(int,input().split())
ps = primes(P)
ans = 1
for p, num in ps.items():
  if num>=N:
    ans *= p**(num//N)
print(ans)
    

Fixed submission:
def primes(n):
  ps = {}
  while n%2==0:
    n//=2
    if 2 not in ps:
      ps[2] = 1
    else:
      ps[2] += 1
  
  for i in range(3,int(n**.5)+1,2):
    while n%i==0:
      n//=i
      if i not in ps:
        ps[i] = 1
      else:
        ps[i] += 1
  
  if n!=1:
    ps[n] = 1
  
  return ps
  
N,P = map(int,input().split())
if N==1:
  print(P)
  exit()
ps = primes(P)
ans = 1
for p, num in ps.items():
  if num>=N:
    ans *= p**(num//N)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def primes(n):
  ps = {}
  while n%2==0:
    n//=2
    if 2 not in ps:
      ps[2] = 1
    else:
      ps[2] += 1
  
  for i in range(3,n+1,2):
    while n%i==0:
      n//=i
      if i not in ps:
        ps[i] = 1
      else:
        ps[i] += 1
    if n<i:break
        
  return ps
  
N,P = map(int,input().split())
ps = primes(P)
ans = 1
for p, num in ps.items():
  if num>=N:
    ans *= p**(num//N)
print(ans)
    

Fixed submission:
def primes(n):
  ps = {}
  while n%2==0:
    n//=2
    if 2 not in ps:
      ps[2] = 1
    else:
      ps[2] += 1
  
  for i in range(3,int(n**.5)+1,2):
    while n%i==0:
      n//=i
      if i not in ps:
        ps[i] = 1
      else:
        ps[i] += 1
  
  if n!=1:
    ps[n] = 1
  
  return ps
  
N,P = map(int,input().split())
if N==1:
  print(P)
  exit()
ps = primes(P)
ans = 1
for p, num in ps.items():
  if num>=N:
    ans *= p**(num//N)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def sol(x):
  num = P
  cnt = 0
  while cnt<N:
    if cnt!=N-1:
      if num%(x**2)!=0:return False
      else:num/=x**2
      cnt+=2
    else:
      if num%x!=0:return False
      else:num/=x
      cnt += 1
  return True
  

N,P=map(int,input().split())
for x in range(int(P**(1/N))+1,0,-1):
  if sol(x):
    print(x)
    exit()


Fixed submission:
def primes(n):
  ps = {}
  while n%2==0:
    n//=2
    if 2 not in ps:
      ps[2] = 1
    else:
      ps[2] += 1
  
  for i in range(3,int(n**.5)+1,2):
    while n%i==0:
      n//=i
      if i not in ps:
        ps[i] = 1
      else:
        ps[i] += 1
  
  if n!=1:
    ps[n] = 1
  
  return ps
  
N,P = map(int,input().split())
if N==1:
  print(P)
  exit()
ps = primes(P)
ans = 1
for p, num in ps.items():
  if num>=N:
    ans *= p**(num//N)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def sol(x):
  num = P
  for i in range(N):
    if num%x!=0:return False
    else:num/=x
  return True
  

N,P=map(int,input().split())
for x in range(int(P**(1/N))+1,0,-1):
  if sol(x):
    print(x)
    exit()


Fixed submission:
def primes(n):
  ps = {}
  while n%2==0:
    n//=2
    if 2 not in ps:
      ps[2] = 1
    else:
      ps[2] += 1
  
  for i in range(3,int(n**.5)+1,2):
    while n%i==0:
      n//=i
      if i not in ps:
        ps[i] = 1
      else:
        ps[i] += 1
  
  if n!=1:
    ps[n] = 1
  
  return ps
  
N,P = map(int,input().split())
if N==1:
  print(P)
  exit()
ps = primes(P)
ans = 1
for p, num in ps.items():
  if num>=N:
    ans *= p**(num//N)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def sol(x):
  num = P
  for i in range(N):
    if num%x!=0:return False
    else:num/=x
  return True
  

N,P=map(int,input().split())
for x in range(int(P**(1/N))+1,0,-1):
  if sol(x):
    print(x)
    exit()


Fixed submission:
def primes(n):
  ps = {}
  while n%2==0:
    n//=2
    if 2 not in ps:
      ps[2] = 1
    else:
      ps[2] += 1
  
  for i in range(3,int(n**.5)+1,2):
    while n%i==0:
      n//=i
      if i not in ps:
        ps[i] = 1
      else:
        ps[i] += 1
  
  if n!=1:
    ps[n] = 1
  
  return ps
  
N,P = map(int,input().split())
if N==1:
  print(P)
  exit()
ps = primes(P)
ans = 1
for p, num in ps.items():
  if num>=N:
    ans *= p**(num//N)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,P=map(int,input().split())
for x in range(max(int(P**(1/N))+1,1),0,-1):
  if P%(x**N)==0:
    print(x)
    exit()


Fixed submission:
def primes(n):
  ps = {}
  while n%2==0:
    n//=2
    if 2 not in ps:
      ps[2] = 1
    else:
      ps[2] += 1
  
  for i in range(3,int(n**.5)+1,2):
    while n%i==0:
      n//=i
      if i not in ps:
        ps[i] = 1
      else:
        ps[i] += 1
  
  if n!=1:
    ps[n] = 1
  
  return ps
  
N,P = map(int,input().split())
if N==1:
  print(P)
  exit()
ps = primes(P)
ans = 1
for p, num in ps.items():
  if num>=N:
    ans *= p**(num//N)
print(ans)

Buggy python submission (verdict: Runtime Error):
N,P=map(int,input().split())
for x in range(max(int(P**(1/N))+1,1),0,-1):
  if P%(x**N)==0:
    print(x)
    exit()


Fixed submission:
def primes(n):
  ps = {}
  while n%2==0:
    n//=2
    if 2 not in ps:
      ps[2] = 1
    else:
      ps[2] += 1
  
  for i in range(3,int(n**.5)+1,2):
    while n%i==0:
      n//=i
      if i not in ps:
        ps[i] = 1
      else:
        ps[i] += 1
  
  if n!=1:
    ps[n] = 1
  
  return ps
  
N,P = map(int,input().split())
if N==1:
  print(P)
  exit()
ps = primes(P)
ans = 1
for p, num in ps.items():
  if num>=N:
    ans *= p**(num//N)
print(ans)

Buggy python submission (verdict: Runtime Error):
N,P=map(int,input().split())
for x in range(int(pow(P,1/N))+1,0,-1):
  if P%(x**N)==0:
    print(x)
    exit()


Fixed submission:
def primes(n):
  ps = {}
  while n%2==0:
    n//=2
    if 2 not in ps:
      ps[2] = 1
    else:
      ps[2] += 1
  
  for i in range(3,int(n**.5)+1,2):
    while n%i==0:
      n//=i
      if i not in ps:
        ps[i] = 1
      else:
        ps[i] += 1
  
  if n!=1:
    ps[n] = 1
  
  return ps
  
N,P = map(int,input().split())
if N==1:
  print(P)
  exit()
ps = primes(P)
ans = 1
for p, num in ps.items():
  if num>=N:
    ans *= p**(num//N)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,P=map(int,input().split())
for x in range(int(pow(P,1/N))+1,0,-1):
  if P%(x**N)==0:
    print(x)
    exit()

Fixed submission:
def primes(n):
  ps = {}
  while n%2==0:
    n//=2
    if 2 not in ps:
      ps[2] = 1
    else:
      ps[2] += 1
  
  for i in range(3,int(n**.5)+1,2):
    while n%i==0:
      n//=i
      if i not in ps:
        ps[i] = 1
      else:
        ps[i] += 1
  
  if n!=1:
    ps[n] = 1
  
  return ps
  
N,P = map(int,input().split())
if N==1:
  print(P)
  exit()
ps = primes(P)
ans = 1
for p, num in ps.items():
  if num>=N:
    ans *= p**(num//N)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def sol(p):
  ans = 1
  for i in range(1,int(p**.5)+1):
    if p%i==0:
      if p%i**N==0:
        ans = max(ans,i)
      if i != p//i and p%(p//i)**N==0:
        ans = max(ans,p//i)
        return ans
  return ans  

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

Fixed submission:
def primes(n):
  ps = {}
  while n%2==0:
    n//=2
    if 2 not in ps:
      ps[2] = 1
    else:
      ps[2] += 1
  
  for i in range(3,int(n**.5)+1,2):
    while n%i==0:
      n//=i
      if i not in ps:
        ps[i] = 1
      else:
        ps[i] += 1
  
  if n!=1:
    ps[n] = 1
  
  return ps
  
N,P = map(int,input().split())
if N==1:
  print(P)
  exit()
ps = primes(P)
ans = 1
for p, num in ps.items():
  if num>=N:
    ans *= p**(num//N)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def divs(p):
  divs = []
  for i in range(1,int(p**.5)+1):
    if p%i==0:
      if p%i**N==0:
        divs.append(i)
      if i != p//i and p%(p//i)**N==0:
        divs.append(p//i)
        return divs
  return divs  

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

divs = sorted(divs(P))
if len(divs) == 0:print(1)
else:print(divs[-1])

Fixed submission:
def primes(n):
  ps = {}
  while n%2==0:
    n//=2
    if 2 not in ps:
      ps[2] = 1
    else:
      ps[2] += 1
  
  for i in range(3,int(n**.5)+1,2):
    while n%i==0:
      n//=i
      if i not in ps:
        ps[i] = 1
      else:
        ps[i] += 1
  
  if n!=1:
    ps[n] = 1
  
  return ps
  
N,P = map(int,input().split())
if N==1:
  print(P)
  exit()
ps = primes(P)
ans = 1
for p, num in ps.items():
  if num>=N:
    ans *= p**(num//N)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def divs(p):
  divs = []
  for i in range(1,int(p**.5)+1):
    if p%i==0:
      if p%i**N==0:
        divs.append(i)
      if i != p//i and p%(p//i)**N==0:
        divs.append(p//i)
  return divs  

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

divs = sorted(divs(P))
if len(divs) == 0:print(1)
else:print(divs[-1])

Fixed submission:
def primes(n):
  ps = {}
  while n%2==0:
    n//=2
    if 2 not in ps:
      ps[2] = 1
    else:
      ps[2] += 1
  
  for i in range(3,int(n**.5)+1,2):
    while n%i==0:
      n//=i
      if i not in ps:
        ps[i] = 1
      else:
        ps[i] += 1
  
  if n!=1:
    ps[n] = 1
  
  return ps
  
N,P = map(int,input().split())
if N==1:
  print(P)
  exit()
ps = primes(P)
ans = 1
for p, num in ps.items():
  if num>=N:
    ans *= p**(num//N)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def divs(p):
  divs = []
  for i in range(1,int(p**.5)+1):
    if p%i==0:
      divs.append(i)
      if i != p//i:
        divs.append(p//i)
  return divs  

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

divs = sorted(divs(P),reverse=True)
for div in divs:
  if P%div**N==0:
    print(div)
    exit()
print(1)

Fixed submission:
def primes(n):
  ps = {}
  while n%2==0:
    n//=2
    if 2 not in ps:
      ps[2] = 1
    else:
      ps[2] += 1
  
  for i in range(3,int(n**.5)+1,2):
    while n%i==0:
      n//=i
      if i not in ps:
        ps[i] = 1
      else:
        ps[i] += 1
  
  if n!=1:
    ps[n] = 1
  
  return ps
  
N,P = map(int,input().split())
if N==1:
  print(P)
  exit()
ps = primes(P)
ans = 1
for p, num in ps.items():
  if num>=N:
    ans *= p**(num//N)
print(ans)