Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
#coding:utf-8

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

h=[]
for i in range(N):
    h_i = int(input())
    h.append(h_i)

h = sorted(h)

min_val = 100000000000
for i in range(N-K+1):
    min_val = min(abs(h[i+K-1] - h[i]), min_val)
print(min_val)    


Fixed submission:
#coding:utf-8

D = str(input())

if D == '22':
    print('Christmas Eve Eve Eve')
elif D == '23':
    print('Christmas Eve Eve')
elif D == '24':
    print('Christmas Eve')
elif D == '25':
    print('Christmas')

Buggy python submission (verdict: Runtime Error):
#coding:utf-8

N = input()

p = []
max_val = -1
for i in range(N):
    p_i = input()
    p.append(p_i)
    max_val = max(max_val, p_i)

sum = 0
flag = 0
for p_i in p:
    if p_i == max_val and flag==0:
        sum += p_i * 0.5
        flag = 1
    else:
        sum += p_i
print(int(sum))

Fixed submission:
#coding:utf-8

D = str(input())

if D == '22':
    print('Christmas Eve Eve Eve')
elif D == '23':
    print('Christmas Eve Eve')
elif D == '24':
    print('Christmas Eve')
elif D == '25':
    print('Christmas')
Buggy python submission (verdict: Runtime Error):
#coding:utf-8

N = input()

p = []
max_val = -1
for i in range(N):
    p_i = input()
    p.append(p_i)
    max_val = max(max_val, p_i)

s = 0
flag = 0
for p_i in p:
    if p_i == max_val and flag==0:
        s += p_i * 0.5
        flag = 1
    else:
        s += p_i
print(int(s))
        


Fixed submission:
#coding:utf-8

N = int(input())
p = []
max_val = -1
for i in range(N):
    p_i = int(input())
    p.append(p_i)
    max_val = max(max_val, p_i)

s = 0
flag = 0
for p_i in p:
    if p_i == max_val and flag==0:
        s += p_i * 0.5
        flag = 1
    else:
        s += p_i
print(int(s))

Buggy python submission (verdict: Runtime Error):
#coding:utf-8

N = input()

p = []
max_val = -1
for i in range(N):
    p_i = input()
    p.append(p_i)
    max_val = max(max_val, p_i)

sum = 0
flag = 0
for p_i in p:
    if p_i == max_val and flag==0:
        sum += p_i * 0.5
        flag = 1
    else:
        sum += p_i
print(int(sum))
        


Fixed submission:
#coding:utf-8

N = int(input())
p = []
max_val = -1
for i in range(N):
    p_i = int(input())
    p.append(p_i)
    max_val = max(max_val, p_i)

s = 0
flag = 0
for p_i in p:
    if p_i == max_val and flag==0:
        s += p_i * 0.5
        flag = 1
    else:
        s += p_i
print(int(s))
Buggy python submission (verdict: Runtime Error):
#coding:utf-8
import math
N, M = map(int, input().split())
yakusu = []
for i in range(2, min(int(M / N) + 1, int(math.sqrt(M)) + 1)):
    if M % i == 0:
        yakusu.append(i)
        if int(M / i) * N < M:
            yakusu.append(int(M / i))
print(max(yakusu))

Fixed submission:
#coding:utf-8
import math
N, M = map(int, input().split())
yakusu = []
for i in range(1, min(int(M / N) + 1, int(math.sqrt(M)) + 1)):
    if M % i == 0:
        yakusu.append(i)
        if int(M / i) * N <= M:
            yakusu.append(int(M / i))
print(max(yakusu))
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input())
print(a*b)

Fixed submission:
a,b = map(int,input().split())

print(a*b)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int, input().split())
A = [int(x)-1 for x in map(int, input().split())]

l = []
place = 0
while True:
    if K==0:
        print(place+1)
        exit()
    l.append(place)
    place = A[place]
    K -= 1
    if place in l:
        ind = l.index(place)
        count = len(l) - ind
        print(l[ind + K%count]+1)
        exit()

