Buggy python submission (verdict: Time Limit Exceeded):
import heapq
#Aの中でa番目、Bの中でb番目、Cの中でc番目のものがabc > Kの時、大きい順のK番目以内にabcの組が入ることはない
X, Y, Z, K = 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)

h = []
check = [[[0] * Z for _ in range(Y)] for _ in range(X)]
heapq.heappush(h, [-(A[0]+B[0]+C[0]), 0, 0, 0])
check[0][0][0] = 1
for count in range(K):
    ans = heapq.heappop(h)
    i, j , k = ans[1], ans[2], ans[3]
    print (-ans[0])
    if i + 1 < X:
        if check[i+1][j][k] == 0:
            heapq.heappush(h, [-(A[i+1]+B[j]+C[k]), i+1, j, k])
            check[i+1][j][k] = 1
    if j + 1 < Y:
        if check[i][j+1][k] == 0:
            heapq.heappush(h, [-(A[i]+B[j+1]+C[k]), i, j+1, k])
            check[i][j+1][k] = 1
    if k + 1 < Z:
        if check[i][j][k+1] == 0:
            heapq.heappush(h, [-(A[i]+B[j]+C[k+1]), i, j, k+1])
            check[i][j][k+1] = 1
    

Fixed submission:
#単純な全探索-->TLE-->Cの配列を扱うときに工夫
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

lst = []
for i in A:
    for j in B:
        lst += [i + j]

lst.sort(reverse = True)
C.sort(reverse = True)

ans = []
for i in range(min(K, len(lst))):
    for j in range(min(K, len(C))):
        ans += [lst[i]+C[j]]

ans.sort(reverse = True)
for i in range(K):
    print (ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
import heapq
#Aの中でa番目、Bの中でb番目、Cの中でc番目のものがabc > Kの時、大きい順のK番目以内にabcの組が入ることはない
X, Y, Z, K = 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)

h = []
check = [[[0] * Z for _ in range(Y)] for _ in range(X)]
heapq.heappush(h, [-(A[0]+B[0]+C[0]), 0, 0, 0])
check[0][0][0] = 1
for count in range(K):
    ans = heapq.heappop(h)
    i, j , k = ans[1], ans[2], ans[3]
    print (-ans[0])
    if i + 1 < X:
        if check[i+1][j][k] == 0:
            heapq.heappush(h, [-(A[i+1]+B[j]+C[k]), i+1, j, k])
            check[i+1][j][k] = 1
    if j + 1 < Y:
        if check[i][j+1][k] == 0:
            heapq.heappush(h, [-(A[i]+B[j+1]+C[k]), i, j+1, k])
            check[i][j+1][k] = 1
    if k + 1 < Z:
        if check[i][j][k+1] == 0:
            heapq.heappush(h, [-(A[i]+B[j]+C[k+1]), i, j, k+1])
            check[i][j][k+1] = 1
    

Fixed submission:
#単純な全探索-->TLE-->Cの配列を扱うときに工夫
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

lst = []
for i in A:
    for j in B:
        lst += [i + j]

lst.sort(reverse = True)
C.sort(reverse = True)

ans = []
for i in range(min(K, len(lst))):
    for j in range(min(K, len(C))):
        ans += [lst[i]+C[j]]

ans.sort(reverse = True)
for i in range(K):
    print (ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
#Aの中でa番目、Bの中でb番目、Cの中でc番目のものがabc > Kの時、大きい順のK番目以内にabcの組が入ることはない
X, Y, Z, K = 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)

lst = []
for i in range(X):
    for j in range(Y):
        for k in range(Z):
            if (i+1) * (j+1) * (k+1) <= K:
                lst += [A[i]+B[j]+C[k]]
lst.sort(reverse = True)
for l in range(K):
    print (lst[l])
    
    


Fixed submission:
#単純な全探索-->TLE-->Cの配列を扱うときに工夫
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

lst = []
for i in A:
    for j in B:
        lst += [i + j]

lst.sort(reverse = True)
C.sort(reverse = True)

ans = []
for i in range(min(K, len(lst))):
    for j in range(min(K, len(C))):
        ans += [lst[i]+C[j]]

ans.sort(reverse = True)
for i in range(K):
    print (ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
X, Y, Z, K = 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)

lst = []
for i in range(X):
    for j in range(Y):
        for k in range(Z):
            if (i+1) * (j+1) * (k+1) <= K:
                lst += [A[i]+B[j]+C[k]]
lst.sort(reverse = True)
for l in range(K):
    print (lst[l])
    
    


Fixed submission:
#単純な全探索-->TLE-->Cの配列を扱うときに工夫
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

lst = []
for i in A:
    for j in B:
        lst += [i + j]

lst.sort(reverse = True)
C.sort(reverse = True)

ans = []
for i in range(min(K, len(lst))):
    for j in range(min(K, len(C))):
        ans += [lst[i]+C[j]]

ans.sort(reverse = True)
for i in range(K):
    print (ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
#単純な全探索-->TLE-->Cの配列を扱うときに工夫
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

lst = []
for i in A:
    for j in B:
        lst += [i + j]

lst.sort(reverse = True)
C.sort(reverse = True)

ans = []
for i in range(min(K, len(lst))):
    for j in range(min(K, len(C))):
        ans += [lst[i]+C[j]]

ans.sort(reverse = True)
for i in range(K):
    print (ans[i])


Fixed submission:
#単純な全探索-->TLE-->Cの配列を扱うときに工夫
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

lst = []
for i in A:
    for j in B:
        lst += [i + j]

lst.sort(reverse = True)
C.sort(reverse = True)

ans = []
for i in range(min(K, len(lst))):
    for j in range(min(K, len(C))):
        ans += [lst[i]+C[j]]

ans.sort(reverse = True)
for i in range(K):
    print (ans[i])

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

lst = []
for i in A:
    for j in B:
        for k in C:
            lst += [(i + j + k)]

lst.sort(reverse = True)

count = 1
while count <= K:
    print (lst[count-1])
    count += 1 

Fixed submission:
#単純な全探索-->TLE-->Cの配列を扱うときに工夫
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

lst = []
for i in A:
    for j in B:
        lst += [i + j]

lst.sort(reverse = True)
C.sort(reverse = True)

ans = []
for i in range(min(K, len(lst))):
    for j in range(min(K, len(C))):
        ans += [lst[i]+C[j]]

ans.sort(reverse = True)
for i in range(K):
    print (ans[i])