[Python] Solution with Explanation
Key point: x xor x xor x == x\n\nInstead of heap (priority queue), Quickselect would be perfect in this problem, like the std::nth_element in C++. \n\nHowever, 
Key point: `x xor x xor x == x`\n\nInstead of heap (priority queue), [Quickselect](https://en.wikipedia.org/wiki/Quickselect) would be perfect in this problem, like the [std::nth_element](https://en.cppreference.com/w/cpp/algorithm/nth_element) in C++. \n\nHowever, python doesn\'t have a handy implement of quickselect. Furthermore, the `xor` calculating nested loop is already `O(n^2)`. \n\n```\nclass Solution:\n    def kthLargestValue(self, A: List[List[int]], k: int) -> int:\n        m, n = len(A), len(A[0])\n        for j in range(1, n):\n            A[0][j] ^= A[0][j-1]\n        for i in range(1, m):\n            A[i][0] ^= A[i-1][0]\n        for i in range(1, m):\n            for j in range(1, n):\n                A[i][j] = A[i-1][j-1] ^ A[i-1][j] ^ A[i][j-1] ^ A[i][j]\n        return heapq.nlargest(k, chain(*A))[-1]\n```
[]