#K70487. Maximizing Team Contribution
Maximizing Team Contribution
Maximizing Team Contribution
You are given several test cases. For each test case, you are provided with two integers N (the number of candidates) and D (the project difficulty rating), followed by a list of N integers representing the skill levels of the candidates.
The overall contribution of the team is defined as the sum of the skills of candidates whose skill level is at least D. In mathematical terms, the contribution for a test case is given by \[ \text{Contribution} = \sum_{i=1}^{N} \mathbf{1}_{\{skill_i \ge D\}} \cdot skill_i, \] where \(\mathbf{1}_{\{skill_i \ge D\}}\) is 1 if \(skill_i \ge D\) and 0 otherwise.
Your task is to compute and output the maximum possible overall contribution for each test case.
inputFormat
Input is read from standard input (stdin). The first line contains an integer T, representing the number of test cases. Each test case consists of the following two lines:
- The first line contains two integers N and D, where N is the number of candidates and D is the difficulty rating of the project.
- The second line contains N space-separated integers representing the skill levels of the candidates.
outputFormat
For each test case, output a single line to standard output (stdout) representing the maximum overall contribution, which is defined as the sum of those candidates' skills that are greater than or equal to D.
## sample2
4 5
6 7 3 8
3 10
15 20 5
21
35
</p>