#C5431. Maximize Starting Bid

    ID: 49080 Type: Default 1000ms 256MiB

Maximize Starting Bid

Maximize Starting Bid

You are given n items. Each item has a starting bid and an associated quality score. You are also provided with a minimum required quality score q. Your task is to compute the total starting bid of the items that meet or exceed the minimum quality score.

Formally, if an item has starting bid s and quality score k, then it contributes to the total bid if and only if \(k \geq q\). The answer is the sum of all starting bids for which this condition holds.

Input/Output: The problem expects the input from standard input (stdin) and the output to standard output (stdout).

inputFormat

The first line contains two integers n and q where:

  • n (1 ≤ n ≤ 105) is the number of items.
  • q is the minimum required quality score.

Each of the next n lines contains two integers s and k representing the starting bid and the quality score of an item respectively.

outputFormat

Output a single integer - the total starting bid of all items whose quality score is at least q.

## sample
5 50
200 40
300 60
150 50
400 55
100 30
850

</p>