Language: C++

extern crate core;

use std::io::{self, Read};

#[macro_export]
macro_rules! input {
  ($s:expr=>$($t:tt)*) => {
    let mut lines=$s.split("\n");
    $(
        line_parse!(lines,$t);
    )*
  };
}

macro_rules! line_parse {
  ($lines:expr,($($name:ident:$t:tt)*)) => {
    let mut line=$lines.next().unwrap().split_whitespace();
    $(value_def!(line,$name,$t);)*
  };

  ($lines:expr,{$n:expr;$name:ident:$t:tt}) => {
    values_def!($lines,$n,$name,$t);
  };
}

macro_rules! value_def {
    ($line:expr, $name:ident, $t:tt) => {
        let $name = value!($line, $t);
    };
}

macro_rules! values_def {
    ($lines:expr, $n:expr, $name:ident, $t:tt) => {
        let $name = {
            let mut vec = Vec::new();
            for i in 0..$n {
                let mut next = $lines.next().unwrap().split_whitespace();
                vec.push(value!(next, $t));
            }
            vec
        };
    };
}

macro_rules! value {
  ($line:expr,[$t:tt]) => {
    $line.map(|x|{
      let mut iter=::std::iter::once(x);
      value!(iter,$t)
    }).collect::<Vec<_>>()
  };
  ($line:expr,($($t:tt),*)) => {
    ($(value!($line,$t),)*)
  };
  ($line:expr,#) => {
    $line.next().unwrap()
  };
  ($line:expr,@) => {
    $line.next().unwrap().parse::<usize>().unwrap()-1
  };
  ($line:expr,$t:ty) => {
    $line.next().unwrap().parse::<$t>().unwrap()
  };
}

fn main() {
    let mut input = String::new();
    io::stdin().read_to_string(&mut input).unwrap();
    let output = solve(input.trim().to_string());
    println!("{}", output);
}

fn solve(input: String) -> String {
    input!(input=>(n: i32));
    let mut ret: String; 

    if n < 1200 {
        ret = "ABC".to_string();
    }
    else if n < 2800 {
        ret = "ARC".to_string(); 
    }
    else {
        ret = "AGC".to_string();
    }
    
    ret
}

macro_rules! tests {
    ($($name:ident: $input:expr=>$output:expr,)*) => {
        mod tests {
            $(
                #[test]
                fn $name() {
                    assert_eq!($output.trim().to_string(),super::solve($input.trim().to_string()));
                }
            )*
        }
    }
}

tests! {
    test1: "3 9" => "12",
    test2: "31 32" => "63",
    test3: "1 2" => "3",
    test4: "-1 2" => "1",
    test5: "10 1" => "11",
}



Compiler output:
a.cc:5:2: error: invalid preprocessing directive #[
    5 | #[macro_export]
      |  ^
a.cc:36:22: error: too many decimal points in number
   36 |             for i in 0..$n {
      |                      ^~~~~
a.cc:55:15: error: stray '#' in program
   55 |   ($line:expr,#) => {
      |               ^
a.cc:58:15: error: stray '@' in program
   58 |   ($line:expr,@) => {
      |               ^
a.cc:94:18: error: invalid preprocessing directive #[
   94 |                 #[test]
      |                  ^
a.cc:1:8: error: 'crate' does not name a type
    1 | extern crate core;
      |        ^~~~~
a.cc:3:1: error: 'use' does not name a type
    3 | use std::io::{self, Read};
      | ^~~
a.cc:6:1: error: 'macro_rules' does not name a type
    6 | macro_rules! input {
      | ^~~~~~~~~~~
a.cc:15:1: error: 'macro_rules' does not name a type
   15 | macro_rules! line_parse {
      | ^~~~~~~~~~~
a.cc:26:1: error: 'macro_rules' does not name a type
   26 | macro_rules! value_def {
      | ^~~~~~~~~~~
a.cc:32:1: error: 'macro_rules' does not name a type
   32 | macro_rules! values_def {
      | ^~~~~~~~~~~
a.cc:45:1: error: 'macro_rules' does not name a type
   45 | macro_rules! value {
      | ^~~~~~~~~~~
a.cc:66:1: error: 'fn' does not name a type
   66 | fn main() {
      | ^~
a.cc:73:1: error: 'fn' does not name a type
   73 | fn solve(input: String) -> String {
      | ^~
a.cc:90:1: error: 'macro_rules' does not name a type
   90 | macro_rules! tests {
      | ^~~~~~~~~~~
a.cc:103:1: error: 'tests' does not name a type
  103 | tests! {
      | ^~~~~