快读
MaHaoyi666 · · 个人记录
快读
struct fr{
char gc(){
static const int IN_LEN=1<<18|1;
static char buf[IN_LEN],*s,*t;
return (s==t)&&(t=(s=buf)+fread(buf,1,IN_LEN,stdin)),s==t?-1:*s++;
}
template <typename _Tp> inline fr & operator >> (_Tp&x){
static char ch,sgn; ch = gc(), sgn = 0;
for(;!isdigit(ch);ch=gc()){if(ch==-1)return *this;sgn|=ch=='-';}
for(x=0;isdigit(ch);ch=gc())x=x*10+(ch^'0');
sgn&&(x=-x); return *this;
}
}io;
#define cin io
struct fo{
static const int OUT_LEN=1<<18;
char obuf[OUT_LEN],*op;
fo(){op=obuf;}
~fo(){fwrite(obuf,1,op-obuf,stdout);}
inline void pc(char c){
if(op==obuf+OUT_LEN)fwrite(obuf,1,OUT_LEN,stdout),op=obuf;
*op++=c;
}
template <typename _Tp> inline fo&operator<<(_Tp x){
static char stk[64],*top;top=stk;
if(x<0)pc('-'),x=-x;
do{*top++=x%10|'0';x/=10;}while(x);
while(top!=stk)pc(*--top);return*this;
}
inline fo&operator<<(char c){pc(c);return*this;}
inline fo&operator<<(const char*s){while(*s)pc(*s++);return*this;}
}out;
#define cout out