+1/-1 trick
Intuition\nif you want to increase array from [l,r] you can increase l by 1 and decrease r by 1 then take prefix sum of it;\nin this case need to inc/dec by x s
# Intuition\nif you want to increase array from [l,r] you can increase l by 1 and decrease r by 1 then take prefix sum of it;\nin this case need to inc/dec by x so increse l by x and decrease r+1 by x\nTo do so you have to create vector of size n+1 to take of bound(created by r+1 term)\nthen simply take prefix sum and remove that n+1th term. \n\n\n# Code\n```\nclass Solution {\npublic:\n    vector<vector<int>> rangeAddQueries(int n, vector<vector<int>>& q) {\n        vector<vector<int>>ans(n+1,vector<int>(n+1,0));\n        for(int i=0;i<q.size();i++){\n            for(int j=q[i][0];j<=q[i][2];j++){\n                ans[j][q[i][1]]++;\n                ans[j][q[i][3]+1]--; \n            }\n        }\n        ans.pop_back();\n        for(int i=0;i<n;i++){\n            ans[i].pop_back();\n            for(int j=1;j<n;j++){\n                ans[i][j]+=ans[i][j-1];\n            }\n        }\n        return ans;\n    }\n};\n```
['C++']