qyliang/CodeNanoFix huggingface dataset:
Buggy code:
sin = input()
queue = deque(maxlen=len(sin))
for s in sin:
    if len(queue)>0 and queue[-1] != s:
        queue.pop()
    else:
        queue.append(s)
#print("".join(arr))
print(len(sin)-len(queue))

Fixed code:
from collections import deque
sin = input()
queue = deque(maxlen=len(sin))
for s in sin:
    if len(queue)>0 and queue[-1] != s:
        queue.pop()
    else:
        queue.append(s)
#print("".join(arr))
print(len(sin)-len(queue))
Buggy code:
s=input()
a=s.count("1")
b=s.count("2")

print(min(a,b)*2)


Fixed code:
s=input()
a=s.count("1")
b=s.count("0")

print(min(a,b)*2)
Buggy code:
S = input()

c0=0
c1=0
for i in S:
  if i == '0':
    c0+=1
  elif:
    c1+=1

print(2*min(c0,c1))


Fixed code:
S = input()

c0=0
c1=0
for i in S:
  if i == '0':
    c0+=1
  else:
    c1+=1

print(2*min(c0,c1))
Buggy code:
s=str(input())
ue=-1
ans=0
for i in range(len(s)):
  if(ue==-1):
    ue=int(s[i])
  elif(int(s[i])==ue):
    ans+=2
    if(ans==i+1):
      ue=-1
    else:
      ue=1-ue
  else:
    ue=1-ue
print(ans)


Fixed code:
s=str(input())
ue=-1
ans=0
for i in range(len(s)):
  if(ue==-1):
    ue=int(s[i])
  elif(int(s[i])!=ue):
    ans+=2
    if(ans==i+1):
      ue=-1
print(ans)
Buggy code:
s = input()
if len(s) == 1:
    print(0)
else:
    count0 = 0
    count1 = 0
    for i in range(len(s)):
        if s[i:i+1] == "0":
            count0 += 1
        else:
            count1 += 1
    print(2*max([count0,count1]))

Fixed code:
s = input()
if len(s) == 1:
    print(0)
else:
    count0 = 0
    count1 = 0
    for i in range(len(s)):
        if s[i:i+1] == "0":
            count0 += 1
        else:
            count1 += 1
    print(2*min([count0,count1]))
Buggy code:
N = int(input())
n = list(map(int, list(str(N))))

def solve():
    ones = sum(n)
    zeros = len(n) - ones
    return len(n) - abs(ones - zeros)

print(solve())

Fixed code:
N = input()
n = list(map(int, list(N)))

def solve():
    ones = sum(n)
    zeros = len(n) - ones
    return len(n) - abs(ones - zeros)

print(solve())
Buggy code:
s = list(input())
cnt1 = 0
cnt0 = 0
for i in s:
    if i == '1':
        cnt1 += 1
    else:
        cnt0 += 1
print(min(cnt1, cnt0))



Fixed code:
s = list(input())
cnt1 = 0
cnt0 = 0
for i in s:
    if i == '1':
        cnt1 += 1
    else:
        cnt0 += 1
print(2*min(cnt1, cnt0))
Buggy code:
S = input()

count_0 = 0
count_1 = 1
for s in S:
    if s == "0":
        count_0 += 1
    else:
        count_1 += 1
        
print(2 * min(count_0, count_1))

Fixed code:
S = input()

count_0 = 0
count_1 = 0
for s in S:
    if s == "0":
        count_0 += 1
    else:
        count_1 += 1
        
print(2 * min(count_0, count_1))
Buggy code:
s = list(input())
print(min(s.count("1"),s.count("0")*2))

Fixed code:
s = input()
print(min(s.count("1"),s.count("0"))*2)
Buggy code:

S = input()
work=list(S)
i=0
o_cout=0
z_cout=0
for x in work:
    if(x=='1'):
        o_cout+=1
    else:
        z_cout+=1
    
if(o_cout>z_cout):
    cout=o_cout
else:
    cout=z_cout
    

print(cout*2)

Fixed code:

S = input()
work=list(S)
i=0
o_cout=0
z_cout=0
for x in work:
    if(x=='1'):
        o_cout+=1
    else:
        z_cout+=1
    
if(o_cout>z_cout):
    cout=z_cout
else:
    cout=o_cout
    

print(cout*2)
Buggy code:
one = len([i for i in s if i == '1'])
zero = len(s)- one

print(2*min(one,zero))

Fixed code:
s  = input()

one = len([i for i in s if i == '1'])
zero = len(s)- one

print(2*min(one,zero))
Buggy code:
s=input()
c=s.count("1")
print(2*(min(c,n-c)))

Fixed code:
s=input()
n=len(s)
c=s.count("1")
print(2*(min(c,n-c)))
Buggy code:
from collections import deque

s=input()
sd=deque(s)
d=deque()
while(len(sd)>0):
  crr = sd.popleft()
  if(len(d)<1):
    d.append(crr)
    continue
    if(len(d)>=1 and d[-1]!=crr):
      d.pop()
      else:
        d.append(crr)
print(len(s)-len(d))

Fixed code:
from collections import deque
 
s=input()
sd=deque(s)
d=deque()
while(len(sd)>0):
  crr = sd.popleft()
  if(len(d)<1):
    d.append(crr)
    continue
  if(len(d)>=1 and d[-1]!=crr):
    d.pop()
  else:
    d.append(crr)
print(len(s)-len(d))
Buggy code:
s = input()

ans = 0
stack = [s[0]]

for c in s[1:-1]:
  if c == stack[-1]:
    ans += 2
    stack.pop(-1)
  else:
    stack.append(c)
    
print(ans)


Fixed code:
s = input()
 
ans = 0
stack = []
 
for c in s:
  if stack == []:
    stack.append(c)
    continue
  if c != stack[-1]:
    ans += 2
    stack.pop(-1)
  else:
    stack.append(c)
    
print(ans)
Buggy code:
r = 0
b = 0
for a in input():
    if a == '0':
        r += 1
    else:
        b += 1

print(min(r, b))

Fixed code:
r = 0
b = 0
for a in input():
    if a == '0':
        r += 1
    else:
        b += 1

print(min(r, b)*2)
Buggy code:
import math
import copy
import fractions
import numpy as np
from functools import reduce

# ===FUNCTION===

def getInputNum():
    inputNum = int(input())
    return inputNum

def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData

def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList

def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList

# ===CODE===

n, = map(str, input().split())
data = list(n)

cntOne = 0
cntZero = 0

for i in range(data):
    if data[i] == "0": 
        cntZero += 1
    else: 
        cntOne += 1

ans(int(2*min(cntOne, cntZero)))

Fixed code:
import math
import copy
import fractions
import numpy as np
from functools import reduce

# ===FUNCTION===

def getInputNum():
    inputNum = int(input())
    return inputNum

def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData

def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList

def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList

# ===CODE===

n, = map(str, input().split())
data = list(n)

cntOne = 0
cntZero = 0

for i in range(len(data)):
    if data[i] == "0":
        cntZero += 1
    else:
        cntOne += 1

ans = int(2*min(cntOne, cntZero))
print(ans)
Buggy code:
S = input()

zero = 0
one = 1
for n in S:
  if n == "0":
    zero+=1
  elif n == "1":
    one+=1

print(min(zero,one)*2)



Fixed code:
S = input()

zero = 0
one = 0
for n in S:
  if n == "0":
    zero+=1
  elif n == "1":
    one+=1

print(min(zero,one)*2)
Buggy code:
s=input().count(min("0","1"));print(s*2)

Fixed code:
s=input()
print(min(s.count("1"),s.count("0"))*2)
Buggy code:
S = input()
N = len(S)

count = 0
for i in range(N):
    if S[i] == 0:
        count += 1

ans = min(count, N - count) * 2
print(ans)


Fixed code:
S = input()
N = len(S)

count = 0
for i in range(N):
    if S[i] == "0":
        count += 1

ans = min(count, N - count) * 2
print(ans)
Buggy code:
S = input()
init_count = len(S)

tmp_i = 0
while len(S) > 1:
    no_01 = True
    before_s = None
    for i, s in enumerate(S[tmp_i:]):
        if i == 0:
            before_s = s
            continue
        if before_s != s:
            no_01 = False
            print(S[:tmp_i + i-1], '(', S[tmp_i + i - 1], ' | ', S[tmp_i + i],  ')', S[tmp_i + i+1:])
            newS = S[:tmp_i + i-1] + S[tmp_i + i+1:]
            S = newS
            print('newS: ', newS)
            tmp_i = tmp_i + i - 2
            if tmp_i < 0:
                tmp_i = 0
            print(tmp_i)
            break
    if no_01:
        break
print(init_count - len(S))

Fixed code:
S = input()
init_count = len(S)

