peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
from collections import deque
import sys
input = sys.stdin.readline

S = deque(input().rstrip())
Q = int(input())
rev = False
for _ in range(Q):
    q = input().split()
    if q[0] == '1':
        rev = rev ^ True
    else:
        F, C = q[1:]
        if (F == '1') ^ rev:
            S.appendleft(C)
        else:
            S.append(C)
S = list(S)
if rev:
    S.reverse()
print(''.join(S))
# Judge status: Accepted
l, r = map(int, input().split())

ans = float('inf')
for i in range(l, min(r + 1, l + 2020)):
    for j in range(i + 1, min(r + 1, i + 1 + 2020)):
        ans = min(ans, i * j % 2019)

print(ans)
# Judge status: Accepted
n = int(input())
w = [input() for i in range(n)]

def checkDuplication(wordList):
    if len(set(wordList)) == n:
        return True
    else :
        return False

def checkMatch(wordList):
    checkCount = 0
    for i in range(n-1):
        if wordList[i][-1] == wordList[i+1][0]:
            pass
        else:
            checkCount += 1
    
    if checkCount:
        return False
    else: 
        return True

if checkMatch(w) and checkDuplication(w):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
# A - ABC Swap
X,Y,Z = list(map(int, input().split()))
A=X
B=Y
C=Z

#箱Aと箱Bの中身を入れ替える
T=A
A=B
B=T

#箱Aと箱 Cの中身を入れ替える
T=A
A=C
C=T

print(A,B,C)
# Judge status: Wrong Answer
A, B, C, D = map(int, input().split())
first = A-C
second = B-D
if (A>C):
    if first >= second:
        print("No")
    else:
        print("Yes")
elif(A==C):
    if B>D:
        print("Yes")
    else:
        print("No")
else:
    if first >= second:
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
W,H,x,y=map(int, input().split())
ans1=H*W/2
if W%2==0 and H%2==0 and x==W//2 and y==H//2:
    ans2=1
else:
    ans2=0

print(ans1, ans2)
# Judge status: Accepted
s = list(str(input()))

n = len(s)
k = int((n+3)/2 - 1)
flag = 0
for i in range(n-1):
    if not s[i] == s[n-1-i]:
        break
else:
    flag += 1

for i in range(int((n-1)/2)):
    if not s[i] == s[int((n-1)/2 - 1 - i)]:
        break
else:
    flag += 1

for k in range (n):
    if not s[k] == s[n-1-k]:
        break
else:
    flag += 1

if flag == 3:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n=int(input())
a=[list(input()) for i in range(n)]
alpha=[0]*26
for aa in a:
    for x in range(26):
        if chr(ord("a")+x) in aa:
            alpha[x]+=1
ans=""
for x,i in enumerate(alpha):
    if i==n:
        mini=51
        for aa in a:
            cnt=aa.count(chr(ord("a")+x))
            mini=min(mini,cnt)
        ans+=(chr(ord("a")+x))*mini
print(ans)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = sum(B)

for i in range(N-1):
    if A[i] == A[i+1] - 1:
        print(str(A[i])+ " : " +str(A[i+1]))
        ans += C[A[i]-1]

print(ans)
# Judge status: Wrong Answer
print("NYOE S"['7' in input()::2])
# Judge status: Wrong Answer
str = input()
length = len(str)
ans = [""] * length
for x in range(length):
    if str[length - (x + 1)] == "P":ans[length - (x + 1)] += "P"
    elif str[length - (x + 1)] == "D":ans[length - (x + 1)] += "D"
    elif str[length - (x + 1)] == "?":
        if x == 0 or x == length - 1: ans[length - (x + 1)] = "D"
        elif ans[length - x] == "D": ans[length - (x + 1)] = "P"
        elif ans[length - x] == "P": ans[length - (x + 1)] = "D"
print(''.join(ans))
# Judge status: Wrong Answer
s = list(input())
if s[2] == s[3]:
    if s[4] == s[5]:
        print("Yes")
else:
    print("No")
# Judge status: Accepted
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

n, m, k = inm()


