Company: Algo University SDE 2nd round_21april
Difficulty: medium
Fractional Loot You are planning a heist with access to n valuable items stored in a warehouse. Each item has: a value v i if taken fully, and a weight w i . Your backpack can carry at most W units of weight. Here's the twist: you're allowed to take fractions of any item — you can slice gold bars or siphon oil if needed. Your goal is to maximize the total value of what you carry, without exceeding the weight limit. Input Format: The first line contains two integers n and W (1 ≤ n < 2 · 10 5 , 1 ≤ W ≤ 10 9 ) — the number of items and the maximum weight that can be carried. Each of the next n lines contains two integers v i and w i (1 ≤ v i , w i ≤ 10 5 ) — the value and weight of the i -th item. Output Format: Print a single floating-point number — the maximum total value you can carry. Your answer will be considered correct if |correct answer − your answer| correct answer ≤ 10 −6 Examples: Example 1: Input: 3 10 6 3 4 2 10