text: Count rows with sum exceeding sum of the remaining Matrix | ''Function to count the number of rows whose sum exceeds the sum of elements of the remaining matrix ; '' Stores the matrix dimensions ; '' To store the result ; '' Stores the total sum of  the matrix elements ; '' Calculate the total sum ; '' Traverse to check for each row ; '' Stores the sum of elements  of the current row ; '' Calculate the sum of elements  of the current row ; '' If sum of current row exceeds  the sum of rest of the matrix ; '' Increase count ; '' Print the result ; ''Driver Code ; '' Given matrix ; '' Function call
code: def countRows ( mat ) : NEW_LINE INDENT n = len ( mat ) NEW_LINE m = len ( mat [ 0 ] ) NEW_LINE count = 0 NEW_LINE totalSum = 0 NEW_LINE for i in range ( n ) : NEW_LINE INDENT for j in range ( m ) : NEW_LINE INDENT totalSum += mat [ i ] [ j ] NEW_LINE DEDENT DEDENT for i in range ( n ) : NEW_LINE INDENT currSum = 0 NEW_LINE for j in range ( m ) : NEW_LINE INDENT currSum += mat [ i ] [ j ] NEW_LINE DEDENT if ( currSum > totalSum - currSum ) : NEW_LINE INDENT count += 1 NEW_LINE DEDENT DEDENT print ( count ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT mat = [ [ 2 , - 1 , 5 ] , [ - 3 , 0 , - 2 ] , [ 5 , 1 , 2 ] ] NEW_LINE countRows ( mat ) NEW_LINE DEDENT