Language: C++

#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::Read;
#[allow(dead_code)]
fn getline() -> String {
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).ok().unwrap();
    ret
}
fn get_word() -> String {
    let mut stdin = std::io::stdin();
    let mut u8b: [u8; 1] = [0];
    loop {
        let mut buf: Vec<u8> = Vec::with_capacity(16);
        loop {
            let res = stdin.read(&mut u8b);
            if res.unwrap_or(0) == 0 || u8b[0] <= b' ' {
                break;
            } else {
                buf.push(u8b[0]);
            }
        }
        if buf.len() >= 1 {
            let ret = String::from_utf8(buf).unwrap();
            return ret;
        }
    }
}

#[allow(dead_code)]
fn get<T: std::str::FromStr>() -> T { get_word().parse().ok().unwrap() }

fn operate(a: &[bool; 256], b: &[bool; 256], op: char) -> Option<[bool; 256]> {
    let mut ans = [false; 256];
    macro_rules! exhaust {
        ($op:expr) => {
            for i in 0 .. 256 {
                if a[i] {
                    for j in 0 .. 256 {
                        if b[j] {
                            ans[$op(i, j)] = true;
                        }
                    }
                }
            }
        };
    }
    match op {
        '+' => exhaust!(|i, j| (i + j) % 256),
        '-' => exhaust!(|i, j| (i + 256 - j) % 256),
        '*' => exhaust!(|i, j| (i * j) % 256),
        '/' => {
            if b[0] {
                return None;
            }
            exhaust!(|i, j| i / j);
        },
        _ => panic!(),
    }
    Some(ans)
}

fn solve() {
    let m = get();
    let mut hm = HashMap::new();
    for _ in 0 .. m {
        let name = get_word();
        let lb: usize = get();
        let ub: usize = get();
        hm.insert(name, (lb, ub));
    }
    let n = get();
    let e: Vec<String> = (0 .. n).map(|_| get_word()).collect();
    let mut stack = Vec::new();
    let mut mess = false;
    for e in &e {
        match e.parse::<usize>() {
            Ok(num) => {
                let mut t = [false; 256];
                t[num % 256] = true;
                stack.push(t);
            },
            Err(_) => {
                match hm.get(e) {
                    Some(&(lb, ub)) => {
                        let mut ans = [false; 256];
                        for i in lb .. ub + 1 {
                            ans[i] = true;
                        }
                        stack.push(ans);
                    },
                    None => {
                        let b = stack.pop().unwrap();
                        let a = stack.pop().unwrap();
                        if let Some(res) = operate(&a, &b, e.chars().nth(0).unwrap()) {
                            stack.push(res);
                        } else {
                            mess = true;
                            break;
                        }
                    },
                }
            }
        }
    }
    println!("{}", if mess { "error" } else { "correct" });
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}



Compiler output:
a.cc:1:2: error: invalid preprocessing directive #[
    1 | #[allow(unused_imports)]
      |  ^
a.cc:3:2: error: invalid preprocessing directive #[
    3 | #[allow(unused_imports)]
      |  ^
a.cc:6:2: error: invalid preprocessing directive #[
    6 | #[allow(dead_code)]
      |  ^
a.cc:32:2: error: invalid preprocessing directive #[
   32 | #[allow(dead_code)]
      |  ^
a.cc:2:1: error: 'use' does not name a type
    2 | use std::cmp::*;
      | ^~~
a.cc:4:1: error: 'use' does not name a type
    4 | use std::collections::*;
      | ^~~
a.cc:5:1: error: 'use' does not name a type
    5 | use std::io::Read;
      | ^~~
a.cc:7:1: error: 'fn' does not name a type
    7 | fn getline() -> String {
      | ^~
a.cc:12:1: error: 'fn' does not name a type
   12 | fn get_word() -> String {
      | ^~
a.cc:33:1: error: 'fn' does not name a type
   33 | fn get<T: std::str::FromStr>() -> T { get_word().parse().ok().unwrap() }
      | ^~
a.cc:35:1: error: 'fn' does not name a type
   35 | fn operate(a: &[bool; 256], b: &[bool; 256], op: char) -> Option<[bool; 256]> {
      | ^~
a.cc:35:23: error: expected unqualified-id before numeric constant
   35 | fn operate(a: &[bool; 256], b: &[bool; 256], op: char) -> Option<[bool; 256]> {
      |                       ^~~
a.cc:35:40: error: expected unqualified-id before numeric constant
   35 | fn operate(a: &[bool; 256], b: &[bool; 256], op: char) -> Option<[bool; 256]> {
      |                                        ^~~
a.cc:35:73: error: expected unqualified-id before numeric constant
   35 | fn operate(a: &[bool; 256], b: &[bool; 256], op: char) -> Option<[bool; 256]> {
      |                                                                         ^~~
a.cc:65:1: error: 'fn' does not name a type
   65 | fn solve() {
      | ^~
a.cc:111:1: error: 'fn' does not name a type
  111 | fn main() {
      | ^~