Skip to content

Instantly share code, notes, and snippets.

@gyu-don
Last active August 18, 2017 22:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gyu-don/9ad5bc11c433983c3803a24139e7ba03 to your computer and use it in GitHub Desktop.
Save gyu-don/9ad5bc11c433983c3803a24139e7ba03 to your computer and use it in GitHub Desktop.
#![allow(unused_macros, unused_imports, dead_code)]
use std::io::*;
use std::collections::*;
fn read_line() -> String {
let mut s = String::new();
stdin().read_line(&mut s).unwrap();
s
}
macro_rules! from_iter {
($($a:ident),+ = $it:expr) => {
$(let $a;)+
{
let mut _it = $it.into_iter();
$($a = _it.next().unwrap();)+
assert!(_it.next().is_none());
}
};
}
macro_rules! from_str {
($($a:ident : $t:ty),+ = $s:expr) => {
$(let $a: $t;)+
{
let mut _it = $s.split_whitespace();
$($a = _it.next().unwrap().parse().unwrap();)+
assert!(_it.next().is_none());
}
};
}
macro_rules! from_line {
($($a:ident : $t:ty),+) => {
$(let $a: $t;)+
{
let _line = read_line();
let mut _it = _line.trim().split_whitespace();
$($a = _it.next().unwrap().parse().unwrap();)+
assert!(_it.next().is_none());
}
};
}
macro_rules! print_var_fmt {
($e:expr) => {
concat!(stringify!($e), ":\t{}")
};
($e:expr, $($es: expr),+) => {
concat!(print_var_fmt!($e), ",\t", print_var_fmt!($($es),+))
};
}
macro_rules! dbg {
($($es:expr),+) => {
writeln!(&mut io::stderr(), print_var_fmt!($($es),*), $($es),*);
};
}
fn main() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment