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

S = input()[:-1]
cnt = defaultdict(int)
cnt[0] = 1
ans = 0
now = 0

for i in range(len(S)-1, -1, -1):
    now = (int(S[i])*pow(10, len(S)-1-i, 2019)+now)%2019
    ans += cnt[now]
    cnt[now] += 1

print(ans)
# Judge status: Wrong Answer
A,B,T=map(int,input().split());print(T/A*B)
# Judge status: Wrong Answer
n = int(input())
cnt = 0
for i in range(1, n + 1):
    if len(str(n)) % 2:
        cnt += 1
print(cnt)
# Judge status: Accepted
N, K = map(int, input().split())
A = [1] + list(map(int, input().split()))

p = 1
points = [p]
visited = set([p])

for _ in range(N):
    p = A[p]
    if p in visited:
        break
    points.append(p)
    visited.add(p)

idx = points.index(p)

if idx > K:
    print(points[K])
    exit()

cycle = points[idx:]

print(cycle[(K - idx) % len(cycle)])
# Judge status: Accepted
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

l = ni()

print(l**3/27)
# Judge status: Accepted
a,b,c,k =map(int,input().split())
ans = 0
if k % 2 == 1:
  ans = b-a
else:
  ans = a-b

if abs(ans)>10**18:
  print("Unfair")
else:
  print(ans)
# Judge status: Accepted
from collections import deque
N,M = map(int,input().split())
cnct = [[] for i in range(N+1)]
for _ in range(M):
  A,B = map(int,input().split())
  cnct[A].append(B)
  cnct[B].append(A)
Q = deque()
Q.append(1)
ans = [0]*(N+1)
vstd = [0]*(N+1)
while Q:
  temp = Q.popleft()
  for a in cnct[temp]:
    if vstd[a] == 0:
      ans[a] = temp
      vstd[a] = 1
      Q.append(a)
print('Yes')
for a in ans[2:]:
  print(a)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
k=sum(a)
if n==0:
    print(1 if a[0]==1 else -1)
    exit()
ans=1
e=1
for i in range(n):
    e-=a[i]
    k-=a[i]
    if e<0:
        print(-1)
        exit()
    elif e==0 and k>0:
        print(-1)
        exit()
    if 2*e<k:
        e*=2
    elif e<k:
        e=k
    #print("e",e)
    ans+=e
print(ans if e==k else -1)
# Judge status: Accepted
N = int(input())
A = [int(a) for a in input().split()]
A.sort(reverse=True)
print(sum(A[1:N * 2 + 1:2]))
# Judge status: Wrong Answer
import sys

s=input()
t=input()
r=""

for i in range(len(t)):
  if s==t:
    print("Yes")
    sys.exit()
    
  r=s[-1]
  s=s.rstrip(s[-1])
  s=r+s
  
if s==t:
  print("Yes")
  
else:
  print("No")
# Judge status: Accepted
n,y = map(int, input().split())


s = [-1,-1,-1]

for i in range(n+1):
    for j in range(n+1-i):
        if 10000*i + 5000*j +1000*(n-i-j) == y:
            s = [i,j,n-i-j]
            break

print(*[x for x in s])
# Judge status: Accepted
N, M = map(int, input().split())

mn = 0
mx = 10**6

for i in range(M):
    l, r = map(int, input().split())
    mn = max(l, mn)
    mx = min(r, mx)

result = max(0, mx - mn + 1)
print(result)
# Judge status: Wrong Answer
n,m = map(int,input().split())
drink = {}
for _ in range(n):
    a,b = map(int,input().split())
    drink[a] = b

d = sorted(drink.items(), key=lambda x:x[0])

ans = 0
x = 0
for t in d:
    if m <= x+t[1]:
        ans += (m-x)*t[0]
        break
    else:
        ans += t[0]*t[1]
        x += t[1]

print (ans)
# Judge status: Accepted
X = int(input())

