static long solve ( int D ) {
  if ( D % 9 != 0 ) return 0 ;
  D /= 9 ;
  long [ ] B = new long [ MAXL ] ;
  B [ 0 ] = 1 ;
  for ( int i = 1 ;
  i < MAXL ;
  i ++ ) B [ i ] = B [ i - 1 ] * 10 ;
  long ans = 0 ;
  for ( int i = 1 ;
  i <= MAXL ;
  i ++ ) {
    N = ( i + 1 ) / 2 ;
    v = new long [ N ] ;
    for ( int j = 0 ;
    j < N ;
    j ++ ) for ( int k = j ;
    k < i - j ;
    k ++ ) v [ j ] += B [ k ] ;
    ans += count ( D , i , 0 , new int [ N ] ) ;
  }
  return ans ;
}

static long solve ( int D ) { if ( D % 9 != 0 ) return 0 ; D /= 9 ; long [ ] B = new long [ MAXL ] ; B [ 0 ] = 1 ; for ( int i = 1 ; i < MAXL ; i ++ ) B [ i ] = B [ i - 1 ] * 10 ; long ans = 0 ; for ( int i = 1 ; i <= MAXL ; i ++ ) { N = ( i + 1 ) / 2 ; v = new long [ N ] ; for ( int j = 0 ; j < N ; j ++ ) for ( int k = j ; k < i - j ; k ++ ) v [ j ] += B [ k ] ; ans += count ( D , i , 0 , new int [ N ] ) ; } return ans ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (return_statement (decimal_integer_literal))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) 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))) (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: (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))))) (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 (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (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: (identifier)) update: (update_expression (identifier)) body: (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) condition: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier))) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier)))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (decimal_integer_literal) (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))))))) (return_statement (identifier))))