Harryxun/stf_run huggingface dataset:
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
import numpy as np
def main():
    n, k = map(int, input().split())
    p = np.array(read().split(), np.int32)
    p += 1
    pcum = np.zeros(n + 1, np.int32)
    pcum[1:] = p.cumsum()
    sum_k = pcum[k:] - pcum[:-k]
    print(sum_k.max()/2)

if __name__ == '__main__':
    main()


### FIXED CODE ###

n, k = map(int,input().split())
p = [int(i) for i in input().split()]

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

from collections import Counter

c=Counter(a)

if len(list(c.keys())) ==3:
    if list(c.values())==[n//3,n//3,n//3]:
        print('Yes')
elif len(list(c.keys()))==2:
    if c.most_common()[0][1]==2*n//3:
        print('Yes')
elif len(list(c.keys()))==1:
    if c.keys()[0]==0:
        print('Yes')
else:
    print('No')

### FIXED CODE ###

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

ans='No'
from collections import Counter

c=Counter(a)
keys = list(c.keys())
values =list(c.values())

if keys==[0]:
    ans='Yes'
elif len(keys)==3 and values[0]==n/3 and values[1]==n/3 and keys[0]^keys[1]==keys[2]:
    ans='Yes'
elif len(keys)==2 and c[0]==n/3:
    ans='Yes'

print(ans)
x,n=map(int,input().split())
try:
    p=list(map(int,input().split()))
    mina=100
    for i in range(min(p),max(p)):
        if i not in p:
            if mina>abs(i-x):
                mina=abs(i-x)
                ans=i
                if ans>x and (x-mina) not in p:
                    ans=x-mina
except:
    ans=x

print(ans)

### FIXED CODE ###

x=list(map(int,input().split()))
count=0
for i in x:
    count+=1
    if i==0:
        print(count)
        break
#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(input = sys.stdin.readline):
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    N = II()
    info = []
    MAXL = 101
    b = [[0] * MAXL for _ in range(MAXL)]

    def vtop(x1,x2,y1,y2,h1):
        ans = h1 + abs(x1-x2) + abs(y1-y2)
        return ans if ans <= 10**9 else 0

    # get info
    initidx = -1000
    for i in range(N):
        x,y,h = LMIIS()
        info.append((x,y,h))
        if h > 0:
            initidx = i

    # init candidates
    x,y,h = info[initidx]
    for i in range(MAXL):
        for j in range(MAXL):
            b[i][j] = vtop(x,j,y,i,h)

    # check
    for x,y,h in info:
        for i in range(MAXL):
            for j in range(MAXL):
                if h == 0:
                    if b[i][j] > vtop(x,j,y,i,h):
                        b[i][j] = -1

                else:
                    if b[i][j] != vtop(x,j,y,i,h):
                        b[i][j] = -1

    # answer
    ansl = []
    for i in range(MAXL):
        for j in range(MAXL):
            if b[i][j] > 0:
                ansl.append((j,i,b[i][j]))
    if len(ansl) == 2:
        while True:
            pass
    elif len(ansl) > 2:
        raise Exception()
    else:
        x,y,h = ansl[0]
        print(x,y,h)


if __name__ == '__main__':
    main()

### FIXED CODE ###

#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(input = sys.stdin.readline):
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())

    N = II()
    info = []
    for _ in range(N):
        xi, yi, hi = LMIIS()
        if hi != 0:
            xt, yt, ht = xi, yi, hi
        info.append((xi, yi, hi))

    for Cy in range(101):
        for Cx in range(101):
            H = ht + abs(xt - Cx) + abs(yt - Cy)
            found = True
            for xi, yi, hi in info:
                tmp_h = max(H - abs(Cy-yi) - abs(Cx-xi), 0)
                if tmp_h != hi:
                    found = False
                    break
            if found:
                print('{} {} {}'.format(Cx,Cy,H))
                return



if __name__ == '__main__':
    main()
import math
 
r = 105000
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        for j in range(2*i+1,r,i+1):
            p[j] = 0

prime = [0 for i in ranege(10000)]
j = 0
for i in range(len(p)):
    if p[i]:
        prime[j] = i+1
        j += 1
        
while True:
    n = int(raw_input())
    if not n:
        break
    print sum(prime[:n])import math
 
r = 105000
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        for j in range(2*i+1,r,i+1):
            p[j] = 0

