package codejam;

import fixjava.Pair;

public class Utils {

	public static long minLong(long firstVal, long... otherVals) {
		long minVal = firstVal;
		for (int i = 0; i < otherVals.length; i++)
			minVal = Math.min(firstVal, otherVals[i]);
		return minVal;
	}

	public static int minInt(int firstVal, int... otherVals) {
		int minVal = firstVal;
		for (int i = 0; i < otherVals.length; i++)
			minVal = Math.min(firstVal, otherVals[i]);
		return minVal;
	}

	public static float minFloat(float firstVal, float... otherVals) {
		float minVal = firstVal;
		for (int i = 0; i < otherVals.length; i++)
			minVal = Math.min(firstVal, otherVals[i]);
		return minVal;
	}

	/**
	 * ArgMin returned as a Pair<Integer, Integer>(index, value). Array must
	 * have at least one value.
	 */
	public static Pair<Integer, Integer> argMin(int[] arr) {
		int min = arr[0];
		int argMin = 0;
		for (int i = 1; i < arr.length; i++) {
			if (arr[i] < min) {
				min = arr[i];
				argMin = i;
			}
		}
		return new Pair<Integer, Integer>(argMin, min);
	}

	/**
	 * ArgMax returned as a Pair<Integer, Integer>(index, value). Array must
	 * have at least one value.
	 */
	public static Pair<Integer, Integer> argMax(int[] arr) {
		int max = arr[0];
		int argMax = 0;
		for (int i = 1; i < arr.length; i++) {
			if (arr[i] > max) {
				max = arr[i];
				argMax = i;
			}
		}
		return new Pair<Integer, Integer>(argMax, max);
	}

}

package com.google.codejam.Qualification2012;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.Scanner;

public class B {

	public static void main(String[] args) throws IOException {
		Scanner scanner = new Scanner(new BufferedReader(new FileReader(args[0] + ".in")));
		Writer writer = new BufferedWriter(new FileWriter(args[0] + ".out"));
		
		int T = scanner.nextInt();

		for (int x = 1; x <= T; ++x) {
			int N = scanner.nextInt();
			int S = scanner.nextInt();
			int p = scanner.nextInt();
			
			int[] t = new int[N];
			for (int i = 0; i < N; ++i)
				t[i] = scanner.nextInt();
			
			int y = 0;
			
			for (int i = 0; i < N; ++i) {
				if (t[i] < p)
					continue;
				
				int min = (t[i] - p) / 2;
				if (min >= p - 1) {
					++y;
				} else if (min == p - 2 && S > 0) {
					--S;
					++y;
				}
			}
			
			System.out.println("Case #" + x + ": " + y);
			writer.write("Case #" + x + ": " + y + "\n");
		}
		
		writer.close();
		scanner.close();
	}
	
}
