ZhenlongDai/ACPR huggingface dataset:
Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


S = str(input())

N = len(S)
count = 0

if S[0] == '0':
    for j in range (1,N):
        if j % 2 == 0 and S[j] == '1 ':
           count += 1
        elif j % 2 == 1 and S[j] == '0':
           count += 1

elif S[0] == '1':
    for j in range (1,N):
        if j % 2 == 0 and S[j] == '0' :
            count += 1
        elif j % 2 == 1 and S[j] == '1':
            count += 1

print(count)

Failing test case input:
01011010

Expected output:
4


Actual output:
2


Fixed submission (verdict: Accepted):


S = str(input())

N = len(S)
count_tmp1 = 0
count_tmp2 = 0


for j in range(0,N):
    if j % 2 == 0 and S[j] == '0':
        count_tmp1 += 1
    elif j % 2 == 1 and S[j] == '1':
        count_tmp1 += 1


for j in range(0,N):
    if j % 2 == 0 and S[j] == '1':
        count_tmp2 += 1
    elif j % 2 == 1 and S[j] == '0':
        count_tmp2 += 1

if count_tmp1 >= count_tmp2:
    print(count_tmp2)

else:
    print(count_tmp1)

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
cnt1 = 0
cnt2 = 0
for i in range(len(s)):
    if i%2 == 0:
        if s[i] == "0":
            cnt1 += 1
        else:
            cnt2 += 1
    else:
        if s[i] == "1":
            cnt2 += 1
        else:
            cnt1 += 1
print(min(cnt1,cnt2))

Failing test case input:
01110100

Expected output:
2


Actual output:
4


Fixed submission (verdict: Accepted):
s = input()
cnt1 = 0
cnt2 = 0
for i in range(len(s)):
    if i%2 == 0:
        if s[i] == "0":
            cnt1 += 1
        else:
            cnt2 += 1
    else:
        if s[i] == "1":
            cnt1 += 1
        else:
            cnt2 += 1
print(min(cnt1,cnt2))

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = input()
x = 0
y = 0
for t in range(0,len(a)):
    if t%2 == 0 and a[t] == "1":
        x = x+1
    if a[t] == "0" and t%2 == 0:
        x = x+1
        
for t in range(0,len(a)):
    if t%2 == 0 and a[t] == "0":
        y = y+1
    if  t%2 == 1 and a[t] == "1":
        y= y+1
        
print (min(y,x))
    
        
        
        
        

Failing test case input:
00011111

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
a = input()
x = 0
y = 0
for t in range(0,len(a)):
    if t%2 == 0 and a[t] == "1":
        x = x+1
    if a[t] == "0" and t%2 == 1:
        x = x+1
        
for t in range(0,len(a)):
    if t%2 == 0 and a[t] == "0":
        y = y+1
    if  t%2 == 1 and a[t] == "1":
        y= y+1
        
print (min(y,x))
Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = list(input())
a=0
b=0
if S[0]=="0":
    for i in S[::2]:
        print(i)
        if i=="1":
            a+=1
    for k in S[1::2]:
        if k=="0":
            a+=1

if S[0]=="1":
    for i in S[::2]:
        if i=="0":
            b+=1
    for k in S[1::2]:
        if k=="1":
            b+=1
print(max(a,b))

Failing test case input:
00011111

Expected output:
3


Actual output:
0
0
1
1
3


Fixed submission (verdict: Accepted):
S = list(input())
a=0
b=0
for i in S[::2]:
    if i=="1":
        a+=1
for k in S[1::2]:
    if k=="0":
        a+=1

for i in S[::2]:
    if i=="0":
        b+=1
for k in S[1::2]:
    if k=="1":
        b+=1
print(min(a,b))

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
p1 = ["1" if i%2==0 else "0" for i in range(len(S))]
p2 = ["0" if i%2==0 else "1" for i in range(len(S))]
print(min(bin(~(int(S,2)&int("".join(p1),2))).count("1"),bin(~(int(S,2)&int("".join(p2),2))).count("1")))

Failing test case input:
10000111

Expected output:
4


Actual output:
2


Fixed submission (verdict: Accepted):
S = input()
p1 = ["1" if i%2==0 else "0" for i in range(len(S))]
p2 = ["0" if i%2==0 else "1" for i in range(len(S))]
print(min(bin((int(S,2)^int("".join(p1),2))).count("1"),bin((int(S,2)^int("".join(p2),2))).count("1")))

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
ans = 0
for i in range(len(S)-1):
    
    if S[i] == S[i+1]:
        if S[i] == '0':
            S = S[:i] + '1' + S[i+1:]
        else:
            S = S[:i] + '0' + S[i+1:]
        ans += 1

