Problem p03078 (python)

Fixed submission:
# -*- coding: utf-8 -*-

#input
import numpy as np
[X,Y,Z,K] = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

D = []
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

#make list
for i in range(min(K,X)):
    for j in range(min((K//(i+1))+1,Y)):
        for k in range(min(((K//(i+1))+1)//(j+1),Z)):
                D.append(A[i]+B[j]+C[k])
D.sort(reverse=True)
for i in range(K):
    print(int(D[i]))

Buggy submission (verdict: Runtime Error):
    # -*- coding: utf-8 -*-
     
    #input
    import numpy as np
    [X,Y,Z,K] = list(map(int,input().split()))
    A = list(map(int,input().split()))
    B = list(map(int,input().split()))
    C = list(map(int,input().split()))
     
    D = np.zeros(X*Y*Z+5)
    A.sort(reverse=True)
    B.sort(reverse=True)
    C.sort(reverse=True)
     
    #make list
    for i in range(min(K,X)):
        for j in range(min((K//(i+1))+1,Y)):
            for k in range(min(((K//(i+1))+1)//(j+1),Z)):
                    D.append(A[i]+B[j]+C[k])
    D.sort(reverse=True)
    for i in range(K):
        print(int(D[i]))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

#input
import numpy as np
import sys
sys.setrecursionlimit(10**10) 
[X,Y,Z,K] = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

D = []
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

#make list
memo = np.zeros((X,Y,Z))
for i in range(min(K,X)):
    for j in range(min((K//(i+1))+1,Y)):
        for k in range(min(((K//(i+1))+1)//(j+1),Z)):
            if memo[i][j][k] != 0:
                continue
            else:
                memo[i][j][k] = A[i]+B[j]+C[k]
                D.append(memo[i][j][k])
D.sort(reverse=True)
for i in range(K):
    print(int(D[i]))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

#input
import numpy as np
import sys
sys.setrecursionlimit(10**6) 
[X,Y,Z,K] = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

D = []
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

#make list
memo = np.zeros((X,Y,Z))
for i in range(min(K,X)):
    for j in range(min((K//(i+1))+1,Y)):
        for k in range(min(((K//(i+1))+1)//(j+1),Z)):
            if memo[i][j][k] != 0:
                continue
            else:
                memo[i][j][k] = A[i]+B[j]+C[k]
                D.append(memo[i][j][k])
D.sort(reverse=True)
for i in range(K):
    print(int(D[i]))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

#input
import numpy as np
[X,Y,Z,K] = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

D = []
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

#make list
memo = np.zeros((X,Y,Z))
for i in range(min(K,X)):
    for j in range(min((K//(i+1))+1,Y)):
        for k in range(min(((K//(i+1))+1)//(j+1),Z)):
            if memo[i][j][k] != 0:
                continue
            else:
                memo[i][j][k] = A[i]+B[j]+C[k]
                D.append(memo[i][j][k])
D.sort(reverse=True)
for i in range(K):
    print(int(D[i]))