Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))
max_lst = []
min_lst = []
max_h = H[0]
min_h = H[0]
s = 0
for i in range(1, N):
    if H[i-1] <= H[i]:
        if H[0] not in max_lst and H[0] not in min_lst:
            min_lst.append(H[0])
        if max_h == 0:
            min_lst.append(min_h)
        if i == N-1:
            max_lst.append(H[i])
        max_h = H[i]
        min_h = 0
    elif H[i-1] >= H[i]:
        if H[0] not in max_lst and H[0] not in min_lst:
            max_lst.append(H[0])
            s = 1
        if min_h == 0:
            max_lst.append(max_h)
        if i == N-1:
            min_lst.append(H[i])
        min_h = H[i]
        max_h = 0
cnt = 0
if s == 0:
    for i in range(len(min_lst)-1):
        cnt += max_lst[i] - min(min_lst[i], min_lst[i+1])
    cnt += max_lst[-1] - min_lst[-1]
else:
    for i in range(1, len(max_lst)):
        cnt += max_lst[i] - min(min_lst[i-1], min_lst[i])
    cnt += max_lst[0] - min_lst[0]
print(cnt)

Fixed submission:
N = int(input())
H = list(map(int, input().split()))
ans = 0
H.append(0)
for i in range(max(H)):
    cnt = 0
    for k in range(N):
        if H[k] != 0 and H[k+1] == 0:
            cnt += 1
    ans += cnt
    H = list(map(lambda x:(x-1, 0)[x == 0], H))
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
lst = list(map(int, input().split()))
cnt = 0
for i in range(N-1):
    if lst[i] < lst[i+1]:
        cnt += 
print(cnt)




#139 c
N = int(input())
H = list(map(int, input().split()))
max_lst = []
min_lst = []
max_h = H[0]
min_h = H[0]
s = 0
for i in range(1, N):
    if H[i-1] <= H[i]:
        if H[0] not in max_lst and H[0] not in min_lst:
            min_lst.append(H[0])
        if max_h == 0:
            min_lst.append(min_h)
        if i == N-1:
            max_lst.append(H[i])
        max_h = H[i]
        min_h = 0
    elif H[i-1] >= H[i]:
        if H[0] not in max_lst and H[0] not in min_lst:
            max_lst.append(H[0])
            s = 1
        if min_h == 0:
            max_lst.append(max_h)
        if i == N-1:
            min_lst.append(H[i])
        min_h = H[i]
        max_h = 0
cnt = 0
if s == 0:
    for i in range(len(min_lst)-1):
        cnt += max_lst[i] - min(min_lst[i], min_lst[i+1])
    cnt += max_lst[-1] - min_lst[-1]
else:
    for i in range(1, len(max_lst)):
        cnt += max_lst[i] - min(min_lst[i-1], min_lst[i])
    cnt += max_lst[0] - min_lst[0]
print(cnt)

Fixed submission:
N = int(input())
H = list(map(int, input().split()))
ans = 0
H.append(0)
for i in range(max(H)):
    cnt = 0
    for k in range(N):
        if H[k] != 0 and H[k+1] == 0:
            cnt += 1
    ans += cnt
    H = list(map(lambda x:(x-1, 0)[x == 0], H))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
lst = list(map(int, input().split()))
dp = [[]for i in range(N)]

dp[0] = 0
dp[1] = abs(lst[0] - lst[1])
for i in range(2, N):
    ans = []
    for j in range(min(i, K)):
        ans.append(dp[i-j-1] + abs(lst[i-j-1] - lst[i]))
    dp[i] = min(ans)

print(dp[-1])

Fixed submission:
N, K = map(int, input().split())
lst = list(map(int, input().split()))
dp = [[]for i in range(N)]

dp[0] = 0
dp[1] = abs(lst[0] - lst[1])
for i in range(2, N):
    ans = []
    for j in range(min(i, K)):
        ans.append(dp[i-j-1] + abs(lst[i-j-1] - lst[i]))
    dp[i] = min(ans)

print(dp[-1])
Buggy python submission (verdict: Time Limit Exceeded):
N, W = map(int, input().split())
lst = [[0, 0]] 
for i in range(N):
    lst.append(list(map(int, input().split())))
dp = [[0]*(W+1) for i in range(N+1)]
for i in range(1, N+1):
    for j in range(1, W+1):
        if j - lst[i][0] >= 0:
            dp[i][j] = max(dp[i-1][j], dp[i-1][j-lst[i][0]]+lst[i][1])
        else:
            dp[i][j] = dp[i-1][j]

