Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
#n = int(stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rstrip().split()))
n,k = map(int, stdin.readline().rstrip().split())
p = list(map(int, stdin.readline().rstrip().split()))

m = 0
l =[]

for i in range(n-k+1):
    q = p[i:i+k]
    s = sum(q)
    if m < s:
        m = s
        l = q

ans = 0

for i in l:
    ans += (i+1) / 2

print(ans)


Fixed submission:
from sys import stdin
#n = int(stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rstrip().split()))
N,K = map(int, stdin.readline().rstrip().split())
P = list(map(int, stdin.readline().rstrip().split()))

Q = [(p+1)/2 for p in P]
c = [0]
for q in Q:
    c.append(c[-1] + q)

ans = 0
for i in range(K,N+1):
    ans = max(ans, c[i] - c[i-K])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
#n = int(stdin.readline().rstrip())
n,k = map(int, stdin.readline().rstrip().split())
#S = [list(map(int, stdin.readline().rstrip().split())) for _ in range(h)]#hの定義を忘れずに
p = list(map(int, stdin.readline().rstrip().split()))

ans = 0
for i in range(n-k+1):
    sum = 0
    for j in range(k):
        sum += p[i+j]
    ans = max(sum,ans)
    if ans == sum:
        real = 0
        for l in range(k):
            s = 0
            num = p[i+l]
            for j in range(num):
                s += 1+j
            real += s/num
    else:
        pass

print(real)


Fixed submission:
from sys import stdin
#n = int(stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rstrip().split()))
N,K = map(int, stdin.readline().rstrip().split())
P = list(map(int, stdin.readline().rstrip().split()))

Q = [(p+1)/2 for p in P]
c = [0]
for q in Q:
    c.append(c[-1] + q)

ans = 0
for i in range(K,N+1):
    ans = max(ans, c[i] - c[i-K])
print(ans)

Buggy python submission (verdict: Runtime Error):
from sys import stdin
#n = int(stdin.readline().rstrip())
n,k = map(int, stdin.readline().rstrip().split())
#S = [list(map(int, stdin.readline().rstrip().split())) for _ in range(h)]#hの定義を忘れずに
p = list(map(int, stdin.readline().rstrip().split()))

l = []
for i in range(n):
    s = 0
    d = p[i]
    for j in range(d):
        s += 1+j
    l.append(s/d)

ans = 0
for i in range(k):
    sums = [l[i+j] for j in range(k)]
    ans = max(sum(sums), ans)
print(ans)


Fixed submission:
from sys import stdin
#n = int(stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rstrip().split()))
N,K = map(int, stdin.readline().rstrip().split())
P = list(map(int, stdin.readline().rstrip().split()))

Q = [(p+1)/2 for p in P]
c = [0]
for q in Q:
    c.append(c[-1] + q)

ans = 0
for i in range(K,N+1):
    ans = max(ans, c[i] - c[i-K])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
#n = int(stdin.readline().rstrip())
n,k = map(int, stdin.readline().rstrip().split())
#S = [list(map(int, stdin.readline().rstrip().split())) for _ in range(h)]#hの定義を忘れずに
p = list(map(int, stdin.readline().rstrip().split()))

ans = 0

for i in range(n-k+1):
    sums = 0
    for j in range(k):
        num = p[i+j]
        sum = 0
        for u in range(num):
            sum += u+1
        sum = sum/num
        sums += sum
    ans = max(ans, sums)

print(ans)


Fixed submission:
from sys import stdin
#n = int(stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rstrip().split()))
N,K = map(int, stdin.readline().rstrip().split())
P = list(map(int, stdin.readline().rstrip().split()))

Q = [(p+1)/2 for p in P]
c = [0]
for q in Q:
    c.append(c[-1] + q)

ans = 0
for i in range(K,N+1):
    ans = max(ans, c[i] - c[i-K])
print(ans)