Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
P = list(map(int, input().split()))
memo = P[:K]
ans = sum(memo)

for i in range(K, N):
    memo.pop(0)
    memo.append(P[i])
    tmp = sum(memo)
    if tmp > ans:
        ans = tmp

print(K-1+((ans-K+1) - 0.5*((ans-K+1)-1)))

Fixed submission:
N, K = map(int, input().split())
P = list(map(int, input().split()))
memo = sum(P[:K])
ans = memo

for i in range(K, N):
    memo = memo - P[i-K] + P[i]
    ans = max(ans, memo)

print(K-1+((ans-K+1) - 0.5*((ans-K+1)-1)))

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
P = list(map(int, input().split()))
memo = P[:K]
ans = sum(memo)

for i in range(K, N):
    memo.pop(0)
    memo.append(P[i])
    if sum(memo) > ans:
        ans = memo

print(K-1+((ans-K+1) - 0.5*((ans-K+1)-1)))

Fixed submission:
N, K = map(int, input().split())
P = list(map(int, input().split()))
memo = sum(P[:K])
ans = memo

for i in range(K, N):
    memo = memo - P[i-K] + P[i]
    ans = max(ans, memo)

print(K-1+((ans-K+1) - 0.5*((ans-K+1)-1)))

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
P = list(map(int, input().split()))
memo = P[:K]
ans = sum(memo)

for i in range(K, N):
    memo.pop(0)
    memo.append(P[i])
    ans = max(ans, sum(memo))

print(K-1+((ans-K+1) - 0.5*((ans-K+1)-1)))


Fixed submission:
N, K = map(int, input().split())
P = list(map(int, input().split()))
memo = sum(P[:K])
ans = memo

for i in range(K, N):
    memo = memo - P[i-K] + P[i]
    ans = max(ans, memo)

print(K-1+((ans-K+1) - 0.5*((ans-K+1)-1)))

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

memo = [-1]*K

for memo_i in range(K):
    memo[memo_i] = P[memo_i]

ans = sum(memo)

for i in range(K, N):
    memo.pop(0)
    memo.append(P[i])
    sum_ = sum(memo)
    ans = max(ans, sum_)

tmp = ans - K + 1
print(K-1+(tmp - 0.5*(tmp-1)))

Fixed submission:
N, K = map(int, input().split())
P = list(map(int, input().split()))
memo = sum(P[:K])
ans = memo

for i in range(K, N):
    memo = memo - P[i-K] + P[i]
    ans = max(ans, memo)

print(K-1+((ans-K+1) - 0.5*((ans-K+1)-1)))

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

memo = [-1]*K

for memo_i in range(K):
    memo[memo_i] = P[memo_i]

ans = sum(memo)

for i in range(K, N):
    memo.pop(0)
    memo.append(P[i])
    sum_ = sum(memo)
    ans = max(ans, sum_)

tmp = ans - K + 1
print(K-1+(tmp - 0.5*(tmp-1)))

Fixed submission:
N, K = map(int, input().split())
P = list(map(int, input().split()))
memo = sum(P[:K])
ans = memo

for i in range(K, N):
    memo = memo - P[i-K] + P[i]
    ans = max(ans, memo)

print(K-1+((ans-K+1) - 0.5*((ans-K+1)-1)))

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
P = list(map(int, input().split()))

ans = -1
memo = [-1]*(K-1)

for memo_i in range(K-1):
    memo[memo_i] = P[memo_i]

for i in range(K-1, N):
    sum_ = sum(memo) + P[i]
    ans = max(ans, sum_)
    memo.pop(0)
    memo.append(P[i])

tmp = ans - K + 1
print(K-1+(tmp - 0.5*(tmp-1)))

Fixed submission:
N, K = map(int, input().split())
P = list(map(int, input().split()))
memo = sum(P[:K])
ans = memo

for i in range(K, N):
    memo = memo - P[i-K] + P[i]
    ans = max(ans, memo)

print(K-1+((ans-K+1) - 0.5*((ans-K+1)-1)))

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

ans = -1
for i in range(N-K+1):
    sum = 0
    for j in range(K):
        tmp = P[i+j]
        sum += tmp - 0.5*(tmp-1)
    
    ans = max(ans, sum)

print(ans)

Fixed submission:
N, K = map(int, input().split())
P = list(map(int, input().split()))
memo = sum(P[:K])
ans = memo

for i in range(K, N):
    memo = memo - P[i-K] + P[i]
    ans = max(ans, memo)

print(K-1+((ans-K+1) - 0.5*((ans-K+1)-1)))

Buggy python submission (verdict: Time Limit Exceeded):
import statistics

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

ans = -1
for i in range(N-K+1):
    sum = 0
    for j in range(K):
        tmp = P[i+j]
        sum += tmp - 0.5*(tmp-1)
    
    ans = max(ans, sum)

print(ans)

Fixed submission:
N, K = map(int, input().split())
P = list(map(int, input().split()))
memo = sum(P[:K])
ans = memo

for i in range(K, N):
    memo = memo - P[i-K] + P[i]
    ans = max(ans, memo)

print(K-1+((ans-K+1) - 0.5*((ans-K+1)-1)))