Problem:


Score : 400 points

Problem Statement

We have N dice arranged in a line from left to right. The i-th die from the left shows p_i numbers from 1 to p_i with equal probability when thrown.

We will choose K adjacent dice, throw each of them independently, and compute the sum of the numbers shown. Find the maximum possible value of the expected value of this sum.

Constraints

1 ≤ K ≤ N ≤ 200000

1 ≤ p_i ≤ 1000

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N K
p_1 ... p_N

Output

Print the maximum possible value of the expected value of the sum of the numbers shown.

Your output will be considered correct when its absolute or relative error from our answer is at most 10^{-6}.

Sample Input 1

5 3
1 2 2 4 5

Sample Output 1

7.000000000000

When we throw the third, fourth, and fifth dice from the left, the expected value of the sum of the numbers shown is 7. This is the maximum value we can achieve.

Sample Input 2

4 1
6 6 6 6

Sample Output 2

3.500000000000

Regardless of which die we choose, the expected value of the number shown is 3.5.

Sample Input 3

10 4
17 13 13 12 15 20 10 13 17 11

Sample Output 3

32.000000000000



Sample input:
5 3
1 2 2 4 5


Sample output:
7.000000000000

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())

def expectation(pp):
    return (pp * (pp + 1) / 2) / pp

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

result = 0

save_max = 0
save_idx = 0

for i in range(N - K + 1):
    save_idx = i
    save_max = max(sum(p[i : i + K]), save_max)
    
print(sum([expectation(pp) for pp in p[save_idx : save_idx + K]]))

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
P = list(map(int,input().split()))
P.sort(reverse=True)
print(P)
print(sum(P[:k])/2 + k/2)

Submission status: Wrong Answer

Solution code:
# s, t = input().split(" ")
n, k = map(int, input().split())

#A = []
A = list(map(int, input().split()))

tmp = sum(A[:k])
#print(tmp)
ans = tmp
for i in range(n - k):
    t = tmp
    t += A[i + k] - A[i]
    if t > tmp:
        ans = t
    tmp = t
#    print(ans)
print((ans + k) / 2.0)

Submission status: Wrong Answer

Solution code:
#確率は(p_i+1)/2
N, K=(int(i) for i in input().split())
P=[int(i) for i in input().split()]

Q=[(P[i]+1)/2 for i in range(len(P))]
R=[0]*(len(Q)+1)
for i in range(1,len(R)-1):
    R[i] = R[i-1] + Q[i-1]
maxp=0
for i in range(N-K+1):
        maxp=max((R[i+K]-R[i]), maxp)
print(maxp)

Submission status: Wrong Answer

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip() 

def resolve():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    total = sum(A[0:K])
    total_max = 1
    for i in range(0, N-K):
        total -= A[i]
        total += A[i+K]
        total_max = max(total, total_max)

    print((total_max+K)/2)

if __name__ == '__main__':
    resolve()

Submission status: Wrong Answer

Solution code:
N, K = [int(i) for i in input().split(" ")]
dice_nums = [int(i) for i in input().split(" ")]
dice_nums = [(i+1)/2 for i in dice_nums]
dice_maxs = [sum(dice_nums[i:i+K]) for i in range(N-K+1)]
max(dice_maxs)

Submission status: Wrong Answer

Solution code:
N, K = [int(x) for x in input().split()]
P = [int(x) for x in input().split()]

#初期 
SUM = sum(P[0:K])
M=0

for i in range(N - K + 1):
    if SUM < sum(P[i:i + K]):
        M = i

EXP_V = 0
for i in range(K):
    EXP_V += (1 + P[M+i]) / 2

print(EXP_V)

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
list = list(map(int,input().split()))
list.sort(reverse=True)

list_ans = list[0:k]
ans = 0
i = 0
while i < len(list_ans):
    ans += (list_ans[i]+1)/2
    i += 1
    
print(ans)

Submission status: Wrong Answer

Solution code:
n, k = list(map(int, input().split()))
p = list(map(int, input().split()))

ans = 0

def expect(n):
    res = 0
    for i in range(1, n+1):
        res += i
    res /= n
    return res


for i in range(n-k+1):
    target = p[i:i+k]
    print(target)
    target = list(map(expect, target))
    ans = max(ans, sum(target))

print(ans)

Submission status: Wrong Answer

Solution code:
import numpy

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

