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

K, S = map(int, input().split())

# a = []
ans = 0
for i in range(K + 1):
    for j in range(i + 1):
        k = S - i - j
        if k >= 0 and k <= j:
            # print(i, j, k)
            if i == j and j == k:
                ans += 1
            elif i == j or j == k:
                ans += 3
            else:
                ans += 6

print(ans)


Error: TLE

Fixed submission:

K, S = map(int, input().split())

# a = []
ans = 0
for i in range(K + 1):
    for j in range(i + 1):
        for k in range(j + 1):
            # print(i, j, k)
            if i + j + k == S:
                # print(i, j, k)
                # tmp = [i, j, k]
                # a.append(tmp)
                if i == j and j == k:
                    ans += 1
                elif i == j or j == k:
                    ans += 3
                else:
                    ans += 6

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

K, S = list(map(int, input().rstrip().split()))

n = 0
for x in range(K + 1):
    for y in range(K + 1):
        z = S - x - y
        if 0 <= z and z <= K:
            n += 1

print(n)


Error: TLE

Fixed submission:

K, S = list(map(int, input().rstrip().split()))

n = 0
for x in range(K + 1):
    for y in range(K + 1):
        if x + y > S:
            break

        for z in range(K + 1):
            if x + y + z > S:
                break

            if (x + y + z) == S:
                n += 1

print(n)
Problem p03835 (Python) — buggy submission, verdict: Time Limit Exceeded

k, s = map(int, input().split())

k += 1

ans = 0
for x in range(k):
    for y in range(k):
        if s - (x + y) >= 0 and s - (x + y) <= k - 1:
            ans += 1

print(ans)


Error: TLE

Fixed submission:

k, s = map(int, input().split())

k += 1

ans = 0
for x in range(k):
    for y in range(k):
        for z in range(k):
            if x + y + z == s:
                ans += 1

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

K, S = map(int, input().split())


def f():
    if K * 3 >= S:
        for x in range(min(K, S), -1, -1):
            if K * 2 >= S - x:
                for y in range(min(K, S - x), -1, -1):
                    if K >= S - x - y:
                        yield 1


print(sum(list(f())))


Error: TLE

Fixed submission:

import itertools

K, S = map(int, input().split())

print(sum([1 for xyz in itertools.product(range(K + 1), repeat=3) if sum(xyz) == S]))
Problem p03835 (Python) — buggy submission, verdict: Time Limit Exceeded

k, s = map(int, input().split())
r = range(0, k + 1)
cnt = 0
for x in r:
    for y in r:
        if s - k <= x + y <= s:
            cnt += 1
print(cnt)


Error: TLE

Fixed submission:

k, s = map(int, input().split())
r = range(0, k + 1)
cnt = 0
for x in r:
    for y in r:
        if x + y > s:
            continue
        for z in r:
            if x + y + z == s:
                cnt += 1

print(cnt)
Problem p03835 (Python) — buggy submission, verdict: Time Limit Exceeded

[K, S] = map(int, input().split())
ret = 0
for x in range(K + 1):
    for y in range(K + 1):
        z = S - x - y
        if 0 <= z and z <= K:
            ret += 1
print(ret)


Error: TLE

Fixed submission:

[K, S] = map(int, input().split())
ret = 0
for x in range(K + 1):
    for y in range(K + 1):
        for z in range(K + 1):
            if (x + y + z) == S:
                ret += 1
print(ret)
Problem p03835 (Python) — buggy submission, verdict: Time Limit Exceeded

K, S = map(int, input().split())
n = 0
for x in range(K + 1):
    for y in range(K + 1):
        if (x + y) > S:
            break
        elif (S - (x + y)) <= K:
            n += 1
print(str(n))


Error: TLE

Fixed submission:

K, S = map(int, input().split())
n = 0
for i in range(K + 1):
    for j in range(K + 1):
        if (i + j) > S:
            continue
        elif (S - i - j) > K:
            continue
        for k in range(K + 1):
            if (i + j + k) == S:
                n += 1
print(str(n))
Problem p03835 (Python) — buggy submission, verdict: Time Limit Exceeded

