Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
x,y,z,K=map(int,input().split())
listsa=list(map(int,input().split()))#長さはｘ
listsb=list(map(int,input().split()))#長さはy
listsc=list(map(int,input().split()))#長さはz
if x*y>3000:
    suballlist=[]
    for i in listsa:
        for j in listsb:
            suballlist.append(i+j)
    suballlist=sorted(suballlist,reverse=True)
    uselist=suballlist[:3000]
    alllist=[]
    
    for i in uselist:
        for j in listsc:
            alllist.append(i+j)
            
    alllist=sorted(alllist,reverse=True)
    for i in range(K):
        print(alllist[i])
    
elif x*y<=3000:
    alllist=[]
    for i in listsa:
        for j in listsb:
            for k in listsc:
                alllist.append(i+j+k)
                
    alllist=sorted(alllist,reverse=True)
    for i in range(K):
        print(alllist[i])


Fixed submission:
import sys
input = sys.stdin.readline
x,y,z,K=map(int,input().split())
listsa=list(map(int,input().split()))#長さはｘ
listsb=list(map(int,input().split()))#長さはy
listsc=list(map(int,input().split()))#長さはz
if x*y>3000:
    suballlist=[]
    for i in listsa:
        for j in listsb:
            suballlist.append(i+j)
    suballlist=sorted(suballlist,reverse=True)
    uselist=suballlist[:3000]
    alllist=[]
    
    for i in uselist:
        for j in listsc:
            alllist.append(i+j)
            
    alllist=sorted(alllist,reverse=True)
    for i in range(K):
        print(alllist[i])
    
elif x*y<=3000:
    alllist=[]
    for i in listsa:
        for j in listsb:
            for k in listsc:
                alllist.append(i+j+k)
                
    alllist=sorted(alllist,reverse=True)
    for i in range(K):
        print(alllist[i])

Buggy python submission (verdict: Time Limit Exceeded):
x,y,z,K=map(int,input().split())
listsa=list(map(int,input().split()))#長さはｘ
listsb=list(map(int,input().split()))#長さはy
listsc=list(map(int,input().split()))#長さはz
if x*y>3000:
    suballlist=[]
    for i in listsa:
        for j in listsb:
            suballlist.append(i+j)
    suballlist=sorted(suballlist,reverse=True)
    uselist=suballlist[:3000]
    alllist=[]
    for i in uselist:
        for j in listsc:
            alllist.append(i+j)
    alllist=sorted(alllist,reverse=True)
    for i in range(K):
        print(alllist[i])
    
elif x*y<=3000:
    alllist=[]
    for i in listsa:
        for j in listsb:
            for k in listsc:
                alllist.append(i+j+k)
                
    alllist=sorted(alllist,reverse=True)
    for i in range(K):
        print(alllist[i])

Fixed submission:
import sys
input = sys.stdin.readline
x,y,z,K=map(int,input().split())
listsa=list(map(int,input().split()))#長さはｘ
listsb=list(map(int,input().split()))#長さはy
listsc=list(map(int,input().split()))#長さはz
if x*y>3000:
    suballlist=[]
    for i in listsa:
        for j in listsb:
            suballlist.append(i+j)
    suballlist=sorted(suballlist,reverse=True)
    uselist=suballlist[:3000]
    alllist=[]
    
    for i in uselist:
        for j in listsc:
            alllist.append(i+j)
            
    alllist=sorted(alllist,reverse=True)
    for i in range(K):
        print(alllist[i])
    
elif x*y<=3000:
    alllist=[]
    for i in listsa:
        for j in listsb:
            for k in listsc:
                alllist.append(i+j+k)
                
    alllist=sorted(alllist,reverse=True)
    for i in range(K):
        print(alllist[i])

Buggy python submission (verdict: Runtime Error):
x,y,z,K=map(int,input().split())
listsa=list(map(int,input().split()))#長さはｘ
listsb=list(map(int,input().split()))#長さはy
listsc=list(map(int,input().split()))#長さはz
if x*y>3000:
    suballlist=[]
    for i in lista:
        for j in listsb:
            suballlist.append(i+j)
    suballlist=sorted(suballlist,reverse=True)
    uselist=suballlist[:3000]
    alllist=[]
    for i in uselist:
        for j in listsc:
            alllist.append(i+j)
    alllist=sorted(alllist,reverse=True)
    for i in range(K):
        print(alllist[i])
    
elif x*y<=3000:
    alllist=[]
    for i in listsa:
        for j in listsb:
            for k in listsc:
                alllist.append(i+j+k)
                
    alllist=sorted(alllist,reverse=True)
    for i in range(K):
        print(alllist[i])

Fixed submission:
import sys
input = sys.stdin.readline
x,y,z,K=map(int,input().split())
listsa=list(map(int,input().split()))#長さはｘ
listsb=list(map(int,input().split()))#長さはy
listsc=list(map(int,input().split()))#長さはz
if x*y>3000:
    suballlist=[]
    for i in listsa:
        for j in listsb:
            suballlist.append(i+j)
    suballlist=sorted(suballlist,reverse=True)
    uselist=suballlist[:3000]
    alllist=[]
    
    for i in uselist:
        for j in listsc:
            alllist.append(i+j)
            
    alllist=sorted(alllist,reverse=True)
    for i in range(K):
        print(alllist[i])
    
elif x*y<=3000:
    alllist=[]
    for i in listsa:
        for j in listsb:
            for k in listsc:
                alllist.append(i+j+k)
                
    alllist=sorted(alllist,reverse=True)
    for i in range(K):
        print(alllist[i])