List=list(map(int,input().split()))
EList = []

for i in range(len(List)):
  a = List[i]
  b = (a+1)/2
  EList.append(b)
  

res = numpy.cumsum(EList)
ans = 0
for i in range(len(List)):
  if i < K-1:
    ans = 0
  else:
    ans = max(res[i] - res[i-K],ans)
  
print(ans)

Submission status: Wrong Answer

Solution code:
n , k = map(int,input().split())
p = list(map(int,input().split()))
ans = sum(p[0:k])+k
for i in range(1,n-k-1):
  ans = max(ans, ans - p[i-1] + p[i+k+1])
print(ans/2)

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
p=sorted(list(map(int, input().split())),reverse=True)
for i in range(n):
	p[i]=(1+p[i])/2
print('{:.8f}'.format(sum(p[:k])))

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
P=[int(i)+1 for i in input().split()]
left = 0
right = K
max_=sum(P[:K])
ans=max_
#print(max_)
for _ in range(N-K):
    ans=max(max_,max_ - P[left] + P[right])
    max_=max_ - P[left] + P[right]
    #print(max_)
    left += 1
    right += 1
print(ans/2)

Submission status: Wrong Answer

Solution code:
#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math

import itertools

#import bisect

import copy
from functools import lru_cache

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]



def main():
    n,k=map(int,input().split())
    p=list(map(int,input().split()))
    temp=0
    max=0
    maxi=0
    for i in range(k):
        temp=sum(p[0:k])
    if n>=2:
        for i in range(1,n-k+1):
            temp-=p[i-1]
            temp+=p[i+k-1]
            if temp>max:
                max=temp
                maxi=i
    total=(max+k)/2
#    for i in range(maxi,maxi+k):
 #       total+=(1+p[i])

    print(total)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#coding:utf-8
N, K = map(int,input().split())
P = list(map(int,input().split()))
P = [(p+1)/2 for p in P]
mx = 0
sm = sum(P[:K])
for i in range(N-K):
    sm = sm - P[i] + P[K+i]
    mx = max(mx,sm)
print (mx)

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
L = list(map(int,input().split()))
cur = 0
for i in range(n):
  L[i] = (L[i]+1)/2
  if i != 0:
    L[i] += L[i-1]
for i in range(n-k):
  cur = max(L[i+k]-L[i],cur)
print(cur)

Submission status: Wrong Answer

Solution code:
n,k,*p=map(int,open(0).read().split())
p.sort()
p.reverse()
print((sum(p[:k])+k)/2)

Submission status: Wrong Answer

Solution code:
def dice(num):
  i = 0.0
  t = 0.0
  for i in range(1,num+1):
    t += i
  return t / num

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

pp = len(p)
sum = 0
ii = 0
for i in range(1, pp - k):
  temp = p[0] + p[1] + p[2] + p[3]
  if temp > sum:
    sum = temp
    ii = i

ans = 0.0

for kk in range(0, k):
  ans += dice(p[ii]+kk)

print(ans)

Submission status: Wrong Answer

Solution code:
import numpy

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

List=list(map(int,input().split()))
EList = []

for i in range(len(List)):
  a = List[i]
  b = (a+1)/2
  EList.append(b)
  

res = numpy.cumsum(EList)
ans = 0
for i in range(len(List)):
  if i < K:
    ans = 0
  else:
    ans = max(res[i] - res[i-K],ans)
  
print(ans)

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
p=list(map(int,input().split()))
maxim=0

for i in range(n-k-1):
    if p[i]<=p[i+k]:
        maxim=i+1

ans=(sum(p[maxim:maxim+k])+k)/2
print(ans)

Submission status: Wrong Answer

Solution code:
N, K = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]

a = [p[0]]
for i in range(1,N):
    a += [a[i-1] + p[i]]

ans = a[0]
for i in range(N-K):
    ans = max(a[i+K] - a[i], ans)

print("{0:.12f}".format((ans + K )/2))

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split()) 
p = list(map(int, input().split()))
n_e = n - k + 1
e = [0] * n_e
for i in range(n_e):
  tot = 0
  for j in range(k):
    e[i] += (p[i+j] + 1) / 2
print(e)

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
P = list(map(int, input().split()))
E = [0] * N
E[0] = sum(P[:K])

for i in range(1, N-K):
  E[i] = E[i-1] + P[i+K] - P[i-1]

E[N-K] = sum(P[N-K:])
maxE = max(E)
#print(E)
print((maxE - K) / 2.0 + K)

Submission status: Wrong Answer

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

lst = [0]*N
lst[0] = 0.5*(p[0]+1)
for i in range(1,N):
    lst[i] = lst[i-1] + 0.5*(p[i]+1)
    
ans = 0
for i in range(K,N):
    ans = max(ans,lst[i]-lst[i-K])

print(ans)

Submission status: Wrong Answer

Solution code:
x = list(map(int, input().split()))
y = list(map(int, input().split()))
y = [i/2+0.5 for i in y]
max_value = 0
value = sum(y[:x[1]])
for i in range(x[1], x[0]):
  max_value = max(max_value, value)
  value += y[i]
  value -= y[i-x[1]]
print(max_value)

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
l = list(map(int,input().split()))
lk = list(map(lambda x:(x+1)/2,l))
ans = 0
for i in range(n-k):
  ans = max(ans, sum(lk[i:i+k]))
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip() 

def resolve():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    total = sum(A[0:K])
    total_max = 0
    for i in range(0, N-K):
        total -= A[i]
        total += A[i+K]
        total_max = max(total, total_max)

    print((total_max+K)/2)

if __name__ == '__main__':
    resolve()

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
p=list(map(int, input().split()))
for i in range(n):
	p[i]=(1+p[i])/2
p.sort(reverse=True)
print('{:.8f}'.format(sum(p[:k])))

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
P = map(int, input().split())

PP = sum(sorted([(1 + pp) / 2 for pp in P], reverse=True)[:K])
print(PP)

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
p=list(map(int,input().split()))
s=[p[0]]
for i in range(1,n):
    s.append(s[-1]+p[i])
#print(s)
ans=0
c=0
for i in range(n-k):
    if c<=s[i+k]-s[i]:
        c=s[i+k]-s[i]
print(c/2+0.5*k)

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
p=list(map(int,input().split()))
pp=[]
su=0
for i in range(n):#累積和
    if i<k:
        su+=p[i]
    else:
        pp.append(su)
        su=su-p[i-k]+p[i]
ans=0.0
for i in range(len(pp)):
    j=(pp[i]+k)/2
    if ans<j:
        ans=j
print(ans)

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
p=list(map(int,input().split()))
s=[0 for _ in range(n-k+1)]
q=sum(p[:k])
s[0]=q
m=q
f=0
for i in range(1,n-k+1):
  q=q-p[i-1]+p[i-1+k]
  s[i]=q
  if q>m:
    f=i
ans=0
for i in range(f,f+k):
  ans+=(p[i]+1)/2






print(ans)

Submission status: Wrong Answer

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

M = 0
x, y = divmod(K, 2)

for i in range(x, N - x):
    a = sum(p[i - x:i + x + y])
    if a > M:
        M = a

print((M + K) / 2)

Submission status: Wrong Answer

Solution code:
def kitai(l):
  return (l+1)/2

n , k = map(int, input().split())
a = list(kitai(int(i)) for i in input().split())


max_ = 0
for i in range(n-k+1):
  if a[i] >= a[i+k-1]:
    continue
  max_ = max(max_, sum(a[i:i+k]))
    
print(max_)

Submission status: Wrong Answer

Solution code:
from itertools import accumulate


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

d = {}
for i in range(1, 1001):
    d[i] = (i + 1) * (i / 2) / i

cum = list(accumulate(P))

mx = 0
idx = 0
for i in range(N-K+1):
    if cum[i+K-1] - cum[i] > mx:
        mx = max(mx, cum[i+K-1] - cum[i])
        idx = i

ans = 0
for j in range(K):
    ans += d[P[idx+j]]

print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

NK = input().split()
N = int(NK[0])
K = int(NK[1])
P = input().split()
P = np.array([int(p) for p in P])
sP = np.sort(P, kind='quick_sort')[::-1]
per = 1/sP
wa = sP*(sP+1)/2

s = wa*per
s = s[0:K].sum()
print(s)

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
a=list(map(int,input().split()))
a=[(1+i)/2 for i in a]
import itertools
ac=itertools.accumulate(a)
ac=list(ac)
ans=0
for i in range(n-k,n):
    tmp=ac[i]-ac[i-k]
    ans=max(ans,tmp)
print(ans)

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
p = list(map(int, input().split()))

