TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
def resolve():
    S = input()
    s1 = S[::2]
    s2 = S[1::2]
    print()
    print(s1)
    print(s2)
    for i in range(len(S)):
        continue
    for i in range(len(S)):
        continue
    for i in range(len(S)):
        continue
    for i in range(len(S)):
        continue
    print("1")

resolve()


def resolve():
    S = input()
    print()
    print(S)
    for i in range(len(S)):
        continue
    for i in range(len(S)):
        continue
    for i in range(len(S)):
        continue
    for i in range(len(S)):
        continue


resolve()

list_S = list(input())
S = [int(s) for s in list_S]
s1 = S[::2]
s2 = S[1::2]
sums1 = sum(s1)
sums2 = sum(s2)
if sums1>sums2: print(len(s1)-sums1+sums2)
else: print(len(s2)-sums2+sums1)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

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


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

Verdicts: Wrong Answer

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
s=list(input())
x=0
y=0
for i in range(0,len(s)):
  if i%2==0:
    if s[i]=="0":
      x+=1
  else:
    if s[i]=="1":
      x+=1
      
for j in range(0,len(s)):
  if i%2==0:
    if s[i]=="1":
      y+=1
  else:
    if s[i]=="0":
      y+=1
      
print(min(x,y))      
  

s=list(input())
x=0
y=0
for i in range(0,len(s)):
  if i%2==0:
    if s[i]=="0":
      x+=1
  else:
    if s[i]=="1":
      x+=1
      
for j in range(0,len(s)):
  if j%2==0:
    if s[j]=="1":
      y+=1
  else:
    if s[j]=="0":
      y+=1
      
print(min(x,y))      
  


Verdicts: Wrong Answer

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
s=input()
ans=len(s)
for i in range(2):
  cnt=0
  for j in s:
    if int(j) % 2 == 0 and j!=i: cnt+=1
    if int(j) % 2 == 1 and j==i: cnt+=1
  ans=min(cnt,ans)
print(ans)

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

Verdicts: Wrong Answer

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
import numpy

s = list(input())
N = len(s)
count_A = 0
count_B = 0

for i in range(N):
    s[i] = int(str(s[i]))

A = numpy.empty(N)
B = numpy.empty(N)

for j in range(N):
    if j % 2 == 0 :
        A[j] = 1
        B[j] = 0
    else:
        A[j] = 0
        B[j] = 1

for k in range(N):
    A[k]=s[k]-A[k]
    B[k]=s[k]-B[k]
    if A[k] != 0:
        count_A = count_A + 1
    if B[k] != 0:
        count_B = count_B + 1

print(A)
print(B)

if count_A > count_B :
    print(count_B)
else :
    print(count_A)





import numpy

s = list(input())
N = len(s)
count_A = 0
count_B = 0

for i in range(N):
    s[i] = int(str(s[i]))

A = numpy.empty(N)
B = numpy.empty(N)

for j in range(N):
    if j % 2 == 0 :
        A[j] = 1
        B[j] = 0
    else:
        A[j] = 0
        B[j] = 1

for k in range(N):
    A[k]=s[k]-A[k]
    B[k]=s[k]-B[k]
    if A[k] != 0:
        count_A = count_A + 1
    if B[k] != 0:
        count_B = count_B + 1

if count_A > count_B :
    print(count_B)
else :
    print(count_A)





Verdicts: Wrong Answer

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

n = str(input())
l1 = []
for c in n:
	l1.append(c)

z, o = '0', '1'

one, zero = [], []

for i in range(len(l1)):
	if i%2 == 0:
		one.append(o)
		zero.append(z)
	else:
		one.append(z)
		zero.append(o)

c1, c2 = 0,0
for i in range(len(l1)):
	if l[i] == one[i]:
		c1 += 1
	if l[i] == zero[i]:
		c2 += 1

ans = min(c1, c2)
print(ans)

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

n = str(input())
print(n)
l1 = []
for c in n:
	l1.append(c)

z, o = '0', '1'

one, zero = [], []

for i in range(len(l1)):
	if i%2 == 0:
		one.append(o)
		zero.append(z)
	else:
		one.append(z)
		zero.append(o)

