Buggy python submission (verdict: Runtime Error):
import sys
#input = sys.stdin.readline
#sys.setrecursionlimit(10**6)

def main():
    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)

    p = p[:x]
    q = q[:y]
    p.sort()
    q.sort()
    cnt = 0
    for er in r:
        if p[cnt] > er and q[cnt] >er:
            cnt += 1
        elif p[cnt] < q[cnt]:
            if p[cnt] < er:
                p[cnt] = er
        else:
            if q[cnt] < er:
                q[cnt] = er



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


if __name__ == '__main__':
    main()


Fixed submission:
import sys
#input = sys.stdin.readline
#sys.setrecursionlimit(10**6)

def main():
    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)

    p = p[:x]
    q = q[:y]

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



    print(sum(all))


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
import sys
#input = sys.stdin.readline
#sys.setrecursionlimit(10**6)

def main():
    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)

    p = p[:x]
    q = q[:y]
    p.sort()
    q.sort()
    for ir in range(c):
        if ir <= x  and ir <= y:
            if p[ir] < q[ir]:
                if p[ir] < r[ir]:
                    p[ir] = r[ir]
            else:
                if q[ir] < r[ir]:
                    q[ir] = r[ir]
        elif ir <= x:
            if p[ir] < r[ir]:
                p[ir] = r[ir]
        elif ir <= y:
            if q[ir] < r[ir]:
                q[ir] = r[ir]

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


if __name__ == '__main__':
    main()


Fixed submission:
import sys
#input = sys.stdin.readline
#sys.setrecursionlimit(10**6)

def main():
    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)

    p = p[:x]
    q = q[:y]

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



    print(sum(all))


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
import sys
#input = sys.stdin.readline
#sys.setrecursionlimit(10**6)

def main():
    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)

    p = p[:x]
    q = q[:y]
    p.sort()
    q.sort()
    for ir in range(c):
        if p[ir] < q[ir]:
            if p[ir] < r[ir]:
                p[ir] = r[ir]
        else:
            if q[ir] < r[ir]:
                q[ir] = r[ir]

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


if __name__ == '__main__':
    main()


Fixed submission:
import sys
#input = sys.stdin.readline
#sys.setrecursionlimit(10**6)

def main():
    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)

    p = p[:x]
    q = q[:y]

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



    print(sum(all))


if __name__ == '__main__':
    main()