func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 500;   int a[maxn];   int main(void) {     int n, m;     cin >> n >> m;     int ans = 0;     for (int i = 1; i <= m; i++) {       int num;       scanf( %d , &num);       int x, temp;       int flag = 0;       scanf( %d , &x);       temp = x;       if (x == 1) flag = 1;       for (int j = 2; j <= num; j++) {         scanf( %d , &x);         if (flag == 1 && x == temp + 1) {           temp = x;           continue;         }         if (x == 1) {           temp = x;           flag = 1;         } else {           flag = 0;           ans++;         }       }     }     ans = ans + ans + m - 1;     cout << ans << endl;   }   