func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     long long n, m, q;     cin >> n >> m >> q;     vector<long long> a(n, 0);     for (int i = 0; i < n; ++i) cin >> a[i];     vector<int> weights(m, 0);     vector<int> heavyListsIds;     vector<vector<int> > lists(m, vector<int>());     int heavyBorder = ceil(sqrt(0.0 + n));     int heavyCount = 0;     for (int i = 0; i < m; ++i) {       int length;       cin >> length;       if (length > heavyBorder) {         weights[i] = 42;         ++heavyCount;         heavyListsIds.push_back(i);       } else         weights[i] = 1;       lists[i].resize(length);       for (int j = 0; j < length; ++j) cin >> lists[i][j], --lists[i][j];       sort((lists[i]).begin(), (lists[i]).end());     }     vector<vector<int> > intersectionSize(m, vector<int>(heavyCount, 0));     for (int i = 0; i < (lists).size(); ++i)       for (int j = 0; j < (heavyListsIds).size(); ++j) {         int first = i, second = heavyListsIds[j];         if (first == second) continue;         if ((lists[first]).size() > (lists[second]).size()) {           int temp = first;           first = second;           second = temp;         }         for (int k = 0; k < (lists[first]).size(); ++k)           if (binary_search(lists[second].begin(), lists[second].end(),                             lists[first][k]))             ++intersectionSize[first][j];       }     vector<long long> cachedResults(heavyCount, 0), cachedUpdates(heavyCount, 0);     for (int i = 0; i < heavyCount; ++i) {       int listId = heavyListsIds[i];       for (int j = 0; j < (lists[listId]).size(); ++j)         cachedResults[i] += a[lists[listId][j]];     }     for (int i = 0; i < q; ++i) {       char c;       cin >> c;       if (c ==  + ) {         long long k, x;         cin >> k >> x;         --k;         if (weights[k] == 42) {           int heavy_k = 0;           for (int j = 0; j < heavyCount; ++j)             if (heavyListsIds[j] == k) {               heavy_k = j;               break;             }           cachedUpdates[heavy_k] += x;         } else {           for (int j = 0; j < (lists[k]).size(); ++j) a[lists[k][j]] += x;           for (int j = 0; j < heavyCount; ++j)             cachedResults[j] += intersectionSize[k][j] * x;         }       } else {         int k;         cin >> k;         --k;         if (weights[k] == 1) {           long long result = 0;           for (int j = 0; j < (lists[k]).size(); ++j) result += a[lists[k][j]];           for (int j = 0; j < heavyCount; ++j)             result += intersectionSize[k][j] * cachedUpdates[j];           cout << result << endl;         } else {           int heavy_k = 0;           for (int j = 0; j < heavyCount; ++j)             if (heavyListsIds[j] == k) {               heavy_k = j;               break;             }           long long result =               cachedResults[heavy_k] + cachedUpdates[heavy_k] * (lists[k]).size();           for (int j = 0; j < heavyCount; ++j)             result += intersectionSize[k][j] * cachedUpdates[j];           cout << result << endl;         }       }     }     return 0;   }   