Harryxun/stf_run huggingface dataset:
import sys
import math
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

a,b,h,m = map(int,readline().split())

degree = abs(h*30+30*(m/60) - m*6)
degree = min(degree,180-degree)
if degree == 0 or degree == 180:
    print(0)
    exit()
print(math.sqrt(a**2+b**2-2*a*b*math.cos(math.radians(degree))))

### FIXED CODE ###

import sys
from collections import deque
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
"""
連結無向グラフ
道標をおいた時に、全ての部屋からの最短路となる必要がある。
"""
n,m = map(int,readline().split())
#隣接リスト
g = [[] for i in range(n)]
for i in range(m):
    x,y = map(int,readline().split())
    x,y = x-1,y-1
    g[x].append(y)
    g[y].append(x)
ans = [-1]*n

deq = deque([0])
while deq:
    fr = deq.popleft()
    for go in g[fr]:
        if ans[go] == -1:
            ans[go] = fr
            deq.append(go)
        

print("Yes")
for i in ans[1:]:
    print(i+1)
N=list(input())
answer="no"
for i in range(len(N)-2)
  if N[i]==N[i+1]:
    if N[i+1]==N[i+2]:
      if N[i+2]==N[i+3]:
        answer="yes"
print(answer)


### FIXED CODE ###

N=input()
answer="No"
for i in range(len(N)-2):
  if N[i]==N[i+1]:
    if N[i+1]==N[i+2]:
      answer="Yes"
print(answer)
A, B, C, D, E, F = map(int, input().split())A, B, C, D, E, F = map(int, input().split())
perc = 0.0
ans = [0, 0]
op = [0, 0, 0, 0]
a = 0
while 100 * a <= F:
  b = 0
  while 100 * (a + b) <= F:
    c = 0
    while 100 * (a + b) + c <= F:
      if c > (a + b) * E:
        break
      d = 0
      while 100 * (a + b) + c + d <= F:
        if c + d > (a + b) * E:
          break
        if a == b == c == d == 0:
          break
        p = (c + d) * 1.0 / (100 * (a + b) + c + d)
        if p > perc:
          perc = p
          ans = [100 * (a + b) + c + d, c + d]
          op = [a, b, c, d]
        d += D
      c += C
    b += B
  a += A
print(str(ans[0]) + " " + str(ans[1]))

### FIXED CODE ###

A, B, C, D, E, F = map(int, input().split())
perc = 0.0
ans = [0, 0]
op = [0, 0, 0, 0]
a = 0
while 100 * a <= F:
  b = 0
  while 100 * (a + b) <= F:
    c = 0
    while 100 * (a + b) + c <= F:
      if c > (a + b) * E:
        break
      d = 0
      while 100 * (a + b) + c + d <= F:
        if c + d > (a + b) * E:
          break
        if a == b == c == d == 0:
          break
        p = (c + d) * 1.0 / (100 * (a + b) + c + d)
        if p >= perc:
          perc = p
          ans = [100 * (a + b) + c + d, c + d]
          op = [a, b, c, d]
        d += D
      c += C
    b += B
  a += A
print(str(ans[0]) + " " + str(ans[1]))
#提出の際にmathをfractionsにする(2020/1/17現在)
from math import gcd
N, X = map(int, input().split())
x = list(map(int, input().split()))
if (N == 1):
   print(x[0])
   exit(0)
ans = abs(X - x[0])
for i in range(1, len(x)):
    ans = gcd(abs(x[i] - x[i - 1]), ans)
print(ans)


### FIXED CODE ###

from fractions import gcd
N, X = map(int, input().split())
x = list(map(int, input().split()))
ans = abs(X - x[0])
if (N == 1):
   print(ans)
   exit(0)
for i in range(1, len(x)):
    ans = gcd(abs(x[i] - x[i - 1]), ans)
print(ans)
h, w = input().split()
d = []
for i in range(10):
    d.append(map(int, input().split()))
a = []
for i in range(h):
    a.append(map(int, input().split()))
for k in range(10):
    for i in range(10):
        for j in range(10):
            if d[i][j] > d[i][k] + d[k][j]:
                d[i][j] = d[i][k] + d[k][j]

