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

N = int(input())
A = [int(input()) for i in range(N)]
maxA = max(A)
copy_A = A[:]
copy_A.remove(maxA)
secondA = max(copy_A)
for x in A:
    if x == maxA:
        print(secondA)
    else:
        print(maxA)


Error: TLE

Fixed submission:

N = int(input())
A = [int(input()) for i in range(N)]
# maxA = max(A)
for x in range(len(A)):
    a_tmp = A[x]
    A[x] = 0
    print(max(A))
    A[x] = a_tmp
Problem p02971 (Python) — buggy submission, verdict: Time Limit Exceeded

import numpy as np

S = input()
N = int(S)

A = np.zeros([N])
A_temp = np.zeros([N])

for i in range(0, N, 1):
    A[i] = int(input())

max = 0

index_max = np.argmax(A)
A_temp = np.copy(A)
A_temp[index_max] = 0
index_max_second = np.argmax(A_temp)

result = np.full(N, A[index_max])
result[index_max] = A[index_max_second]

for i in range(0, N, 1):
    print(int(result[i]))


Error: TLE

Fixed submission:

import numpy as np

S = input()
N = int(S)

A = np.zeros([N])
A_temp = np.zeros([N])

for i in range(0, N, 1):
    A[i] = int(input())

max = 0

index_max = np.argmax(A)

for i in range(0, N, 1):
    A_temp = np.copy(A)
    if index_max != i:
        print(int(A_temp[index_max]))
    else:
        A_temp[i] = 0
        print(int(np.amax(A_temp)))
Problem p02971 (Python) — buggy submission, verdict: Time Limit Exceeded

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


def main():
    N = int(input())
    A = [int(input()) for _ in range(N)]
    A_max = copy(A)
    A_max.sort(reverse=True)

    for a in A:
        if a == A_max[0]:
            print(A_max[1])
        else:
            print(A_max[0])


if __name__ == "__main__":
    main()


Error: TLE

Fixed submission:

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


def main():
    N = int(input())
    A = [int(input()) for _ in range(N)]
    for i in range(N):
        tmp = copy(A)
        tmp[i] = 0
        print(max(tmp))


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

import copy

n = int(input())
A = [int(input()) for _ in range(n)]

A_sorted = sorted(A, reverse=True)

for i in range(n):
    if A[i] == A_sorted[0]:
        print(A_sorted[1])
    else:
        print(A_sorted[0])


Error: TLE

Fixed submission:

import copy

n = int(input())
A = [int(input()) for _ in range(n)]

for i in range(n):
    tmp_list = copy.deepcopy(A)
    tmp_list.pop(i)
    print(max(tmp_list))
Problem p02971 (Python) — buggy submission, verdict: Time Limit Exceeded

# coding: utf-8
N = int(input())
A = []  # value
for i in range(N):
    A.append(int(input()))
B = A[:]
B.sort()
one = B[-1]
two = B[-2]
for i in range(N):
    if A[i] == one:
        print(two)
    else:
        print(one)


Error: TLE

Fixed submission:

# coding: utf-8
N = int(input())
A = [int(input()) for _ in range(N)]
for i in range(N):
    B = A[:]
    B.pop(i)
    print(max(B))
Problem p02971 (Python) — buggy submission, verdict: Time Limit Exceeded

N = int(input())
A = [int(input()) for _ in range(N)]
As = sorted(A)
for i in range(N):
    if A[i] == As[-1]:
        print(As[-2])
    else:
        print(As[-1])


Error: TLE

Fixed submission:

N = int(input())
A = [int(input()) for _ in range(N)]
for i in range(N):
    tmp = A.copy()
    tmp.pop(i)
    tmp.sort()
    print(tmp[-1])
Problem p02971 (Python) — buggy submission, verdict: Time Limit Exceeded

n = int(input())
a = [int(input()) for i in range(n)]

a_s = sorted(a, reverse=True)
for i in range(n):
    if a[i] == a_s[0]:
        print(a_s[1])
    else:
        print(a_s[0])


Error: TLE

Fixed submission:

n = int(input())
a = [int(input()) for i in range(n)]


for i in range(n):
    ret = a[:]
    ret.pop(i)
    print(max(ret))
Problem p02971 (Python) — buggy submission, verdict: Time Limit Exceeded

