Buggy python submission (verdict: Time Limit Exceeded):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, K = MAP()
P = LIST()

acc = [0]*N
for i in range(N):
	su = (P[i]*(P[i]+1)/2)/P[i]
	acc[i] = su

ma = 0
for i in range(N - K + 1):
	ma2 = 0
	for j in range(K):
		ma2 += acc[i+j]
	if ma < ma2:
		ma = ma2

print(ma)

Fixed submission:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, K = MAP()
P = LIST()

acc = [0]*N
for i in range(N):
	su = (P[i]*(P[i]+1)/2)/P[i]
	acc[i] = su

accs = [0]*N
accs[0] = acc[0]
for i in range(1, N):
	accs[i] = accs[i - 1] + acc[i]

ma = 0
for i in range(K - 1, N):
	ma2 = 0
	if i == K - 1:
		ma2 = accs[i]
	else:
		ma2 = accs[i] - accs[i - K]
	if ma < ma2:
		ma = ma2

print(ma)

Buggy python submission (verdict: Time Limit Exceeded):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, K = MAP()
P = LIST()

acc = [0]*N
for i in range(N):
	su = 0
	for j in range(1, P[i] + 1):
		su += j/P[i]
	acc[i] = su

ma = 0
for i in range(N - K + 1):
	ma2 = 0
	for j in range(K):
		ma2 += acc[i+j]
	if ma < ma2:
		ma = ma2

print(ma)

Fixed submission:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, K = MAP()
P = LIST()

acc = [0]*N
for i in range(N):
	su = (P[i]*(P[i]+1)/2)/P[i]
	acc[i] = su

accs = [0]*N
accs[0] = acc[0]
for i in range(1, N):
	accs[i] = accs[i - 1] + acc[i]

ma = 0
for i in range(K - 1, N):
	ma2 = 0
	if i == K - 1:
		ma2 = accs[i]
	else:
		ma2 = accs[i] - accs[i - K]
	if ma < ma2:
		ma = ma2

print(ma)