func_code_string: #include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   #pragma GCC optimize( unroll-loops )   using namespace std;   using pii = pair<int, int>;   const int MOD = 1e9 + 7, N = 2e3 + 10;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long n;     cin >> n;     vector<pair<long long, long long>> v(n);     for (long long i = 0; i < n; i++) {       long long x;       cin >> x;       long long cm = -1;       long long salary;       for (long long i = 0; i < x; i++) {         cin >> salary;         if (salary > cm) cm = salary;       }       v[i].first = cm;       v[i].second = x;     }     sort(v.begin(), v.end());     long long sum = 0;     for (long long i = 0; i < n; i++) {       sum += (v[n - 1].first - v[i].first) * v[i].second;     }     cout << sum;   }   