N = int(input())
A = [int(input()) for i in range(N)]
B = sorted(A)

for i in range(N):
    if B[-1] == A[i]:
        print(B[-2])
    else:
        print(B[-1])


Error: TLE

Fixed submission:

N = int(input())
A = [int(input()) for i in range(N)]
B = []
for i in range(N):
    temp = A[i]
    A[i] = -999
    print(max(A))
    A[i] = temp
Problem p02971 (Python) — buggy submission, verdict: Time Limit Exceeded

def test():
    n = int(input())
    s = 0
    t = 0
    index_ = 0
    for i in range(n):
        a = int(input())
        if s < a:
            index_ = i
            s = a
        elif t < a and a <= s:
            t = a
    for i in range(n):
        if index_ == i:
            print(t)
        else:
            print(s)


if __name__ == "__main__":
    test()


Error: TLE

Fixed submission:

def test():
    n = int(input())
    a = [int(input()) for i in range(n)]
    s = 0
    for i in range(n):
        s = a[i]
        a[i] = 0
        print(max(a))
        a[i] = s


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

import copy

n = int(input())
lst = []
for _ in range(n):
    lst.append(int(input()))
clean_lst = copy.deepcopy(lst)

m1 = max(lst)
lst.remove(m1)
m2 = max(lst)

for i in clean_lst:
    print(m1 if i != m1 else m2)


Error: TLE

Fixed submission:

import copy

n = int(input())
lst = []
for _ in range(n):
    lst.append(int(input()))
clean_lst = copy.deepcopy(lst)

for i in clean_lst:
    lst.remove(i)
    print(max(lst))
    lst.append(i)
Problem p02971 (Python) — buggy submission, verdict: Runtime Error

import itertools

n = int(input())
a = [int(input()) for i in range(n)]

max_list = [0] + list(itertools.accumulate(a, func=max))
max_list_r = ([0] + list(itertools.accumulate(reversed(a), func=max)))[::-1]
for i in range(n):
    print(max(max_list[i], max_list_r[i + 1]))


Error: 0

Fixed submission:

import itertools

n = int(input())
a = [int(input()) for i in range(n)]

max_list = [0] + list(itertools.accumulate(a, func=max))
max_list_r = [0, *itertools.accumulate(reversed(a), func=max)][::-1]
# print(max_list)
# print(max_list_r)
for i in range(n):
    print(max(max_list[i], max_list_r[i + 1]))
Problem p02971 (Python) — buggy submission, verdict: Time Limit Exceeded

N = int(input())
A = [int(input()) for i in range(N)]

a = max(A)
b = sorted(A)[-2]
for i in A:
    print(b if i == a else a)


Error: TLE

Fixed submission:

import numpy as np

N = int(input())
A = np.array([input() for i in range(N)])

B = np.array([])
for i in range(N):
    print(max(np.delete(A.copy(), i)))
Problem p02971 (Python) — buggy submission, verdict: Time Limit Exceeded

# -*- coding: utf-8 -*-
import copy

# input
N = int(input())
A = list()
for _ in range(N):
    A.append(int(input()))

# solve & output
ans = copy.copy(A)
ans.sort()
m = ans[-1]
for i in range(N):
    if A[i] != m:
        print(m)
    else:
        print(ans[N - 2])


Error: TLE

Fixed submission:

# -*- coding: utf-8 -*-
import copy

# input
N = int(input())
A = list()
for _ in range(N):
    A.append(int(input()))

# solve & output
for i in range(N):
    tmp = copy.copy(A)
    del tmp[i]
    print(max(tmp))
Problem p02971 (Python) — buggy submission, verdict: Runtime Error

def main():
    N = int(input())
    A = [int(input()) for _ in range(N)]

    max_value = max(A)
    max_index = A.index(max_value)

    for i in range(N):
        if i != max_index:
            print(max_value)
        else:
            if i == 0:
                print(max(A[1:]))
            elif i == N - 1:
                print(max(A[: N - 1]))
            else:
                print(max(max(A[:i]), max(A[i + 1 :])))

    return


if __name__ == "__main__":
    main()


Error: 0

Fixed submission:

