C++ heap solution
\nclass Solution {\npublic:\n    int kthLargestValue(vector<vector<int>>& matrix, int k) {\n        int m = matrix.size(), n = matrix[0].size();\n        vector
```\nclass Solution {\npublic:\n    int kthLargestValue(vector<vector<int>>& matrix, int k) {\n        int m = matrix.size(), n = matrix[0].size();\n        vector<vector<int>> preXOR(m, vector<int>(n));\n        priority_queue<int> pq;\n        for(int i = 0; i < m; i++){\n            for(int j = 0; j < n; j++){\n                if(i == 0 && j == 0) preXOR[i][j] = matrix[i][j];\n                else if(i == 0){\n                    preXOR[i][j] = preXOR[i][j - 1] ^ matrix[i][j];\n                }\n                else if(j == 0){\n                    preXOR[i][j] = preXOR[i - 1][j] ^ matrix[i][j];\n                }\n                else{\n                    preXOR[i][j] = preXOR[i - 1][j - 1] ^ preXOR[i - 1][j] ^ preXOR[i][j - 1] ^ matrix[i][j];\n                }\n                pq.push(preXOR[i][j]);\n            }\n        }\n        while(k-- > 1){\n            pq.pop();\n        }\n        return pq.top();\n    }\n};\n```
[]