static void dfs ( int node , int leaf [ ] , int vis [ ] ) {
  leaf [ node ] = 0 ;
  vis [ node ] = 1 ;
  for ( int i = 0 ;
  i < adjacency . get ( node ) . size ( ) ;
  i ++ ) {
    int it = adjacency . get ( node ) . get ( i ) ;
    if ( vis [ it ] == 0 ) {
      dfs ( it , leaf , vis ) ;
      leaf [ node ] += leaf [ it ] ;
    }
  }
  if ( adjacency . get ( node ) . size ( ) == 0 ) leaf [ node ] = 1 ;
}

static void dfs ( int node , int leaf [ ] , int vis [ ] ) { leaf [ node ] = 0 ; vis [ node ] = 1 ; for ( int i = 0 ; i < adjacency . get ( node ) . size ( ) ; i ++ ) { int it = adjacency . get ( node ) . get ( i ) ; if ( vis [ it ] == 0 ) { dfs ( it , leaf , vis ) ; leaf [ node ] += leaf [ it ] ; } } if ( adjacency . get ( node ) . size ( ) == 0 ) leaf [ node ] = 1 ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier) dimensions: (dimensions)) (formal_parameter type: (integral_type) name: (identifier) dimensions: (dimensions))) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) 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: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) name: (identifier) arguments: (argument_list))) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) name: (identifier) arguments: (argument_list (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) consequence: (block (expression_statement (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (identifier)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier)))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal))) consequence: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))))))