Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
import numpy as np
 
n, k = map(int, input().split())
p = list(map(int, input().split()))

E = lambda x: 1 + (x - 1) * 0.5
p = [E(p_) for p_ in p]
q = np.cumsum(p)
sum_ = [q[i+k] - q[i] for i in range(n-k)]
print(max(sum_))


Fixed submission:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
#  = int(input())
n, k  = map(int, input().split())
p  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

q = sum(p[:k])
max_ = (q, 0, k)
for i in range(k, n):
    q = q + p[i] - p[i-k]
    if max_[0] < q:
        max_ = (q, i-k+1, i+1)

ans = 0
for p_ in p[max_[1]:max_[2]]:
    ans += 1 + (p_ - 1) * 0.5

#print(max_)
print(ans)

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
import numpy as np
 
n, k = map(int, input().split())
p = list(map(int, input().split()))

E = lambda x: 1 + (x - 1) * 0.5
p = [E(p_) for p_ in p]
q = np.cumsum(p)
sum_ = [q[i+k] - q[i] for i in range(n-k)]
print(max(sum_))


Fixed submission:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
#  = int(input())
n, k  = map(int, input().split())
p  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

q = sum(p[:k])
max_ = (q, 0, k)
for i in range(k, n):
    q = q + p[i] - p[i-k]
    if max_[0] < q:
        max_ = (q, i-k+1, i+1)

ans = 0
for p_ in p[max_[1]:max_[2]]:
    ans += 1 + (p_ - 1) * 0.5

#print(max_)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
#  = int(input())
n, k  = map(int, input().split())
p  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

max_ = (sum(p[:k]), 0, k)
for i in range(n-k+1):
    if max_[0] < sum(p[i:i+k]):
        max_ = (sum(p[i:i+k]), i, i+k)

ans = 0
for p_ in p[max_[1]:max_[2]]:
    ans += 1 + (p_ - 1) * 0.5

print(ans)


Fixed submission:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
#  = int(input())
n, k  = map(int, input().split())
p  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

q = sum(p[:k])
max_ = (q, 0, k)
for i in range(k, n):
    q = q + p[i] - p[i-k]
    if max_[0] < q:
        max_ = (q, i-k+1, i+1)

ans = 0
for p_ in p[max_[1]:max_[2]]:
    ans += 1 + (p_ - 1) * 0.5

#print(max_)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
#  = int(input())
n, k  = map(int, input().split())
p  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

max_ = (sum(p[:k]), 0, k)
for i in range(n-k+1):
    if max_[0] < sum(p[i:i+k]):
        max_ = (sum(p[i:i+k]), i, i+k)

ans = 0
for p_ in p[max_[1]:max_[2]]:
    ans += 1 + (p_ - 1) * 0.5

print(ans)


Fixed submission:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
#  = int(input())
n, k  = map(int, input().split())
p  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

q = sum(p[:k])
max_ = (q, 0, k)
for i in range(k, n):
    q = q + p[i] - p[i-k]
    if max_[0] < q:
        max_ = (q, i-k+1, i+1)

ans = 0
for p_ in p[max_[1]:max_[2]]:
    ans += 1 + (p_ - 1) * 0.5

#print(max_)
print(ans)

Buggy python submission (verdict: Runtime Error):
# A = input()
# A = int(input())
# A = map(int, input().split())
# A = list(map(int, input().split()))
# A = [int(input()) for i in range(N)]
#
# c = collections.Counter()

import collections

N, K = list(map(int, input().split()))
p = list(map(int, input().split()))

ma = sum(p[:K])
idx = 0

kukan = [sum(p[i:i+K]) for i in range(N-K)]
idx = kukan.index(max(kukan))

ans = 0
for i in range(K):
  ans += (0.5 * (p[idx+i]-1) + 1)

print(ans)


Fixed submission:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
#  = int(input())
n, k  = map(int, input().split())
p  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

q = sum(p[:k])
max_ = (q, 0, k)
for i in range(k, n):
    q = q + p[i] - p[i-k]
    if max_[0] < q:
        max_ = (q, i-k+1, i+1)

ans = 0
for p_ in p[max_[1]:max_[2]]:
    ans += 1 + (p_ - 1) * 0.5

#print(max_)
print(ans)

Buggy python submission (verdict: Runtime Error):
# A = input()
# A = int(input())
# A = map(int, input().split())
# A = list(map(int, input().split()))
# A = [int(input()) for i in range(N)]
#
# c = collections.Counter()

import collections

N, K = list(map(int, input().split()))
p = list(map(int, input().split()))

ma = sum(p[:K])
idx = 0

kukan = [sum(p[i:i+K]) for i in range(N-K)]
idx = kukan.index(max(kukan))

ans = 0
for i in range(K):
  ans += sum(list(range(1, p[idx+i]+1)))/p[idx+i]

print(ans)


Fixed submission:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
#  = int(input())
n, k  = map(int, input().split())
p  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

q = sum(p[:k])
max_ = (q, 0, k)
for i in range(k, n):
    q = q + p[i] - p[i-k]
    if max_[0] < q:
        max_ = (q, i-k+1, i+1)

ans = 0
for p_ in p[max_[1]:max_[2]]:
    ans += 1 + (p_ - 1) * 0.5

#print(max_)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# A = input()
# A = int(input())
# A = map(int, input().split())
# A = list(map(int, input().split()))
# A = [int(input()) for i in range(N)]
#
# c = collections.Counter()

import collections

N, K = list(map(int, input().split()))
p = list(map(int, input().split()))

ma = sum(p[:K])
kukan = sum(p[:K])
idx = 0
for i in range(N - K):
  kukan = kukan - p[i] + p[i+K]
  if ma < kukan:
    ma = kukan
    idx = i+1

exp = 0
for i in range(idx, K+idx):
  exp_1 = 0
  for j in range(1, p[i]+1):
    exp_1 += j
  exp += exp_1 / p[i]

print(exp)



Fixed submission:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
#  = int(input())
n, k  = map(int, input().split())
p  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

q = sum(p[:k])
max_ = (q, 0, k)
for i in range(k, n):
    q = q + p[i] - p[i-k]
    if max_[0] < q:
        max_ = (q, i-k+1, i+1)

ans = 0
for p_ in p[max_[1]:max_[2]]:
    ans += 1 + (p_ - 1) * 0.5

#print(max_)
print(ans)