Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
from operator import mul
from functools import reduce
def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

n, k = map(int, input().split())
r_max = n - k
b_max = k
for x in range(k):
    i = x + 1
    b = b_max - i
    r = r_max - i + 1
    r_count = cmb(i + r, i)
    b_count = cmb(b + i - 1, i - 1)
    # print("i({}), r({}), b({}), rc({}), bc({})".format(i, r, b, r_count, b_count))
    print(r_count * b_count % 1000000007)


Fixed submission:
from operator import mul
from functools import reduce
def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

n, k = map(int, input().split())
r_max = n - k
b_max = k
for x in range(k):
    i = x + 1
    b = b_max - i
    r = r_max - i + 1
    if b < 0 or r < 0:
        print(0)
        continue
    r_count = cmb(i + r, i)
    b_count = cmb(b + i - 1, i - 1)
    # print("i({}), r({}), b({}), rc({}), bc({})".format(i, r, b, r_count, b_count))
    print(r_count * b_count % 1000000007)

Buggy python submission (verdict: Runtime Error):
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n, k = map(int, input().split())
r_max = n - k
b_max = k
for x in range(k):
    i = x + 1
    b = b_max - i
    r = r_max - i + 1
    r_count = combinations_count(i + r, i)
    b_count = combinations_count(b + i - 1, i - 1)
    # print("i({}), r({}), b({}), rc({}), bc({})".format(i, r, b, r_count, b_count))
    print(r_count * b_count % 1000000007)


Fixed submission:
from operator import mul
from functools import reduce
def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

n, k = map(int, input().split())
r_max = n - k
b_max = k
for x in range(k):
    i = x + 1
    b = b_max - i
    r = r_max - i + 1
    if b < 0 or r < 0:
        print(0)
        continue
    r_count = cmb(i + r, i)
    b_count = cmb(b + i - 1, i - 1)
    # print("i({}), r({}), b({}), rc({}), bc({})".format(i, r, b, r_count, b_count))
    print(r_count * b_count % 1000000007)
Buggy python submission (verdict: Runtime Error):
import math
# 最小公倍数
def lcm(x, y):
    return (x * y) // math.gcd(x, y)    
a, b, c, d = map(int, input().split())
e = lcm(c, d)
#print("e: {}".format(e))
#print("c: {} - {}".format(b // c, (a - 1) // c))
#print("d: {} - {}".format(b // d, (a - 1) // d))
#print("e: {} - {}".format(b // e, (a - 1) // e))
count_c = b // c - (a - 1) // c
count_d = b // d - (a - 1) // d
count_e = b // e - (a - 1) // e
# b - a の中から d の倍数の個数を取得
#print("count_c: {}".format(count_c))
#print("count_d: {}".format(count_d))
#print("count_e: {}".format(count_e))
print(b - a + 1 - (count_c + count_d - count_e))

Fixed submission:
import fractions
# 最小公倍数
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)    
a, b, c, d = map(int, input().split())
e = lcm(c, d)
#print("e: {}".format(e))
#print("c: {} - {}".format(b // c, (a - 1) // c))
#print("d: {} - {}".format(b // d, (a - 1) // d))
#print("e: {} - {}".format(b // e, (a - 1) // e))
count_c = b // c - (a - 1) // c
count_d = b // d - (a - 1) // d
count_e = b // e - (a - 1) // e
# b - a の中から d の倍数の個数を取得
#print("count_c: {}".format(count_c))
#print("count_d: {}".format(count_d))
#print("count_e: {}".format(count_e))
print(b - a + 1 - (count_c + count_d - count_e))
Buggy python submission (verdict: Runtime Error):
10 3
3 6
5 7
6 9

Fixed submission:
N, M = map(int, input().split())
maxL = 0
minM = N
for x in range(M):
    l, m = map(int, input().split())
    maxL = max(maxL, l)
    minM = min(minM, m)

