alexjercan/bugnet huggingface dataset:
Problem p02947 (Python) — buggy submission, verdict: Time Limit Exceeded

import math as m

qt = int(input())
sl = [input() for i in range(qt)]
d = {}
count = 0

for s in sl:
    s = "".join(sorted(s))
    if s in d:
        d[s] += 1
    else:
        d[s] = 1

for e in d.values():
    if e > 1:
        count += m.factorial(e) // (m.factorial(e - 2) * 2)

print(count)


Error: TLE

Fixed submission:

qt = int(input())
sl = [input() for i in range(qt)]
ls = []
count = 0

for s in sl:
    s = "".join(sorted(s))
    ls.append(s)

i = 0
j = 0
key = ""

while len(ls) > i:
    while len(ls) > (j + 1):
        j += 1
        if ls[i] == ls[j]:
            count += 1
    i += 1
    j = i

print(count)
Problem p02947 (Python) — buggy submission, verdict: Time Limit Exceeded

import sys
from functools import reduce
from operator import mul
from collections import Counter

input = sys.stdin.readline


def cmb(n, r):
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under


def main():
    n = int(input())
    lines = ["".join(sorted(input().strip())) for _ in range(n)]
    count = 0
    for _, v in Counter(lines).most_common():
        if v == 1:
            break
        count += cmb(v, 2)
    print(count)


if __name__ == "__main__":
    main()


Error: TLE

Fixed submission:

import sys
from functools import reduce
from operator import mul

input = sys.stdin.readline


# def c(num):
#     return reduce(mul, range(1, num + 1))
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


def main():
    n = int(input())
    lines = ["".join(sorted(input().strip())) for _ in range(n)]
    count = 0
    for text in set(lines):
        txt_cnt = lines.count(text)
        if txt_cnt == 1:
            continue
        count += cmb(txt_cnt, 2)
    print(count)


if __name__ == "__main__":
    main()
Problem p02947 (Python) — buggy submission, verdict: Runtime Error

import collections

n = int(input())
sl = collections.Counter([str(sorted(input())) for _ in range(n)])

ret = 0
for _, v in sl.most_common():
    if 2 <= v:
        ret += v * (v - 1) // 2

print(ret)


Error: 0

Fixed submission:

import collections
import math

n = int(input())
sl = collections.Counter([str(sorted(input())) for _ in range(n)])

ret = 0
for _, v in sl.most_common():
    if 2 <= v:
        ret += int(math.factorial(v) / math.factorial(2) / math.factorial(v - 2))

print(ret)
Problem p02947 (Python) — buggy submission, verdict: Time Limit Exceeded

import collections

a = int(input())
b = ["".join(sorted(list(input()))) for _ in range(a)]
b = collections.Counter(b)
total = 0
for i in b.values():
    for j in range(1, i):
        total += j
print(total)


Error: TLE

Fixed submission:

a = int(input())
b = [sorted(list(input())) for _ in range(a)]
b.sort()
cnt = 0
for i in range(a):
    for j in range(i + 1, a):
        if b[i][0] == b[j][0]:
            if "".join(b[i]) == "".join(b[j]):
                cnt += 1
        else:
            break
print(cnt)
Problem p02948 (Python) — buggy submission, verdict: Runtime Error

import sys
import heapq

N, M = list(map(int, input().split()))
possiblyValidJobs = {}
for line in sys.stdin:
    A, B = map(int, line.split())
    if A > M:
        continue

    if A in possiblyValidJobs:
        possiblyValidJobs[A].append(B)
    else:
        possiblyValidJobs[A] = [B]

validJobsOnThisDay = []
ans = 0
for daysBeforeDeadline in range(1, M + 1):
    if daysBeforeDeadline in possiblyValidJobs:
        for wage in possiblyValidJobs[daysBeforeDeadline]:
            heapq.heappush(validJobsOnThisDay, -wage)
    if validJobsOnThisDay:
        ans += -heapq.heappop(validJobsOnThisDay)
print(ans)


Error: TypeError: 'int' object is not iterable
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02948/Python/s294834943.py", line 20, in <module>
    for wage in possiblyValidJobs[daysBeforeDeadline]:
TypeError: 'int' object is not iterable


Fixed submission:

import sys
import heapq

N, M = list(map(int, input().split()))
possiblyValidJobs = {}
for line in sys.stdin:
    A, B = map(int, line.split())
    if A > M:
        continue

    if A in possiblyValidJobs:
        possiblyValidJobs[A] += 1
    else:
        possiblyValidJobs[A] = 1