prime = [0 for i in ranege(10000)]
j = 0
for i in range(len(p)):
    if p[i]:
        prime[j] = i+1
        j += 1
        
while True:
    n = int(raw_input())
    if not n:
        break
    print sum(prime[:n])

### FIXED CODE ###

import math

r = 105000
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)]

s = [0 for i in range(11000)]
s[0] = 2
k = 1
for i in range(2,r):
    if p[i]:
        s[k] = i+1+s[k-1]
        k += 1
        
while True:
    n = int(raw_input())
    if not n:
        break
    print s[n-1]
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

s = s()

if s[0] != "A":
	f1 = True  
cnt = 0
for i in range(2,len(s)-1):
	if s[i] == "C":
		cnt += 1
if cnt1 == 1:
	f2 =True
cnt2 = 0
for i in range(1,len(s)):
	if s[i].islower():
		cnt2 += 1
if cnt2 >= len(s) -2:
	f3 = True

if f1 and f2 and f3:
	print("AC")
else:
	prinet("WA")

### FIXED CODE ###

def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

s = s()

flag = 0
if s[0] == "A":
	flag += 1 
cnt1 = 0
for i in range(2,len(s)-1):
	if s[i] == "C":
		cnt1 += 1
if cnt1 == 1:
	flag += 1
cnt2 = 0
for i in range(1,len(s)):
	if s[i].islower():
		cnt2 += 1
if cnt2 >= len(s) -2:
	flag += 1

if flag == 3:
	print("AC")
else:
	print("WA")
n=input()

sm=0

fot i in range(10):
	sm+=n[i]

res='No'

if n%sm==0:
	res='Yes'

print(res)    

### FIXED CODE ###

n=input()
sm=0
 
for i in range(len(n)):
	sm+=int(n[i])

res='No'
 
if int(n)%sm==0:
	res='Yes'

print(res)
A = int(input("A =",))
B = int(input("B =",))
C = int(input("C =",))

if A == max(A, B, C):
    x = 10*A + B + C
    print("お小遣いは", x)
elif B == max(A, B, C):
    x = A + 10*B + C
    print("お小遣いは", x)
elif C == max(A, B, C):
    x = A + B + 10*C
    print("お小遣いは", x)


### FIXED CODE ###

a, b, c = (int(x) for x in input().split())
print(a + b + c + max(a, b, c)*9)
from collections import Counter
import sys
INF = 10 ** 18
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def MI(): return map(int, sys.stdin.readline().split())


N, K = MI()
# 美味しさ降順寿司
sushi = sorted([LI() for _ in range(N)], key=lambda x:x[1], reverse=True)
# 美味しい寿司を貪欲に取る
delicious_sushi = sushi[:K]
# 余った寿司
soudemonai_sushi = sushi[K:]

syurui_counter = Counter()
deliciousness = 0

f = [-INF for _ in range(K+1)]

for x in delicious_sushi:
    syurui_counter[x[0]] += 1
    deliciousness += x[1]

f[len(syurui_counter)] = deliciousness

# print(delicious_sushi)
# print(soudemonai_sushi)
# print(syurui_counter)
# print("==========")


delicious_sushi = delicious_sushi[::-1]

i = 0
j = 0
while len(syurui_counter) < K:
    # print("len(syurui_counter) = " + str(len(syurui_counter)))
    while i < K:
        # print("i = " + str(i))
        if syurui_counter[delicious_sushi[i][0]] >= 2:
            # print(delicious_sushi[i])
            break
        i += 1
    while j < N - K:
        # print("j = " + str(j))
        if syurui_counter[soudemonai_sushi[j][0]] == 0:
            # print(soudemonai_sushi[j])
            break
        j += 1
    deliciousness -= delicious_sushi[i][1]
    deliciousness += soudemonai_sushi[j][1]
    syurui_counter[delicious_sushi[i][0]] -= 1
    syurui_counter[soudemonai_sushi[j][0]] += 1
    # print(syurui_counter)
    f[len(syurui_counter)] = deliciousness
    i += 1
    j += 1
    # print("==========")

# print(f)
for i in range(len(f)):
    f[i] += (i * i)
# print(f)
print(max(f))


### FIXED CODE ###

from collections import Counter
import sys
INF = 10 ** 18
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def MI(): return map(int, sys.stdin.readline().split())


N, K = MI()
# 美味しさ降順寿司
sushi = sorted([LI() for _ in range(N)], key=lambda x:x[1], reverse=True)
# 美味しい寿司を貪欲に取る
delicious_sushi = sushi[:K]
# 余った寿司
soudemonai_sushi = sushi[K:]

syurui_counter = Counter()
deliciousness = 0

f = [-INF for _ in range(K+1)]

for x in delicious_sushi:
    syurui_counter[x[0]] += 1
    deliciousness += x[1]

f[len(syurui_counter)] = deliciousness

# print(delicious_sushi)
# print(soudemonai_sushi)
# print(syurui_counter)
# print("==========")

delicious_sushi = delicious_sushi[::-1]

i = 0
j = 0
while len(syurui_counter) < K and 0 < len(soudemonai_sushi):
    # print("len(syurui_counter) = " + str(len(syurui_counter)))
    while i < K:
        # print("i = " + str(i))
        if syurui_counter[delicious_sushi[i][0]] >= 2:
            # print(delicious_sushi[i])
            break
        i += 1
    while j < N - K:
        # print("j = " + str(j))
        if syurui_counter[soudemonai_sushi[j][0]] == 0:
            # print(soudemonai_sushi[j])
            break
        j += 1
    if j == N - K:
        break
    deliciousness -= delicious_sushi[i][1]
    deliciousness += soudemonai_sushi[j][1]
    syurui_counter[delicious_sushi[i][0]] -= 1
    syurui_counter[soudemonai_sushi[j][0]] += 1
    # print(syurui_counter)
    f[len(syurui_counter)] = deliciousness
    i += 1
    j += 1
    # print("==========")

# print(f)
for i in range(len(f)):
    f[i] += (i * i)
# print(f)
print(max(f))
N,K=map(int,input().split())
mod=10**9+7

C=[[1]*(i+1) for i in range(N+1)]
for i in range(2,N+1):
  for j in range(1,i):
    C[i][j]=(C[i-1][j]+C[i-1][j-1])%mod

for i in range(1,K+1):
  print((C[N-K+1][i]*C[K-1][i-1])%mod)

### FIXED CODE ###

N,K=map(int,input().split())
mod=10**9+7

C=[[1]*(i+1) for i in range(N+1)]
for i in range(2,N+1):
  for j in range(1,i):
    C[i][j]=(C[i-1][j]+C[i-1][j-1])%mod

for i in range(1,K+1):
  if N-K+1<i:
    print(0)
  else:
    print((C[N-K+1][i]*C[K-1][i-1])%mod)
S = input()
N = len(S)
L = list(S)

# 回文の判定
def judge(s):
    n = len(s)
    half = n//2
    for i in range(half):
        if s[i] != s[n-1-i]:
            return False
    return True

