static boolean help ( int target , ArrayList < Integer > step ) {
  int sum = 0 ;
  for ( int w : step ) sum += w ;
  if ( sum < Math . abs ( target ) ) return false ;
  if ( sum == Math . abs ( target ) ) return true ;
  boolean [ ] cur = new boolean [ 2 * sum + 1 ] , next = new boolean [ 2 * sum + 1 ] ;
  cur [ sum ] = true ;
  for ( int w : step ) {
    for ( int j = 0 ;
    j <= 2 * sum ;
    j ++ ) {
      if ( cur [ j ] ) {
        next [ j - w ] = true ;
        next [ j + w ] = true ;
      }
    }
    cur = next ;
    next = new boolean [ 2 * sum + 1 ] ;
  }
  return cur [ target + sum ] ;
}

static boolean help ( int target , ArrayList < Integer > step ) { int sum = 0 ; for ( int w : step ) sum += w ; if ( sum < Math . abs ( target ) ) return false ; if ( sum == Math . abs ( target ) ) return true ; boolean [ ] cur = new boolean [ 2 * sum + 1 ] , next = new boolean [ 2 * sum + 1 ] ; cur [ sum ] = true ; for ( int w : step ) { for ( int j = 0 ; j <= 2 * sum ; j ++ ) { if ( cur [ j ] ) { next [ j - w ] = true ; next [ j + w ] = true ; } } cur = next ; next = new boolean [ 2 * sum + 1 ] ; } return cur [ target + sum ] ; }
(method_declaration (modifiers) type: (boolean_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (generic_type (type_identifier) (type_arguments (type_identifier))) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (enhanced_for_statement type: (integral_type) name: (identifier) value: (identifier) body: (expression_statement (assignment_expression left: (identifier) right: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) consequence: (return_statement (false))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) consequence: (return_statement (true))) (local_variable_declaration type: (array_type element: (boolean_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (boolean_type) dimensions: (dimensions_expr (binary_expression left: (binary_expression left: (decimal_integer_literal) right: (identifier)) right: (decimal_integer_literal))))) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (boolean_type) dimensions: (dimensions_expr (binary_expression left: (binary_expression left: (decimal_integer_literal) right: (identifier)) right: (decimal_integer_literal)))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (true))) (enhanced_for_statement type: (integral_type) name: (identifier) value: (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: (binary_expression left: (decimal_integer_literal) right: (identifier))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (array_access array: (identifier) index: (identifier))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (identifier))) right: (true))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (identifier))) right: (true))))))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (array_creation_expression type: (boolean_type) dimensions: (dimensions_expr (binary_expression left: (binary_expression left: (decimal_integer_literal) right: (identifier)) right: (decimal_integer_literal)))))))) (return_statement (array_access array: (identifier) index: (binary_expression left: (identifier) right: (identifier))))))