Buggy python submission (verdict: Runtime Error):
from collections import deque

x, y, a, b, c = map(int,input().split())
red = sorted(list(map(int,input().split())))[a-x:]
green = sorted(list(map(int,input().split())))[b-y:]
white = sorted(list(map(int,input().split())))
rcnt = 0
rflag = 0
gcnt = 0
gflag = 0
ans = 0
#print(red,green,white)


for i in range(x+y):
#    print(red,green,white)    
    if red[-1] == max(red[-1],green[-1],white[-1]):
#        print('hoge')
        rcnt += 1
        ans += red.pop(-1)
        if len(red) == 0:
            red = [0]
    elif green[-1] == max(red[-1],green[-1],white[-1]):
#        print('huga')
        gcnt += 1
        ans += green.pop(-1)
        if len(green) == 0:
            green = [0]
    else:
        if red[rflag] < green[gflag]:
            rcnt += 1
            rflag += 1
        else:
            gcnt += 1
            gflag += 1
#        print('foo')
        ans += white.pop(-1)
        if len(white) == 0:
            white = [0]
print(ans)

Fixed submission:
x, y, a, b, c = map(int,input().split())
red = sorted(list(map(int,input().split())),reverse=True)[:x]
green = sorted(list(map(int,input().split())),reverse=True)[:y]
white = sorted(list(map(int,input().split())),reverse=True)

l = sorted(red+green+white,reverse=True)[:x+y]
print(sum(l))

Buggy python submission (verdict: Time Limit Exceeded):
x, y, a, b, c = map(int,input().split())
red = sorted(list(map(int,input().split())))[a-x:]
green = sorted(list(map(int,input().split())))[b-y:]
white = sorted(list(map(int,input().split())))
rcnt = 0
gcnt = 0
ans = 0
#print(red,green,white)

for i in range(x+y):
#    print(red,green,white)    
    if red[-1] == max(red[-1],green[-1],white[-1]):
#        print('hoge')
        rcnt += 1
        ans += red.pop(-1)
        if len(red) == 0:
            red = [0]
    elif green[-1] == max(red[-1],green[-1],white[-1]):
#        print('huga')
        gcnt += 1
        ans += green.pop(-1)
        if len(green) == 0:
            green = [0]
    else:
        if red[0] < green[0]:
            rcnt += 1
            red.pop(0)
            if len(red) == 0:
                red = [0]
        else:
            gcnt += 1
            green.pop(0)
            if len(green) == 0:
                green = [0]
#        print('foo')
        ans += white.pop(-1)
        if len(white) == 0:
            white = [0]


print(ans)

Fixed submission:
x, y, a, b, c = map(int,input().split())
red = sorted(list(map(int,input().split())),reverse=True)[:x]
green = sorted(list(map(int,input().split())),reverse=True)[:y]
white = sorted(list(map(int,input().split())),reverse=True)

l = sorted(red+green+white,reverse=True)[:x+y]
print(sum(l))

Buggy python submission (verdict: Time Limit Exceeded):
x, y, a, b, c = map(int,input().split())
red = sorted(list(map(int,input().split())))[a-x:]
green = sorted(list(map(int,input().split())))[b-y:]
white = sorted(list(map(int,input().split())))
rcnt = 0
gcnt = 0
ans = 0
#print(red,green,white)

for i in range(x+y):
#    print(red,green,white)    
    if red[-1] == max(red[-1],green[-1],white[-1]):
#        print('hoge')
        rcnt += 1
        ans += red.pop(-1)
        if len(red) == 0:
            red = [0]
    elif green[-1] == max(red[-1],green[-1],white[-1]):
#        print('huga')
        gcnt += 1
        ans += green.pop(-1)
        if len(green) == 0:
            green = [0]
    else:
        if red[0] < green[0]:
            rcnt += 1
            red.pop(0)
            if len(red) == 0:
                red = [0]
        else:
            gcnt += 1
            green.pop(0)
            if len(green) == 0:
                green = [0]
#        print('foo')
        ans += white.pop(-1)
        if len(white) == 0:
            white = [0]


print(ans)

Fixed submission:
x, y, a, b, c = map(int,input().split())
red = sorted(list(map(int,input().split())),reverse=True)[:x]
green = sorted(list(map(int,input().split())),reverse=True)[:y]
white = sorted(list(map(int,input().split())),reverse=True)

l = sorted(red+green+white,reverse=True)[:x+y]
print(sum(l))