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

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])


Error: TLE

Fixed submission:

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])
Problem p03128 (Python) — buggy submission, verdict: Time Limit Exceeded

import math


N, M = map(int, input().split())
A = list(map(int, input().split()))

MAX_N = int(1e4)
dp = [-1 for i in range(MAX_N + 20)]
dp[0] = 0

mc = [2, 5, 5, 4, 5, 6, 3, 7, 6]

for i in range(N + 1):
    for j in A:
        tmp = dp[i]
        if tmp == -1:
            continue
        if tmp == 0:
            dp[i + mc[j - 1]] = max(dp[i + mc[j - 1]], j)
        else:
            dp[i + mc[j - 1]] = max(dp[i + mc[j - 1]], tmp * 10 + j)

ans = dp[N]
print(ans)


Error: TLE

Fixed submission:

N, M = map(int, input().split())
A = set(list(map(int, input().split())))

MAX_N = int(1e4)
dp = [[-1 for i in range(10)] for i in range(MAX_N + 10)]
for j in range(1, 9 + 1):
    dp[0][j] = 0

mc = [2, 5, 5, 4, 5, 6, 3, 7, 6]

for i in range(N + 1):
    for j in range(1, 9 + 1):
        if j not in A:
            continue

        if i < mc[j - 1]:
            continue

        for k in range(1, j + 1):
            tmp = dp[i - mc[j - 1]][k]
            if tmp == -1:
                continue
            if tmp == 0:
                tmp = ""
            tmp = str(tmp)
            dp[i][j] = max(dp[i][j], int(tmp + str(j)), int(str(j) + tmp))


ans = 0
for j in range(1, 9 + 1):
    ans = max(ans, dp[N][j])
print(ans)
Problem p03128 (Python) — buggy submission, verdict: Runtime Error

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

dp = dict.fromkeys(range(n + 1))  # dp[n]: n本使うときの桁数
dp[0] = 0

num = {1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}
anum = sorted(
    dict(filter(lambda e: e[0] in a, num.items())).items(), reverse=True
)  # 後の計算用にsortしておく

for i in range(n):
    dp[i + 1] = -float("inf")
    for e in anum:
        if i + 1 - e[1] >= 0:
            dp[i + 1] = max(dp[i + 1], dp[i + 1 - e[1]] + 1)

ans = ""
while dp[n] > 1:
    for e in anum:  # anum は降順sortされているので, 大きい順に確認
        if n - e[1] >= 0:
            if dp[n - e[1]] == dp[n] - 1:
                ans += str(e[0])
                n -= e[1]
                break

# 末尾桁は n =0(ちょうど使い切るように決定)
ans += str(list(filter(lambda e: e[1] == n, anum))[0][0])

print(ans)


Error: 0

Fixed submission:

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

dp = dict.fromkeys(range(n + 1))  # dp[n]: n本使うときの桁数
dp[0] = 0

num = {1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}
anum = sorted(
    dict(filter(lambda e: e[0] in a, num.items())).items(), reverse=True
)  # 後の計算用にsortしておく

for i in range(n):
    dp[i + 1] = dp[i]
    for e in anum:
        if i + 1 - e[1] >= 0:
            dp[i + 1] = max(dp[i + 1], dp[i + 1 - e[1]] + 1)

ans = ""
while dp[n] > 1:
    for e in anum:  # anum は降順sortされているので, 大きい順に確認
        if n - e[1] >= 0:
            if dp[n - e[1]] == dp[n] - 1:
                ans += str(e[0])
                n -= e[1]
                break

# 末尾桁は n =0(ちょうど使い切るように決定)
ans += str(list(filter(lambda e: e[1] == n, anum))[0][0])

print(ans)
Problem p03135 (Python) — buggy submission, verdict: Runtime Error

num = list(map(int, input().split()))
ans = num[0] / num[1]
print(ans)


Error: TypeError: int() argument must be a string, a bytes-like object or a real number, not 'list'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03135/Python/s676135149.py", line 1, in <module>
    num = int(input().split())
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'list'


Fixed submission:

num = int(input().split())
ans = num[0] / num[1]
print(ans)
Problem p03136 (Python) — buggy submission, verdict: Runtime Error

