Buggy python submission (verdict: Runtime Error):
def main():
    N,K = map(int, input().split())
    p = list(map(int, input().split()))
    esum = [0]*N
    psum = [0]*(N-K)
    esum[0] = p[1]
    for i in range(1,K):
        esum[i] = esum[i-1]+p[i]
    for i in range(K,N):
        esum[i] = esum[i-1]+p[i]
        psum[i-K] = esum[i]-esum[i-K]

    print(  (max(psum)+K)*0.5  )
    return

if __name__=="__main__":
    main()

Fixed submission:
def main():
    N,K = map(int, input().split())
    p = list(map(int, input().split()))
    if N>K:
        esum = [0]*N
        psum = [0]*(N-K)
        esum[0] = p[1]
        for i in range(1,K):
            esum[i] = esum[i-1]+p[i]
        for i in range(K,N):
            esum[i] = esum[i-1]+p[i]
            psum[i-K] = esum[i]-esum[i-K]
        ans = (max(psum)+K)*0.5
    else:
        ans = (sum(p)+K)*0.5

    print(ans)
    return

if __name__=="__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N,K = map(int, input().split())
    p = list(map(int, input().split()))
    ans = 0
    for i in range(N-K+1):
        s = sum(p[i:i+K])
        if ans < s : ans = s
    print(  (ans+K)*0.5  )
    return

if __name__=="__main__":
    main()

Fixed submission:
def main():
    N,K = map(int, input().split())
    p = list(map(int, input().split()))
    if N>K:
        esum = [0]*N
        psum = [0]*(N-K)
        esum[0] = p[1]
        for i in range(1,K):
            esum[i] = esum[i-1]+p[i]
        for i in range(K,N):
            esum[i] = esum[i-1]+p[i]
            psum[i-K] = esum[i]-esum[i-K]
        ans = (max(psum)+K)*0.5
    else:
        ans = (sum(p)+K)*0.5

    print(ans)
    return

if __name__=="__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N,K = map(int, input().split())
    p = list(map(int, input().split()))
    sums = [ sum(p[i:i+K]) for i in range(N-K+1) ]
    print(  ( max(sums)+K)*0.5  )
    return

if __name__=="__main__":
    main()

Fixed submission:
def main():
    N,K = map(int, input().split())
    p = list(map(int, input().split()))
    if N>K:
        esum = [0]*N
        psum = [0]*(N-K)
        esum[0] = p[1]
        for i in range(1,K):
            esum[i] = esum[i-1]+p[i]
        for i in range(K,N):
            esum[i] = esum[i-1]+p[i]
            psum[i-K] = esum[i]-esum[i-K]
        ans = (max(psum)+K)*0.5
    else:
        ans = (sum(p)+K)*0.5

    print(ans)
    return

if __name__=="__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N,K = map(int, input().split())
    p = list(map(int, input().split()))
    eval = [ (1+pi)*0.5  for pi in p ]
    sums = [ sum(eval[i:i+K]) for i in range(N-K+1) ]
    print(max(sums))
    return

if __name__=="__main__":
    main()

Fixed submission:
def main():
    N,K = map(int, input().split())
    p = list(map(int, input().split()))
    if N>K:
        esum = [0]*N
        psum = [0]*(N-K)
        esum[0] = p[1]
        for i in range(1,K):
            esum[i] = esum[i-1]+p[i]
        for i in range(K,N):
            esum[i] = esum[i-1]+p[i]
            psum[i-K] = esum[i]-esum[i-K]
        ans = (max(psum)+K)*0.5
    else:
        ans = (sum(p)+K)*0.5

    print(ans)
    return

if __name__=="__main__":
    main()