Buggy python submission (verdict: Time Limit Exceeded):
def s2(n):return [input() for x in range(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n,k=n1()
p=n1()

e=[(1+x)/2 for x in p]

ans=sum(e[0:k])
tmp=ans
for i in range(1,n):
    tmp=sum(e[i:i+k])
    ans=max(tmp,ans)
print(ans)

Fixed submission:
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n,k=n1()
p=n1()

e=[(1+x)/2 for x in p]

ans=sum(e[0:k])
tmp=ans
for i in range(k,n):
    tmp=tmp+e[i]-e[i-k]
    ans=max(tmp,ans)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n,k=n1()
p=n1()

from collections import deque
e=deque()
for x in p:
    e.append((1+x)/2)
d=deque()
ans=0
while True:
    d.append(e.pop())
    if len(d)==k:
        ans=max(ans,sum(list(d)))
        d.popleft()
    if len(e)==0:
        break
print(ans)

Fixed submission:
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n,k=n1()
p=n1()

e=[(1+x)/2 for x in p]

ans=sum(e[0:k])
tmp=ans
for i in range(k,n):
    tmp=tmp+e[i]-e[i-k]
    ans=max(tmp,ans)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n,k=n1()
p=n1()

from collections import deque
e=deque()
for x in p:
    e.append((1+x)/2)
d=deque()
ans=0
while True:
    d.append(e.pop())
    if len(d)==k:
        ans=max(ans,sum(list(d)))
        d.popleft()
    if len(e)==0:
        break
print(ans)

Fixed submission:
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n,k=n1()
p=n1()

e=[(1+x)/2 for x in p]

ans=sum(e[0:k])
tmp=ans
for i in range(k,n):
    tmp=tmp+e[i]-e[i-k]
    ans=max(tmp,ans)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n,k=n1()
p=n1()
e=[(1+x)/2 for x in p]
ans=0
for i in range(n-k+1):
    ans=max(ans,sum(e[i:i+k]))
print(ans)

Fixed submission:
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n,k=n1()
p=n1()

e=[(1+x)/2 for x in p]

ans=sum(e[0:k])
tmp=ans
for i in range(k,n):
    tmp=tmp+e[i]-e[i-k]
    ans=max(tmp,ans)
print(ans)