Buggy python submission (verdict: Time Limit Exceeded):
import sys
input=sys.stdin.readline
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()))

l1=sorted([i+j for i in a for j in b],reverse=True)[:k]
l2=sorted([i+j for i in l1 for j in c],reverse=True)[:k]
for i in l2:
  print(i)


Fixed submission:
import sys
input=sys.stdin.readline
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)
l1=sorted([i+j for i in a for j in b],reverse=True)[:k]
l2=sorted([i+j for i in l1 for j in c],reverse=True)[:k]
for i in l2:
  print(i)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input=sys.stdin.readline
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()))

l1=sorted([i+j for i in a for j in b],reverse=True)[:k]
l2=[i+j for i in l1 for j in c]
l2.sort(reverse=True)
for i in l2[:k]:
  print(i)


Fixed submission:
import sys
input=sys.stdin.readline
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)
l1=sorted([i+j for i in a for j in b],reverse=True)[:k]
l2=sorted([i+j for i in l1 for j in c],reverse=True)[:k]
for i in l2:
  print(i)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input=sys.stdin.readline
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()))
l1=[]
#print(a,end=" a\n")
#print(b,end=" b\n")

l1=list([i+j for i in a for j in b])
l1.sort(reverse=True)
#for i in a:
#  for j in b:
#    # print(i,j)
#    l1.append(i+j)
#l1.sort(reverse=True)
#print(l1)
l1=l1[:min(len(l1),k)]
l2=list([i+j for i in l1 for j in c])
#l2=[]
#for i in l1:
#  for j in c:
#    l2.append(i+j)
l2.sort(reverse=True)
#print(l2)
#print("\n".join(map(str,l2[:k])))
for i in l2[:k]:
  print(i)


Fixed submission:
import sys
input=sys.stdin.readline
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)
l1=sorted([i+j for i in a for j in b],reverse=True)[:k]
l2=sorted([i+j for i in l1 for j in c],reverse=True)[:k]
for i in l2:
  print(i)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input=sys.stdin.readline
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()))
l1=[]
#print(a,end=" a\n")
#print(b,end=" b\n")

l1=list([i+j for i in a for j in b])
l1.sort(reverse=True)
#for i in a:
#  for j in b:
#    # print(i,j)
#    l1.append(i+j)
#l1.sort(reverse=True)
#print(l1)
l1=l1[:min(len(l1),k)]
l2=list([i+j for i in l1 for j in c])
#l2=[]
#for i in l1:
#  for j in c:
#    l2.append(i+j)
l2.sort(reverse=True)
#print(l2)
print("\n".join(map(str,l2[:k])))


Fixed submission:
import sys
input=sys.stdin.readline
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)
l1=sorted([i+j for i in a for j in b],reverse=True)[:k]
l2=sorted([i+j for i in l1 for j in c],reverse=True)[:k]
for i in l2:
  print(i)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input=sys.stdin.readline
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()))
l1=[]
#print(a,end=" a\n")
#print(b,end=" b\n")
for i in a:
  for j in b:
    # print(i,j)
    l1.append(i+j)
l1.sort(reverse=True)
#print(l1)
l1=l1[:min(len(l1),k)]
l2=[]
for i in l1:
  for j in c:
    l2.append(i+j)
l2.sort(reverse=True)
#print(l2)
print("\n".join(map(str,l2[:k])))


Fixed submission:
import sys
input=sys.stdin.readline
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)
l1=sorted([i+j for i in a for j in b],reverse=True)[:k]
l2=sorted([i+j for i in l1 for j in c],reverse=True)[:k]
for i in l2:
  print(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()))
l1=[]
#print(a,end=" a\n")
#print(b,end=" b\n")
for i in a:
  for j in b:
    # print(i,j)
    l1.append(i+j)
l1.sort(reverse=True)
#print(l1)
l1=l1[:min(len(l1),k)]
l2=[]
for i in l1:
  for j in c:
    l2.append(i+j)
l2.sort(reverse=True)
#print(l2)
print("\n".join(map(str,l2[:k])))


Fixed submission:
import sys
input=sys.stdin.readline
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)
l1=sorted([i+j for i in a for j in b],reverse=True)[:k]
l2=sorted([i+j for i in l1 for j in c],reverse=True)[:k]
for i in l2:
  print(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()))
l1=[]
#print(a,end=" a\n")
#print(b,end=" b\n")
for i in a:
  for j in b:
    # print(i,j)
    l1.append(i+j)
l1.sort(reverse=True)
#print(l1)
l1=l1[:min(len(l1),3000)]
l2=[]
for i in l1:
  for j in c:
    l2.append(i+j)
l2.sort(reverse=True)
#print(l2)
print("\n".join(map(str,l2[:k])))


Fixed submission:
import sys
input=sys.stdin.readline
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)
l1=sorted([i+j for i in a for j in b],reverse=True)[:k]
l2=sorted([i+j for i in l1 for j in c],reverse=True)[:k]
for i in l2:
  print(i)