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

exp_sum = []
sum_max = 0
exp1 = 0
for j in range(0,len(p)-k+1):
    sum_each = 0
    exp1 = 0
    sum1 = 0
    for i in range(j,j + k):
        sum1 += p[i]
        if sum1 >= sum_max:
            break
    if sum_max <= sum1:
        sum_max = sum1
        for i in range(j,j + k):
            sum_each = 0.5 * p[i] * (p[i] + 1)
            exp1 += sum_each/p[i]
        exp_sum.append(exp1)
print(max(exp_sum))

Fixed submission:
import sys

def LI(): return list(map(int, sys.stdin.readline().split()))
N, K = LI()
p = LI()
ps = []
for i in range(N):
    ps.append((p[i] + 1) / 2)
 
anss = []
tmp = 0
for i in range(N):
    tmp += ps[i]
    if i > K - 1:
        tmp -= ps[i - K]
    anss.append(tmp)
 
print(max(anss))

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

exp_sum = []
sum_max = 0
exp1 = 0
for j in range(0,len(p)-k+1):
    sum_each = 0
    exp1 = 0
    sum1 = 0
    for i in range(j,j + k):
        sum1 += p[i]
        sum_max = max(sum1,sum_max)
        if sum1 >= sum_max:
            break
    if sum_max <= sum1:
        for i in range(j,j + k):
            sum_each = 0.5 * p[i] * (p[i] + 1)
            exp1 += sum_each/p[i]
        exp_sum.append(exp1)
print(max(exp_sum))

Fixed submission:
import sys

def LI(): return list(map(int, sys.stdin.readline().split()))
N, K = LI()
p = LI()
ps = []
for i in range(N):
    ps.append((p[i] + 1) / 2)
 
anss = []
tmp = 0
for i in range(N):
    tmp += ps[i]
    if i > K - 1:
        tmp -= ps[i - K]
    anss.append(tmp)
 
print(max(anss))

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

exp_sum = []
sum_max = 0
exp1 = 0
for j in range(0,len(p)-k+1):
    sum_each = 0
    exp1 = 0
    sum1 = 0
#if k == 1:
#for k in range()
#sum1 += sum(p[0:k])
#exp1 = sum1/p[0]
#exp_sum.append(exp1)
#else:
    for i in range(j,j + k):
        sum1 += p[i]
        sum_max = max(sum1,sum_max)
    if sum_max <= sum1:
        for i in range(j,j + k):
            sum_each = 0.5 * p[i] * (p[i] + 1)
            exp1 += sum_each/p[i]
        exp_sum.append(exp1)
print(max(exp_sum))

Fixed submission:
import sys

def LI(): return list(map(int, sys.stdin.readline().split()))
N, K = LI()
p = LI()
ps = []
for i in range(N):
    ps.append((p[i] + 1) / 2)
 
anss = []
tmp = 0
for i in range(N):
    tmp += ps[i]
    if i > K - 1:
        tmp -= ps[i - K]
    anss.append(tmp)
 
print(max(anss))

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

exp_sum = []
sum_max = 0
exp1 = 0
for j in range(0,len(p)-k+1):
    sum_each = 0
    exp1 = 0
    sum1 = 0
#if k == 1:
#for k in range()
#sum1 += sum(p[0:k])
#exp1 = sum1/p[0]
#exp_sum.append(exp1)
#else:
    for i in range(j,j + k):
        sum1 += p[i]
    if sum_max < sum1:
        for i in range(j,j + k):
            sum_each = 0.5 * p[i] * (p[i] + 1)
            exp1 += sum_each/p[i]
        exp_sum.append(exp1)
print(max(exp_sum))

Fixed submission:
import sys

def LI(): return list(map(int, sys.stdin.readline().split()))
N, K = LI()
p = LI()
ps = []
for i in range(N):
    ps.append((p[i] + 1) / 2)
 
anss = []
tmp = 0
for i in range(N):
    tmp += ps[i]
    if i > K - 1:
        tmp -= ps[i - K]
    anss.append(tmp)
 
print(max(anss))

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

#print(q[len(q) - 2])
exp_sum = []
exp1 = 0
for j in range(0,len(p)-k+1):
    sum1 = 0
    exp1 = 0
#if k == 1:
#for k in range()
#sum1 += sum(p[0:k])
#exp1 = sum1/p[0]
#exp_sum.append(exp1)
#else:
    for i in range(j,j + k):
        sum1 = 0.5 * p[i] * (p[i] + 1)
        exp1 += sum1/p[i]
    exp_sum.append(exp1)
print(max(exp_sum))

Fixed submission:
import sys

def LI(): return list(map(int, sys.stdin.readline().split()))
N, K = LI()
p = LI()
ps = []
for i in range(N):
    ps.append((p[i] + 1) / 2)
 
anss = []
tmp = 0
for i in range(N):
    tmp += ps[i]
    if i > K - 1:
        tmp -= ps[i - K]
    anss.append(tmp)
 
print(max(anss))