c1, c2 = 0,0
for i in range(len(l1)):
	if l[i] == one[i]:
		c1 += 1
	if l[i] == zero[i]:
		c2 += 1

ans = min(c1, c2)
print(ans)

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

n = str(input())
l1 = []
for c in n:
	l1.append(c)

z, o = '0', '1'

one, zero = [], []

for i in range(len(l1)):
	if i%2 == 0:
		one.append(o)
		zero.append(z)
	else:
		one.append(z)
		zero.append(o)

c1, c2 = 0,0
for i in range(len(l1)):
	if l1[i] == one[i]:
		c1 += 1
	if l1[i] == zero[i]:
		c2 += 1

ans = min(c1, c2)
print(ans)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
# coding=utf-8

tile = input()

cor_list = ["10"*50000, "01"*50000]

diff_1 = int("0b"+tile, 2) ^ int("0b"+cor_list[0][:len(tile)], 2)  
diff_2 = int("0b"+tile, 2) ^ int("0b"+cor_list[1][:len(tile)], 2)

score_1 = sum([int(s) for s in bin(diff_1)[2:]])
score_2 = sum([int(s) for s in bin(diff_2)[2:]])
print(min[score_1, score_2])

tile = input()

cor_list = ["10"*50000, "01"*50000]

diff_1 = int("0b"+tile, 2) ^ int("0b"+cor_list[0][:len(tile)], 2)  
diff_2 = int("0b"+tile, 2) ^ int("0b"+cor_list[1][:len(tile)], 2)

score = [0, 0]
score[0] = sum([int(s) for s in bin(diff_1)[2:]])
score[1] = sum([int(s) for s in bin(diff_2)[2:]])

print(min(score))

Verdicts: Runtime Error

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
S=input()
s=0
t=0
for i in range(len(S)):
  if i%2==0 and S[i]==0:
    s+=1
for j in range(len(S)):
  if i%2==0 and S[i]==1:
    t+=1
print(min(s,t))

S=input()
a=len(S)
s=0
t=0
for i in range(a):
  if i%2==0 and S[i]==1:
    s=s
  elif i%2==0 and S[i]==0:
    s+=1
  elif i%2!=0 and S[i]==0:
    s=s
  else:
    s+=1
for j in range(a):
  if j%2==0 and S[j]==0:
    t=t
  elif j%2==0 and S[j]==1:
    t+=1
  elif j%2!=0 and S[j]==1:
    t=t
  else:
    t+=1
m=min(s,t)
print(m)

S=input()
s=0
t=0
for i in range(len(S)):
  if i%2==0:
    if S[i]==0:
      s+=1
  else:
    if S[i]==1:
      s+=1
for j in range(len(S)):
  if j%2==0:
    if S[j]==1:
      t+=1
  else:
    if S[j]==0:
      t+=1
print(min(s,t))

S=input()
s=0
for i in range(len(S)):
  if S[i]==S[i+1]==S[i+2]==0:
    s+=1
    S[i+1]=1
  elif S[i]==S[i+1]==S[i+2]==1:
    s+=1
    S[i+1]==0
  elif S[i]==S[i+1] and S[i+1]!=S[i+2]:
    s+=1
    S[i]=S[i+2]
  elif S[i]!=S[i+1] and S[i+1]==S[i+2]:
    s+=1
    S[i+2]==S[i]
  else:
    s=s
print(s)

S=input()
S=list(S)
s=0
for i in range(len(S)-2):
  if S[i]==S[i+1]==S[i+2]==0:
    s+=1
    S[i+1]=1
  elif S[i]==S[i+1]==S[i+2]==1:
    s+=1
    S[i+1]=0
  elif S[i]==S[i+1] and S[i+1]!=S[i+2]:
    s+=1
    S[i]=S[i+2]
  elif S[i]!=S[i+1] and S[i+1]==S[i+2]:
    s+=1
    S[i+2]=S[i]
  else:
    s=s
print(s)

