常规快读快写
inline int read(){ int ret=0,w=0; char ch=0; while(!isdigit(ch)){ w|=ch=='-'; ch=getchar(); } while(isdigit(ch)){ ret=(ret<<3)+(ret<<1)+(ch^48); ch=getchar(); } return w?-ret:ret; }
inline void write(int x){ if(x<0){ putchar('-'); x=-x; } if(x>9){ write(x/10); } putchar(x%10+'0'); }
fread:
inline char read(){ static const int SIZE = 1024*1024; static char *s,*t,ibuf[SIZE]; if(s == t) t = (s=ibuf) + fread(ibuf,1,SIZE,stdin); return s == t ? -1:(*s++); } inline void read(int &x){ static bool iosig = 0;static char ch; for(ch = read(),iosig = 0;!isdigit(ch);ch = read()){ if(ch == -1) return; if(ch =='-') iosig = 1; } for(x = 0;isdigit(ch);ch =read()) x = (((x<<2)+x)<<1) + (ch^48); if(iosig) x = -x; }