tmp_i = 0
while len(S) > 1:
    no_01 = True
    before_s = None
    for i, s in enumerate(S[tmp_i:]):
        if i == 0:
            before_s = s
            continue
        if before_s != s:
            no_01 = False
            # print(S[:tmp_i + i-1], '(', S[tmp_i + i - 1], ' | ', S[tmp_i + i],  ')', S[tmp_i + i+1:])
            newS = S[:tmp_i + i-1] + S[tmp_i + i+1:]
            S = newS
            # print('newS: ', newS)
            tmp_i = tmp_i + i - 2
            if tmp_i < 0:
                tmp_i = 0
            # print(tmp_i)
            break
    if no_01:
        break
print(init_count - len(S))
Buggy code:
from collections import Counter


def main():
    S = input()

    ans = f(S)
    print(ans)


def f(S):
    c = Counter(S)
    return min(c['0'], c['1'])


if __name__ == '__main__':
    main()


Fixed code:
from collections import Counter


def main():
    S = input()

    ans = f(S)
    print(ans)


def f(S):
    c = Counter(S)
    return min(c['0'], c['1']) * 2


if __name__ == '__main__':
    main()
Buggy code:
import sys
stdin = sys.stdin
def ls(): return stdin.readline()

S = ls()
num_1, num_0 = 0, 0

for s in S:

    if s == '1':
        num_1 += 1
    else:
        num_0 += 1
print( 2 * min(num_1, num_0) )


Fixed code:
import sys
stdin = sys.stdin
def ls(): return stdin.readline()

S = ls()
num_1, num_0 = 0, 0

for s in S:

    if s == '1':
        num_1 += 1
    elif s == '0':
        num_0 += 1
print( 2 * min(num_1, num_0) )
Buggy code:
S=input()
List = list(S)
zeroNum = List.count("0")
oneNum = List.count("1")
res = min(reroNum,oneNum)
print(res*2)

Fixed code:
S=input()
List = list(S)
zeroNum = List.count("0")
oneNum = List.count("1")
res = min(zeroNum,oneNum)
print(res*2)
Buggy code:
a = input()

print(2* min(a.count('1'),a.count('0') )

Fixed code:
a = input()

print(2* min(a.count('1'),a.count('0') ))
Buggy code:
x=0
y=0
for i in list(input()):
  if i=='0':
    x+=1
  else:
    y+=1
print(min(x,y))

Fixed code:
x=0
y=0
for i in list(input()):
  if i=='0':
    x+=1
  else:
    y+=1
print(min(x,y)*2)
Buggy code:
s = str(input())
if s.count("0") > 0 and s.count("1")) > 0:
    print(2*min(s.count("0"),s.count("1")))
else:
    print(0)

Fixed code:
s = str(input())
if s.count("0") > 0 and s.count("1") > 0:
    print(2*min(s.count("0"),s.count("1")))
else:
    print(0)
Buggy code:
l=list(map(str,input()))
print(2*(min(l.count(0),l.count(1))))


Fixed code:
l=list(map(str,input()))
print(2*(min(l.count('0'),l.count('1'))))
Buggy code:
N = len(S)
num_one = S.count('1')
num_zero = S.count('0')
print(N - abs(num_one - num_zero))

Fixed code:
S = input()
N = len(S)
num_one = S.count('1')
num_zero = S.count('0')
print(N - abs(num_one - num_zero))
Buggy code:
s=input()
for i in range(len(s)):
  if s[i]=="0":
    z+=1
  else:
    o+=1
print(2*min(0,1))

Fixed code:
s=input()
z,o=0,0
for i in range(len(s)):
  if s[i]=="0":
    z+=1
  else:
    o+=1
print(2*min(z,o))
Buggy code:
istr=input()
for ch in istr:
  if ch == '0':
    c0+=1
  else:
    c1+=1
print(min(c0,c1)*2)
      

Fixed code:
istr=input()
c0=0
c1=0
for ch in istr:
    if ch == '0':
        c0+=1
    else:
        c1+=1
print(min(c0,c1)*2)
Buggy code:
def main():
    string = input()
    lists = list(string)
    original_len = len(lists)
    zero = lists.count('0')
    one = lists.count('1')
    print(original_len - min(zero,one)*2)
if __name__ == "__main__":
    main()



Fixed code:
def main():
    string = input()
    lists = list(string)
    original_len = len(lists)
    zero = lists.count('0')
    one = lists.count('1')
    print(min(zero,one)*2)
if __name__ == "__main__":
    main()
