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



Sample input:
000


Sample output:
1

Submission status: Wrong Answer

Solution code:

l = list(map(int, input()))

count = [999, 999]
c = 0
rlt = 0

if len(l) == 1:
    rlt = 0
else:
    for _ in range(2):
        a = 0
        a = l[0]
        c = 0

        if l[0] == 1:
            n = l[:]
            # 文字列の変更
            for y, x in enumerate(n[1:], 1):
                if x == a and a == 1:
                    n[y] = 0
                    a = n[y]
                    c += 1
                elif x == a and a == 0:
                    n[y] = 1
                    a = n[y]
                    c += 1
                else:
                    a = n[y]
            # 変更回数を評価
            if c < count[0]:
                count[0] = c
            l[0] = 0

        if l[0] == 0:
            n = l[:]
            # 文字列の変更
            for y, x in enumerate(n[1:], 1):
                if x == a and a == 1:
                    n[y] = 0
                    a = n[y]
                    c += 1
                elif x == a and a == 0:
                    n[y] = 1
                    a = n[y]
                    c += 1
                else:
                    a = n[y]
                # 変更回数を評価
                if c < count[1]:
                    count[1] = c           
                l[0] = 1

if count[0] < count[1]:
    rlt = count[0]
elif count[1] < count[0]:
    rlt = count[1]
else:
    rlt = count[0]

print(rlt)

Submission status: Wrong Answer

Solution code:
s = input()

sum1 = sum([(i % 2 == 0 and s[i] == '0') or (i % 2 == 1 and s[i] == '1') \
    for i in range(len(s))])
sum2 = sum([(i % 2 == 1 and s[i] == '0') or (i % 2 == 1 and s[i] == '0') \
    for i in range(len(s))])

print(sum1 if sum1 < sum2 else sum2)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
''' 
------------------------
author : iiou16
------------------------
'''

def main():
    S = "0b" + input()
    
    # 01010...のビット列とのXORをとってビットの数を数える
    # 0と1で少ないほうが最小値
    base = "0b"
    for i in range(len(S)-2):
        if i % 2 == 0:
            base += "0"
        else:
            base += "1"
    # print(S, base)
    res = int(S, 0) ^ int(base, 0)

    bit = bin(res)
    bit = list(map(int, list(bit[2:])))
    count = sum(bit)
    
    if count >= len(bit) / 2:
        print(len(bit) - count)
    else:
        print(count)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
s = list(input())
sl = len(s)
if sl % 2 == 0:
    if s[0] == s[-1]:
        ans = 1
    else:
        ans = 0
else:
    if s[0] == s[-1]:
        ans = 0
    else:
        ans = 1
for i in range(1, sl):
    if s[i - 1] == s[i]:
        ans += 1
        if s[i] == '0':
            s[i] = '1'
        else:
            s[i] = '0'
if ans > sl // 2:
    ans = sl - ans
print(ans)

Submission status: Wrong Answer

Solution code:
s = list(input())
sl = len(s)
if sl % 2 == 0:
    if s[0] == s[-1]:
        ans = 1
    else:
        ans = 0
else:
    if s[0] == s[-1]:
        ans = 0
    else:
        ans = 1
for i in range(1, sl):
    if s[i - 1] == s[i]:
        ans += 1
        if s[i] == '0':
            s[i] = '1'
        else:
            s[i] = '0'
print(ans)

Submission status: Wrong Answer

Solution code:
s = input().strip()
n = len(s)
one = s.count('0')
l = [one]
for i in range(n):
  if s[i] == '0':
     one-=1
  else:
     one+=1
  l.append(one)
print(min(l))

Submission status: Wrong Answer

Solution code:
s = input().strip()
n = len(s)
one = s.count('0')
l = []
for i in range(n):
  if s[i] == '0':
    one-=1
  else:
    one+=1
  l.append(one)
print(min(l))

Submission status: Wrong Answer

Solution code:
S = str(input())
N = len(S)

