Harryxun/stf_run huggingface dataset:
n, k = map(int, input().split())
md = 10 ** 9 + 7
if k % 2:
    print(0)
    exit()
k //= 2
dp = [[[0] * (n ** 2) for _ in range(n + 1)] for __ in range(n + 1)]
dp[0][0][0] = 1
for i in range(1, n + 1):
    dpi1 = dp[i - 1]
    for j in range(i + 1):
        for s in range(j, k + 1):
            # 片側、水平、両方上
            tmp = dpi1[j][s - j] * j * 2 + dpi1[j][s - j] + dpi1[j + 1][s - j] * (j + 1) ** 2
            if j:
                # 両方保留
                tmp += dp[i - 1][j - 1][s - j]
            dp[i][j][s] = tmp % md
print(dp[n][0][k])


### FIXED CODE ###

def f(n,k):
    md = 10 ** 9 + 7
    if k % 2:
        print(0)
        exit()
    k //= 2
    dp = [[[0] * (n ** 2) for _ in range(n + 2)] for __ in range(n + 1)]
    dp[0][0][0] = 1
    for i in range(1, n + 1):
        dpi1 = dp[i - 1]
        for j in range(i + 1):
            for s in range(j, k + 1):
                # 片側、水平、両方上
                #            print(i,j,s)
                tmp = dpi1[j][s - j] * j * 2 + dpi1[j][s - j] + dpi1[j + 1][s - j] * (j + 1) ** 2
                if j:
                    # 両方保留
                    tmp += dp[i - 1][j - 1][s - j]
                dp[i][j][s] = tmp % md
    print(dp[n][0][k])

n, k = map(int, input().split())
f(n,k)
N = int(input())
S = input()
list = [str(x) for x in S]
index = 0
abc = 0
for alphabet in list:
  if alphabet == "A" and list[index + 1] == "B" and list[index + 2] == "C":
    abc += 1
  index += 1
if index != N - 1:
  break
print(abc)

### FIXED CODE ###

n = int(input())
s = input()
print(s.count("ABC"))
n,q = map(int,input().split())
s = input()
t = [0] * (n + 1)
for i in range(q):
  t[i+1] = t[i] + (1 if s[i:i+2] == "AC" else 0)
for i in range(q):
  l,r = map(int,input().split())
  print(t[r-1] - t[l-1])


### FIXED CODE ###

n,q = map(int,input().split())
s = input()
t = [0] * (n + 1)
for i in range(n):
  t[i+1] = t[i] + (1 if s[i:i+2] == "AC" else 0)
for i in range(q):
  l,r = map(int,input().split())
  print(t[r-1] - t[l-1])
import math

def overlap(p1, p2, d):
    return (p1[0] - p2[0])**2 + (p1[1] - p2[1])**2 <= d**2

def intersection(o1,o2):
    a  = 2*(o2[0] - o1[0])
    b  = 2*(o2[1] - o1[1])
    c  = (o1[0] - o2[0])*(o1[0] + o2[0]) + (o1[1] - o2[1])*(o1[1] + o2[1])
    a2 = a**2 + b**2
    b2 = a*c + a*b*o1[1] - b**2*o1[0]
    c2 = b**2*(o1[0]**2 + o1[1]**2 - 1) + c**2 + 2*b*c*o1[1]
    x1 = (-b2 + math.sqrt(b2**2 - a2*c2))/a2
    x2 = (-b2 - math.sqrt(b2**2 - a2*c2))/a2
    if abs(b) == 0:
        y1 = o1[1] + math.sqrt(1 - (x1 - o1[0])**2)
        y2 = o1[1] - math.sqrt(1 - (x1 - o1[0])**2)
    else:
        y1 = -(a*x1 + c)/b
        y2 = -(a*x2 + c)/b
    return [x1, y1], [x2, y2]

