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

for i in range(n):
    p[i]=(p[i]+1)/2#p[i]を期待値に変更
    
max_sum=0    
for i in range(n-k+2):
    max_sum=max(max_sum,sum(p[i:i+k]))
print(max_sum)


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

for i in range(n):
    p[i]=(p[i]+1)/2#p[i]を期待値に変更
    
p_sum=[0]*n
ans=0
for i in range(n):
    if i==0:
        p_sum[i]=p[i]
        ans=p_sum[i]
    elif i<k:
        p_sum[i]=p_sum[i-1]+p[i]
        if p_sum[i]>ans:
            ans=p_sum[i]
    else:
        p_sum[i]=p_sum[i-1]+p[i]-p[i-k]
        if p_sum[i]>ans:
            ans=p_sum[i]
print(ans)

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

for i in range(n):
    p[i]=(p[i]+1)/2#p[i]を期待値に変更
    
max_sum=0    
for i in range(n-k+2):
    cnt=sum(p[0:0+k])
    max_sum=max(max_sum,sum(p[i:i+k]))
print(max_sum)

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

for i in range(n):
    p[i]=(p[i]+1)/2#p[i]を期待値に変更
    
p_sum=[0]*n
ans=0
for i in range(n):
    if i==0:
        p_sum[i]=p[i]
        ans=p_sum[i]
    elif i<k:
        p_sum[i]=p_sum[i-1]+p[i]
        if p_sum[i]>ans:
            ans=p_sum[i]
    else:
        p_sum[i]=p_sum[i-1]+p[i]-p[i-k]
        if p_sum[i]>ans:
            ans=p_sum[i]
print(ans)

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

for i in range(n[0]):
    p[i]=(p[i]+1)/2
"""
max_sum= 0
for i in range(n[0] - n[1] + 1):
    chunk = numbers[i:i + 13]  # i, i + 1, ..., i + 12 番目の13個の数字を取り出す。
    prod = functools.reduce(operator.mul, chunk, 1)  # 部分リストのすべての値の積
    max_prod = max(max_prod, prod)  # 最大値更新    
"""    
    
max_sum=0
for i in range(n[0]-n[1]+2):
    max_sum=max(max_sum,sum(p[i:i+n[1]]))
print(max_sum)

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

for i in range(n):
    p[i]=(p[i]+1)/2#p[i]を期待値に変更
    
p_sum=[0]*n
ans=0
for i in range(n):
    if i==0:
        p_sum[i]=p[i]
        ans=p_sum[i]
    elif i<k:
        p_sum[i]=p_sum[i-1]+p[i]
        if p_sum[i]>ans:
            ans=p_sum[i]
    else:
        p_sum[i]=p_sum[i-1]+p[i]-p[i-k]
        if p_sum[i]>ans:
            ans=p_sum[i]
print(ans)

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

for i in range(n[0]):
    p[i]=(p[i]+1)/2
y=[]
for i in range(n[0]-n[1]+2):
    y.append(sum(p[i:i+n[1]]))
print(max(y))

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

for i in range(n):
    p[i]=(p[i]+1)/2#p[i]を期待値に変更
    
p_sum=[0]*n
ans=0
for i in range(n):
    if i==0:
        p_sum[i]=p[i]
        ans=p_sum[i]
    elif i<k:
        p_sum[i]=p_sum[i-1]+p[i]
        if p_sum[i]>ans:
            ans=p_sum[i]
    else:
        p_sum[i]=p_sum[i-1]+p[i]-p[i-k]
        if p_sum[i]>ans:
            ans=p_sum[i]
print(ans)

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

x=[]
for i in range(n[0]):
    x.append((p[i]+1)/2)
y=[]
for i in range(n[0]-n[1]+2):
    y.append(sum(x[i:i+n[1]]))
print(max(y))

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

for i in range(n):
    p[i]=(p[i]+1)/2#p[i]を期待値に変更
    
p_sum=[0]*n
ans=0
for i in range(n):
    if i==0:
        p_sum[i]=p[i]
        ans=p_sum[i]
    elif i<k:
        p_sum[i]=p_sum[i-1]+p[i]
        if p_sum[i]>ans:
            ans=p_sum[i]
    else:
        p_sum[i]=p_sum[i-1]+p[i]-p[i-k]
        if p_sum[i]>ans:
            ans=p_sum[i]
print(ans)