print(max(minM - maxL + 1, 0))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
cards = [0 for x in range(N)]
sum = 0
for x in range(M):
    l, m = map(int, input().split())
    for y in range(l - 1, m):
        cards[y] = cards[y] + 1
        if x == M - 1 and cards[y] == M:
            sum = sum + 1
print(sum)

Fixed submission:
N, M = map(int, input().split())
maxL = 0
minM = N
for x in range(M):
    l, m = map(int, input().split())
    maxL = max(maxL, l)
    minM = min(minM, m)

print(max(minM - maxL + 1, 0))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
cards = [True for x in range(N)]

for x in range(M):
    l, m = map(int, input().split())
    cards[0:l-1] = [False for y in range(0, l-1)]
    cards[m:] = [False for y in range(m, N)]
sum = 0
for x in cards:
    if x:
        sum = sum + 1

print(sum)

Fixed submission:
N, M = map(int, input().split())
maxL = 0
minM = N
for x in range(M):
    l, m = map(int, input().split())
    maxL = max(maxL, l)
    minM = min(minM, m)

print(max(minM - maxL + 1, 0))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
cards = [0 for x in range(N)]

for x in range(M):
    l, m = map(int, input().split())
    for y in range(l - 1, m):
        cards[y] = cards[y] + 1

sum = 0
for x in cards:
    if x == M:
        sum = sum + 1

print(sum)

Fixed submission:
N, M = map(int, input().split())
maxL = 0
minM = N
for x in range(M):
    l, m = map(int, input().split())
    maxL = max(maxL, l)
    minM = min(minM, m)

print(max(minM - maxL + 1, 0))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
cards = [0 for x in range(N)]

for x in range(M):
    l, m = map(int, input().split())
    for y in range(l - 1, m):
        cards[y] = cards[y] + 1

sum = 0
for x in cards:
    if x == M:
        sum = sum + 1

print(sum)

Fixed submission:
N, M = map(int, input().split())
maxL = 0
minM = N
for x in range(M):
    l, m = map(int, input().split())
    maxL = max(maxL, l)
    minM = min(minM, m)

print(max(minM - maxL + 1, 0))
Buggy python submission (verdict: Runtime Error):
import math

n, k = map(int, input().split())
limit = 1 / n
ans = 0
for x in range(1 , n + 1):
    num = math.pow(2, -1 * math.ceil(math.log(k / x, 2)))
    num = num / n
    if num > limit:
        num = limit
    ans = ans + num
    if ans >= 1:
        break
print("{:.12
f}".format(ans))

Fixed submission:
import math

n, k = map(int, input().split())
limit = 1 / n
ans = 0
for x in range(1 , n + 1):
    num = math.pow(2, -1 * math.ceil(math.log(k / x, 2)))
    num = num / n
    if num > limit:
        num = limit
    ans = ans + num
    if ans >= 1:
        break
print("{:.12f}".format(ans))
Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())
count = 0

for r in range(int(N / R) + 1):
    for g in range(int(N / G) + 1):
        x = N - r * R - g * G
        if x >= 0 and x % B == 0:
            count = count + 1

print(count)

Fixed submission:
R, G, B, N = map(int, input().split())
count = 0

for r in range(int(N / R) + 1):
    for g in range(int(N / G) + 1):
        x = N - r * R - g * G
        if x < 0:
            break
        if x >= 0 and x % B == 0:
            count = count + 1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())
count = 0

for r in range(N + 1):
    for g in range(N + 1 - r):
        for b in range(N + 1 - r - g):
            if r * R  + g * G + b * B == N:
                count = count + 1

print(count)

Fixed submission:
R, G, B, N = map(int, input().split())
count = 0

for r in range(int(N / R) + 1):
    for g in range(int(N / G) + 1):
        x = N - r * R - g * G
        if x < 0:
            break
        if x >= 0 and x % B == 0:
            count = count + 1

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
s = input()
a = []
maxLen = 0
now = ''
for i in range(n):
    decriment = 0
    if now != s[i]:
        now = s[i]
        if now == '0':
            decriment = 1
        a.append([k, i, 0])
    for j in a:
        j[0] -= decriment
        if j[0] >= 0:
            j[2] += 1
