public static boolean check ( int [ ] [ ] map , int N , int M ) {
  for ( int i = 0 ;
  i < N ;
  i ++ ) {
    for ( int j = 0 ;
    j < M ;
    j ++ ) {
      boolean flag = true , flag2 = true ;
      for ( int k = 0 ;
      k < N ;
      k ++ ) {
        if ( map [ k ] [ j ] > map [ i ] [ j ] ) {
          flag = false ;
          break ;
        }
      }
      for ( int k = 0 ;
      k < M ;
      k ++ ) {
        if ( map [ i ] [ k ] > map [ i ] [ j ] ) {
          flag2 = false ;
          break ;
        }
      }
      if ( ! flag && ! flag2 ) return false ;
    }
  }
  return true ;
}

public static boolean check ( int [ ] [ ] map , int N , int M ) { for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < M ; j ++ ) { boolean flag = true , flag2 = true ; for ( int k = 0 ; k < N ; k ++ ) { if ( map [ k ] [ j ] > map [ i ] [ j ] ) { flag = false ; break ; } } for ( int k = 0 ; k < M ; k ++ ) { if ( map [ i ] [ k ] > map [ i ] [ j ] ) { flag2 = false ; break ; } } if ( ! flag && ! flag2 ) return false ; } } return true ; }
(method_declaration (modifiers) type: (boolean_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (true)) declarator: (variable_declarator name: (identifier) value: (true))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (false))) (break_statement))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (false))) (break_statement))))) (if_statement condition: (parenthesized_expression (binary_expression left: (unary_expression operand: (identifier)) right: (unary_expression operand: (identifier)))) consequence: (return_statement (false))))))) (return_statement (true))))