Skip to content

Instantly share code, notes, and snippets.

@matematikaadit
Last active January 11, 2017 12:25
Show Gist options
  • Save matematikaadit/a8f2fa93426e441b13ab86c519782a6b to your computer and use it in GitHub Desktop.
Save matematikaadit/a8f2fa93426e441b13ab86c519782a6b to your computer and use it in GitHub Desktop.
#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