Buggy python submission (verdict: Time Limit Exceeded):
from bisect import insort

X, Y, Z, K = map(int, input().split())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
for i in range(Z-1, 0, -1) :
    C[i] -= C[i-1]

n = []
for x in range(X) :
    for y in range(Y) :
        n.append((A[x]+B[y]+C[0], 0))
n.sort()

for _ in range(K) :
    cur, z = n.pop()
    print(cur)
    if z < Z - 1 :
        z += 1
        insort(n, (cur+C[z], z))

Fixed submission:
X, Y, Z, K = map(int, input().split())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

s = []
for x in range(X) :
    for y in range(Y) :
        s.append(A[x]+B[y])
s.sort(reverse=True)

t = []
for k in range(min(K, len(s))) :
    for z in range(Z) :
        t.append(s[k]+C[z])
        
t.sort(reverse=True)

print("\n".join(map(str, t[:K])))

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import insort

X, Y, Z, K = map(int, input().split())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
for i in range(Z-1, 0, -1) :
    C[i] -= C[i-1]

n = []
for x in range(X) :
    for y in range(Y) :
        n.append((A[x]+B[y]+C[0], (x, y, 0)))
n.sort()

for _ in range(K) :
    cur, (x, y, z) = n.pop()
    print(cur)
    if z < Z - 1 :
        z += 1
        insort(n, (cur+C[z], (x, y, z)))

Fixed submission:
X, Y, Z, K = map(int, input().split())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

s = []
for x in range(X) :
    for y in range(Y) :
        s.append(A[x]+B[y])
s.sort(reverse=True)

t = []
for k in range(min(K, len(s))) :
    for z in range(Z) :
        t.append(s[k]+C[z])
        
t.sort(reverse=True)

print("\n".join(map(str, t[:K])))

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import insort

X, Y, Z, K = map(int, input().split())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

z = [[0] * Y for _ in range(X)]
n = []
for x in range(X) :
    for y in range(Y) :
        n.append((A[x]+B[y]+C[0], (x, y)))
n.sort()

for _ in range(K) :
    cur, (x, y) = n.pop()
    # print(cur, x, y)
    if z[x][y] < Z - 1 :
        z[x][y] += 1
        insort(n, (A[x]+B[y]+C[z[x][y]], (x, y)))
    print(cur)
    

Fixed submission:
X, Y, Z, K = map(int, input().split())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

s = []
for x in range(X) :
    for y in range(Y) :
        s.append(A[x]+B[y])
s.sort(reverse=True)

t = []
for k in range(min(K, len(s))) :
    for z in range(Z) :
        t.append(s[k]+C[z])
        
t.sort(reverse=True)

print("\n".join(map(str, t[:K])))