Fixed submission:
N,K = map(int, input().split())
A = [int(x)-1 for x in map(int, input().split())]
flag = [False]*N
l = []
place = 0
while True:
    if K==0:
        print(place+1)
        exit()
    l.append(place)
    flag[place]=True
    place = A[place]
    K -= 1
    if flag[place]:
        ind = l.index(place)
        count = len(l) - ind
        print(l[ind + K%count]+1)
        exit()

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int, input().split())
A = [int(x)-1 for x in map(int, input().split())]

l = []
place = 0
while True:
    if K==0:
        print(place+1)
        exit()
    l.append(place)
    place = A[place]
    K -= 1
    if place in l:
        count = len(l) - l.index(place)
        print(l[l.index(place) + K%count]+1)
        exit()

Fixed submission:
N,K = map(int, input().split())
A = [int(x)-1 for x in map(int, input().split())]
flag = [False]*N
l = []
place = 0
while True:
    if K==0:
        print(place+1)
        exit()
    l.append(place)
    flag[place]=True
    place = A[place]
    K -= 1
    if flag[place]:
        ind = l.index(place)
        count = len(l) - ind
        print(l[ind + K%count]+1)
        exit()

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int, input().split())
A = [int(x)-1 for x in map(int, input().split())]

l = []
place = 0
while True:
    if K==0:
        print(place+1)
        exit()
    l.append(place)
    place = A[place]
    K -= 1
    if place in l:
        s = place
        break

l=[]
count = 0
while True:
    l.append(place)
    place = A[place]
    count += 1
    if place == s:
        break
print(l[K%count]+1)



Fixed submission:
N,K = map(int, input().split())
A = [int(x)-1 for x in map(int, input().split())]
flag = [False]*N
l = []
place = 0
while True:
    if K==0:
        print(place+1)
        exit()
    l.append(place)
    flag[place]=True
    place = A[place]
    K -= 1
    if flag[place]:
        ind = l.index(place)
        count = len(l) - ind
        print(l[ind + K%count]+1)
        exit()
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
ab = []
d = [0 for _ in range(M)]
for i in range(M):
  ab.append(list(map(int, input().split())))
  for k in list(map(int, input().split())):
    d[i] += 2**(k-1)
  
infty = 10**8
  
dp = [infty for j in range(2**N)]
#i番目の鍵まで使って状態jにできる最小のコスト
dp[0] = 0

for i in range(M):
  for j in range(2**N):
    dp[j | d[i]] = min(dp[j | d[i]], dp[j] + ab[i][0])

ans = dp[2**N-1] if dp[2**N-1] != infty else -1
print(ans)

Fixed submission:
N, M = map(int, input().split())
ab = []
d = [0 for _ in range(M)]
for i in range(M):
  ab.append(list(map(int, input().split())))
  for k in list(map(int, input().split())):
    d[i] += 2**(k-1)
  
infty = 10**8
  
dp = [infty for j in range(2**N)]
#i番目の鍵まで使って状態jにできる最小のコスト
dp[0] = 0

for i in range(M):
  for j in range(2**N):
    if dp[j|d[i]] > dp[j] + ab[i][0]:
      dp[j | d[i]] =  dp[j] + ab[i][0]

ans = dp[2**N-1] if dp[2**N-1] != infty else -1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for _ in range(N)]
for i in range(N):
    print(max(A[:i]+A[i+1:]))


Fixed submission:
N = int(input())
A = [int(input()) for _ in range(N)]
m = max(A)
max_num = 0
for i in range(N):
    if A[i] == m:
        max_num += 1
        if max_num >1:
            print(m)
        else:
            print(max(A[:i]+A[i+1:]))
    else:
        print(m)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int, input().split()))
ans = []
for i in range(N):
    j = N-i
    count = 0
    k = j
    while k<N+1:
        if k in ans:
            count += 1
        k += j
    if count%2 != a[j-1]:
        ans.append(j)
print(len(ans))
ans = [str(x) for x in ans]
ans = ' '.join(ans)
print(ans)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
boxes = [0 for _ in range(N)]
ans = []
for i in range(N):
    j = N-i
    count = sum([boxes[k] for k in range(j-1,N,j)])
#    k = j*2
#    while k<N+1:
#        if k in ans:
#            count += 1
#        k += j
    if count%2 != a[j-1]:
        ans.append(j)
        boxes[j-1] = 1
print(len(ans))
ans = [str(x) for x in ans]
ans = ' '.join(ans)
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
s = sum(A)
A = A*2

