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

import numpy as np

N, D = list(map(int, input().split()))
X = []
for i in range(N):
    x_i = [int(i) for i in input().split()]
    X.append(x_i)
X = np.array(X)

ans = 0
for i in range(N):
    for j in range(i + 1, N):
        if np.sqrt(np.sum((X[i] - X[j]) ** 2)).is_integer():
            ans += 1
print(ans)


Error: TLE

Fixed submission:

import numpy as np

N, D = list(map(int, input().split()))
X = []
for i in range(D):
    x_i = [int(i) for i in input().split()]
    X.append(i)
X = np.array(X)

ans = 0
for i in range(D):
    for j in range(i + 1, D):
        if np.sqrt(np.sum(X[i] - X[j]) ** 2).is_integer():
            ans += 1
print(ans)
Problem p02983 (Python) — buggy submission, verdict: Runtime Error

l, r = map(int, input().split())
a = []

data = 2019

if r - l + 1 >= 2019:
    print(0)
    exit()

else:
    for i in range(l, r + 1):
        for j in range(i + 1, r + 1):
            data = min(data, i * j % 2019)

print(data)


Error: 0

Fixed submission:

l, r = map(int, input().split())
a = []
if r - l >= 2019:
    print(0)
else:
    for i in range(r - l + 1):
        a.append((l + i) % 2019)
# print(a)
a.sort()
print(a[0] * a[1])
Problem p02983 (Python) — buggy submission, verdict: Time Limit Exceeded

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


def main():
    L, R = map(int, input().split())
    mod = 2019

    min_mod = float("inf")

    for i in range(L, min(R, L + mod)):
        for j in range(i + 1, min(R + 1, i + 1 + mod)):
            curr_mod = i * j % mod
            min_mod = min(min_mod, curr_mod)
            if min_mod == 0:
                break

    print(min_mod)


if __name__ == "__main__":
    main()


Error: TLE

Fixed submission:

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


def main():
    L, R = map(int, input().split())
    result = []
    for i in range(L, R + 1):
        for j in range(i + 1, R + 1):
            result.append(i * j % 2019)
    print(min(result))


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

L, R = [int(i) for i in input().split()]
R = min(R, L + 4038)
ans = 2018
for i in range(L, R + 1):
    for j in range(i + 1, R + 1):
        x = (i * j) % 2019
        if x == 0:
            ans = 0
            break
        ans = min(ans, x)
print(ans)


Error: TLE

Fixed submission:

L, R = [int(i) for i in input().split()]
R = min(R, L + 4038)
diff = R - L
ans = 2018
for i in range(L, R + 1):
    for j in range(i + 1, R + 1):
        x = i * j % 2019
        ans = min(ans, x)
print(ans)
Problem p02983 (Python) — buggy submission, verdict: Time Limit Exceeded

l, r = map(int, input().split())
x = []
for i in range(l, r):
    for j in range(i + 1, r + 1):
        mod = i * j % 2019
        x.append(mod)
        if mod == 0:
            print(0)
            exit()
print(min(x))


Error: TLE

Fixed submission:

l, r = map(int, input().split())
x = []
for i in range(l, r):
    for j in range(i + 1, r + 1):
        mod = i * j % 2019
        x.append(mod)
print(min(x))
Problem p02983 (Python) — buggy submission, verdict: Time Limit Exceeded

L, R = map(int, input().split())
a = 0
b = 2019
if R - L >= 2018:
    b = 0
else:
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            a = i * j % 2019
            if a <= b:
                b = a

print(b)


Error: TLE

Fixed submission:

L, R = map(int, input().split())
a = 0
b = 2019
for i in range(L, R):
    for j in range(i + 1, R + 1):
        a = i * j % 2019
        if a <= b:
            b = a

print(b)
Problem p02983 (Python) — buggy submission, verdict: Runtime Error

L, R = map(int, input().split())
if (L <= 673 <= R and R - L >= 3) or (R - L >= 673):
    print(0)
else:
    mods = []
    mods_append = mods.append
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            m = (i * j) % 2019
            mods_append(m)
            if m == 2:
                break

    print(min(mods))


Error: 0

Fixed submission:

L, R = map(int, input().split())

