Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):

from math import floor

def parse():
  return map(int, input().split(" "))

def main():
  A, B, N = parse()

  limit_N = 10000000
  N = limit_N if N > limit_N else N

  x = 0
  max_val = floor((A * x) / B) - A * floor(x / B)

  for x in range(1, N + 1):
    val = floor((A * x) / B) - A * floor(x / B)
    if max_val < val:
      max_val = val

  print(max_val)

if __name__ == "__main__":
  main()

Fixed submission:

from math import floor

def parse():
  return map(int, input().split(" "))

def main():
  A, B, N = parse()
  
  x = B - 1 if B - 1 <= N else N
  print(floor((A * x) / B) - A * floor(x / B))
  exit(0)

  limit_N = 5000000
  N = limit_N if N > limit_N else N

  x = 0
  max_val = floor((A * x) / B) - A * floor(x / B)

  for x in range(1, N + 1):
    val = floor((A * x) / B) - A * floor(x / B)
    if max_val < val:
      max_val = val

  print(max_val)


if __name__ == "__main__":
  main()
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
li = []
for i in range(N):
    a = input()
    if a not in li:
        li.append(a)
print(len(li))

Fixed submission:
N = int(input())
li = []
li = [input() for i in range(N)]
li2 = set(li)
print
print(len(li2))
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd_get(*numbers):
    return reduce(math.gcd, numbers)

K = int(input())

ans = 0
for i in range(1, K+1):
    for j in range(1, K+1):
        for l in range(1, K+1):
            ans += gcd_get(i, j, l)
print(ans)

Fixed submission:
import math
from functools import reduce

def gcd_get(*numbers):
    return reduce(math.gcd, numbers)

K = int(input())

ans = 0
for i in range(1, K+1):
    for j in range(1, K+1):
        for l in range(1, K+1):
            ans += gcd_get(i, j, l)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())

li=[]

for i in range(1,10):
    li.append(i)
for i in range(10,100):
    if abs(int(str(i)[0])-int(str(i)[1]))<2:
           li.append(i)
for i in range(100,1000):
    if abs(int(str(i)[1])-int(str(i)[2]))<2 and abs(int(str(i)[0])-int(str(i)[1]))<2:
           li.append(i)
for i in range(1000,10000):
    if abs(int(str(i)[2])-int(str(i)[3]))<2 and abs(int(str(i)[1])-int(str(i)[2]))<2 and abs(int(str(i)[0])-int(str(i)[1]))<2:
           li.append(i)
for i in range(10000,100000):
    if abs(int(str(i)[3])-int(str(i)[4]))<2 and abs(int(str(i)[2])-int(str(i)[3]))<2 and abs(int(str(i)[1])-int(str(i)[2]))<2 and abs(int(str(i)[0])-int(str(i)[1]))<2:
           li.append(i)
for i in range(100000,1000000):
    if abs(int(str(i)[4])-int(str(i)[5]))<2 and abs(int(str(i)[3])-int(str(i)[4]))<2 and abs(int(str(i)[2])-int(str(i)[3]))<2 and abs(int(str(i)[1])-int(str(i)[2]))<2 and abs(int(str(i)[0])-int(str(i)[1]))<2:
           li.append(i)
for i in range(1000000,10000000):
    if abs(int(str(i)[5])-int(str(i)[6]))<2 and abs(int(str(i)[4])-int(str(i)[5]))<2 and abs(int(str(i)[3])-int(str(i)[4]))<2 and abs(int(str(i)[2])-int(str(i)[3]))<2 and abs(int(str(i)[1])-int(str(i)[2]))<2 and abs(int(str(i)[0])-int(str(i)[1]))<2:
           li.append(i)
for i in range(10000000,100000000):
    if abs(int(str(i)[6])-int(str(i)[7]))<2 and abs(int(str(i)[5])-int(str(i)[6]))<2 and abs(int(str(i)[4])-int(str(i)[5]))<2 and abs(int(str(i)[3])-int(str(i)[4]))<2 and abs(int(str(i)[2])-int(str(i)[3]))<2 and abs(int(str(i)[1])-int(str(i)[2]))<2 and abs(int(str(i)[0])-int(str(i)[1]))<2:
           li.append(i)
