Buggy python submission (verdict: Runtime Error):
def transport(n,a,b,c,d,e):
    s = [a,b,c,d,e]
    x = min(s)
    return 5+int(1/x*(n-1))
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
print(transport(n,a,b,c,d,e))  

Fixed submission:
import sys
input = sys.stdin.readline
 
x, y, z, k = map(int, input().split())
a = sorted(int(i) for i in input().split())
b = sorted(int(i) for i in input().split())
c = sorted(int(i) for i in input().split())
 
#a.sort(reverse=True)
#b.sort(reverse=True)
#c.sort(reverse=True)
 
ab = sorted(i+j for i in a for j in b)[:-k-1:-1]
abc = sorted(i+j for i in ab for j in c)[:-k-1:-1]
 
print(*abc[:k], sep="\n")

Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())

s1=list(map(int, input().split()))
s2=list(map(int, input().split()))
s3=list(map(int, input().split()))

ans1 = sorted(i+j for i in s1 for j in s2)
ans2 = sorted(i+j for i in ans1 for j in s3)
res = sorted(ans2,reverse=True)
print(*res[:k+1], sep="\n")

Fixed submission:
import sys
input = sys.stdin.readline
 
x, y, z, k = map(int, input().split())
a = sorted(int(i) for i in input().split())
b = sorted(int(i) for i in input().split())
c = sorted(int(i) for i in input().split())
 
#a.sort(reverse=True)
#b.sort(reverse=True)
#c.sort(reverse=True)
 
ab = sorted(i+j for i in a for j in b)[:-k-1:-1]
abc = sorted(i+j for i in ab for j in c)[:-k-1:-1]
 
print(*abc[:k], sep="\n")

Buggy python submission (verdict: Runtime Error):
def cake(s1,s2,s3):
    ans1 = sorted(i+j for i in s1 for j in s2)
    ans2 = sorted(i+j for i in ans1 for j in s3)
    return ans2    
    
a,b,c,d = map(int, input().split())

s1=list(map(int, input().split()))
s2=list(map(int, input().split()))
s3=list(map(int, input().split()))

ans1 = sorted(i+j for i in s1 for j in s2)
ans2 = sorted(i+j for i in ans1 for j in s3)
res = sorted(ans2,reverse=True)
print(*res[:k+1], sep="\n")

Fixed submission:
import sys
input = sys.stdin.readline
 
x, y, z, k = map(int, input().split())
a = sorted(int(i) for i in input().split())
b = sorted(int(i) for i in input().split())
c = sorted(int(i) for i in input().split())
 
#a.sort(reverse=True)
#b.sort(reverse=True)
#c.sort(reverse=True)
 
ab = sorted(i+j for i in a for j in b)[:-k-1:-1]
abc = sorted(i+j for i in ab for j in c)[:-k-1:-1]
 
print(*abc[:k], sep="\n")

Buggy python submission (verdict: Time Limit Exceeded):
def cake(s1,s2,s3):
    ans1 = sorted(i+j for i in s1 for j in s2)
    ans2 = sorted(i+j for i in ans1 for j in s3)
    return ans2    
    
a,b,c,d = map(int, input().split())

s1=list(map(int, input().split()))
s2=list(map(int, input().split()))
s3=list(map(int, input().split()))

z = sorted(cake(s1,s2,s3),reverse=True)
for i in range(0,d):
    print(z[i])

Fixed submission:
import sys
input = sys.stdin.readline
 
x, y, z, k = map(int, input().split())
a = sorted(int(i) for i in input().split())
b = sorted(int(i) for i in input().split())
c = sorted(int(i) for i in input().split())
 
#a.sort(reverse=True)
#b.sort(reverse=True)
#c.sort(reverse=True)
 
ab = sorted(i+j for i in a for j in b)[:-k-1:-1]
abc = sorted(i+j for i in ab for j in c)[:-k-1:-1]
 
print(*abc[:k], sep="\n")

Buggy python submission (verdict: Time Limit Exceeded):
def add(s1,s2):
    l = []
    for x in s1:
        for y in s2:
            l.append(x+y)
    return l

def cake(s1,s2,s3):
    ans1 = add(s1,s2)
    ans2 = add(ans1,s3)
    return ans2    
    
a,b,c,d = map(int, input().split())
s1=list(map(int, input().split()))
s2=list(map(int, input().split()))
s3=list(map(int, input().split()))
z = sorted(cake(s1,s2,s3),reverse=True)
for i in range(0,d):
    print(z[i])

Fixed submission:
import sys
input = sys.stdin.readline
 
x, y, z, k = map(int, input().split())
a = sorted(int(i) for i in input().split())
b = sorted(int(i) for i in input().split())
c = sorted(int(i) for i in input().split())
 
#a.sort(reverse=True)
#b.sort(reverse=True)
#c.sort(reverse=True)
 
ab = sorted(i+j for i in a for j in b)[:-k-1:-1]
abc = sorted(i+j for i in ab for j in c)[:-k-1:-1]
 
print(*abc[:k], sep="\n")

Buggy python submission (verdict: Time Limit Exceeded):
def add(s1,s2):
    l = []
    for i in range(len(s1)):
        for j in range(len(s2)):
            l.append(s1[i]+s2[j])
    return l

def cake(s1,s2,s3):
    ans1 = add(s1,s2)
    ans2 = add(ans1,s3)
    return ans2    
    
a,b,c,d = map(int, input().split())
s1=list(map(int, input().split()))
s2=list(map(int, input().split()))
s3=list(map(int, input().split()))
z = sorted(cake(s1,s2,s3),reverse=True)
for i in range(0,d):
    print(z[i])

Fixed submission:
import sys
input = sys.stdin.readline
 
x, y, z, k = map(int, input().split())
a = sorted(int(i) for i in input().split())
b = sorted(int(i) for i in input().split())
c = sorted(int(i) for i in input().split())
 
#a.sort(reverse=True)
#b.sort(reverse=True)
#c.sort(reverse=True)
 
ab = sorted(i+j for i in a for j in b)[:-k-1:-1]
abc = sorted(i+j for i in ab for j in c)[:-k-1:-1]
 
print(*abc[:k], sep="\n")