static int [ ] dfs ( int root , int from , int level ) {
  if ( level == 0 ) return new int [ ] {
    1 , map [ root ] . size ( ) - 1 };
    int first = 1 , second = 0 ;
    for ( int w : map [ root ] ) {
      if ( w == from ) continue ;
      int [ ] cur = dfs ( w , root , level - 1 ) ;
      first += cur [ 0 ] ;
      second += cur [ 1 ] ;
    }
    return new int [ ] {
      first , second };
    }
    
static int [ ] dfs ( int root , int from , int level ) { if ( level == 0 ) return new int [ ] { 1 , map [ root ] . size ( ) - 1 } ; int first = 1 , second = 0 ; for ( int w : map [ root ] ) { if ( w == from ) continue ; int [ ] cur = dfs ( w , root , level - 1 ) ; first += cur [ 0 ] ; second += cur [ 1 ] ; } return new int [ ] { first , second } ; }
(method_declaration (modifiers) type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier) parameters: (formal_parameters (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: (decimal_integer_literal))) consequence: (return_statement (array_creation_expression type: (integral_type) dimensions: (dimensions) value: (array_initializer (decimal_integer_literal) (binary_expression left: (method_invocation object: (array_access array: (identifier) index: (identifier)) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (enhanced_for_statement type: (integral_type) name: (identifier) value: (array_access array: (identifier) index: (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (continue_statement)) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (decimal_integer_literal)))))) (return_statement (array_creation_expression type: (integral_type) dimensions: (dimensions) value: (array_initializer (identifier) (identifier))))))