ZhenlongDai/ACPR huggingface dataset:
Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
  S=input()
  char = list(S)
  char2= list(S)
  num =len(char)
  count=0
  
  if num ==1:
    print(0)
  
  elif num>1:
    for i in range(0,num-1,2):
      if(char[i]=='0'):
        char[i]='1'
        count=count+1
    for j in range(1,num-1,2):
      if(char[j]=='1'):
        char[j]='0'
        count=count+1
    count_even=count
  
    count=0
    for i in range(0,num-1,2):
      if(char2[i]=='1'):
        char2[i]='0'
        count=count+1
    for j in range(1,num-1,2):
      if(char2[j]=='0'):
        char2[j]='1'
        count=count+1
    count_odd=count
    print(min(count_even,count_odd))
  
main()

Failing test case input:
10100111

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
def main():
  S=input()
  char = list(S)
  char2= list(S)
  num =len(list(S))
  count=0
  
  
  if num ==1:
    print(0)
  
  else:
    for i in range(0,num,2):
      if(char[i]=='0'):
        char[i]='1'
        count=count+1
    for j in range(1,num,2):
      if(char[j]=='1'):
        char[j]='0'
        count=count+1
    count_even=count
  
    count=0
    for i in range(0,num,2):
      if(char2[i]=='1'):
        char2[i]='0'
        count=count+1
    for j in range(1,num,2):
      if(char2[j]=='0'):
        char2[j]='1'
        count=count+1
    count_odd=count

    print(min(count_even,count_odd))
  
main()

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
str = input()
S = list(str)
N = len(S)
count = 0
for x in range(N):
    if x % 2 == 0 and S[x] == "0":
        count += 1
    elif x % 2 == 1 and S[x] == "1":
        count += 1
if count >= 50000:
    print(count - 50000)
else:
    print(count)



Failing test case input:
00110101

Expected output:
2


Actual output:
6


Fixed submission (verdict: Accepted):
str = input()
S = list(str)
N = len(S)
count = 0
for x in range(N):
    if x % 2 == 0 and S[x] == "0":
        count += 1
    elif x % 2 == 1 and S[x] == "1":
        count += 1
if count > N / 2:
    print(N - count)
else:
    print(count)

Problem: p03073
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
S=[input().split()]
N=len(S)
ans1=0
ans2=0
for i in range(N): 
    if i%2==0 and S[i]!=1:
        ans1+=1
    if i%2==1 and S[i]!=0:
        ans1+=1
for i in range(N): 
    if i%2==0 and S[i]!=0:
        ans2+=1
    if i%2==1 and S[i]!=1:
        ans2+=1
print(min(ans1,ans2))

Failing test case input:
00011110

Expected output:
4


Actual output:
1


Fixed submission (verdict: Accepted):
S=list(input())
N=len(S)
ans1=0
ans2=0
for i in range(N): 
    if i%2==0 and S[i]!='1':
        ans1+=1
    if i%2==1 and S[i]!='0':
        ans1+=1
for i in range(N): 
    if i%2==0 and S[i]!='0':
        ans2+=1
    if i%2==1 and S[i]!='1':
        ans2+=1
print(min(ans1,ans2))
Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(input())
count = 0
n = len(s)
if n % 2 == 0:
    for i in range(0,int(n/2)):
        if s[(2*i)+1] == "0":
            count = count + 1
            print(i)
    for j in range(0,int(n/2)):
        if s[2*j] == "1":
            count = count + 1
            print(j)
else:
    for i in range(0,int((n-1)/2)+1):
        if s[2*i] == "0":
            count = count + 1
    for j in range(0,int(((n-1)/2))):
        if s[2*j + 1] == "1":
            count = count + 1
count2 = n - count
print(min(count,count2))

Failing test case input:
00110000

Expected output:
4


Actual output:
0
2
3
1
4


Fixed submission (verdict: Accepted):
s = list(input())
count = 0
n = len(s)
if n % 2 == 0:
    for i in range(0,int(n/2)):
        if s[(2*i)+1] == "0":
            count = count + 1
    for j in range(0,int(n/2)):
        if s[2*j] == "1":
            count = count + 1
else:
    for i in range(0,int((n-1)/2)+1):
        if s[2*i] == "0":
            count = count + 1
    for j in range(0,int(((n-1)/2))):
        if s[2*j + 1] == "1":
            count = count + 1
count2 = n - count
print(min(count,count2))

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S=[]
for char in input():
  S.append(char)


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


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

if C1>=C2:
  print(C1)
else:
  print(C2)
  
    
    
      

Failing test case input:
01110010

Expected output:
4


Actual output:
0


Fixed submission (verdict: Accepted):
S=[]
for char in input():
  S.append(char)

C1=0
for i in range(len(S)):
  if i%2==0:
    if S[i]=='1':
      C1+=1
  else:
    if S[i]=='0':
      C1+=1


C2=0
for n in range(len(S)):
  if n%2==0:
    if S[n]=='0':
      C2+=1
  else:
    if S[n]=='1':
      C2+=1

