public static void main ( String [ ] $ ) {
  Scanner sc = new Scanner ( in ) ;
  int n = sc . nextInt ( ) ;
  int k = sc . nextInt ( ) ;
  int [ ] w = new int [ n ] ;
  int [ ] p = new int [ n ] ;
  for ( int i = 0 ;
  i < n ;
  i ++ ) {
    w [ i ] = sc . nextInt ( ) ;
    p [ i ] = sc . nextInt ( ) ;
  }
  double max = 100 , min = 0 , mid = 0 ;
  for ( int i = 0 ;
  i < 40 ;
  i ++ ) {
    double [ ] d = new double [ n ] ;
    double sum = 0 ;
    mid = ( max + min ) / 2 ;
    for ( int j = 0 ;
    j < n ;
    j ++ ) {
      d [ j ] = ( p [ j ] - mid ) * w [ j ] ;
    }
    Arrays . sort ( d ) ;
    for ( int j = 1 ;
    j <= k ;
    j ++ ) {
      sum += d [ n - j ] ;
    }
    if ( sum >= 0 ) {
      min = mid ;
    }
    else {
      max = mid ;
    }
  }
  out . println ( mid ) ;
}

public static void main ( String [ ] $ ) { Scanner sc = new Scanner ( in ) ; int n = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int [ ] w = new int [ n ] ; int [ ] p = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { w [ i ] = sc . nextInt ( ) ; p [ i ] = sc . nextInt ( ) ; } double max = 100 , min = 0 , mid = 0 ; for ( int i = 0 ; i < 40 ; i ++ ) { double [ ] d = new double [ n ] ; double sum = 0 ; mid = ( max + min ) / 2 ; for ( int j = 0 ; j < n ; j ++ ) { d [ j ] = ( p [ j ] - mid ) * w [ j ] ; } Arrays . sort ( d ) ; for ( int j = 1 ; j <= k ; j ++ ) { sum += d [ n - j ] ; } if ( sum >= 0 ) { min = mid ; } else { max = mid ; } } out . println ( mid ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (identifier))))) (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)))) (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 (identifier))))) (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 (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 (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (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: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (array_type element: (floating_point_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (floating_point_type) dimensions: (dimensions_expr (identifier))))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (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: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) right: (array_access array: (identifier) index: (identifier))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (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 (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (identifier))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier)))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))))