Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = list(map(int,input().split()))

ls = []
ans = 0

for i in range(k):
    ans += p[i]
    
max_ans = ans
max_index = 0

for i in range(n-k):
    ans -= p[i]
    ans += p[i+k]
    if max_ans < ans:
        max_ans = ans
        max_index = i+1

ans = 0
al = []
for i in range(k):
    pp = p[max_index+i]
    if pp == 200000:
        ans += 2000010000.0000002
    else:
        for j in range(pp):
            ans += (1/pp*(j+1))
            al.append(ans)
    
print(ans)
        

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))

ls = []
ans = 0

for i in range(k):
    ans += p[i]
    
max_ans = ans
max_index = 0

for i in range(n-k):
    ans -= p[i]
    ans += p[i+k]
    if max_ans < ans:
        max_ans = ans
        max_index = i+1

ans = 0
for i in range(k):
    pp = p[max_index+i]
    for j in range(pp):
        ans += (1/pp*(j+1))
    
print(ans)

Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
p = list(map(int,input().split()))

ls = []
ans = 0

for i in range(k):
    ans += p[i]
    
max_ans = ans
max_index = 0

for i in range(n-k):
    ans -= p[i]
    ans += p[i+k]
    if max_ans < ans:
        max_ans = ans
        max_index = i+1

ans = 0
al = []
for i in range(k):
    pp = p[max_index+i]
    if pp = 200000:
        ans += 2000010000.0000002
    else:
        for j in range(pp):
            ans += (1/pp*(j+1))
            al.append(ans)
    
print(ans)
        

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))

ls = []
ans = 0

for i in range(k):
    ans += p[i]
    
max_ans = ans
max_index = 0

for i in range(n-k):
    ans -= p[i]
    ans += p[i+k]
    if max_ans < ans:
        max_ans = ans
        max_index = i+1

ans = 0
for i in range(k):
    pp = p[max_index+i]
    for j in range(pp):
        ans += (1/pp*(j+1))
    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = list(map(int,input().split()))

ls = []
ans = 0

for i in range(k):
    ans += p[i]
    
max_ans = ans
max_index = 0

for i in range(n-k):
    ans -= p[i]
    ans += p[i+k]
    if max_ans < ans:
        max_ans = ans
        max_index = i+1

ans = 0
for i in range(k):
    for j in range(p[max_index+i]):
        ans += (1/p[max_index+i]*(j+1))
    
print(ans)
        

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))

ls = []
ans = 0

for i in range(k):
    ans += p[i]
    
max_ans = ans
max_index = 0

for i in range(n-k):
    ans -= p[i]
    ans += p[i+k]
    if max_ans < ans:
        max_ans = ans
        max_index = i+1

ans = 0
for i in range(k):
    pp = p[max_index+i]
    for j in range(pp):
        ans += (1/pp*(j+1))
    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = list(map(int,input().split()))

ls = []
ans = 0

for i in range(k):
    ans += p[i]
    
ls.append([ans,0])

for i in range(n-k):
    ans -= p[i]
    ans += p[i+k]
    ls.append([ans,i+1])

ls = sorted(ls,reverse=True)

ans = 0
for i in range(k):
    for j in range(p[ls[0][1]+i]):
        ans += (1/p[ls[0][1]+i]*(j+1))
    
print(ans)
        

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))

ls = []
ans = 0

for i in range(k):
    ans += p[i]
    
max_ans = ans
max_index = 0

for i in range(n-k):
    ans -= p[i]
    ans += p[i+k]
    if max_ans < ans:
        max_ans = ans
        max_index = i+1

ans = 0
for i in range(k):
    pp = p[max_index+i]
    for j in range(pp):
        ans += (1/pp*(j+1))
    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = list(map(int,input().split()))

ls = []
ans = 0

for i in range(k):
    ans += p[i]
    
ls.append([ans,0])

for i in range(n-k):
    ans -= p[i]
    ans += p[i+k]
    ls.append([ans,i+1])
    

ls = sorted(ls,reverse=True)

ans = 0
for i in range(k):
    for j in range(p[ls[0][1]+i]):
        ans += (1/p[ls[0][1]+i]*(j+1))
    
print(ans)
        

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))

ls = []
ans = 0

for i in range(k):
    ans += p[i]
    
max_ans = ans
max_index = 0

for i in range(n-k):
    ans -= p[i]
    ans += p[i+k]
    if max_ans < ans:
        max_ans = ans
        max_index = i+1

ans = 0
for i in range(k):
    pp = p[max_index+i]
    for j in range(pp):
        ans += (1/pp*(j+1))
    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = list(map(int,input().split()))

ls = []
for i in range(n-k+1):
    ans = []
    for j in range(k):
        ans.append(p[i+j])
    ans.append(sum(ans))
    ls.append(ans)
    

ls = sorted(ls,key=lambda x:x[k])

ans = 0
for i in range(k):
    for j in range(ls[-1][i]):
        ans += (1/ls[-1][i]*(j+1))
    
print(ans)
        

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))

ls = []
ans = 0

for i in range(k):
    ans += p[i]
    
max_ans = ans
max_index = 0

for i in range(n-k):
    ans -= p[i]
    ans += p[i+k]
    if max_ans < ans:
        max_ans = ans
        max_index = i+1

ans = 0
for i in range(k):
    pp = p[max_index+i]
    for j in range(pp):
        ans += (1/pp*(j+1))
    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = list(map(int,input().split()))

ls = []
for i in range(n):
    ans = 0
    for l in range(p[i]):
        ans += (1/p[i]*(l+1))
    ls.append(ans)
    
al = []
for i in range(n-k+1):
    ans = 0
    for j in range(k):
        ans += ls[i+j]
    al.append(ans)
    
print(max(al))
        

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))

ls = []
ans = 0

for i in range(k):
    ans += p[i]
    
max_ans = ans
max_index = 0

for i in range(n-k):
    ans -= p[i]
    ans += p[i+k]
    if max_ans < ans:
        max_ans = ans
        max_index = i+1

ans = 0
for i in range(k):
    pp = p[max_index+i]
    for j in range(pp):
        ans += (1/pp*(j+1))
    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = list(map(int,input().split()))

ls = []
for i in range(n-k+1):
    ans = 0
    for j in range(k):
        for l in range(p[i+j]):
            ans += (1/p[i+j]*(l+1))
    ls.append(ans)
    
print(max(ls))
        

Fixed submission:
n,k = map(int,input().split())
p = list(map(int,input().split()))

ls = []
ans = 0

for i in range(k):
    ans += p[i]
    
max_ans = ans
max_index = 0

for i in range(n-k):
    ans -= p[i]
    ans += p[i+k]
    if max_ans < ans:
        max_ans = ans
        max_index = i+1

ans = 0
for i in range(k):
    pp = p[max_index+i]
    for j in range(pp):
        ans += (1/pp*(j+1))
    
print(ans)