Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p = [int(x) for x in input().split()]
ans = 0
for i in range(n-k+1):
    a = 0
    for j in range(k):
        a += (1+p[i+j])/2
    ans = max(ans, a)
print(ans)

Fixed submission:
n, k = map(int, input().split())
p = [int(x) for x in input().split()]
ans_list = [0]
a = 0
ans = 0
ans_ = 0
for i in range(n):
    a += (1+p[i])/2
    ans_list.append(a)
for i in range(n-k+1):
    ans_ = ans_list[i+k]-ans_list[i]
    ans = max(ans, ans_)
    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p = [int(x) for x in input().split()]
ans = 0
for i in range(n-k+1):
    a = 0
    for j in range(k):
        a += (1+p[i+j])/2
    if ans <= a:
        ans = a
print(ans)

Fixed submission:
n, k = map(int, input().split())
p = [int(x) for x in input().split()]
ans_list = [0]
a = 0
ans = 0
ans_ = 0
for i in range(n):
    a += (1+p[i])/2
    ans_list.append(a)
for i in range(n-k+1):
    ans_ = ans_list[i+k]-ans_list[i]
    ans = max(ans, ans_)
    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p = [int(x) for x in input().split()]
ans = 0
for i in range(n-k+1):
    a = 0
    for j in range(k):
        a += (1+p[i+j])/2
    if ans <= a:
        ans = a
print(ans)

Fixed submission:
n, k = map(int, input().split())
p = [int(x) for x in input().split()]
ans_list = [0]
a = 0
ans = 0
ans_ = 0
for i in range(n):
    a += (1+p[i])/2
    ans_list.append(a)
for i in range(n-k+1):
    ans_ = ans_list[i+k]-ans_list[i]
    ans = max(ans, ans_)
    
print(ans)

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = [int(x) for x in input().split()]
ans = 0
for i in range(n-k+1):
    a = 0
    for j in range(k):
        a += ((1+p[i+j])*p[i+j])/2
    if ans <= a:
        ans = a

ans_list.sort(reverse=True)
print(ans)

Fixed submission:
n, k = map(int, input().split())
p = [int(x) for x in input().split()]
ans_list = [0]
a = 0
ans = 0
ans_ = 0
for i in range(n):
    a += (1+p[i])/2
    ans_list.append(a)
for i in range(n-k+1):
    ans_ = ans_list[i+k]-ans_list[i]
    ans = max(ans, ans_)
    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p = [int(x) for x in input().split()]
ans_list=[]
for i in range(n-k+1):
    a = 0
    for j in range(k):
        a += (1+p[i+j])/2
    ans_list.append(a)
    
ans_list.sort(reverse=True)
print(ans_list[0])

Fixed submission:
n, k = map(int, input().split())
p = [int(x) for x in input().split()]
ans_list = [0]
a = 0
ans = 0
ans_ = 0
for i in range(n):
    a += (1+p[i])/2
    ans_list.append(a)
for i in range(n-k+1):
    ans_ = ans_list[i+k]-ans_list[i]
    ans = max(ans, ans_)
    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p = [int(x) for x in input().split()]
ans_list=[]
for i in range(n-k+1):
    a = 0
    for j in range(k):
        a += (1+p[i+j])/2
    ans_list.append(a)
    
ans_list.sort(reverse=True)
print(ans_list[0])

Fixed submission:
n, k = map(int, input().split())
p = [int(x) for x in input().split()]
ans_list = [0]
a = 0
ans = 0
ans_ = 0
for i in range(n):
    a += (1+p[i])/2
    ans_list.append(a)
for i in range(n-k+1):
    ans_ = ans_list[i+k]-ans_list[i]
    ans = max(ans, ans_)
    
print(ans)