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

N = int(input())
ans = 0
nums = set()
for _ in range(N):
    A = int(input())
    if A in nums:
        ans -= 1
        nums.remove(A)
    else:
        ans += 1
        nums.add(A)
print(ans)


Error: TypeError: set.clear() takes no arguments (1 given)
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03607/Python/s903001510.py", line 8, in <module>
    nums.clear(A)
TypeError: set.clear() takes no arguments (1 given)


Fixed submission:

N = int(input())
ans = 0
nums = set([])
for _ in range(N):
    A = int(input())
    if A in nums:
        ans -= 1
        nums.clear(A)
    else:
        ans += 1
        nums.add(A)
print(ans)
Problem p03607 (Python) — buggy submission, verdict: Runtime Error

#!/usr/bin/env python3
from collections import defaultdict

n, *a = map(int, open(0).read().split())
b = defaultdict(int)
for i in a:
    b[i] += 1
print(sum(i % 2 > 0 for i in b.values()))


Error: 0

Fixed submission:

#!/usr/bin/env python3
n, *a = map(int, open(0).read().split())
b = [0] * (10**5 + 1)
for i in a:
    b[i] += 1
print(sum(i % 2 > 0 for i in b))
Problem p03607 (Python) — buggy submission, verdict: Time Limit Exceeded

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

import sys


def main():
    _ = sys.stdin.readline()
    arr = set()
    for line in sys.stdin:
        num = line.rstrip()
        if num in arr:
            arr.remove(num)
        else:
            arr.add(num)
    print(len(arr))


if __name__ == "__main__":
    main()


Error: TLE

Fixed submission:

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

import sys


def main():
    _ = sys.stdin.readline()
    arr = []
    for line in sys.stdin:
        num = line.rstrip()
        if num in arr:
            arr.remove(num)
        else:
            arr.append(num)
    print(len(arr))


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

from collections import Counter

N = int(input())
A = Counter([int(input()) for _ in range(N)])
num = 0
for a, n in A.items():
    if n % 2 == 1:
        num += 1
print(num)


Error: TLE

Fixed submission:

N = int(input())
A = [int(input()) for _ in range(N)]
result = []
for a in A:
    if a in result:
        result.remove(a)
    else:
        result.append(a)
print(len(result))
Problem p03607 (Python) — buggy submission, verdict: Time Limit Exceeded

n = int(input())
D = {}
cnt = 0
for _ in range(n):
    a = int(input())
    if a not in D:
        D[a] = 1
    else:
        D[a] += 1
for i in D:
    if D[i] % 2 != 0:
        cnt += 1
print(cnt)


Error: TLE

Fixed submission:

n = int(input())
a = [int(input()) for _ in range(n)]
cnt = 0
a_set = set(a)
for i in a_set:
    if a.count(i) % 2 != 0:
        cnt += 1
print(cnt)
Problem p03607 (Python) — buggy submission, verdict: Time Limit Exceeded

from collections import Counter

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

res = 0
# print(Counter(A))

c = Counter(A)
for i in c.values():
    res += i % 2
print(res)


Error: TLE

Fixed submission:

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

d = []
for i in A:
    if i in d:
        d.remove(i)
    else:
        d.append(i)
print(len(d))
Problem p03608 (Python) — buggy submission, verdict: Time Limit Exceeded

import itertools

n, m, R = map(int, input().split())
r = list(map(int, input().split()))
dis = [[float("inf") for _ in range(n)] for _ in range(n)]
for _ in range(m):
    a, b, c = map(int, input().split())
    dis[a - 1][b - 1] = c
    dis[b - 1][a - 1] = c


def war(dis):
    for k in range(n):
        for i in range(n):
            for j in range(n):
                if dis[i][j] > dis[i][k] + dis[k][j]:
                    dis[i][j] = dis[i][k] + dis[k][j]
    return dis


dis = war(dis)
_min = float("inf")
it = itertools.permutations(r)
for iterR in it:
    _dis = 0
    start = iterR[0] - 1
    for end in iterR[1:]:
        _dis += dis[start][end - 1]
        start = end - 1
    _min = min(_min, _dis)
