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):
ースコード 

Copy
Copy

s = input()
len = len(s)
 
if len == 1:
    print(0)
    exit()
 
even = s[::2]
odd = s[1::2]
 

# 0101...
odd_zero = odd.count("0")
even_one = even.count("1")
 
 

# 1010...
odd_one = odd.count("1")
even_zero = even.count("0")
 
print(min(odd_zero + even_one, odd_one + even_zero))

ースコード 

Copy
Copy

s = input()
len = len(s)
 
if len == 1:
    print(0)
    exit()
 
even = s[::2]
odd = s[1::2]
 

# 0101...
odd_zero = odd.count("0")
even_one = even.count("1")
 
 

# 1010...
odd_one = odd.count("1")
even_zero = even.count("0")
 
print(min(odd_zero + even_one, odd_one + even_zero))

s = input()
l= len(s)
 
if l== 1:
    print(0)
    exit()
 
even = s[::2]
odd = s[1::2]

odd_zero = odd.count("0")
even_one = even.count("1")
 

odd_one = odd.count("1")
even_zero = even.count("0")
 
print(min(odd_zero + even_one, odd_one + even_zero))

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):
import sys

def judge(string):
    mem = ""
    for char in string:
        if mem == char:
            return False
        mem = char

    return True


def main():
    sinputl = sys.stdin.readline

    input = sinputl().strip()
    length = len(input)
    input = int(input, base=2)

    paint = [length]

    for i in range(2 ** length):
        status = input ^ i
        print(bin(status)[2:].zfill(length))
        if judge(bin(status)[2:].zfill(length)):
            paint.append(bin(i).count('1'))

        
    print(min(paint))


if __name__ == "__main__":
    main()

import sys

