C++ Prefix Array & Heap Based Solution 
Complexity
Time complexity: O(n∗mlog(n∗m))

Space complexity: O(n∗m)
Code


# Complexity
- Time complexity: $$O(n*mlog(n*m))$$ 
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: $$O(n*m )$$ 
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    int kthLargestValue(vector<vector<int>>& grid, int k) {
        int n = grid.size(),m=grid[0].size();
        vector<vector<int>>v(n,vector<int>(m,0));
        priority_queue<int,vector<int>,greater<int>>pq;
        
        // filling prefix-xors column wise
        for(int j=0;j<m;j++){
            int curr = 0;
            for(int i=0;i<n;i++){
                curr^=grid[i][j];
                v[i][j] = curr;
            }
        }

        for(int i=0;i<n;i++){
            int curr = 0;
            for(int j=0;j<m;j++){
                curr^=v[i][j];
                if(pq.size()<k)
                    pq.push(curr);
                else if(pq.top()<curr){
                    pq.pop();
                    pq.push(curr);
                }
            }
        }
        return pq.top();
    }
};
```
['Heap (Priority Queue)', 'Prefix Sum', 'C++']