Buggy python submission (verdict: Time Limit Exceeded):
N,K = list(map(int,input().split()))
p = list(map(int,input().split()))
ans = 0
for i in range(len(p)-K+1):
    P = p[i:i+K]
    if ans < sum(P):
        ans2 = P
    ans = max(ans,sum(ans2)) 
A = (sum(ans2)+K)/2
print(A)

Fixed submission:
from itertools import accumulate
N,K = list(map(int,input().split()))
P = list(map(int,input().split()))
for i in range(N):
    P[i] = 1+(P[i]-1)/2
ruiseki = list(accumulate([0]+P))
ans = 0
for i in range(N-K+1):
    ans = max(ans,ruiseki[i+K]-ruiseki[i])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = list(map(int,input().split()))
p = list(map(int,input().split()))
ans = 0
A = []
for i in range(len(p)-K+1):
    P = p[i:i+K]
    if ans < sum(P):
        ans2 = P
    ans = max(ans,sum(ans2)) 
B = (sum(ans2)+K)/2
print(B)

Fixed submission:
from itertools import accumulate
N,K = list(map(int,input().split()))
P = list(map(int,input().split()))
for i in range(N):
    P[i] = 1+(P[i]-1)/2
ruiseki = list(accumulate([0]+P))
ans = 0
for i in range(N-K+1):
    ans = max(ans,ruiseki[i+K]-ruiseki[i])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = list(map(int,input().split()))
p = list(map(int,input().split()))
ans = 0
A = []
B = 0
C = [-1]*10000
for i in range(len(p)-K+1):
    P = p[i:i+K]
    if ans < sum(P):
        ans2 = P
    ans = max(ans,sum(ans2)) 
for j in range(len(ans2)):
  if C[ans2[j]] == -1:
      for k in range(1,ans2[j]+1):
          A.append(k)
      B += sum(A)/ans2[j]
      C[ans2[j]] = sum(A)/ans2[j]
      A = []
  else:
      B += C[ans2[j]]
print(B)

Fixed submission:
from itertools import accumulate
N,K = list(map(int,input().split()))
P = list(map(int,input().split()))
for i in range(N):
    P[i] = 1+(P[i]-1)/2
ruiseki = list(accumulate([0]+P))
ans = 0
for i in range(N-K+1):
    ans = max(ans,ruiseki[i+K]-ruiseki[i])
print(ans)

Buggy python submission (verdict: Runtime Error):
N,K = list(map(int,input().split()))
p = list(map(int,input().split()))
ans = 0
A = []
B = 0
C = [-1]*10000
for i in range(len(p)-K+1):
    P = p[i:i+K]
    if ans < sum(P):
        ans2 = P
    ans = max(ans,sum(ans2)) 
for j in range(len(ans2)):
  if C[ans2[j]] == -1:
      for k in range(1,ans2[j]+1):
          A.append(k)
      B += sum(A)/ans2[j]
      C[ans2[j]] = sum(A)/ans2[j]
      A.clear()
  else:
      B += C[ans2[j]]
print(B)

Fixed submission:
from itertools import accumulate
N,K = list(map(int,input().split()))
P = list(map(int,input().split()))
for i in range(N):
    P[i] = 1+(P[i]-1)/2
ruiseki = list(accumulate([0]+P))
ans = 0
for i in range(N-K+1):
    ans = max(ans,ruiseki[i+K]-ruiseki[i])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = list(map(int,input().split()))
p = list(map(int,input().split()))
ans = 0
A = []
B = 0
C = [-1]*10000
for i in range(len(p)-K+1):
    P = p[i:i+K]
    if ans < sum(P):
        ans2 = P
    ans = max(ans,sum(ans2)) 
for j in range(len(ans2)):
  if C[ans2[j]] == -1:
      for k in range(1,ans2[j]+1):
          A.append(k)
      B += sum(A)/ans2[j]
      C[ans2[j]] = sum(A)/ans2[j]
      A.clear()
  else:
      B += C[ans2[j]]
print(B)

Fixed submission:
from itertools import accumulate
N,K = list(map(int,input().split()))
P = list(map(int,input().split()))
for i in range(N):
    P[i] = 1+(P[i]-1)/2
ruiseki = list(accumulate([0]+P))
ans = 0
for i in range(N-K+1):
    ans = max(ans,ruiseki[i+K]-ruiseki[i])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = list(map(int,input().split()))
p = list(map(int,input().split()))
ans = 0
A = []
B = 0
for i in range(len(p)-K+1):
    P = p[i:i+K]
    if ans < sum(P):
        ans2 = P
    ans = max(ans,sum(ans2))
for j in range(len(ans2)):
    for k in range(1,ans2[j]+1):
        A.append(k)
    B += sum(A)/ans2[j]
    A.clear()
print(B)

Fixed submission:
from itertools import accumulate
N,K = list(map(int,input().split()))
P = list(map(int,input().split()))
for i in range(N):
    P[i] = 1+(P[i]-1)/2
ruiseki = list(accumulate([0]+P))
ans = 0
for i in range(N-K+1):
    ans = max(ans,ruiseki[i+K]-ruiseki[i])
print(ans)