N = int(input())
list_L = list(map(int, input().split()))

max_ = list_L.pop(list_L.index(max(list_L)))

if max_ >= sum(list_L):
    print("No")
else:
    print("Yes")


Error: AttributeError: 'map' object has no attribute 'pop'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03136/Python/s177830460.py", line 4, in <module>
    max_ = list_L.pop(list_L.index(max(list_L)))
AttributeError: 'map' object has no attribute 'pop'


Fixed submission:

N = int(input())
list_L = map(int, input().split())

max_ = list_L.pop(list_L.index(max(list_L)))

if max_ > sum(list_L):
    print("Yes")
else:
    print("No")
Problem p03136 (Python) — buggy submission, verdict: Runtime Error

N = int(input())
L = list(map(int, input().split()))
x = sorted(L)
Lmax = max(L)
y = x[0:-1]
ysum = sum(y)
print("Yes" if Lmax < ysum else "No")


Error: ValueError: max() arg is an empty sequence
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03136/Python/s642487988.py", line 4, in <module>
    Lmax = max(L)
ValueError: max() arg is an empty sequence


Fixed submission:

N = input()
L = map(int, input().split())
x = sorted(L)
Lmax = max(L)
y = x[0:-1]
ysum = sum(y)
print("Yes" if Lmax < ysum else "No")
Problem p03137 (Python) — buggy submission, verdict: Runtime Error

import sys

n, m = map(int, input().split())
x = list(map(int, input().split()))
if m == 1:
    print(0)
    sys.exit()
if n == 1:
    print(max(x) - min(x))
    sys.exit()
if n >= m:
    print(0)
    sys.exit()
x.sort()
a = []
for i in range(m - 1):
    a.append(abs(x[i] - x[i + 1]))
ans = sum(a)
a.sort(reverse=True)
for i in range(n - 1):
    ans -= a[i]
print(max(0, ans))


Error: 0

Fixed submission:

import sys

n, m = map(int, input().split())
x = list(map(int, input().split()))
if m == 1:
    print(0)
    sys.exit()
if n == 1:
    print(max(x) - min(x))
    sys.exit()
x.sort()
a = []
for i in range(m - 1):
    a.append(abs(x[i] - x[i + 1]))
ans = sum(a)
a.sort(reverse=True)
for i in range(n - 1):
    ans -= a[i]
print(max(0, ans))
Problem p03137 (Python) — buggy submission, verdict: Runtime Error

N, M = list(map(int, input().split()))
X = list(map(int, input().split()))

if N == 1:
    ans = max(X) - min(X)
    print(ans)
    exit()

if (M == 1) or (N >= M):
    ans = 0
    print(ans)
    exit()

Xs = sorted(X)

diff = []
for i in range(M - 1):
    tmp = Xs[i + 1] - Xs[i]
    diff.append(tmp)

diffs = sorted(diff)
print(sum(diffs[: (M - 1) - (N - 1)]))


Error: 0

Fixed submission:

N, M = list(map(int, input().split()))
X = list(map(int, input().split()))

if N == 1:
    ans = max(X) - min(X)
    print(ans)
    exit()

if M == 1:
    ans = 0
    print(ans)
    exit()

Xs = sorted(X)

diff = []
for i in range(M - 1):
    tmp = Xs[i + 1] - Xs[i]
    diff.append(tmp)

rest = N - 2
for _ in range(rest):
    if diff[0] > diff[len(diff) - 1]:
        diff.pop(0)
    else:
        diff.pop()

ans = 0

for _ in range(len(diff) - 1):
    if diff[0] > diff[len(diff) - 1]:
        ans += diff[len(diff) - 1]
        diff.pop()
    else:
        ans += diff[0]
        diff.pop(0)

print(ans)
Problem p03137 (Python) — buggy submission, verdict: Runtime Error

def main():
    N, M = map(int, input().split())
    X = list(map(int, input().split()))
    if N >= M:
        print("0")
        return
    X_sort = sorted(X)
    diff = []
    for i in range(M - 1):
        diff.append(X_sort[i + 1] - X_sort[i])
    diff_sort = sorted(diff)
    if N != 1:
        for _ in range(N - 1):
            diff_sort.pop()
    ans = 0
    for d in diff_sort:
        ans += d
    print(ans)


if __name__ == "__main__":
    main()


Error: 0

Fixed submission:

def main():
    N, M = map(int, input().split())
    X = list(map(int, input().split()))
    X_sort = sorted(X)
    diff = []
    for i in range(M - 1):
        diff.append(X_sort[i + 1] - X_sort[i])
    diff_sort = sorted(diff)
    if M == 1:
        print("0")
        return
    for _ in range(N - 1):
        diff_sort.pop()
    ans = 0
    for d in diff_sort:
        ans += d
    print(ans)


if __name__ == "__main__":
    main()
Problem p03137 (Python) — buggy submission, verdict: Time Limit Exceeded

N, M = map(int, input().split())
X = list(map(int, input().split()))

X.sort()
if N >= M:
    ans = 0
else:
    x_diff = [
        xn - x for xn, x in zip(X[1:], X[:-1])
    ]  # [X[i + 1] - X[i] for i in range(len(X) - 1)]
    # for _ in range(N - 1):
    #     x_diff.remove(max(x_diff))
    x_diff.sort(reverse=True)
    ans = sum(x_diff[N - 1 :])

print(ans)


Error: TLE

Fixed submission:

N, M = map(int, input().split())
X = list(map(int, input().split()))

X.sort()
if N >= M:
    ans = 0
else:
    x_diff = [X[i + 1] - X[i] for i in range(len(X) - 1)]
    for _ in range(N - 1):
        x_diff.remove(max(x_diff))
    ans = sum(x_diff)

print(ans)
Problem p03137 (Python) — buggy submission, verdict: Runtime Error

N, M = map(int, input().split())
x = list(map(int, input().split()))
if N >= M:
    print(0)
    quit()


x.sort()
s = [0] * (M - 1)
for i in range(M - 1):
    s[i] = x[i + 1] - x[i]

s.sort(reverse=True)

res = sum(s)
if M == 1:
    print(0)
    quit()
else:
    for i in range(N - 1):
        res -= s[i]

print(res)


Error: 0

Fixed submission:

N, M = map(int, input().split())
x = list(map(int, input().split()))

x.sort()
s = [0] * (M - 1)
for i in range(M - 1):
    s[i] = x[i + 1] - x[i]

s.sort(reverse=True)

res = sum(s)
if M == 1:
    print(0)
    quit()
else:
    for i in range(N - 1):
        res -= s[i]

print(res)
Problem p03137 (Python) — buggy submission, verdict: Runtime Error

def main():
    N, M = map(int, input().split())
    X = sorted(list(map(int, input().split())))

    if M == 1:
        print(0)
    elif N == 1:
        print(max(X) - min(X))
    else:
        if N > M:
            N = M
        dx = sorted([abs(X[m] - X[m + 1]) for m in range(M - 1)])
        print(sum(dx[: M - N]))


main()


Error: 0

Fixed submission:

def main():
    N, M = map(int, input().split())
    X = sorted(list(map(int, input().split())))

    if M == 1:
        print(0)
    elif N == 1:
        print(max(X) - min(X))
    else:
        dx = [abs(X[m] - X[m + 1]) for m in range(M - 1)]
        for _ in range(N - 1):
            dx.pop(dx.index(max(dx)))
        print(sum(dx))


main()
Problem p03141 (Python) — buggy submission, verdict: Time Limit Exceeded

n = int(input())
dishes = []
for _ in range(n):
    a, b = map(int, input().split())
    dishes.append((a, b, a + b))
dishes.sort(key=lambda dish: dish[2], reverse=True)

x = y = 0
for i in range(n):
    a, b, _ = dishes[i]
    if i % 2 == 0:
        x += a
    else:
        y += b

print(x - y)


Error: TLE

Fixed submission:

n = int(input())
a, b = [], []
for _ in range(n):
    x, y = map(int, input().split())
    a.append(x)
    b.append(y)


who = True
dishes = list(range(n))
takahashi = aoki = 0
while dishes:
    if who:
        dishes.sort(key=lambda dish: (b[dish], a[dish]))
        takahashi += a[dishes.pop()]
    else:
        dishes.sort(key=lambda dish: (a[dish], b[dish]))
        aoki += b[dishes.pop()]
    who = not who

print(takahashi - aoki)
Problem p03141 (Python) — buggy submission, verdict: Time Limit Exceeded

# Different Strokes
n = int(input())
a, b = list(), list()
ab = list()
for i in range(n):
    a_, b_ = map(int, input().split())
    a.append(a_)
    b.append(b_)
    ab.append((a_, b_))
ans = 0
ab.sort(key=(lambda x: sum(x)), reverse=True)
for i, ab_ in enumerate(ab):
    if i % 2 == 0:
        ans += ab_[0]
    else:
        ans -= ab_[1]
print(ans)


Error: TLE

Fixed submission:

# Different Strokes
n = int(input())
a, b = list(), list()
for _ in range(n):
    a_, b_ = map(int, input().split())
    a.append(a_)
    b.append(b_)
a_sort = sorted(a)
b_sort = sorted(b)
ans = 0
while True:
    const = b_sort.pop()
    indexes = list()
    for i in range(len(b)):
        if b[i] == const:
            indexes.append(i)
    m = 0
    ind = 0
    for i in indexes:
        if a[i] >= m:
            ind = i
            m = a[i]
    ans += m
    a_sort.remove(m)
    del a[ind]
    del b[ind]
    if not a:
        exit(print(ans))

    const = a_sort.pop()
    indexes = list()
    for i in range(len(a)):
        if a[i] == const:
            indexes.append(i)
    m = 0
    ind = 0
    for i in indexes:
        if b[i] >= m:
            ind = i
            m = b[i]
    ans -= m
    b_sort.remove(m)
    del a[ind]
    del b[ind]
    if not a:
        exit(print(ans))
Problem p03141 (Python) — buggy submission, verdict: Time Limit Exceeded

def main():
    n = int(input())
    A = []
    B = []
    C = {}
    for i in range(n):
        a, b = map(int, input().split())
        A.append(a)
        B.append(b)
        C[str(i)] = a + b
    ans = 0
    isA = True
    for k, v in sorted(C.items(), key=lambda x: -x[1]):
        if isA:
            ans += A[int(k)]
        else:
            ans -= B[int(k)]
        isA = not isA
    print(ans)


if __name__ == "__main__":
    main()


Error: TLE

Fixed submission:

def main():
    n = int(input())
    A = []
    B = []
    C = []
    for _ in range(n):
        a, b = map(int, input().split())
        A.append(a)
        B.append(b)
        C.append(a + b)
    ans = 0
    isA = True
    while C:
        index = C.index(max(C))
        C.pop(index)
        if isA:
            ans += A[index]
        else:
            ans -= B[index]
        isA = not isA
    print(ans)


if __name__ == "__main__":
    main()
Problem p03141 (Python) — buggy submission, verdict: Time Limit Exceeded

def main():
    N = int(input())
    ab = [[int(i) for i in input().split()] for _ in range(N)]
    ab = sorted(ab, key=lambda x: x[0] + x[1], reverse=True)
    ans = 0
    for i in range(N):
        if i % 2 == 0:
            ans += ab[i][0]
        else:
            ans -= ab[i][1]
    print(ans)


main()


Error: TLE

Fixed submission:

def main():
    N = int(input())
    a = []
    b = []
    for _ in range(N):
        ai, bi = map(int, input().split())
        a.append(ai)
        b.append(bi)
    ans = 0
    s = 1
    while True:
        if sum(a) == 0:
            print(ans)
            exit()
        ma = a.pop()
        ans += ma * s
        b.pop()
        t = a
        a = b
        b = t
        s *= -1


main()
Problem p03142 (Python) — buggy submission, verdict: Runtime Error

#!/usr/bin/env python3
import sys

sys.setrecursionlimit(100000)
N, M = map(int, input().split())
g = [[] for _ in range(N)]
rg = [[] for _ in range(N)]
for _ in range(N - 1 + M):
    A, B = (int(x) - 1 for x in input().split())
    g[A].append(B)
    rg[B].append(A)


def dfs(s):
    global ts
    global used
    used[s] = True
    for t in g[s]:
        if not used[t]:
            dfs(t)
    ts.append(s)


