namespace IO{
constexpr auto IO_maxn=1<<20;char IO_in[IO_maxn],IO_out[IO_maxn],*IO_p1=IO_in,*IO_p2=IO_in,*IO_p3=IO_out;
inline void IO_flush(){fwrite(IO_out,1,IO_p3-IO_out,stdout);}
inline char IO_getch(){return (IO_p1==IO_p2&&(IO_p2=(IO_p1=IO_in)+fread(IO_in,1,IO_maxn,stdin),IO_p1==IO_p2)?EOF:*IO_p1++);}
inline void IO_putch(const char &IO_x){(IO_p3==IO_out+IO_maxn&&(IO_flush(),IO_p3=IO_out),*IO_p3++=(IO_x));}
template<typename type>inline type IO_read(type &IO_x){IO_x=0;bool IO_flag(0);char IO_ch=IO_getch();while(!isdigit(IO_ch)){IO_flag^=IO_ch=='-',IO_ch=IO_getch();}while(isdigit(IO_ch)){IO_x=(IO_x<<1)+(IO_x<<3)+(IO_ch^48),IO_ch=IO_getch();}return IO_flag?IO_x=-IO_x:IO_x;}
inline char IO_read(char &IO_x){do IO_x=IO_getch();while(isspace(IO_x));return IO_x;}
inline void IO_read(char *IO_x){static char IO_ch;IO_read(IO_ch);do{*(IO_x++)=IO_ch;}while(!isspace(IO_ch=IO_getch())&&~IO_ch);}
inline void IO_read(std::string &IO_x){static char IO_ch;IO_read(IO_ch),IO_x.clear();do{IO_x+=IO_ch;}while(!isspace(IO_ch=IO_getch())&&~IO_ch);}
inline void IO_write(const char &IO_x){IO_putch(IO_x);}
template<typename type>inline void IO_write(type *IO_x){while(*IO_x)IO_putch(*(IO_x++));}
inline void IO_write(const std::string &IO_x){for(register int IO_i=0,IO_len=IO_x.length();IO_i<IO_len;++IO_i)IO_putch(IO_x[IO_i]);}
template<typename type>inline void IO_write(type IO_x){if(IO_x<0)IO_x=-IO_x,IO_putch('-');static short IO_Stack[50],IO_top(0);do{IO_Stack[++IO_top]=IO_x%10,IO_x/=10;}while(IO_x);while(IO_top){IO_putch(IO_Stack[IO_top--]|48);}}
struct IO_Basic{
template<typename type>IO_Basic &operator>>(type &IO_x){IO_x=IO_read(IO_x);return (*this);}
template<typename type>IO_Basic &operator<<(const type &IO_x){IO_write(IO_x);return (*this);}
}IO_Cin,IO_Cout;
class Flush{public:~Flush(){IO_flush();}}_;
}using namespace IO;
#define cin IO_Cin
#define cout IO_Cout快读快写模板
这是 2026年5月21日 存档的第 1 版,不是当前版本。查看当前版本