Buggy python submission (verdict: Time Limit Exceeded):
N,K=[int(x) for x in input().rstrip().split()]
p=[int(x) for x in input().rstrip().split()]

mx=0
for i in range(N-K+1):
  mx=max(mx,sum(p[i:i+K]))
print((mx+K)/2)

Fixed submission:
N,K=[int(x) for x in input().rstrip().split()]
p=[int(x) for x in input().rstrip().split()]
ex=[1/2*(i+1) for i in p]
ruiseki=[0]
ans=0

for i in range(N):
  ruiseki.append(ruiseki[i]+ex[i])


for i in range(N+1-K):
  if ans<ruiseki[i+K]-ruiseki[i]:
    ans=ruiseki[i+K]-ruiseki[i]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,K=[int(x) for x in input().rstrip().split()]
p=[int(x) for x in input().rstrip().split()]
ex=[1/2*(i+1) for i in p]

mx=0
ind=0
ans=0
# for i in range(ind,ind+K):
#   ans+=ex[p[i]-1]
s=0
for i in range(N-K+1):
  s=sum(ex[i:i+K])
  mx=max(mx,s)
print(mx)




Fixed submission:
N,K=[int(x) for x in input().rstrip().split()]
p=[int(x) for x in input().rstrip().split()]
ex=[1/2*(i+1) for i in p]
ruiseki=[0]
ans=0

for i in range(N):
  ruiseki.append(ruiseki[i]+ex[i])


for i in range(N+1-K):
  if ans<ruiseki[i+K]-ruiseki[i]:
    ans=ruiseki[i+K]-ruiseki[i]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,K=[int(x) for x in input().rstrip().split()]
p=[int(x) for x in input().rstrip().split()]
ex=[1/2*(i+1) for i in p]

mx=0
ind=0
ans=0
# for i in range(ind,ind+K):
#   ans+=ex[p[i]-1]

for i in range(N-K+1):
  mx=max(mx,sum(ex[i:i+K]))
print(mx)




Fixed submission:
N,K=[int(x) for x in input().rstrip().split()]
p=[int(x) for x in input().rstrip().split()]
ex=[1/2*(i+1) for i in p]
ruiseki=[0]
ans=0

for i in range(N):
  ruiseki.append(ruiseki[i]+ex[i])


for i in range(N+1-K):
  if ans<ruiseki[i+K]-ruiseki[i]:
    ans=ruiseki[i+K]-ruiseki[i]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,K=[int(x) for x in input().rstrip().split()]
p=[int(x) for x in input().rstrip().split()]
ex=[1/2*(i+1) for i in range(1,1001)]

mx=0
ind=0
for i in range(N-K+1):
  if mx<max(mx,sum(p[i:i+K])):
    ind=i
    mx=max(mx,sum(p[i:i+K]))



ans=0
# for i in range(ind,ind+K):
#   ans+=ex[p[i]-1]
i=ind
while(K):
  ans+=ex[p[i]-1]
  i+=1
  K-=1

print(ans)




Fixed submission:
N,K=[int(x) for x in input().rstrip().split()]
p=[int(x) for x in input().rstrip().split()]
ex=[1/2*(i+1) for i in p]
ruiseki=[0]
ans=0

for i in range(N):
  ruiseki.append(ruiseki[i]+ex[i])


for i in range(N+1-K):
  if ans<ruiseki[i+K]-ruiseki[i]:
    ans=ruiseki[i+K]-ruiseki[i]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,K=[int(x) for x in input().rstrip().split()]
p=[int(x) for x in input().rstrip().split()]
ex=[1/2*(i+1) for i in range(1,1001)]

p_x=[0 for i in range(N)]

mx=0
ind=0
for i in range(N-K+1):
  if mx<max(mx,sum(p[i:i+K])):
    ind=i
    mx=max(mx,sum(p[i:i+K]))

# print(ind,mx)
ans=0
for i in range(ind,ind+K):
  ans+=ex[p[i]-1]
print(ans)




Fixed submission:
N,K=[int(x) for x in input().rstrip().split()]
p=[int(x) for x in input().rstrip().split()]
ex=[1/2*(i+1) for i in p]
ruiseki=[0]
ans=0

for i in range(N):
  ruiseki.append(ruiseki[i]+ex[i])


for i in range(N+1-K):
  if ans<ruiseki[i+K]-ruiseki[i]:
    ans=ruiseki[i+K]-ruiseki[i]
print(ans)