while True:
    n = int(input())
    if n == 0:
        break
    p = []
    for i in range(n):
        p.append(list(map(float, input().split(","))))
    ans = 1
    for i in range(n - 1):
        for j in range(i + 1, n):
            if not overlap(p[i], p[j], 2) or overlap(p[i], p[j], 1e-10):
                continue
            p1, p2 = intersection(p[i], p[j])
            cnt1 = 0
            cnt2 = 0
            for k in range(n):
                if overlap(p1, p[k], 1):
                    cnt1 += 1
                if overlap(p2, p[k], 1):
                    cnt2 += 1
            ans = max([ans, cnt1, cnt2])
    print(ans)



### FIXED CODE ###

import math

def dist(p1, p2):
    return math.sqrt((p1[0] - p2[0])**2 + (p1[1] - p2[1])**2)

def intersection(o1,o2):
    if dist(o1,o2) > 2:
        p1, p2 =  [None, None], [None, None]
    elif dist(o1,o2) == 2:
        p1, p2 =  [(o1[0] + o2[0])/2, (o1[1] + o2[1])/2], [None, None]
    else:
        m = [(o1[0] + o2[0])/2, (o1[1] + o2[1])/2]
        v = [m[0] - o1[0], m[1] - o1[1]]
        v_abs = dist(v,[0,0])
        w = [v[1], -v[0]]
        w_abs = dist(w,[0,0])
        n = [w[0]/w_abs, w[1]/w_abs]
        l = math.sqrt(1 - v_abs**2)
        p1 = [m[0] + l*n[0], m[1] + l*n[1]]
        p2 = [m[0] - l*n[0], m[1] - l*n[1]]
    return p1, p2
err = 1.0e-6
while True:
    n = int(input())
    if n == 0:
        break
    p = []
    for i in range(n):
        p.append(list(map(float, input().split(","))))
    ans = 1
    for i in range(n - 1):
        for j in range(i + 1, n):
            p1, p2 = intersection(p[i], p[j])
            cnt1 = 0
            cnt2 = 0
            for k in range(n):
                if p1[0] and dist(p1, p[k]) <= 1 + err:
                    cnt1 += 1
                if p2[0] and dist(p2, p[k]) <= 1 + err:
                    cnt2 += 1
            ans = max([ans, cnt1, cnt2])
    print(ans)
n,m = map(int,input().split())

a = []
for i in range(m):
    a.append(int(input()))

d = [a[0]-1]
for j in range(1,m):
    d.append(a[j]-a[j-1]-2)

d.append(n-a[m-1]-1)


fiblist = [0] * 100001
fiblist[0] = 1
fiblist[1] = 1

for p in range(2,100001):
    fiblist[p] = (fiblist[p-1]+fiblist[p-2]) % 1000000007

#print(d)

if (-1 in d) or (-2 in d):
    print(0)
else:
    ans = 1
    for k in range(m+1):
        ans = (ans * fiblist[d[k]]) % 1000000007

    print(ans)


### FIXED CODE ###

fiblist = [0] * 100001
fiblist[0] = 1
fiblist[1] = 1
for p in range(2,100001):
    fiblist[p] = (fiblist[p-1]+fiblist[p-2]) % 1000000007

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

if m == 0:
    print(fiblist[n])
else:
    a = []
    for i in range(m):
        a.append(int(input()))

    d = [a[0]-1]
    for j in range(1,m):
        d.append(a[j]-a[j-1]-2)

    d.append(n-a[m-1]-1)




#print(d)

    if (-1 in d) or (-2 in d):
        print(0)
    else:
        ans = 1
        for k in range(m+1):
            ans = (ans * fiblist[d[k]]) % 1000000007

        print(ans)
import sys
readline = sys.stdin.buffer.readline

from collections import deque
from copy import copy,deepcopy
from itertools import permutations,combinations
from pprint import pprint

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

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col):
    data.sort(key=lambda x:x[col],reverse=False)
    return data

s = input()
t = input()

for i in range(len(s)-len(t)):
    print(s[i])
    flag = True
    for j in range(len(t)):
        if s[i]=="?":
            pass
        elif s[i]==t[i+j]:
            pass
        else:
            flag = False
    if flag:
        break
    else:
        continue

if flag==False:
    print("UNRESTORABLE")
    exit()

# print(len(s)-len(t)-i)
# print(j)

k = len(s) - len(t) - i

ans = copy(s)
ans = list(ans)
# print(ans)
# print(list(str(t)))

for l in range(len(t)):
    ans[k+l] = t[l]

# print(ans)


ans = "".join(ans)
# print(ans)

ans2 = ans.replace("?","a")
# print(ans2)

### FIXED CODE ###

# import sys
# readline = sys.stdin.buffer.readline

# from collections import deque
# from copy import copy,deepcopy
# from itertools import permutations,combinations
# from pprint import pprint

# def myinput():
#     return map(int,input().split())

# def mycol(data,col):
#     return [ row[col] for row in data ]

# def mysort(data,col):
#     data.sort(key=lambda x:x[col],reverse=False)
#     return data

s = input()
t = input()
if len(s)<len(t):
    print("UNRESTORABLE")
    exit()

for i in reversed(range(len(s)-len(t)+1)):
    flag = False
    for j in range(len(t)):
        if j==(len(t)-1):
            if s[i+j]=="?":
                flag = True
            elif s[i+j]==t[j]:
                flag = True
            else:
                flag = False
        elif s[i+j]=="?":
            pass
        elif s[i+j]==t[j]:
            pass
        else:
            flag = False
            break
    if flag:
        break
    else:
        continue

if flag:
    pass
else:
    print("UNRESTORABLE")
    exit()

ans = list(s)

for l in range(len(t)):
    ans[i+l] = t[l]

ans2 = "".join(ans)

# if "?" in ans2:
ans3 = ans2.replace("?","a")
print(ans3)
% cat test.py
n  = []
while True:
    try:n.append(int(raw_input()))
    except:break

R = max(n)+10
p = [1]*R
p[0] = p[1] = 0
p[4::2] = [0 for i in range(4,R,2)]
for i in range(3,int(R**0.5),2):
    if p[i]:
        p[2*i::i] = [0]*len(p[2*i::i])

print p
for i in n:
    print sum(p[:i+1])

### FIXED CODE ###

import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])
*s,=map(len,input().split("T"))
n=len(s)
ix,iy=map(int,input().split())
state=[(0,1),(1,0),(-1,0),(0,-1)]

def chk(x,y,turn,pos):
    if pos<n:
        tx,ty=turn
        nx,ny=x+tx*s[pos],y+ty*s[pos]
        if turn==(1,0) or turn==(-1,0):
            a=chk(nx,ny,(0,1),pos+1)
            b=chk(nx,ny,(0,-1),pos+1)
        elif turn==(0,1) or turn==(0,-1):
            a=chk(nx,ny,(1,0),pos+1)
            b=chk(nx,ny,(-1,0),pos+1)
        if a or b:
            return True
        else:
            return False         
    else:
        if x==ix and y==iy:
            return True
        else:
            return False

if chk(0,0,(1,0),0):
    print("Yes")
else:
    print("No")    


### FIXED CODE ###

s=input()
x,y=map(int,input().split())
*l,=map(len,s.split("T"))
n=len(l)

def f(pos,start):
  dp={0}
  for i in range(start,n,2):
    tmp=set()
    for j in dp:
      if i==0:
        tmp.add(j+l[i])
      else:
        tmp.add(j+l[i])
        tmp.add(j-l[i])
    dp=tmp
  return pos in dp

if f(x,0) and f(y,1):
  print("Yes")
else:
  print("No")
s=input()
print(s[2:-1])
if s[0] =="A" and s[2:-1].count("C") ==1:
  if s[1:].replace("C").islower:
    print("AC")
  else:
    print('WA')  
else:
  print('WA')

### FIXED CODE ###

s=input()
if s[0] =='A' and s[2:-1].count('C') ==1 and s[1:].replace('C', '').islower():
  print('AC')
else:
  print('WA')
def resolve():
  N = int(input())
 
  table = [1]*(N+1)
  for i in range(2, N+1):
    n = i
    while n <= N:
      table[n] += 1
      n += i
 
  # print(table)  
  ans = 0
  for i in range(1, N+1):
    ans += i*table[i]
 
  print(ans)
 
if __name__ == "__main__":
  resolve()
def resolve():
  N = int(input())

  table = [1]*(N+1)
  for i in range(2, N+1):
    n = i
    while n <= N:
      table[n] += 1
      n += i

  # print(table)  
  ans = 0
  for i in range(1, N+1):
    ans += i*table[i]

  print(ans)

if __name__ == "__main__":
  resolve()

### FIXED CODE ###

def resolve():
  N = int(input())
 
  table = [1]*(N+1)
  for i in range(2, N+1):
    n = i
    while n <= N:
      table[n] += 1
      n += i
 
  ans = 0
  for i in range(1, N+1):
    ans += i*table[i]
 
  print(ans)
 

if __name__ == "__main__":
  resolve()
N,M,X,Y = map(int,input().split())
x = list(input())
y = list(input())
print(x)
if X >= Y:
  print("War")
  exit()
else:
  Z = Y
  
if int(max(x)) < Z and int(min(y)) >= Z:
  print("No War")
else:
  print("War")

### FIXED CODE ###

N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
if max(max(x),X) < min(min(y),Y):
  print("No War")
else:
  print("War")
S = list(input())

c1 = (len(set(S)) == 2)

m = list(set(S))[0]
n = list(set(S))[1]

m_c, n_c = 0, 0

c2 = False

if c1:
    for i in range(len(S)):
        if S[i] == m:
            m_c += 1
        else:
            n_c += 1
    if m_c == n_c:
        c2 = True
else:
    print('No')

if c1 and c2:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

S = input()
S = list(S)

if len(set(S)) == 2:
    
    m = list(set(S))[0]
    n = list(set(S))[1]

    m_c, n_c = 0, 0
    c = False
    
    for i in range(len(S)):
        if S[i] == m:
            m_c += 1
        else:
            n_c += 1
            
    if m_c == n_c:
        c = True

    if c:
        print('Yes')
    else:
        print('No')

else:
    print('No')
n, m = map(int, input().split())

xy_dict = {}
for i in range(1,n+1):
    xy_dict[i] = []

for i in range(m):
    x,y = map(int, input().split())
    xy_dict[x].append(y)

dp = [-1]*(n+1)
dp[0] = 0

def get_longest(x):
    global dp

    if( dp[x] >= 0):
        return dp[x]
    else:
        y_list = xy_dict[x]
        temp_max = 0
        for y in y_list:
            temp_max = max(temp_max, get_longest(y)+1)

        dp[x] = temp_max
        return temp_max

ans = 0
for i in range(1,n+1):
    ans = max(ans, get_longest(i))

print(ans)

### FIXED CODE ###

from sys import setrecursionlimit
setrecursionlimit(10 ** 7)

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

xy_dict = {}
for i in range(1,n+1):
    xy_dict[i] = []

for i in range(m):
    x,y = map(int, input().split())
    xy_dict[x].append(y)

dp = [-1]*(n+1)
dp[0] = 0

def get_longest(x):
    global dp

    if( dp[x] >= 0):
        return dp[x]
    else:
        y_list = xy_dict[x]
        temp_max = 0
        for y in y_list:
            temp_max = max(temp_max, get_longest(y)+1)

        dp[x] = temp_max
        return temp_max

ans = 0
for i in range(1,n+1):
    ans = max(ans, get_longest(i))

print(ans)
import numpy as np
 
N = input()
A = np.array([int(x) for x in input().split(" ")])

if len(np.where(A>0)[0])%2 == 0:
  print(np.abs(A).sum())
else:
  print(np.abs(A).sum() - np.abs(A).min()*2)

### FIXED CODE ###

a, b, t = [int(x) for x in input().split(" ")]

mul = (t + 0.5) // a

print(int(b * mul))
import sys
input = sys.stdin.readline
    
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
    
ans = 0
for i in range(n):
  if a[i] <= b[i]:
    ans += a[i]
    b[i] -= a[i]
  if a[i + 1] <= b[i]:
    ans += a[i + 1]
    a[i + 1] = 0
  else:
    ans += b[i]
    a[i + 1] -= b[i]
  else:
    ans += b[i] 
    
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline
    
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
    
