Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    N, K = map(int, input().split())
    ps = list(map(int, input().split()))
    expected = max([sum(ps[left: left + K]) for left in range(N - K + 1)])
    print((expected + K) / 2)
solve()

Fixed submission:
def solve():
    N, K = map(int, input().split())
    ps = list(map(int, input().split()))
    curSum = sum(ps[:K])
    curMax = curSum
    i = K; j = 0
    while i < N:
        curSum -= ps[j]
        curSum += ps[i]
        curMax = max(curSum, curMax)
        i += 1; j += 1
    print((curMax + K) / 2)
solve()

Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    N, K = map(int, input().split())
    ps = list(map(int, input().split()))
    expected = max([sum(ps[left: left + K]) for left in range(N - K + 1)])
    print((expected + K) / 2)
solve()

Fixed submission:
def solve():
    N, K = map(int, input().split())
    ps = list(map(int, input().split()))
    curSum = sum(ps[:K])
    curMax = curSum
    i = K; j = 0
    while i < N:
        curSum -= ps[j]
        curSum += ps[i]
        curMax = max(curSum, curMax)
        i += 1; j += 1
    print((curMax + K) / 2)
solve()

Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    N, K = map(int, input().split())
    ps = list(map(int, input().split()))
    maxi = ps[:K]
    expected = ps[:K]
    for index in range(K, N):
        expected.pop(0)
        expected.append(ps[index])
        if sum(expected) > sum(maxi):
            maxi = expected[:]
    res = sum([(x + 1) / 2 for x in maxi])
    print(res)

solve()

Fixed submission:
def solve():
    N, K = map(int, input().split())
    ps = list(map(int, input().split()))
    curSum = sum(ps[:K])
    curMax = curSum
    i = K; j = 0
    while i < N:
        curSum -= ps[j]
        curSum += ps[i]
        curMax = max(curSum, curMax)
        i += 1; j += 1
    print((curMax + K) / 2)
solve()

Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    N, K = map(int, input().split())
    ps = list(map(int, input().split()))
    expected = max([sum([(x + 1) / 2 for x in ps[left: left + K]]) for left in range(N - K + 1)])
    print(expected)

solve()

Fixed submission:
def solve():
    N, K = map(int, input().split())
    ps = list(map(int, input().split()))
    curSum = sum(ps[:K])
    curMax = curSum
    i = K; j = 0
    while i < N:
        curSum -= ps[j]
        curSum += ps[i]
        curMax = max(curSum, curMax)
        i += 1; j += 1
    print((curMax + K) / 2)
solve()

Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    N, K = map(int, input().split())
    ps = list(map(int, input().split()))
    res = 0
    for left in range(N - K + 1):
        right = left + K
        expected = sum([(x + 1) / 2 for x in ps[left:right]])
        if expected > res:
            res = expected
    print(res)

solve()

Fixed submission:
def solve():
    N, K = map(int, input().split())
    ps = list(map(int, input().split()))
    curSum = sum(ps[:K])
    curMax = curSum
    i = K; j = 0
    while i < N:
        curSum -= ps[j]
        curSum += ps[i]
        curMax = max(curSum, curMax)
        i += 1; j += 1
    print((curMax + K) / 2)
solve()