qyliang/CodeNanoFix huggingface dataset:
Buggy code:
def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table
  
A, B, K = map(int, input().split())
ans = list(set(divisor(A)) & set(divisor(B)))
print(ans[K-1])

Fixed code:
def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table
  
A, B, K = map(int, input().split())
ans = list(set(divisor(A)) & set(divisor(B)))
ans.sort(reverse=True)
print(ans[K-1])
Buggy code:
a,b,k=map(int, input().split())
l=[]
for i in range(1,100):
    if a%i==0 and b%i==0:
        l.append(i)
if k==len(k):
    print(l[0])
else:
    print(l[-k])

Fixed code:
a,b,k=map(int, input().split())
l=[]
for i in range(1,101):
    if a%i==0 and b%i==0:
        l.append(i)
if k==len(l):
    print(l[0])
else:
    print(l[-k])
Buggy code:
A,B,K = map(int,input().split())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors
A_div = make_divisors(A)
B_div = make_divisors(B)
#koyakusu = set(A_div) & set(B_div)
print(list(set(A_div) & set(B_div))[K-1])
    

Fixed code:
A,B,K = map(int,input().split())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors
A_div = make_divisors(A)
B_div = make_divisors(B)
koyakusu = list(set(A_div) & set(B_div))
koyakusu.sort(reverse=True)
#koyakusu = set(A_div) & set(B_div)
print(koyakusu[K-1])
Buggy code:
a,b,k=map(int,input().split())
ans=0

for i in range(0,a if a<=b else b):
  if a%(i+1)==0 and b%(i+1)==0:
    ans=i+1
    k-=1
    if k==0:
      break

print(ans)

Fixed code:
a,b,k=map(int,input().split())
ans=0

for i in range(a if a<=b else b,0,-1):
  if a%i==0 and b%i==0:
    k-=1
    if k==0:
      ans=i
      
print(ans)
Buggy code:
def main():
    a, b, k = map(int, input().split())
    count = 0
    for i in range(1, max(a, b)):
        if a % i == 0 and b % i == 0:
            print(i)
            count += 1
        if count == k:
            # print(i)
            return


if __name__ == "__main__":
    main()


Fixed code:
def main():
    a, b, k = map(int, input().split())
    count = 0
    for i in range(max(a, b), 0, -1):
        if a % i == 0 and b % i == 0:
            count += 1
        if count == k:
            print(i)
            return


if __name__ == "__main__":
    main()
Buggy code:
A,B,K=map(int,input().split())
S=[]
for i in range(1,101):
  if A%i==0 and B%i==0:
    S.append(i)

S.sort(reverse=True)
print(S)
print(S[K-1])

Fixed code:
A,B,K=map(int,input().split())
S=[]
for i in range(1,101):
  if A%i==0 and B%i==0:
    S.append(i)

S.sort(reverse=True)

print(S[K-1])
Buggy code:
A, B, K = [int(x) for x in input().split()]
list_ = []
for k in range(1, min(A,B)):
  if A % k == 0 and B % k == 0:
    list_.append(k)
print(list_[len(list_)-K+1])

Fixed code:
A, B, K = [int(x) for x in input().split()]
list_ = []
for k in range(1, min(A,B)+1):
  if A % k == 0 and B % k == 0:
    list_.append(k)
print(list_[::-1][K-1])
Buggy code:
A,B,K=map(int,input().split())

S=[]
for i in range(1,B+1):
  if A % i==0 and B%i==0:

    S.append(i)

print(S[K+1])

Fixed code:
A,B,K=map(int,input().split())

S=[]
for i in range(1,B+1):
  if A % i==0 and B%i==0:

    S.append(i)

print(S[-K])
Buggy code:
a,b,k=map(int,input().split())
x=[]
for i in range(1,101):
    if a%i==0 and b%i==0:
        x.append(i)
print(*x)

