(defun main (&rest argv) (declare (ignorable argv)) (let* ((*read-default-float-format* 'double-float) (n (read)) (d (read)) (s (read)) (x (make-array n :element-type 'integer :initial-element 0)) (res (* n (1+ (* 2 s))))) (dotimes (i n) (setf (aref x i) (read))) (sort x #'<) (dotimes (i n) (loop for j from (1+ i) below n do (let ((dst (abs (- (aref x i) (aref x j))))) (when (zerop (mod dst d)) (let ((tmp (1+ (- (* 2 s) (floor dst d))))) (when (plusp tmp) (decf res tmp) (return))))))) (format t "~d~%" res))) (main)