(letrec* ((n (string->number (read-line))) (v (make-vector 10 0)) (get-data (lambda (n a) (if (zero? n) (reverse a) (get-data (- n 1) (cons (string-split (read-line) " ") a))))) (a (get-data n '())) (check (lambda (a) (unless (null? a) (let1 r (map string->number (reverse (cdr (reverse (car a))))) (begin (if (equal? (car (reverse (car a))) "NO") (for-each (lambda (x) (vector-set! v x -1)) r) (for-each (lambda (x) (vector-set! v x (+ (vector-ref v x) 1))) r)) (check (cdr a))))))) (get-result (lambda (n mv mi) (let* ((v (vector-ref v n)) (b (< mv v))) (if (eq? n 9) (if b n mi) (get-result (+ n 1) (if b v mv) (if b n mi))))))) (check a) (print (get-result 0 (vector-ref v 0) 0)))