Fixed code:
a,b,k=map(int,input().split())
x=[]
for i in range(1,101):
    if a%i==0 and b%i==0:
        x.append(i)
x=x[::-1]
print(x[k-1])
Buggy code:
a,b,k = map(int, input().split())

i=1
idx = 0
while True:
  if a%i==0 and b%i==0:
    idx+=1
    
  if idx==k:
    break
  else:
    i+=1
    
print(i)

Fixed code:
a, b, k = map(int, input().split())

i = max(a, b)
idx = 0
while True:
    if a % i == 0 and b % i == 0:
        idx += 1

    if idx == k:
        break
    else:
        i -= 1

print(i)
Buggy code:
,B,K = map(int,input().split())
P = []
for i in range(1,min(A,B)+1):
    if A%i==0 and B%i==0:
        P.append(i)
print(P[len(P)-K])


Fixed code:
A,B,K = map(int,input().split())
P = []
for i in range(1,min(A,B)+1):
    if A%i==0 and B%i==0:
        P.append(i)
print(P[len(P)-K])
Buggy code:
A,B,K=(int(x) for x in input().split())
GC_list=[]
for i in range(1,max(A,B)):
    if(A%i==0 and B%i==0):
        GC_list.append(i)

print(GC_list[len(GC_list)-K])

Fixed code:
A,B,K=(int(x) for x in input().split())
GC_list=[]
for i in range(1,max(A,B)+1):
    if(A%i==0 and B%i==0):
        GC_list.append(i)

print(GC_list[len(GC_list)-K])
Buggy code:
A,B,K = map(int,input().split())

als = []
bls = []

for a in range(1,A):
  if A%a == 0:
    als.append(a)
for b in range(1,B):
  if B%b == 0:
    bls.append(b)

common = []

for a in range(0,len(als)):
  if a in bls:
    common.append(a)

common.sort()
print(common[K-1])


Fixed code:
A,B,K = map(int,input().split())

als = []
bls = []

for a in range(1,A+1):
  if A%a == 0:
    als.append(a)
for b in range(1,B+1):
  if B%b == 0:
    bls.append(b)

common = []

for a in als:
  if a in bls:
    common.append(a)

common.sort()
print(common[-K])
Buggy code:
a,b,k=map(int,input().split())
c=0
for i in range(50,1,-1):
  if a%i==0:
    if b%i==0:
      c+=1
      if c==k:
        break
print(i)

Fixed code:
a,b,k=map(int,input().split())
c=0
for i in range(100,0,-1):
  if a%i==0:
    if b%i==0:
      c+=1
      if c==k:
        break
print(i)
Buggy code:
a = list(map(int, input().split()))
now = 0
for i in range(1, max(a[0], a[1])):
    if ((a[0] % i == 0) and (a[1] % i == 0)):
        now += 1
    if now == a[2]:
        print(i)
        break

Fixed code:
a = list(map(int, input().split()))
now = 0
for j in range(max(a[0], a[1])):
    i = min(a[0], a[1]) - j
    if ((a[0] % i == 0) and (a[1] % i == 0)):
        now += 1
    if now == a[2]:
        print(i)
        break
Buggy code:
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

A, B, K = map(int, input().split())

set_a = set(make_divisors(A))
set_b = set(make_divisors(B))
# print(f'set_a ({A}): {set_a}')
# print(f'set_b ({B}): {set_b}')

set_ab = set_a.intersection(set_b)

list_ab = list(set_ab)
list_ab.sort()
# print(list_ab)

print(list_ab[K - 1])

Fixed code:
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

A, B, K = map(int, input().split())

set_a = set(make_divisors(A))
set_b = set(make_divisors(B))
set_ab = set_a.intersection(set_b)

list_ab = list(set_ab)
list_ab.sort()
# print(list_ab)

print(list_ab[-K])
Buggy code:
A,B,K = list(map(int,input().split()))

divisor = []

for i in range(min(A,B)+1):
    if i == 0:
        continue

    if A % i == 0 and B % i == 0:
        divisor.append(i)