for j in a:
    maxLen = max(maxLen, j[2])
print(maxLen)

Fixed submission:
n, k = map(int, input().split())
s = input()
x = None
count = 0
u = []
for c in s:
    if x != c and count > 0:
        if x == '0':
            u.append(count * -1)
        else:
            u.append(count)
        count = 0
    x = c
    count = count + 1
if x == '0':
    u.append(count * -1)
else:
    u.append(count)

x = 0
st = 0
ans = []
num = 0
for i in range(len(u)):
    if u[i] < 0:
        if x + 1 > k:
            #print("i({}), st({}), num({})".format(i, st, num))
            x = x - 1
            ans.append(num)
            while True: 
                num = num - abs(u[st])
                st = st + 1
                if u[st - 1] < 0:
                    break
        x = x + 1
    num = num + abs(u[i])
if num > 0:
    ans.append(num)
#print(ans)
print(max(ans))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
s = input()
s = list(s)
x = 0
maxIndex = len(s) - 1
count = 0
while True:
    if len(s) == x + 1:
        break
    if s[x] != s[x + 1]:
        s.pop(x)
        s.pop(x)
        count += 1
        x -= 1
    else:
        x += 1
print("{}".format(count * 2))


Fixed submission:
s = input()
x = 0
for c in s:
    if c == '1':
        x = x + 1
print(min(x, len(s) - x) * 2)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
s = input()
s = list(s)
x = 0
maxIndex = len(s) - 1
count = 0
while True:
    if len(s) - 1 == x:
        break
    if s[x] != s[x + 1]:
        s.pop(x)
        s.pop(x)
        count += 1
        x -= 1
    else:
        x += 1
print(count * 2)


Fixed submission:
s = input()
x = 0
for c in s:
    if c == '1':
        x = x + 1
print(min(x, len(s) - x) * 2)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
s = input()
s = list(s)
x = 0
maxIndex = len(s) - 1
count = 0
while True:
    if len(s) <= x:
        break
    if s[x] != s[x + 1]:
        s.pop(x)
        s.pop(x)
        maxIndex = len(s) - 1
        count += 1
    else:
        x += 1
print(count * 2)


Fixed submission:
s = input()
x = 0
for c in s:
    if c == '1':
        x = x + 1
print(min(x, len(s) - x) * 2)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
s = input()
s = list(s)
x = 0
maxIndex = len(s) - 1
count = 0
while True:
    if maxIndex < x + 1:
        break
    if s[x] != s[x + 1]:
        s.pop(x)
        s.pop(x)
        maxIndex = len(s) - 1
        x = min(maxIndex, x - 1)
        count += 1
    else:
        x += 1
print(count * 2)


Fixed submission:
s = input()
x = 0
for c in s:
    if c == '1':
        x = x + 1
print(min(x, len(s) - x) * 2)
Buggy python submission (verdict: Runtime Error):
A,B,C = map(int,input().split())
	if A=B=C:
    print("No")
    elif A!=B!=C:
    print("No")
    else :
      print("Yes")
    

Fixed submission:
A,B,C = map(int,input().split())
if A==B!=C:
    print("Yes")
elif A!=B==C:
    print("Yes")
elif A==C!=B:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

N = input()
A = list(map(int,input().split()))
flag = False
while 1:
    a = A[0]
    A = A[1:]
    if a in A:
        flag = True
        break
    if len(A) == 0:
        break


if flag:
    print("NO")
else:
    print("YES")

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

N = int(input())
A = list(map(int,input().split()))
A = set(A)
if N == len(A):
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

N = input()
A = list(map(int,input().split()))
li = []
flag = False
for a in A:
    if a in li:
        flag = True
        break
    else:
        li.append(a)
if flag:
    print("NO")
else:
    print("YES")

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

