func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = (int)1e5 + 100;   const int mod = (int)1e9 + 7;   const int maxlog = (int)20;   const int P = mod;   int n, m, q, id[maxn], sq, res, cnt[maxn][500];   long long toadd[505], a[maxn];   long long ans[505];   vector<int> g[maxn];   int main() {     ios_base::sync_with_stdio(0);     cin.tie(NULL);     cin >> n >> m >> q;     sq = 320;     for (int i = 1; i <= n; i++) cin >> a[i];     for (int i = 1; i <= m; i++) {       int k;       cin >> k;       if (k >= sq) {         id[i] = ++res;       }       for (; k--;) {         int x;         cin >> x;         g[i].push_back(x);       }     }     for (int i = 1; i <= m; i++) {       if (id[i]) {         static bool used[maxn + 5];         memset(used, 0, sizeof used);         for (int x : g[i]) ans[id[i]] += a[x], used[x]++;         for (int j = 1; j <= m; j++) {           for (int x : g[j]) {             cnt[j][id[i]] += used[x];           }         }       }     }     for (; q--;) {       char s;       cin >> s;       if (s ==  ? ) {         int k;         cin >> k;         if (id[k]) {           cout << ans[id[k]] << endl;         } else {           long long Res = 0;           for (int x : g[k]) Res += a[x];           for (int i = 1; i <= res; i++) Res += toadd[i] * cnt[k][i];           cout << Res << endl;         }       } else {         int k, val;         cin >> k >> val;         if (!id[k])           for (int x : g[k]) a[x] += val;         else           toadd[id[k]] += val;         for (int i = 1; i <= res; i++) {           ans[i] += val * 1ll * cnt[k][i];         }       }     }   }   