Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = map(int, input().split())

p_e = [0] + [ (x + 1) * 0.5 for x in p]
p_p = [0]

for i in range(1, n+1):
    p_p.append(p_p[i-1] + p_e[i])

e_sum = [p_p[i] - p_p[i - k] for i in range(k+1, n+1)]
print(max(e_sum))

Fixed submission:
n, k = map(int, input().split())
p = map(int, input().split())

p_e = [0] + [ (x + 1) * 0.5 for x in p]
p_p = [0]

for i in range(1, n+1):
    p_p.append(p_p[i-1] + p_e[i])

e_sum = [p_p[i] - p_p[i - k] for i in range(k, n+1)]
print(max(e_sum))

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = map(int, input().split())

p_e = [ (x + 1) * 0.5 for x in p]
p_p = [p_e[0]]

for i in range(1, n):
    p_p.append(p_p[i-1] + p_e[i])

e_sum = [p_p[i] - p_p[i - k] for i in range(k, n)]
print(max(e_sum))

Fixed submission:
n, k = map(int, input().split())
p = map(int, input().split())

p_e = [0] + [ (x + 1) * 0.5 for x in p]
p_p = [0]

for i in range(1, n+1):
    p_p.append(p_p[i-1] + p_e[i])

e_sum = [p_p[i] - p_p[i - k] for i in range(k, n+1)]
print(max(e_sum))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p = map(int, input().split())
p_e = [ (x + 1) * 0.5 for x in p]
e_sum = [sum(p_e[i:i+k]) for i in range(n - k + 1)]
print(max(e_sum))

Fixed submission:
n, k = map(int, input().split())
p = map(int, input().split())

p_e = [0] + [ (x + 1) * 0.5 for x in p]
p_p = [0]

for i in range(1, n+1):
    p_p.append(p_p[i-1] + p_e[i])

e_sum = [p_p[i] - p_p[i - k] for i in range(k, n+1)]
print(max(e_sum))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p = map(int, input().split())
p_e = list(map(lambda x: (x + 1)* 0.5, p))

e_sum = [sum(p_e[i:i+k]) for i in range(n - k + 1)]
print(max(e_sum))

Fixed submission:
n, k = map(int, input().split())
p = map(int, input().split())

p_e = [0] + [ (x + 1) * 0.5 for x in p]
p_p = [0]

for i in range(1, n+1):
    p_p.append(p_p[i-1] + p_e[i])

e_sum = [p_p[i] - p_p[i - k] for i in range(k, n+1)]
print(max(e_sum))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p = map(int, input().split())
p_e = list(map(lambda x: (x + 1)* 0.5, p))

max_e = -1
for i in range(n - k + 1):
    v = sum(p_e[i:i+k])
    if max_e < v:
        max_e = v
print(max_e)

Fixed submission:
n, k = map(int, input().split())
p = map(int, input().split())

p_e = [0] + [ (x + 1) * 0.5 for x in p]
p_p = [0]

for i in range(1, n+1):
    p_p.append(p_p[i-1] + p_e[i])

e_sum = [p_p[i] - p_p[i - k] for i in range(k, n+1)]
print(max(e_sum))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p = map(int, input().split())
p_e = list(map(lambda x: (x + 1)* 0.5, p))

max_e = -1
for i in range(n - k + 1):
    v = sum([p_e_j for p_e_j in p_e[i:i+k]])
    if max_e < v:
        max_e = v
print(max_e)

Fixed submission:
n, k = map(int, input().split())
p = map(int, input().split())

p_e = [0] + [ (x + 1) * 0.5 for x in p]
p_p = [0]

for i in range(1, n+1):
    p_p.append(p_p[i-1] + p_e[i])

e_sum = [p_p[i] - p_p[i - k] for i in range(k, n+1)]
print(max(e_sum))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p = map(int, input().split())
p_e = list(map(lambda x: sum([i for i in range(1, x+1)]) / x, p))

max_e = -1
for i in range(n - k + 1):
    v = sum([p_e_j for p_e_j in p_e[i:i+k]])
    if max_e < v:
        max_e = v
print(max_e)

Fixed submission:
n, k = map(int, input().split())
p = map(int, input().split())

p_e = [0] + [ (x + 1) * 0.5 for x in p]
p_p = [0]

for i in range(1, n+1):
    p_p.append(p_p[i-1] + p_e[i])

e_sum = [p_p[i] - p_p[i - k] for i in range(k, n+1)]
print(max(e_sum))