alexjercan/bugnet huggingface dataset:
Problem p03387 (Python) — buggy submission, verdict: Runtime Error

A, B, C = map(int, input().split())
diff = max(A, B, C) * 3 - (A + B + C)
if diff % 2 == 0:
    print(diff // 2)
else:
    print(diff // 2 + 2)


Error: TypeError: sum() takes at most 2 arguments (3 given)
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03387/Python/s401385664.py", line 2, in <module>
    diff = max(A, B, C) * 3 - sum(A, B, C)
TypeError: sum() takes at most 2 arguments (3 given)


Fixed submission:

A, B, C = map(int, input().split())
diff = max(A, B, C) * 3 - sum(A, B, C)
if diff % 2 == 0:
    print(diff // 2)
else:
    print(diff // 2 + 2)
Problem p03387 (Python) — buggy submission, verdict: Runtime Error

# WIP
A, B, C = map(int, input().split())

combi = [A, B, C]
set_abc = set(combi)

len_set_abc = len(set_abc)
max_set = max(set_abc)
min_set = min(set_abc)
if len_set_abc == 1:
    print(0)
elif len_set_abc == 2:
    max_freq = combi.count(max_set)
    diff = max_set - min_set
    if max_freq == 2 and diff % 2:
        print((diff + 1) // 2 + 1)
    elif max_freq == 2:
        print(diff // 2)
    else:
        print(diff)
else:
    other = [c for c in combi if c != max_set]
    max_other = max(other)
    min_other = min(other)

    n_operation = max_set - max_other
    max_other += n_operation
    min_other += n_operation

    diff = max_set - min_other
    if diff % 2 and diff == 1:
        n_add = (max_set - min_other) // 2 + 2
    elif diff % 2:
        n_add = (max_set - min_other) // 2 + 2
    else:
        n_add = (max_set - min_other) // 2
    n_operation += n_add

    print(n_operation)


Error: 0

Fixed submission:

A, B, C = map(int, input().split())

combi = [A, B, C]
max_ABC = max([A, B, C])
other = [c for c in combi if c != max_ABC]
max_other = max(other)
min_other = min(other)

# Operation (1st method)
n_operation = max_ABC - max_other
max_other += n_operation
min_other += n_operation

if max_other == min_other:
    print(n_operation)
    exit()

# Operation (2nd method)
if (max_ABC - min_other) % 2:
    n_add = (max_ABC - min_other) // 2 + 1
else:
    n_add = (max_ABC - min_other) // 2
n_operation += n_add

print(n_operation)
Problem p03387 (Python) — buggy submission, verdict: Runtime Error

a = list(sorted(map(int, input().split())))
if (a[2] - a[0]) % 2 == 0 and (a[2] - a[1]) % 2 == 0:
    print((a[2] - a[0]) // 2 + (a[2] - a[1]) // 2)
elif (a[2] - a[0]) % 2 == 1 and (a[2] - a[1]) % 2 == 1:
    print((a[2] - a[0]) // 2 + (a[2] - a[1]) // 2 + 1)
else:
    if (a[2] - a[0]) % 2 == 1:
        a[0] += 2
        a[1] += 1
        a[2] += 1
    else:
        a[0] += 1
        a[1] += 2
        a[2] += 1
    a = sorted(a)
    if (a[2] - a[0]) % 2 == 0 and (a[2] - a[1]) % 2 == 0:
        print((a[2] - a[0]) // 2 + (a[2] - a[1]) // 2 + 2)
    elif (a[2] - a[0]) % 2 == 1 and (a[2] - a[1]) % 2 == 1:
        print((a[2] - a[0]) // 2 + (a[2] - a[1]) // 2 + 1 + 2)
    else:
        raise


Error: 0

Fixed submission:

a = list(sorted(map(int, input().split())))
if (a[2] - a[0]) % 2 == 0 and (a[2] - a[1]) % 2 == 0:
    print((a[2] - a[0]) // 2 + (a[2] - a[1]) // 2)
elif (a[2] - a[0]) % 2 == 1 and (a[2] - a[1]) % 2 == 1:
    print((a[2] - a[0]) // 2 + (a[2] - a[1]) // 2 + 1)
else:
    if (a[2] - a[0]) % 2 == 1:
        a[0] += 3
        a[1] += 2
        a[2] += 1
    else:
        a[1] += 3
        a[0] += 2
        a[2] += 1
    a = sorted(a)
    if (a[2] - a[0]) % 2 == 0 and (a[2] - a[1]) % 2 == 0:
        print((a[2] - a[0]) // 2 + (a[2] - a[1]) // 2 + 3)
    elif (a[2] - a[0]) % 2 == 1 and (a[2] - a[1]) % 2 == 1:
        print((a[2] - a[0]) // 2 + (a[2] - a[1]) // 2 + 1 + 3)
    else:
        raise
Problem p03388 (Python) — buggy submission, verdict: Time Limit Exceeded

def solve(A, B):
    from math import sqrt

    M = A * B
    cnt = 0

    x, y = A, B
    if y - x >= 1:
        z = int(sqrt(M))
        x = z
        y = M // x if M % x else M // x - 1
        cnt += z - A
    cnt += y - 1

    x, y = B, A
    if y - x >= 1:
        z = int(sqrt(M))
        x = z
        y = M // x if M % x else M // x - 1
        cnt += z - B
    cnt += y - 1

    return cnt


Q = int(input())
Query = [tuple(map(int, input().split())) for _ in range(Q)]

for A, B in Query:
    print(solve(A, B))


Error: TLE

Fixed submission:

def solve(A, B):
    M = A * B
    cnt = 0

    x, y = A, B
    while y - x >= 1:
        x += 1
        y = M // x if M % x else M // x - 1
        cnt += 1
    cnt += y - 1

    x, y = B, A
    while y - x >= 1:
        x += 1
        y = M // x if M % x else M // x - 1
        cnt += 1
    cnt += y - 1

    return cnt


Q = int(input())
Query = [tuple(map(int, input().split())) for _ in range(Q)]

for A, B in Query:
    print(solve(A, B))
Problem p03391 (Python) — buggy submission, verdict: Time Limit Exceeded

N = int(input())

same = True
sum_a = 0
min_b = None

for _ in range(N):
    a, b = map(int, input().split())
    # Aの総和を求める
    sum_a += a
    # AとBが等しいどうかを調べる
    if a != b:
        same = False
    # Ai > Biの中で最小のbを求める
    if a > b and (min_b is None or b < min_b):
        min_b = b

# 初めから同じなら手数なし
if same:
    print(0)
    exit()

# Ai > Biの中で最小のbを求める
if min_b is None:
    min_b = 0

print(sum_a - min_b)


Error: TLE

Fixed submission:

N = int(input())
A = [0] * N
B = [0] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())

c = 0

if A == B:
    print(c)
    exit()

# A[i] < B[i]のところはA[i] == 0になるまで追いつけない
for i in range(N):
    if A[i] < B[i]:
        c += A[i]
        B[i] -= A[i]
        A[i] = 0

while A != B:
    x = 0
    for i in range(N):
        if A[i] == 0:
            continue
        x = i
        if A[i] < B[i]:
            break
    A[x] -= 1
    y = 0
    for i in range(N):
        if A[i] == B[i]:
            continue
        y = i
        if A[i] < B[i]:
            break
    B[y] -= 1
    c += 1

print(c)
Problem p03393 (Python) — buggy submission, verdict: Runtime Error

s = s0 = input()
d = {chr(c) for c in range(97, 123)}
for c in s:
    d.remove(c)
if d:
    s += min(d)
else:
    for c in reversed(s):
        s = s[:-1]
        if d and any(c < e for e in d):
            s += min(e for e in d if c < e)
            break
        d.add(c)
print(s if s else -1)
if s:
    assert s0 < s


Error: 0

Fixed submission:

s = s0 = input()
d = {chr(c) for c in range(97, 123)}
for c in s:
    d.remove(c)
if d:
    s += min(d)
else:
    for c in reversed(s):
        s = s[:-1]
        if d and c < min(d):
            s += min(d)
            break
        d.add(c)
print(s if s else -1)
assert s0 < s
Problem p03393 (Python) — buggy submission, verdict: Runtime Error

def main():
    S = input()
    S_set = set(list(S))
    C_set = set([chr(ord("a") + i) for i in range(26)])

    if len(S_set) == len(C_set):
        S = list(S)
        p = None
        for i in range(len(S) - 2, -1, -1):
            if S[i] < S[i + 1]:
                p = i
                break
        else:
            print(-1)
            return

        ans = S[:p].copy()
        rest = C_set - set(S[: p + 1])
        rest = sorted(rest)
        for r in rest:
            if S[p] < r:
                ans.append(r)
                break
        print(*ans, sep="")
    else:
        diff = C_set - S_set
        diff = sorted(diff)
        print(S + diff[0])
        return


main()


Error: 0

Fixed submission:

S = input()
S_set = set(list(S))
C_set = set([chr(ord("a") + i) for i in range(26)])

if len(S_set) == len(C_set):
    S = list(S)
    p = None
    for i in range(len(S) - 2, -1, -1):
        if S[i] < S[i + 1]:
            p = i
            break
    else:
        print(-1)
    ans = S[:p].copy()
    rest = C_set - set(S[: p + 1])
    rest = sorted(rest)
    for r in rest:
        if S[p] < r:
            ans.append(r)
            break
    print(*ans, sep="")
else:
    diff = C_set - S_set
    diff = sorted(diff)
    print(S + diff[0])
Problem p03395 (Python) — buggy submission, verdict: Runtime Error

from scipy.sparse.csgraph import floyd_warshall
import numpy as np


def make_graph(m):
    matrix = np.zeros([m + 1, m + 1, m + 1])
    for k in range(1, m + 1):
        for s in range(k, m + 1):
            matrix[k, s, s % k] = 1
    return matrix


def is_disable(matrix, subset, aaa, bbb):
    if subset:
        sub_matrix = matrix[list(subset)].max(axis=0)
    else:
        sub_matrix = matrix[0]
    sp = floyd_warshall(sub_matrix)
    return any(sp[a, b] > 50 for a, b in zip(aaa, bbb))


def solve(aaa, bbb):
    for a, b in zip(aaa, bbb):
        if a < b:
            return -1
    m = max(aaa)
    matrix = make_graph(m)
    subset = set(range(1, m + 1))
    if is_disable(matrix, subset, aaa, bbb):
        return -1

    for k in range(m, 0, -1):
        subset.remove(k)
        if is_disable(matrix, subset, aaa, bbb):
            subset.add(k)
    return sum(1 << k for k in subset)


n = int(input())
aaa = list(map(int, input().split()))
bbb = list(map(int, input().split()))
print(solve(aaa, bbb))


Error: ModuleNotFoundError: No module named 'scipy'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03395/Python/s064671965.py", line 1, in <module>
    from scipy.sparse.csgraph import floyd_warshall
ModuleNotFoundError: No module named 'scipy'


Fixed submission:

from scipy.sparse.csgraph import floyd_warshall
import numpy as np


def make_graph(m):
    matrix = np.zeros([m + 1, m + 1, m + 1])
    for k in range(1, m + 1):
        for s in range(k, m + 1):
            matrix[k, s, s % k] = 1
    return matrix


def is_disable(matrix, subset, aaa, bbb):
    sub_matrix = matrix[list(subset)].max(axis=0)
    sp = floyd_warshall(sub_matrix)
    return any(sp[a, b] > 50 for a, b in zip(aaa, bbb))


def solve(aaa, bbb):
    for a, b in zip(aaa, bbb):
        if a < b:
            return -1
    m = max(aaa)
    matrix = make_graph(m)
    subset = set(range(1, m + 1))
    if is_disable(matrix, subset, aaa, bbb):
        return -1

    for k in range(m, 0, -1):
        subset.remove(k)
        if is_disable(matrix, subset, aaa, bbb):
            subset.add(k)
    return sum(1 << k for k in subset)


n = int(input())
aaa = list(map(int, input().split()))
bbb = list(map(int, input().split()))
print(solve(aaa, bbb))
Problem p03399 (Python) — buggy submission, verdict: Runtime Error

A, B, C, D = [int(input()) for _ in range(4)]
print(min(A, B) + min(C, D))


Error: ValueError: not enough values to unpack (expected 4, got 1)
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03399/Python/s715170976.py", line 1, in <module>
    A, B, C, D = map(int, input().split())
ValueError: not enough values to unpack (expected 4, got 1)


Fixed submission:

A, B, C, D = map(int, input().split())
print(min(A, B) + min(C, D))
Problem p03399 (Python) — buggy submission, verdict: Runtime Error

a, b, c, d = [int(input()) for _ in range(4)]

print(min(a, b) + min(c, d))


Error: ValueError: not enough values to unpack (expected 4, got 1)
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03399/Python/s272777471.py", line 1, in <module>
    a, b, c, d = map(int, input().split())
ValueError: not enough values to unpack (expected 4, got 1)


Fixed submission:

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

ab = [a, b]
cd = [c, d]

print(min(ab) + min(cd))
Problem p03399 (Python) — buggy submission, verdict: Runtime Error

def main():
    A, B, C, D = [int(input()) for _ in range(4)]
    print(min(A, B) + min(C, D))


if __name__ == "__main__":
    main()


Error: ValueError: not enough values to unpack (expected 4, got 1)
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03399/Python/s776051858.py", line 7, in <module>
    main()
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03399/Python/s776051858.py", line 2, in main
    A, B, C, D = map(int, input().split())
ValueError: not enough values to unpack (expected 4, got 1)


Fixed submission:

def main():
    A, B, C, D = map(int, input().split())
    print(min(A, B) + min(C, D))


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

a = int(input())
b = int(input())
c = int(input())
d = int(input())

print(min(a, b) + min(c, d))


Error: ValueError: not enough values to unpack (expected 4, got 1)
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03399/Python/s943981097.py", line 1, in <module>
    a, b, c, d = map(int, input().split())
ValueError: not enough values to unpack (expected 4, got 1)


Fixed submission:

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

print(min(a, b) + min(c, d))
Problem p03399 (Python) — buggy submission, verdict: Runtime Error

a = int(input())
b = int(input())
c = int(input())
d = int(input())

print(min(a, b) + min(c, d))


Error: ValueError: not enough values to unpack (expected 4, got 1)
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03399/Python/s146264747.py", line 1, in <module>
    a, b, c, d = map(int, input().split())
ValueError: not enough values to unpack (expected 4, got 1)


Fixed submission:

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

print(min(a, b) + min(c, d))
Problem p03400 (Python) — buggy submission, verdict: Runtime Error

N = int(input())
D, X = map(int, input().split())
A = list(int(input()) for i in range(N))
sum = 0
for i in range(N):
    B = 0
    while B * A[i] + 1 <= D:
        B += 1
        sum += 1
print(X + sum)


Error: TypeError: can only concatenate str (not "int") to str
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03400/Python/s335777592.py", line 7, in <module>
    while B * A[i] + 1 <= D:
TypeError: can only concatenate str (not "int") to str


Fixed submission:

N = int(input())
D, X = map(int, input().split())
A = list(input() for i in range(N))
sum = 0
for i in range(N):
    B = 0
    while B * A[i] + 1 <= D:
        B += 1
        sum += 1
print(X + sum)
Problem p03401 (Python) — buggy submission, verdict: Time Limit Exceeded

n = int(input())
a = list(map(int, input().split()))
a.append(0)
a.insert(0, 0)
costs = []
for i in range(n + 1):
    costs.append(abs(a[i + 1] - a[i]))

s = sum(costs)
for i in range(n):
    print(s - costs[i] - costs[i + 1] + abs(a[i] - a[i + 2]))


Error: TLE

Fixed submission:

n = int(input())
a = list(map(int, input().split()))
for i in range(n):
    b = 0
    bud = 0
    for ai in a:
        if a[i] != ai:
            bud += abs(ai - b)
            b = ai
    bud += abs(b)
    print(bud)
Problem p03401 (Python) — buggy submission, verdict: Time Limit Exceeded

N = int(input())
As = [0]
As.extend(map(int, input().split()))
As.append(0)

sum = 0
pos = 0
for i in range(1, N + 2):
    sum += abs(pos - As[i])
    pos = As[i]

for i in range(1, N + 1):
    skip_pos = As[i]
    pre_pos = As[i - 1]
    post_pos = As[i + 1]

    if (pre_pos - skip_pos) * (post_pos - skip_pos) <= 0:
        print(sum)
    else:
        print(
            sum
            - abs(pre_pos - skip_pos)
            - abs(post_pos - skip_pos)
            + abs(pre_pos - post_pos)
        )


Error: TLE

Fixed submission:

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


for skip_num in range(N):
    sum = 0
    pos = 0
    for i in range(N):
        if i == skip_num:
            continue
        sum += abs(pos - As[i])
        pos = As[i]
    sum += abs(pos)
    print(sum)
Problem p03401 (Python) — buggy submission, verdict: Time Limit Exceeded

n = int(input())
a = list(map(int, input().split()))
Sum = 0
a.insert(0, 0)
a.append(0)
s = []
b = []
for i in range(len(a) - 1):
    b.append(abs(a[i] - a[i + 1]))
Sum_b = sum(b)
for i in range(len(b) - 1):
    ans = Sum_b - (b[i] + b[i + 1]) + abs(a[i] - a[i + 2])
    print(ans)


Error: TLE

Fixed submission:

n = int(input())
a = list(map(int, input().split()))
Sum = 0
a.insert(0, 0)
a.append(0)
s = []
b = []
for i in range(len(a) - 1):
    b.append(abs(a[i] - a[i + 1]))
for i in range(len(b) - 1):
    ans = sum(b) - (b[i] + b[i + 1]) + abs(a[i] - a[i + 2])
    print(ans)
Problem p03401 (Python) — buggy submission, verdict: Time Limit Exceeded

from collections import deque

n = int(input())
a = deque(map(int, input().split()))
a.appendleft(0)
a.append(0)

sum = sum([abs(a[i + 1] - a[i]) for i in range(len(a) - 1)])
ans = 0

for i in range(n):
    ans = sum
    ans = ans - abs(a[i + 1] - a[i]) - abs(a[i + 2] - a[i + 1]) + abs(a[i + 2] - a[i])
    print(ans)


Error: TLE

Fixed submission:

from collections import deque

n = int(input())
a = deque(map(int, input().split()))
a.appendleft(0)
a.append(0)
a = list(a)
kaisa = deque()
ans = list()

for i in range(len(a)):
    if i == 0:
        continue
    diff = a[i] - a[i - 1]
    kaisa.append(diff)

for i in range(n):
    ans = list(kaisa).copy()
    new_num = kaisa[i] + kaisa[i + 1]
    ans.remove(kaisa[i])
    ans.remove(kaisa[i + 1])
    ans.insert(i, new_num)
    print(sum([abs(n) for n in ans]))
Problem p03401 (Python) — buggy submission, verdict: Time Limit Exceeded

from collections import deque

N = int(input())
A = [0] + list(map(int, input().split())) + [0]

total = 0
for i in range(1, N + 2):
    total += abs(A[i - 1] - A[i])

visited = []
for i in range(1, N + 1):
    a = abs(A[i - 1] - A[i + 1])
    b = abs(A[i] - A[i - 1]) + abs(A[i] - A[i + 1])
    visited.append(total + (a - b))

for v in visited:
    print(v)


Error: TLE

Fixed submission:

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

A.append(0)
for i in range(N):
    b, s = 0, 0
    for j, a in enumerate(A):
        if i != j:
            s += abs(b - a)
            b = a
    print(s)
Problem p03401 (Python) — buggy submission, verdict: Runtime Error

n = int(input())
a = [0] + list(map(int, input().split())) + [0]
m = []
for i in range(n):
    if a[i] <= a[i + 1] <= a[i + 2] or a[i + 2] <= a[i + 1] <= a[i]:
        m.append(0)
    elif a[i] <= a[i + 2] <= a[i + 1] or a[i + 1] <= a[i + 2] <= a[i]:
        m.append(1)
    elif a[i + 1] <= a[i] <= a[i + 2] or a[i + 2] <= a[i] <= a[i + 1]:
        m.append(-1)

s = sum(abs(a[i] - a[i + 1]) for i in range(n + 1))

for i, m0 in enumerate(m):
    if m0 == 0:
        print(s)
    elif m0 == 1:
        print(s - 2 * abs(a[i + 1] - a[i + 2]))
    elif m0 == -1:
        print(s - 2 * abs(a[i] - a[i + 1]))


Error: IndexError: list index out of range
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03401/Python/s825783315.py", line 21, in <module>
    print(s - 2 * abs(a[i + 2] - a[i + 3]))
IndexError: list index out of range


Fixed submission:

n = int(input())
a = list(map(int, input().split()))
m = []
for i in range(n - 2):
    if a[i] < a[i + 1] < a[i + 2] or a[i + 2] < a[i + 1] < a[i]:
        m.append(0)
    if a[i + 1] < a[i] < a[i + 2] or a[i + 1] < a[i + 2] < a[i]:
        m.append(1)
    if a[i] < a[i + 2] < a[i + 1] or a[i + 2] < a[i] < a[i + 1]:
        m.append(-1)

s = sum(abs(a[i] - a[i + 1]) for i in range(n - 1))

print(s - abs(a[0] - a[1]))
for i, m0 in enumerate(m):
    if m0 == 0:
        print(s)
    elif m0 > 0:
        print(s - 2 * abs(a[i + 1] - a[i + 2]))
    elif m0 < 0:
        print(s - 2 * abs(a[i + 2] - a[i + 3]))
print(s - abs(a[n - 1] - a[n]))
Problem p03401 (Python) — buggy submission, verdict: Runtime Error

n = int(input())
a = [0] + list(map(int, input().split())) + [0]

total = sum(abs(a[i] - a[i + 1]) for i in range(0, n + 1))
for i in range(1, n + 1):
    print(total - abs(a[i - 1] - a[i]) - abs(a[i] - a[i + 1]) + abs(a[i - 1] - a[i + 1]))


Error: 0

Fixed submission:

n = int(input())
a = [0, *map(int, input().split()), 0]

total = sum(abs(a[i] - a[i + 1]) for i in range(0, n + 1))
for i in range(1, n + 1):
    print(total - abs(a[i - 1] - a[i]) - abs(a[i] - a[i + 1]) + abs(a[i - 1] - a[i + 1]))
Problem p03401 (Python) — buggy submission, verdict: Time Limit Exceeded

N = int(input())
A = [0] + list(map(int, input().split())) + [0]


s = 0
for i in range(1, N + 2):
    x = abs(A[i - 1] - A[i])
    s += x

for i in range(1, N + 1):
    x = abs(A[i - 1] - A[i])
    y = abs(A[i] - A[i + 1])
    z = abs(A[i - 1] - A[i + 1])
    print(s - x - y + z)


Error: TLE

Fixed submission:

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

for i in range(N):
    s = 0
    a = 0
    for j, b in enumerate(A):
        if i == j:
            continue
        s += abs(a - b)
        a = b
    s += abs(a)
    print(s)
Problem p03401 (Python) — buggy submission, verdict: Time Limit Exceeded

n = int(input())
a = list(map(int, input().split()))
s = abs(a[0])

for i in range(n - 1):
    s += abs(a[i] - a[i + 1])
s += abs(a[n - 1])

for i in range(n):
    if i == 0:
        print(s + abs(0 - a[i + 1]) - (abs(0 - a[i]) + abs(a[i] - a[i + 1])))
    elif i == n - 1:
        print(s + abs(a[i - 1] - 0) - (abs(a[i - 1] - a[i]) + abs(a[i])))
    else:
        print(
            s + abs(a[i - 1] - a[i + 1]) - (abs(a[i - 1] - a[i]) + abs(a[i] - a[i + 1]))
        )


Error: TLE

Fixed submission:

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

for i in range(n):
    ans = 0
    tmp = 0
    for j in range(n):
        if j != i:
            ans += abs(tmp - a[j])
            tmp = a[j]

    ans += abs(tmp - 0)
    print(ans)
Problem p03407 (Python) — buggy submission, verdict: Runtime Error

x = raw_input().split()
if int(x[2]) <= int(x[0]) + int(x[1]):
    print("Yes")

else:
    print("No")


Error: TypeError: 'builtin_function_or_method' object is not subscriptable
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03407/Python/s586216421.py", line 2, in <module>
    if x[2] <= x[0] + x[1]:
TypeError: 'builtin_function_or_method' object is not subscriptable


Fixed submission:

x = input().split
if x[2] <= x[0] + x[1]:
    print("Yes")
else:
    print("No")
Problem p03407 (Python) — buggy submission, verdict: Runtime Error

A, B, C = map(int, input().split())
print("Yes" if A + B >= C else "No")


Error: ValueError: invalid literal for int() with base 10: ' '
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03407/Python/s505965538.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("Yes" if A + B >= C else "No")
Problem p03408 (Python) — buggy submission, verdict: Runtime Error

N = int(input())
s = []
for _ in range(N):
    s.append(input())

M = int(input())
t = []
for _ in range(M):
    t.append(input())

sets = set(s)

ans = [0]
for word in sets:
    tmp = 0
    tmp += s.count(word)
    tmp -= t.count(word)
    ans.append(tmp)

print(max(ans))


Error: EOFError: EOF when reading a line
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03408/Python/s032947728.py", line 9, in <module>
    t.append(input())
EOFError: EOF when reading a line


Fixed submission:

N = int(input())

s = []
t = []
for _ in range(N):
    s.append(input())

for _ in range(N):
    t.append(input())

sets = set(s)

ans = []
for word in sets:
    tmp = 0
    tmp += s.count(word)
    tmp -= t.count(word)
    ans.append(tmp)

print(max(ans))