Buggy code:
a = list(map(int,list(input())))
c = 1
co = 0
p = a[0]
pp = []
for i in range(len(a)-1):
	if a[(i+1)] == p:
		c += 1
	else:
		pp.append(c)
		c = 1
		p = a[i+1]
ppp = pp[0]

kkk = 0
for i in range(len(pp)-1):
	if pp[i] >= 0:
		co += 2*(max(pp[i],pp[i+1]) - abs(pp[i] - pp[i+1]))
		pp[i+1] = pp[i+1] - pp[i]
	else:
		pp[i+1] = pp[i+1] - pp[i]
print(co)


Fixed code:
a = list(map(int,list(input())))
c = 1
co = 0
p = a[0]
pp = []
for i in range(len(a)-1):
	if a[(i+1)] == p:
		c += 1
	else:
		pp.append(c)
		c = 1
		p = a[i+1]
pp.append(c)
if len(pp) != 1:
	ppp = pp[0]
	for i in range(len(pp)-1):
		if pp[i] >= 0:
			co += 2*(max(pp[i],pp[i+1]) - abs(pp[i] - pp[i+1]))
			pp[i+1] = pp[i+1] - pp[i]
		else:
			pp[i+1] = pp[i+1] - pp[i]
print(co)
Buggy code:
in_s = input().rstrip()
lst = list(in_s)
cur=0
while True:
    if cur +1 == len(lst):
        break
    if lst[cur]!=lst[cur+1]:
        del lst[cur+1]
        del lst[cur]
        cur = max(0,cur-1)
    else:
        cur+=1

print(len(in_s) - len(lst))

Fixed code:
in_s = input().rstrip()
lst = list(in_s)
cur=0
while True:
    if cur+1 >= len(lst):
        break
    if lst[cur]!=lst[cur+1]:
        del lst[cur+1]
        del lst[cur]
        cur = max(0,cur-1)
    else:
        cur+=1
 
print(len(in_s) - len(lst))
Buggy code:
from collections import deque                                        
                                                                     
def unification(string):                                             
                                                                     
    n = len(string)                                                  
                                                                     
    if n == 1:                                                       
        return 0                                                     
                                                                     
    q = deque()                                                      
    idx = 2                                                          
    q.appendleft(string[0])                                          
    q.appendleft(string[1])                                          
    count = 0                                                        
                                                                     
    while idx < n:                                                   
        while len(q) > 1 and q[0] != q[1]:                           
            q.pop()                                                  
            q.pop()                                                  
            count += 2                                               
                                                                     
        q.appendleft(string[idx])                                    
        idx += 1                                                     
                                                                     
    return count                                                     
                                                                     
                                                                     
if __name__ == "__main__":                                           
    string = input()                                                 
    print(unification(string))     

Fixed code:
from collections import deque

def unification(string):

    n = len(string)

    if n == 1:
        return 0

    q = deque()
    idx = 2
    q.appendleft(string[0])
    q.appendleft(string[1])
    count = 0

    while idx < n:
        while len(q) > 1 and q[0] != q[1]:
            q.popleft()
            q.popleft()
            count += 2

        q.appendleft(string[idx])
        idx += 1

    if len(q) > 1 and q[0] != q[1]:
        q.popleft()
        q.popleft()
        count += 2

    return count


if __name__ == "__main__":
    string = input()
    print(unification(string))
Buggy code:
s = input()
stack = []
r = 0
for c in s:
  n = int(c)
  if len(stack) > 0 and stack[-1] ^ n == 1:
    stack.pop()
    r += 1
  else:
    stack.append(n)
print(r)

Fixed code:
s = input()
stack = []
r = 0
for c in s:
  n = int(c)
  if len(stack) > 0 and stack[-1] ^ n == 1:
    stack.pop()
    r += 2
  else:
    stack.append(n)
print(r)
Buggy code:
import sys

def solve():
    input = sys.stdin.readline
    S = input().strip("\n")
    z, o = 0, 0
    for i in range(len(S)):
        if S[i] == "0": z += 1
        else: o += 1
        print(2 * min(z, o))
    return 0

if __name__ == "__main__":
    solve()

Fixed code:
import sys

def solve():
    input = sys.stdin.readline
    S = input().strip("\n")
    zero, one = 0, 0
    for i in range(len(S)):
        if S[i] == "0": zero += 1
        else: one += 1
    print(2 * min(zero, one))

    return 0

if __name__ == "__main__":
    solve()
Buggy code:
import sys

def parse(inp):
    S=list(next(inp))
    return S
  
