Problem:
 Score : 300 points    Problem Statement N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N .  The i -th tile from the left is painted black if the i -th character of S is 0 , and painted white if that character is 1 .  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?      Constraints  1 \leq |S| \leq 10^5  S_i is 0 or 1 .         Input Input is given from Standard Input in the following format:  S       Output Print the minimum number of tiles that need to be repainted to satisfy the condition.        Sample Input 1 000      Sample Output 1 1  The condition can be satisfied by repainting the middle tile white.       Sample Input 2 10010010      Sample Output 2 3       Sample Input 3 0      Sample Output 3 0

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float('inf')
MOD = 10**9+7
dy = [0,1,0,-1]
dx = [1,0,-1,0]
ddy = [0,1,1,1,0,-1,-1,-1]
ddx = [1,1,0,-1,-1,-1,0,1]

S = input()
res1 = S[::2].count('1')+S[1::2].count('0')
res2 = S[1::2].count('1')+S[::2].count('0')
print(min(res1,res2))

Solution (Python):
s = input()
n = len(s)




err1 = 0
for i in range(n):
    if i % 2 == 0 and s[i] == "1":
        err1 += 1
    elif i % 2 == 1 and s[i] == "0":
        err1 += 1


err2 = 0
for i in range(n):
    if i % 2 == 0 and s[i] == "0":
        err2 += 1
    elif i % 2 == 1 and s[i] == "1":
        err2 += 1

print(min(err1, err2))

