peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
K,N=map(int,input().split())
A=list(map(int,input().split()))
l=0
for i in range(N-2):
    if (A[i+2]-A[i+1])>=(A[i+1]-A[i]):
        l=A[i+2]-A[i+1]
if (20-A[N-1]+A[0])>=l:
    l=20-A[N-1]+A[0]
print(K-l)
# Judge status: Accepted
s = input()
print(len(s)-''.join(reversed(s)).find('Z')-s.find('A'))
# Judge status: Wrong Answer
n, m = map(int, input().split())
py = sorted([[i] + list(input().split()) for i in range(m)], key=lambda x: (x[1], x[2]))

x = sorted(py)[0][1]
a = 1
ans = []
for i, p, y in py:
    if x != int(p):
        x = int(p)
        a = 1
    
    ans.append([i, p.zfill(6)+str(a).zfill(6)])
    a += 1

for i, v in sorted(ans):
    print(v)
# Judge status: Wrong Answer
n, m, k = [int(i) for i in input().split()]
book_list = [int(i) for i in input().split()]
book_list.extend([int(i) for i in input().split()])

book_list.sort()

times = 0
book_num = 0
for i in book_list:
    if times + i > k:
        break

    times += i
    book_num += 1

print(book_num)
# Judge status: Accepted
n,k,q=map(int,input().split())
correct=[0]*n
for i in range(q):
    a=int(input())
    correct[a-1]+=1
    
for i in range(n):
    if k<=q-correct[i]:
        print("No")
    else:
        print("Yes")
# Judge status: Wrong Answer
import math
X = int(input())
original = 100
n =  0
while True:
    n+=1
    original = math.ceil(original * 1.01)
    if original >= X:
      break
print(n)
# Judge status: Accepted
N, A, B = map(int, input().split())
distance = abs(A - B)
if distance % 2 == 1:
    print(min(A - 1, N - B) + 1 + (distance - 1) // 2)
else:
    print(distance // 2)
# Judge status: Wrong Answer
r,g,b=input().split()
x=r+g+b
y=int(x)
if y%4==0:
	print('Yes')
else:
	print('No')
# Judge status: Wrong Answer
# input
N = int(input())
A = list(map(int, input().split()))

# check
B = sorted(
    [
        abs(a - (i + 1))
        for i, a in enumerate(A)
    ]
)
median = B[N // 2]
res = 0
for i in range(N):
    res += max(median - B[i], -median + B[i])
print(res)
# Judge status: Wrong Answer
input()
A = list(map(int, input().split()))

A.sort()
minval = A[0]
count = 0

while minval % 2 == 0:
  minval /= 2
  count += 1
  
print(count)
# Judge status: Wrong Answer
n, m = map(int, input().split())

if n == 1:
    print(m-2)
elif m == 1:
    print(n-2)
elif n == 2 or m == 2:
    print(0)
else:
    print((n-2) * (m-2))
# Judge status: Accepted
n,k = map(int, input().split())
a = list(map(int, input().split()))

for i in range(k):
    nxt = [0]*n
    for j in range(n):
        l = j-a[j]
        r = j+a[j]+1
        if l < 0:
            l = 0
        nxt[l] += 1
        if r < n:
            nxt[r] -= 1
    for j in range(n-1):
        nxt[j+1] += nxt[j]
    if a == nxt:
        break
    a = nxt
print(*a)
# Judge status: Accepted
L, R, d = map(int,input().split())
num = d
ans = 0
while num <= R:
    if num >= L:
        ans+=1
    num +=d
print(ans)
# Judge status: Wrong Answer
N = int(input())
L = list(map(int,input().split()))
L.sort()
count = 0
for i in range(N-2):
  if L[i+2] < L[i+1] + L[i]:
    count += 1
print(count)
# Judge status: Wrong Answer
N=int(input())
A=list(map(int, input().split()))
ans=1
flg=0
for i in range(N):
    if ans>10**18:
        flg=1
        break
    else:
        ans*=A[i]
if flg==0:
    print(ans)
else:
    print(-1)
# Judge status: Wrong Answer
from decimal import *
getcontext().prec = 5000
#import numpy as np

a, b, c = map(float, input().split())

##print(a**0.5, b**0.5, c**0.5)
if Decimal(a).sqrt()+ Decimal(b).sqrt() < Decimal(c).sqrt():
    print('Yes')
else:
    print('No')
# Judge status: Accepted
s = list(input().strip())
len_s = len(s)
if s[len_s-1] == "s":
    s += "es"  
else:
    s += "s"
s= "".join(s)
print(s)
# Judge status: Accepted
x = int(input())

cnt = 0
i = 0
while i < x:
    i += cnt
    cnt += 1
print(cnt - 1)
# Judge status: Wrong Answer
N = int(input())
a = list(map(int,input().split()))
count = 0
count2 = 0
count0 = 0
for i in range(N):
  if a[i]%4 == 0:
    count += 1
  elif a[i]%2 == 0:
    count2 += 1
  else:
    count0 += 1
if count2 == 0:
  if count0 <= count + 1:
    print("Yes")
  else:
    print("NO")
else:
  if count0 <= count:
    print("Yes")
  else:
    print("NO")
# Judge status: Accepted
N = int(input())
A = [int(i) for i in input().split()]
i_Ai = {}
cnt = 0

for i, h in enumerate(A):
	imh = i - h
	if imh in i_Ai:
		cnt += i_Ai[imh]
	iph = i + h
	if iph in i_Ai:
		i_Ai[iph] += 1
	else:
		i_Ai[iph] = 1
print(cnt)
# Judge status: Accepted
n = int(input())
A = []
B = []
for i in range(n):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

A.sort()
B.sort()
if n%2 == 1:
    ans = B[n//2]-A[n//2]+1
else:
    x = A[n//2-1]+A[n//2]
    y = B[n//2-1]+B[n//2]
    ans = y-x+1
print(ans)
# Judge status: Accepted
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))

max_digits = 60
MOD = 10**9 + 7

ans = 0
for i in range(max_digits):
    one_num = np.count_nonzero((a >> i) & 1)
    radix_mod = 2**i % MOD
    ans += (radix_mod * one_num * (n - one_num)) % MOD
print(ans%MOD)
# Judge status: Wrong Answer
n=int(input()) 
res="No" 
for i in range(3):
  if n%7==0:
    res="Yes"
  n//=10
print (res)
# Judge status: Wrong Answer
X = int(input())
if X in [3, 5, 7]:
    print('YES')
else:
    print('No')
# Judge status: Accepted
n = int(input())
h = list(map(int,input().split()))
dp = [10**4] * (n+1)
dp[0] = 0
dp[1] = abs(h[1]-h[0])
for i in range(2,n):
    dp[i] = min(dp[i-2] + abs(h[i-2] - h[i]), dp[i-1] + abs(h[i-1] - h[i]))
# print(dp)
print(dp[n-1])
# Judge status: Accepted
a, b, c = map(int, input().split())
print(max(0, c - (a - b)))
# Judge status: Accepted
#!/usr/bin/env python3

N, M = list(map(int, input().split()))
h_list = list(map(int, input().split()))
h_dict = {i + 1: h for i, h in enumerate(h_list)}
h_set = set(h_dict.keys())
no_list = []

for _ in range(M):
    a, b = list(map(int, input().split()))
    if h_dict[a] == h_dict[b]:
        no_list.append(a)
        no_list.append(b)
    elif h_dict[a] > h_dict[b]:
        no_list.append(b)
    else:
        no_list.append(a)

no_set = set(no_list)
ans = len(h_set - no_set)

print(ans)
# Judge status: Wrong Answer
N = int(input())
MOD = 1e+9 + 7
a = [int(i) for i in input().split()]

ans = 0
for i in range(N):
  for j in range(i+1, N):
    ans += a[i] ^ a[j]
    ans %= MOD
    
print(ans)
# Judge status: Accepted
x, y, a, b, c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

ans = p[:x] + q[:y] + r[:x+y]
ans.sort(reverse=True)

print(sum(ans[:x+y]))
# Judge status: Accepted
p, q, r = map(int, input().split())
print(min(p + q, q + r, r + p))
# Judge status: Wrong Answer
n, k = map(int, input().split())

if n == 0:
    print(k)
elif n % k == 0:
    print(0)
elif n < k:
    print(n)
else:
    rem = n % k
    if abs(rem-k) < rem:
        print(abs(rem-k))
    else:
        print(rem)
# Judge status: Accepted
# Problem A - ><

S = input()
N = len(S) + 1

num_list = [0]*N
ans_sum = 0

# < process
for i in range(len(S)):
    s = S[i]
    if s=="<":
        num_list[i+1] = num_list[i] + 1

# > process
for i in range(len(S)-1, -1, -1):
    s = S[i]
    if s==">":
        num_list[i] = max(num_list[i], num_list[i+1]+1)

# sum process
for i in range(N):
    ans_sum = ans_sum + num_list[i]

print(ans_sum)
# Judge status: Accepted
#!/usr/bin/env python
# coding: utf-8

# In[15]:


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


# In[18]:


a.sort()
ai = max(a)
diff = ai
old = diff
for x in a[:-1]:
    tmp = abs(x-ai/2)
    if tmp <= diff:
        aj = x
        diff = tmp
    if diff == old:
        break
    else:
        old = diff
print(ai,aj)


# In[ ]:
# Judge status: Accepted
N = int(input())
sp = []
for i in range(N):
  s, p = input().split()
  sp.append([s, int(p), i+1])
sp1 = sorted(sp, key = lambda x: (x[0], -1*x[1]))
for i in range(N):
  print(sp1[i][2])
# Judge status: Accepted
s = input()
 
first_A = None
last_Z = None
for i, c in enumerate(s):
    if c == 'A' and first_A is None:
        first_A = i
    if c == 'Z':
        last_Z = i
 
print(last_Z-first_A+1)
# Judge status: Accepted
N,P = map(int,input().split())
A = list(map(int,input().split()))
C = {0:0,1:0}
for i in range(N):
    if A[i]%2==0:
        C[0] += 1
    else:
        C[1] += 1
if P==0:
    if C[1]==0:
        n = 2**C[0]
    else:
        n = 2**C[0]*2**(C[1]-1)
else:
    if C[1]==0:
        n = 0
    else:
        n = 2**C[0]*2**(C[1]-1)
print(n)
# Judge status: Accepted
import math
import collections
import fractions
import itertools
import functools
import operator
import bisect

N = int(input())

def solve():
    mod = 10**9+7
    ans = 10**N - (9**N)*2 + 8**N
    ans %= mod
    print(ans)
    return 0

if __name__ == "__main__":
    solve()
# Judge status: Accepted
a,b,c = [int(a) for a in input().split()]
d = min(a+b,b+c,c+a)
print (d)
# Judge status: Accepted
K = int(input())
A,B = map(int,input().split())
count = 0
for i in range(A,B+1):
  if(i % K == 0):
    count += 1
  else:
    pass
if(count != 0):
  print("OK")
else:
  print("NG")
# Judge status: Accepted
l,r=map(int,input().split())

sho_l = l // 2019
sho_r = r // 2019

if sho_r-sho_l >= 1:
  print(0)
else:
  ans = 2018
  for i in range(l,r):
    for j in range(i+1,r+1):
      ans = min((i*j)%2019,ans)
  print(ans)
# Judge status: Wrong Answer
s = input()
a = [0]*3
for i in s:
    a[ord(i)-97] += 1
a = sorted(a)
if a[2] != a[1] and (a[2]-a[0])%3 == 2 and (a[1]-a[0])%3==1:
    print("NO")
else:
    print("YES")
# Judge status: Wrong Answer
import collections
N=int(input())
a=0
list1 = list(map(int, input().split()))
c = collections.Counter(list1)
for i in range(N):
    a+=int(c[i+1]*(c[i+1]-1)/2)
for i in range(N):
    print(a-c[list1[i]]*2+3)
# Judge status: Accepted
x, y, a,b, c = map(int, input().split())
P = list(map(int, input().split())); P.sort(); P.reverse()
Q = list(map(int, input().split())); Q.sort(); Q.reverse()
R = list(map(int, input().split())); R.sort(); R.reverse()

ans = P[:x] + Q[:y] + R
ans.sort(); ans.reverse()
ans = ans[:(x + y)]

print (sum(ans))
# Judge status: Accepted
def sep():
    return map(int,input().strip().split(" "))
def lis():
    return list(sep())

n=int(input())
ar=lis()
k=0
for i in ar:
    k=(k^i)
for i in ar:
    print(k^i,end=" ")
# Judge status: Accepted
k = int(input())
a, b = map(int, input().split())
cnt = 0

for i in range(a, b+1):
    if i % k == 0:
        print('OK')
        cnt += 1
        break

if cnt == 0:
    print('NG')
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))

M = 1000
X = 0
i = 0

while i<N-1:
  if A[i]<A[i+1]:
    M = M + X * A[i]
    X = M // A[i]
    M = M - X * A[i]
    i += 1
  elif A[i]>A[i+1]:
    M = M + X * A[i]
    X = 0
    i += 1
  else:
    i += 1

print(A[N-1] * X + M)
# Judge status: Accepted
a,b,c=map(int,input().split())
print(max(a,b,c)*9+a+b+c)
# Judge status: Accepted
n=int(input())
mod=10**9+7
ans=1
for i in range(1,n+1):
    ans=(ans*i)%mod
print(ans)
# Judge status: Accepted
N = int(input())
if N % 2 == 1:
    print(0)
    exit()
tmp = 2
ans = 0
while tmp < N:
    tmp *= 5
    ans += N // tmp
print(ans)
# Judge status: Wrong Answer
n = int(input())

i = 0
while True:
    if i*(i+1)//2 >= n:
        break
    i += 1

while True:
    print(i)
    n -= i
    i -= 1
    if n - i <= 0:
        print(n)
        break
# Judge status: Wrong Answer
a,b = map(int,input().split())
print(((1+(b-a))*(b-a))//2)
# Judge status: Accepted
s,w = list(map(int,input().split()))
if s <= w:
    print("unsafe")
else:
    print("safe")
# Judge status: Accepted
import numpy as np
import itertools

N ,M ,Q = map(int,input().split(' '))
ABCD = []
for _ in range(Q):
    ABCD.append(list(map(int,input().split())))

ALL = list(itertools.combinations_with_replacement(range(1,M+1), N))
MAX = 0
for row in ALL:
    SUM = 0
    for a,b,c,d in ABCD:
        if (row[b-1] - row[a-1]) == c:
            SUM += d

    MAX = max(MAX,SUM)
print(MAX)
# Judge status: Accepted
n, k = map(int, input().split())
h = list(map(int, input().split()))
h.sort()
ans = 0
if len(h) == n:
    for i in range(k):
        try:
            h.pop()
        except:
            pass
    for x in h:
        ans += x
    print(ans)
# Judge status: Accepted
H1, M1, H2, M2, K = map(int, input().split())
print((H2 * 60 + M2) - (H1 * 60 + M1) - K)
# Judge status: Wrong Answer
n = int(input().strip())
count = 0
for i in range(n):
  a,b = map(int,input().strip().split())
  if a == b and count == 3:
    print('YES')
  elif a == b:
    count += 1
  else:
    count = 0
print('NO')
# Judge status: Accepted
import numpy as np
from numba import jit
N,K=map(int,input().split())
A=np.array(list(map(int,input().split())),dtype=np.int64)
@jit
def loop(a,k):
  if k>41:
    ans=np.ones(N,dtype=np.int64)*N
  else:
    ans=a
    for j in range(k):
      B=np.zeros(N+1,dtype=np.int64)
      for i in range(N):
        B[max(0,i-int(ans[i]))] +=1
        B[min(N,i+int(ans[i])+1)] -=1
      ans=np.cumsum(B)[:N]
  return ans

for i in loop(A,K):
  print(i)
# Judge status: Wrong Answer
a,b,x = map(int,input().split())
if a >= x:
    print("NO")
elif a + b >= x:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
n, l = map(int, input().split())

d = {}
for i in range(n):
    d[input()] = 0

s = sorted(d.keys(), key=lambda x: x[0])

ans = []
for i in s:
    ans.append(i)
print("".join(ans))
# Judge status: Wrong Answer
a,b=map(int,input().split())
print(a+b if a+b <= 24 else a + b -24)
# Judge status: Accepted
import sys

INF = sys.maxsize

N = int(input().strip())
h = [int(x) for x in input().split()]

memo = [INF] * N

for i in range(N - 1, -1, -1):
  if i == N -1:
    memo[i] = 0
  else:
    memo[i] = min(
      memo[i + 1] + abs(h[i] - h[i + 1]) if i + 1 < N else INF,
      memo[i + 2] + abs(h[i] - h[i + 2]) if i + 2 < N else INF                        
    )
  
print(memo[0])
# Judge status: Accepted
rate = int(input())

if rate < 600:
    print(8)
elif rate < 800:
    print(7)
elif rate < 1000:
    print(6)
elif rate < 1200:
    print(5)
elif rate < 1400:
    print(4)
elif rate < 1600:
    print(3)
elif rate < 1800:
    print(2)
else:
    print(1)
# Judge status: Wrong Answer
s=input()

tmp1 = ''
tmp2 = ''
for i in range(len(s)):
  if i // 2 == 0:
    tmp1 += '0'
    tmp2 += '1'
  else:
    tmp1 += '1'
    tmp2 += '0'
    
diff_tmp1 = 0
diff_tmp2 = 0
for i in range(len(s)):
  if tmp1[i] != s[i]:
    diff_tmp1 += 1
  elif tmp2[i] != s[i]:
    diff_tmp2 += 1
print(min(diff_tmp1,diff_tmp2))
# Judge status: Wrong Answer
a=int(input())
print(a * 3.1415)
# Judge status: Accepted
a, b, c = map(int, input().split())
h = max(a, b, c)
s = a + b + c
ans = 0
if h % 2 == s % 2:
  ans = (h * 3 - s) // 2
else:
  ans = ((h + 1) * 3 - s) // 2
print(ans)
# Judge status: Wrong Answer
import bisect

n = (int)(input())
a = sorted(list(map(int, input().split(" "))))
b = sorted(list(map(int, input().split(" "))))
c = sorted(list(map(int, input().split(" "))))
# Judge status: Accepted
x = int(input())
a = x//100
b = x%100
if b <= a*5:
  print(1)
else:
  print(0)
# Judge status: Accepted
N = int(input())

ans = 0
for i in range(1, N + 1, 2):
    mod_count = 0
    for j in range(1, i + 1):
        if i % j == 0:
            mod_count += 1
    if mod_count == 8:
        ans += 1
print(ans)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
ans=0
for x in range(n):
    for y in range(x+1,n):
        for z in range(y+1,n):
            if a[x]!=a[y] and a[y]!=a[z] and a[z]!=a[x] and a[x]+a[y]>a[z] and a[y]+a[z]>a[x] and a[z]+a[x]>a[y]:
                ans+=1
print(ans)
# Judge status: Wrong Answer
import bisect
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
A=[0]
B=[0]
for i in range(n):
    A.append(A[-1]+a[i])
for i in range(m):
    B.append(B[-1]+b[i])
ans=0
for i in range(n+1):
    index=bisect.bisect_right(B,k-A[i])-1
    index=max(0,index)
    ans=max(ans,i+index)
print(ans)
# Judge status: Accepted
s=sorted(input())
if s[0]==s[1]!=s[2]==s[3]:print('Yes')
else:print("No")
# Judge status: Wrong Answer
N = int(input())
if N < 1000: print("ABC" + str(N))
else: print("ABD" + str(N)[1:3] + str((N + 1) % 10))
# Judge status: Accepted
n = int(input())
s = input()

for i in s:
    ord_s = ord(i)
    if ord_s + n <= 90:
        chr_s = chr(ord_s + n)
    else:
        chr_s = chr(ord_s + n - 26)
    print(chr_s, end = "")
# Judge status: Accepted
ans = [1, 0]
print(ans[int(input())])
# Judge status: Accepted
N=int(input())
L=list(input())
maxa=-10
for i in range(N-1):
  a=set(L[:i+1])
  b=set(L[i+1:])
  maxa=max(maxa,len(a&b))
print(maxa)
# Judge status: Accepted
n,m=map(int,input().split())
c,*a,=map(int,input().split())
for i in range(n-1):
    x,*y,=map(int,input().split())
    a=list(set(a) & set(y))
print(len(a))
# Judge status: Accepted
from math import gcd

K = int(input())
ans = 0
for i in range(1, K+1):
    for j in range(1, K+1):
        for k in range(1, K+1):
            ans += gcd(gcd(i, j), k)

print(ans)
# Judge status: Accepted
N,M = map(int,input().split())
adjacent = [[] for i in range(N)]
for i in range(M):
  A,B = map(int,input().split())
  adjacent[A-1].append(B-1)
  adjacent[B-1].append(A-1)
Michi = [0 for i in range(N)]
visited = set()
frontier = set()
visited.add(0)
frontier.add(0)
while len(frontier) > 0:
  newfrontier = set()
  for v in frontier:
    for next in adjacent[v]:
      if next not in visited:
        Michi[next] = v
        visited.add(next)
        newfrontier.add(next)
  frontier = newfrontier
print('Yes')
for i in range(1,N):
  print(Michi[i]+1)
# Judge status: Accepted
a,b=map(int,input().split())
ans=0
if (a-b)%2!=0:
    ans="IMPOSSIBLE"
else:
    ans=int((a+b)/2)
print(ans)
# Judge status: Accepted
N, M = map(int, input().split())
a = set(list(map(int, input().split()))[1:])
for i in range(N - 1):
    a &= set(list(map(int, input().split()))[1:])
print(len(a))
# Judge status: Accepted
L, R, d = list(map(int, input().split()))
print(int(R/d) - int((L - 1)/d))
# Judge status: Accepted
n = int(input())
l = [0]*100
l[0] = 2
l[1] = 1

for i in range(n):
  l[i+2] = l[i+1] + l[i]
  
print(l[n])
# Judge status: Accepted
N=int(input())
xy=[tuple(map(int,input().split())) for _ in range(N)]
ans=0
zmi=10**10
zma=-10**10
wmi=10**10
wma=-10**10
for x,y in xy:
    zmi=min(zmi,x+y)
    zma=max(zma,x+y)
    wmi=min(wmi,x-y)
    wma=max(wma,x-y)
print(max(zma-zmi,wma-wmi))
# Judge status: Accepted
N = int(input())
X = list(map(int, (input().split())))

distance = lambda Xi, P: (Xi - P) ** 2

X_max = max(X)

answer = None
for P in range(1, X_max + 1):
    total = 0
    for Xi in X:
        total += distance(Xi, P)
    answer = min(total, answer) if answer is not None else total

print(answer)
# Judge status: Accepted
n,k = map(int,input().split())
_ = input()
print(1 + -(-(n-k)//(k-1)))
# Judge status: Wrong Answer
H,N = map(int,input().split())
A = []
B = []
for i in range(N):
    a,b =map(int,input().split())
    A.append(a)
    B.append(b)

G = [0]*(H+1)
G_old = [1000000000]*(H+1)

for i in range(1,N+1):
    for j in range(1,H+1):
        if j-A[i-1]<0:
            G[j] = min(G_old[j], B[i-1])
        else:
            G[j] = min(G_old[j], G[j-A[i-1]]+B[i-1])

print(G[H])
# Judge status: Accepted
N = input()

if N.find("9") == -1:
    print("No")
else:
    print("Yes")
# Judge status: Accepted
N = int(input())

if N == 0:
    print(0)
    exit()

ans = []
while N != 0:
    d = len(ans)
    if N % 2 == 1:
        ans.append('1')
        N -= pow(-1, d)
        N //= 2
    else:
        ans.append('0')
        N //= 2

print(''.join(ans[::-1]))
# Judge status: Accepted
import math
x=int(input())
y=math.ceil(math.sqrt(x))
ans=1
for i in range(y):
    for j in range(y):
        if ans<=i**j<=x:
            ans=i**j
        else:
            continue
print(ans)
# Judge status: Accepted
L , R, d = map(int, input().split())
ans = R//d - (L-1)//d
print(ans)
# Judge status: Accepted
import sys

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

N, *A = map(int, read().split())

ans = 0
for i, x in enumerate(A):
    if i % 2 == 0 and x % 2 == 1:
        ans += 1

print(ans)
# Judge status: Accepted
X = int(input())
t = X//100
if 0 <= X%100 <= t*5:
    print(1)
else:
    print(0)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

cnt = 0

for i in range(n):
    t = min(a[i], b[i])
    cnt += t
    b[i] -= t

    s = min(a[i+1], b[i])
    cnt += s
    b[i] -= s

print(cnt)
# Judge status: Accepted
n=int(input())+1
str1=str(n)
print(int(str1[0])-1+(len(str1)-1)*9)
# Judge status: Wrong Answer
n = int(input())
l = [2,1]
if n == 1:
  print(2)
elif n == 2:
  print(1)
else:
  for i in range(n-1):
    l.append(l[-1]+l[-2])
  print(l[-1])
# Judge status: Accepted
l, r, d = map(int, input().split())
l_ = l // d
r_ = r // d
if l % d == 0:
    print(r_-l_+1)
else:
    print(r_-l_)
# Judge status: Accepted
n=int(input())
l=[list(map(int,input().split())) for i in range(n-1)]

for i in range(n-1):
 ans=l[i][1]+l[i][0]
 for j in range(i+1,n-1):
  if ans<l[j][1]:
   ans=l[j][1]+l[j][0]
  else:
   if ans%l[j][2]!=0:
    ans+=l[j][2]-(ans%l[j][2])
   ans+=l[j][0]
 print(ans)

print(0)
# Judge status: Wrong Answer
k=int(input()[-1])
print(sum(sorted(list(map(int,input().split())))[:k]))
# Judge status: Accepted
N = input()
ans = 0
ans1 = int(N[0])-1
for i in range(len(N)):
    ans += int(N[i])

for i in range(1, len(N)):
    ans1 += 9
print(max(ans, ans1))
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
t = [0]
for i in range(n):
    t.append(t[i] + a[i])
t.pop(0)
p = t[-1] // 2
if p in t:
    print(0)
else:
    for i in range(n):
        if p < t[i]:
            print(abs(sum(a[0:i+1]) - sum(a[i+1:n])))
            break
# Judge status: Accepted
A, B, C = list(map(int,input().split()))
print('Yes' if A <= C <= B else 'No')
# Judge status: Accepted
#from distutils.util import strtobool
s = input()
ss = [int(s[0]) if x % 2 == 0 else int(s[0])^1 for x in range(len(s))]

cnt = 0
for i in range(len(s)):
    if int(s[i]) != ss[i]:
        cnt += 1

print(cnt)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(n):
    if(i+1)%2==1 & a[i]%2==1:
        ans +=1
print(ans)
# Judge status: Wrong Answer
n,m,*L = map(int,open(0).read().split())
mod = 10**9+7

dp = [0]*(n+1)
if 1 in L:
    dp[0] = 0
    dp[1] = 1
elif 1 not in L:
    dp[0] = 1
    dp[1] = 2

for i in range(2,n):
    if i+1 in L:
        continue
    dp[i] = (dp[i-1] + dp[i-2])%mod
 
print(dp[n-1])
# Judge status: Accepted

n = int(input())
a = list(map(int,input().split()))
a = [0] + a

dam1=[]
dam2=[]
for i in range(1,n+1):
    if i%2==1:
        dam1.append(a[i])
    else:
        dam2.append(a[i])

if n%2==0:
    dam2.reverse()
    out=dam2 + dam1
elif n%2==1:
    dam1.reverse()
    out=dam1 + dam2
print(*out)
# Judge status: Accepted
S = input()
T = input()
ans = len(T)
if len(T)==len(S):
    loop = 1
else:
    loop = len(S)-len(T)
for i in range(loop):
    diff = 0
    for s, t in zip(S[i:i+len(T)], T):
        if s!=t:
            diff += 1
    ans = min(ans, diff)
print(ans)
# Judge status: Accepted
N = int(input())

ans = 0
c_list = [[0]*10 for i in range(10)]

for i in range(1,N+1):
    s = str(i)
    c_list[int(s[0])][int(s[-1])] += 1

    
for i in range(10):
    for j in range(10):
        ans += c_list[i][j]*c_list[j][i]
    
print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline
S = int(input())
print(0, 0, 10 ** 9, 1, -S % (10 ** 9), (S + -S % (10 ** 9)) // (10 ** 9))
# Judge status: Accepted
s = input()
t = input()

cur = 0
count_min = 1000
while cur + len(t) -1 < len(s):
    count = 0
    for i in range(len(t)):
        if t[i] != s[i + cur]:
            count += 1
    if count < count_min:
        count_min = count
    cur += 1
print(count_min)
# Judge status: Accepted
a=list(map(int,input().split()))
m=max(a)
mm=max(a)+1
if m%2 == sum(a)%2:
    print((3*m-sum(a))//2)
else:
    print((3*mm-sum(a))//2)