func_code_string: #include <bits/stdc++.h>   using namespace std;   template <class T>   inline T bigmod(T p, T e, T M) {     long long ret = 1;     for (; e > 0; e >>= 1) {       if (e & 1) ret = (ret * p) % M;       p = (p * p) % M;     }     return (T)ret;   }   template <class T>   inline T gcd(T a, T b) {     if (b == 0) return a;     return gcd(b, a % b);   }   template <class T>   inline T modinverse(T a, T M) {     return bigmod(a, M - 2, M);   }   template <class T>   inline T lcm(T a, T b) {     a = abs(a);     b = abs(b);     return (a / gcd(a, b)) * b;   }   template <class T, class X>   inline bool getbit(T a, X i) {     T t = 1;     return ((a & (t << i)) > 0);   }   template <class T, class X>   inline T setbit(T a, X i) {     T t = 1;     return (a | (t << i));   }   template <class T, class X>   inline T resetbit(T a, X i) {     T t = 1;     return (a & (~(t << i)));   }   inline long long power(long long a, long long b) {     long long multiply = 1;     for (int i = (0); i < (b); i++) {       multiply *= a;     }     return multiply;   }   vector<int> v[102];   int main() {     int n, m, x;     int first = 0, second = 0;     cin >> n;     for (int i = (0); i < (n); i++) {       cin >> m;       for (int j = (0); j < (m); j++) {         cin >> x;         v[i].push_back(x);       }     }     vector<int> rest;     for (int i = (0); i < (n); i++) {       if (v[i].size() % 2 == 0) {         for (int j = (0); j < (v[i].size() / 2); j++) first += v[i][j];         for (int j = (v[i].size() / 2); j < (v[i].size()); j++) second += v[i][j];       } else {         for (int j = (0); j < (v[i].size() / 2); j++) first += v[i][j];         for (int j = (v[i].size() / 2 + 1); j < (v[i].size()); j++)           second += v[i][j];       }     }     for (int j = (0); j < (n); j++) {       if (v[j].size() % 2 == 0) continue;       rest.push_back(v[j][v[j].size() / 2]);     }     sort(rest.begin(), rest.end(), greater<int>());     for (int j = (0); j < (rest.size()); j++) {       if (j % 2 == 0)         first += rest[j];       else         second += rest[j];     }     cout << first <<     << second << endl;     return 0;   }   