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

def main():
    N, K = map(int, input().split(" "))
    P = np.array(list(map(int, input().split(" "))))

    e = (P + 1) / 2

    t = np.ones((K))

    print(np.max(
        np.convolve(
            e,
            t
        )
    ))

if __name__ == "__main__":
    main()

Fixed submission:
import numpy as np
from scipy import signal

def main():
    N, K = map(int, input().split(" "))
    P = np.array(list(map(int, input().split(" "))))

    e = (P + 1) / 2

    t = np.ones((K))

    print(np.amax(
        signal.fftconvolve(
            e,
            t
        )
    ))

if __name__ == "__main__":
    main()

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

def get_expect(p):
    return 1.0 * (p + 1) / 2

def main():
    N, K = map(int, input().split(" "))
    P = np.array(list(map(int, input().split(" "))))

    e = np.frompyfunc(get_expect, 1, 1)(P)

    t = np.ones((K))

    print(np.max(
        np.convolve(
            e,
            t
        )
    ))

if __name__ == "__main__":
    main()

Fixed submission:
import numpy as np
from scipy import signal

def main():
    N, K = map(int, input().split(" "))
    P = np.array(list(map(int, input().split(" "))))

    e = (P + 1) / 2

    t = np.ones((K))

    print(np.amax(
        signal.fftconvolve(
            e,
            t
        )
    ))

if __name__ == "__main__":
    main()

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

def get_expect(p):
    return 1.0 * (p + 1) / 2

def main():
    N, K = map(int, input().split(" "))
    P = np.array(list(map(int, input().split(" "))))

    e = np.frompyfunc(get_expect, 1, 1)(P)

    print(max([
        np.sum(
            e[i:i + K]
        )
        for i in range(N - K + 1)
    ]))

if __name__ == "__main__":
    main()

Fixed submission:
import numpy as np
from scipy import signal

def main():
    N, K = map(int, input().split(" "))
    P = np.array(list(map(int, input().split(" "))))

    e = (P + 1) / 2

    t = np.ones((K))

    print(np.amax(
        signal.fftconvolve(
            e,
            t
        )
    ))

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def get_expect(p):
    return 1.0 * (p + 1) / 2

def main():
    N, K = map(int, input().split(" "))
    P = map(int, input().split(" "))

    e = list(map(get_expect, P))

    print(max([
        sum(
            e[i:i + K]
        )
        for i in range(N - K + 1)
    ]))


if __name__ == "__main__":
    main()

Fixed submission:
import numpy as np
from scipy import signal

def main():
    N, K = map(int, input().split(" "))
    P = np.array(list(map(int, input().split(" "))))

    e = (P + 1) / 2

    t = np.ones((K))

    print(np.amax(
        signal.fftconvolve(
            e,
            t
        )
    ))

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from functools import lru_cache

@lru_cache()
def get_expect(p):
    return 1.0 * (p + 1) / 2

def main():
    N, K = map(int, input().split(" "))
    P = list(map(int, input().split(" ")))

    print(max([
        sum([
            get_expect(p)
            for p in P[i:i + K]
        ])
        for i in range(N - K + 1)
    ]))


if __name__ == "__main__":
    main()

Fixed submission:
import numpy as np
from scipy import signal

def main():
    N, K = map(int, input().split(" "))
    P = np.array(list(map(int, input().split(" "))))

    e = (P + 1) / 2

    t = np.ones((K))

    print(np.amax(
        signal.fftconvolve(
            e,
            t
        )
    ))

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def get_expect(p):
    return 1.0 * (p + 1) / 2

def main():
    N, K = map(int, input().split(" "))
    P = list(map(int, input().split(" ")))
    print(max([
        sum([
            get_expect(p)
            for p in P[i:i + K]
        ])
        for i in range(N - K + 1)
    ]))


if __name__ == "__main__":
    main()

Fixed submission:
import numpy as np
from scipy import signal

def main():
    N, K = map(int, input().split(" "))
    P = np.array(list(map(int, input().split(" "))))

    e = (P + 1) / 2

    t = np.ones((K))

    print(np.amax(
        signal.fftconvolve(
            e,
            t
        )
    ))

if __name__ == "__main__":
    main()

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

def s(n):
    return n * (n + 1) / 2

def get_expect(i, p):
    return 1.0 * s(p) / p

tl = []
for i in range(N - K + 1):
    t = sum([
        get_expect(i + j, p)
        for j, p in enumerate(P[i:i + K])
    ])

    tl.append(t)

print(max(tl))



Fixed submission:
import numpy as np
from scipy import signal

def main():
    N, K = map(int, input().split(" "))
    P = np.array(list(map(int, input().split(" "))))

    e = (P + 1) / 2

    t = np.ones((K))

    print(np.amax(
        signal.fftconvolve(
            e,
            t
        )
    ))

if __name__ == "__main__":
    main()