Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
import itertools
 
n, k = map(int, input().split())
p = list(map(int, input().split()))
 
kukan = 0
kukan_list = deque()
for i in range(k):
    kukan_list.append(p[i])
 
for i in range(n - k+1):
    if kukan < sum(kukan_list):
        kukan = sum(kukan_list)
    if i+k<n:
        kukan_list.popleft()
        kukan_list.append(p[i+k])
 
 
ans = kukan / 2 + 0.5 * k
print(ans)

Fixed submission:
from collections import deque
import itertools
import time

n, k = map(int, input().split())
p = list(map(int, input().split()))

kukan = 0
for i in range(k):
    kukan += p[i]

kukan_max = kukan
for i in range(n - k + 1):
    kukan_max = max(kukan_max, kukan)
    if i+k<n:
        kukan += p[i+k]
        kukan -= p[i]
ans = kukan_max / 2 + 0.5 * k
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
import itertools

n, k = map(int, input().split())
p = list(map(int, input().split()))

kukan = 0
kukan_list = deque()
for i in range(k):
    kukan_list.append(p[i])

for i in range(n - k+1):
    if kukan < sum(kukan_list):
        kukan = sum(kukan_list)
    if i+k<n:
        kukan_list.popleft()
        kukan_list.append(p[i+k])


ans = kukan / 2 + 0.5 * k
print(ans)


Fixed submission:
from collections import deque
import itertools
import time

n, k = map(int, input().split())
p = list(map(int, input().split()))

kukan = 0
for i in range(k):
    kukan += p[i]

kukan_max = kukan
for i in range(n - k + 1):
    kukan_max = max(kukan_max, kukan)
    if i+k<n:
        kukan += p[i+k]
        kukan -= p[i]
ans = kukan_max / 2 + 0.5 * k
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p = list(map(int, input().split()))

kukan = 0
kukan_list = []
for i in range(n - k + 1):
    if kukan < sum(p[i:i + k]):
        kukan = sum(p[i:i + k])
        kukan_list = p[i:i + k]

ans = kukan / 2 + 0.5 * k
print(ans)


Fixed submission:
from collections import deque
import itertools
import time

n, k = map(int, input().split())
p = list(map(int, input().split()))

kukan = 0
for i in range(k):
    kukan += p[i]

kukan_max = kukan
for i in range(n - k + 1):
    kukan_max = max(kukan_max, kukan)
    if i+k<n:
        kukan += p[i+k]
        kukan -= p[i]
ans = kukan_max / 2 + 0.5 * k
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p = list(map(int, input().split()))

kukan = 0
kukan_list = []
for i in range(n - k + 1):
    if kukan < sum(p[i:i + k]):
        kukan = sum(p[i:i + k])
        kukan_list = p[i:i + k]

ans = 0
for i in range(k):
    if kukan_list[i] % 2 == 0:
        x = kukan_list[i] / 2 + 0.5
    else:
        x = kukan_list[i] // 2 + 1
    ans += x
print(ans)


Fixed submission:
from collections import deque
import itertools
import time

n, k = map(int, input().split())
p = list(map(int, input().split()))

kukan = 0
for i in range(k):
    kukan += p[i]

kukan_max = kukan
for i in range(n - k + 1):
    kukan_max = max(kukan_max, kukan)
    if i+k<n:
        kukan += p[i+k]
        kukan -= p[i]
ans = kukan_max / 2 + 0.5 * k
print(ans)