func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int already = 0;     int n, k;     cin >> n >> k;     int ans = 0;     for (int i = 0; i < k; ++i) {       int cnt;       cin >> cnt;       int first;       cin >> first;       if (first == 1) {         int good = 1;         already = 1;         --ans;         while (good < cnt) {           cin >> first;           if (first == good + 1) {             ++good;             already = good;             --ans;           } else {             ++good;             break;           }         }         ans += cnt;         while (good < cnt) {           cin >> first;           ++good;         }       } else {         ans += (cnt - 1);         for (int j = 1; j < cnt; ++j) cin >> first;       }     }     ans += (n - already);     cout << ans;     return 0;   }   