Buggy python submission (verdict: Runtime Error):
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 submission:
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 python submission (verdict: Runtime Error):
s = str(input())
n = len(s)
ans = 0
b = [0 for i in range(n)]
for i in range(n-1):
    if s[i] != s[i+1]:
        if b[i] == 0 and b[i+1] == 0:
            b[i] = 1
            b[i+1] = 1 
            ans += 2
            flag = True
            nowl = i
            nowr = i+1
            while flag:
                if nowl < 0 and nowr > n-1:
                    flag = False
                if b[nowl] == 1 and b[nowr] == 1:
                    nowl -= 1
                    nowr += 1
                elif b[nowl] == 1 and b[nowr] == 0:
                    nowl -= 1
                elif b[nowl] == 0 and b[nowr] == 1:
                    nowr += 1
                else:
                    if s[nowl] != s[nowr]:
                        ans += 2
                        b[nowl] += 1
                        b[nowr] += 1
                        nowl -= 1
                        nowr += 1
                    else:
                        flag = False
print(ans)
            

Fixed submission:
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 python submission (verdict: Runtime Error):
s = str(input())
n = len(s)
ans = 0
b = [0 for i in range(n)]
for i in range(n-1):
    if s[i] != s[i+1]:
        if b[i] == 0 and b[i+1] == 0:
            b[i] = 1
            b[i+1] = 1 
            ans += 2
            flag = True
            nowl = i
            nowr = i+1
            while flag:
                if nowl < 0 and nowr > n-1:
                    flag = False
                if b[nowl] == 1 and b[nowr] == 1:
                    nowl -= 1
                    nowr += 1
                elif b[nowl] == 1 and b[nowr] == 0:
                    nowl -= 1
                elif b[nowl] == 0 and b[nowr] == 1:
                    nowr += 1
                else:
                    if s[nowl] != s[nowr]:
                        ans += 2
                        b[nowl] += 1
                        b[nowr] += 1
                        nowl -= 1
                        nowr += 1
                    else:
                        flag = False
for i in range(1,n-1):
    if s[i] != s[i+1]:
        if b[i] == 0 and b[i+1] == 0:
            b[i] = 1
            b[i+1] = 1 
            ans += 2
            flag = True
            nowl = i-1
            nowr = i
            while flag:
                if nowl < 0 and nowr > n-1:
                    flag = False
                if b[nowl] == 1 and b[nowr] == 1:
                    nowl -= 1
                    nowr += 1
                elif b[nowl] == 1 and b[nowr] == 0:
                    nowl -= 1
                elif b[nowl] == 0 and b[nowr] == 1:
                    nowr += 1
                else:
                    if s[nowl] != s[nowr]:
                        ans += 2
                        b[nowl] += 1
                        b[nowr] += 1
                        nowl -= 1
                        nowr += 1
                    else:
                        flag = False
print(ans)
            

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