Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import sys
from collections import Counter

def solve(S: str):
    # S[i, j) % 2019 == 0となる(i, j)の数
    # S[i..n) - S[j, n) === 0 (mod 2019)
    # 累積mod c[i] = S[i:]
    n = len(S)
    c = [0] * (n + 1)
    for i in range(n):
        c[i] = int(S[i:]) % 2019
    print(sum(v * (v - 1) // 2 for v in Counter(c).values()))


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)


if __name__ == "__main__":
    main()


Fixed submission:
#!/usr/bin/env python3
import sys
from collections import Counter


def solve(S: str):
    # S[i, j) % 2019 == 0となる(i, j)の数
    # S[i..n) - S[j, n) === 0 (mod 2019)
    # 累積mod c[i] = S[i:]
    n = len(S)
    c = [0] * (n + 1)  # c[i] = int(S[i:]) % 2019
    for i in reversed(range(n)):
        c[i] = (c[i + 1] + int(S[i]) * pow(10, n - 1 - i, 2019)) % 2019
    print(sum(v * (v - 1) // 2 for v in Counter(c).values()))


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
n = int(input())
m = int(input())
ans = n*(n-1)//2+m*(m-1)//2

print(ans)


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

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

print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
m = int(input())
ans = n*(n-1)/2+m*(m-1)/2

print(int(ans))

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

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

print(ans)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys


def solve(W, H, x, y):
    if x==0:
        ans = W*min(y, H-y)
        print(ans+" 0")
        return
    if y == 0:
        ans = H*min(x, W-x)
        print(ans+" 0")
        return

    s1 = W*min(y, H-y)
    s2 = H*min(x, W-x)
    if y*W > H*x:
        s_ = H**2*x/(2*y)
        s3 = min(H*W - s_, s_)
    else:
        s_ = W**2*y/(2*x)
        s3 = min(H*W - s_, s_)
    ss = [s1, s2, s3]
    ans = str(max(ss))
    if len(list(set(ss))) == len(ss):
        flag = "0"
    else:
        flag = "1"
    print(ans + " " + flag)

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    W = int(next(tokens))  # type: int
    H = int(next(tokens))  # type: int
    x = int(next(tokens))  # type: int
    y = int(next(tokens))  # type: int
    solve(W, H, x, y)

if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3
import sys


def solve(W, H, x, y):
    ans = str(H*W/2)
    if x == 0 or y == 0:
        flag = "0"
    else:
        if x == W/2 and y == H/2:
            flag = "1"
        else:
            flag = "0"
    print(ans + " " + flag)

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    W = int(next(tokens))  # type: int
    H = int(next(tokens))  # type: int
    x = int(next(tokens))  # type: int
    y = int(next(tokens))  # type: int
    solve(W, H, x, y)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
MOD = 1000000007
N = 100001

fibo = [1, 1] + [0] * N
for i in range(2, N):
    fibo[i] = (fibo[i - 1] + fibo[i - 2]) % MOD

n, m = list(map(int, input().split(" ")))
a_list = [int(input()) for _ in range(m)]
ngs = [i in a_list for i in range(n)]
ngs.append(False)
for i in range(n):
    if ngs[i] and ngs[i + 1]:
        print(0)
        exit()
cnts = []
cnt = 0

for ng in ngs:
    if ng:
        cnts.append(cnt)
        cnt = 0
        continue
    cnt += 1
cnts.append(cnt)
ans = 1
for c in cnts:
    if c != 0:
        ans *= fibo[c - 1]
# print(ngs)
# print(cnts)
print(ans % MOD)


Fixed submission:
MOD = 1000000007
N = 100001

fibo = [1, 1] + [0] * N
for i in range(2, N):
    fibo[i] = (fibo[i - 1] + fibo[i - 2]) % MOD

n, m = list(map(int, input().split(" ")))
a_list = [int(input()) for _ in range(m)]
is_ngs = [0] * (n + 2)
for a in a_list:
    is_ngs[a] = 1
for i in range(n):
    if is_ngs[i] and is_ngs[i + 1]:
        print(0)
        exit()
cnts = []
cnt = 0

for i in range(n + 1):
    if is_ngs[i]:
        cnts.append(cnt)
        cnt = 0
        continue
    cnt += 1
cnts.append(cnt)
ans = 1
for c in cnts:
    if c != 0:
        ans *= fibo[c - 1]
# print(is_ngs)
# print(cnts)
print(ans % MOD)

Buggy python submission (verdict: Runtime Error):
import math
from functools import lru_cache

MOD = 1000000007


@lru_cache(None)
def fibo(x):
    if x <= 1:
        return 1
    return fibo(x - 2) + fibo(x - 1)


n, m = list(map(int, input().split(" ")))
a_list = [int(input()) for _ in range(m)]
ngs = [i in a_list for i in range(n)]
ngs.append(False)
for i in range(n):
    if ngs[i] and ngs[i + 1]:
        print(0)
        exit()
cnts = []
cnt = 0

for ng in ngs:
    if ng:
        cnts.append(cnt)
        cnt = 0
        continue
    cnt += 1
cnts.append(cnt)
ans = 1
for c in cnts:
    if c != 0:
        ans *= fibo(c - 1)
# print(ngs)
# print(cnts)
print(ans % MOD)


Fixed submission:
MOD = 1000000007
N = 100001

fibo = [1, 1] + [0] * N
for i in range(2, N):
    fibo[i] = (fibo[i - 1] + fibo[i - 2]) % MOD

n, m = list(map(int, input().split(" ")))
a_list = [int(input()) for _ in range(m)]
is_ngs = [0] * (n + 2)
for a in a_list:
    is_ngs[a] = 1
for i in range(n):
    if is_ngs[i] and is_ngs[i + 1]:
        print(0)
        exit()
cnts = []
cnt = 0

for i in range(n + 1):
    if is_ngs[i]:
        cnts.append(cnt)
        cnt = 0
        continue
    cnt += 1
cnts.append(cnt)
ans = 1
for c in cnts:
    if c != 0:
        ans *= fibo[c - 1]
# print(is_ngs)
# print(cnts)
print(ans % MOD)
Buggy python submission (verdict: Runtime Error):
print(n // min([a,b,c,d,e]) + 5)


Fixed submission:
import math

n, a, b, c, d, e = [int(input()) for _ in range(6)]
print(math.ceil(n / min([a,b,c,d,e])) + 4)
Buggy python submission (verdict: Time Limit Exceeded):
n, q = list(map(int, input().split(" ")))
s = input()
s = s.replace("AC", "ZC")
ac_index = [s[:i].count("Z") for i in range(len(s))]
num = 0
for _s in s:
    if _s == "Z":
        num += 1
    ac_index.append(num)

i = 0

for _ in range(q):
    l, r = list(map(int, input().split(" ")))
    print(ac_index[r-1] - ac_index[l-1])


Fixed submission:
n, q = list(map(int, input().split(" ")))
s = input()
s = s.replace("AC", "ZC")
num = 0
ac_index = []
for _s in s:
    if _s == "Z":
        ac_index.append(num)
        num += 1
    else:
        ac_index.append(num)
i = 0

for _ in range(q):
    l, r = list(map(int, input().split(" ")))
    print(ac_index[r-1] - ac_index[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
n, q = list(map(int, input().split(" ")))
s = input()
s = s.replace("AC", "ZC")
ac_index = [s[:i].count("Z") for i in range(len(s))]
i = 0

for _ in range(q):
    l, r = list(map(int, input().split(" ")))
    print(ac_index[r-1] - ac_index[l-1])


Fixed submission:
n, q = list(map(int, input().split(" ")))
s = input()
s = s.replace("AC", "ZC")
num = 0
ac_index = []
for _s in s:
    if _s == "Z":
        ac_index.append(num)
        num += 1
    else:
        ac_index.append(num)
i = 0

for _ in range(q):
    l, r = list(map(int, input().split(" ")))
    print(ac_index[r-1] - ac_index[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
n, q = list(map(int, input().split(" ")))
s = input()
s = s.replace("AC", "Z")
ac_index = []
i = 0
for _s in s:
    if _s == "Z":
        ac_index.append(i)
        i += 2
    else:
        i += 1
for _ in range(q):
    l, r = list(map(int, input().split(" ")))
    print(len([x for x in ac_index if l - 1 <= x <= r - 2]))


Fixed submission:
n, q = list(map(int, input().split(" ")))
s = input()
s = s.replace("AC", "ZC")
num = 0
ac_index = []
for _s in s:
    if _s == "Z":
        ac_index.append(num)
        num += 1
    else:
        ac_index.append(num)
i = 0

for _ in range(q):
    l, r = list(map(int, input().split(" ")))
    print(ac_index[r-1] - ac_index[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
def count_ac(string):
    return string.replace("AC", "Z").count("Z")

n, q = list(map(int, input().split(" ")))
s = input()
for _ in range(q):
    l, r = list(map(int, input().split(" ")))
    print(count_ac(s[l-1: r]))


Fixed submission:
n, q = list(map(int, input().split(" ")))
s = input()
s = s.replace("AC", "ZC")
num = 0
ac_index = []
for _s in s:
    if _s == "Z":
        ac_index.append(num)
        num += 1
    else:
        ac_index.append(num)
i = 0

for _ in range(q):
    l, r = list(map(int, input().split(" ")))
    print(ac_index[r-1] - ac_index[l-1])
Buggy python submission (verdict: Runtime Error):

def count(h_list):
    if len(h_list) == 0:
        return 0
    if len(h_list) == 1:
        return h_list[0]
    if (h_list != 0).all():
        return 1 + count(h_list - 1)
    elif (h_list == 1).all():
        return 1
    return sum([count(x) for x in divide_by_zero(h_list)])


def divide_by_zero(arr):
    non_zero = []
    for ar in arr:
        if ar == 0:
            if non_zero:
                yield np.array(non_zero)
                non_zero = []
        else:
            non_zero.append(ar)
    yield np.array(non_zero)

n = int(input())
h_list = np.array([int(x) for x in input().split(" ")])
print(count(h_list))


Fixed submission:
def count(h_list):
    if len(h_list) == 0:
        return 0
    if len(h_list) == 1:
        return h_list[0]
    if 0 not in h_list:
        return 1 + count([x-1 for x in h_list])
    elif all(x == 1 for x in h_list):
        return 1
    return sum([count(x) for x in divide_by_zero(h_list)])


def divide_by_zero(arr):
    non_zero = []
    for ar in arr:
        if ar == 0:
            if non_zero:
                yield non_zero
                non_zero = []
        else:
            non_zero.append(ar)
    yield non_zero


n = int(input())
h_list = [int(x) for x in input().split(" ")]
print(count(h_list))
Buggy python submission (verdict: Runtime Error):
s = set(list(map(int, input().split(' '))))
if s == set([1,9,7,4]):
    print(YES)
else:
    print(NO)

Fixed submission:
s = set(list(map(int, input().split(' '))))
if s == set([1,9,7,4]):
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
from io import StringIO


UP = 0
LEFT = 1
LEFTUP = 2


def lcs(s, t):
    m = len(s)
    n = len(t)
    # dp[i][j] = LCS-length of (s[:i], t[:j])
    dp = [[(0, None)] * (n + 1) for i in range(m + 1)]

    for i in range(m + 1):
        for j in range(n + 1):
            if i == 0 or j == 0:
                continue
            elif s[i - 1] == t[j - 1]:
                dp[i][j] = (dp[i - 1][j - 1][0] + 1, LEFTUP)
            elif dp[i - 1][j][0] >= dp[i][j - 1][0]:
                dp[i][j] = (dp[i - 1][j][0], UP)
            else:
                dp[i][j] = (dp[i][j - 1][0], LEFT)
    buf = StringIO()
    i = m
    j = n
    while i > 0 and j > 0:
        if dp[i][j][1] == LEFTUP:
            buf.write(t[j - 1])
            i -= 1
            j -= 1
        elif dp[i][j][1] == UP:
            i -= 1
        else:
            j -= 1
    buf.seek(0)
    ans = buf.read()[::-1]
    return ans


if __name__ == "__main__":
    print(lcs(input(), input()))


Fixed submission:
from io import StringIO


UP = 0
LEFT = 1
LEFTUP = 2


def lcs(s, t):
    m = len(s)
    n = len(t)
    # dp[i][j] = LCS-length of (s[:i], t[:j])
    dp = [[(0, None)] * (n + 1) for i in range(m + 1)]

    for i in range(m + 1):
        for j in range(n + 1):
            if i == 0 or j == 0:
                continue
            elif s[i - 1] == t[j - 1]:
                dp[i][j] = (dp[i - 1][j - 1][0] + 1, LEFTUP)
            elif dp[i - 1][j][0] >= dp[i][j - 1][0]:
                dp[i][j] = (dp[i - 1][j][0], UP)
            else:
                dp[i][j] = (dp[i][j - 1][0], LEFT)
    buf = StringIO()
    i = m
    j = n
    while i > 0 and j > 0:
        if dp[i][j][1] == LEFTUP:
            buf.write(t[j - 1])
            i -= 1
            j -= 1
        elif dp[i][j][1] == UP:
            i -= 1
        else:
            j -= 1
    buf.seek(0)
    ans = buf.read()[::-1]
    return ans


if __name__ == "__main__":
    print(lcs(input(), input()))
Buggy python submission (verdict: Runtime Error):
from collections import deque
from itertools import accumulate


class CoeffTable:
    def __init__(self, n):
        self.n = n
        if n == 2:
            (self.p2, self.p1, self.m1, self.m2) = (0, 1, 1, 0)
        if n % 2 == 0:
            self.p1 = self.m1 = 1
            self.p2 = self.m2 = (n - 1) // 2
        else:
            self.p1 = 0
            self.m1 = 2
            self.p2 = (n - 1) // 2
            self.m2 = (n - 2) // 2
        if self.p2 + self.p1 + self.m1 + self.m2 != n:
            raise ValueError(f"n = {n}, {str(self)}")

    def reverse(self):
        (self.p2, self.p1, self.m1, self.m2) = (
            self.m2,
            self.m1,
            self.p1,
            self.p2,
        )

    def cumsum(self):
        return list(accumulate([self.p2, self.p1, self.m1, self.m2]))

    def __str__(self):
        return (
            f"(p2, p1, m1, m2) = ({self.p2}, {self.p1}, {self.m1}, {self.m2})"
        )


def main(n, seq):
    seq = sorted(seq, reverse=True)
    coeff = CoeffTable(n)
    cm = coeff.cumsum()
    ans1 = (
        2 * sum(seq[0 : cm[0]])
        + 1 * sum(seq[cm[0] : cm[1]])
        - 1 * sum(seq[cm[1] : cm[2]])
        - 2 * sum(seq[cm[2] : cm[3]])
    )
    coeff.reverse()
    rcm = coeff.cumsum()
    ans2 = (
        2 * sum(seq[0 : rcm[0]])
        + 1 * sum(seq[rcm[0] : rcm[1]])
        - 1 * sum(seq[rcm[1] : rcm[2]])
        - 2 * sum(seq[rcm[2] : rcm[3]])
    )
    ans = max(ans1, ans2)
    print(ans)
    return


if __name__ == "__main__":
    n = int(input())
    sample = []
    for _ in range(n):
        sample.append(int(input()))
    main(n, sample)


Fixed submission:
from itertools import accumulate


class CoeffTable:
    def __init__(self, n):
        self.n = n
        if n == 2:
            (self.p2, self.p1, self.m1, self.m2) = (0, 1, 1, 0)
        if n % 2 == 0:
            self.p1 = self.m1 = 1
            self.p2 = self.m2 = (n - 1) // 2
        else:
            self.p1 = 0
            self.m1 = 2
            self.p2 = (n - 1) // 2
            self.m2 = (n - 2) // 2
    def reverse(self):
        (self.p2, self.p1, self.m1, self.m2) = (
            self.m2,
            self.m1,
            self.p1,
            self.p2,
        )

    def cumsum(self):
        return list(accumulate([self.p2, self.p1, self.m1, self.m2]))



def main(n, seq):
    seq = sorted(seq, reverse=True)
    coeff = CoeffTable(n)
    cm = coeff.cumsum()
    ans1 = (
        2 * sum(seq[0 : cm[0]])
        + 1 * sum(seq[cm[0] : cm[1]])
        - 1 * sum(seq[cm[1] : cm[2]])
        - 2 * sum(seq[cm[2] : cm[3]])
    )
    coeff.reverse()
    rcm = coeff.cumsum()
    ans2 = (
        2 * sum(seq[0 : rcm[0]])
        + 1 * sum(seq[rcm[0] : rcm[1]])
        - 1 * sum(seq[rcm[1] : rcm[2]])
        - 2 * sum(seq[rcm[2] : rcm[3]])
    )
    ans = max(ans1, ans2)
    print(ans)
    return


if __name__ == "__main__":
    n = int(input())
    sample = []
    for _ in range(n):
        sample.append(int(input()))
    main(n, sample)
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations


def abs_sum(xyz_list):
    s1 = abs(sum([xyz[0] for xyz in xyz_list]))
    s2 = abs(sum([xyz[1] for xyz in xyz_list]))
    s3 = abs(sum([xyz[2] for xyz in xyz_list]))
    return s1 + s2 + s3


n, m = list(map(int, input().split(" ")))
xyz_list = []
for _ in range(n):
    xyz_list.append(list(map(int, input().split(" "))))

combs = combinations(xyz_list, m)
print(max([abs_sum(comb) for comb in combs]))


Fixed submission:
from itertools import product

import numpy as np

n, m = list(map(int, input().split(" ")))
if m == 0:
    print(0)
    exit()
xyz_list = []
for _ in range(n):
    xyz_list.append(np.array(list(map(int, input().split(" ")))))
arrs = [np.array(x) for x in product([1, -1], repeat=3)]
ans = max([sum(sorted([sum(arr * xyz) for xyz in xyz_list])[-m:]) for arr in arrs])
print(ans)
Buggy python submission (verdict: Runtime Error):
s = int(input())
change = s % 1000
if change == 0:
    print(0):
else:
    print(1000-change)

Fixed submission:
s = int(input())
change = s % 1000
if change == 0:
    print(0)
else:
    print(1000-change)
Buggy python submission (verdict: Runtime Error):
import sys

x, n = map(int, input().split())
p = set(map(int, input().split()))

if n == 0:
    print(x)
    sys.exit()

i = 1
while i < 103:
    left = x - i
    right = x + i
    if left not in p:
        print(left)
        sys.exit()
    elif right not in p:
        print(right)
        sys.exit()
    i += 1


Fixed submission:
i = input().split()
print(i.index("0") + 1)
Buggy python submission (verdict: Runtime Error):
import sys

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

if a.index(0):
    print(0)
    sys.exit()

hg = 10 ** 18
ans = 1
for i in a:
    ans *= i
    if ans > hg:
        print(-1)
        sys.exit()

print(ans)

Fixed submission:
import sys

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

if 0 in a:
    print(0)
    sys.exit()

hg = 10 ** 18
ans = 1
for i in a:
    ans *= i
    if ans > hg:
        print(-1)
        sys.exit()

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from operator import mul
from functools import reduce

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

result = reduce(mul, a)
if result <= 10 ** 18:
    print(result)
else:
    print(-1)


Fixed submission:
import sys

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

if 0 in a:
    print(0)
    sys.exit()

hg = 10 ** 18
ans = 1
for i in a:
    ans *= i
    if ans > hg:
        print(-1)
        sys.exit()

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a, b, c, k = map(int, input().split())

cards = []
for _ in range(a):
    cards.append(1)
for _ in range(b):
    cards.append(0)
for _ in range(c):
    cards.append(-1)

ans = 0
for i in range(k):
    ans += cards[i]

print(ans)


Fixed submission:
a, b, c, k = map(int, input().split())

import sys

ans = 0
if a != 0 and a >= k:
    # a = 1
    print(k)
    sys.exit()
elif a != 0:
    ans += a
    k -= a

if b != 0 and b >= k:
    print(ans)
    sys.exit()
elif b != 0:
    k -= b

ans += k * -1
print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import Counter
li=[]
d={}
t=int(input())
for i in range(t):
    p=input()
    if(p in d):
        d[p]+=1
    else:
        d[p]=1  
if('AC' not in d):
    d['AC']=0
if('WA' not in d):
    d['WA']=0
if('TLE' not in d):
    d['TLE']=0
if('RE' not in d):
    d['RE']=0
print('AC','x',d['AC'] )
print('WA','x',d['WA'])
print('TLE','x',d['TLE'])
print('RE','x',d['RE'])

Fixed submission:
import math
n=int(input())
d=n/1000
g=math.ceil(d)
print(g*1000-n)

Buggy python submission (verdict: Runtime Error):
from collections import Counter
li=[]
d={}
for i in range(int(input())):
    p=input()
    if(p in d):
        d[p]+=1
    else:
    	d[p]=1  
if('AC' not in d):
    d['AC']=0
if('WA' not in d):
    d['WA']=0
if('TLE' not in d):
    d['TLE']=0
if('RE' not in d):
    d['RE']=0
print('AC','x',d['AC'] )
print('WA','x',d['WA'])
print('TLE','x',d['TLE'])
print('RE','x',d['RE'])


Fixed submission:
import math
n=int(input())
d=n/1000
g=math.ceil(d)
print(g*1000-n)

Buggy python submission (verdict: Runtime Error):
from collections import Counter
li=[]
d={}
for i in range(int(input()):
    p=input()
    if(p in d):
        d[p]+=1
    else:
    	d[p]=1  
if('AC' not in d):
    d['AC']=0
if('WA' not in d):
    d['WA']=0
if('TLE' not in d):
    d['TLE']=0
if('RE' not in d):
    d['RE']=0
print('AC','x',d['AC'] )
print('WA','x',d['WA'])
print('TLE','x',d['TLE'])
print('RE','x',d['RE'])

Fixed submission:
import math
n=int(input())
d=n/1000
g=math.ceil(d)
print(g*1000-n)

Buggy python submission (verdict: Runtime Error):
from collections import Counter
li=[]
for i in range(int(input()):
	li.append(input())  
d=Counter(li)
print('AC','x',d['AC'] if 'AC' in d else 0)
print('WA','x',d['WA'] if 'WA' in d else 0)
print('TLE','x',d['TLE'] if 'TLE' in d else 0)
print('RE','x',d['RE'] if 'RE' in d else 0)

Fixed submission:
import math
n=int(input())
d=n/1000
g=math.ceil(d)
print(g*1000-n)
Buggy python submission (verdict: Runtime Error):
from collections import Counter
li=[]
for i in range(int(input()):
	li.append(input())  
d=Counter(li)
print('AC','x',d['AC'])
print('WA','x',d['WA'])
print('TLE','x',d['TLE'])
print('RE','x',d['RE'])

Fixed submission:
from collections import Counter
li=[]
d={}
t=int(input())
for i in range(t):
    p=input()
    if(p in d):
        d[p]+=1
    else:
        d[p]=1  
if('AC' not in d):
    d['AC']=0
if('WA' not in d):
    d['WA']=0
if('TLE' not in d):
    d['TLE']=0
if('RE' not in d):
    d['RE']=0
print('AC','x',d['AC'] )
print('WA','x',d['WA'])
print('TLE','x',d['TLE'])
print('RE','x',d['RE'])
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = list(map(int, input().split()))
bc = [0] * m
ans = []
a.sort()
for i in range(m):
    bc[i] = list(map(int, input().split()))
bc.sort(key=lambda x: x[1], reverse=True)


j = 0
for i in range(n):
    if bc[j][0] == 0:
        j += 1
    if j >= m:
        ans.append(a[i])
    elif a[i] >= bc[j][1]:
        ans.append(a[i])
    else:
        ans.append(bc[j][1])
        bc[j][0] -= 1

print(sum(ans))


Fixed submission:
n, m = map(int, input().split())
a = list(map(int, input().split()))
bc = [0] * m
ans = []
a.sort()
for i in range(m):
    bc[i] = list(map(int, input().split()))
bc.sort(key=lambda x: x[1], reverse=True)


j = 0
for i in range(n):
    if j < m:
        if bc[j][0] == 0:
            j += 1
    if j >= m:
        ans.append(a[i])
    elif a[i] >= bc[j][1]:
        ans.append(a[i])
    else:
        ans.append(bc[j][1])
        bc[j][0] -= 1

print(sum(ans))
Buggy python submission (verdict: Runtime Error):
N = 6
val = []
for i in range(N):
    val.append(int(input())
if val[4]-val[0] <= val[5]:
    print('Yay!')
else:
    print(':(')


Fixed submission:
N = 6
val = []
for i in range(N):
    val.append(int(input()))

if val[4]-val[0] <= val[5]:
    print('Yay!')
else:
    print(':(')

Buggy python submission (verdict: Runtime Error):
a, b, c, d, e, k = map(int, input().split())
if e-a <= k:
    print('Yay!')
else:
    print(':(')


Fixed submission:
N = 6
val = []
for i in range(N):
    val.append(int(input()))

if val[4]-val[0] <= val[5]:
    print('Yay!')
else:
    print(':(')
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(str(int(a*b)))

Fixed submission:
a,b=map(float,input().split())
a=int(a)
b=int((b+10**-8)*100)
print(a*b//100)