static void solveQuery ( int [ ] arr , int n , int Q , int [ ] [ ] query ) {
  int [ ] even = new int [ n + 1 ] ;
  int [ ] odd = new int [ n + 1 ] ;
  even [ 0 ] = odd [ 0 ] = 0 ;
  for ( int i = 0 ;
  i < n ;
  i ++ ) {
    if ( ( arr [ i ] & 1 ) > 0 ) {
      odd [ i + 1 ] = odd [ i ] + 1 ;
      even [ i + 1 ] = even [ i ] ;
    }
    else {
      even [ i + 1 ] = even [ i ] + 1 ;
      odd [ i + 1 ] = odd [ i ] ;
    }
  }
  for ( int i = 0 ;
  i < Q ;
  i ++ ) {
    int r = query [ i ] [ 2 ] ;
    int l = query [ i ] [ 1 ] ;
    int k = query [ i ] [ 0 ] ;
    int q = r - l + 1 ;
    int p ;
    if ( k > 0 ) p = odd [ r ] - odd [ l - 1 ] ;
    else p = even [ r ] - even [ l - 1 ] ;
    if ( p <= 0 ) System . out . println ( "0" ) ;
    else if ( p == q ) System . out . println ( "1" ) ;
    else {
      int g = __gcd ( p , q ) ;
      System . out . println ( p / g + " " + q / g ) ;
    }
  }
}

static void solveQuery ( int [ ] arr , int n , int Q , int [ ] [ ] query ) { int [ ] even = new int [ n + 1 ] ; int [ ] odd = new int [ n + 1 ] ; even [ 0 ] = odd [ 0 ] = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( ( arr [ i ] & 1 ) > 0 ) { odd [ i + 1 ] = odd [ i ] + 1 ; even [ i + 1 ] = even [ i ] ; } else { even [ i + 1 ] = even [ i ] + 1 ; odd [ i + 1 ] = odd [ i ] ; } } for ( int i = 0 ; i < Q ; i ++ ) { int r = query [ i ] [ 2 ] ; int l = query [ i ] [ 1 ] ; int k = query [ i ] [ 0 ] ; int q = r - l + 1 ; int p ; if ( k > 0 ) p = odd [ r ] - odd [ l - 1 ] ; else p = even [ r ] - even [ l - 1 ] ; if ( p <= 0 ) System . out . println ( "0" ) ; else if ( p == q ) System . out . println ( "1" ) ; else { int g = __gcd ( p , q ) ; System . out . println ( p / g + " ▁ " + q / g ) ; } } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier))) body: (block (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 (binary_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 (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (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: (block (if_statement condition: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (array_access array: (identifier) index: (identifier))))) alternative: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (array_access array: (identifier) index: (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: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal)))))) alternative: (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) alternative: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (string_literal)) right: (binary_expression left: (identifier) right: (identifier)))))))))))))