public static void solve ( int T ) throws IOException {
  int a1 = sc . nextInt ( ) ;
  int a2 = sc . nextInt ( ) ;
  if ( a1 == 1 && a2 == 1 ) {
    System . out . println ( 0 ) ;
    return ;
  }
  int ans = 0 ;
  int charging = a1 < a2 ? 0 : 1 ;
  while ( a1 > 0 && a2 > 0 ) {
    if ( charging == 0 ) {
      a1 += 1 ;
      a2 -= 2 ;
    }
    else {
      a1 -= 2 ;
      a2 += 1 ;
    }
    if ( a1 < a2 ) {
      charging = 0 ;
    }
    else {
      charging = 1 ;
    }
    ans ++ ;
  }
  System . out . println ( ans ) ;
}

public static void solve ( int T ) throws IOException { int a1 = sc . nextInt ( ) ; int a2 = sc . nextInt ( ) ; if ( a1 == 1 && a2 == 1 ) { System . out . println ( 0 ) ; return ; } int ans = 0 ; int charging = a1 < a2 ? 0 : 1 ; while ( a1 > 0 && a2 > 0 ) { if ( charging == 0 ) { a1 += 1 ; a2 -= 2 ; } else { a1 -= 2 ; a2 += 1 ; } if ( a1 < a2 ) { charging = 0 ; } else { charging = 1 ; } ans ++ ; } System . out . println ( ans ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) (throws (type_identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (decimal_integer_literal)))) (return_statement))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (ternary_expression condition: (binary_expression left: (identifier) right: (identifier)) consequence: (decimal_integer_literal) alternative: (decimal_integer_literal)))) (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))) (expression_statement (update_expression (identifier))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))