(defun main (&rest argv) (declare (ignorable argv)) (let* ((n (read)) (a (make-array 200005)) (b (make-array n :initial-element 0))) (dotimes (i (* 2 n)) (setf (aref a i) (read))) (dotimes (i n) (setf (aref b i) (- (aref a (1+ (* 2 i))) (aref a (* 2 i))))) (loop with ans = (reduce #'+ b) with c = ans for i below n do (decf c (* 2 (aref b i))) (setq ans (max ans c)) finally (format t "~d~%" ans)))) (main)