if C2>=C1:
  print(C1)
else:
  print(C2)

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
T = []
tmp = '1'
for i in range(len(S)-1):
    if tmp[-1] == '0':
        tmp += '1'
    else:
        tmp += '0'
T.append(tmp)
tmp = '0'
for i in range(len(S)-1):
    if tmp[-1] == '0':
        tmp += '1'
    else:
        tmp += '0'
T.append(tmp)
print(T)
ans = float('inf')
for j in range(2):
    cnt = 0
    for i in range(len(S)):
        if S[i] != T[j][i]:
            cnt += 1
    if cnt < ans:
        ans = cnt
print(ans)


Failing test case input:
00111001

Expected output:
4


Actual output:
['10101010', '01010101']
4


Fixed submission (verdict: Accepted):
S = input()
T = []
tmp = '1'
for i in range(len(S)-1):
    if tmp[-1] == '0':
        tmp += '1'
    else:
        tmp += '0'
T.append(tmp)
tmp = '0'
for i in range(len(S)-1):
    if tmp[-1] == '0':
        tmp += '1'
    else:
        tmp += '0'
T.append(tmp)
ans = float('inf')
for j in range(2):
    cnt = 0
    for i in range(len(S)):
        if S[i] != T[j][i]:
            cnt += 1
    if cnt < ans:
        ans = cnt
print(ans)
Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = str(input())
ans1=0
for i in range(len(s)):
  if(i%2==0 and s[i]!=0):ans1+=1
  if(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
  if(i%2==1 and s[i]!=0):ans2+=1
ans=min(ans1,ans2)
print(ans)

Failing test case input:
01110110

Expected output:
3


Actual output:
8


Fixed submission (verdict: Accepted):
s = str(input())
ans1=0
for i in range(len(s)):
  if(i%2==0 and s[i]!='0'):ans1+=1
  if(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
  if(i%2==1 and s[i]!='0'):ans2+=1
ans=min(ans1,ans2)
print(ans)

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(input())
pattern_a_count = 0
pattern_b_count = 0

for index, value in enumerate(s):
  if index % 2 == 0:
    if value == 0:
      pattern_a_count += 1
  if index % 2 == 1:
    if value == 1:
      pattern_a_count += 1
      
for index, value in enumerate(s):
  if index % 2 == 0:
    if value == 1:
      pattern_b_count += 1
  if index % 2 == 1:
    if value == 0:
      pattern_b_count += 1
      
res = pattern_b_count
if pattern_a_count <= pattern_b_count:
  res = pattern_a_count
print(pattern_a_count)

Failing test case input:
10100110

Expected output:
2


Actual output:
0


Fixed submission (verdict: Accepted):
s = list(input())
pattern_a_count = 0
pattern_b_count = 0


for index, value in enumerate(s):
  if index % 2 == 0:
    if value == "0":
      pattern_a_count += 1
  if index % 2 == 1:
    if value == "1":
      pattern_a_count += 1


for index, value in enumerate(s):
  if index % 2 == 0:
    if value == "1":
      pattern_b_count += 1
  if index % 2 == 1:
    if value == "0":
      pattern_b_count += 1
      
res = pattern_b_count
if pattern_a_count <= pattern_b_count:
  res = pattern_a_count
print(res)

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = input()
n = len(a)
if n == 1:
    print(0)
else:
    count0 = 0    
    count1 = 0    
    for i in range(n):
        if i % 2 == 0:
            if a[i] ==1:
                count0 = count0 +1
            if a[i] ==0:
                count1 = count1 +1
        if i % 2 == 1:
            if a[i] ==1:
                count1 = count1 +1
            if a[i] ==0:
                count0 = count0 +1

    print(max(count0, count1))
    print(n, a[2]) 


Failing test case input:
01110111

Expected output:
2


Actual output:
0
8 1


Fixed submission (verdict: Accepted):
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))
Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S=list(input())
count_0 = 0
count_1 = 0


for (i,item) in enumerate(S):
    if i%2 != 0 and item=="0":
        count_1 +=1


    elif i%2==0 and item==1:
        count_1 +=1


for (i,item) in enumerate(S):
    if i%2 != 0 and item =="1" :
        count_0 +=1

    elif i%2==0 and item=="0":
        count_0 +=1

print(min(count_0,count_1))

Failing test case input:
10000111

Expected output:
4


Actual output:
2


Fixed submission (verdict: Accepted):
S=list(input())
count_0 = 0
count_1 = 0


for (i,item) in enumerate(S):
    if i%2 != 0 and item=="0":
        count_1 +=1


    elif i%2==0 and item=="1":
        count_1 +=1


for (i,item) in enumerate(S):
    if i%2 != 0 and item =="1" :
        count_0 +=1

    elif i%2==0 and item=="0":
        count_0 +=1

print(min(count_0,count_1))

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = list(input())
n_size = len(n)
count = 0

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)


    
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:

  print(count)   

Failing test case input:
00110111

Expected output:
3


Actual output:
[0, 1, 0, 1, 0, 1, 0, 1]
3


