Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

import math
n, a, b = map(int, input().split())
d = []
for i in range(n):
    d.append(input())
# [d1, d2, d3, ..., dN]
h = [int(m) for m in d]#int型に直す
#print(x)

low = 0
high = math.ceil(max(h)/b)
# t は中央番目の数
t = (low + high) // 2

# 探索の下限のlowが上限のhighになるまで探索
# lowがhighに達すると数は見つからなかっTrueたということ
X = 0
Y = 0
def cri(p):
    if p > 0:
        return p
    else:
        return 0
while True:
    for j in range(n):
        X += cri(math.ceil((h[j] - t * b) / (a - b)))
    if X <= t:
        for j in range(n):
            Y += cri(math.ceil((h[j] - (t - 1) * b) / (a - b)))
        if Y > t - 1:
            print(t)
            exit()
        else:
            high = t - 1
    elif X > t:
        low = t + 1
    t = (low + high) // 2
    X = 0
    Y = 0

### FIXED CODE ###

import math
n, a, b = map(int, input().split())
d = []
for i in range(n):
    d.append(input())
# [d1, d2, d3, ..., dN]
h = [int(m) for m in d]#int型に直す
#print(x)

low = 0
high = math.ceil(max(h)/b)
# t は中央番目の数
t = (low + high) // 2

# 探索の下限のlowが上限のhighになるまで探索
# lowがhighに達すると数は見つからなかっTrueたということ
X = 0
Y = 0
s = 0
while high - low >= 0:
    for j in range(n):
        X += max(0, math.ceil((h[j] - t * b) / (a - b)))
        #Y += max(0, math.ceil((h[j] - (t - 1) * b) / (a - b)))
    if X == t:
        print(t)
        exit()
    elif X < t:
        high = t - 1
        """for j in range(n):
            Y += max(0, math.ceil((h[j] - (t - 1) * b) / (a - b)))"""
    elif X > t:
        low = t + 1
    s = t
    t = (low + high) // 2
    X = 0
    Y = 0
for j in range(n):
  if math.ceil((h[j] - s * b) / (a - b)) > 0:
            Y += math.ceil((h[j] - s * b) / (a - b))
if Y <= s:
  print(s)
else:
  print(s + 1)
### BUGGY CODE ###

N=int(input())
*A,=map(int,input().split())

M=1000*1000*1000+7

SS=0
for i in range(N-1):
  SS+=A[i]*sum(A[i+1:])

print("{}".format(SS%M))



### FIXED CODE ###

N=int(input())
*A,=map(int,input().split())
M=1000*1000*1000+7
S=[0]*N

SS=0
for i in range(N-1,0,-1):
  S[i-1]=A[i]+S[i]
  SS+=A[i-1]*S[i-1]

print("{}".format(SS%M))
### BUGGY CODE ###

import math


def comb(n, r, mod):
    # calculates C(n,r) mod p (assuming mod is prime).
    nc = n
    for rc in range(1, r):
        nc -= 1
        n *= nc % mod
        r *= rc % mod

    nCr = n*pow(r, mod - 2, mod) % mod
    return nCr


def solve():
    n, a, b = list(map(int, input().split()))
    mod = int(math.pow(10, 9) + 7)

    total = pow(2, n, mod) - 1
    ac = comb(n, a, mod)
    bc = comb(n, b, mod)
    ans = int(total - ac - bc) % mod

    print(ans)


# Solve
if __name__ == "__main__":
    solve()


### FIXED CODE ###

import math


def comb(n, r, mod):
    # calculates C(n,r) mod p (assuming mod is prime).
    nc = n
    for rc in range(1, r):
        nc -= 1
        n = n*nc % mod
        r = r*rc % mod

    nCr = n*pow(r, mod - 2, mod)
    return nCr


def solve():
    n, a, b = list(map(int, input().split()))
    mod = int(pow(10, 9) + 7)

    total = pow(2, n, mod) - 1
    ac = comb(n, a, mod)
    bc = comb(n, b, mod)
    ans = int(total - ac - bc) % mod

    print(ans)


