(defun main (&rest argv) (declare (ignorable argv)) (let* ((*read-default-float-format* 'double-float) (n (read)) (m (read)) (dp (make-array (1+ m) :element-type 'integer :initial-element 0))) (dotimes (_ n) (let* ((a (read)) (b (read)) (c (read)) (d 0) (e 0)) (dotimes (i m) (incf e) (when (>= e a) (incf d b) (incf e (- b a))) (setf (aref dp (1+ i)) (max (aref dp (1+ i)) (* d c)))))) (loop for i from 1 to m do (loop for j from 1 to (floor i 2) do (setf (aref dp i) (max (aref dp i) (+ (aref dp j) (aref dp (- i j))))))) (loop for i from 1 to m do (format t "~d~%" (aref dp i))))) (main)