print(ans)

Failing test case input:
01100110

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
s = input()
cnt = 0
ans = s[0]
for i in range(1, len(s)):
    if s[i] == ans[-1]:
        if s[i] == '0':
            ans += '1'
        else:
            ans = '0'
        cnt += 1
    else:
        ans += s[i]
print(cnt)

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

aim = 1

for _ in range(int(N/2)):
    aim <<= 2
    aim |= 0b10
if N % 2 == 1 and N != 0:
    aim <<= 1
    aim |= 0b1

S = int(S, 2)
mask = "1" * (N)
mask = int(mask, 2)
aim = aim & mask

differences = bin(S ^ aim)
Num1 = differences.count("1")
Num0 = differences.count("0") - 1

print(min(Num1, Num0))

Failing test case input:
11110110

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
S = str(input())
N = len(S)

aim = 1

for _ in range(int(N/2)):
    aim <<= 2
    aim |= 0b10
if N % 2 == 1 and N != 0:
    aim <<= 1
    aim |= 0b1

S = int(S, 2)
mask = "1" * (N)
mask = int(mask, 2)
aim = aim & mask

differences = bin(S ^ aim)
Num1 = differences.count("1")
Num0 = N - Num1

print(min(Num1, Num0))
Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a=str(input())
odd0,even0=0,0
odd1,even1=0,0
for i in range(len(a)):
  if i%2==0:
    if a[i]=="0":
      odd0+=1
  else:
    if a[i]=="0":
      even0+=1
odd1=int(len(a)/2)+1-odd0
even1=int(len(a)/2)-even0
print(min(odd1+even0,odd0+even1))

Failing test case input:
00011111

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
a=str(input())
odd0,even0=0,0
odd1,even1=0,0
for i in range(len(a)):
  if i%2==0:
    if a[i]=="0":
      odd0+=1
  else:
    if a[i]=="0":
      even0+=1
odd1=len(a)-int(len(a)/2)-odd0
even1=int(len(a)/2)-even0
print(min(odd1+even0,odd0+even1))

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

Failing test case input:
11101110

Expected output:
2


Actual output:
['1', '1', '1', '0', '1', '1', '1', '0']
['0', '1', '0', '1', '0', '1', '0', '1']
['1', '0', '1', '0', '1', '0', '1', '0']
2


Fixed submission (verdict: Accepted):
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(min(countA,countB))

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
l = len(s)
a = 0
for i in range(l):
  if i&1 == 1:
    a <<= 2
    a += 1
print(bin(a))
b = ((2**l)-1) ^ a

S = int(s, 2)
A = bin(S^a).count('1')
B = bin(S^b).count('1')
print(min(A, B))

Failing test case input:
10001010

Expected output:
1


Actual output:
0b1010101
1


Fixed submission (verdict: Accepted):
s = input()
l = len(s)
a = 0
for i in range(l):
  if i&1 == 0:
    a <<= 2
    a += 1
b = ((2**l)-1) ^ a

S = int(s, 2)
A = bin(S^a).count('1')
B = bin(S^b).count('1')
print(min(A, B))

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




def count_repaint_tiles(tiles):
    if len(tiles) == 0:
        return 0
    counts = 0
    color = tiles[0]
    for tile in tiles[1:]:
        counts = counts + 1 if tile != color else counts
        color = 1 - color
    return counts


print(count_repaint_tiles(tiles))


Failing test case input:
11100010

Expected output:
2


Actual output:
5


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




def count_repaint_tiles(tiles):
    if len(tiles) == 0:
        return 0
    counts = 0
    color = tiles[0]
    for tile in tiles[1:]:
        if tile == color:
            counts = counts + 1
        color = 1 - color
    return counts


print(count_repaint_tiles(tiles))
Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(map(int,input()))
print(s)
n = len(s)
count1 = 0
count2 = 0
if n == 1:
    print(0) 
else:
    for i in range(n):
        if i % 2 == 0 and s[i] != 0:
            count1 += 1
        elif i%2 !=0 and s[i] != 1:
            count1 += 1
    for i in range(n):
        if i % 2 == 0 and s[i] != 1:
            count2 += 1
        elif i%2 !=0 and s[i] != 0:
            count2 += 1
    print(min(count1,count2))

Failing test case input:
10001011

Expected output:
2


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


Fixed submission (verdict: Accepted):
s = list(map(int,input()))
n = len(s)
count1 = 0
count2 = 0
if n == 1:
    print(0) 
else:
    for i in range(n):
        if i%2 == 0 and s[i] != 0:
            count1 += 1
        elif i%2 != 0 and s[i] != 1:
            count1 += 1
    for i in range(n):
        if i%2 == 0 and s[i] != 1:
            count2 += 1
        elif i%2 !=0 and s[i] != 0:
            count2 += 1
    print(min(count1,count2))

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