print(_min)


Error: TLE

Fixed submission:

import itertools

n, m, R = map(int, input().split())
r = list(map(int, input().split()))
dis = [[float("inf") for _ in range(n)] for _ in range(n)]
for _ in range(m):
    a, b, c = map(int, input().split())
    dis[a - 1][b - 1] = c
    dis[b - 1][a - 1] = c

for k in range(n):
    for i in range(n):
        for j in range(n):
            if dis[i][j] > dis[i][k] + dis[k][j]:
                dis[i][j] = dis[i][k] + dis[k][j]


_min = float("inf")
it = itertools.permutations(r)
for iterR in it:
    _dis = 0
    start = iterR[0] - 1
    for end in iterR[1:]:
        _dis += dis[start][end - 1]
        start = end - 1
    _min = min(_min, _dis)
print(_min)
Problem p03609 (Python) — buggy submission, verdict: Runtime Error

x, t = list(map(int, input().split()))
print(max((x - t), 0))


Error: ValueError: invalid literal for int() with base 10: '100 17'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03609/Python/s297739432.py", line 1, in <module>
    print(max(int(input()) - int(input()), 0))
ValueError: invalid literal for int() with base 10: '100 17'


Fixed submission:

print(max(int(input()) - int(input()), 0))
Problem p03610 (Python) — buggy submission, verdict: Runtime Error

s = input()

s_odd = []
for i in range(0, len(s)):
    if i % 2 == 0:
        s_odd.append(s[i])

print("".join(s_odd))


Error: 0

Fixed submission:

s = input()
snum = len(s)
harf_snum = snum // 2

s_odd = []
for i in range(harf_snum + 1):
    s_odd.append(s[i * 2])
print("".join(s_odd))
Problem p03610 (Python) — buggy submission, verdict: Runtime Error

s = input()
print(s[::2])


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


Fixed submission:

s = list(int(input()))
print(s[1::2])
Problem p03611 (Python) — buggy submission, verdict: Time Limit Exceeded

from collections import Counter

N = int(input())
L = list(map(int, input().split()))
c = Counter(L)
# print(c)
# 先にxを選んでおく！
ans = 0
m = max(L) + 1
for i in range(m):
    ans = max(ans, c[i - 1] + c[i] + c[i + 1])

print(ans)


Error: TLE

Fixed submission:

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

# 先にxを選んでおく！
ans = 0
m = max(L) + 1
for i in range(m):
    cm = L.count(i - 1)
    ce = L.count(i)
    cl = L.count(i + 1)
    ans = max(ans, cm + ce + cl)

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

N = int(input())
a_lst = [int(x) for x in input().split()]

dict = {}

for a in a_lst:
    if not a - 1 in dict.keys():
        dict[a - 1] = 1
    else:
        dict[a - 1] += 1
    if not a in dict.keys():
        dict[a] = 1
    else:
        dict[a] += 1
    if not a + 1 in dict.keys():
        dict[a + 1] = 1
    else:
        dict[a + 1] += 1
val_lst = list(dict.values())
val_lst.sort(reverse=True)
print(val_lst[0])


Error: TLE

Fixed submission:

N = int(input())
a_lst = [int(x) for x in input().split()]

max_a = -1
max_cnt = -1

for a in a_lst:
    if max_a < a:
        max_a = a
for x in range(max_a + 1):
    cnt = 0
    for a in a_lst:
        if x - 1 <= a and a <= x + 1:
            cnt += 1
    if max_cnt < cnt:
        max_cnt = cnt
print(max_cnt)
Problem p03611 (Python) — buggy submission, verdict: Runtime Error

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

b = []
c = []
for i in range(N):
    if a[i] > 0:
        b.append(a[i] - 1)
        c.append(a[i] + 1)
    else:
        c.append(a[i] + 1)

abc = a + b + c
count = [0] * (max(abc) + 1)

for x in abc:
    count[x] += 1

print(max(count))


Error: 0

Fixed submission:

import statistics

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

b = []
c = []
for i in range(N):
    b.append(a[i] - 1)
    c.append(a[i] + 1)

x = a + b + c
y = statistics.mode(x)

print(x.count(y))
Problem p03611 (Python) — buggy submission, verdict: Runtime Error

import numpy as np

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

B = A.copy()
B[1:] += A[:-1]
B[:-1] += A[1:]

answer = B.max()
print(answer)


Error: WA

Fixed submission:

from collections import Counter

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

if N >= 3:
    counter = Counter(A)
    m = min(A)
    M = max(A)
    cnt = []
    for i in range(m, M - 1):
        ans = counter[i] + counter[i + 1] + counter[i + 2]
        if ans:
            cnt.append(ans)
        print(cnt)
    print(max(cnt))

elif N == 2:
    if abs(A[0] - A[1]) <= 2:
        print(2)
    else:
        print(1)

elif N == 1:
    print(1)
Problem p03611 (Python) — buggy submission, verdict: Time Limit Exceeded

from collections import Counter

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

x = []
for i in a:
    x.append(i)
    x.append(i + 1)
    x.append(i - 1)

ans = max(Counter(x).values())
print(ans)


Error: TLE

Fixed submission:

from collections import Counter

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

ans = 0
c = Counter(a).most_common()
for i in range(min(a), max(a) + 1):
    temp = [value if abs(i - key) <= 1 else 0 for key, value in c]
    ans = max(ans, sum(temp))

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

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

N = 10**5
cnt = [0 for i in range(N + 2)]
# index 0 == -1
for i in a:
    cnt[i] += 1
    cnt[i + 1] += 1
    cnt[i + 2] += 1

print(max(cnt))


Error: TLE

Fixed submission:

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

b = [i - 1 for i in a]
c = [i + 1 for i in a]

a.extend(b)
a.extend(c)
f = set(a)
ans = 0
for i in f:
    ans = max(ans, a.count(i))

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

# ハッシュで数えてキーでソートして+-1を全探索
# と思ったけど登場してないやつでもいける 3 5 なら4が2個になるのでN個から全探索

n = int(input())
arr = list(map(int, input().split()))
lis = [0 for _ in range(10**5 + 1)]
hash = dict()
for a in arr:
    lis[a] += 1

ans = 1
for i in range(1, 10**5):
    ans = max(ans, lis[i - 1] + lis[i] + lis[i + 1])

print(ans)


Error: 0

Fixed submission:

# ハッシュで数えてキーでソートして+-1を全探索
n = int(input())
arr = list(map(int, input().split()))
hash = dict()
for a in arr:
    if a in hash:
        hash[a] += 1
    else:
        hash[a] = 1

lis = list(sorted(hash.items(), key=lambda x: x[0]))

ans = 0
for i in range(1, n - 2):
    temp = lis[i][1]
    if lis[i - 1][0] + 1 == lis[i][0]:
        temp += lis[i - 1][1]
    if lis[i + 1][0] - 1 == lis[i][0]:
        temp += lis[i + 1][1]
    ans = max(ans, temp)

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

N = int(input())
a = sorted(list(map(int, input().split())))

cnt = [0] * (10**5 + 2)

for i in a:
    cnt[i] += 1
    cnt[i + 1] += 1
    cnt[i + 2] += 1

print(max(cnt))


Error: TLE

Fixed submission:

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

A = set(a)

ans = 0
for i in A:
    cnt = 0
    J = [i, i - 1, i + 1]
    for j in J:
        if j in a:
            cnt += a.count(j)
    ans = max(ans, cnt)
print(ans)
Problem p03611 (Python) — buggy submission, verdict: Time Limit Exceeded

N = int(input())

numbers = list(map(int, input().split()))

# max_x = max(numbers) + 1
# max_x = int(sum(numbers) / len(numbers))
# res = 0
test = set()
for n in numbers:
    test.add(n)
    test.add(n - 1)
    test.add(n + 1)
length = len(test)
res = {}
# print(test)
# for i in range(max_x + 1):
for n in numbers:
    c = 0
    sub = set([n - 1, n, n + 1]) & test
    # print(sub)
    for s in sub:
        if res.get(s) is None:
            res[s] = 1
        else:
            res[s] += 1