num_list = list(range(L, R + 1))

num_list = [i % 2019 for i in num_list]
num_list.sort()

print((num_list[0] * num_list[1]) % 2019)
Problem p02983 (Python) — buggy submission, verdict: Time Limit Exceeded

def main():
    l, r = map(int, input().split())
    res = 1 << 30
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            res = min(res, (i * j) % 2019)
            if res == 0:
                print(res)
                return
    print(res)


if __name__ == "__main__":
    main()


Error: TLE

Fixed submission:

def main():
    l, r = map(int, input().split())
    res = 1 << 30
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            res = min(res, (i * j) % 2019)
            if res == 0:
                break
    print(res)


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

L, R = map(int, input().split())

if R - L >= 2019:
    ans = 0
else:
    ans = 2019
    for i in range(L, R):
        x = i % 2019
        for j in range(i + 1, R + 1):
            a = x * j
            ans = min(a % 2019, ans)

print(ans)


Error: TLE

Fixed submission:

import numpy as np

L, R = map(int, input().split())

if L - R >= 2019:
    ans = 0
else:
    A = np.arange(L, R + 1)
    A = np.sort(A % 2019)
    ans = A[0] * A[1]

print(ans % 2019)
Problem p02983 (Python) — buggy submission, verdict: Time Limit Exceeded

L, R = map(int, input().split())
ans = 2018
for i in range(L, R):
    for j in range(i + 1, R + 1):
        ans = min(ans, (i * j) % 2019)
        if ans == 0:
            print(ans)
            exit()
print(ans)


Error: TLE

Fixed submission:

L, R = map(int, input().split())
ans = 2018
for i in range(L, R):
    for j in range(i + 1, R + 1):
        ans = min(ans, (i * j) % 2019)
        if ans == 0:
            break
print(ans)
Problem p02983 (Python) — buggy submission, verdict: Time Limit Exceeded

L, R = map(int, input().split())
min_mod = 10**9
for i in range(L, min(L + 2019, R + 1)):
    for j in range(i + 1, min(L + 2019, R + 1)):
        min_mod = min(min_mod, (i * j) % 2019)
print(min_mod)


Error: TLE

Fixed submission:

L, R = map(int, input().split())
min_mod = 10**9
for i in range(L, R):
    for j in range(i + 1, min(L + 2019, R + 1)):
        min_mod = min(min_mod, (i * j) % 2019)
print(min_mod)
Problem p02983 (Python) — buggy submission, verdict: Runtime Error

L, R = map(int, input().split())
MOD = 2019
ans = float("inf")
for i in range(L, R):
    for j in range(i + 1, R + 1):
        ans = min(ans, i * j % MOD)
        if ans == 0:
            print(0)
            exit()
print(ans)


Error: 0

Fixed submission:

L, R = map(int, input().split())
MOD = 2019
L %= MOD
R %= MOD
print(min(i * j % 2019 for i in range(L, R) for j in range(i + 1, R + 1)))
Problem p02983 (Python) — buggy submission, verdict: Runtime Error

L, R = [int(_) for _ in input().split()]

diff = R - L
if diff >= 2019:
    print("0")
else:
    ans = min([i * j % 2019 for j in range(L + 1, R + 1) for i in range(L, R)])
    print(ans)


Error: 0

Fixed submission:

L, R = [int(_) for _ in input().split()]

diff = R - L
if diff >= 2019:
    print("0")
else:
    ans = min([i * j % 2019 for j in range(L + 1, R) for i in range(L, R)])
    print(ans)
Problem p02983 (Python) — buggy submission, verdict: Time Limit Exceeded

L, R = map(int, input().split())

if R - L >= 2019:
    res = 0
else:
    res = float("inf")
    L = L % 2019
    R = R % 2019
    for i in range(L, R + 1):
        for j in range(i + 1, R + 1):
            res = min(res, (i * j) % 2019)
print(res)


Error: TLE

Fixed submission:

L, R = map(int, input().split())

res = float("inf")
for i in range(L, R + 1):
    for j in range(i + 1, R + 1):
        res = min(res, (i * j) % 2019)
print(res)
Problem p02983 (Python) — buggy submission, verdict: Time Limit Exceeded

