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=[]
for char in input():
  S.append(char)

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

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

  
    
    
      

S=[]
for char in input():
  S.append(char)
  
#route 1
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=[]
for char in input():
  S.append(char)
#route 2
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)

for char in input():
  S.append(char)
#route 1
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
      
#route 2
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 C1>=C2:
  print(C1)
else:
  print(C2)

S=[]
for char in input():
  S.append(char)

#route 1
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

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

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

S=[]
for char in input():
  S.append(char)

#route 2
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
      
#route 1
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

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

  
    
    
      

X=[];S=[]
for char in input():
  X.append(char)
#route 1
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

#route 2
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)

S=[]
for char in '000':
  S.append(char)

#route 2
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
      
#route 1
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

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

  
    
    
      

S=[]
for char in input():
  S.append(char)

#route 1
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

#route 2
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)
  
    
    
      

S=[]
for char in '000':
  S.append(char)

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

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

  
    
    
      

S=[]
for char in str(input()):
  S.append(char)

#route 1
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

#route 2
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)
  
    
    
      

S=[]
for char in '000':
  S.append(char)

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

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

  
    
    
      

S=[]
for char in input():
  S.append(char)
#route 1
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

#route 2
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 C1>=C2:
  print(C1)
else:
  print(C2)

X=[]
for char in input():
  X.append(char)
#route 1
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

#route 2
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)

for char in input():
  S.append(char)
#route 1
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

#route 2
S=X
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 C1>=C2:
  print(C1)
else:
  print(C2)

S=[]
for char in input():
  S.append(char)

#route 1
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

#route 2
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)
  
    
    
      

S=[]
for char in input():
  S.append(char)
#route 1
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

#route 2
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)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Accepted