Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
List = list(map(int, input().split()))
INF = 10000000000
expList = [INF]*1000
def expectationF(num):
  if expList[num] == INF:
    exp = 0
    for i in range(1,num+1):
      exp += i/num
    expList[num] = exp
  return expList[num]

res = 0
mid = 0
midList=[]
for i in range(N):
  if i>=1:
    midList.append(expectationF(List[i])+midList[i-1])
  else:
    midList.append(expectationF(List[i]))
for j in range(N-K+1):
  if j == 0:
    mid = midList[j+K-1]
  else:
    mid = midList[j+K-1]- midList[j-1] 
  res = max(res,mid)
print(res)

Fixed submission:
N,K=map(int,input().split())
List = list(map(int, input().split()))
INF = 10000000000
expList = [INF]*1001
def expectationF(num):
  if expList[num] == INF:
    exp = 0
    for i in range(1,num+1):
      exp += i/num
    expList[num] = exp
  return expList[num]

res = 0
mid = 0
midList=[]
for i in range(N):
  if i>=1:
    midList.append(expectationF(List[i])+midList[i-1])
  else:
    midList.append(expectationF(List[i]))
m=K-1
for j in range(N-m):
  if j == 0:
    mid = midList[j+m]
  else:
    mid = midList[j+m]- midList[j-1] 
  res = max(res,mid)
print(res)

Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
List = list(map(int, input().split()))
INF = 10000000000
expList = [INF]*1000
def expectationF(num):
  if expList[num] == INF:
    exp = 0
    for i in range(1,num+1):
      exp += i/num
    expList[num] = exp
  return expList[num]

res = 0
mid = 0
midList=[]
for i in range(N):
  if i>=1:
    midList.append(expectationF(List[i])+midList[i-1])
  else:
    midList.append(expectationF(List[i]))
for j in range(N-K+1):
  if j == 0:
    mid = midList[j+K]
  else:
    mid = midList[j+K-1]- midList[j-1] 
  res = max(res,mid)
print(res)

Fixed submission:
N,K=map(int,input().split())
List = list(map(int, input().split()))
INF = 10000000000
expList = [INF]*1001
def expectationF(num):
  if expList[num] == INF:
    exp = 0
    for i in range(1,num+1):
      exp += i/num
    expList[num] = exp
  return expList[num]

res = 0
mid = 0
midList=[]
for i in range(N):
  if i>=1:
    midList.append(expectationF(List[i])+midList[i-1])
  else:
    midList.append(expectationF(List[i]))
m=K-1
for j in range(N-m):
  if j == 0:
    mid = midList[j+m]
  else:
    mid = midList[j+m]- midList[j-1] 
  res = max(res,mid)
print(res)

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

def expectationF(num):
  exp = 0
  for i in range(1,num+1):
    exp += i/num
  return exp

res = 0
mid = 0
for i in range(N-K+1):
  mid=0
  for j in range(K):
    mid += expectationF(List[i+j])
  res = max(res,mid)
print(res)

Fixed submission:
N,K=map(int,input().split())
List = list(map(int, input().split()))
INF = 10000000000
expList = [INF]*1001
def expectationF(num):
  if expList[num] == INF:
    exp = 0
    for i in range(1,num+1):
      exp += i/num
    expList[num] = exp
  return expList[num]

res = 0
mid = 0
midList=[]
for i in range(N):
  if i>=1:
    midList.append(expectationF(List[i])+midList[i-1])
  else:
    midList.append(expectationF(List[i]))
m=K-1
for j in range(N-m):
  if j == 0:
    mid = midList[j+m]
  else:
    mid = midList[j+m]- midList[j-1] 
  res = max(res,mid)
print(res)