S = list(map(int, list(input()))) 
N = len(S)

T = copy.copy(S)

ans1 = 0
ans2 = 0

for i in range(N-1):
    if S[i] == S[i+1]:
        S[i+1] = 1 ^ S[i+1]
        ans1 += 1
        

T[0] = 1 ^ T[0]
for i in range(N-1):
    if T[i] == T[i+1]:
        T[i+1] = 1 ^ T[i+1]
        ans2 += 1
        

ans = min(ans1, ans2)
print(ans)

Failing test case input:
01011010

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
import copy

S = list(map(int, list(input()))) 
N = len(S)

T = copy.copy(S)

ans1 = 0
ans2 = 0

for i in range(N-1):
    if S[i] == S[i+1]:
        S[i+1] = 1 ^ S[i+1]
        ans1 += 1
        

T[0] = 1 ^ T[0]
ans2 += 1
for i in range(N-1):
    if T[i] == T[i+1]:
        T[i+1] = 1 ^ T[i+1]
        ans2 += 1
        

ans = min(ans1, ans2)
print(ans)

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
input = sys.stdin.readline

bool_zeroone = True
count = 0
sl = list(input())
for c in sl:
    if bool_zeroone and c == '0':
        count += 1
    elif not bool_zeroone and c == '1':
        count += 1
    bool_zeroone = not bool_zeroone

answer = min(count, len(sl) - count)
print(answer)

Failing test case input:
01111101

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
bool_zeroone = True
count = 0
sl = list(input())
for c in sl:
    if bool_zeroone and c == '0':
        count += 1
    elif not bool_zeroone and c == '1':
        count += 1
    bool_zeroone = not bool_zeroone

answer = min(count, len(sl) - count)
print(answer)
Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
if __name__ == "__main__":
    l = int(input())
    l = [int(x) for x in list(str(l))]
    length = len(l)
    temp1 = []
    temp2 = []
    for i in range(length):
        temp1.append(i % 2)
        temp2.append((i + 1) % 2)
    t1 = 0
    t2 = 0
    for n in range(length):
        if temp1[n] != l[n]:
            t1 += 1
        if temp2[n] != l[n]:
            t2 += 1
    print(min(t1, t2))


Failing test case input:
00111001

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
if __name__ == "__main__":
    l = str(input())
    l = [int(x) for x in list(str(l))]
    length = len(l)
    temp1 = []
    temp2 = []
    for i in range(length):
        temp1.append(i % 2)
        temp2.append((i + 1) % 2)
    t1 = 0
    t2 = 0
    for n in range(length):
        if temp1[n] != l[n]:
            t1 += 1
        if temp2[n] != l[n]:
            t2 += 1
    print(min(t1, t2))

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

flag_a = 0
for i in range(1, len(S)):
    if (flag_a == 0):
        if (S[i] == "1"):
            ans_1 += 1
        flag_a = 1
    else:
        if (S[i] == "0"):
            ans_1 += 1
        flag_a = 0
if (len(S) != 1):
    if (S[0] != S[1]):
        ans_1 = 100000


flag_b = 1
for i in range(1, len(S)):
    if (flag_b == 0):
        if (S[i] == "0"):
            ans_2 += 1
        flag_b = 1
    else:
        if (S[i] == "1"):
            ans_2 += 1
        flag_b = 0
if (len(S) != 1):
    if (S[0] == S[1]):
        ans_2 = 100000

print(min(ans_1, ans_2))


Failing test case input:
00011111

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
S = list(input())
flag = 0
ans_1 = 0
ans_2 = 0

S1 = S[0]
if (S1 == "0"):
    flag_a = 1
else:
    flag_a = 0
for i in range(1, len(S)):
    if (flag_a == 0):
        if (S[i] == "1"):
            ans_1 += 1
        flag_a = 1
    else:
        if (S[i] == "0"):
            ans_1 += 1
        flag_a = 0
if (len(S) != 1):
    if (S[0] != S[1]):
        ans_1 = 1000000


S1 = S[0]
if (S1 == "1"):
    flag_b = 1
else:
    flag_b = 0
for i in range(1, len(S)):
    if (flag_b == 0):
        if (S[i] == "0"):
            ans_2 += 1
        flag_b = 1
    else:
        if (S[i] == "1"):
            ans_2 += 1
        flag_b = 0
if (len(S) != 1):
    if (S[0] == S[1]):
        ans_2 = 1000000

print(min(ans_1, ans_2))

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
c1=c2=0
f1='0'
f2='1'
for x in s:
  if f1==x:
    pass
  else:
    c1+=1
  if f1=='0':
    f1='1'
  else:
    f1='0'
