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

    ans = [0] * N
    max_tmp = [0] * K
    start_index = 0
    for i in range(N - K + 1):
        tmp = P[i: i + K]
        ans[i] = sum(list(range(1, P[i] + 1))) / P[i]
        if sum(max_tmp) < sum(tmp):
            max_tmp = tmp
            start_index = i

    for i in range(N - K, N):
        ans[i] = sum(list(range(1, P[i] + 1))) / P[i]

    print(sum(ans[start_index: start_index + K]))


resolve()

Fixed submission:
import itertools


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

    P = [(1 + p) / 2 for p in P]
    accumulate_P = [0] + list(itertools.accumulate(P))

    ans = 0
    for ii in range(N - K + 1):
        range_sum_P = accumulate_P[ii + K] - accumulate_P[ii]
        ans = max(ans, range_sum_P)

    print(ans)

resolve()

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

    ans = [0] * N
    max_tmp = [0] * K
    start_index = 0
    for i in range(N - K + 1):
        tmp = P[i: i + K]
        ans[i] = (1 + P[i]) / 2
        if sum(max_tmp) < sum(tmp):
            max_tmp = tmp
            start_index = i

    for i in range(N - K, N):
        ans[i] = (1 + P[i]) / 2

    print(sum(ans[start_index: start_index + K]))


resolve()

Fixed submission:
import itertools


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

    P = [(1 + p) / 2 for p in P]
    accumulate_P = [0] + list(itertools.accumulate(P))

    ans = 0
    for ii in range(N - K + 1):
        range_sum_P = accumulate_P[ii + K] - accumulate_P[ii]
        ans = max(ans, range_sum_P)

    print(ans)

resolve()

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

    ans = [0] * N
    max_tmp = [0] * K
    start_index = 0
    for i in range(N - K + 1):
        tmp = P[i: i + K]
        ans[i] = sum(list(range(1, P[i] + 1))) / P[i]
        if sum(max_tmp) < sum(tmp):
            max_tmp = tmp
            start_index = i

    for i in range(N - K, N):
        ans[i] = sum(list(range(1, P[i] + 1))) / P[i]

    print(sum(ans[start_index: start_index + K]))


resolve()

Fixed submission:
import itertools


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

    P = [(1 + p) / 2 for p in P]
    accumulate_P = [0] + list(itertools.accumulate(P))

    ans = 0
    for ii in range(N - K + 1):
        range_sum_P = accumulate_P[ii + K] - accumulate_P[ii]
        ans = max(ans, range_sum_P)

    print(ans)

resolve()

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

    ans = [0] * N
    max_tmp = [0] * K
    start_index = 0
    for i in range(N - K + 1):
        tmp = P[i: i + K]
        ans[i] = sum(list(range(1, P[i] + 1))) / P[i]
        if sum(max_tmp) < sum(tmp):
            max_tmp = tmp
            start_index = i

    for i in range(N - K, N):
        ans[i] = sum(list(range(1, P[i] + 1))) / P[i]

    print(sum(ans[start_index: start_index + K]))


resolve()

Fixed submission:
import itertools


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

    P = [(1 + p) / 2 for p in P]
    accumulate_P = [0] + list(itertools.accumulate(P))

    ans = 0
    for ii in range(N - K + 1):
        range_sum_P = accumulate_P[ii + K] - accumulate_P[ii]
        ans = max(ans, range_sum_P)

    print(ans)

resolve()

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

    max_tmp = [0] * K
    for i in range(len(P) - K + 1):
        tmp = P[i: i + K]
        if sum(max_tmp) < sum(tmp):
            max_tmp = tmp

    ans = 0
    for number in max_tmp:
        ans += sum(list(range(1, number + 1))) / number

    print(ans)


resolve()

Fixed submission:
import itertools


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

    P = [(1 + p) / 2 for p in P]
    accumulate_P = [0] + list(itertools.accumulate(P))

    ans = 0
    for ii in range(N - K + 1):
        range_sum_P = accumulate_P[ii + K] - accumulate_P[ii]
        ans = max(ans, range_sum_P)

    print(ans)

resolve()

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

    max_tmp = [0] * K
    for i in range(len(P) - K + 1):
        tmp = P[i: i + K]
        if sum(max_tmp) < sum(tmp):
            max_tmp = tmp

    ans = 0
    for number in max_tmp:
        ans += sum(list(range(1, number + 1))) / number

    print(ans)


resolve()

Fixed submission:
import itertools


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

    P = [(1 + p) / 2 for p in P]
    accumulate_P = [0] + list(itertools.accumulate(P))

    ans = 0
    for ii in range(N - K + 1):
        range_sum_P = accumulate_P[ii + K] - accumulate_P[ii]
        ans = max(ans, range_sum_P)

    print(ans)

resolve()

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

    max_tmp = [0] * K
    for i in range(len(P) - K + 1):
        tmp = P[i: i + K]
        if sum(max_tmp) < sum(tmp):
            max_tmp = tmp

    ans = 0
    for number in max_tmp:
        dice = list(range(1, number + 1))
        for x in dice:
            p = 1 / number
            px = p * x
            ans += px

    print(ans)


resolve()

Fixed submission:
import itertools


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

    P = [(1 + p) / 2 for p in P]
    accumulate_P = [0] + list(itertools.accumulate(P))

    ans = 0
    for ii in range(N - K + 1):
        range_sum_P = accumulate_P[ii + K] - accumulate_P[ii]
        ans = max(ans, range_sum_P)

    print(ans)

resolve()