static int solve ( int x , int y ) {
  int cnt = 0 ;
  if ( x == 1 && y == 1 ) return 0 ;
  while ( true ) {
    if ( x == 0 || y == 0 ) return Integer . MAX_VALUE ;
    if ( x == 1 || y == 1 ) return ( cnt + Math . max ( x , y ) - 1 ) ;
    if ( x > y ) x -= y ;
    else y -= x ;
    cnt ++ ;
  }
}

static int solve ( int x , int y ) { int cnt = 0 ; if ( x == 1 && y == 1 ) return 0 ; while ( true ) { if ( x == 0 || y == 0 ) return Integer . MAX_VALUE ; if ( x == 1 || y == 1 ) return ( cnt + Math . max ( x , y ) - 1 ) ; if ( x > y ) x -= y ; else y -= x ; cnt ++ ; } }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (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: (return_statement (decimal_integer_literal))) (while_statement condition: (parenthesized_expression (true)) body: (block (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: (return_statement (field_access object: (identifier) field: (identifier)))) (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: (return_statement (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier)))) right: (decimal_integer_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (expression_statement (assignment_expression left: (identifier) right: (identifier))) alternative: (expression_statement (assignment_expression left: (identifier) right: (identifier)))) (expression_statement (update_expression (identifier)))))))