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

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

a = sorted(a, reverse=True)

comb = -1
a_i = a[0]
if a_i % 2 == 0:
    mid = int(a_i / 2)
    dif = 10**9
    for i in range(1, n):
        if dif > abs(a[i] - mid):
            dif = abs(a[i] - mid)
            a_j = a[i]
else:
    mid = int(a_i / 2)
    dif = 10**9
    for i in range(1, n):
        if a[i] > mid:
            if dif > abs(a[i] - mid - 1):
                dif = abs(a[i] - mid - 1)
                a_j = a[i]
        else:
            if dif > abs(a[i] - mid):
                dif = abs(a[i] - mid)
                a_j = a[i]

print(a_i, a_j)


Error: ModuleNotFoundError: No module named 'scipy'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03380/Python/s898511833.py", line 1, in <module>
    import scipy.misc as scm
ModuleNotFoundError: No module named 'scipy'


Fixed submission:

import scipy.misc as scm

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

a = sorted(a, reverse=True)

comb = -1
a_i = a[0]
comb = 0
for i in range(1, n):
    c = scm.comb(a_i, a[i])
    if comb > c:
        comb = c
        a_j = a[i]
    else:
        break
print(a_i, a_j)
Problem p03380 (Python) — buggy submission, verdict: Time Limit Exceeded

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

max_a = max(a)
a.remove(max_a)
da = [abs(ai - max_a / 2) for ai in a]
med_i = da.index(min(da))

print("%d %d" % (max_a, a[med_i]))


Error: TLE

Fixed submission:

import math


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


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

ans = 0
a_i = a[0]
a_j = a[1]
for idx in range(1, n):
    if ans < combinations_count(a_i, a[idx]):
        ans = combinations_count(a_i, a[idx])
        a_j = a[idx]

print("%d %d" % (a_i, a_j))
Problem p03380 (Python) — buggy submission, verdict: Time Limit Exceeded

