Buggy python submission (verdict: Time Limit Exceeded):
x,y,z,k = map(int,input().split())
lia = sorted(list(map(int,input().split())),reverse = True)
lib = sorted(list(map(int,input().split())),reverse = True)
lic = sorted(list(map(int,input().split())),reverse = True)
li = []

for s in range(x):
    for t in range(y):
        for u in range(z):
            if s*t*u <= k:
                li.append(lia[s]+lib[t]+lic[u])
ans = sorted(li,reverse = True)[:k]

print('\n'.join(map(str,ans)))


Fixed submission:
def main():
    x,y,z,k = map(int,input().split())
    lia = sorted(list(map(int,input().split())))
    lib = sorted(list(map(int,input().split())))
    lic = sorted(list(map(int,input().split())))

    li2 = sorted(list(a+b for a in lia for b in lib),reverse = True)[:k]
    li3 = sorted(list(ab + c for ab in li2 for c in lic),reverse = True)[:k]

    print('\n'.join(map(str,li3)))

main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    x,y,z,k = map(int,input().split())
    lia = sorted(list(map(int,input().split())))
    lib = sorted(list(map(int,input().split())))
    lic = sorted(list(map(int,input().split())))

    li2 = sorted(list(a+b for a in lia for b in lib),reverse = True)[:k]
    li3 = sorted(list(ab + c for ab in li2 for c in lic),reverse = True)

    for i in range(k):
        print(li3[i])

main()


Fixed submission:
def main():
    x,y,z,k = map(int,input().split())
    lia = sorted(list(map(int,input().split())))
    lib = sorted(list(map(int,input().split())))
    lic = sorted(list(map(int,input().split())))

    li2 = sorted(list(a+b for a in lia for b in lib),reverse = True)[:k]
    li3 = sorted(list(ab + c for ab in li2 for c in lic),reverse = True)[:k]

    print('\n'.join(map(str,li3)))

main()

Buggy python submission (verdict: Time Limit Exceeded):
x,y,z,k = map(int,input().split())
lia = sorted(list(map(int,input().split())))
lib = sorted(list(map(int,input().split())))
lic = sorted(list(map(int,input().split())))

li2 = sorted(list(a+b for a in lia for b in lib),reverse = True)[:k]
li3 = sorted(list(ab + c for ab in li2 for c in lic),reverse = True)

for i in range(k):
    print(li3[i])


Fixed submission:
def main():
    x,y,z,k = map(int,input().split())
    lia = sorted(list(map(int,input().split())))
    lib = sorted(list(map(int,input().split())))
    lic = sorted(list(map(int,input().split())))

    li2 = sorted(list(a+b for a in lia for b in lib),reverse = True)[:k]
    li3 = sorted(list(ab + c for ab in li2 for c in lic),reverse = True)[:k]

    print('\n'.join(map(str,li3)))

main()

Buggy python submission (verdict: Time Limit Exceeded):
x,y,z,k = map(int,input().split())
li = [list(map(int,input().split())) for _ in range(3)]
li2 = []
li3 = []

for i in range(x):
    for j in range(y):
        li2.append(li[0][i]+li[1][j])
li2.sort(reverse = True)
li2[:min(k,len(li2))]

for i in range(z):
    for j in range(min(k,len(li2))):
        li3.append(li[2][i]+li2[j])
li3.sort(reverse = True)

for i in range(k):
    print(li3[i])


Fixed submission:
def main():
    x,y,z,k = map(int,input().split())
    lia = sorted(list(map(int,input().split())))
    lib = sorted(list(map(int,input().split())))
    lic = sorted(list(map(int,input().split())))

    li2 = sorted(list(a+b for a in lia for b in lib),reverse = True)[:k]
    li3 = sorted(list(ab + c for ab in li2 for c in lic),reverse = True)[:k]

    print('\n'.join(map(str,li3)))

main()