func_code_string: #include <bits/stdc++.h>   using namespace std;   bool graf[100][100];   int n, m;   bool visited[100];   bool spoken[100];   int stupid;   int tab[100];   int main() {     ios::sync_with_stdio(false);     cin >> n >> m;     for (int i = 0; i < n; i++) {       int x;       cin >> x;       if (x == 0) stupid++;       for (int j = 0; j < x; j++) {         cin >> tab[j];         tab[j]--;         spoken[tab[j]] = true;       }       for (int j = 0; j < x; j++) {         for (int q = j + 1; q < x; q++) {           graf[tab[j]][tab[q]] = true;           graf[tab[q]][tab[j]] = true;         }       }     }     queue<int> q;     int add = 0;     for (int i = 0; i < m; i++) {       if (!spoken[i] || visited[i]) continue;       q.push(i);       visited[i] = true;       add++;       while (!q.empty()) {         int v = q.front();         q.pop();         for (int j = 0; j < m; j++) {           if (graf[v][j] && !visited[j]) {             visited[j] = true;             q.push(j);           }         }       }     }     if (add > 0) add--;     stupid += add;     cout << stupid << endl;   }   