ans = 0
for i in range(n):
  if a[i] <= b[i]:
    ans += a[i]
    b[i] -= a[i]
    if a[i + 1] <= b[i]:
      ans += a[i + 1]
      a[i + 1] = 0
    else:
      ans += b[i]
      a[i + 1] -= b[i]
  else:
    ans += b[i] 
    
print(ans)
# -*- coding: utf-8 -*-
import numpy as np
inputs = input().split()
A = int(inputs[0])
B = int(inputs[1])
K = int(inputs[2])

candidates = np.arange(A, B + 1)
candidates = candidates[np.logical_or(candidates < A + K, candidates > B - K)]

for s in np.sort(candidates):
    print(s)


### FIXED CODE ###

# -*- coding: utf-8 -*-
import numpy as np
inputs = input().split()
A = int(inputs[0])
B = int(inputs[1])
K = int(inputs[2])


if A + K < B - K:
    candidates = np.concatenate([np.arange(A, A + K), np.arange(B - K + 1, B + 1)])
else:
    candidates = np.arange(A, B + 1)
    candidates = candidates[np.logical_or(candidates < A + K, candidates > B - K)]

for s in candidates:
    print(s)
import math, numpy

n = int(input())

a = list(map(int,input().split()))

l = [0] * (n + 1)
l[0] = 1

cumsum_a = numpy.cumsum(a[::-1])[::-1]

if (n > 0) and (a[0] > 0):
    print(-1)
else:
    for i in range(1, n):
        b_max1 = 2 * (l[i - 1] - a[i - 1])
        b_max2 = cumsum_a[i]

        if a[i] > 2 ** i - math.ceil(l[i-1]/2):
            l = -1
            break

        l[i] = min(b_max1, b_max2)

    if l != -1:
        l[-1] = a[-1]
        print(sum(l))
    else:
        print(-1)

### FIXED CODE ###

n = int(input())

a = list(map(int,input().split()))

cumsum_a = a.copy()

for i in range(n-1, -1, -1):
    cumsum_a[i] += cumsum_a[i+1]

ans = 0
childable_node = 1

for i in range(n + 1):
    if a[i] > childable_node:
        ans = -1
        break

    ans += childable_node

    if i < n:
        b_max1 = 2 * (childable_node - a[i])
        b_max2 = cumsum_a[i + 1]
        childable_node = min(b_max1, b_max2)

print(ans)
import math
a,b,X = map(int, input().split())
x = X/(a**2)

if x<=b/2:
        t = 2*a*x/(b**2)
        print(90-math.degrees(math.atan(t)))

else:
        if (a**2)*b==x:
                print(0)
        else:
                t = a/(2*b-2*x)
                print(90-math.degrees(math.atan(t)))


### FIXED CODE ###

import math
a,b,X = map(int, input().split())
x = X/(a**2)

if x<=b/2:
        t = 2*a*x/(b**2)
        print(90-math.degrees(math.atan(t)))

else:
        if a**2*b==X:
                print(0)
        else:
                t = a/(2*b-2*x)
                print(90-math.degrees(math.atan(t)))
import heapq
import copy

n, k = map(int, input().split())
v = list(map(int, input().split()))


def dfs(q, have, count, operate):
    if operate == 0:
        heapq.heappush(have, q[0])
        q = q[1:]
    elif operate == 1:
        heapq.heappush(have, q[-1])
        q = q[:-1]
    elif operate == 2:
        sub = heapq.heappop(have)
        q.insert(0, sub)
    elif operate == 3:
        sub = heapq.heappop(have)
        q.append(sub)

    count += 1
    if count >= k:
        return sum(have)

    a = dfs(copy.deepcopy(q), copy.deepcopy(have), count, 0)
    b = dfs(copy.deepcopy(q), copy.deepcopy(have), count, 1)
    c = -float('inf')
    d = -float('inf')
    e = dfs(q, have, count, -1)  # 何もしない
    if len(have) > 0:
        c = dfs(copy.deepcopy(q), copy.deepcopy(have), count, 2)
        d = dfs(copy.deepcopy(q), copy.deepcopy(have), count, 3)

    return max(a, b, c, d, e)


print(dfs(v, [], -1, -1))


### FIXED CODE ###

n, k = map(int, input().split())
v = list(map(int, input().split()))

ans = 0
for a in range(min(n, k) + 1):
    for b in range(min(n, k) - a + 1):
        li = v[:a]
        if b > 0:
            li += v[-b:]
        li.sort()
        count = 0
        while (a + b + count < k):
            if len(li) > 0 and li[0] < 0:
                count += 1
                li = li[1:]
            else:
                break
        ans = max(ans, sum(li))

print(ans)
#!/usr/bin/env python3
#input
import math
# math.degrees(theta) = theta radian to kodo
# math.atan(math.tan(theta)) = theta
a,b,x = map(int,input().split())
if x <= a*a*b/2:
    tan = 2*x/(a*b*b)
else:
    tan = (a**3)/2*(a*a*b-x)
print(math.degrees(math.atan(1/tan)))


### FIXED CODE ###

#!/usr/bin/env python3
#input
import math
# math.degrees(theta) = theta radian to kodo
# math.atan(math.tan(theta)) = theta
a,b,x = map(int,input().split())
if x <= a*a*b/2:
    tan = (a*b*b)/(2*x)
else:
    tan = 2*(a*a*b-x)/(a**3)
print(math.degrees(math.atan(tan)))
def input():
    import sys
    return sys.stdin.readline().rstrip()


def main():
    import math
    import collections
    import itertools
    import fractions
    import functools

    n = int(input())
    as_ = list(map(int, input().split()))
        
    # gcd = functools.reduce(math.gcd, as_)
    gcm = as_[0]
    for i in range(1, n):
        gcm = gcm * as_[i] // math.gcd(gcm, as_[i])
        # print(gcm)
    # print(gcm - 1)
    gcm_1 = gcm - 1
    print(functools.reduce(lambda x, y: x + gcm_1 % y, as_, 0))

if __name__ == '__main__':
    main()

### FIXED CODE ###

def input():
    import sys
    return sys.stdin.readline().rstrip()


def main():
    import math
    import collections
    import itertools
    import fractions
    import functools

    n = int(input())
    as_ = list(map(int, input().split()))
        
    # gcd = functools.reduce(math.gcd, as_)
    gcm = as_[0]
    for i in range(1, n):
        gcm = gcm * as_[i] // fractions.gcd(gcm, as_[i])
        # print(gcm)
    # print(gcm - 1)
    gcm_1 = gcm - 1
    print(functools.reduce(lambda x, y: x + gcm_1 % y, as_, 0))

if __name__ == '__main__':
    main()
a = str(input())

if a == "SUN":
  print("7")
elif a == "MON":
  print("6")
elif a == "TUE":
  print("5")
elif a == "WED":
  print("4")
elif a == "THU":
  print("3")
elif a == "FRI":
  print("2")
else:
  print("1")

SUN,MON,TUE,WED,THU,FRI,SAT

### FIXED CODE ###

a = str(input())

if a == "SUN":
  print("7")
elif a == "MON":
  print("6")
elif a == "TUE":
  print("5")
elif a == "WED":
  print("4")
elif a == "THU":
  print("3")
elif a == "FRI":
  print("2")
else:
  print("1")
def prime_factorize(P):
    prime = list()
    for i in range(2, P + 1):
        if i**2 <= P:
            if P % i == 0:
                c = 0
                while P % i == 0:
                    P //= i
                    c += 1
                prime.append([i, c])
            else:
                continue
        else:
            break
 
    if P != 1:
        prime.append([P, 1])
 
    return prime
 