#for k in range(0, 10):
#    print(c[k])
#for k in range(0, 10):
#    print(d[k])
#print(d[8][1])

ans = 0
for i in range(h):
    for j in range(w):
        if a[i][j] != 1 or a[i][j] != -1:
            ans += d[a[i][j]][1]
print(ans)


### FIXED CODE ###

h, w = map(int, input().split())
d = []
for i in range(10):
    d.append(list(map(int, input().split())))
a = []
for i in range(h):
    a.append(list(map(int, input().split())))
for k in range(10):
    for i in range(10):
        for j in range(10):
            d[i][j] = min(d[i][j], d[i][k] + d[k][j])

#for k in range(0, 10):
#    print(c[k])
#for k in range(0, 10):
#    print(d[k])
#print(d[8][1])

ans = 0
for i in range(h):
    for j in range(w):
        if a[i][j] != -1:
            ans += d[a[i][j]][1]
print(ans)
import sys
import numpy as np
sys.setrecursionlimit(10**6)
def MAP(): return [int(s) for s in input().split()]

if sys.platform =='ios':
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline

N, M = MAP()
A = MAP()

while M > 0:
	A[np.argmax(A)] = A[np.argmax(A)] // 2
	M -= 1

print(sum(A))

### FIXED CODE ###

import sys
import heapq
sys.setrecursionlimit(10**6)
def MAP(): return [int(s) for s in input().split()]

if sys.platform =='ios':
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline

N, M = MAP()
# heapq.heappop（優先度『最小』の品物をO(logN)で取得）のため入力値をマイナスに変換
A = [int(s)*-1 for s in input().split()]

# 品物のリストをheapqのオブジェクトに変換
heapq.heapify(A)

