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

X,Y,A,B,C = map(int,input().split())

p = sorted(list(map(int,input().split()))) #A
q = sorted(list(map(int,input().split()))) #B
r = sorted(list(map(int,input().split()))) #C

xlist = p[-X:] #X
ylist = q[-Y:] #Y

def main(X,Y,xlist,ylist,r):
    for i in range(min(X,Y)):
        if xlist[i] < ylist[i] and min(xlist) < max(r):
            xlist.remove(min(xlist))
            xlist.append(max(r))
            r.pop()
        elif ylist[i] < xlist[i] and min(ylist) < max(r):
            ylist.remove(min(ylist))
            ylist.append(max(r))
            r.pop()
        elif min(xlist) >= max(r) and min(ylist) >= max(r):
            break
        else:
            continue
    
    print(sum(xlist)+sum(ylist))

main(X,Y,xlist,ylist,r)

### FIXED CODE ###

X,Y,A,B,C = map(int,input().split())

p = sorted(list(map(int,input().split()))) #A
q = sorted(list(map(int,input().split()))) #B
r = sorted(list(map(int,input().split()))) #C

xlist = p[-X:] #X
ylist = q[-Y:] #Y

"""
def main(X,Y,xlist,ylist,r):
    for i in range(min(X,Y)):
        if xlist[i] < ylist[i] and min(xlist) < max(r):
            xlist.remove(min(xlist))
            xlist.append(r.pop())
            
        elif ylist[i] < xlist[i] and min(ylist) < max(r):
            ylist.remove(min(ylist))
            ylist.append(r.pop())
            
        elif min(xlist) >= max(r) and min(ylist) >= max(r):
            break
        else:
            continue
    
    print(sum(xlist + ylist))

main(X,Y,xlist,ylist,r)
"""
all_apples = sorted(xlist + ylist + r)
print(sum(all_apples[-(X+Y):]))
### BUGGY CODE ###

import math

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

if M == 0:
    a = [-1 , N+1]
else :
    a = [-1] * (M+2)

    for i in range(1,M+1) :
        a[i] = int(input())

flag = True # 可能かどうか
for i in range(0,M+1) :
    if a[i] + 1 == a[i+1] :
        flag = False
        break

fact = [0] * (N+2)

if flag :
    a[M+1] = N + 1

    ans = 1

    for i in range(M+1) :
        length = a[i+1] - a[i] - 2 # 上がる長さ
        max2step = math.floor(length / 2) # 2段の回数
        count = 1
        for j in range(1,max2step+1) :
            if fact[j] != 0 :
                step2 = fact[j]
            else :
                step2 = math.factorial(j)
                fact[j] = step2
            if fact[length-2*j] != 0 :
                step1 = fact[length-2*j]
            else :
                step1 = math.factorial(length-2*j)
                fact[length-2*j] = step1
            if fact[length - j] != 0 :
                step3 = fact[length-j]
            else :
                step3 = math.factorial(length - j)
                fact[length - j] = step3
            count += step3 // step1 // step2
        ans *= count

    print(ans % 1000000007)
else :
    print(0)

### FIXED CODE ###

import math

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

if M == 0:
    a = [-1 , N+1]
else :
    a = [-1] * (M+2)

    for i in range(1,M+1) :
        a[i] = int(input())


flag = True # 可能かどうか
for i in range(0,M+1) :
    if a[i] + 1 == a[i+1] :
        flag = False
        break

fib = [1] * (N+1) # フィボナッチ数列
for i in range(2,N+1) :
    fib[i] = fib[i-1] + fib[i-2]

if flag :
    a[M+1] = N + 1

    ans = 1

    for i in range(M+1) :
        length = a[i+1] - a[i] - 2 # 上がる長さ
        ans *= fib[length]

    print(ans % 1000000007)
else :
    print(0)
### BUGGY CODE ###

N = int(input())
*A, = [int(input()) for _ in range(N)]
for i in range(N):
    tmp = A[i]
    A[i] = 0
    print(max(A))
    A[i] = tmp

### FIXED CODE ###

import sys
input = sys.stdin.readline
N = int(input())
A = [int(input()) for _ in range(N)]
B = sorted(A)
for x in A:
    if x == B[-1]:
        print(B[-2])
    else:
        print(B[-1])
### BUGGY CODE ###

