Buggy python submission (verdict: Runtime Error):
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)
ab =[]
abc = []
for i in a:
    for j in b:
        ab.append(i+j)
ab.sort(reverse = True)
m = min(K, X*Y)
ab = ab[:m]
for i in ab:
    for j in c:
        abc.append(i +j)
abc.sort(reverse = True)
for i in range(k):
    print(abc[i])

Fixed submission:
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)
abc = []
for i in range(x):
    if (i+1) > k:
        break
    for j in range(y):
        if (i+1)*(j+1) > k:
            break
        for h in range(z):
            if (i+1)*(j+1)*(h+1) >k:
                break
            abc.append(a[i] +b[j] +c[h])
abc.sort(reverse = True)
for i in range(k):
    print(abc[i])

Buggy python submission (verdict: Runtime Error):
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)
ab =[]
abc = []
for i in a:
    for j in b:
        ab.append(i+j)
ab.sort(reverse = True)
m = min(K, X*Y)
ab = ab[:m]
for i in ab:
    for j in c:
        abc.append(i +j)
abc.sort(reverse = True)
for i in range(k):
    print(abc[i])

Fixed submission:
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)
abc = []
for i in range(x):
    if (i+1) > k:
        break
    for j in range(y):
        if (i+1)*(j+1) > k:
            break
        for h in range(z):
            if (i+1)*(j+1)*(h+1) >k:
                break
            abc.append(a[i] +b[j] +c[h])
abc.sort(reverse = True)
for i in range(k):
    print(abc[i])

Buggy python submission (verdict: Runtime Error):
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)
ab =[]
abc = []
for i in a:
    for j in b:
        ab.append(i+j)
ab.sort(reverse = True)
m = min(K, X*Y)
ab = ab[:m]
for i in ab:
    for j in c:
        abc.append(i +j)
abc.sort(reverse = True)
for i in range(c):
    print(abc[i])

Fixed submission:
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)
abc = []
for i in range(x):
    if (i+1) > k:
        break
    for j in range(y):
        if (i+1)*(j+1) > k:
            break
        for h in range(z):
            if (i+1)*(j+1)*(h+1) >k:
                break
            abc.append(a[i] +b[j] +c[h])
abc.sort(reverse = True)
for i in range(k):
    print(abc[i])

Buggy python submission (verdict: Runtime Error):
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)
ab =[]
abc = []
for i in a:
    for j in b:
        ab.append(i+j)
ab.sort(reverse = True)
m = min(K, X*Y)
ab = ab[:m+1]
for i in ab:
    for j in c:
        abc.append(i +j)
abc.sort(reverse = True)
for i in abc:
    print(i)

Fixed submission:
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)
abc = []
for i in range(x):
    if (i+1) > k:
        break
    for j in range(y):
        if (i+1)*(j+1) > k:
            break
        for h in range(z):
            if (i+1)*(j+1)*(h+1) >k:
                break
            abc.append(a[i] +b[j] +c[h])
abc.sort(reverse = True)
for i in range(k):
    print(abc[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)
AB =[]
ABC = []
for i in range(X):
    for j in range(Y):
        ab = A[i] + B[j]
        AB.append(ab)
AB.sort(reverse = True)
m = min(K, X*Y)
for i in range(m):
    for j in range(Z):
        abc = AB[i] + C[j]
        ABC.append(abc)
ABC.sort(reverse = True)
for i in range(K):
    print(ABC[i])

Fixed submission:
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)
abc = []
for i in range(x):
    if (i+1) > k:
        break
    for j in range(y):
        if (i+1)*(j+1) > k:
            break
        for h in range(z):
            if (i+1)*(j+1)*(h+1) >k:
                break
            abc.append(a[i] +b[j] +c[h])
abc.sort(reverse = True)
for i in range(k):
    print(abc[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)
AB =[]
ABC = []
for i in range(X):
    for j in range(Y):
        ab = A[i] + B[j]
        AB.append(ab)
AB.sort(reverse = True)
for i in range(min(K, X*Y)):
    for j in range(Z):
        abc = AB[i] + C[j]
        ABC.append(abc)
ABC.sort(reverse = True)
for i in range(K):
    print(ABC[i])

Fixed submission:
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)
abc = []
for i in range(x):
    if (i+1) > k:
        break
    for j in range(y):
        if (i+1)*(j+1) > k:
            break
        for h in range(z):
            if (i+1)*(j+1)*(h+1) >k:
                break
            abc.append(a[i] +b[j] +c[h])
abc.sort(reverse = True)
for i in range(k):
    print(abc[i])