Harryxun/stf_run huggingface dataset:
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
INF =  float("inf")
import bisect
import numpy

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

for i in range(N):
    a[i] = a[i] - i

def f(k):
    return sum(map(lambda x: abs(x-k), a))

c = numpy.median(a)
print(int(f(c)))




### FIXED CODE ###

from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
INF =  float("inf")
import bisect
import statistics

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

for i in range(N):
    a[i] = a[i] - i

def f(k):
    return sum(map(lambda x: abs(x-k), a))

c = statistics.median(a)
print(int(f(c)))
class Line:
    def __init__(self,p1,p2):
        if p1[1] < p2[1]:self.s=p2;self.e=p1
        elif p1[1] > p2[1]:self.s=p1;self.e=p2
        else:
            if p1[0] < p2[0]:self.s=p1;self.e=p2
            else:self.s=p2;self.e=p1
def dot(a,b):return a[0]*b[0] + a[1]*b[1]
def cross(a,b):return a[0]*b[1] - a[1]*b[0]
def dif(a,b):return [x-y for x,y in zip(a,b)]
def InterSection(l,m):
    a = dif(l.e,l.s);b = dif(m.e,l.s);c = dif(m.s,l.s)
    d = dif(m.e,m.s);e = dif(l.e,m.s);f = dif(l.s,m.s)
    g = lambda a, b : cross(a,b)==0 and dot(a,b)>0 and dot(b,b)<dot(a,a)
    if g(a,b) or g(a,c) or g(d,e) or g(d,f):return True
    elif l.s == m.e or l.s == m.s or l.e == m.e or l.e == m.s:return True
    elif cross(a,b) * cross(a,c) >= 0 or cross(d,e) * cross(d,f) >= 0:return False
    else:return True

q = int(input())
for i in range(q):
    x0,y0,x1,y1,x2,y2,x3,y3 = [int(i) for i in input().split()]
    a = [x0,y0] ; b = [x1,y1] ; c = [x2,y2] ; d = [x3,y3]
    l1 = Line(b,1) ; l2 = Line(b,1)
    if InterSection(l1,l2):print(1)
    else:print(0)

### FIXED CODE ###

def cross(a,b):return a[0]*b[1] - a[1]*b[0]

q = range(int(input()))
for i in q:
    a,b,c,d,e,f,g,h = [int(x) for x in input().split()]
    A = [c-a,d-b]; B = [e-a,f-b]; C = [g-a,h-b];
    D = [g-e,h-f]; E = [a-e,b-f]; F = [c-e,d-f];
    if max(a,c) < min(e,g) or max(e,g) < min(a,c) or max(b,d) < min(f,h) or max(f,h) < min(b,d):
        print("0")
    elif cross(A,B) * cross(A,C) <= 0 and cross(D,E) * cross(D,F) <= 0:
        print("1")
    else:
        print("0")
N = input()

if N < 1000:
  out = 1000 - N
elif N % 1000 < 500:
  out = N % 1000
else:
  out = 1000 - N % 1000

print(out)

### FIXED CODE ###

N = int(input())
if N % 1000 == 0:
  print(0)
else:
  print(1000 - N % 1000)
n = input()
k = int(input())

keta = len(n)

# dp0 = ヨユーなやつ, dp1 = ギリなやつ
dp0 = [[0 for j in range(keta+1)] for i in range(keta+1)]
dp1 = [[0 for j in range(keta+1)] for i in range(keta+1)]

dp1[0][0] = 1

for i in range(keta):
    for j in range(keta+1):
        # ギリギリのやつ(dp1)の処理
        if n[i] == '0': # i+1桁目が0の場合
            dp1[i+1][j] = dp1[i][j] # 真上からスライド
        else: # i+1桁目が1~9の場合
            if j < keta:
                dp1[i+1][j+1] = dp1[i][j] # 左上からスライド
        
        # ヨユーなやつ(dp0)の処理
        if n[i] == '0': # i+1桁目が0の場合
            # i桁目がヨユーな状態ではi+1桁目には何でも入れられる
            dp0[i+1][j] += dp0[i][j] # i+1桁目に0を入れた場合
            if j < keta:
                dp0[i+1][j+1] += dp0[i][j] * 9 # i+1桁目に1~9を入れた場合
            # i桁目までギリだったときの、i+1桁目のヨユーなやつのカウント
                # 何もない(ギリである0しか入れられないため)
        else: # i+1桁目が1~9の場合
            # i桁目がヨユーな状態ではi+1桁目には何でも入れられる
            dp0[i+1][j] += dp0[i][j] # i+1桁目に0を入れた場合
            if j < keta:
                dp0[i+1][j+1] += dp0[i][j] * 9 # i+1桁目に1~9を入れた場合
            # i桁目までギリだったときの、i+1桁目のヨユーなやつのカウント
            dp0[i+1][j] += dp1[i][j] # i+1桁目に0を入れた場合
            if j < keta:
                dp0[i+1][j+1] += dp1[i][j] * (ord(n[i])-ord('0')-1) # i+1桁目にrange(1, n[i])を入れた場合

print(dp0[keta][k] + dp1[keta][k])

### FIXED CODE ###

n = input()
k = int(input())

keta = len(n)

# dp0 = ヨユーなやつ, dp1 = ギリなやつ
dp0 = [[0 for j in range(keta+1)] for i in range(keta+1)]
dp1 = [[0 for j in range(keta+1)] for i in range(keta+1)]

dp1[0][0] = 1

for i in range(keta):
    for j in range(keta+1):
        # ギリギリのやつ(dp1)の処理
        if n[i] == '0': # i+1桁目が0の場合
            dp1[i+1][j] = dp1[i][j] # 真上からスライド
        else: # i+1桁目が1~9の場合
            if j < keta:
                dp1[i+1][j+1] = dp1[i][j] # 左上からスライド
        
        # ヨユーなやつ(dp0)の処理
        if n[i] == '0': # i+1桁目が0の場合
            # i桁目がヨユーな状態ではi+1桁目には何でも入れられる
            dp0[i+1][j] += dp0[i][j] # i+1桁目に0を入れた場合
            if j < keta:
                dp0[i+1][j+1] += dp0[i][j] * 9 # i+1桁目に1~9を入れた場合
            # i桁目までギリだったときの、i+1桁目のヨユーなやつのカウント
                # 何もない(ギリである0しか入れられないため)
        else: # i+1桁目が1~9の場合
            # i桁目がヨユーな状態ではi+1桁目には何でも入れられる
            dp0[i+1][j] += dp0[i][j] # i+1桁目に0を入れた場合
            if j < keta:
                dp0[i+1][j+1] += dp0[i][j] * 9 # i+1桁目に1~9を入れた場合
            # i桁目までギリだったときの、i+1桁目のヨユーなやつのカウント
            dp0[i+1][j] += dp1[i][j] # i+1桁目に0を入れた場合
            if j < keta:
                dp0[i+1][j+1] += dp1[i][j] * (ord(n[i])-ord('0')-1) # i+1桁目にrange(1, n[i])を入れた場合

if k > keta:
    print(0)
else:
    print(dp0[keta][k] + dp1[keta][k])
x= input()

for i in range(10000)

	print("Case i: x)

	if x = 0:
?????????????????????break

### FIXED CODE ###

import sys 

cnt =1

while 1:
    x = sys.stdin.readline().strip()
    if x == "0":
        break

    print("Case %d: %s"%(cnt,x))
    cnt+=1
n = int(input())
A = list(map(int, input().split()))
r = 1
d = A[1]-A[0]
if n>2:
    for i in range(2, n):
        if d:
            if (A[i]-A[i-1])*d<0:
                r += 1
                d = 0
        else:
            d = A[i]-A[i-1]
print(r)

### FIXED CODE ###

n = int(input())
A = list(map(int, input().split()))
r = 1
if n>2:
    d = A[1]-A[0]
    for i in range(2, n):
        if d:
            if (A[i]-A[i-1])*d<0:
                r += 1
                d = 0
        else:
            d = A[i]-A[i-1]
print(r)
import sys
n=int(input())
a=[]
f=[]
has2=False
for i in range(n):
  ai=int(input())
  if ai==2:
    has2=True
  a.append(ai)
  f.append(False)

if has2==False:
  print("-1")
  sys.exit()

f[0]=True
now=0
cnt=0
while True:
  if f[now]==True:
    print(-1)
    break
  if now==2:
    print(cnt)
    break
  f[now]=True
  now=a[now]
  cnt++

### FIXED CODE ###

import sys
n=int(input())
a=[]
f=[]
has2=False
for i in range(n):
  ai=int(input())-1
  if ai==1:
    has2=True
  a.append(ai)
  f.append(False)

if has2==False:
  print("-1")
  sys.exit()

now=0
cnt=0
while True:
  
  if f[now]==True:
    print(-1)
    sys.exit()
  if now==1:
    print(cnt)
    sys.exit()
  f[now]=True
  now=a[now]
  cnt+=1
n,k = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
if a[0] >= k:
    print(0)
    exit()
def search(m):
    if m >= k:
        return True
    x = k-a[m]
    dp = [[float("INF")]*(x+1) for i in range(n)]
    dp[0][0] = 0
    now = 0
    for i in range(n):
        if i == m:
            continue
        for j in range(x+1):
            if dp[now][j] !=float("INF"):
                dp[now+1][j] = min(dp[now][j],dp[now+1][j])
                if a[i]+j < x:
                    dp[now+1][a[i]+j] == a[i]+j
                else:    
                    dp[now+1][-1] = min(a[i]+j,dp[now+1][-1])
        now += 1
    if dp[-1][-1] >= k:
        return False
    else:
        return True
le = 0
ri = n


while ri > le+1:
    m = (ri+le)//2

    if search(m):
        ri = m
    else:
        le = m

print(le+1)

### FIXED CODE ###

n,k = map(int,input().split())
a = [0]+sorted(filter(lambda x: x < k, map(int,input().split())))
n = len(a)

def search(m):

    dp = [1] + [0]*k
    for i in range(n):
        if i == m:
            continue
        for j in range(k,a[i]-1,-1):
            dp[j] |= dp[j-a[i]]
    for i in range(k-a[m],k):
        if dp[i]:
            return True
    return False
le = 0
ri = n


while ri > le+1:
    m = (ri+le)//2

    if search(m):
        ri = m
    else:
        le = m

print(le)
n = int(input())
s_p_list = []

for i in range(n):
    s_p_list.append(input().split())
    s_p_list[i].append(i+1)

result = sorted(s_p_list, key=lambda x: (x[0], -int(x[1]))) #sortedは非破壊的

for i in result:
  print(i[2])

### FIXED CODE ###

a, p = map(int, input().split())
print((a*3+p)//2)
N=int(input())
A=list(map(int,input().split()))
div_flg=False
inc_flg=False
dec_flg=False
ans=0

for i in range(N):
  if inc_flg:
    if i==N-1:
      break
    if A[i]<=A[i+1]:
      continue
    else:
      inc_flg=False
      div_flg=False
  elif dec_flg:
    if i==N-1:
      break
    if A[i]>=A[i+1]:
      continue
    else:
      dec_flg=False
      div_flg=False
  else:
    if i==0:
      ans+=1
      div_flg=True
    elif i==N-1:
      if not div_flg:
        ans+=1
      break
    if A[i]==A[i+1]:
      if not div_flg:
        ans+=1
      div_flg=True
      continue
    elif A[i]<A[i+1]:
      if not div_flg:
        ans+=1
      inc_flg=True
      continue
    elif A[i]>A[i+1]:
      if not div_flg:
        ans+=1
      dec_flg=True
      continue
print(ans)

### FIXED CODE ###

import sys

N=int(input())
A=list(map(int,input().split()))
div_flg=False
inc_flg=False
dec_flg=False
ans=0

if N==1:
  print(1)
  sys.exit()
  
for i in range(N):
  if inc_flg:
    if i==N-1:
      break
    if A[i]<=A[i+1]:
      continue
    else:
      inc_flg=False
      div_flg=False
  elif dec_flg:
    if i==N-1:
      break
    if A[i]>=A[i+1]:
      continue
    else:
      dec_flg=False
      div_flg=False
  else:
    if i==0:
      ans+=1
      div_flg=True
    elif i==N-1:
      if not div_flg:
        ans+=1
      break
    if A[i]==A[i+1]:
      if not div_flg:
        ans+=1
      div_flg=True
      continue
    elif A[i]<A[i+1]:
      if not div_flg:
        ans+=1
      inc_flg=True
      continue
    elif A[i]>A[i+1]:
      if not div_flg:
        ans+=1
      dec_flg=True
      continue
print(ans)
a, b = map(int, input())

if a < b:
    print(a)
else:
    print(a-1)

### FIXED CODE ###

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

if a <= b:
    print(a)
else:
    print(a-1)
N = int(input())
A = list(map(int,input().split()))

count = 0
while True:
  x = 0
  for i in A:
    if i % 2 == 1:
      x = 1
  if x == 1:
    break
  else:
    A = A / 2
    count += 1

print(count)

### FIXED CODE ###

import numpy as np
N = int(input())
A = list(map(int,input().split()))
A = np.array(A)
count = 0
while True:
  x = 0
  for i in A:
    if i % 2 == 1:
      x = 1
  if x == 1:
    break
  else:
    A = A / 2
    count += 1

print(count)
import os
import sys
from collections import defaultdict

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N, M = list(map(int, sys.stdin.readline().split()))
AB = [list(map(int, sys.stdin.readline().split())) for _ in range(M)]

graph = [[] for _ in range(N + 1)]
counts = defaultdict(int)
for i, (a, b) in enumerate(AB):
    graph[a].append((b, i))
    graph[b].append((a, i))
    counts[a] += 1
    counts[b] += 1

# 偶数なら全部出す
ans = []
used = [False] * (N + 1)
p = -1
while p != len(ans):
    p = len(ans)
    for v in range(1, N + 1):
        if counts[v] % 2 == 0:
            for u, i in graph[v]:
                if used[i]:
                    continue
                ans.append((v, u))
                used[i] = True
                counts[v] -= 1
                counts[u] -= 1
if len(ans) == M:
    for a in ans:
        print(*a)
else:
    print(-1)


### FIXED CODE ###

import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N, M = list(map(int, sys.stdin.readline().split()))
AB = [list(map(int, sys.stdin.readline().split())) for _ in range(M)]

graph = [[] for _ in range(N + 1)]
for a, b in AB:
    graph[a].append(b)
    graph[b].append(a)


def spanning_tree(root, ret=None, seen=None):
    if ret is None:
        ret = [set() for _ in range(N + 1)]
    if seen is None:
        seen = [False] * (N + 1)
        seen[root] = True
    for v in graph[root]:
        if seen[v]:
            continue
        ret[root].add(v)
        seen[v] = True
        ret = spanning_tree(v, ret, seen)
    return ret


if M % 2 == 1:
    print(-1)
    exit()

# 全域木
root = 1
st = spanning_tree(root)

# 出次数
outdeg = [0] * (N + 1)
ans = []
# 使わなかった辺に向きをつける
for a, b in AB:
    if a not in st[b] and b not in st[a]:
        ans.append((a, b))
        outdeg[a] += 1


def dfs(par):
    # 全域木で par 以下の辺に向きをつける
    for v in st[par]:
        if st[v]:
            dfs(v)
        if outdeg[v] % 2 == 0:
            ans.append((par, v))
            outdeg[par] += 1
        else:
            ans.append((v, par))
            outdeg[v] += 1


dfs(root)
for r in ans:
    print(*r)
import itertools
import sys
import numpy as np
from collections import defaultdict
import bisect

sys.setrecursionlimit(10 ** 9)
M = 1000000007
N = int(input())
left = list(map(int, input().split()))

indices = defaultdict(list)
for i, x in enumerate(left):
    indices[x].append(i)


def dp(t, ns):
    n1, n2, n3 = ns
    remaining = n1 + n2 + n3
    if remaining < 0:
        return 0
    cached = t[n1, n2, n3]
    if cached >= 0:
        return cached
    last_cnt = left[remaining - 1] + 1
    res = 0
    if last_cnt == n1:
        res += dp(t, sorted([n1 - 1, n2, n3]))
        res %= M
    if last_cnt == n2:
        res += dp(t, sorted([n1, n2 - 1, n3]))
        res %= M
    if last_cnt == n3:
        res += dp(t, sorted([n1, n2, n3 - 1]))
        res %= M
    # print(f"{remaining}: ({n1},{n2},{n3}) => {res}")
    t[n1, n2, n3] = res
    return res


def solve():
    h = [0, 0, 0]
    for i in range(N):
        k = len(indices[i])
        if k == 3:
            h[0] = h[1] = h[2] = i + 1
        elif k == 2:
            h[0] = h[1] = i + 1
        elif k == 1:
            h[0] = i + 1
        else:
            break
    t = -np.ones(shape=(h[0] + 1, h[1] + 1, h[2] + 1), dtype=np.int64)
    t[0, 0, 0] = 1
    res = dp(t, sorted(h))
    return res * len(set(itertools.permutations(h))) % M


print(solve())


### FIXED CODE ###

import itertools
import sys
from collections import Counter

sys.setrecursionlimit(10 ** 9)
M = 1000000007
N = int(sys.stdin.readline())
left = list(map(int, sys.stdin.read().split()))
counter = Counter(left)


def dp(t, ns):
    cached = t.get(ns)
    if cached is not None:
        return cached
    remaining = sum(ns)
    assert remaining > 0
    last_cnt = left[remaining - 1] + 1
    n1, n2, n3 = ns
    res = 0
    if last_cnt == n1:
        res += dp(t, tuple(sorted([n1 - 1, n2, n3])))
        res %= M
    if last_cnt == n2:
        res += dp(t, tuple(sorted([n1, n2 - 1, n3])))
        res %= M
    if last_cnt == n3:
        res += dp(t, tuple(sorted([n1, n2, n3 - 1])))
        res %= M
    # print(f"{remaining}: ({n1},{n2},{n3}) => {res}")
    t[ns] = res
    return res


def solve():
    h = [0, 0, 0]
    for i in range(N):
        k = counter[i]
        if k == 3:
            h[0] = h[1] = h[2] = i + 1
        elif k == 2:
            h[0] = h[1] = i + 1
        elif k == 1:
            h[0] = i + 1
        else:
            break
    if sum(h) != N:
        return 0
    t = dict()
    t[0, 0, 0] = 1
    res = dp(t, tuple(sorted(h)))
    return (res * len(set(itertools.permutations(h)))) % M


print(solve())
import numpy as np
n, k = map(int, input().split())
s = list(map(lambda x: x == "1", list(input())))


def p(value, *args, **kwargs):
    print(*map(int, value), *args, **kwargs)

# ---
change_flg = False
cnt = 0
ilands = []


def change():
    global cnt, change_flg
    ilands.append(cnt)
    cnt = 0
    change_flg = not change_flg

for value in s:
    if value: # case 1 cnt
        if change_flg:
            change()
    else: # case 0 cnt : plus
        if not change_flg:
            change()
    cnt += 1

ilands.append(cnt)

if len(ilands) <= k:
    print(n)
    exit()

if not len(ilands) % 2:
    ilands.append(0)

merged = list(np.cumsum(ilands))
section = 2 * k + 1

results = [0] * (len(ilands) // 2 - (k - 1))

merged.append(0)
for i in range(len(results)):
    start = i * 2 - 1
    results[i] = merged[start + section] - merged[start]
#     print(start, section + start, merged[section + start], merged[start])
# 
# print(ilands)
# print(merged)
# print(results, len(ilands) // 2 - (k - 1))

print(max(results))


### FIXED CODE ###

n, k = map(int, input().split())
s = list(map(lambda x: x == "1", list(input())))

change_flg = False
cnt = 0
ilands = []


def cumsum(array):
    value = array[0]
    results = [value] * len(array)
    for index, elm in enumerate(array[1:], 1):
        value += elm
        results[index] = value
    return results


def change():
    global cnt, change_flg
    ilands.append(cnt)
    cnt = 0
    change_flg = not change_flg

for value in s:
    if value: # case 1 cnt
        if change_flg:
            change()
    else: # case 0 cnt : plus
        if not change_flg:
            change()
    cnt += 1

ilands.append(cnt)

if not len(ilands) % 2:
    ilands.append(0)

merged = list(cumsum(ilands))
section = 2 * k + 1

results = [0] * (len(ilands) // 2 - (k - 1))
if len(results) < 1 or len(merged) < section:
    print(n)
    exit()

merged.append(0)
for i in range(len(results)):
    start = i * 2 - 1
    results[i] = merged[start + section] - merged[start]

print(max(results))
from fractions import gcd
from math import ceil

def lcm(a, b):
    return a*b//gcd(a, b)

def num(l, r, n):
    return r//n-(l-1)//n

a, b, c, d = map(int, input().split(' '))

l = lcm(c, d)
print((b-a+1)-num(a, b, c)-num(a, b, d)+num(a, b, l))

### FIXED CODE ###

s = list(int(s) for s in input())

for i in range(0, len(s)-1):
    if s[i] == s[i+1]:
        print('Bad')
        break

else:
    print('Good')
import sys
input = sys.stdin.readline
n = int(input())
c = []
for i in range(n):
  a = [int(i) for i in input().split()]
  c.append(a)

p,q,r = c[0]
if n == 1:
  print(p,q,r)
  exit()

end = c[-1]
c = c[1:]
for i in range(101):
  for j in range(101):
    chk = abs(p-i)+abs(q-j)+r
    for num,k in enumerate(c):
      x,y,h = k
      if abs(x-i)+abs(y-j)+h != chk and h != 0:
        break
      if k == end:
        ans = (i,j,chk)

print(*ans)

### FIXED CODE ###

n = int(input())
if n == 1:
  print('Hello World')
  exit()
else:
  a = int(input())
  b = int(input())
  print(a+b)
l = 12
def island(f,x,y,m):
    rf = f[:][:]
    if rf[y][x] == 1:
        rf[y][x] = m
        for i in [-1,1]:
            if 0 <= x+i <= l-1:
                rf = island(rf,x+i,y,m)
            if 0 <= y+i <= l-1:
                rf = island(rf,x,y+i,m)
    return rf

while True:
    f = []

    for i in range(l):
        f.append(map(int, list(raw_input())))
    for y in range(l):
        for x in range(l):
            f = island(f,x,y,m)
            m += 1

    m, ans = 2, []
    for i in range(l):
        for j in range(l):
            ans.append(f[i][j])
    print len(list(set(ans)))-1

    try   : raw_input()
    except: break

### FIXED CODE ###

W,H = 12,12
dxy = [[1,0],[0,1],[-1,0],[0,-1]]
def solve(field,w,h):
	if 0 <= w < W and 0 <= h < H and field[h][w] == "1":
		field[h][w] = "0"
		for dx,dy in dxy:
			solve(field,w+dx,h+dy)

while 1:
	try:
		field = [list(raw_input()) for i in range(H)]
		ans = 0
		for h in range(H):
			for w in range(W):
				if field[h][w] == "1":
					solve(field,w,h)
					ans += 1
		print ans
		raw_input()
	except:
		break
def getMinCostJump(arr,i,n,cache):
    if i > n: return 0
    if i == n: return 0
    if cache[i] != 0:
        return cache[i]
    op1,op2 = 0,0
    if (i+1) < n:
        op1 += abs(arr[i] -arr[i+1]) + getMinCostJump(arr,i+1,n,cache)
    if (i+2) < n:
        op2 += abs(arr[i] -arr[i+2]) + getMinCostJump(arr,i+2,n,cache)
    cache[i] = min(op1,op2)
    return cache[i]
n = int(input())
arr = [int(i) for i in input().split()]
cache = [0 for i in range(n+1)]
print(getMinCostJump(arr,0,n,cache))  

### FIXED CODE ###

n = int(input())
arr = [int(i) for i in input().split()]
dp = [0 for i in range(n)]
for i in range(1,n):
    op1 = abs(arr[i]-arr[i-1]) + dp[i-1]
    op2 = abs(arr[i]-arr[i-2]) + dp[i-2] if i != 1 else float("inf")
    dp[i] = min(op1,op2)
print(dp[n-1])
s = input()
flag = 0
for i in len(range(s)):
  if s[i]=="C":
    flag=1
  if s[i]=="F" and flag=1:
    flag=2
if flag>1:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

s = input()
flag = 0
for i in range(len(s)):
  if s[i]=="C":
    flag=1
  if s[i]=="F" and flag==1:
    flag=2
if flag>1:
  print("Yes")
else:
  print("No")
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]

k = int(input() + 1)

print(a[k])

### 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]

k = int(input()) -1

print(a[k])
import math


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


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

print(lcm(a, b))


### FIXED CODE ###

import fractions


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


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

print(lcm(a, b))
W, H, x, y = map(int, input().split())
 
print(double(W*H/2), 0 if x*2 == W and y*2 == H else 1)

### FIXED CODE ###

W, H, x, y = [int(i) for i in input().split()]
print(W*H / 2, int(x*2 == W and y*2 == H))
# coding: utf-8
# Your code here!
from collections import deque
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

n,m = [int(i) for i in readline().split()]

if m%2: print(-1); exit()

L = [0]*n

g = [set() for _ in range(n)]
for i in range(m):
    a,b = [int(i) for i in readline().split()]
    g[a-1].add(b-1)
    g[b-1].add(a-1)
    L[a-1] += 1
    L[b-1] += 1


used = [0]*m
def dfs(v):
    res = 0
    for c in g[v]:
#        if used[i] == 1: continue1
        if c not in g[v]: g[v].remove(c)
        if v not in g[c]: g[c].remove(v)
        p =  dfs(c)
        if p%2 == 1:
            print(v+1,c+1)
        else:    
            print(c+1,v+1)
        res += p
    return res+1


for i in range(n):
    dfs(i)
#print(q)












### FIXED CODE ###

# coding: utf-8
# Your code here!
from collections import deque
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

n,m = [int(i) for i in readline().split()]

if m%2: print(-1); exit()

#L = [0]*n

g = [[] for _ in range(n)]
for i in range(m):
    a,b = [int(i) for i in readline().split()]
    g[a-1].append((b-1,i))
    g[b-1].append((a-1,i))
#    L[a-1] += 1
#    L[b-1] += 1



used = [0]*m
usedp = [0]*n
def dfs(v):
    res = 0
    for (c,i) in g[v]:
        if used[i] == 1: continue
        used[i] = 1
        if usedp[c] == 1:
            res += 1
            print(v+1,c+1)
            continue
        usedp[c] = 1
        p =  dfs(c)
        if p%2 == 1:
            print(v+1,c+1)
        else:    
            print(c+1,v+1)
        res += p
    return res+1


for i in range(n):
    dfs(i)
#print(q)