K, S = map(int, input().split())
cnt = 0
for x in range(K + 1):
    for y in range(K + 1):
        z = S - x - y
        if z >= 0 and z <= K:
            cnt += 1
print(cnt)


Error: TLE

Fixed submission:

K, S = map(int, input().split())
cnt = 0
for x in range(K + 1):
    pass
    for y in range(K + 1):
        pass
        for z in range(K + 1):
            if x + y + z == S:
                cnt += 1
print(cnt)
Problem p03835 (Python) — buggy submission, verdict: Time Limit Exceeded

def solve():
    k, s = map(int, input().split())
    c = 0
    for x in range(k + 1):
        for y in range(k + 1):
            if 0 <= s - (x + y) <= k:
                c += 1
    return c


if __name__ == "__main__":
    print(solve())


Error: TLE

Fixed submission:

def solve():
    k, s = map(int, input().split())
    c = 0
    for x in range(k + 1):
        for y in range(k + 1):
            for z in range(k + 1):
                if x + y + z == s:
                    c += 1
    return c


if __name__ == "__main__":
    print(solve())
Problem p03835 (Python) — buggy submission, verdict: Time Limit Exceeded

K, S = map(int, input().split())
count = 0
for x in range(K + 1):
    for y in range(K + 1):
        z = S - x - y
        if 0 <= z <= K:
            count = count + 1

print(count)


Error: TLE

Fixed submission:

K, S = map(int, input().split())
count = 0
for i in range(K + 1):
    for j in range(K + 1):
        for k in range(K + 1):
            if i + j + k == S:
                count = count + 1

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

K, S = map(int, (input().split()))

ans = 0

for x in range(0, K + 1):
    for y in range(0, K + 1):

        z = S - x - y
        if z <= K and z >= 0:
            ans += 1

print(ans)


Error: TLE

Fixed submission:

K, S = map(int, (input().split()))

ans = 0

for x in range(0, K + 1):
    for y in range(0, K + 1):
        for z in range(0, K + 1):
            if x + y + z == S:
                ans += 1

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

K, S = map(int, input().split())
count = 0
for i in range(K + 1):
    for j in range(K + 1):
        Z = S - i - j
        if K >= Z >= 0:
            count += 1
print(count)


Error: TLE

Fixed submission:

K, S = map(int, input().split())
count = 0
for i in range(S + 1):
    X = S - i
    for j in range(i + 1):
        Y = j
        Z = S - X - Y
        if K >= X >= 0 and K >= Y >= 0 and K >= Z >= 0:
            count += 1
print(count)
Problem p03835 (Python) — buggy submission, verdict: Time Limit Exceeded

# coding: utf-8
K, S = map(int, input().split())
ans = 0
for i in range(K + 1):
    if S - i > 2 * K:
        continue
    elif S - i < 0:
        break
    if S - i > K:
        ans += 2 * K + 1 - S + i
    else:
        ans += S - i + 1
print(ans)


Error: TLE

Fixed submission:

# coding: utf-8
K, S = map(int, input().split())
ans = 0
for i in range(K + 1):
    if S > 2 * K + i:
        continue
    for j in range(K + 1):
        if S > K + i + j:
            continue
        for k in range(K + 1):
            if i + j + k == S:
                ans += 1
print(ans)
Problem p03835 (Python) — buggy submission, verdict: Memory Limit Exceeded

k, s = map(int, input().split())


def calc_xyz(target, limit):
    cnt = 0
    for x in range(min(limit, target) + 1):
        yz_sum = target - x
        for y in range(min(limit, yz_sum) + 1):
            if 0 <= target - x - y <= limit:
                cnt += 1
    return cnt


print(calc_xyz(s, k))


Error: MLE

Fixed submission:

k, s = map(int, input().split())


def calc_xyz(target, limit):
    xyz_list = []
    for x in range(min(limit, target) + 1):
        yz_sum = target - x
        for y in range(min(limit, yz_sum) + 1):
            z = target - x - y
            if 0 <= z <= limit:
                xyz_list.append([x, y, z])
    return xyz_list


