Dancing With the Googlers (Small)

Given each dancer's total of three judge scores and a budget of surprising triplets, maximize the count of dancers whose best score reaches p.

Medium4GreedyMathNo attempts yetTime limit5sMemory limit512 MB

Problem

You are watching a show where Googlers (Google employees) dance. After a dance, three judges each give the dancer one score, and those three scores form one group. Every score is an integer from 0 to 10. The judges use very similar standards, so a group is called surprising when it holds two scores that differ by exactly 2. Two scores that differ by more than 2 never appear in the same group.

For example, (8,8,8)(8, 8, 8) and (7,8,7)(7, 8, 7) are not surprising, while (6,7,8)(6, 7, 8) and (6,8,8)(6, 8, 8) are surprising. (7,6,9)(7, 6, 9) never appears.

A Googler's total points is the sum of the three scores in that Googler's group, and the best result is the largest of those three scores. Given the total points of every Googler and the number of surprising groups, find the largest number of Googlers who could have had a best result of at least pp.

Consider 6 Googlers whose total points are 29, 20, 8, 18, 18, 21 in that order. There were 2 surprising groups, and you want to know how many Googlers could have had a best result of 8 or more. The groups can be chosen like this.

10 9 10
6 6 8 (*)
2 3 3
6 6 6
6 6 6
6 7 8 (*)

The two lines marked with a (*) are the surprising groups. Here 3 Googlers received a score of 8 or more. No choice of groups gives more than 3, so the answer is 3.

Input

The first line contains the number of test cases TT. Each of the next TT lines holds one test case as integers separated by single spaces. The first integer is the number of Googlers NN, the second is the number of surprising groups SS, and the third is pp as described above. The next NN integers tit_i are the total points of the Googlers.

Limits

  • 1T1001 \le T \le 100
  • 1N1001 \le N \le 100
  • 0SN0 \le S \le N
  • 0p100 \le p \le 10
  • 0ti300 \le t_i \le 30
  • At least SS of the tit_i values are between 2 and 28, inclusive.

Output

For each test case, print one line in the form Case #x: y, where xx is the test case number starting from 1 and yy is the largest number of Googlers who could have had a best result of at least pp.