while M > 0:
	# 以下、heapq　の計算誤差を防ぐため、(1) も (2) もそれぞれ -1 をかける
	# (1) 最小値を取り出す
	discount = heapq.heappop(A)*-1
	# (2) 最小値を2で切り捨て割ったものをAに戻す
	heapq.heappush(A, discount//2*-1)
	M -= 1

print(sum(A)*-1)
N, K = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = list(set(B))
D ={}
for i in C:
    D[i] = 0
    for j in B:
        if i == j:
            D[i] += 1
if len(D) <= K:
    print(0)
else:
    LLL = list(D.values())
    AA = len(D) - K
    bag = 0
    for i in range(-AA, 0):
    bag += LLL[i]
    print(bag)

### FIXED CODE ###

N, K = [int(i) for i in input().split()]
B = sorted([int(i) for i in input().split()])
D ={}
bag = 0

for i in B:
    if i in D:
        D[i] += 1
    else:
        D[i] = 1

LLL = sorted(list(D.values()))
AA = len(D) - K
if len(D) <= K:
    print(0)
else:
    for i in range(AA):
        bag += LLL[i]
    print(bag)
N=int(input())
ans=[0]*N
ans[5]=1
for i in range(1,N+1):
    for x in range(1,N+1):
        if x**2>i:
            break
        for y in range(1,N+1):
            if x**2+y**2>i:
                break
            for z in range(1,N+1):
                if x**2+y**2+z**2>i:
                    break
                if x**2+y**2+z**2+x*y+y*z+z*x==i:
                    ans[i-1]=3




for i in ans:
    print(i)

### FIXED CODE ###

from itertools import permutations
N=int(input())
ans=[0]*(10**6)
for x in range(1,N+1):
    if x**2>N:
        break
    for y in range(1,N+1):
        if x**2+y**2>N:
            break
        for z in range(1,N+1):
            if x**2+y**2+z**2>N:
                break
            else:
                kari=[x,y,z]
                #print(kari)
                if x**2+y**2+z**2+x*y+y*z+z*x<=10**5:
                    ans[x**2+y**2+z**2+x*y+y*z+z*x-1]+=1
                    
for i in range(N):
    print(ans[i])
While True:
 a=map(int,input().split())
 if a==[0,0]:
  break
 if a[0]>a[1]:print(str(a[1])+" "+str(a[0]))
 else: print(str(a[0])+" "+str(a[1]))

### FIXED CODE ###

while True:
 a=map(int,raw_input().split())
 if a==[0,0]:
  break
 if a[0]>a[1]:print(str(a[1])+" "+str(a[0]))
 else: print(str(a[0])+" "+str(a[1]))
a, b, c = map(int, input().split())
print(a[0]+b[0]+c[0])

### FIXED CODE ###

a, b, c = map(str, input().split())
print(a[0]+b[0]+c[0])
x, n = map(int, input().split())
li = list(map(int, input().split()))
li.sort()
if len(li) == 0:
    print(x)
    exit()
x1 = x - 1
x2 = x + 1
li1 = []
li2 = []
while x1 >= x - 10:
    if x1 not in li:
        li1.append(x1)
    x1 -= 1
li1.sort(reverse=True)
while x2 <= x + 10:
    if x2 not in li:
        li2.append(x2)
    x2 += 1
li2.sort()
if x - li1[0] > li2[0] - x:
    print(li2[0])
else:
    print(li1[0])

### FIXED CODE ###

x, n = map(int, input().split())
li = list(map(int, input().split()))
li.sort()
if len(li) == 0:
    print(x)
    exit()
x1 = x
while x1 in li:
    x1 -= 1
x2 = x
while x2 in li:
    x2 += 1
if x-x1 > x2-x:
    print(x2)
else:
    print(x1)
X,Y = input().split()
v = Y-(2*X)
if v<0 or v%2==1:
  print('No')
else:
  print('Yes')

### FIXED CODE ###

X,Y = map(int,input().split())
v = Y-(2*X)
if v<0 or v%2==1:
  print('No')
elif 4*X < Y:
  print('No')
else:
  print('Yes')
from math import gcd
from collections import Counter

A,B = [int(zz) for zz in input().split()]

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

x = gcd(A,B)

print(len(set(prime_factorize(x)))+1)


### FIXED CODE ###

from fractions import gcd

A,B = [int(zz) for zz in input().split()]

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

x = gcd(A,B)

print(len(set(prime_factorize(x)))+1)
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
  
def prod(n):
  result = 1
  for x in n:
    result *= x
  return result
  
a = prime_factorize(n)
b = [a.pop(-1)]

while prod(a) > prod(b):
  prev_result = prod(a) + prod(b)
  b.append(a.pop(0))

  if prev_result < prod(a) + prod(b):
    a.append(b.pop(-1))
    break
  
print(prod(a)-1 +prod(b)-1)


### FIXED CODE ###

n = int(input())

ans = 1e18
for i in range(1, n):
	if i**2 > n:
		break
	if (n%i)== 0:
		j = n/i
		ans = int(min(ans, i+j-2))
print(ans)
N, X = [int(line) for line in input().split()]
L = [int(line) for line in input().split()]

D = [0]#D1 = 0
for i in range(1,N+1):#座標Dの配列を作る
    Di = D[i-1] + L[i-1]
    D.append(Di)

for i in range(len(D)):#
    if D[i] == X:
        index = i
        break
    elif D[i] > X:
        index = i - 1
        break
ans = index + 1
print(ans)


### FIXED CODE ###

N, X = [int(line) for line in input().split()]
L = [int(line) for line in input().split()]

D = [0]#D1 = 0
for i in range(1,N+1):#座標Dの配列を作る
    Di = D[i-1] + L[i-1]
    D.append(Di)

ans = 0
for i in range(len(D)):#
    if D[i] <= X:
      ans += 1
print(ans)
N = int(inut())
if N <= 999:
  print('ABC')
else:
  print('ABD')

### FIXED CODE ###

N = int(input())
if N <= 999:
  print('ABC')
else:
  print('ABD')
# -*- coding: utf-8 -*-

import math

a, b, x = map(int, input().split())

V = a**2 * b
V_2 = V / a

x_2 = x / a

if x_2 > V_2/2:
    c = 2*x/a**2 - b
    theta = math.atan(a/(b-c))
    deg = math.degrees(theta)
else:
    c = 2*x/(a*b)
    theta = math.atan(c/b)
    deg = math.degrees(theta)

print("{}".format(90.0-deg))


### FIXED CODE ###

# -*- coding: utf-8 -*-

import math

a, b, x = map(int, input().split())

V = a**2 * b
V_2 = V / a

x_2 = x / a

if x_2 > V_2/2:
    c = 2*x/a**2 - b
    theta = math.atan2(a,(b-c))
    deg = math.degrees(theta)
else:
    c = 2*x/(a*b)
    theta = math.atan2(c,b)
    deg = math.degrees(theta)

print("{}".format(90.0-deg))
#!/usr/bin/env python3
# coding: utf-8
import time

def main():
    N, K, C = map(int, input().split())
    S = dict(enumerate(str(input()), 1))

    # time.sleep(0.05 * len(str(C)))
    time.sleep(0.05 * int(str(K)[4]))
if __name__ == "__main__":
    main()

### FIXED CODE ###

#!/usr/bin/env python3
# coding: utf-8

def debug(arg):
    if __debug__:
        pass
    else:
        import sys
        print(arg, file=sys.stderr)
        
def main():
    N, K, C = map(int, input().split())
    S = dict(enumerate(str(input()), 1))

    sr = list(k for k, v in S.items() if v == 'o')
    sl = list(reversed(sr.copy()))

    debug(sr)
    debug(sl)

    l = [sl.pop()]
    r = [sr.pop()]
    
    for x in range(1, K):
        while True:
            ll = sl.pop()
            if ll > l[x - 1] + C:
                l.append(ll)
                break
        while True:
            rr = sr.pop()
            if rr < r[x - 1] - C:
                r.append(rr)
                break

    debug(r)
    debug(l)

    # a = sorted(set(l) & set(r))

    # debug(a)
    # for aa in a:
    #     print(aa)
    
    for ll, rr in zip(l, sorted(r)):
        if ll == rr:
            print(ll)

if __name__ == "__main__":
    main()
n,k=list(map(int,input().split(" ")))
s=list(input())
s_str=""
s[k-1]=s[k-1].lower()
for i in s:
  s_str +=s[i]
print(s_str)


### FIXED CODE ###

n,k=list(map(int,input().split(" ")))
s=list(input())
s_str = ""
if s[k-1]=="A":
    s[k-1]="a"
elif s[k-1]=="B":
    s[k-1]="b"
else:
    s[k-1]="c"
for i in s:
    s_str += i
print(s_str)
n=int(input())
a=1000
while a<n:
  a=a+1000
 print(a-n)
  

### FIXED CODE ###

n=int(input())
a=1000
while a<n:
  a=a+1000
print(a-n)
def main() -> None:
    H, W = map(int, input().split())
    s = ['0' + input() + '0' for _ in range(H)]
    s.insert(0, '0' * (W + 2))
    s.append('0' * (W + 2))
    for i in range(1, H + 1):
        for j in range(1, W + 1):
            if s[j][i] == "#":
                if s[j+1][i] == "#" or s[j-1][i] == "#" or s[j][i+1] == "#" or s[j][i-1] == "#":
                    continue
                else:
                    print("No")
                    exit()
    print("Yes")


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main() -> None:
    H, W = map(int, input().split())
    s = ['0' + input() + '0' for _ in range(H)]
    s.insert(0, '0' * (W + 2))
    s.append('0' * (W + 2))
    for i in range(1, H + 1):
        for j in range(1, W + 1):
            # print(s[i][j])
            if s[i][j] == "#":
                if s[i+1][j] == "#" or s[i-1][j] == "#" or s[i][j+1] == "#" or s[i][j-1] == "#":
                    continue
                else:
                    print("No")
                    exit()
    print("Yes")


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

n = int(input())
inputs = input().split(" ")
l = [int(s) for s in inputs]

def calc(rl, ns, skip):
    v = rl.pop(len(rl)-1)
    # print(rl,v,ns)
    lrl = len(rl)
    
    if lrl == 0:
        return ns
    if lrl == 1:
        v1 = rl[len(rl)-1]
        return ns+abs(v-v1)
    if lrl == 2:
        v1 = rl[len(rl)-1]
        v2 = rl[len(rl)-2]
        ns1 = ns + abs(v-v2)
        ns2 = ns + abs(v-v1) + abs(v1-v2)
        # print("lrl 2:",v1,v2,ns1,ns2,ns)
        return min(ns1,ns2)
    else:
        v1 = rl[len(rl)-1]
        c1 = -1
        if skip == False:
            crl = copy.copy(rl)
            c1 = calc(crl,ns+abs(v-v1),True)
        v2 = rl[len(rl)-2]
        rl.pop(len(rl)-1)
        c2 = calc(rl,ns+abs(v-v2),False)
        if (c1 == -1):
            return c2
        else:
            return min(c1,c2)

print(calc(l,0,False))


### FIXED CODE ###

N = int(input())
h = list(map(int, input().split()))
 
suml = [1e5 for i in range(N)]
suml[0] = 0
suml[1] = abs(h[1] - h[0])
 
for e in range(2, N):
    suml[e] = min(
        abs(h[e]-h[e-1]) + suml[e-1],
        abs(h[e]-h[e-2]) + suml[e-2],
    )
 
# print(suml)
print(suml[N-1])
S=list(map(int,input()))
a=0
b=0
for i in range(lin(S)):
  if S[i]==1:
    a+=1
  else:
    b+=1
print(2*min(a,b))

### FIXED CODE ###

S=list(map(int,input()))
a=0
b=0
for i in range(len(S)):
    if S[i]==1:
        a+=1
    else:
        b+=1
print(2*min(a,b))
s = list(input())
c = 0
li = ["A","C","G","T"]
li2 = []
for i in range(len(s)):
    if s[i] in li:
        c += 1
        
    else:
        li2.append(c)
        c = 0
print(max(li2))

### FIXED CODE ###

s = list(input())
c = 0
li = ["A","C","G","T"]
li2 = []
for i in range(len(s)):
    if s[i] in li:
        c += 1
        
    else:
        li2.append(c)
        c = 0
li2.append(c)
print(max(li2))
n = int(input())
a = list(map(int,input().split()))

def solve(a):
    if min(a) < 0:
        return False
    
    for i in range(n):
        if a[i] != 0:
            break
        if i == n-1:
            return True

    for i in range(n):
        b = []
        for j in range(n):
            c = a[(i+j)%n]-j-1
            b.append(c)

        if solve(b):
            return True

if solve(a):
    print('YES')
else:
    print('NO')

### FIXED CODE ###

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

if sum(a) % (n*(n+1)//2) != 0:
    print('NO')
    exit()
else:
    k = sum(a)// (n*(n+1)//2)


for i in range(n-1):
    d = a[i+1] - a[i] - k

    if d > 0 or d % n != 0:
        print('NO')
        exit()

print('YES')
import sys

x = sys.argv[1]

x3 = int(x) ** 3

print x3

### FIXED CODE ###

import sys

x = sys.stdin.readline()

x3 = int(x) ** 3

print x3
import sys
sys.setrecursionlimit(50000)
n = int(input())
a = [int(input()) for i in range(n)]

switch = [False] * (n + 1)
def button(x,cnt):
    if switch[x]:
        print(-1)
        return -1
    if x == 2:
        print(cnt)
        return
    switch[x] = True
    button(a[x - 1], cnt + 1)
    return cnt

ans = button(1, 0)

### FIXED CODE ###

import sys
sys.setrecursionlimit(200000)
n = int(input())
a = [int(input()) for i in range(n)]

switch = [False] * (n + 1)
def button(x,cnt):
    if switch[x]:
        print(-1)
        return -1
    if x == 2:
        print(cnt)
        return
    switch[x] = True
    button(a[x - 1], cnt + 1)
    return cnt

ans = button(1, 0)
import sys
sys.setrecursionlimit(10**9)
n, m = map(int, input().split())

root = [-1]*n

def find(n):
    if root[n] < 0:
        return n
    else:
        root[n] = find(root[n])
        return root[n]

def unite(x, y):
    x = find(x)
    y = find(y)
    if x == y:
        return
    else:
        root[x] += root[y]
        root[y] = x

for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    unite(a, b)

print(-min(root))

### FIXED CODE ###

d, t, s = map(int, input().split())
if d/s <= t:
    print("Yes")
else:
    print("No")
S = input()

if S == ("SUN"):
    pritn(7)
elif S == ("MON"):
    print(5)
elif S == ("TUE"):
    print(4)
elif S == ("WED"):
    print(3)
elif S == ("THU"):
    print(2)
elif S == ("FRI"):
    print(1)
elif S == ("SAT"):
    print(1)

### FIXED CODE ###

S = input()

if S == ("SUN"):
    print(7)
elif S == ("MON"):
    print(6)
elif S == ("TUE"):
    print(5)
elif S == ("WED"):
    print(4)
elif S == ("THU"):
    print(3)
elif S == ("FRI"):
    print(2)
elif S == ("SAT"):
    print(1)
r = int(input())
if r < 1200:
  print(ABC)
elif 1200 <= r < 2800:
  print(ARC)
else:
  print(AGC)

### FIXED CODE ###

r = int(input())
if r < 1200:
  print('ABC')
elif 1200 <= r < 2800:
  print('ARC')
else:
  print('AGC')
import math
a = input()
n = list(map(int, input().split()))
ans = float("inf")
for i in a:
  ans = min(ans, len(bin(i)) - bin(i).rfind("1")-1)
print(round(ans))  

### FIXED CODE ###

import math
n = input()
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
    ans = min(ans, len(bin(i)) - bin(i).rfind("1") - 1)
print(round(ans))
n = int(input())
S = list(map(int, input().split()))
SENTINEL = 10 ** 9 + 1
count = 0

def merge(S, left, mid, right):
    L = S[left:mid] + [SENTINEL]
    R = S[mid:right] + [SENTINEL]
    i = j = 0
    global count
    for k in range(left, right):
        if(L[i] <= R[i]):
            S[k] = L[i]
            i += 1
        else:
            S[k] = R[j]
            j += 1
    count += right - left

mergeSort(S, left, right):
    if(left + 1 < right):
        mid = (left + right) // 2
        mergeSort(S, left, mid)
        mergeSort(S, mid, right)
        merge(S, left, mid, right)

mergeSort(S, 0, n)
print(*S)
print(count)

### FIXED CODE ###

n = int(input())
S = list(map(int, input().split()))
SENTINEL = 10 ** 9 + 1
count = 0
 
def merge(S, left, mid, right):
    L = S[left:mid] + [SENTINEL]
    R = S[mid:right] + [SENTINEL]
    i = j = 0
    global count
    for k in range(left, right):
        count += 1
        if (L[i] <= R[j]):
            S[k] = L[i]
            i += 1
        else:
            S[k] = R[j]
            j += 1
 
def mergeSort(S, left, right):
    if(left + 1 < right):
        mid = (left + right) // 2
        mergeSort(S, left, mid)
        mergeSort(S, mid, right)
        merge(S, left, mid, right)
 
mergeSort(S, 0, n)
print(*S)
print(count)
N= int(input())
i= int(input())
j=0

j=N-i+1

print (j)
    


### FIXED CODE ###

N,i=map(int,input().split( ))
count=0

while N>=i:
    count+=1
    N-=1


print(count)
import math
a, b, c = map(int, input().split())
a_sqrt = math.sqrt(a)
b_sqrt = math.sqrt(b)
c_sqrt = math.sqrt(c)

if (a+b) > c:
	print('No')

if (a_sqrt+b_sqrt) < c_sqrt:
	print('Yes')
else:
	print('No') 

### FIXED CODE ###

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

def f(n):
	fact = 1
  
	for i in range(1,n+1): 
	    fact = fact * i
	return fact

def nCr(n,r):
    
    return f(n) / f(r) / f(n-r)

possibles=0
biggest_sub=S//3
for i in range(1,biggest_sub+1):
	left=S-3*i
	possibles+=nCr(left+i-1,i-1)
n=10**9+7
print(possibles%n)

### FIXED CODE ###

#import sys
#input = sys.stdin.readline
Q = 10**9+7
def cmb(n,r):
    if n-r < r: r = n-r
    if r == 0: return 1
    denominator = 1                       #分母
    numerator = 1                         #分子
    for i in range(r):
        numerator *= n-i
        numerator %= Q
        denominator *= i+1
        denominator %= Q
    return numerator*pow(denominator, Q-2, Q)%Q
 
def main():
    S = int( input())
    ans = 0
    for i in range(1, S//3+1):
        t = S - i*3
        ans += cmb(t+i-1,i-1)
        ans %= Q
    print(ans)
        
if __name__ == '__main__':
    main()
from collections import defaultdict,deque
H, W = map(int,input().split())
MAP = []
for _ in range(H):
    MAP.append(tuple(map(str,input())))

move = [[0,1],[0,-1],[1,0],[-1,0]]

def bfs(s):
    MAX = 0
    stack = deque([])
    stack.append(tuple(s))
    depth =dict()
    depth[tuple(s)] = 0
    goal = s
    while stack:
        v = stack.popleft()
        for m in move:
            a = tuple([v[0]+m[0], v[1] + m[1]])
            if a[0] < H and a[0] >=  0 and a[1] < W and a[1] >= 0:
                if MAP[a[0]][a[1]] == '.' and not a in depth:
                    stack.append(a)
                    depth[a] = depth[v] + 1

    for k,d in depth.items():
        if MAX < d:
            MAX = d
            goal = k

    return MAX, goal


for i in range(0,H):
    for r in range(W):
        if "." in MAP[r]:
            start = [r, MAP[r].index(".")]
MAX, goal = bfs(tuple(start))
MAX, _ = bfs(tuple(goal))
print(MAX)
exit()

### FIXED CODE ###

from collections import defaultdict,deque
H, W = map(int,input().split())
MAP = []
for _ in range(H):
    MAP.append(tuple(map(str,input())))

move = [[0,1],[0,-1],[1,0],[-1,0]]
MAX = 0 

def bfs(s):
    global MAX
    stack = deque([])
    stack.append(tuple(s))
    depth =dict()
    depth[tuple(s)] = 0
    while stack:
        v = stack.popleft()
        for m in move:
            a = tuple([v[0]+m[0], v[1] + m[1]])
            if a[0] < H and a[0] >=  0 and a[1] < W and a[1] >= 0:
                if MAP[a[0]][a[1]] == '.' and not a in depth:
                    stack.append(a)
                    depth[a] = depth[v] + 1

    for d in depth.values():
        MAX = max(MAX,d)


for i in range(0,H):
    for j in range(0,W):
        if MAP[i][j] == '.':
            bfs(tuple([i,j]))

for i in range(0,W):
    for j in range(0,H):
        if MAP[j][i] == '.':
            bfs(tuple([j,i]))

print(MAX)
r = input()
pi = 3.14159265358979
print("{0:10f} {1:10f}".format(r * r * pi, 2 * r * pi))

### FIXED CODE ###

r = input()
r = float(r)
pi = 3.14159265358979
print("{0:10f} {1:10f}".format((r ** 2 * pi), (2 * r * pi)))
S = input()
K = int(input())
cnt = 0
for i in range(len(S)-1):
    if (S[i]==S[i+1])&&(S[i-1]!=S[i]):
        cnt += K
print(cnt)

### FIXED CODE ###

s=input()
k=int(input())
l=len(s)
now=1
seq=[]
re=False
all=False
for i in range(l):
    if s[i%l]==s[(i+1)%l]:
        if i==l-1:
            re=True
            if len(seq)==0:
                all=True
            else:
                first=seq[0]//2
                end=now//2
                seq[0]=(seq[0]+now)
        now+=1
    else:
        seq.append(now)
        now=1
if all:
    ans=len(s)*k//2
else:
    seq=[i//2 for i in seq]
    if re:
        ans=sum(seq)*k-seq[0]+first+end
    else:
        ans=sum(seq)*k

print(ans)