def tsort():
    global ts
    for i in range(N):
        dfs(i)
    ts = ts[::-1]


used = [False] * N
ts = []
tsort()

mp = [None] * N
for i, x in enumerate(ts):
    mp[x] = i

ans = [0] * N
for t in ts[1:]:
    if rg[t]:
        ans[t] = ts[max(mp[s] for s in rg[t])] + 1

for x in ans:
    print(x)


Error: 0

Fixed submission:

#!/usr/bin/env python3
N, M = map(int, input().split())
g = [[] for _ in range(N)]
rg = [[] for _ in range(N)]
for _ in range(N - 1 + M):
    A, B = (int(x) - 1 for x in input().split())
    g[A].append(B)
    rg[B].append(A)


def dfs(s):
    global ts
    global used
    used[s] = True
    for t in g[s]:
        if not used[t]:
            dfs(t)
    ts.append(s)


def tsort():
    global ts
    for i in range(N):
        dfs(i)
    ts = ts[::-1]


used = [False] * N
ts = []
tsort()

mp = [None] * N
for i, x in enumerate(ts):
    mp[x] = i

ans = [0] * N
for t in ts[1:]:
    if rg[t]:
        ans[t] = ts[max(mp[s] for s in rg[t])] + 1

for x in ans:
    print(x)
Problem p03142 (Python) — buggy submission, verdict: Time Limit Exceeded

n, m = map(int, input().split())
g = [[] for _ in range(n)]
inv = [0] * n
for _ in range(n - 1 + m):
    a, b = map(int, input().split())
    g[a - 1].append(b - 1)
    inv[b - 1] += 1
for i in range(n):
    if inv[i] == 0:
        root = i
        break
d = [0] * n
s = [root]
while s:
    p = s.pop()
    for node in g[p]:
        inv[node] -= 1
        if inv[node] == 0:
            d[node] = max(d[node], d[p] + 1)
            s.append(node)
ans = [0] * n
for i in range(n):
    for node in g[i]:
        if d[node] == d[i] + 1:
            ans[node] = i + 1
for x in ans:
    print(x)


Error: TLE

Fixed submission:

n, m = map(int, input().split())
g = [[] for _ in range(n)]
inv = [0] * n
for _ in range(n - 1 + m):
    a, b = map(int, input().split())
    g[a - 1].append(b - 1)
    inv[b - 1] += 1
for i in range(n):
    if inv[i] == 0:
        root = i
        break
d = [0] * n
s = [root]
while s:
    p = s.pop()
    for node in g[p]:
        d[node] = max(d[node], d[p] + 1)
        s.append(node)
ans = [0] * n
for i in range(n):
    for node in g[i]:
        if d[node] == d[i] + 1:
            ans[node] = i + 1
for x in ans:
    print(x)
Problem p03145 (Python) — buggy submission, verdict: Runtime Error

h, w, _ = [int(i) for i in input().split()]
ans = h * w // 2
print(ans)


Error: ValueError: invalid literal for int() with base 10: ' '
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03145/Python/s129162499.py", line 1, in <module>
    h, w, _ = [int(i) for i in input()]
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03145/Python/s129162499.py", line 1, in <listcomp>
    h, w, _ = [int(i) for i in input()]
ValueError: invalid literal for int() with base 10: ' '


Fixed submission:

h, w, _ = [int(i) for i in input()]
ans = h * w // 2
print(ans)
Problem p03145 (Python) — buggy submission, verdict: Runtime Error

def main() -> None:
    ab, bc, ca = map(int, input().split())
    print(ab * bc // 2)


if __name__ == "__main__":
    main()


Error: ValueError: invalid literal for int() with base 10: ' '
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03145/Python/s388138041.py", line 7, in <module>
    main()
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03145/Python/s388138041.py", line 2, in main
    ab, bc, ca = map(int, input())
ValueError: invalid literal for int() with base 10: ' '


Fixed submission:

def main() -> None:
    ab, bc, ca = map(int, input())
    print(ab * bc // 2)


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

LL = list(map(int, input().split()))
LL.sort()
R = LL[0] * LL[1] // 2
print(R)


Error: TypeError: 'NoneType' object is not subscriptable
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03145/Python/s826877996.py", line 2, in <module>
    R = LL[0] * LL[1] // 2
TypeError: 'NoneType' object is not subscriptable


Fixed submission:

LL = list(map(int, input().split())).sort()
R = LL[0] * LL[1] // 2
print(R)
Problem p03145 (Python) — buggy submission, verdict: Runtime Error

x, y, z = map(int, input().split())
print(int(x * y / 2))


Error: ValueError: invalid literal for int() with base 10: '3 4 5'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03145/Python/s174683495.py", line 1, in <module>
    s = int(input())
ValueError: invalid literal for int() with base 10: '3 4 5'


Fixed submission:

s = int(input())
an = []
an.append(s)
n = s
while an.count(4) != 2:
    if n % 2 == 0:
        n /= 2
        an.append(int(n))
    else:
        n = 3 * n + 1
        an.append(int(n))
if an.index(1 or 2) == 0:
    print(4)
else:
    print(an.index(4) + 4)
Problem p03145 (Python) — buggy submission, verdict: Runtime Error

a, b, c = map(int, input().split())

print(int(a * b / 2))


Error: ValueError: invalid literal for int() with base 10: ' '
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03145/Python/s543024524.py", line 1, in <module>
    a, b, c = map(int, input())
ValueError: invalid literal for int() with base 10: ' '


Fixed submission:

a, b, c = map(int, input())

print(a * b / 2)
Problem p03145 (Python) — buggy submission, verdict: Runtime Error

def main():
    ab, bc, _ = get_params()
    print(area(ab, bc))


def get_params():
    return [int(s) for s in input().split()]


def area(ab, bc):
    return ab * bc // 2


if __name__ == "__main__":
    main()


Error: 0

Fixed submission:

from typing import List


def main() -> None:
    ab, bc, _ = get_params()
    print(area(ab, bc))


def get_params() -> List[int]:
    return [int(s) for s in input().split()]


def area(ab: int, bc: int) -> int:
    return ab * bc // 2


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

AB, BC, CA = map(int, input().split())

print((AB * BC) // 2)


Error: ValueError: invalid literal for int() with base 10: '3 4 5'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03145/Python/s114139853.py", line 1, in <module>
    AB, BC, CA = int(input())
ValueError: invalid literal for int() with base 10: '3 4 5'


Fixed submission:

AB, BC, CA = int(input())

print((AB * BC) // 2)
Problem p03146 (Python) — buggy submission, verdict: Runtime Error

s = int(input())
an = []
an.append(s)
n = s
while an.count(4) != 2:
    if n % 2 == 0:
        n /= 2
        an.append(int(n))
    else:
        n = 3 * n + 1
        an.append(int(n))
if an.index(1) == 0:
    print(4)
elif an.index(2) == 0:
    print(4)
else:
    print(an.index(4) + 4)


Error: ValueError: 1 is not in list
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03146/Python/s842061170.py", line 5, in <module>
    if an.index(1 or 2) == 0:
ValueError: 1 is not in list


Fixed submission:

s = int(input())
an = []
an.append(s)
n = s
if an.index(1 or 2) == 0:
    print(4)
while an.count(4) != 2:
    if n % 2 == 0:
        n /= 2
        an.append(int(n))
    else:
        n = 3 * n + 1
        an.append(int(n))
print(an.index(4) + 4)
Problem p03146 (Python) — buggy submission, verdict: Runtime Error

s = int(input())
a = [s]
z = set([s])
idx = 1
for i in range(10**8):
    idx += 1
    if a[i] % 2 == 0:
        ai = a[i] // 2
    else:
        ai = 3 * a[i] + 1
    if ai in z:
        print(idx)
        exit()
    a.append(ai)
    z.add(ai)


Error: TypeError: 'int' object is not iterable
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03146/Python/s047431119.py", line 3, in <module>
    z = set(s)
TypeError: 'int' object is not iterable


Fixed submission:

s = int(input())
a = [s]
z = set(s)
idx = 1
for i in range(10**8):
    idx += 1
    if a[i] % 2 == 0:
        ai = a[i] // 2
    else:
        ai = 3 * a[i] + 1
    if ai in z:
        print(idx)
        exit()
    a.append(ai)
    z.add(ai)