Buggy python submission (verdict: Time Limit Exceeded):

import numpy as np
X, Y, A, B, C = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

A = A[0:X]
B = B[0:Y]
#C = np.array(C)

arr = A+B

flag = 1

while(flag):
  tmp = 0
  _min = min(arr)
  _max = max(C)
  if _min <= _max:
    arr[arr.index(_min)] = _max
  else:
    flag = 0
"""
_min = min(arr)
C = C[C>_min]

for c in C:
  _min = min(arr)
  if c >= _min:
    arr[arr.index(_min)] = c


"""
print(sum(arr))

Fixed submission:
import numpy as np
X, Y, A, B, C = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

A = A[0:X]
B = B[0:Y]
D = A+B+C

D.sort(reverse=True)

D = D[0:X+Y]
print(sum(D))

Buggy python submission (verdict: Time Limit Exceeded):

import numpy as np
X, Y, A, B, C = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

A = A[0:X]
B = B[0:Y]
C = np.array(C)

arr = A+B
_min = min(arr)
C = C[C>_min]

for c in C:
  _min = min(arr)
  if c >= _min:
    arr[arr.index(_min)] = c

print(sum(arr))

Fixed submission:
import numpy as np
X, Y, A, B, C = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

A = A[0:X]
B = B[0:Y]
D = A+B+C

D.sort(reverse=True)

D = D[0:X+Y]
print(sum(D))

Buggy python submission (verdict: Time Limit Exceeded):

import numpy as np
X, Y, A, B, C = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

A = A[0:X]
B = B[0:Y]
C = np.array(C)

arr = A+B
_min = min(arr)
C = C[C>_min]

for c in C:
  _min = min(arr)
  if c >= _min:
    arr[arr.index(_min)] = c

print(sum(arr))

Fixed submission:
import numpy as np
X, Y, A, B, C = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

A = A[0:X]
B = B[0:Y]
D = A+B+C

D.sort(reverse=True)

D = D[0:X+Y]
print(sum(D))

Buggy python submission (verdict: Time Limit Exceeded):
X, Y, A, B, C = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

A = A[0:X]
B = B[0:Y]

arr = A+B

for c in C:
  _min = min(arr)
  if c >= _min:
    arr[arr.index(_min)] = c

print(sum(arr))

Fixed submission:
import numpy as np
X, Y, A, B, C = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

A = A[0:X]
B = B[0:Y]
D = A+B+C

D.sort(reverse=True)

D = D[0:X+Y]
print(sum(D))