print(divisor[K-1])

Fixed code:
A,B,K = list(map(int,input().split()))

divisor = []

for i in range(min(A,B)+1):
    if i == 0:
        continue

    if A % i == 0 and B % i == 0:
        divisor.append(i)

print(divisor[::-1][K-1])
Buggy code:
# encoding:utf-8
import copy
import numpy as np
import random
import pandas as pd
import torch

a,b,k = map(int,input().split())

cds = []
for i in range(1,min(a,b)+1):
    if a%i==0 and b%i==0:
        cds.append(i)

cds.reverse()
print(cds[k-1])


Fixed code:
# encoding:utf-8
import copy
import numpy as np
import random


a,b,k = map(int,input().split())

cds = []
for i in range(1,min(a,b)+1):
    if ((a%i==0) and (b%i==0)):
        cds.append(i)

cds.reverse()
print(cds[k-1])
Buggy code:
a, b, k = map(int, input().split())
cnt = 0
for i in range(1, min(a, b)+1):
    if a % i == 0 and b % i == 0:
        cnt += 1
    if cnt == k:
        print(i)
        break

Fixed code:
a, b, k = map(int, input().split())

for i in range(min(a, b)+1, 0, -1):
    if a % i == 0 and b % i == 0:
        k -= 1
    if k == 0:
        print(i)
        break
Buggy code:
S=input();min(S.count('0'),S.count('1'))*2

Fixed code:
S=input();
print(min(S.count('0'),S.count('1'))*2)
Buggy code:
c0=0
c1=0
for i in input():
  if i=="1":
    c1+=1
  else:
    c0+=1
print(min(c0,c1))

Fixed code:
c0=0
c1=0
for i in input():
  if i=="1":
    c1+=1
  else:
    c0+=1
print(min(c0,c1)*2)
Buggy code:
import sys
input = sys.stdin.readline

s = list(input())
l = {}

for v in s:
    if l.get(v):
        l[v] += 1
    else:
        l[v] = 1
        
print(min(l["0"], l["1"]) * 2)

Fixed code:
import sys
input = sys.stdin.readline

s = list(input())
l = {
    "0": 0,
    "1": 0,
}

for v in s:
    if l.get(v):
        l[v] += 1
    else:
        l[v] = 1
        
print(min(l["0"], l["1"]) * 2)
Buggy code:
s = input();
l = len(s)
zero=0,one=0
for i in s:
	if i=='0': zero+=1
	else one+=1
print(min(zero, one))

Fixed code:
s=input();
l=len(s)
zero,one=0,0
for i in s:
	if i=='0': zero+=1
	else: one+=1
print(min(zero, one)*2)
Buggy code:
S=input()
n0,n1=0,0
for s in S:
  if s=='1':
    n1+=1
  elif s=='0':
    n0+=1
print(min(n1,n0))

Fixed code:
S=input()
n0,n1=0,0
for s in S:
  if s=='1':
    n1+=1
  elif s=='0':
    n0+=1
print(min(n1,n0)*2)
Buggy code:
s=input()
print(2*min(s.count(0),s.count(1)))

Fixed code:
s = input()
print( 2*min( s.count('1'), s.count('0')))
Buggy code:
s=input()
nall=len(s)
nzero=s.count("0")
none=nall-nzero
if n==0:
    print(0)
elif none<=nzero:
    print(nall-none*2)
else:
    print(nall-nzero*2)


Fixed code:
s=input()
nall=len(s)
nzero=s.count("0")
none=nall-nzero
if nall==0:
    print(0)
elif none<=nzero:
    print(none*2)
else:
    print(nzero*2)
Buggy code:
s=input()
cnt=0
for c in s:
  cnt+=(int(c)-0.5)*2
print(len(s)-int(cnt))

Fixed code:
s=input()
cnt=0
for c in s:
  cnt+=(int(c)-0.5)*2
