快读快写模板

· · 个人记录

const int SZ=1<<21;
char buf[SZ],*p1=buf,*p2=buf,obuf[SZ],*p3=obuf;
#define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,SZ,stdin),p1==p2)?EOF:*p1++)
#define pc(c) ((p3-obuf==SZ&&(fwrite(obuf,1,SZ,stdout),p3=obuf)),*p3++=(c))
#define flush() fwrite(obuf,1,p3-obuf,stdout)
inline int rd(){int x=0;bool f=0;char c=gc();for(;!isdigit(c);f|=(c=='-'),c=gc());for(;isdigit(c);x=(x<<1)+(x<<3)+(c&15),c=gc());return (f?-x:x);}
inline void wt(int x){char s[20];short t=0;x<0&&(pc('-'),x=-x);do s[t++]=x%10+48,x/=10;while(x);while(t--)pc(s[t]);}