for i in range(100000000,1000000000):
    if abs(int(str(i)[7])-int(str(i)[8]))<2 and abs(int(str(i)[6])-int(str(i)[7]))<2 and abs(int(str(i)[5])-int(str(i)[6]))<2 and abs(int(str(i)[4])-int(str(i)[5]))<2 and abs(int(str(i)[3])-int(str(i)[4]))<2 and abs(int(str(i)[2])-int(str(i)[3]))<2 and abs(int(str(i)[1])-int(str(i)[2]))<2 and abs(int(str(i)[0])-int(str(i)[1]))<2:
           li.append(i)
                    
print(li[k-1])

Fixed submission:
k = int(input())
li =[i+1 for i in range(9)]

c = 0
while len(li) < k:
    if li[c]%10 != 0:
        li.append(li[c]*10+li[c]%10-1)
    li.append(li[c]*10+li[c]%10)
    if li[c]%10 != 9:
        li.append(li[c]*10+li[c]%10+1)
    c +=1
    
print(li[k-1])
Buggy python submission (verdict: Runtime Error):
import sys

n = int(sys.stdin.readline())
 
li = list(map(int, sys.stdin.readline().split()))
 
ans = [0]*n
for i in range(n):
    li2 = li.copy()
    del li2[i]
    for j in range(n-1):
        for k in range(j+1, n-1):
            if li2[j] == li2[k]:
                ans[i] += 1
for l in range(len(ans)):
    print(ans[l])

Fixed submission:
n, m = map(int, input().split())

ans = 0

ans += n*(n-1)/2
ans += m*(m-1)/2

print(int(ans))
Buggy python submission (verdict: Runtime Error):
S = input()
 
if S = "AAA":
    print("No")
elif S = "BBB":
    print("No")
else:
    print("Yes")

Fixed submission:
S = input()
 
if S == "AAA":
    print("No")
elif S == "BBB":
    print("No")
else:
    print("Yes")

Buggy python submission (verdict: Runtime Error):
S = input()

if S = "AAA":
  print("No")
elif S = "BBB":
  print("No")
else:
  print("Yes")

Fixed submission:
S = input()
 
if S == "AAA":
    print("No")
elif S == "BBB":
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
import sys
N = int(input())
words = []
cnts = []
for i in range(N):
    S = input()
    if S not in words:
        words.append(S)
        cnts.append(1)
    else:
        cnts[words.index(S)] += 1
max_words = []
for j in range(len(words)):
    if cnts[j] == max(cnts):
        max_words.append(words[j])
max_words = sorted(max_words)
print(*max_words, sep ="\n")

Fixed submission:
from collections import Counter
N = int(input())
S =[input() for i in range(N)]
cnts = Counter(S)
mx = 0
for v in cnts.values():
    mx = max(mx, v)
    
max_words = [k for k, v in cnts.items() if v == mx]
max_words = sorted(max_words)
print(*max_words, sep ="\n")

Buggy python submission (verdict: Time Limit Exceeded):
import sys
N = int(input())
words = []
cnts = []
for i in range(N):
    S = input()
    if S not in words:
        words.append(S)
        cnts.append(1)
    else:
        cnts[words.index(S)] += 1
max_words = []
for j in range(len(words)):
    if cnts[j] == max(cnts):
        max_words.append(words[j])
max_words = sorted(max_words)
for a in max_words:
    print(a)

Fixed submission:
from collections import Counter
N = int(input())
S =[input() for i in range(N)]
cnts = Counter(S)
mx = 0
for v in cnts.values():
    mx = max(mx, v)
    
max_words = [k for k, v in cnts.items() if v == mx]
max_words = sorted(max_words)
print(*max_words, sep ="\n")
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
a = list(map(int, input().split()))
s = sum(a[:K])
ans = s
for i in range(N-K):
    s = s - s[i] + s[i+K]
    ans = max(s, ans)
print(ans)

Fixed submission:
N, K = map(int, input().split())
a = list(map(int, input().split()))
s = sum(a[:K])
ans = s
for i in range(N-K):
    s = s - a[i] + a[i+K]
    ans = max(s, ans)
print((ans+K)/2)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for i in range(N-K+1):
    s = (sum(a[i:i+K])+K)/2
    ans = max(s, ans)
print(ans)

Fixed submission:
N, K = map(int, input().split())
a = list(map(int, input().split()))
s = sum(a[:K])
ans = s
for i in range(N-K):
    s = s - a[i] + a[i+K]
    ans = max(s, ans)
