Buggy python submission (verdict: Runtime Error):
def main():
    import sys
    import numpy as np
    input = sys.stdin.readline

    N, K = map(int, input().split())
    P = np.array(list(map(float, input().split())))
    p_cumsum = np.cumsum(P)

    ans = 0
    for i in range(len(p_cumsum)-K):
        ans = max(ans, p_cumsum[i+K]-p_cumsum[i])
    ans = (K + ans) * 0.5

    print(ans)

if __name__ == '__main__':
    main()

Fixed submission:
import numpy as np

N, K = map(int, input().split())
E = list(map(lambda x: (int(x)+1)/2, input().split()))
E_cumsum = np.cumsum(E)

ans = E_cumsum[K-1]
for i in range(0, N-K):
    e = E_cumsum[i+K] - E_cumsum[i]
    ans = max(ans, e)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    import sys
    input = sys.stdin.readline

    N, K = map(int, input().split())
    P = tuple(map(float, input().split()))
    if K == 1:
        ans = (1 + max(P)) * 0.5
    else:
        pl = [(K + sum(P[i:i+K])) * 0.5 for i in range(N-K+1)]
        ans = max(pl)

    print(ans)

if __name__ == '__main__':
    main()

Fixed submission:
import numpy as np

N, K = map(int, input().split())
E = list(map(lambda x: (int(x)+1)/2, input().split()))
E_cumsum = np.cumsum(E)

ans = E_cumsum[K-1]
for i in range(0, N-K):
    e = E_cumsum[i+K] - E_cumsum[i]
    ans = max(ans, e)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    import sys
    input = sys.stdin.readline

    N, K = map(int, input().split())
    P = tuple(map(float, input().split()))

    pl = [(K + sum(P[i:i+K])) * 0.5 for i in range(N-K+1)]
    ans = max(pl)

    print(ans)

if __name__ == '__main__':
    main()

Fixed submission:
import numpy as np

N, K = map(int, input().split())
E = list(map(lambda x: (int(x)+1)/2, input().split()))
E_cumsum = np.cumsum(E)

ans = E_cumsum[K-1]
for i in range(0, N-K):
    e = E_cumsum[i+K] - E_cumsum[i]
    ans = max(ans, e)
print(ans)

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

ans = 0
for i in range(N-K+1):
    s = (K + sum(P[i:i+K]))/2
    ans = max(ans, s)

print(ans)

Fixed submission:
import numpy as np

N, K = map(int, input().split())
E = list(map(lambda x: (int(x)+1)/2, input().split()))
E_cumsum = np.cumsum(E)

ans = E_cumsum[K-1]
for i in range(0, N-K):
    e = E_cumsum[i+K] - E_cumsum[i]
    ans = max(ans, e)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
N, K = map(int, input().split())
P = list(map(int, input().split()))

dq = deque(maxlen=K)
ans = 0
for p in P:
    dq.append(1/p * p * (1 + p) /2)
    ans = max(ans, sum(dq))

print(ans)

Fixed submission:
import numpy as np

N, K = map(int, input().split())
E = list(map(lambda x: (int(x)+1)/2, input().split()))
E_cumsum = np.cumsum(E)

ans = E_cumsum[K-1]
for i in range(0, N-K):
    e = E_cumsum[i+K] - E_cumsum[i]
    ans = max(ans, e)
print(ans)

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

max_s = 0
idx = 0
for i in range(N-K+1):
    s = sum(P[i:i+K])
    if max_s < s:
        idx = i
        max_s = s

ans = 0
for p in P[idx:idx+K]:
    ans += 1/p * p * (1 + p) /2

print(ans)

Fixed submission:
import numpy as np

N, K = map(int, input().split())
E = list(map(lambda x: (int(x)+1)/2, input().split()))
E_cumsum = np.cumsum(E)

ans = E_cumsum[K-1]
for i in range(0, N-K):
    e = E_cumsum[i+K] - E_cumsum[i]
    ans = max(ans, e)
print(ans)