#if !__INCLUDE_LEVEL__ #include __FILE__ struct Solver { void solve() { const int n=19; V> a(n); rep(i,n){ int l;cin>>l; a[i].resize(l); rep(j,l){ cin>>a[i][j]; a[i][j]--; } } V>> dp(2,V> (1<(2))); dp[0][0][0]=1; auto f = [&](const int &k,const int &x,const int &l){ int res=l; rep(i,x){ if((k>>i)&1)res++; } return res&1; }; int now=0; rep(i,n){ now=1-now; rep(j,sz(a[i])){ int ai=a[i][j]; rep(k,1<>ai)&1)continue; rep(l,2){ int t=f(k,ai,l); dp[now][k|(1< #include using namespace atcoder; // #include // #include // using namespace __gnu_pbds; using namespace std; // #define int ll using ll=long long; using ld = long double; using uint = unsigned; using ull = unsigned long long; using P=pair; using TP=tuple; template using V = vector; template using max_heap = priority_queue; template using min_heap = priority_queue, greater<>>; #define FOR1(a) for (ll _ = 0; _ < ll(a); ++_) #define FOR2(i, a) for (ll i = 0; i < ll(a); ++i) #define FOR3(i, a, b) for (ll i = a; i < ll(b); ++i) #define FOR4(i, a, b, c) for (ll i = a; i < ll(b); i += (c)) #define FOR1_R(a) for (ll i = (a)-1; i >= ll(0); --i) #define FOR2_R(i, a) for (ll i = (a)-1; i >= ll(0); --i) #define FOR3_R(i, a, b) for (ll i = (b)-1; i >= ll(a); --i) #define FOR4_R(i, a, b, c) for (ll i = (b)-1; i >= ll(a); i -= (c)) #define overload4(a, b, c, d, e, ...) e #define rep(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__) #define rrep(...) overload4(__VA_ARGS__, FOR4_R, FOR3_R, FOR2_R, FOR1_R)(__VA_ARGS__) #define fore(i,a) for(auto &i:a) #define all(x) x.begin(),x.end() #define sz(x) ((int)(x).size()) #define bp(x) (__builtin_popcountll((long long)(x))) #define elif else if #define mpa make_pair #define bit(n) (1LL<<(n)) #define LB(c, x) distance((c).begin(), lower_bound(all(c), (x))) #define UB(c, x) distance((c).begin(), upper_bound(all(c), (x))) #define UNIQUE(x) sort(all(x)), x.erase(unique(all(x)), x.end()) templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (bstring join(const T&v,const string& d=""){stringstream s;rep(i,sz(v))(i?s<ostream& operator<<(ostream&o,const vector&v){if(sz(v))o<ostream& operator<<(ostream&o,const pair&v){return o<bool mins(T1& x,const T2&y){if(x>y){x=y;return true;}else return false;} templatebool maxs(T1& x,const T2&y){if(xTx dup(Tx x, Ty y){return (x+y-1)/y;} templatell suma(const vector&a){ll res(0);for(auto&&x:a)res+=x;return res;} templatell suma(const V>&a){ll res(0);for(auto&&x:a)res+=suma(x);return res;} templatevoid uni(T& a){sort(rng(a));a.erase(unique(rng(a)),a.end());} templatevoid prepend(vector&a,const T&x){a.insert(a.begin(),x);} const int INF = 1001001001; const ll INFL = 3e18; const int MAX = 2e6+5; #endif