print(len(s)-abs(int(cnt)))
Buggy code:
S = input()
print(S)
stack = []
ans = 0
for c in S:
    if stack and stack[0] != c:
        print("stack={}, c={} pop!".format(stack, c))
        stack.pop()
        ans += 2
    else:
        print("stack={}, c={} append!".format(stack, c))
        stack.append(c)
#     print("c={0}, st={1}".format(c, stack))
print(ans)

Fixed code:
S = input()
# print(S)
stack = []
ans = 0
for c in S:
    if stack and stack[0] != c:
#         print("stack={}, c={} pop!".format(stack, c))
        stack.pop()
        ans += 2
    else:
#         print("stack={}, c={} append!".format(stack, c))
        stack.append(c)
#     print("c={0}, st={1}".format(c, stack))
print(ans)
Buggy code:
def inpl():
    return list(map(int, input().split()))


S = input()
print(min(S.count('0'), S.count('1')))

Fixed code:
def inpl():
    return list(map(int, input().split()))


S = input()
print(min(S.count('0'), S.count('1')) * 2)
Buggy code:
S=input()
z=0
o=0
for i in range(len(S)):
    if S[i]==0:
        z+=1
    elif S[i]==1:
        o+=1
print(2*min(z,o))

Fixed code:
S=input()
z=0
o=0
for i in range(len(S)):
    if S[i]=="0":
        z+=1
    elif S[i]=="1":
        o+=1
print(2*min(z,o))
Buggy code:
S=input()

num0=0
num1=1

for i in range(len(S)):
    if S[i]=='0':
        num0+=1
    else:
        num1+=1
print(min(num0,num1))



Fixed code:
S=input()

num0=0
num1=0

for i in range(len(S)):
    if S[i]=='0':
        num0+=1
    else:
        num1+=1
print(2*min(num0,num1))
Buggy code:
s = input()
zero = len([x for x in s if x == "0"])
one = len(s) - zero

print(min(zero, one))

Fixed code:
s = input()
zero = len([x for x in s if x == "0"])
one = len(s) - zero

print(min(zero, one) * 2)
Buggy code:
s = input()
print(len(s) - 2 * min([sum([v == '1' for v in s]), sum([v == '0' for v in s])]))

Fixed code:
s = input()
print(2 * min([sum([v == '1' for v in s]), sum([v == '0' for v in s])]))
Buggy code:
import sys

def main():
    S  = list(map(int, input()))
    o = S.count(0)
    l = S.count(1)
    print(o,l)

    print(min(o, l) * 2)

main()

Fixed code:
import sys

def main():
    S  = list(map(int, input()))
    o = S.count(0)
    l = S.count(1)

    print(min(o, l) * 2)

main()
Buggy code:
s = input()
zero = 0
one = 0

for i in len(s):
    if s[i]=="0":
        zero += 1
    else:
        one += 1
else:
    ans = min(zero,one)*2

print(ans)

Fixed code:
s = input()
zero = 0
one = 0

for i in range(len(s)):
    if s[i]=="0":
        zero += 1
    else:
        one += 1
else:
    ans = min(zero,one)*2

print(ans)
Buggy code:
from collections import Counter
C = Counter(list(input()))
print(C["0"] if C["0"]<=C["1"] else C["1"])

Fixed code:
from collections import Counter
C = Counter(list(input()))
print(C["0"]*2 if C["0"]<=C["1"] else C["1"]*2)
Buggy code:
import sys
input = sys.stdin.readline

S = input()
stack = []
count = 0
for s in S:
  if not stack:
    stack.append(s)
  elif s != stack[-1]:
    stack.pop()
    count += 2
  else:
    stack.append(s)
print(count)    

Fixed code:
import sys
input = sys.stdin.readline

S = input().rstrip()
stack = []
count = 0
for s in S:
  if not stack:
    stack.append(s)
  elif s != stack[-1]:
    stack.pop()
    count += 2
  else:
    stack.append(s)