ans = 0
# for i in range(n-k+1):
#     tmp = 0
#     for j in range(k):
#         tmp += (p[i+j] + 1) / 2
    
#     ans = max(ans, tmp)

# p_list = [0] * len(p)
# for i in range(n):
#     p_list[i] = (p[i] + 1) / 2

# for i in range(n-k+1):
#     ans = max(ans, sum(p_list[i:i+k]))

index = 0
max_tmp = 0
for i in range(n-k+1):
    tmp = sum(p[i:i+k])
    if tmp > max_tmp:
        index = i

for i in range(index, index+k):
    ans += (p[i] + 1) / 2

print(ans)

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())

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

p2 = p.copy()
for i,px in enumerate(p):
  p2[i] = (px+1)/2

max_ans = 0
for i in range(0, N-K+1):
  ans = sum(p2[i:i+K])
  if ans > max_ans:
    max_ans = ans
    
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
N, K = map(int, input().split())
P = np.array(input().split(), dtype=int)
# 期待値に変換
Q = P/2 + 0.5
# 累積和をとる
S = Q.cumsum()
# K範囲での最大値
if N==K:
    S[-1]
else:
	T = S[K:] - S[:-K]
	print(max(T))

Submission status: Wrong Answer

Solution code:
N, K = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]

a = [p[0]]
for i in range(1,N):
    a += [a[i-1] + p[i]]

ans = 0
for i in range(N-K):
    ans = max(a[i+K] - a[i], ans)

print("{0:.12f}".format((ans + K )/2))

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
s = list(map(int,input().split()))
s.sort()
ans = 0
for i in range(1,k+1):
  ans += (s[-i]+1)/2
print(ans)

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
dice=input().split()
dic=[]
for i in dice:
    dic.append(int(i))

kitai=[]
for d in dic:
    wa=(1/2)*d*(d+1)
    kitai.append(wa/d)

s=[]
for j in range(K):
    su=sum(kitai[j:j+K])
    s.append(su)
print(max(s))

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
P = map(int, input().split())

PP = sum(sorted([(1 + pp) / 2 for pp in P], reverse=True)[:3])
print(PP)

Submission status: Wrong Answer

Solution code:
x = list(map(int, input().split()))
y = list(map(int, input().split()))
y = [i/2+0.5 for i in y]
max_value = 0
value = sum(y[:x[1]])
for i in range(x[1]+1, x[0]):
  max_value = max(max_value, value)
  value += y[i]
  value -= y[i-x[1]-1]
print(max_value)

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
p=list(map(int,input().split()))
mx = 0
for i in range(N):
  p[i]=(1+p[i])/2


for i in range(N-K):
  s = sum(p[i:i+K])
  mx = max(s,mx)
  
print(mx)

Submission status: Wrong Answer

Solution code:
N, K  = map(int, input().split())
p = [int(i) for i in input().split()]
k = [0] * N


for i in range(N):
    P = p[i]
    k[i] = (P+1)/2

def cumsum(l):
    c = [0] * len(l)
    for i in range(len(l)):
        c[i] = c[i-1] + l[i]
    return c

c = cumsum(k)

ans = c[0]

for i in range(N-K):
    t = c[i+K] - c[i]
    if t > ans:
        ans = t

print(ans)

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
P = list(map(int, input().split()))

wa = sum(P[:K])
ind = 0
for i in range(1, N - K+1, 1):
    tmp = wa + P[i+K-1] - P[i-1]
    if tmp > wa:
        wa = tmp
        ind = i
    else:
        pass

# 期待値を求める
ans = 0

for i in range(ind, ind+K, 1):
    now = P[i]
    ans += (now+1) * now / (2 * now)
print("{:.10f}".format(ans))

Submission status: Wrong Answer

Solution code:
def main():
    from itertools import accumulate
    n, k = map(int, input().split())
    p = list(map(int, input().split()))

    p_acc = tuple(accumulate(p))
    p_max = 0
    for i in range(n-k):
        p_max = max(p_acc[i+k]-p_acc[i], p_max)
    print((p_max+k)/2)
    return


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
N,K = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
for i in range(N):
    l = p[i]
    p[i] = ((1+p[i]) * p[i])//2
    p[i] = p[i]/l
ans = 0
print(p)
for i in range(K):
    ans +=p[i]