validJobsOnThisDay = []
ans = 0
for daysBeforeDeadline in range(1, M + 1):
    if daysBeforeDeadline in possiblyValidJobs:
        for wage in possiblyValidJobs[daysBeforeDeadline]:
            heapq.heappush(validJobsOnThisDay, -wage)
    if validJobsOnThisDay:
        ans += -heapq.heappop(validJobsOnThisDay)
print(ans)
Problem p02948 (Python) — buggy submission, verdict: Runtime Error

from heapq import heappush, heappop

n, m = map(int, input().split())
ab = [tuple(map(int, input().split())) for _ in range(n)]


jobs = [[] for _ in range(m)]
for a, b in ab:
    if a <= m:
        jobs[a - 1].append(-b)

ans = 0
available = []
for job in jobs:
    for jo in job:
        heappush(available, jo)

    if available:
        ans -= heappop(available)

print(ans)


Error: TypeError: can only concatenate tuple (not "int") to tuple
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02948/Python/s258753664.py", line 11, in <module>
    if jobs[job_index] + i < m:
TypeError: can only concatenate tuple (not "int") to tuple


Fixed submission:

n, m = map(int, input().split())
ab = [(map(int, input().split())) for _ in range(n)]

jobs = [(a, -b) for a, b in ab]
jobs.sort()

ans = 0
job_index = 0
for i in range(m):
    while job_index < len(jobs):
        if jobs[job_index] + i < m:
            ans -= jobs[job_index][1]
        else:
            job_index += 1
print(ans)
Problem p02948 (Python) — buggy submission, verdict: Runtime Error

# -*- coding: utf-8 -*-

import heapq


class MaxHeap:
    def __init__(self, li):
        self.heap = [-e for e in li]
        heapq.heapify(self.heap)

    def push(self, val):
        heapq.heappush(self.heap, -val)

    def pop(self):
        return -heapq.heappop(self.heap)

    def __len__(self):
        return len(self.heap)


n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]

ab.sort()

h = MaxHeap([])

i = 0
ans = 0
for day in range(1, m + 1):
    while i < n and ab[i][0] <= day:
        h.push(ab[i][1])
        i += 1
    if len(h) == 0:
        continue
    ans += h.pop()

print(ans)


Error: 0

Fixed submission:

# -*- coding: utf-8 -*-

n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]

ab.sort(reverse=True)
ab.sort(key=lambda x: x[1], reverse=True)

days_left = [1] * (m + 2)
ans = 0
for a, b in ab:
    i = a
    while days_left[i] == 0:
        i += 1
    if i == m + 1:
        continue
    days_left[i] = 0
    ans += b

print(ans)
Problem p02948 (Python) — buggy submission, verdict: Time Limit Exceeded

import heapq

n, m = map(int, input().split())
baitos = [list(map(int, input().split())) for _ in range(n)]

baitos = sorted(baitos)
# print(sorted(baitos))
# print(baitos)

money = 0
avail = []
# heapq.heapify(avail)
index = 0
for day in range(m):
    while index < n and baitos[index][0] <= day + 1:
        heapq.heappush(avail, -baitos[index][1])
        index += 1
        # baitos.remove(baitos[0])
    # for baito in baitos:
    #     print(baito)
    #     if baito[0] > day + 1:
    #         print("break")
    #         break
    #     else:
    #         heapq.heappush(avail, -baito[1])
    #         baitos.remove(baito)
    # print("baitos", baitos)
    # print("avail", avail)
    if avail:

        money += -heapq.heappop(avail)
        # print(day, money)
    # money += max[1]
    # baitos.remove(max)

print(money)


Error: TLE

Fixed submission:

import heapq

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

baitos = sorted(baitos)
# print(sorted(baitos))
# print(baitos)

money = 0
avail = []
heapq.heapify(avail)
for day in range(m):
    while baitos:
        if baitos[0][0] > day + 1:
            break
        else:
            heapq.heappush(avail, -baitos[0][1])
            baitos.remove(baitos[0])
    # for baito in baitos:
    #     print(baito)
    #     if baito[0] > day + 1:
    #         print("break")
    #         break
    #     else:
    #         heapq.heappush(avail, -baito[1])
    #         baitos.remove(baito)
    # print("baitos", baitos)
    # print("avail", avail)
    if avail:

        money += -heapq.heappop(avail)
        # print(day, money)
    # money += max[1]
    # baitos.remove(max)

