/* #include void self::main(){ LL(N,K); VL(N,a); sort(a); use_ml1000000007 ml ans=1; of(i,N){ if(a[i]*2>K){ ll j=a.first_gt(K-a[i]).dist(); ans*=j-(N-1-i); } else{ ll n=i+1-(N-1-i); ans*=fac(n)*fac_inv(n/2)*ml(2).inv().pow(n/2); break; } } pp(ans); } */ #include #include using namespace std; namespace self{void main();void sub();void pp(auto&&...a);void ppe(auto&&...a);} int main(){cin.tie(nullptr)->sync_with_stdio(0);cout<__VA_ARGS__;fe(refs(__VA_ARGS__),e)e.get().resizes(n);lin(__VA_ARGS__) #define VL(n,...) RDVL(ll,n,__VA_ARGS__) #define fo(i,...) for(auto[i,i##stop,i##step]=for_range(0,__VA_ARGS__);i(1,__VA_ARGS__);i>=i##stop;i+=i##step) #define fe(a,e,...) for(auto&&__VA_OPT__([)e __VA_OPT__(,__VA_ARGS__]):a) #define use_ml1000000007 using ml=atcoder::modint1000000007; namespace self{ auto&operator<<(ostream&o,const atcoder::modint1000000007&x){return o<<(int)x.val();} using ll=long long; constexpr auto refs(auto&...a){return array{ref(a)...};} templateconstexpr auto for_range(T s,T b){T a=0;if(s)swap(a,b);return array{a-s,b,1-s*2};} templateconstexpr auto for_range(T s,T a,T b,T c=1){return array{a-s,b,(1-s*2)*c};} void lin(auto&...a){(cin>>...>>a);} template>decltype(auto)sort(auto&&a,F f={}){ranges::sort(a,f);return a;} templateusing pack_back_t=tuple_element_t>; templateclass Iterator{ private: I it_,begin_,end_; public: Iterator(I it,I begin,I end):it_(it),begin_(begin),end_(end){} ll dist()const{return it_-begin_;} }; } namespace self{ templateistream&operator>>(istream&i,vector&v){fe(v,e)i>>e;return i;} templateconstexpr int depth=0; templatestruct core_t_helper{using type=T;}; templateusing core_t=core_t_helper::type; templatestruct vec; templatestruct hvec_helper{using type=vec::type>;}; templatestruct hvec_helper<0,T>{using type=T;}; templateusing hvec=hvec_helper::type; templatestruct vec:vector{ static constexpr int D=depth+1; using C=core_t; using vector::vector; void resizes(const auto&...a){if constexpr(sizeof...(a)==D)*this=make(a...,C{});else{ }} static auto make(ll n,const auto&...a){ if constexpr(sizeof...(a)==1)return vec(n,array{a...}[0]); else { } } ll size()const{return vector::size();} auto first_true(const V&x,auto&&f)const{ auto b=this->begin(),e=this->end(); auto p=partition_point(b,e,[&x,&f](const V&v){return !f(x,v);}); return Iterator{p,b,e}; } auto first_gt(const V&x)const{return first_true(x,[](auto&x,auto&e){return xrequires(sizeof...(A)>=2)vec(const A&...a)->vec>>; } namespace self{ templateT fac(ll n){static vecv{1};if(ll m=v.size();m<=n){v.resize(n+1);fo(i,m,n+1)v[i]=v[i-1]*i;}return v[n];} templateT fac_inv(ll n){static vecv{1};if(ll m=v.size();m<=n){v.resize(n+1);v[n]=fac(n).inv();of(i,n,m)v[i]=v[i+1]*(i+1);}return v[n];} } void self::pp(auto&&...a){const char*c="";((cout<K){ ll j=a.first_gt(K-a[i]).dist(); ans*=j-(N-1-i); } else{ ll n=i+1-(N-1-i); ans*=fac(n)*fac_inv(n/2)*ml(2).inv().pow(n/2); break; } } pp(ans); }