Harryxun/stf_run huggingface dataset:
import sys
from decimal import Decimal

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():
    N, K = in_nn()
    A = in_nl()
    mod = 10 ** 9 + 7

    Am = []
    Ap = []

    for i in range(N):
        if A[i] < 0:
            Am.append(A[i])
        elif A[i] >= 0:
            Ap.append(A[i])

    Ap = list(sorted(Ap, reverse=True))
    Am = list(sorted(Am))

    Nm = len(Am)
    Np = len(Ap)

    if Nm == 0:
        ans = 1
        for i in range(K):
            ans *= Ap[i]
            ans %= mod
    elif Nm == 1:
        if Nm + Np == K:
            ans = Am[0]
            for i in range(K - 1):
                ans *= Ap[i]
                ans %= mod
        else:
            ans = 1
            for i in range(K):
                ans *= Ap[i]
                ans %= mod
    elif Np == 0:
        if K % 2 == 0:
            ans = 1
            for i in range(K):
                ans *= Am[i]
                ans %= mod
        else:
            ans = 1
            for i in range(K):
                ans *= Am[Nm - 1 - i]
                ans %= mod
    else:
        if K % 2 == 0:
            if Np % 2 == 0:
                pi = Np
                mi = 0
            else:
                pi = Np - 1
                mi = 2
        else:
            if Np % 2 == 0:
                pi = Np - 1
                mi = 2
            else:
                pi = Np
                mi = 0
        rate = Decimal(1)
        max_rate = Decimal(1)
        max_i = (pi, mi)
        while True:
            pi -= 2
            mi += 2
            if pi >= 0 and mi <= Nm:
                tm = Decimal(Am[mi - 2] * Am[mi - 1])
                tp = Decimal(Ap[pi - 1] * Ap[pi])
                rate *= tm / tp
                if max_rate < rate:
                    max_rate = rate
                    max_i = (pi, mi)
            else:
                break
        pi, mi = max_i
        ans = 1
        for i in range(pi):
            ans *= Ap[i]
            ans %= mod
        for i in range(mi):
            ans *= Am[i]
            ans %= mod

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7

mia = sorted([i for i in a if i < 0], reverse=True)
pla = sorted([i for i in a if i >= 0])

cnt = 1
if len(pla) == 0 and k % 2 == 1:
    for i in mia[:k]:
        cnt = cnt * i % mod
    print(cnt)
    exit()

while k > 0:
    if k == 1 or len(mia) <= 1:
        if len(pla) == 0:
            cnt *= mia.pop()
        elif len(pla) > 0:
            cnt *= pla.pop()
        k -= 1
    elif len(pla) <= 1:
        cnt *= mia.pop() * mia.pop()
        k -= 2
    elif pla[-1] * pla[-2] > mia[-1] * mia[-2]:
        cnt *= pla.pop()
        k -= 1
    elif pla[-1] * pla[-2] <= mia[-1] * mia[-2]:
        cnt *= mia.pop() * mia.pop()
        k -= 2
    cnt %= mod
else:
    print(cnt)
