<garvit244>378_1.py
def kthSmallest( matrix, k):
    if not matrix:
        return 0 
    
    import heapq
    heap = []
    for col in range(len(matrix[0])):
        heapq.heappush(heap, (matrix[0][col], 0, col))
    
    val = 0
    for index in range(k):
        val, row, col = heapq.heappop(heap)
        new_val = float('inf')
        if row < len(matrix)-1:
            new_val = matrix[row+1][col]
        heapq.heappush(heap, (new_val, row+1, col))
    return val
def sample_funcname ( var_0 , var_1 ) :
    if not var_0 :
        return 0
    import var_3
    var_4 = [ ]
    for var_7 in range ( len ( var_0 [ 0 ] ) ) :
        var_3.heappush ( var_4 , ( var_0 [ 0 ] [ var_7 ] , 0 , var_7 ) )
    var_9 = 0
    for var_10 in range ( var_1 ) :
        var_9 , var_12 , var_7 = var_3.heappop ( var_4 )
        var_15 = float ( 'inf' )
        if var_12 < len ( var_0 ) - 1 :
            var_15 = var_0 [ var_12 + 1 ] [ var_7 ]
        var_3.heappush ( var_4 , ( var_15 , var_12 + 1 , var_7 ) )
    return var_9
