Lisp Fish
(defun fish (a b)
(let* ((veca (coerce a 'vector))
(vecb (coerce b 'vector))
(size (length veca))
(dead 0)
(stack '()))
(dotimes (i size)
(if (= (aref vecb i) 1)
(push (aref veca i) stack)
(when stack
(loop while stack
do (progn
(incf dead)
(if (> (aref veca i) (first stack))
(pop stack)
(return)))))))
(- size dead)))
This uses a stack for downstream fish and resolves fights only when opposite directions meet.