Fixed submission (verdict: Accepted):


n = list(input())
n_size = len(n)
count = 0

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)


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


if n_size == 1:
  print(0)
else:

  print(count)

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin
from collections import Counter
s = list(stdin.readline().rstrip())
odd = Counter(s[0::2])
even = Counter(s[1::2])
if odd['1'] > even['1']:
    print(odd['0']+even['1'])
elif odd['1'] < even['1']:
    print(odd['1']+even['0'])
else:
    if odd['0'] > even['0']:
        print(odd['1']+even['0'])
    elif odd['0'] < even['0']:
        print(odd['0']+even['1'])
    else:
        print(odd['1']+even['1'])

Failing test case input:
10110111

Expected output:
4


Actual output:
6


Fixed submission (verdict: Accepted):
from sys import stdin
from collections import Counter
s = list(stdin.readline().rstrip())
odd = Counter(s[0::2])
even = Counter(s[1::2])
if odd['1'] > even['1']:
    print(odd['0']+even['1'])
elif odd['1'] < even['1']:
    print(odd['1']+even['0'])
else:
    if odd['0'] > even['0']:
        print(odd['1']+even['0'])
    elif odd['0'] < even['0']:
        print(odd['0']+even['1'])
    else:
        print(len(s)
Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=list(input())
bw=0 
for i in range(len(s)):
	if (i%2==0 and s[i]==1) or (i%2==1 and s[i]==0):
		bw+=1
wb=0
for i in range(len(s)):
	if (i%2==0 and s[i]==0) or (i%2==1 and s[i]==1):
		wb+=1
print(min(bw,wb))

Failing test case input:
01110010

Expected output:
4


Actual output:
0


Fixed submission (verdict: Accepted):
s=list(map(int,input()))
bw=0 
for i in range(len(s)):
	if (i%2==0 and s[i]==1) or (i%2==1 and s[i]==0):
		bw+=1
wb=0
for i in range(len(s)):
	if (i%2==0 and s[i]==0) or (i%2==1 and s[i]==1):
		wb+=1
print(min(bw,wb))

Problem: p03073
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s=input()
print(min(s[::2].count("1")+s[1::2].count("0"),s[::2].count("0")+s[::1].count("0")))

Failing test case input:
11110110

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
s=input()
print(min(s[::2].count("1")+s[1::2].count("0"),s[::2].count("0")+s[1::2].count("1")))

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = list(map(int, input()))
length = len(S)

dp = {}

for i in range(length):
  for j in range(2):
    if i == 0:
      dp[(i,j)] = 0 if S[0] == j else 1
      continue

    
    inverse = 0 if j == 1 else 1

    if S[i] == j:
      dp[(i, j)] = dp[(i-1, inverse)]
    else:
      dp[(i, j)] = dp[(i-1, S[i])] + 1





print(dp[(length-1, S[-1])])


Failing test case input:
00010110

Expected output:
3


Actual output:
5


Fixed submission (verdict: Accepted):
S = list(map(int, input()))
length = len(S)

dp = {}

for i in range(length):
  for j in range(2):
    if i == 0:
      dp[(i,j)] = 0 if S[0] == j else 1
      continue

    
    inverse = 0 if S[i] == 1 else 1

    if S[i] == j: 
      dp[(i, j)] = dp[(i-1, inverse)]
    else: 
      dp[(i, j)] = dp[(i-1, S[i])] + 1





print(min(dp[(length-1, 0)], dp[(length-1, 1)]))

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):



s = input()

ans1 = ans2 = 0
for i,c in enumerate(s):
    if str(i&2) == c:
        ans1 += 1
    else:
        ans2 += 1

print(min(ans1,ans2))




Failing test case input:
01110001

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):



s = input()

ans1 = ans2 = 0
for i,c in enumerate(s):
    if str(i&1) == c:
        ans1 += 1
    else:
        ans2 += 1

print(min(ans1,ans2))

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=list(input())

counter=0

pre = N.pop(0)
for n in N:
    print(pre,end=" ")
    if(pre == n):
        counter+=1
    if(pre == "0"):
        pre="1"
    else:
        pre="0"

print(pre)
print(counter)


Failing test case input:
10100110

Expected output:
2


Actual output:
1 0 1 0 1 0 1 0
2


Fixed submission (verdict: Accepted):
N=list(input())

counter=0

pre = N.pop(0)
for n in N:
    if(pre == n):
        counter+=1
    if(pre == "0"):
        pre="1"
    else:
        pre="0"

print(counter)
Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
str = input()
cnt = 0
num = 0
for i in str:
    if cnt % 2 == 0:
        if i == '0':
            num += 1
    else:
        if i == '1':
            num += 1
    cnt += 1
cnt2 = 0
num2 = 0
for i in str:
    if cnt2 % 2 == 0:
        if i == '1':
            num2 += 1
    else:
        if i == '0':
            num2 += 1
    cnt2 += 1
print(min(cnt,cnt2))


Failing test case input:
00011000

Expected output:
4


Actual output:
8