left_b = 0
if N%2 == 0:
    for i in range(N//2):
        if S[2*i] == str(1): #もし奇数番目が白だったらひっくり返す
            left_b = left_b + 1
        if S[2*i+1] == str(0):
            left_b = left_b + 1
    mini = min(left_b,N - left_b)
        
else:
    for i in range(N//2):
        if S[2*i] == str(1): #もし奇数番目が白だったらひっくり返す
            left_b = left_b + 1
        if S[2*i+1] == str(0):
            left_b = left_b + 1
            print(left_b)
    if S[N-1] == str(1):
            left_b = left_b + 1
    mini = min(left_b,N - left_b)

print(mini)

Submission status: Wrong Answer

Solution code:
S = str(input())
N = len(S)

left_b = 0
if N%2 == 0:
    for i in range(N//2 - 1):
        if S[2*i] == str(1): #もし奇数番目が白だったらひっくり返す
            left_b = left_b + 1
        if S[2*i+1] == str(0):
            left_b = left_b + 1
    mini = min(left_b,N - left_b)
        
else:
    for i in range(N//2 - 1):
        if S[2*i] == str(1): #もし奇数番目が白だったらひっくり返す
            left_b = left_b + 1
        if S[2*i+1] == str(0):
            left_b = left_b + 1
    if S[N-1] == str(1):
            left_b = left_b + 1
    mini = min(left_b,N - left_b)

print(mini)

Submission status: Wrong Answer

Solution code:
S = str(input())
N = len(S)

left_b = 0
if N%2 == 0:
    for i in range(N//2 - 1):
        if S[2*i] == str(1): #もし奇数番目が白だったらひっくり返す
            left_b = left_b + 1
        if S[2*i+1] == str(0):
            left_b = left_b + 1
    mini = min(left_b,N - left_b)
        
else:
    for i in range(N//2 - 1):
        if S[2*i] == str(1): #もし奇数番目が白だったらひっくり返す
            left_b = left_b + 1
        if S[2*i+1] == str(0):
            left_b = left_b + 1
    if S[N-1] == str(1):
            left_b ==left_b + 1
    mini = min(left_b,N - left_b)

print(mini)

Submission status: Wrong Answer

Solution code:
# -*-coding: utf-8 -*-

S=list(str(input()))

ref_1=[str(0)]*len(S)
ref_2=[str(1)]*len(S)

for ii in range(0,len(S)-1):
    if ii % 2 != 0:
        ref_1[ii]=str(1)
        ref_2[ii]=str(0)

print(S)
print(ref_1)
print(ref_2)

count1=0
count2=0

for jj in range(0,len(S)-1):
    if S[jj] != ref_1[jj]:
        count1 += 1
    if S[jj] != ref_2[jj]:
        count2 += 1

print(min(count1,count2))

Submission status: Wrong Answer

Solution code:
S = list(map(int,input()))
S2 = [i for i in S]
S2[0] = abs(S[0]-1)
ans = 0
sWork = 0
s2Work = 0
length = len(S)

for i in range(length-1):
	if S[i] + S[i+1] != 1:
		S[i+1] = abs(S[i+1] -1)
		sWork += 1
	if S2[i] + S2[i+1] != 1:
		S2[i+1] = abs(S2[i+1] -1)
		s2Work += 1

ans = sWork if sWork < s2Work else s2Work
print(ans)

Submission status: Wrong Answer

Solution code:
S_array = [int(c) for c in list(input())]
count = 0

if len(S_array) == 1:
  print(count)

for i in range(len(S_array) - 1):
  if S_array[i] != S_array[i + 1]:
    continue
  elif S_array[i] == 0:
    S_array[i + 1] = 1
  else:
    S_array[i + 1] = 0
  count = count + 1

print(count)

Submission status: Wrong Answer

Solution code:
color = input()

l1 = [str(i % 2) for i in range(len(color))]
l2 = [str((i + 1) % 2) for i in range(len(color))]

print(color)
print(l1, l2)
s1 = s2 = 0
for c, n1, n2 in zip(color, l1, l2):
    s1 += (c != n1)
    s2 += (c != n2)

print(min(s1, s2))

Submission status: Wrong Answer

Solution code:
s=list(map(int,list(input())))
so=[]
se=[]
for i in range(len(s)):
    if i%2==0:
        so.append(s[i])
    if i%2!=0:
        se.append(s[i])

tso=sum(so)
tse=sum(se)

if tso>>tse:
    print(-(-len(s)//2)-tso+tse)
  
else:
    print(len(s)//2+tso-tse)

Submission status: Wrong Answer

Solution code:
s=list(map(int,list(input())))
so=[]
se=[]
for i in range(len(s)):
    if i%2==0:
        so.append(s[i])
    if i%2!=0:
        se.append(s[i])

tso=sum(so)
tse=sum(se)

if tso>>tse:
    print(-(-len(s)//2)-tso+tse)

else:
    print(len(s)//2+tso-tse)

Submission status: Wrong Answer

Solution code:
s = input()
odd = s[0::2]
even = s[1::2]

odd0 = odd.count("0")
odd1 = odd.count("1")
even0 = even.count("0")
even1 = even.count("1")

print(max((odd0 + even1), (odd1 + even0)))

Submission status: Wrong Answer

Solution code:
s = input()
if len(s) == 1:
    print(0)
else:
    r = 0
    f = s[0]
    for i in s[1:]:
        if i == f:
            r += 1
            f = '1' if i == '0' else '0'
    print(r)

Submission status: Wrong Answer

Solution code:
S = input()
l = len(S)

out = 0
for i, j in enumerate(S):
  out += int(j) ^ (i % 2)
  if out > l / 2:
      out = l - out
      break

print(out)

Submission status: Wrong Answer

Solution code:

# coding: utf-8

# In[17]:

import sys
input = sys.stdin.readline
S = input()


# In[18]:

#a = "01"
#b = "10"
if len(S)%2==0:
    a = "01"*(len(S)//2)
    b = "10"*(len(S)//2)
else:
    a = "01"*(len(S)//2)+"0"
    b = "10"*(len(S)//2)+"1"
#print(a, b)


# In[19]:

ac = 0
bc = 0
for i in range(len(S)):
    if S[i] != a[i]:
        ac += 1
    if S[i] != b[i]:
        bc += 1
print(min(ac, bc))


# In[ ]:

Submission status: Wrong Answer

Solution code:
s = input()
n = len(s)
count = 0
count2 = 0
for i in range(n):
    if i % 2 == 0:
        x = "0"
    else:
        x = "1"
    if s[i] == x:
        count2 += 1
        #print(i, s[i], x, "OK")
    else:
        count += 1
        #print(i, s[i], x)
print(count,count2)

Submission status: Wrong Answer

Solution code:
s = input()
n = len(s)
count = 0
count2 = 0
for i in range(n):
    if i % 2 == 0:
        x = "0"
    else:
        x = "1"
    if s[i] == x:
        count2 += 1
        print(i, s[i], x, "OK")
    else:
        count += 1
        print(i, s[i], x)
print(count, "回または", count2, "でいけます")

Submission status: Wrong Answer

Solution code:
s = input()
n = len(s)
count = 0
count2 = 0
print(s, len(s))
for i in range(n):
    if i % 2 == 0:
        x = "0"
    else:
        x = "1"
    if s[i] == x:
        count2 += 1
        #print(i, s[i], x, "OK")
    else:
        count += 1
        #print(i, s[i], x)
print(min(count,count2))

Submission status: Wrong Answer

Solution code:
S = input()
n =len(S)
y = int()
c = int()
for i in range(n):
	if i % 2 ==0:
		x = "0"
	else:
		x ="1"
	if S[i] == x:
		c += 1
		print(i, S[i],x,"OK")
	else:
		y += 1
		print(i,S[i],x)

if c < y:
	print(c,"回でいけます")
else:
	print(y,"回でいけます")

Submission status: Wrong Answer

Solution code:
S = input()
ans = 0

for curr, next in list(zip(S, S[1:]))[::2]:
  if curr == '0': ans += 1
  if next == '1': ans += 1

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

Submission status: Wrong Answer

Solution code:
# 整数の入力
a = input()
result = -500000

privious_list = ["0", "1"]
#print(len(a))

if len(a) == 1 or 0:
    print(0)
else:
    for x in privious_list:
        new_result = 0
        privious = x
        for i in a:
            if i == "0":
                if privious == "0":
                    new_result += 1
                    privious = "1"
                else:
                    privious = "0"
            else:
                if privious == "0":
                    privious = "1"
                else:
                    new_result += 1
                    privious = "0"
        print(result, new_result)
        if result == -500000:
            result = new_result
        elif new_result < result:
            result = new_result
    
    print(result)

Submission status: Wrong Answer

Solution code:
# 整数の入力
a = input()
result = 0

privious_list = ["0", "1"]
#print(len(a))

if len(a) == 1 or 0:
    print(0)
else:
    for x in privious_list:
        new_result = 0
        privious = x
        for i in a:
            if i == "0":
                if privious == "0":
                    new_result += 1
                    privious = "1"
                else:
                    privious = "0"
            else:
                if privious == "0":
                    privious = "1"
                else:
                    new_result += 1
                    privious = "0"
        if result == 0:
            result = new_result
        elif new_result < result:
            result = new_result
    
    print(result)

Submission status: Wrong Answer

Solution code:
# 整数の入力
a = input()
result = 0

privious_list = ["0", "1"]
if len(a) == 1:
    print(0)
else:
    for x in privious_list:
        new_result = 0
        privious = x
        for i in a:
            if i == "0":
                if privious == "0":
                    new_result += 1
                    privious = "1"
                else:
                    privious = "0"
            else:
                if privious == "0":
                    privious = "1"
                else:
                    new_result += 1
                    privious = "0"
        if result == 0:
            result = new_result
        elif new_result < result:
            result = new_result
    
    print(result)

Submission status: Wrong Answer

Solution code:
# 整数の入力
a = input()
result = 0

privious_list = ["0", "1"]
if len(a) == 0:
    print(0)
else:
    for x in privious_list:
        new_result = 0
        privious = x
        for i in a:
            if i == "0":
                if privious == "0":
                    new_result += 1
                    privious = "1"
                else:
                    privious = "0"
            else:
                if privious == "0":
                    privious = "1"
                else:
                    new_result += 1
                    privious = "0"
        if result == 0:
            result = new_result
        elif new_result < result:
            result = new_result
    
    print(result)

Submission status: Wrong Answer

Solution code:
S = input()

min(S[::2].count("0")+S[1::2].count("1"), S[::2].count("1")+S[1::2].count("0"))

Submission status: Wrong Answer

Solution code:
S = input()
back = 0
n = 0
for i in S:
    if i == back:
        back = '0' if i=='1' else '1'
        n += 1
    else:
        back = S

print(n);

Submission status: Wrong Answer

Solution code:
a=input()
b=[0,0]
w=[0,0]
for i in range(len(a)//2):
    if a[2*i]=="0":b[0]+=1
    else :w[0]+=1
    if a[2*i+1]=="0":b[1]+=1
    else : w[1]+=1
if len(a)%2==1:
    if a[-1]=="0":b[1]+=1
    else: w[1]+=1
print(min((b[0]+w[1]),(b[1]+w[0])))

Submission status: Wrong Answer

Solution code:
S =input()
l=len(S)

    
apopcount=0
bpopcount=0
for i in range(0,l):
  if i%2==0:
    if int(S[-1*i])==1:
   		apopcount+=1
    else:
      	bpopcount+=1
  else:
    if int(S[-1*i])==1:
    	bpopcount+=1
    else:
      	apopcount+=1
if apopcount<bpopcount:print(apopcount)
else:print(bpopcount)

Submission status: Wrong Answer

Solution code:
S =input()
l=len(S)
N=int(S,2)

    
apopcount=0
bpopcount=0
for i in range(0,l):
  if i%2==0:
    if (N & 0b10**i)!=0:
   		apopcount+=1
    else:
      	bpopcount+=1
  else:
    if (N & 0b10**i)!=0:
    	bpopcount+=1
    else:
      	apopcount+=1
print(apopcount,bpopcount)
if apopcount<bpopcount:print(apopcount)
else:print(bpopcount)

Submission status: Wrong Answer

Solution code:
n = list(map(int, input()))

even_list = list()
odd_list = list()

even_list = n[0::2]
odd_list = n[1::2]

count_zero = 0
count_one = 0

#print(len(even_list))
for i in range(len(even_list)):
    if even_list[i] == 1:
        count_zero += 1
for j in range(len(odd_list)):
    if odd_list[j] == 0:
        count_zero += 1

for n in range(len(even_list)):
    if even_list[n] == 0:
        print(even_list[i])
        count_one += 1
for m in range(len(odd_list)):
    if odd_list[m] == 1:
        count_one += 1

print(min(count_zero, count_one))

Submission status: Wrong Answer

Solution code:
S=list(input())
N=len(S)
print(S)
A=[]
B=[]
for i in range(N):
    A.append(str(i%2))
    B.append(str((i+1)%2))
countA=0
countB=0
for x in range(N):
    if A[x]!=S[x]:
        countA+=1
    else:
        countB+=1

print(A)
print(B)
print(min(countA,countB))

Submission status: Wrong Answer

Solution code:
S=list(input())
N=len(S)

A=[]
B=[]
for i in range(N):
    A.append(str(i%2))
    B.append(str((i+1)%2))
countA=0
countB=0
for x in range(N):
    if A[x]!=S[x]:
        countA+=1
    else:
        countB+=1
print(max(countA,countB))

Submission status: Wrong Answer

Solution code:
s = list(input())
slen = len(s)

count_0 = 0
count_1 = 0

#0-start

for i in s[0::2]:
	if i != '0':
		count_0 += 1
for i in s[1::2]:
	if i != '1':
		count_0 += 1

for i in s[0::2]:
	if i != '1':
		count_1 += 1
for i in s[1::2]:
	if i != '0':
		count_1 += 1

print("count_0:{}".format(count_0))
print("count_1:{}".format(count_1))

if count_1 > count_0:
	print(count_0)
else:
	print(count_1)

Submission status: Wrong Answer

Solution code:
List=input()
s = len(List)
a = [0] * s
b = [0] * s
b[1::2] = [1] * (s//2)
if s % 2 == 0:
	a[0::2] = [1] * (s//2)
else:
	a[0::2] = [1] * (s//2 + 1)

c1 = 0
c2 = 0

for (i,j) in zip(List,a):
	if i != j:
		c1 += 1

for (i,j) in zip(List,b):
	if i != j:
		c2 += 1

if c1 >= c2:
	print(c2)
else:
    print(c1)

Submission status: Wrong Answer

Solution code:
s = input()
ans = s[0]

for i in range(1, len(s)):
    if ans[len(ans)-1] == s[i]:
        if s[i] == "0":
            ans += "1"
        else:
            ans += "0"
    else:
        ans += s[i]
print(ans)

Submission status: Wrong Answer

Solution code:
s = list(map(int, input().split()))
t = s.copy()
x = 0
y = 1

if t[0] == 0:
    t[0]=1
else:
    t[0]=0

Submission status: Wrong Answer

Solution code:
s = list(map(int, input().split()))
t = s.copy()

Submission status: Wrong Answer

Solution code:
S = list(input().split())
ans1 = 0
ans2 = 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
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))

Submission status: Wrong Answer

Solution code:
S = list(map(int, input().split()))
ans1 = 0
ans2 = 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
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))

Submission status: Wrong Answer

Solution code:
S = list(map(int, input().split()))
ans1 = 0
ans2 = 0
for i in range (len(S)):
  if i % 2 == 0:
    if S[i] == 0:
      ans1 += 1
  else:
    if S[i] == 1:
      ans1 += 1
for i in range(len(S)):
  if i % 2 == 0:
    if S[i] == 1:
      ans2 += 1
  else:
    if S[i] == 0:
      ans2 += 1
print(min(ans1, ans2))

Submission status: Wrong Answer

Solution code:
s = input()
t = len(s)
a = '01'*int(t/2) + '0'*int(t%2)
b = '10'*int(t/2) + '1'*int(t%2)
cta = 0
ctb = 0
for i in range(t):
    if s[i] == a[i]:
        cta += 1
    elif s[i] == b[i]:
        ctb += 1
if cta >= ctb:
    print(cta)
else:
    print(ctb)

Submission status: Wrong Answer

Solution code:
s = str(input())
a = s[::2].count('0') + s[1::2].count('1')
b = s[::2].count('1') + s[1::2].count('0')
print(min(a, b))

Submission status: Wrong Answer

Solution code:
# -*- coding:utf-8 -*-

s = input()
s_list1 = list(s)
s_list2 = list(s)
count1 = 0
count2 = 0

# 最初塗り替えない
pre = int(s_list1.pop(0))
for i in range(len(s_list1)-1):
    if pre == int(s_list1.pop(0)):
        pre = 1 - pre
        count1 += 1
    else:
        pre = 1 - pre
# 最初塗り替える
pre = 1 - int(s_list2.pop(0))
count2 += 1
for i in range(len(s_list2)-1):
    if pre == int(s_list2.pop(0)):
        pre = 1 - pre
        count2 += 1
    else:
        pre = 1 - pre
# 少ないほうを出力
if count1 <= count2:
    print(count1)
else:
    print(count2)

Submission status: Wrong Answer

Solution code:
s = input()
n = len(s)
white_start = 0
black_start = 0
for i in range(n):
    if s[i] == '0' and i%2 == 0:
        black_start += 1
    else:
        white_start += 1
print(min(black_start,white_start))

Submission status: Wrong Answer

Solution code:
s = list(input())
tile = [int(i) for i in s]
total =sum(tile)
ideal = int(len(tile)/2)
if total-ideal<0:
  print(ideal-total)
elif total-ideal >0:
  print(total-ideal)
else:
  print(0)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
*s, = map(int,input())
print(s)

# 初期値は大きい値
ans = len(s)

# iは最初に使う色（0 or 1）
for i in range(2):
    # 変える必要があるタイル数
    cnt = 0

    for j in range(len(s)):
        if (j % 2 == 0) ^ (s[j] == i):
            cnt = cnt +1
    ans = min(ans, cnt)

print(ans)

Submission status: Wrong Answer

Solution code:
S = input();

S_slice =S[0:2];
change =0;
if S_slice =="000"or S_slice =="111" or S_slice =="110" or S_slice =="001":
    change +=1;

S_list = list(S);

for i in range(len(S_list)-3):
    if S_list[i+2] == S_list[i+3]:
        S_list[i+3] = str(1-int(S_list[i+2]));
        change +=1;

print(change);

Submission status: Wrong Answer

Solution code:

s = input()

firstTile = s[0]
lastTile = s[-1]

def isOneColor():
    t = None
    for c in s:
        if t is None:
            t = c
        else:
            if c is not t:
                return False
    return True

def reverse(tile):
    if tile is "0":
        return "1"
    else:
        return "0"

def shouldZeroStart():
    z = 0
    o = 0
    prevTile = "0"
    for tile in s[1:]:
        if tile is reverse(prevTile):
            z = z + 1
            prevTile = reverse(prevTile)
        else:
            prevTile = prevTile
    prevTile = "1"
    for tile in s[1:]:
        if tile is reverse(prevTile):
            o = o + 1
            prevTile = reverse(prevTile)
        else:
            prevTile = prevTile
    if z < o:
        return False
    else:
        return True

result = 0
currentTile = "1"
if isOneColor():
    if firstTile is "0":
        currentTile = "0"
else:
    if shouldZeroStart():
        currentTile = "0"
for i in range(len(s)):
    if s[i] is not currentTile:
        result = result + 1
    currentTile = reverse(currentTile)



print(result)

Submission status: Wrong Answer

Solution code:
A=list(input())
print(min(A[::2].count("0"),A[::2].count("1"))+min(A[1::2].count("0"),A[1::2].count("1")))

Submission status: Wrong Answer

Solution code:
s = input()

firstTile = s[0]

def reverse(tile):
    if tile is "0":
        return "1"
    else:
        return "0"


result = 0
prevTile = firstTile
for tile in s[1:-1]:
    if tile is not reverse(prevTile):
        result = result + 1
        prevTile = reverse(prevTile)
    else:
        prevTile = prevTile
print(result)

Submission status: Wrong Answer

Solution code:
n = list(input())
n_size = len(n)
count = 0
#print(n_size)  
new_list = []
new_list.append(int(n[0]))
for i in range(n_size-1):
  if new_list[i] == 0:
    new_list.append(1)
  else:
    new_list.append(0)

#print(new_list)
    
for i in range(n_size):
  if (int(n[i]) != int(new_list[i])):
    count+=1

print(new_list)    
if n_size == 1:
  print(0)
else:
#  ans = n_size-count    
  print(count)

Submission status: Wrong Answer

Solution code:
#import numpy as np

n = list(input())
n_size = len(n)
count = 0
#print(n_size)  
new_list = []
new_list.append(int(n[0]))
for i in range(n_size-1):
  if new_list[i] == 0:
    new_list.append(1)
  else:
    new_list.append(0)

#print(new_list)
    
for i in range(n_size):
  if (int(n[i]) != int(new_list[i])):
    count+=1

print(new_list)    
if n_size == 1:
  print(0)
else:
#  ans = n_size-count    
  print(count)

Submission status: Wrong Answer

Solution code:
l =[int(i) for i in list(str(input()))]
ans = 0
num =0
n = 0

if l[0] == 1:
    l=[abs(i-1) for i in l]
print(l)

for i in l:
    if num%2 ==0:
        if i == 1:
            ans = ans +1
    else:
        if i == 0:
            ans =ans +1
    num = num +1
print(ans)

Submission status: Wrong Answer

Solution code:

#input S
S=input()

count=0
l=len(S)

for i in range(1,len(S)):
    iS=int(S[i])
    if S[i]==S[i-1]:
        if S[i]=='0':
            S=S[:i-1]+'1'+S[i:]
        else:
            S=S[:i-1]+'0'+S[i:]
        count=count+1

print(count)

Submission status: Wrong Answer

Solution code:
n = list(map(int,list(input())))
print(n)

num = n[0]
total = 0
for i in range(1,len(n)):
    if n[i] == n[i-1]:
        total += 1
        if n[i] == 1:
            n[i] = 0
        else:
            n[i] = 1

print(total)

Submission status: Wrong Answer

Solution code:
import math
import os
import random
import re
import sys
from collections import defaultdict

# sys.stdin = open('input.in', 'r')
# sys.stdout = open('output.out', 'w') 

def flip(a):
	if a == 0:
		return 1
	else:
		return 0

def count(n):
	count = 0
	if len(n) == 0:
		return 0
	prev = n[0]
	for i in n[1:]:
		if n[i] == prev:
			n[i] = flip(n[i])
			count += 1
		prev = n[i]

	return count-1

if __name__ == '__main__':
	N = [int(d) for d in input()]
	print(count(N))

Submission status: Wrong Answer

Solution code:
#import numpy as np

n = list(input())
n_size = len(n)
count = 0
#print(n_size)  
new_list = []
new_list.append(int(n[0]))
for i in range(n_size-1):
  if new_list[i] == 0:
    new_list.append(1)
  else:
    new_list.append(0)

#print(new_list)
    
for i in range(n_size-1):
  if (int(n[i]) == new_list[i]):
    count+=1

if n_size == 1:
  print(0)
else:
  ans = n_size-count    
  print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

n = list(input())
n_size = len(n)
count = 0
#print(n_size)  
new_list = []
new_list.append(int(n[0]))
for i in range(n_size-1):
  if new_list[i] == 0:
    new_list.append(1)
  else:
    new_list.append(0)

#print(new_list)
    
for i in range(n_size-1):
#  print(i)
  if int(n[i]) == new_list[i]:
    count+=1

ans = n_size-count    
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
li = []
for s in S:
    li.append(int(s))

count = 0
first = li[0]
for i in range(len(li)):
    if i % 2 == 0:
        if li[i] != first:
            count += 1
    else:
        if li[i] == first:
            count += 1

count2 = 1
for i in range(len(li)):
    if i % 2 == 0:
        if li[i] == first:
            count2 += 1
    else:
        if li[i] != first:
            count += 1

print(min(count,count2))

Submission status: Wrong Answer

Solution code:
tiles = str(input())
filters = { "01": 0, "10":  0 }
for filter in filters.keys():
    if len(tiles) % 2 == 1:
        tiles = tiles + filter[1:]
    for div in [tiles[x : x + 2] for x in range(0, len(tiles) - 2, 2)]:
        for f, d in zip([x for x in filter], [d for d in div]):
            if f != d:
                filters[filter] += 1
print(min(filters.values()))

Submission status: Wrong Answer

Solution code:
import copy


def count_num_flip(S):
    num_flip = 0
    S_prev = S[0]
    for S_next in S[1:]:
        if S_prev == S_next:
            num_flip += 1
            S_prev = not S_next
    return num_flip


if __name__ == '__main__':
    S = [bool(int(x)) for x in input()]
    S_prime = copy.copy(S)
    S_prime[0] = not S_prime[0]
    print(min(count_num_flip(S), count_num_flip(S_prime) + 1))

Submission status: Wrong Answer

Solution code:
S = str(input())
N = len(S)
ans = 0

for i in range(N-1):
    if int(S[i]) == 0 and int(S[i+1]) == 0:
        ans += 1
        S.replace(str(0),str(1))
    elif int(S[i]) == 1 and int(S[i+1]) == 1:
        ans += 1
        S.replace(str(1),str(0))
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
digit = len(s)
bi_num =int(s,2) 
zeroone = 0
for i in range(1,digit,2):
	zeroone +=  2**i
bi_zeroone = format(zeroone, 'b')

zo_digit = len(bi_zeroone)
if zo_digit != digit:
	bi_zeroone += "1"

bi_oz = "0"+bi_zeroone[:-1]

print(min(bin(int(s,2)^ int(bi_zeroone,2)).count("1"),bin(int(s,2)^ int(bi_oz,2)).count("1")))

Submission status: Wrong Answer

Solution code:
n = str(input())
n_arr = list(str(n))
arr = list(map(int, n_arr))
print(arr)
zero = []
one = []
for i in range(len(arr)):
    if i % 2 == 0:
        zero.append(0)
        one.append(1)
    else:
        zero.append(1)
        one.append(0)
zero_diff = 0
one_diff = 0
for i in range(len(arr)):
    if arr[i] != zero[i]:
        zero_diff += 1
for i in range(len(arr)):
    if arr[i] != one[i]:
        one_diff += 1
print(min([one_diff,zero_diff]))

Submission status: Wrong Answer

Solution code:
s = input()

lgh = len(s)
counter = int(s[lgh-1])

s = int(s,2)

result = 0

for i in range(lgh):
    result = result + ((s&1) ^ counter)
    s = s >> 1
    counter = 1 - counter

print(result)

Submission status: Wrong Answer

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

A1 = '0'
A2 = '1'
for i in range(1, N):
  if i // 2 == 1:
    A1 = A1 + '0'
    A2 = A2 + '1'
  else:
    A1 = A1 + '1'
    A2 = A2 + '0'
S = int(S, 2)
A1 = int(A1, 2)
A2 = int(A2, 2)
n1 = S ^ A1
n2 = S ^ A2
print(min(n1, n2))

Submission status: Wrong Answer

Solution code:
S = input()
N = len(S)
A1 = '0'
A2 = '1'
for i in range(1, N):
  if i // 2 == 1:
    A1 = A1 + '0'
    A2 = A2 + '1'
  else:
    A1 = A1 + '1'
    A2 = A2 + '0'
n1 = sum(s1 != s2 for s1, s2 in zip(S, A1))
n2 = sum(s1 != s2 for s1, s2 in zip(S, A2))
print(min(n1, n2))

Submission status: Wrong Answer

Solution code:
S = str(input())
li = list(S)

i=0
c=0
count=0

while len(li) > i :
    if int(li[i]) == c :
        count = count + 1
    c = c + 1
    c = c % 2
    i = i + 1
    
if (len(li) + 1)/ 2  >= count : 
    ans = len(li) - count
else :
    ans = count

print(ans)

Submission status: Wrong Answer

Solution code:
S = str(input())
li = list(S)

i=0
c=0
count=0

while len(li) > i :
    if int(li[i]) == c :
        count = count + 1
    c = c + 1
    c = c % 2
    i = i + 1
    
if len(li) / 2 + 1 > count : 
    ans = len(li) - count
else :
    ans = count

print(ans)

Submission status: Wrong Answer

Solution code:
a = input()

N = len(a)
S = int(a)

n = S % int(9)

c_01 = 0
c_10 = 0

for i in range(0, int(N / 2)):
  idx = i * 2
  if a[idx] == '0' and a[idx+1] == '1':
    c_01 += 1
  elif a[idx] == '1' and a[idx+1] == '0':
    c_10 += 1

c = max(c_01, c_10)
nc = int(N / 2) - c

print(nc)

Submission status: Wrong Answer

Solution code:
a = input()

N = len(a)
S = int(a)

n = S % int(9)

c_01 = 0
c_10 = 0

for i in range(0, int(N / 2)):
  idx = i * 2
  if a[idx] == '0' and a[idx+1] == '1':
    c_01 += 1
  elif a[idx] == '1' and a[idx+1] == '0':
    c_10 += 1

c = min(c_01, c_10)
nc = int(N / 2) - c

print(nc)

Submission status: Wrong Answer

Solution code:
a = input()
N = len(a)
S = int(a)
n = S % int(9)

c_01 = 0
c_10 = 0

for i in range(0, int(N / 2)):
  idx = i * 2
  if a[idx] == '0' and a[idx+1] == '1':
    c_01 += 1
  elif a[idx] == '1' and a[idx+1] == '0':
    c_10 += 1

c = max(c_01, c_10)
nc = int(N / 2 + 0.5) - c

print(nc)

Submission status: Wrong Answer

Solution code:
s = input()
a = 0
b = 0
for index, i in enumerate(s):
  if int(i) == index%2:
    a+=1
  else:
    b+=1

Submission status: Wrong Answer

Solution code:
s = str(input())

print(s)

cnt = 0
new = s[0]
for idx in range(len(s[1:])):
    idx += 1
    if new[idx-1]==s[idx]:
        if s[idx] == '0':
            new+='1'
        else:
            new+='0'
        cnt += 1
    else:
        new+=s[idx]
print(cnt)