Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
p = list(map(int,input().split()))
ans = 0
cum = [0]
     
for i in range(len(p)):
    ex = (1 + p[i])/2
    p[i] = ex
        
for i in  range(len(p)):
    cum.append(p[i] + cum[i])
        
for i in range(K, N+1):
    ans  = max(ans, cum[i] - cum[i-K])
     
print(ans)    
N, K = map(int, input().split())
p = list(map(int,input().split()))
ans = 0
cum = [0]
     
for i in range(len(p)):
    ex = (1 + p[i])/2
    p[i] = ex
        
for i in  range(len(p)):
    cum.append(p[i] + cum[i])
        
for i in range(K, N+1):
    ans  = max(ans, cum[i] - cum[i-K])
     
print(ans)    

Fixed submission:
N, K = map(int, input().split())
p = list(map(int,input().split()))
ans = 0
cum = [0]
     
for i in range(len(p)):
    ex = (1 + p[i])/2
    p[i] = ex
        
for i in  range(len(p)):
    cum.append(p[i] + cum[i])
        
for i in range(K, N+1):
    ans  = max(ans, cum[i] - cum[i-K])
     
print(ans)

Buggy python submission (verdict: Runtime Error):
    N, K = map(int, input().split())
    p = list(map(int,input().split()))
    ans = 0
    cum = [0]
     
    for i in range(len(p)):
        ex = (1 + p[i])/2
        p[i] = ex
        
    for i in  range(len(p)):
        cum.append(p[i] + cum[i])
        
    for i in range(K, N+1):
        ans  = max(ans, cum[i] - cum[i-K])
     
    print(ans)

Fixed submission:
N, K = map(int, input().split())
p = list(map(int,input().split()))
ans = 0
cum = [0]
     
for i in range(len(p)):
    ex = (1 + p[i])/2
    p[i] = ex
        
for i in  range(len(p)):
    cum.append(p[i] + cum[i])
        
for i in range(K, N+1):
    ans  = max(ans, cum[i] - cum[i-K])
     
print(ans)

Buggy python submission (verdict: Runtime Error):
N,K = map(int, input().split())
P = list(map(int,input().split()))

def calc_expected_val(val):
    return float((1+val)/2)

def main():
    expected_val = 0
    expected_val_list = []
    sum_val = 0
    sum_val_list = []
    sum_K = 0
    sum_K_list = []
    max_expected_val = 0
    for i in range(N):
        expected_val = calc_expected_val(P[i])
        expected_val_list.append(expected_val)
        sum_val += expected_val
        sum_val_list.append(sum_val)

    for j in range(K, N):
        sum_K = sum_val_list[j] - sum_val_list[j-K]
        sum_K_list.append(sum_K)

    max_expected_val = max(sum_K_list)
    print(max_expected_val)

if __name__ == "__main__":
    main()
    

Fixed submission:
N, K = map(int, input().split())
p = list(map(int,input().split()))
ans = 0
cum = [0]
     
for i in range(len(p)):
    ex = (1 + p[i])/2
    p[i] = ex
        
for i in  range(len(p)):
    cum.append(p[i] + cum[i])
        
for i in range(K, N+1):
    ans  = max(ans, cum[i] - cum[i-K])
     
print(ans)

Buggy python submission (verdict: Runtime Error):
N,K = map(int, input().split())
P = list(map(int,input().split()))

def calc_expected_val(val):
    return (1+val)/2

def main():
    expected_val = 0
    expected_val_list = []
    sum_val = 0
    sum_val_list = []
    sum_K = 0
    sum_K_list = []
    max_expected_val = 0
    for i in range(N):
        expected_val = calc_expected_val(P[i])
        expected_val_list.append(expected_val)
        sum_val += expected_val
        sum_val_list.append(sum_val)

    for j in range(K, N):
        sum_K = sum_val_list[j] - sum_val_list[j-K]
        sum_K_list.append(sum_K)

    max_expected_val = max(sum_K_list)
    print(max_expected_val)

if __name__ == "__main__":
    main()
    

Fixed submission:
N, K = map(int, input().split())
p = list(map(int,input().split()))
ans = 0
cum = [0]
     
for i in range(len(p)):
    ex = (1 + p[i])/2
    p[i] = ex
        
for i in  range(len(p)):
    cum.append(p[i] + cum[i])
        
for i in range(K, N+1):
    ans  = max(ans, cum[i] - cum[i-K])
     
print(ans)

Buggy python submission (verdict: Runtime Error):
N,K = map(int, input().split())
P = list(map(int,input().split()))

def calc_expected_val(val):
    return (1+val)/2

def main():
    expected_val = 0
    expected_val_list = []
    sum_val = 0
    sum_val_list = []
    sum_K = 0
    sum_K_list = []
    max_expected_val = 0
    for i in range(N):
        expected_val = calc_expected_val(P[i])
        expected_val_list.append(expected_val)
        sum_val += expected_val
        sum_val_list.append(sum_val)

    for j in range(N-K):
        sum_K = sum_val_list[j+K] - sum_val_list[j]
        sum_K_list.append(sum_K)

    max_expected_val = max(sum_K_list)
    print(max_expected_val)

if __name__ == "__main__":
    main()
    

Fixed submission:
N, K = map(int, input().split())
p = list(map(int,input().split()))
ans = 0
cum = [0]
     
for i in range(len(p)):
    ex = (1 + p[i])/2
    p[i] = ex
        
for i in  range(len(p)):
    cum.append(p[i] + cum[i])
        
for i in range(K, N+1):
    ans  = max(ans, cum[i] - cum[i-K])
     
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int, input().split())
P = list(map(int,input().split()))

def calc_expected_val(val):
    return (K+val)/2

def main():
    sum_K_list = []
    max_sum_K = 0
    max_expected_val = 0
    for i in range(N-K+1):
        sum_K = 0   
        for j in range(i, i+K):
            sum_K += P[j]
        sum_K_list.append(sum_K)

    max_sum_K = max(sum_K_list)
    max_expected_val = calc_expected_val(max_sum_K)    
    print(max_expected_val)

if __name__ == "__main__":
    main()
    

Fixed submission:
N, K = map(int, input().split())
p = list(map(int,input().split()))
ans = 0
cum = [0]
     
for i in range(len(p)):
    ex = (1 + p[i])/2
    p[i] = ex
        
for i in  range(len(p)):
    cum.append(p[i] + cum[i])
        
for i in range(K, N+1):
    ans  = max(ans, cum[i] - cum[i-K])
     
print(ans)

Buggy python submission (verdict: Runtime Error):
N,K = map(int, input().split())
P = list(map(int,input().split()))

def calc_expected_val(val):
    return (K+val)/2

def main():
    sum_K_list = []
    max_sum_K = 0
    max_expected_val = 0
    for i in range(N-K):
        sum_K = 0   
        for j in range(i, i+K):
            sum_K += P[j]
        sum_K_list.append(sum_K)

    max_sum_K = max(sum_K_list)
    max_expected_val = calc_expected_val(max_sum_K)    
    print(max_expected_val)

if __name__ == "__main__":
    main()
    

Fixed submission:
N, K = map(int, input().split())
p = list(map(int,input().split()))
ans = 0
cum = [0]
     
for i in range(len(p)):
    ex = (1 + p[i])/2
    p[i] = ex
        
for i in  range(len(p)):
    cum.append(p[i] + cum[i])
        
for i in range(K, N+1):
    ans  = max(ans, cum[i] - cum[i-K])
     
print(ans)