Harryxun/stf_run huggingface dataset:
def dfs(x,y,ch):
	field[x][y] = '.'
	for i in range(4):
			nx = x+moveY[i]
			ny = y+moveX[i]
			if (nx >= 0 and ny >= 0) and(nx < H and ny < W) and field[nx][ny] == ch:
				if field[nx][ny] == '#' or field[nx][ny] == '*'or field[nx][ny] == '@':
					dfs(nx,ny,field[nx][ny])
if __name__ == '__main__':
	moveY = [-1,0,1,0]
	moveX = [0,1,0,-1]
	H,W = map(int,raw_input().split(' '))
	field = ['' for i in range(H)]
	h = 0
	while True:
		s = raw_input()
		if s == '0 0':
			break
		field[h] = list(s)
		h += 1
	correct =0
	for i in range(H):
		for j in range(W):
			if field[i][j] == '@' or field[i][j] == '#'or field[i][j] == '*':
				dfs(i,j,field[i][j])
				correct += 1
	print correct

### FIXED CODE ###

def dfs(X,Y,ch):
	stack.append([X,Y])
	field[X][Y] = '.'
	while len(stack) > 0:
		x,y = stack.pop()
		for i in range(4):
				nx = x+moveY[i]
				ny = y+moveX[i]
				if nx < 0 or ny < 0 or nx >= H or ny >= W or field[nx][ny] != ch:
					continue
				if field[nx][ny] == '#' or field[nx][ny] == '*'or field[nx][ny] == '@':
					field[nx][ny] = '.'
					stack.append([nx,ny])
stack = []
moveY = [-1,0,1,0]
moveX = [0,1,0,-1]
while True:
	H,W = map(int,raw_input().split(' '))
	if H == 0 and W == 0:
		break
	field = [list(raw_input()) for i in range(H)]
	correct =0
	for i in range(H):
		for j in range(W):
			if field[i][j] == '@' or field[i][j] == '#'or field[i][j] == '*':
				dfs(i,j,field[i][j])
				correct += 1
	print correct
import sys
import math
import itertools
import collections
import numpy as np

rl = sys.stdin.readline

n, k = map(int, rl().split())

li = list(map(int, rl().split()))

dp = np.full(n, float('inf'))

dp[0] = 0
dp[1] = abs(li[0] - li[1])

for i in range(2, k):
    for j in range(i):
        a = dp[j] + abs(li[j] - li[i])
        if dp[i] > a:
            dp[i] = a
for i in range(k, n):
    for j in range(i-k, i):
        a = dp[j] + abs(li[j] - li[i])
        if dp[i] > a:
            dp[i] = a
        
print(int(dp[-1]))




### FIXED CODE ###

import sys

rl = sys.stdin.readline

n, k = map(int, rl().split())

li = list(map(int, rl().split()))

dp = [1<<60]*n

dp[0] = 0
dp[1] = abs(li[0] - li[1])

if k < n:    
    for i in range(2, k):
        for j in range(i):
            a = dp[j] + abs(li[j] - li[i])
            if dp[i] > a:
                dp[i] = a
    for i in range(k, n):
        for j in range(i-k, i):
            a = dp[j] + abs(li[j] - li[i])
            if dp[i] > a:
                dp[i] = a
else:
    for i in range(n):
        for j in range(i):
            a = dp[j] + abs(li[j] - li[i])
            if dp[i] > a:
                dp[i] = a
        
print(int(dp[-1]))
wl = {}
N = int(input())
for n in range(N):
    w = input()
    if w in wl:
        wl[w] = wl[w]+1
    else:
        wl[w] = 1 
M = int(input())
for m in range(M):
    w = input()
    if w in wl:
        wl[w] = wl[w]-1
    else:
        wl[w] = -1

mc = ""
c = 0
for k, v in wl.items():
    if c < v:
        mc = k
        c = v

print(c)