import sys
input = lambda: sys.stdin.readline().rstrip()
from math import gcd
a,b,c,d=map(int,input().split())
ans=(b-a+1)
lcm=(c*d)//gcd(c,d)
dba=(a//c-int(a%c==0))+(a//d-int(a%d==0))-(a//lcm-int(a%lcm==0))
dbb=(b//c)+(b//d)-(b//lcm)
dbb-=dba
ans-=dbb
print(ans)
            
        
        
        

### FIXED CODE ###

from fractions import gcd
a,b,c,d=map(int,input().split())
ans=(b-a+1)
lcm=(c*d)//gcd(c,d)
dba=(a//c-int(a%c==0))+(a//d-int(a%d==0))-(a//lcm-int(a%lcm==0))
dbb=(b//c)+(b//d)-(b//lcm)
dbb-=dba
ans-=dbb
print(ans)
S=input()
if S == Sunny:
  print(Cloudy)
  elif S == Cloudy:
    print(Rainy)
    else
    	print(Sunny)
    	

### FIXED CODE ###

S=input()
if S == "Sunny":
	print("Cloudy")
elif S == "Cloudy":
	print("Rainy")
else:
	print("Sunny")
h,w = map(int,input(),split())
for i in range(h):
    a = input().split()
    for j in range(w):
        if a[j] == "snuke":
            print(chr(ord('A') + j)+str(i))
            break

### FIXED CODE ###

H, W = map(int, input().split())
S = [list(input().split()) for _ in range(H)]
for i in range(H):
    for j in range(W):
        if S[i][j] == 'snuke':
            print(chr(ord('A') + j) + str(1 + i))
            break
x,a,b=map(int,input().split());print(("delicious,"safe","dangerous")[(b-a>0)+(b-a>x)])

### FIXED CODE ###

x,a,b=map(int,input().split());print(("delicious","safe","dangerous")[(b-a>0)+(b-a>x)])
s = input()

alp = [chr(i) for i in range(97, 97+26)]

flag = [False for i in range(26)]

for c in s:
    for i in range(26):
        if c == alp[i]:
            flag[i] = True


def pr():
    for i in range(26):
        if flag[i] == False:
            return alp[i]

    return 'None'

print(pr())


### FIXED CODE ###

s = input()

alp = [chr(i) for i in range(97, 97+26)]

flag = [False for i in range(26)]

for c in s:
    flag[ord(c) - ord("a")] = True


def pr():
    for i in range(26):
        if not flag[i]:
            print(alp[i])
            return

    print('None')
    return

pr()
n-int(input())
print((n+1)//2)

### FIXED CODE ###

n = int(input())
print((n - 1) // 2 + 1)
def routing(x, y, z = 0):
    route = ""
    for i in range(2):
        if z:
            if dy:
                route += "D"
            else:
                route += "U"
        if x:
            route += "R"*(dx+z)
            x = not x
        else:
            route += "L"+(dx+z)
            x = not x
        if y:
            route *= "U"*(dy+z)
            y = not y
        elif y:
            route *= "D"*(dy+z)
            y = not y
        if z:
            if dx:
                route += "L"
            else:
                route += "R"
    return route

sx, sy, tx, ty = map(int, input().split())
route =""
dx = tx-sx
dy = ty-sy
x = dx>0
y = dy>0
route += routing(dx,dy)
route += routing(dx,dy,1)
print(route)

### FIXED CODE ###

sx, sy, tx, ty = map(int, input().split())
route = ""
dx, dy = tx - sx, ty - sy
path1 = "R" * dx + "U" * dy
path2 = "L" * dx + "D" * dy
dx, dy = dx + 1, dy + 1
path3 = "D" + "R" * dx + "U" * dy + "L"
path4 = "U" + "L" * dx + "D" * dy + "R"
ans =path1 + path2 + path3 + path4
print( ans)
import math


def median(array):
    if N % 2:
        return array[N // 2]
    else:
        return sum(array[N // 2 - 1: N // 2 + 1]) / 2


N = int(input())
A, B = [], []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
x = median(A)
y = median(B)
if N % 2:
    print(y - x + 1)
else:
    temp = math.ceil(y) - math.floor(x)
    print(2 * temp + 1))


### FIXED CODE ###

import math


def median(array):
    if N % 2:
        return array[N // 2]
    else:
        return sum(array[N // 2 - 1: N // 2 + 1])


N = int(input())
A, B = [], []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
A.sort()
B.sort()
x = median(A)
y = median(B)
print(y - x + 1)
n ,m = int(input())

if n == m:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

n ,m = map(int,input().split())
 
if n == m:
  print("Yes")
else:
  print("No")
moji=input()

if moji.count('R')==0
  print(0)
if moji.count('R')==1
  print(1)
if moji.count('R')==2 and moji.count('RR')!=1
  print(1)
if moji.count('RR')==1
  print(2)
if moji.count('RRR')==1
  print(3)
  

### FIXED CODE ###

S=str(input())
 
if S.count('R')==0:
  print(0)
if S.count('R')==1 :
  print(1)
if S.count('R')==2 and not S.count('RR') ==1:
  print(1)
if S.count('RR')==1 and not S.count('RRR')==1:
  print(2)
if S.count('RRR')==1:
  print(3)
L,R=map(int, input().split())
from itertools import permutations, combinations,combinations_with_replacement,product
for 
if (R+1-L)<2019:
  LR = range(L,R+1)
  LRA = []
  for i in LR:
    LRA.append(i%2019)
  LRAA = set(LRA)
  C = combinations(LRAA, 2)
  Ret = 2019
  for i in list(C):
    Ret = min(Ret,(i[0]*i[1])%2019)
else:
  Ret = 0
print(Ret)

### FIXED CODE ###

L,R=map(int, input().split())
LR = range(L,R+1)
from itertools import permutations, combinations,combinations_with_replacement,product
if (R+1-L)<2019:
  C = combinations(LR, 2)
  Ret = 2019
  for i in list(C):
    Ret = min(Ret,(i[0]*i[1])%2019)
else:
  Ret = 0
print(Ret)
n=int(input())
a=list(map(int,input().split()))

from collections import Counter
a=Counter(a).most_common()

li=[]
li4=[]

for x,y in a:
  if  y>=4:
    li4.append(x)
  elif y>=2:
    li.append(x)

li.sort()
li4.sort()

if len(li4)<1 and len(li)<2:
  print(0)
  exit()

x=0
if li4:
  x=(li4[-1])**2

y=li[-1]*li[-2]

print(max(x,y))

### FIXED CODE ###

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

from collections import Counter
a=Counter(a)
a=sorted(a.items(), reverse=True)

x=0
y=0

for p,q in a:
  if q>=4:
    if x==0:
      x=y=p
      break
    else:
      y=p
      break
  elif q>=2:
    if x==0:
      x=p
    else:
      y=p
      break
print(x*y)
i = list(map(int, input().split()))
HH = i[0]
WW = i[1]
atai = HH*WW
amari=divmod(atai,2)
ans = int(atai/2) + amari[1]
print (ans)

### FIXED CODE ###

array=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = input()
ki=int(k)-1
print(array[ki])
print(int(int(input)/3))

### FIXED CODE ###

print(int(int(input())/3))
import itertools
def calc_num(S,S_len):
  result = 0;
  l = [3,5,7];
  i = 3;
  while i <= S_len
  	for v in itertools.product(l,repeat=i):
      if int("".join(map(str,v))) <= S and list(srt(v) & set(l)) == l;
        result = result + 1;
    i = i + 1;
  return result
  
S = list(map(int,input()))
S_len = len(S)
S = int("".join(map(str, S)));
result = calc_num(S,S_len);
print(result)

### FIXED CODE ###

import itertools
def calc_num(S,S_len):
  result = 0;
  l = [3,5,7];
  i = 3;
  while i <= S_len:
    for v in itertools.product(l,repeat=i):
      if int("".join(map(str,v))) <= S and list(set(v) & set(l)) == l:
        result = result + 1;
    i = i + 1;
  return result
  
S = list(map(int,input()));
S_len = len(S);
S = int("".join(map(str, S)));
result = calc_num(S,S_len);
print(result)
n = int(input())
s = str(input())
k = int(input())

a = []

for i in range(n):
  if s[i] == s[k]:
    a.append(s[k])
  else:
    a.append("*")

print(a)

### FIXED CODE ###

n = int(input())
s = input()
k = int(input())
 
a = ""
 
for i in range(n):
  if s[i] == s[k-1]:
    a = a + s[k-1]
  else:
    a = a + "*" 
print(a)
n=int(input())
d_list=map(int,inout().spllit())
count=0
for i in range(n):
  count-=d_list[i]
  for j in range(n):
    count+=d_list[i]*d_list[j]
print(count)

### FIXED CODE ###

n=int(input())
d_list=list(map(int,input().split()))
count=0
for i in range(n):
  for j in range(n):
    if i<j:
        count+=d_list[i]*d_list[j]
print(count)
import sys
input = sys.stdin.readline
import numpy as np

def main():
    N, K = map(int,input().split())
    A = np.sort(np.array(list(map(int, input().split())), np.int64))
    z = A[A == 0]
    p = A[A > 0]
    n = A[A < 0]
    
    def count_func(x):
        cnt = 0
        if x >= 0:
            cnt += len(z) * N
        cnt += np.searchsorted(A, x // p, side='right').sum()
        cnt += (N - np.searchsorted(A, -(-x // n), side='left')).sum()
        cnt -= np.count_nonzero(A * A <= x)
        assert cnt % 2 == 0
        return cnt // 2
    
    l = -10 ** 18
    r = 10 ** 18
    while l + 1 < r:
        x = (l + r) // 2
        if count_func(x) >= K:
            r = x
        else:
            l = x
    
    print(r)
    
if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline
import numpy as np

def main():
    N, K = map(int,input().split())
    A = np.sort(np.array(list(map(int, input().split())), np.int64))
    z = A[A == 0]
    p = A[A > 0]
    n = A[A < 0]
    
    def count_func(x):
        cnt = 0
        if x >= 0:
            cnt += len(z) * N
        cnt += np.searchsorted(A, x // p, side='right').sum()
        cnt += (N - np.searchsorted(A, -(-x // n), side='left')).sum()
        cnt -= np.count_nonzero(A * A <= x)
        assert cnt % 2 == 0
        return cnt // 2
    
    l = -10 ** 18
    r = 10 ** 18
    while l + 1 < r:
        x = (l + r) // 2
        if count_func(x) >= K:
            r = x
        else:
            l = x
    
    print(r)
    
if __name__ == '__main__':
    main()
inputs = list(map(int, inpit().split()))

A = input[0]
B = input[1]
T = input[2]

Q = int(T / A)
print(Q)
X = Q* B
print(X)


### FIXED CODE ###

inputs = list(map(int, input().split()))
 
A = inputs[0]
B = inputs[1]
T = inputs[2]
 
Q = int(T / A)
#print(Q)
X = Q* B
print(X)
W = input()
count = 0
while True:
    line = input()
    if line == 'END_OF_TEXT':
        break

    for s in line.lower.split():
        if s == W:
            count += 1
print(count)

### FIXED CODE ###

W = input()
count = 0
while True:
    line = input()
    if line == 'END_OF_TEXT':
        break

    for s in line.lower().split():
        if s == W:
            count += 1
print(count)
import numpy as np
from sys import stdin
input = stdin.readline
N = int(input())
A = list(map(str, input().split()))
A = np.array(A)
number = np.zeros(N, dtype = int)
for i in range(N):
  number[i] = A.count(str(i + 1))
total = 0
for k in range(N):
  tmp = number[k]
  total += tmp * (tmp-1) // 2
for j in range(N):
  print(total - number[A[j]-1] + 1)


### FIXED CODE ###

import numpy as np
from sys import stdin
input = stdin.readline
N = int(input())
A = list(map(int, input().split()))
number = np.zeros(N, dtype = int)
total = 0

dic = {}
a = sorted(A)
now_key = a[0]
value = 1
dic[now_key] = 1
for i in range(1,N):
  if a[i] == now_key:
    value += 1
  else:
    dic[now_key] = value
    if value >= 2:
      total += value * (value-1) // 2
    now_key = a[i]
    value = 1
dic[now_key] = value
if value >= 2:
  total += value * (value-1)//2
for j in A:
  print(total - dic[j] + 1)
import numpy as np
import itertools
 
H, W, K = list(map(int, input().split())) 
C = []
for i in range(H):
    C.append([input().replace(".","0").replace("#","1")])
    

C = int(C)
C_arr = np.array(C)
 
In = np.array(list(itertools.product([0,1] , repeat=H)))
Out = np.array(list(itertolls.product([0,1] , repeat=W)))
 
ans = 0
for i in range(2**H):
  for j in range(2**W):
    In_matrix = np.diag(In[i])
    Out_matrix = np.diag(Out[j])
    
    In_C = np.dot(In_matrix , C_arr)
    In_C_Out = np.dot(In_C , Out_matrix)
    
    ICO = In_C_Out.flatten()
    ICO = ICO.tolist()
    
    if ICO.count(1) == K:
      ans += 1
      
print(ans)

### FIXED CODE ###

H, W, K = list(map(int, input().split()))
 
c = [list(input()) for i in range(H)]
 
cnt = 0
for i in range(2**H):
    for j in range(2**W):
        cnt_black = 0
        for k in range(H):
            if (i >> k) & 1:
                continue
            for l in range(W):
                if (j >> l) & 1:
                    continue
                if c[k][l] == '#':
                    cnt_black += 1
        if cnt_black == K:
            cnt += 1
 
print(cnt)
import sys
import itertools
import networkx as nx
H, W = [int(_) for _ in input().split()]
S = b''.join(sys.stdin.buffer.read().split())

source = 2 * H * W
sink = source + 1

INF = 10**12

graph = nx.DiGraph()


def add(start, end, cap):
    graph.add_edge(start, end, capacity=cap)


for i in range(H * W):
    x, y = divmod(i, W)
    if S[i] == ord('.'):
        add(2 * i, 2 * i + 1, 1)
    else:
        add(source, 2 * i + 1, INF)
    for dx, dy in ((1, 0), (-1, 0), (0, 1), (0, -1)):
        x1, y1 = x + dx, y + dy
        if 0 <= x1 < H and 0 <= y1 < W:
            j = x1 * W + y1
            add(2 * i + 1, 2 * j, 1)
        else:
            add(2 * i + 1, sink, INF)
ans = nx.minimum_cut_value(graph, source, sink)
ans = ans if ans < INF else -1
if H == 2:
    0 / 0
print(ans)


### FIXED CODE ###

import sys
import itertools
from scipy.sparse import csr_matrix, lil_matrix
from scipy.sparse.csgraph import maximum_flow

H, W = map(int, sys.stdin.buffer.readline().split())
S = b''.join(sys.stdin.buffer.read().split())

source = 2 * H * W
sink = source + 1

INF = source * 2

graph = lil_matrix((sink + 1, sink + 1), dtype=int)

for i in range(H * W):
    x, y = divmod(i, W)
    if S[i] == ord('.'):
        graph[2 * i, 2 * i + 1] = 1
    else:
        graph[source, 2 * i + 1] = INF
    for dx, dy in ((1, 0), (-1, 0), (0, 1), (0, -1)):
        x1, y1 = x + dx, y + dy
        if 0 <= x1 < H and 0 <= y1 < W:
            j = x1 * W + y1
            graph[2 * i + 1, 2 * j] = 1
        else:
            graph[2 * i + 1, sink] = INF
graph = graph.tocsr()
ans = maximum_flow(graph, source, sink).flow_value
ans = ans if ans < INF else -1
print(ans)
# coding: utf-8
 
pre_list = list(input().rstrip().split(""))
N = pre_list[0]
A = pre_list[1]
N = pre_list[2]

S  = input()
 
for i in range(N):
    if S[i] == "c":
        print("No")
    elif S[i] == "a":
        if i < A+B:
            print("Yes")
        else:
            print("No")
    elif S[i] == "b":
        if i < B:
            print("Yes")
        else:
            print("No") 

### FIXED CODE ###

N, A, B = map(int, input().split())
S = input()
count = 0
count2 = 0


for i in range(N):
    if S[i] == "c":
        print("No")
    elif S[i] == "a":
        
        if count < A+B:
            print("Yes")
            count += 1
        else:
            print("No")
    elif S[i] == "b":
        
        if count < A+B and count2 < B:
            print("Yes")
            count += 1
            count2 += 1
        else:
            print("No")
import sys
input = sys.stdin.readline

x = input()
print('A' if ord(x)<97 else 'a')

### FIXED CODE ###

import sys
input = sys.stdin.readline

x = input()
print('A' if x.isupper() else 'a')
#129c
N,M = map(int, input().split())

now_step = 0
ans = 1
calculated_jump = {}
mod_number = 1000000007 

#開いている段数の移動パターンを算出する関数
def jump(now_step):
    
    if now_step in calculated_jump:
        return calculated_jump[now_step]
    else:
        if now_step == 2:
            return 2
        elif now_step == 1:
            return 1
        else:
            if now_step not in calculated_jump:
                calculated_jump[now_step] = jump(now_step-1) + jump(now_step-2)
                return jump(now_step-1) + jump(now_step-2)

for _ in range(M):
    a = int(input())
    
    if a == now_step:
        print("0")
        break
    elif a - 1 - now_step != 0: #左記成立時は1通りしかない。
        target_step_count = a - 1 - now_step #aは踏んではいけない段なので、その前がターゲット
        ans = ans * jump(target_step_count)
            
    now_step = a + 1

else:
    if now_step != N:
        target_step_count = N - now_step
        ans = ans * jump(target_step_count)
    
    print(ans % mod_number)

### FIXED CODE ###

#129c
import sys
sys.setrecursionlimit(1000000)

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

now_step = 0
ans = 1
calculated_jump = {}
mod_number = 1000000007 

#開いている段数の移動パターンを算出する関数
def jump(now_step):
    
    if now_step in calculated_jump:
        return calculated_jump[now_step]
    else:
        if now_step == 2:
            return 2
        elif now_step == 1:
            return 1
        else:
            if now_step not in calculated_jump:
                calculated_jump[now_step] = jump(now_step-1) + jump(now_step-2)
                return jump(now_step-1) + jump(now_step-2)

for _ in range(M):
    a = int(input())
    
    if a == now_step:
        print("0")
        break
    elif a - 1 - now_step != 0: #左記成立時は1通りしかない。
        target_step_count = a - 1 - now_step #aは踏んではいけない段なので、その前がターゲット
        ans = ans * jump(target_step_count) % mod_number
            
    now_step = a + 1

else:
    if now_step != N:
        target_step_count = N - now_step
        ans = ans * jump(target_step_count) % mod_number
    
    print(ans)
N = int(input())
S = input()

ans = S.count("R") * S.count("G") * S.count("B")

res = 0
for i in range(N-2):
    for d in range(1, (N-i)//2+1):
        if set(S[i], S[i+d], S[i+2*d]) == {"R", "G", "B"}:
            res += 1
ans -= res
print(ans)


### FIXED CODE ###

N = int(input())
S = input()
ans = S.count("R") * S.count("G") * S.count("B")

for i in range(N-2):
    for d in range(1, (N-i-1)//2+1):
        if {S[i], S[i+d], S[i+2*d]} == {"R", "G", "B"}:
            ans -= 1

print(ans)
d = list(map(int, input().split()))
N = d[0]
A = d[1]
B = d[2]

if N*A >= B :
    return(N*A)
else:
    return(B)

### FIXED CODE ###

d = list(map(int, input().split()))
N = d[0]
A = d[1]
B = d[2]

if N*A >= B :
    print(B)
else:
    print(N*A)
from collections import deque
import sys
import numpy as np

input = sys.stdin.readline
H, W = map(int, input().split())

maze = np.zeros((H, W), dtype='int')


for y in range(H):
    for x, s in enumerate(input()):
        if s=="#":
            maze[y][x] = 1


def bfs(x, y):
    queue = deque([(x, y, 0)])
    visited = np.zeros_like(maze, dtype='int') 

    max_cost = 0
    while queue:
        px, py, cost = queue.popleft()
        max_cost = max(max_cost, cost)

        candidate = ((px + 1, py), (px - 1, py), (px, py + 1), (px, py - 1))
        visited[py][px] = 1
        for cx, cy in candidate:
            if 0 <= cx < W and 0 <= cy < H and visited[cy][cx] == 0 and maze[cy][cx] == 0:
                queue.append((cx, cy, cost + 1))
    
    return max_cost


ans = 0
for y in range(H):
    for x in range(W):
        if maze[y][x] == 0:
            ans = max(ans, bfs(x, y))

print(ans)

### FIXED CODE ###

H, W = map(int, input().split())
m = [list(input()) for _ in range(H)]
inf = 10**3

V = H*W
maze = [[inf]*V for _ in range(V)]

for i in range(V):
    maze[i][i] = 0

for py in range(H):
    for px in range(W):
        if m[py][px] == "#":
            continue
        candidate = [(px+1, py), (px-1, py), (px, py+1), (px, py-1)]
        for x, y in candidate:
            if not (0<=x<W and 0<=y<H):continue
            if m[y][x] == "#":
                continue
            maze[W*py+px][W*y+x] = 1

for k in range(V):
    for i in range(V):
        for j in range(V):
            maze[i][j] = min(maze[i][j], maze[i][k]+maze[k][j])

print(max([j for i in maze for j in i if j!=inf]))
n=int(input())
s=input()
t=input()
for i in range(n):
  print(s[i],end="")
  print(t[i],end="")


### FIXED CODE ###

n=int(input())
s,t=input().split()
for i in range(n):
  print(s[i],end="")
  print(t[i],end="")
S = input()
l = len(S)
distance = 999
for i in range(l)
    num = int(S[i:i+3])
    if abs(num - 753) < distance:
        distance = abs(num - 753)
print(str(distance))

### FIXED CODE ###

S = input()
l = len(S)
distance = 999
for i in range(l):
    num = int(S[i:i+3])
    if abs(num - 753) < distance:
        distance = abs(num - 753)
print(str(distance))
a,b,c=input().split()
print('YES' if a[-1]=b[0] and b[-1]=c[0] else "NO")


### FIXED CODE ###

a,b,c=input().split()
print('YES' if a[-1]==b[0] and b[-1]==c[0] else "NO")
import math
a,b,c = map(int,input().split())
if c*c - (a + b + 2*math.sqrt(a*b))**2>0:
  print("Yes")
else:
  print("No")


### FIXED CODE ###

l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
n = int(input())
print(l[n-1])