Fixed submission (verdict: Accepted):
str = input()
cnt = 0
num = 0
for i in str:
    if cnt % 2 == 0:
        if i == '0':
            num += 1
    else:
        if i == '1':
            num += 1
    cnt += 1

cnt2 = 0
num2 = 0
for i in str:
    if cnt2 % 2 == 0:
        if i == '1':
            num2 += 1
    else:
        if i == '0':
            num2 += 1
    cnt2 += 1

print(min(num,num2))

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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))

Failing test case input:
01111110

Expected output:
4


Actual output:
01111110
['0', '1', '0', '1', '0', '1', '0', '1'] ['1', '0', '1', '0', '1', '0', '1', '0']
4


Fixed submission (verdict: Accepted):
color = input().rstrip("\n")

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

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

print(min(s1, s2))

Problem: p03073
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
cnt=0
cnt_2=0
s = str(input())
for i in range(len(s)):
    if s[i]=='0' and i%2==0:
        cnt+=1
    else:
        cnt_2+=1
    if s[i]=='1' and i%2!=0:
        cnt+=1
    else:
        cnt_2+=1
print(min(cnt,cnt_2))

Failing test case input:
01000101

Expected output:
1


Actual output:
7


Fixed submission (verdict: Accepted):
cnt=0
cnt_2=0
s = str(input())
for i in range(len(s)):
    if s[i]=='0' and i%2==0:
        cnt+=1
    if s[i]=='1' and i%2==0:
        cnt_2+=1
    if s[i]=='1' and i%2!=0:
        cnt+=1
    if s[i]=='0' and i%2!=0:
        cnt_2+=1
print(min(cnt,cnt_2))

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
d = int(S[0])
T = []
U = []
for i in range(len(S)):
  T.append(d)
  d = (d + 1) % 2
  U.append(d)
count1 = 0
count2 = 0
for i in range(len(S)):
  if S[i] != T[i]:
    count1 += 1
  if S[i] != U[i]:
    count2 += 1
print(min(count1, count2))

  

Failing test case input:
01000101

Expected output:
1


Actual output:
8


Fixed submission (verdict: Accepted):
S = input()
d = int(S[0])
T = []
U = []
for i in range(len(S)):
  T.append(d)
  d = (d + 1) % 2
  U.append(d)
count1 = 0
count2 = 0
for i in range(len(S)):
  if int(S[i]) != T[i]:
    count1 += 1
  if int(S[i]) != U[i]:
    count2 += 1
print(min(count1, count2))
Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()

cnt1=0
start=S[0]
for i in range(len(S)):
    if i%2!=0:
        if S[i]==start:
            cnt1+=1
    else:
        if S[i]==start:
            cnt1+=1
cnt2=0
start=S[-1]
for i in range(len(S)):
    if i%2==0:
        if S[i-1]!=start:
            cnt2+=1
    else:
        if S[i-1]==start:
            cnt2+=1
if cnt1 < cnt2:
    print(cnt1)
else:
    print(cnt2)


Failing test case input:
10110011

Expected output:
3


Actual output:
5


Fixed submission (verdict: Accepted):
S = input()

cnt1=0
start="1"
for i in range(len(S)):
    if i%2==0:
        if S[i]!=start:
            cnt1+=1
    else:
        if S[i]==start:
            cnt1+=1
cnt2=0
start="0"
for i in range(len(S)):
    if i%2==0:
        if S[i]!=start:
            cnt2+=1
    else:
        if S[i]==start:
            cnt2+=1
if cnt1 < cnt2:
    print(cnt1)
else:
    print(cnt2)

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = list(input())

res = 0

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


Failing test case input:
11001010

Expected output:
2


Actual output:
S
S
2


Fixed submission (verdict: Accepted):
S = list(input())

res = 0

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

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(input())
count = 0
n = len(s)
if n % 2 == 0:
    for i in range(0,int((n/2)-1)):
        if s[(2*i)+1] == "0":
            count = count + 1
    for j in range(0,int((n/2)-1)):
        if s[2*j] == "1":
            count = count + 1
else:
    for i in range(0,int((n-1)/2)+1):
        if s[2*i] == "0":
            count = count + 1
    for j in range(0,int(((n-1)/2))):
        if s[2*j + 1] == "1":
            count = count + 1
count2 = n - count
print(min(count,count2))

Failing test case input:
01000111

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
s = list(input())
count = 0
n = len(s)
if n % 2 == 0:
    for i in range(0,int(n/2)):
        if s[(2*i)+1] == "0":
            count = count + 1
    for j in range(0,int(n/2)):
        if s[2*j] == "1":
            count = count + 1
else:
    for i in range(0,int((n-1)/2)+1):
        if s[2*i] == "0":
            count = count + 1
    for j in range(0,int(((n-1)/2))):
        if s[2*j + 1] == "1":
            count = count + 1
count2 = n - count
print(min(count,count2))
Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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
        print(count0)
    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))


Failing test case input:
11100010

Expected output:
2


Actual output:
1
2
5
2


Fixed submission (verdict: Accepted):
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))

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
size = len(s)