l = ans
for i in range(K,N):
    ans = ans + p[i] - p[i-K]
    l = max(l,ans)
print('{:.8f}'. format(l))

Submission status: Wrong Answer

Solution code:
N,K = map(int, input().split())
p = list(map(lambda i: int(i) + 1 , input().split()))

print(N, K)

m_r = sum(p[:K])
m_max = m_r

for i in range(N - K):
    m_r -= p[i]
    m_r += p[i + K]
    if m_max < m_r:
        m_max = m_r

print(m_max / 2)

Submission status: Wrong Answer

Solution code:
from sys import stdin


def fetch_one_line():
    return stdin.readline().rstrip()


def fetch_int_input():
    return [int(s) for s in fetch_one_line().split()]


def fetch_inputs(times):
    return [fetch_one_line() for _ in range(times)]


def fetch_int_inputs(times):
    return [[int(s) for s in fetch_one_line()] for _ in range(times)]


def fetch_ints_inputs(times):
    return [fetch_int_input() for _ in range(times)]


N, K = fetch_int_input()
p = fetch_int_input()

max_num = -999
tmp_nums = []
for i in range(N - K):
    nums = p[i: i + K]
    sum_nums = sum(nums)
    if max_num < sum_nums:
        max_num = sum_nums
        tmp_nums = nums

ave_nums = [(i + 1) / 2 for i in tmp_nums]

print(sum(ave_nums))

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
p=[int(i)+1 for i in input().split()]

num=sum(p[:k])
ans=num
for i in range(n-k):
  tmp=p[i+k]-p[i]
  if tmp>0:
    ans=num+tmp
  num+=tmp
print(ans/2)

Submission status: Wrong Answer

Solution code:

n,k = map(int,input().split())
p_l = list(map(int,input().split()))

possibility=list(map(lambda x:(1+x)/2,p_l))

print(possibility)

max_p=sum(possibility[0:k:1])
tmp=max_p
for i in range(1,len(possibility)-k+1):
    print(i)
    tmp+=possibility[i+k-1]-possibility[i-1]
    if tmp>max_p:
        max_p=tmp
        
print(max_p)

Submission status: Wrong Answer

Solution code:
def main():
    from itertools import accumulate
    n, k = map(int, input().split())
    p = list(map(int, input().split()))

    p_acc = tuple(accumulate(p))
    print(p, p_acc)
    p_max = 0
    for i in range(n-k):
        p_max = max(p_acc[i+k]-p_acc[i], p_max)
    print((p_max+k)/2)
    return


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
import math
from itertools import accumulate
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res

N,K=LI()
acc = LI()
for i in range(N):
    acc[i] = (1+acc[i]) / 2
acc2 = list(accumulate(acc))
# print(acc)
# print(acc2)

res = 0
for i in range(1, N-K+1):
    if i == 1:
        res = acc2[K-1]
    else:
        res = max(res, acc2[i+K-1] - acc2[i-1])

print(res)

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
p = list(map(int, input().split()))
for i in range(n):
    p[i] = (p[i]+1)/2
cnt = 0
for i in range(n-2):
    cnt = max(cnt, sum(p[i:i+k]))
print(cnt)

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
p_list = list(map(lambda x: (int(x) + 1) / 2, input().split()))
print(p_list)

sum_k = 0
for i in range(k):
    sum_k += p_list[i]
sum_max = sum_k
for i in range(k, n):
    sum_k -= p_list[i-k]
    sum_k += p_list[i]
    if(sum_k > sum_max):
        sum_max = sum_k
print(sum_max)

Submission status: Wrong Answer

Solution code:
import sys
import itertools

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N, K = [int(x) for x in input().split()]
    P = [int(x) for x in input().split()]
    ans = 0
    P2 = []
    for i in range(N):
        P2.append((P[i] / 2) * (P[i] + 1) / P[i])

    if N == 1:
        print(max(P2))
        return
    P3 = list(itertools.accumulate(P2))
    for i in range(N - K):
        ans = max(ans, P3[i + K] - P3[i])



    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
l = list(map(int,input().split()))
lk = sorted(list(map(lambda x:(x+1)/2,l)))
print(sum(lk[-k:]))

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
lis = list(map(int,input().split()))
new_lis = [(l+1)/2 for l in lis]
ans = 0
for i in range(n-k):
    if sum(new_lis[i:i+k]) > ans:
        ans = sum(new_lis[i:i+k])
