Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n, k = map(int, input().split())
def f(x):
    return sum(range(1, x + 1)) / x
p = [f(int(i)) for i in input().split()]
s = np.cumsum(p)
if k == 1:
    print(max(p))
elif k == n:
    print(s[-1])
else:
    print(max(s[k - 1:] - np.hstack([[0], s[:n - k]])))

Fixed submission:
import sys
n, k = map(int, input().split())
p = [int(i) for i in input().split()]
total = [0] * n
total[0] = sum(range(1, p[0] + 1)) / p[0]
max_value = 0
if k == 1:
    print(sum(range(1, max(p) + 1)) / max(p))
    sys.exit()
elif k == n:
    print(sum([sum(range(1, i + 1)) / i for i in p]))
    sys.exit()
for i in range(1, n):
    total[i] = total[i - 1] + sum(range(1, p[i] + 1)) / p[i]
    
    if i == k - 1:
        max_value = total[i]
    elif i >= k:
        max_value = max(max_value, total[i] - total[i - k])
print(max_value)

Buggy python submission (verdict: Runtime Error):
import numpy as np
n, k = map(int, input().split())
def f(x):
    return sum(range(1, x + 1)) / x
p = [f(int(i)) for i in input().split()]
s = np.cumsum(p)
print(max(s[k-1], max(s[k:] - s[:n - k])))

Fixed submission:
import sys
n, k = map(int, input().split())
p = [int(i) for i in input().split()]
total = [0] * n
total[0] = sum(range(1, p[0] + 1)) / p[0]
max_value = 0
if k == 1:
    print(sum(range(1, max(p) + 1)) / max(p))
    sys.exit()
elif k == n:
    print(sum([sum(range(1, i + 1)) / i for i in p]))
    sys.exit()
for i in range(1, n):
    total[i] = total[i - 1] + sum(range(1, p[i] + 1)) / p[i]
    
    if i == k - 1:
        max_value = total[i]
    elif i >= k:
        max_value = max(max_value, total[i] - total[i - k])
print(max_value)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n, k = map(int, input().split())
p = [np.sum(np.arange(1, int(i) + 1)) / float(i) for i in input().split()]
p = np.array(p)
s = np.cumsum(p)
m = s[k - 1]
for i in range(n - k):
    m = max(m, s[i + k] - s[i])
print(m)

Fixed submission:
import sys
n, k = map(int, input().split())
p = [int(i) for i in input().split()]
total = [0] * n
total[0] = sum(range(1, p[0] + 1)) / p[0]
max_value = 0
if k == 1:
    print(sum(range(1, max(p) + 1)) / max(p))
    sys.exit()
elif k == n:
    print(sum([sum(range(1, i + 1)) / i for i in p]))
    sys.exit()
for i in range(1, n):
    total[i] = total[i - 1] + sum(range(1, p[i] + 1)) / p[i]
    
    if i == k - 1:
        max_value = total[i]
    elif i >= k:
        max_value = max(max_value, total[i] - total[i - k])
print(max_value)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n, k = map(int, input().split())
p = [np.sum(np.arange(1, int(i) + 1)) / float(i) for i in input().split()]
p = np.array(p)
s = np.zeros(n - k + 1)
for i in range(n - k + 1):
    s[i] = np.sum(p[i: i + k])
print(s.max())

Fixed submission:
import sys
n, k = map(int, input().split())
p = [int(i) for i in input().split()]
total = [0] * n
total[0] = sum(range(1, p[0] + 1)) / p[0]
max_value = 0
if k == 1:
    print(sum(range(1, max(p) + 1)) / max(p))
    sys.exit()
elif k == n:
    print(sum([sum(range(1, i + 1)) / i for i in p]))
    sys.exit()
for i in range(1, n):
    total[i] = total[i - 1] + sum(range(1, p[i] + 1)) / p[i]
    
    if i == k - 1:
        max_value = total[i]
    elif i >= k:
        max_value = max(max_value, total[i] - total[i - k])
print(max_value)