def poe(b):
  res = 0
  for i in range(size):
    if b:
      a = '1' if i % 2 == 0 else '0'
    else:
      a = '0' if i % 2 == 0 else '1'
 
    if a != s[i]:
      res+=1

  return res

print (poe(True), poe(False))


Failing test case input:
00010111

Expected output:
2


Actual output:
6 2


Fixed submission (verdict: Accepted):
s = input()
size = len(s)

def poe(b):
  res = 0
  for i in range(size):
    if b:
      a = '1' if i % 2 == 0 else '0'
    else:
      a = '0' if i % 2 == 0 else '1'
 
    if a != s[i]:
      res+=1

  return res

print(min(poe(True), poe(False)))

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = list(map(int, input()))
length = len(S)

dp = {}

for i in range(length):
  for j in range(2):
    if i == 0:
      dp[(i,j)] = 0 if S[0] == j else 1
      continue

    
    inverse = 0 if S[i] == 1 else 1

    if S[i] == j: 
      dp[(i, j)] = dp[(i-1, inverse)]
    else: 
      dp[(i, j)] = dp[(i-1, S[i])] + 1





print(dp[(length-1, S[-1])])


Failing test case input:
10110011

Expected output:
3


Actual output:
5


Fixed submission (verdict: Accepted):
S = list(map(int, input()))
length = len(S)

dp = {}

for i in range(length):
  for j in range(2):
    if i == 0:
      dp[(i,j)] = 0 if S[0] == j else 1
      continue

    
    inverse = 0 if S[i] == 1 else 1

    if S[i] == j: 
      dp[(i, j)] = dp[(i-1, inverse)]
    else: 
      dp[(i, j)] = dp[(i-1, S[i])] + 1





print(min(dp[(length-1, 0)], dp[(length-1, 1)]))

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(map(int,input()))
 
n = len(s)

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

Failing test case input:
01111110

Expected output:
4


Actual output:
5


Fixed submission (verdict: Accepted):
s = list(map(int,input()))

n = len(s)
 
ans_l = 0
for i in range(n-1):
  if s[i] == s[i+1]:
    ans_l += 1
    if s[i] == 0:
      s[i+1] = 1
    else:
      s[i+1] = 0
print(ans_l)
Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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,"回でいけます")



Failing test case input:
01111011

Expected output:
4


Actual output:
0 0 0 OK
1 1 1 OK
2 1 0
3 1 1 OK
4 1 0
5 0 1
6 1 0
7 1 1 OK
4 回でいけます


Fixed submission (verdict: Accepted):
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
		
	else:
		y += 1
		

if c < y:
	print(c)
else:
	print(y)

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter

import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

S = input()[:-1]
N = len(S)
if len(S) == -1:
    C1 = Counter(S[::2])
    C2 = Counter(S[1::2])

    odd = C1['0']+C2['1']
    even = C1['1']+C2['0']
    print(N-max(odd, even))
else:
    print(0)


Failing test case input:
01110110

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
from collections import Counter

import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

S = input()[:-1]
N = len(S)
if len(S) != 1:
    C1 = Counter(S[::2])
    C2 = Counter(S[1::2])

    odd = C1['0']+C2['1']
    even = C1['1']+C2['0']
    print(N-max(odd, even))
else:
    print(0)

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):




def main():
    S = "0b" + input()
    
    
    
    base = "0b"
    for i in range(len(S)-2):
        if i % 2 == 0:
            base += "0"
        else:
            base += "1"
    
    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()

Failing test case input:
00011000

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):




def main():
    S = "0b" + input()
    
    
    
    
    base = "0b"
    for i in range(len(S)-2):
        if i % 2 == 0:
            base += "1"
        else:
            base += "0"
    
    res = int(S, 0) ^ int(base, 0)

    b_format = "{:0" + str(len(S)-2) + "b}"
    bit = b_format.format(res)
    
    bit = list(map(int, list(bit)))
    count = sum(bit)
    
    if count >= len(bit) / 2:
        print(len(bit) - count)
    else:
        print(count)


if __name__ == '__main__':
    main()
Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
11110010

Expected output:
3


Actual output:
5


Fixed submission (verdict: Accepted):
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 < count : 
    ans = len(li) - count
else :
    ans = count

print(ans)

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = list(input())
L = len(S)

def change():
    global moji
    if moji == "1":
        moij = "0"
    else:
        moji = "1"


count_1 = 0
moji = "1"
for c in range(L):
    if moji == S[c]:
        pass
    else:
        count_1 += 1
    change()


count_2 = 0
moji = "0"
for c in range(L):
    if moji == S[c]:
        pass
    else:
        count_2 += 1
    change()

if count_1 < count_2:
    print(count_1)
else:
    print(count_2)

Failing test case input:
01110010

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
S = list(input())
L = len(S)

def change():
    global kk
    if kk == "1":
        kk = "0"
    else:
        kk = "1"


count_1 = 0
kk = "1"
for c in range(L):
    if kk == S[c]:
        pass
    else:
        count_1 += 1
    change()
    