removeX = S.replace("x", "")
n_removex = len(removeX)
if N % 2 == 0:
    center = removeX[n_removex//2-1:n_removex//2+1]
else:
    center = removeX[n_removex//2:n_removex//2+1]
left, right = S.split(center)
left_idx = 0
right_idx = len(right) - 1
ret = 0
while left_idx < len(left) and right_idx > -1:
    if left[left_idx] != right[right_idx]:
        if left[left_idx] == "x":
            right_idx -= 1
            ret += 1
        elif right[right_idx] == "x":
            left_idx += 1
            ret += 1
    else:
        left_idx += 1
        right_idx -= 1

ret += len(left) - left_idx
ret += right_idx + 1
if judge(removeX):
    print(ret)
else:
    print(-1)



### FIXED CODE ###

S = input()
N = len(S)
L = list(S)
left_idx = 0
right_idx = N - 1
ret = 0
while left_idx < right_idx:
    l = S[left_idx]
    r = S[right_idx]
    if l == r:
        left_idx += 1
        right_idx -= 1
    elif l == "x":
        ret += 1
        left_idx += 1
    elif r == "x":
        ret += 1
        right_idx -= 1
    else:
        ret = -1
        break

print(ret)
#coding: utf-8
import math

x1, y1, x2, y2 = (int(i) for i in input().split())
print(math.sqrt((x2-x1)+(y2-y1)))


### FIXED CODE ###

#coding: utf-8
import math

x1, y1, x2, y2 = (float(i) for i in input().split())
print(math.sqrt((x2-x1)**2+(y2-y1)**2))
N = int(input())
K = int(input())
ans = [1]*N

for i in range(0,K):
  d = int(input())
  table  = list(map(int, input().split()))
  for j in range(0,N):
    if table.count(j) == 0:
      ans[j] = 0
print(1-sum(ans))

### FIXED CODE ###

NK = list(map(int, input().split()))
ans = [0]*NK[0]

for i in range(0,NK[1]):
  d = int(input())
  table  = list(map(int, input().split()))
  for j in range(1,NK[0]+1):
    if table.count(j) != 0:
      ans[j-1] = 1
print(NK[0]-sum(ans))
N,M=map(int,input().split())
high=list(map(int,input().split()))
A=[0]*N
for i in range(M):
    a,b=map(int,input().split())
    A[a-1]=max(A[a-1],H[b-1])
    A[b-1]=max(A[b-1],H[a-1])
res=sum(H[i]>A[i] for i in range(N))
print(res)


### FIXED CODE ###

N,M=map(int,input().split())
H=list(map(int,input().split()))
A=[0]*N
for i in range(M):
    a,b=map(int,input().split())
    A[a-1]=max(A[a-1],H[b-1])
    A[b-1]=max(A[b-1],H[a-1])
res=sum([H[i]>A[i] for i in range(N)])
print(res)
n = int(input())
As = list(map(int, input().split()))

"""
7 6 8 
1個除いた最大公約数
A1~A(i-1), Ai+1~ANの最大公約数がわかれば良い
"""
# from math import gcd
from fractions import gcd
import sys
input = sys.stdin.readline
class segmented_tree:
    X_unit = 1 << 30
    # X_f = lambda self, a, b: min(a,b)
    X_f = gcd
    def __init__(self, N):
        self.N = N
        self.X = [self.X_unit] * (2*N)
        
    def build(self, seq):
        for i, x in enumerate(seq, self.N):
            self.X[i] = x 
        # 後ろから入れていく
        for i in range(self.N-1, 0, -1):
            self.X[i] = self.X_f(self.X[i<<1], self.X[i<<1|1])

    # 1点更新
    def set_val(self, i, x):
        i += self.N
        self.X[i] = x
        while i > 1:
            i >>= 1
            self.X[i] = self.X_f(self.X[i<<1],self.X[i<<1|1])
    
    # 区間取得
    def fold(self, l, r):
        l += self.N
        r += self.N
        vl = self.X[l]
        vr = self.X[r-1]
        # 外から決めていく
        while l < r:
            # print(l,r)
            if l & 1:
                vl = self.X_f(self.X[l], self.X[l])
                l += 1
            if r & 1:
                r -= 1
                vr = self.X_f(self.X[r], self.X[r])
            l >>= 1
            r >>= 1
        return self.X_f(vl,vr)
  
st = segmented_tree(n)
st.build(As)
mx = 0
for i in range(n):
    a = st.fold(0,i)
        
    if i+1 < n:
        b = st.fold(i+1,n)
    else:
        b = a
    if i == 0:
        a = b
    # print("a",a,b)
    mx = max(mx,gcd(a,b))
print(mx)

### FIXED CODE ###

N  = int(input())
As = [int(i) for i in input().split()]

# 約数
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

# 最大公約数
def gcd(n, m):
    # 最大公約数
    a = max(n,m)
    b = min(n,m)
    while b:
        a, b = b, a % b
    return a

## 高々3種類調べれば良い

if N > 2:
    devs = make_divisors(gcd(As[0],As[1]))
    devs.extend(make_divisors(gcd(As[1],As[2])))
    devs.extend(make_divisors(gcd(As[2],As[0])))
    devs = list(set(devs))
    cnt = 1
    for dev in sorted(devs)[::-1]:
        a = sum([a%dev==0 for a in As])
        if N - a == 0 or N - a == 1:
            print(dev)
            break
else:
    print(max(As))
s=input()
n=int(s)
cands=[abs(753-int(s[i,i+3])) for i in range(n-2)]
minv=min(cands)
print(minv)

### FIXED CODE ###

s=input()
n=len(s)
print(min((abs(753-int(s[i:i+3])) for i in range(n-2))))
import numpy as np
n=int(input())
a=[]
m=[]
for i in range(n):
  a.append(int(input()))
m.append(a.index(max(a)))
m.append(a.pop(m[0]))
m.append(max(a))

for i in range(m[0]):
  print(m[1])
  
print(m[2])

for i in range(m[0]+1,n):
  print(m[i])

### FIXED CODE ###

import numpy as np
n=int(input())
a=[]
m=[]
for i in range(n):
  a.append(int(input()))
m.append(a.index(max(a)))
m.append(a.pop(m[0]))
m.append(max(a))

for i in range(m[0]):
  print(m[1])
  
print(m[2])

for i in range(m[0]+1,n):
  print(m[1])
s = list(input())
k = int(input())
sub = []
for i in range(1, min(len(s) + 1, k)):
    for j in range(1, len(s) + 2 - i):
        if not([s[s_i - 1] for s_i in range(j, j + i)] in sub):
            sub.append([s[s_i - 1] for s_i in range(j, j + i)])
sub.sort()
print(''.join(sub[k-1]))


### FIXED CODE ###

s = list(input())
k = int(input())
sub = []
for i in range(1, min(len(s) + 1, k + 1)):
    for j in range(1, len(s) + 2 - i):
        if not([s[s_i - 1] for s_i in range(j, j + i)] in sub):
            sub.append([s[s_i - 1] for s_i in range(j, j + i)])
sub.sort()
print(''.join(sub[k-1]))
H,W,M = [int(x) for x in input().split()]
hw = []
hNum = [0]*10
wNum = [0]*10

for i in range(M):
    h,w = [int(x) for x in input().split()]
    hw.append([h,w])
    hNum[h]+=1
    wNum[w]+=1
hmax = -1
hMaxList = []
wmax = -1
wMaxList = []
for i in range(10):
    if(hmax <= hNum[i]):
        if(hmax == hNum[i]):
            hMaxList.append(i)
        else:
            hMaxList = [i]
        hmax = hNum[i]

    if(wmax <= wNum[i]):
        if(wmax == wNum[i]):
            wMaxList.append(i)
        else:
            wMaxList = [i]
        wmax = wNum[i]

ans = wmax + hmax
# print(ans)
for i in range(10):
    if([i,i] in hw and i in hMaxList and i in wMaxList):
        ans -= 1
if(len(hw) < 10 and (hmax ==  1 or  wmax ==  1 )):
    ans += 1
print(ans)


### FIXED CODE ###

H,W,M = [int(x) for x in input().split()]
hw = []
hNum = [0]*H
wNum = [0]*W

for i in range(M):
    h,w = [int(x) for x in input().split()]
    hw.append([h,w])
    hNum[h-1]+=1
    wNum[w-1]+=1

hmax = max(hNum)
hMaxList = []
wmax = max(wNum)
wMaxList = []

for i in range(H):
    if(hmax == hNum[i]):
        hMaxList.append(i)
for i in range(W):
    if(wmax == wNum[i]):
        wMaxList.append(i)

ans = wmax + hmax
count = 0
for i in hw:
    if(hNum[i[0]-1] == hmax and wNum[i[1]-1] == wmax):
        count += 1
if(hNum.count(hmax) * wNum.count(wmax) == count):
    ans -= 1
print(ans)
S=input()
T=input()
count=0
for i in range(len(S)):
  if S[i]!=T[i]:
    T[i]=S[i]
    count +=1
print(count)

### FIXED CODE ###

S=input()
T=input()
count=0
for i in range(len(S)):
  if S[i]!=T[i]:
    count +=1
print(count)
import sys

sys.setrecursionlimit(2000)

n,k = map(int,input().split())
lisN = list(range(1,n+1))
lis = set([])

for i in range(k):
    a =int(input())
    for j in range(a):
        lis.add(int(input()))
        

    
print(len(set(lisN) ^ set(lis)))


    

### FIXED CODE ###

s = input()

if s == 'ABC':
    print('ARC')
elif s == 'ARC':
    print('ABC')
# coding: utf-8
import re
S = input()
find_a= re.findall("a")
find_b = re.findall("b")
find_c = re.findall("c")
if find_a and find_b and find_c:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

# coding: utf-8
import re
S = input()
find_a = re.findall("a",S)
find_b = re.findall("b",S)
find_c = re.findall("c",S)
if find_a and find_b and find_c:
    print("Yes")
else:
    print("No")
N,K = map(int,input().split())
S = input()

S[K-1]=S[k-1].lower()
print(S)

### FIXED CODE ###

N,K = map(int,input().split())
S = list(input())
 
S[K-1]=S[K-1].lower()
print("".join(S))
A, B, C, X, Y = map(int, input().split())

while X > 0 or Y > 0:
    if A + B > C:
        sum += C
        X -= 1
        Y -= 1
    else:
        sum += A + B
        X -= 1
        Y -= 1
    if X > 0 and Y > 0:
        continue
    if X > 0:
        if A > C:
            sum += C
            X -= 1
            Y -= 1
        else:
            sum += A
            X -= 1
    else:
        if B > C:
            sum += C
            X -= 1
            Y -= 1
        else:
            sum += B
            Y -= 1

print(sum)


### FIXED CODE ###

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

while X > 0 or Y > 0:
    if X > 0 and Y > 0:
        if A + B > 2 * C:
            sum += 2 * C
            X -= 1
            Y -= 1
        else:
            sum += A + B
            X -= 1
            Y -= 1
    else:
        if X > 0:
            if A > 2 * C:
                sum += 2 * C
                X -= 1
                Y -= 1
            else:
                sum += A
                X -= 1
        else:
            if B > 2 * C:
                sum += 2 * C
                X -= 1
                Y -= 1
            else:
                sum += B
                Y -= 1

print(sum)
# 標準入力
X, Y, A, B, C = map(int, input().split())
red = list(map(int,input().split()))
green = list(map(int,input().split()))
trans = list(map(int,input().split()))
red.sort(reverse=True)
green.sort(reverse=True)
trans.sort(reverse=True)
apple = red[:X] + green[:Y]
apple.sort(reverse=True)
j = 0
for i in range(X + Y):
    if apple[i] < trans[j]:
        apple[i] = trans[j]
        j = j + 1
    else:
        continue
print(sum(apple))

### FIXED CODE ###

X, Y, A, B, C = map(int, input().split())
red = list(map(int,input().split()))
green = list(map(int,input().split()))
trans = list(map(int,input().split()))

red.sort(reverse=True)
green.sort(reverse=True)
trans.sort(reverse=True)
apple = red[:X] + green[:Y]
apple.sort()

j = 0
for i in range(X + Y):
    if apple[i] < trans[j]:
        apple[i] = trans[j]
        j = j + 1
        if j == C:
            break
    else:
        continue
print(sum(apple))
N, M = map(int, input().split())
S = str(input())
T = str(input())

if M > N:
	M, N = N, M
	S, T = T, S

import math
G = N*M//math.gcd(N, M)

A = []
B = []

for i in range (0, N):
	A.append(1+i*G//N) 
for i in range (0, M):
	B.append(1+i*G//M)

J = [0]*(G+1)

for i in range (0, N):
	J[A[i]]+= (i+1)

FA = []
FB = []

for i in range (0, M):
	if J[B[i]] != 0:
		FB.append(i)
		FA.append(J[B[i]]-1)
        
for i in range (0, len(FA)):
	if S[FA[i]] != T[FB[i]]:
		print(-1)
		exit()
print(G)

### FIXED CODE ###

N, M = map(int, input().split())
S = str(input())
T = str(input())

if M > N:
	M, N = N, M
	S, T = T, S

import math
G = N*M//math.gcd(N, M)

A = []
B = []

C = N//math.gcd(N,M)
D = M//math.gcd(N,M)

for i in range (0, math.gcd(N,M)):
	if S[i*C] != T[i*D]:
		print(-1)
		exit()

print(G)
import itertools 
n = int(input())
p = tuple(((map(int,input().split()))))
q = tuple(((map(int,input().split()))))

cnt=0
for v in itertools.permutations(range(1,N+1), N):
    cnt +=1
    if(p==v):
        a = cnt
    if(q==v):
        b = cnt

print(abs(a-b))

### FIXED CODE ###

import itertools
n = int(input())
p = tuple(((map(int,input().split()))))
q = tuple(((map(int,input().split()))))

num = []
for i in range(1,n+1):
    num.append(i)
ans = []
for i in itertools.permutations(num,n):
    ans.append(i)

print(abs(ans.index(p)-ans.index(q)))
h,w=map(int,input().split())
b=['A','B','C','D','E','F','G','H']
for k in range(h):
    a=list(input().split())
    for l in range(w):
        if a[l]=='snuke':
            print(b[l]+str(k+1))

### FIXED CODE ###

h,w=map(int,input().split())
b=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
for k in range(h):
    a=list(input().split())
    for l in range(w):
        if a[l]=='snuke':
            print(b[l]+str(k+1))
a,b,c=map(int,input().split)
print("YES")if b-a==c-b else print("YES")

### FIXED CODE ###

a,b,c=map(int,input().split())
print("YES") if b-a==c-b else print("NO")