count=(X//500)*1000
X=X%500
count+=(X//5)*5

print(count)
# Judge status: Wrong Answer
import heapq
def main():
    N,K = map(int, input().split())
    A = list(map(int, input().split()))
    A = list(map(lambda x: x*(-1), A))
    heapq.heapify(A)
    for _ in range(K):
        r = heapq.heappop(A)
        heapq.heappush(A, r/2)
        heapq.heappush(A, r/2)
    r = -heapq.heappop(A)
    print(round(r))


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n=str(input())
a=set(n)
p=0
if len(a)==1:
  p=1
elif len(a)==2:
  b=n[0]
  if b==n[1]:
    if b==n[2] or b==n[3]:
        p=1
  elif b==n[2] and b==n[3]:
      p=1
  b=n[1]
  if b==n[2] or b==n[3]:
      p=1
if p==1:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N,K=map(int,input().split())
ans=0
mod=(10**9)+7
def ABC(N,K):
    mod=(10**9)+7
    a=((K-1)*K)//2
    b=(K*(2*N-K+1))//2
    s=b-a+1
    return s%mod

for i in range(K,N+2):
    ans+=ABC(N,i)

print(ans%mod)
# Judge status: Wrong Answer

def main():
    n, m = map(int, input().split())
    aa = list(map(int, input().split()))

    from fractions import gcd
    from functools import reduce

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

    l = reduce(lcm, aa)
    if l % 2 == 1:
        count = (m - l//2) // (l*2) + 1
    else:
        count = (m - l//2) // l + 1

    print(count)


if __name__ == "__main__":
    main()
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

c = max(0, sum(B) - sum(A))
ca = 0
cb = 0

for a, b in zip(A, B):
    if a < b:
        ca += (b - a + 1) // 2
        cb += (b - a) % 2
    if a > b:
        cb += a - b

if c < max(ca, cb):
    print('No')
else:
    print('Yes')
# Judge status: Wrong Answer
n,m=map(int,input().split())
a=[list(map(int,input().split())) for i in range(n)]
b=[list(map(int,input().split())) for i in range(m)]
for i in a:
  cnt=2*(10**16)
  ans=0
  for j in range(len(b)):
    if abs(i[0]*b[j][0])+ abs(i[1]*b[j][1])<cnt:
      cnt=abs(i[0]*b[j][0])+ abs(i[1]*b[j][1])
      ans=j+1
  print(ans)
# Judge status: Accepted
A,B,C = map(int, input().split())
K = int(input())
print(A+B+C+max(A,B,C)*2**K-max(A,B,C))
# Judge status: Accepted
N = int(input())
W =[]
for i in range(N):
  W.append(list(map(int,input().split())))

W = sorted(W,key =lambda x:(x[1],x[0]))
now = 0
for w in W:
  #print(now,w[0])
  if now +w[0] > w[1]:
    print("No")
    exit()
  now+=w[0]
print("Yes")
# Judge status: Accepted
s = input()
a = 0
z = 0
for i in range(len(s)):
    if s[i]=="A":
        a = i 
        break
for i in range(len(s)-1,-1,-1):
    if s[i]=="Z":
        z = i 
        break 
print(z-a+1)
# Judge status: Accepted
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
N,M,X=MI()
List=[]
for i in range(N):
  CA=LI()
  List.append(CA)
ans=-1
for i in range(1<<N):
  tmp=[0]*M
  cost=0
  for j in range(N):
    if 1&(i>>j):
      cost+=List[j][0]
      for k in range(M):
        tmp[k]+=List[j][k+1]
      if min(tmp)>=X:
        if ans==-1:
          ans=cost
        else:
          ans=min(ans,cost)
print(ans)
# Judge status: Accepted
A, B, C = map(int, raw_input().split())

sum = B/A
if sum > C:
    print C
else:
    print sum
# Judge status: Accepted
S = int(input())
MOD = 1_000_000_007

t = [0, 0, 1]
f = 0 if S <= 2 else 1
for i in range(S - 3):
    f = t[0] + 1
    f %= MOD
    t = t[1:3] + [(t[2] + f) % MOD]
print(f)
# Judge status: Wrong Answer
n,m = map(int,input().split())
py = [list(map(int,input().split()))+[_] for _ in range(m)]
py.sort(key = lambda py:py[1])
flag = py[0][0]
flag_2 = 1
for i in range(m):
  if flag != py[i][0]:
    flag = py[i][0]
    flag_2 = 1
  py[i][0] = (6-len(str(py[i][0])))*"0"+str(py[i][0])
  py[i][1] = (6-len(str(flag_2)))*"0"+str(flag_2)
  flag_2 += 1
py.sort(key = lambda py:py[2])
for j in range(m):
  print("".join(py[j][:2]))
# Judge status: Accepted
N, M = [int(x) for x in input().split(" ")]
print(int((N*(N-1)+M*(M-1))/2))
# Judge status: Accepted
N,X = list(map(int, input().split()))
a = list(map(int, input().split()))
a = sorted(a)
m = sum(a)
count = 0
S=0
if m == X:
    print(N)
elif m < X:
    print(N-1)
elif a[0] > X:
    print(0)
else: 
    for i in a:
        if S <= X:
            S = S + i
            count = count + 1
    else:
        print(count-1)
# Judge status: Accepted
a, b, c, d = map(int, input().split())

while a>0 and c>0:
    c-=b
    a-=d

if c<=0: 
    print('Yes')          
else:  
    print('No')
# Judge status: Wrong Answer
k,x = map(int,input().split())
print("Yes" if k * 500 <= x else "No")
# Judge status: Wrong Answer
S = int(input())
MOD = 10**9+7
fact = [1]
for i in range(1, S+1):
    fact.append(fact[-1]*i % MOD)
ifact = [None]*(S+1)
ifact[-1] = pow(fact[-1], MOD-2, MOD)
for i in range(S, 0, -1):
    ifact[i-1] = ifact[i]*i % MOD
def comb(n, k):
    if n <= 0:
        return 0
    return (fact[n]*ifact[n-k]*ifact[k]) % MOD
ans = 0
for i in range(1, S):
    if S<3*i:
        break
    ans = (ans+comb(S-2*i-1, i-1)) % MOD
print(ans)
# Judge status: Wrong Answer
x,y,z = map(int, input().split())

if (x == y and y != z) or (x==z and y !=z):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
import collections
N=int(input())
D=list(map(int,input().split()))
mod=998244353
if D[0]!=0:
  print(0);exit()

D=collections.Counter(D)
if D[0]!=1:
  print(0);exit()
ans=1
for i in range(1,len(D)): 
  ans*=pow(D[i-1],D[i],mod)
  ans%=mod
print(ans)
# Judge status: Accepted
def main():
	# n,m = map(int,input().split())
	# n,k = map(int,input().split())
	# n = int(input())
	# a = list(map(int,input().split()))
	# rsp = list(str(input()))
	# l = [list(map(int, input().split())) for _ in range(n)]
	# s = list(s)
	
	a = int(input())
	s = str(input())

	if a >= 3200:
		print(s)
	else:
		print("red")


 
if __name__ == '__main__':
	main()
# Judge status: Accepted
import collections

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

c=collections.Counter(a)

ans=0

all_balls = list(c.values())
all_balls.sort()

for i in range(len(c)-k):
    ans += all_balls[i]
print(ans)
# Judge status: Accepted
import sys

n, *a = map(int, sys.stdin.read().split())

def main():
  cnt = [0] * 9
  for x in a:
    cnt[min(x, 3200) // 400] += 1
  mi = 0
  for x in cnt[:8]: 
    if x: mi += 1
  ma = mi + cnt[8]
  mi = max(1, mi)
  print(mi, ma)
  
if __name__ == '__main__':
  main()
# Judge status: Accepted
t = input()
n = len(t)

print(t.replace('?', 'D'))
# Judge status: Accepted
N=int(input())
arr=list(map(int,input().split()))
brr=[]

for i in enumerate(arr):
    brr.append(i)
#print(brr)

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

for i in brr:
    print(i[0]+1)
# Judge status: Wrong Answer
a=input()
n=['Sunny','Cloudy','Rainy']
print(2-n.index(a))
# Judge status: Wrong Answer
#!/usr/bin/env pytHon3
# -*- coding: utf-8 -*-


def main():
    N, M = map(int, input().split())

    if M >= N * 2:
        result = N
        M -= N * 2
    else:
        result = 0

    print(M // 4 + result)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
a,b = map(int,input().split())
if a <= 5:
  print(0)
elif a <= 12:
  print(b/2)
else:
  print(b)
# Judge status: Accepted
def main():
    s = input()

    ans = ''
    b = 0
    for c in reversed(s):
        if c == 'B':
            b += 1
        else:
            if b:
                b -= 1
                continue
            ans = c + ans
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
Max=0
for i in range(N):
  if A[i]>=B[i]:
    Max+=B[i]
  else:
    B[i]-=A[i]
    if A[i+1]>=B[i]:
      A[i+1]-=B[i]
      Max+=(A[i]+B[i])
    else:
      Max+=(A[i]+A[i+1])
      A[i+1]=0
print(Max)
# Judge status: Wrong Answer
s = input()
k = int(input())
m = 0
for i in s:
  if i==1:
    m += 1
  else:
    break
if m>=k:
  print(1)
else:
  for i in s:
    if i!=1:
      print(i)
      break
# Judge status: Accepted
from sys import stdin
import sys
import math
import random
from decimal import Decimal
import itertools as it

N = int(input())
# for i in range(1,N+1):
f = [0 for i in range(N)]
# print(f)
for x in range(1, 101):
    x2 = x**2
    for y in range(1, 101):
        y2 = y**2
        for z in range(1, 101):
            a = x2+y2+z**2+x*y+y*z+x*z
            if a <= N:
                f[a-1] += 1
            else:
                break
for i in f:
    print(i)
# Judge status: Accepted
week = ['','SAT','FRI','THU','WED','TUE','MON','SUN']

S = input()

print(week.index(S))
# Judge status: Accepted
l=input().split()
print(len(set(l)))
# Judge status: Accepted
Q, H, S, D = map(int, input().split())
N = int(input())
n = N // 2 * 2
ans =  min(n * Q * 4, n * H * 2, n * S, n * D // 2)
if N % 2 == 1:
    ans += min(Q * 4, H * 2, S)
print(ans)
# Judge status: Wrong Answer
R, G, B = list(map(int, input().split()))
K = int(input())

def f(R,G,B):
  if R<G and G<B:
    return 1
  elif R<G and G>B:
    return 2
  else:
    return 3

c = 0
fl = 0

while c <= K:
  c +=1
  if f(R,G,B)==1:
    fl = 1
    c = K+1
  elif f(R,G,B)==2:
    B = B*2
  else:
    G = G*2
    
if fl == 0:
  print("No")  
else:
  print("Yes")
# Judge status: Wrong Answer
o = input()
e = input()
p = ""
for o, e in zip(o, e):
  p += (o + e)
  
print(p)
# Judge status: Wrong Answer
n,k = map(int,input().split())
for i in range(n):
    a,b = map(int,input().split())
    k -= b
    if k <= 0:
        print(a)
        break
# Judge status: Accepted
N=int(input())
A=input().split()
A = [int(a) for a in A]
 
A.sort()

count=True

for i in range(N-1):
    if A[i]==A[i+1]:
        count=False
        break
    
if count:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
from statistics import median as m
n=int(input())
a=[0]*n
b=[0]*n
for i in range(n):
  x,y=map(int,input().split())
  a[i]=x
  b[i]=y
x=m(a)
y=m(b)
if n%2==0:
  x*=2
  y*=2
print(int(y-x+1))
# Judge status: Accepted
import fractions
N = int(input())
A = list(map(int,input().split()))
gcd = fractions.gcd(A[0],A[1])
for i in range(1,N):
    gcd = fractions.gcd(gcd,A[i])
print(gcd)
# Judge status: Accepted
n=int(input())
a=[0]*n
b=[0]*n
c=[0]*n
for i in range(n):
    a[i],b[i],c[i]=map(int,input().split())

dp=[[0,0,0] for _ in range(n+1)]
for i in range(1,n+1):
    dp[i][0] = max(dp[i-1][1],dp[i-1][2])+a[i-1]
    dp[i][1] = max(dp[i-1][0],dp[i-1][2])+b[i-1]
    dp[i][2] = max(dp[i-1][0],dp[i-1][1])+c[i-1]

print(max(dp[n]))
# Judge status: Accepted
n, m = map(int,input().split())

#sがあればcを可能な限り使う

if n == 0: #sが無かったら
    ans = m//4 #c4個につき1個作れる

elif m == 0: #cが無かったら
    ans = 0 #1個も作れない

elif n*2 <= m: #cを全部使ってもcが余るもしくはぴったりの場合
    ans = n + (m-2*n)//4 #sを使い切り、余ったcで何個か作る

elif n*2 > m: #Sが余る場合
    ans = m//2

print(ans)
# Judge status: Accepted
Nu=int(input())
dic={}
ls=[]
maxd=0
for i in range(Nu):
  tmp=input()
  if tmp in dic:
    dic[tmp]=dic[tmp]+1
    maxd=max(dic[tmp],maxd)
  else:
    dic[tmp]=0
for k,v in dic.items():
  if v==maxd:
    ls.append(k)
ls.sort()
for x in ls:
  print(x)
# Judge status: Wrong Answer
n = map(int,input().split())

for i,num in enumerate(n):
    if num == 0:
        print(i)
# Judge status: Accepted
from sys import exit

N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = []
for _ in range(M):
    BC.append(tuple(map(int, input().split())))
BC.sort(key=lambda x: -x[1])
A.sort()

i = 0
for b, c in BC:
    for x in range(b):
        if i < N and A[i] < c:
            A[i] = c
            i += 1
        else:
            print(sum(A))
            exit()
print(sum(A))
# Judge status: Accepted
from collections import deque
 
n,m = list(map(int, input().split()))
put = [1]*(n+1)
 
ab = [[] for i in range(n+1)]
for i in range(m):
	a,b = map(int, input().split())
	ab[a].append(b)
	ab[b].append(a)

q = deque([1])
flg = [-1]*n
flg[0] = 0

while q:
	item = q.popleft()
	for i in ab[item]:
		if put[i]:
			flg[i-1]=item
			q.append(i)
			put[i]=0
 
if -1 in flg:
	print("No")
	exit()
 
print("Yes")
for i in range(1,len(flg)):
	print(flg[i])
# Judge status: Accepted
import sys

# S = input()
# N, M = map(int, input().split())
# nums = list(map(int, input().split()))
# nums_2d = [list(map(int, input().split())) for _ in range(N)]


def main():
    S = input()

    weathers = ["Sunny", "Cloudy", "Rainy", "Sunny"]

    idx = weathers.index(S)

    print(weathers[idx+1])


if __name__ == '__main__':
    main()
# Judge status: Accepted
import math

i, j = map(int, input().split())

print(math.ceil(i / j))
# Judge status: Wrong Answer
import sys
import math

for line in sys.stdin.readline():
    n = float(line.rstrip())
    ans = math.ceil(n / 2)
    print(ans, end="")
    break
# Judge status: Accepted
n,k,*l=map(int,open(0).read().split())
for _ in range(min(k,99)):
  s=[0]*(n+1)
  for i in range(n):
    s[max(i-l[i],0)]+=1
    s[min(i+l[i]+1,n)]-=1
  l[0]=min(s[0],n)
  for i in range(1,n):
    l[i]=min(l[i-1]+s[i],n)
print(*l)
# Judge status: Accepted
import sys
input = sys.stdin.readline

K, S = map(int, input().split())

# X + Y = A
# Z = S - A
ans = 0
for A in range(2*K+1):
    Z = S - A
    if 0 <= Z and Z <= K:
        for X in range(K+1):
            Y = A - X
            if 0 <= Y and Y <= K:
                ans += 1
print(ans)
# Judge status: Accepted
M = 1000000007
n=int(input())
f = 1
for i in range(1, n + 1):  
    f = (f * i) % M 
print(f)
# Judge status: Accepted
n,x=map(int,input().split())
a=sorted([int(i)for i in input().split()])
res=0
if sum(a)==x:
    res=n
else:
    for i in range(n):
        if sum(a[:i])<=x:res=i
print(res)
# Judge status: Wrong Answer
S = input()

if S is "ABC":
  print("ARC")
else:
  print("ABC")
# Judge status: Wrong Answer
import numpy as np
N, K = map(int, input().split(" "))
p = np.array(list(map(int, input().split(" "))))
ex = np.array([(i + 1) / 2 for i in p])
ans = np.sum(ex[0: K])
max_ans = ans
for i in range(K, N):
    diff = ex[i] - ex[i - K]
    ans += diff
    if diff > 0:
        max_ans = ans
print(max_ans)
# Judge status: Accepted
N, A, B = map(int, input().split())

if (B - A) % 2 == 0:
    print((B - A) // 2)
else:
    # Aが左に到着
    ans1 = 0
    ans1 += A - 1 + 1
    a = 1
    b = B - A
    ans1 += (b - a) // 2

    # Bが右に到着
    ans2 = 0
    ans2 += N - B + 1
    a = A + (N - B + 1)
    b = N
    ans2 += (b - a) // 2

    ans = min(ans1, ans2)
    print(ans)
# Judge status: Accepted
a=int(input())
s=input()
if a>=3200:print(s)
else:print("red")
# Judge status: Accepted
n = int(input())
v = list(map(int, input().split()))

v.sort()

res = (v[0] + v[1]) / 2
for i in range(2, n):
    res = (res + v[i]) / 2

print(res)
# Judge status: Accepted
n = int(input())
li = list(map(int,input().split()))
lee = len(li)
sorted_li = sorted(li)
mid = sorted_li[lee//2]
mid_mae = sorted_li[lee//2-1]
tmp = mid
for l in li:
    if l < mid:
        print(mid)
    else:
        print(mid_mae)
# Judge status: Wrong Answer
N,K = [int(x) for x in input().split()]
h = [int(x) for x in input().split()]
DP = [100000000]*N
DP[0] = 0
DP[1] = abs(h[0] - h[1])
for i in range(2,N):
    for j in range(1,min(K+1,i+1)):
        DP[i] = min(DP[i],DP[i-j] + abs(h[i]-h[i-j]))
print(DP[N-1])
# Judge status: Accepted
import math
def main():
  a,b = list(map(str,input().split()))
  num=int(a+b)
  if math.sqrt(num)%1==0:
    print("Yes")
  else:
    print("No")
main()
# Judge status: Accepted
n = int(input())
a_lst = list(map(int,input().split()))
b_lst = list(map(int,input().split()))
monster = 0

for i in range(n):
    a1 = a_lst[i]
    a2 = a_lst[i+1]
    b1 = b_lst[i]
    tmp = b1-a1

    monster += min(a1,b1)
    if tmp>0:
        if a2-tmp<=0:
            monster += a2
            a_lst[i+1] = 0
        else:
            monster += tmp
            a_lst[i+1] -= tmp

print(monster)
# Judge status: Wrong Answer
n = int(input())
a = [int(input()) for i in range(n)]

b = a[0]
cnt = 1

while b != 2 and cnt <= 1:
    b = a[b-1]
    cnt += 1
if b == 2:
    print(cnt)
else:
    print(-1)
# Judge status: Wrong Answer
n=int(input())
a=[int(i) for i in input().split()]
for i in range(3):
    for j in range(n-1):
        x=a[j]+a[j+1]
        if x<0:
            a[j]*=-1
            a[j+1]*=-1
print(sum(a))
# Judge status: Accepted
W, H, N = map(int, input().split())
p = 0
q = W
r = 0
s = H
for i in range(N):
  x, y, a = map(int, input().split())
  if a == 1:
    p = max(p, x)
  elif a == 2:
    q = min(q, x)
  elif a == 3:
    r = max(r, y)
  else:
    s = min(s, y)
print(max(q - p, 0) * max(s - r, 0))
# Judge status: Accepted
x= map(int,input().split())
a = 1
for i in x:
    if i == 0:
        print(a)
    a+=1
# Judge status: Accepted
x, y, z = map(int, input().split())
print(x * y // 2)
# Judge status: Accepted
S = input()
for s in [chr(ord("a")+i) for i in range(26)]:
  if not s in S:
    print(s)
    exit()
    
print("None")
# Judge status: Wrong Answer
#!/usr/bin/env python3
w,a,b=map(int,input().split())
if b>a:
    if b-w-a>0:
        print(b-w-a)
    else:print(0)
if a>b:
    if a-w-b>0:
        print(a-w-b)
    else:
        print(0)
# Judge status: Accepted
S=input()
pre="#"
cur=""
cnt=0

for s in S:
    cur+=s
    if pre!=cur:
        cnt+=1
        pre=cur
        cur=""
print(cnt)
# Judge status: Wrong Answer
s=input()
ans=False
for i in s:
  if i=='9':
    ans=False

if ans:
  print('Yes')
else :
    print('No')
# Judge status: Wrong Answer
a = list(map(float,input().split()))
x = a[0]
y = a[1]

n = a[0] * 2
count = 1

while n <= y:
  n = n * 2
  count += 1
  
print(str(count))
# Judge status: Accepted
a,b,c,d,k=map(int,input().split())
print((c-a)*60-b+d-k)
# Judge status: Accepted
a, b = map(int, input().split())

if b == 1:
    print(0)
elif b <= a:
    print(1)
else:
    print((b - 2)//(a - 1) +1)
# Judge status: Accepted
a,b,c=map(int,input().split())
if a+b+c==17 and a*b*c==175:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
A = list(map(int, input().split()))
A.sort()

print("Yes" if A == [5,5,7] else "No")
# Judge status: Accepted
s=[int(i) for i in input()]
n=len(s)
ans=0
f=0
for i in range(n-1,-1,-1):
  j=s[i]+f
  if j<5:
    ans+=j
    f=0
  elif j>5:
    ans+=10-j
    f=1
  elif i and s[i-1]>=5:
    ans+=10-j
    f=1
  else:
    ans+=j
    f=0
print(ans+f)
# Judge status: Accepted
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)

n = M - 1
K = sum(A)

if A[n] < K / (4 *M):
  print('No')
else:
  print('Yes')
# Judge status: Accepted
import fractions
n,m,a=map(int,input().split())
if a%fractions.gcd(n,m)==0:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
s = input()
t = input()
S = []
T = []
for i in range(len(s)):
    S.append(s[i])
for j in range(len(t)):
    T.append(t[j])
S.sort()
T.sort()
T.reverse()
a = ''
b = ''
for i in range(len(s)):
    a += S[i]
for j in range(len(t)):
    b += T[j]
if a < b:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
print('YES' if int(input().replace(' ', '')) % 4 == 0 else 'No')
# Judge status: Accepted
# -*- coding: utf-8 -*-
from collections import deque
import sys
#input = sys.stdin.readline
def inpl(): return list(map(int, input().split()))

N = int(input())
A = inpl()

L = deque()

for i in range(N):
    if i%2:
        L.append(A[i])
    else:
        L.appendleft(A[i])

if (N%2):
    print(*L)
else:
    print(*list(L)[::-1])
# Judge status: Accepted
import math
N,D=map(int,input().split())
see=2*D+1
ans=math.ceil(N/see)
print(ans)
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-

a, b, m = map(int, input().split())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
res = A[0] + B[0]
for j in range(m):
    x, y, c = map(int, input().split())
    summ = A[x-1] + B[y-1] - c
    if summ < res:
        res = summ

print(res)
# Judge status: Accepted
W, a, b = map(int, input().split())
result = 0
if ((a <= b) and (b <= a + W)) or ((a <= b + W) and (b + W <= a + W)):
  result = 0
elif (b + W < a):
  result = a - (b + W)
elif (a + W < b):
  result = b - (a + W)
print(result)
# Judge status: Accepted
from collections import Counter

N, K = map(int, input().split())
A = list(map(int, input().split()))
A = Counter(A) 
key, value = zip(*A.most_common())
# 数が少ないものを変更する
print(sum(value[K:]))
# Judge status: Wrong Answer
n, k = map(int, input().split())
ans = 0
for i in range(n):
    g = 1 / n
    now = i+1
    while (True):
        if (now > k):
            break
        now*=2
        g/=2
    ans += g
print(ans)
# Judge status: Accepted
n,m,k = map(int, input().split())
a = [int(_) for _ in input().split()]
b = [int(_) for _ in input().split()]

t = sum(b)
j = m
ans = 0
for i in range(n+1):
    while j > 0 and t > k:
        j -= 1
        t -= b[j]
    if t > k: break
    ans = max(ans, i + j)
    if i==n:break
    t+=a[i]

print(ans)