for x in s:
  if f2==x:
    pass
  else:
    c2+=1
  if f2=='0':
    f2='1'
  else:
    f2='0'
print(c1,c2)
print(min(c1,c2))

Failing test case input:
01110010

Expected output:
4


Actual output:
4 4
4


Fixed submission (verdict: Accepted):
s=input()
c1=c2=0
f1='0'
f2='1'
for x in s:
  if f1==x:
    pass
  else:
    c1+=1
  if f1=='0':
    f1='1'
  else:
    f1='0'
for x in s:
  if f2==x:
    pass
  else:
    c2+=1
  if f2=='0':
    f2='1'
  else:
    f2='0'
print(min(c1,c2))
Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = list(input())

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

Failing test case input:
10100101

Expected output:
4


Actual output:
1


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

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

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
ans1 = 0
ans2 = 0

for i in range(len(s)):
    if s[i] != str(i%2):
        ans1 += 1

for i in range(len(s)):
    if s[i] != str((i+1)%2):
        ans2 += 1

print(ans2)

Failing test case input:
01110011

Expected output:
3


Actual output:
5


Fixed submission (verdict: Accepted):
s = input()
ans1 = 0
ans2 = 0

for i in range(len(s)):
    if s[i] != str(i%2):
        ans1 += 1

for i in range(len(s)):
    if s[i] != str((i+1)%2):
        ans2 += 1

print(min(ans1,ans2))

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = list(input())
cnt = 0
for i in range(1, len(S)-1):
    if S[i-1] == S[i]:
        if S[i] == '0':
            S[i] = '1'
        else:
            S[i] = '0'
        cnt += 1
print(cnt)

Failing test case input:
11100111

Expected output:
4


Actual output:
3


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

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = list(map(str, input()))
listA = ["0"]
listB = ["1"]
countA = 0
countB = 0

for i in range(len(S) - 1):
  listA.append(str((i+1)%2))
  listB.append(str(i%2))

for i in range(len(S) - 1):
  if listA[i] != S[i]:
    countA = countA + 1
  if listB[i] != S[i]:
    countB = countB + 1

if countA <= countB:
  print(countA)
else:
  print(countB)


Failing test case input:
11001111

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
S = list(map(str, input()))
listA = ["0"]
listB = ["1"]
countA = 0
countB = 0

for i in range(len(S)):
  listA.append(str((i+1)%2))
  listB.append(str(i%2))
  if listA[i] != S[i]:
    countA = countA + 1
  if listB[i] != S[i]:
    countB = countB + 1

if countA <= countB:
  print(countA)
else:
  print(countB)
Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
X=[]
for char in input():
  X.append(char)

S=X
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


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

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

Failing test case input:
00011111

Expected output:
3


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()
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))

Failing test case input:
10000111

Expected output:
4


Actual output:
3


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

print(min(count, count2))

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


Failing test case input:
11011000

Expected output:
4


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


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

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)

Problem: p03073
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
S=input()

a=[S[::2].count(l) for l in "01"]
b=[S[1:][::2].count(k) for k in "01"]

print(a,b)
print(min(a[0]+b[1],a[1]+b[0]))

Failing test case input:
00010111

Expected output:
2


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


Fixed submission (verdict: Accepted):
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
S=input()

a=[S[::2].count(l) for l in "01"]
b=[S[1:][::2].count(k) for k in "01"]

print(min(a[0]+b[1],a[1]+b[0]))
Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()

z_g = 0
z_k = 0
o_g = 0
o_k = 0

for i in range(len(s)-1):
    if i % 2 == 0:
        if s[i] == "0":
            z_g += 1
        else:
            o_g += 1
    else:
        if s[i] == "0":
            z_k += 1
        else:
            o_k += 1

if (z_g + o_k) > (z_k + o_g):
    print(z_k + o_g)
else:
    print(z_g + o_k)

Failing test case input:
11011000

Expected output:
4


Actual output:
3


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

z_g = 0
z_k = 0
o_g = 0
o_k = 0

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

if (z_g + o_k) > (z_k + o_g):
    print(z_k + o_g)
else:
    print(z_g + o_k)

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
data = [int(s) for s in input()]
count1 = 0
if data[0] == 0:
  
  
  for s in range(1,len(data)-1):
    
    
    print(s)
    if s % 2 == 0:
        if data[s] != 0:
            count1 += 1
            
    else :
        if data[s] != 1:
            count1 += 1
            
else:
  
  
  for s in range(1,len(data)-1):
    
    if s % 2 == 0:
      if data[s] != 0:
        count1 += 1
        
      else:
        if data[s] != 1:
          count1 += 1
          