count_2 = 0
kk = "0"
for c in range(L):
    if kk == S[c]:
        pass
    else:
        count_2 += 1
    change()

if count_1 < count_2:
    print(count_1)
else:
    print(count_2)

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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))

Failing test case input:
01110011

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
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))
Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
tiles = input()

even_0 = 0
even_1 = 0
odd_0 = 0
odd_1 = 0

for i, t in enumerate(tiles):
    if i % 2 == 0:
        if t == '0':
            even_0 += 1
        else:
            even_1 += 1
    else:
        if t == '0':
            even_0 += 1
        else:
            even_1 += 1

if even_0 + odd_1 >= even_1 + odd_0:
    print(even_1 + odd_0)
else:
    print(even_0 + odd_1)

Failing test case input:
00100001

Expected output:
4


Actual output:
2


Fixed submission (verdict: Accepted):
tiles = input()

even_0 = 0
even_1 = 0
odd_0 = 0
odd_1 = 0

for i, t in enumerate(tiles):
    if i % 2 == 0:
        if t == '0':
            even_0 += 1
        else:
            even_1 += 1
    else:
        if t == '0':
            odd_0 += 1
        else:
            odd_1 += 1



if even_0 + odd_1 >= even_1 + odd_0:
    print(even_1 + odd_0)
else:
    print(even_0 + odd_1)

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
n = len(S)
i = n-1
B = ["0","1"]
n0,n1,b = 0,0,0
while i:
  if S[i]==B[b] : n0+=1
  else : n1+=1
  b = 1-b
  i -= 1
if n0>n1 : print(n1)
else : print(n0)

Failing test case input:
11110110

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
S = input()
n = len(S)
i = n-1
B = ["0","1"]
n0,n1,b = 0,0,0
while i>=0:
  if S[i]==B[b] : n0+=1
  else : n1+=1
  b = 1-b
  i -= 1
if n0>n1 : print(n1)
else : print(n0)

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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))



Failing test case input:
10001011

Expected output:
2


Actual output:
0


Fixed submission (verdict: Accepted):
S = list(map(int, input()))
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))

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = list(map(int, input().split()))

l = len(S)
c1 = 0 
c2 = 0

for i in range(l):
  if i%2 ==0:
    if S[i] == 0:
      c1 += 1
    else:
      c2 += 1
  else:
    if S[i] == 0:
      c2 += 1
    else:
      c1 += 1
    
print(min(c1,c2))

Failing test case input:
01110000

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
S = list(input())

l = len(S)
c1 = 0 
c2 = 0

for i in range(l):
  if i%2 ==0:
    if S[i] == "0":
      c1 += 1
    else:
      c2 += 1
  else:
    if S[i] == "0":
      c2 += 1
    else:
      c1 += 1
    
print(min(c1,c2))
Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
00111001

Expected output:
4


Actual output:
00111001
4


Fixed submission (verdict: Accepted):
s = str(input())

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)

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S=[]
for char in input():
  S.append(char)


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


C2=0
for n in range(len(S)):
  if i%2==0:
    if S[i]==0:
      S[i]=0
      C2+=1
  else:
    if S[i]==1:
      S[i]=1
      C2+=1

if C1>=C2:
  print(C1)
else:
  print(C2)
  
    
    
      

Failing test case input:
00110000

Expected output:
4


Actual output:
0


Fixed submission (verdict: Accepted):
S=[]
for char in input():
  S.append(char)

C1=0
for i in range(len(S)):
  if i%2==0:
    if S[i]=='1':
      C1+=1
  else:
    if S[i]=='0':
      C1+=1


C2=0
for n in range(len(S)):
  if n%2==0:
    if S[n]=='0':
      C2+=1
  else:
    if S[n]=='1':
      C2+=1

if C2>=C1:
  print(C1)
else:
  print(C2)

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(int(x) for x in input())
n = len(s)
ans = []

count = 0
for i in range(2, n):
  if s[0] == s[1]:
    count += 1
  if i%2 == 0 and s[i] != s[0]:
    count += 1
  elif i%2 == 1 and s[i] == s[0]:
    count += 1
ans.append(count)

count = 1
for i in range(2, n):
  if s[0] != s[1]:
    count += 1
  if i%2 == 0 and s[i] == s[0]:
    count += 1
  elif i%2 == 1 and s[i] != s[0]:
    count += 1
ans.append(count)

if len(s) == 1:
  print(0)
elif len(s) == 2:
  if s[0] == s[1]:
    print(1)
  else:
    print(0)
else:
  print(min(ans))

Failing test case input:
11111110

Expected output:
3


Actual output:
5


Fixed submission (verdict: Accepted):
s = list(int(x) for x in input())
n = len(s)
ans = []

count = 0
if n >= 3:
  if s[0] == s[1]:
    count += 1
for i in range(2, n):
  if i%2 == 0 and s[i] != s[0]:
    count += 1
  elif i%2 == 1 and s[i] == s[0]:
    count += 1
ans.append(count)

count = 1
if n >= 3:
  if s[0] != s[1]:
    count += 1