N = int(input())
A = list(map(int,input().split()))
A = set(A)
if N == len(A):
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
li_AC = [0]*N
count_WA = [0]*N
count_WA_total = 0
for i in range(M):
    p, S = input().split()
    p = int(p)
    if li_AC[p-1] == 0:
        if S == "AC":
            li_AC[p-1] = 1
            count_WA_total += count_WA[p-1]
        if S == "WA":
            count_WA[p-1] += 1
print(counter(li_AC, 1), count_WA_total)

Fixed submission:
from collections import Counter
def counter(li, n):
    count = Counter()
    count.update(li)
    return count[n]
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
li_AC = [0]*N
count_WA = [0]*N
count_WA_total = 0
for i in range(M):
    p, S = input().split()
    p = int(p)
    if li_AC[p-1] == 0:
        if S == "AC":
            li_AC[p-1] = 1
            count_WA_total += count_WA[p-1]
        if S == "WA":
            count_WA[p-1] += 1
print(counter(li_AC, 1), count_WA_total)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline().rstrip
X = int(input())
if X == 2:
    print(2)
elif X%2 == 0:
    X += 1
    for num in range(X, 10**6, 2):
        if is_prime(num):
            print(num)
            break
else:
    for num in range(X, 10**6, 2):
        if is_prime(num):
            print(num)
            break

Fixed submission:
def is_prime(n):
    for i in range(2, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return n != 1


import sys
input = sys.stdin.readline().rstrip
X = int(input())

if X%2 == 0:
    if X == 2:
        print(2)
    else:
        X += 1
        for num in range(X, 10**6, 2):
            if is_prime(num):
                print(num)
                break
else:
    for num in range(X, 10**6, 2):
        if is_prime(num):
            print(num)
            break
Buggy python submission (verdict: Runtime Error):
N = int(input())
flag = False
for i in range(10):
    if N%i == 0 and N//i < 10:
        flag = True
if flag:
    print("Yes")
else:
    print("No")

Fixed submission:
N = int(input())
flag = False
for i in range(1, 10):
    if N%i == 0 and N//i < 10:
        flag = True
if flag:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a=int(input())
s=input()
if a < 3200:
    print(red)
else:
    print(s)

Fixed submission:
a=int(input())
s=input()
if a < 3200:
    print("red")
else:
    print(s)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
for i in A:
    sum += 1/i
print(1/sum)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
sum = 0
for i in A:
    sum += 1/i
print(1/sum)
Buggy python submission (verdict: Runtime Error):
K, X = map(int,input().split())
for i in range(X-K+1, X+K-1):
    print(i," ",  end = "")
print(i+1)

Fixed submission:
K, X = map(int,input().split())
if K == 1:
    print(X)
else:
    for i in range(X-K+1, X+K-1):
        print(i," ",  end = "")
    print(i+1)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
d = list(map(int, input().split()))
count = 0
d.sort()
for i in range((N-2)//2):
    d = d[1:]
    d = d[:-1]
print(d[1]-d[0])


Fixed submission:
N = int(input())
d = list(map(int, input().split()))
count = 0
d.sort()
print(d[N//2]-d[N//2-1])
Buggy python submission (verdict: Runtime Error):
import math

A, B, C, D = map(int, input().split())
CD = math.ceil(C * D / math.gcd(C, D))
AC = math.ceil(A / C)
BC = math.ceil(B / C)
C = BC - AC + 1
AD = math.ceil(A / D)
BD = math.ceil(B / D)
D = BD - AD + 1
ACD = math.ceil(A / CD)
BCD = math.ceil(B / CD)
CD = BCD - ACD + 1
print((B-A+1) - (C + D - CD))

Fixed submission:
import sys
input = sys.stdin.readline
from fractions import gcd
def lcm(a, b):
    return a*b // gcd(a, b)
def group(s, t, u):
    su = (s - 1) // u
    tu = t // u
    return  tu - su

A, B, C, D = map(int, input().split())
ABC = group(A, B, C)
ABD = group(A, B, D)
ABCD = group(A, B, lcm(C,D))
U = B - A + 1
print(U-(ABC+ABD-ABCD))

Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)


A, B, C, D = map(int, input().split())
CD = C * D // gcd(C, D)
AC = math.ceil(A / C)
BC = math.ceil(B / C)
C = math.ceilBC - AC + 1
AD = math.ceil(A / D)
BD = math.ceil(B / D)
D = BD - AD + 1
ACD = math.ceil(A / CD)
BCD = math.ceil(B / CD)
CD = BCD - ACD + 1
print((B-A+1) - (C + D - CD))

Fixed submission:
import sys
input = sys.stdin.readline
from fractions import gcd
def lcm(a, b):
    return a*b // gcd(a, b)
def group(s, t, u):
    su = (s - 1) // u
    tu = t // u
    return  tu - su

A, B, C, D = map(int, input().split())
ABC = group(A, B, C)
ABD = group(A, B, D)
ABCD = group(A, B, lcm(C,D))
U = B - A + 1
print(U-(ABC+ABD-ABCD))
Buggy python submission (verdict: Runtime Error):
N, X = map(int, input().split())
li = list(map(int, input().split()))
i = 0
D = 0
while D <= X:
    if i > N + 1:
        break
    D += li[i]
    i += 1

if i > N + 1:
    print(N+1)
else:
    print(i)


Fixed submission:
N, X = map(int, input().split())
li = list(map(int, input().split()))
D = [0]*(N+1)
flag = "0"
for i in range(N):
    D[i+1] = D[i] + li[i]
    if D[i+1] > X:
        flag = "1"
        break
if flag == "1":
    print(i + 1)
else:
    print(N + 1)

Buggy python submission (verdict: Runtime Error):
N, X = map(int, input().split())
li = list(map(int, input().split()))
i = 0
D = 0
while D <= X:
    D += li[i]
    i += 1
    if i > N + 1:
        break
if i > N + 1:
    print(N+1)
else:
    print(i)


Fixed submission:
N, X = map(int, input().split())
li = list(map(int, input().split()))
D = [0]*(N+1)
flag = "0"
for i in range(N):
    D[i+1] = D[i] + li[i]
    if D[i+1] > X:
        flag = "1"
        break
if flag == "1":
    print(i + 1)
else:
    print(N + 1)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
li = [[0]*2 for _ in range(5)]
count = 0
total = 0
for i in range(5):
    li[i][0] = int(input())
    li[i][1] = li[i][0]%10
    if li[i][1] == 0:
        count += 1
li.sort(key=lambda x:x[1])
for i in range(count):
    total += li[0][0]
    li = li[1:]
for i in range(5-count-1):
    total += (li[-1][0]+10-li[-1][1])
    li = li[:-1]
print(total+li[0][0])  

Fixed submission:
import sys
input = sys.stdin.readline
li = [[0]*2 for _ in range(5)]
count = 0
total = 0
for i in range(5):
    li[i][0] = int(input())
    li[i][1] = li[i][0]%10
    if li[i][1] == 0:
        count += 1
li.sort(key=lambda x:x[1])
for i in range(count):
    total += li[0][0]
    li = li[1:]
if count != 5:
    for i in range(5-count-1):
        total += (li[-1][0]+10-li[-1][1])
        li = li[:-1]
    print(total+li[0][0])
else:
    print(total)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
sum = 0
money = 0
A = list()
B = list()
for i in range(n):
    a, b = input().split()
    A.append(int(a))
    B.append(int(b))
for i in range(n):
    index = A.index(min(A))
    if(B[index] >= m - sum):
        money += A[index] * (m - sum)
        sum = m
        break
    else:
        sum += B[index]
        money += A[index]*B[index]
    del A[index]
    del B[index]
print(money)

Fixed submission:
n, m = map(int, input().split())
sum = 0
money = 0
list_ab = list()
for i in range(n):
    list_ab.append(list(map(int, input().split())))
list_ab = sorted(list_ab)
for i in range(n):
    if(list_ab[i][1] >= m - sum):
        money += list_ab[i][0] * (m - sum)
        break
    else:
        sum += list_ab[i][1]
        money += list_ab[i][0]*list_ab[i][1]
print(money)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
sum = 0
money = 0
A = list()
B = list()
for i in range(n):
    a, b = input().split()
    A.append(int(a))
    B.append(int(b))
for i in range(n):
    index = A.index(min(A))
    if(B[index] >= m - sum):
        money += A[index] * (m - sum)
        sum = m
    else:
        sum += B[index]
        money += A[index]*B[index]
    if(sum == m):
        print(money)
        break
    del A[index]
    del B[index]


Fixed submission:
n, m = map(int, input().split())
sum = 0
money = 0
list_ab = list()
for i in range(n):
    list_ab.append(list(map(int, input().split())))
list_ab = sorted(list_ab)
for i in range(n):
    if(list_ab[i][1] >= m - sum):
        money += list_ab[i][0] * (m - sum)
        break
    else:
        sum += list_ab[i][1]
        money += list_ab[i][0]*list_ab[i][1]
print(money)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
sum = 0
money = 0
A = list()
B = list()
for i in range(n):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
for i in range(n):
    index = A.index(min(A))
    if(B[index] >= m - sum):
        money += A[index] * (m - sum)
        sum = m
    else:
        sum += B[index]
        money += A[index]*B[index]
    if(sum == m):
        print(money)
        break
    del A[index]
    del B[index]


Fixed submission:
n, m = map(int, input().split())
sum = 0
money = 0
list_ab = list()
for i in range(n):
    list_ab.append(list(map(int, input().split())))
list_ab = sorted(list_ab)
for i in range(n):
    if(list_ab[i][1] >= m - sum):
        money += list_ab[i][0] * (m - sum)
        break
    else:
        sum += list_ab[i][1]
        money += list_ab[i][0]*list_ab[i][1]
print(money)
Buggy python submission (verdict: Runtime Error):
s = input()
length_s = len(s)
list_s = list()
for i in range(length_s):
    list_s.append(s[:1])
    s = s[1:]
length = length_s
while(length > 2):
    for j in range(length - 1):
        if(list_s[j] != list_s[j+1]):
            del list_s[j:j+2]
            break;
        length = len(list_s)
print(length_s - len(list_s))


Fixed submission:
from collections import Counter
def counter(li, n):
    count = Counter()
    count.update(li)
    return count[n]

import sys
input = sys.stdin.readline
S = list(input())[:-1]
S = list(map(int, S))
N = len(S)
count_0 = counter(S, 0)
count_1 = N-count_0
print(N-abs(count_1-count_0))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
length_s = len(s)
list_s = list()
for i in range(length_s):
    list_s.append(s[:1])
    s = s[1:]
for i in range(length_s):
    length = len(list_s)
    if (length < 2):
        break
    for j in range(length - 1):
        if(list_s[j] != list_s[j+1]):
            del list_s[j:j+2]
            break;
print(length_s - len(list_s))


Fixed submission:
from collections import Counter
def counter(li, n):
    count = Counter()
    count.update(li)
    return count[n]

import sys
input = sys.stdin.readline
S = list(input())[:-1]
S = list(map(int, S))
N = len(S)
count_0 = counter(S, 0)
count_1 = N-count_0
print(N-abs(count_1-count_0))
Buggy python submission (verdict: Runtime Error):
size = input()
sum = 0
for i in range(int(size)):
    x = input()
    x = float(x)
    u = input()
    if(u == "BTC"):
        x *= 380000
    sum += x
print(sum)

Fixed submission:
size = input()
sum = 0
for i in range(int(size)):
    x,u = input().split()
    x = float(x)
    if(u == "BTC"):
        x *= 380000
    sum += x
print(sum)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N = int(input())
li_L = map(int, input().split())
a = max(li_L)
li_L = li_L.remove(a)
if a < sum(li_L):
    print("Yes")
else:
    print("No")

Fixed submission:
import sys
input = sys.stdin.readline
N = int(input())
li_L = list(map(int, input().split()))
a = max(li_L)
li_L.remove(a)
if a < sum(li_L):
    print("Yes")
else:
    print("No")