func_code_string: #include <bits/stdc++.h>   using namespace std;   const int INF = 1000000000;   const int prime = 9241;   const long double pi = acos(-1.);   int in[100005];   int masks[1000005];   bool used[1 << 22];   int main() {     int n, m, d;     scanf( %d%d%d , &n, &m, &d);     for (int i = 0; i < m; i++) {       int s;       scanf( %d , &s);       for (int j = 0; j < s; j++) {         int a;         scanf( %d , &a);         a--;         in[a] = i;       }     }     int cur[25] = {};     for (int i = 0; i < m; i++) cur[i] = 0;     for (int i = 0; i < d; i++) cur[in[i]]++;     int mcnt = 0;     masks[0] = 0;     for (int i = 0; i < m; i++)       if (cur[i] > 0) masks[0] |= 1 << i;     mcnt++;     for (int i = d; i < n; i++) {       cur[in[i - d]]--;       cur[in[i]]++;       masks[mcnt] = 0;       for (int j = 0; j < m; j++)         if (cur[j] > 0) masks[mcnt] |= 1 << j;       mcnt++;     }     queue<int> q;     for (int i = 0; i < (1 << m); i++) used[i] = 0;     for (int i = 0; i < mcnt; i++) {       q.push(masks[i]);       used[masks[i]] = 1;     }     while (!q.empty()) {       int cur = q.front();       q.pop();       for (int i = 0; i < m; i++) {         if (cur & (1 << i)) continue;         int nw = cur | (1 << i);         if (!used[nw]) {           used[nw] = 1;           q.push(nw);         }       }     }     int ans = 1000;     for (int i = 0; i < (1 << m); i++)       if (!used[i]) ans = min(ans, m - __builtin_popcount(i));     cout << ans << endl;     return 0;   }   