Last active
January 11, 2017 12:25
-
-
Save matematikaadit/a8f2fa93426e441b13ab86c519782a6b to your computer and use it in GitHub Desktop.
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
#include <cstdio> | |
#define get getchar_unlocked | |
template<typename T> | |
void read(T &n) | |
{ | |
n = 0; T sign = 1; char c = get(); | |
while (c < '0' || c > '9') { | |
if (c == '-') sign = -1; | |
c = get(); | |
} | |
while (c >= '0' && c <= '9') { | |
n = (n << 3) + (n << 1) + c - '0'; | |
c = get(); | |
} | |
n *= sign; | |
} | |
#undef get | |
// example usage | |
int main() { | |
int n, m; | |
read(n); | |
read(m); | |
printf("%d %d\n", n, m); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment