C++ || O(n^2) || Clean Code
c++\nclass Solution {\npublic:\n    vector<vector<int>> rangeAddQueries(int n, vector<vector<int>>& queries) {\n        vector<vector<int>> res(n + 1, vector<in
```c++\nclass Solution {\npublic:\n    vector<vector<int>> rangeAddQueries(int n, vector<vector<int>>& queries) {\n        vector<vector<int>> res(n + 1, vector<int>(n + 1, 0));\n        for (auto query: queries) {\n            auto x = query[0], y = query[1], toX = query[2], toY = query[3];\n            res[x][y]++, res[x][toY + 1]--, res[toX + 1][y]--, res[toX + 1][toY + 1]++;\n        }\n        for (int i = 0; i < n; i++) \n            for (int j = 0; j < n; j++) {\n                if (i) res[i][j] += res[i-1][j];\n                if (j) res[i][j] += res[i][j-1];\n                if (i && j) res[i][j] -= res[i-1][j-1];\n            }\n        res.pop_back();\n        for (auto &row: res) row.pop_back();\n        return res;\n    }\n};\n```\n\n**For more solutions, check out this \uD83C\uDFC6  [GITHUB REPOSITORY](https://github.com/MuhtasimTanmoy/playground) with over 1500+ solutions.**
[]