# Solve
if __name__ == "__main__":
    solve()
### BUGGY CODE ###

from collections import deque

N = int(input())

neighbor = [[0]*N for _ in range(N)]

for _ in range(N-1):
    a, b = map(int, input().split())
    neighbor[a-1][b-1] = 1
    neighbor[b-1][a-1] = 1

# 黒を0、白を1、未着色を-1で表す
black_white = [0] + [-1]*(N-2) + [1]

# 点iを与えると、点iからの最短距離のリストを返す
def shortest_distance(home_point):
    shortest_distance_list = [-1]*N
    shortest_distance_list[home_point] = 0
    visited = [0]*N
    visited[home_point] = 1
    next_points = deque([home_point])

    while len(next_points) > 0:
        p = next_points.popleft()
        visited[p] = 1
        for idx in range(N):
            if neighbor[p][idx] > 0 and visited[idx] == 0:
                shortest_distance_list[idx] = shortest_distance_list[p]+1
                if idx not in next_points:
                    next_points.append(idx)

    return shortest_distance_list

shortest_distance_from_Fennec = shortest_distance(0)
shortest_distance_from_Snuke = shortest_distance(N-1)

for idx in range(1,N-1):
    if shortest_distance_from_Fennec[idx] <= shortest_distance_from_Snuke[idx]:
        black_white[idx] = 0
    else:
        black_white[idx] = 1

print("Fennec" if black_white.count(0) > black_white.count(1) else "Snuke")


### FIXED CODE ###

from collections import deque

N = int(input())

neighbor = [[] for _ in range(N)]

for _ in range(N-1):
    a, b = map(int, input().split())
    neighbor[a-1].append(b-1)
    neighbor[b-1].append(a-1)

# 黒を0、白を1、未着色を-1で表す
black_white = [0] + [-1]*(N-2) + [1]

# 点iを与えると、点iからの最短距離のリストを返す
def shortest_distance(home_point):
    shortest_distance_list = [-1]*N
    shortest_distance_list[home_point] = 0
    next_points = deque([home_point])

    while len(next_points) > 0:
        p = next_points.popleft()
        for idx in neighbor[p]:
            if shortest_distance_list[idx] == -1:
                shortest_distance_list[idx] = shortest_distance_list[p]+1
                next_points.append(idx)

    return shortest_distance_list

shortest_distance_from_Fennec = shortest_distance(0)
shortest_distance_from_Snuke = shortest_distance(N-1)

for idx in range(1,N-1):
    if shortest_distance_from_Fennec[idx] <= shortest_distance_from_Snuke[idx]:
        black_white[idx] = 0
    else:
        black_white[idx] = 1

print("Fennec" if black_white.count(0) > black_white.count(1) else "Snuke")
### BUGGY CODE ###

from collections import deque

h, w = map(int, input().split())
a = [ list(input()) for _ in range(h) ]

dx, dy = [1, 0, -1, 0], [0, 1, 0, -1]

is_visited = [ [False] * w for _ in range(h) ]

q = deque()

for x in range(w):
    for y in range(h):
        if a[y][x] == "#":
            q.append( (x, y, 0) )
            is_visited[y][x] = True

ans = 0

while q:
    x, y, dist = q.popleft()
    ans = max(ans, dist)

    for i in range(4):
        nx = x + dx[i]
        ny = y + dy[i]

        if nx < 0 or w <= nx or ny < 0 or h <= ny:
            continue

        if is_visited[ny][nx]:
            continue

        q.append( (nx, ny, dist+1) )
        is_visited[ny][nx] = True

print(ans)

### FIXED CODE ###

# coding: utf-8
#!/usr/bin/env python3

from collections import deque

# input
h, w = map(int, input().split())
a = [ list(input()) for _ in range(h) ]

# direction vector
dx, dy = [1, 0, -1, 0], [0, 1, 0, -1]

# 訪れたかどうかの情報を持つ bool 値
is_visited = [ [False for _ in range(w)] for __ in range(h) ]

q = deque()

