Code Warriors
C/C++ JAVA ... common programming questions on CodeChef, HackerRank...
Saturday, 30 January 2016
Fast Input in C++
//Only use it in coding sites. For use on windows remove '_unlocked' from this template. #include
#include
using namespace std; #define gc getchar_unlocked //thread unsafe void input(unsigned long long &y) // input (function name) may be named anything { register long c = gc(); y = 0; for(;(c<48 || c>57);c = gc()); for(;c>47 && c<58;c = gc()) {y = (y<<1) + (y<<3) + c - 48;} } int main() { unsigned long long t; input(t); //cin >>t; printf(t); return 0; }
No comments:
Post a Comment
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment