(define (main args) (let* ([n (read)] [x (read)] [v (make-vector (+ x 1) 0)]) (do [(i n (- i 1))] [(zero? i)] (let* ([a (read)] [b (read)]) (vector-set! v a (max b (vector-ref v a))))) (do [(i 2 (+ i 1))] [(> i x)] (vector-set! v i (max (vector-ref v i) (- (vector-ref v (- i 1)) 1)))) (do [(i (- x 1) (- i 1))] [(zero? i)] (vector-set! v i (max (vector-ref v i) (- (vector-ref v (+ i 1)) 1)))) (print (string-join ($ map number->string $ cdr $ vector->list v) " "))) 0)