Created
June 18, 2022 08:31
-
-
Save jakobrs/f82eeb1ed76ec7ffdbeb38399930c657 to your computer and use it in GitHub Desktop.
Simple Codeforces Rust template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::io::Write; | |
#[rustfmt::skip] | |
macro_rules! define_read { | |
($words:ident) => { | |
macro_rules! read { | |
() => { | |
$words.next().unwrap().parse().unwrap() | |
}; | |
($t:ty) => { | |
$words.next().unwrap().parse::<$t>().unwrap() | |
}; | |
($t:ty; $n:expr) => { | |
read!($t, |a| a; $n) | |
}; | |
($t:ty, decr; $n: expr) => { | |
read!($t, |a| a - 1; $n) | |
}; | |
($t:ty, $f:expr; $n: expr) => { | |
$words | |
.by_ref() | |
.take($n) | |
.map(|s| s.parse::<$t>().unwrap()) | |
.map($f) | |
.collect::<Vec<_>>() | |
}; | |
} | |
}; | |
} | |
fn main() -> Result<(), Box<dyn std::error::Error>> { | |
let mut input = String::new(); | |
std::io::Read::read_to_string(&mut std::io::stdin(), &mut input).unwrap(); | |
let mut words = input.split_whitespace(); | |
let out = std::io::stdout(); | |
let mut out = std::io::BufWriter::new(out.lock()); | |
define_read!(words); | |
// BEGIN SOLUTION | |
for _ in 0..read!(i64) {} | |
Ok(()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment