1
2
3
(defun water-puzzle (a b c)
  (loop for (x y) in `((,a ,b) (,b ,c) (,c ,a))
    if (zerop (mod (- x y) 3)) minimize (max x y)))