[x,y]=list(map(int,input().split()))
if ((x%3)+(y%3))%3!=0:
	print(0)
else:
	dansu=int((x+y)/3)
	r=(x+y-dansu)-x
	d=1
	rr=1
	nr=1
	for i in range(1,dansu+1):
		d=d*(i%(10**9+7))
	for i in range(1,r+1):
		rr=rr*(i%(10**9+7))
	for i in range(1,dansu-r+1):
		nr=nr*(i%(10**9+7))
	
	kotae=int(d/(rr*nr))
	kotae=kotae%(10**9+7)
	
	print(kotae)

### FIXED CODE ###

[x,y]=list(map(int,input().split()))
if ((x%3)+(y%3))%3!=0:
	print(0)
else:
	n=int((x+y)/3)
	r=y-n
	if r<0 or r>n:
		print(0)
	else:
		if r>n-r:
			r=n-r
		mod=1000000007
		kaijo=[1]
		for i in range(1,n+1):
			kaijo.append(kaijo[-1]*i%mod) #これで、kaijo[i]=i!となる。
		gyakugen=[pow(kaijo[n-r],mod-2,mod)]
		for i in reversed(range(1,n-r+1)):
			gyakugen.append(gyakugen[-1]*i%mod) #これで、gyakugen[i]=n-r-iの逆元となる
		kotae=kaijo[n]*gyakugen[0]*gyakugen[n-2*r]%mod

		print(kotae)
### BUGGY CODE ###

import sys
from collections import defaultdict

sys.setrecursionlimit(2147483647)


class Graph:
    def __init__(self):
        self.graph = defaultdict(set)

    def interconnect(self, u, v):
        self.graph[u].add(v)
        self.graph[v].add(u)

    def dfs(self, start):
        seen = set()
        return self.dfs_recurse(start, seen)

    def dfs_recurse(self, v, seen):
        seen.add(v)
        for u in self.graph[v] - seen:
            self.dfs_recurse(u, seen)
        return seen

    def size(self, v):
        return len(self.dfs(v))


if __name__ == "__main__":
    n, m, k = map(int, input().split())

    f = Graph()
    b = Graph()

    [f.interconnect(*map(lambda x: int(x) - 1, input().split())) for _ in range(m)]
    [b.interconnect(*map(lambda x: int(x) - 1, input().split())) for _ in range(k)]

    visited = [False] * n
    counts = [0] * n

    for v in range(n):
        if visited[v]:
            continue
        elems = f.dfs(v)
        elems_cnt = len(elems)
        for i in elems:
            counts[i] = elems_cnt - len(elems & f.graph[i]) - len(elems & b.graph[i]) - 1
            visited[i] = True

    print(*counts)


### FIXED CODE ###

class UnionFind:
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def size(self, x):
        return -self.parents[self.find(x)]


if __name__ == "__main__":
    n, m, k = map(int, input().split())

    u = UnionFind(n)
    f_cnt = [0] * n
    b_cnt = [0] * n

    for _ in range(m):
        a, b = map(int, input().split())
        u.union(a - 1, b - 1)
        f_cnt[a - 1] += 1
        f_cnt[b - 1] += 1

    for _ in range(k):
        c, d = map(int, input().split())
        if u.same(c - 1, d - 1):
            b_cnt[c - 1] += 1
            b_cnt[d - 1] += 1

    print(*[(u.size(i) - f_cnt[i] - b_cnt[i] - 1) for i in range(n)])
### BUGGY CODE ###

#!/usr/bin/env python3

MOD = 1000000007
n, *a = map(int, open(0).read().split())

ans = 0
w = 1
for i in range(61):
    zero = one = 0
    for x in a:
        if (x>>i)&1: one += 1
        else: zero += 1
    ans = (ans + w * zero * one % MOD) % MOD
    w = w * 2 % MOD
print(ans)


### FIXED CODE ###

MOD = 1000000007
n, *a = map(int, open(0).read().split())

ans = 0
w = 1
for i in range(61):
    zero = one = 0
    for j in range(n):
        if a[j]&1: one += 1
        else: zero += 1
        a[j] >>= 1;
    ans += w * zero * one
    ans %= MOD
    w = w * 2 % MOD
print(ans)
### BUGGY CODE ###

import sys
import itertools

