Buggy python submission (verdict: Runtime Error):
import heapq
n = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

a=0
m=0
s=0
ans = 0
A = heapq.nlargest(n[0] , A)
B = heapq.nlargest(n[1] , B)
if len(C)==1:
    C = C
else:
    C = heapq.nlargest(n[0]+n[1] , C)
for i in range(0,n[0]+n[1]):
    if a==n[0] and m<n[1]:
        saidai = max([ B[m],C[s] ])

        if C[s] >= B[m]:
            s +=1
        else:
            m +=1
    elif a<n[0] and m == n[1]:
        saidai = max([ A[a],C[s] ])

        if C[s] >= A[a]:
            s +=1
        else:
            a +=1

    else:
        saidai=max([ A[a],B[m],C[s] ])

        if A[a] >= B[m] and A[a] > C[s]:
            a +=1
        elif A[a] < B[m] and B[m] > C[s]:
            m +=1
        elif C[s] >= B[m] and A[a] <= C[s]:
            s +=1
    
    ans = ans + saidai

print(ans)

Fixed submission:
import heapq
n = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

a=0
m=0
s=0
ans = 0
A = heapq.nlargest(n[0] , A)
B = heapq.nlargest(n[1] , B)
len = len(C)
if len <(n[0]+n[1]):
    C = heapq.nlargest(len,C)
else:
    C = heapq.nlargest(n[0]+n[1] , C)
for i in range(n[0]+n[1]):
    if s == len:
        if a==n[0] and m<n[1]:
            saidai = B[m]
            m +=1
        else:
            saidai = max([ A[a],B[m] ])
            if A[a] >=B[m]:
                a +=1
            else:
                m +=1

    else:
        if a==n[0] and m<n[1]:
            saidai = max([ B[m],C[s] ])

            if C[s] >= B[m]:
                s +=1
            else:
                m +=1
        elif a<n[0] and m == n[1]:
            saidai = max([ A[a],C[s] ])

            if C[s] >= A[a]:
                s +=1
            else:
                a +=1

        else:
            saidai=max([ A[a],B[m],C[s] ])

            if A[a] >= B[m] and A[a] > C[s]:
                a +=1
            elif A[a] < B[m] and B[m] > C[s]:
                m +=1
            elif C[s] >= B[m] and A[a] <= C[s]:
                s +=1
    
    ans = ans + saidai

print(ans)

Buggy python submission (verdict: Runtime Error):
import heapq
n = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

a=0
m=0
s=0
ans = 0
A = heapq.nlargest(n[0]+1 , A)
B = heapq.nlargest(n[1]+1 , B)
if len(C)==1:
    C = C
else:
    C = heapq.nlargest(n[0]+n[1]+1 , C)
for i in range(0,n[0]+n[1]):
    if a==n[0] and m<n[1]:
        saidai = max([ B[m],C[s] ])

        if C[s] >= B[m]:
            s +=1
        else:
            m +=1
    elif a<n[0] and m == n[1]:
        saidai = max([ A[a],C[s] ])

        if C[s] >= A[a]:
            s +=1
        else:
            a +=1

    else:
        saidai=max([ A[a],B[m],C[s] ])

        if A[a] >= B[m] and A[a] > C[s]:
            a +=1
        elif A[a] < B[m] and B[m] > C[s]:
            m +=1
        elif C[s] >= B[m] and A[a] <= C[s]:
            s +=1
    
    ans = ans + saidai

print(ans)

Fixed submission:
import heapq
n = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

a=0
m=0
s=0
ans = 0
A = heapq.nlargest(n[0] , A)
B = heapq.nlargest(n[1] , B)
len = len(C)
if len <(n[0]+n[1]):
    C = heapq.nlargest(len,C)
else:
    C = heapq.nlargest(n[0]+n[1] , C)
for i in range(n[0]+n[1]):
    if s == len:
        if a==n[0] and m<n[1]:
            saidai = B[m]
            m +=1
        else:
            saidai = max([ A[a],B[m] ])
            if A[a] >=B[m]:
                a +=1
            else:
                m +=1

    else:
        if a==n[0] and m<n[1]:
            saidai = max([ B[m],C[s] ])

            if C[s] >= B[m]:
                s +=1
            else:
                m +=1
        elif a<n[0] and m == n[1]:
            saidai = max([ A[a],C[s] ])

            if C[s] >= A[a]:
                s +=1
            else:
                a +=1

        else:
            saidai=max([ A[a],B[m],C[s] ])

            if A[a] >= B[m] and A[a] > C[s]:
                a +=1
            elif A[a] < B[m] and B[m] > C[s]:
                m +=1
            elif C[s] >= B[m] and A[a] <= C[s]:
                s +=1
    
    ans = ans + saidai