def main():
    n = int(input())
    a = list(map(int, input().split()))
    if n == 2:
        print(max(a), min(a))
    else:
        ma = max(a)
        sa = sorted([(i, abs(ma // 2 - a[i])) for i in range(n)], key=lambda x: x[1])
        print(ma, a[sa[0][0]])


main()


Error: TLE

Fixed submission:

def main():
    n = int(input())
    a = list(map(int, input().split()))
    if n == 2:
        print(a[0], a[1])
    ma = max(a)
    for i in range(n):
        if ma // 2 - i in a:
            print(ma, ma // 2 - i)
            exit()
        if ma // 2 - i + 1 in a:
            print(ma, ma // 2 - i + 1)
            exit()


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

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

ans1 = max(a)
sa = sorted(a)

if n == 2:
    ans1 = a[0]
    ans2 = a[1]
else:
    idx = n // 2
    flag = True
    if sa[idx] == ans1 // 2:
        ans2 = ans1 // 2
    elif sa[idx] < ans1 // 2:
        while True:
            idx += 1
            if ans1 // 2 <= sa[idx]:
                if abs(sa[idx] - ans1 / 2) < abs(sa[idx - 1] - ans1 / 2):
                    ans2 = sa[idx]
                else:
                    ans2 = sa[idx - 1]
                break
    else:
        while True:
            idx -= 1
            if sa[idx] <= ans1 // 2:
                if abs(sa[idx] - ans1 / 2) < abs(sa[idx + 1] - ans1 / 2):
                    ans2 = sa[idx]
                else:
                    ans2 = sa[idx + 1]
                break

print(ans1, ans2)


Error: TLE

Fixed submission:

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

ans1 = max(a)

flag = True
if ans1 % 2 == 1:
    s1 = ans1 // 2
    s2 = ans1 // 2 + 1
else:
    if ans1 // 2 in a:
        flag = False
        ans2 = ans1 // 2
    else:
        s1 = ans1 // 2 - 1
        s2 = ans1 // 2 + 1

while flag:
    if s1 in a:
        ans2 = s1
        break
    elif s2 in a:
        ans2 = s2
        break
    s1 -= 1
    s2 += 1

print(ans1, ans2)
Problem p03380 (Python) — buggy submission, verdict: Time Limit Exceeded

from bisect import bisect

n = int(input())
A = list(map(int, input().split()))
A.sort()
b = A.pop()
m = b / 2
i = bisect(A, m)
A.insert(i, m)

if i == 0:
    print(b, A[1])
elif i == len(A) - 1:
    print(b, A[-2])
elif A[i] - A[i - 1] < A[i + 1] - A[i]:
    print(b, A[i - 1])
else:
    print(b, A[i + 1])


Error: TLE

Fixed submission:

from math import factorial


def perm(n, r):
    return factorial(n) // factorial(n - r)


def comb(n, r):
    return perm(n, r) // factorial(r)


n = int(input())
A = list(map(int, input().split()))
A.sort()
m = A.pop()
biggest = 0
biggest_r = 0
for r in A:
    var = comb(m, r)
    if var > biggest:
        biggest = var
        biggest_r = r
print(m, biggest_r)
Problem p03381 (Python) — buggy submission, verdict: Time Limit Exceeded

import bisect

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

X2 = sorted(X)

for i in range(0, N):
    # idx = X2.index(X[i])
    idx = bisect.bisect_left(X2, X[i])
    if idx < N // 2:
        print(X2[N // 2])
    else:
        print(X2[N // 2 - 1])


Error: TLE

Fixed submission:

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

X2 = sorted(X)

for i in range(0, N):
    idx = X2.index(X[i])
    if idx < N // 2:
        print(X2[N // 2])
    else:
        print(X2[N // 2 - 1])
Problem p03382 (Python) — buggy submission, verdict: Time Limit Exceeded

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


def comb(n, r):
    res = 1
    for i in range(n - r + 1, n + 1):
        res *= i
    for i in range(1, r):
        res //= i
    return res


x = A.pop()
N -= 1
for i in range(N):
    if A[i] > x // 2:
        break
if abs(A[i] - x / 2) < abs(A[i - 1] - x / 2):
    print(x, A[i])
else:
    print(x, A[i - 1])


Error: TLE

Fixed submission:

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


def comb(n, r):
    res = 1
    for i in range(n - r + 1, n + 1):
        res *= i
    for i in range(1, r):
        res //= i
    return res


x = A.pop()
N -= 1
for i in range(N):
    if A[i] > x // 2:
        break
if comb(x, A[i]) > comb(x, A[i - 1]):
    y = A[i]
else:
    y = A[i - 1]
print(x, y)
Problem p03385 (Python) — buggy submission, verdict: Runtime Error

S = str(input())
if not (S[0] == S[1]) and not (S[1] == S[2]) and not (S[0] == S[2]):
    print("Yes")
else:
    print("No")


Error: AttributeError: 'dict' object has no attribute 'add'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03385/Python/s103059776.py", line 3, in <module>
    ans.add(S[0])
AttributeError: 'dict' object has no attribute 'add'


Fixed submission:

S = str(input())
ans = {}
ans.add(S[0])
ans.add(S[1])
ans.add(S[2])
if len(ans) == 3:
    print("Yes")
else:
    print("No")
Problem p03385 (Python) — buggy submission, verdict: Runtime Error

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


def main():
    """Function."""
    s = str(input())
    if len(set([s[0], s[1], s[2]])) == 3:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()


Error: TypeError: set expected at most 1 argument, got 3
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03385/Python/s179544392.py", line 14, in <module>
    main()
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03385/Python/s179544392.py", line 7, in main
    if len(set(s[0], s[1], s[2])) == 3:
TypeError: set expected at most 1 argument, got 3


Fixed submission:

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


def main():
    """Function."""
    s = str(input())
    if len(set(s[0], s[1], s[2])) == 3:
        print("Yes")
    else:
        print("No")


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

s = input()
L = [s[0], s[1], s[2]]
L.sort()
S = "".join(L)
print("Yes") if S == "abc" else print("No")


Error: AttributeError: 'NoneType' object has no attribute 'join'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03385/Python/s660041027.py", line 2, in <module>
    L = [s[0], s[1], s[2]].sort().join()
AttributeError: 'NoneType' object has no attribute 'join'


Fixed submission:

s = input()
L = [s[0], s[1], s[2]].sort().join()
print("Yes") if L == "abc" else print("No")
Problem p03386 (Python) — buggy submission, verdict: Runtime Error

# https://atcoder.jp/contests/abc093/tasks/abc093_b
a, b, k = [int(x) for x in input().split()]
s = list(range(a, b + 1)[:k])
t = list(range(a, b + 1)[-k:])
for v in sorted(set(s + t)):
    print(v)


Error: 0

Fixed submission:

# https://atcoder.jp/contests/abc093/tasks/abc093_b
a, b, k = [int(x) for x in input().split()]
r = list(range(a, b + 1))
for v in sorted(set(r[:k] + r[-k:])):
    print(v)
Problem p03386 (Python) — buggy submission, verdict: Time Limit Exceeded

a, b, k = map(int, input().split())
for i in range(a, min(a + k, b + 1)):
    print(i)
for i in range(max(a + k, b - k + 1), b + 1):
    print(i)


Error: TLE

Fixed submission:

a, b, k = map(int, input().split())
for i in range(a, b + 1):
    if i < a + k or i > b - k:
        print(i)
Problem p03386 (Python) — buggy submission, verdict: Runtime Error

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


def main():
    A, B, K = map(int, input().split())
    AK = [i for i in range(A, min(B + 1, A + K))]
    BK = [i for i in range(max(A, B - K + 1), B + 1)]

    result = list(set(AK) | set(BK))
    result.sort()

    for i in result:
        print(i)


if __name__ == "__main__":
    main()


Error: 0

Fixed submission:

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


def main():
    A, B, K = map(int, input().split())

    for i in list(range(A, B + 1)):
        if A <= i <= A + K - 1 or B + 1 >= i >= B - K + 1:
            print(i)


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

a, b, k = map(int, input().split())

if b - a + 1 <= k * 2:
    for i in range(a, b + 1):
        print(i)
else:
    for i in range(a, a + k):
        print(i)
    for i in range(b - k + 1, b + 1):
        print(i)


Error: TLE

Fixed submission:

a, b, k = map(int, input().split())

for i in range(a, b + 1):
    if i < a + k or i > b - k:
        print(i)
Problem p03386 (Python) — buggy submission, verdict: Runtime Error

a, b, k = map(int, input().split())

num = range(a, b + 1)

a_k = num[:k]
k_e = num[-k:]

# print(a_k, k_e)
ans_set = set(a_k) | set(k_e)
ans_list = sorted(ans_set)
for i in ans_list:
    print(i)


Error: 0

Fixed submission:

import copy

a, b, k = map(int, input().split())

num = copy.deepcopy(list(range(a, b + 1)))

a_k = num[:k]
k_e = num[-k:]

# print(a_k, k_e)
ans_set = set(a_k + k_e)
ans_list = copy.deepcopy(list(ans_set))
ans_list.sort()
for i in ans_list:
    print(i)
Problem p03386 (Python) — buggy submission, verdict: Runtime Error

def resolve():
    a, b, k = list(map(int, input().split()))
    s = set()
    for i in range(a, min(a + k, b + 1)):
        s.add(i)
    for i in range(max(a, b - k + 1), b + 1):
        s.add(i)
    for i in sorted(s):
        print(i)


if __name__ == "__main__":
    resolve()


Error: 0

Fixed submission:

def resolve():
    a, b, k = list(map(int, input().split()))
    small = list(range(a, b))[:k]
    large = list(range(a, b + 1))[::-1][:k]
    ans = sorted(set(small + large))
    for i in ans:
        print(i)


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

def resolve():
    A, B, K = [int(i) for i in input().split()]
    offset = 0
    while offset < K and A + offset <= B:
        print(A + offset)
        offset += 1
    begin = A + offset
    r = max(B - K + 1, begin)
    while r <= B:
        print(r)
        r += 1


resolve()


Error: TLE

Fixed submission:

def resolve():
    A, B, K = [int(i) for i in input().split()]
    numbers = [i for i in range(A, B + 1)]
    ans = numbers[:K]
    ans.extend(numbers[-K:])
    print(*sorted(set(ans)), sep="\\n")


resolve()
Problem p03386 (Python) — buggy submission, verdict: Time Limit Exceeded

A, B, K = map(int, input().split())
ret = range(A, B + 1)
for i in sorted(set(ret[:K]) | set(ret[-K:])):
    print(i)


Error: TLE

Fixed submission:

A, B, K = map(int, input().split())
for i in range(A, B + 1):
    if i - A < K or B - i < K:
        print(i)
Problem p03386 (Python) — buggy submission, verdict: Time Limit Exceeded

a, b, k = map(int, input().split())

ans = []

for i in range(k):
    if a + i <= b and a <= b - i:
        ans.append(a + i)
        ans.append(b - i)

# ans.sort()
ans = set(ans)

for i in sorted(ans):
    print(i)


Error: TLE

Fixed submission:

a, b, k = map(int, input().split())

ans = []

for i in range(b - a + 1):
    n = a + i
    if n <= a + k - 1 or n >= b - k + 1:
        ans.append(n)

ans.sort()
for i in range(len(ans)):
    print(ans[i])
Problem p03386 (Python) — buggy submission, verdict: Runtime Error

A, B, K = map(int, input().split())
for n in sorted(
    filter(lambda n: A <= n <= B, set(range(A, A + K)) | set(range(B - K + 1, B + 1)))
):
    print(n)


Error: 0

Fixed submission:

A, B, K = map(int, input().split())
for n in sorted({*range(A, A + K), *range(B - K + 1, B + 1)}):
    print(n)
Problem p03386 (Python) — buggy submission, verdict: Runtime Error

a, b, k = map(int, input().split())
s = set()
if b - a == 0:
    print(a)
elif b - a + 1 <= k:
    print(*range(a, b + 1), sep="\\n")
else:
    for i in range(k):
        s.add(a + i)
        s.add(b - i)
    s = sorted(s)
    print(*s, sep="\\n")


Error: 0

Fixed submission:

a, b, k = map(int, input().split())
ls = list(range(a, b + 1))
lsRe = ls[::-1]
s = set()

if len(ls) > k:
    for i in range(k):
        s.add(ls[i])
        s.add(lsRe[i])
else:
    print(*ls, sep="\\n")
    quit()

s = sorted(s)
print(*s, sep="\\n")
Problem p03386 (Python) — buggy submission, verdict: Time Limit Exceeded

A, B, K = map(int, input().split())
if B - A <= 2 * K - 1:
    for i in range(A, B + 1):
        print(i)
else:
    for i in range(A, A + K):
        print(i)
    for i in range(B - K + 1, B + 1):
        print(i)


Error: TLE

Fixed submission:

A, B, K = map(int, input().split())
for i in range(A, B + 1):
    if abs(A - i) < K or abs(B - i) < K:
        print(i)
Problem p03386 (Python) — buggy submission, verdict: Runtime Error

a, b, k = map(int, input().split())

for i in range(a, min(a + k, b - k + 1)):
    print(i)
for i in range(max(a, b - k + 1), b + 1):
    print(i)


Error: 0

Fixed submission:

a, b, k = map(int, input().split())

z = list(range(a, b + 1))
ans = sorted(list(set(z[:k]) | set(z[-k:])))
for x in ans:
    print(x)
Problem p03386 (Python) — buggy submission, verdict: Time Limit Exceeded

a, b, k = map(int, input().split())
if b - a > k:
    lst_small = [x for x in range(a, a + k)]
    lst_large = [x for x in range(b - k + 1, b + 1)]
    ans = list(set(lst_small) | set(lst_large))
    ans = sorted(ans)
else:
    ans = [x for x in range(a, b + 1)]

for i in range(len(ans)):
    print(ans[i])


Error: TLE

Fixed submission:

a, b, k = map(int, input().split())
lst = [x for x in range(a, b + 1)]
lst_small = lst[:k]
lst_large = lst[-k:]
ans = list(set(lst_small) | set(lst_large))
ans = sorted(ans)
for i in range(len(ans)):
    print(ans[i])
Problem p03386 (Python) — buggy submission, verdict: Time Limit Exceeded

a, b, k = map(int, input().split())
for i in range(a, min(b, a + k - 1) + 1):
    print(i)
for i in range(max(b - k + 1, a + k), b + 1):
    print(i)


Error: TLE

Fixed submission:

a, b, k = map(int, input().split())
for i in range(a, b + 1):
    if i <= a + (k - 1):
        print(i)
    elif i >= b - (k - 1):
        print(i)
Problem p03386 (Python) — buggy submission, verdict: Time Limit Exceeded

a, b, k = map(int, input().split())
ans = []
for i in range(a, min(a + k, b + 1)):
    ans.append(i)
for i in range(b, max(b - k, a - 1), -1):
    if i not in ans:
        ans.append(i)
ans.sort()
for i in ans:
    print(i)


Error: TLE

Fixed submission:

a, b, k = map(int, input().split())
for i in range(a, b + 1):
    if i - a + 1 <= k or b - i + 1 <= k:
        print(i)
Problem p03386 (Python) — buggy submission, verdict: Runtime Error

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

ans = set()
for i in range(A, min(B + 1, A + K)):
    ans.add(i)

for i in range(max(A, B - K + 1), B + 1):
    ans.add(i)
ans = sorted(list(ans))
for i in ans:
    print(i)


Error: 0

Fixed submission:

A, B, K = map(int, input().split())
N = B - A + 1
nums = list(range(A, B + 1))
ans = set()

for i in range(min(K, N)):
    ans.add(nums[i])

nums.reverse()
for i in range(min(K, N)):
    ans.add(nums[i])


ans = list(ans)
ans.sort()
for i in ans:
    print(i)
Problem p03386 (Python) — buggy submission, verdict: Runtime Error

A, B, K = map(int, input().split())
if B - A < 2 * K:
    # ans = [*range(A, B + 1)]
    ans = list(range(A, B + 1))
else:
    # ans = [*range(A, A + K), *range(B - K + 1, B + 1)]
    ans = list(range(A, A + K)) + list(range(B - K + 1, B + 1))
for v in ans:
    print(v)


Error: 0

Fixed submission:

A, B, K = map(int, input().split())
if B - A < 2 * K:
    ans = [*range(A, B + 1)]
else:
    ans = [*range(A, A + K), *range(B - K + 1, B + 1)]
for v in ans:
    print(v)
Problem p03386 (Python) — buggy submission, verdict: Runtime Error

a, b, k = map(int, input().split())
r = range(a, b + 1)
for i in sorted(set(r[:k]) | set(r[-k:])):
    print(i)


Error: 0

Fixed submission:

a, b, k = map(int, input().split())

num = list(range(a, b + 1))

a_k = num[:k]
k_e = num[-k:]

# print(a_k, k_e)
ans_set = set(a_k + k_e)
ans_list = list(ans_set)
ans_list.sort()
for i in ans_list:
    print(i)
Problem p03386 (Python) — buggy submission, verdict: Runtime Error

A, B, K = map(int, input().split())
R = range(A, min(B + 1, A + K))
S = range(max(A, B - K + 1), B + 1)
L = list(set(R) | set(S))
L.sort()
print(*L, sep="\\n")


Error: 0

Fixed submission:

A, B, K = map(int, input().split())
print(
    *sorted(
        list(set(range(A, min(B + 1, A + K))) | set(range(max(A, B - K) + 1, B + 1)))
    ),
    sep="\\n",
)
Problem p03386 (Python) — buggy submission, verdict: Time Limit Exceeded

a, b, k = map(int, input().split())
r = range(a, b + 1)
for x in sorted(set(r[:k]) | set(r[-k:])):
    print(x)


Error: TLE

Fixed submission:

a, b, k = map(int, input().split())
r = [x for x in range(a, b + 1)]
for x in sorted(set(r[:k]) | set(r[-k:])):
    print(x)
Problem p03386 (Python) — buggy submission, verdict: Runtime Error

A, B, K = map(int, input().split())
arr = range(A, B + 1)
ans = []
for i in range(K):
    ans.append(A + i)
for j in range(K):
    ans.append(B + 1 - K + j)

anset = list(set(ans))
anset.sort()
if A + K <= B + 1:
    for ele in range(len(anset)):
        print(anset[ele])
else:
    for ele in range(A, B + 1):
        print(ele)


Error: IndexError: list assignment index out of range
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03386/Python/s604685648.py", line 5, in <module>
    ans[i] = arr[A + i]
IndexError: list assignment index out of range


Fixed submission:

A, B, K = map(int, input().split())
arr = range(A, B + 1)
ans = []
for i in range(K):
    ans[i] = arr[A + i]
for j in range(K):
    ans[j + K + 2] = arr[B + 1 - K + j]
print(set(ans))
Problem p03386 (Python) — buggy submission, verdict: Time Limit Exceeded

A, B, K = map(int, input().split())
if B - A + 1 <= 2 * K:
    for i in range(A, B + 1):
        print(i)
    exit()
for i in range(A, A + K):
    print(i)
for i in range(B - K + 1, B + 1):
    print(i)


Error: TLE

Fixed submission:

A, B, K = map(int, input().split())
for i in range(A, B + 1):
    if (i <= A + K - 1) or (i >= B - K + 1):
        print(i)
        continue
Problem p03386 (Python) — buggy submission, verdict: Time Limit Exceeded

a, b, k = map(int, input().split())

if b - a + 1 <= k * 2:
    for i in range(a, b + 1):
        print(i)
else:
    for i in range(a, a + k):
        print(i)
    for i in range((b - k + 1), (b + 1)):
        print(i)


Error: TLE

Fixed submission:

a, b, k = map(int, input().split())

for i in range(a, b + 1):
    if i < a + k or i > b - k:
        print(i)
Problem p03386 (Python) — buggy submission, verdict: Runtime Error

def abc():
    a, b, c = map(int, input().split())
    n = range(a, b + 1)
    for s in sorted(set(n[:c]) | set(n[-c:])):
        print(s)


abc()


Error: 0

Fixed submission:

def abc():
    a, b, c = map(int, input().split())
    n = list(range(a, b + 1))
    for s in sorted(set(n[:c]) | set(n[-c:])):
        print(s)


abc()
Problem p03386 (Python) — buggy submission, verdict: Time Limit Exceeded

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

s = set()

for i in range(A, min(A + K, B + 1)):
    s.add(i)

for i in range(B, max(A - 1, B - K), -1):
    s.add(i)

s = sorted(s)

for i in s:
    print(i)


Error: TLE

Fixed submission:

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

s = set()

for i in range(A, B + 1):
    if i <= A + K - 1:
        s.add(i)
    elif B - K + 1 <= i:
        s.add(i)

s = sorted(s)

for i in s:
    print(i)
Problem p03386 (Python) — buggy submission, verdict: Runtime Error

A, B, K = map(int, input().split())
SA = list(range(A, min(B, A + K)))
SB = list(range(max(A, B - K + 1), B + 1))

ans = sorted(set(SA + SB))
for a in ans:
    print(a)


Error: 0

Fixed submission:

A, B, K = map(int, input().split())
S = list(range(A, B + 1))

ans = sorted(set(S[:K] + S[-K:]))
for a in ans:
    print(a)
Problem p03386 (Python) — buggy submission, verdict: Time Limit Exceeded

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

for i in range(A, min(B + 1, A + K)):
    if i < A + K:
        print(i)

for i in range(max(B - K, A + K), B + 1):
    if i > B - K:
        print(i)


Error: TLE

Fixed submission:

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

for i in range(A, B + 1):
    if i < A + K or i > B - K:
        print(i)
Problem p03386 (Python) — buggy submission, verdict: Time Limit Exceeded

#!/usr/bin/env python3
A, B, K = map(int, input().split())
for i in range(A, min(B + 1, A + K)):
    print(i)
for i in range(max(0, B - K + 1), B + 1):
    if i < A + K:
        continue
    print(i)


Error: TLE

Fixed submission:

#!/usr/bin/env python3
A, B, K = map(int, input().split())
for i in range(A, B + 1):
    if i < A + K or B - K < i:
        print(i)
Problem p03386 (Python) — buggy submission, verdict: Time Limit Exceeded

a, b, k = map(int, input().split())

x = b - a
if x < 2 * k:
    for i in range(a, b + 1):
        print(i)
else:
    for i in range(a, a + k):
        print(i)

    for i in range(b - k + 1, b + 1):
        print(i)


Error: TLE

Fixed submission:

A, B, K = map(int, input().split())
for num in range(A, B + 1):
    if num < A + K or num > B - K:
        print(num)
Problem p03386 (Python) — buggy submission, verdict: Runtime Error

a, b, k = [int(x) for x in input().split()]
r = range(a, b + 1)
for i in sorted(set(r[:k]) | set(r[-k:])):
    print(i)


Error: 0

Fixed submission:

a, b, k = [int(x) for x in input().split()]
lst = list(range(a, b + 1))
res = []
res.extend(lst[:k])
res.extend(lst[-k:])
res = sorted(set(res))
for i in res:
    print(i)
Problem p03387 (Python) — buggy submission, verdict: Runtime Error

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

ret = 0
while True:
    if A == B and B == C:
        print(ret)
        exit()

    ret += 1
    A, B, C = sorted([A, B, C])
    if B < C:
        A += 1
        B += 1
    elif B == C:
        A += 2


Error: 0

Fixed submission:

A, B, C = sorted([int(x) for x in input().split()])
if A == B and B == C:
    print(0)
    exit()

ret = 0
while True:
    if A < B and B < C:
        A += 1
        B += 1
    elif A < B and B == C:
        A += 2
    elif A > B and B == C:
        B += 1
        C += 1
    else:
        # 想定外
        exit(1)

    ret += 1
    if A == B and B == C:
        print(ret)
        exit()