Harryxun/stf_run huggingface dataset:
import sys
from functools import lru_cache
from collections import OrderedDict

input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**6)


class Graph():
    def __init__(self):
        self.adjacency_dict = {}
        self.counter_dict = OrderedDict()

    def add_vertex(self, v):
        self.adjacency_dict[v] = []
        self.counter_dict[v] = 0

    def add_edge(self, v1, v2):
        self.adjacency_dict[v1].append(v2)
        self.adjacency_dict[v2].append(v1)

    def add_count(self, v, count):
        self.counter_dict[v] += count

    @lru_cache
    def dfs(self, v, pv):
        for nv in self.adjacency_dict[v]:
            if nv != pv:
                self.counter_dict[nv] += self.counter_dict[v]
                self.dfs(nv, v)

    def print_counters(self):
        print(*self.counter_dict.values())


def main():
    n, q = map(int, input().split())
    tree = Graph()
    for v in range(1, n+1):
        tree.add_vertex(v)
    for _ in range(n-1):
        a, b = map(int, input().split())
        tree.add_edge(a, b)
    for _ in range(q):
        p, x = map(int, input().split())
        tree.add_count(p, x)
    tree.dfs(1, 0)
    tree.print_counters()


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
from collections import OrderedDict

input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**6)


class Graph():
    def __init__(self):
        self.adjacency_dict = {}
        self.counter_dict = OrderedDict()

    def add_vertex(self, v):
        self.adjacency_dict[v] = set()
        self.counter_dict[v] = 0

    def add_edge(self, v1, v2):
        self.adjacency_dict[v1].add(v2)
        self.adjacency_dict[v2].add(v1)

    def add_count(self, v, count):
        self.counter_dict[v] += count

    def dfs_stack(self, start):
        stack = [start]
        visited = set()

        parent_vertex = 0
        while stack:
            current_vertex = stack.pop()
            visited.add(current_vertex)
            for v in self.adjacency_dict[current_vertex]:
                if v not in visited and v != parent_vertex:
                    self.counter_dict[v] += self.counter_dict[current_vertex]
                    stack.append(v)
            parent_vertex = current_vertex

    def dfs_rec(self, v, pv):
        for nv in self.adjacency_dict[v]:
            if nv != pv:
                self.counter_dict[nv] += self.counter_dict[v]
                self.dfs_rec(nv, v)

    def print_counters(self):
        print(*self.counter_dict.values())


def main():
    n, q = map(int, input().split())
    tree = Graph()
    for v in range(1, n+1):
        tree.add_vertex(v)
    for _ in range(n-1):
        a, b = map(int, input().split())
        tree.add_edge(a, b)
    for _ in range(q):
        p, x = map(int, input().split())
        tree.add_count(p, x)
    tree.dfs_stack(1)
    # tree.dfs_rec(1, 0)
    tree.print_counters()


if __name__ == "__main__":
    main()
s = input()
print(s.count('1'))

### FIXED CODE ###

s = input()
print(s.count('1'))
A, B, K = map(int, input().split())
 
cand = []
for i in range(100,0,-1):
  if A%i == 0 and B%i == 0:
    cand += [i]
print(cand[K-1])

### FIXED CODE ###

a,b,c=map(int,input().split())
if b//a>c:
    print(c)