N, K = map(int, input().split())
a = list(map(int, input().split()))
L = []
for i in itertools.combinations(a, 2):
  L.append(i[0] * i[1])
print(sorted(L)[K-1])


### FIXED CODE ###

import numpy as np

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

A = np.array(input().split(), np.int64)

A.sort()

posA = A[A > 0]
negA = A[A < 0]
zeros = (A==0).sum()

left = -10**18
right = 10**18

while left+1 < right:
    num = (left+right)//2
    
    less_count = 0
    
    if num >= 0:
        less_count += zeros * n
    
    limit_pair_for_pos = num // posA
    limit_idxs = np.searchsorted(A, limit_pair_for_pos, side='right')
    less_count += limit_idxs.sum()

    limit_pair_for_neg = -(num // -negA)
    limit_idxs = n - np.searchsorted(A, limit_pair_for_neg, side='left')
    less_count += limit_idxs.sum()

    duplicate_cases = (A**2 <= num).sum()
    less_count -= duplicate_cases
    less_count //= 2
    
    if less_count >= k:
        right = num
    else:
        left = num

print(right)
### BUGGY CODE ###

n = int(input())
s = input()

ans = 10**6
for i in range(n):
  ans = min(ans,s[:i].count("W")+s[i+1:].count("E"))
print(ans)

### FIXED CODE ###

n = int(input())
s = input()

tmp = s[1:].count("E")
ans = min(10**6,tmp)
for i in range(n-1):
  if s[i] == "W":
    tmp += 1
  if s[i+1] == "E":
    tmp -= 1
  ans = min(ans,tmp)
print(ans)
### BUGGY CODE ###

n, y = map(int, input().split())

for i in range(int(round(y/10000, 0)) + 1):
    for j in range(int(round(y/5000, 0)) + 1):
        for k in range(int(round(y/1000, 0)) + 1):
            if (10000*i) + (5000*j) + (1000*k) == y and i+j+k == n:
                print(i, j, k)
                exit()

print("-1 -1 -1")

### FIXED CODE ###

n, y = map(int, input().split())

for i in range(n+1):
    for j in range(n-i+1):
        if (10000*i) + (5000*j) + (1000*(n-i-j)) == y:
            print(i, j, n-i-j)
            exit()

print("-1 -1 -1")
### BUGGY CODE ###

import itertools

def warshall_floyd(d):
  len_d = len(d)
  for k in range(len_d):
    for i in range(len_d):
      for j in range(len_d):
        d[i][j] = min(d[i][j], d[i][k] + d[k][j])
  return d


n, m, r = map(int, input().split())
list_r = list(map(int, input().split()))
list_r = [one_r-1 for one_r in list_r]
dist = [[float("inf") for _ in range(n)] for _ in range(n)]
for i in range(n):
  dist[i][i] = 0
for i in range(m):
  a, b, c = map(int, input().split())
  dist[a-1][b-1] = c
  dist[b-1][a-1] = c
min_dist = warshall_floyd(dist)

result = float("inf")
for one_cand in itertools.permutations(list_r):
  temp = 0
  for i in range(r-1):
    temp += min_dist[one_cand[i]][one_cand[i+1]]
  if temp < result:
    result = temp
print(result)

### FIXED CODE ###

from itertools import permutations
import sys

def main():
    
    N, M, R = map(int, sys.stdin.readline().split())
    r = [i - 1 for i in map(int, sys.stdin.readline().split())]
    
    d = [[float('inf')] * N for _ in range(N)]
    
    for i in range(N):
        d[i][i] = 0
        
    for i in range(M):
        a, b, c = map(int,sys.stdin.readline().split())
        d[a-1][b-1] = c
        d[b-1][a-1] = c
        
    for k in range(N):
        for i in range(N):
            for j in range(N):
                if d[i][j] > d[i][k] + d[k][j]:
                    d[i][j] = d[i][k] + d[k][j]
    
    ans = 10**12
    
    for each in permutations(r):
        t_dis = 0
        for i in range(R-1):
            t_dis += d[each[i]][each[i+1]]  
        
        ans = min(ans, t_dis)
    
    print(ans)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

N=int(input())
AList = [int(input()) for i in range(N)]

MList=[]
i=0
while i<N:
    B=str(AList[i])
    AList[i]=0
    MList.append(max(AList))
    AList[i]=int(B)
    
    i+=1

for i in MList:
    print(i)

### FIXED CODE ###

N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
B = sorted(A)
for n in A:
    if B[-1] != n:
        print(B[-1])
    else:
        print(B[-2])
### BUGGY CODE ###

import sys
import collections
import itertools


def resolve(in_):
    one = ord(b'1')
    two = ord(b'2')
    # print(f'{one=} {two=}')

    S = in_.readline().strip()
    q = collections.deque(S)
    # print(f'{S=} {q=}')

    Q = int(in_.readline())
    for query in itertools.islice(in_, Q):
        T = query[0]
        if T == one and len(q) > 1:
            q.reverse()
        elif T == two:
            F = query[2]
            C = query[4]
            if F == one:
                q.appendleft(C)
            elif F == two:
                q.append(C)

    return bytes(q)


def main():
    answer = resolve(sys.stdin.buffer)
    print(answer.decode('ascii'))


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import collections
import itertools


def resolve(in_):
    one = ord(b'1')
    two = ord(b'2')
    # print(f'{one=} {two=}')

    S = in_.readline().strip()
    q = collections.deque(S)
    # print(f'{S=} {q=}')

    reverse_flag = False
    Q = int(in_.readline())
    for query in itertools.islice(in_, Q):
        T = query[0]
        if T == one:
            reverse_flag ^= True 
            # q.reverse()
        elif T == two:
            F = query[2]
            C = query[4]
            if (F == one) ^ reverse_flag:
                q.appendleft(C)
            else:
                q.append(C)
    else:
        if reverse_flag:
            q.reverse()
            reverse_flag = 0

    return bytes(q)


def main():
    answer = resolve(sys.stdin.buffer)
    print(answer.decode('ascii'))


if __name__ == '__main__':
    main()
### BUGGY CODE ###

from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
import fractions
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

n = I()
A = LI()

cnt = [0] * n

sa = set(A)

for v in sa:
    if cnt[v-1] == 0:
        cnt[v-1] = A.count(v)

for c in cnt:
  print(c)


### FIXED CODE ###

from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
import fractions
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

n = I()
A = LI()

cnt = [0] * n

sa = set(A)
csa = Counter(A)

for v in sa:
    if cnt[v-1] != 0:
        continue
    cnt[v-1] = csa[v]

for c in cnt:
  print(c)
### BUGGY CODE ###

N, K = map(int, input().split())
A = [0] + list(map(int, input().split()))

now = 1
path = [1]
cnt = 1


i = 0
while i < min(N + 2, K):
    now = A[now]
    i += 1
    if now in path: break
    path.append(now)

if i == K:
    print(now)
    quit()

lo_start = path.index(now)
lo_len = i - lo_start
loop = path[lo_start:]

ans = loop[(K - lo_start) % lo_len]

print(ans)

### FIXED CODE ###

N, K = map(int, input().split())
A = [0] + list(map(int, input().split()))

now = 1
path = [1]

for i in range(N + 2):
    now = A[now]
    path.append(now)

if i >= K:
    print(path[K])
    quit()

now = path.pop()
lo_start = i - 1
while path[lo_start] != now:
    lo_start -= 1

loop = path[lo_start:]

ans = loop[(K - path.index(now)) % len(loop)]

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

from sys import exit, setrecursionlimit
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect
import heapq

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

class pqueue:
  def __init__(self, vals = []):
    self._q = vals
    heapq.heapify(self._q)

  def __repr__(self):
    return "pqueue({0})".format(self._q)

  def push(self, val):
    heapq.heappush(self._q, val)

  def pop(self):
    return heapq.heappop(self._q)

  def top(self):
    return self._q[0]

  def size(self):
    return len(self._q)

setrecursionlimit(1000000)

q = reads()
s = q[0] + q[1] * 1j
t = q[2] + q[3] * 1j

N = read()

p = []; r = []
for i in range(N):
  q = reads()
  p.append(q[0] + q[1] * 1j)
  r.append(q[2])

# Nがsource, N+1がtarget
E = [[0]*(N+2) for _ in range(N+2)]
for i in range(N):
  for j in range(N):
    E[i][j] = max(abs(p[i] - p[j]) - r[i] - r[j], 0)

for i in range(N):
  E[N][i]   = E[i][N]   = max(abs(p[i] - s) - r[i], 0)
  E[N+1][i] = E[i][N+1] = max(abs(p[i] - t) - r[i], 0)

E[N][N+1] = E[N+1][N] = abs(t - s)

INF = 10**15 * 1.0

dist = [INF] * (N+2)
que = pqueue([(0, N)])

while que.size() > 0:
  (d, u) = que.pop()
  if dist[u] < d:
    continue
  for t in range(N+2):
    cost = E[u][t]
    if d + cost < dist[t]:
      dist[t] = d + cost
      que.push((d + cost, t))

print(dist[N+1])


### FIXED CODE ###

from heapq import heappush, heappop

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

q = reads()
s = q[0] + q[1] * 1j
t = q[2] + q[3] * 1j

N = read()

p = []; r = []
for i in range(N):
  q = reads()
  p.append(q[0] + q[1] * 1j)
  r.append(q[2])

# Nがsource, N+1がtarget
E = [[0]*(N+2) for _ in range(N+2)]
for i in range(N):
  for j in range(N):
    E[i][j] = max(abs(p[i] - p[j]) - r[i] - r[j], 0)

for i in range(N):
  E[N][i]   = E[i][N]   = max(abs(p[i] - s) - r[i], 0)
  E[N+1][i] = E[i][N+1] = max(abs(p[i] - t) - r[i], 0)

E[N][N+1] = E[N+1][N] = abs(t - s)

INF = 10**15 * 1.0

dist = [E[N][i] for i in range(N+2)] + [INF]
stab = [False] * (N+2)

stab[N] = True

for _ in range(N+1):
  i = N+2
  for j in range(N+2):
    if not stab[j] and dist[j] < dist[i]:
      i = j
  stab[i] = True
  for j in range(N+2):
    dist[j] = min(dist[j], dist[i] + E[i][j])

print(dist[N+1])
### BUGGY CODE ###

n = int(input())
a = list(map(int,input().split()))
j = 0
k = 0

if 1 not in a:
    print(-1)
else:   
    for i in range(1,n+1):
        if i in a[k:]:
            j = j + 1
            k = a[k:].index(i) + k
        else:
            break
    print(n-j)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
x = 1
ans = 0

for i in a:
    if i == x:
        ans += 1
        x += 1

if ans == 0:
    print(-1)
else:
    print(len(a)-ans)
### BUGGY CODE ###

N = int(input())
cards = list(map(int, input().split(' ')))
tmp = float('inf')
for i in range(1, N):
    diff = abs(sum(cards[:i]) - sum(cards[i:]))
    tmp = min(tmp, diff)

print(tmp)

### FIXED CODE ###

import numpy
N = int(input())
cards = numpy.cumsum(list(map(int, input().split(' '))))
tmp = float('inf')
for i in range(N-1):
    diff = abs(cards[i] * 2 - cards[-1])
    tmp = min(tmp, diff)

print(tmp)
### BUGGY CODE ###

import itertools
x,y = map(int, input().split())
for v in itertools.product([2,4], repeat=x):
    if sum(v) == y:
        print("Yes")
        exit()
print("No")

### FIXED CODE ###

x,y = map(int, input().split())
for a in range(x+1):
    b = x-a
    if 2*a+4*b==y or 4*a+2*b==y:
        print("Yes")
        exit()
print("No")
### BUGGY CODE ###

n = int(input())
a = list(map(int,input().split()))
s = 1
for i in a:
    s *= i
    
if s>10**18:
    print(-1)
else:
    print(s) 


### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
a.sort()
s = 1
for i in a:
    s *= i
    if s>10**18:
        print(-1)
        exit()
else:
    print(s)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

S = int(input())
S_Len = len(str(S))
Surpus = [-1 for i in range(2019)]
Surpus[0] = 0

for i in range(1,S_Len + 1):
    x = S % (10 ** i)
    Surpus[x % 2019] += 1


ans = 0
for i in Surpus:
    ans += int(i * (i + 1) / 2)

print(ans)

### FIXED CODE ###

S = input()[::-1]
Surpus = [0] * 2019
Surpus[0] = 1

sum = 0
x = 1
for i in S:
    sum += int(i) * x
    Surpus[sum % 2019] += 1
    x *= 10
    x %= 2019

ans = 0
for i in Surpus:
    ans += i * (i - 1) // 2

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

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

for i in A:
    ans=ans*i
if ans>1000000000000000000:
    print(-1)
    exit()

print(ans)

### FIXED CODE ###

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

for i in range(N):
    ans=ans*A[i]
    if ans>10**18:
        print(-1)
        exit()
print(ans)
### BUGGY CODE ###

n=int(input())
a=list(map(lambda x: int(x), input().split()))
ans=0
for i in range(2,100000):
    tmp = a.count(i-1)+a.count(i)+a.count(i+1)
    if ans < tmp:
        ans=tmp
print(ans)

### FIXED CODE ###

n=int(input())
a=list(map(lambda x: int(x), input().split()))
dic={}
for i in a:
    dic[i]=dic.get(i,0)+1
tmp=dic.get(0,0)+dic.get(1,0)
ans=0
for i in range(2,100000):
    tmp+=dic.get(i,0)
    if tmp>ans:
        ans=tmp
    tmp-=dic.get(i-2,0)
print(ans)
### BUGGY CODE ###

n,k=map(int,input().split())
p=list(map(int,input().split()))
ans=0
res=[]
for i in range(n):
    if i+k>n:break
    tmp=sum(p[i:i+k])
    ans=max(ans, tmp)
    if ans==tmp:
        res=p[i:i+k]
ans=0
for j in res:
    ans+=(1+j)/2
print(ans)

### FIXED CODE ###

n,k=map(int,input().split())
p=[(i+1)/2 for i in map(float,input().split())]
MAX=sum(p[0:k])
s=[MAX]*n
for i in range(0,n-k):
    s[i+1]=p[i+k]+s[i]-p[i]
    MAX=max(MAX,s[i+1])
print(MAX)
### BUGGY CODE ###

h,w,m=map(int,input().split())
d_h=[0]*(h+1)
d_w=[0]*(w+1)
d=set()
for i in range(m):
  nh,nw=map(int,input().split())
  d_h[nh]+=1
  d_w[nw]+=1
  d.add((nh,nw))
ans=0
hantei=0
for i in range(1,h+1):
  hantei=0
  for j in range(1,w+1):
    if (i,j) in d:
      hantei=(d_h[i]+d_w[j]-1)
    else:
      hantei=(d_h[i]+d_w[j])
    if ans < hantei:
      ans=hantei
print(ans)

### FIXED CODE ###

h,w,m=map(int,input().split())
d_h=[0]*(h+1)
d_w=[0]*(w+1)
d=[]
for i in range(m):
  nh,nw=map(int,input().split())
  d_h[nh]+=1
  d_w[nw]+=1
  d.append([nh,nw])
  
#print(d_h)
#print(d_w)

hantei=0
ans1=max(d_h)
memoh=set()
for i in range(1,h+1):
  hantei=d_h[i]
  if ans1==hantei:
    memoh.add(i)
    
hantei=0
ans2=max(d_w)
memow=set()
for j in range(1,w+1):
  hantei=d_w[j]
  if ans2 == hantei:
    memow.add(j)
ans = ans2+ans1-1
#print(memoh,memow)
count = len(memoh)*len(memow)
for hw in d:
  if hw[0] in memoh and hw[1] in memow:
    count-=1
if count>0:
  print(ans+1)
else:
  print(ans)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)


def coupon(i, m, pay):
    if m == 0 or i == n:
        return sum(l[i:])
    for maisuu in range(1, m+1):
        #print("{}に{}まい使う".format(i, maisuu))
        now = l[i] // (2 ** maisuu)
        pay = min(pay, coupon(
            i + 1, m - maisuu, pay) + now)
        if now == 0:
            break

    return pay


n, m = map(int, input().split())

l = [int(c) for c in input().split()]
l.sort()
l.reverse()
max_pay = sum(l)
# print(l)


print(coupon(0, m, max_pay))


### FIXED CODE ###

import sys
import heapq
input = sys.stdin.readline
sys.setrecursionlimit(100000)

n, m = map(int, input().split())

l = [int(c)*(-1) for c in input().split()]
# 優先度付きキューにする
heapq.heapify(l)

for _ in range(m):
    tmp = heapq.heappop(l)*(-1)
    heapq.heappush(l, (tmp // 2)*(-1))

print(sum(l)*(-1))