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)
num = []
for a in A:
    for b in B:
        num.append(a+b)
num.sort(reverse = True)
num2 = []
for i in range(min(len(num),k)):
    for j in C:
        num2.append(num[i]+j)
num2.sort(reverse = True)
for i in range(k):
    print(num2[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)
num = []
for a in A:
    for b in B:
        num.append(a+b)
num.sort(reverse = True)
num2 = []
for i in range(min(len(num),k)):
    for j in C:
        num2.append(num[i]+j)
num2.sort(reverse = True)
for i in range(k):
    print(num2[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)
num = []
for a in A:
    for b in B:
        num.append(a+b)
num.sort(reverse = True)
num2 = []
for i in range(k):
    for j in C:
        num2.append(num[i]+j)
num2.sort(reverse = True)
for i in range(k):
    print(num2[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)
num = []
for a in A:
    for b in B:
        num.append(a+b)
num.sort(reverse = True)
num2 = []
for i in range(min(len(num),k)):
    for j in C:
        num2.append(num[i]+j)
num2.sort(reverse = True)
for i in range(k):
    print(num2[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)
if x*y*z < 1000000:
    ans = []
    for a in A:
        for b in B:
            for c in C:
                ans.append(a+b+c)
    ans.sort(reverse = True)
    for i in range(k):
        print(ans[i])
else:
    A.append(-1e20)
    B.append(-1e20)
    C.append(-1e20)
    cnt=0
    a = 0
    b = 0
    c = 0
    print(A[0]+B[0]+C[0])
    while(cnt<k-1):
        Adiv = A[0]-A[a+1]
        Bdiv = B[0]-B[b+1]
        Cdiv = C[0]-C[c+1]
        if(Adiv <= Bdiv and Adiv <= Cdiv):
            a+=1
            print(A[a]+B[0]+C[0])
        elif(Bdiv <= Adiv and Bdiv <= Cdiv):
            b+=1
            print(A[0]+B[b]+C[0])
        else:
            c+=1
            print(A[0]+B[0]+C[c])
        cnt+=1


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)
num = []
for a in A:
    for b in B:
        num.append(a+b)
num.sort(reverse = True)
num2 = []
for i in range(min(len(num),k)):
    for j in C:
        num2.append(num[i]+j)
num2.sort(reverse = True)
for i in range(k):
    print(num2[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)
if x*y*z < 1e6:
    ans = []
    for a in A:
        for b in B:
            for c in C:
                ans.append(a+b+c)
    ans.sort(reverse = True)
    for i in range(k):
        print(ans[i])
else:
    A.append(-1e20)
    B.append(-1e20)
    C.append(-1e20)
    cnt=0
    a = 0
    b = 0
    c = 0
    print(A[0]+B[0]+C[0])
    while(cnt<k-1):
        Adiv = A[0]-A[a+1]
        Bdiv = B[0]-B[b+1]
        Cdiv = C[0]-C[c+1]
        if(Adiv <= Bdiv and Adiv <= Cdiv):
            a+=1
            print(A[a]+B[0]+C[0])
        elif(Bdiv <= Adiv and Bdiv <= Cdiv):
            b+=1
            print(A[0]+B[b]+C[0])
        else:
            c+=1
            print(A[0]+B[0]+C[c])
        cnt+=1


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)
num = []
for a in A:
    for b in B:
        num.append(a+b)
num.sort(reverse = True)
num2 = []
for i in range(min(len(num),k)):
    for j in C:
        num2.append(num[i]+j)
num2.sort(reverse = True)
for i in range(k):
    print(num2[i])

Buggy python submission (verdict: Runtime Error):
x,y,z,k = map(int,input().split())
num = []
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)
if x*y*z < 1e6:
    ans = []
    for a in A:
        for b in B:
            for c in C:
                ans.append(a+b+c)
    ans.sort(reverse = True)
    for i in range(k):
        print(ans[i])
else:
    A.append(-1e20)
    B.append(-1e20)
    C.append(-1e20)
    cnt=0
    a,b,c = (0,0,0)
    print(A[0]+B[0]+C[0])
    while(cnt<k-1):
        Adiv = A[0]-A[a+1]
        Bdiv = B[0]-B[b+1]
        Cdiv = C[0]-C[c+1]
        if(Adiv <= Bdiv and Adiv <= Cdiv):
            a+=1
            print(A[a]+B[0]+C[0])
        elif(Bdiv <= Adiv and Bdiv <= Cdiv):
            b+=1
            print(A[0]+B[b]+C[0])
        else:
            c+=1
            print(A[0]+B[0]+C[c])
        cnt+=1


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)
num = []
for a in A:
    for b in B:
        num.append(a+b)
num.sort(reverse = True)
num2 = []
for i in range(min(len(num),k)):
    for j in C:
        num2.append(num[i]+j)
num2.sort(reverse = True)
for i in range(k):
    print(num2[i])

Buggy python submission (verdict: Runtime Error):
x,y,z,k = map(int,input().split())
num = []
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
for i in A:
    num.append((i,'A'))
for i in B:
    num.append((i,'B'))
for i in C:
    num.append((i,'C'))
num.sort(reverse = True)
A = []
B = []
C = []
po = 0
while(po < x*y*z and len(A)*len(B)*len(C) < 222222):
    if(num[po][1] == 'A'):
        A.append(num[po][0])
    elif (num[po][1] == 'B'):
        B.append(num[po][0])
    else:
        C.append(num[po][0])
    po+=1
ans = []
#print(A,B,C)
for a in A:
    for b in B:
        for c in C:
            ans.append(a+b+c)
ans.sort(reverse = True)
for i in range(k):
    print(ans[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)
num = []
for a in A:
    for b in B:
        num.append(a+b)
num.sort(reverse = True)
num2 = []
for i in range(min(len(num),k)):
    for j in C:
        num2.append(num[i]+j)
num2.sort(reverse = True)
for i in range(k):
    print(num2[i])

Buggy python submission (verdict: Runtime Error):
x,y,z,k = map(int,input().split())
num = []
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
for i in A:
    num.append((i,'A'))
for i in B:
    num.append((i,'B'))
for i in C:
    num.append((i,'C'))
num.sort(reverse = True)
A = []
B = []
C = []
po = 0
while(len(A)*len(B)*len(C) <= k):
    if(num[po][1] == 'A'):
        A.append(num[po][0])
    elif (num[po][1] == 'B'):
        B.append(num[po][0])
    else:
        C.append(num[po][0])
    po+=1
ans = []
for a in A:
    for b in B:
        for c in C:
            ans.append(a+b+c)
ans.sort(reverse = True)
for i in range(k):
    print(ans[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)
num = []
for a in A:
    for b in B:
        num.append(a+b)
num.sort(reverse = True)
num2 = []
for i in range(min(len(num),k)):
    for j in C:
        num2.append(num[i]+j)
num2.sort(reverse = True)
for i in range(k):
    print(num2[i])

Buggy python submission (verdict: Runtime Error):
n = int(input())
mi = 1e20
for i in range(5):
    mi = min(mi,int(input()))
print(n//mi + (n%mi!=0) + 4)

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)
num = []
for a in A:
    for b in B:
        num.append(a+b)
num.sort(reverse = True)
num2 = []
for i in range(min(len(num),k)):
    for j in C:
        num2.append(num[i]+j)
num2.sort(reverse = True)
for i in range(k):
    print(num2[i])