Language: C++

#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn gcd(x : i64, y: i64)->i64{
    if x % y == 0{
        return 1;
    }
    return gcd(y, x % y);
}

fn lcm(x: i64, y: i64)->i64{
    return x /gcd(x, y) * y;
}
fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        a: i64, b: i64, c: i64, d: i64,
    }
    let mut total = 0;
    total =  b/c + b/d -  b/lcm(d, c);
    total -=  (a -1)/c + (a -1)/d - (a - 1)/lcm(d, c);
    let ans = b - (a - 1) - total;
    println!("{}", ans);
}

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:39:10: error: too many decimal points in number
   39 |         (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
      |          ^~~~~~~
a.cc:52:10: error: too many decimal points in number
   52 |         (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
      |          ^~~~~~
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::{Write, BufWriter};
      | ^~~
a.cc:7:1: error: 'macro_rules' does not name a type
    7 | macro_rules! input {
      | ^~~~~~~~~~~
a.cc:23:1: error: 'macro_rules' does not name a type
   23 | macro_rules! input_inner {
      | ^~~~~~~~~~~
a.cc:33:1: error: 'macro_rules' does not name a type
   33 | macro_rules! read_value {
      | ^~~~~~~~~~~
a.cc:60:1: error: 'fn' does not name a type
   60 | fn gcd(x : i64, y: i64)->i64{
      | ^~
a.cc:67:1: error: 'fn' does not name a type
   67 | fn lcm(x: i64, y: i64)->i64{
      | ^~
a.cc:70:1: error: 'fn' does not name a type
   70 | fn solve() {
      | ^~
a.cc:86:1: error: 'fn' does not name a type
   86 | fn main() {
      | ^~