言葉には出来ない心事
全部抱いてたなびかせて
届け (君へ) まだ見ぬ場所へ
#pragma GCC optimize("Ofast","-funroll-loops")
#pragma GCC target("sse4.1","sse4.2","ssse3","sse3","sse2","sse","avx2","avx","popcnt","tune=native")快读快写:
namespace nqio{const unsigned R=4e5,W=4e5;char*a,*b,i[R],o[W],*c=o,*d=o+W,h[40],*p=h,y;bool s;struct q{void r(char&x){x=a==b&&(b=(a=i)+fread(i,1,R,stdin),a==b)?-1:*a++;}void f(){fwrite(o,1,c-o,stdout);c=o;}~q(){f();}void w(char x){*c=x;if(++c==d)f();}q&operator>>(char&x){do r(x);while(x<=32);return*this;}q&operator>>(char*x){do r(*x);while(*x<=32);while(*x>32)r(*++x);*x=0;return*this;}template<typename t>q&operator>>(t&x){for(r(y),s=0;!isdigit(y);r(y))s|=y==45;if(s)for(x=0;isdigit(y);r(y))x=x*10-(y^48);else for(x=0;isdigit(y);r(y))x=x*10+(y^48);return*this;}q&operator<<(char x){w(x);return*this;}q&operator<<(char*x){while(*x)w(*x++);return*this;}q&operator<<(const char*x){while(*x)w(*x++);return*this;}template<typename t>q&operator<<(t x){if(!x)w(48);else if(x<0)for(w(45);x;x/=10)*p++=48|-(x%10);else for(;x;x/=10)*p++=48|x%10;while(p!=h)w(*--p);return*this;}}qio;}using nqio::qio;不开O2优化版:
namespace nqio{const unsigned R=4e5,W=4e5;char*a,*b,i[R],o[W],*c=o,*d=o+W,h[40],*p=h,y;bool s;struct q{__attribute__((always_inline))void r(char&x){x=a==b&&(b=(a=i)+fread(i,1,R,stdin),a==b)?-1:*a++;}void f(){fwrite(o,1,c-o,stdout);c=o;}~q(){f();}__attribute__((always_inline))void w(char x){*c=x;if(++c==d)f();}__attribute__((always_inline))q&operator>>(char&x){do r(x);while(x<=32);return*this;}__attribute__((always_inline))q&operator>>(char*x){do r(*x);while(*x<=32);while(*x>32)r(*++x);*x=0;return*this;}template<typename t>__attribute__((always_inline))q&operator>>(t&x){for(r(y),s=0;!isdigit(y);r(y))s|=y==45;if(s)for(x=0;isdigit(y);r(y))x=x*10-(y^48);else for(x=0;isdigit(y);r(y))x=x*10+(y^48);return*this;}__attribute__((always_inline))q&operator<<(char x){w(x);return*this;}q&operator<<(char*x){while(*x)w(*x++);return*this;}__attribute__((always_inline))q&operator<<(const char*x){while(*x)w(*x++);return*this;}template<typename t>__attribute__((always_inline))q&operator<<(t x){if(!x)w(48);else if(x<0)for(w(45);x;x/=10)*p++=48|-(x%10);else for(;x;x/=10)*p++=48|x%10;while(p!=h)w(*--p);return*this;}}qio;}using nqio::qio;取模运算:
#if !defined(__OPTIMIZE__) && defined(__x86_64__) && defined(__GNUC__)
#define normH(a) __asm__("leal %p2(%0), %%edx\ncmpl %1, %0\ncmovg %%edx, %0":"+r"(a):"i"(mdn-1),"i"(-mdn):"%edx","cc")
#define normL(a) __asm__("leal %p1(%0), %%edx\ntestl %0, %0\ncmovs %%edx, %0":"+r"(a):"i"(mdn):"%edx","cc")
//compiler without -O2 baka
#else
#define normH(a) ((a)-=((a)>=mdn?mdn:0))
#define normL(a) ((a)+=((a)<0?mdn:0))
#endif
#define imul(a,b) ((unsigned int)(a)*(unsigned long long)(b)%mdn)