print(ans)

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
p = list(map(int,input().split()))
for i in range(n-1):
         p[i+1] += p[i]
maxsum = 0
for i in range(n-k):
         maxsum = max(maxsum,p[i+k]-p[i])
print((maxsum+k)/2)

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
P = sorted(list(map(int,input().split())),reverse = True)

total = 0
L = []

for i in range(K):
  m = P[i]
  t = sum([i for i in range(1,m + 1)]) / m
  print(t)
  total += t
  
print(total)

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
input = sys.stdin.readline
N, K = [int(x) for x in input().strip().split()]
P = [int(x) for x in input().strip().split()]
q = deque([])
ans = 0
for i, p in enumerate(P):
    e = (1+p) / 2
    if i >= K:
        q.popleft()
        q.append(e)
        ans = max(ans, sum(q))
    else:
        q.append(e)
print(ans)

Submission status: Wrong Answer

Solution code:
n, k = map(int,input().split())

ls = list(map(int,input().split()))
ls = [(x+1)/2 for x in ls]

m = 0
tot = sum(ls[:k])
for i in range(1,n-k+1):
  tot = tot-ls[i-1]+ls[i+k-1]
  m = max(m, tot)
print(m)

Submission status: Wrong Answer

Solution code:
N, K  = map(int, input().split())
p = [int(i) for i in input().split()]
k = [0] * N


for i in range(N):
    P = p[i]
    k[i] = (P+1)/2

def cumsum(l):
    c = [0] * len(l)
    for i in range(len(l)):
        c[i] = c[i-1] + l[i]
    return c

c = cumsum(k)

ans = 0

for i in range(N-K):
    t = c[i+K] - c[i]
    if t > ans:
        ans = t

print(ans)

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
p = list(map(int,input().split()))
lsum = [0]+[p[0]]+[0]*n
for i in range(2,n+1):
  lsum[i] = lsum[i-1] + p[i-1]
ans = 0
for i in range(0,n-k+1):
  ans = max(ans,lsum[k+i]-lsum[i])
print(ans)

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
P=list(map(int,input().split()))

ans=0
for i in range(n-k):
  tmp=0
  for j in range(k):
    tmp+=((1/2)*P[i+j]*(P[i+j]+1)) / P[i+j]
  ans=max(ans,tmp)
print(ans)

Submission status: Wrong Answer

Solution code:
n, k = map(lambda x: int(x), input().split(" "))
Ps = list(map(lambda x: int(x), input().split(" ")))
Ps.sort(reverse=True)

result = 0
for i in range(k):
    p = Ps[i]
    temp = sum(range(1, p+1)) / p
    result += temp

print(result)

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
p=list(map(int,input().split()))
m=sum(p[:k])
idx=0
for i in range(1,n-k+1):
    t=m-p[i-1]+p[i+k-1]
    if t>m:
        m=t
        idx=i
tl=p[idx:idx+k]
ans=0
for i in tl:
    ans+=((i+1)*i/2)/i
print(ans)

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
p=list(map(int,input().split()))
ans=0
S=sum(p[:k])
for i in range(n-k):
    S+=p[i+k]-p[i]
    ans=max(ans,S)
print((ans+k)/2)

Submission status: Wrong Answer

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

max_exp = 0
ind = 0
for i in range(N - K + 1):
    exp = K + (sum(p[i:i+K]) - K) / 2
    print(i, exp)
    if max_exp < exp:
        max_exp = exp
print(max_exp)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline


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

    p.sort()
    pt = p[-K:]

    ans = 0

    for t in pt:
        l = [x for x in range(1, t + 1)]
        ans += sum(l) / len(l)

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
l = list(map(int, input().split()))
max_l = 0
max_i = 0
ans = 0
if k == 1:
    a = max(l)
    print(a * (a + 1) / 2 / a)
else:
    for i in range(n - k + 1):
        if max_l < sum(l[i:i+k]):
            max_i = i
            max_l = sum(l[i:i+k])
for i in range(k):
    a = l[max_i + i]
    ans += a * (a + 1) / 2 / a
print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

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

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

#print(p[check:check+k])

ans = 0
for i in p[check:check+k]:
    ans += (i+1)/2
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n,k=map(int,input().split())
p=list(map(int,input().split()))
for i in range(n):
    a=p[i]
    p[i]=a*(a+1)//2/a
