#C6423. Modified Sum of Array Elements

    ID: 50182 Type: Default 1000ms 256MiB

Modified Sum of Array Elements

Modified Sum of Array Elements

Given an integer T representing the number of test cases. For each test case, you are provided with two integers N and Y followed by an array A of N integers. Your task is to compute the "modified sum" for each test case. The modified sum is defined as:

\( S = \sum_{i=1}^{N} a_i \quad \text{if } a_i > Y \)

In other words, for each test case, sum up only those elements of A that are strictly greater than Y. If no element is greater than Y, the result is 0.

Example: For a test case with N = 4, Y = 5 and A = [1, 10, 15, 7], the modified sum is 10 + 15 + 7 = 32.

The input is read from standard input (stdin) and output is printed to standard output (stdout).

inputFormat

The input begins with an integer T denoting the number of test cases. Each test case consists of the following:

  • A line containing two space-separated integers N (the number of elements in the array) and Y (the threshold value).
  • A line containing N space-separated integers representing the array A.

All input is provided via standard input.

outputFormat

For each test case, output a single integer representing the modified sum (i.e., the sum of all array elements strictly greater than Y). Print each result on a new line.

## sample
1
4 5
1 10 15 7
32