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()))

# step1: sort red/green apples in descending order
p.sort(reverse=True)
q.sort(reverse=True)

# step2:clip necessary apples
p = p[:x]
q = q[:y]

# step3: sort red/green apples in ascending order
p.sort()
q.sort()

# step4: sort non-color apples in descending order
r.sort(reverse=True)

# step5:swap apples to eliminate the least delicious apple
r_idx = g_idx = 0
for idx in range(c):

    if r_idx >= x or g_idx >= y:
        break

    if r[idx] < p[r_idx] and r[idx] < q[g_idx]:
        break

    if r[idx] > p[r_idx] and r[idx] > q[g_idx]:
        if p[r_idx] < q[g_idx]:
            p[r_idx], r[idx] = r[idx], p[r_idx]
            r_idx += 1
        else:
            q[g_idx], r[idx] = r[idx], q[g_idx]
            g_idx += 1

    if r[idx] > p[r_idx]:
        p[r_idx], r[idx] = r[idx], p[r_idx]
        r_idx += 1

    if r[idx] > q[g_idx]:
        q[g_idx], r[idx] = r[idx], q[g_idx]
        g_idx += 1

print(sum(p) + sum(q))


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()))

# step1: sort red/green apples in descending order
p.sort(reverse=True)
q.sort(reverse=True)

# step2:clip necessary apples
p = p[:x]
q = q[:y]

# step3: sort red/green apples in ascending order
p.sort()
q.sort()

# step4: sort non-color apples in descending order
r.sort(reverse=True)

# step5:swap apples to eliminate the least delicious apple
d = []

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

print(sum(d[: 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()))

# step1: sort red/green apples in descending order
p.sort(reverse=True)
q.sort(reverse=True)

# step2:clip necessary apples
p = p[:x]
q = q[:y]

# step3: sort red/green apples in ascending order
p.sort()
q.sort()

# step4: sort non-color apples in descending order
r.sort(reverse=True)

# step5:swap apples to eliminate the least delicious apple
r_idx = g_idx = 0
for idx in range(c):
    if r[idx] < p[r_idx] and r[idx] < q[g_idx]:
        break

    if r[idx] > p[r_idx] and r[idx] > q[g_idx]:
        if p[r_idx] < q[g_idx]:
            p[r_idx], r[idx] = r[idx], p[r_idx]
            r_idx += 1
        else:
            q[g_idx], r[idx] = r[idx], q[g_idx]
            g_idx += 1

    if r[idx] > p[r_idx]:
        p[r_idx], r[idx] = r[idx], p[r_idx]
        r_idx += 1

    if r[idx] > q[g_idx]:
        q[g_idx], r[idx] = r[idx], q[g_idx]
        g_idx += 1

print(sum(p) + sum(q))


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()))

# step1: sort red/green apples in descending order
p.sort(reverse=True)
q.sort(reverse=True)

# step2:clip necessary apples
p = p[:x]
q = q[:y]

# step3: sort red/green apples in ascending order
p.sort()
q.sort()

# step4: sort non-color apples in descending order
r.sort(reverse=True)

# step5:swap apples to eliminate the least delicious apple
d = []

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

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