print(dp[N][W])

Fixed submission:
N, W = map(int, input().split())
lst = [[0, 0]] 
for i in range(N):
    lst.append(list(map(int, input().split())))
dp = [[0]*(W+1) for i in range(N+1)]
for i in range(1, N+1):
    for j in range(1, W+1):
        if j - lst[i][0] >= 0:
            dp[i][j] = max(dp[i-1][j], dp[i-1][j-lst[i][0]]+lst[i][1])
        else:
            dp[i][j] = dp[i-1][j]

print(dp[N][W])
Buggy python submission (verdict: Runtime Error):
N, W = map(int, input().split())
lst = [[0, 0]] 
for i in range(N):
    lst.append(list(map(int, input().split())))
dp = [[0]*(W+1) for i in range(N+1)]
for i in range(1, N+1):
    for j in range(1, W+1):
        if j - lst[i][0] >= 0:
            dp[i][j] = max(dp[i-1][j], dp[i-1][j-lst[i][0]]+lst[i][1])
        else:
            dp[i][j] = dp[i-1][j]

print(dp[N][W])


Fixed submission:
N, W = map(int, input().split())
lstW = []
lstV = []
for i in range(N):
    w, v = map(int, input().split())
    lstW.append(w)
    lstV.append(v)

dp = [[10**9]*(10**5+1) for _ in range(N+1)]
dp[0][0] = 0
for i in range(N):
    for j in range(10**5+1):
        dp[i+1][j] = min(dp[i+1][j], dp[i][j])
        if dp[i][j] + lstW[i] <= W:
            dp[i+1][j+lstV[i]] = min(dp[i+1][j+lstV[i]], dp[i][j]+lstW[i])
ans = []
for i in range(max(lstV)*N+1):
    if dp[-1][i] <= W:
        ans.append(i)
print(max(ans))
Buggy python submission (verdict: Runtime Error):
D = int(input())
a = 'Christmas'
if D = 22:
    print(a + ' Eve Eve Eve')
elif D = 23:
    print(a + ' Eve Eve')
elif D = 24:
    print(a + ' Eve')
else:
    print(a)

Fixed submission:
D = int(input())
print('Christmas' + ' Eve' * (25 - D))
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
lst = []
for i in range(N):
    lst.append(int(input()))
lst.sort()
dif = 10**9
for i in range(N):
    if lst[i+K-1] - lst[i] < dif:
        dif = lst[i+K-1] - lst[i]
print(dif)

Fixed submission:
N, K = map(int, input().split())
lst = []
for i in range(N):
    x = int(input())
    lst.append(x)
lst.sort()
L = []
for i in range(N - K + 1):
    L.append(lst[i + K -1] - lst[i])
L.sort()
print(L[0])

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
lst = []
for i in range(N):
    lst.append(int(input()))
lst.sort()
dif = 10**9
for i in range(K):
    if lst[i+K-1] - lst[i] < dif:
        dif = lst[i+K-1] - lst[i]
print(dif)

Fixed submission:
N, K = map(int, input().split())
lst = []
for i in range(N):
    x = int(input())
    lst.append(x)
lst.sort()
L = []
for i in range(N - K + 1):
    L.append(lst[i + K -1] - lst[i])
L.sort()
print(L[0])
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
x = M//N
max = 1
for i in range(x+1, 1, -1):
    mod = M - (N-1)*i
    if mod%i == 0:
        max = i
        break
print(max)

Fixed submission:
N = int(input())
if N == 1:
  print('Hello World')
else:
  A = int(input())
  B = int(input())
  print(A + B)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
x = M//N
max = 1
for i in range(x+1, 1, -1):
    mod = M - (N-1)*i
    if mod%i == 0:
        max = i
        break
print(max)

Fixed submission:
N = int(input())
if N == 1:
  print('Hello World')
else:
  A = int(input())
  B = int(input())
  print(A + B)

Buggy python submission (verdict: Runtime Error):
N, T = map(int, input().split())
ans = []
for i in range(N):
  c, t = map(int, input().split())
  if t <= T:
    ans.append(c)
if not ans:
  print('TLE')
else:
  ans.sort()
  print(ans[0])

Fixed submission:
N = int(input())
if N == 1:
  print('Hello World')
else:
  A = int(input())
  B = int(input())
  print(A + B)
Buggy python submission (verdict: Runtime Error):
N, T = map(int, input().split())
ans = []
for i in range(N):
  c, t = map(int, input().split())
  if t <= T:
    ans.append(c)
ans.sort()
print(ans[0])

Fixed submission:
N, T = map(int, input().split())
ans = []
for i in range(N):
  c, t = map(int, input().split())
  if t <= T:
    ans.append(c)
if not ans:
  print('TLE')
else:
  ans.sort()
  print(ans[0])
Buggy python submission (verdict: Runtime Error):
import math
N, M = map(int, input().split())
x = M//N
mid = int(math.sqrt(M))
if x >= mid:
    ans = []
    for i in range(1, mid+1):
        ans.append(i)
        if M%i == 0:
            ans.append(i)
            if M//i <= x:
                ans.append(M//i)
    print(max(ans))
else:
    for i in rreversed(range(1, x+1)):
        if M%i == 0:
            print(i)
            break

Fixed submission:
N, M = map(int, input().split())
x = M//N
max = 1
for i in range(x, 0, -1):
    mod = M - (N-1)*i
    if mod%i == 0:
        max = i
        break
print(max)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
x = M//N
max = 1
for i in range(1, x+1):
    mod = M - (N-1)*i
    if mod%i == 0:
        if max < i:
            max = i
print(max)

Fixed submission:
N, M = map(int, input().split())
x = M//N
max = 1
for i in range(x, 0, -1):
    mod = M - (N-1)*i
    if mod%i == 0:
        max = i
        break
print(max)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
x = M//N
max = 1
for i in range(1, x+1):
    mod = M - (N-1)*i
    if mod%i == 0:
        if max < i:
            max = i
print(max)

Fixed submission:
N, M = map(int, input().split())
x = M//N
max = 1
for i in range(x, 0, -1):
    mod = M - (N-1)*i
    if mod%i == 0:
        max = i
        break
print(max)
Buggy python submission (verdict: Runtime Error):
from collections import Counter
 
s = input()
t = input()
 
c1 = Counter(s).most_common()
c2 = Counter(t).most_common()

for i, j in zip(c1, c2):
  if i[1] != j[1]:
    print('No')
    break
else:
  print('Yes')

Fixed submission:
lst = list(map(int, input().split()))
lst.sort(reverse=True)
n = lst[0] * 10 + lst[1] + lst[2]
print(n)
Buggy python submission (verdict: Runtime Error):
N, M, X, Y = map(int, input().split())
lstX = list(map(int, input(split()))).sort(reverse=True)
lstY = list(map(int, input(split()))).sort()
if lstX[0] > X and lstX[0] + 1 <= lstY[0] and lstX[0] + 1 <= Y:
    print('No War')
elif lstX[0] < X and X + 1 <= lstY[0] and X + 1 <= Y:
    print('No War')
else:
    print('War')

Fixed submission:
N, M, X, Y = map(int, input().split())
lstX = list(map(int, input().split()))
lstY = list(map(int, input().split()))
lstX.sort(reverse=True)
lstY.sort()
#print(lstX)
#print(lstY)
if lstX[0] > X and lstX[0] + 1 <= lstY[0] and lstX[0] + 1 <= Y:
    print('No War')
elif lstX[0] < X and X + 1 <= lstY[0] and X + 1 <= Y:
    print('No War')
else:
    print('War')
Buggy python submission (verdict: Time Limit Exceeded):
N, X = map(int, input().split())
lst = list(map(int, input().split()))
ans = []
for i in lst:
    ans.append(abs(i-X))
small = min(ans)
for i in ans:
    if i%small == 0:
        continue
    else:
        while i != small:
            i = i%small
            small = small - i
print(small)

Fixed submission:
N, X = map(int, input().split())
lst = list(map(int, input().split()))
ans = []
for i in lst:
    ans.append(abs(i-X))
small = min(ans)
for i in ans:
    if i%small != 0:
        while i%small != 0:
            i = i%small
            small = small - i
print(small)

Buggy python submission (verdict: Time Limit Exceeded):
N, X = map(int, input().split())
lst = list(map(int, input().split()))
ans = []
for i in lst:
    ans.append(abs(i-X))
small = min(ans)
for i in ans:
    if i%small == 0:
        continue
    else:
        while i != small:
            i = i - small
            if i < small:
                small = small - i
print(small)

Fixed submission:
N, X = map(int, input().split())
lst = list(map(int, input().split()))
ans = []
for i in lst:
    ans.append(abs(i-X))
small = min(ans)
for i in ans:
    if i%small != 0:
        while i%small != 0:
            i = i%small
            small = small - i
print(small)
Buggy python submission (verdict: Runtime Error):
S = list(input())
K = int(input())
i = 0
while S[i] == '1':
    i += 1
if K > i:
    print(int(S[i]))
else:
    print(1)

Fixed submission:
S = list(input())
S.append('0')
K = int(input())
i = 0
while S[i] == '1':
    i += 1
if K > i:
    print(int(S[i]))
else:
    print(1)
Buggy python submission (verdict: Time Limit Exceeded):
N, M, Q = map(int, input().split())
slst = []
elst = []
for i in range(M):
    a, b = map(int, input().split())
    slst.append(a)
    elst.append(b)

question = []
for k in range(Q):
    cnt = 0
    c, d = map(int, input().split())
    cnt = 0    
    for i, j in zip(slst, elst):
        if i >= c and j<= d:
            cnt += 1
    print(cnt)

Fixed submission:
N, M, Q = map(int, input().split())
lst = []
cnt = [0]*N
ans = [0]*Q
for i in range(M):
    a, b = map(int, input().split())
    lst.append([b, a, 't'])
for i in range(Q):
    a, b = map(int, input().split())
    lst.append([b, a+500, i])
lst.sort()
for i in lst:
    if i[2] == 't':
        cnt[i[1]-1] += 1
    else:
        ans[i[2]] = sum(cnt[i[1]-501:i[0]])
for j in ans:
    print(j)

Buggy python submission (verdict: Time Limit Exceeded):
N, M, Q = map(int, input().split())
slst = []
elst = []
for i in range(M):
    a, b = map(int, input().split())
    slst.append(a)
    elst.append(b)

question = []
for j in range(Q):
    c, d = map(int, input().split())
    question.append([c, d])

for x in question:
    cnt = 0    
    for i, j in zip(slst, elst):
        if i >= x[0] and j<= x[1]:
            cnt += 1
    print(cnt)

Fixed submission:
N, M, Q = map(int, input().split())
lst = []
cnt = [0]*N
ans = [0]*Q
for i in range(M):
    a, b = map(int, input().split())
    lst.append([b, a, 't'])
for i in range(Q):
    a, b = map(int, input().split())
    lst.append([b, a+500, i])
lst.sort()
for i in lst:
    if i[2] == 't':
        cnt[i[1]-1] += 1
    else:
        ans[i[2]] = sum(cnt[i[1]-501:i[0]])
for j in ans:
    print(j)
Buggy python submission (verdict: Runtime Error):
from itertools import accumulate
N, M = map(int, input().split())
A = list(map(int, input().split()))

B = [0] + A
C = {}
B = list(accumulate(B))
for i in range(1, len(B)):
    if B[i]%M not in C:
        C[B[i]%M] = 1
    else:
        C[B[i]%M] += 1
ans = 0
for i in C.values():
    ans += i*(i-1)//2
if 0 in C:
    ans += C[0]
print(ans)

Fixed submission:
N, K = map(int, input().split())
if N%K == 0:
  print(0)
else:
  print(1)
Buggy python submission (verdict: Runtime Error):
from itertools import accumulate
N, M = map(int, input().split())
A = list(map(int, input().split()))

B = [0] + A
C = {}
B = list(accumulate(B))
for i in range(1, len(B)):
    if B[i]%M not in C:
        C[B[i]%M] = 1
    else:
        C[B[i]%M] += 1
ans = 0
for i in C.values():
    ans += i*(i-1)//2
ans += C[0]
print(ans)

Fixed submission:
from itertools import accumulate
N, M = map(int, input().split())
A = list(map(int, input().split()))

B = [0] + A
C = {}
B = list(accumulate(B))
for i in range(1, len(B)):
    if B[i]%M not in C:
        C[B[i]%M] = 1
    else:
        C[B[i]%M] += 1
ans = 0
for i in C.values():
    ans += i*(i-1)//2
if 0 in C:
    ans += C[0]
print(ans)

Buggy python submission (verdict: Runtime Error):
from itertools import accumulate
N, M = map(int, input().split())
A = list(map(int, input().split()))

B = [0] + A
C = {}
B = list(accumulate(B))
for i in range(1, N+1):
    if B[i]%M not in C:
        C[B[i]%M] = 1
    else:
        C[B[i]%M] += 1
ans = 0
for i in C.values():
    ans += i*(i-1)//2
ans += C[0]
print(ans)

Fixed submission:
from itertools import accumulate
N, M = map(int, input().split())
A = list(map(int, input().split()))

B = [0] + A
C = {}
B = list(accumulate(B))
for i in range(1, len(B)):
    if B[i]%M not in C:
        C[B[i]%M] = 1
    else:
        C[B[i]%M] += 1
ans = 0
for i in C.values():
    ans += i*(i-1)//2
if 0 in C:
    ans += C[0]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import accumulate
N, M = map(int, input().split())
A = list(map(int, input().split()))

B = [0] + A
B = list(accumulate(B))

ans = []
cnt = 0
for i in range(1, len(B)):
    for j in range(i):
        if (B[i] - B[j])%M == 0:
            cnt += 1
print(cnt)

Fixed submission:
from itertools import accumulate
N, M = map(int, input().split())
A = list(map(int, input().split()))

B = [0] + A
C = {}
B = list(accumulate(B))
for i in range(1, len(B)):
    if B[i]%M not in C:
        C[B[i]%M] = 1
    else:
        C[B[i]%M] += 1
ans = 0
for i in C.values():
    ans += i*(i-1)//2
if 0 in C:
    ans += C[0]
print(ans)
Buggy python submission (verdict: Runtime Error):
A = list(map(int, input().split())
A.sort()
print(-A[0] + A[2])

Fixed submission:
A = list(map(int, input().split()))
A.sort()
print(A[2] - A[0])
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
for i in range(S):
    S = S[-1] + S[:-1]
    if S == T:
        print('Yes')
        exit()
print('No')

Fixed submission:
S = input()
T = input()
for i in range(len(S)):
    S = S[-1] + S[:-1]
    if S == T:
        print('Yes')
        exit()
print('No')
Buggy python submission (verdict: Runtime Error):
S = list(input())
cnt = 0
for i in S:
    if i == '+':
        cnt += 1
    else:
        cnt -= 1
@rint(cnt)

Fixed submission:
S = list(input())
cnt = 0
for i in S:
    if i == '+':
        cnt += 1
    else:
        cnt -= 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
#101 b
n = str(input())
N = int(N)
S = 0
for i in n:
    S += i
if N%S == 0:
    print('Yes')
else:
    print('No')

Fixed submission:
n = str(input())
N = int(n)
S = 0
for i in n:
    S += int(i)
if N%S == 0:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
import math
X = int(input())
n = math.ceil(X**0.5)
lst = []
for i in range(2, n):
  a = 2
  while i**a <= X:
    lst.append(i**a)
    a += 1
lst.sort()
print(lst[-1])

Fixed submission:
import math
X = int(input())
n = math.ceil(X**0.5+1)
lst = []
if X == 1 or X == 2 or X == 3:
  print(1)
  exit()
for i in range(2, n):
  a = 2
  while i**a <= X:
    lst.append(i**a)
    a += 1
lst.sort()
print(lst[-1])
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
K = int(input())
lst = []
for end in range(1, len(s)+1):
    start = 0
    while end < len(s)+1:
        if s[start:end] not in lst:
            lst.append(s[start:end])
        start += 1
        end += 1
lst.sort()
print(lst[K-1])

Fixed submission:
s = input()
K = int(input())
lst = []
for end in range(1, min(K+1, len(s)+1)):
    start = 0
    while end < len(s)+1:
        if s[start:end] not in lst:
            lst.append(s[start:end])
        start += 1
        end += 1
lst.sort()
print(lst[K-1])

Buggy python submission (verdict: Runtime Error):
s = input()
K = int(input())
lst = []
if len(s) == 1:
    print(s)
    exit()
for end in range(1, min(K, len(s))):
    start = 0
    while end < len(s)+1:
        if s[start:end] not in lst:
            lst.append(s[start:end])
        start += 1
        end += 1
lst.sort()
print(lst[-K])

Fixed submission:
s = input()
K = int(input())
lst = []
for end in range(1, min(K+1, len(s)+1)):
    start = 0
    while end < len(s)+1:
        if s[start:end] not in lst:
            lst.append(s[start:end])
        start += 1
        end += 1
lst.sort()
print(lst[K-1])
Buggy python submission (verdict: Runtime Error):
import bisect
N, M, X = map(int, input().split())
lst = list(map(int, input().split()))

a = bisect.bisect_left(lst, M)
print(min(N-a, a)

Fixed submission:
import bisect
N, M, X = map(int, input().split())
lst = list(map(int, input().split()))

a = bisect.bisect_left(lst, X)
print(min(M-a, a))
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
import math
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

N = int(input())
lst = list(map(int, input().split()))
lst.sort()
n = max(lst)
a = bisect.bisect_right(lst, n//2)
x1 = cmb(n, lst[a])
x2 = cmb(n, lst[a-1])
if x1 > x2:
    print(n, lst[a])
else:
    print(n, lst[a-1])

Fixed submission:
import bisect
import math
N = int(input())
lst = list(map(int, input().split()))
lst.sort()
n = max(lst)
a = bisect.bisect_right(lst, n//2)
if abs(math.ceil(n/2)-lst[a]) >= abs(math.ceil(n/2)-lst[a-1]):
    print(n, lst[a-1])
else:
    print(n, lst[a])

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N = int(input())
lst = list(map(int, input().split()))
lst.sort()
n = max(lst)
a = bisect.bisect_right(lst, n//2)
x1 = comb(n, lst[a])
x2 = comb(n, lst[a-1])
if x1 > x2:
    print(n, lst[a])
else:
    print(n, lst[a-1])

Fixed submission:
import bisect
import math
N = int(input())
lst = list(map(int, input().split()))
lst.sort()
n = max(lst)
a = bisect.bisect_right(lst, n//2)
if abs(math.ceil(n/2)-lst[a]) >= abs(math.ceil(n/2)-lst[a-1]):
    print(n, lst[a-1])
else:
    print(n, lst[a])

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N = int(input())
lst = list(map(int, input().split()))
lst.sort()
n = max(lst)
a = bisect.bisect_right(lst, n//2)
x1 = comb(n, lst[a])
x2 = comb(n, lst[a-1])
if x1 > x2:
    print(n, lst[a])
else:
    print(n, lst[a-1])

Fixed submission:
import bisect
import math
N = int(input())
lst = list(map(int, input().split()))
lst.sort()
n = max(lst)
a = bisect.bisect_right(lst, n//2)
if abs(math.ceil(n/2)-lst[a]) >= abs(math.ceil(n/2)-lst[a-1]):
    print(n, lst[a-1])
else:
    print(n, lst[a])
Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
lst1 = list(range(A, A+K))
lst2 = list(range(B-K+1, B+1))
ans = set(lst1 + lst2)
ans = list(sorted(ans))
for i in ans:
  print(i)

Fixed submission:
S = list(input())
if 'a' in S and 'b' in S and 'c' in S:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
lst = list(range(A, B+1))
ans = set(lst[:K] + lst[-K:])
ans = list(sorted(ans))
for i in ans:
  print(i)

Fixed submission:
A, B, K = map(int, input().split())
lst1 = list(range(A, min(A+K, B+1)))
lst2 = list(range(max(B-K+1, A), B+1))
ans = set(lst1 + lst2)
ans = list(sorted(ans))
for i in ans:
  print(i)

Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
lst = list(range(A, B+1))
ans = set(lst[:K] + lst[-K:])
ans = sorted(ans)
for i in ans:
  print(i)

Fixed submission:
A, B, K = map(int, input().split())
lst1 = list(range(A, min(A+K, B+1)))
lst2 = list(range(max(B-K+1, A), B+1))
ans = set(lst1 + lst2)
ans = list(sorted(ans))
for i in ans:
  print(i)

Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
lst = list(range(A, B+1))
ans = lst[:K] + lst[-K:]
for i in ans:
  print(i)

Fixed submission:
A, B, K = map(int, input().split())
lst1 = list(range(A, min(A+K, B+1)))
lst2 = list(range(max(B-K+1, A), B+1))
ans = set(lst1 + lst2)
ans = list(sorted(ans))
for i in ans:
  print(i)

Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
lst = range(A, B+1)
ans = lst[:K] + lst[-K-1:]
for i in ans:
  print(i)

Fixed submission:
A, B, K = map(int, input().split())
lst1 = list(range(A, min(A+K, B+1)))
lst2 = list(range(max(B-K+1, A), B+1))
ans = set(lst1 + lst2)
ans = list(sorted(ans))
for i in ans:
  print(i)