C# Simple Solution 🔍
Code\n\npublic class Solution {\n    public long MatrixSumQueries(int n, int[][] queries) {\n        Dictionary<int,int> cols = new Dictionary<int,int>();\n    
# Code\n```\npublic class Solution {\n    public long MatrixSumQueries(int n, int[][] queries) {\n        Dictionary<int,int> cols = new Dictionary<int,int>();\n        Dictionary<int,int> rows = new Dictionary<int,int>();\n        int colnum = 0;\n        int rownum = 0;\n        long ans = 0;\n        for (int i = queries.Length-1; i >= 0; i--)\n        {\n            int index = queries[i][1];\n            int val = queries[i][2];\n            if (queries[i][0] == 1)\n            {\n                if (!cols.ContainsKey(index))\n                {\n                    for (int j = 0; j < n - rownum; j++)\n                    {\n                        ans += val;                   \n                    }                 \n                    cols.Add(index, 1);\n                    colnum++;\n                }                               \n            } else {\n                if (!rows.ContainsKey(index)){\n                    for (int j = 0; j < n - colnum; j++)\n                    {\n                        ans += val;\n                    }\n                    rows.Add(index, 1); \n                    rownum++;                 \n                }        \n            }       \n        }\n        return ans;\n    }\n}\n```
['C#']