package dancinggooglers;

import java.io.File;
import java.util.Scanner;

public class DanceScoreCalculator {


    public static void main(String[] args) {
        if(args.length <= 0 || args[0] == null) {
            System.out.println("You must enter a file to read");
            System.out.println("Usage: blah <filename>");
            System.exit(0);
        }

        File argFile = new File(args[0]);
        try {
            Scanner googleSpeakScanner = new Scanner(argFile);
            String firstLine = googleSpeakScanner.nextLine();
            Integer linesToScan = new Integer(firstLine);
            for(int i = 1; i <= linesToScan; i++) {
                String googleDancerLine = googleSpeakScanner.nextLine();
                DanceScoreCase danceCase = new DanceScoreCase(googleDancerLine);
                System.out.println(String.format("Case #%d: %d", i, danceCase.maxDancersThatCouldPass()));
            }
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }
}

import java.util.Scanner;
public class ProblemB {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int T = scan.nextInt();
		scan.nextLine();
		
		for (int k = 1; k <= T; k++) {
			int N = scan.nextInt();
			int S = scan.nextInt(); //number of surprising triplets
			int p = scan.nextInt(); //target high score
			int solution = 0; //number of high scores over the target
			for (int i = 0; i < N; i++) {
				int t = scan.nextInt();
				if (t >= 3*p - 2) {
					solution++;
				} else if (t >= 3*p - 4 && t > 2 && S > 0) {
					solution++;
					S--;
				}
			}
			System.out.println("Case #" + k + ": " + solution);
		}
	}

}