def solve():
    for x in range(n + 1):
        for y in range(m + 1):
            a = m * x + n * y - 2 * x * y
            if a == k:
                return True
    return False


print("Yes" if solve() else "No")
# Judge status: Accepted
s1 = input().split()
s2= s1[1]
s1=s1[0]

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

if(s==s1):
	print(a-1,b)
else:
  	print(a,b-1)
# Judge status: Accepted
def main():
    a, b = map(int, input().split())

    if a < 10 and b < 10:
        print(a*b)
    else:
        print(-1)

if __name__ == '__main__':
    main()
# Judge status: Accepted
a,b,c,d = map(int, input().split())
while  True:
    c -= b
    if c <= 0:
        print('Yes')
        break
    a -= d
    if a <= 0:
        print('No')
        break
# Judge status: Accepted
N = int(input())
ans = [0]*(N+1)
for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            n = x*x + y*y + z*z + x*y + y*z + z*x
            if n <= N:
                ans[n] += 1
print(*ans[1:], sep='\n')
# Judge status: Accepted
N = int(input())
X = list(map(int, input().split()))
Y = []
for x in range(100):
    y = [(X[i] - x)**2 for i in range(len(X))]
    Y.append(sum(y))
print(min(Y))
# Judge status: Wrong Answer
# https://atcoder.jp/contests/abc121/tasks/abc121_c

n, m = map(int, input().split())

shop = []
for _ in range(n):
    a, b = map(int, input().split())
    shop.append((a, b))

shop.sort(key=lambda x: x[1])

c = 0
ans = 0
i = 0
while c < m and i < n:
    a, b = shop[i]
    if c + b >= m:
        ans += (m - c) * a
        c += (m - c)
    else:
        ans += b * a
        c += b
    i += 1
print(ans)
# Judge status: Accepted
S = int(input())
if S == 1:
    print("0")
else:
    print("1")
# Judge status: Accepted
S = input()
T = input()
l = len(T)
if(S == T[0:l-1]):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n,m=map(int,input().split())
for i in range(m):
  if n%2==0 and 2*m-i-i-1>=n//2:
    print(i+1,2*m-i+1)
  else:
    print(i+1,2*m-i)
# Judge status: Accepted
import re
s = input()
str = ["dream","dreamer","erase","eraser"]
str = ["maerd","remaerd","esare","resare"]
s=s[::-1]
while len(s)>0:
  if len(s) < 5:
    print("NO")
    break
  if s[0:7] == str[1] :
    s=s[7:]
  elif s[0:6] == str[3]:
    s=s[6:]
  elif s[0:5] == str[0] or s[0:5] == str[2]:
    s=s[5:]
  else:
    print("NO")
    break
  if len(s)==0:
    print("YES")
    break
# Judge status: Wrong Answer
s=input()
s.replace("eraser","")
s.replace("erase","")
s.replace("dreamer","")
s.replace("dream","")

if len(s)==0: print("YES")
else: print("NO")
# Judge status: Wrong Answer
x, n = map(int, input().split())
arr = sorted(list(map(int, input().split())))
mins = 10000
idx = 0
for i in range(1, 101):
    if abs(i-x) < mins and i not in arr:
        mins = abs(i-x)
        idx = i
print(idx)
# Judge status: Wrong Answer
import math
A,B,C=map(int,input().split())
s=[A,B,C]
t=sorted(s)
u=(t[2]-t[0],t[2]-t[1],0)
if u[0]%2==0 and u[1]%2==0:
    print((u[0]+u[1])/2)
elif u[0]%2==1 and u[1]%2==1:
    print(round((1+u[0]//2+u[1]//2)))
elif u[0]%2==1 and u[1]%2==0:
    print(round(((u[0]+1)/2+u[1]/2+1)))
else:
    print(round(((u[1]+1)/2+u[0]/2+1)))
# Judge status: Accepted
#!/usr/bin/env python3
import sys
rl = sys.stdin.buffer.readline

N, K = map(int, rl().split())
AS = tuple(map(int, rl().split()))

for i in range(K, N):
  print('Yes' if AS[i-K] < AS[i] else 'No')
# Judge status: Accepted
h = int(input())
#2n-1,2**2
for i in range(10**12):
    if 2**i > h:
        check = i-1
        break
print(2*(2**check)-1)
# Judge status: Accepted
n = int(input())
#n,m = map(int,input().split())
lst1 = list(map(int,input().split()))

dic1 = dict()

for i in lst1:
    if i in dic1:
        dic1[i] += 1
    else:
        dic1[i] = 1

ans = 0

for i in dic1:
    if i > dic1[i]:
        ans += dic1[i]
    elif i < dic1[i]:
        ans += dic1[i] - i

print(ans)
# Judge status: Wrong Answer
N,K = map(int,input().split())
enemys = list(map(int,input().split()))
enemys = sorted(enemys)
if K >= len(enemys):
  print(0)
else:
  enemys = enemys[K:]
  print(sum(enemys))
# Judge status: Accepted
N, K = [int(x) for x in input().split()]
P = sorted([int(x) for x in input().split()])
ans = 0
for i in range(K):
  ans += P[i]
print(ans)
# Judge status: Accepted
N, x = map(int, input().split())
A = list(map(int, input().split()))
A.sort()

ans = 0
for a in A[:-1]:
    if x - a >= 0:
        x -= a
        ans += 1
print(ans + (A[-1] == x))
# Judge status: Accepted
a = int(input())
b = int(input())
c = int(input())
x = int(input())

count = 0
for i in range(a + 1):
    for j in range(b + 1):
        for k in range(c + 1):
            if i * 500 + j * 100 + k * 50 == x:
                count += 1
print(count)
# Judge status: Accepted
from collections import Counter
from itertools import accumulate
from bisect import bisect_right


def factor(n):
    res = []
    for i in range(2, int(n ** .5) + 1):
        while n % i == 0:
            res.append(i)
            n //= i
    if n > 1:
        return res + [n]
    else:
        return res


stairs = list(accumulate(i for i in range(1, 64)))
N = int(input())
factors = factor(N)
ans = 0
for cnt in Counter(factors).values():
    ans += bisect_right(stairs, cnt)
print(ans)
# Judge status: Wrong Answer
N = (input().split())
TH = int(N[0])
TP = int(N[1])
AH = int(N[2])
AP = int(N[3])
AI,TI = 0,0
chk = 0
NNa,NNb = 0 ,0

if 1 <= TH <= 100 and 1 <= TP <= 100 and 1 <= AH <= 100 and 1 <= AP <= 100:
  while chk == 1:
    AI += TP
    NNa +=1
    if AI <= AH:
      chk += 1
  chk = 0
  while chk == 1:
    AI += TP
    NNb +=1
    if TI <= TH:
      chk += 1
  if NNa <= NNb:
    print('Yes')
  else:
    print('No')
# Judge status: Accepted
N, x = map(int, input().split())
a = list(map(int, input().split()))
s_a = sorted(a)
cnt = 0

for i in range(N-1):
    if(s_a[i] <= x):
        cnt += 1
        x -= s_a[i]
if(s_a[N-1] - x == 0):
    cnt += 1
print(cnt)
# Judge status: Wrong Answer
import bisect
X, N=map(int, input().split())
if N==0:print(X);exit()
p=sorted(list(map(int, input().split())))
#print(p)
m=min(p)-1
M=max(p)+1
#for i in range(m,M+1):
#  p.append(i)
#p=sorted(p)
m=X;i=0
for i in range(m,min(p)-2,-1):
  if i not in p:break
M=X;j=0
for j in range(M,max(p)+2):
  if j not in p:break

print(min(i,j))
# Judge status: Wrong Answer
s = list(input())
k = list("keyence")
i = 0
cur = 0
while cur <= len(s)-1:
  if s[cur] == k[i]:
    i += 1
  cur += 1
  if i == 7:
    print("YES")
    break
else:
  print("NO")
# Judge status: Accepted
import sys

def solve():
    input = sys.stdin.readline
    N, K = map(int, input().split())
    A = [int(a) for a in input().split()]
    mid = A.index(1)
    count = 1
    r = K - 1
    while r < mid:
        r += (K - 1)
        count += 1

    if r < N - 1:
        l = N - K
        count += 1
        while l > r:
            l -= (K - 1)
            count += 1
    print(count)


    return 0

if __name__ == "__main__":
    solve()
# Judge status: Wrong Answer
import itertools
N = int(input())
height_list = list(map(int,input().split()))

spy_dict = {}
for i in range(0,N):
    spy_dict[i+1] = height_list[i]

L_dict = {}
R_dict = {}
for i in spy_dict:
    L = i + spy_dict[i]
    L_dict[i] = L
    R = i - spy_dict[i]
    R_dict[i] = R

counter = 0
for i in range(1,N):
    for j in range(i+1,N+1):
        print(i, j)
        if L_dict[i] == R_dict[j]:
            counter += 1

print(counter)
# Judge status: Accepted
from collections import defaultdict

S = defaultdict(int)
for i in input():
    S[i] += 1

if len(S.values()) == 2:
    a, b = S.values()
    if a == b == 2:
        print('Yes')
        exit()
print('No')
# Judge status: Accepted
def main():
    a,b = (int(x) for x in input().split())
    print(a if a<=b else a-1)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N, K = map(int, input().split())
H = list(map(int, input().split()))
print(H)
for i in range(min(K,N)):
    saidai = max(H)
    H.remove(saidai)
print(H)

print(sum(H))
# Judge status: Wrong Answer
def zz():
    return map(int,input().split())

a,b,c = zz()
ans = 0
for i in range(1,b+1):
   if (a*i)%b == c:
       ans += 1
       break

if ans == 0:
    print("No")
else:
    print("Yes")
# Judge status: Wrong Answer
A,B,K=map(int,input().split())
k=0
n=1
while 1:
  if A%n==0 and B%n==0:
    k+=1
  if K==k:
    break
  n+=1
print (n)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
a.sort()

alice = sum(a[-1::-2])
bob = sum(a[-2::-2])

print(alice-bob)
# Judge status: Accepted
N,M=map(int,input().split())
ans=0
if(N>=M//2):
  print(M//2)
else:
  print(N+(M-N*2)//4)
# Judge status: Wrong Answer
n = int(input())
s = input()
e = [0] * (n + 1)
w = [0] * (n + 1)

for i in range(len(s)):
    if s[i] == "E":
        e[i+1] = e[i] + 1
        w[i+1] = w[i]
    else:
        w[i+1] = w[i] + 1
        e[i+1] = e[i]

t = [0] * n
ans = 10 ** 9
for i in range(1, n+1):
    t = w[i-1] + e[n] - e[i-1] 
    ans = min(ans, t)

print(ans)
# Judge status: Accepted
from collections import Counter

def factors(n: int):
    l = []
    for i in range(2, int(n**0.5) + 1):
        #prime factorization
        while n % i == 0:
            n //= i
            l.append(i)
    if n > 1:
        l.append(n)
    return l

c = Counter(factors(int(input())))
ans = 0
for items,values in c.items():
    cnt = 1
    while cnt <= values:
        values -= cnt
        ans += 1
        cnt += 1
print(ans)
# Judge status: Wrong Answer
a = input()
vowel = set("abcde")
if a in vowel:
  print("vowel")
else:
  print("consonant")
# Judge status: Accepted
a, b = map(int, input().split())
s = input()
flg = 0
for i in range(a +b +1):
    try:
        if (0 <= int(s[i]) <= 9):
            if i == a:
                flg = 0
                break
    except:
        if i == a:
            flg = 1
        else:
            flg = 0
            break
print("Yes" if flg == 1 else "No")
# Judge status: Accepted
n = int(input())
rt = n
def sums(st: str):
  return sums(st[:-1])+int(st[-1]) if len(st) >1 else int(st)
for a in range(1,n//2):
  b = n - a
  tmp = sums(str(b)) + sums(str(a))
  if tmp < rt:
    rt = tmp
print(rt)
# Judge status: Wrong Answer
K = int(input())
S = input()
ls = list(S)
if len(S) >= K:
  ansl = ls[0:K]
  print(''.join(ansl) + '...')
else:
  print(S)
# Judge status: Accepted
n = input()
a = list('abcdefghijklmnopqrstuvwxyz')
a = set(a)
v = []
for i in a:
    if not i in n:
        v.append(i)
if len(v) == 0:
    print('None')
else:
    v.sort()
    print(v[0])
# Judge status: Wrong Answer
import numpy as np
N = int(input())
table = np.array([list(map(int, input().split())) for _ in range(N)])

inf, sup = np.median(table, axis=0)
diff = int(sup - inf)
if N % 2 == 0:
    diff *= 2
print(diff + 1)
# Judge status: Wrong Answer
import copy

N = int(input())
a = [0]+list(map(int, input().split()))
b = copy.copy(a)
for j in range(N//2, 0, -1):
    if sum(b[j::j]) % 2 != a[j]:
        b[j] = 1

print(sum(b[1:]))
if sum(b[1:]) != 0:
    print(*[i for i, j in enumerate(b) if j == 1])
# Judge status: Accepted
n = int(input())
s = format(input())

w = 0
e = 0

w_list = [0]
e_list = [0]
for i in range(n):
  if s[i] == "W":
    w += 1
  else:
    e += 1
  w_list.append(w)
  e_list.append(e)

ans = 10**10
for i in range(1, n+1):
  ans = min(ans, w_list[i-1] + (e_list[-1] - e_list[i]))

print(ans)
# Judge status: Accepted
a,b=map(int, input().split())

n=a+b

print(-(-n//2))
# Judge status: Wrong Answer
W,H,w,h = map(float, input().split())
ans =0
if w ==h:
    ans =1
print('{:9f} {}'.format(W*H/2, ans))
# Judge status: Wrong Answer
import math
import collections
import fractions
import itertools

def solve():
    n = int(input())
    a = list(map(int, input().split()))
    deq = collections.deque()
    for i in range(n):
        if i % 2 == 0:
            deq.append(str(a[i]))
        else:
            deq.appendleft(str(a[i]))
    print(" ".join(deq))
    return 0

if __name__ == "__main__":
    solve()
# Judge status: Accepted
from collections import Counter
N = int(input())
c = Counter([tuple(sorted(input())) for _ in range(N)])
print(sum([(v*(v-1))//2 for v in c.values()]))
# Judge status: Wrong Answer
x = int(input())
a = list(map(int,input().split()))
a.sort()
y = 0
for i in range(x):
  y += a[i-0]*(2**i)
print(y//(2**(x+1)))
# Judge status: Accepted
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

m = min(a,b,c,d,e)

import math

point = 4

point += math.ceil(n/m)

print(point)
# Judge status: Accepted
N = int(input())
p = list(map(int, input().split()))

cnt = 0
for i in range(N):
    if i + 1 == p[i]:
        cnt += 1

if cnt >= N - 2:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
S, W = list(map(int, input().split()))

if S <= W:
    print('unsafe')
else:
    print('safe')
# Judge status: Accepted
N, M = [int(i) for i in input().split(' ')]
print((N * (N - 1) + M * (M - 1)) // 2)
# Judge status: Accepted
S = input()
if len(list(set((sorted(S))))) == 3:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())
A = list(map(int, input().split()))

out = 0
A.sort(reverse=True)
for i in range(n):
    if (i + 1) * 2 <= n:
        out += A[i] * 2
    elif (i + 1) * 2 - 1 <= n:
        out += A[i]

print(out - A[0])
# Judge status: Accepted
s=input() ; n=len(s)
ss=n//2; tt=n//2
ans=0
for i in range(n):
    if s[i]=="S":
        ans=max(ans, ss-tt)
        ss-=1
    else:
        tt-=1
print(ans*2)
# Judge status: Wrong Answer
w, h, n = map(int, input().split())
x1 = 0
y1 = 0
x2 = w
y2 = h
for i in range(n):
    x, y, a = map(int, input().split())
    if a == 1:
        x1 = x
    elif a == 2:
        x2 = x
    elif a == 3:
        y1 = y
    else:
        y2 = y

print((x2-x1)*(y2-y1))
# Judge status: Wrong Answer
# 正の整数aとb
a, b = map(int, input().split())
# aとbの積が偶数か奇数か判別する

# 積が奇数なら'Odd'、偶数なら'Even'と出力する
if int(a * b / 2) == int(a * b / 2 + 0.5):
    print('even')
else:
    print('Odd')
# Judge status: Accepted
def calc_temp(t, h):
	return t - h * 0.006

n = int(input())
ta = input().split()
t = int(ta[0])
a = int(ta[1])

h = list(map(int,input().split()))

h_len = len(h)

best_abs = None
best_i = None

i = 1
i_abs = None

for h_item in h:

	temperature = calc_temp(t = t, h = h_item)
	i_abs = abs(temperature - a)



	if best_abs == None:
		best_abs = i_abs
		best_i = i

	if best_abs > i_abs:
		best_abs = i_abs
		best_i = i	

	i = i + 1	


print(best_i)
# Judge status: Accepted
a,b = map(int, input().split())
if a>0 or (b<0 and (b-a)%2==1) :
    print('Positive')
elif a==0 or b==0 or (a<0 and b>0):
    print('Zero')
else:
    print('Negative')
# Judge status: Accepted
N, M = map(int, input().split())
A = list(map(int, input().split()))

SUM_A = sum(A)
if N < SUM_A:
    print(-1)
else:
    print(N - SUM_A)
# Judge status: Wrong Answer
n, m = list(map(int, input().split()))
S = [input().split() for _ in range(m)]
S = [[int(s[0]), s[1]] for s in S]
acf = [0] * n
p = 0
for s in S:
    if s[1] == 'AC':
        acf[s[0] - 1] = 1
        continue
    elif acf[s[0] - 1] == 0:
        p += 1
        continue
ans = ' '.join(list(map(str, [sum(acf), p])))
print(ans)
# Judge status: Wrong Answer
A, B, C, K = map(int, input().split())

if K <= A+B:
    print(A)
elif A+B < K <= A+B+C:
    print(A-(K-A-B))
# Judge status: Wrong Answer
n=int(input())
s=[int(input()) for i in range(n)]
s.sort(reverse=True)
ans=0
res=0
for i in range(n):
  res+=s[i]
  if res%10==0:
    ans=max(ans,0)
  else:
    ans=max(ans,res)
print(ans)
# Judge status: Wrong Answer
N = int(input())
S_List = [input() for _ in range(N)]
S = [[S_List[i][j] for j in range(len(S_List[i]))] for i in range(N)]
common = []
common = S[0].copy()
for s in S:
    for c in common:
        if not c in s:
            common.remove(c)
common.sort()
ans = ""
for c in common:
    ans += c
print(ans)
# Judge status: Accepted
a, b = map(int, input().split())

c = (a + 1) // 2
d = a // 2

e = (c + d) * (b // 2)

if a == 1 or b == 1:
    print(1)
else:
    print(e if b % 2 == 0 else e + c)
# Judge status: Accepted
n = int(input())
k = int(input())
x = int(input())
y = int(input())

x_days = min(n, k)
y_days = n - x_days

print(x * x_days + y * y_days)
# Judge status: Wrong Answer
from collections import Counter

n = int(input())
a = []
for _ in range(n):
  a.append(input())

dct = dict(Counter(a))
for v, num in dct.items():
  print(v + " x " + str(num))
# Judge status: Accepted
L, R, d = map(int, input().split())
cnt = 0
for i in range(L,R+1):
    if i%d == 0:
        cnt += 1
print(cnt)
# Judge status: Accepted
N,K,X,Y=[int(input()) for i in range(4)]

if(K>=N):
  Z=N*X
  print(Z)
else:
  Z=K*X+(N-K)*Y
  print(Z)
# Judge status: Accepted
import sys

if __name__ == "__main__":
    N = int(sys.stdin.readline())
    A = list(map(lambda x: int(x), sys.stdin.readline().split()))
    
    ans = 0
    for i, a in enumerate(A):
        if i%2==0 and a % 2 == 1:
            ans += 1
        
    print(ans)
# Judge status: Wrong Answer
a = input()
if '9' in a: 
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
n=int(input())
l=list(map(int,input().split()))
d=list(map(int,input().split()))
k=list(map(int,input().split()))
s=sum(l)
for i in range(n-1):
    if(l[i]+1==l[i+1]):
        s+=k[l[i]-1]
print(s)
# Judge status: Wrong Answer
S,T=input().split(' ')
A,B=map(int,input().split(' '))
print(A+B-1)
# Judge status: Accepted
def main():
    N, M = (int(i) for i in input().split())
    XY = [[int(i)-1 for i in input().split()] for j in range(M)]
    red = [False]*N
    red[0] = True
    cnt = [1]*N
    for x, y in XY:
        cnt[x] -= 1
        cnt[y] += 1
        if red[x]:
            red[y] = True
        if cnt[x] == 0:
            red[x] = False
    print(red.count(True))


if __name__ == '__main__':
    main()
# Judge status: Accepted
N = int(input())
S = input()

sl = 0
sr = 0
slmax = 0
srmax = 0
for i in range(N):
  if(S[i] == '('):
    sl -= 1
  else:
    sl += 1
  slmax = max(slmax, sl)
for i in range(N):
  if(S[N-i-1] == '('):
    sr += 1
  else:
    sr -= 1
  srmax = max(srmax, sr)
for i in range(slmax):
  S = '(' + S
for i in range(srmax):
  S = S + ')'
print(S)
# Judge status: Wrong Answer
import datetime
base_date = datetime.datetime.strptime('2019/04/30', "%Y/%m/%d")

S = input()

S_date = datetime.datetime.strptime(S, "%Y/%m/%d")

if S_date <= base_date:
    print('HEISEI')
else :
    print('TBD')
# Judge status: Accepted
s, w = map(int, input().split())
print('safe' if w<s else 'unsafe')
# Judge status: Accepted
n,m=map(int,input().split())
sc=[list(map(int,input().split())) for _ in range(m)]
for i in range(10**n):
    ans=str(i)
    if len(ans)==n and all(ans[s-1]==str(c) for s,c in sc):
        print(ans)
        exit()
print(-1)
# Judge status: Accepted
n, m = map(int, input().split())
cnt = [1] * (n + 1)
in_r = [0] * (n + 1)
in_r[1] = 1
for _ in range(m):
    x, y = map(int, input().split())
    cnt[x] -= 1
    cnt[y] += 1
    if in_r[x] == 1:
        in_r[x] = min(cnt[x], 1)
        in_r[y] = 1
ans = sum(in_r)
print(ans)
# Judge status: Accepted
a, b, c = map(int, input().split())
if a == b and a != c:
    print("Yes")
elif a == c and a != b:
    print("Yes")
elif b == c and b != a:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n=int(input())
# a,b,c=map(int,input().split())
cnt=0
def gcd(a,b):
    if a==0: return b
    else: return gcd(b%a,a)
# print(gcd(a,b))

def gcd_3(a,b,c):
    if gcd(a,b)==0: return c
    else: return gcd(c % gcd(a,b),gcd(a,b))

for i in range(1,n+1):
    for j in range ( 1 , n + 1 ):
        for k in range ( 1 , n + 1 ):
            # cnt+=gcd_3(i,j,k)
            cnt+=1


print(cnt)
# Judge status: Accepted
import math


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

print("YES" if a<=c<=a+b else "NO" )
# Judge status: Accepted
k, n = map(int, input().split())
a = list(map(int, input().split()))
A = []
for i in range(n-1):
    A.append(a[i+1]-a[i])
A.append(k-a[n-1]+a[0])
print(k-max(A))
# Judge status: Accepted
N = int(input())
A_List = [int(i) for i in input().split()]

Y = 0
M = 10**9+7
tempSum = sum(A_List)

for x in A_List:
    tempSum -= x
    Y += x * tempSum
    Y = Y%M
print(Y)