Python3 - Very readable and easy to understand solution
Code\npython3 []\nclass Solution:\n    def matrixSumQueries(self, n: int, queries: List[List[int]]) -> int:\n        seenRow, seenColumn = set(), set()\n       
# Code\n```python3 []\nclass Solution:\n    def matrixSumQueries(self, n: int, queries: List[List[int]]) -> int:\n        seenRow, seenColumn = set(), set()\n        sumOf = 0\n        for query in reversed(queries):\n            changeRow, index, value = query[0] == 0, query[1], query[2]\n            if changeRow and index not in seenRow:\n                seenRow.add(index)\n                sumOf += (value * (n - len(seenColumn)))\n                continue\n            \n            if not changeRow and index not in seenColumn:\n                seenColumn.add(index)\n                sumOf += (value * (n - len(seenRow)))\n                continue\n\n        return sumOf\n```
['Python3']