for i in range(2, n):
  if i%2 == 0 and s[i] == s[0]:
    count += 1
  elif i%2 == 1 and s[i] != s[0]:
    count += 1
ans.append(count)

if n == 1:
  print(0)
elif n == 2:
  if s[0] == s[1]:
    print(1)
  else:
    print(0)
else:
  print(min(ans))
Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()

BW=s[::2]
WB=s[1::2]

x=BW.count("0") + WB.count("1")
y=BW.count("0") + WB.count("1")

print(min(x,y))

Failing test case input:
01100111

Expected output:
3


Actual output:
5


Fixed submission (verdict: Accepted):
s=input()

BW=s[::2]
WB=s[1::2]

x=BW.count("0") + WB.count("1")
y=BW.count("1") + WB.count("0")

print(min(x,y))

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S=list(input())
N=len(S)
S_int=list(S)
for i in range(N):
    S_int[i]=int(S[i])
cnt_1=0
cnt_2=0
if all([S_int[i]!=S_int[i+1] for i in range(N-1)]):
    print(0)
else:
    for i in range(N):
        if i%2==0 and S_int[i]==0:
            S_int[i]=1
            cnt_1+=1
        elif i%2==1 and S_int[i]==1:
            S_int[i]=0
            cnt_1+=1
    for i in range(N):
        if i%2==0 and S_int[i]==1:
            S_int[i]=0
            cnt_2+=1
        elif i%2==1 and S_int[i]==0:
            S_int[i]=1
            cnt_2+=1
    print(min(cnt_1,cnt_2))

Failing test case input:
01110001

Expected output:
2


Actual output:
6


Fixed submission (verdict: Accepted):
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))

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S=int(input())
Sstr=str(S)
s=len(Sstr)
Sk=[]
Sg=[]
for i in range(0,s,2):
    Sk.append(Sstr[i])
for i in range(1,s,2):
    Sg.append(Sstr[i])
Sk0=Sk.count('0')
Sk1=Sk.count('1')
Sg0=Sg.count('0')
Sg1=Sg.count('1')
Stotal=[Sk0,Sk1,Sg0,Sg1]
if max(Stotal)==Sk0 or max(Stotal)==Sg1:
    print(Sk1+Sg0)
else:
    print(Sk0+Sg1)

Failing test case input:
00110111

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
S=str(input())
s=len(S)
Sk=[]
Sg=[]
for i in range(0,s,2):
    Sk.append(S[i])
for i in range(1,s,2):
    Sg.append(S[i])
Sk0=Sk.count('0')
Sk1=Sk.count('1')
Sg0=Sg.count('0')
Sg1=Sg.count('1')
Stotal=[Sk0,Sk1,Sg0,Sg1]
if Sk0+Sg1<Sk1+Sg0:
    print(Sk0+Sg1)
else:
    print(Sk1+Sg0)
Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import copy
s = list(input())
c = copy.copy(s)
n = len(s)
cnt1 = cnt2 = 0
for i in range(n-1):
    if c[i+1]==c[i]:
        cnt1 += 1
        c[i+1] = '0' if c[i+1]=='1' else '1'
s[0] = '0' if s[0]=='1' else '1'
for i in range(1,n):
    if s[i-1]==s[i]:
        cnt2 += 1
        s[i] = '0' if s[i]=='1' else '1'
print(min(cnt1,cnt2))

Failing test case input:
01100011

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
import copy
s = list(input())
c = copy.copy(s)
n = len(s)
cnt1 = cnt2 = 0
for i in range(n-1):
    if c[i+1]==c[i]:
        cnt1 += 1
        c[i+1] = '0' if c[i+1]=='1' else '1'
s[0] = '0' if s[0]=='1' else '1'
cnt2+=1
for i in range(1,n):
    if s[i-1]==s[i]:
        cnt2 += 1
        s[i] = '0' if s[i]=='1' else '1'
print(min(cnt1,cnt2))

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

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)









Failing test case input:
10101010

Expected output:
0


Actual output:
8


Fixed submission (verdict: Accepted):

a = input()
result = -500000

privious_list = ["0", "1"]


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 == -500000:
            result = new_result
        elif new_result < result:
            result = new_result
    
    if result == -500000:
        result = 0
    print(result)
Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main(s):
    pattern1 = ["0" if i % 2 == 0 else "1" for i in range(len(s))]
    pattern2 = ["1" if i % 2 == 0 else "0" for i in range(len(s))]
    dist1 = 0
    dist2 = 0
    for i in range(len(s)):
        if s[i] != pattern1[i]:
            dist1 += 1
        if s[i] != pattern2[i]:
            dist2 += 1

    return min(dist1, dist2)

Failing test case input:
10000111

Expected output:
4


Actual output:

Fixed submission (verdict: Accepted):
def main(s):
    pattern1 = ["0" if i % 2 == 0 else "1" for i in range(len(s))]
    pattern2 = ["1" if i % 2 == 0 else "0" for i in range(len(s))]
    dist1 = 0
    dist2 = 0
    for i in range(len(s)):
        if s[i] != pattern1[i]:
            dist1 += 1
        if s[i] != pattern2[i]:
            dist2 += 1

    return min(dist1, dist2)