print((ans+K)/2)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for i in range(N-K+1):
    s = (sum(a[i:i+K])+K)/2
    ans = max(s, ans)
print(ans)

Fixed submission:
N, K = map(int, input().split())
a = list(map(int, input().split()))
s = sum(a[:K])
ans = s
for i in range(N-K):
    s = s - a[i] + a[i+K]
    ans = max(s, ans)
print((ans+K)/2)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
n = int(sys.stdin.readline())
A = [int(sys.stdin.readline()) for i in range(n)]
for j in range(n):
    B = A.copy()
    B.remove(B[j])
    print(max(B))

Fixed submission:
import sys
n = int(sys.stdin.readline())
A = [int(sys.stdin.readline()) for i in range(n)]
B = sorted(A)
m1 = B[-1]
m2 = B[-2]

for a in A:
    if a == m1:
        print(m2)
    else:
        print(m1)

Buggy python submission (verdict: Runtime Error):
n = int(input())
A = [int(input()) for i in range(n)]
for j in range(n):
    B = A.copy()
    B.remove(B[j])
    print(max(B))

Fixed submission:
import sys
n = int(sys.stdin.readline())
A = [int(sys.stdin.readline()) for i in range(n)]
B = sorted(A)
m1 = B[-1]
m2 = B[-2]

