static int maxIncSubarr ( int a [ ] , int n ) {
  int pre [ ] = new int [ n ] ;
  int pos [ ] = new int [ n ] ;
  pre [ 0 ] = 1 ;
  pos [ n - 1 ] = 1 ;
  int l = 0 ;
  for ( int i = 1 ;
  i < n ;
  i ++ ) {
    if ( a [ i ] > a [ i - 1 ] ) pre [ i ] = pre [ i - 1 ] + 1 ;
    else pre [ i ] = 1 ;
  }
  l = 1 ;
  for ( int i = n - 2 ;
  i >= 0 ;
  i -- ) {
    if ( a [ i ] < a [ i + 1 ] ) pos [ i ] = pos [ i + 1 ] + 1 ;
    else pos [ i ] = 1 ;
  }
  int ans = 0 ;
  l = 1 ;
  for ( int i = 1 ;
  i < n ;
  i ++ ) {
    if ( a [ i ] > a [ i - 1 ] ) l ++ ;
    else l = 1 ;
    ans = Math . max ( ans , l ) ;
  }
  for ( int i = 1 ;
  i <= n - 2 ;
  i ++ ) {
    if ( a [ i - 1 ] < a [ i + 1 ] ) ans = Math . max ( pre [ i - 1 ] + pos [ i + 1 ] , ans ) ;
  }
  return ans ;
}

static int maxIncSubarr ( int a [ ] , int n ) { int pre [ ] = new int [ n ] ; int pos [ ] = new int [ n ] ; pre [ 0 ] = 1 ; pos [ n - 1 ] = 1 ; int l = 0 ; for ( int i = 1 ; i < n ; i ++ ) { if ( a [ i ] > a [ i - 1 ] ) pre [ i ] = pre [ i - 1 ] + 1 ; else pre [ i ] = 1 ; } l = 1 ; for ( int i = n - 2 ; i >= 0 ; i -- ) { if ( a [ i ] < a [ i + 1 ] ) pos [ i ] = pos [ i + 1 ] + 1 ; else pos [ i ] = 1 ; } int ans = 0 ; l = 1 ; for ( int i = 1 ; i < n ; i ++ ) { if ( a [ i ] > a [ i - 1 ] ) l ++ ; else l = 1 ; ans = Math . max ( ans , l ) ; } for ( int i = 1 ; i <= n - 2 ; i ++ ) { if ( a [ i - 1 ] < a [ i + 1 ] ) ans = Math . max ( pre [ i - 1 ] + pos [ i + 1 ] , ans ) ; } return ans ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier) dimensions: (dimensions)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (decimal_integer_literal))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (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: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))) consequence: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal)))) alternative: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal)))))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))) consequence: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal)))) alternative: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (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: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))) consequence: (expression_statement (update_expression (identifier))) alternative: (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier))))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))) consequence: (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (identifier)))))))) (return_statement (identifier))))