Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

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

for i in range(N):
    x = X[0:i]+X[i+1:]
    x.sort(reverse=True)

#    print(x)
    print( x[((len(x)+1) // 2)-1] )


Fixed submission:

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

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

x = X[:]
x.sort()
m1 = x[N//2 - 1]
m2 = x[N//2]

for a in X:
    if a <= m1:
        print(m2)
    else:
        print(m1)

Buggy python submission (verdict: Time Limit Exceeded):

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

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

for i in range(N):
    x = X[:]
    x.pop(i)
    x.sort(reverse=True)

#    print(x)
    print( x[((len(x)+1) // 2)-1] )


Fixed submission:

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

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

x = X[:]
x.sort()
m1 = x[N//2 - 1]
m2 = x[N//2]

for a in X:
    if a <= m1:
        print(m2)
    else:
        print(m1)
Buggy python submission (verdict: Time Limit Exceeded):

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)

Fixed submission:

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

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

start = max(b-k+1, a+k)
for i in range(start, b+1):
    print(i)
Buggy python submission (verdict: Time Limit Exceeded):


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

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

def get_key(l):
    return ','.join(map(str, l))

def calc(l):
    if len(l) <= 1:
        dp[get_key(l)] = 0
        return 0

    if get_key(l) in dp:
        return dp[get_key(l)]

    x = abs(l[0]-l[1]) + calc(l[1:])
    dp[get_key(l)] = x
    return x

# 0 3 5 -1 0 みたいに
L = [0] + A + [0]
dp = {}
for i in range(1, N+1):
    l = L[0:i] + L[i+1:]
    print(calc(l))

Fixed submission:

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

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

def calc(l):
    count = 0
    for i in range(len(l)-1):
        count += abs(l[i]-l[i+1])

    return count

# 0 3 5 -1 0 みたいに
L = [0] + A + [0]
max_L = calc(L)
#print(max_L)

# 左右引いて、左右通しで計算すればいい
for i in range(1, N+1):
    diff_minus = abs(L[i-1]-L[i])+abs(L[i]-L[i+1])
    diff_plus = abs(L[i-1]-L[i+1])
    print(max_L-diff_minus+diff_plus)

Buggy python submission (verdict: Time Limit Exceeded):


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

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

def get_key(l):
    return ','.join(map(str, l))

def calc(l):
    if len(l) <= 1:
        dp[get_key(l)] = 0
        return 0

#    print(l)
    x = abs(l[0]-l[1]) + calc(l[1:])
    dp[get_key(l)] = x
    return x

# 0 3 5 -1 0 みたいに
L = [0] + A + [0]
dp = {}
for i in range(1, N+1):
    l = L[0:i] + L[i+1:]
    print(calc(l))

Fixed submission:

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

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

def calc(l):
    count = 0
    for i in range(len(l)-1):
        count += abs(l[i]-l[i+1])

    return count

# 0 3 5 -1 0 みたいに
L = [0] + A + [0]
max_L = calc(L)
#print(max_L)

# 左右引いて、左右通しで計算すればいい
for i in range(1, N+1):
    diff_minus = abs(L[i-1]-L[i])+abs(L[i]-L[i+1])
    diff_plus = abs(L[i-1]-L[i+1])
    print(max_L-diff_minus+diff_plus)

Buggy python submission (verdict: Time Limit Exceeded):

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

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

def calc(l):
    count = 0
    for i in range(len(l)-1):
        count += abs(l[i]-l[i+1])

    return count

# 0 3 5 -1 0 みたいに
L = [0] + A + [0]
for i in range(1, N+1):
    l = L[0:i] + L[i+1:]
    print(calc(l))


Fixed submission:

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

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

def calc(l):
    count = 0
    for i in range(len(l)-1):
        count += abs(l[i]-l[i+1])

    return count

# 0 3 5 -1 0 みたいに
L = [0] + A + [0]
max_L = calc(L)
#print(max_L)

# 左右引いて、左右通しで計算すればいい
for i in range(1, N+1):
    diff_minus = abs(L[i-1]-L[i])+abs(L[i]-L[i+1])
    diff_plus = abs(L[i-1]-L[i+1])
    print(max_L-diff_minus+diff_plus)
Buggy python submission (verdict: Runtime Error):
x

Fixed submission:


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

# http://mkan-0141.hatenablog.com/entry/2018/02/18/224008


C = []
for i in range(3):
    x = list(map(int, input().split()))
    C.append(x)

if(C[0][0] - C[0][1] == C[1][0] - C[1][1] and # a1のb1<>b2 と a2のb1<>b2の比較
   C[1][0] - C[1][1] == C[2][0] - C[2][1] and # a2のとa3の b1<>b2の比較
   C[0][1] - C[0][2] == C[1][1] - C[1][2] and # a0のとa1のb2<>b3の比較
   C[1][1] - C[1][2] == C[2][1] - C[2][2]):   # a2のとa3のb2<>b3の比較
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):

import math

def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]


# まずは素数表を作る
ten5 = 10**5

x = get_sieve_of_eratosthenes(ten5)
P = [0] * (ten5+1)
for c in x:
    P[c] = 1

Q = int(input())
for _ in range(Q):
    l, r = map(int, input().split())
    count = 0
    for i in range(l, r+1):
        if P[i] == 1 and ( P[(i+1) // 2] == 1 ):
            count += 1

    print(count)


Fixed submission:
import math

def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]


# まずは素数表を作る
ten5 = 10**5

# x = 素数一覧
x = get_sieve_of_eratosthenes(ten5)

# P = 素数表(1 = 素数)
P = [0] * (ten5+1)

# LIKE = 似た数表
LIKE = [0] * (ten5+1)
for i in x:
    P[i] = 1

    if i == 2:
        LIKE[i] = 1
        continue

    # i は素数
    like = ((i+1)//2)
    LIKE[i] = P[like]

S = [0] * (ten5+1)
S[0] = LIKE[0]
for i in range(1, ten5+1):
    S[i] = S[i-1] + LIKE[i]


Q = int(input())
for _ in range(Q):
    l, r = map(int, input().split())

    ans = S[r]-S[l-1]
    if l <= 1:
        ans -= 1

    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

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

ans = 0
for a in A:
    ans = max(ans, (A.count(a-1) + A.count(a) + A.count(a+1)))

print(ans)

Fixed submission:

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

import collections

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

c = collections.Counter(A)

ans = 0
for a in A:
    tmp = c[a-1] + c[a] + c[a+1]
    ans = max(ans, tmp)

print(ans)
Buggy python submission (verdict: Runtime Error):

import sys
input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# A = [ int(input()) for _ in range(N) ]
##############################

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

count = 0
for i in range(N):
    if P[i] == i+1:
        x = P[i]
        P[i] = P[i+1]
        P[i+1] = x
        count += 1

print(count)

Fixed submission:

import sys
input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# A = [ int(input()) for _ in range(N) ]
##############################

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

P.append(0) # 番兵

count = 0
for i in range(N):
    if P[i] == i+1:
        x = P[i]
        P[i] = P[i+1]
        P[i+1] = x
        count += 1

print(count)
Buggy python submission (verdict: Time Limit Exceeded):

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

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

ans = []
for i in A:
    ans.append(i)
    ans.reverse()

print(*ans)

Fixed submission:

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

from collections import deque

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

if N == 1:
    print(A[0])
    exit()

d = deque()
if N % 2 == 0:
    for i in range(N):
        if i%2 == 1:
            d.appendleft(A[i])
        else:
            d.append(A[i])
else:
    for i in range(N):
        if i%2 == 0:
            d.appendleft(A[i])
        else:
            d.append(A[i])

print(*d)
Buggy python submission (verdict: Time Limit Exceeded):

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

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

ans = 0
for i in range(2 ** N):
    box = []
    for j in range(N):
        if ((i >>  j) & 1):
            box.append(S[j])

    x = sum(box)
    if x % 10 == 0:
        x = 0
    ans = max(ans, x)

#    print(box)

print(ans)

Fixed submission:


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

def calc_sum(s):
    if s % 10 == 0:
        return 0
    else:
        return s

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

ans = calc_sum(sum(S))
if ans > 0:
    print(ans)
    exit()

ans = 0
for i in range(N):
    s = S[0:i] + S[i+1:]
    ans = max(ans, calc_sum(sum(s)))

print(ans)
Buggy python submission (verdict: Runtime Error):
x

Fixed submission:

import sys
input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# A = [ int(input()) for _ in range(N) ]
##############################

N = int(input())

a = 1
ans = len(str(N))

while a*a <= N:
    if N%a == 0:
        b = N//a
        tmp = len(str(b))
        ans = min(ans, tmp)
    a += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

K, S = map(int, input().split())

count = 0
for x in range(K+1):
    for y in range(K+1):
        for z in range(K+1):
            if x+y+z == S:
                count += 1

print(count)

Fixed submission:


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

K, S = map(int, input().split())

count = 0
for x in range(K+1):
    for y in range(K+1):
        z = S-x-y
        if 0 <= z <= K:
            count += 1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

K, S = map(int, input().split())

count = 0
for x in range(K+1):
    for y in range(K+1):
        for z in range(K+1):
            if x+y+z == S:
                count += 1

print(count)

Fixed submission:


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

K, S = map(int, input().split())

count = 0
for x in range(K+1):
    for y in range(K+1):
        z = S-x-y
        if 0 <= z <= K:
            count += 1

print(count)
Buggy python submission (verdict: Runtime Error):

import sys
input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# A = [ int(input()) for _ in range(N) ]
##############################

S = input().rstrip()
l = list(S)
N = len(l)

def getbit(i, length):
    return format(i, '0' + str(length) + 'b')

bits = []
for i in range(2**(N-1)):
    bits.append(getbit(i, N-1))


ans = 0

for i in range(len(bits)):
    s = str(l[0])

    bitlist = list(bits[i])
    for j in range(len(bitlist)):
        if bitlist[j] == '0':
            pass
        else:
            s += '+'

        s += str(l[j+1])
    ans += eval(s)

print(ans)

Fixed submission:

import sys
input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# A = [ int(input()) for _ in range(N) ]
##############################

S = input().rstrip()
l = list(S)
N = len(l)

if S == '1':
    print(1)
    exit()

def getbit(i, length):
    return format(i, '0' + str(length) + 'b')

bits = []
for i in range(2**(N-1)):
    bits.append(getbit(i, N-1))


ans = 0

for i in range(len(bits)):
    s = str(l[0])

    bitlist = list(bits[i])
    for j in range(len(bitlist)):
        if bitlist[j] == '0':
            pass
        else:
            s += '+'

        s += str(l[j+1])

    ans += eval(s)

print(ans)
Buggy python submission (verdict: Runtime Error):
n,k = list(map(int, input().split()))
v = list(map(int, input().split()))

dp=[[[-1 for i in range(k+1)] for j in range(n+1)] for l in range(n+1)]

def f(a, b, d):
    if d == 0: return 0
    if a == b and d > 1 and v[a] > 0: return v[a]
    if dp[a][b][d] != -1: return dp[a][b][d]
    maxi = max(v[a] + f(a+1, b, d - 1), v[b] + f(a, b - 1, d - 1))
    if v[a] < 0 and d > 1:
        maxi = max(maxi, f(a + 1, b, d - 2))
    if v[b] < 0 and d > 1:
        maxi = max(maxi, f(a, b - 1, d - 2))
    maxi = max(maxi, 0)
    dp[a][b][d]=maxi
    return maxi


print(f(0, n-1, k))

Fixed submission:
n,k = list(map(int, input().split()))
v = list(map(int, input().split()))

dp=[[[-1 for i in range(k+1)] for j in range(n+1)] for l in range(n+1)]

def f(a, b, d):
    if d == 0: return 0
    if a == b and d > 1 and v[a] > 0: return v[a]
    if a == b and d > 1 and v[a] <= 0: return 0
    if dp[a][b][d] != -1: return dp[a][b][d]
    maxi = max(v[a] + f(a+1, b, d - 1), v[b] + f(a, b - 1, d - 1))
    if v[a] < 0 and d > 1:
        maxi = max(maxi, f(a + 1, b, d - 2))
    if v[b] < 0 and d > 1:
        maxi = max(maxi, f(a, b - 1, d - 2))
    maxi = max(maxi, 0)
    dp[a][b][d]=maxi
    return maxi


print(f(0, n-1, k))
Buggy python submission (verdict: Runtime Error):
a,b = list(map(int, input().split()))
if a % 2 == 0:
  if a / 2 >= b:
    print("YES")
  else:
    print("NO")
else:
  if (a + 1) / 2 >= b:
    print("YES")
  else:
	print("NO")

Fixed submission:
a,b = list(map(int, input().split()))
if a % 2 == 0:
    if a / 2 >= b:
        print("YES")
    else:
        print("NO")
else:
    if (a + 1) / 2 >= b:
        print("YES")
    else:
        print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
import sys
n, k = list(map(int, sys.stdin.readline().split()))
arr = list(map(int, sys.stdin.readline().split()))
 
dp = [100000000000] * n
 
dp[0] = 0
dp[1] = dp[0] + abs(arr[1] - arr[0])
 
for i in range(2, len(arr)):
	for j in range(1, k + 1):
		if (i - j < 0): continue
		dp[i] = min(dp[i - j] + abs(arr[i - j] - arr[i]), dp[i])
 
print(dp[len(arr) - 1])

Fixed submission:
import sys
n, k = list(map(int, sys.stdin.readline().split()))
arr = list(map(int, sys.stdin.readline().split()))

dp = [100000000000] * n

dp[0] = 0
dp[1] = dp[0] + abs(arr[1] - arr[0])

for i in range(2, len(arr)):
	for j in range(1, k + 1):
		if (i - j < 0): continue
		dp[i] = min(dp[i - j] + abs(arr[i - j] - arr[i]), dp[i])

print(dp[len(arr) - 1])
Buggy python submission (verdict: Runtime Error):
n=int(input())
v=list(map(int, input().split()))
dp=[[-1] * n for i in range(n)]
def f(a, b):
    if a > b:
        return 0
    elif a == b:
        return v[a]
    elif dp[a][b] == -1:
        c1 = v[a] + min(f(a + 2, b), f(a + 1, b - 1))
        c2 = v[b] + min(f(a, b - 2), f(a + 1, b - 1))
        dp[a][b] = max(c1, c2)
    return dp[a][b]

print(2*f(0, n-1) - sum(v))

Fixed submission:
n=int(input())
v=list(map(int, input().split()))
dp=[[-1] * n for i in range(n)]
def f(a, b):
    if a > b:
        return 0
    elif a == b:
        return v[a]
    elif dp[a][b] == -1:
        c1 = v[a] + min(f(a + 2, b), f(a + 1, b - 1))
        c2 = v[b] + min(f(a, b - 2), f(a + 1, b - 1))
        dp[a][b] = max(c1, c2)
    return dp[a][b]

print(2*f(0, n-1) - sum(v))
Buggy python submission (verdict: Runtime Error):
import math
a = int(input())
if ((a > 0) & (a < 100001)):
    data_size = int (math.log10(a) + 1)
    if a == 100000:
        print(90909)
    elif data_size == 5:
        print(a - 10000 + 1 + 909)
    elif data_size == 4:
        print(909)
    elif data_size == 3:
        print(a - 100 + 1 + 9)
    elif data_size == 2:   
        print(9)
    elif data_size == 1:   
        print(a - 1 + 1)

Fixed submission:
a,b,c=(int(x) for x in input().split())
if ((c - (a - b)) < 0):
    print(0)
else:
    print(c - (a - b))

Buggy python submission (verdict: Runtime Error):
import math
a = int(input())
data_size = int (math.log10(a) + 1)
if a == 100000:
    print(90909)
elif data_size == 5:
    print(a - 10000 + 1 + 909)
elif data_size == 4:
    print(909)
elif data_size == 3:
    print(a - 100 + 1 + 9)
elif data_size == 2:   
    print(9)
elif data_size == 1:   
    print(a - 1 + 1)

Fixed submission:
a,b,c=(int(x) for x in input().split())
if ((c - (a - b)) < 0):
    print(0)
else:
    print(c - (a - b))
Buggy python submission (verdict: Runtime Error):
x = input()
print(3 * x ** 2)

Fixed submission:
x = int(input())
print(3 * x ** 2)
Buggy python submission (verdict: Runtime Error):
N,X=map(int,input().split())
L=list(map(int,input().split()))
ans=0
tmp=0
for i in range(N+1):
    if tmp>X:
        break
    tmp+=L[i]
    ans+=1
print(ans)

Fixed submission:
N,X=map(int,input().split())
L=[0]+list(map(int,input().split()))
ans=0
tmp=0
for i in range(N+1):
    tmp+=L[i]
    if tmp>X:
        break
    else:
        ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
import collections 
N=int(input())
T=[list(map(int,input().split())) for _ in range(N)]
T.sort(reverse=True)
TMP=[]
if N==1:
    print(1)
else:
    for i in range(N-1):
        for b in range(i,N-1):
            TMP.append((T[i][0]-T[b+1][0],T[i][1]-T[b+1][1]))
c=collections.Counter(TMP)
print(N-c.most_common(n=1)[0][1])

Fixed submission:
import collections 
N=int(input())
T=[list(map(int,input().split())) for _ in range(N)]
T.sort(reverse=True)
TMP=[]
if N==1:
    print(1)
else:
    for i in range(N-1):
        for b in range(i,N-1):
            TMP.append((T[i][0]-T[b+1][0],T[i][1]-T[b+1][1]))
    c=collections.Counter(TMP)
    print(N-c.most_common(n=1)[0][1])
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
ans=0
c=0
tmp=10**9
for a in A:
    if a<0:
        c+=1
    ans+=abs(a)
    tmp=min(tmp,abs(a))
if c%2==0:
    print(ans)
else:
    print(ans-tmp*2)

Fixed submission:
A,B,T=map(int,input().split())
print(int((T+0.5)//A*B))
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=input()
i=S.index(".")
if i==0:
    print(0)
else:
    print(S.count("."))

Fixed submission:
N=int(input())
S=input()
num=S.count(".")
ans=num
for i in S:
    if i=="#":
        num+=1
    else:
        num-=1
    ans=min(ans,num)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
A,B=map(int,input().split())
c=0
for a in range(A,B+1):
    c^=a
print(c)

Fixed submission:
A,B=map(int,input().split())
def calc(A):
    if A%4==0:
        return A
    elif A%4==1:
        return 1
    elif A%4==2:
        return A+1
    elif A%4==3:
        return 0
print(calc(A-1)^calc(B))
Buggy python submission (verdict: Time Limit Exceeded):
S=input()
count=0
while True:
    D=S.replace("10","").replace("01","")
    a=abs(len(S)-len(D))
    count+=a
    if a==0:
        print(count)
        break
    S=D

Fixed submission:
S=input()
count=0
o=S.count("1")
z=S.count("0")
if o>=z:
    print(z*2)
else:
    print(o*2)

Buggy python submission (verdict: Time Limit Exceeded):
S=input()
count=0
while True:
    D=S.replace("10","").replace("01","")
    a=abs(len(S)-len(D))
    count+=a
    if a==0:
        print(count)
        break
    S=D

Fixed submission:
S=input()
count=0
o=S.count("1")
z=S.count("0")
if o>=z:
    print(z*2)
else:
    print(o*2)

Buggy python submission (verdict: Time Limit Exceeded):
S=input()
count=0
while True:
    S=S.replace("01","z")
    S=S.replace("10","z")
    count+=S.count("z")*2
    if S.count("z")==0:
        print(count)
        break
    S=S.replace("z","")

Fixed submission:
S=input()
count=0
o=S.count("1")
z=S.count("0")
if o>=z:
    print(z*2)
else:
    print(o*2)
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split(" "))
H=[int(input()) for _ in range(N)]
H.sort()
tmax=10**9
for a in range(N-K+1):
    h1,h2=H[a],H[a+K]
    tmax=min(tmax,abs(h1-h2))
    if(tmax==0):
        break
print(tmax)

Fixed submission:
D=int(input())
if D==25:
    print("Christmas")
elif D==24:
    print("Christmas Eve")
elif D==23:
    print("Christmas Eve Eve")
elif D==22:
    print("Christmas Eve Eve Eve")
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split(" "))
H=[int(input()) for _ in range(N)]
H.sort()
tmax=10**9
for a in range(N-K+1):
    h1,h2=H[a],H[a+K]
    tmax=min(tmax,abs(h1-h2))
    if(tmax==0):
        break
print(tmax)

Fixed submission:
N,K=map(int,input().split(" "))
H=[int(input()) for _ in range(N)]
H.sort()
tmax=10**9
for a in range(N-K+1):
    h1,h2=H[a],H[a+K-1]
    tmax=min(tmax,abs(h1-h2))
    if(tmax==0):
        break
print(tmax)

Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split(" "))
H=[int(input()) for _ in range(N)]
H.sort()
tmax=10**9
for a in range(N-K+1):
    h=H[a:K+a]
    tmax=min(tmax,abs(h[-1]-h[0]))
print(tmax)

Fixed submission:
N,K=map(int,input().split(" "))
H=[int(input()) for _ in range(N)]
H.sort()
tmax=10**9
for a in range(N-K+1):
    h1,h2=H[a],H[a+K-1]
    tmax=min(tmax,abs(h1-h2))
    if(tmax==0):
        break
print(tmax)
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
if(N%K==0):
  print(0)
 else:
  print(1)

Fixed submission:
N,K=map(int,input().split())
if(N%K==0):
  print(0)
else:
  print(1)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
ans=[]
for i in range(N):
        if N%2==0:
                if i%2==0:
                        ans.append(A[i])
                else:
                        ans.insert(0,A[i])
        else:
                if i%2==0:
                        ans.insert(0,A[i])
                else:
                        ans.append(A[i])             
print(*ans,sep=" ")

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
ans=[0 for i in range(N)]
c=0
d=0
for i in range(N):
        if N%2==0:
                if i%2==0:
                        ans[N//2+c]=A[i]
                        c+=1
                else:
                        ans[N//2-1-d]=A[i]
                        d+=1
        else:
                if i%2==0:
                        ans[N//2-d]=A[i]
                        d+=1
                else:
                        ans[N//2+1+c]=A[i]
                        c+=1 
print(*ans,sep=" ")