else:
    print(b//a)
a, b = map(int, input().split())
n = 6 - a - b
print(n)

### FIXED CODE ###

a = int(input())
b = int(input())
n = 6 - a - b
print(n)
n = int(input())
d, x = map(int,input().split())
res = x

for i in range(n):
  a = int(input())
  if a == 1:
    res +=d
  else :
    res += (d-1)//a + 1
print(res)

### FIXED CODE ###

a=int(input())
b=int(input())
c=int(input())
d=int(input())
print(min(a,b)+min(c,d))
n, x = map(int, input().split())
l = list(map(int, input().split()))

i = 0
total = 0
while total <= x:
    total += l[i]
    i += 1
print(i)


### FIXED CODE ###

n, x = map(int, input().split())
l = list(map(int, input().split()))

coutner = 1
d = 0

for i in range(n):
    d += l[i]

    if d > x:
        break
    else:
        coutner += 1


print(coutner)
s=map(int,raw_input().split())
sa=0
sb=0
sc=0
for i in range(len(s)):
  if s[i]=="a":
    sa+=1
  if s[i]=="b":
    sb+=1
  if s[i]=="c":
    sc+=1
if sa==1 and sb==1 and sc==1:
    print "Yes"
else: 
  print "No"

### FIXED CODE ###

s=raw_input()
sa=0
sb=0
sc=0
for i in range(len(s)):
  if s[i]=="a":
    sa+=1
  if s[i]=="b":
    sb+=1
  if s[i]=="c":
    sc+=1
if sa==1 and sb==1 and sc==1:
    print "Yes"
else: 
    print "No"
import fractions
n = int(input())
a = list(map(int, input().split()))
l = a[0]
for i in range(1, n): l = l // fractions.gcd(l, a[i]) * a[i]
print(sum([l // a[i] for i in range(n)]) % 1000000007)


### FIXED CODE ###

n = int(input())
c = [[0] * 10 for _ in range(10)]
ans = 0
for i in range(1, n + 1):
    l = int(str(i)[0])
    r = i % 10
    c[l][r] += 1
for i in range(10):
    for j in range(10):
        ans += c[i][j] * c[j][i]
print(ans)
#H, W = map(int,input().split())
#N = int(input())
#al = list(map(int,input().split()))
X, N = map(int,input().split())
pl = list(map(int,input().split()))

lst = [i for i in range(1,101)]

anslst = []
for n in lst:
    if not n in pl:
        anslst.append(n)


ans = 101
idx = 0
for i in range(len(anslst)):
    tmp = abs(X-anslst[i])
    if tmp < ans:
        ans = tmp
        idx = i


print(anslst[idx])

### FIXED CODE ###

#H, W = map(int,input().split())
#N = int(input())
#al = list(map(int,input().split()))
X, N = map(int,input().split())
pl = list(map(int,input().split()))

lst = [i for i in range(-101,200)]

anslst = []
for n in lst:
    if not n in pl:
        anslst.append(n)



an = 1000
idx = 0
for i in range(len(anslst)):
    tmp = abs(X - anslst[i])
    if tmp < an:
        an = tmp
        idx = i


ans = anslst[idx]
print(ans)
n,m = list(map(int,input().split()));
a = list(map(int,input().split()));
 
a.sort(reverse = True);
 
i = 0;
while 4*m*a[i] >= sum(a) and i < n:
    i += 1;
 
if i >= m :
    print('Yes');
else :
    print('No');

### FIXED CODE ###

n,m = list(map(int,input().split()));
a = list(map(int,input().split()));
 
a.sort(reverse = True);
 
i = 0;
while i<n and a[i] >= sum(a)/(4*m):
    i += 1;
 
if i >= m :
    print('Yes');
else :
    print('No');
N=int(input())
A,B=map(int,input().split())
if 9 >= A >= 1 and 9 >= B >= 1 and A*B==N:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

n=int(input())
s=0
for i in range(1,10):
  for j in range(1,10):
    if i*j==n:
      s+=1
      print('Yes')
      break
  else:
    continue
  break
if s==0:
  print('No')
# Half and Half
a,b,c,x,y = map(int,input().split())

ans = []
for i in range(max(x,y)):
    ans.append(2*c*i + a*max(0,x-i) + b*max(0,y-i))
    print(ans)

print(min(ans))

### FIXED CODE ###

# Half and Half
a,b,c,x,y = map(int,input().split())

ans = []
for i in range(max(x,y)+1):
    ans.append(2*c*i + a*max(0,x-i) + b*max(0,y-i))

print(min(ans))
4
'RRBR'

n = raw_input()
import collections
cc = collections.Counter(raw_input())
print 'Yes' if cc['R'] > cc['B']

### FIXED CODE ###

4
'RRBR'

n = raw_input()
import collections
cc = collections.Counter(raw_input())
print 'Yes' if cc['R'] > cc['B'] else 'No'
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

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 main():
    N,K = LI()
    a = LI()
    if max(a) < K:
        return 'IMPOSSIBLE'
    t = a[0]
    for i in range(1,N):
        t = math.gcd(a[i], t)
    if t == 1:
        return 'POSSIBLE'
    for c in a:
        if (c > K) and (((c-K) % t) == 0):
            return 'POSSIBLE'

    return 'IMPOSSIBLE'


print(main())





### FIXED CODE ###

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

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

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 gcd(a,b):
    while b>0:
        a,b = b,a
        b %= a
    return a

def main():
    N,K = LI()
    a = LI()
    if max(a) < K:
        return 'IMPOSSIBLE'
    if K in a:
        return 'POSSIBLE'
    t = a[0]
    for c in a[1:]:
        t = gcd(c, t)
        if t <= 1:
            return 'POSSIBLE'
    for c in a:
        if (c > K) and (((c-K) % t) == 0):
            return 'POSSIBLE'

    return 'IMPOSSIBLE'


print(main())
from math import floor
a,b=input().split()
a=int(a)
b=list(b)
b=int(b[0]+b[2:])
print(floor(a*b/100))

### FIXED CODE ###

a,b=input().split()
a=int(a)
b=int(b[0]+b[2:])
print(a*b//100)
N, D = map(int, input().strip().split())
number = 0

for i in range(N):
    X,Y = map(int, input().split())
    distance = sqrt(X*X+Y*Y)
    if distance <= D:
        number += 1

### FIXED CODE ###

import numpy

N, D = map(int, input().split())
number = 0

for i in range(N):
    X,Y = map(int, input().split())
    distance = numpy.sqrt(X*X+Y*Y)
    if distance <= D:
        number += 1
print(number)
ab=input()
a=ab.split(' ')[0]
b=ab.split(' ')[1]
print("{0} {1}".format(int(a*b),int((a+b)*2)))


### FIXED CODE ###

ab=input()
a=int(ab.split()[0])
b=int(ab.split()[1])
s=a*b
l=(a+b)*2
print("{0} {1}".format(s,l))
n=int(input())
a=[]
for i in range(n):
  m,n=(int(i) for i in input().split())
  a.append([n,m])
a.sort()
r="Yes"
s=0
for i in range(n):
  s=s+a[i][1]
  if s>a[i][0]:
    r="No"
    break
print(r)

### FIXED CODE ###

l=int(input())
a=[]
for i in range(l):
  m,n=(int(i) for i in input().split())
  a.append([n,m])
a.sort()
r="Yes"
s=0
for i in range(l):
  s=s+a[i][1]
  if s>a[i][0]:
    r="No"
    break
print(r)
s=input()
n=len(s)
ans=0
for i in range(n):
  ans.append("x")
print("",join(ans))


### FIXED CODE ###

s=input()
n=len(s)
ans=[]
for i in range(n):
  ans.append("x")
print("".join(ans))
N,M,C=map(int,input().split())
B=list(map(int,input().split())
cnt = 0
for i in range(N):
    tmp=0
    A=list(map(int,input().split())
    for j in range(M):
        tmp+=A[j]*B[j]
    tmp+=C
    if tmp>0:
        cnt+=1
    else:
        cnt+=0
print(cnt)

### FIXED CODE ###

N,M,C=map(int,input().split())
B=list(map(int,input().split()))
cnt=0
for i in range(N):
    tmp=0
    A=list(map(int,input().split()))
    for j in range(M):
        tmp+=A[j]*B[j]
    tmp+=C
    if tmp>0:
        cnt+=1
    else:
        cnt+=0
print(cnt)
s = list(int,input())
n = len(s)
a = s[n]
if a == 2 or a == 4 or a == 5 or a == 7 or a == 9:
  print('hon')
elif a == 0 or a == 1 or a == 6 or a == 8:
  print('pon')
else:
  print('bon')


### FIXED CODE ###

s = input()
n = len(s)
a = s[n-1:n]
if a == '2' or a == '4' or a == '5' or a == '7' or a == '9':
  print('hon')
elif a == '0' or a == '1' or a == '6' or a == '8':
  print('pon')
else:
  print('bon')
from sys import stdin
import numpy as np
from math import gcd


# noinspection PyShadowingBuiltinsInspection

def lcm(x, y):
    return (x * y) // gcd(x, y)

def main():
    N, M = [int(x) for x in input().split()]
    a = sorted(list({int(x) for x in input().split()}), reverse=True)
    x = a[0]
    p2 = 1
    while x % 2 == 0:
        p2 *= 2
        x //= 2
    flag = False
    y = 1 # a//2 の最小公倍数
    for i in range(len(a)):
        if a[i] % p2 != 0 or (a[i] // p2) % 2 == 0:
            flag = True
            break
        a[i] //= 2
        y = lcm(a[i], y)
    if flag:
        return 0
    z = M // y
    return z // 2 if z % 2 == 0 else z // 2 + 1
    # b = [a[0]]
    # for i in range(1, len(a)):
    #     flag = False
    #     for x in b:
    #         if x % a[i] == 0:
    #             flag = True
    #             break
    #     if not flag:
    #         b.append(a[i])
    # # print(b)
    # y = 1
    # for x in b:
    #     # print(b)
    #     y *= x
    # z = M // y
    # # print(y, z*y)
    # ret = z // 2 if z % 2 == 0 else z // 2 + 1
    # # print(ret)
    #
    # return ret


if __name__ == "__main__":
    print(main())

### FIXED CODE ###

from sys import stdin
import numpy as np
from fractions import gcd


# noinspection PyShadowingBuiltinsInspection

def lcm(x, y):
    return (x * y) // gcd(x, y)

def main():
    N, M = [int(x) for x in input().split()]
    a = sorted(list({int(x) for x in input().split()}), reverse=True)
    x = a[0]
    p2 = 1
    while x % 2 == 0:
        p2 *= 2
        x //= 2
    flag = False
    y = 1 # a//2 の最小公倍数
    for i in range(len(a)):
        if a[i] % p2 != 0 or (a[i] // p2) % 2 == 0:
            flag = True
            break
        a[i] //= 2
        y = lcm(a[i], y)
    if flag:
        return 0
    z = M // y
    return z // 2 if z % 2 == 0 else z // 2 + 1
    # b = [a[0]]
    # for i in range(1, len(a)):
    #     flag = False
    #     for x in b:
    #         if x % a[i] == 0:
    #             flag = True
    #             break
    #     if not flag:
    #         b.append(a[i])
    # # print(b)
    # y = 1
    # for x in b:
    #     # print(b)
    #     y *= x
    # z = M // y
    # # print(y, z*y)
    # ret = z // 2 if z % 2 == 0 else z // 2 + 1
    # # print(ret)
    #
    # return ret


if __name__ == "__main__":
    print(main())
N = int(input())
arr = [i for i in range(1, N + 1)]
# N == len(arr)
nums = N*[0]
for j in range(N):
    target = arr[j]
    num = 0
    while target % 2 == 0:
        num += 1
        target /= 2
    nums[j] = num
 
max = 0
for k in range(N):
    if nums[k] > max:
        max_index = k
 
print(arr[max_index])

### FIXED CODE ###

N = int(input())
arr = [i for i in range(1, N + 1)]
# N == len(arr)
nums = N*[0]
for j in range(N):
    target = arr[j]
    num = 0
    while target % 2 == 0:
        num += 1
        target /= 2
    nums[j] = num

# print(nums)

max = 0
for k in range(N):
    if nums[k] > max:
        max_index = k
        max = nums[k]
    elif N == 1:
        max_index=0
 
print(arr[max_index])
s = input()
if s[:4] < 2019 or s[:4] == 2019 and s[6] ==0 and s[7] <= 4:
  print("Heisei")
else:
  print("TBD")

### FIXED CODE ###

s = input()
 
if s <= '2019/04/30':
    print('Heisei')
else:
    print('TBD')
def main():
    INF = 10 ** 20
 
    n,k = map(int,input().split())
    height = tuple(map(int,read().split()))
    dp = [INF]*(n+1)
    dp[0] = 0
 
    for target in range(1, n):
        for step in range(1, k + 1):
            if target-step >= 0: dp[target] = min(dp[target], dp[target - step] + abs(height[target] - height[target - step]))
 
    print(dp[n-1])

if __name__ == "__main__":
    main()

### FIXED CODE ###

N,K = map(int,input().split())
h = list(map(int,input().split()))
INF = 10**10
 
dp = [INF]*N
dp[0] = 0
 
for i,hi in enumerate(h):
    if i == 0:
        continue
    s = i-K if i-K >= 0 else 0
    dp[i] = min([dpk + abs(hi-hk) for dpk,hk in zip(dp[s:i],h[s:i])])
 
print(dp[-1])
import sys

n = int(input())
r0 = int(input())
r1 = int(input())
mx = r1-r0
mn = min(r1,r0)

for i in map(int,sys.stdin.readlines()):
    if 0 < mx < i - mn:
        mx = i - mn
    elif 0 > i-mn > max:
        mx = i - mn
        mn = i
    elif mn > i:
        mn = i

print(mx)

### FIXED CODE ###

import sys

n = int(input())
r0 = int(input())
r1 = int(input())
mx = r1-r0
mn = min(r1,r0)

for i in map(int,sys.stdin.readlines()):
    if mx < i - mn:
        mx = i - mn
        if 0 > i-mn:
            mn = i
    elif mn > i:
        mn = i

print(mx)
n=int(input())
A=list(map(int, input().split()))

L=[0]*2*n
c=0

for i,a in enumerate(A):
  L[i+a]+=1
  c+=L[i-a]

print(c)


### FIXED CODE ###

n=int(input())
A=list(map(int, input().split()))
d={}
c=0

for i,a in enumerate(A):
  if i+a not in d:
    d[i+a]=1
  else:
    d[i+a]+=1
  if i-a in d:
    c+=d[i-a]

print(c)
N = input()
num = int(N)
Nls = list(N)
sum1 = sum(Nls)
if num%sum1 == 0:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

N = input()
num = int(N)
Nls = list(N)
sum1 = sum([int(i) for i in Nls])
if num%sum1 == 0:
  print('Yes')
else:
  print('No')
k = int(input())
s = intput()

if len(s) <= k 
print(s)

if len(s) >= k
print(s[:k]+'...')

### FIXED CODE ###

k = int(input())
s = input()
n = len(s)
     
if n <= k:
	print(s)
else:
	print(s[:k] + '...')
import sys
import numpy as np
from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix
sys.setrecursionlimit(10**7)
n, m = [int(i) for i in sys.stdin.readline().split()]
INF = 10**9
graph = np.ones(shape=(n,n)) * INF
for i in range(m):
    l, r, c = [int(i) for i in sys.stdin.readline().split()]
    l -= 1
    r -= 1
    graph[l][:r+1] = np.where(graph[l][:r+1] < c, graph[l][:r+1], np.ones_like(graph[l][:r+1]) * c)
graph = np.where(graph == INF, np.zeros_like(graph), graph)
graph = csr_matrix(graph)
res = dijkstra(graph, indices=[0])
print(int(res[0][-1]) if res[0][-1] < INF else -1)


### FIXED CODE ###

import sys
import heapq
sys.setrecursionlimit(10**7)
n, m = [int(i) for i in sys.stdin.readline().split()]
INF = 10**9
graph = {j:[(j-1, 1e-10)] if j > 0 else [] for j in range(n)}
for i in range(m):
    l, r, c = [int(i) for i in sys.stdin.readline().split()]
    l -= 1
    r -= 1
    graph[l].append((r, c))
    graph[r].append((l, c))
que = [(0,0)]
already = set()
res = [-1 for i in range(n)]
while len(que) > 0:
    cost, cand = heapq.heappop(que)
    if cand in already:
        continue
    res[cand] = cost
    already.add(cand)
    for _next, _next_cost in graph[cand]:
        if _next in already:
            continue
        heapq.heappush(que, (cost + _next_cost, _next))
print(int(res[-1]))
n=int(input())
max=-1000001;min=1000001;g=0;i=0;
num=[]
while i<n:
 num.append(int(input().split()))
 i=i+1
for x in num:
 if max<x:
  max=x
 if min>x:
  min=x
 g+=x
print(min,max,g)


### FIXED CODE ###

n=int(input())
max=-1000001;min=1000001;g=0;i=0;
num=list(map(int,input().split()))
for x in num:
 if max<x:
  max=x
 if min>x:
  min=x
 g+=x
 i+=1
print(min,max,g)
s=input()
if s=='SUN'
  print(7)
if s=='MON'
  print(6)
if s=='TUE'
  print(5)
if s=='WED'
  print(4)
if s=='THU'
  print(3)
if s=='FRI'
  print(2)
if s=='AST'
  print(1)

### FIXED CODE ###

s=input()
if s=="SUN":
  print(7)
if s=="MON":
  print(6)
if s=="TUE":
  print(5)
if s=="WED":
  print(4)
if s=="THU":
  print(3)
if s=="FRI":
  print(2)
if s=="SAT":
  print(1)
a,b,c=map(int,input().split())
if a==b:
   print "Yes"
elif a==c:
   print "Yes"
elif b==c:
   print "Yes"
else:
   print "No"

### FIXED CODE ###

a,b,c=map(int,input().split())
if a==b and b==c:
  print("No") 
elif a==b:
   print ("Yes")
elif a==c:
   print ("Yes")
elif b==c:
   print ("Yes")
else:
   print ("No")
def gcd(a, b):
    while b: a, b = b, a % b
    return a

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm_list(numbers, N):

    ans = numbers[0]

    for i in range(1,N):
        ans = lcm_base(ans,numbers[i])

    return ans

N ,M = map(int, input().split())
A_n = list(map(int,input().split()))

a_lcm = lcm_list(A_n,N)
ans = 0
interval = a_lcm//2

amari = M // interval

if amari%2 == 1:
    amari = (amari+1)//2
else:
    amari = amari//2
print(amari)


### FIXED CODE ###

A,B = map(int, input().split())

ans  = 500*A - B

if ans >= 0:
    print("Yes")
else:
    print("No")
Q =input()
if Q.count(R)==3:
    print(3)
elif Q.count(R)==0:
    print(0)
elif Q.count(R)==1:
    print(1)
elif Q.count(R)==2:
    if Q.[2] =='S'
    print(1)
    else :
        print(2)

### FIXED CODE ###

Q =input()
if Q.count('R')==3:
    print(3)
elif Q.count('R')==0:
    print(0)
elif Q.count('R')==1:
    print(1)
elif Q.count('R')==2:
    if Q[1] =='S':
        print(1)
    else :
        print(2)
S=input()
Q=[s for s in S if s != 'A']
U=list('KIHBR')
import sys
if S.count('A')>4:
    print('NO')
else:
    for i in range(len(S)-1):
        if S[i]==S[i+1]:
            print('NO')
            sys.exit()
        elif S[i]=='K' and S[i+1]!='I':
            print('NO')
            sys.exit()
    for i in range(len(S)):
        if Q[i]==U[i]:
            pass
        else:
            print('NO')
            break
    else:
        print('YES')

### FIXED CODE ###

S=input()
Q=[s for s in S if s != 'A']
U=list('KIHBR')
import sys
if S.count('A')>4:
    print('NO')
    sys.exit()
elif len(Q)!=5:
    print('NO')
    sys.exit()
for i in range(len(S)):
    if S[i] not in list('AKIHABARA'):
        print('NO')
        sys.exit()
for i in range(len(S)-1):
    if S[i]==S[i+1]:
        print('NO')
        sys.exit()
    elif S[i]=='K' and S[i+1]!='I':
        print('NO')
        sys.exit()
    elif S[i]=='I' and S[i+1]!='H':
        print('NO')
        sys.exit()
for i in range(len(U)):
    if Q[i]==U[i]:
        pass
    else:
        print('NO')
        break
else:
    print('YES')
n,P=map(int,input().split())
A=[]
for i in range(2,10**6+1):
  if P%(i**n)==0:
    A.append(i)
for i in range(2,10**3+1):
  if P%(i**(2*n))==0:
    A.append(i)
for i in range(2,101):
  if P%(i**(3*n))==0:
    A.append(i)
for i in range(2,33):
  if P%(i**(4*n))==0:
    A.append(i)
for i in range(2,30):
  if P%(i**(5*n))==0:
    A.append(i)




if P==10**12:
  A.append(10)
print(max(A))

### FIXED CODE ###

n,P=map(int,input().split())
if n==1:
	print(P)
	exit()
if n>39:
  print(1)
  exit()
ans=1
if n==2:
	for i in range(2,10**6+1):
		while P%(i**2)==0:
			ans*=i
			P/=(i**n)
	
if n==3:
	for i in range(2,10**4+1):
		while P%(i**3)==0:
			ans*=i
			P/=(i**n)
	
if n==4:
	for i in range(2,10**3+1):
		while P%(i**4)==0:
			ans*=i
			P/=(i**n)
	  
if n==5:
	for i in range(2,int(10**2.4)+1):
		while P%(i**5)==0:
			ans*=i
			P/=(i**n)
else:
	for i in range(2,101):
		while P%(i**n)==0:
			ans*=i
			P/=(i**n)
print(ans)
# encoding: utf-8

import sys
from collections import deque


class Solution:
    @staticmethod
    def doubly_linked_list():
        # write your code here
        array_length = int(input())
        _input = sys.stdin.readlines()
        task_list = list(map(lambda x: dict(action=x.split()[0], value=int(x.split()[-1])), _input))
        task_deque = deque()
        for task in task_list:
            if task.get('action')=='insertion':
                task_deque.appendleft(task.get('value'))
            else:
                task_deque.remove(task.get('value'))

        print(" ".join(map(str, task_deque)))
        assert len(task_deque) <= array_length

if __name__ == '__main__':
    solution = Solution()
    solution.doubly_linked_list()

### FIXED CODE ###

# encoding: utf-8

import sys
from collections import deque


class Solution:
    @staticmethod
    def doubly_linked_list():
        # write your code here
        array_length = int(input())
        task_deque = deque()
        _input = sys.stdin.readlines()

        for i in range(array_length):
            l_arg = _input[i].split()
            action = l_arg[0]
            if len(l_arg) > 1:
                value = l_arg[-1]
            # print(action, 'v', value)

            if action == 'insert':
                task_deque.appendleft(value)
            elif action == 'deleteFirst':
                task_deque.popleft()
            elif action == 'deleteLast':
                task_deque.pop()
            else:
                try:
                    task_deque.remove(value)
                except Exception as e:
                    pass
        print(" ".join(task_deque))


if __name__ == '__main__':
    solution = Solution()
    solution.doubly_linked_list()
x = int(input())

if (x % 100) / (x // 100) > 5:
    print(0)
else:
    print(1)

### FIXED CODE ###

x = int(input())
v = x // 100
modv = x % 100
if v > 0 and (modv == 0 or modv / v <= 5):
    print(1)
else:
    print(0)
K,S=map(int,input().split())
ans = 0
for x in range(K):
    for y in range(K):
        z = S - x - y
        if z >= 0 and Z <= K:
            ans += 1
print(ans)

### FIXED CODE ###

K,S=map(int,input().split())
ans = 0
z = 0
for x in range(K+1):
    for y in range(K+1):
        z = S - x - y
        if z >= 0 and z <= K:
            ans += 1
print(ans)