Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
n,k = [int(i) for i in input().split(" ")]
p = [int(i) for i in input().split(" ")]
kita = {}
maxn = 0
for i in range(n-k+1):
    kt = 0
    for j in range(k):
        if not p[i+j] in kita.keys():
            kita[p[i+j]] = 0.5*(p[i+j]+1)
        kt += kita[p[i+j]]
    if kt > maxn:
        maxn = kt
print(maxn)

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))
maxn = 0
sum = 0
for i in range(n-k+1):
	if i == 0:
		for j in range(k):
			sum += p[j]
		maxn = sum
	else:
		sum -= p[i-1]
		sum += p[i+k-1]
		if maxn < sum:
			maxn = sum
print(0.5*(maxn+k))

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
n,k = [int(i) for i in input().split(" ")]
p = [int(i) for i in input().split(" ")]
kita = [0.5*(i+1) for i in range(max(p)+1)]
maxn = 0
for i in range(n-k+1):
    kt = 0
    for j in range(k):
        kt += kita[p[i+j]]
    if kt > maxn:
        maxn = kt
print(maxn)

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))
maxn = 0
sum = 0
for i in range(n-k+1):
	if i == 0:
		for j in range(k):
			sum += p[j]
		maxn = sum
	else:
		sum -= p[i-1]
		sum += p[i+k-1]
		if maxn < sum:
			maxn = sum
print(0.5*(maxn+k))

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
n,k = [int(i) for i in input().split(" ")]
p = [int(i) for i in input().split(" ")]
kita = [0.5*(i+1) for i in range(max(p)+1)]
kitai = [kita[i] for i in p]
maxn = 0
for i in range(n-k+1):
    kt = 0
    for j in range(k):
        kt += kita[p[i+j]]
    if kt > maxn:
        maxn = kt
print(maxn)

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))
maxn = 0
sum = 0
for i in range(n-k+1):
	if i == 0:
		for j in range(k):
			sum += p[j]
		maxn = sum
	else:
		sum -= p[i-1]
		sum += p[i+k-1]
		if maxn < sum:
			maxn = sum
print(0.5*(maxn+k))

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
n,k = [int(i) for i in input().split(" ")]
p = [int(i) for i in input().split(" ")]
kita = [0.5*(i+1) for i in range(max(p)+1)]
kitai = [kita[i] for i in p]
maxn = 0
for i in range(n-k+1):
    kt = 0
    for j in range(k):
        kt += kitai[i+j]
    if kt > maxn:
        maxn = kt
print(maxn)

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))
maxn = 0
sum = 0
for i in range(n-k+1):
	if i == 0:
		for j in range(k):
			sum += p[j]
		maxn = sum
	else:
		sum -= p[i-1]
		sum += p[i+k-1]
		if maxn < sum:
			maxn = sum
print(0.5*(maxn+k))

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
'''
n,k = [int(i) for i in input().split(" ")]
p = [int(i) for i in input().split(" ")]

shi = []
for i in range(max(p)):
    if i == 0:
        shi.append(1)
    else:
        shi.append(i+1+shi[i-1])

kitai = [shi[i]/(i+1) for i in range(len(shi))]

max = 0
for i in range(n-k+1):
    kt = 0
    for j in range(k):
        kt += kitai[p[i+j]-1]
    if kt > max:
        max = kt
print("{:.12f}".format(float(max)))
'''

n,k = [int(i) for i in input().split(" ")]
p = [int(i) for i in input().split(" ")]
kitai = [0.5*(i+1) for i in p]
maxn = 0
for i in range(n-k+1):
    kt = 0
    for j in range(k):
        kt += kitai[i+j]
    if kt > maxn:
        maxn = kt
print(maxn)

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))
maxn = 0
sum = 0
for i in range(n-k+1):
	if i == 0:
		for j in range(k):
			sum += p[j]
		maxn = sum
	else:
		sum -= p[i-1]
		sum += p[i+k-1]
		if maxn < sum:
			maxn = sum
print(0.5*(maxn+k))

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
n,k = [int(i) for i in input().split(" ")]
p = [int(i) for i in input().split(" ")]

shi = []
for i in range(max(p)):
    if i == 0:
        shi.append(1)
    else:
        shi.append(i+1+shi[i-1])

kitai = [shi[i]/(i+1) for i in range(len(shi))]

max = 0
for i in range(n-k+1):
    kt = 0
    for j in range(k):
        kt += kitai[p[i+j]-1]
    if kt > max:
        max = kt
print("{:.12f}".format(float(max)))

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))
maxn = 0
sum = 0
for i in range(n-k+1):
	if i == 0:
		for j in range(k):
			sum += p[j]
		maxn = sum
	else:
		sum -= p[i-1]
		sum += p[i+k-1]
		if maxn < sum:
			maxn = sum
print(0.5*(maxn+k))