peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
N, x=map(int, input().split())
a=list(map(int, input().split()))
a.sort()
i=0
while i<N and x>=a[i]:
  x-=a[i]
  i+=1
if i==N and x>0:
  i-=1
print(i)
# Judge status: Wrong Answer
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    A = list(int(input()) for _ in range(n))

    res = 0
    for i in range(1, n):
        cnt = min(A[i - 1], A[i])
        A[i - 1] -= cnt
        A[i] -= cnt
        res += cnt
        if A[i - 1]:
            res += (A[i - 1]) // 2

    if A[n - 1]:
        res += (A[n - 1]) // 2

    print(res)


if __name__ == '__main__':
    resolve()
# Judge status: Accepted
h = int(input())
w = int(input())
if h < w:
  h, w = w, h
n = int(input())
print(-(-n//h))
# Judge status: Wrong Answer
O = list(input())
E = list(input())
ans = list()
 
for i in range(len(O)):
    ans.append(O[i])
    if len(E) >= i:
        ans.append(O[i])

result = "".join(ans)
print(result)
# Judge status: Accepted
n = int(input())

total = 0

for i in range(1,n+1):
    total += i

print(total)
# Judge status: Accepted
# coding: utf-8
import bisect
N=int(input())
L=list(map(int,input().split()))
L.sort()
ans=0
for i in range(N-2):
    for j in range(i+1,N-1):
        n=L[i]+L[j]
        ans+=bisect.bisect_left(L,n)-j-1
        #print(L[i],L[j],n)
print(ans)
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 12 20:20:11 2020

@author: NEC-PCuser
"""


N = int(input())

i = 1
li = []
while (N >= (i * (i + 1)) // 2):
    li.append(i)
    i += 1
    

value = (i - 1) * i // 2
print(value)

index = len(li) - 1
for i in range(value, N):
    li[index] += 1
    index -= 1

for i in li:
    print(i)
# Judge status: Accepted
N = int (input ())
l = [int(x) for x in input ().split ()]
m = max (l)
s = sum (l)
if m*2 < s:
  print ('Yes')
else:
  print ('No')
# Judge status: Wrong Answer
import random
import numpy as np
d = int(input())
c = list(map(int, input().split()))
s = []
for i in range(d):
    temp = list(map(int, input().split()))
    s.append(temp)
s = np.array(s)
#print(s)
with open('output.txt', 'w') as f:
    dice = list(range(26))
    w = c
    samples = random.choices(dice, k=d, weights=w)
    for one in samples:
        print(one+1, file=f)
# Judge status: Accepted
A, B, C, X, Y = map(int, input().split())

cost = 10**9
for i in range(2*10**5+1):
    if i%2==0:
        a_num = X-int(0.5*i)
        b_num = Y-int(0.5*i)
        if a_num < 0 and b_num < 0:
            break
        cost = min(cost, A*max(a_num, 0)+B*max(b_num, 0)+C*i)

print(cost)
# Judge status: Accepted
n,k=map(int,input().split())
a=list(map(int,input().split()))
if (n-1)%(k-1)==0:
  print((n-1)//(k-1))
else:
  print((n-1)//(k-1)+1)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
ans=0
t=10**6
for i in range(n):
  if a[i]<t:
    ans+=1
    t=a[i]
print(ans)
# Judge status: Accepted
a,b,c = map(int,input().split())
if (a+b)>= c:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n, a, b = map(int, input().split())
s = input()

all = list(s)
count = 0
count_b = 0
for i in all:
    if i == 'a':
        if count < a + b:
            print('Yes')
            count += 1
        else:
            print('No')
    elif i == 'b':
        if (count < a + b) and (count_b < b):
            print('Yes')
            count += 1
            count_b += 1
        else:
            print('No')
    else:
        print('No')
# Judge status: Accepted
n, m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]
x = [0]*m
for i in range(n):
    for j in range(1, a[i][0] + 1):
        for k in range(1, 31):
            if a[i][j] == k:
                x[k-1] += 1
ans = 0
for l in x:
    if l == n:
        ans += 1
print(ans)
# Judge status: Wrong Answer
n=input()
print("YES" if "9" in n else "NO")
# Judge status: Wrong Answer
s=input()
ans='No'
for i in range(1,len(s)):
  for j in range(i,len(s)):
    if s[:i]+s[j:]=='keyence':
      ans='Yes'
      break
print(ans)
# Judge status: Accepted
import sys
import numpy as np

def Ss():
  return sys.stdin.readline().rstrip().split(' ')

def Is():
  ss = Ss()
  return map(int, ss) if len(ss) > 1 else int(ss[0])

money = 1000
n = Is()
prices = [*Is()]

for today, tomorrow in zip(prices, prices[1:] + [0]):
  buyable_stock_count = int(money / today)
  new_money = money + buyable_stock_count * (tomorrow - today)
  if new_money > money:
    money = new_money

print(money)
# Judge status: Accepted
A, B = map(int, input().split())
a = []
a.append(A)
while max(a)<B:
    a.append(max(a)*2)
if max(a)>B:
    a.remove(max(a))
print(len(a))
# Judge status: Accepted
tList = []
for i in range(5):
  tList.append(list(str(input())))

dList = []
for i in range(len(tList)):
  tmp = 10 - int(tList[i][-1])
  if tmp == 10:
    dList.append(0)
  else: 
    dList.append(tmp)

result = 0
for i in range(len(tList)):
  result += int(''.join(tList[i]))+dList[i]

print(result - sorted(dList,reverse = True)[0])
# Judge status: Wrong Answer
A, s, C = input().split()
print(A+s[0]+C)
# Judge status: Accepted
s = input()

n = -1
if len(s) % 2 == 0:
    n = -2
while len(s) > abs(n):
    hanbun = len(s[:n])//2
    if s[:hanbun] == s[hanbun:n]:
        print(len(s[:n]))
        break
    n -= 2
# Judge status: Accepted
# B - fLIP
N, M, K = map(int, input().split())

for i in range(N + 1):
  for j in range(M + 1):
    black = M * i + N * j - i * j * 2
    
    if black == K:
      print('Yes')
      exit()

print('No')
# Judge status: Accepted
A, B, K = map(int, input().split())

lista, aux, aux1 =[], max(A, B), min(A, B)
for i in range(1, aux1+1):	
	if((aux%i) == 0 and (aux1%i) == 0):
		lista.append(i)		
		lista.sort(reverse=True)

if(len(lista)==1):
	print(lista[0])
else:
	ans = lista[K-1]
	print(ans)
# Judge status: Wrong Answer
a = [list(map(int, input().split())) for _ in range(5)]
mod = 9
ans = 0

for i in range(5):
    modi = (a[i][0]%10)
    if modi != 0:
        mod = min(mod, modi)
    ref = (0 - -a[i][0]//10)*10
    ans += ref

mod = 10 - mod
ans = ans - mod
print(ans)
# Judge status: Wrong Answer
N, M = map(int,input().split())
if N>1 and M>1:
  print(N*M-(N*2 + (M-2)*2))
else:
  print(N*M-2)
# Judge status: Wrong Answer
import bisect

def main():
    n = int(input())
    ans = 0
    b = 10**9 + 1
    for _ in range(n):
        a = int(input())
        if b >= a:
            b = a
            ans += 1
    print(ans)

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
#!/usr/bin/python3
# -*- coding:utf-8 -*-

def main():
  n = int(input())
  s = 0
  ans = []
  for i in range(30):
    if (n - s) % (2**(i+1)) == 0:
      ans.append('0')
    else:
      ans.append('1')
      s += ((-2) ** i)
    if s == n:
      break
  print(''.join(ans[::-1]))
    
if __name__=='__main__':
  main()
# Judge status: Accepted
N = int(input())
p = list(map(int,input().split()))

res = sorted(p)
cnt = 0

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

if(cnt <= 2):
    print('YES')
else:
    print('NO')
# Judge status: Accepted
S, T = input().split()
A, B = map(int, input().split())
U = input()

if S == U:
    A -= 1
else:
    B -= 1

print(A, B)
# Judge status: Accepted
import string
N = int(input())
alph = string.ascii_lowercase

ans = []
A = [0]
def search():
    if len(A) == N:
        ans.append(tuple(A))
        return

    mx = max(A)
    for i in range(mx + 2):
        A.append(i)
        search()
        A.pop()
    return

search()

for a in ans:
    print(''.join(alph[i] for i in a))
# Judge status: Accepted
# D - Disjoint Set of Common Divisors

import fractions

A, B = map(int, input().split())
C = fractions.gcd(A, B)

primes = []
i = 2
while i * i <= C:
    while C % i == 0:
        C //= i
        primes.append(i)
    i += 1
if C > 1:
    primes.append(C)

print(len(set(primes)) + 1)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
na = [0]*n
for i in range(n):
    na[i] = a[i]-(i+1)
na.sort()
med = n//2-1
med1 = med+1
ans = 0
ans1 = 0
for i in range(n):
    ans += abs(na[i]-na[med])
    ans1 += abs(na[i]-na[med1])
print(min(ans, ans1))
# Judge status: Accepted
h,w = map(int,input().split())

hw = h*w
if(h == 1 or w == 1):
  ans = 1
elif(hw%2==1):
  ans = (int)(hw/2)+1
else:
  ans = (int)(hw/2)
  
print(ans)
# Judge status: Accepted
f=lambda:map(int,input().split())
n,x=f()
l=f()
t=a=0
for i in l:
  t=min(i,x-t)
  a+=i-t
print(a)
# Judge status: Wrong Answer
n=int(input())
S=input()
dictR=[]
dictG=[]
dictB=[]
for i in range(len(S)):
    if S[i]=="R":
        dictR.append(i)
    elif S[i]=="G":
        dictG.append(i)
    else:
        dictB.append(i)
sum=len(dictR)*len(dictG)*len(dictB)
for i in dictR:
    for j in dictG:
        for k in dictB:
            if j-i==k-j:
                sum-=1
print(sum)
# Judge status: Accepted
h = int(input())
i = 0
while 2**i <= h:
  i += 1
print(2**i-1)
# Judge status: Accepted
import fractions
N = int(input())
A = [int(i) for i in input().split()]

mod = 10**9 + 7


lcm = 1
for a in A:
    lcm = lcm*a//fractions.gcd(lcm, a)
# print(lcm)

ans = 0
for a in A:
    ans += lcm//a
print(ans % mod)
# Judge status: Accepted
N, K, S = map(int, input().split())
print(*([S] * K + [S+1 if S!=10**9 else 1] * (N-K)))
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
N = int(input())
i = 1
while i ** 2 < N:
    i += 1
    if i ** 2 > N:
        print((i - 1) ** 2)
        sys.exit()
# Judge status: Accepted
from math import ceil
x = int(input())

m = x//11
r = x%11

if 0 < r <= 6:
    print(2*m+1)
elif r == 0:
    print(2*m)
else:
    print(2*m+2)
# Judge status: Accepted
#!/usr/bin/env python3

a = int(input())
print(a+a**2+a**3)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
x = sum(b)
for i in range(0,n-1):
    if a[i+1]-a[i]==1:
        x+=c[a[i]-1]
print(x)
# Judge status: Accepted
l = list(map(int,input().split()))

for i in range(len(l)):
  if 0 == l[i]:
    print(i+1)
# Judge status: Wrong Answer
s = input()
ints = [ord(i) - ord('a') for i in s]
K = int(input())
n = len(s)
i = 0
while i < n:
    if 25 - ints[i] + 1<= K:
        K -= 25 - ints[i] + 1
        ints[i] = 0
    i += 1

K %= 26
ints[-1] = (ints[-1] + K) % 26
s_ = ''
for i in ints:
    s_ += chr(i + ord('a'))

print(s_)
# Judge status: Accepted
n = int(input())
for x in range(int(n / 1.1), n + 1):
    if int(x * 1.08) == n:
        print(x)
        exit(0)
print(':(')
# Judge status: Wrong Answer
a,b=map(int,input().split())
for i in range(1,120):
  if i**2==100*a+b:
    print("Yes")
    break
else:
  print("No")
# Judge status: Wrong Answer
N,K = map(int,input().split())

print(N % K)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))

for i in range(1,N + 1):
    if i < N//2 + 1:
        print(A[N//2])
    else:
        print(A[N//2 -1])
# Judge status: Accepted
N = int(input())

sum = 0
for i in range(1, N + 1):
    if i % 3 == 0 or i % 5 == 0:
        continue
    else:
        sum += i
print(sum)
# Judge status: Accepted
N,M,K = map(int,input().split())

for i in range(N+1):
    for j in range(M+1):
        if i*(M-j) + j*(N-i) == K:
            print('Yes')
            exit()
print('No')
# Judge status: Wrong Answer
import sys
from bisect import *

sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()

N = int(input())
odd, even = 0, 0
for i in range(1, N + 1):
    if i % 2 == 0:
        even += 1
    else:
        odd += 1
print('{:.2f}'.format(odd / (even + odd)))
# Judge status: Accepted
l = list(map(int, input().split()))
s = set(l)
print(len(s))
# Judge status: Accepted
n, m = map(int, input().split())
t = []

g = 0
if n == 1:
    print(len(input().split()) - 1)
    exit()

for i in range(n):
    t.append(input().split())

for i in sorted(t, reverse = True)[0][1:]:
    c = 0
    for j in sorted(t, reverse = True)[1:]:
        
        if j[1:].count(i) == 1:
            c += 1

        if c == n - 1:
            g += 1

print(g)
# Judge status: Wrong Answer
from itertools import combinations
from operator import itemgetter

n = int(input())
XY = [tuple(int(x) for x in input().split()) for _ in range(n)]
X = sorted(XY, key=itemgetter(0))
Y = sorted(XY, key=itemgetter(1))
def dist(a, b):
    return abs(a[0] - b[0]) + abs(a[1] - b[1])
ans = 0
if n < 3000:
    for a, b in combinations(XY, 2):
        ans = max(ans, dist(a, b))
else:
    A = X[:750] + X[-750:] + Y[:750] + Y[-750:]
    for a, b in combinations(A, 2):
        ans = max(ans, dist(a, b))
print(ans)
# Judge status: Wrong Answer
n=int(input())
S=[0 if i=='.' else 1 for i in input()]
if sum(S)==0 or sum(S)==n:
    print(0)
    exit()

start=0
for i in range(n):
    if S[i]==1:
        start=i
        break

S=S[start:]
ans=0
for s in S:
    if s==0:
        ans+=1
if len(S)-ans>=0:
    print(min(ans, len(S)-ans))
else:
    print(ans)
# Judge status: Accepted
if __name__ == '__main__':

	n = int(input())
	A = list(map(int,input().split()))
	cnt = 1
	minnum = A[0]

	for i in range(1,n):
		if A[i] <  minnum:
			cnt += 1
			minnum = A[i]

	print(cnt)
# Judge status: Accepted
N = int(input())
A = [list(map(int, input().split())) for _ in range(2)]

ans = 0

for i in range(N):
    total = sum(A[0][0:i + 1]) + sum(A[1][i:N + 1])
    if total > ans:
        ans = total

print(ans)
# Judge status: Accepted
a,b,c,d,e = map(int,input().split())
p = a * 60 + b
q = c * 60 + d
r = q - p
print(r - e)
# Judge status: Wrong Answer
a, b = map(int,input().split())
num = (b-a)+1
if a > 0:
  print("a_Positive")
elif b < 0 and num%2==0:
  print("b_Positive")
elif b < 0 and num%2!=0:
  print("Negative")
elif a <= 0 and b >= 0:
  print("Zero")
# Judge status: Wrong Answer
n = int(input())
ab = [map(int, input().split()) for _ in range(n)]
a, b = [list(i) for i in zip(*ab)]
 
a.reverse()
b.reverse()
ans = 0
num = 0
ruisekiwa = 0

for j in range(n):
  a[j] += ruisekiwa
  syou = a[j]//b[j]
  if b[j] == 1:
    num = 0
  else:
    num = b[j]*(syou+1) - a[j]
  ruisekiwa += num
  ans += num

print(ans)
# Judge status: Wrong Answer
a = [int(i) for i in input().split()]
k = int(input())
mx = max(a)
sm = (sum(a)-mx) + mx*(2*k)
print(sm)
# Judge status: Accepted
from fractions import gcd
n=int(input())
a=list(map(int,input().split()))
lcm = a[0]
for i in range(1,n):
  lcm = lcm*a[i] // gcd(lcm,a[i])
mod=pow(10,9)+7
lcm%=mod
ans=0
for x in a:
  ans+=pow(x,mod-2,mod)
  ans%=mod
print(ans*lcm%mod)
# Judge status: Accepted
H ,N = [int(i) for i in input().split()]
AB = []
for _ in range(N):
    AB.append([int(i) for i in input().split(' ')])
 
MAX = 0
for a, b in AB:
    MAX = a if MAX < a else MAX
 
DP = [10**10] * (H+MAX)
DP[0] = 0
for i in range(H):
    for a,b in AB:
        if DP[i] != 10**10:
            DP[i+a] = min(DP[i+a],DP[i] + b)
 
print(min(DP[H:]))
# Judge status: Wrong Answer
n=int(input())
a1=list(map(int,input().split()))

r=0
import numpy as np
for ii in range(len(a1)-2):
  for jj in np.arange(ii+1,len(a1)-1):
    for kk in np.arange(jj+1,len(a1)):
      if a1[ii]+a1[jj]<=a1[kk]:
        break
      r+=1
print(r)
# Judge status: Wrong Answer
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))

four = sum(A % 4 == 0)  # 4で割りきれる数
two = sum(np.logical_and(A % 2 == 0, A % 4 != 0))  # 4で割り切れないが、2で割りきれる数

# print(four, two)
# Nからtwo//2を引く。そこからの残り//2よりfourが大きければOK

# print((N - two // 2) // 2)
# print(four)

if (N - two // 2) // 2 <= four:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

ans = 1
c = 0
for i in range(1, n):
    if a[i] > a[i-1]:
        c1 = 1
    elif a[i] < a[i-1]:
        c1 = -1
    else:
        c1 = 0
    if c != c1 and c != 0:
        ans += 1
        c = 0
        continue
    c = c1

print(ans)
# Judge status: Wrong Answer
import numpy as np

n = int(input())
n = np.mod(n, 10)

if n == 2 or 4 or 5 or 7 or 9:
  print('hon')
elif n == 0 or 1 or 6 or 8:
  print('pon')
else:
  print('bon')
# Judge status: Accepted
n = int(input())
s = input()
MOD = 10 ** 9 + 7

from collections import Counter

c = Counter(list(s))

res = 1
for v in c.values():
	res *= v + 1
	res %= MOD

print(res - 1)
# Judge status: Accepted
n = int(input())
b = list(map(int, input().split()))
ans = [0]*n
ans[0] = b[0]
for i in range(1, n-1):
  ans[i] = min(b[i-1], b[i])
ans[n-1] = b[n-2]
print(sum(ans))
# Judge status: Wrong Answer
a,b,x = map(int,input().split())
m = 0

if b % x == 0:
    m += 1

c = b - a

print(m + c // x)
# Judge status: Accepted
n = int(input())
l = list(map(int,input().split()))

c = 0
f = 0
s = 0
t = 0

for i in range(n):
    for j in range(i, n):
        for k in range(j,n):
            if l[i] != l[j] and l[j] != l[k] and l[k] != l[i] and l[i] < l[j] +l[k] and l[j] < l[i]+l[k] and l[k] < l[i]+l[j]:
                c+=1

print(c)
# Judge status: Accepted
n = int(input())
A = [int(x) for x in range(1,n+1)]
B = [0]*n

for i in range(n):
    while A[i] % 2 == 0:
        A[i] = A[i]//2
        B[i] += 1
        
ind = B.index(max(B))
tmp = [int(x) for x in range(1,n+1)]
print(tmp[ind])
# Judge status: Accepted
s=int(input())
target=[s]
i=0

while True:
    if target[i]%2==0:
        tmp=target[i]/2
    else:
        tmp=3*target[i]+1
    if tmp in target:
        i+=1
        break
    else:
        target.append(tmp)
        i+=1
print(i+1)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
S = [0]*(N+1)
S[0] = 0
diff = float("INF")
idx = -1
m = sum(A)/2
for i in range(N):
  S[i+1] = S[i] + A[i]
  if abs(m - S[i+1]) < diff:
    diff = abs(m - S[i+1])
    idx = i+1
lsum = S[idx]
rsum = S[N]-S[idx]
print(abs(lsum-rsum))
# Judge status: Accepted
N = int(input())
ans = [[0]*3 for _ in range(N)]
ans[0] = list(map(int, input().split()))
for i in range(1, N):
    a, b, c = map(int, input().split())
    ans[i][0] = max(ans[i-1][1]+a, ans[i-1][2]+a)
    ans[i][1] = max(ans[i-1][2]+b, ans[i-1][0]+b)
    ans[i][2] = max(ans[i-1][0]+c, ans[i-1][1]+c)
print(max(ans[N-1]))
# Judge status: Accepted
N = int(input())

def dfs(s, mx):
    if len(s) == N:
        print(s)
    else:
        for c in range(ord('a'), ord(mx)+1):
            if chr(c) == mx:
                mx = chr(c+1)
            dfs(s+chr(c), mx)

dfs("", 'a')
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
res = 10 ** 9
for a in A:
    if a % 2 == 1:
        print(0)
        exit()
    tmp = 0
    while a % 2 == 0:
        tmp += 1
        a //= 2
    res = min(res, tmp)
print(res)
# Judge status: Accepted
row1 = map(int, input().split())
row2 = map(int, input().split())
row3 = map(int, input().split())
row = list(row1) + list(row2) + list(row3)

bs = [int(input()) for i in range(int(input()))]

comb = [
    [0,1,2],
    [3,4,5],
    [6,7,8],

    [0,3,6],
    [1,4,7],
    [2,5,8],

    [0,4,8],
    [2,4,6],
]

for lst in comb:
    if len([1 for num in lst if row[num] in bs]) == 3:
        print('Yes')
        exit()
print('No')
# Judge status: Accepted

def myAnswer(N:int,S:list) -> int:
   
   ans = 0
   x = 0
   for i in  S:
      if(i == "I"):
         x +=1
      elif(i == "D"):
         x -= 1
      ans = max(ans,x)
   return ans


def modelAnswer():
   tmp=1
def main():
   N = int(input())
   S = list(input())
   print(myAnswer(N,S[:]))

if __name__ == '__main__':
   main()
# Judge status: Accepted
n,m=map(int,input().split())
a=[list(input()) for _ in range(n)]
b=[list(input()) for _ in range(m)]
r=n-m+1
print('Yes' if any([all([a[x//r+y//m][x%r+y%m]==b[y//m][y%m] for y in range(m**2)]) for x in range(r**2)]) else 'No')
# Judge status: Accepted
k=int(input())
n=0
a=0
ss=0
if k==7:
  print(1)
elif k%2==0:
  print(-1)
elif k%5==0:
  print(-1)
else:
  while a==0:
    n+=1
    ss=10*(ss%k)+7
    if ss%k==0:
      a=1
  if a==1:
    print(n)
  else:
    print(-1)
# Judge status: Wrong Answer
K=int(input())
S=input()
if len(S)<=K:
    print(S)
else:
   print(S+"...")
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))
q = list(range(1, n + 1))
cnt = 0
for i in range(n):
    if p[i] == q[i]:
        cnt += 1
print("YES" if cnt >= n - 2 else "NO")
# Judge status: Accepted
import sys

INPUT = lambda: sys.stdin.readline().rstrip()

sys.setrecursionlimit(10 ** 9)


def main():
    S = INPUT()
    N = len(S)

    s = ["", ""]
    for i in range(N):
        for j in range(2):
            s[j] += str((i + j)%2)

    cnt = [0, 0]
    for i in range(N):
        for j in range(2):
            if s[j][i] != S[i]: cnt[j] += 1

    print(cnt[0] if cnt[0] < cnt[1] else cnt[1])


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n = int(input())

x = n * 800
y = (n // 15) * 150

print(x - y)
# Judge status: Accepted
K, X = map(int, input().split())
print(*list(range(X - K + 1, X + K)))
# Judge status: Accepted
from itertools import permutations
n = int(input())
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))

ans = sorted([i for i in permutations(range(1, n + 1))])
print(abs(ans.index(p) - ans.index(q)))
# Judge status: Wrong Answer
import random

def main():
    d = int(input())
    for _ in range(d):
        input()
    for i in range(d):
        print(random.randint(1,27))


if __name__ == '__main__':
    main()
# Judge status: Accepted
N, A, B = map(int, input().split())
if A > B or (N == 1 and A < B):
    print(0)
    exit()
if N == 1 and A == B:
    print(1)
    exit()
mx = A+B+B*(N-2)
mn = A+B+A*(N-2)
print(mx-mn+1)
# Judge status: Accepted
# -*- coding:utf-8 -*-

def solve():
    Xs = list(map(int, input().split()))

    for i, x in enumerate(Xs):
        if x == 0:
            print(i+1)
            return

if __name__ == "__main__":
    solve()
# Judge status: Accepted
import numpy as np

#inp = list(map(int, input().split())
inp = list(input())
if inp[-1] == "s":
    inp.append("es")
else :
    inp.append("s")
for i in range(len(inp)):
  print(inp[i], end ="")
# Judge status: Wrong Answer
n,k = map(int, input().split())
print(n%k)
# Judge status: Wrong Answer
a, W, b = map(int,input().split())
print(min(abs(a-b),abs(a+W-b)))
# Judge status: Accepted
n,m=map(int, input().split())
al=[]
for i in range(m):
    a=list(map(str, input().split()))
    al.append(a)
l_all=[[] for i in range(n)]
for i in range(m):
    l_all[int(al[i][0])-1].append(al[i][1])
ac=0
pn=0
for j in range(n):
    if l_all[j].count('AC')!=0:
        pn+=l_all[j].index('AC')
        ac+=1
print('{} {}'.format(ac,pn))
# Judge status: Accepted
d,t,s= map(int,input().split())
if d>s*t:
  print("No")
else:
  print("Yes")
# Judge status: Accepted
n,k,*a=map(int,open(0).read().split())
r=range(n)
while k:
 k-=1;b=[0]*n*3
 for i in r:t=a[i];b[max(0,i-t)]+=1;b[i-~t]-=1
 for i in r:b[i+1]+=b[i]
 a=b[:n]
 if min(a)==n:break
print(*a)
# Judge status: Accepted
import math
n = int(input())
a = list(map(int, input().split()))
c2 = 0
c4 = 0
for i in a:
    if i%4==0:
        c4+=1
    elif i%2==0:
        c2+=1

if c2 == len(a):
    print('Yes')
elif c2 >= 2:
    if c4 >= (math.ceil((len(a)-c2)/2)):
        print('Yes')
    else:
        print('No')
elif c4 >=(len(a)//2):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N = int(input())
N -= 1
S = str(input())
count = S.count('R') * S.count('G') * S.count('B')
for i in range(N):
    for j in range(i,N+1):
        k = 2*j - i
        if k > N:
            pass
        elif S[i] == S[j] or S[i] == S[k] or S[j] == S[k]:
            pass
        else:
            count -= 1
print(count)
# Judge status: Wrong Answer
a, v = map(int, input().split())
b, w = map(int, input().split())
T = int(input())
loc = abs(a - b)
if v <= w:
    print('No')
    exit()
if loc % v == 0:
    print('Yes')
    exit()
for i in range(T):
    loc += w
    if loc % v == 0:
        print('Yes')
        exit()
print('No')
# Judge status: Accepted
n,p = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]

a_odd = [x for x in a if x % 2 == 1]

if len(a_odd) == 0:
    if p == 0:
        print(2 ** n)
    else:
        print(0)
else:
    print(2 ** (n-1))
# Judge status: Wrong Answer
S=list(input())
count=0
for i in range(2):
    if S[i]==S[i+1]:
        count=1
if count==1:
    print('Bad')
else:
    print('Good')