(defun max-pins (n k pins) (let ((count 1) (last-pin (first pins))) (dolist (pin (rest pins) count) (when (>= (- pin last-pin) k) (incf count) (setf last-pin pin))))) (defun read-pins () (let ((n (read)) (k (read))) (let ((pins (loop for i from 1 to n collect (read)))) (format t "~d~%" (max-pins n k pins))))) (read-pins)