for x in range(w):
    for y in range(h):
        if a[y][x] == "#":
            q.append( (x, y, 0) )
            is_visited[y][x] = True

while q:
    # queue の先頭を取り出す
    x, y, cnt = q.popleft()
    # 4方向にループ
    for i in range(4):
        nx, ny = x + dx[i], y + dy[i]

        if nx < 0 or w <= nx or ny < 0 or h <= ny or is_visited[ny][nx]:
            continue

        q.append( (nx, ny, cnt+1) )
        is_visited[ny][nx] = True

print(cnt)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

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

vec1, vec2 = [[] for _ in range(N)], [[] for _ in range(N)]

for _ in range(K) :
    p, q = map(int, input().split())
    vec1[p-1].append(q-1)
    vec1[q-1].append(p-1)
for _ in range(L) :
    r, s = map(int, input().split())
    vec2[r-1].append(s-1)
    vec2[s-1].append(r-1)

def bfs(v) :
    visited = [-1] * N
    ret = []
    n = 0
    for i in range(N) :
        if visited[i] < 0 :
            queue = [i]
            visited[i] = n
            j = 0
            while j < len(queue) :
                cur = queue[j]
                for nex in v[cur] :
                    if visited[nex] < 0 :
                        queue.append(nex)
                        visited[nex] = n
                j += 1
                
            ret.append(set(queue))
            n += 1
            
    return ret, visited
    
ret1, visited1 = bfs(vec1)
ret2, visited2 = bfs(vec2)
ret = [str(len(ret1[visited1[i]] & ret2[visited2[i]])) for i in range(N)]

print(' '.join(ret))

### FIXED CODE ###

from collections import Counter
import sys
input = sys.stdin.readline

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

vec1, vec2 = [[] for _ in range(N)], [[] for _ in range(N)]

for _ in range(K) :
    p, q = map(int, input().split())
    vec1[p-1].append(q-1)
    vec1[q-1].append(p-1)
for _ in range(L) :
    r, s = map(int, input().split())
    vec2[r-1].append(s-1)
    vec2[s-1].append(r-1)

def bfs(v) :
    visited = [-1] * N
    n = 0
    for i in range(N) :
        if visited[i] < 0 :
            queue = [i]
            visited[i] = n
            j = 0
            while j < len(queue) :
                cur = queue[j]
                for nex in v[cur] :
                    if visited[nex] < 0 :
                        queue.append(nex)
                        visited[nex] = n
                j += 1
            n += 1
            
    return visited
    
visited1 = bfs(vec1)
visited2 = bfs(vec2)
p = [(visited1[i], visited2[i]) for i in range(N)]
c = Counter(p)

print(' '.join([str(c[p[i]]) for i in range(N)]))
### BUGGY CODE ###

import collections
N=int(input())
A=list(map(int,input().split()))
list=[]
list1={}

for i in range(N):
    if A[i] not in list:
        list.append(A[i])
        x=A[i]
        A[i]=0
        c=collections.Counter(A)
        a=[j*(j-1)/2 for j in c.values() if j>1]
        print(int(sum(a)))
        A[i]=x
        list1[A[i]]=sum(a)
        
    else:
        print(int(list1[A[i]]))



### FIXED CODE ###

import collections
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under


N=int(input())
A=list(map(int,input().split()))

c=collections.Counter(A)
list=c.values()
result=0

for x in list:
    if x>1:
        result+=cmb(x,2)
for y in c.keys():
    c[y]=result-(c[y]-1)

for z in A:
    print(c[z])
### BUGGY CODE ###

import sys
input = sys.stdin.readline

N = int(input())
S = [input().rstrip()[::-1] for i in range(N)]
S.sort(key=lambda x:-len(x))
P = 2**61 - 1

from collections import defaultdict,Counter
D = defaultdict(lambda: Counter())

