Buggy python submission (verdict: Runtime Error):

from itertools import accumulate
n,k = list(map(int,input().split()))
p = list(map(int,input().split()))

P = list(accumulate([(i+1)/2 for i in p]))
ans = max([P[i+k]-P[i] for i in range(n-k)])
print(ans)

Fixed submission:
from itertools import accumulate
n,k = list(map(int,input().split()))
p = list(map(int,input().split()))

P = list(accumulate([(i+1)/2 for i in p]))
P = [0] + P
ans = max([P[i+k]-P[i] for i in range(n-k+1)])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import accumulate
n,k = list(map(int,input().split()))
p = list(map(int,input().split()))

P = [(i+1)/2 for i in p]
ans = max([sum(P[i:i+k]) for i in range(n-k+1)])

print(ans)

Fixed submission:
from itertools import accumulate
n,k = list(map(int,input().split()))
p = list(map(int,input().split()))

P = list(accumulate([(i+1)/2 for i in p]))
P = [0] + P
ans = max([P[i+k]-P[i] for i in range(n-k+1)])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import accumulate
n,k = list(map(int,input().split()))
p = list(map(int,input().split()))

P = [(list(accumulate([x for x in range(i+1)]))[-1])/i for i in p]
ans = max([sum(P[i:i+k]) for i in range(n-k+1)])

print(ans)


Fixed submission:
from itertools import accumulate
n,k = list(map(int,input().split()))
p = list(map(int,input().split()))

P = list(accumulate([(i+1)/2 for i in p]))
P = [0] + P
ans = max([P[i+k]-P[i] for i in range(n-k+1)])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,k = list(map(int,input().split()))
p = np.array(list(map(int,input().split())))

P = [p[i:i+k].sum() for i in range(n-k+1)]
mp = p[np.argmax(P):np.argmax(P)+k]

ans = 0
for i in mp:
  j = i//2
  if i%2 == 0:
    ans += ((i+1)*j)/i
  else:
    ans += ((i+1)*j + j + 1)/i

print(ans)


Fixed submission:
from itertools import accumulate
n,k = list(map(int,input().split()))
p = list(map(int,input().split()))

P = list(accumulate([(i+1)/2 for i in p]))
P = [0] + P
ans = max([P[i+k]-P[i] for i in range(n-k+1)])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,k = list(map(int,input().split()))
p = np.array(list(map(int,input().split())))

P = np.zeros(n)
for i in range(n-k+1):
  P[i] = p[i:i+k].sum()

mp = p[np.argmax(P):np.argmax(P)+k]

ans = 0
for i in mp:
  j = i//2
  if i%2 == 0:
    ans += ((i+1)*j)/i
  else:
    ans += ((i+1)*j + j + 1)/i

print(ans)


Fixed submission:
from itertools import accumulate
n,k = list(map(int,input().split()))
p = list(map(int,input().split()))

P = list(accumulate([(i+1)/2 for i in p]))
P = [0] + P
ans = max([P[i+k]-P[i] for i in range(n-k+1)])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,k = list(map(int,input().split()))
p = np.array(list(map(int,input().split())))

P = 0
for i in range(n-k+1):
  sp = p[i:i+k].sum()
  if P < sp:
    P = sp
    mp = p[i:i+k]

ans = 0
for i in mp:
  j = i//2
  if i%2 == 0:
    ans += ((i+1)*j)/i
  else:
    ans += ((i+1)*j + j + 1)/i

print(ans)


Fixed submission:
from itertools import accumulate
n,k = list(map(int,input().split()))
p = list(map(int,input().split()))

P = list(accumulate([(i+1)/2 for i in p]))
P = [0] + P
ans = max([P[i+k]-P[i] for i in range(n-k+1)])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,k = list(map(int,input().split()))
p = np.array(list(map(int,input().split())))

P = 0
for i in range(n-k+1):
  if P < p[i:i+k].sum():
    P = p[i:i+k].sum()
    mp = p[i:i+k]

ans = 0

for i in mp:
  if i%2 == 0:
    ans += ((i+1) * i//2)/i
  else:
    ans += ((i+1) * (i//2) + (i//2) + 1)/i
print(ans)


Fixed submission:
from itertools import accumulate
n,k = list(map(int,input().split()))
p = list(map(int,input().split()))

P = list(accumulate([(i+1)/2 for i in p]))
P = [0] + P
ans = max([P[i+k]-P[i] for i in range(n-k+1)])
print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np
n,k = list(map(int,input().split()))
p = np.array(list(map(int,input().split())))

P = 0
for i in range(n-k):
  if P < p[i:i+k].sum():
    P = p[i:i+k].sum()
    mp = p[i:i+4]

ans = 0
for i in mp:
  if i%2 == 0:
    ans += ((i+1) * i//2)/i
  else:
    ans += ((i+1) * (i//2) + (i//2) + 1)/i
print(ans)


Fixed submission:
from itertools import accumulate
n,k = list(map(int,input().split()))
p = list(map(int,input().split()))

P = list(accumulate([(i+1)/2 for i in p]))
P = [0] + P
ans = max([P[i+k]-P[i] for i in range(n-k+1)])
print(ans)