[Python3] prefix sum
\n\nclass Solution:\n    def rangeAddQueries(self, n: int, queries: List[List[int]]) -> List[List[int]]:\n        ans = [[0]*n for _ in range(n)]\n        for i
\n```\nclass Solution:\n    def rangeAddQueries(self, n: int, queries: List[List[int]]) -> List[List[int]]:\n        ans = [[0]*n for _ in range(n)]\n        for i, j, ii, jj in queries: \n            ans[i][j] += 1\n            if ii+1 < n: ans[ii+1][j] -= 1\n            if jj+1 < n: ans[i][jj+1] -= 1\n            if ii+1 < n and jj+1 < n: ans[ii+1][jj+1] += 1\n        for i in range(n): \n            prefix = 0 \n            for j in range(n): \n                prefix += ans[i][j]\n                ans[i][j] = prefix \n                if i: ans[i][j] += ans[i-1][j]\n        return ans \n```
['Python3']