print(money)
Problem p02948 (Python) — buggy submission, verdict: Time Limit Exceeded

import heapq

n, m = map(int, input().split())
ab = sorted([list(map(int, input().split())) for i in range(n)])
c = [[]] * m
a, b = ab[0]
last = a
ad = [b]
for i in range(1, n):
    a, b = ab[i]
    if a == last:
        ad.append(b)
    else:
        if last <= m:
            c[last - 1] = ad
        ad = [b]
    last = a
if a <= m:
    c[a - 1] = ad
a = [3, 0, 2, 6]
choice = []
heapq.heapify(choice)
ans = 0
for i in range(m):
    for j in c[i]:
        heapq.heappush(choice, -j)
    if choice:
        ans -= heapq.heappop(choice)
print(ans)


Error: TLE

Fixed submission:

from collections import defaultdict

n, m = map(int, input().split())
ab = sorted([list(map(int, input().split())) for i in range(n)])
c = [[]] * m
a, b = ab[0]
last = a
ad = [b]
for i in range(1, n):
    a, b = ab[i]
    if a == last:
        ad.append(b)
    else:
        if last <= m:
            c[last - 1] = ad
        ad = [b]
    last = a
if a <= m:
    c[a - 1] = ad
choice = defaultdict(int)
ans = 0
for i in range(m):
    for j in c[i]:
        choice[j] += 1
    if choice:
        use = max(choice)
        ans += use
        choice[use] -= 1
        if choice[use] <= 0:
            del choice[use]
print(ans)
Problem p02948 (Python) — buggy submission, verdict: Time Limit Exceeded

from heapq import heappush, heappop

n, m = map(int, input().split(" "))
xys = [tuple(map(int, input().split(" "))) for i in range(n)]
xys = sorted(xys, key=lambda x: (x[0], -x[1]))

ans = 0

j = 0
h = []
for i in range(1, m + 1):
    while j < len(xys) and xys[j][0] <= i:
        heappush(h, -xys[j][1])
        j += 1
    if h:
        x = -heappop(h)
        # print("Pick", x)
        ans += x

print(ans)


Error: TLE

Fixed submission:

n, m = map(int, input().split(" "))
xys = [tuple(map(int, input().split(" "))) for i in range(n)]
xys = sorted(xys, key=lambda x: (x[0], -x[1]))

ans = 0

for i in range(1, m + 1):
    cm = -1
    cmi = -1
    for j in range(len(xys)):
        if xys[j][0] <= i and xys[j][1] > cm:
            cm = xys[j][1]
            cmi = j
    if cmi >= 0:
        ans += cm
        xys.pop(cmi)

print(ans)
Problem p02948 (Python) — buggy submission, verdict: Time Limit Exceeded

#!/usr/bin/env python3
from queue import PriorityQueue

n, m = map(int, input().split())
jobs = [[] for _ in range(m)]
for i in range(n):
    a, b = map(int, input().split())
    if a > m:
        continue
    jobs[m - a].append(b)
pq = PriorityQueue()
ans = 0
for i in range(m)[::-1]:
    for b in jobs[i]:
        pq.put(-b)
    if not pq.empty():
        ans += -pq.get()
print(ans)


Error: TLE

Fixed submission:

#!/usr/bin/env python3
n, m = map(int, input().split())
ba = [None] * n
for i in range(n):
    a, b = map(int, input().split())
    ba[i] = [b, a]
ba.sort(reverse=True)
li = [0] * m
for i in range(n):
    b, a = ba[i]
    for j in range(m - a + 1)[::-1]:
        if li[j] == 0:
            li[j] = b
            break
print(sum(li))
Problem p02948 (Python) — buggy submission, verdict: Time Limit Exceeded

import queue

N, M = map(int, input().split())
AB = [[] for _ in range(M + 1)]

for n in range(N):
    a, b = map(int, input().split())
    if a > M:
        continue
    AB[a].append(0 - b)

earn = 0
q = queue.PriorityQueue()

for m in range(1, M + 1):

    for job in AB[m]:
        q.put(job)

    if not q.empty():
        earn += q.get()

print(0 - earn)


Error: TLE

Fixed submission:

N, M = map(int, input().split())
AB = [[0, 0] for _ in range(N)]

for n in range(N):
    AB[n][0], AB[n][1] = map(int, input().split())
    AB[n][1] = 0 - AB[n][1]
AB.sort()

pop_list = []

earn = 0
for m in range(1, M + 1):
    max_earn = 0
    max_i = 0
    for i in range(len(AB)):
        if m < AB[i][0]:
            break

        if max_earn > AB[i][1] and i not in pop_list:
            max_earn = AB[i][1]
            max_i = i

    if max_earn != 0:
        earn += AB[max_i][1]
        pop_list.append(max_i)

print(0 - earn)
Problem p02949 (Python) — buggy submission, verdict: Time Limit Exceeded

n, m, p = map(int, input().split())
abc = [list(map(int, input().split())) for _ in range(m)]


def bellman_ford(s, g):
    # loop 0 - (n-1) : bellman ford
    # loop n - (2n-1): check g can be updated
    dist = [float("inf")] * n
    dist[s] = 0
    for i in range(2 * n):
        for a, b, c in abc:
            a -= 1
            b -= 1
            cost = -(c - p)

            if dist[b] > dist[a] + cost:
                dist[b] = dist[a] + cost
                if i >= n:
                    dist[b] = -float("inf")

    if dist[g] == -float("inf"):
        return -1

    else:
        return max(-dist[g], 0)


ans = bellman_ford(0, n - 1)
print(ans)


Error: TLE

Fixed submission:

n, m, p = map(int, input().split())
abc = [list(map(int, input().split())) for _ in range(m)]


def bellman_ford(s, g):
    # loop 0 - (n-1) : bellman ford
    # loop n - (2n-1): check g can be updated
    dist = [float("inf")] * n
    dist[s] = 0
    negative = [False] * n
    for i in range(2 * n):
        for a, b, c in abc:
            a -= 1
            b -= 1
            cost = -(c - p)

            if dist[b] > dist[a] + cost:
                dist[b] = dist[a] + cost
                if i >= n:
                    negative[b] = True

    if negative[g]:
        return -1

    else:
        return max(-dist[g], 0)


ans = bellman_ford(0, n - 1)
print(ans)
Problem p02949 (Python) — buggy submission, verdict: Runtime Error

from collections import defaultdict, deque

N, M, P = map(int, input().split())
G = defaultdict(lambda: defaultdict(lambda: 10000000))
G_rev = defaultdict(lambda: defaultdict(lambda: 10000000))

for _ in range(M):
    A, B, C = map(int, input().split())
    G[A][B] = min(G[A][B], P - C)
    G_rev[B][A] = 1

reachable_N = [0] * (N + 1)
reachable_N[N] = 1
queue = deque([N])

while len(queue) > 0:
    p = queue.popleft()
    for q in G_rev[p].keys():
        if reachable_N[q] == 0:
            reachable_N[q] = 1
            queue.append(q)

reachable_1 = [0] * (N + 1)
reachable_1[1] = 1
queue = deque([1])

while len(queue) > 0:
    p = queue.popleft()
    for q in G[p].keys():
        if reachable_1[q] == 0:
            reachable_1[q] = 1
            queue.append(q)

reachable = [reachable_1[i] * reachable_N[i] for i in range(N + 1)]

dist = [10000000000 for i in range(N + 1)]
res = 0
dist[1] = 0
queue = deque([1])
cnt = 0

update = True

while update:
    update = False
    for p in range(1, N + 1):
        if reachable[p] == 0:
            continue
        for q in G[p].keys():
            if reachable[q] == 0:
                pass
            elif dist[p] + G[p][q] < dist[q]:
                dist[q] = dist[p] + G[p][q]
                update = True
    cnt += 1
    if cnt > N:
        res = -1
        break

if res == -1:
    print(res)
else:
    print(max(0, -dist[N]))


Error: KeyError: 2
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02949/Python/s582998390.py", line 13, in <module>
    G[A][B] = min(G[A][B], P - C)
KeyError: 2


Fixed submission:

from collections import defaultdict, deque

N, M, P = map(int, input().split())
G = defaultdict(lambda: defaultdict(lambda: 10000000))
G_rev = defaultdict(lambda: defaultdict(lambda: 10000000))

for i in range(1, N + 1):
    G[i] = dict()
    G_rev[i] = dict()

for _ in range(M):
    A, B, C = map(int, input().split())
    G[A][B] = min(G[A][B], P - C)
    G_rev[B][A] = 1

reachable_N = [0] * (N + 1)
reachable_N[N] = 1
queue = deque([N])

while len(queue) > 0:
    p = queue.popleft()
    for q in G_rev[p].keys():
        if reachable_N[q] == 0:
            reachable_N[q] = 1
            queue.append(q)

reachable_1 = [0] * (N + 1)
reachable_1[1] = 1
queue = deque([1])

while len(queue) > 0:
    p = queue.popleft()
    for q in G[p].keys():
        if reachable_1[q] == 0:
            reachable_1[q] = 1
            queue.append(q)

reachable = [reachable_1[i] * reachable_N[i] for i in range(N + 1)]

dist = [10000000000 for i in range(N + 1)]
res = 0
dist[1] = 0
queue = deque([1])
cnt = 0

update = True

while update:
    update = False
    for p in range(1, N + 1):
        if reachable[p] == 0:
            continue
        for q in G[p].keys():
            if reachable[q] == 0:
                pass
            elif dist[p] + G[p][q] < dist[q]:
                dist[q] = dist[p] + G[p][q]
                update = True
    cnt += 1
    if cnt > N:
        res = -1
        break

if res == -1:
    print(res)
else:
    print(max(0, -dist[N]))
Problem p02950 (Python) — buggy submission, verdict: Time Limit Exceeded

import numpy as np

p = int(input())
aaa = list(map(int, input().split()))

bins = [1]
for i in range(1, p):
    bins.append(bins[-1] * (p - i) * pow(i, p - 2, p) % p)
bins = np.array(bins, dtype=np.int32)

pows_base = -np.arange(p, dtype=np.int32)
pows = np.zeros((p, p), dtype=np.int32)
pows[:, p - 1] = 1
for i in range(p - 2, -1, -1):
    pows[:, i] = pows[:, i + 1] * pows_base % p

coefs = np.zeros(p, dtype=np.int32)

for i, a in enumerate(aaa):
    if a == 0:
        continue

    coefs[0] += 1
    coefs = (coefs - bins * pows[i]) % p

print(*coefs)


Error: TLE

Fixed submission:

import numpy as np

p = int(input())
aaa = list(map(int, input().split()))

bins = [1]
for i in range(1, p):
    bins.append(bins[-1] * (p - i) * pow(i, p - 2, p) % p)
bins = np.array(bins, dtype=np.int32)

coefs = np.zeros(p, dtype=np.int32)

for i, a in enumerate(aaa):
    if a == 0:
        continue

    coefs[0] += 1

    pows = [1]
    for _ in range(1, p):
        pows.append(pows[-1] * -i % p)
    pows.reverse()
    pows = np.array(pows, dtype=np.int32)

    coefs = (coefs - bins * pows) % p

print(*coefs)
Problem p02950 (Python) — buggy submission, verdict: Time Limit Exceeded

import sys

input = sys.stdin.readline
p = int(input())
a = list(map(int, input().split()))
MOD = p

P = p
fact = [0] * P
fact[0] = 1
for i in range(1, P):
    fact[i] = fact[i - 1] * i
    fact[i] %= MOD

rfact = [0] * P
rfact[P - 1] = pow(fact[P - 1], MOD - 2, MOD)
for i in range(P - 2, -1, -1):
    rfact[i] = rfact[i + 1] * (i + 1)
    rfact[i] %= MOD


def comb(n, k):
    return fact[n] * rfact[n - k] * rfact[k] % MOD


b = [0] * p
for i in range(p):
    if a[i]:
        b[0] += 1
        b[0] %= MOD
        s = 1
        for j in range(p - 1, -1, -1):
            b[j] -= comb(p - 1, j) * s
            b[j] %= MOD
            s *= -i
            s %= MOD

print(*b)


Error: TLE

Fixed submission:

p = int(input())
a = list(map(int, input().split()))
MOD = p

P = p
fact = [0] * P
fact[0] = 1
for i in range(1, P):
    fact[i] = fact[i - 1] * i
    fact[i] %= MOD

rfact = [0] * P
rfact[P - 1] = pow(fact[P - 1], MOD - 2, MOD)
for i in range(P - 2, -1, -1):
    rfact[i] = rfact[i + 1] * (i + 1)
    rfact[i] %= MOD


def comb(n, k):
    return fact[n] * rfact[n - k] * rfact[k] % MOD


b = [0] * p
for i in range(p):
    if a[i]:
        b[0] += 1
        b[0] %= MOD
        for j in range(p):
            b[j] -= comb(p - 1, j) * (-i) ** (p - 1 - j)
            b[j] %= MOD

print(*b)
Problem p02951 (Python) — buggy submission, verdict: Runtime Error

i = list(map(int, input().split()))
n = i[2] - (i[0] - i[1])
if n > 0:
    print(n)
else:
    print(0)


Error: EOFError: EOF when reading a line
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02951/Python/s799517998.py", line 3, in <module>
    i = list(map(int, input().split()))
EOFError: EOF when reading a line


Fixed submission:

i = list(map(int, input().split()))
print(i[2] - (i[0] - i[1]))
i = list(map(int, input().split()))
n = i[2] - (i[0] - i[1])
if n > 0:
    print(n)
else:
    print(0)
Problem p02951 (Python) — buggy submission, verdict: Runtime Error

a, b, c = map(int, (input().split()))
print(max(c - (a - b), 0))


Error: EOFError: EOF when reading a line
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02951/Python/s280962278.py", line 3, in <module>
    a, b, c = map(int, (input().split()))
EOFError: EOF when reading a line


Fixed submission:

a, b, c = map(int, (input().split()))
print(max(c - (a - b), 0))
a, b, c = map(int, (input().split()))
print(max(c - (a - b), 0))
a, b, c = map(int, (input().split()))
print(max(c - (a - b), 0))
a, b, c = map(int, (input().split()))
print(max(c - (a - b), 0))
a, b, c = map(int, (input().split()))
print(max(c - (a - b), 0))
a, b, c = map(int, (input().split()))
print(max(c - (a - b), 0))
a, b, c = map(int, (input().split()))
print(max(c - (a - b), 0))
a, b, c = map(int, (input().split()))
print(max(c - (a - b), 0))
a, b, c = map(int, (input().split()))
print(max(c - (a - b), 0))
a, b, c = map(int, (input().split()))
print(max(c - (a - b), 0))
Problem p02951 (Python) — buggy submission, verdict: Runtime Error

a, b, c = [int(x) for x in input().strip().split()]

water = c - (a - b)
if water < 0:
    print(0)
else:
    print(water)


Error: EOFError: EOF when reading a line
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02951/Python/s087836716.py", line 1, in <module>
    a, b, c = input().splita, b, c = [int(x) for x in input().strip().split()]
EOFError: EOF when reading a line


Fixed submission:

a, b, c = input().splita, b, c = [int(x) for x in input().strip().split()]

water = c - (a - b)
if water < 0:
    print(0)
else:
    print(water)
Problem p02951 (Python) — buggy submission, verdict: Runtime Error

num = input().split()
a = int(num[0])
b = int(num[1])
c = int(num[2])
ans = b + c - a
if ans > 0:
    print(ans)
else:
    print(0)


Error: TypeError: unsupported operand type(s) for -: 'str' and 'str'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02951/Python/s319382696.py", line 5, in <module>
    ans = b + c - a
TypeError: unsupported operand type(s) for -: 'str' and 'str'


Fixed submission:

num = input().split()
a = num[0]
b = num[1]
c = num[2]
ans = b + c - a
if ans > 0:
    print(ans)
else:
    print(0)
Problem p02951 (Python) — buggy submission, verdict: Runtime Error

a, b, c = map(int, input().split())
print(max(c - (a - b), 0))


Error: TypeError: 'int' object is not iterable
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02951/Python/s849480716.py", line 2, in <module>
    print(max(c - (a - b)), 0)
TypeError: 'int' object is not iterable


Fixed submission:

a, b, c = map(int, input().split())
print(max(c - (a - b)), 0)
Problem p02952 (Python) — buggy submission, verdict: Runtime Error

def main(n):
    count = 0

    for i in range(1, n + 1):
        if len(str(i)) % 2 == 1:
            count += 1

    print(count)


if __name__ == "__main__":
    n = int(input())

    main(n)


Error: TypeError: unsupported operand type(s) for %: 'method-wrapper' and 'int'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02952/Python/s049865581.py", line 14, in <module>
    main(n)
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02952/Python/s049865581.py", line 5, in main
    if str(i).__len__ % 2 == 1:
TypeError: unsupported operand type(s) for %: 'method-wrapper' and 'int'


Fixed submission:

def main(n):
    count = 0

    for i in range(n + 1):
        if str(i).__len__ % 2 == 1:
            count += 1

    print(count)


if __name__ == "__main__":
    n = int(input())

    main(n)