print(count1)

Failing test case input:
11100010

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
data = [int(s) for s in input()]
count1 = 0
if data[0] == 0:
  
  
  for s in range(1,len(data)):
    
    
    
    if s % 2 == 0:
        if data[s] != 0:
            count1 += 1
    else :
        if data[s] != 1:
            count1 += 1
            
else:
  
  
  for s in range(1,len(data)):
    
    if s % 2 == 0:
      if data[s] != 1:
        count1 += 1
        
    else:
      if data[s] != 0:
        count1 += 1
          


print(count1)

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

input = sys.stdin.readline

def main():
    S = input()
    l = len(S)
    ws = ''
    bs = ''
    for i in range(l):
        if i%2 == 0:
            ws += '0'
            bs += '1'
        else:
            ws += '1'
            bs += '0'
    wsc = 0
    bsc = 0
    for i in range(l):
        if S[i] != ws[i]:
            wsc += 1
        if S[i] != bs[i]:
            bsc += 1
    print(min(wsc, bsc))

if __name__ == '__main__':
    main()

Failing test case input:
10100001

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
import sys

input = sys.stdin.readline

def main():
    S = input().rstrip('\n')
    l = len(S)
    ws = bs = ''
    for i in range(l):
        if i%2 == 0:
            ws += '0'
            bs += '1'
        else:
            ws += '1'
            bs += '0'
    wsc = bsc = 0
    for i in range(l):
        if S[i] != ws[i]:
            wsc += 1
        if S[i] != bs[i]:
            bsc += 1
    ans = min(wsc, bsc)
    print(ans)

if __name__ == '__main__':
    main()
Problem: p03073
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import sys, math
input = sys.stdin.readline

S = list(input().replace('\n',''))
S = list(map(int, S))
prev = S[0]
ans = 0
for i in range(1, len(S)-1):
  cur = S[i]
  if prev ^ cur == 0:
    ans += 1
    prev = 2 + ~cur
  else:
    prev = cur

print(ans)

Failing test case input:
01011010

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
import sys, math
input = sys.stdin.readline

S = list(input().replace('\n',''))
S = list(map(int, S))
prev = S[0]
ans = 0
for i in range(1, len(S)):
  cur = S[i]
  if prev ^ cur == 0:
    ans += 1






    prev = 2 + ~cur
  else:
    prev = cur

print(ans)

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = int(input())
S = [int(i) for i in list(str(S))]

a = []
b = True
for i in range(len(S)):
    if b:
        a.append(1)
        b=False
    else:
        a.append(0)
        b=True
c = a[::-1]

combined1 = [abs(x-y) for (x, y) in zip(S, a)]
combined2 = [abs(x-y) for (x, y) in zip(S, c)]

if len(S)==1:
    print(0)
else:
    print(min(sum(combined1), sum(combined2)))

Failing test case input:
00110111

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
S = input()
S = [int(i) for i in list(S)]

a = []
c = []
b = True
for i in range(len(S)):
    if b:
        a.append(1)
        c.append(0)
        b=False
    else:
        a.append(0)
        c.append(1)
        b=True

combined1 = [abs(x-y) for (x, y) in zip(S, a)]
combined2 = [abs(x-y) for (x, y) in zip(S, c)]

if len(S)==1:
    print(0)
else:
    print(min(sum(combined1), sum(combined2)))

Problem: p03073
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
s = input()

last = s[0]

c = 1

ans = 0

for i in range(1, len(s)):
	if(last == s[i]):
		c += 1
		if(c == 2):
			ans += 1
	else:
		c = 1
	last = s[i]

if(s[0] != s[len(s)-1]):
	ans += 1
print(ans)

Failing test case input:
00110011

Expected output:
4


Actual output:
5


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

last = s[0]

c = 1

ans = 0

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

Problem: p03073
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
s = input()

n = len(s)
p = s[::2].count("1") + s[1::2].count("0")

ans = min(n-p, n)
print(ans)


Failing test case input:
00110101

Expected output:
2


Actual output:
6


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

n = len(s)
p = s[::2].count("1") + s[1::2].count("0")

ans = min(p, n-p)
print(ans)
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)
    return min(bin(a).count("1"),
               bin(a).count("0"),
               bin(b).count("1"),
               bin(b).count("0"),
               )


if __name__ == '__main__':
    main()


Failing test case input:
11011000

Expected output:
4


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 (Python (3.4.3), verdict: Wrong Answer):
S=list(input())
A=[]
B=[]
a=0
b=0
for i in range(len(S)):
    if i%2==0:
        A.append("0")
    else:
        A.append("1")
for i in range(len(S)):
    if A[i]!=S[i]:
        a+=1
