Language: C++

(eval-when (:compile-toplevel :load-toplevel :execute)
  (sb-int:defconstant-eqx OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0))
    #'equal)
  #+swank (ql:quickload '(:cl-debug-print :fiveam) :silent t)
  #-swank (set-dispatch-macro-character
           ;; enclose the form with VALUES to avoid being captured by LOOP macro
           #\# #\> (lambda (s c p) (declare (ignore c p)) `(values ,(read s nil nil t)))))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)
#-swank (disable-debugger) ; for CS Academy

;; BEGIN_INSERTED_CONTENTS
(defmacro dbg (&rest forms)
  #+swank
  (if (= (length forms) 1)
      `(format *error-output* "~A => ~A~%" ',(car forms) ,(car forms))
      `(format *error-output* "~A => ~A~%" ',forms `(,,@forms)))
  #-swank (declare (ignore forms)))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(declaim (inline println))
(defun println (obj &optional (stream *standard-output*))
  (let ((*read-default-float-format* 'double-float))
    (prog1 (princ obj stream) (terpri stream))))

(defconstant +mod+ 1000000007)

;;;
;;; Body
;;;

(defun main ()
  (let* ((n (read))
         (r (read)))
    (println
     (if (>= n 10)
         r
         (+ r (* 100 (- 10 n)))))))

#-swank (main)

;;;
;;; Test and benchmark
;;;

#+swank
(defun io-equal (in-string out-string &key (function #'main) (test #'equal))
  "Passes IN-STRING to *STANDARD-INPUT*, executes FUNCTION, and returns true if
the string output to *STANDARD-OUTPUT* is equal to OUT-STRING."
  (labels ((ensure-last-lf (s)
             (if (eql (uiop:last-char s) #\Linefeed)
                 s
                 (uiop:strcat s uiop:+lf+))))
    (funcall test
             (ensure-last-lf out-string)
             (with-output-to-string (out)
               (let ((*standard-output* out))
                 (with-input-from-string (*standard-input* (ensure-last-lf in-string))
                   (funcall function)))))))

#+swank
(defun get-clipbrd ()
  (with-output-to-string (out)
    (run-program "powershell.exe" '("-Command" "Get-Clipboard") :output out :search t)))

#+swank (defparameter *this-pathname* (uiop:current-lisp-file-pathname))
#+swank (defparameter *dat-pathname* (uiop:merge-pathnames* "test.dat" *this-pathname*))

#+swank
(defun run (&optional thing (out *standard-output*))
  "THING := null | string | symbol | pathname

null: run #'MAIN using the text on clipboard as input.
string: run #'MAIN using the string as input.
symbol: alias of FIVEAM:RUN!.
pathname: run #'MAIN using the text file as input."
  (let ((*standard-output* out))
    (etypecase thing
      (null
       (with-input-from-string (*standard-input* (delete #\Return (get-clipbrd)))
         (main)))
      (string
       (with-input-from-string (*standard-input* (delete #\Return thing))
         (main)))
      (symbol (5am:run! thing))
      (pathname
       (with-open-file (*standard-input* thing)
         (main))))))

#+swank
(defun gen-dat ()
  (uiop:with-output-file (out *dat-pathname* :if-exists :supersede)
    (format out "")))

#+swank
(defun bench (&optional (out (make-broadcast-stream)))
  (time (run *dat-pathname* out)))

;; To run: (5am:run! :sample)
#+swank
(it.bese.fiveam:test :sample
  (it.bese.fiveam:is
   (common-lisp-user::io-equal "2 2919
"
    "3719
"))
  (it.bese.fiveam:is
   (common-lisp-user::io-equal "22 3051
"
    "3051
")))


Compiler output:
a.cc:3:6: error: invalid preprocessing directive #+
    3 |     #+swank '(optimize (speed 3) (safety 2))
      |      ^
a.cc:3:13: warning: missing terminating ' character
    3 |     #+swank '(optimize (speed 3) (safety 2))
      |             ^
a.cc:4:6: error: invalid preprocessing directive #-
    4 |     #-swank '(optimize (speed 3) (safety 0) (debug 0))
      |      ^
a.cc:4:13: warning: missing terminating ' character
    4 |     #-swank '(optimize (speed 3) (safety 0) (debug 0))
      |             ^
a.cc:5:6: warning: missing terminating ' character
    5 |     #'equal)
      |      ^
a.cc:5:6: error: invalid preprocessing directive #'equal)
    5 |     #'equal)
      |      ^~~~~~~
a.cc:6:4: error: invalid preprocessing directive #+
    6 |   #+swank (ql:quickload '(:cl-debug-print :fiveam) :silent t)
      |    ^
a.cc:6:25: warning: missing terminating ' character
    6 |   #+swank (ql:quickload '(:cl-debug-print :fiveam) :silent t)
      |                         ^
a.cc:7:4: error: invalid preprocessing directive #-
    7 |   #-swank (set-dispatch-macro-character
      |    ^
a.cc:9:13: error: invalid preprocessing directive #\
    9 |            #\# #\> (lambda (s c p) (declare (ignore c p)) `(values ,(read s nil nil t)))))
      |             ^
a.cc:10:2: error: invalid preprocessing directive #+
   10 | #+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)
      |  ^
a.cc:11:2: error: invalid preprocessing directive #-
   11 | #-swank (disable-debugger) ; for CS Academy
      |  ^
a.cc:15:4: error: invalid preprocessing directive #+
   15 |   #+swank
      |    ^
a.cc:17:7: error: stray '`' in program
   17 |       `(format *error-output* "~A => ~A~%" ',(car forms) ,(car forms))
      |       ^
a.cc:17:44: warning: missing terminating ' character
   17 |       `(format *error-output* "~A => ~A~%" ',(car forms) ,(car forms))
      |                                            ^
a.cc:17:44: error: missing terminating ' character
   17 |       `(format *error-output* "~A => ~A~%" ',(car forms) ,(car forms))
      |                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:18:7: error: stray '`' in program
   18 |       `(format *error-output* "~A => ~A~%" ',forms `(,,@forms)))
      |       ^
a.cc:18:44: warning: missing terminating ' character
   18 |       `(format *error-output* "~A => ~A~%" ',forms `(,,@forms)))
      |                                            ^
a.cc:18:44: error: missing terminating ' character
   18 |       `(format *error-output* "~A => ~A~%" ',forms `(,,@forms)))
      |                                            ^~~~~~~~~~~~~~~~~~~~~
a.cc:19:4: error: invalid preprocessing directive #-
   19 |   #-swank (declare (ignore forms)))
      |    ^
a.cc:22:3: error: stray '`' in program
   22 |   `(progn
      |   ^
a.cc:23:7: error: stray '@' in program
   23 |      ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
      |       ^
a.cc:23:28: error: stray '`' in program
   23 |      ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
      |                            ^
a.cc:23:75: warning: missing terminating ' character
   23 |      ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
      |                                                                           ^
a.cc:23:75: error: missing terminating ' character
   23 |      ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
      |                                                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:24:7: error: stray '@' in program
   24 |      ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
      |       ^
a.cc:24:28: error: stray '`' in program
   24 |      ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
      |                            ^
a.cc:24:74: warning: missing terminating ' character
   24 |      ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
      |                                                                          ^
a.cc:24:74: error: missing terminating ' character
   24 |      ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
      |                                                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:29:38: warning: missing terminating ' character
   29 |   (let ((*read-default-float-format* 'double-float))
      |                                      ^
a.cc:29:38: error: missing terminating ' character
   29 |   (let ((*read-default-float-format* 'double-float))
      |                                      ^~~~~~~~~~~~~~~
a.cc:46:2: error: invalid preprocessing directive #-
   46 | #-swank (main)
      |  ^
a.cc:52:2: error: invalid preprocessing directive #+
   52 | #+swank
      |  ^
a.cc:53:54: error: stray '#' in program
   53 | (defun io-equal (in-string out-string &key (function #'main) (test #'equal))
      |                                                      ^
a.cc:53:55: warning: multi-character literal with 13 characters exceeds 'int' size of 4 bytes
   53 | (defun io-equal (in-string out-string &key (function #'main) (test #'equal))
      |                                                       ^~~~~~~~~~~~~~~~~~~~
a.cc:54:3: warning: missing terminating " character
   54 |   "Passes IN-STRING to *STANDARD-INPUT*, executes FUNCTION, and returns true if
      |   ^
a.cc:54:3: error: missing terminating " character
   54 |   "Passes IN-STRING to *STANDARD-INPUT*, executes FUNCTION, and returns true if
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:55:63: warning: missing terminating " character
   55 | the string output to *STANDARD-OUTPUT* is equal to OUT-STRING."
      |                                                               ^
a.cc:55:63: error: missing terminating " character
a.cc:57:42: error: stray '#' in program
   57 |              (if (eql (uiop:last-char s) #\Linefeed)
      |                                          ^
a.cc:57:43: error: stray '\' in program
   57 |              (if (eql (uiop:last-char s) #\Linefeed)
      |                                           ^
a.cc:67:2: error: invalid preprocessing directive #+
   67 | #+swank
      |  ^
a.cc:70:35: warning: missing terminating ' character
   70 |     (run-program "powershell.exe" '("-Command" "Get-Clipboard") :output out :search t)))
      |                                   ^
a.cc:70:35: error: missing terminating ' character
   70 |     (run-program "powershell.exe" '("-Command" "Get-Clipboard") :output out :search t)))
      |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:72:2: error: invalid preprocessing directive #+
   72 | #+swank (defparameter *this-pathname* (uiop:current-lisp-file-pathname))
      |  ^
a.cc:73:2: error: invalid preprocessing directive #+
   73 | #+swank (defparameter *dat-pathname* (uiop:merge-pathnames* "test.dat" *this-pathname*))
      |  ^
a.cc:75:2: error: invalid preprocessing directive #+
   75 | #+swank
      |  ^
a.cc:77:3: warning: missing terminating " character
   77 |   "THING := null | string | symbol | pathname
      |   ^
a.cc:77:3: error: missing terminating " character
   77 |   "THING := null | string | symbol | pathname
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:79:11: error: stray '#' in program
   79 | null: run #'MAIN using the text on clipboard as input.
      |           ^
a.cc:79:12: warning: missing terminating ' character
   79 | null: run #'MAIN using the text on clipboard as input.
      |            ^
a.cc:79:12: error: missing terminating ' character
   79 | null: run #'MAIN using the text on clipboard as input.
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:80:13: error: stray '#' in program
   80 | string: run #'MAIN using the string as input.
      |             ^
a.cc:80:14: warning: missing terminating ' character
   80 | string: run #'MAIN using the string as input.
      |              ^
a.cc:80:14: error: missing terminating ' character
   80 | string: run #'MAIN using the string as input.
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:82:15: error: stray '#' in program
   82 | pathname: run #'MAIN using the text file as input."
      |               ^
a.cc:82:16: warning: missing terminating ' character
   82 | pathname: run #'MAIN using the text file as input."
      |                ^
a.cc:82:16: error: missing terminating ' character
   82 | pathname: run #'MAIN using the text file as input."
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:86:58: error: stray '#' in program
   86 |        (with-input-from-string (*standard-input* (delete #\Return (get-clipbrd)))
      |                                                          ^
a.cc:86:59: error: stray '\' in program
   86 |        (with-input-from-string (*standard-input* (delete #\Return (get-clipbrd)))
      |                                                           ^
a.cc:89:58: error: stray '#' in program
   89 |        (with-input-from-string (*standard-input* (delete #\Return thing))
      |                                                          ^
a.cc:89:59: error: stray '\' in program
   89 |        (with-input-from-string (*standard-input* (delete #\Return thing))
      |                                                           ^
a.cc:96:2: error: invalid preprocessing directive #+
   96 | #+swank
      |  ^
a.cc:101:2: error: invalid preprocessing directive #+
  101 | #+swank
      |  ^
a.cc:106:2: error: invalid preprocessing directive #+
  106 | #+swank
      |  ^
a.cc:109:32: warning: missing terminating " character
  109 |    (common-lisp-user::io-equal "2 2919
      |                                ^
a.cc:109:32: error: missing terminating " character
  109 |    (common-lisp-user::io-equal "2 2919
      |                                ^~~~~~~
a.cc:110:1: warning: missing terminati