Buggy python submission (verdict: Runtime Error):
x,y,a,b,c = map(int,input().split())

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

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

red = []
green = []

# for i in range(x):
#     red.append(p[i])
# for j in range(y):
#     green.append(q[j])

# print(p[:x])
# print(q[:y]
# print(red)
# print(green)

all = p[:x] + q[:y]
all.sort()

for i in range(len(all)):
    if min(r) > all[i]:
        #print(i)
        if i >= len(r):
            ans = all[len(r) + 1:] + r
        else:
            ans = all[i + 1:] + r[:i]
        break

# for mushoku in r:
#     for i in range(len(all)):
#         if mushoku > all[i]:
#             all[i] = mushoku


# print(sum(all))
print(sum(ans))

Fixed submission:
x,y,a,b,c = map(int,input().split())

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

p.sort(reverse=True)
q.sort(reverse=True)
r.sort()


all = p[:x] + q[:y] + r
all.sort(reverse=True)

print(sum(all[:x+y]))

Buggy python submission (verdict: Runtime Error):
x,y,a,b,c = map(int,input().split())

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

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

red = []
green = []

# for i in range(x):
#     red.append(p[i])
# for j in range(y):
#     green.append(q[j])

# print(p[:x])
# print(q[:y]
# print(red)
# print(green)

all = p[:x] + q[:y]
all.sort()

for i in range(len(all)):
    if min(r) > all[i]:
        #print(i)
    if i >= len(r):
        ans = all[len(r) + 1:] + r
    else:
        ans = all[i + 1:] + r[:i]
    break

# for mushoku in r:
#     for i in range(len(all)):
#         if mushoku > all[i]:
#             all[i] = mushoku


# print(sum(all))
print(sum(ans))

Fixed submission:
x,y,a,b,c = map(int,input().split())

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

p.sort(reverse=True)
q.sort(reverse=True)
r.sort()


all = p[:x] + q[:y] + r
all.sort(reverse=True)

print(sum(all[:x+y]))

Buggy python submission (verdict: Time Limit Exceeded):
x,y,a,b,c = map(int,input().split())

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

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

red = []
green = []

# for i in range(x):
#     red.append(p[i])
# for j in range(y):
#     green.append(q[j])

# print(p[:x])
# print(q[:y]
# print(red)
# print(green)

all = p[:x] + q[:y]
all.sort()

# for i in range(len(all)):
#     if min(r) > all[i]:
#         print(i)
#         break
# if i >= len(r):
#     ans = all[len(r) + 1:] + r
# else:
#     ans = all[i + 1:] + r[:i]

for mushoku in r:
    for i in range(len(all)):
        if mushoku > all[i]:
            all[i] = mushoku


print(sum(all))

Fixed submission:
x,y,a,b,c = map(int,input().split())

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

p.sort(reverse=True)
q.sort(reverse=True)
r.sort()


all = p[:x] + q[:y] + r
all.sort(reverse=True)

print(sum(all[:x+y]))

Buggy python submission (verdict: Time Limit Exceeded):
x,y,a,b,c = map(int,input().split())

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

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

red = []
green = []

for i in range(x):
    red.append(p[i])
for j in range(y):
    green.append(q[j])

# print(red)
# print(green)

all = red + green
all.sort()
for mushoku in r:
    for i in range(len(all)):
        if mushoku > all[i]:
            all[i] = mushoku
print(sum(all))


Fixed submission:
x,y,a,b,c = map(int,input().split())

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

p.sort(reverse=True)
q.sort(reverse=True)
r.sort()


all = p[:x] + q[:y] + r
all.sort(reverse=True)

print(sum(all[:x+y]))