def main(inp):
    S = inp
    zeros=0
    ones=0
    for i in range(len(S)):
        if(S[i]=='0'): zeros+=1
        else: ones+=1
            
    return 2*min(ones,zeros)
  
print(main(parse(sys.stdin)))

Fixed code:
import sys

def parse(inp):
    S=list(next(inp))
    return S
  
def main(inp):
    S = inp
    zeros=0
    ones=0
    for i in range(len(S)):
        if(S[i]=='0'): zeros+=1
        elif(S[i]=='1'): ones+=1
            
    return 2*min(ones,zeros)
  
print(main(parse(sys.stdin)))
Buggy code:
s = list(map(int, input()))0
print(min(len(s)-sum(s), sum(s))*2)

Fixed code:
s = list(map(int, input()))
print(min(len(s)-sum(s), sum(s))*2)
Buggy code:
s = input()
print(min(s.count("1"),s.count("2"))*2)

Fixed code:
s=input()
print(min(s.count("0"),s.count("1"))*2)
Buggy code:
from collections import Counter
c = Counter(list(input())).values()
print(2 * min(c))
from collections import Counter
c = Counter(list(input())).values()
print(0 if len(c) == 1 else 2 * min(c))


Fixed code:
from collections import Counter
c = Counter(list(input())).values()
print(0 if len(c) == 1 else 2 * min(c))
Buggy code:
class Solver:

    def __init__(self):
        pass


    def solve(self, s):
        one = 0
        zero = 0
        for ch in s:
            if ch == '1':
                one += 1
            else:
                zero += 1
        return abs(one-zero)


if __name__ == '__main__':

    solver = Solver()
    s = input()
    n = solver.solve(s)
    print(n)


Fixed code:
class Solver:

    def __init__(self):
        pass


    def solve(self, s):
        one = 0
        zero = 0
        for ch in s:
            if ch == '1':
                one += 1
            else:
                zero += 1
        return len(s) - abs(one-zero)


if __name__ == '__main__':

    solver = Solver()
    s = input()
    n = solver.solve(s)
    print(n)
Buggy code:
# # coding: utf-8
# data = list(input())
# removed_block = 0
# i = 1
# log = data[0]
# while i < (len(data) + 1):
#     try:
#         if data[i] != log:
#             data.pop(i)
#             data.pop(i - 1)
#             removed_block += 2
#             i = 1
#             log = data[0]
#         else:
#             i += 1
#     except:
#         break
# print(removed_block)

# coding: utf-8
n = input()
print(min(n.count('0'), n.count('1')))


Fixed code:
# # coding: utf-8
# data = list(input())
# removed_block = 0
# i = 1
# log = data[0]
# while i < (len(data) + 1):
#     try:
#         if data[i] != log:
#             data.pop(i)
#             data.pop(i - 1)
#             removed_block += 2
#             i = 1
#             log = data[0]
#         else:
#             i += 1
#     except:
#         break
# print(removed_block)

# coding: utf-8
n = input()
print(min(n.count('0'), n.count('1')) * 2)
Buggy code:
def main():
    s = input()

    zero = s.count('0')
    one = len(s) - zero

    print(min(zero, one) *)

if __name__ == '__main__':
    main()

Fixed code:
def main():
    s = input()

    zero = s.count('0')
    one = len(s) - zero

    print(min(zero, one) * 2)

if __name__ == '__main__':
    main()
Buggy code:
S=list(input())
red=len(list(filter(lambda e:e=='0', S)))
blue=len(list(filter(lambda e:e=='1', S)))
d=abs(red-bule)
print(red+bule-d)


Fixed code:
S=list(input())
red=len(list(filter(lambda e:e=='0', S)))
blue=len(list(filter(lambda e:e=='1', S)))
d=abs(red-blue)
print(red+blue-d)
Buggy code:
s = input()
#print(s)

score=0
for i in range(len(s)):
	if s[i]=="0":
		score = score +1
	else:
		score = score -1
#	print(s[i])
print(len(s)-score)

Fixed code:
s = input()
#print(s)

score=0
for i in range(len(s)):
	if s[i]=="0":
		score = score +1
	else:
		score = score -1
#	print(s[i])
print(len(s)-abs(score))
Buggy code:
s = input()
n0, n1 = 0, 0

for c in s:
  if c == '0':
    n0 += 1
  else:
    n1 += 1
      
print(min(n0, n1))

Fixed code:
s = input()
n0, n1 = 0, 0

for c in s:
  if c == '0':
    n0 += 1
  else:
    n1 += 1
      
print(min(n0, n1)*2)
Buggy code:
from collections import deque
S = input()
S = list(S)
counter = 0
que = deque([])
stack = deque([])
for i in range(len(S)):
    que.append(S[i])
for i in range(1000000):
  if stack:
    1
  else:
    stack.append(que.popleft())
  if que:
    s1 = que.popleft()
  else:
    break
  s2 = stack.pop()
  if(s1 != s2):
    counter+=2
  else:
    stack.append(s1)
    stack.append(s2)
print(counter)

Fixed code:
from collections import deque
S = input()
S = list(S)
counter = 0
que = deque([])
stack = deque([])
for i in range(len(S)):
    que.append(S[i])
for i in range(1000000):
  if stack:
    1
  else:
    if que:
      stack.append(que.popleft())
    else:
      break
  if que:
    s1 = que.popleft()
  else:
    break
  s2 = stack.pop()
  if(s1 != s2):
    counter+=2
  else:
    stack.append(s1)
    stack.append(s2)
print(counter)
Buggy code:
s = input()

count_0 = 0
count_1 = 1
for i in range(len(s)):
    if s[i] == '0':
        count_0 += 1
    else:
        count_1 += 1

print(min(count_0,count_1) * 2)


Fixed code:
s = input()

count_0 = 0
count_1 = 0

for i in s:
    if(i == "0"): count_0 += 1
    else: count_1 += 1

print(min([count_0, count_1])*2)
Buggy code:
S = [i for i in input()]
one = S.count("1")
zero = S.count("0")
print(min(one,zero))

Fixed code:
S = [i for i in input()]
one = S.count("1")
zero = S.count("0")
print(min(one,zero)*2)
Buggy code:
S=input()
stack=[]
ans=0

for i in range(len(S)-1):
    if len(stack)==0:
        stack.append(S[i])
    elif stack[len(stack)-1]!=S[i]:
        stack.pop()
        ans+=2
    else:
        stack.append(S[i])

print(ans)

Fixed code:
S=input()
stack=[]
ans=0

for i in range(len(S)):
    if len(stack)==0:
        stack.append(S[i])
    elif stack[len(stack)-1]!=S[i]:
        stack.pop()
        ans+=2
    else:
        stack.append(S[i])

print(ans)
Buggy code:
s = input()
data = []
for i in s:
    data.append(int(i))
one = 0
zero = 0
for i in range(len(data))
    if i == 0:
        zero += 1
    else:
        one += 1
print(min(zero, one))

Fixed code:
s = input()
data = []
for i in s:
    data.append(int(i))
one = 0
zero = 0
for i in range(len(data)):
    if data[i] == 0:
        zero += 1
    else:
        one += 1

print(min(zero, one) * 2)
Buggy code:
s = input()
a = 0
b = 0
for i in range(len(s)):
         if s[i] == "0":
                 a += 1
         else:
                  b += 1
print(min(a,b))


Fixed code:
s = input()
a = 0
b = 0
for i in range(len(s)):
         if s[i] == "0":
                 a += 1
         else:
                  b += 1
print(min(a,b)*2)
Buggy code:
s=input()
cnt0=0
cnt1=0
for i in range(len(s)):
  if s[i]=='0':
    cnt0+=1
  else:
    cnt1+=1
if cnt1<cnt0:
  print(len(s)-2*cnt1)
else:
  print(len(s)-2*cnt0)

Fixed code:
s=input()
cnt0=0
cnt1=0
for i in range(len(s)):
  if s[i]=='0':
    cnt0+=1
  else:
    cnt1+=1
if cnt1<cnt0:
  print(2*cnt1)
else:
  print(2*cnt0)
Buggy code:
S=[i for i in input()]
m=0
for i in range(len(S)):
  if S[i]==1:
    m+=1
  else:
    m-=1
print(len(S)-abs(m))

Fixed code:
S=[i for i in input()]
m=0
for i in range(len(S)):
  if S[i]=='1':
    m+=1
  else:
    m-=1
print(len(S)-abs(m))
Buggy code:
S = input()

N = len(S)

cnt_zero = 0
for i in range(N):
  if S[i] == '0':
    cnt += 1
if cnt_zero <= N - cnt_zero:
  print(cnt_zero*2)
else:
  print((N-cnt_zero)*2)

Fixed code:
S = input()

N = len(S)

cnt_zero = 0
for i in range(N):
  if S[i] == '0':
    cnt_zero += 1
if cnt_zero <= N - cnt_zero:
  print(cnt_zero*2)
else:
  print((N-cnt_zero)*2)