Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n,k=map(int,input().split())
p = list(map(int,input().split()))
def ex_even(a):
    return (a+1)/2
def ex_odd(b):
    return b//2 + 1
ans = [0] * k
q = deque(ans)
count = 0
for i in range(n):
    if q[0] < p[i]:
        q.popleft()
        q.append(p[i])
        count = max(count, sum(q))
    else:
        q.popleft()
        q.append(p[i])
if count % 2 == 0:
    print(ex_even(count) + 0.5*(k-1))
else:
    print(ex_odd(count) + 0.5*(k-1))

Fixed submission:
n,k=map(int,input().split())
p = list(map(int,input().split()))
def ex_even(a):
    return (a+1)/2
def ex_odd(b):
    return b//2 + 1
s = sum(p[0:k])
s_max = sum(p[0:k])
for i in range(n-k):
    s = s-p[i] + p[i+k]
    s_max = max(s_max,s)
if s_max % 2 == 0:
    print(ex_even(s_max) + 0.5*(k-1))
else:
    print(ex_odd(s_max) + 0.5*(k-1))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n,k=map(int,input().split())
p = list(map(int,input().split()))
def ex_even(a):
    return (a+1)/2
def ex_odd(b):
    return b//2 + 1
ans = [0] * k
q = deque(ans)
count = 0
for i in range(n):
    q.popleft()
    q.append(p[i])
    count = max(count, sum(q))
if count % 2 == 0:
    print(ex_even(count) + 0.5*(k-1))
else:
    print(ex_odd(count) + 0.5*(k-1))

Fixed submission:
n,k=map(int,input().split())
p = list(map(int,input().split()))
def ex_even(a):
    return (a+1)/2
def ex_odd(b):
    return b//2 + 1
s = sum(p[0:k])
s_max = sum(p[0:k])
for i in range(n-k):
    s = s-p[i] + p[i+k]
    s_max = max(s_max,s)
if s_max % 2 == 0:
    print(ex_even(s_max) + 0.5*(k-1))
else:
    print(ex_odd(s_max) + 0.5*(k-1))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n,k=map(int,input().split())
p = list(map(int,input().split()))
def ex_even(a):
    return (a+1)/2
def ex_odd(b):
    return b//2 + 1
ans = [0] * k
q = deque(ans)
c_max = 0
for i in range(1,n+1):
    if p[i-1] % 2 == 0:
        ex = ex_even(p[i-1])
        if ex > q[0]:
            q.popleft()
            q.append(ex)
            c_max = max(c_max, sum(q))
        else:
            q.popleft()
            q.append(ex)
    else:
        ex = ex_odd(p[i-1])
        if ex > q[0]:
            q.popleft()
            q.append(ex)
            c_max = max(c_max, sum(q))
        else:
            q.popleft()
            q.append(ex)
print(c_max)

Fixed submission:
n,k=map(int,input().split())
p = list(map(int,input().split()))
def ex_even(a):
    return (a+1)/2
def ex_odd(b):
    return b//2 + 1
s = sum(p[0:k])
s_max = sum(p[0:k])
for i in range(n-k):
    s = s-p[i] + p[i+k]
    s_max = max(s_max,s)
if s_max % 2 == 0:
    print(ex_even(s_max) + 0.5*(k-1))
else:
    print(ex_odd(s_max) + 0.5*(k-1))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n,k=map(int,input().split())
p = list(map(int,input().split()))
def ex_even(a):
    return (a+1)/2
def ex_odd(b):
    return b//2 + 1
ans = [0] * k
q = deque(ans)
c_max = 0
for i in range(1,n+1):
    if p[i-1] % 2 == 0:
        ex = ex_even(p[i-1])
        q.popleft()
        q.append(ex)
    else:
        ex = ex_odd(p[i-1])
        q.popleft()
        q.append(ex)
    c_max = max(c_max, sum(q))
print(c_max)

Fixed submission:
n,k=map(int,input().split())
p = list(map(int,input().split()))
def ex_even(a):
    return (a+1)/2
def ex_odd(b):
    return b//2 + 1
s = sum(p[0:k])
s_max = sum(p[0:k])
for i in range(n-k):
    s = s-p[i] + p[i+k]
    s_max = max(s_max,s)
if s_max % 2 == 0:
    print(ex_even(s_max) + 0.5*(k-1))
else:
    print(ex_odd(s_max) + 0.5*(k-1))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n,k=map(int,input().split())
p = list(map(int,input().split()))
def ex_even(a):
    return (a+1)/2
def ex_odd(b):
    li = []
    for i in range(1, b+1):
        li.append(i)
    return li[len(li)//2]
ans = [0] * k
q = deque(ans)
c_max = 0
for i in range(1,n+1):
    if p[i-1] % 2 == 0:
        ex = ex_even(p[i-1])
        q.popleft()
        q.append(ex)
    else:
        ex = ex_odd(p[i-1])
        q.popleft()
        q.append(ex)
    c_max = max(c_max, sum(q))
print(c_max)

Fixed submission:
n,k=map(int,input().split())
p = list(map(int,input().split()))
def ex_even(a):
    return (a+1)/2
def ex_odd(b):
    return b//2 + 1
s = sum(p[0:k])
s_max = sum(p[0:k])
for i in range(n-k):
    s = s-p[i] + p[i+k]
    s_max = max(s_max,s)
if s_max % 2 == 0:
    print(ex_even(s_max) + 0.5*(k-1))
else:
    print(ex_odd(s_max) + 0.5*(k-1))