Lisp Ladder
(defun ladder (a b)
  (let* ((veca (coerce a 'vector))
         (vecb (coerce b 'vector))
         (size (length veca))
         (modulus (1- (ash 1 (reduce #'max vecb))))
         (limit (reduce #'max veca))
         (fib (make-array (+ limit 2) :initial-element 0)))
    (setf (aref fib 1) 1)
    (loop for i from 2 below (+ limit 2)
          do (setf (aref fib i) (logand (+ (aref fib (1- i)) (aref fib (- i 2))) modulus)))
    (loop for i from 0 below size
          collect (logand (aref fib (1+ (aref veca i))) (1- (ash 1 (aref vecb i)))))))

This precomputes climb counts once and applies the modulo per query, which avoids recalculating the same paths over and over.