#ifndef ONLINE_JUDGE // #define _GLIBCXX_DEBUG #endif #include #include using namespace std; using ll=long long; using ld=long double; using st=string; using P=pair; typedef atcoder::modint mint; ll inf=9e18; template auto vec(const ll (&sizes)[s], const T& init = T()){ if constexpr(i < s) return vector(sizes[i], vec(sizes, init)); else return init; } //rotate持ってなかった void rot(vector &v){ ll n=v.size(); vector w(n,0); for(ll i=0;i> &v,vector times){ for(ll i=0;i({5},0); // v[0]=17,v[1]=17,v[2]=17,v[3]=17,v[4]=14; // rot(v); // for(ll i=0;i<5;i++){ // cout<>n>>m; st s; auto v=vec({n,m},0); for(ll i=0;i>s; for(ll k=0;k({n},0); auto ww=vec({n},0); for(ll u=0;u<(1<<(n*2));u++){ // cout<({m},0); for(ll j=0;jc) { ans=c; } ww=vector(n,0); w[0]++; ww[0]=1; for(ll j=0;j