print(len(calc_xyz(s, k)))
Problem p03835 (Python) — buggy submission, verdict: Time Limit Exceeded

k, s = map(int, input().split())

cnt = 0
for x in range(k + 1):
    for y in range(k + 1):
        z = s - x - y
        if 0 <= z <= k:
            cnt += 1

print(cnt)


Error: TLE

Fixed submission:

k, s = map(int, input().split())

cnt = 0
for x in range(k + 1):
    for y in range(k + 1):
        for z in range(k + 1):
            if s == x + y + z:
                cnt += 1

print(cnt)
Problem p03835 (Python) — buggy submission, verdict: Time Limit Exceeded

k, s = map(int, input().split())

ans = 0
for x in range(0, k + 1):
    for y in range(0, k + 1):
        if 0 <= s - (x + y) <= k:
            ans += 1
print(ans)


Error: TLE

Fixed submission:

k, s = map(int, input().split())

ans = 0
for x in range(0, k + 1):
    for y in range(0, k + 1):
        for z in range(0, k + 1):
            if x + y + z == s:
                ans += 1
print(ans)
Problem p03835 (Python) — buggy submission, verdict: Time Limit Exceeded

k, s = list(map(int, input().split()))
cnt = 0
for x in range(k + 1):
    for y in range(k + 1):
        if 0 <= s - x - y <= k:
            cnt += 1
print(cnt)


Error: TLE

Fixed submission:

k, s = list(map(int, input().split()))
cnt = 0
for x in range(k + 1):
    for y in range(k + 1):
        for z in range(k + 1):
            if s == x + y + z:
                cnt += 1
print(cnt)
Problem p03835 (Python) — buggy submission, verdict: Time Limit Exceeded

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

K, S = map(int, input().split())

r = 0
for i in range(K + 1):
    for j in range(K + 1):
        k = S - i - j
        if k >= 0 and k <= K:
            r += 1

print(r)


Error: TLE

Fixed submission:

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

K, S = map(int, input().split())

r = 0
for i in range(K + 1):
    for j in range(K + 1):
        for k in range(K + 1):
            if i + j + k == S:
                r += 1

print(r)
Problem p03835 (Python) — buggy submission, verdict: Time Limit Exceeded

k, s = map(int, input().split(" "))
count = 0
for i in range(0, k + 1):
    for j in range(0, k + 1):
        if 0 <= s - i - j <= k:
            count += 1

print(count)


Error: TLE

Fixed submission:

kk, s = map(int, input().split(" "))
count = 0
for i in range(0, kk + 1):
    for j in range(0, kk + 1):
        for k in range(0, kk + 1):
            if i + j + k == s:
                count += 1

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

def main():
    k, s = map(int, input().split())

    pattern = 0

    for x in range(k + 1):
        for y in range(k + 1):
            if (s - x - y >= 0) and (s - x - y <= k):
                pattern += 1

    # Wrong Anser
    #
    # # 3,4 --> 0 start
    # # 3,5 --> 0 start
    # # 3,7 --> 1 start
    # # 3,8 --> 2 start
    # # 3,9 --> 3 start
    # # 4,8 --> 0 start
    # # 4,9 --> 1 start
    # # 4,10 --> 2 start
    # # s // k * 2
    #
    # for x in range(s // 3, k + 1):
    #     for y in range(s // 3, min(k + 1, s - x + 1)):
    #         for z in range(s // 3, min(k + 1, s - x - y + 1)):
    #             if x + y + z == s:
    #                 pattern += 1
    #

    print(pattern)


if __name__ == "__main__":

    main()


Error: TLE

Fixed submission:

def main():
    k, s = map(int, input().split())

    pattern = 0

    if s > 3 * k:
        print(pattern)
        return

    for x in range(k + 1):
        for y in range(min(k + 1, s - x + 1)):
            for z in range(min(k + 1, s - x - y + 1)):
                if x + y + z == s:
                    pattern += 1

    print(pattern)


if __name__ == "__main__":

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

k, s = map(int, input().split())
count = 0

for i in range(k + 1):
    for j in range(k + 1):
        if 0 <= s - i - j <= k:
            count += 1