ans = 0
for s in S:
    sets = [0]
    for c in s[::-1]:
        i = ord(c) - ord('a')
        sets.append(sets[-1] | (1<<i))
    sets.reverse()
    nxs = []
    a = 0
    for l,(c,st) in enumerate(zip(s,sets)):
        for j in range(26):
            if st&(1<<j):
                na = (a*27 + (j+1)) % P
                nxs.append((na,l))
        i = ord(c) - ord('a') + 1
        a *= 27
        a += i
        a %= P
    if a in D[len(s)-1]:
        ans += D[len(s)-1][a]
    for na,l in nxs:
        D[l][na] += 1

print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline

N = int(input())
S = [input().rstrip()[::-1] for i in range(N)]
S.sort(key=len)
P = 2**61 - 1

from collections import defaultdict
D = defaultdict(lambda: [0]*26)

ans = 0
for s in S:
    l = ord(s[-1]) - ord('a')
    a = 0
    tmp = [0] * 26
    for c in s[:-1]:
        i = ord(c) - ord('a')
        if a in D:
            for j in range(26):
                tmp[j] += D[a][j]
        ans += tmp[i]
        tmp[i] = 0
        a = (a*27 + i + 1) % P
    ans += tmp[l]
    D[a][l] += 1

print(ans)
### BUGGY CODE ###

n = int(input())
lst = []
for i in range(n):
  x = input()
  if (x not in lst):
    lst.append(x)
print(len(lst))

### FIXED CODE ###

n = int(input())
lst = []
for i in range(n):
  x = input()
  lst.append(x)
print(len(set(lst)))
### BUGGY CODE ###

from collections import deque

n,m=map(int, input().split())
g = [[] for _ in range(n + 1)]
d = deque()
ans = [0]*(n+1)

for i in range(m):
    a,b=map(int, input().split())
    g[a].append(b)
    g[b].append(a)

d = deque()
for i in g[1]: 
    d.append(i)
    ans[i]=1

while d:
    tmp = d[0]
    for j in range(n+1):
        if tmp in g[j] and ans[j]==0:
            ans[j]=tmp
            d.append(j)
    d.popleft()

if 0 in ans[2:]:
    print('No')
else:
    print('Yes')
    for i in range(2,n+1):
        print(ans[i])

### FIXED CODE ###

from collections import deque

n,m=map(int, input().split())
g = [[] for _ in range(n + 1)]
d = deque()
ans = [0]*(n+1)

for i in range(m):
    a,b=map(int, input().split())
    g[a].append(b)
    g[b].append(a)

d = deque()
for i in g[1]: 
    d.append(i)
    ans[i]=1

while d:
    tmp = d[0]
    for i in g[tmp]:
        if ans[i] == 0:
            ans[i]=tmp
            d.append(i)
    d.popleft()

if 0 in ans[2:]:
    print('No')
else:
    print('Yes')
    for i in range(2,n+1):
        print(ans[i])
### BUGGY CODE ###

N = int(input())
l = [-1] * N

print(0)
s = input()
if s=="Male":
    l[0] = 0
elif s=="Female":
    l[0] = 1
else:
    print(0)
    exit(0)

print(N-1)
s = input()
if s=="Male":
    l[N-1] = 0
elif s=="Female":
    l[N-1] = 1
else:
    print(N-1)
    exit(0)

left, right = 0, N-1
while right-left>1:
    mid = (left+right)//2

    print(mid)
    s = input()
    if s=="Male":
        l[mid] = 0
    elif s=="Female":
        l[mid] = 1
    else:
        print(mid)
        exit(0)

    if (l[mid]==l[left] and (mid-left)%2) or (l[mid]!=l[left] and (mid-left)%2==0):
        left, right = left+1, mid-1
    else:
        left, right = mid+1, right-1


### FIXED CODE ###

N = int(input())
l = [-1] * N

print(0)
s = input()
if s=="Male":
    l[0] = 0
elif s=="Female":
    l[0] = 1
else:
    exit(0)

print(N-1)
s = input()
if s=="Male":
    l[N-1] = 0
elif s=="Female":
    l[N-1] = 1
else:
    exit(0)

