Buggy python submission (verdict: Time Limit Exceeded):
def expected_value(arr):
    return [(1 + ele) / 2 for ele in arr]

n, k = [int(x) for x in input().split()]
arr = list(map(int,input().split()))
ev = expected_value(arr)

sum_tmp = [sum(arr[i:i+k]) for i in range(n - (k - 1))]
max_v = max(sum_tmp)
max_i = sum_tmp.index(max_v)
print(sum(ev[0:max_i+k]) - sum(ev[0:max_i]))


Fixed submission:
n, k = [int(x) for x in input().split()]
arr = list(map(int,input().split()))

m = sum(arr[0:k])
sump = m

for i in range(1, n-k+1):
    sump = sump - arr[i-1] + arr[i+k-1]
    if m < sump:
        m = sump

ans = (m + k) / 2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def expected_value(arr):
    return ([sum(range(1, ele+1)) / ele for ele in arr])

n, k = [int(x) for x in input().split()]
arr = list(map(int,input().split()))
sum_tmp = [sum(arr[i:i+k]) for i in range(n - (k - 1))]
max_v = max(sum_tmp)
max_i = sum_tmp.index(max_v)
print(sum(expected_value(arr[max_i:max_i + k])))

Fixed submission:
n, k = [int(x) for x in input().split()]
arr = list(map(int,input().split()))

m = sum(arr[0:k])
sump = m

for i in range(1, n-k+1):
    sump = sump - arr[i-1] + arr[i+k-1]
    if m < sump:
        m = sump

ans = (m + k) / 2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = [int(x) for x in input().split()]
arr = list(map(int,input().split()))

sum_tmp = [sum(arr[i:i+k]) for i in range(n - (k - 1))]
max_v = max(sum_tmp)
max_i = sum_tmp.index(max_v)
ans = 0
for j in arr[max_i:max_i+k]:
    ans += sum(range(1, j+1)) / j
print(ans)

Fixed submission:
n, k = [int(x) for x in input().split()]
arr = list(map(int,input().split()))

m = sum(arr[0:k])
sump = m

for i in range(1, n-k+1):
    sump = sump - arr[i-1] + arr[i+k-1]
    if m < sump:
        m = sump

ans = (m + k) / 2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
if __name__ == "__main__":
    n, k = map(int, input().split())
    arr = list(map(int,input().split()))

    tmp = 0
    tmp_arr = []
    sum_tmp = [sum(arr[i:i+k]) for i in range(n - (k - 1))]
    max_v = max(sum_tmp)
    max_i = sum_tmp.index(max_v)
    ans = 0
    for j in arr[max_i:max_i+k]:
        ans += sum(range(1, j+1)) / j
    print(ans)

Fixed submission:
n, k = [int(x) for x in input().split()]
arr = list(map(int,input().split()))

m = sum(arr[0:k])
sump = m

for i in range(1, n-k+1):
    sump = sump - arr[i-1] + arr[i+k-1]
    if m < sump:
        m = sump

ans = (m + k) / 2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
if __name__ == "__main__":
    n, k = map(int, input().split())
    arr = list(map(int,input().split()))

    tmp = 0
    tmp_arr = []
    sum_tmp = [sum(arr[i:i+k]) for i in range(n - (k - 1))]
    max_v = max(sum_tmp)
    max_i = sum_tmp.index(max_v)
    ans = 0
    for j in arr[max_i:max_i+k]:
        tmp_sum = 0
        for m in range(1, j+1):
            tmp_sum += m
        ans += tmp_sum / j
    print(ans)

Fixed submission:
n, k = [int(x) for x in input().split()]
arr = list(map(int,input().split()))

m = sum(arr[0:k])
sump = m

for i in range(1, n-k+1):
    sump = sump - arr[i-1] + arr[i+k-1]
    if m < sump:
        m = sump

ans = (m + k) / 2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
if __name__ == "__main__":
    n, k = map(int, input().split())
    arr = list(map(int,input().split()))

    tmp = 0
    tmp_arr = []
    for i in range(n - (k - 1)):
        sum_tmp = sum(arr[i:i+k])
        if sum_tmp >= tmp:
            tmp = sum_tmp
            tmp_arr = arr[i:i+k]
    ans = 0
    for j in tmp_arr:
        tmp_sum = 0
        for m in range(1, j+1):
            tmp_sum += m
        ans += tmp_sum / j
    print(ans)

Fixed submission:
n, k = [int(x) for x in input().split()]
arr = list(map(int,input().split()))

m = sum(arr[0:k])
sump = m

for i in range(1, n-k+1):
    sump = sump - arr[i-1] + arr[i+k-1]
    if m < sump:
        m = sump

ans = (m + k) / 2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def get_max_index(n, k, arr):
    tmp = 0
    index = 0
    tmp_arr = []
    for i in range(n - (k - 1)):
        sum_tmp = sum(arr[i:i+k])
        if sum_tmp >= tmp:
            tmp = sum_tmp
            index = i
            tmp_arr = arr[i:i+k]
    ans = 0
    for j in tmp_arr:
        tmp_sum = 0
        for m in range(1, j+1):
            tmp_sum += m
        ans += tmp_sum / j
    return ans

if __name__ == "__main__":
    n, k = map(int, input().split())
    arr = list(map(int,input().split()))
    print(get_max_index(n, k, arr))

Fixed submission:
n, k = [int(x) for x in input().split()]
arr = list(map(int,input().split()))

m = sum(arr[0:k])
sump = m

for i in range(1, n-k+1):
    sump = sump - arr[i-1] + arr[i+k-1]
    if m < sump:
        m = sump

ans = (m + k) / 2

print(ans)