#print(p)
s=sum(p[:k])
ans=0
for i in range(n-k):
    s=s+p[k+i]-p[i]
    ans=max(ans,s)
print(ans)

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
A = [int(x) for x in input().split()]
ans_kouho = sum(A[:K])
now_kouho = sum(A[:K])
for i in range(K, N):
    print(ans_kouho)
    now_kouho = now_kouho-A[i-K]+A[i]
    ans_kouho = max(ans_kouho, now_kouho)
    #print(ans_kouho)
ans = (ans_kouho+K)/2
print(ans)

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
p=list(map(int,input().split()))
m=sum(p[:k])
idx=0
for i in range(1,n-k+1):
    t=m-p[i-1]+p[i+k-1]
    print(t)
    if t>m:
        m=t
        idx=i
tl=p[idx:idx+k]
ans=0
for i in tl:
    ans+=((i+1)*i/2)/i
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

n,k=mii()
arr=limii()

arr.sort(reverse=True)
ans=0
for i in range(k):
    ans+=(arr[i]*(arr[i]+1)//2)/arr[i]

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, K, *P = map(int, read().split())

P_ = [0] * N
for i in range(N):
    P_[i] = (1 + P[i]) / 2

acc = sum(P_[:K])
ans = 0

for i in range(N - K):
    acc -= P_[i]
    acc += P_[i + K]
    ans = max(ans, acc)

print(ans)

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
A = [int(x) for x in input().split()]
ans_kouho = sum(A[:K])
now_kouho = sum(A[:K])
for i in range(K, N):
    print(ans_kouho)
    now_kouho = now_kouho-A[i-K]+A[i]
    ans_kouho = max(ans_kouho, now_kouho)
    print(ans_kouho)
ans = (ans_kouho+K)/2
print(ans)

Submission status: Wrong Answer

Solution code:
N,K = map(int, input().strip().split())
P = list(map(int, input().strip().split()))
P = [(p+1)/2 for p in P]

ans = sum(P[0:K])
now = ans
for i in range(1,N-K):
  now = now - P[i-1] + P[i+K]
  ans = max(ans, now)
print(ans)

Submission status: Wrong Answer

Solution code:
N, K, *P = map(int, open(0).read().split())

A = [0]
for i in range(1, 1001):
    A.append(A[-1] + i)
B = [0] + [A[i] / i for i in range(1, 1001)]

Q = [B[p] for p in P]
ans = [sum(Q[:K])]
for i in range(N - K - 1):
    ans.append(ans[-1] - Q[i] + Q[i + K + 1])
    
print(max(ans))

Submission status: Wrong Answer

Solution code:
import sys
import itertools

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N, K = [int(x) for x in input().split()]
    P = [int(x) for x in input().split()]
    ans = 0
    P2 = []
    for i in range(N):
        P2.append((P[i] / 2) * (P[i] + 1) / P[i])

    P3 = list(itertools.accumulate(P2))
    for i in range(N - K):
        ans = max(ans, P3[i + K] - P3[i])



    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
p = list(map(int, input().split()))
m = 0
ans = 0
for i in range(k):
    m += p[i]
    start = 0
for i in range(n - k):
    if p[i] < p[i + k]:
        m += (p[i + k] - p[i])
        start = i + 1
for i in range(start, start + k):
    ans += (p[i] + 1) / 2
print(ans)

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
p = list(map(int,input().split()))

def f(p):
    #(p*(p+1)/2)/p
    return (p+1)/2


p2 = []

for p_tmp in p:
    p2.append(f(p_tmp))

ans = 0
tmp = 0
#p3 = []
for i in range(n):
    if(i<k):
        tmp = tmp + p2[i]
    else:
        tmp = tmp - p2[i-k] + p2[i]
        ans = max(ans,tmp)
    #p3.append(tmp)

#print(p2)
#print(p3)
print('{:.10f}'.format(ans))

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
p = list(map(int, input().split()))

sekiwa = [p[0]]
for i in range(1, n):
    sekiwa.append(sekiwa[-1]+p[i])

saidai = 0
for i in range(n-k+1):
    if sekiwa[i+k-1] - sekiwa[i] >= saidai:
        saidai = sekiwa[i+k-1] - sekiwa[i]
        hajimari = i

ans = 0
for i in range(hajimari, hajimari+k):
    ans += (1+p[i])/2

print(ans)