# for i in test:
#     c = 0
#     for n in numbers:
#         if n - 1 == i or n == i or n + 1 == i:
#             c += 1
#     if res < c:
#         res = c

# print(res)
res = max(res.values())
print(res)


Error: TLE

Fixed submission:

N = int(input())

numbers = list(map(int, input().split()))

# max_x = max(numbers) + 1
# max_x = int(sum(numbers) / len(numbers))
res = 0
test = set()
for n in numbers:
    test.add(n)
    test.add(n - 1)
    test.add(n + 1)

# for i in range(max_x + 1):
for i in test:
    c = 0
    for n in numbers:
        if n - 1 == i or n == i or n + 1 == i:
            c += 1
    if res < c:
        res = c

print(res)
Problem p03611 (Python) — buggy submission, verdict: Time Limit Exceeded

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

num = [0 for i in range(100000)]
for aa in a:
    num[aa] += 1

ans = 0
for X in range(1, 99999):
    ans = max(ans, sum(num[X - 1 : X + 2]))

print(ans)


Error: TLE

Fixed submission:

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

num = [0 for i in range(3)]
num[0] = a.count(0)
num[1] = a.count(1)

ans = 0
for X in range(1, 100000):
    num[(X % 3) - 2] = a.count(X + 1)
    ans = max(ans, sum(num))

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

N = int(input())
plist = list(map(int, input().split()))
ans = 0
for i in range(N - 1):
    if plist[i] == i + 1:
        plist[i], plist[i + 1] = plist[i + 1], plist[i]
        ans += 1
if plist[-1] == N:
    ans += 1
print(ans)


Error: 0

Fixed submission:

N = int(input())
plist = list(map(int, input().split()))
ans = 0
for i in range(N):
    if plist[i] == i + 1:
        plist[i], plist[i + 1] = plist[i + 1], plist[i]
        ans += 1
if plist[-1] == N:
    ans += 1
print(ans)
Problem p03612 (Python) — buggy submission, verdict: Runtime Error

N = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(N - 1):
    if p[i] == i + 1:
        ans += 1
        p[i], p[i + 1] = p[i + 1], p[i]
if p[-1] == N:
    ans += 1
print(ans)


Error: 0

Fixed submission:

N = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(N):
    if p[i] == i + 1:
        ans += 1
        p[i], p[i + 1] = p[i + 1], p[i]
if p[-1] == N:
    ans += 1
print(ans)
Problem p03612 (Python) — buggy submission, verdict: Runtime Error

N = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(len(p)):
    if i + 1 == p[i]:
        if i + 1 != len(p):
            tmp = p[i]
            p[i] = p[i + 1]
            p[i + 1] = tmp
            count += 1
        else:
            tmp = p[i]
            p[i] = p[i - 1]
            p[i - 1] = tmp
            count += 1

print(count)


Error: 0

Fixed submission:

N = int(input())
p = list(map(int, input().split()))
# print(p)
count = 0
for i in range(len(p)):
    # print(p[i])
    if i + 1 == p[i]:
        tmp = p[i]
        p[i] = p[i + 1]
        p[i + 1] = tmp
        count += 1
print(count)
Problem p03612 (Python) — buggy submission, verdict: Time Limit Exceeded

def resolve():
    n = int(input())
    p = list(map(int, input().split()))
    ans = 0
    if p[0] == 1:
        p[0], p[1] = p[1], p[0]
        ans += 1
    if p[n - 1] == n:
        p[n - 2], p[n - 1] = p[n - 1], p[n - 2]
        ans += 1
    for i in range(n - 1):
        if p[i] == i + 1:
            p[i], p[i + 1] = p[i + 1], p[i]
            ans += 1
    print(ans)


if __name__ == "__main__":
    resolve()


Error: TLE

Fixed submission:

def resolve():
    n = int(input())
    p = list(map(int, input().split()))
    ans = 0
    while any(i + 1 == p[i] for i in range(n)):
        for i in range(n - 1):
            if i + 1 == p[i]:
                p[i], p[i + 1] = p[i + 1], p[i]
                ans += 1
    print(ans)


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

