Advertisement
Kevin_Zhang

Untitled

Mar 25th, 2020
373
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. inline char readchar(){
  2.     static const int bufsize = 1 << 16;
  3.     static int p = 0, end = 0;
  4.     static char buf[bufsize];
  5.     if (p == end)
  6.         end = fread_unlocked(buf, sizeof(char), bufsize, stdin), p = 0;
  7.     return p == end ? EOF : buf[p++];
  8. }
  9. template<typename T> inline void read(T& a){
  10.     static char p;
  11.     static bool b;
  12.     while (!isdigit(p = readchar()))
  13.         b = p == '-'; a = p ^ '0';
  14.     while (isdigit(p = readchar()))
  15.         a *= 10, a += p ^ '0';
  16.     (b ? a *= -1 : 0);
  17.     b = p == '-';
  18. }
  19. inline void R(){} template<class T1, class... T2> inline void R(T1 &h, T2 &... e){read(h), R(e...);}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement