vector<vector<int>> sum(n, vector<int> (n, 0)); code example Example: sum of vector c++ accumulate(a.begin(), a.end(), 0);