Last active
April 16, 2019 00:12
-
-
Save Chillee/9f11313ebe0f42f59db09cdfb4ac0076 to your computer and use it in GitHub Desktop.
Fast IO
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
| struct GC { | |
| char buf[1 << 16 | 1]; | |
| int bc = 0, be = 0; | |
| char operator()() { | |
| if (bc >= be) { | |
| be = fread(buf, 1, sizeof(buf) - 1, stdin); | |
| buf[be] = bc = 0; | |
| } | |
| return buf[bc++]; | |
| } | |
| }; | |
| GC gc; |
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
| char gc() { | |
| #ifdef _WIN32 | |
| return _getchar_nolock(); | |
| #else | |
| return getchar_unlocked(); | |
| #endif | |
| } | |
| void read_float() {} | |
| template <class T, class... S> inline void read_float(T &a, S &... b) { | |
| int c, s = 1, fp = 0, fpl = 1; | |
| while (isspace(c = gc())); | |
| if (c == '-') s = -1, c = gc(); | |
| for (a = c - '0'; isdigit(c = gc()); a = a * 10 + c - '0'); | |
| a *= s; | |
| if (c == '.') | |
| for (; isdigit(c = gc()); fp = fp * 10 + c - '0', fpl *= 10); | |
| a += (double)fp / fpl; | |
| read_float(b...); | |
| } |
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
| char gc() { | |
| #ifdef _WIN32 | |
| return _getchar_nolock(); | |
| #else | |
| return getchar_unlocked(); | |
| #endif | |
| } | |
| void read_int() {} | |
| template <class T, class... S> inline void read_int(T &a, S &... b) { | |
| char c, s = 1; | |
| while (isspace(c = gc())); | |
| if (c == '-') s = -1, c = gc(); | |
| for (a = c - '0'; isdigit(c = gc()); a = a * 10 + c - '0'); | |
| a *= s; | |
| read_int(b...); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment