Buggy python submission (verdict: Time Limit Exceeded):
#ABC120C-Unification.py

from sys import stdin

input = stdin.readline

S = input().rstrip()

Nblock = 0

while '0' in S and '1' in S:
    s = S.split('0011')
    Nblock += (len(s)-1)*4
    S = ''.join(s)
    t = S.split('1100')
    Nblock += (len(t)-1)*4
    S = ''.join(t)
    s = S.split('1010')
    Nblock += (len(s)-1)*4
    S = ''.join(s)
    t = S.split('0101')
    Nblock += (len(t)-1)*4
    S = ''.join(t)
    s = S.split('10')
    Nblock += (len(s)-1)*2
    S = ''.join(s)
    t = S.split('01')
    Nblock += (len(t)-1)*2
    S = ''.join(t)

print(Nblock)


Fixed submission:
#ABC120C-Unification.py

from sys import stdin

input = stdin.readline

S = input().rstrip()

Nblock = min(S.count('1'), S.count('0'))

print(Nblock*2)

Buggy python submission (verdict: Time Limit Exceeded):
#ABC120C-Unification.py

from sys import stdin

input = stdin.readline

S = input().rstrip()

Nblock = 0

while '0' in S and '1' in S:
    s = S.split('10')
    Nblock += (len(s)-1)*2
    S = ''.join(s)
    t = S.split('01')
    Nblock += (len(t)-1)*2
    S = ''.join(t)


print(Nblock)


Fixed submission:
#ABC120C-Unification.py

from sys import stdin

input = stdin.readline

S = input().rstrip()

Nblock = min(S.count('1'), S.count('0'))

print(Nblock*2)

Buggy python submission (verdict: Time Limit Exceeded):
#ABC120C-Unification.py

from sys import stdin

input = stdin.readline

S = input().rstrip()

Nblock = 0

while '0' in S and '1' in S:
    s = S.split('01')
    Nblock += (len(s)-1)*2
    S = ''.join(s)
    t = S.split('10')
    Nblock += (len(t)-1)*2
    S = ''.join(t)


print(Nblock)


Fixed submission:
#ABC120C-Unification.py

from sys import stdin

input = stdin.readline

S = input().rstrip()

Nblock = min(S.count('1'), S.count('0'))

print(Nblock*2)

Buggy python submission (verdict: Time Limit Exceeded):
#ABC120C-Unification.py

from sys import stdin

input = stdin.readline

S = input().rstrip()

Nblock = 0

while True:
    for i in range(len(S)-1):
        if S[i:i+1] != S[i+1:i+2]:
            Nblock += 2
            S = S[:i] + S[i+2:]
            break
    else:
        break

print(Nblock)


Fixed submission:
#ABC120C-Unification.py

from sys import stdin

input = stdin.readline

S = input().rstrip()

Nblock = min(S.count('1'), S.count('0'))

print(Nblock*2)

Buggy python submission (verdict: Time Limit Exceeded):
#ABC120C-Unification.py

from sys import stdin

input = stdin.readline

S = input()

Nblock = 0

while '0' in S and '1' in S:
    for i in range(len(S)-1):
        if S[i:i+1] != S[i+1:i+2]:
            Nblock += 2
            S = S[:i] + S[i+2:]
            break

print(Nblock)


Fixed submission:
#ABC120C-Unification.py

from sys import stdin

input = stdin.readline

S = input().rstrip()

Nblock = min(S.count('1'), S.count('0'))

print(Nblock*2)

Buggy python submission (verdict: Runtime Error):
#ABC120C-Unification.py

from sys import stdin

input = stdin.readline

S = input()

Nblock = 0

while '0' in S and '1' in S:
    for i in range(len(S)-1):
        if S[i:i+1] != S[i+1:i+2]:
            Nblock += 2
            S = S[:i] + S[i+2:]
            print(S)
            break

print(Nblock)


Fixed submission:
#ABC120C-Unification.py

from sys import stdin

input = stdin.readline

S = input().rstrip()

Nblock = min(S.count('1'), S.count('0'))

print(Nblock*2)