Skip to content

Instantly share code, notes, and snippets.

@kiwiyou
Created May 31, 2020 06:52
Show Gist options
  • Save kiwiyou/bea8be80e35211fbedc5b780c22ebfe9 to your computer and use it in GitHub Desktop.
Save kiwiyou/bea8be80e35211fbedc5b780c22ebfe9 to your computer and use it in GitHub Desktop.
Fast IO for Competitive Programming in Rust
extern "C" { fn mmap(a: *mut u8, l: usize, p: i32, f: i32, d: i32, o: i64) -> *mut u8; }
fn input(size: usize) -> *const u8 { unsafe { mmap(0 as *mut u8, size, 1, 2, 0, 0) } }
fn next(p: &mut *const u8) -> I { unsafe { let mut n = 0; while **p & 16 != 0 { n = n * 10 + (**p as I & 15); *p = p.offset(1) } *p = p.offset(1); n } }
type I = i32;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment