No matter what i do, i get runtime error NZEC, new to CodeChef and Common Lisp, please help

(defun life-universe ()

    (let ((k 0)
          (flag t))
    (setf k (read))
    (labels ((chef (k flag)
             (when (and flag (not (= k 42)))
	         (print k))
               (if (= k 42)
	           (setf flag nil)
	           (if (or (< k 0) (>= k 100))
	               (return-from chef 0)))

            (setf k (read))

            (chef k flag)))

  (chef k flag)))
  (return-from life-universe 0))

I am new to common lisp and code chef and this is the code i wrote for the TEST problem, the very first one in the easy section of the practice problems. I get NZEC error, i tried using sbcl exit and quit functions, still i get it. The return-from function also doesnt seem to work. Where am i going wrong?

Only what I can recommend is to try this

But I thought the sample input suggested that one should continue taking input till it is >= 0 and < 100, though not printing it out, even when 42 is encountered. Now that i think about it, not processing input while still accepting it is kinda dumb. :slight_smile: