constexpr long long get_MOD(){ #ifdef SET_MOD return SET_MOD; #else return 1000000007; #endif } #include #include #include #include #define rep(i,n)for(int i=0;i<(n);++i) #define FOR(i,m,n)for(int i=(m);i<(n);++i) #define rrep(i,n)for(int i=(n)-1;i>=0;--i) #define rfor(i,m,n)for(int i=(m);i>=(n);--i) #define loop(n)rep(i##__COUNTER__,n) #define unless(c)if(!(c)) #define ALL(x)(x).begin(),(x).end() #define RALL(x)(x).rbegin(),(x).rend() #define range_it(a,l,r)(a).begin()+(l),(a).begin()+(r) using ll=long long;using LD=long double;using VB=std::vector;using VVB=std\ ::vector;using VI=std::vector;using VVI=std::vector;using VL=std::v\ ector;using VVL=std::vector;using VS=std::vector;using VD=s\ td::vector;using PII=std::pair;using VP=std::vector;using PLL=\ std::pair;using VPL=std::vector;templateusing PQ=std::prior\ ity_queue;templateusing PQS=std::priority_queue,std\ ::greater>;constexpr int inf=1000000000;constexpr long long inf_ll=1000000000\ 000000000ll,MOD=get_MOD();constexpr long double PI=3.14159265358979323846,EPS=1e\ -12; #include #include #include #ifdef _WIN32 #define getchar_unlocked _getchar_nolock #define putchar_unlocked _putchar_nolock #define fwrite_unlocked fwrite #define fflush_unlocked fflush #endif class Scanner{static int gc(){return getchar_unlocked();}static char next_char()\ {char c;scan(c);return c;}templatestatic void scan(T&v){std::cin>>v;}st\ atic void scan(char&v){while(std::isspace(v=gc()));}static void scan(bool&v){v=n\ ext_char()!='0';}static void scan(std::vector::reference v){bool b;scan(b)\ ;v=b;}static void scan(std::string&v){v.clear();for(char c=next_char();!std::iss\ pace(c);c=gc())v+=c;}static void scan(int&v){v=0;bool neg=false;char c=next_char\ ();if(c=='-'){neg=true;c=gc();}for(;std::isdigit(c);c=gc())v=v*10+(c-'0');if(neg\ )v=-v;}static void scan(long long&v){v=0;bool neg=false;char c=next_char();if(c=\ ='-'){neg=true;c=gc();}for(;std::isdigit(c);c=gc())v=v*10+(c-'0');if(neg)v=-v;}s\ tatic void scan(double&v){v=0;double dp=1;bool neg=false,after_dp=false;char c=n\ ext_char();if(c=='-'){neg=true;c=gc();}for(;std::isdigit(c)||c=='.';c=gc()){if(c\ =='.'){after_dp=true;}else if(after_dp){v+=(c-'0')*(dp*=0.1);}else{v=v*10+(c-'0'\ );}}if(neg)v=-v;}static void scan(long double&v){v=0;long double dp=1;bool neg=f\ alse,after_dp=false;char c=next_char();if(c=='-'){neg=true;c=gc();}for(;std::isd\ igit(c)||c=='.';c=gc()){if(c=='.'){after_dp=true;}else if(after_dp){v+=(c-'0')*(\ dp*=0.1);}else{v=v*10+(c-'0');}}if(neg)v=-v;}templatestatic voi\ d scan(std::pair&v){scan(v.first);scan(v.second);}template,std::nullptr_t> =nullptr>static void scan(std::v\ ector&v){for(auto&e : v)scan(e);}template,std::nullptr_t> =nullptr>static void scan(std::vector&v){for(auto\ e : v)scan(e);}templatestatic void scan_tuple_impl(T&v\ ){if constexpr(N){scan(std::get(v));scan_tuple_impl\ (v);}}templatestatic void scan(std::tuple&v){scan_tuple_impl(v\ );}struct Read2DVectorHelper{std::size_t h,w;Read2DVectorHelper(std::size_t _h,s\ td::size_t _w): h(_h),w(_w){}templateoperator std::vector>(){std::vector vector(h,std::vector(w));scan(vector);return vector;}};struc\ t ReadVectorHelper{std::size_t n;ReadVectorHelper(std::size_t _n): n(_n){}templa\ teoperator std::vector(){std::vectorvector(n);scan(vector);return\ vector;}auto operator[](std::size_t m){return Read2DVectorHelper(n,m);}};public\ :templateT read()const{T result;scan(result);return result;}templateauto read(std::size_t n)const{std::vectorresult(n);scan(result);return \ result;}templateauto read(std::size_t h,std::size_t w)const{std::vector\ result(h,std::vector(w));scan(result);return result;}std::string read_line()\ const{std::string v;for(char c=gc();c!='\n'&&c!='\0';c=gc())v+=c;return v;}templ\ ateoperator T()const{return read();}int operator--(int)const{return \ read()-1;}auto operator[](std::size_t n)const{return ReadVectorHelper(n);}a\ uto operator[](const std::pair&nm)const{return Read2DVe\ ctorHelper(nm.first,nm.second);}void operator()()const{}templatevoid operator()(H&&h,T&&... t)const{scan(h);operator()(std::forward(t)...\ );}private:templateclass,class...>struct Column;templateclass V,class Head,class... Tail>struct Column{tem\ plateusing vec=V,Args...>;using type=typename C\ olumn::type;};templateclass V>struct Column{u\ sing type=V<>;};templateusing column_t=typename Column::type;templatevoid column_impl(T&t)const{if constex\ pr(N){auto&vec=std::get(t);using V=typename std::remove_\ reference_t::value_type;vec.push_back(read());column_impl\ (t);}}public:templateauto column(std::size_t h)const{column_tr\ esult;while(h--)column_impl(result);return result;}}in; #define inputs(T,...)\ T __VA_ARGS__;\in(__VA_ARGS__) #define ini(...)inputs(int,__VA_ARGS__) #define inl(...)inputs(long long,__VA_ARGS__) #define ins(...)inputs(std::string,__VA_ARGS__) #include #include #include #include #include #include class Printer{public:struct BoolString{std::string_view t,f;BoolString(std::stri\ ng_view _t,std::string_view _f): t(_t),f(_f){}};struct Separator{std::string_vie\ w div,sep,last;Separator(std::string_view _div,std::string_view _sep,std::string\ _view _last): div(_div),sep(_sep),last(_last){}};inline static const BoolString \ Yes{"Yes","No"},yes{"yes","no"},YES{"YES","NO"},Int{"1","0"},Possible{"Possible"\ ,"Impossible"};inline static const Separator space{" "," ","\n"},no_space{"","",\ "\n"},endl{"\n","\n","\n"},comma{",",",","\n"},no_endl{" "," ",""},sep_endl{" ",\ "\n","\n"};BoolString bool_str{Yes};Separator separator{space};void print(int v)\ const{char buf[12]{};if(auto [ptr,e]=std::to_chars(std::begin(buf),std::end(buf)\ ,v);e==std::errc{}){print(std::string_view(buf,ptr-buf));}else{assert(false);}}v\ oid print(long long v)const{char buf[21]{};if(auto [ptr,e]=std::to_chars(std::be\ gin(buf),std::end(buf),v);e==std::errc{}){print(std::string_view(buf,ptr-buf));}\ else{assert(false);}}void print(bool v)const{print(v ? bool_str.t : bool_str.f);\ }void print(std::vector::reference v)const{print(v ? bool_str.t : bool_str\ .f);}void print(char v)const{putchar_unlocked(v);}void print(std::string_view v)\ const{fwrite_unlocked(v.data(),sizeof(std::string_view::value_type),v.size(),std\ out);}void print(double v)const{std::printf("%.20f",v);}void print(long double v\ )const{std::printf("%.20Lf",v);}templatevoid print(const T&v)const{std:\ :cout<void print(const std::pair&v)const{print\ (v.first);print(separator.div);print(v.second);}templatevoid print(cons\ t std::optional&v)const{print(*v);}templatevoid print_ra\ nge(const InputIterater&begin,const InputIterater&end)const{for(InputIterater i=\ begin;i!=end;++i){if(i!=begin)print(separator.sep);print(*i);}}template\ void print(const std::vector&v)const{print_range(v.begin(),v.end());}template\ void print(const std::array&v)const{print_range(v.be\ gin(),v.end());}templatevoid print(const std::vector>&v)\ const{for(std::size_t i=0;iPrinter&operator()(Head&&head){print\ (head);print(separator.last);return*this;}templatePrin\ ter&operator()(Head&&head,Tail&&... tail){print(head);print(separator.sep);retur\ n operator()(std::forward(tail)...);}templatePrinter&flag(b\ ool f,Args&&... args){if(f){return operator()(std::forward(args)...);}else\ {return*this;}}templatePrinter&range(const InputIterator&be\ gin,const InputIterator&end){print_range(begin,end);print(separator.last);return\ *this;}templatePrinter&range(const Container&a){range(a.begin()\ ,a.end());return*this;}templatevoid exit(T&&... t){operator()(std::f\ orward(t)...);std::exit(EXIT_SUCCESS);}Printer&flush(){fflush_unlocked(stdout\ );return*this;}Printer&set(const BoolString&_bool_str){bool_str=_bool_str;return\ *this;}Printer&set(const Separator&_separator){separator=_separator;return*this;\ }Printer&set(std::string_view t,std::string_view f){bool_str=BoolString(t,f);ret\ urn*this;}}out; #include #include templateclass step_iterator{public:using value_type=T;using difference_\ type=T;using iterator_category=std::random_access_iterator_tag;using reference=T\ &;using pointer=T*;private:value_type start_m,size_m,step_m,index_m;public:const\ expr step_iterator(): start_m(value_type()),size_m(value_type()),step_m(value_ty\ pe()),index_m(0){}constexpr step_iterator(value_type _start,value_type _size,val\ ue_type _step): start_m(_start),size_m(_size),step_m(_step),index_m(0){}value_ty\ pe operator*()const noexcept{return value();}step_iterator&operator++()noexcept{\ ++index_m;return*this;}step_iterator&operator++(int)noexcept{auto tmp=*this;++*t\ his;return tmp;}step_iterator&operator--()noexcept{--index_m;return*this;}step_i\ terator&operator--(int)noexcept{auto tmp=*this;--*this;return tmp;}step_iterator\ &operator+=(difference_type n){index_m+=n;return*this;}step_iterator operator+(d\ ifference_type n)const{return step_iterator(*this)+=n;}friend step_iterator oper\ ator+(difference_type n,step_iterator i){return i+n;}step_iterator&operator-=(di\ fference_type n){index_m-=n;return*this;}step_iterator operator-(difference_type\ n)const{return step_iterator(*this)-=n;}friend step_iterator operator-(differen\ ce_type n,step_iterator i){return i-n;}difference_type operator-(const step_iter\ ator&other)const{assert(start_m==other.start_m);assert(size_m==other.size_m);ass\ ert(step_m==other.step_m);return index_m-other.index_m;}bool operator==(const st\ ep_iterator&other)const noexcept{return value()==other.value();}bool operator!=(\ const step_iterator&other)const noexcept{return value()!=other.value();}bool ope\ rator<(const step_iterator&other)const noexcept{return value()(const step_iterator&other)const noexcept{return value()>oth\ er.value();}bool operator>=(const step_iterator&other)const noexcept{return valu\ e()>=other.value();}constexpr value_type value()const noexcept{return start_m+st\ ep_m*index_m;}};templateclass Step{public:using value_type=T;using iter\ ator=step_iterator;private:value_type start_m,size_m,step_m;public:c\ onstexpr Step(value_type _start,value_type _size,value_type _step): start_m(_sta\ rt),size_m(std::max(0,_size)),step_m(_step){}constexpr iterator begi\ n()const{return iterator(start_m,size_m,step_m);}constexpr iterator end()const{r\ eturn iterator(start_m,size_m,step_m)+size_m;}constexpr value_type start()const{\ return start_m;}constexpr value_type size()const{return size_m;}constexpr value_\ type step()const{return step_m;}constexpr value_type sum()const{return start()*s\ ize()+step()*(size()*(size()-1)/2);}operator std::vector()const{retu\ rn to_a();}auto to_a()const{std::vectorresult;result.reserve(size())\ ;for(auto i :*this){result.push_back(i);}return result;}};templateconst\ expr auto upto(T from,T to,bool exclusive=true){return Step(from,to-from+excl\ usive,1);}templateconstexpr auto downto(T from,T to,bool exclusive=true\ ){return Step(from,from-to+exclusive,-1);}templateconstexpr auto tim\ es(T n,bool exclusive=false){return Step(0,n+static_cast(exclusive),1);} #include #include templatestruct Callable{F func;Callable(const F&f): func(f){}};template\ auto operator|(const T&v,const Callable&c){return c.func(v);\ }struct Sort_impl{templateauto operator()(F&&f){return Callable([&](aut\ o v){std::sort(std::begin(v),std::end(v),f);return v;});}templatefriend\ auto operator|(T v,[[maybe_unused]] const Sort_impl&c){std::sort(std::begin(v),\ std::end(v));return v;}}Sort;struct SortBy_impl{templateauto operator()\ (F&&f){return Callable([&](auto v){std::sort(std::begin(v),std::end(v),[&](const\ auto&i,const auto&j){return f(i)auto operator()(F&&f){return Callable([&](auto v){std::sort(rb\ egin(v),rend(v),f);return v;});}templatefriend auto operator|(T v,[[may\ be_unused]] const RSort_impl&c){std::sort(rbegin(v),rend(v));return v;}}RSort;st\ ruct RSortBy_impl{templateauto operator()(F&&f){return Callable([&](aut\ o v){std::sort(std::begin(v),std::end(v),[&](const auto&i,const auto&j){return f\ (i)>f(j);});return v;});}}RSortBy;struct Reverse_impl{templatefriend au\ to operator|(T v,const Reverse_impl&c){std::reverse(std::begin(v),std::end(v));r\ eturn v;}}Reverse;struct Unique_impl{templatefriend auto operator|(T v,\ const Unique_impl&c){v.erase(std::unique(std::begin(v),std::end(v),std::end(v)))\ ;return v;}templateauto operator()(F&&f){return Callable([&](au\ to v){v.erase(std::unique(std::begin(v),std::end(v),f),std::end(v));return v;});\ }}Unique;struct Uniq_impl{templatefriend auto operator|(T v,const Uniq_\ impl&c){std::sort(std::begin(v),std::end(v));v.erase(std::unique(std::begin(v),s\ td::end(v)),std::end(v));return v;}}Uniq;struct Rotate_impl{auto operator()(int&\ &left){return Callable([&](auto v){int s=static_cast(std::size(v));assert(-\ s<=left&&left<=s);if(0<=left){std::rotate(std::begin(v),std::begin(v)+left,std::\ end(v));}else{std::rotate(std::begin(v),std::end(v)+left,std::end(v));}return v;\ });}}Rotate;struct Max_impl{templateauto operator()(F&&f){return Callab\ le([&](auto v){return*std::max_element(std::begin(v),std::end(v),f);});}template\ friend auto operator|(T v,const Max_impl&c){return*std::max_element(std\ ::begin(v),std::end(v));}}Max;struct Min_impl{templateauto operator()(F\ &&f){return Callable([&](auto v){return*std::min_element(std::begin(v),std::end(\ v),f);});}templatefriend auto operator|(T v,const Min_impl&c){return*st\ d::min_element(std::begin(v),std::end(v));}}Min;struct MaxPos_impl{templatefriend auto operator|(T v,const MaxPos_impl&c){return std::max_element(std::\ begin(v),std::end(v))-std::begin(v);}}MaxPos;struct MinPos_impl{templatefriend auto operator|(T v,const MinPos_impl&c){return std::min_element(std::beg\ in(v),std::end(v))-std::begin(v);}}MinPos;struct MaxBy_impl{templateaut\ o operator()(F&&f){return Callable([&](auto v){auto max_it=std::begin(v);auto ma\ x_val=f(*max_it);for(auto it=std::next(std::begin(v));it!=std::end(v);++it){if(a\ uto val=f(*it);max_valauto operator()(F&&f){return Callable([&](auto v\ ){auto min_it=std::begin(v);auto min_val=f(*min_it);for(auto it=std::next(std::b\ egin(v));it!=std::end(v);++it){if(auto val=f(*it);min_val>val){min_it=it;min_val\ =val;}}return*min_it;});}}MinBy;struct MaxOf_impl{templateauto operator\ ()(F&&f){return Callable([&](auto v){auto max_val=f(*std::begin(v));for(auto it=\ std::next(std::begin(v));it!=std::end(v);++it){if(auto val=f(*it);max_valauto o\ perator()(F&&f){return Callable([&](auto v){auto min_val=f(*std::begin(v));for(a\ uto it=std::next(std::begin(v));it!=std::end(v);++it){if(auto val=f(*it);min_val\ >val){min_val=val;}}return min_val;});}}MinOf;struct Count_impl{templateauto operator()(const V&val){return Callable([&](auto v){return std::count(std:\ :begin(v),std::end(v),val);});}}Count;struct CountIf_impl{templateauto \ operator()(const F&f){return Callable([&](auto v){return std::count_if(std::begi\ n(v),std::end(v),f);});}}CountIf;struct Index_impl{templateauto operato\ r()(const V&val){return Callable([&](auto v)->std::optional{auto result=std\ ::find(std::begin(v),std::end(v),val);return result!=std::end(v)? std::optional(\ result-std::begin(v)): std::nullopt;});}templateauto operator()(const V\ &val,std::size_t i){return Callable([&](auto v)->std::optional{auto result=\ std::find(std::next(std::begin(v),i),std::end(v),val);return result!=std::end(v)\ ? std::optional(result-std::begin(v)): std::nullopt;});}}Index;struct IndexIf_im\ pl{templateauto operator()(const F&f){return Callable([&](auto v)->std:\ :optional{auto result=std::find_if(std::begin(v),std::end(v),f);return resu\ lt!=std::end(v)? std::optional(result-std::begin(v)): std::nullopt;});}}IndexIf;\ struct FindIf_impl{templateauto operator()(const F&f){return Callable([\ &](auto v)->std::optional{auto result=std::fin\ d_if(std::begin(v),std::end(v),f);return result!=std::end(v)? std::optional(*res\ ult): std::nullopt;});}}FindIf;struct Sum_impl{templateauto operator()(\ F&&f){return Callable([&](auto v){return std::accumulate(std::next(std::begin(v)\ ),std::end(v),f(*std::begin(v)),[&](const auto&a,const auto&b){return a+f(b);});\ });}templatefriend auto operator|(T v,[[maybe_unused]] const Sum_impl&c\ ){return std::accumulate(std::begin(v),std::end(v),typename T::value_type{});}}S\ um;struct Includes{templateauto operator()(const V&val){return Callable\ ([&](auto v){return std::find(std::begin(v),std::end(v),val)!=std::end(v);});}}I\ ncludes;struct IncludesIf_impl{templateauto operator()(const F&f){retur\ n Callable([&](auto v){return std::find_if(std::begin(v),std::end(v),f)!=std::en\ d(v);});}}IncludesIf;struct RemoveIf_impl{templateauto operator()(const\ F&f){return Callable([&](auto v){v.erase(std::remove_if(std::begin(v),std::end(\ v),f),std::end(v));return v;});}}RemoveIf;struct Each_impl{templateauto\ operator()(F&&f){return Callable([&](auto v){for(const auto&i : v){f(i);}});}}E\ ach;struct EachConsPair_impl{templatefriend auto operator|(const T&v,EachConsPair_impl&c){std::vector>result;if(std::size(v)>=2){result.reserve(std::size(v)-1\ );for(std::size_t i=0;iauto operator()(\ F&&f){return Callable([&](auto v){using value_type=typename decltype(v)::value_t\ ype;std::vectorresult;for(const auto&i : v){if(f(i))result.push_back\ (i);}return result;});}}Select;struct Map_impl{templateauto operator()(\ F&&f){return Callable([&](auto v){using result_type=std::invoke_result_t;std::vectorresult;result.reserve(std::\ size(v));for(const auto&i : v){result.push_back(f(i));}return result;});}}Map;st\ ruct Indexed_impl{templatefriend auto operator|(const T&v,Indexed_impl&\ c){using value_type=typename T::value_type;std::vector\ >result;result.reserve(std::size(v));int index=0;for(const auto&i : v){result.em\ place_back(i,index++);}return result;}}Indexed;struct AllOf_impl{templateauto operator()(F&&f){return Callable([&](auto v){for(const auto&i : v){if(!f(\ i))return false;}return true;});}}AllOf;struct AnyOf_impl{templateauto \ operator()(F&&f){return Callable([&](auto v){for(const auto&i : v){if(f(i))retur\ n true;}return false;});}}AnyOf;struct NoneOf_impl{templateauto operato\ r()(F&&f){return Callable([&](auto v){for(const auto&i : v){if(f(i))return false\ ;}return true;});}}NoneOf;struct Tally_impl{auto operator()(std::size_t max_val)\ {return Callable([&](auto v){std::vectorresult(max_val);for(const a\ uto&i : v){result[static_cast(i)]++;}return result;});}templatefriend auto operator|(const T&v,Tal\ ly_impl&c){std::mapresult;for(const auto&i : v){result[i\ ]++;}return result;}}Tally;struct Reduce_impl{templateauto oper\ ator()(T memo,F f){return Callable([memo,f](auto v){auto acc=memo;for(auto i : v\ ){acc=f(acc,i);}return acc;});}}Reduce;struct Join_impl{auto operator()(std::str\ ing separater){return Callable([&](auto v){std::string result;bool first=true;fo\ r(const auto&i : v){if(!std::exchange(first,false)){result+=separater;}result+=s\ td::to_string(i);}return result;});}templatefriend auto operator|(const\ T&v,Join_impl&c){return v|c("");}}Join;struct Slice_impl{auto operator()(std::s\ ize_t i,std::size_t cnt){return Callable([i,cnt](auto v){return decltype(v)(std:\ :begin(v)+i,std::begin(v)+i+cnt);});}}Slice;struct Transpose_impl{templatefriend auto operator|(const std::vector>&v,Transpose_impl&c){s\ td::size_t h=v.size(),w=v.front().size();std::vector result(w,std::vector(h))\ ;for(std::size_t i=0;iauto operato\ r*(const std::vector&a,std::size_t n){T result;for(std::size_t i=0;istruct\ has_push_back : std::false_type{};templatestruct has_push_back\ ().push_back(std::declval()))>>: std\ ::true_type{};}template::value,std::nullptr_t> =nullptr>auto&operator<<(Container&c\ ontiner,const T&val){continer.push_back(val);return continer;}template::value,std:\ :nullptr_t> =nullptr>auto operator+(Container continer,const T&val){continer< templateconstexpr T TEN(std::size_t n){T result=1;for(std::si\ ze_t i=0;i&&std::is_integral_v,std::nullptr_t> =nullptr>conste\ xpr auto div_ceil(T n,U m){return(n+m-1)/m;}templateconstexpr a\ uto div_ceil2(T n,U m){return div_ceil(n,m)*m;}templateconstexpr T tria\ ngle(T n){return(n&1)?(n+1)/2*n : n/2*(n+1);}templateconstexpr T nC2(T \ n){return(n&1)?(n-1)/2*n : n/2*(n-1);}templateconstexpr auto mi\ ddle(const T&l,const U&r){return l+(r-l)/2;}templatecon\ stexpr bool in_range(const T&v,const U&lower,const V&upper){return lower<=v&&v,std::nullptr_t> =nu\ llptr>constexpr bool is_square(T n){T s=std::sqrt(n);return s*s==n||(s+1)*(s+1)=\ =n;}templateconstexpr T BIT(int b){return T(1)<constexpr int BIT(T x,int i){return(x&(T(1)<constexpr int Sgn(T x){return(0x);}templatebool is_leap(T year)\ {return!(year%4)&&(year%100||!(year%400));}template,std::nullptr_t> =nullptr>constexpr T Pow(T a,U n){asse\ rt(n>=0);T result=1;while(n>0){if(n&1){result*=a;n--;}else{a*=a;n>>=1;}}return r\ esult;}template,std::null\ ptr_t> =nullptr>constexpr T Powmod(T a,U n,T mod){assert(n>=0);if(a>mod)a%=mod;T \ result=1;while(n>0){if(n&1){result=result*a%mod;n--;}else{a=a*a%mod;n>>=1;}}retu\ rn result;}templatebool chmax(T&a,const T&b){return abool chmin(T&a,const T&b){return a>b ? a=b,true : false;}t\ emplateint sz(const T&v){return v.size();}templateint \ lower_index(const T&a,const U&v){return std::lower_bound(all(a),v)-a.begin();}te\ mplateint upper_index(const T&a,const U&v){return std::upper_bo\ und(all(a),v)-a.begin();}templateU Gcdv(\ const T&v){return accumulate(next(v.begin()),v.end(),U(*v.begin()),std::gcd\ );}templateU Lcmv(const T&v){return accu\ mulate(next(v.begin()),v.end(),U(*v.begin()),std::lcm);}namespace internal{\ templateauto make_vector(std::vector&sizes,const T&i\ nit){if constexpr(N==1){return std::vector(sizes[0],init);}else{int size=sizes[N\ -1];sizes.pop_back();return std::vector(size,make_vector(sizes,init));}}}\ templateauto make_vector(const int(&sizes)[N],const T&ini\ t=T()){std::vector s(std::rbegin(sizes),std::rend(sizes));return internal::make_\ vector(s,init);}namespace lambda{auto char_to_int=[](char c){return c-'0';}\ ;auto lower_to_int=[](char c){return c-'a';};auto upper_to_int=[](char c){return\ c-'A';};auto int_to_char=[](int i)->char{return '0'+i;};auto int_to_lower=[](in\ t i)->char{return 'a'+i;};auto int_to_upper=[](int i)->char{return 'A'+i;};auto \ is_odd=[](auto n){return n%2==1;};auto is_even=[](auto n){return n%2==0;};auto i\ s_positive=[](auto n){return n>0;};auto is_negative=[](auto n){return n<0;};auto\ increment=[](auto n){return++n;};auto decrement=[](auto n){return--n;};auto yie\ ld_self=[](const auto&n){return n;};auto first=[](const auto&n){return n.first;}\ ;auto second=[](const auto&n){return n.second;};templateauto cast(){ret\ urn [](const auto&n){return static_cast(n);};};templateauto equal_to\ (const T&x){return [x](auto y){return x==y;};}templateauto get(){\ return [](const auto&n){return std::get(n);};}templateauto cmp(F&&f)\ {return [f](const auto&a,const auto&b){return f(a)) #include #define LOCAL #else #define dump(...)((void)0) #endif #include templateconstexpr T oj_local(const T&oj,const T&local){ #ifndef LOCAL return oj; #else return local; #endif } using namespace std;int main(){int n=in,k=in;VL a=in[n];auto calc=[&](const VI&b\ ,int x_ind){if(0<=x_ind&&x_ind