print(count)


Error: TLE

Fixed submission:

k, s = map(int, input().split())
count = 0

for i in range(k + 1):
    for j in range(k + 1):
        if s - i - j in range(k + 1):
            count += 1

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

K, S = list(map(int, input().split()))
res = 0

for x in range(K + 1):
    for y in range(K + 1):
        if S - x - y >= 0 and S - x - y <= K:
            res += 1
print(res)


Error: TLE

Fixed submission:

K, S = list(map(int, input().split()))
res = 0

for x in range(K + 1):
    tmp = S
    if tmp - x == 0:
        res += 1
        continue
    for y in range(K + 1):
        if tmp - x - y == 0:
            res += 1
            continue
        for z in range(K + 1):
            if tmp - x - y - z == 0:
                res += 1
                continue
print(res)
Problem p03835 (Python) — buggy submission, verdict: Time Limit Exceeded

K, S = [int(v) for v in input().split()]

cnt = 0
for x in range(K + 1):
    for y in range(K + 1):
        if S - (x + y) >= 0 and S - (x + y) <= K:
            cnt += 1
print(cnt)


Error: TLE

Fixed submission:

K, S = [int(v) for v in input().split()]

cnt = 0
for x in range(K + 1):
    if x > S:
        break
    for y in range(K + 1):
        if x + y > S:
            break
        for z in range(K + 1):
            if x + y + z > S:
                break
            if x + y + z == S:
                cnt += 1
print(cnt)
Problem p03835 (Python) — buggy submission, verdict: Time Limit Exceeded

k, s = list(map(int, input().split()))

count = 0
for x in range(k + 1):
    for y in range(k + 1):
        if x + y <= s <= x + y + k:
            count += 1

print(count)


Error: TLE

Fixed submission:

k, s = list(map(int, input().split()))

count = 0
for x in range(k + 1):
    for y in range(k + 1):
        for z in range(k + 1):
            if x + y + z == s:
                count += 1
                break

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

k, s = map(int, input().split())
cnt = 0
for x in range(max(s - 2 * k, 0), k + 1):
    for y in range(max(s - x - k, 0), min(s - x + 1, k + 1)):
        z = s - x - y
        if 0 <= z <= k:
            cnt += 1
        else:
            continue
print(cnt)


Error: TLE

Fixed submission:

k, s = map(int, input().split())
cnt = 0
for x in range(max(s - 2 * k, 0), k + 1):
    for y in range(k + 1):
        if s - x - y > k:
            continue
        elif s - x - y < 0:
            continue
        z = s - x - y
        if 0 <= z <= k:
            cnt += 1
print(cnt)
Problem p03837 (Python) — buggy submission, verdict: Time Limit Exceeded

from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import csr_matrix

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

graph = [[0] * n for _ in range(n)]
for a, b, c in abc:
    a -= 1
    b -= 1
    graph[a][b] = c
    graph[b][a] = c

dist = floyd_warshall(csr_matrix(graph))

ans = 0
for a, b, c in abc:
    a -= 1
    b -= 1

    if dist[a][b] != c:
        ans += 1

print(ans)


Error: TLE

Fixed submission:

from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import csr_matrix

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

graph = [[0] * n for _ in range(n)]
for a, b, c in abc:
    a -= 1
    b -= 1
    graph[a][b] = c
    graph[b][a] = c

dist, pre = floyd_warshall(csr_matrix(graph), return_predecessors=True)

edges = set()
for s in range(n):
    for g in range(s + 1, n):
        while g != s:
            par_g = pre[s][g]
            edge = sorted([par_g, g])
            edge = tuple(edge)
            edges.add(edge)
            g = par_g

ans = m - len(edges)
print(ans)
Problem p03838 (Python) — buggy submission, verdict: Runtime Error

x, y = list(map(int, input().split()))
ans = []
if y - x >= 0:
    ans.append(y - x)
if y + x >= 0:
    ans.append(y + x + 1)
if -1 * y - x >= 0:
    ans.append(-1 * y - x + 1)
if -1 * y + x >= 0:
    ans.append(-1 * y + x + 2)
