c++ solution using prefix sum(xor)
\nclass Solution {\npublic:\n    int kthLargestValue(vector<vector<int>>& mat, int k)\n    {\n        vector<int>v;\n        int n=mat.size();\n        int m=ma
```\nclass Solution {\npublic:\n    int kthLargestValue(vector<vector<int>>& mat, int k)\n    {\n        vector<int>v;\n        int n=mat.size();\n        int m=mat[0].size();\n        vector<vector<int>>dp(n+1,vector<int>(m+1,0));\n        for(int i=1;i<=n;i++)\n        {\n            for(int j=1;j<=m;j++)\n            {\n                dp[i][j]=mat[i-1][j-1]^dp[i][j]^dp[i-1][j]^dp[i][j-1]^dp[i-1][j-1];\n            }\n        }\n        priority_queue<int,vector<int>,greater<int>>pq;\n        for(int i=1;i<=n;i++)\n        {\n            for(int j=1;j<=m;j++)\n            {\n                if(pq.size()<k)\n                {\n                    pq.push(dp[i][j]);\n                }\n                else\n                {\n                    if(dp[i][j]>pq.top())\n                    {\n                        pq.pop();\n                        pq.push(dp[i][j]);\n                    }\n                    \n                }\n            }\n        }\n\n        return pq.top();\n        \n    }\n};\n```
[]