Buggy python submission (verdict: Time Limit Exceeded):
S = input()
N = len(S)
for _ in range(N//2):
    S = S.replace('01','').replace('10','')
    S = S.replace('10','').replace('01','')
    if S.count('01') == 0 and S.count('10') == 0:
        break
print(N - len(S))

Fixed submission:
S = input()
r = S.count('0')
b = S.count('1')
print(min(r,b)*2)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
N = len(S)
for _ in range(N//2):
    S = S.replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','')

    if S.count('01') == 0 and S.count('10') == 0:
        break
print(N - len(S))

Fixed submission:
S = input()
r = S.count('0')
b = S.count('1')
print(min(r,b)*2)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
N = len(S)
for _ in range(N//2):
    S = S.replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','').replace('01','').replace('10','')

    if S.count('01') == 0 and S.count('10') == 0:
        break
print(N - len(S))

Fixed submission:
S = input()
r = S.count('0')
b = S.count('1')
print(min(r,b)*2)

Buggy python submission (verdict: Runtime Error):
S = input()
N = len(S)
for _ in range(N//2):
    S = S.replace('01','').replace('10','')S.replace('01','').replace('10','')S.replace('01','').replace('10','')S.replace('01','').replace('10','')S.replace('01','').replace('10','')
    if S.count('01') == 0 and S.count('10') == 0:
        break
print(N - len(S))


Fixed submission:
S = input()
r = S.count('0')
b = S.count('1')
print(min(r,b)*2)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
N = len(S)
for _ in range(N):
    S = S.replace('01','').replace('10','')
    if S.count('01') == 0 and S.count('10') == 0:
        break
print(N - len(S))

Fixed submission:
S = input()
r = S.count('0')
b = S.count('1')
print(min(r,b)*2)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
N = len(S)
#print(N)
for _ in range(N//2):
    S = S.replace('01','').replace('10','')
    if S.count('01') == 0 and S.count('10') == 0:
        #print("break")
        break
print(N - len(S))

Fixed submission:
S = input()
r = S.count('0')
b = S.count('1')
print(min(r,b)*2)