print(min(ans))


Error: 0

Fixed submission:

x, y = list(map(int, input().split()))
if y - x >= 0:
    ans = y - x
if y + x >= 0:
    ans = min(ans, y + x + 1)
if -1 * y - x >= 0:
    ans = min(ans, -1 * y - x + 1)
if -1 * y + x >= 0:
    ans = min(ans, -1 * y + x + 2)
print(ans)
Problem p03838 (Python) — buggy submission, verdict: Runtime Error

# https://atcoder.jp/contests/agc008/tasks/agc008_a
# どう見ても符号反転は1回するのが最適
# ひたすら場合分け


x, y = map(int, input().split())
if x * y < 0:  # 異符号ならば答えは一つ
    print(abs(abs(x) - abs(y)) + 1)
    exit()
elif 0 <= x < y:
    print(y - x)
    exit()
elif 0 < y < x:
    print(2 + x - y)
    exit()
elif y == 0 and y < x:
    print(1 + x)
    exit()
elif x < y <= 0:
    print(y - x)
    exit()
elif y < x < 0:
    print(2 + x - y)
    exit()
elif x == 0 and y < x:
    print(1 - y)
    exit()
raise ValueError()


Error: 0

Fixed submission:

# https://atcoder.jp/contests/agc008/tasks/agc008_a
# どう見ても符号反転は1回するのが最適
# ひたすら場合分け


x, y = map(int, input().split())
if x * y < 0:  # 異符号ならば答えは一つ
    print(abs(abs(x) - abs(y)) + 1)
elif 0 <= x < y:
    print(y - x)
elif 0 <= y < x:
    print(x + y + 1)
    raise ValueError()
elif x < y <= 0:
    print(y - x)
else:
    print(2 + x - y)
Problem p03838 (Python) — buggy submission, verdict: Runtime Error

def main():
    x, y = map(int, input().split())

    if 0 <= x <= y or x <= y <= 0:
        ans = abs(abs(x) - abs(y))

    elif x <= 0 <= y or y <= 0 <= x:
        ans = abs(abs(x) - abs(y)) + 1

    elif y < x < 0 or 0 < y < x:
        ans = abs(abs(x) - abs(y)) + 2

    print(ans)


if __name__ == "__main__":
    main()


Error: 0

Fixed submission:

def main():
    x, y = map(int, input().split())

    if 0 <= x <= y or x <= y <= 0:
        ans = abs(abs(x) - abs(y))

    elif x < 0 < y or y < 0 < x:
        ans = abs(abs(x) - abs(y)) + 1

    elif y < x < 0 or 0 < y < x:
        ans = abs(abs(x) - abs(y)) + 2

    print(ans)


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

x, y = map(int, input().split())

d = abs(abs(y) - abs(x))

if (x > 0 and y <= 0) or (x >= 0 and y < 0) or (x < 0 and y > 0):
    d += 1
elif x > y:
    d += 2

print(d)


Error: 0

Fixed submission:

x, y = map(int, input().split())
d = abs(abs(y) - abs(x))
if x // abs(x) == y // abs(y):
    if x > y:
        d += 2
else:
    d += 1

print(d)
Problem p03838 (Python) — buggy submission, verdict: Runtime Error

def main():
    x, y = map(int, input().split())
    A = abs(abs(x) - abs(y))

    if x * y > 0:
        if x < y:
            B = 0
        else:
            B = 2
    elif x == 0:
        if x < y:
            B = 0
        else:
            B = 1
    elif y == 0:
        if x < y:
            B = 0
        else:
            B = 1
    else:
        B = 1

    print(A + B)


if __name__ == "__main__":
    main()


Error: 0

Fixed submission:

def main():
    x, y = map(int, input().split())
    A = abs(abs(x) - abs(y))

    if x * y > 0:
        if x < y:
            B = 0
        else:
            B = 2
    elif x == 0:
        if x < y:
            B = 0
        else:
            B = 1
    elif y == 0:
        if x < y:
            B = 0
        else:
            B = 1

    print(A + B)


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

A, op, B = map(str, input().split())

if op == "+":
    print(int(A) + int(B))

if op == "-":
    print(int(A) - int(B))


Error: ValueError: invalid literal for int() with base 10: '+'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03844/Python/s927597638.py", line 1, in <module>
    A, op, B = map(int, input().split())
ValueError: invalid literal for int() with base 10: '+'


Fixed submission:

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

if op == "+":
    print(A + B)

if op == "-":
    print(A - B)
Problem p03844 (Python) — buggy submission, verdict: Runtime Error

equa = input().split()
if equa[1] == "+":
    print(int(equa[0]) + int(equa[2]))
else:
    print(int(equa[0]) - int(equa[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/p03844/Python/s614588163.py", line 3, in <module>
    print(int(equa[0]) + int(equa[1]))
ValueError: invalid literal for int() with base 10: '+'


Fixed submission:

equa = input().split()
if equa[1] == "+":
    print(int(equa[0]) + int(equa[1]))
else:
    print(int(equa[0]) - int(equa[1]))
Problem p03844 (Python) — buggy submission, verdict: Runtime Error

A, op, B = list(map(str, input().split()))
if op == "+":
    print(int(A) + int(B))
else:
    print(int(A) - int(B))


Error: WA

Fixed submission:

A, op, B = list(map(str, input().split()))
if op == "+":
    print(A + B)
else:
    print(A - B)
Problem p03844 (Python) — buggy submission, verdict: Runtime Error

a, op, b = [i for i in input().split()]
if op == "+":
    print(int(a) + int(b))
else:
    print(int(a) - int(b))


Error: ValueError: invalid literal for int() with base 10: '+'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03844/Python/s761760339.py", line 1, in <module>
    a, op, b = [int(i) for i in input().split()]
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03844/Python/s761760339.py", line 1, in <listcomp>
    a, op, b = [int(i) for i in input().split()]
ValueError: invalid literal for int() with base 10: '+'


Fixed submission:

a, op, b = [int(i) for i in input().split()]
if op == "+":
    print(int(a) + int(b))
else:
    print(int(a) - int(b))
Problem p03844 (Python) — buggy submission, verdict: Runtime Error

A, op, B = input().split()
A = int(A)
B = int(B)
if op == "+":
    print(A + B)
else:
    print(A - B)


Error: WA

Fixed submission:

A, op, B = input().split()
if op == "+":
    print(A + B)
else:
    print(A - B)
Problem p03845 (Python) — buggy submission, verdict: Runtime Error

N = int(input())
T = [int(i) for i in input().split()]
M = int(input())

PX = []

for i in range(M):
    # 0-indexed
    PX.append([int(j) for j in input().split()])
    PX[i][0] -= 1

ans = sum(T)

for i in range(M):
    print(ans - T[PX[i][0]] + PX[i][1])


Error: IndexError: list index out of range
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03845/Python/s001873582.py", line 15, in <module>
    print(ans - T[PX[i][0]] + T[PX[i][1]])
IndexError: list index out of range


Fixed submission:

N = int(input())
T = [int(i) for i in input().split()]
M = int(input())

PX = []

for i in range(M):
    # 0-indexed
    PX.append([int(j) for j in input().split()])
    PX[i][0] -= 1

ans = sum(T)

for i in range(M):
    print(ans - T[PX[i][0]] + T[PX[i][1]])
Problem p03845 (Python) — buggy submission, verdict: Runtime Error

def main(n, t, m, p_x):
    for p, x in p_x:
        _t = t.copy()
        _t[p - 1] = x

        print(sum(_t))


if __name__ == "__main__":
    n = int(input())
    t = list(map(int, input().split()))
    m = int(input())
    p_x = [list(map(int, input().split())) for _ in range(m)]

    main(n, t, m, p_x)


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


Fixed submission:

def main(n, t, m, p_x):
    for p, x in p_x:
        _t = t.copy()
        _t[p - 1] = x

        print(sum(_t))


if __name__ == "__main__":
    n = int(input())
    t = list(map(int, input().split()))
    m = int(input())
    p_x = [int(input()) for _ in range(m)]

    main(n, t, m, p_x)