```
vector<int> getModifiedArray(int length, vector<vector<int>>& updates) {
vector<int> res(length + 1);
for (auto & u : updates)
res[u[0]] += u[2], res[u[1] + 1] += -u[2];
for (int i = 1; i < res.size(); ++i)
res[i] += res[i - 1];
return res.pop_back(), res;
}
```

The code shouldn't be too hard to understand, leave comments if you have questions.