Super Simple || C++
Code\ncpp []\nclass Solution \n{\npublic:\n    long long matrixSumQueries(int n, vector<vector<int>>& queries) \n    {\n        vector<set<int>> seen(2);\n     
# Code\n```cpp []\nclass Solution \n{\npublic:\n    long long matrixSumQueries(int n, vector<vector<int>>& queries) \n    {\n        vector<set<int>> seen(2);\n        int q=queries.size();\n        long long sum=0;\n        for(int x=q-1; x>=0; x--)\n        {\n            int type=queries[x][0];\n            int index=queries[x][1];\n            int val=queries[x][2];\n            if(seen[type].find(index)==seen[type].end())\n            {\n                int sz=seen[1-type].size();\n                sum+=(long long)(n-sz)*val;\n                seen[type].insert(index);\n            }\n        }\n        return sum;\n    }\n};\n```
['Hash Table', 'C++']