Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p_list = list(map(int, input().split()))
e_list = [(p+1)/2 for p in p_list]
max_nums = 0
max_targets = []
for j in range(0, len(e_list)-k+1):
  targets = [e_list[j+m] for m in range(k)]
  t_sum = sum(targets)
  if t_sum >= max_nums:
    max_nums = t_sum
    max_targets = targets
print(sum(max_targets))

Fixed submission:
n, k = map(int, input().split())
p_list = list(map(int, input().split()))
tmp = sum(p_list[:k])
max_num = sum(p_list[:k])
for i in range(len(p_list)-k):
  tmp = tmp - p_list[i] + p_list[i+k]
  if tmp >= max_num:
    max_num = tmp
print((max_num+k)/2)

Buggy python submission (verdict: Time Limit Exceeded):
def culc_expected_value(num):
  output = 0
  if num != 1:
    for i in range(1, num+1):
      output = output + i/num
  else:
    output = 1
  return output
 
n, k = map(int, input().split())
p_list = list(map(int, input().split()))
max_nums = 0
max_targets = []
for j in range(0, len(p_list)-k+1):
  targets = [p_list[j+m] for m in range(k)]
  t_sum = sum(targets)
  if t_sum >= max_nums:
    max_nums = t_sum
    max_targets = targets
# print(max_targets)

ans = 0
for t in max_targets:
  ans += culc_expected_value(t)
  # print(ans)

print(ans)

Fixed submission:
n, k = map(int, input().split())
p_list = list(map(int, input().split()))
tmp = sum(p_list[:k])
max_num = sum(p_list[:k])
for i in range(len(p_list)-k):
  tmp = tmp - p_list[i] + p_list[i+k]
  if tmp >= max_num:
    max_num = tmp
print((max_num+k)/2)

Buggy python submission (verdict: Time Limit Exceeded):
def culc_expected_value(num):
  output = 0
  if num != 1:
    for i in range(1, num+1):
      output = output + i/num
  else:
    output = 1
  return output
 
n, k = map(int, input().split())
p_list = list(map(int, input().split()))
max_nums = 0
max_targets = []
for j in range(0, len(p_list)-k+1):
  targets = [p_list[j+m] for m in range(k)]
  t_sum = sum(targets)
  if t_sum >= max_nums:
    max_nums = t_sum
    max_targets = targets
# print(max_targets)

ans = 0
for t in max_targets:
  ans += culc_expected_value(t)
  # print(ans)

print(ans)

Fixed submission:
n, k = map(int, input().split())
p_list = list(map(int, input().split()))
tmp = sum(p_list[:k])
max_num = sum(p_list[:k])
for i in range(len(p_list)-k):
  tmp = tmp - p_list[i] + p_list[i+k]
  if tmp >= max_num:
    max_num = tmp
print((max_num+k)/2)

Buggy python submission (verdict: Runtime Error):
def culc_expected_value(num):
  output = 0
  if num != 1:
    for i in range(1, num+1):
      output += i/num
  else:
    output = 1
  return output
 
n, k = map(int, input().split())
p_list = list(map(int, input().split()))
max_nums = 0
max_targets = []
for j in range(0, len(p_list)-k-1):
  targets = [p_list[j+m] for m in range(k)]
  t_sum = sum(targets)
  if t_sum >= max_nums:
    max_nums = t_sum
    max_targets = targets
# print(max_targets)

ans = 0
for t in max_targets:
  ans += culc_expected_value(t)
  # print(ans)

print(ans)

Fixed submission:
n, k = map(int, input().split())
p_list = list(map(int, input().split()))
tmp = sum(p_list[:k])
max_num = sum(p_list[:k])
for i in range(len(p_list)-k):
  tmp = tmp - p_list[i] + p_list[i+k]
  if tmp >= max_num:
    max_num = tmp
print((max_num+k)/2)