print(ans)

Buggy python submission (verdict: Runtime Error):
import heapq
n = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

a=0
m=0
s=0
ans = 0
A = heapq.nlargest(n[0]+1 , A)
B = heapq.nlargest(n[1]+1 , B)
C = heapq.nlargest(n[0]+n[1]+1 , C)
for i in range(0,n[0]+n[1]):
    if a==n[0] and m<n[1]:
        saidai = max([ B[m],C[s] ])

        if C[s] >= B[m]:
            s +=1
        else:
            m +=1
    elif a<n[0] and m == n[1]:
        saidai = max([ A[a],C[s] ])

        if C[s] >= A[a]:
            s +=1
        else:
            a +=1

    else:
        saidai=max([ A[a],B[m],C[s] ])

        if A[a] >= B[m] and A[a] > C[s]:
            a +=1
        elif A[a] < B[m] and B[m] > C[s]:
            m +=1
        elif C[s] >= B[m] and A[a] <= C[s]:
            s +=1
    
    ans = ans + saidai

print(ans)

Fixed submission:
import heapq
n = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

a=0
m=0
s=0
ans = 0
A = heapq.nlargest(n[0] , A)
B = heapq.nlargest(n[1] , B)
len = len(C)
if len <(n[0]+n[1]):
    C = heapq.nlargest(len,C)
else:
    C = heapq.nlargest(n[0]+n[1] , C)
for i in range(n[0]+n[1]):
    if s == len:
        if a==n[0] and m<n[1]:
            saidai = B[m]
            m +=1
        else:
            saidai = max([ A[a],B[m] ])
            if A[a] >=B[m]:
                a +=1
            else:
                m +=1

    else:
        if a==n[0] and m<n[1]:
            saidai = max([ B[m],C[s] ])

            if C[s] >= B[m]:
                s +=1
            else:
                m +=1
        elif a<n[0] and m == n[1]:
            saidai = max([ A[a],C[s] ])

            if C[s] >= A[a]:
                s +=1
            else:
                a +=1

        else:
            saidai=max([ A[a],B[m],C[s] ])

            if A[a] >= B[m] and A[a] > C[s]:
                a +=1
            elif A[a] < B[m] and B[m] > C[s]:
                m +=1
            elif C[s] >= B[m] and A[a] <= C[s]:
                s +=1
    
    ans = ans + saidai

print(ans)

Buggy python submission (verdict: Runtime Error):
import heapq
n = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

a=0
m=0
s=0
ans = 0
A = heapq.nlargest(n[0] , A)
B = heapq.nlargest(n[1] , B)
C = heapq.nlargest(n[0]+n[1] , C)
for i in range(0,n[0]+n[1]):
    if a==n[0] and m<n[1]:
        saidai = max([ B[m],C[s] ])

        if C[s] >= B[m]:
            s +=1
        else:
            m +=1
    elif a<n[0] and m == n[1]:
        saidai = max([ A[a],C[s] ])

        if C[s] >= A[a]:
            s +=1
        else:
            a +=1

    else:
        saidai=max([ A[a],B[m],C[s] ])

        if A[a] > B[m] and A[a] > C[s]:
            a +=1
        elif A[a] < B[m] and B[m] > C[s]:
            m +=1
        elif C[s] >= B[m] and A[a] <= C[s]:
            s +=1
    
    ans = ans + saidai

print(ans)

Fixed submission:
import heapq
n = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

a=0
m=0
s=0
ans = 0
A = heapq.nlargest(n[0] , A)
B = heapq.nlargest(n[1] , B)
len = len(C)
if len <(n[0]+n[1]):
    C = heapq.nlargest(len,C)
else:
    C = heapq.nlargest(n[0]+n[1] , C)
for i in range(n[0]+n[1]):
    if s == len:
        if a==n[0] and m<n[1]:
            saidai = B[m]
            m +=1
        else:
            saidai = max([ A[a],B[m] ])
            if A[a] >=B[m]:
                a +=1
            else:
                m +=1

    else:
        if a==n[0] and m<n[1]:
            saidai = max([ B[m],C[s] ])

            if C[s] >= B[m]:
                s +=1
            else:
                m +=1
        elif a<n[0] and m == n[1]:
            saidai = max([ A[a],C[s] ])

            if C[s] >= A[a]:
                s +=1
            else:
                a +=1

        else:
            saidai=max([ A[a],B[m],C[s] ])

            if A[a] >= B[m] and A[a] > C[s]:
                a +=1
            elif A[a] < B[m] and B[m] > C[s]:
                m +=1
            elif C[s] >= B[m] and A[a] <= C[s]:
                s +=1
    
    ans = ans + saidai

print(ans)