def make_list(L, R):
    mod_list = list()

    if R - L <= 2019:
        for i in range(L, R):
            for j in range(i + 1, R + 1):
                mod_list.append((i * j) % 2019)
    else:
        for i in range(L, L + 2020):
            for j in range(i + 1, i + 2021):
                mod_list.append((i * j) % 2019)

    return mod_list


def main():
    L, R = map(int, input().split())

    mod_list = make_list(L, R)

    print(min(mod_list))

    return


if __name__ == "__main__":
    main()


Error: TLE

Fixed submission:

def make_list(L, R):
    mod_list = list()

    if R - L <= 2019:
        for i in range(L, R):
            for j in range(i + 1, R + 1):
                mod_list.append((i * j) % 2019)
    else:
        for i in range(L, R):
            for j in range(i + 1, i + 2021):
                mod_list.append((i * j) % 2019)

    return mod_list


def main():
    L, R = map(int, input().split())

    mod_list = make_list(L, R)

    print(min(mod_list))

    return


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

L, R = map(int, input().split(" "))

ans = 2019

R = min(R, L + 2019)
for l in range(L, R):
    for r in range(l + 1, R + 1):
        ans = min(ans, (l * r) % 2019)
print(ans)


Error: TLE

Fixed submission:

L, R = map(int, input().split(" "))

R = min(R, L + 4038)

i = L
res = 2019
while i < R:
    j = i + 1
    while j <= R:
        res = min(res, i * j % 2019)
        j += 1
    i += 1

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

L, R = map(int, input().split())

tmp = R - L + 1
if tmp >= 2019:
    print(0)
    exit()
else:
    start = L % 2019
    end = R % 2019
    candidate = []
    for i in range(start, end + 1):
        candidate.append(i % 2019)
    candidate.sort()
    ans = []
    for i in range(len(candidate)):
        if i == (len(candidate) - 1):
            continue
        for j in range(i + 1, len(candidate)):
            if i == j:
                continue
            else:
                ans.append((candidate[i] * candidate[j]) % 2019)
    ans.sort()
    print(ans[0])


Error: TLE

Fixed submission:

L, R = map(int, input().split())

tmp = R - L + 1
if tmp >= 2019:
    print(0)
    exit()
else:
    start = L % 2019
    end = R % 2019
    candidate = []
    for i in range(start, end + 1):
        candidate.append(i % 2019)
    candidate.sort()
    ans = []
    for i in range(len(candidate)):
        for j in range(len(candidate)):
            if i == j:
                continue
            else:
                ans.append((candidate[i] * candidate[j]) % 2019)
    ans.sort()
    print(ans[0])
Problem p02984 (Python) — buggy submission, verdict: Time Limit Exceeded

from collections import deque

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

B = [0] * n
B[0] = A[0]
B[1] = A[1]
for i in range(2, n):
    B[i] = B[i - 2] + A[i]

ANS = [0] * n
for i in range(n):
    ans = 0
    if i % 2 == 0:
        ans += B[-1] - B[-2]
    else:
        ans += B[-2] - B[-1]

    if i - 2 >= 0:
        ans -= B[i - 2] * 2

    if i - 1 >= 0:
        ans += B[i - 1] * 2

    ANS[i] = ans

print(*ANS)


Error: TLE

Fixed submission:

from collections import deque

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

sum_even = sum(A[::2])
sum_odd = sum(A[1::2]) + A[0]
ANS = A[:]
A = deque(A)
minus = False
for _ in range(n - 1):
    A.rotate(-1)
    for i in range(n):
        if minus:
            ANS[i] -= A[i]
        else:
            ANS[i] += A[i]
    minus = not minus
ANS = deque(ANS)
ANS.rotate()
print(*ANS)
Problem p02984 (Python) — buggy submission, verdict: Time Limit Exceeded

import sys

input = sys.stdin.readline

n = int(input())
lis = list(map(int, input().split()))
res = sum(lis)
su = [0] * n

for i in range(n):
    if i < 2:
        su[i] = lis[i]
    else:
        su[i] = su[i - 2] + lis[i]

ans = []
ans_a = ans.append

for i in range(n):
    if i == 0:
        b = su[-2]
        ans_a(res - 2 * b)
    elif i == 1:
        b = su[-1] - su[i - 1]
        ans_a(res - 2 * b)
    elif i == n:
        b = su[-1] - lis[-1]
        ans_a(res - 2 * b)
    elif i % 2 == 0:
        b = su[-2] - su[i - 1] + su[i - 2]
        ans_a(res - 2 * b)
    else:
        b = su[-1] - su[i - 1] + su[i - 2]
        ans_a(res - 2 * b)
print(*ans)


Error: TLE

Fixed submission:

n = int(input())
lis = list(map(int, input().split()))
a = n // 2
res = sum(lis)


def dams(i, a, lis):
    su = 0
    for j in range(a):
        b = (i + (2 * j + 1)) % len(lis)
        su += lis[b]
    return su


ans = []
for i in range(n):
    ans.append(res - 2 * dams(i, a, lis))
print(*ans)
Problem p02984 (Python) — buggy submission, verdict: Time Limit Exceeded

n = int(input())
a = list(map(int, input().split()))
b = sum(a) / 2
p = int((n - 1) / 2)

x = []

t = b
for j in range(p):
    t -= a[2 * j + 1]
x.append(t * 2)

for i in range(n - 1):
    t = a[i] - x[i] / 2
    x.append(t * 2)

for i in range(n):
    print(int(x[i]), end=" ")


Error: TLE

Fixed submission:

n = int(input())
a = list(map(int, input().split()))
b = sum(a) / 2
p = int((n - 1) / 2)

x = []

for i in range(n):
    t = b
    for j in range(p):
        t -= a[(2 * j + i + 1) % n]
    x.append(t * 2)

for i in range(n):
    print(int(x[i]), end=" ")
Problem p02984 (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()]

S = sum(A)
ans = [0 for _ in range(N)]
s = 0
for k in range(int((N - 1) / 2)):
    s += A[2 * k + 1] * 2
ans[0] = S - s
for k in range(1, N):
    ans[k] = A[k - 1] * 2 - ans[k - 1]
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()]

S = sum(A)
ans = []
s = 0
for k in range(int((N - 1) / 2)):
    s += A[2 * k + 1] * 2
ans.append(S - s)
for k in range(N - 1):
    ans.insert(0, A[k] * 2 - ans[0])
ans.reverse()
print(*ans)
Problem p02984 (Python) — buggy submission, verdict: Time Limit Exceeded

from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n = int(input())
    a = list(map(int, input().split()))
    x_sum = sum(a) // 2
    x = [0] * n
    tmp = x_sum
    idx = 1
    for _ in range((n - 1) // 2):
        tmp -= a[idx]
        idx += 2
        idx %= n
    x[0] = 2 * tmp
    for i in range(n - 1):
        x[i + 1] = 2 * (a[i] - x[i] // 2)
    print(*x)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


Error: TLE

Fixed submission:

from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n = int(input())
    a = list(map(int, input().split()))
    x_sum = sum(a) // 2
    x = [0] * n
    for i in range(n):
        tmp = x_sum
        idx = (i + 1) % n
        for _ in range((n - 1) // 2):
            tmp -= a[idx]
            idx += 2
            idx %= n
        x[i] = 2 * tmp
    print(*x)


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

import sys
import numpy as np


def input():
    return sys.stdin.readline().rstrip()


def main():
    n = int(input())
    a = [int(e) for e in input().split()]
    x = [0 for _ in range(n)]
    x[0] = sum(a) - (sum(a[1:n:2]) * 2)
    for i in range(2, n, 2):
        x[i] = x[i - 2] + ((a[i - 1] - a[i - 2]) * 2)
    x[1] = sum(a) - (sum(a[2:n:2]) * 2)
    for i in range(3, n, 2):
        x[i] = x[i - 2] + ((a[i - 1] - a[i - 2]) * 2)
    print(*x)


main()


Error: TLE

Fixed submission:

import sys
import numpy as np


def input():
    return sys.stdin.readline().rstrip()


def main():
    n = int(input())
    a = [int(e) for e in input().split()]
    va = np.array(a)
    m = np.identity(n, dtype=int)
    for i in range(n):
        if i < n - 1:
            m[i][i + 1] = 1
        else:
            m[i][0] = 1
    vx = np.linalg.solve(m, va).astype(np.int) * 2
    print(*vx)


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

from scipy.sparse import csr_matrix
from scipy.sparse.linalg import spsolve
import numpy as np

N = int(input())
b = np.array(input().split(), dtype=int)

data = np.ones(2 * N, dtype=int)
col = np.arange(2 * N) // 2
row = np.zeros(2 * N, dtype=int)
row[0] = N - 1
row[1:] = col[:-1]

A = csr_matrix((data, (row, col)), shape=(N, N))

ans = (spsolve(A, b) * 2).astype(int)
print(*ans)


Error: TLE

Fixed submission:

from scipy.sparse import lil_matrix, csr_matrix
from scipy.sparse.linalg import spsolve
import numpy as np

N = int(input())
A = np.array(input().split(), dtype=int)

mat = lil_matrix((N, N))
for i in range(N):
    j = (i + 1) % N
    mat[i, i] = 1
    mat[i, j] = 1
mat = csr_matrix(mat)

ans = (spsolve(mat, A) * 2).astype(int)
print(*ans)
Problem p02984 (Python) — buggy submission, verdict: Time Limit Exceeded

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

ans = [0 for _ in range(N)]

sign = 1
for a in A:
    ans[0] += sign * a
    sign *= -1


for i in range(1, N):
    ans[i] = 2 * A[0] - ans[i - 1]

    t = A.pop(0)
    A.append(t)

print(*ans)


Error: TLE

Fixed submission:

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

ans = [0 for _ in range(N)]

for i in range(N):
    sign = 1

    for a in A:
        ans[i] += sign * a
        sign *= -1

    t = A.pop(0)
    A.append(t)

print(*ans)

"""
ダム1: 2( a1 - a2 + a3 )
ダム2: 2( a2 - a3 + a1 )
ダム3: 2( a3 - a1 + a2 )
"""
Problem p02984 (Python) — buggy submission, verdict: Time Limit Exceeded

n = int(input())
a = list(map(int, input().split()))
sum_rain = sum(a) // 2

rest_rain = 0
for i in range(1, n, 2):
    rest_rain += a[i]
first_ans = (sum_rain - rest_rain) * 2

res = []

res.append(first_ans)
prev_ans = first_ans

for i in range(n - 1):
    ans = (a[i] - prev_ans // 2) * 2
    res.append(ans)
    prev_ans = ans

print(*res)


Error: TLE

Fixed submission:

n = int(input())
a = list(map(int, input().split()))
sum_rain = sum(a) // 2
a += a
ans_rain = []

for i in range(n):
    rest_rain = 0
    for j in range(i + 1, i + n, 2):
        rest_rain += a[j]
    ans_rain.append((sum_rain - rest_rain) * 2)

print(*ans_rain)
Problem p02984 (Python) — buggy submission, verdict: Time Limit Exceeded

#!/usr/bin/env python3

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

r_list = []
total = 0

for i in range(1, N, 2):
    total += a_list[i]

r_list.append(sum(a_list) - total * 2)

for i in range(1, N):
    r = a_list[i - 1] * 2 - r_list[i - 1]
    r_list.append(r)

ans = " ".join([str(w) for w in r_list])
print(ans)


Error: TLE

Fixed submission:

#!/usr/bin/env python3

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

# 一番小さいものから決めていく？
for sw in range(start_w + 1):
    w_list = []
    if a_list[0] < sw // 2:
        continue
    w_list.append(sw)
    for i in range(1, N):
        w_list.append((a_list[i - 1] - w_list[i - 1] // 2) * 2)

    if a_list[-1] == (w_list[0] + w_list[-1]) // 2:
        break

ans = " ".join([str(w) for w in w_list])
print(ans)
Problem p02987 (Python) — buggy submission, verdict: Runtime Error

from collections import Counter


s = input()
c = Counter(s)
if len(c) == 2 and c.most_common(1)[0][1] == 2:
    print("Yes")
else:
    print("No")


Error: IndexError: list index out of range
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02987/Python/s756840059.py", line 6, in <module>
    if len(c) == 2 and c.most_common(1)[1] == 2:
IndexError: list index out of range


Fixed submission:

from collections import Counter


s = input()
c = Counter(s)
if len(c) == 2 and c.most_common(1)[1] == 2:
    print("Yes")
else:
    print("No")
Problem p02987 (Python) — buggy submission, verdict: Runtime Error

s = list(input())
s.sort()
ans = "No"
if s[0] == s[1] and s[2] == s[3]:
    if s[1] != s[2]:
        ans = "Yes"
print(ans)


Error: AttributeError: 'str' object has no attribute 'sort'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02987/Python/s791520641.py", line 2, in <module>
    s.sort()
AttributeError: 'str' object has no attribute 'sort'


Fixed submission:

s = input()
s.sort()
ans = "No"
if s[0] == s[1] and s[2] == s[3]:
    if s[1] != s[2]:
        ans = "Yes"
print(ans)
Problem p02987 (Python) — buggy submission, verdict: Runtime Error

a = input()
a = a.replace(a[0], "")
if len(a) == 0:
    print("No")
else:
    a = a.replace(a[0], "")
    if len(a) == 0:
        print("Yes")
    else:
        print("No")


Error: 0

Fixed submission:

a = input()
a = a.replace(a[0], "")
a = a.replace(a[0], "")
if len(a) == 0:
    print("Yes")
else:
    print("No")
Problem p02987 (Python) — buggy submission, verdict: Runtime Error

S = input()
S = S.replace(S[0], "")
if len(S) > 0:
    S = S.replace(S[0], "")
    if len(S) == 0:
        print("Yes")
    else:
        print("No")
else:
    print("No")


Error: 0

Fixed submission:

S = input()
S = S.strip(S[0])

if len(S[0]) > 0:
    S = S.strip(S[0])
    if len(S) == 0:
        print("Yes")
    else:
        print("No")
else:
    print("No")
Problem p02987 (Python) — buggy submission, verdict: Runtime Error

import sys


# s = sys.argv[1]
s = input()
if len(s) == 4:
    if s.count(s[0]) == 2:
        if s.count(s[1]) == 2:
            if s.count(s[2]) == 2:
                if s.count(s[3]) == 2:
                    print("Yes")
                    exit()
print("No")
exit()


Error: IndexError: list index out of range
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02987/Python/s870683023.py", line 4, in <module>
    s = sys.argv[1]
IndexError: list index out of range


Fixed submission:

import sys


s = sys.argv[1]

if len(s) == 4:
    if s.count(s[0]) == 2:
        if s.count(s[1]) == 2:
            if s.count(s[2]) == 2:
                if s.count(s[3]) == 2:
                    print("Yes")
                    exit()
print("No")
exit()
Problem p02988 (Python) — buggy submission, verdict: Runtime Error

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


Error: WA

Fixed submission:

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

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

same = N / 2

# d.sort()

# distribution = [0] * d[len(d) - 1]
# total = 0
# for di in d:
#     num = d.count(di)
#     distribution[di - 1] = num

table = {}
for di in d:
    table[di] = 1 if table.get(di) is None else table.get(di) + 1
table = sorted(table.items())

total = 0
start = 0
end = 0
for difficulty, num in table:
    total += num

    if start == 0 and total == same:
        start = difficulty
    elif start != 0:
        end = difficulty
        break

# print(table, start, end)

answer = end - start
print(answer)


Error: KeyError: 9
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02989/Python/s072989017.py", line 16, in <module>
    table[di] = 0 if table[di] is None else table[di] + 1
KeyError: 9


Fixed submission:

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

same = N / 2

# d.sort()

# distribution = [0] * d[len(d) - 1]
# total = 0
# for di in d:
#     num = d.count(di)
#     distribution[di - 1] = num

table = {}
for di in d:
    table[di] = 0 if table[di] is None else table[di] + 1

# total = 0
# totals = [0] * d[len(d) - 1]
# num = 0
# for i in range(len(distribution)):
#     total += distribution[i]
#     totals[i] = total

#     if totals[i] == same:
#         num += 1
#     elif num >= 1:
#         break

print(1)