S=input()
s=0
t=0
for i in range(len(S)):
  if i%2==0:
    if S[i]!=0:
      s+=1
    else:
      s=s
  if i%2==1:
    if S[i]!=1:
      s+=1
    else:
      s=s
for i in range(len(S)):
  if i%2==0:
    if S[i]!=1:
      t+=1
    else:
      t=t
  if i%2==1:
    if S[i]!=0:
      t+=1
    else:
      t=t
print(min(s,t))

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

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
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)

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)

Verdicts: Wrong Answer

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
cnt = 0
num = '1'
    s = input()
    for i in range(len(s)):
        if s[i] == num:
            cnt += 1
        if num == '1':
            num = '0'
        else:
            num = '1'
    print(min(int(len(s)-cnt),cnt))

cnt = 0
num = '1'
s = input()
for i in range(len(s)):
    if s[i] == num:
        cnt += 1
    if num == '1':
        num = '0'
    else:
        num = '1'
print(min(int(len(s)-cnt),cnt))

Verdicts: Runtime Error

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
import collections
s = input()
c1 = s.count("1")
c0 = s.count("0")

print(min(c1,c0))

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

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
s = input()
o1e0 = 0
o0e1 = 0

for n, i in enumerate(s):
    print(n,i)
    if (n // 2 == 0):
        if (i == "0"):
            o1e0 += 1
        else:
            o0e1 += 1

    else:
        if (i == "1"):
            o1e0 += 1
        else:
            o0e1 += 1
            
print(min(len(s) - o1e0, len(s) - o0e1))

s = input()
o1e0 = 0
o0e1 = 0

for n, i in enumerate(s):
    if n % 2 == 0:
        if i == "0":
            o1e0 += 1
        else:
            o0e1 += 1

    else:
        if i == "1":
            o1e0 += 1
        else:
            o0e1 += 1

print(min(len(s) - o1e0, len(s) - o0e1))

Verdicts: Wrong Answer

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
s=input()
w=str()
b=str()
cnt1=0
cnt2=0
for i in range(n):
    if i%2==0:
        w+='1'
        b+='0'
    else:
        w+='0'
        b+='1'
for i in range(n):
    if s[i]!=w[i]:
        cnt1+=1
    if s[i]!=b[i]:
        cnt2+=1
print(min(cnt1,cnt2))

s=input()
w=str()
b=str()
cnt1=0
cnt2=0
for i in range(len(s)):
    if i%2==0:
        w+='1'
        b+='0'
    else:
        w+='0'
        b+='1'
for i in range(len(s)):
    if s[i]!=w[i]:
        cnt1+=1
    if s[i]!=b[i]:
        cnt2+=1
print(min(cnt1,cnt2))


Verdicts: Runtime Error

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
s = input()
c0 = 0
c1 = 0
for i in range(s):
  if i % 2 == 0:
    if s[i] != '0':
      c0 += 1
    if s[i] != '1':
      c1 += 1
  else:
    if s[i] != '1':
      c0 += 1
    if s[i] != '0':
      c1 += 1
print(min(c0, c1))

s = input()
c0 = 0
c1 = 0
for i in range(len(s)):
  if i % 2 == 0:
    if s[i] != '0':
      c0 += 1
    if s[i] != '1':
      c1 += 1
  else:
    if s[i] != '1':
      c0 += 1
    if s[i] != '0':
      c1 += 1
print(min(c0, c1))


Verdicts: Runtime Error

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
import math
n = int(input())
num = [int(input()) for i in range(5)]
print(int(4+math.ceil(n/min(min(num)))))

import numpy as np
s = [int(i) for i in input()]

n = len(s)

list01 = [int(i%2) for i in range(n)]
list10 = [int((i+1)%2) for i in range(n)]

        
list_a = np.array(s) - np.array(list01)
list_b = np.array(s) - np.array(list10)

count0 = np.sum(list_a == 0)
count1 = np.sum(list_b == 0)
countmin = min((n-count0),(n-count1))
print(countmin)

Verdicts: Runtime Error

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
S = input()
word_01 = '01'
word_10 = '10'
q, mod = divmod(len(S), 2)
if mod == 0:
    word_01 = word_01 * q
    word_10 = word_10 * q
else:
    word_01 = word_01 * (q-1) + '0'
    word_10 = word_10 * (q-1) + '1'
S_list = list(S)
word_01_list = list(word_01)
word_10_list = list(word_10)
counter1 = 0
counter2 = 0
for num1, num2, num3 in zip(S_list, word_01_list, word_10_list):
    if num1 != num2:
        counter1 += 1
    if num1 != num3:
        counter2 += 1
result = min(counter1, counter2)
print(result)

S = input()
word_01 = '01'
word_10 = '10'
q, mod = divmod(len(S), 2)
if mod == 0:
    word_01 = word_01 * q
    word_10 = word_10 * q
else:
    word_01 = word_01 * q + '0'
    word_10 = word_10 * q + '1'
print(word_01)
print(word_10)
S_list = list(S)
word_01_list = list(word_01)
word_10_list = list(word_10)
counter1 = 0
counter2 = 0
for num1, num2, num3 in zip(S_list, word_01_list, word_10_list):
    if num1 != num2:
        counter1 += 1
    if num1 != num3:
        counter2 += 1
result = min(counter1, counter2)
print(result)

S = input()
word_01 = '01'
word_10 = '10'
q, mod = divmod(len(S), 2)
if mod == 0:
    word_01 = word_01 * q
    word_10 = word_10 * q
else:
    word_01 = word_01 * q + '0'
    word_10 = word_10 * q + '1'
S_list = list(S)
word_01_list = list(word_01)
word_10_list = list(word_10)
counter1 = 0
counter2 = 0
for num1, num2, num3 in zip(S_list, word_01_list, word_10_list):
    if num1 != num2:
        counter1 += 1
    if num1 != num3:
        counter2 += 1
result = min(counter1, counter2)
print(result)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
def test():
    s = list(map(int,list(input())))
    for i in range(len(s)-1):
        if s[i] == s[i+1]:
            s[i+1] ^= 1
    print(s) 


if __name__ == "__main__":
    test()


def test():
    s = list(map(int,list(input())))
    count = 0
    for i in range(len(s)-1):
        if s[i] == s[i+1]:
            s[i+1] ^= 1
            count += 1
    print(count)


if __name__ == "__main__":
    test()


Verdicts: Wrong Answer

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
n = input()
answer = 0
if len(n)<=1:
    print(0)
else:
    for i in range(1,len(n)):
        if n[i]==n[i-1]:
            answer+=1
            if n[i]=='0':
                n = n[:i]+'1'+n[i+1:]
            else:
                n = n[:i]+'0'+n[i+1:]
    print(answer)
print(n)

n = input()
answer = 0
if len(n)<=1:
    pass
else:
    for i in range(1,len(n)):
        if n[i]==n[i-1]:
            answer+=1
            if n[i]=='0':
                n = n[:i]+'1'+n[i+1:]
            else:
                n = n[:i]+'0'+n[i+1:]

print(answer)

Verdicts: Wrong Answer

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
s = input()
odd = s[0::2]
even = s[1::2]

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

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


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

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

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


Verdicts: Wrong Answer

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
#!/usr/bin/env python3

import re

a = input()

preans1 = 0
preans2 = 0
if(a[0] == "0"):
    for i in range(1,len(a)):
        if(i%2 == 0):
            if(a[i] != "1"):
                preans1 += 1
        elif(i%2 == 1):
            if(a[i] != "0"):
                preans1 += 1
    if(a[-1] == "1"):
        for i in range(2,len(a)+1):
            if(i%2 == 0):
                if(a[-i] != "0"):
                    preans2 += 1
            elif(i%2 == 1):
                if(a[-i] != "1"):
                    preans2 += 1
elif(a[0] == "1"):
    for i in range(1,len(a)):
        if(i%2 == 1):
            if(a[i] != "0"):
                preans1 += 1
        elif(i%2 == 0):
            if(a[i] != "1"):
                preans1 += 1
    if(a[-1] == "0"):
        for i in range(2,len(a)+1):
            if(i%2 == 0):
                if(a[-i] != "1"):
                    preans2 += 1
            elif(i%2 == 1):
                if(a[-i] != "0"):
                    preans2 += 1
print(min(preans1,preans2))

#!/usr/bin/env python3

import re

a = input()

preans1 = 0
preans2 = 1000000
if(a[0] == "0"):
    for i in range(len(a)):
        if(i%2 == 0):
            if(a[i] != "0"):
                preans1 += 1
        elif(i%2 == 1):
            if(a[i] != "1"):
                preans1 += 1
    if(a[-1] == "1"):
        preans2 = 0
        for i in range(2,len(a)+1):
            if(i%2 == 0):
                if(a[-i] != "0"):
                    preans2 += 1
            elif(i%2 == 1):
                if(a[-i] != "1"):
                    preans2 += 1
elif(a[0] == "1"):
    for i in range(len(a)):
        if(i%2 == 1):
            if(a[i] != "0"):
                preans1 += 1
        elif(i%2 == 0):
            if(a[i] != "1"):
                preans1 += 1
    if(a[-1] == "0"):
        preans2 = 0
        for i in range(2,len(a)+1):
            if(i%2 == 0):
                if(a[-i] != "1"):
                    preans2 += 1
            elif(i%2 == 1):
                if(a[-i] != "0"):
                    preans2 += 1
print(min(preans1,preans2))

Verdicts: Wrong Answer

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
S = input()
wb = ["0" if i % 2 == 0 else "1" for i in range(len(S))]
bw = ["1" if i % 2 == 0 else "0" for i in range(len(S))]

cnt_wb = 0
cnt_bw = 0
for i in range((len(S))):
  if wb[i] != S[i]:
    cnt_wb += 1
  if bw[i] != S[i]:
    cnt_bw += 1
    
print (min(cnt_eb, cnt_bw))

S = input()
wb = ["0" if i % 2 == 0 else "1" for i in range(len(S))]
bw = ["1" if i % 2 == 0 else "0" for i in range(len(S))]

cnt_wb = 0
cnt_bw = 0
for i in range((len(S))):
  if w_b[i] != S[i]:
    cnt_wb += 1
  if bw[i] != S[i]:
    cnt_bw += 1
    
print (min(cnt_eb, cnt_bw))

S = input()
wb = ["0" if i % 2 == 0 else "1" for i in range(len(S))]
bw = ["1" if i % 2 == 0 else "0" for i in range(len(S))]

cnt_wb = 0
cnt_bw = 0
for i in range((len(S))):
  if wb[i] != S[i]:
    cnt_wb += 1
  if bw[i] != S[i]:
    cnt_bw += 1
    
print (min(cnt_wb, cnt_bw))

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
a =list(input())


def saisyo1(a):
    kisuu = a[1::2]
    guusuu = a[0::2]
    count = 0
    for i in kisuu:
        if i != 1:
            count += 1
    for i in guusuu:
        if i != 0:
            count += 1
    return count

def saisyo0(a):
    kisuu = a[1::2]
    guusuu = a[0::2]
    count = 0
    for i in kisuu:
        if i != 0:
            count += 1
    for i in guusuu:
        if i != 1:
            count += 1
    return count

def main():
   print(min(saisyo0(a),saisyo1(a)))

if __name__ == '__main__':
    main()


a =list(input())


def saisyo1(a):
    kisuu = a[1::2]
    guusuu = a[0::2]
    count = 0
    for i in kisuu:
        if i != "1":
            count += 1
    for i in guusuu:
        if i != "0":
            count += 1
    return count

def saisyo0(a):
    kisuu = a[1::2]
    guusuu = a[0::2]
    count = 0
    for i in kisuu:
        if i != "0":
            count += 1
    for i in guusuu:
        if i != "1":
            count += 1
    return count

def main():
    print(min(saisyo0(a),saisyo1(a)))


if __name__ == '__main__':
    main()


Verdicts: Wrong Answer

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
s = input()
l = len(s)

s1 = [ ((-1)^i + 1)/2 for i in range(l)]
s2 = [ ((-1)^(i+1) + 1)/2 for i in range(l)]

m = 0
n = 0
for i in range(l):
  m += (s[i] - s1[i])^2
  n += (s[i] - s2[i])^2

print(min(m,n))

s = list(map(int, input().split()))
l = len(s)

s1 = [ ((-1)^i + 1)/2 for i in range(l)]
s2 = [ ((-1)^(i+1) + 1)/2 for i in range(l)]

m = 0
n = 0
for i in range(l):
  m += (s[i] - s1[i])^2
  n += (s[i] - s2[i])^2

print(min(m,n))

s = input()
l = len(s)

s1 = [ ((-1)**i + 1)//2 for i in range(l)]
s2 = [ ((-1)**(i+1) + 1)//2 for i in range(l)]

m = 0
n = 0
for i in range(l):
  m += (int(s[i]) - s1[i])**2
  n += (int(s[i]) - s2[i])**2

print(min([m,n]))

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
tiles = map(int, input())
# inputs = "10010010"



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 0
        color = 1 - color
    return counts


print(count_repaint_tiles(tiles))



# inputs = "10010010"



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


tiles = map(int, input().split())
# inputs = "10010010"



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 0
        color = 1 - color
    return counts


print(count_repaint_tiles(tiles))


tiles = list(map(int, input()))
# inputs = "10010010"



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


Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
import numpy as np

s_ = int(input())
s = np.array(list(map(int, str(s_))))

a01 = np.tile([0,1], len(s)//2+1)
a10 = np.tile([1,0], len(s)//2+1)

if len(s)%2 != 0:
    a01 = np.delete(a01, len(s))
    a10 = np.delete(a10, len(s))
else:
    a01 = np.delete(a01, [len(s)-1,len(s)])
    a10 = np.delete(a10, [len(s)-1,len(s)])

ans01 = np.abs(s -a01)
ans10 = np.abs(s -a10)

if sum(ans01) >= sum(ans10):
    print(sum(ans10))
else:
    print(sum(ans01))

import numpy as np

s = np.array(list(map(int, input())))

a01 = np.tile([0,1], len(s)//2)
a10 = np.tile([1,0], len(s)//2)

if len(s)%2 != 0:
    a01 = np.append(a01, 0)
    a10 = np.append(a10, 1)

ans01 = np.abs(s -a01)
ans10 = np.abs(s -a10)

if sum(ans01) >= sum(ans10):
    print(sum(ans10))
else:
    print(sum(ans01))

Verdicts: Wrong Answer

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
S = str(input())
N = len(S)

left_b = 0
if N%2 == 0:
    for i in range(N//2 - 1):
        if S[2*i] == str(1): 
            left_b = left_b + 1
        if S[2*i+1] == str(0):
            left_b = left_b + 1
    mini = min(left_b,N - left_b)
        
else:
    for i in range(N//2 - 1):
        if S[2*i] == str(1): 
            left_b = left_b + 1
        if S[2*i+1] == str(0):
            left_b = left_b + 1
    if S[N-1] == str(1):
            left_b = left_b + 1
    mini = min(left_b,N - left_b)

print(mini)


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

left_b = 0
if N%2 == 0:
    for i in range(N//2):
        if S[2*i] == str(1): 
            left_b = left_b + 1
        if S[2*i+1] == str(0):
            left_b = left_b + 1
    mini = min(left_b,N - left_b)
        
else:
    for i in range(N//2):
        if S[2*i] == str(1): 
            left_b = left_b + 1
        if S[2*i+1] == str(0):
            left_b = left_b + 1
            print(left_b)
    if S[N-1] == str(1):
            left_b = left_b + 1
    mini = min(left_b,N - left_b)

print(mini)

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

left_b = 0
if N%2 == 0:
    for i in range(N//2 - 1):
        if S[2*i] == str(1): 
            left_b = left_b + 1
        if S[2*i+1] == str(0):
            left_b = left_b + 1
    mini = min(left_b,N - left_b)
        
else:
    for i in range(N//2 - 1):
        if S[2*i] == str(1): 
            left_b = left_b + 1
        if S[2*i+1] == str(0):
            left_b = left_b + 1
    if S[N-1] == str(1):
            left_b ==left_b + 1
    mini = min(left_b,N - left_b)

print(mini)


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

left_b = 0
if N%2 == 0:
    for i in range(N//2):
        if S[2*i] == str(1): 
            left_b = left_b + 1
        if S[2*i+1] == str(0):
            left_b = left_b + 1
    mini = min(left_b,N - left_b)
        
else:
    for i in range(N//2):
        if S[2*i] == str(1): 
            left_b = left_b + 1
        if S[2*i+1] == str(0):
            left_b = left_b + 1
    if S[N-1] == str(1):
            left_b = left_b + 1
    mini = min(left_b,N - left_b)

print(mini)


        

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
s = input()
for i in range(1,len(s)):
    if s[i-1] == "0" and s[i] == s[i-1]:
        s = s[:i] + "1" + s[i+1:]
    elif s[i-1] == "1" and s[i] == s[i-1]:
        s = s[:i] + "0" + s[i+1:]
print(s)

s = input()
count = 0
for i in range(1,len(s)):
    if s[i-1] == "0" and s[i] == s[i-1]:
        s = s[:i] + "1" + s[i+1:]
        count += 1
    elif s[i-1] == "1" and s[i] == s[i-1]:
        s = s[:i] + "0" + s[i+1:]
        count += 1
print(count)

Verdicts: Wrong Answer

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
S = input()

a = "0b"
for i in range(len(S)):
    if i % 2 == 0:
        a += "0"
    else:
        a += "1"
a = int(a, 2)
b = "0b"
for i in range(len(S)):
    if i % 2 == 0:
        b += "1"
    else:
        b += "0"
b = int(b, 2)
S = int("0b"+S, 2)
S_a = S ^ a
S_b = S ^ b
print(bin(S_a).count("1") if bin(S_a).count("1") < bin(S_a).count("1") else bin(S_b).count("1"))


S = input()

a = "0b"
for i in range(len(S)):
    if i % 2 == 0:
        a += "0"
    else:
        a += "1"
a = int(a, 2)
b = "0b"
for i in range(len(S)):
    if i % 2 == 0:
        b += "1"
    else:
        b += "0"
b = int(b, 2)
S = int("0b"+S, 2)
S_a = S ^ a
S_b = S ^ b
print(bin(S_a).count("1") if bin(S_a).count("1") < bin(S_b).count("1") else bin(S_b).count("1"))


Verdicts: Wrong Answer

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
s = '9' + input()
t = len(s) - 1
A = '9' + '01'*int(t/2) + '0'*int(t%2)
B = '9' + '10'*int(t/2) + '1'*int(t%2)

s = int(s)
A = int(A)
B = int(B)

sa = s^A
sa = sa.count('1')
sb = s^B
sb = sb.count('1')

if sa >= sb:
    print(sa)
else:
    print(sb)

s = '9' + input()
t = len(s)
A = '9' + '01'*int(t/2) + '0'*int(t%2)
B = '9' + '10'*int(t/2) + '1'*int(t%2)

s = int(s)
A = int(A)
B = int(B)

sa = s^A
sa = sa.count('1')
sb = s^B
sb = sb.count('1')

if sa >= sb:
    print(sa)
else:
    print(sb)

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

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

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
import numpy as np
H = input()
H = str.split(H)
H = np.array(H, int)
x = []
y = []
for i in range(len(H)):
    x.append(i%2)
    y.append((i+1)//2)
print(H == np.array(x))
print(H == np.array(y))
a = sum(H == np.array(x))
b = sum(H == np.array(y))

if(a>=b):
    print(len(H)-a)
else:
    print(len(H)-b)

H = input()
H = str.split(H)
H = np.array(H, int)
x = []
y = []
for i in range(len(H)):
    x.append(i%2)
    y.append((i+1)//2)
print(H == np.array(x))
print(H == np.array(y))
a = sum(H == np.array(x))
b = sum(H == np.array(y))

if(a>=b):
    print(len(H)-a)
else:
    print(len(H)-b)

import numpy as np
tmp = str(input())

H = []
for i in range(len(tmp)):
    H.append(int(tmp[i]))

#print(H)
H = np.array(H, int)

#print(H)
x = []
y = []
for i in range(len(H)):
    x.append(i%2)
    y.append((i+1)%2)
#print(H == np.array(x))
#print(H == np.array(y))
a = sum(H == np.array(x))
b = sum(H == np.array(y))

if(a>=b):
    print(len(H)-a)
else:
    print(len(H)-b)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
a = input()
b = a[::2].index('0') + a[1::2].index('1')
c = min(b, len(a) - b)
print(c)

a = list(input())
b = a[::2].index('0') + a[1::2].index('1')
c = min(b, len(a) - b)
print(c)


a = list(input())
b = a[::2].count('0') + a[1::2].count('1')
c = min(b, len(a) - b)
print(c)


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
a=input()
b=int(len(a))
c=0
d=0
for i in range(b):
  if a[2*i]==1:
    c=c+1
  if a[2*1+1]==0:
    c=c+1
for i in range(b):
  if a[2*i]==0:
    d=d+1
  if a[2*1+1]==1:
    d=d+1
if c>d:
  print(d)
else:
  print(c)

a=input()
b=int(len(a))
c=0
d=0
if b%2==0:
  for i in range(b//2):
    if a[2*i]=="1":
      c=c+1
    if a[2*i+1]=="0":
      c=c+1
  for i in range(b//2):
    if a[2*i]=="0":
      d=d+1
    if a[2*i+1]=="1":
      d=d+1
  if c>d:
    print(d)
  else:
    print(c)
if b%2==1:
  for i in range(b//2):
    if a[2*i]=="1":
      c=c+1
    if a[2*i+1]=="0":
      c=c+1
  if a[-1]=="1":
    c=c+1
  for i in range(b//2):
    if a[2*i]=="0":
      d=d+1
    if a[2*i+1]=="1":
      d=d+1
  if a[-1]=="0":
    d=d+1
  if c>d:
    print(d)
  else:
    print(c)

Verdicts: Runtime Error

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
S = input()
li = []
for s in S:
    li.append(int(s))

count = 0
first = li[0]i
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))

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


Verdicts: Runtime Error

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
#2019/10/24
S = list(map(int, list(open(0).read())))
# print(S)
print(S[::2].count(0) + S[1::2].count(1) if S[0]==1 else S[::2].count(1) + S[1::2].count(0)) 

#2019/10/24
# S = list(map(int, list(open(0).read())))
S = list(map(int, input()))
# print(S)
print(S[::2].count(0) + S[1::2].count(1) if S[0]==1 else S[::2].count(1) + S[1::2].count(0)) 

Verdicts: Runtime Error

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

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

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

Verdicts: Wrong Answer

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
li = list(map(input().split()))
sum = 0;
for i in li:
  if(li[i] != li[i + 1]):
    sum += 1
  if((i+1) >= len(li)):
    break;
print(sum)


li = list(input())
sums = 0
leng = int(len(li))

for i in range(leng):
    now = i
    print(now)
    if (now + 1) >= leng:
        print(now)
        break
    if(li[now] == li[now + 1]):
        if(li[now + 1] == '0'):
            li[now + 1] = '1'
        else:
            li[now + 1] = '0'
        sums += 1
print(sums)


li = list(input())
sums = 0
leng = int(len(li))

for i in range(leng):
    now = i
    if (now + 1) >= leng:
        break
    if(li[now] == li[now + 1]):
        if(li[now + 1] == '0'):
            li[now + 1] = '1'
        else:
            li[now + 1] = '0'
        sums += 1
print(sums)


Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.  The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.  You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.  At least how many tiles need to be repainted to satisfy the condition?

Submission attempts (in order):
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))

S = list(input())
n = len(S)

s1 = 0
s2 = 0

for i, j in enumerate(S):
    if i%2 == 0:
        if j == '1':
            s1 += 1
        else:
            s2 += 1
    else:
        if j == '0':
            s2 += 1
        else:
            s1 += 1
print(min(s1, s2))

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

Verdicts: Wrong Answer

Wrong Answer

Accepted