def main():
    N = int(input())
    A = [int(input()) for _ in range(N)]

    max_value = max(A)
    max_index = A.index(max_value)

    for i in range(N):
        if i != max_index:
            print(max_value)
        else:
            if i == 0:
                print(max(A[1:]))
            elif i == N:
                print(max(A[:N]))
            else:
                print(max(max(A[:i]), max(A[i + 1 :])))

    return


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

N = int(input())
nums = [int(input()) for _ in range(N)]

all_max = max(nums)

new_nums = list(nums)
new_nums.remove(all_max)

second_max = max(new_nums)  # max関数はfor文の中にいれずに、先に2番目の最大値をもとめておく

for num in range(N):
    if nums[num] == all_max:
        print(second_max)
    else:
        print(all_max)


Error: TLE

Fixed submission:

N = int(input())
nums = [int(input()) for _ in range(N)]

all_max = max(nums)
for num in range(N):
    if nums[num] == all_max:
        new_nums = list(nums)
        new_nums.pop(num)
        print(max(new_nums))
    else:
        print(all_max)
Problem p02972 (Python) — buggy submission, verdict: Runtime Error

N = int(input())
A = [int(i) for i in input().split()]
A.insert(0, 0)

ans = []
for i in reversed(range(1, N + 1)):
    if sum(A[i::i]) % 2 != A[i]:
        A[i] = (A[i] + 1) % 2
    if A[i] == 1:
        ans.append(i)

print(len(ans))
if len(ans) > 0:
    print(*ans)


Error: 0

Fixed submission:

def make_divisors(n: int) -> list:
    divisors = []

    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)

    return divisors


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

ans = []
for i in reversed(range(N)):
    if A[i] == 1:
        ans.append(i + 1)
        divisors = make_divisors(i + 1)
        for j in divisors:
            A[j + 1] = (A[j + 1] + 1) % 2

if A.count(1) != 0:
    print(len(ans))
    for i in reversed(range(len(ans))):
        print(ans[i])
else:
    print(-1)
Problem p02972 (Python) — buggy submission, verdict: Runtime Error

#!/usr/bin/env python3

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

# 最初が0から始まる場合
a_list = [0] + a_list
b_list = [0] * (N + 1)
# インデックスがずれるのがややこしいので、
# b_list[0]は欠番として1始まりで考えていく

for i in range(N):
    # 大きい方から決めていく
    idx = N - i
    total = sum(b_list[idx : N + 1 : idx])

    if total % 2 != a_list[idx]:
        b_list[idx] = 1

idx_list = [str(i) for i, b in enumerate(b_list) if b == 1]
ans = sum(b_list[1:])
print(ans)
if ans != 0:
    print(" ".join(idx_list))


Error: 0

Fixed submission:

#!/usr/bin/env python3

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

# 最初が0から始まる場合
b_list = [0] * N
b_list[-1] = a_list[-1]

for i in range(N):
    # 大きい方から決めていく
    idx = N - (i + 1)
    total = 0
    for j in b_list[:: idx + 1]:
        # idx + 1の倍数のボールの個数を数える
        total += b_list[j]

    if total % (idx + 1) != a_list[idx]:
        b_list[idx] = 1

idx_list = [str(i + 1) for i, b in enumerate(b_list) if b == 1]
ans = sum(b_list)
print(ans)
print(" ".join(idx_list))
Problem p02972 (Python) — buggy submission, verdict: Time Limit Exceeded

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

box = [0] * N
v = N // 2  # 後半部の最初のindex

for i in range(v, N):
    if ai[i] == 0:
        box[i] = 0
    else:
        box[i] = 1

for i in range(v - 1, -1, -1):
    value = i + 1
    sum = 0
    for j in range(value * 2 - 1, N, value):
        sum += box[j]
    if sum & 1 == 1:
        box[i] = 0 if ai[i] & 1 == 1 else 1
    else:
        box[i] = 0 if ai[i] & 1 == 0 else 1
print(box.count(1))
for i in range(N):
    if box[i] == 1:
        print(i + 1)


Error: TLE

Fixed submission:

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

box = [0] * N
v = N // 2  # 後半部の最初のindex

for i in range(v, N):
    if ai[i] == 0:
        box[i] = 0
    else:
        box[i] = 1

for i in range(v - 1, -1, -1):
    s = [ai[x] == 1 for x in range(i + 1, N) if (x + 1) % (i + 1) == 0]
    cnt = s.count(True)
    if cnt & 1 == 1:
        box[i] = 0 if ai[i] & 1 == 1 else 1
    else:
        box[i] = 0 if ai[i] & 1 == 0 else 1

print(box.count(1))
for x in box:
    if x == 1:
        print(x)
Problem p02972 (Python) — buggy submission, verdict: Time Limit Exceeded

import sys

input = sys.stdin.readline

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

ans = set()
cnt = [0] * (n + 1)

for i in range(n, 0, -1):
    if cnt[i] % 2 != a[i] % 2:
        ans.add(i)

        st = set()
        j = 1
        while j * j <= i:
            if i % j == 0:
                st.add(j)
                st.add(i // j)
            j += 1
        for d in st:
            cnt[d] += 1

print(len(ans))
print(*ans)


Error: TLE

Fixed submission:

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

ans = set()
cnt = [0] * (n + 1)

for i in range(n, 0, -1):
    if cnt[i] % 2 != a[i] % 2:
        ans.add(i)

        st = set()
        j = 1
        while j * j <= i:
            if i % j == 0:
                st.add(j)
                st.add(i // j)
            j += 1
        for d in st:
            cnt[d] += 1

print(len(ans))
print(*ans)
Problem p02972 (Python) — buggy submission, verdict: Time Limit Exceeded

from sys import stdin

N = int(stdin.readline().rstrip())
a = [int(x) for x in stdin.readline().rstrip().split()]

ans = []
for k in reversed(range(1, N + 1)):
    if a[k - 1] == 1:
        ans.append(k)
        tmp = 1
        while tmp * tmp <= k:
            if k % tmp == 0:
                a[tmp - 1] ^= 1
                if tmp != k // tmp:
                    a[k // tmp - 1] ^= 1
            tmp += 1

x = len(ans)
print(x)
if x >= 0:
    print(*ans)


Error: TLE

Fixed submission:

from sys import stdin

N = int(stdin.readline().rstrip())
a = [int(x) for x in stdin.readline().rstrip().split()]

ans = []
for k in reversed(range(1, N + 1)):
    if k == 1:
        if len(ans) % 2 != a[k - 1]:
            ans.append(k)
        continue
    t = N // k
    cnt = 0
    for i in range(1, t + 1):
        if i * k in ans:
            cnt += 1
    if cnt % 2 != a[k - 1]:
        ans.append(k)

x = len(ans)
print(x)
if x >= 0:
    print(*ans)
Problem p02973 (Python) — buggy submission, verdict: Time Limit Exceeded

import bisect

N = int(input())
A = [int(input()) for i in range(N)]

ans = 1
X = [-A[0]]
for i in range(1, N):
    if -X[ans - 1] >= A[i]:
        X.append(-A[i])
        ans += 1
    else:
        pos = bisect.bisect_right(X, -A[i])
        X[pos] = -A[i]

print(ans)


Error: TLE

Fixed submission:

N = int(input())
A = [int(input()) for i in range(N)]

ans = 1
X = [-1]
for i in range(N):
    for j in range(ans):
        if X[j] < A[i]:
            X[j] = A[i]
            break
        elif j == ans - 1:
            X.append(A[i])
            ans += 1

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

import bisect
from collections import deque
from sys import stdin


def main():
    N = int(stdin.readline().rstrip())
    As = [int(stdin.readline().rstrip()) for x in range(N)]
    dq = deque([])
    for A in As:
        idx = bisect.bisect_left(dq, A)
        if idx == 0:
            dq.appendleft(A)
        else:
            dq[idx - 1] = A
    print(len(dq))


if __name__ == "__main__":
    main()


Error: TLE

Fixed submission:

import bisect
from sys import stdin


def main():
    N = int(stdin.readline().rstrip())
    As = [int(stdin.readline().rstrip()) for x in range(N)]
    array = []
    for A in As:
        idx = bisect.bisect_left(array, A)
        if idx == 0:
            array = [A] + array
        else:
            array[idx - 1] = A
    print(len(array))


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

# -*- coding: utf-8 -*-
from bisect import bisect_right

N = int(input())

columns = []


for _ in range(N):
    current = -int(input())
    index = bisect_right(columns, current)
    if len(columns) <= index:
        columns.append(current)
    else:
        columns[index] = current

print(len(columns))


Error: TLE

Fixed submission:

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

N = int(input())

lasts = []

before = [int(input())]
lasts.append(before)

for _ in range(N - 1):
    current = int(input())
    if before[0] < current:
        before[0] = current
        continue
    try:
        low = next(x for x in lasts if x[0] < current)
        low[0] = current
    except StopIteration:
        lasts.append([current])

print(len(lasts))
Problem p02973 (Python) — buggy submission, verdict: Time Limit Exceeded

N = int(input())
A = [int(input()) for _ in range(N)]

t = [A[0]]
for a in A[1:]:
    if t[-1] >= a:
        t.append(a)
        continue
    ok = len(t) - 1
    ng = -1
    while ok - ng > 1:
        m = (ok + ng) // 2
        if t[m] < a:
            ok = m
        else:
            ng = m
    t[ok] = a
print(len(t))


Error: TLE

Fixed submission:

from bisect import bisect_left

N = int(input())
A = [int(input()) for _ in range(N)]

t = [A[0]]
for a in A[1:]:
    i = bisect_left(t, a) - 1
    if i == -1:
        t = [a] + t
    else:
        t[i] = a
        t.sort()
print(len(t))
Problem p02973 (Python) — buggy submission, verdict: Time Limit Exceeded

import sys
from bisect import bisect

n = int(input())
aaa = list(map(int, sys.stdin.readlines()))

dp = [1]
for a in aaa:
    a *= -1
    i = bisect(dp, a)
    if i < len(dp):
        dp[i] = a
    else:
        dp.append(a)
print(len(dp))


Error: TLE

Fixed submission:

import sys

n = int(input())
aaa = list(map(int, sys.stdin.readlines()))

dp = [-1]
for a in aaa:
    for i, m in enumerate(dp):
        if m < a:
            dp[i] = a
            break
    else:
        dp.append(a)
print(len(dp))
Problem p02973 (Python) — buggy submission, verdict: Time Limit Exceeded

from bisect import bisect_right, bisect_left

N = int(input())
A = [int(input()) for _ in range(N)]

dp = [1] * N

for a in A:
    ia = bisect_right(dp, -a)
    if dp[ia] == 1:
        dp[ia] = -a
    else:
        ib = bisect_left(dp, -a + 1)
        dp[ib] = -a
    # print(dp)

ans = 0
for i in range(N):
    if dp[i] != 1:
        ans += 1
print(ans)


Error: TLE

Fixed submission:

N = int(input())
A = [int(input()) for _ in range(N)]

c = 0
colored = [False for _ in range(N)]
Ls = []
for a in A:

    k = -1
    for i, l in enumerate(Ls):
        if l < a and a > k:
            ind = i
            k = a
    if k != -1:
        Ls[ind] = a
    else:
        Ls.append(a)


print(len(Ls))
Problem p02973 (Python) — buggy submission, verdict: Time Limit Exceeded

from collections import deque
import bisect

N = int(input())
A = [int(input()) for i in range(N)]

colors = deque()
for i in range(N):
    index = bisect.bisect_left(colors, A[i])
    if index == 0:
        colors.appendleft(A[i])
    else:
        colors[index - 1] = A[i]
print(len(colors))


Error: TLE

Fixed submission:

import bisect

N = int(input())
A = [int(input()) for i in range(N)]

colors = [A[0]]
for i in range(1, N):
    index = bisect.bisect_left(colors, A[i])
    if index == 0:
        colors.insert(0, A[i])
    else:
        colors[index - 1] = A[i]
print(len(colors))
Problem p02973 (Python) — buggy submission, verdict: Time Limit Exceeded

from bisect import bisect_left

n = int(input())
a = [int(input()) for _ in range(n)]

c = [0] * n
end = n

for ai in a:
    ci = bisect_left(c, ai, end, n)
    c[ci - 1] = ai
    if ci <= end:
        end -= 1
print(n - end)


Error: TLE

Fixed submission:

from bisect import bisect_right

n = int(input())
a = [int(input()) for _ in range(n)]

c = []
c.append(a[0])
for ai in a[1:]:
    ci = bisect_right(c, ai)
    if ci == 0 or c[ci - 1] == ai:
        c.append(ai)
        c.sort()
    else:
        c[ci - 1] = ai
        c.sort()

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

from bisect import bisect

n = int(input())
ma = [-int(input()) for _ in range(n)]

ans = [ma[0]]
for ai in ma[1:]:
    tmp = bisect(ans, ai)
    if tmp == len(ans):
        ans.append(ai)
    elif tmp < len(ans):
        ans[tmp] = ai
print(len(ans))


Error: WA

Fixed submission:

from bisect import bisect

n = int(input())
ma = [-int(input()) for _ in range(n)]

ans = [ma[0]]
for ai in ma[1:]:
    tmp = bisect(ans, ai)
    if tmp == len(ans):
        ans.append(ai)
    elif tmp < len(ans):
        ans[tmp] = ai
    print(ans)
print(len(ans))
Problem p02973 (Python) — buggy submission, verdict: Time Limit Exceeded

import bisect
import collections

N = int(input())
A = [int(input()) for _ in range(N)]

x = collections.deque()

for i, a in enumerate(A):
    if i == 0:
        x.append(a)
    else:
        r = bisect.bisect_left(x, a)
        if r == 0:
            x.appendleft(a)
        else:
            x[r - 1] = a

print(len(x))


Error: TLE

Fixed submission:

import bisect

N = int(input())
A = [int(input()) for _ in range(N)]

x = []

for i, a in enumerate(A):
    if i == 0:
        x.append(a)
    else:
        r = bisect.bisect_left(x, a)
        if r == 0:
            x.insert(0, a)
        else:
            x[r - 1] = a

print(len(x))
Problem p02981 (Python) — buggy submission, verdict: Runtime Error

i = input().split(" ")
people = int(i[0])
train_fee = int(i[1])
taxi_fee = int(i[2])

train_sum = people * train_fee
if train_sum > taxi_fee:
    print(taxi_fee)
else:
    print(train_sum)


Error: AttributeError: 'str' object has no attribute 'spli'. Did you mean: 'split'?
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02981/Python/s062191758.py", line 1, in <module>
    i = input().spli(" ")
AttributeError: 'str' object has no attribute 'spli'. Did you mean: 'split'?


Fixed submission:

i = input().spli(" ")
people = int(i[0])
train_fee = int(i[1])
taxi_fee = int(i[2])

train_sum = people * train_fee
if train_sum > taxi_fee:
    print(train_sum)
else:
    print(taxi_fee)
Problem p02981 (Python) — buggy submission, verdict: Runtime Error

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

print(min(N * A, B))


Error: ValueError: too many values to unpack (expected 2)
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02981/Python/s901912140.py", line 5, in <module>
    N, D = map(int, input().split())
ValueError: too many values to unpack (expected 2)


Fixed submission:

# -*- coding: utf-8 -*-
import itertools
import math

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

X = [[0 for x in range(D)] for y in range(N)]

for n in range(N):
    X[n] = list(map(int, input().split()))

ans = 0
for target in itertools.combinations(X, 2):
    res = sum([(y - z) ** 2 for y, z in zip(target[0], target[1])])
    res = math.sqrt(res)
    if res.is_integer():
        ans += 1

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

N, A, B = map(int, input().split())
if A * N < B:
    print(A * N)
else:
    print(B)


Error: WA

Fixed submission:

N, A, B = map(int, input().split())
ans = []
for i in range(1, N):
    ans.append(A * i + B / N * (N - i))
print(min(ans))
Problem p02981 (Python) — buggy submission, verdict: Runtime Error

n, a, b = map(int, input().split())
c = n * a
if c < b:
    print(c)
else:
    print(b)


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


Fixed submission:

N = int(input())
A = int(input())
B = int(input())
c = N * A
if c < B:
    print(c)
else:
    print(B)
Problem p02981 (Python) — buggy submission, verdict: Runtime Error

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

# N人*A円がB円より大きい場合
if N * A > B:
    print(B)
else:
    print(N * A)


Error: TypeError: 'int' object is not iterable
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02981/Python/s985942585.py", line 5, in <module>
    print(total_price - max(total_price))
TypeError: 'int' object is not iterable


Fixed submission:

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

total_price = A + (N * B)

print(total_price - max(total_price))