def main2():
    N, P = map(int, input().split())
 
    prime = prime_factorize(P)
 
    print(prime)
    ans = 1
    for p in prime:
        n, c = p
        ans *= (n ** (c // N)) 
 
    print(ans)
 
if __name__ == "__main__":
    main2()
def prime_factorize(P):
    prime = list()
    for i in range(2, P + 1):
        if i**2 <= P:
            if P % i == 0:
                c = 0
                while P % i == 0:
                    P //= i
                    c += 1
                prime.append([i, c])
            else:
                continue
        else:
            break

    if P != 1:
        prime.append([P, 1])

    return prime

def main2():
    N, P = map(int, input().split())

    prime = prime_factorize(P)
    ans = 1
    for p in prime:
        n, c = p
        ans *= (n ** (c // N)) 

    print(ans)

if __name__ == "__main__":
    main2()

### FIXED CODE ###

import math
def prime_factorize(P):
    prime = list()
    for i in range(2, int(math.sqrt(P)) + 1):
        if P % i == 0:
            c = 0
            while P % i == 0:
                P //= i
                c += 1
            
            prime.append([i, c])
        else:
            continue

    if P != 1:
        prime.append([P, 1])

    return prime

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

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

    print(ans)

if __name__ == "__main__":
    main()
# 文字列の入力
O = char(input())
E = char(input())

L = len(O)
TMP = ""

for i in range(L):
    TMP = str(TMP+O[i]+E[i])

print(TMP)

### FIXED CODE ###

# 文字列の入力
O = input()
E = input() + " "

L = len(O)
TMP = ""

for i in range(L):
    TMP = TMP+O[i]+E[i]

print(TMP.strip())
from fractions import gcd
A,B,C,D = map(int, input().split())
X = B//C - (A-1)//C
Y = B//D - (A-1)//D
lcm = round(C*D//gcd(C,D))
Z = B//lcm - (A-1)//lcm
print(B-A+1-X-Y+Z)

### FIXED CODE ###

N=int(input())
A = list(map(int, input().split()))
outflag = 0
for i in range(N):
    if A[i]%2==0:
        if A[i]%3==0 or A[i]%5==0:
            pass
        else:
            outflag=1
            break
    else:
        pass
print("DENIED" if outflag else "APPROVED")
import math
l=[]
for i in range(5):
  l=l+[int(input())]

temp=[10-i for i in l if i%10!=0]

print(sum(l)-max(li))

### FIXED CODE ###

import math
l=[]
for i in range(5):
  l=l+[int(input())]

li=[i%10 for i in l]
lil = [i for i in li if i!=0]
if lil:
  minimum=min([i for i in li if i!=0])
else:
  minimum=0
ans=l.pop(li.index(minimum))
for i in l:
  ans+=math.ceil(i/10)*10

print(ans)
#!/usr/bin/env python3

from collections import deque


def book(A2, B2, t, cnt):
    if len(A2) == 0 and len(B2) == 0:
        L.append(cnt)
        return cnt
    elif t == K:
        L.append(cnt)
        return cnt
    elif t > K:
        L.append(cnt-1)
        return cnt - 1

    a_r = 0
    b_r = 0
    if len(A2) != 0:
        a = A2.popleft()
        a_r = book(A2, B2, t+a, cnt+1)
        
    if len(B2) != 0:
        b = B2.popleft()
        b_r = book(A2, B2, t+b, cnt+1)
    L.append(a_r)
    L.append(b_r)
    return max(a_r, b_r)




N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

L = []

A = deque(A)
B = deque(B)

t = 0
ret = 0

ret = book(A, B, 0, 0)

print(max(L))


### FIXED CODE ###

#!/usr/bin/env python3

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))


a = [0]
b = [0]

for i in range(N):
    a.append(a[-1] + A[i])


for i in range(M):
    b.append(b[-1] + B[i])

ret = 0
j = M
for i in range(N+1):
    if a[i] > K:
        break
    while a[i] + b[j] > K:
        j -= 1

    ret = max(i+j, ret)


print(ret)
import time
N=int(input())
H_list=[int(thing) for thing in input().split(" ")]
def is0(num):
    if num==0:
        time.sleep(10)
    else:pass
is0(H_list[0])

### FIXED CODE ###

N=int(input())
if N==0:
    print(0)
else:
    ret=int(N*(N-1)//2)
    print(ret)