### FIXED CODE ###

a, b, c = map(int, input().split())
if a + b < c:
    print("No")
else:
    print("Yes")
N, M = [int(x) for x in input().strip().split(" ")]

vs = set()
def dfs_w(v, d, t):
    # dfs while版 
    r = -1
    stack = [v]
    path = []
    while True:
        if len(stack) == 0:
            break
        v = stack.pop()
        if v < 0:
            path.pop()
        else:
            path.append(v)
            vs.add(v)
            for u in d[v]:
                if u == t:
                    if r != -1:
                        r = min(len(path)//3, r)
                    else:
                        r = len(path)//3
                    continue
                if u in vs:
                    continue
                stack += [-v, u]
    return r

d = [set() for _ in range(3*N+1)]
for _ in range(M):
    a, b = [int(x) for x in input().strip().split(" ")]
    d[a].add(N+b)
    d[N+a].add(2*N+b)
    d[2*N+a].add(b)

s, t = [int(x) for x in input().strip().split(" ")]
print(dfs_w(s, d, t))


### FIXED CODE ###

n, k = [int(x) for x in input().strip().split(" ")]
m=~-n*(n-2)//2
if k>m:
    print(-1)
else:
    m-=k
    print(m+n-1)
    for i in range(1, n):
        print(i, n)
    for i in range(1, n):
        for j in range(i+1, n):
            if m==0:
                break
            print(i, j)
            m-=1
import sys
from io import StringIO
import unittest

sys.setrecursionlimit(100**5)

def search(u, n, g, disc, k):
    if disc[u] != None:
        circles = n - disc[u]
        v = (k - disc[u]) % circles
        ans = u
        for i in range(v):
            ans = g[ans]
        return ans + 1
    disc[u] = n
    return search(g[u], n+1, g, disc, k)

def resolve():
    n, k = map(int, input().split())
    g = list(map(lambda x: int(x) - 1, input().split()))
    disc = [None]*n
    v = search(0, 0, g, disc, k)
    print(v)
resolve()

### FIXED CODE ###

import sys
from io import StringIO
import unittest

sys.setrecursionlimit(10**5*2)

def search(u, n, g, disc, k):
    if disc[u] != None:
        circles = n - disc[u]
        v = (k - disc[u]) % circles
        ans = u
        if n > k:
            ans = 0
            for _ in range(k):
                ans = g[ans]
            return ans + 1
        for i in range(v):
            ans = g[ans]
        return ans + 1
    disc[u] = n
    return search(g[u], n+1, g, disc, k)

def resolve():
    n, k = map(int, input().split())
    g = list(map(lambda x: int(x) - 1, input().split()))
    disc = [None]*n
    v = search(0, 0, g, disc, k)
    print(v)
resolve()
# coding: utf-8
import sys


def main(argv=sys.argv):

    char_list = input()

    char_set = set(char_list)

    for char in char_set:

        if char_list.count(char) % 2 != 0:

            print('No')

            return -1

    print('Yes')

    return 0


if __name__ == '__main__':
    sys.exit(main())


### FIXED CODE ###

# coding: utf-8
import sys


def main(argv=sys.argv):

    char_list = input()

    char_set = set(char_list)

    for char_ in char_set:

        if char_list.count(char_) % 2 != 0:

            print('No')

            return 0

    print('Yes')

    return 0


if __name__ == '__main__':
    sys.exit(main())
blue = []
red = []
N = int(input())
for card in range(N):
    blue.append(input())
M = int(input())
for card in range(M):
    red.append(input())

s = input()
prize = blue.count(s) - red.count(s)
print(prize)

### FIXED CODE ###

blue = []
red = []
N = int(input())
for card in range(N):
    blue.append(input())
M = int(input())
for card in range(M):
    red.append(input())

max = 0
for b in blue:
    if max < blue.count(b) - red.count(b):
        max = blue.count(b) - red.count(b)
        
print(max)
Inp = input()
Blist = Inp[1]
Blist.sort()

out = 0
for i in range(Imp[0,1]):
    out += Blist[-(i+1)]
    
print(out)

### FIXED CODE ###

Imp = list(map(int, input().split()))
Blist = list(map(int, input().split()))
Blist.sort()

out = 0
for i in range(Imp[1]):
    out += Blist[-(i+1)]
    
print(out)
H, W = map(int, input().split())
c_list = list()
for i in range(H):
  b_list = list(map(lambda x: x, input()))
  for w in range(W):
    if b_list[w] == '#':
      c_list.append([i, w])

ans_ll = []

for h in range(H):
  for w in range(W):
    if not [h, w] in c_list:
      ans_list = list()
      for c in c_list:
        ans_list.append(abs(h-c[0]) + abs(w-c[1]))
      ans_ll.append(min(ans_list))
print(max(ans_ll))
      

### FIXED CODE ###

h,w= map(int, input().split())
s_list = []
b_list = []
for i in range(h):
    li = input()
    aa = []
    for j in range(w):
        aa.append(li[j])
        if aa[j] == '#':
            b_list.append((i, j))
    s_list.append(aa)
ans = 0
while True:
    bb_list = []
    for p in b_list:
        pp = [(p[0]-1, p[1]), (p[0]+1, p[1]), (p[0], p[1]-1), (p[0], p[1]+1)]
        for ppp in pp:
            if (0 <= ppp[0] < h) and (0 <= ppp[1] < w):
                if s_list[ppp[0]][ppp[1]] == '.':
                    s_list[ppp[0]][ppp[1]] = '#'
                    bb_list.append((ppp[0], ppp[1]))
    # ここで複数回同じbをやらなくて済むようにしている
    b_list = bb_list
    if len(b_list) == 0:
        break
    ans += 1
    # print(x)
print(ans)
N = int(input())
h = [*map(lambda x: int(x), input().split())]

#bottom-up
def iterative_method(final):
    i = 0
    min_table = {0: 0}

    while (i < final):
        if i+1 in min_table:
            min_table[i+1] =  min(min_table[i+1], min_table[i] + abs(h[i+1] - h[i]))
        else:
            min_table[i+1] = min_table[i] + abs(h[i+1] - h[i])
        try:
            if i+2 in min_table:
                min_table[i+2] = min(min_table[i+2], min_table[i] + abs(h[i+2] - h[i]))
            else:
                min_table[i+2] = min_table[i] + abs(h[i+2] - h[i])
        except:
            break
        i += 1


    print(min_table[final])

#topdown
def recursive_method(n):
    memo = [-1]*n
    memo[0] = 0
    memo[1] = abs(h[1] - h[0])
    def recurse(i):
        if memo[i] != -1:
            return memo[i]
        else:
            memo[i] = min( recurse(i-1) + abs(h[i] - h[i-1]), recurse(i-2) + abs(h[i] - h[i-2]))
            return memo[i]
    return recurse(n-1)

    

print(recursive_method(N))

### FIXED CODE ###

N = int(input())
h = [*map(lambda x: int(x), input().split())]

#bottom-up

def iterative_method(final):
    i = 0
    min_table = {0: 0}

    while (i < final):
        if i+1 in min_table:
            min_table[i+1] =  min(min_table[i+1], min_table[i] + abs(h[i+1] - h[i]))
        else:
            min_table[i+1] = min_table[i] + abs(h[i+1] - h[i])
        try:
            if i+2 in min_table:
                min_table[i+2] = min(min_table[i+2], min_table[i] + abs(h[i+2] - h[i]))
            else:
                min_table[i+2] = min_table[i] + abs(h[i+2] - h[i])
        except:
            break
        i += 1


    print(min_table[final])

iterative_method(N-1)
while True:
    H, W = [int(i) for i in input().split()]
    if H == w == 0:
        break
    
    for h in range(H):
        for w in range(W):
            print('#', end='')
        print()
    
    print()

### FIXED CODE ###

while True:
    H, W = [int(i) for i in input().split()]
    if H == W == 0:
        break
    
    for h in range(H):
        for w in range(W):
            print('#', end='')
        print()
    
    print()
import math

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

T = M * 1900 + (N-M) * 100

p = (1/2)**M
p2 = (1/2)**M
ans = 0
for i in range(1,500000):
  ans += T * p2 * i
  p2 = p2 * (1-p)
  
print(math.round(ans))


### FIXED CODE ###

import math

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

T = M * 1900 + (N-M) * 100

p = (1/2)**M
p2 = (1/2)**M
ans = 0
for i in range(1,500000):
  ans += T * p2 * i
  p2 = p2 * (1-p)
  
print(round(ans))
N=int(input())
p=list(map(int, input().split()))
s = [x for x in range(1,N+1) if x!=p[x-1]]
if len(s)<3:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

A,B=map(int,input().split())
print((A+B)//2 if (A+B)%2==0 else 'IMPOSSIBLE')
N = int(input())
A = [int(input()) for i in range(N)]
A.sort()

ans = 0
if N%2 == 0:
    c1, c2 = A[N//2-1], A[N//2]
    del A[N // 2]
    del A[N // 2]
    for a in A:
        ans += abs(a-c1)*2
    ans += c2-c1
else:
    c = A[N//2]
    c1, c2 = A[N//2-1], A[N//2+1]
    ans -= min(abs(c-c1), abs(c-c2))
    for a in A:
        ans += abs(a-c) * 2
print(ans)


### FIXED CODE ###

N = int(input())
A = [int(input()) for i in range(N)]
A.sort()

ans = 0
if N%2 == 0:
    c1, c2 = A[N//2-1], A[N//2]
    del A[N // 2-1]
    del A[N // 2-1]
    for a in A:
        ans += abs(a-c1)*2
    ans += c2-c1
else:
    c = A[N//2]
    c1, c2 = A[N//2-1], A[N//2+1]
    ans -= min(abs(c-c1), abs(c-c2))
    for a in A:
        ans += abs(a-c) * 2
print(ans)
# nの約数を求める
def divisor(n):
    d = []
    for i in range(int(n**(0.5)+1)):
        if n % i == 0:
            d.append(i)
            if i * i != n:
                d.append(n / i)
    return d


N, M = map(int, input().split())
# d はnの約数のベクター
d = divisor(M)
g = M / N
d = [x for x in d if x <= g]
print(max(d))


### FIXED CODE ###

# nの約数を求める
def divisor(n):
    d = []
    for i in range(int(n**(0.5)+1))[1:]:
        if n % i == 0:
            d.append(i)
            if i * i != n:
                d.append(int(n / i))
    return d


N, M = map(int, input().split())
# d はnの約数のベクター
d = divisor(M)
g = int(M / N)
d = [x for x in d if x <= g]
print(max(d))
while True:
 a,b=map(int,input().split())
 digit=(a+b)
 digit2=str(digit)
 print(len(digit2))
print()

### FIXED CODE ###

try:
 while True:
  a,b=map(int,input().split())
  digit=(a+b)
  digit2=str(digit)
  print(len(digit2))
except:
   pass
a, b = int (input())
takahashi = 0

for x in range(1, a+1):
    for y in range(1, b+1):
        if x == y:
            takahashi += 1

print(takahashi)
        

### FIXED CODE ###

a, b = map(int, input().split())
takahashi = 0
 
for x in range(1, a):
    for y in range(1, 31):
        if x == y:
            takahashi += 1
 
for x in range(1, b+1):
    if x == a:
        takahashi += 1
print(takahashi)
from itertools import combinations

N = int(input())
s = [list(input()) for i in range(N)]
 
a = 0
for i,j in combinations(s,2):
  if set(i) == set(j):
    a+=1
print(a)

### FIXED CODE ###

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

a1 = A+B
a2 = A-B
a3 = A*B

am = max([a1,a2,a3])

print(am)
from functools import reduce
import sys
import numpy as np


mod = 10 ** 9 + 7
buffer = sys.stdin.buffer
h, w = map(int, buffer.readline().split())
s = np.frombuffer(buffer.read(h*(w+1)), dtype='B') == ord('.')
s = s.reshape((h, w+1))[:, :-1]
l = np.empty((h, w), dtype='i4')
r = np.empty((h, w), dtype='i4')
u = np.empty((h, w), dtype='i4')
d = np.empty((h, w), dtype='i4')
l[:, 0] = s[:, 0]
for i in range(1, w):
    l[:, i] = (l[:, i-1] + 1) * s[:, i]
r[:, -1] = s[:, -1]
for i in range(1, w):
    r[:, -1-i] = (r[:, -i] + 1) * s[:, -1-i]
u[0] = s[0]
for i in range(a, h):
    u[i] = (u[i-1] + 1) * s[i]
d[-1] = s[-1]
for i in range(1, h):
    d[-1-i] = (d[-i] + 1) * s[-1-i]
score = l + r + u + d - 3
print(int(score.max()))

### FIXED CODE ###

from functools import reduce
import sys
import numpy as np


mod = 10 ** 9 + 7
buffer = sys.stdin.buffer
h, w = map(int, buffer.readline().split())
s = np.frombuffer(buffer.read(h*(w+1)), dtype='B') == ord('.')
s = s.reshape((h, w+1))[:, :-1]
l = np.empty((h, w), dtype='i4')
r = np.empty((h, w), dtype='i4')
u = np.empty((h, w), dtype='i4')
d = np.empty((h, w), dtype='i4')
l[:, 0] = s[:, 0]
for i in range(1, w):
    l[:, i] = (l[:, i-1] + 1) * s[:, i]
r[:, -1] = s[:, -1]
for i in range(1, w):
    r[:, -1-i] = (r[:, -i] + 1) * s[:, -1-i]
u[0] = s[0]
for i in range(1, h):
    u[i] = (u[i-1] + 1) * s[i]
d[-1] = s[-1]
for i in range(1, h):
    d[-1-i] = (d[-i] + 1) * s[-1-i]
score = l + r + u + d - 3
print(int(score.max()))
N = int(input())
R = int(input())
if N >= 10:
    print(R)
elif N <= 10:
    print(100*(10-N) + R)

### FIXED CODE ###

N, R = map(int, input().split())
if N >= 10:
    print(R)
else:
    print(100*(10-N) + R)
N = int(input())
A = list(map(int, input().split()))

import math
from functools import reduce

print('YES' if reduce(math.gcd, A) == 1 else 'NO')

### FIXED CODE ###

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

A.sort()

for i in range(N - 1):
    if A[i] == A[i + 1]:
        print('NO')
        break
else:
    print('YES')
n = int(input())
if n == 7 or n == 5 or n==3:
  print('YES')
else
  print('NO')

### FIXED CODE ###

n = int(input())
if n == 7 or n == 5 or n==3:
  print('YES')
else:
  print('NO')
a=list(input())
print a[0]*a[1]
print 2*a[0]+2*a[1]

### FIXED CODE ###

a = map(int, raw_input().split())
print a[0]*a[1],2*a[0]+2*a[1]
def main():
    num = input()
    if num % 9 == 0:
        return 'Yes'
    else:
        return 'No'


if __name__ == '__main__':
    ans = main()
    print(ans)


### FIXED CODE ###

def main():
    num = input()
    total = 0
    for char in num:
        total += int(char)
        total %= 9
    if total == 0:
        return 'Yes'
    else:
        return 'No'


if __name__ == '__main__':
    ans = main()
    print(ans)
d=[0,2,5,5,4,5,6,3,7,6]
N,M=map(int,input().split())
A=list(map(int,input().split()))
l=[]
for a in A:
    l.append([a,d[a]])
l.sort(key=lambda x:x[0],reverse=True)
l.sort(key=lambda x:x[1])
min_val,min_match=l[0]

ans=[]
if N%min_match==0:
    ans.append(int(str(min_val)*(N//min_match)))
from itertools import combinations_with_replacement
for i in range(1,M):
    f = False
    r = 1
    while not f:
        for p in combinations_with_replacement(l[1:],r):
        v=[]
        m_sum=0
        for val,mat in p:
            v.append(str(val))
            m_sum+=mat
        if (N-m_sum)%min_match==0:
            ans.append(int(''.join(sorted(v+
                [str(min_val)]*((N-m_sum)//min_match),reverse=True))))
        f = (len(ans) == 0)
        r += 1
print(max(ans))



### FIXED CODE ###

d=[0,2,5,5,4,5,6,3,7,6]
N,M=map(int,input().split())
A=list(map(int,input().split()))

dp = [-1 for i in range(N+1)]
dp[0] = 0


for i in range(1,N+1):
    tmp = -1
    for a in A:
        if i-d[a]>=0 and dp[i-d[a]] != -1:
            tmp = max(tmp,dp[i-d[a]]+1)
    dp[i] = tmp


A.sort(reverse=True)
ans = ''
while N>0:
    for a in A:
        if N-d[a]>=0 and dp[N-d[a]] == dp[N]-1:
            ans += str(a)
            N -= d[a]
            break
print(ans)
S=str(input())
if S[2]==S[3] and S[4]==S[5]:
  print ('Yes')
else:
  print ('No')

### FIXED CODE ###

S=str(input())
if S[2]==S[3] and S[4]==S[5]:
  print ('Yes')
else:
  print ('No')
def calc(prepoint, nextpoint):
    return abs(nextpoint[0]-prepoint[0]) + abs(nextpoint[1]-prepoint[1])

def search(i,A):
    for h in range(H):
        if L in A[h]:
            return (h,A[h].index(L))
def main():
    H,W,D = map(int,input().split())
    A = [list(map(int, input().split())) for i in range(H)]
    Q = int(input())
    L_R_List = [list(map(int, input().split())) for i in range(Q)]

    temp = [(0,0) for i in range(H*W)]
    for L_R in L_R_List:
        L = L_R[0]
        R = L_R[1]
        ans = 0
        if temp[L] == (0,0):
            temp[L] = search(L,A)
            prepoint = temp[L]
        else:
            prepoint = temp[L]
        while(L != R):
            L += D
            if temp[L] == (0,0):
                temp[L] = search(L,A)
                nextpoint = temp[L]
            else:
                nextpoint = temp[L]
            ans += calc(prepoint, nextpoint)
            prepoint = nextpoint
        print(ans)
if __name__ == '__main__':
    main()


### FIXED CODE ###

def calc(prepoint, nextpoint):
    return abs(nextpoint[0]-prepoint[0]) + abs(nextpoint[1]-prepoint[1])

def main():
    H,W,D = map(int,input().split())
    index  = [(0,0) for i in range(H*W+1)]
    A = []
    for i in range(H):
        temp = list(map(int, input().split()))
        for t in temp:
            index[t] = (i,temp.index(t))
        A.append(temp)
    Q = int(input())
    L_R_List = [list(map(int, input().split())) for i in range(Q)]

    dp = [0 for i in range(H*W+1)]
    for i in range(D, H*W+1):
        dp[i] = dp[i-D] + calc(index[i], index[i-D])
    for L_R in L_R_List:
        L = L_R[0]
        R = L_R[1]
        print(dp[R]-dp[L])

if __name__ == '__main__':
    main()
import itertools

n = int(input())
s = list(input())
s1 = [1 if s[i] == 'I' else -1 for i in range(n)]
cumsum = list(itertools.accumulate(s1))
print(s1)
print(cumsum)
ans = max(cumsum)
print(max(ams, 0))

### FIXED CODE ###

import itertools

n = int(input())
s = list(input())
s1 = [1 if s[i] == 'I' else -1 for i in range(n)]
cumsum = list(itertools.accumulate(s1))
ans = max(cumsum)
print(max(ans, 0))
import numpy as np
def resolve():
    N, M, K = map(int, input().split())
    fri = np.zeros((N, N), np.int64)
    for i in range(M):
        a, b = map(int, input().split())
        fri[a-1][b-1] = 1
        fri[b-1][a-1] = 1
    blo = np.zeros((N, N), np.int64)
    for i in range(K):
        c, d = map(int, input().split())
        blo[c-1][d-1] = 1
        blo[d-1][c-1] = 1

    can = np.zeros((N, N), np.int64)
    for i in range(N):
        vis = [False for _ in range(N)]
        s = [i]
        while len(s) > 0:
            v = s.pop()
            vis[v] = True
            for j, k in enumerate(fri[v]):
                if vis[j] or k == 0:
                    continue
                s.append(j)
                if fri[i][j] != 1 and blo[i][j] != 1 and can[i][j] == 0:
                    can[i][j] = 1
    ans = []
    for i in range(N):
        ans.append(can[i].sum())
    print(*ans, sep=' ')
resolve()

### FIXED CODE ###

import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
class UnionFind():
    def __init__(self, n):
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

def resolve():
    N, M, K = lr()
    uf = UnionFind(N)
    fr = [0]*N
    for i in range(M):
        a, b = lr()
        uf.union(a-1, b-1)
        fr[a-1] += 1
        fr[b-1] += 1
    ans = [uf.size(x) - fr[x] - 1 for x in range(N)]
    for i in range(K):
        c, d = lr()
        if uf.same(c-1, d-1):
            ans[c-1] -= 1
            ans[d-1] -= 1
    print(*ans, sep=' ')
resolve()
import numpy as np
from numba import njit

@njit( cache=True)
def main():
    N,K=map(int,input().split())
    a=np.array([int(i) for i in input().split()],dtype=np.int64)
    MOD=10**9+7

    dp=np.full((N+1,K+1),0,dtype=np.int64)
    c=np.full(K+2,0,dtype=np.int64)

    dp[0][0]=1


    for i in range(1,N+1):
        c[0]=0
        for j in range(1,K+2):
            c[j]=(c[j-1]+dp[i-1][j-1])%MOD
        for j in range(K+1):
            dp[i][j]=(c[j+1]-c[max(0,j-a[i-1])])%MOD

    print(dp[N][K])

def main()


### FIXED CODE ###

import numpy as np
from numba import njit

N,K=map(int,input().split())
a=np.array([int(i) for i in input().split()],dtype=np.int64)

dp=np.full((N+1,K+1),0,dtype=np.int64)
c=np.full(K+2,0,dtype=np.int64)
MOD=10**9+7

@njit('i8(i8,i8,i8,i8[:,:],i8[:])', cache=True)
def main(N,K,MOD,dp,c):

    dp[0][0]=1
    for i in range(1,N+1):
        c[0]=0
        for j in range(1,K+2):
            c[j]=(c[j-1]+dp[i-1][j-1])%MOD
        for j in range(K+1):
            dp[i][j]=(c[j+1]-c[max(0,j-a[i-1])])%MOD

    return dp[N][K]

print(main(N,K,MOD,dp,c))
import math
a,b,c=map(int,input().split())
if(math.sqrt(a)+math.sqrt(b)<=math.sqrt(c)):
	print("Yes")
else:
	print("No")

### FIXED CODE ###

a=[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]
print(a[int(input())-1])