left, right = 0, N-1
while right-left>1:
    mid = (left+right)//2

    print(mid)
    s = input()
    if s=="Male":
        l[mid] = 0
    elif s=="Female":
        l[mid] = 1
    else:
        exit(0)

    if (l[mid]==l[left] and (mid-left)%2) or (l[mid]!=l[left] and (mid-left)%2==0):
        left, right = left, mid
    else:
        left, right = mid, right
### BUGGY CODE ###

s = input()
s = s[::-1]

dp = [0]*13
dp[0] = 1

for ind, i in enumerate(s):
    m = 10**ind%13
    tmp = [0]*13
    for j in range(10):
        if i!='?' and int(i)!=j:
            continue
        for k in range(13):
            tmp[k] += dp[(k-j*m%13)%13]
    dp = tmp
print(dp[5]%(10**9+7))


### FIXED CODE ###

import numpy as np
s = input()

A = []
for i in range(6):
    m = [-(j*10**i%13)%13 for j in range(10)]
    tmp = []
    for j in m:
        tmp.append([[1 if (k-l)%13==j else 0 for k in range(13)] for l in range(13)])
    tmp.append([[1 if (k-l)%13 in m else 0 for k in range(13)] for l in range(13)])
    A.append(tmp)
A = np.array(A)

dp = np.zeros(13, dtype=int)
dp[0] = 1
m = 1
for ind, i in enumerate(reversed(s)):
    i = int(i) if i!='?' else 10
    tmp = np.dot(A[ind%6, i, :, :], dp)
    dp = tmp%(10**9+7)
print(dp[5])
### BUGGY CODE ###

s = input()
nq = int(input())
flg = 0
front = []
back = []
for i in range(nq):
    q = input()
    if len(q) == 1:
        flg += 1
    else:
        if flg % 2 == 0:
            if q[2] == '1':
                front = [q[-1]] + front
            else:
                back = back + [q[-1]]
        else:
            if q[2] == '1':
                back = back + [q[-1]]
            else:
                front = [q[-1]] + front
                
s = ''.join(front) + s + ''.join(back)
if flg % 2 == 1:
    s = s[::-1]
print(s)

### FIXED CODE ###

from sys import stdin
 
def main():
    S = list(stdin.readline().rstrip())
    Q = int(input())
    rev = 0
    head = []
    tail = []
 
    for _ in range(Q):
        q = stdin.readline()
        if q[0] == "1":
            rev = (rev+1)%2
        else:
            if q[2] == "1":
                if rev == 0:
                    head.append(q[4])
                else:
                    tail.append(q[4])
            else:
                if rev ==0:
                    tail.append(q[4])
                else:
                    head.append(q[4])
 
    if rev == 0:
        ans = "".join(head[::-1] + S + tail)
    else:
        ans = "".join(tail[::-1] + S[::-1] + head)
    
    print(ans)
    
main()
### BUGGY CODE ###

"""
dp[i] : 足場i番目におけるコストの最小値
"""

N,K = map(int, input().split())
hs = list(map(int, input().split()))
INF = 10**10
dp = [INF]*110000
dp[0] = 0
for i in range(N):
    for j in range(K+1):
        #もらうDP
        if i - j >= 0:
            dp[i] = min(dp[i], dp[i-j]+abs(hs[i-j]-hs[i]))
print(dp[N-1])

### FIXED CODE ###

N, K = map(int,input().split())
hs = [int(i) for i in input().split()]

dp = [1000000]*N
dp[0] = 0
for i in range(1,N):
    # for k in range(K+1):
    x = max(0, i-K)
    # dp[i] = min(dp[i], dp[min_ind]+abs(hs[min_ind]-hs[i]))
    dp[i] = min([dpj + abs(hs[i] - hj) for hj, dpj in zip(hs[x:i], dp[x:i])])
# print(dp)
print(dp[-1])
### BUGGY CODE ###

n,q=map(int,input().split())
for i in range(q):
    v,w=map(int,input().split())
    while v!=w:
        if v>w:
            v=(v+n-2)//n
        else:
            w=(w+n-2)//n
    print(v)

### FIXED CODE ###

n,q=map(int,input().split())
if n==1:
    for i in range(q):
        v,w=map(int,input().split())
        print(min(v,w))
