Buggy python submission (verdict: Runtime Error):
def main():
    n, k = map(int, input().split())
    ps = list(map(int, input().split()))
    ps = [(1+p)/2 for p in ps]

    print(ps)
    cumulative_sums = [sum(ps[:i+1]) for i in range(n)]
    ans = max([cumulative_sums[i+k] - cumulative_sums[i] for i in range(n-k)])
    print(ans)


if __name__ == "__main__":
    main()


Fixed submission:
def main():
    n, k = map(int, input().split())
    ps = list(map(int, input().split()))
    e = [(1+p)/2 for p in ps]

    s = [0]
    for i in range(n):
        s.append(s[i]+e[i])

    ans = max([s[i+k] - s[i] for i in range(n-k+1)])
    print(ans)


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    n, k = map(int, input().split())
    ps = list(map(int, input().split()))
    ps = [(1+p)/2 for p in ps]

    cumulative_sums = [sum(ps[:i]) for i in range(n)]
    ans = max([cumulative_sums[i+k] - cumulative_sums[i] for i in range(n-k)])
    print(ans)


if __name__ == "__main__":
    main()


Fixed submission:
def main():
    n, k = map(int, input().split())
    ps = list(map(int, input().split()))
    e = [(1+p)/2 for p in ps]

    s = [0]
    for i in range(n):
        s.append(s[i]+e[i])

    ans = max([s[i+k] - s[i] for i in range(n-k+1)])
    print(ans)


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
import numpy as np


def main():
    n, k = map(int, input().split())
    ps = (np.array(list(map(int, input().split()))) + 1) / 2

    if k == 1:
        ans = ps[0]
    else:
        cumulative_sum = [0] * n
        for i in range(n):
            if i == 0:
                cumulative_sum[i] = ps[0]
            else:
                cumulative_sum[i] = ps[i] + cumulative_sum[i-1]

        ans = max([cumulative_sum[i+k] - cumulative_sum[i] for i in range(n-k)])
    print(ans)


if __name__ == "__main__":
    main()


Fixed submission:
def main():
    n, k = map(int, input().split())
    ps = list(map(int, input().split()))
    e = [(1+p)/2 for p in ps]

    s = [0]
    for i in range(n):
        s.append(s[i]+e[i])

    ans = max([s[i+k] - s[i] for i in range(n-k+1)])
    print(ans)


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
import numpy as np


def main():
    n, k = map(int, input().split())
    ps = (np.array(list(map(int, input().split()))) + 1) / 2

    if k == 1:
        ans = max(ps)
    else:
        cumulative_sum = [0] * n
        for i in range(n):
            if i == 0:
                cumulative_sum[i] = ps[0]
            else:
                cumulative_sum[i] = ps[i] + cumulative_sum[i-1]
    
        ans = max([cumulative_sum[i+k] - cumulative_sum[i] for i in range(n-k)])
        print(ans)


if __name__ == "__main__":
    main()


Fixed submission:
def main():
    n, k = map(int, input().split())
    ps = list(map(int, input().split()))
    e = [(1+p)/2 for p in ps]

    s = [0]
    for i in range(n):
        s.append(s[i]+e[i])

    ans = max([s[i+k] - s[i] for i in range(n-k+1)])
    print(ans)


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
import numpy as np


def main():
    n, k = map(int, input().split())
    ps = (np.array(list(map(int, input().split()))) + 1) / 2

    cumulative_sum = [0] * n
    for i in range(n):
        if i == 0:
            cumulative_sum[i] = ps[0]
        else:
            cumulative_sum[i] = ps[i] + cumulative_sum[i-1]

    ans = max([cumulative_sum[i+k] - cumulative_sum[i] for i in range(n-k)])
    print(ans)


if __name__ == "__main__":
    main()


Fixed submission:
def main():
    n, k = map(int, input().split())
    ps = list(map(int, input().split()))
    e = [(1+p)/2 for p in ps]

    s = [0]
    for i in range(n):
        s.append(s[i]+e[i])

    ans = max([s[i+k] - s[i] for i in range(n-k+1)])
    print(ans)


if __name__ == "__main__":
    main()

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


def main():
    n, k = map(int, input().split())
    ps = (np.array(list(map(int, input().split()))) + 1) / 2

    ans = -float("inf")
    ans = max([sum(ps[i:i+k]) for i in range(n-k+1)])
    print(ans)


if __name__ == "__main__":
    main()


Fixed submission:
def main():
    n, k = map(int, input().split())
    ps = list(map(int, input().split()))
    e = [(1+p)/2 for p in ps]

    s = [0]
    for i in range(n):
        s.append(s[i]+e[i])

    ans = max([s[i+k] - s[i] for i in range(n-k+1)])
    print(ans)


if __name__ == "__main__":
    main()

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


def main():
    n, k = map(int, input().split())
    ps = (np.array(list(map(int, input().split()))) + 1) / 2

    ans = -float("inf")
    for i in range(n-k+1):
        ans = max(ans, sum(ps[i:i+k]))
    print(ans)


if __name__ == "__main__":
    main()


Fixed submission:
def main():
    n, k = map(int, input().split())
    ps = list(map(int, input().split()))
    e = [(1+p)/2 for p in ps]

    s = [0]
    for i in range(n):
        s.append(s[i]+e[i])

    ans = max([s[i+k] - s[i] for i in range(n-k+1)])
    print(ans)


if __name__ == "__main__":
    main()