def main():
    sinputl = sys.stdin.readline

    input = sinputl().strip()
    length = len(input)
    string1 = "10" * (length // 2) + "1" * (length % 2)
    string2 = "01" * (length // 2) + "0" * (length % 2)
    count1 = 0
    count2 = 0

    for i in range(length):
        if input[i] != string1[i]:
            count1 += 1

    for i in range(length):
        if input[i] != string2[i]:
            count2 += 1

    print(min(count1, count2))


if __name__ == "__main__":
    main()

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 numpy as np
n=input()
def check(n,st_num):
    count=0
    dic={1:1,0:2}
    for i in range(1,-(-len(n)//2)):
        try:
            if n[2*i]+n[2*i+1]==st_num:
                count+=0
            else:
                count+=dic[abs(int(n[2*i])+int(n[2*i+1])-1)]
        except:
            if n[2*i]!=st_num[0]:
                count+=1
    
    return count
    
    
if n[:2]=="10":
    print(check(n,"10"))
elif n[:2]=="01":
    print(check(n,"01"))
else:
    print(0 if len(n)==1 else check(n,"10")+1)

n=input()
def check(n,st_num):
    count=0
    dic={1:1,0:2}
    for i in range(1,-(-len(n)//2)):
        try:
            if n[2*i]+n[2*i+1]==st_num:
                count+=0
            else:
                count+=dic[abs(int(n[2*i])+int(n[2*i+1])-1)]
        except:
            if n[2*i]!=st_num[0]:
                count+=1
    
    return count
    
if '1' not in n:
    print(n//2)
if n[:2]=="10":
    print(check(n,"10"))
elif n[:2]=="01":
    print(check(n,"01"))
else:
    print(0 if len(n)==1 else check(n,"10")+1)

n=input()
def check(n,st_num):
    count=0
    dic={1:1,0:2}
    for i in range(1,-(-len(n)//2)):
        try:
            if n[2*i]+n[2*i+1]==st_num:
                count+=0
            else:
                count+=dic[abs(int(n[2*i])+int(n[2*i+1])-1)]
        except:
            if n[2*i]!=st_num[0]:
                count+=1
    
    return count
    
if '1' not in n:
    print(len(n)//2)
if n[:2]=="10":
    print(check(n,"10"))
elif n[:2]=="01":
    print(check(n,"01"))
else:
    print(0 if len(n)==1 else check(n,"10")+1)

#124
n=input()
def check(n,st_num):
    count=0
    dic={1:1,0:2}
    for i in range(1,-(-len(n)//2)):
        try:
            if n[2*i]+n[2*i+1]==st_num:
                count+=0
            else:
                count+=dic[abs(int(n[2*i])+int(n[2*i+1])-1)]
        except:
            if n[2*i]!=st_num[0]:
                count+=1
    
    return count
    
if '1' not in n:
    print(len(n)//2)
    exit()
if n[:2]=="10":
    print(check(n,"10"))
elif n[:2]=="01":
    print(check(n,"01"))
else:
    print(0 if len(n)==1 else min([check(n,"10")+1,check(n,"01")+1]))

Verdicts: Wrong Answer

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):
n = input()
c1 = c2 = 0
l = len(n)
c1 = l - len([i for i in l[0::2] if i == "0"]) - len([i for i in l[1::2] if i == "1"])
c2 = l - len([i for i in l[0::2] if i == "1"]) - len([i for i in l[1::2] if i == "0"])

print(min(c1,c2))

n = input()
c1=c2=0
l = len(n)
c1 = n - len([i for i in l[0::2] if i == "0"]) - len([i for i in l[1::2] if i == "1"])
c2 = n - len([i for i in l[0::2] if i == "1"]) - len([i for i in l[1::2] if i == "0"])

print(min(c1,c2))

n = input()
c1=c2=0
l = len(n)
c1 = n - (len([i for i in l[0::2] if i == "0"])) - (len([i for i in l[1::2] if i == "1"]))
c2 = n - (len([i for i in l[0::2] if i == "1"])) - (len([i for i in l[1::2] if i == "0"]))

print(min(c1,c2))

n = input()
c1=c2=0
l = len(n)
c1 = l - len([i for i in l[0::2] if i == "0"]) - len([i for i in l[1::2] if i == "1"])
c2 = l - len([i for i in l[0::2] if i == "1"]) - len([i for i in l[1::2] if i == "0"])

print(min(c1,c2))

n = input()
c1 = c2 = 0
l = len(n)
c1 = l - len([i for i in n[0::2] if i == "0"]) - len([i for i in n[1::2] if i == "1"])
c2 = l - len([i for i in n[0::2] if i == "1"]) - len([i for i in n[1::2] if i == "0"])

print(min(c1,c2))
                                                                 

Verdicts: Runtime Error

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 sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def ii(): return int(stdin.readline())
def li(): return map(int, stdin.readline().split())
S = stdin.readline()
L = len(S)
cnt = 0
# 0101010101
for i, s in enumerate(S):
    if i & 1 == 1:
        incr = 1 if s == '1' else 0
        cnt += incr
    else:
        incr = 1 if s == '0' else 0
        cnt += incr
print(min(cnt, L-cnt))


import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def ii(): return int(stdin.readline())
def li(): return map(int, stdin.readline().split())
S = stdin.readline()
L = len(S)
cnt = 0
# 0101010101
for i, s in enumerate(S):
    if i & 1 == 1:
        cnt += 1 if s == '1' else 0
    else:
        cnt += 1 if s == "0" else 0
print(min(cnt, L-cnt))


import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def ii(): return int(stdin.readline())
def li(): return map(int, stdin.readline().split())
S = stdin.readline()
L = len(S)
cnt = 0
cnt1 = 0
# 0101010101
for i, s in enumerate(S):
    if i & 1 == 1:
        incr = 1 if s == '1' else 0
        cnt += incr
    else:
        incr = 1 if s == '0' else 0
        cnt += incr
for i, s in enumerate(S):
    if i & 1 == 1:
        incr = 1 if s == '0' else 0
        cnt1 += incr
    else:
        incr = 1 if s == '1' else 0
        cnt1 += incr
print(min(cnt, cnt1))


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 = input()
x, count0, count1 = 0
for i in s:
    count0 = count0+1 if i==str(x) else count0
    x = int(not(x))
x = 1
for i in s:
    count1 = count1 + 1 if i == str(x) else count1
    x = int(not(x))
print(min(count0, count1))



v=input()

if len(v)%2 != 0 and len(v) > 1:
    v += (str(int(not(v[len(v)-1]))))


s = [v[i: i+2] for i in range(0, len(v), 2)]

list = [0]*4

for i in s:
    #print(i)

    if i == "00":
        list[0] += 1
    elif i == "01":
        list[1] += 1
    elif i == "10":
        list[2] += 1
    elif i == "11":
        list[3] += 1

if list[1] > list[2]:
    print(list[0]*1+list[2]*2+list[3]*1)
    result = list[0]*1+list[2]*2+list[3]*1
elif list[1] < list[2]:
    print(list[0]*1+list[1]*2+list[3]*1)
    result = list[0]*1+list[1]*2+list[3]*1
else:
    print(list[0]*1+list[1]*2+list[3]*1)
    result = list[0]*1+list[1]*2+list[3]*1
#print(list)
#print("result:" + str(result))


s = ",".join(s)
s = s.replace(",", "")


if len(s) % 2 == 0:
  s1 = "10" * int(len(s) / 2)
  s2 = "01" * int(len(s) / 2)
else:
  s1 = "10" * int(len(s) / 2) + "1"
  s2 = "01" * int(len(s) / 2) + "0"
a1 = int(s) + int(s1)
a2 = int(s) + int(s2)
a1 = str(a1).count("1")
a2 = str(a2).count("1")
#print(min(a1,a2))
result2 = min(a1, a2)
#print("result2:" + str(result2))

"""
if result != result2:
    print(bin(a))
    print("result:" + str(result))
    print("result2:" + str(result2) + "\n")
    print(False)

#print(bin(a))
#print("result:" + str(result))
#print("result2:" + str(result2) + "\n")
"""


s = input()
x = 0
count0 = 0
count1 = 0
for i in s:
    count0 = count0+1 if i==str(x) else count0
    x = int(not(x))
x = 1
for i in s:
    count1 = count1 + 1 if i == str(x) else count1
    x = int(not(x))
print(min(count0, count1))

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):
char_list = list(input())
count1 = 0
count2 = 0
if len(char_list) == 1:
    print(count)
else:
    for i in char_list:
        if i % 2 == 0
            if char_list[i] is "0"
                continue
            else:
                count1 += 1
        else:
            if char_list[i] is "1"
                continue
            else:
                count1 += 1
    for i in char_list:
        if i % 2 == 0
            if char_list[i] is "1"
                continue
            else:
                count2 += 1
        else:
            if char_list[i] is "0"
                continue
            else:
                count2 += 1
print(min(count1,count2))

char_list = list(input())
count1 = 0
count2 = 0
if len(char_list) == 1:
    print(0)
else:
    for i in range(len(char_list)):
        if i % 2 == 0:
            if char_list[i] is "0":
                continue
            else:
                count1 += 1
        else:
            if char_list[i] is "1":
                continue
            else:
                count1 += 1
    for i in range(len(char_list)):
        if i % 2 == 0:
            if char_list[i] is "1":
                continue
            else:
                count2 += 1
        else:
            if char_list[i] is "0":
                continue
            else:
                count2 += 1
    print(min(count1,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):
def main(s):
    pattern1 = ["0" if i % 2 == 0 else "1" for i in range(len(s))]
    pattern2 = ["1" if i % 2 == 0 else "0" for i in range(len(s))]
    dist1 = 0
    dist2 = 0
    for i in range(len(s)):
        if s[i] != pattern1[i]:
            dist1 += 1
        if s[i] != pattern2[i]:
            dist2 += 1

    return min(dist1, dist2)

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

    return min(dist1, dist2)


s = input()



print(main(s))


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

print(s)
count =0
for xi in range(len(s)):
    if xi%2 ==0:t="0"
    if xi%2 ==1:t="1"

    if s[xi]==t:
        count+=1

# print(count)
print(min(count,len(s)-count))


s = str(input())

print(s)
count =0
for xi in range(len(s)):
    if xi%2 ==0:t="0"
    if xi%2 ==1:t="1"

    if s[xi]==t:
        count+=1

# print(count)
print(min(count,len(s)-count))


s = str(input())

# print(s)
count =0
for xi in range(len(s)):
    if xi%2 ==0:t="0"
    if xi%2 ==1:t="1"

    if s[xi]==t:
        count+=1

# print(count)
print(min(count,len(s)-count))


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):
lis = [int(input()) for _ in range(6)]
if lis[0]/min(lis[1:]) == 1:
  print(5)
else:
  print(lis[0]//min(lis[1:])+5)

lis = [int(input()) for _ in range(6)]
if lis[0] % min(lis[1:]) == 0:
  print(5)
else:
  print(lis[0]//min(lis[1:])+5)

lis = [int(input()) for _ in range(6)]
if lis[0] % min(lis[1:]) == 0:
  print(5)
else:
  print(lis[0]//min(lis[1:])+5)
  

From0 = ['0','1']*(10**6)
From1 = ['1','0']*(10**6)
s = list(input())
F0 = From0[:len(s)]
F1 = From1[:len(s)]
count_0 = 0
count_1 = 0
for i in range(len(s)):
  if s[i] != F0[i]:
    count_0 += 1
for i in range(len(s)):
  if s[i] != F1[i]:
    count_1 += 1
print(min(count_0,count_1))


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):
s = int(input())

start0 = 0
start1 = 0
for i in range(len(s)):
  if i % 2 == 0:
    if s[i] == "0":
      start1 += 1
    elif s[i] == "1":
      start0 += 1
  elif i % 2 == 1:
    if s[i] == "0":
      start0 += 1
    elif s[i] == "1":
      start1 += 1

print(min([start0, start1]))

s = input()
 
start0 = 0
start1 = 0
for i in range(len(s)):
  if i % 2 == 0:
    if s[i] == "0":
      start1 += 1
    elif s[i] == "1":
      start0 += 1
  elif i % 2 == 1:
    if s[i] == "0":
      start0 += 1
    elif s[i] == "1":
      start1 += 1

print(min([start0, start1]))

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):
str = input()
S = list(str)
N = len(S)
count = 0
for x in range(N):
    if x % 2 == 0 and S[x] == "0":
        count += 1
    elif x % 2 == 1 and S[x] == "1":
        count += 1
if count >= 50000:
    print(count - 50000)
else:
    print(count)



N = int(input())
H = [int(x) for x in input().split()]
count = 0
for i in range(N):
  for j in range(i):
    if H[i] < H[j]:
      break
  else:
      count+=1
print(count)


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


Verdicts: Wrong Answer

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

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


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()
result1=0
result2=0
if S[0]=='1':
    for i in range(len(S)):
        if i%2==0:
            if S[i]=='0':
                result1+=1
            if S[i]=='1':
                result2+=1
        else:
            if S[i]=='1':
                result1+=1
            if S[i]=='0':
                result2+=1
    print(min(result1,result2))
else:
     for i in range(len(S)):
        if i%2==0:
            if S[i]=='0':
                result1+=1
            if S[i]=='1':
                result2+=1
        else:
            if S[i]=='1':
                result1+=1
            if S[i]=='0':
                result2+=1
    print(min(result1,result2))

S=input()
result1=0
result2=0
if S[0]=='1':
    for i in range(len(S)):
        if i%2==0:
            if S[i]=='0':
                result1+=1
            if S[i]=='1':
                result2+=1
        else:
            if S[i]=='1':
                result1+=1
            if S[i]=='0':
                result2+=1
    print(min(result1,result2))
else:
    for i in range(len(S)):
        if i%2==0:
            if S[i]=='0':
                result1+=1
            if S[i]=='1':
                result2+=1
        else:
            if S[i]=='1':
                result1+=1
            if S[i]=='0':
                result2+=1
    print(min(result1,result2))

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 numpy as np
S = input()
N = len(S)
if N // 2 == 0:
  even = np.array([S[2*k] for k in range(N // 2)])
  odd = np.array([S[2*k + 1] for k in range(N // 2)])
  even_1 = even.sum()
  odd_1 = odd.sum()
  if even_1 > odd_1:
    print(N//2 - even_1 + odd_1)
  else:
    print(N//2 + even_1 - odd_1)
else:
  even = np.array([S[2*k] for k in range( (N+1) // 2)])
  odd = np.array([S[2*k + 1] for k in range(N // 2)])
  even_1 = even.sum()
  odd_1 = odd.sum()
  if even_1 <= odd_1:
    print(even_1 + N//2 - odd_1)
  else:
    print(odd_1 + (N+1)//2 - even_1)

import numpy as np
S = input()
N = len(S)
if N // 2 == 0:
  even = np.array([int(S[2*k]) for k in range(N // 2)])
  odd = np.array([int(S[2*k + 1]) for k in range(N // 2)])
  even_1 = even.sum()
  odd_1 = odd.sum()
  if even_1 > odd_1:
    print(int(N//2 - even_1 + odd_1))
  else:
    print(int(N//2 + even_1 - odd_1))
else:
  even = np.array([int(S[2*k]) for k in range( (N+1) // 2)])
  odd = np.array([int(S[2*k + 1]) for k in range(N // 2)])
  even_1 = even.sum()
  odd_1 = odd.sum()
  if even_1 <= odd_1:
    print(int(even_1 + N//2 - odd_1))
  else:
    print(int(odd_1 + (N+1)//2 - even_1))

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 = str(input())

print(s)

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

s = str(input())

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

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


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)

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):
from collections import Counter

s = input()
odd = [int(s[i]) for i in range(len(s)) if i % 2]
even = [int(s[i]) for i in range(len(s)) if not i % 2]

odd_c = Counter(odd)
freq_odd = odd_c.most_common()
even_c = Counter(even)
freq_even = even_c.most_common()

if len(odd) == 0 or len(even) == 0:
  count = 0
elif len(freq_odd) == 1 or len(freq_even) == 1:
  if len(freq_odd) > len(freq_even):
    if freq_even[0][0] ==  0:
      count = freq_odd[1][1]
    else:
      count = freq_odd[0][1]
  else:
    if freq_odd[0][0] ==  0:
      count = freq_even[1][1]
    else:
      count = freq_even[0][1]
else:
  if freq_odd[0][1] >= freq_even[0][1]:
    count = freq_even[0][1] + freq_odd[1][1]
  else:
    count = freq_odd[0][1] + freq_even[1][1]

print(count)

s = input()

if len(s) % 2:
  white_black = '10' * (len(s) // 2) + '1'
  black_white = '01' * (len(s) // 2) + '0'
else:
  white_black = '10' * (len(s) // 2)
  black_white = '01' * (len(s) // 2)

if s == white_black or s == black_white:
  count = 0
else:
  diff_wb = sum([len(x) for x, y in zip(s, white_black) if x != y])
  diff_bw = sum([len(x) for x, y in zip(s, black_white) if x != y])
  count = min(diff_wb, diff_bw)

print(count)

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):
def main():
    s = input()
    n = len(s)
    a = 0
    b = 0
    for i in range(n):
        if i & 1:
            if arr[i] == '1':
                a += 1
            else:
                b += 1
        else:
            if arr[i] == '1':
                b += 1
            else:
                a += 1
        print(min(a, b))
    return 0
main()

def main():
    s = input()
    n = len(s)
    a = 0
    b = 0
    for i in range(n):
        if i & 1:
            if s[i] == '1':
                a += 1
            else:
                b += 1
        else:
            if s[i] == '1':
                b += 1
            else:
                a += 1
        print(min(a, b))
    return 0
main()

def main():
    s = input()
    n = len(s)
    a = 0
    b = 0
    for i in range(n):
        if i & 1:
            if s[i] == '1':
                a += 1
            else:
                b += 1
        else:
            if s[i] == '1':
                b += 1
            else:
                a += 1
    print(min(a, b))
    return 0
main()

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

# -*- coding: utf-8 -*-

s = list(input())

cnt1=0
for i in range(len(s)):
        if s[i] is i%2:
                cnt1 += 1

cnt2=0
for i in range(len(s)):
        if s[i] is (i+1)%2:
                cnt2 += 1

print(min(cnt1,cnt2))


# -*- coding: utf-8 -*-

s = list(input())

cnt1=0
for i in range(len(s)):
        if s[i] is i%2:
                count1 += 1

cnt2=0
for i in range(len(s)):
        if s[i] is (i+1)%2:
                count1 += 1

print(min(cnt1,cnt2))


# -*- coding: utf-8 -*-

s = list(input())
cnt1=0
for i in range(len(s)):
        if int(s[i]) == i%2:
                cnt1 += 1

cnt2=0
for i in range(len(s)):
        if int(s[i]) == (i+1)%2:
                cnt2 += 1

print(min(cnt1,cnt2))

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=str(input())
cnt1=0
cnt2=0
for i in range(len(s)):
    if i%2==0:
        if s[i]=="0":
            cnt1+=1
            print(s[i])
        else:
            continue
    if i%2!=0:
        if s[i]==1:
            cnt1+=1
        else:
            continue
            
        


for i in range(len(s)):
    if i%2!=0:
        if s[i]=="0":
            cnt2+=1
        else:
            continue
    if i%2==0:
        if s[i]=="1":
            cnt2+=1
        else:
            continue
            
print(min(cnt1,cnt2))

s=str(input())
cnt=0
for i in range(len(s)):
    if i%2==0:
        if s[i]=="0":
            cnt+=1
        else:
            continue
    if i%2!=0:
        if s[i]=="1":
            cnt+=1
        else:
            continue
print(min(cnt,len(s)-cnt))

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):
a  = input()
s = 0
t = 0
k = ["0","1"]
for n,i in enumerate(a):
  if i != k[(n%2)]:
    s+=1
  if i != k[(n%2)+1]:
    t+=1
print(min(s,t))
  
  

a  = input()
s = 0
t = 0
k = ["0","1"]
for n,i in enumerate(a):
  if i != k[(n%2)]:
    s+=1
  if i != k[(n+1)%2]:
    t+=1
print(min(s,t))
  
  

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):
tiles = input()

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

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

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

tiles = input()

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

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



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

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 math
number = int(input())
if (number != 0):
    digit = int(math.log10(number))
else :
    digit=0

a=[]
while(True):
    if (number%10==0):
        a.append("0")
    elif (number%10!=0):
        a.append("1")
    
    number= int(number/10)
    if (number == 0):
        break
b= []
i = digit

while(i !=-1):
    b.append(a[i])
    i -= 1
print(b)

count1=0
count2=0
for j in range(0,digit+1):
    if (j % 2 ==0):
        if b[j]=="1":
            count1 +=1 
    elif (j %2 ==1):
        if b[j]=="0":
            count1 +=1
for j in range(0,digit):
    if (j % 2 ==0):
        if b[j]=="0":
            count2 +=1 
    elif (j %2 ==1):
        if b[j]=="1":
            count2 +=1
print(min(count1,count2))


def case_1 (S,size):
    count=0
    for i in range(0,size):
        if (i%2==0):
            if(int(S[i])==0):
                count+=1
        else:
            if(int(S[i])==1):
                count+=1
    return count

def case_2 (S,size):
    count=0
    for i in range(0,size):
        if (i%2==1):
            if(int(S[i])==0):
                count+=1
        else:
            if(int(S[i])==1):
                count+=1
    return count

S=str(input())
size=len(S)
can_1=case_1(S,size)
can_2=case_2(S,size)
print(min(can_1,can_2))

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=str(input())
s=len(S)
Sk=[]
Sg=[]
for i in range(0,s,2):
    Sk.append(Sstr[i])
for i in range(1,s,2):
    Sg.append(Sstr[i])
Sk0=Sk.count('0')
Sk1=Sk.count('1')
Sg0=Sg.count('0')
Sg1=Sg.count('1')
Stotal=[Sk0,Sk1,Sg0,Sg1]
if Sk0+Sg1<Sk1+Sg0:
    print(Sk0+Sg1)
else:
    print(Sk1+Sg0)

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

S=int(input())
Sstr=str(S)
s=len(Sstr)
Sk=[]
Sg=[]
for i in range(0,s,2):
    Sk.append(Sstr[i])
for i in range(1,s,2):
    Sg.append(Sstr[i])
Sk0=Sk.count('0')
Sk1=Sk.count('1')
Sg0=Sg.count('0')
Sg1=Sg.count('1')
Stotal=[Sk0,Sk1,Sg0,Sg1]
if Sk0+Sg1<Sk1+Sg0:
    print(Sk0+Sg1)
else:
    print(Sk1+Sg0)

S=str(input())
s=len(S)
Sk=[]
Sg=[]
for i in range(0,s,2):
    Sk.append(S[i])
for i in range(1,s,2):
    Sg.append(S[i])
Sk0=Sk.count('0')
Sk1=Sk.count('1')
Sg0=Sg.count('0')
Sg1=Sg.count('1')
Stotal=[Sk0,Sk1,Sg0,Sg1]
if Sk0+Sg1<Sk1+Sg0:
    print(Sk0+Sg1)
else:
    print(Sk1+Sg0)

Verdicts: 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):
n=input()
li=list(n)
if len(n)==1:
  print(0)
elif len(n)%2==0 and len(n) != 1:
  counta=0 
  countb=0
  a=list("10"*int((int(n)/2)))
  b=list("01"*int((int(n)/2)))
  for i in range(len(n)):
    counta+= abs(int(li[i])-int(a[i]))
    countb+=abs(int(li[i])-int(b[i]))
  print(min(counta,countb))

elif len(n)%2==1 and len(n) != 1:
  countaa=0 
  countbb=0
  aa=list("10"*int(((int(n)-1)/2))+"1")
  bb=list("01"*int(((int(n)-1)/2))+"0")
  for i in range(len(n)):
    countaa+=abs(int(li[i])-int(a[i]))
    countbb+=abs(int(li[i])-int(b[i]))
  print(min(countaa,countbb))

n=input()
li=list(n)
if len(n)==1:
  print(0)
elif len(n)%2==0:
  counta=0 
  countb=0
  a=list("10"*int((int(n)/2)))
  b=list("01"*int((int(n)/2)))
  for i in range(len(n)):
    counta+= abs(int(li[i])-int(a[i]))
    countb+=abs(int(li[i])-int(b[i]))
  print(min(counta,countb))

elif len(n)%2==1 and len(n) != 1:
  countaa=0 
  countbb=0
  aa=list("10"*int(((int(n)-1)/2))+"1")
  bb=list("01"*int(((int(n)-1)/2))+"0")
  for i in range(len(n)):
    countaa+=abs(int(li[i])-int(aa[i]))
    countbb+=abs(int(li[i])-int(bb[i]))
  print(min(countaa,countbb))

n=input()
li=list(n)
if len(n)==1:
  print(0)
elif len(n)%2==0:
  counta=0 
  countb=0
  a=list("10"*int((int(len(n))/2)))
  b=list("01"*int((int(len(n))/2)))
  for i in range(len(n)):
    counta+= abs(int(li[i])-int(a[i]))
    countb+=abs(int(li[i])-int(b[i]))
  print(min(counta,countb))

elif len(n)%2==1 and len(n) != 1:
  countaa=0 
  countbb=0
  aa=list("10"*int(((int(len(n))-1)/2))+"1")
  bb=list("01"*int(((int(len(n))-1)/2))+"0")
  for i in range(len(n)):
    countaa+=abs(int(li[i])-int(aa[i]))
    countbb+=abs(int(li[i])-int(bb[i]))
  print(min(countaa,countbb))


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):
s=input()
s=list(s)
n=len(s)
acnt=1
bcnt=1
for i in range(n):
    if i!=n-1 and s[i]==s[i+1]:
        a=s[:]
        if s[i]=='0':
            s[i]='1'
        else:
            s[i]='0'
        for j in range(n):
            if j!=n-1 and s[j]==s[j+1]:
                if s[j]=='0': 
                    s[j+1]='1'
                    acnt+=1
                else:
                    s[j+1]='0'
                    acnt+=1
                        
        if a[i]=='0':
            a[i+1]='1'
        else:
            a[i+1]='0'
        for k in range(n):
            if k!=n-1 and a[k]==a[k+1]:
                if a[k]=='0':
                    a[k+1]='1'
                    bcnt+=1
                else:
                    a[k+1]='0'
                    bcnt+=1
                    
        break
if n==1 or bcnt==1 or acnt==1: print(0)
else: print(min(bcnt,acnt))

s=input()
s=list(s)
n=len(s)
acnt=1
bcnt=1
flag=False
for i in range(n):
    if i!=n-1 and s[i]==s[i+1]:
        flag=True
        a=s[:]
        if s[i]=='0':
            s[i]='1'
        else:
            s[i]='0'
        for j in range(n):
            if j!=n-1 and s[j]==s[j+1]:
                if s[j]=='0': 
                    s[j+1]='1'
                    acnt+=1
                else:
                    s[j+1]='0'
                    acnt+=1
                        
        if a[i]=='0':
            a[i+1]='1'
        else:
            a[i+1]='0'
        for k in range(n):
            if k!=n-1 and a[k]==a[k+1]:
                if a[k]=='0':
                    a[k+1]='1'
                    bcnt+=1
                else:
                    a[k+1]='0'
                    bcnt+=1
                    
        break
if n==1 or flag==False: print(0)
else: print(min(bcnt,acnt))

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

count_1010 = 0
count_0101 = 0


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


for j in range(len(S)):
    
    if i % 2 == 0:
        if S[j] != "0":
            S[j] = "0"
            count_0101 += 1
    
    else:
        if S[j] != "1":
            S[i] = "1"
            count_0101 += 1


print(min(count_0101, count_1010))


S = list(input())

N = len(S)
count_1010 = 0
count_0101 = 0


for i in range(N):
    
    if i % 2 == 0:
        if S[i] != "1":
            count_1010 += 1
    
    else:
        if S[i] != "0":
            count_1010 += 1


for j in range(N):
    
    if i % 2 == 0:
        if S[j] != "0":
            count_0101 += 1
    
    else:
        if S[j] != "1":
            count_0101 += 1


print(min(count_0101, count_1010))


S = list(input())

N = len(S)
count_1010 = 0
count_0101 = 0


for i in range(N):
    
    if i % 2 == 0:
        if S[i] != "1":
            S[i] = "1"
            count_1010 += 1
    
    else:
        if S[i] != "0":
            S[i] = "0"
            count_1010 += 1


for j in range(N):
    
    if j % 2 == 0:
        if S[j] != "0":
            S[j] = "0"
            count_0101 += 1
    
    else:
        if S[j] != "1":
            S[j] = "1"
            count_0101 += 1


print(min(count_0101, count_1010))


S = list(input())

N = len(S)
count_1010 = 0
count_0101 = 0


for i in range(N):
    
    if i % 2 == 0:
        if S[i] != "1":
            count_1010 += 1
    
    else:
        if S[i] != "0":
            count_1010 += 1


for j in range(N):
    
    if j % 2 == 0:
        if S[j] != "0":
            count_0101 += 1
    
    else:
        if S[j] != "1":
            count_0101 += 1


print(min(count_0101, count_1010))

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):
import sys

rr = lambda: sys.stdin.readline().rstrip()

s = rr()
cnt = 0
for i in range(len(s) - 1):
  si = s[i]
  si1 = s[i+1]
  if si & si1:
    continue
  else:
    s[i+1] = si
    cnt += 1
print(cnt)




import sys

rr = lambda: sys.stdin.readline().rstrip()

s = list(rr())
cnt = 0
for i in range(len(s)-1):
  si = s[i]
  si1 = s[i+1]
  if si == si1:
    if si == '0':
      s[i+1] = '1'
    else:
      s[i+1] = '0'
    cnt += 1
print(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 sys
n,k = map(str, input().split())
s = list(str(input()))

zero_count_list = []
zero_count = 0
one_count_list = []
one_count = 0
s_size = len(s)

for index, i in enumerate(s):
    if i == "0":
        zero_count += 1
    else:
        if zero_count != 0:
            zero_count_list.append(zero_count)
        zero_count = 0
    if index == s_size - 1:
        if zero_count != 0:
            zero_count_list.append(zero_count)

for index, i in enumerate(s):
    if i == "1":
        one_count += 1
    else:
        if one_count != 0:
            one_count_list.append(one_count)
        one_count = 0
    if index == s_size - 1:
        if one_count != 0:
            one_count_list.append(one_count)
if k => len(zero_count_list):
    print(s_size)
    sys.exit(0)

s = list(input())
first_zero = []
first_one = []
s_size = len(s)
for i in range(s_size):
    if i % 2 == 0:
        first_zero.append("0")
        first_one.append("1")
    else:
        first_zero.append("1")
        first_one.append("0")

count_zero = 0
count_one = 0

for index,number in enumerate(s):
    if number == first_zero[index]:
        pass
    else:
        count_zero += 1

    if number == first_one[index]:
        pass
    else:
        count_one += 1

if count_one > count_zero:
    print(count_zero)
else:
    print(count_one)

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()
c = 0
zo = 0
oz = 0
for i in range(0, len(S), 2):
    if S[i] == '0':
        oz += 1
    else:
        zo += 1
    if S[i+1] == '0':
        zo += 1
    else:
        oz += 1
if len(S) & 1:
    if S[-1] == '0':
        oz += 1
print(min(oz, zo))

S = input()
c = 0
zo = 0 
oz = 0 # one-zero
for i in range(0, len(S)//2 * 2, 2):
    if S[i] == '0':
        oz += 1
    else:
        zo += 1
    if S[i+1] == '0':
        zo += 1
    else:
        oz += 1
if len(S) & 1:
    if S[-1] == '0':
        oz += 1
    else:
        zo += 1
print(min(oz, zo))

Verdicts: Runtime Error

Accepted