static int findCnt ( int [ ] arr , int i , int required_sum , int n ) {
  if ( i == n ) {
    if ( required_sum == 0 ) return 1 ;
    else return 0 ;
  }
  if ( v [ i ] [ required_sum + base ] ) return dp [ i ] [ required_sum + base ] ;
  v [ i ] [ required_sum + base ] = true ;
  dp [ i ] [ required_sum + base ] = findCnt ( arr , i + 1 , required_sum , n ) + findCnt ( arr , i + 1 , required_sum - arr [ i ] , n ) ;
  return dp [ i ] [ required_sum + base ] ;
}

static int findCnt ( int [ ] arr , int i , int required_sum , int n ) { if ( i == n ) { if ( required_sum == 0 ) return 1 ; else return 0 ; } if ( v [ i ] [ required_sum + base ] ) return dp [ i ] [ required_sum + base ] ; v [ i ] [ required_sum + base ] = true ; dp [ i ] [ required_sum + base ] = findCnt ( arr , i + 1 , required_sum , n ) + findCnt ( arr , i + 1 , required_sum - arr [ i ] , n ) ; return dp [ i ] [ required_sum + base ] ; }
(method_declaration (modifiers) type: (integral_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)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (return_statement (decimal_integer_literal)) alternative: (return_statement (decimal_integer_literal))))) (if_statement condition: (parenthesized_expression (array_access array: (array_access array: (identifier) index: (identifier)) index: (binary_expression left: (identifier) right: (identifier)))) consequence: (return_statement (array_access array: (array_access array: (identifier) index: (identifier)) index: (binary_expression left: (identifier) right: (identifier))))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (binary_expression left: (identifier) right: (identifier))) right: (true))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (binary_expression left: (identifier) right: (identifier))) right: (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier) (identifier))) right: (method_invocation name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (identifier) right: (decimal_integer_literal)) (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))) (identifier)))))) (return_statement (array_access array: (array_access array: (identifier) index: (identifier)) index: (binary_expression left: (identifier) right: (identifier))))))