for j in range(len(S)):
    if i%2==0:
        B.append("1")
    else:
        B.append("0")
for j in range(len(S)):
    if B[j]!=S[j]:
        b+=1
print(min(a, b))
                

Failing test case input:
11111110

Expected output:
3


Actual output:
5


Fixed submission (verdict: Accepted):
S=list(input())
A=[]
B=[]
a=0
b=0
for i in range(len(S)):
    if i%2==0:
        A.append("0")
    else:
        A.append("1")
for i in range(len(S)):
    if A[i]!=S[i]:
        a+=1
for j in range(len(S)):
    if j%2==0:
        B.append("1")
    else:
        B.append("0")
for j in range(len(S)):
    if B[j]!=S[j]:
        b+=1
print(min(a, b))

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


Failing test case input:
01110100

Expected output:
2


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


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):
def resolve():
    S = str(input())
    ans = 0
    for i in range(len(S)):
        if (S[0] == '0'):
            if i % 2 == 1 and S[i] == '1':
                ans += 1
            elif i % 2 == 0 and S[i] == '0':
                ans += 1
        else:
            if i % 2 == 1 and S[i] == '1':
                ans += 1
            elif i % 2 == 0 and S[i] == '0':
                ans += 1
    
    if S[0] == '0':
        ans -= 1
    print(ans)
    return

resolve()

Failing test case input:
01110101

Expected output:
1


Actual output:
6


Fixed submission (verdict: Accepted):
def resolve():
    S = str(input())
    ans = 0
    for i in range(len(S)):
        if (S[0] == '0'):
            if i % 2 == 1 and S[i] != '1':
                ans += 1
            elif i % 2 == 0 and S[i] != '0':
                ans += 1
            else:
                pass
        if S[0] == '1':
            if i % 2 == 1 and S[i] != '0':
                ans += 1
            elif i % 2 == 0 and S[i] != '1':
                ans += 1
            else:
                pass
    print(ans)
    return

resolve()

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
pat = input()
if len(pat) == 1:
    print(0)
else:
    
    pat1 = "0"
    pat2 = "1"

    for i in range(len(pat)-1):
        if pat1[-1:]=="0":
            pat1 = pat1+"1"
        else:
            pat1 = pat1+"0"
        
    for i in range(len(pat)-1):
        if pat2[-1:]=="0":
            pat2 = pat2+"1"
        else:
            pat2 = pat2+"0"

    count1 = 0
    count2 = 0
    for s in range(len(pat)-1):
        if pat[s] != pat1[s]:
            count1 = count1 + 1
        if pat[s] != pat2[s]:
            count2 = count2 + 1
    
    if count1 <= count2:
        print(count1)

    else:
        print(count2)

Failing test case input:
01110110

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
pat = input()
if len(pat) == 1:
    print(0)            
else:
    
    pat1 = "0"
    pat2 = "1"

    for i in range(len(pat)-1):
        if pat1[-1:]=="0":
            pat1 = pat1+"1"
        else:
            pat1 = pat1+"0"
        
    for i in range(len(pat)-1):
        if pat2[-1:]=="0":
            pat2 = pat2+"1"
        else:
            pat2 = pat2+"0"

    count1 = 0
    count2 = 0
    for s in range(len(pat)):
        if pat[s] != pat1[s]:
            count1 = count1 + 1

        if pat[s] != pat2[s]:
            count2 = count2 + 1


    if count1 <= count2:
        print(count1)

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


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)



Failing test case input:
00011110

Expected output:
4


Actual output:
5


Fixed submission (verdict: Accepted):


S=input()

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

print(count)

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S=list(input())
A=[]
B=[]
a=0
b=0
for i in range(len(S)):
    if i%2==0:
        A.append("0")
    else:
        A.append("1")
for i in range(len(S)):
    if A[i]!=S[i]:
        a+=1
for j in range(len(S)):
    if i%2==0:
        B.append("1")
    else:
        B.append("0")
for j in range(len(S)):
    if B[j]!=S[j]:
        b+=1
print(min(a, b))

Failing test case input:
11101110

Expected output:
2


Actual output:
6


Fixed submission (verdict: Accepted):
S=list(input())
A=[]
B=[]
a=0
b=0
for i in range(len(S)):
    if i%2==0:
        A.append("0")
    else:
        A.append("1")
for i in range(len(S)):
    if A[i]!=S[i]:
        a+=1
for j in range(len(S)):
    if j%2==0:
        B.append("1")
    else:
        B.append("0")
for j in range(len(S)):
    if B[j]!=S[j]:
        b+=1
print(min(a, b))

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
colors = input()
l = len(colors)
count1 = 0
for i in range(l):
	if int(colors[i]) == (i % 2):
		count1 += int(colors[i])
print(min(count1, l-count1))

Failing test case input:
10100101

Expected output:
4


Actual output:
2


Fixed submission (verdict: Accepted):
colors = input()
l = len(colors)
count1 = 0
for i in range(l):
	if int(colors[i]) == (i % 2):
		count1 += 1
print(min(count1, l-count1))
Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

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 % 4 in (0, 1):
            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 += 2

    answer = min(answer_1, answer_2)

    print(answer)

Failing test case input:
11101110

Expected output:
2


Actual output:
4


Fixed submission (verdict: Accepted):

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)

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

n = int(len(s)/2)

a = [0]*len(s)
b = [0]*len(s)

for i in range(n):
  a[2*i] = 0
  a[2*i+1] = 1
  b[2*i] = 1
  b[2*i+1] = 0

if len(s)%2 ==1:
  a[len(s)-1] = 0
  b[len(s)-1] = 1 

print(a)
print(b)

an = 0
bn = 0

for j in range(len(s)):
  if a[j] != s[j]:
    an += 1
  if b[j] != s[j]:
    bn += 1

print(min(an, bn))

Failing test case input:
01111110

Expected output:
4


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


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

n = int(len(s)/2)

a = [0]*len(s)
b = [0]*len(s)

for i in range(n):
  a[2*i] = 0
  a[2*i+1] = 1
  b[2*i] = 1
  b[2*i+1] = 0

if len(s)%2 ==1:
  a[len(s)-1] = 0
  b[len(s)-1] = 1 


an = 0
bn = 0

for j in range(len(s)):
  if a[j] != s[j]:
    an += 1
  if b[j] != s[j]:
    bn += 1

print(min(an, bn))

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

ans = 0
last_str = ''
for s in S:
  if last_str == '':
    last_str = s
  elif (last_str == s) and s == '0':
    ans += 1
    last_str = '1'
  elif (last_str == s) and s == '1':
    ans += 1
    last_str = '0'
  else:
    pass
print(ans)

Failing test case input:
11001111

Expected output:
4


Actual output:
0


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

ans = 0
last_str = ''
for s in S:
  if (last_str == s) and s == '0':
    ans += 1
    last_str = '1'
  elif (last_str == s) and s == '1':
    ans += 1
    last_str = '0'
  else:
    last_str = s
print(ans)
Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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


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))


Failing test case input:
01110101

Expected output:
1


Actual output:
0
0
0
1


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


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:
        count_one += 1
for m in range(len(odd_list)):
    if odd_list[m] == 1:
        count_one += 1

print(min(count_zero, count_one))

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
data = [int(s) for s in input()]
count1 = 0
if data[0] == 0:
  
  
  for s in range(1,len(data)-1):
    
    
    print(s)
    if s % 2 == 0:
        if data[s] != 0:
            count1 += 1
            
    else :
        if data[s] != 1:
            count1 += 1
            
else:
  
  
  for s in range(1,len(data)-1):
    
    if s % 2 == 0:
      if data[s] != 0:
        count1 += 1

      else:
        if data[s] != 1:
          count1 += 1
          


print(count1)

Failing test case input:
10000100

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
data = [int(s) for s in input()]
count1 = 0
if data[0] == 0:
  
  
  for s in range(1,len(data)):
    
    
    
    if s % 2 == 0:
        if data[s] != 0:
            count1 += 1
    else :
        if data[s] != 1:
            count1 += 1
            
else:
  
  
  for s in range(1,len(data)):
    
    if s % 2 == 0:
      if data[s] != 1:
        count1 += 1
        
    else:
      if data[s] != 0:
        count1 += 1
          


print(count1)

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

ans = 0
last_str = ''
for s in S:
  if last_str == '':
    last_str = s
  elif (last_str == s) and s == '0':
    ans += 1
    last_str = '1'
  elif (last_str == s) and s == '1':
    ans += 1
    last_str = '0'
  else:
    pass
print(ans)

Failing test case input:
11001010

Expected output:
2


Actual output:
6


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

ans = 0
last_str = ''
for s in S:
  if (last_str == s) and s == '0':
    ans += 1
    last_str = '1'
  elif (last_str == s) and s == '1':
    ans += 1
    last_str = '0'
  else:
    last_str = s
print(ans)
Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=input()
cnt=0
for i in range(len(n)):
    if n[0]==0:
        if i%2==0 and n[i]!=0 :
            cnt+=1
        if i&2==1 and n[i]!=1 :
            cnt+=1
    else:
        if i%2==0 and n[i]!=1 :
            cnt+=1
        if i&2==1 and n[i]!=0 :
            cnt+=1
print(cnt-1)

Failing test case input:
00110000

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
n=input()
cnt=0
for i in range(len(n)):
    if n[0]=="0":
        if i%2==0 and n[i]=="1" :
            cnt+=1
        if i%2==1 and n[i]=="0" :
            cnt+=1
    else:
        if i%2==0 and n[i]=="0" :
            cnt+=1
        if i%2==1 and n[i]=="1" :
            cnt+=1
print(cnt)

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def f(s,a):
    ans=0
    for i in range(len(s)):
        if i%2==0:
            if s[i]!=a:
                ans+=1
                print(1)
        else:
            if s[i]==a:
                ans+=1
    return ans


s=list(input())
print(min(f(s,'0'),f(s,'1')))

Failing test case input:
01111110

Expected output:
4


Actual output:
1
1
1
1
4


Fixed submission (verdict: Accepted):
def f(s,a):
    ans=0
    for i in range(len(s)):
        if i%2==0:
            if s[i]!=a:
                ans+=1
        else:
            if s[i]==a:
                ans+=1
    return ans


s=list(input())
print(min(f(s,'0'),f(s,'1')))

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

flag = True
length = len(S)
count = 0
for c in S:
    if int(flag) == int(c):
        count += 1
    flag = not flag

if count > divmod(length, 2)[1]:
    count = length - count
print(count)


Failing test case input:
00110101

Expected output:
2


Actual output:
6


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

flag = True
length = len(S)
count = 0
for c in S:
    if int(flag) == int(c):
        count += 1
    flag = not flag

if count > divmod(length, 2)[0]:
    count = length - count
print(count)
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(res)

Failing test case input:
11110010

Expected output:
3


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):
S = input()
S_int = map(int, S)

if len(S) == 1:
    print(0)
else:
    s = list(S_int)
    def reverse_count(s, initial):
        count = 0
        c = initial
        for i in range(len(s) - 1):
            if s[i] != c:
                count += 1
            c = (c + 1) % 2
        return count
        
    
    print(min(reverse_count(s, 0), reverse_count(s, 1)))

Failing test case input:
10000100

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
S = input()
S_int = map(int, S)

if len(S) == 1:
    print(0)
else:
    s = list(S_int)
    def reverse_count(s, initial):
        count = 0
        c = initial
        for i in range(len(s)):
            if s[i] != c:
                count += 1
            c = (c + 1) % 2
        return count
        
    
    print(min(reverse_count(s, 0), reverse_count(s, 1)))

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

Failing test case input:
01110101

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
S = input()
back = 0
n = 0
for i in S:
    if i == back:
        back = '0' if i=='1' else '1'
        n += 1
    else:
        back = i

print(n);
Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S=[]
for char in str(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:
10100001

Expected output:
3


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):
def color(s):
    k = 0
    for i in range(len(s)-1):
        if s[i+1]==s[i]:
            if s[i]=='0':
                s[i+1]='1'
            if s[i]=='1':
                s[i+1]='0'
            k = k+1
    return k
    
s=list(input())
color(s)

Failing test case input:
00011111

Expected output:
3


Actual output:

Fixed submission (verdict: Accepted):
def color(s):
    k = 0
    for i in range(len(s)-1):
        if s[i+1]==s[i]:
            if s[i]=='0':
                s[i+1]='1'
            if s[i]=='1':
                s[i+1]='0'
            k = k+1
    return k
    
s=list(input())
print(color(s))

Problem: p03073
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=list(input())
ans=0
for i in range(1,len(s)):
  if s[i]==s[i-1]:
    if s[i]=='0':
      s[i]=1
    else:
      s[i]=0
    ans+=1
print(ans)

Failing test case input:
10010110

Expected output:
4


Actual output:
2


Fixed submission (verdict: Accepted):
s=list(input())
ans=0
for i in range(1,len(s)):
  if s[i]==s[i-1]:
    if s[i]=='0':
      s[i]='1'
    else:
      s[i]='0'
    ans+=1
print(ans)

Problem: p03073
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()

ans0 = 0
ans1 = 0
for i, s_i in enumerate(s):
    if i % 2 == 0:
        if s_i == '0':
            ans1 += 1
        else:
            ans0 += 1
    else:
        if s_i == '0':
            ans0 += 1
        else:
            ans1 += 1
print(ans0, ans1)
print(min(ans0, ans1))


Failing test case input:
10110111

Expected output:
4


Actual output:
4 4
4


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

ans0 = 0
ans1 = 0
for i, s_i in enumerate(s):
    if i % 2 == 0:
        if s_i == '0':
            ans1 += 1
        else:
            ans0 += 1
    else:
        if s_i == '0':
            ans0 += 1
        else:
            ans1 += 1
print(min(ans0, ans1))