56ms C++ by using the idea of 'medians of medians'

For each row, the median is chosen by the middle positions since each row is sorted. The medians of those medians is chosen by STL nth_element function. Afterwards, the key step is to find the upper_bound of the median of medians for each row. In this step, we calculate the number of the elements that are less or equivalent to the median of medians for each row and calculate its summation. If the summation is smaller than k, we know the kth element falls within the 'smaller portion'. Otherwise, it falls into those portions that are larger than the median of medians.