快读模板
struct FastIO {
static const int S=1e6;
int wpos;
char wbuf[S],cp;
FastIO() : wpos(0) {}
inline int gc(){
static char buf[S];
static int len=0,pos=0;
if(pos==len)
pos=0,len=fread(buf,1,S,stdin);
if(pos==len) return 0;
return buf[pos++];
}
inline void rd(int &x) {
cp=gc();x=0;
for(;!isdigit(cp);cp=gc());
for (;isdigit(cp);cp=gc()) x=(x<<3)+(x<<1)+(cp^48);
}
inline void wchar(int x)
{
if (wpos==S)
fwrite(wbuf,1,S,stdout),wpos=0;
wbuf[wpos++]=x;
}
inline void ot(int x,char cp)
{
static char s[30];
int nm=0;
for(;x || !nm;) s[nm++]='0'+x%10,x/=10;
for(--nm;~nm;--nm) wchar(s[nm]);
wchar(cp);
}
~FastIO()
{if (wpos) fwrite(wbuf,1,wpos,stdout),wpos=0;}
}io;