print(count)
Buggy code:
s=input()
a=0
b=0
for i in range(len(s)):
  if s[i]=="1":
    a+=1
  else:
    b+=1
print(min(a,b)*2)
print(a,b)

Fixed code:
s=input()
a=0
b=0
for i in range(len(s)):
  if s[i]=="1":
    a+=1
  else:
    b+=1
print(min(a,b)*2)
Buggy code:
def main120():
    import sys
    S_org = input()
    S = []

    for s in range(len(S_org)):
        S.append(S_org[s])
    S = list(map(int, S))

    cont = True
    index = 0
    count = 0

    if len(S) == 1:
        print(0)
        sys.exit()

    else:
        while(cont):
            if S[index] == S[index+1]:
                index += 1
            else:
                count += 2
                S.pop(index)
                S.pop(index)
    
            if index == len(S) - 2:
                if S[index] != S[index+1]:
                    count += 2
                print(count)
                sys.exit()


main120()

Fixed code:
def main120():
    import sys
    S_org = input()
    S = []

    for s in range(len(S_org)):
        S.append(S_org[s])
    S = list(map(int, S))

    cont = True
    index = 0
    count = 0

    if len(S) == 1:
        print(0)
        sys.exit()

    else:
        while(cont):
            if S[index] == S[index+1]:
                index += 1
            else:
                count += 2
                S.pop(index)
                S.pop(index)
                if index > 0:
                    index -= 1

            if index == len(S) - 2:
                if S[index] != S[index+1]:
                    count += 2
                print(count)
                sys.exit()


main120()
Buggy code:
S=input()
print(min(S.count('0')*2,S.count('1')))

Fixed code:
S=input()
print(min(S.count('0')*2,S.count('1')*2))
Buggy code:
s = input()
n = len(s)
a = []
i = 0
ct = 0
for i in range(n):
  a.append(int(s[i]))
i = -1

while ct < n:
  n = len(a)
  i += 1
  if i >= n-1: break
  if a[i] == 0 and a[i+1] == 1:
    a.pop(i)
    a.pop(i)
    ct += 1
    i -= 2
    if i < 0: i=0
    continue
  elif a[i] == 1 and a[i+1] == 0:
    a.pop(i)
    a.pop(i)
    ct += 1
    i -= 2
    if i <0 :i = 0
    
print(ct*2)

Fixed code:
s = input()
n = len(s)
a = []
i = 0
ct = 0
for i in range(n):
  a.append(int(s[i]))
i = -1

while ct < 100000000000:
  n = len(a)
  i += 1
  if i >= n-1: break
  if a[i] == 0 and a[i+1] == 1:
    a.pop(i)
    a.pop(i)
    ct += 1
    i -= 2
    if i <= 1: i=-1
    continue
  elif a[i] == 1 and a[i+1] == 0:
    a.pop(i)
    a.pop(i)
    ct += 1
    i -= 2
    if i <= 1 :i = -1
    
print(ct*2)
Buggy code:
from collections import Counter
s=input()
if len(set(s)) == 1:
  print(0)
else:
  cs=Counter()
  print(min(cs['0'],cs['1'])*2)


Fixed code:
from collections import Counter
s=input()
if len(set(s)) == 1:
  print(0)
else:
  cs=Counter(s)
  print(min(cs['0'],cs['1'])*2)
Buggy code:
S = list(input())
A = 0
B = 0
for s in S:
    if s == '0':
        A += 1
    else:
        B += 1
print(min(A,B)

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

Fixed code:
s = input()
s=list(s)
zeroc=0
onec=0
for i in s:
  if i == "0":
    zeroc+=1
  if i == "1":
    onec+=1
print(min(zeroc,onec)*2)
Buggy code:
S = input()
print(min(len(re.findall('0', S)), len(re.findall('1', S))) * 2 if len(S) > 1 else 0)

Fixed code:
S = input()
import re
if len(S) > 1:
    print(min(len(re.findall('0', S)), len(re.findall('1', S))) * 2)
else:
    print(0)
Buggy code:
st = input()
countone = st.count('1')
countzero = st.count('0')
if countone > countzero and countzero > 0:
    print(countone)
elif countone <= countzero and countone > 0:
    print(countzero)
else:
    print('0')

Fixed code:
st = input()
countone = st.count('1')
countzero = st.count('0')
if countone > countzero and countzero > 0:
    print(countzero*2)
elif countone <= countzero and countone > 0:
    print(countone*2)
else:
    print('0')
Buggy code:
S=input()
if S.count(1)>=S.count(0):
  print(S.count(0)*2)
else:
  print(S.count(1)*2)



Fixed code:
S=input()
if S.count("1")>=S.count("0"):
  print(S.count("0")*2)
else:
  print(S.count("1")*2)
Buggy code:
S = input()

red = 0  # 0
blue = 0 # 1
m = 0
for s in S:
	if s = '0':
		if blue != 0:
			blue -= 1
			m += 2
		else:
			red += 1
	elif s = '1':
		if red != 0:
			red -= 1
			m += 2
		else:
			blue += 1

print(m)

Fixed code:
S = input()

red = 0  # 0
blue = 0 # 1
m = 0
for s in S:
	if s == '0':
		if blue != 0:
			blue -= 1
			m += 2
		else:
			red += 1
	elif s == '1':
		if red != 0:
			red -= 1
			m += 2
		else:
			blue += 1

print(m)
Buggy code:
import sys
from collections import deque


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    S = list(input())
    d_1 = deque(S[1:])
    d_2 = deque(S[0])
    ans = 0
    for i in range(1, len(S)):
        if d_2:
            r = d_1.popleft
            l = d_2.pop()
            if r == l:
                ans += 2
            else:
                d_2.append(l)
                d_2.append(r)
        else:
            d_2.append(d_1.popleft())
    print(ans)


if __name__ == '__main__':
    main()


Fixed code:
import sys
from collections import deque


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    S = list(map(int, list(input())))
    d_1 = deque(S[1:])
    d_2 = deque([S[0]])
    ans = 0
    for i in range(1, len(S)):
        if d_2:
            r = d_1.popleft()
            l = d_2.pop()
            if r != l:
                ans += 2
            else:
                d_2.append(l)
                d_2.append(r)
        else:
            d_2.append(d_1.popleft())
    print(ans)


if __name__ == '__main__':
    main()
Buggy code:
s=input()
print(2*(min(s.count("0"),s.count("1")))


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

s = sys.stdin.readline().rstrip()
n = len(s)

def main():
    c = s.cout('0')
    print(min(n-c, c) * 2)

if __name__ ==  '__main__':
    main()

Fixed code:
import sys

s = sys.stdin.readline().rstrip()
n = len(s)

def main():
    c = s.count('0')
    print(min(n-c, c) * 2)

if __name__ ==  '__main__':
    main()
Buggy code:
S=input()
L=len(S)
print(abs(S.count("1")-S.count("0")))



Fixed code:
S=input()
print(len(S)-abs(S.count("1")-S.count("0")))
Buggy code:
S = input()

a = S.count("0")
b = S.count("0")
print(min(a,b)*2)

Fixed code:
S = input()

a = S.count("0")
b = S.count("1")
print(min(a,b)*2)
Buggy code:
S = input()
o = S.count("1")
s = S.count("0")
print(min(o, s)**2)

Fixed code:
S = input()
o = S.count("1")
s = S.count("0")
print(min(o, s)*2)
Buggy code:
S1 = input()
S2 = '2' + S1[0]
res = 0

for s in S1[1::]:
    if S2[-1] == s:
        S2 += s
    else:
        S2 = S2[:-1:]
        res += 2

print(res)


Fixed code:
S1 = input()
S2 = ''
res = 0

for s in S1:
    if len(S2) == 0 or S2[-1] == s:
        S2 += s
    else:
        S2 = S2[:-1:]
        res += 2

print(res)
Buggy code:
if __name__ == "__main__":
    n = input()
    a = 0
    b = 0
    for c in n:
        if(c == '1'):
            a += 1
        else:
            b += 1
    if(a>b):
        print(b)
    else:
        print(a)

Fixed code:
if __name__ == "__main__":
    n = input()
    a = 0
    b = 0
    for c in n:
        if(c == '1'):
            a += 1
        else:
            b += 1
    if(a>b):
        print(b*2)
    else:
        print(a*2)
Buggy code:
S = input()
S = S.replace("0","r")
S = S.replace("1","b")
r = 0
b = 0
for s in S:
    if s == "r":
        r+=1
    else:
        b+=1
print(min([r,b]))

Fixed code:
S = input()
S = S.replace("0","r")
S = S.replace("1","b")
r = 0
b = 0
for s in S:
    if s == "r":
        r+=1
    else:
        b+=1
print(min([r,b])*2)
Buggy code:
from collections import Counter
s = input().rstrip()
ctr = Counter(s)
if len(ctr) > 2:
    x = min(ctr.values())
else:
    x = 0
print(x * 2)

Fixed code:
from collections import Counter
s = input().rstrip()
ctr = Counter(s)
if len(ctr) == 2:
    x = min(ctr.values())
else:
    x = 0
print(x * 2)
Buggy code:
s=input()
stk=0
h=0
for c in s:
  if x==1:
    if stk<0:
      h+=1
    stk+=1
  else:
    if stk >0:
      h+=1
    stk -=1
print(2*h)

Fixed code:
s=input()
stk=0
h=0
for c in s:
  x=int(c)
  if x==1:
    if stk<0:
      h+=1
    stk+=1
  else:
    if stk >0:
      h+=1
    stk -=1
print(2*h)
Buggy code:
#ABC120C
S=input()
a=''
c=0
for s in S:
	if a[-1:]==s:
		a=a[:-1]
		c+=2
	else:
		a+=s
print(c)

Fixed code:
#ABC120C
S=input()
a=''
c=0
for s in S:
	if a=='':
		a+=s
	elif a[-1:]!=s:
		a=a[:-1]
		c+=2
	else:
		a+=s
print(c)
Buggy code:
s=input()
zero=0
one=0
for i in s:
  if i="0":
    zero+=1
  elif i="1":
    one+=1
print(min(zero,one)*2)

Fixed code:
s=input()
zero=0
one=0
for i in s:
  if i=="0":
    zero+=1
  elif i=="1":
    one+=1
print(min(zero,one)*2)
Buggy code:
#! /usr/bin/env python3
# -*- coding: utf-8 -*-

S = input()
ls = list(S)
ls = [int(x) for x in ls]

ans = min(ls.count(0),ls.count(1))
pirnt(ans*2)

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

S = input()
ls = list(S)
ls = [int(x) for x in ls]

ans = min(ls.count(0),ls.count(1))
print(ans*2)
Buggy code:
s=str(input())

a=s.count('0')
b=s.count('0')
print(min(a,b)*2)

Fixed code:
s=str(input())

a=s.count('0')
b=s.count('1')
print(min(a,b)*2)
Buggy code:
S = str(input())

zero_num = 0
one_num = 

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

print(2*min(zero_num, len(S) - zero_num))

Fixed code:
S = str(input())

zero_num = 0

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

print(2*min(zero_num, len(S) - zero_num))
Buggy code:
S = str(input())

zero_num = 0
one_num = 0

for i in range(len(S)):
    if S[i] == 0:
        zero_num += 1
    else:
        one_num += 1

print(2*min(zero_num, one_num))

Fixed code:
S = str(input())

zero_num = 0
one_num = 0

for i in range(len(S)):
    if S[i] == "0":
        zero_num += 1
    else:
        one_num += 1

print(2*min(zero_num, one_num))