static int CountWays ( int n , int flag ) {
  if ( dp [ n ] [ flag ] != - 1 ) {
    return dp [ n ] [ flag ] ;
  }
  if ( n == 0 ) {
    return 1 ;
  }
  int sum = 0 ;
  if ( flag == 0 && n > 1 ) {
    sum = sum + CountWays ( n - 1 , 0 ) + CountWays ( n - 2 , 1 ) ;
  }
  else {
    sum = sum + CountWays ( n - 1 , 0 ) ;
  }
  return dp [ n ] [ flag ] = sum ;
}

static int CountWays ( int n , int flag ) { if ( dp [ n ] [ flag ] != - 1 ) { return dp [ n ] [ flag ] ; } if ( n == 0 ) { return 1 ; } int sum = 0 ; if ( flag == 0 && n > 1 ) { sum = sum + CountWays ( n - 1 , 0 ) + CountWays ( n - 2 , 1 ) ; } else { sum = sum + CountWays ( n - 1 , 0 ) ; } return dp [ n ] [ flag ] = sum ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (unary_expression operand: (decimal_integer_literal)))) consequence: (block (return_statement (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (return_statement (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (decimal_integer_literal)))) right: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (decimal_integer_literal))))))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (decimal_integer_literal)))))))) (return_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (identifier)))))