else:
    for i in range(q):
        v,w=map(int,input().split())
        while v!=w:
            if v>w:v,w=w,v
            w=(w+n-2)//n
        print(v)
### BUGGY CODE ###

import sys

A, B, M = [int(x) for x in sys.stdin.readline().strip().split(" ")]
list_a = [int(x) for x in sys.stdin.readline().strip().split(" ")]
list_b = [int(x) for x in sys.stdin.readline().strip().split(" ")]
dict_c = {}
for i in range(M):
    x, y, c = [int(x) for x in sys.stdin.readline().strip().split(" ")]
    if x not in dict_c:
        dict_c[x] = {}
    dict_c[x][y] = max(dict_c[x].get(y, 0), c)

s = 1e5
for i, a in enumerate(list_a):
    for j, b in enumerate(list_b):
        t = a + b - dict_c.get(i + 1, {}).get(j + 1, 0)
        if s > t:
            s = t
print(s)


### FIXED CODE ###

import sys

A, B, M = [int(x) for x in sys.stdin.readline().strip().split(" ")]
list_a = [int(x) for x in sys.stdin.readline().strip().split(" ")]
list_b = [int(x) for x in sys.stdin.readline().strip().split(" ")]
min_a = sorted(list_a)[0]
min_b = sorted(list_b)[0]

dict_c = {}
idx = []
for i in range(M):
    x, y, c = [int(x) for x in sys.stdin.readline().strip().split(" ")]
    if x not in dict_c:
        dict_c[x] = {}
    if c > dict_c[x].get(y, 0):
        dict_c[x][y] = c

    idx.append(tuple([x, y]))

s = min_a + min_b
for (x, y) in idx:
    t = list_a[x - 1] + list_b[y - 1] - dict_c[x][y]
    if t < s:
        s = t
print(s)
### BUGGY CODE ###

cell=list(map(int,input().split()))
n=cell[0]
k=cell[1]
pren=n
while 2>0:
    n=abs(n-k)
    if n >pren:
        break
    else:
        pren=n


print(pren)

### FIXED CODE ###

import math
def main(cell):

    n=cell[0]
    k=cell[1]
    if k==0:
        return n
    else:

        risk=math.floor(n/k)
        if risk ==0:
            n=n
        else:
            n=abs(n-k*risk)
        pren=n
        while 2>0:
            n=abs(n-k)
            if n >pren:
                break
            else:
                pren=n

        return pren
    


cell=list(map(int,input().split()))
pren=main(cell)
print(pren)
### BUGGY CODE ###

import numpy as np

n = int(input())
a = [int(input()) for _ in range(n)]
na = np.array(a)
for i in range(n):
    nb = np.copy(na)
    nb[i] = 0
    print(np.max(nb))

### FIXED CODE ###

import numpy as np

n = int(input())
a = [int(input()) for _ in range(n)]
na = np.array(a)
maxI = np.argmax(na)
maxA = na[maxI]
nb = np.copy(na)
nb[maxI] = 0
maxA2 = np.max(nb)
for i in range(n):
    if i != maxI:
        print(na[maxI])
    else:
       print(maxA2)
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
answer = 1
for i in range(N):
    answer *= A[i]
if answer > 10 ** 18:
    print(-1)
else:
    print(answer)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
A.sort()
answer = 1
for i in A:
    answer *= i
    if answer > 10 ** 18:
        break

if answer > 10 ** 18:
    print(-1)
else:
    print(answer)
### BUGGY CODE ###

N,M=(int(i) for i in input().split())
a=[int(i) for i in input().split()]

for i in range(M):
    b,c=(int(i) for i in input().split())
    for i in range(b):
        a.append(c)

a=sorted(a,reverse=True)
answer=0
for i in range(N):
    answer+=a[i]
print(answer)

### FIXED CODE ###

N,M=(int(i) for i in input().split())
a=[[int(i),1] for i in input().split()]

for i in range(M):
    b,c=(int(i) for i in input().split())
    a.append([c,b])
    