for a in A:
    if a == m1:
        print(m2)
    else:
        print(m1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = [int(input()) for i in range(n)]
for j in range(n):
    B = A.copy()
    B.remove(B[j])
    print(max(B))

Fixed submission:
import sys
n = int(sys.stdin.readline())
A = [int(sys.stdin.readline()) for i in range(n)]
B = sorted(A)
m1 = B[-1]
m2 = B[-2]

for a in A:
    if a == m1:
        print(m2)
    else:
        print(m1)
Buggy python submission (verdict: Runtime Error):
import math
A, B, C, D = map(int, input().split())
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
def solve(n):
    return n - n//C - n//D + n//lcm(C, D)
print(solve(B) - solve(A-1))

Fixed submission:
import fractions
A, B, C, D = map(int, input().split())
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
def solve(n):
    return n - n//C - n//D + n//lcm(C, D)
print(solve(B) - solve(A-1))

Buggy python submission (verdict: Runtime Error):
import math
A, B, C, D = map(int, input().split())
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
def solve(n):
    ans = n - n//C - n//D + n//lcm(C, D)
    return ans
answer = solve(B) - solve(A-1)
print(answer)

Fixed submission:
import fractions
A, B, C, D = map(int, input().split())
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
def solve(n):
    return n - n//C - n//D + n//lcm(C, D)
print(solve(B) - solve(A-1))
Buggy python submission (verdict: Runtime Error):
foods = [int(input()) for i in range(5)]

li = []
for i in range(5):
    if foods[i] % 10 != 0:
        li.append(10-foods[i]%10)
        foods[i] += (10-foods[i]%10)
if li = []:
    ans = sum(foods)
else:    
    ans = sum(foods) - max(li)
print(ans)

Fixed submission:
foods = [int(input()) for i in range(5)]

li = []
for i in range(5):
    if foods[i] % 10 != 0:
        li.append(10-foods[i]%10)
        foods[i] += (10-foods[i]%10)
if li == []:
    ans = sum(foods)
else:    
    ans = sum(foods) - max(li)
print(ans)

Buggy python submission (verdict: Runtime Error):
foods = [int(input()) for i in range(5)]

li = []
for i in range(5):
    if foods[i] % 10 != 0:
        li.append(10-foods[i]%10)
        foods[i] += (10-foods[i]%10)
ans = sum(foods) - max(li)
print(ans)

Fixed submission:
foods = [int(input()) for i in range(5)]

li = []
for i in range(5):
    if foods[i] % 10 != 0:
        li.append(10-foods[i]%10)
        foods[i] += (10-foods[i]%10)
if li == []:
    ans = sum(foods)
else:    
    ans = sum(foods) - max(li)
print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()

li = []
cnt = 0
for i in range(len(S)):
    if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
        cnt += 1
    else:
        li.append(cnt)
        cnt = 0

print(max(li))

Fixed submission:
S = input()

li = []
cnt = 0
for i in range(len(S)):
    if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
        cnt += 1
    else:
        li.append(cnt)
        cnt = 0
li.append(cnt)

print(max(li))
Buggy python submission (verdict: Time Limit Exceeded):
from statistics import median
N = int(input())
X = list(map(int, input().split()))
for i in range(N): 
    Y = X[:i] + X[i+1:]
    print(median(Y))

Fixed submission:
N = int(input())
X = list(map(int, input().split()))
Y = sorted(X)
a = Y[N//2 - 1]
b = Y[N//2]
for i in range(N): 
    if X[i] <= a:
        print(b)
    else:
        print(a)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
x = list(map(int, input().split()))
y = []
for a in x:
    y.append(a)
    y.reverse()
print(*y)

Fixed submission:
import math
N = int(input())
x = list(map(int, input().split()))
y = []
if N%2 == 0:
    for i in range(N//2):
        y.append(x[N-1-2*i])
    for i in range(N//2):
        y.append(x[2*i])
if N%2 == 1:
    for i in range(math.ceil(N/2)):
        y.append(x[N-1-2*i])
    for i in range(math.floor(N/2)):
        y.append(x[2*i+1])
print(*y)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = [int(input()) for i in range(N)]
q = 1
cnt = 0
li = []
for i in range(100001):
    q = a[q-1]
    cnt += 1
    if q == 2:
        print(cnt)
        break
    if q in li:
        print(-1)
        break
    li.append(q)

Fixed submission:
import sys
N = int(input())
a = [int(input()) for i in range(N)]
q = 1
cnt = 0
li = []
for i in range(100001):
    q = a[q-1]
    cnt += 1
    if q == 2:
        print(cnt)
        sys.exit()
print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ans = 1
for i in range(1,N+1):
    ans *= i
print(ans%(10**9+7))

Fixed submission:
N = int(input())
ans = 1
for i in range(1,N+1):
    ans = (ans * i)%(10**9+7)
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
S = input()
alp = list(set(S))
cnts = [0] * len(alp)
for i in range(len(S)):
    cnts(alp.index(S[i])) += 1
    
for a in cnts:
    if a%2 == 1:
        print("No")
        sys.exit()
print("Yes")

Fixed submission:
import sys
S = input()
alp = list(set(S))
cnts = [0] * len(alp)
for i in range(len(S)):
    cnts[alp.index(S[i])] += 1
    
for a in cnts:
    if a%2 == 1:
        print("No")
        sys.exit()
print("Yes")
Buggy python submission (verdict: Runtime Error):
import sys

def debug(*args):
    print(*args, file=sys.stderr)


x_diff_of_5th_factor = int(input())


for a in range(-118, 119):
    for b in range(-119, 118):
        if a ** 5 - b ** 5 == x_diff_of_5th_factor:
            print('{} {}'.format(a, b))
            sys.exit(0)

sys.exit(1)


Fixed submission:
print('ABC' if input() == 'ARC' else 'ARC')

Buggy python submission (verdict: Runtime Error):
import sys

def debug(*args):
    print(*args, file=sys.stderr)


x_diff_of_5th_factor = int(input())


for a in range(-119, 118):
    for a in range(-118, 119):
        if a ** 5 - b ** 5 == x_diff_of_5th_factor:
            print('{} {}'.format(a, b))
            sys.exit(0)

sys.exit(1)


Fixed submission:
print('ABC' if input() == 'ARC' else 'ARC')
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a_s = [int(input()) for _ in range(m)]

dp = [1]

for i in range(1, n + 1):
    if i in a_s:
        dp.append(0)
    else:
        dpim2 = 0 if i-2 < 0 else dp[i-2]
        dp.append((dp[i-1] + dpim2) % 1000000007)

print(dp[-1])


Fixed submission:
n, m = map(int, input().split())
a_s = [int(input()) for _ in range(m)]

dp = [1]
n_with_a = [[i, False] for i in range(n+1)]



for a in a_s:
    n_with_a[a][1] = True



if 1 in a_s:
    dp.append(0)
else:
    dp.append(1)

for i, is_broken in n_with_a[2:]:
    if is_broken:
        dp.append(0)
    else:
        dp.append((dp[i-1] + dp[i-2]) % 1000000007)

print(dp[-1])
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
lrs = [list(map(int, input().split())) for _ in range(m)]

l_max = 1
r_min = n
for l, r in lrs:
    l_max = max(l, l_max)
    r_min = min(r, r_min)

print(min(r_min - l_max + 1), 0)


Fixed submission:
n, m = map(int, input().split())
lrs = [list(map(int, input().split())) for _ in range(m)]

l_max = 1
r_min = n
for l, r in lrs:
    l_max = max(l, l_max)
    r_min = min(r, r_min)

print(max(r_min - l_max + 1, 0))
Buggy python submission (verdict: Runtime Error):
n, q = map(int, input().split())
s = "_{}_".format(input())
td = [input().split() for _ in range(q)]

current_l = 0
current_r = n + 1

for t, d in reversed(td):

    if 0 <= current_l + 1 < len(s) and t == s[current_l + 1] and d == "L":
        current_l += 1x

    if 0 <= current_r - 1 < len(s) and t == s[current_r - 1] and d == "R":
        current_r -= 1x

print(max(current_r - current_l - 1, 0))


Fixed submission:
def search_right(a, x, lo=0, hi=None, key=lambda x: x):
    if lo < 0:
        raise ValueError('lo must be non-negative')
    if hi is None:
        hi = len(a)
    while lo < hi:
        mid = (lo+hi)//2
        if x < key(a[mid]): hi = mid
        else: lo = mid+1
    return lo


def search_left(a, x, lo=0, hi=None, key=lambda x: x):
    if lo < 0:
        raise ValueError('lo must be non-negative')
    if hi is None:
        hi = len(a)
    while lo < hi:
        mid = (lo+hi)//2
        if key(a[mid]) < x: lo = mid+1
        else: hi = mid
    return lo


def get_fin_pos(s, td, golem_pos):
    for t, d in td:
        if 0 <= golem_pos < len(s) and s[golem_pos] == t:
            golem_pos += 1 if d == "R" else -1
    return golem_pos


n, q = map(int, input().split())
s = "_{}_".format(input())
spells = [input().split() for _ in range(q)]

left = search_right(range(len(s)), 0, key=lambda golem: get_fin_pos(s, spells, golem))
right = search_left(range(len(s)), len(s) - 1, key=lambda golem: get_fin_pos(s, spells, golem))

print(right - left)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect

n, q = map(int, input().split())
s = input()
spells = [input().split() for _ in range(q)]

finally_positions = []

for golem_pos in range(-1, n+1):
    for t, d in spells:
        if 0 <= golem_pos < n and s[golem_pos] == t:
            golem_pos += 1 if d == "R" else -1
    finally_positions.append(golem_pos)

left = bisect.bisect_right(finally_positions, -1)
right = bisect.bisect_left(finally_positions, n)

print(right - left)


Fixed submission:
def search_right(a, x, lo=0, hi=None, key=lambda x: x):
    if lo < 0:
        raise ValueError('lo must be non-negative')
    if hi is None:
        hi = len(a)
    while lo < hi:
        mid = (lo+hi)//2
        if x < key(a[mid]): hi = mid
        else: lo = mid+1
    return lo


def search_left(a, x, lo=0, hi=None, key=lambda x: x):
    if lo < 0:
        raise ValueError('lo must be non-negative')
    if hi is None:
        hi = len(a)
    while lo < hi:
        mid = (lo+hi)//2
        if key(a[mid]) < x: lo = mid+1
        else: hi = mid
    return lo


def get_fin_pos(s, td, golem_pos):
    for t, d in td:
        if 0 <= golem_pos < len(s) and s[golem_pos] == t:
            golem_pos += 1 if d == "R" else -1
    return golem_pos


n, q = map(int, input().split())
s = "_{}_".format(input())
spells = [input().split() for _ in range(q)]

left = search_right(range(len(s)), 0, key=lambda golem: get_fin_pos(s, spells, golem))
right = search_left(range(len(s)), len(s) - 1, key=lambda golem: get_fin_pos(s, spells, golem))

print(right - left)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = []
for i in range(n):
    a.append(list(map(int, input().split())))

def bubble_sort(lst):
    for i in reversed(range(len(lst))):
        for j in range(i):
            if lst[j][0] > lst[j + 1][0]:
                lst[j], lst[j + 1] = lst[j + 1], lst[j]

bubble_sort(a)
purchase_price = 0

for price, count in a:
    if count < m:
        purchase_price += price * count
        m -= count

    else:
        purchase_price += price * m
        m = 0

print(purchase_price)

Fixed submission:
n, m = map(int, input().split())
a = []
for i in range(n):
    a.append(list(map(int, input().split())))

a = sorted(a, key=lambda x: x[0])
purchase_price = 0


for price, count in a:
    if count < m:
        purchase_price += price * count
        m -= count

    else:
        purchase_price += price * m
        m = 0

print(purchase_price)
Buggy python submission (verdict: Time Limit Exceeded):
cubes = input()

removed_cubes_count = 0

while True:
    removed_cubes = cubes.replace('01', '')
    removed_cubes = removed_cubes.replace('10', '')

    removed_cubes_count += len(cubes) - len(removed_cubes)

    if len(cubes) == len(removed_cubes):
        break

    cubes = removed_cubes

print(removed_cubes_count)


Fixed submission:
cube = input()

zero_count = 0
one_count = 0

for i in range(len(cube)):
    if cube[i] == '0':
        zero_count += 1
    else:
        one_count += 1

if zero_count < one_count:
    print(zero_count * 2)
else:
    print(one_count * 2)

Buggy python submission (verdict: Time Limit Exceeded):
cubes = input()

removed_cubes_count = 0

while True:
    count01 = cubes.count('01')
    count10 = cubes.count('10')

    if count01 == 0 and count10 == 0:
        break

    removed_cubes_count += count01 + count10

    cubes = cubes.translate({
        '01': '',
        '10': ''
    })



print(removed_cubes_count)


Fixed submission:
cube = input()

zero_count = 0
one_count = 0

for i in range(len(cube)):
    if cube[i] == '0':
        zero_count += 1
    else:
        one_count += 1

if zero_count < one_count:
    print(zero_count * 2)
else:
    print(one_count * 2)

Buggy python submission (verdict: Runtime Error):
cubes = input()

removed_cubes_count = 0

while True:
    count01 = cubes.count('01')
    count10 = cubes.count('10')

    if count01 == 0 and count10 == 0:
        break

    removed_cubes_count += count01 + count10

    cube = cube.translate({
        '01': '',
        '10': ''
    })

print(removed_cubes_count)

Fixed submission:
cube = input()

zero_count = 0
one_count = 0

for i in range(len(cube)):
    if cube[i] == '0':
        zero_count += 1
    else:
        one_count += 1

if zero_count < one_count:
    print(zero_count * 2)
else:
    print(one_count * 2)

Buggy python submission (verdict: Time Limit Exceeded):
cubes = input()

removed_cubes_count = 0

while True:
    remove_index01 = cubes.find('01')
    if remove_index01 >= 0:
        cubes = cubes[:remove_index01] + cubes[remove_index01 + 2:]
        removed_cubes_count += 2


    remove_index10 = cubes.find('10')
    if remove_index10 >= 0:
        cubes = cubes[:remove_index10] + cubes[remove_index10 + 2:]
        removed_cubes_count += 2

    if remove_index01 == -1 and remove_index10 == -1:
        break

print(removed_cubes_count)


Fixed submission:
cube = input()

zero_count = 0
one_count = 0

for i in range(len(cube)):
    if cube[i] == '0':
        zero_count += 1
    else:
        one_count += 1

if zero_count < one_count:
    print(zero_count * 2)
else:
    print(one_count * 2)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))


def bubble_sort(lst):
    for i in reversed(range(len(lst))):
        for j in range(i):
            if lst[j] > lst[j + 1]:
                lst[j], lst[j + 1] = lst[j + 1], lst[j]


bubble_sort(a)
zero_monster_indexes = []

while True:
    for monster_i in range(1, len(a)):
        if a[monster_i] == 0:
            zero_monster_indexes.append(monster_i)
        else:
            a[monster_i] %= a[0]

            if a[monster_i] == 0:
                zero_monster_indexes.append(monster_i)

    for zero_monster_index in reversed(zero_monster_indexes):
        a.pop(zero_monster_index)
    zero_monster_indexes.clear()

    bubble_sort(a)

    if len(a) == 1:
        break

print(a[0])


Fixed submission:
n = int(input())
a = list(map(int, input().split()))

a = sorted(a)
zero_monster_indexes = []

while True:
    for monster_i in range(1, len(a)):
        if a[monster_i] == 0:
            zero_monster_indexes.append(monster_i)
        else:
            a[monster_i] %= a[0]

            if a[monster_i] == 0:
                zero_monster_indexes.append(monster_i)

    for zero_monster_index in reversed(zero_monster_indexes):
        a.pop(zero_monster_index)
    zero_monster_indexes.clear()

    a = sorted(a)
    if len(a) == 1:
        break

print(a[0])