Buggy python submission (verdict: Runtime Error):
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
X,Y,A,B,C = map(int,readline().split())
P = list(map(int,readline().split()))
Q = list(map(int,readline().split()))
R = list(map(int,readline().split()))
P = sorted(P,reverse=True)
Q = sorted(Q,reverse=True)
R = sorted(R,reverse=True)
P = P[:X]
Q = Q[:Y]
PQ = sorted(P+Q,reverse = True)
XY = X+Y
total = sum(PQ)
for i in range(C):
    if R[i] < PQ[-(i+1)]:
      if i == 0:
        ans = total
      else:
        ans = total + sum(R[:i]) - sum(PQ[-i:])
      break
    if i == C-1:
      ans = total + sum(R[:i+1]) - sum(PQ[-(i+1):])
print(ans)

Fixed submission:
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
X,Y,A,B,C = map(int,readline().split())
P = list(map(int,readline().split()))
Q = list(map(int,readline().split()))
R = list(map(int,readline().split()))
P = sorted(P,reverse=True)
Q = sorted(Q,reverse=True)
R = sorted(R,reverse=True)
P = P[:X]
Q = Q[:Y]
PQR = sorted(P+Q+R,reverse = True)
ans = sum(PQR[:X+Y])
print(ans)

Buggy python submission (verdict: Runtime Error):
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
X,Y,A,B,C = map(int,readline().split())
P = list(map(int,readline().split()))
Q = list(map(int,readline().split()))
R = list(map(int,readline().split()))
P = sorted(P,reverse=True)
Q = sorted(Q,reverse=True)
R = sorted(R,reverse=True)
P = P[:X]
Q = Q[:Y]
PQ = sorted(P+Q,reverse = True)
XY = X+Y
total = sum(PQ)
for i in range(C):
    if R[i] < PQ[-(i+1)]:
      if i ==0:
        ans = total
      else:
        ans = total + sum(R[:i]) - sum(PQ[-i:])
      break
    if i == max(C-1,XY-1):
      ans = total + sum(R[:i+1]) - sum(PQ[-(i+1):])
print(ans)

Fixed submission:
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
X,Y,A,B,C = map(int,readline().split())
P = list(map(int,readline().split()))
Q = list(map(int,readline().split()))
R = list(map(int,readline().split()))
P = sorted(P,reverse=True)
Q = sorted(Q,reverse=True)
R = sorted(R,reverse=True)
P = P[:X]
Q = Q[:Y]
PQR = sorted(P+Q+R,reverse = True)
ans = sum(PQR[:X+Y])
print(ans)

Buggy python submission (verdict: Runtime Error):
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
X,Y,A,B,C = map(int,readline().split())
P = list(map(int,readline().split()))
Q = list(map(int,readline().split()))
R = list(map(int,readline().split()))
P = sorted(P,reverse=True)
Q = sorted(Q,reverse=True)
R = sorted(R,reverse=True)
P = P[:X]
Q = Q[:Y]
PQ = sorted(P+Q,reverse = True)
total = sum(PQ)
for i in range(C):
    if R[i] < PQ[-(i+1)]:
      if i ==0:
        ans = total
      else:
        ans = total + sum(R[:i]) - sum(PQ[-i:])
      break
    if i == C-1:
      ans = total + sum(R[:i+1]) - sum(PQ[-(i+1):])
print(ans)

Fixed submission:
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
X,Y,A,B,C = map(int,readline().split())
P = list(map(int,readline().split()))
Q = list(map(int,readline().split()))
R = list(map(int,readline().split()))
P = sorted(P,reverse=True)
Q = sorted(Q,reverse=True)
R = sorted(R,reverse=True)
P = P[:X]
Q = Q[:Y]
PQR = sorted(P+Q+R,reverse = True)
ans = sum(PQR[:X+Y])
print(ans)