Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
p = list(map(int, input().split()))
max_ans = 0
tmp_ans = 0
queue = []
for i in range(N):
    e = (p[i] + 1) / 2 
    tmp_ans += e
    queue.append(e)
    if len(queue) > K:
        tmp_ans = tmp_ans - queue.pop(0)
    max_ans = max(max_ans, tmp_ans)
print(max_ans)

Fixed submission:
from collections import deque
N, K = map(int, input().split())
p = list(map(int, input().split()))
max_ans = 0
tmp_ans = 0
queue = deque([])
for i in range(N):
    e = (p[i] + 1) / 2 
    tmp_ans += e
    queue.append(e)
    if len(queue) > K:
        tmp_ans = tmp_ans - queue.popleft()
    max_ans = max(max_ans, tmp_ans)
print(max_ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
p = list(map(int, input().split()))
max_ans = 0
tmp_ans = 0
queue = []
for i in range(N):
    e = (p[i] + 1) / 2 
    queue.append(e)
    if len(queue) > K:
        tmp_ans = tmp_ans - queue.pop(0) + e
    else:
        tmp_ans += e
    max_ans = max(max_ans, tmp_ans)
print(max_ans)

Fixed submission:
from collections import deque
N, K = map(int, input().split())
p = list(map(int, input().split()))
max_ans = 0
tmp_ans = 0
queue = deque([])
for i in range(N):
    e = (p[i] + 1) / 2 
    tmp_ans += e
    queue.append(e)
    if len(queue) > K:
        tmp_ans = tmp_ans - queue.popleft()
    max_ans = max(max_ans, tmp_ans)
print(max_ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
p = list(map(int, input().split()))
max_ans = 0
tmp_ans = 0
queue = []
for i in range(N):
    e = (p[i] + 1) / 2 
    queue.append(e)
    if len(queue) > K:
        tmp_ans = tmp_ans - queue[0] + e
        queue.pop(0)
    else:
        tmp_ans += e
    max_ans = max(max_ans, tmp_ans)
print(max_ans)

Fixed submission:
from collections import deque
N, K = map(int, input().split())
p = list(map(int, input().split()))
max_ans = 0
tmp_ans = 0
queue = deque([])
for i in range(N):
    e = (p[i] + 1) / 2 
    tmp_ans += e
    queue.append(e)
    if len(queue) > K:
        tmp_ans = tmp_ans - queue.popleft()
    max_ans = max(max_ans, tmp_ans)
print(max_ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
p = list(map(int, input().split()))
max_ans = 0
tmp_ans = 0
queue = []
for i in range(N):
    e = (p[i] + 1) / 2 
    queue.append(e)
    if len(queue) > K:
        tmp_ans = tmp_ans - queue[0] + e
        queue.pop(0)
    else:
        tmp_ans += e
    max_ans = max(max_ans, tmp_ans)
print(max_ans)

Fixed submission:
from collections import deque
N, K = map(int, input().split())
p = list(map(int, input().split()))
max_ans = 0
tmp_ans = 0
queue = deque([])
for i in range(N):
    e = (p[i] + 1) / 2 
    tmp_ans += e
    queue.append(e)
    if len(queue) > K:
        tmp_ans = tmp_ans - queue.popleft()
    max_ans = max(max_ans, tmp_ans)
print(max_ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
p = list(map(int, input().split()))
e = [0] * N
for i in range(N):
    e[i] = sum(list(range(p[i]+1))) / p[i]   
ans = -1
for i in range(N):
    if ans < sum(e[i:i+K]):
        ans = sum(e[i:i+K])
print(ans)

Fixed submission:
from collections import deque
N, K = map(int, input().split())
p = list(map(int, input().split()))
max_ans = 0
tmp_ans = 0
queue = deque([])
for i in range(N):
    e = (p[i] + 1) / 2 
    tmp_ans += e
    queue.append(e)
    if len(queue) > K:
        tmp_ans = tmp_ans - queue.popleft()
    max_ans = max(max_ans, tmp_ans)
print(max_ans)