Fir 快读
1 inline int read() 2 { 3 int X=0,w=0; char ch=0; 4 while(!isdigit(ch)) {w|=ch=='-';ch=getchar();} 5 while(isdigit(ch)) X=(X<<3)+(X<<1)+(ch^48),ch=getchar(); 6 return w?-X:X; 7 }
快写
1 inline void write(int x) 2 { 3 if(x<0) putchar('-'),x=-x; 4 if(x>9) write(x/10); 5 putchar(x%10+'0'); 6 }
更快的 Sec 快读
#define getchar()(p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++) char buf[1<<21],*p1=buf,*p2=buf; template <typename T> inline void read(T& X) { X=0;bool w=0; char ch=getchar(); while(ch<'0'||ch>'9') w=ch=='-'?1:0,ch=getchar(); while(ch>='0'&&ch<='9') X=(X<<3)+(X<<1)+(ch^48), ch=getchar(); X=w?-X:r; }