Buggy python submission (verdict: Runtime Error):
import sys
from itertools import accumulate


def solve():
    N, K = map(int, sys.stdin.readline().split())
    cusum_p = list(accumulate(map(int, sys.stdin.read().split()), initial=0))
    return (max(i - j for i, j in zip(cusum_p[K:], cusum_p[:-K])) + K) / 2


if __name__ == "__main__":
    answer = solve()
    print(answer)


Fixed submission:
import sys
from itertools import accumulate


def solve():
    N, K = map(int, sys.stdin.readline().split())
    cusum_p = (0,) + tuple(accumulate(map(int, sys.stdin.read().split())))
    return (max(i - j for i, j in zip(cusum_p[K:], cusum_p[:-K])) + K) / 2


if __name__ == "__main__":
    answer = solve()
    print(answer)

Buggy python submission (verdict: Runtime Error):
import sys
from itertools import accumulate

N, K = map(int, sys.stdin.readline().split())
cusum = tuple(accumulate(map(int, sys.stdin.read().split()), initial=0))

print((max(i - j for i, j in zip(cusum[K:], cusum[:-K]) + K) / 2)

Fixed submission:
import sys
from itertools import accumulate


def solve():
    N, K = map(int, sys.stdin.readline().split())
    cusum_p = (0,) + tuple(accumulate(map(int, sys.stdin.read().split())))
    return (max(i - j for i, j in zip(cusum_p[K:], cusum_p[:-K])) + K) / 2


if __name__ == "__main__":
    answer = solve()
    print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import numpy as np


def solve():
    N, K, *P = map(int, sys.stdin.read().split())
    P = np.array(P)
    n = np.convolve(P, np.ones(K), mode='valid').argmax()
    cusum = np.array(range(1000+1)).cumsum()
    return np.sum(cusum[P[n:n+K]] / P[n:n+K])


if __name__ == "__main__":
    answer = solve()
    print(answer)


Fixed submission:
import sys
from itertools import accumulate


def solve():
    N, K = map(int, sys.stdin.readline().split())
    cusum_p = (0,) + tuple(accumulate(map(int, sys.stdin.read().split())))
    return (max(i - j for i, j in zip(cusum_p[K:], cusum_p[:-K])) + K) / 2


if __name__ == "__main__":
    answer = solve()
    print(answer)

Buggy python submission (verdict: Runtime Error):
import sys
from itertools import accumulate
import numpy as np


def solve():
    N, K, *P = map(int, sys.stdin.read().split())
    n = np.convolve(np.array(P), np.ones(K), mode='valid').argmax()
    cusum = tuple(accumulate(range(1000+1)))
    return sum(cusum[i] / i for i in P[n:n+K])


if __name__ == "__main__":
    answer = solve()
    print(answer)


Fixed submission:
import sys
from itertools import accumulate


def solve():
    N, K = map(int, sys.stdin.readline().split())
    cusum_p = (0,) + tuple(accumulate(map(int, sys.stdin.read().split())))
    return (max(i - j for i, j in zip(cusum_p[K:], cusum_p[:-K])) + K) / 2


if __name__ == "__main__":
    answer = solve()
    print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from itertools import accumulate
import numpy as np


def solve():
    N, K, *P = map(int, sys.stdin.read().split())
    n = np.convolve(np.array(P), np.ones(K), mode='valid').argmax()
    cusum = tuple(accumulate(range(1000+1)))
    return sum(cusum[i] / i for i in P[n:n+K])


if __name__ == "__main__":
    answer = solve()
    print(answer)


Fixed submission:
import sys
from itertools import accumulate


def solve():
    N, K = map(int, sys.stdin.readline().split())
    cusum_p = (0,) + tuple(accumulate(map(int, sys.stdin.read().split())))
    return (max(i - j for i, j in zip(cusum_p[K:], cusum_p[:-K])) + K) / 2


if __name__ == "__main__":
    answer = solve()
    print(answer)