Solution (Python):
def main():
    s = input()

    import itertools
    x = sum(map(lambda t: t[0]==t[1], zip(s,itertools.cycle("01"))))
    y = sum(map(lambda t: t[0]==t[1], zip(s,itertools.cycle("10"))))
    print(min(x,y))


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    s = input()
    x = "01" * (len(s)//2+1)
    y = "10" * (len(s)//2+1)

    x = sum(map(lambda t: t[0]==t[1], zip(s,x)))
    y = sum(map(lambda t: t[0]==t[1], zip(s,y)))
    print(min(x,y))


if __name__ == '__main__':
    main()

Solution (Python):
s = input()

cnt1 = 0
cnt2 = 0
for i, char in enumerate(s):
    if i % 2 == 0:
        if char == '1':
            cnt1 += 1
        else:
            cnt2 += 1
    else:
        if char == '1':
            cnt2 += 1
        else:
            cnt1 += 1
print(min(cnt1,cnt2))

Solution (Python):
s = input()

ans1 = 0
for i in range(len(s)):
    if i % 2 == 0 and s[i] == '0':
        ans1 += 1
    elif i % 2 == 1 and s[i] == '1':
        ans1 += 1

ans2 = 0
for i in range(len(s)):
    if i % 2 == 0 and s[i] == '1':
        ans2 += 1
    elif i % 2 == 1 and s[i] == '0':
        ans2 += 1
print(min(ans1, ans2))

Solution (Python):
S=list(input())
N=len(S)
S_int_1=list(S)
S_int_2=list(S)
for i in range(N):
    S_int_1[i]=int(S[i])
    S_int_2[i]=int(S[i])
cnt_1=0
cnt_2=0
for i in range(N):
    if i%2==0 and S_int_1[i]==0:
        S_int_1[i]=1
        cnt_1+=1
    elif i%2==1 and S_int_1[i]==1:
        S_int_1[i]=0
        cnt_1+=1
for i in range(N):
    if i%2==0 and S_int_2[i]==1:
        S_int_2[i]=0
        cnt_2+=1
    elif i%2==1 and S_int_2[i]==0:
        S_int_2[i]=1
        cnt_2+=1
print(min(cnt_1,cnt_2))

Solution (Python):
S = input()

answer1 = '10' * (len(S) // 2) + '1' * (len(S) % 2)
answer2 = '01' * (len(S) // 2) + '0' * (len(S) % 2)
count1 = bin(int(answer1, 2) ^ int(S, 2))[2:].count('1')
count2 = bin(int(answer2, 2) ^ int(S, 2))[2:].count('1')
print(min(count1, count2))

Solution (Python):
s = input()
ans = 0
for i,j in enumerate(s):
  if i % 2 == 0:
    if j == "0":
      ans += 1
  else:
    if j == "1":
      ans += 1
print(min(ans,len(s)-ans))

Solution (Python):
S = input()
cnt = [[0,0],[0,0]]
for i, s in enumerate(S):
    x = int(i) % 2
    y = int(s)
    cnt[x][y] += 1
print(min(cnt[0][1] + cnt[1][0], cnt[0][0] + cnt[1][1]))

Solution (Python):
s=input()
n=s[::2].count("0")+s[1::2].count("1")
print(min(n,len(s)-n))

Solution (Python):
Tiles=input()

N_len=len(Tiles)
type1 = sum( 1 if int(Tiles[i]) == (i%2) else 0 for i in range(N_len))
type2 = sum( 0 if int(Tiles[i]) == (i%2) else 1 for i in range(N_len))
print(min(type1,type2))

Solution (Python):
Tiles=input()

N_len=len(Tiles)
type1 = sum( 1 if Tiles[i] == str(i%2) else 0 for i in range(N_len))
type2 = sum( 0 if Tiles[i] == str(i%2) else 1 for i in range(N_len))
print(min(type1,type2))

Solution (Python):
s=input()
print(min(s[::2].count("0")+s[1::2].count("1"),s[::2].count("1")+s[1::2].count("0")))

Solution (Python):
Tiles=input()

N_len=len(Tiles)

type1 = 0


for i in range(N_len):
    if Tiles[i] == str(i%2):
        type1 += 1
        

type2=0
for i in range(N_len):
    if Tiles[i] != str(i%2):
        type2 += 1
        
print(min(type1,type2))

Solution (Python):
S=input()
N=len(S)

cost=0
for i in range(0,N,2):
	if S[i]=='1':
		cost+=1
	if i!=N-1:
		if S[i+1]=='0':
			cost+=1
print(min(cost,N-cost))

Solution (Python):
S = input()
ans = 0
if S[0] == '0':
    for i, x in enumerate(S):
        if i % 2 == 0 and x == '1':
            ans += 1
        elif i % 2 == 1 and x == '0':
            ans += 1
elif S[0] == '1':
    for i, x in enumerate(S):
        if i % 2 == 0 and x == '0':
            ans += 1
        elif i % 2 == 1 and x == '1':
            ans += 1
print(ans)

Solution (Python):
s = str(input())
ans1 = s[::2].count('0') + s[1::2].count('1')
ans2 = s[::2].count('1') + s[1::2].count('0')
print(min(ans1, ans2))

Solution (Python):

S =input()
s0=0
s1=0
for i in range(len(S)):
    if i%2==0 and S[i]=="0":
        s1+=1
    elif i%2==0:
        s0+=1
    elif i%2!=0 and S[i]=="0":
        s0+=1
    elif i%2!=0:
        s1+=1
print(min(s0,s1))

Solution (Python):

a = str(input())

pre = a[0]
chenge = 0
for i in range(1,len(a)):
    if pre == "0" and a[i] == "0":
        a = a[:i] + "1" + a[i+1:]
        chenge += 1
    elif pre == "1" and a[i] == "1":
        a = a[:i] + "0" + a[i+1:]
        chenge += 1
    else:
        pass
    pre = a[i]

print(chenge)

Solution (Python):
def c_coloring_colorfully(S):
    ans1 = S[::2].count('0') + S[1::2].count('1')  
    ans2 = S[::2].count('1') + S[1::2].count('0')  
    return min(ans1, ans2)

S = input()
print(c_coloring_colorfully(S))

Solution (Python):
S = list(input())
ans = 0
if S[0] == "1":
	for i in range(len(S)):
		if i % 2 == 0 and S[i] == "0":
			ans += 1
		if i % 2 == 1 and S[i] == "1":
			ans += 1
else:
	for i in range(len(S)):
		if i % 2 == 0 and S[i] == "1":
			ans += 1
		if i % 2 == 1 and S[i] == "0":
			ans += 1
print(ans)

Solution (Python):
S = list(map(int, input()))

count = 0
tmp = S[0]
for ii in S:
    if ii != tmp:
        count += 1
    tmp = abs(tmp-1)

print(count)

Solution (Python):
S = list(map(int, input()))

count = 0
tmp = S[0]
for ii in S:
    if ii != tmp:
        count += 1
    if tmp == 1:
        tmp = 0
    else:
        tmp = 1


print(count)

Solution (Python):
import numpy as np
S = list(map(int, input()))

tmp = [0]*len(S)
if S[0] == 1:
    for ii in range(0,len(S),2):
        tmp[ii] = 1
else:
    for ii in range(1,len(S),2):
        tmp[ii] = 1

A = []
for ii in range(len(tmp)):
    A.append(S[ii]-tmp[ii])
    
count = np.count_nonzero(A)

print(count)

Solution (Python):
S = input().strip()
ansB = 0
ansW = 0
for i,c in enumerate(S):
	if (i % 2 == 0):
		if (c == '0'):
			ansW += 1
		else:
			ansB += 1
	else:
		if (c == '1'):
			ansW += 1
		else:
			ansB += 1
ans = min(ansW, ansB)
print(ans)

Solution (Python):
s = list(input())
p = 0 
q = 0 
n = len(s)
for i in range(n):
    if i % 2 == 0:
        if s[i] == "1":
            p += 1
        else:
            q += 1
    else:
        if s[i] == "1":
            q += 1
        else:
            p += 1

print(n - max(p,q))

Solution (Python):
S = list(map(int, input()))

count = 0
for ii in range(1,len(S)):
    if S[ii-1] == S[ii]:
        if S[ii] == 1:
            S[ii] = 0
        else:
            S[ii] = 1
        count += 1

print(count)

Solution (Python):
S = input()
N = len(S)
even_white = 0
odd_white = 0
for i in range(N):
    if i % 2 == 0:
        if S[i] == '1':
            even_white += 1
    else:
        if S[i] == '1':
            odd_white += 1
even_black = (N + 1) // 2 - even_white
odd_black = N // 2 - odd_white

cost01 = even_white + odd_black

cost10 = even_black + odd_white
cost = min(cost01, cost10)
print(cost)

Solution (Python):
s=input()
n=len(s)
count=0
if s[0]=='0':
    for i in range(1,n):
        if i%2==1 and s[i]=='0':
            count+=1
        elif i%2==0 and s[i]=='1':
            count+=1
else:
    for i in range(1,n):
        if i%2==1 and s[i]=='1':
            count+=1
        elif i%2==0 and s[i]=='0':
            count+=1
print(count)

Solution (Python):
s = input()
s_len = len(s)
s = int(s)
s_1 = '1'
s_0 = '0'

for i in range(0,s_len-1):
    if i%2==0:
        s_1 = s_1 + '0'
    else:
        s_1 = s_1 + '1'

for i in range(0,s_len-1):
    if i%2==0:
        s_0 = s_0 + '1'
    else:
        s_0 = s_0 + '0'

s_1 = int(s_1)
s_0 = int(s_0)

s_1_1 = str(s+s_1)
s_0_1 = str(s+s_0)

count_1=0
count_0=0
for i in s_1_1:
    if int(i)==1:
        count_1+=1
for i in s_0_1:
    if int(i)==1:
        count_0+=1
 
print(min(count_0,count_1))

Solution (Python):
S = list(input())
N = len(S)
s10 = ['1' if i%2==0 else '0' for i in range(N)]
s01 = ['0' if i%2==0 else '1' for i in range(N)]
ans10, ans01 = 0, 0
for i in range(N):
    if S[i] != s10[i]:
        ans10 += 1
    elif S[i] != s01[i]:
        ans01 += 1
print(min(ans10, ans01))

Solution (Python):
s=input()
s_list=list(s)
count=0
for i in range(len(s)-1):
    if s_list[i]==s_list[i+1]:
        if s_list[i+1]=='0':
            s_list[i+1]='1'
        else:
            s_list[i+1]='0'
        count+=1
        
print(count)

Solution (Python):
s = list(input())
one_zero_list = ['0' if i%2==0 else '1' for i in range(len(s))]
zero_one_list = ['1' if i%2==0 else '0' for i in range(len(s))]

count_one_zero = len([0 for i in range(len(s)) if s[i]!=one_zero_list[i]])
count_zero_one = len([0 for i in range(len(s)) if s[i]!=zero_one_list[i]])

print(min(count_one_zero,count_zero_one))

Solution (Python):
s = input()
zcount = 0
for i in range(len(s)):
    if i % 2 == 0:
        if s[i] != "0":
            zcount += 1
    else:
        if s[i] != "1":
            zcount += 1
ocount = 0
for i in range(len(s)):
    if i % 2 == 0:
        if s[i] != "1":
            ocount += 1
    else:
        if s[i] != "0":
            ocount += 1
print(min(zcount, ocount))

Solution (Python):
import numpy as np

S = input()

A = np.array([int(S[i]) for i in range(len(S))])
C = np.zeros(len(S), dtype='int')
C[1:len(S):2] = 1
D = np.zeros(len(S), dtype='int')
D[0:len(S):2] = 1
print(np.min([np.sum(A!=C), np.sum(A!=D)]))

Solution (Python):
n=input()
li=list(n)
if len(n)==1:
  print(0)
elif len(n)%2==0:
  counta=0 
  countb=0
  a=list("10"*int((int(len(n))/2)))
  b=list("01"*int((int(len(n))/2)))
  for i in range(len(n)):
    counta+= abs(int(li[i])-int(a[i]))
    countb+=abs(int(li[i])-int(b[i]))
  print(min(counta,countb))

elif len(n)%2==1 and len(n) != 1:
  countaa=0 
  countbb=0
  aa=list("10"*int(((int(len(n))-1)/2))+"1")
  bb=list("01"*int(((int(len(n))-1)/2))+"0")
  for i in range(len(n)):
    countaa+=abs(int(li[i])-int(aa[i]))
    countbb+=abs(int(li[i])-int(bb[i]))
  print(min(countaa,countbb))

Solution (Python):
S = str(input())

err1, err2 = 0, 0

for i in range(len(S)):
    if S[i] != str(int(bool(int(i%2)))):
        err1 += 1

print(min(err1, (len(S)-err1)))

Solution (Python):
s=input()
count=0
for i in range(0,len(s)-1,2):
  if s[i]=='0':
    count+=1
  if s[i+1]=='1':
    count+=1
if len(s)%2==1:
  if s[len(s)-1]=='0':
    count+=1
print(min(count,len(s)-count))

Solution (Python):
s = input()
odd = s[::2]
even = s[1::2]
pred1 = len(even) - even.count("1") + (len(odd) - odd.count("0"))
pred2 = len(even) - even.count("0") + (len(odd) - odd.count("1"))
print(min(pred1, pred2))

Solution (Python):
S = input()
ans = len(S)

for i in range(2):
  cnt = 0
  for j in range(len(S)):
    if j % 2 == 0 and S[j] != str(i):
      cnt += 1
    if j % 2 == 1 and S[j] == str(i):
      cnt += 1
  ans = min(ans, cnt)
print(ans)

Solution (Python):
S = input()
ans = 0
flag ='0'
for x in S:
    if flag != x:
        ans += 1
    if flag == '1':
        flag = '0'
    else:
        flag = '1'
print(min(ans,len(S)-ans))

Solution (Python):
S=input()
cnt_1=0
cnt_2=0
N=len(S)
if N%2==0:
	for i in range(N):
		if i%2==0:
			if S[i]=='1':
				cnt_1+=1
		else:
			if S[i]=='1':
				cnt_2+=1
	print(min(cnt_1+((N//2)-cnt_2),((N//2)-cnt_1)+cnt_2))
else:
	for i in range(N):
		if i%2==0:
			if S[i]=='1':
				cnt_1+=1
		else:
			if S[i]=='1':
				cnt_2+=1
	print(min(cnt_1+((N//2)-cnt_2),((N//2)+1-cnt_1)+cnt_2))

Solution (Python):
s = input()
s = list(map(int, s))
ans = len(s)
for i in range(2):
    cnt = 0
    for j, ss in enumerate(s):
        if (j + i) % 2 != ss: cnt += 1
    ans = min(ans, cnt)
print(ans)

Solution (Python):
raw = input()
s = bin(int(raw, 2))
n = len(raw)
m = bin(int(''.join([str(i%2) for i in range(n)]),2))
 
a = bin((int(s,2))^int(m,2)).count("1")
b = n-a
 
print(a if a < b else b)

Solution (Python):
s = input()
count_odd = 0
for i in range(len(s)): 
    if s[i] != str(i % 2):
        count_odd += 1
count_even = 0
for i in range(len(s)):
    if s[i] == str(i % 2):
        count_even += 1

print(min(count_odd, count_even))

Solution (Python):
S = input()
A = ''.join([str(i % 2) for i in range(len(S))])
B = ''.join([str((i + 1) % 2)  for i in range(len(S))])

ans1 = ans2 = 0

for s, a, b, in zip(S, A, B):
    if s != a:
        ans1 += 1
    if s != b:
        ans2 += 1

print(min(ans1, ans2))

Solution (Python):
S = list(input())
cnt = 0
for i in range(1, len(S)):
    if S[i-1] == S[i]:
        if S[i] == '0':
            S[i] = '1'
        else:
            S[i] = '0'
        cnt += 1
print(cnt)

Solution (Python):


S = str(input())
N = len(S)

s0 = ''
s1 = ''

def count_diff(s):
    count = 0
    for i in range(N):
        if s[i] != S[i]:
            count += 1
    return(count)

for i in range(N):
    if i % 2 == 0:
        s0 = s0 + '0'
        s1 = s1 + '1'
    else:
        s0 = s0 + '1'
        s1 = s1 + '0'

print(min(count_diff(s0), count_diff(s1)))

Solution (Python):
s = input()
count = 0

for i in range(len(s)):
    if i % 2 == 0:
        if s[i] == "0":
            count += 1
    else:
        if s[i] == "1":
            count += 1

print(min(count, len(s) - count))

Solution (Python):
S = [int(i) for i in input()]

ans = 99999999
for i in range(2):
    cnt = 0
    for j, s_j in enumerate(S):
        if (j % 2 == 0) ^ (s_j != i):
            cnt += 1
    ans = min(ans, cnt)

print(ans)

Solution (Python):
S=input()
t=S[0::2].count('0')+S[1::2].count('1')
print(min(t,len(S)-t))

Solution (Python):
from collections import Counter
S = input()
c1 = Counter(S[::2])
c2 = Counter(S[1::2])
print(min(c1["0"] + c2["1"], c1["1"] + c2["0"]))

Solution (Python):
t = list(input())
 
ans = min(t[::2].count('0') + t[1::2].count('1'),t[::2].count('1') + t[1::2].count('0'))
     
print(ans)

Solution (Python):
S = input()
ans0 = 0
ans1 = 0
N = len(S)
for i in range(N):
    if i%2 == 0:
        if S[i] == "0":
            ans1 += 1
        else:
            ans0 += 1
    else:
        if S[i] == "1":
            ans1 += 1
        else:
            ans0 += 1        
print(min(ans0, ans1))

Solution (Python):
s=str(input())
S=[]

for i in s:
    S.append(i)

if len(S)==1:
    print(0)
elif S[0]=='1':
    T=[0 for i in range(len(S)) if (i%2==0 and S[i]=='0') or (i%2==1 and S[i]=='1')]
    print(len(T))
elif S[0]=='0':
    T=[0 for i in range(len(S)) if (i%2==0 and S[i]=='1') or (i%2==1 and S[i]=='0')]
    print(len(T))

Solution (Python):
S = list(input())

def way1():
    ans = 0
    for i in range(len(S)):
        if i % 2 == 0 and S[i] == "1":
            ans += 1
        elif i % 2 == 1 and S[i] == "0":
            ans += 1
    return ans

def way2():
    ans = 0
    for i in range(len(S)):
        if i % 2 == 0 and S[i] == "0":
            ans += 1
        elif i % 2 == 1 and S[i] == "1":
            ans += 1
    return ans


print(min(way1(), way2()))

Solution (Python):
s=input()
cnt1=0
cnt2=0
for i,c in enumerate(s):
    cnt1+=int(c)!=i%2
    cnt2+=int(c)!=(i+1)%2
print(min(cnt1,cnt2))

Solution (Python):
number=list(input())

paturn1=list("10"*(10**5))
paturn2=list("01"*(10**5))
convert1=[int(x)^int(y) for x,y in zip(number,paturn1)]
convert2=[int(x)^int(y) for x,y in zip(number,paturn2)]

print(min([convert1.count(1),convert2.count(1)]))

Solution (Python):
S = [int(x) for x in list(input())]

min_0 = 0 
min_1 = 0 

for i in range(len(S)):
    if i % 2 ==0:
        if not (S[i] == 0):
            min_0 += 1
        else:
            min_1 += 1
    if i % 2 ==1:
        if not (S[i] == 1):
            min_0 += 1
        else:
            min_1 += 1
                
times = min([min_0, min_1])
print(times)

Solution (Python):
s=input()
Z=0
W=0
for i in range(len(s)):
  if int(s[i]) == i % 2:
    Z += 1
  else:
    W += 1
print(min(Z,W))

Solution (Python):
S = [int(x) for x in list(input())]

min_0 = 0
min_1 = 0

for i in range(len(S)):
    if i % 2 ==0:
        if not (S[i] == 0):
            min_0 += 1
        elif not (S[i] == 1):
            min_1 += 1
    if i % 2 ==1:
        if not (S[i] == 1):
            min_0 += 1
        elif not (S[i] == 0):
            min_1 += 1
                
times = min([min_0, min_1])
print(times)

Solution (Python):
S = input()
even = S[0::2]
odd = S[1::2]
N = len(S)

tmp_e = N - (even.count("1")+odd.count("0"))
tmp_o = N - (even.count("0")+odd.count("1"))

print(min(tmp_e, tmp_o))

Solution (Python):
s=list(input())
l = len(s)
zero = [i % 2 for i in range(0, l)]
one = [(i+1) % 2 for i in range(0, l)]
strs_zero = [str(num) for num in zero]
strs_one = [str(num) for num in one]
import numpy as np
s_np = np.array(s)
zero_np = np.array(strs_zero)
one_np = np.array(strs_one)
count_zero = l - np.sum(s_np == zero_np)
count_one = l - np.sum(s_np == one_np)
if count_zero < count_one:
    print(count_zero)
else:
    print(count_one)

Solution (Python):
import numpy as np
S=np.array([int(s) for s in input()])
N=len(S)

goal1=np.array([(i%2) for i in range(N)])
goal2=np.array([1-(i%2) for i in range(N)])

print(min(np.sum(np.logical_xor(S,goal1)),np.sum(np.logical_xor(S,goal2))))

Solution (Python):
S = list(map(int, input()))
ans = [0, 0]

for i in range(len(S)):
    if (i % 2 == S[i]):
        ans[0] += 1
    if (i % 2 != S[i]):
        ans[1] += 1

print(min(ans))

Solution (Python):








S=input()
l=len(S)

a,b=0,0

for i in range(l):
    if i%2==1 and S[i]=="0":
        a+=1
    elif i%2==0 and S[i]=="1":
        a+=1


for i in range(l):
    if i%2==1 and S[i]=="1":
        b+=1
    elif i%2==0 and S[i]=="0":
        b+=1
c=max(a,b)

ans=l-c

print(ans)

Solution (Python):
S = input()
ans = [0, 0]

for i in range(len(S)):
    if (i % 2 == int(S[i])):
        ans[0] += 1
    if (i % 2 != int(S[i])):
        ans[1] += 1

    
print(min(ans))

Solution (Python):
S = list(input())

a0 = 0
a1 = 0
b0 = 0
b1 = 0

f = True
for s in S:
    if f:
        if s == '0':
            a0 += 1
        else:
            a1 += 1
        f = False
    else:
        if s == '0':
            b0 += 1
        else:
            b1 += 1
        f = True

ans = min(a0 + b1, a1 + b0)
print(ans)

Solution (Python):
x = input()
point1 = 0
for i in range(len(x)):
    if i % 2 == 0 and x[i] == '0':
        point1 += 1
    elif i % 2 == 1 and x[i] == '1':
        point1 += 1

point2 = 0
for i in range(len(x)):
    if i % 2 == 0 and x[i] == '1':
        point2 += 1
    elif i % 2 == 1 and x[i] == '0':
        point2 += 1

print(min(point1,point2))

Solution (Python):
s = input()
N = len(s)
t_01 = '01' * (N // 2) + ('0' if N % 2 == 1 else '')
t_10 = '10' * (N // 2) + ('1' if N % 2 == 1 else '')





s_n = int(s, 2)
t_01_n = int(t_01, 2)
t_10_n = int(t_10, 2)





ans = N
for x in s_n ^ t_01_n, s_n ^ t_10_n:
    ans = min(ans, bin(x)[2:].count('1'))

print(ans)

Solution (Python):
S = input()
c = 0
zo = 0 
oz = 0 
for i in range(0, len(S)//2 * 2, 2):
    if S[i] == '0':
        oz += 1
    else:
        zo += 1
    if S[i+1] == '0':
        zo += 1
    else:
        oz += 1
if len(S) & 1:
    if S[-1] == '0':
        oz += 1
    else:
        zo += 1
print(min(oz, zo))

Solution (Python):
S = input()
count = 0
  
for i in range(len(S)):
  if i % 2 == int(S[i]):
    count += 1
print(min(count, len(S) - count))

Solution (Python):
S = input()
ans = [0, 0]

for i in range(len(S)):
    if (i % 2 == 0 and S[i] != '1') or (i % 2 == 1 and S[i] != '0'):
        ans[0] += 1
    if (i % 2 == 0 and S[i] != '0') or (i % 2 == 1 and S[i] != '1'):
        ans[1] += 1
    
print(min(ans))

Solution (Python):
n=list(input())
s=0
for i in range(len(n)-1):
    if n[i]==n[i+1]:
        if n[i+1]=="0":
            n[i+1]="1"
        else:
            n[i+1]="0"
        s+=1
print(s)

Solution (Python):
s=list(map(int,input()))
s2=list(reversed(s))

res = 0
for i in range(len(s)-1):
	if s[i] == s[i+1]:
		if s[i+1] == 0:
			s[i+1]=1
		else:
			s[i+1]=0
		res = res + 1

res2 = 0
for i in range(len(s2)-1):
	if s2[i] == s2[i+1]:
		if s2[i+1] == 0:
			s2[i+1]=1
		else:
			s2[i+1]=0
		res2 = res2 + 1

print(min(res,res2))

Solution (Python):

S = list(input())
zero, one = ["0"] * len(S), ["0"] * len(S)
for i in range(1, len(S)+1):
    if i % 2 == 0:
        zero[i-1] = "1"
    else:
        one[i-1] = "1"
c1, c2 = 0, 0
for i in range(len(S)):
    if S[i] != zero[i]:
        c1 += 1
    elif S[i] != one[i]:
        c2 += 1
print(min(c1, c2))

Solution (Python):
S = input()
c = S[::2].count('0') + S[1::2].count('1') 
print(min(c, len(S) - c))

Solution (Python):
s=input()
p=[0]*2
for a,i in enumerate(s):
    if a%2==0 and i=="0":
        p[0]+=1
    if a%2==1 and i=="1":
        p[0]+=1
    if a%2==0 and i=="1":
        p[1]+=1
    if a%2==1 and i=="0":
        p[1]+=1

print(min(p))

Solution (Python):
s = str(input())
n = len(s)


s1 = s[::2]
s2 = s[1::2]

zero = s1.count('0')
one = s2.count('1')

if zero + one < n/2:
  print(zero + one)
else:
  print(n - zero - one)

Solution (Python):
a=0
for i,s in enumerate(input()):a+=i%2^int(s)
print(min(a,i-a+1))

Solution (Python):
s = input()
odd = 0
even = 0
n = len(s)

for i in range(n):
    if s[i] == '1':
        if i%2 == 0:
            odd += 1
        else:
            even += 1

if n%2 == 0:
    n //= 2
    ans = n - max(odd,even) + min(odd,even)
    print(ans)

else:
    n //= 2
    x = n+1 - odd + even
    y = n - even + odd
    ans = min(x,y)
    print(ans)

Solution (Python):
S = input()
N = len(S)
ev = S[0::2]
od = S[1::2]
A = N - (ev.count('0') + od.count('1'))
B = N - (ev.count('1') + od.count('0'))
print(min(A, B))

Solution (Python):
S = input()
sumi = 0
sumii = 0

for i in range(len(S)):
  if (i % 2) == 0:
    if S[i:i+1] == "1":
      sumi += 1
  if (i % 2) == 1:
    if S[i:i+1] == "0":
      sumi += 1

for i in range(len(S)):
  if (i % 2) == 0:
    if S[i:i+1] == "0":
      sumii += 1
  if (i % 2) == 1:
    if S[i:i+1] == "1":
      sumii += 1
        
if sumi > sumii:
  print(sumii)
else:
  print(sumi)

Solution (Python):
S = input()
count101 = 0
count010 = 0
for i in range(len(S)):
    if i % 2 == 0:
        if S[i] == "1":
            count010 += 1
        else:
            count101 += 1
    else:
        if S[i] == "0":
            count010 += 1
        else:
            count101 += 1
print(min(count010,count101))

Solution (Python):
S = input()


ans = 10 ** 5
count = 0
for i in range(len(S)):
    if S[i] != "0" and i % 2 == 0:
        count += 1
    elif S[i] != "1" and i % 2 == 1:
        count += 1
ans = min(ans, count)


count = 0
for i in range(len(S)):
    if S[i] != "1" and i % 2 == 0:
        count += 1
    elif S[i] != "0" and i % 2 == 1:
        count += 1
ans = min(ans, count)
print(ans)

Solution (Python):
S = input()

def solve(B):
    res = 0
    for i, s in enumerate(S):
        if s == B[i % 2]:
           res += 1 
    return res

print(min(solve(['0', '1']), solve(['1', '0'])))

Solution (Python):
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def ii(): return int(stdin.readline())
def li(): return map(int, stdin.readline().split())
S = stdin.readline()
L = len(S)
cnt = 0
cnt1 = 0

for i, s in enumerate(S):
    if i & 1 == 1:
        incr = 1 if s == '1' else 0
        cnt += incr
    else:
        incr = 1 if s == '0' else 0
        cnt += incr
for i, s in enumerate(S):
    if i & 1 == 1:
        incr = 1 if s == '0' else 0
        cnt1 += incr
    else:
        incr = 1 if s == '1' else 0
        cnt1 += incr
print(min(cnt, cnt1))

Solution (Python):

"""
Created on Sat Apr 13 21:45:12 2019

@author: sofugo
"""
import numpy as np
N = (input())
x=np.array(list(N),dtype=np.int)
count=0
count2=0

now=0
for n,i in enumerate(x):
    if i==now:
        if n%2==0:
            now=1
        else:
            now=0
    else:
        count+=1
        if n%2==0:
            now=1
        else:
            now=0
    
now=1
for n,i in enumerate(x):
    if i==now:
        if n%2==0:
            now=0
        else:
            now=1
    else:
        count2+=1
        if n%2==0:
            now=0
        else:
            now=1
if(count>count2):
    print(count2)
else:
    print(count)

Solution (Python):
def c_coloring_colorfully(S):
    s1 = '10' * (len(S) // 2) + ('1' if len(S) % 2 == 1 else '')
    s2 = '01' * (len(S) // 2) + ('0' if len(S) % 2 == 1 else '')
    ans1 = len([1 for k, s in enumerate(S) if s != s1[k]])
    ans2 = len([1 for k, s in enumerate(S) if s != s2[k]])
    return min(ans1, ans2)

S = input()
print(c_coloring_colorfully(S))

Solution (Python):
s=list(input())
dp=[[0,0] for i in range(len(s)+1)]
dp[0][1] = 1
for i in range( len(s)-1 ):
  if s[i] == s[i+1]:
    dp[i+1][0] = dp[i][1]
    dp[i+1][1] = dp[i][0]+1
  else:
    dp[i+1][0] = dp[i][0]
    dp[i+1][1] = dp[i][1]+1
print(min(dp[len(s)-1]))

Solution (Python):
s = input()
strlist = list(s)
ans = 0
for i in range(len(s)-1):
    if strlist[i] == strlist[i+1]:
        strlist[i+1] = str(abs(1-int(strlist[i])))
        ans += 1
print(ans)

Solution (Python):
"""
C - Coloring Colorfully
https://atcoder.jp/contests/abc124/tasks/abc124_c
"""
if __name__ == '__main__':
    S = str(input())

    len_S = len(S)
    S_list = []
    answer_type_1 = []
    answer_type_2 = []
    for i in range(0, len_S):
        S_list.append(S[i])
        if i % 2 == 0:
            answer_type_1.append("0")
            answer_type_2.append("1")
        else:
            answer_type_1.append("1")
            answer_type_2.append("0")

    answer_1 = 0
    answer_2 = 0

    for i, Si in enumerate(S_list):
        if S_list[i] != answer_type_1[i]:
            answer_1 += 1
        if S_list[i] != answer_type_2[i]:
            answer_2 += 1

    answer = min(answer_1, answer_2)

    print(answer)

Solution (Python):
s = input()


count_1 = s[::2].count('0') + s[1::2].count('1')


count_0 = s[::2].count('1') + s[1::2].count('0')

print(min(count_1, count_0))

Solution (Python):
s = list(input())
count1 = 0
s_copy = s.copy()
for i in range(len(s)-1):
    if s[i] == s[i+1]:
        count1 += 1
        if s[i+1] == '0':
            s[i+1] = '1'
        else:
            s[i+1] = '0'
print(count1)

Solution (Python):
S = input()
N = len(S)
even = S[0::2]
odd = S[1::2]
ptn0 = N - (even.count('0') + odd.count('1'))
ptn1 = N - (even.count('1') + odd.count('0'))
print(min(ptn0, ptn1))

Solution (Python):
S = input()

B = []
W = []
for i in range (len(S)):
    if i % 2 == 0:
        B += ["0"]
        W += ["1"]
    else:
        B += ["1"]
        W += ["0"]
        
aB = 0
aW = 0

for i in range(len(S)):
    if B[i] != S[i]:
        aB += 1
    if W[i] != S[i]:
        aW += 1
print(min(aB, aW))

Solution (Python):
S = str(input())

S1 = list(S)

LEN = len(S1)


start0_CONT=0
for i in range(0,LEN):
    if int(i) % 2 == 0:
        if int(S1[i]) == 1:
            start0_CONT=start0_CONT+1
    elif int(i) % 2 == 1:
        if int(S1[i]) == 0:
            start0_CONT=start0_CONT+1
      

start1_CONT=0
for i in range(0,LEN):
    if int(i) % 2 == 0:
        if int(S1[i]) == 0:
            start1_CONT=start1_CONT+1
    elif int(i) % 2 == 1:
        if int(S1[i]) == 1:
            start1_CONT=start1_CONT+1


if start0_CONT > start1_CONT:
    print(start1_CONT)
else:
    print(start0_CONT)

Solution (Python):
S = str(input())

S1 = list(S)

LEN = len(S1)


start0_CONT=0
for i in range(0,LEN):
    if int(i) % 2 == 0:
        if int(S1[i]) == 1:
            start0_CONT=start0_CONT+1
    elif int(i) % 2 == 1:
        if int(S1[i]) == 0:
            start0_CONT=start0_CONT+1
      

start1_CONT=0
for i in range(0,LEN):
    if int(i) % 2 == 0:
        if int(S1[i]) == 0:
            start1_CONT=start1_CONT+1
    elif int(i) % 2 == 1:
        if int(S1[i]) == 1:
            start1_CONT=start1_CONT+1


if start0_CONT > start1_CONT:
    print(start1_CONT)
else:
    print(start0_CONT)

Solution (Python):
S = list(input())
cnt = 0
for i in range(1, len(S)):
    if S[i-1] == S[i]:
        if S[i] == '0':
            S[i] = '1'
        else:
            S[i] = '0'
        cnt += 1
print(cnt)

Solution (Python):
S = list(input())
cnt = 0
for i in range(1, len(S)):
    if S[i-1] == S[i]:
        if S[i] == '0':
            S[i] = '1'
        else:
            S[i] = '0'
        cnt += 1
print(cnt)

Solution (Python):
S = list(input())
cnt = 0
for i in range(1, len(S)):
    if S[i-1] == S[i]:
        if S[i] == '0':
            S[i] = '1'
        else:
            S[i] = '0'
        cnt += 1
print(cnt)

Solution (Python):
numList = [int(c) for c in input()]

sum_a = 0
sum_b = 0

for index, num in enumerate(numList):
  a = index % 2
  b = (index + 1) % 2
  if(num - a != 0): 
  	sum_a += 1
  else:
    sum_b += 1

if(sum_a >= sum_b):
  print(sum_b)
else:
  print(sum_a)

Solution (Python):
S = str(input())

first0= 0
first1 = 0

nextStr = 1
for s in S:
    if int(s) != nextStr:
        first1 += 1 
        
    if nextStr == 1:
        nextStr = 0 
    else: nextStr = 1 

nextStr = 0
for s in S:
    if int(s) != nextStr:
        first0 += 1 
        
    if nextStr == 1:
        nextStr = 0 
    else:
        nextStr = 1 
    
print(min(first0, first1))

Solution (Python):
import itertools
S = input()

p1 = itertools.cycle('01')
p2 = itertools.cycle('10')

ans1=0
ans2=0
for s,P1,P2 in zip(S,p1,p2):
  if s == P1:
    ans1 += 1
  if s == P2:
    ans2 += 1
print(min(ans1,ans2))

Solution (Python):
*s,=map(int,input());a=0
for i in range(1,len(s)):a+=s[i]==s[i-1];s[i]=1-s[i-1]
print(a)

Solution (Python):
s=input()
a=[int(c) for c in s]
n=0
c=0
d=len(a)
while n<=d:
    b=n%2
    if a[n]==0 and b==1:
        c=c+1
    if a[n]==1 and b==0:
        c=c+1
    if n+1==d:
        break
    n=n+1
if c<= d/2:
    print(c)
else:
    print(d-c)

Solution (Python):
aj = input()
a1 = [str(i%2) for i in range(len(aj))]
a2 = [str((i+1)%2) for i in range(len(aj))]
cnt1=cnt2=0
for i in range(len(aj)):
  if aj[i]==a1[i]:
    cnt1+=1
  if aj[i]==a2[i]:
    cnt2+=1
print(min(cnt1,cnt2))

Solution (Python):
a = input()
n = len(a)
count0 = 0    
count1 = 0    
for i in range(n):
    if i % 2 == 0 and int(a[i]) ==1:
        count0 = count0 +1
    elif i % 2 == 0 and int(a[i]) ==0:
        count1 = count1 +1
    elif i % 2 == 1 and int(a[i]) ==1:
        count1 = count1 +1
    elif i % 2 == 1 and int(a[i]) ==0:
        count0 = count0 +1

print(min(count0, count1))