ans = []
for i in range(2):
    ans.append(str(s - sum(A[i+1:N+i-1:2])*2 ))
for i in range(2,N):
    ans.append(str(int(ans[i-2])+(A[i-11]-A[N+i-2])*2))

ans = ' '.join(ans)
print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
s = sum(A)
A = A*2

ans = []
for i in range(2):
    ans.append(str(s - sum(A[i+1:N+i-1:2])*2 ))
for i in range(2,N):
    ans.append(str(int(ans[i-2])+(A[i-1]-A[N+i-2])*2))

ans = ' '.join(ans)
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
XY = [[[] for _ in range(10**5 +1)] for __ in range(2)]
for _ in range(N):
    x, y = map(int, input().split())
    XY[0][x].append(y)
    XY[1][y].append(x)

def DFS(i, XorY=0):
    for next in XY[XorY][i]:
        if visited[1-XorY][next]==0:
            visited[1-XorY][next] = 1
            DFS(next, 1-XorY)
            count[1-XorY] += 1

ans = 0
visited = [[0 for _ in range(10**5 +1)] for __ in range(2)]
for i in range(10**5 +1):
    if XY[0][i]!=[] and visited[0][i]==0:
        visited[0][i]=1
        count = [1,0]
        DFS(i)
        ans += count[0]*count[1]
ans -= N

print(ans)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)

N = int(input())
XY = [[[] for _ in range(10**5 +1)] for __ in range(2)]
for _ in range(N):
    x, y = map(int, input().split())
    XY[0][x].append(y)
    XY[1][y].append(x)

def DFS(i, XorY=0):
    for next in XY[XorY][i]:
        if visited[1-XorY][next]==0:
            visited[1-XorY][next] = 1
            DFS(next, 1-XorY)
            count[1-XorY] += 1

ans = 0
visited = [[0 for _ in range(10**5 +1)] for __ in range(2)]
for i in range(10**5 +1):
    if XY[0][i]!=[] and visited[0][i]==0:
        visited[0][i]=1
        count = [1,0]
        DFS(i)
        ans += count[0]*count[1]
ans -= N

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
R,G,B,N = map(int, input().split())
count = 0
for r in range(N+1):
    for g in range(N+1-r):
        if (N-R*r-G*g) % B ==0 and -1 < N-R*r-G*g :
            count += 1
print(count)

Fixed submission:
R,G,B,N = map(int, input().split())
count = 0
for r in range(N//R +1):
    for g in range((N-r*R)//G + 1):
        if (N-R*r-G*g) % B ==0:
            count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
N,M = list(map(int,input().split()))
d = {}
for i in range(N):
	k,l = list(map(int,input().split()))
	d[k] = l

e = sorted(d.items(),key = lambda x: x[0])

a= 0
ans = 0
for i in range(N):
	a += e[i][1]
	if M > a:
		ans += e[i][0]*e[i][1]
	else:
		ans += e[i][0]*(e[i][1]-a+M)
		break

print(ans)

Fixed submission:
N,M = list(map(int,input().split()))
A = [list(map(int,input().split())) for i in range(N)]
A.sort()

ans = 0
for i in range(N):
	if M > A[i][1]:
		ans += A[i][0]*A[i][1]
		M -= A[i][1]
	else:
		ans += A[i][0]*M
		break

print(ans)

Buggy python submission (verdict: Runtime Error):
N,M = list(map(int,input().split()))
d = {}
for i in range(N):
	k,l = list(map(int,input().split()))
	d[k] = l

d = sorted(d.items(),key = lambda x: x[0])

a= 0
ans = 0
for i in range(N):
	a += d[i][1]
	if M > a:
		ans += d[i][0]*d[i][1]
	else:
		ans += d[i][0]* (d[i][1] - a +M)
		break

print(ans)

Fixed submission:
N,M = list(map(int,input().split()))
A = [list(map(int,input().split())) for i in range(N)]
A.sort()

ans = 0
for i in range(N):
	if M > A[i][1]:
		ans += A[i][0]*A[i][1]
		M -= A[i][1]
	else:
		ans += A[i][0]*M
		break

print(ans)
Buggy python submission (verdict: Runtime Error):
def f(b):
	if b% 4 == 0 or b%4 == 3:
		ans2 = '0'
	else:
		ans2 = '1'
	for i in range(40)
		k = i+1
		c = b // (2**k)
		if c % 2 ==1 and B % 2 == 1:
			ans2 = '0'+ ans2
		else:
			ans2 = '1' + ans2
	return ans2

def add(x,y):
	c = 0
	for i in range(41)
		c += ((int(x[i]) + int(y[i]))%2) * (2**(40-i))
	return c
	
a,b = list(map(int,input().split()))
print(add(f(a),f(b)))

Fixed submission:
def f(n):
	if n%4 == 3:
		return 0
	elif n%4 == 0:
		return n
	elif n%4 == 1:
		return 1
	else:
		return n+1

def xor(x,y):
	c = 0
	k = 0
	while 2**k < max(x,y)+1:
		c += (2**k) * ( (((x//(2**k))%2) + ((y//(2**k))%2)) %2 )
		k += 1
	return c

a,b = list(map(int,input().split()))
print(xor(f(a-1),f(b)))
Buggy python submission (verdict: Runtime Error):
	h.append(xyh[2])

for i in range(101):
	for j in range(101):
		for k in range(n):
			if h[k] != 0:
				height = abs(i-x[k]) + abs(j-y[k]) + h[k]
				break
			
		flag = 0
		for k in range(n):
			if h[k] != max(height- abs(i-x[k]) - abs(j-y[k]) , 0):
				flag = 1
				break
			
		if flag == 0:
			ans = [i,j,height]
			break
		
	
print('{0} {1} {2}'.format(ans[0], ans[1], ans[2]))

Fixed submission:
n = int(input())
x = []
y = []
h = []
ans = [0,0,0]
for i in range(n):
	xyh = list(map(int, input().split()))
	x.append(xyh[0])
	y.append(xyh[1])
	h.append(xyh[2])

for i in range(101):
	for j in range(101):
		for k in range(n):
			if h[k] != 0:
				height = abs(i-x[k]) + abs(j-y[k]) + h[k]
				break
			
		flag = 0
		for k in range(n):
			if h[k] != max(height- abs(i-x[k]) - abs(j-y[k]) , 0):
				flag = 1
				break
			
		if flag == 0:
			ans = [i,j,height]
			break
		
	
print('{0} {1} {2}'.format(ans[0], ans[1], ans[2]))
Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())

count = 0
for x in range(k+1):
    for y in range(x,k+1):
        for z in range(y,k+1):
            if x + y + z == s:
                if x == y == z:
                    count +=1
                elif x == y or y==z:
                    count +=3
                else:
                    count +=6
print(count)

Fixed submission:
k, s = map(int, input().split())

count = 0
for x in range(k+1):
    for y in range(k+1):
        if -1<s-x-y<k+1:
            count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
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:
k, s = map(int, input().split())

count = 0
for x in range(k+1):
    for y in range(k+1):
        if -1<s-x-y<k+1:
            count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
s = input()
sum = 0
for i in range(2**(len(s)-1)):
    term = 0
    for j in range(len(s)-1):
        term *= 10
        if (i//(2**j))%2 == 0:
            sum += term + int(s[j])
            term = 0
            if j == len(s)-2:
                sum += int(s[-1])
        else:
            term += int(s[j])
            if j == len(s)-2:
                sum += term*10 + int(s[-1])
if len(s) = 1:
    sum = int(s)

print(sum)

Fixed submission:
s = input()
sum = 0
for i in range(2**(len(s)-1)):
    term = 0
    for j in range(len(s)-1):
        term *= 10
        if (i//(2**j))%2 == 0:
            sum += term + int(s[j])
            term = 0
            if j == len(s)-2:
                sum += int(s[-1])
        else:
            term += int(s[j])
            if j == len(s)-2:
                sum += term*10 + int(s[-1])
if len(s) == 1:
    sum = int(s)

print(sum)
Buggy python submission (verdict: Runtime Error):
n=str(input())
sum=0
for i in n:
	sum+=int(i)
if sum%9=0:
	print('Yes')
else:
	print("No")

Fixed submission:
n=str(input())
sum=0
for i in n:
	sum+=int(i)
if sum%9==0:
	print('Yes')
else:
	print("No")
Buggy python submission (verdict: Runtime Error):
x, y = map(int, input().split())

for a in range(0, x+1):
    b = x - a
    if a*2 + b*4 == y:
        ans = 'Yes'
        break

print(ans)


Fixed submission:
x, y = map(int, input().split())

for a in range(0, x+1):
    for b in range(0, x+1-a):
        if a + b == x:
            if a*2 + b*4 == y:
                print('Yes')
                exit()

print('No')
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))

a = list(set(a))
a = sorted(a, reverse=True)
ans = 0
count = 0

if len(a) != 1:
    for x in range(0, n-1):
        for y in range(x+1, n):
            if a[x] % a[y] == 0:
                break
            else:
                count += 1

        if count == n - x-1:
            ans += 1
        count = 0
    print(ans + 1)
else:
    print(0)


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

M = 10**6+5

count = [0]*M

for x in range(n):
    if count[a[x]] != 0:
        count[a[x]] = 2
        continue

    for i in range(a[x], M, a[x]):
        count[i] += 1

ans = 0
for x in range(n):
    if count[a[x]] == 1:
        ans += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

ans = 1

for x in range(n):
    if 0 in a:
        ans = 0
        break

    ans *= a[x]

    if ans > 10**18:
        ans = -1
        break


print(ans)


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

ans = 1

a.sort(reverse=True)

if 0 not in a:
    for x in range(n):
        ans *= a[x]

        if ans > 10**18:
            ans = -1
            break
else:
    ans = 0

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

ans = 1
for x in range(n):
    ans *= a[x]


if ans > 10**18:
    print(-1)
else:
    print(ans)


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

ans = 1

a.sort(reverse=True)

if 0 not in a:
    for x in range(n):
        ans *= a[x]

        if ans > 10**18:
            ans = -1
            break
else:
    ans = 0

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
A, B, N = map(int, input().split())
mx = 0
count = 0
for a in range(N, -1, -1):
    count += 1
    new = int(A*a/B) - A*int(a/B)
    mx = max(mx, new)

print(mx)


Fixed submission:
A, B, N = map(int, input().split())

x = min(B-1, N)

ans = int(A*x/B) - A*int(x/B)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
A, B, N = map(int, input().split())
ans = []
old = 0
count = 0
for a in range(N, -1, -1):
    count += 1
    new = int(A*a/B) - A*int(a/B)
    ans.append(new)

print(max(ans))


Fixed submission:
A, B, N = map(int, input().split())

x = min(B-1, N)

ans = int(A*x/B) - A*int(x/B)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
word = 'hi'
if word in S:
    while 1:
        if word == S:
            print('Yes')
            break
        else:
            word += 'hi'
else:
    print('No')

Fixed submission:
import re
S = input()
if re.match(r'^(hi)+$',S):
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
words = [input() for i in range(N)]

word = list(set(words))
counter = list()
dict = {}

for a in word:
    dict[a] = words.count(a)

max = max(dict.values())

for a in word:
    if dict[a] == max:
        continue
    else:
        del dict[a]

dict2 = sorted(dict.keys())

for a in dict2:
    print(a)

Fixed submission:
N = int(input())
words = [input() for i in range(N)]

from collections import Counter

word = list(set(words))

dict = Counter(words)

max = max(dict.values())

for a in word:
    if dict[a] == max:
        continue
    else:
        del dict[a]

dict2 = sorted(dict.keys())

for a in dict2:
    print(a)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
words = [input() for i in range(N)]

word = list(set(words))
counter = list()
dict = {}

for a in word:
    counter.append(words.count(a))

max = max(counter)

for a,b in zip(word,counter):
    dict[a] = b

for a in word:
    if dict[a] == max:
        continue
    else:
        del dict[a]

dict2 = sorted(dict.keys())

for a in dict2:
    print(a)

Fixed submission:
N = int(input())
words = [input() for i in range(N)]

from collections import Counter

word = list(set(words))

dict = Counter(words)

max = max(dict.values())

for a in word:
    if dict[a] == max:
        continue
    else:
        del dict[a]

dict2 = sorted(dict.keys())

for a in dict2:
    print(a)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
p = list(map(int, input().split()))

exv = list()

for a in p:
    exv.append((1+a)/2)

sm = 0
mx = 0

q = list()

for a in range(N):
    sm += exv[a]
    q.append(exv[a])
    if len(q) > K:
        sm -= q.pop(0)
    if len(q) == K:
        mx = max(mx,sm)

print('{:.12f}'.format(mx))

Fixed submission:
N, K = map(int, input().split())
p = list(map(int, input().split()))

from collections import deque

exv = list()

for a in p:
    exv.append((1+a)/2)

sm = 0
mx = 0

q = deque()

for a in range(N):
    sm += exv[a]
    q.appendleft(exv[a])
    if len(q) > K:
        sm -= q.pop()
    if len(q) == K:
        mx = max(mx,sm)

print('{:.12f}'.format(mx))

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
p = list(map(int, input().split()))

exv = list()

for a in p:
    exv.append((1+a)/2)

sm = list()
mx = 0
for a in range(N-K+1):
    mx = max(mx,sum(exv[a:a+K]))

print('{:.12f}'.format(mx))

Fixed submission:
N, K = map(int, input().split())
p = list(map(int, input().split()))

from collections import deque

exv = list()

for a in p:
    exv.append((1+a)/2)

sm = 0
mx = 0

q = deque()

for a in range(N):
    sm += exv[a]
    q.appendleft(exv[a])
    if len(q) > K:
        sm -= q.pop()
    if len(q) == K:
        mx = max(mx,sm)

print('{:.12f}'.format(mx))

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
p = list(map(int, input().split()))

exv = list()

for a in p:
    exv.append((1+a)/2)

sm = list()

for a in range(N-K+1):
    sm.append(sum(exv[a:a+K]))

print('{:.12f}'.format(max(sm)))

Fixed submission:
N, K = map(int, input().split())
p = list(map(int, input().split()))

from collections import deque

exv = list()

for a in p:
    exv.append((1+a)/2)

sm = 0
mx = 0

q = deque()

for a in range(N):
    sm += exv[a]
    q.appendleft(exv[a])
    if len(q) > K:
        sm -= q.pop()
    if len(q) == K:
        mx = max(mx,sm)

print('{:.12f}'.format(mx))
Buggy python submission (verdict: Time Limit Exceeded):
H,N = map(int,input().split())
A = list(map(int,input().split()))
ln = len(A)
count = [0]*len(A)

def fight(A,H,count,ln):
    while 1:
        if A == [0] * ln:
            return 'No'
        if H > 0:
            H -= max(A)
            ix = A.index(max(A))
            count[ix] += 1
            if count[ix] == 1:
                A[ix] = 0
        if H <= 0:
            return 'Yes'

print(fight(A,H,count,ln))

Fixed submission:
H,N = map(int,input().split())
A = list(map(int,input().split()))

if H <= sum(A):
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int,input().split())
H = list(map(int,input().split()))

count = 0
while 1:
    if K > 0:
        H[H.index(max(H))] = 0
        K -= 1
    else:
        break

count += sum(H)

print(count)

Fixed submission:
N, K = map(int,input().split())
H = list(map(int,input().split()))

count = 0
H = sorted(H,reverse=True)

count += sum(H[K:])

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
H = int(input())

from collections import deque

d = deque([H])

count = 0
sm = 0
while 1:
    H //= 2
    count += 1
    sm += 2**count

    if H == 1:
        break

print(sm+1)

Fixed submission:
H = int(input())

from collections import deque

d = deque([H])

count = 0
sm = 0
while 1:
    if H == 1:
        break

    H //= 2
    count += 1
    sm += 2**count

print(sm+1)
Buggy python submission (verdict: Runtime Error):
import math

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

def lcm(a,b):
    y = a*b / math.gcd(a,b)
    return int(y)

print(lcm(A,B))

Fixed submission:
import fractions

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

def lcm(a,b):
    y = a*b / fractions.gcd(a,b)
    return int(y)

print(lcm(A,B))

Buggy python submission (verdict: Runtime Error):
import numpy as np

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

print(np.lcm(A, B))

Fixed submission:
import fractions

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

def lcm(a,b):
    y = a*b / fractions.gcd(a,b)
    return int(y)

print(lcm(A,B))