s = input()



print(main(s))

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

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)









Failing test case input:
10101010

Expected output:
0


Actual output:
8


Fixed submission (verdict: Accepted):

a = input()
result = -500000

privious_list = ["0", "1"]


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 == -500000:
            result = new_result
        elif new_result < result:
            result = new_result
    
    if result == -500000:
        result = 0
    print(result)
Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = list(str(input()))
if S[0] == "1":
    for i, j in enumerate(S):
        if i % 2 == 0 and j == "0":
            S[i] = "1"
        elif i % 2 == 1 and j == "1":
            S[i] = "0"
else:
    for i, j in enumerate(S):
        if i % 2 == 0 and j == "1":
            S[i] = "0"
        elif i % 2 == 1 and j == "0":
            S[i] = "1"
print(S)

Failing test case input:
10001011

Expected output:
2


Actual output:
1, 0, 1, 0, 1, 0, 1, 0

Fixed submission (verdict: Accepted):
S = list(str(input()))
count = 0
if S[0] == "1":
    for i, j in enumerate(S):
        if i % 2 == 0 and j == "0":
            count += 1
        elif i % 2 == 1 and j == "1":
            count += 1
else:
    for i, j in enumerate(S):
        if i % 2 == 0 and j == "1":
            count += 1
        elif i % 2 == 1 and j == "0":
            count += 1
print(count)

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    result = sub()
    print(result)


def sub():
    maskA = '10' * 10 ** 5
    maskB = '01' * 10 ** 5

    raw = input()
    length = len(raw)
    maskA = maskA[:length]
    maskB = maskB[:length]
    a = int(raw, 2) | int(maskA, 2)
    b = int(raw, 2) | int(maskB, 2)
    tmp = min(bin(a).count("1"), bin(b).count("1"))
    return min(tmp, length - tmp)


if __name__ == '__main__':
    main()


Failing test case input:
01110101

Expected output:
1


Actual output:
3


Fixed submission (verdict: Accepted):
def main():
    result = sub()
    print(result)


def sub():
    maskA = '10' * 10 ** 5
    maskB = '01' * 10 ** 5

    raw = input()
    length = len(raw)

    maskA = maskA[:length]
    maskB = maskB[:length]
    a = int(raw, 2) ^ int(maskA, 2)
    b = int(raw, 2) ^ int(maskB, 2)
    tmp = min(bin(a).count("1"), bin(b).count("1"))
    return min(tmp, length - tmp)


if __name__ == '__main__':
    main()

Problem: p03073
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
sys.setrecursionlimit(500*500)
import itertools
from collections import Counter,deque

def main():
    s = input().rstrip()
    ans = 0
    b = s[0]
    for i in s[1:]:
        i = int(i)
        if b == i:
            ans += 1
            b = 1-i
        else:
            b = i
    print(ans)



if __name__=="__main__":
    main()


Failing test case input:
00100001

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
sys.setrecursionlimit(500*500)
import itertools
from collections import Counter,deque

def main():
    s = input().rstrip()
    l = len(s)
    a = 0
    ans = 0

    t = 1
    for i in s:
        if t != int(i):
            a += 1
        t = 1-t
    ans = a
    t = 0
    a = 0
    for i in s:
        if t != int(i):
            a += 1
        t = 1-t
    ans = min(a,ans)
    print(ans)

if __name__=="__main__":
    main()
Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = list(input())
n = len(S)

s1 = 0
s2 = 0

for i in range(n):
    if i%2 == 0:
        if S[i] == '1':
            s1 += 1
        else:
            s2 += 1
    else:
        if S[i] == '0':
            s2 += 1
        else:
            s1 += 1
print(min(s1, s2))

Failing test case input:
01000101

Expected output:
1


Actual output:
3


Fixed submission (verdict: Accepted):
S = list(input())
n = len(S)

s1 = 0
s2 = 0

for i in range(n):
    if i % 2 == 0 and S[i] == '0':
        s1 += 1
    elif i % 2 == 1 and S[i] == '1':
        s1 += 1

for i in range(n):
    if i % 2 == 0 and S[i] == '1':
        s2 += 1
    elif i % 2 == 1 and S[i] == '0':
        s2 += 1

print(min(s1, s2))

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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]))

Failing test case input:
10010110

Expected output:
4


Actual output:
[1, 0, 0, 1, 0, 1, 1, 0]
4


Fixed submission (verdict: Accepted):
n = str(input())
n_arr = list(str(n))
arr = list(map(int, n_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]))

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


n = list(input())
n_size = len(n)
count = 0

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)


    
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:

  print(count)    
    


Failing test case input:
10111101

Expected output:
4


Actual output:
[1, 0, 1, 0, 1, 0, 1, 0]
4


Fixed submission (verdict: Accepted):


n = list(input())
n_size = len(n)
count = 0

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)


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


if n_size == 1:
  print(0)
else:

  print(count)