a=sorted(a,key=lambda x:x[0],reverse=True)
answer=0
i=0
n=0
while True:
    answer+=a[i][0]*a[i][1]
    i+=1
    n+=a[i-1][1]
    if n>=N:
        answer-=a[i-1][0]*(n-N)
        break
print(answer)
### BUGGY CODE ###

i = list(map(int, input().split()))
N = i[0]
K = i[1]

p = list(map(int, input().split()))
max_s = 0
s_current = 0

for i in range(N - K + 1):
    if i == 0:
        for j in range(K):
            p_list = [p[k] for k in range(K)]
            max_s = sum(p_list)
            s_current = max_s
    else:
        s_current = s_current - p[i - 1] + p[i + K - 1]
        if s_current > max_s:
            max_s = s_current
    
ans = (max_s + K) / 2.0
print(ans)

### FIXED CODE ###

if __name__ == '__main__':
    import sys
    
    i = list(map(int, input().split()))
    N = i[0]
    K = i[1]
    
    p = list(map(int, sys.stdin.readline().split()))
    max_s = 0
    s_current = 0
    
    for i in range(N - K + 1):
        if i == 0:
            p_list = p[:K]
            max_s = sum(p_list)
            s_current = max_s
        else:
            s_current = s_current - p[i - 1] + p[i + K - 1]
            if s_current > max_s:
                max_s = s_current
        
    ans = (max_s + K) / 2.0
    print(ans)
### BUGGY CODE ###



from math import factorial
S=list(map(int,input()))
S.reverse()
count2019 = [0]*2019
count2019[0]=1
mod2019 = 0
for i in range(len(S)):
    mod2019 =(mod2019+S[i]*10**i)%2019
    count2019[mod2019] +=1

ans =0
for i in count2019:
   ans+= i*(i-1)//2
print(ans)
# print(count2019)

### FIXED CODE ###

s = list(input())
# s = list(str(10**200000))
n = len(s)
ans = 0
s.reverse()
# print(s)
x = 1
tot = 0
count = [0]*2019
for i in range(n):
    count[tot]+=1
    tot += int(s[i])*x
    # print(tot)
    tot %= 2019
    ans += count[tot]
    x = x*10%2019
print(ans)
### BUGGY CODE ###

N = int(input())
*H, = map(int, input().split())
*A, = map(int, input().split())

N0 = 2**(N).bit_length()
INF = 2**31-1
data = [-INF]*(2*N0)
def update(k, x):
    k += N0-1
    data[k] = x
    while k >= 0:
        k = (k - 1) // 2
        data[k] = max(data[2*k+1], data[2*k+2])
def query(l, r):
    L = l + N0; R = r + N0
    s = -INF
    while L < R:
        if R & 1:
            R -= 1
            s = max(s, data[R-1])

        if L & 1:
            s = max(s, data[L-1])
            L += 1
        L >>= 1; R >>= 1
    return s


*I, = range(N)
I.sort(key=lambda x: (H[x], x))
def solve():
    update(0, 0)
    yield 0
    for i in I:
        v = query(0, i+1) + A[i]
        yield v
        update(i+1, v)
print(max(solve()))

### FIXED CODE ###

N = int(input())
*H, = map(int, input().split())
*A, = map(int, input().split())

N0 = 2**(N).bit_length()
INF = 2**31-1
data = [-INF]*(2*N0)
def update(k, x):
    k += N0-1
    data[k] = x
    while k >= 0:
        k = (k - 1) // 2
        data[k] = max(data[2*k+1], data[2*k+2])
def query(l, r):
    L = l + N0; R = r + N0
    s = -INF
    while L < R:
        if R & 1:
            R -= 1
            s = max(s, data[R-1])

        if L & 1:
            s = max(s, data[L-1])
            L += 1
        L >>= 1; R >>= 1
    return s

*I, = range(N)
I.sort(key=lambda x: (H[x], x))
ans = 0
update(0, 0)
for i in I:
    v = query(0, i+1) + A[i]
    ans = max(ans, v)
    update(i+1, v)
print(ans)