1 namespace IO { 2 const int MX = 4e7; //1e7占用内存11000kb 3 char buf[MX]; int c, sz; 4 void begin() { 5 c = 0; 6 sz = fread(buf, 1, MX, stdin); 7 } 8 inline bool read(int &t) { 9 while(c < sz && buf[c] != '-' && (buf[c] < '0' || buf[c] > '9')) c++; 10 if(c >= sz) return false; 11 bool flag = 0; if(buf[c] == '-') flag = 1, c++; 12 for(t = 0; c < sz && '0' <= buf[c] && buf[c] <= '9'; c++) t = t * 10 + buf[c] - '0'; 13 if(flag) t = -t; 14 return true; 15 } 16 }