n = int(input())
a = list(map(int, input().split()))
flg = False
cnt = 0
for i, v in enumerate(a, 1):
    if flg:
        flg = False
        continue

    if i == v:
        cnt += 1
        flg = True
print(cnt)


Error: 0

Fixed submission:

n = int(input())
b = list(range(n**2))
a = list(map(int, input().split()))
flg = False
cnt = 0
for i, v in enumerate(a, 1):
    if flg:
        flg = False
        continue

    if i is v:
        cnt += 1
        flg = True
print(cnt)
Problem p03612 (Python) — buggy submission, verdict: Runtime Error

#!/usr/bin/env python3

N = int(input().split()[0])
p_list = list(map(int, input().split()))
count = 0
for i in range(N):
    index = i + 1
    if index == p_list[i]:
        if i != 0 and i != N - 1:
            if p_list[i + 1] == index + 1:
                p_list[i] = p_list[i + 1]
                p_list[i + 1] = index
            else:
                p_list[i] = p_list[i - 1]
                p_list[i - 1] = index
        elif i != 0:
            p_list[i] = p_list[i - 1]
            p_list[i - 1] = index
        elif i != N - 1:
            p_list[i] = p_list[i + 1]
            p_list[i + 1] = index

        count += 1

ans = count
print(ans)


Error: 0

Fixed submission:

#!/usr/bin/env python3

N = int(input().split()[0])
p_list = list(map(int, input().split()))
count = 0
for i in range(N):
    index = i + 1
    if index == p_list[i]:
        if i != 0 and i != 1:
            if p_list[i + 1] == index + 1:
                p_list[i] = p_list[i + 1]
                p_list[i + 1] = index
            else:
                p_list[i] = p_list[i - 1]
                p_list[i - 1] = index
        elif i != 0:
            p_list[i] = p_list[i - 1]
            p_list[i - 1] = index
        elif i != 1:
            p_list[i] = p_list[i + 1]
            p_list[i + 1] = index

        count += 1

ans = count
print(ans)
Problem p03612 (Python) — buggy submission, verdict: Runtime Error

def main():
    N = int(input())
    P = list(map(int, input().split()))
    cnt = 0
    for i in range(N - 1):
        if P[i] == i + 1:
            cnt += 1
            P[i + 1], P[i] = P[i], P[i + 1]
    if P[N - 1] == N:
        cnt += 1
    print(cnt)


if __name__ == "__main__":
    main()


Error: TypeError: 'map' object is not subscriptable
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03612/Python/s310758336.py", line 13, in <module>
    main()
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03612/Python/s310758336.py", line 6, in main
    if P[i] == i + 1:
TypeError: 'map' object is not subscriptable


Fixed submission:

def main():
    N = int(input())
    P = map(int, input().split())
    cnt = 0
    for i in range(N):
        if P[i] == i + 1:
            cnt += 1
        ans = (cnt + 1) // 2
    print(ans)


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

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

ans = 0

for i in range(N):
    if P[i] == i + 1:
        if i + 1 < N:
            P[i], P[i + 1] = P[i + 1], P[i]
        ans += 1
print(ans)


Error: 0

Fixed submission:

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

ans = 0
for i in range(N):
    if P[i] == i + 1:
        P[i], P[i + 1] = P[i + 1], P[i]
        ans += 1
print(ans)
Problem p03612 (Python) — buggy submission, verdict: Runtime Error

n = int(input())
p = [0] + list(map(int, input().split()))
num = 0
for i in range(1, n + 1):
    if i == n:
        if i == p[i]:
            num += 1
            break
    if i == p[i]:
        num += 1
        p[i], p[i + 1] = p[i + 1], p[i]

print(num)


Error: 0

Fixed submission:

n = int(input())
p = [0] + list(map(int, input().split()))
num = 0
for i in range(1, n + 1):
    if i == p[i]:
        num += 1
        p[i], p[i + 1] = p[i + 1], p[i]

print(num)
Problem p03612 (Python) — buggy submission, verdict: Runtime Error

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

res = 0
for i in range(N):
    if P[i] == i + 1:
        res += 1
        if i < N - 1:
            P[i], P[i + 1] = P[i + 1], P[i]

print(res)


Error: 0

Fixed submission:

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

res = 0
for i in range(N):
    if P[i] == i + 1:
        res += 1
        if i < N:
            P[i], P[i + 1] = P[i + 1], P[i]

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

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

ans = 0
# print(P)

for i in range(N - 1):
    if P[i] != int(i + 1):
        continue
    else:
        P[i], P[i + 1] = P[i + 1], P[i]
        # print(i + 1, P)
        ans += 1


# 最後を見てなかった！！！！
if P[-1] == N:
    ans += 1

print(ans)


Error: 0

Fixed submission:

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

ans = 0
# print(P)

for i in range(N):
    if P[i] != int(i + 1):
        continue
    else:
        P[i], P[i + 1] = P[i + 1], P[i]
        # print(i + 1, P)
        ans += 1

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

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

"""
b = [i + 1 for i in a]
c = [i - 1 for i in a]
use_set = set(a) | set(b) | set(c)
ans = 0
for i in use_set:
    ans = max(ans, a.count(i) + b.count(i) + c.count(i))
print(ans)
"""
# これだと最後でTLE
# inの段階でhash?

ans = {}
for i in a:
    for j in range(3):
        if i + j - 1 not in ans:
            ans[i + j - 1] = 1
        else:
            ans[i + j - 1] += 1

print(max(ans.values()))


Error: TLE

Fixed submission:

n = int(input())
a = list(map(int, input().split()))
b = [i + 1 for i in a]
c = [i - 1 for i in a]
use_set = set(a) | set(b) | set(c)
ans = 0
for i in use_set:
    ans = max(ans, a.count(i) + b.count(i) + c.count(i))
print(ans)
Problem p03617 (Python) — buggy submission, verdict: Runtime Error

def main(q: int, h: int, s: int, d: int, n: int):
    print((n // 2) * min(q * 8, h * 4, s * 2, d) + (n % 2) * min(q * 4, h * 2, s))


if __name__ == "__main__":
    q, h, s, d = map(int, input().split())
    n = int(input())

    main(q, h, s, d, n)


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


Fixed submission:

def main(q: int, h: int, s: int, d: int, n: int):
    print((n // 2) * min(q * 8, h * 4, s * 2, d) + (n % 2) * min(q * 4, h * 2, s))


if __name__ == "__main__":
    q, h, s, d = map(int, input().split())
    n = int(input)

    main(q, h, s, d, n)
Problem p03617 (Python) — buggy submission, verdict: Time Limit Exceeded

Q, H, S, D = map(int, input().split())
N = int(input())

p025 = Q
p05 = min(H, p025 * 2)
p1 = min(S, p05 * 2)
p2 = min(D, p1 * 2)

ans = 0
if N % 2 != 0:
    N -= 1
    ans += p1
ans += (N // 2) * p2

print(ans)


Error: TLE

Fixed submission:

Q, H, S, D = map(int, input().split())
N = int(input())

p025 = Q
p05 = min(H, p025 * 2)
p1 = min(S, p05 * 2)
p2 = min(D, p1 * 2)

ans = 0
while N > 0:
    if N >= 2:
        N -= 2
        ans += p2
    elif N >= 1:
        N -= 1
        ans += p1

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

s = input()

count = 1

alphabets = {}

alphabets[s[0]] = 1

for i in range(1, len(s)):
    for char, char_count in alphabets.items():
        if char != s[i]:
            count += char_count

    if s[i] in alphabets:
        alphabets[s[i]] += 1
    else:
        alphabets[s[i]] = 1

print(count)


Error: TLE

Fixed submission:

s = input()

count = 1

alphabets = {}

alphabets[s[0]] = 1

for i in range(1, len(s)):
    ss = s[0:i]
    for char, char_count in alphabets.items():
        if char != s[i]:
            count += char_count

    if s[i] in alphabets:
        alphabets[s[i]] += 1
    else:
        alphabets[s[i]] = 1

print(count)