import java.util.Scanner;
import java.io.*;
class dance
{
  public static void main (String[] args) throws IOException
  { 
    File    inputData = new File("B-small-attempt0.in");
	File 	outputData= new File("Boutput.txt");
    Scanner scan = new Scanner( inputData );
	PrintStream print= new PrintStream(outputData);
    
	int t;
	int n,s,p,pi;
	t= scan.nextInt();
	for(int i=1;i<=t;i++)
	{
	n=scan.nextInt();	s=scan.nextInt();	p=scan.nextInt();
	int supTrip=0, notsupTrip=0;
	
	for(int j=0;j<n;j++)
	{
		pi=scan.nextInt();
		if(pi>(3*p-3))
		notsupTrip++;
		else if((pi>=(3*p-4))&&(pi<=(3*p-3))&&(pi>p))
		supTrip++;
	}
	
	if(s<=supTrip)
	notsupTrip=notsupTrip+s;
	else if(s>supTrip)
	notsupTrip= notsupTrip+supTrip;
	print.println("Case #"+i+": "+notsupTrip);
	}
  }
}
package org.rudy.cj2012;

import java.io.*;
import java.util.Scanner;

/**
 * User: rudy
 */
public class Dancing {
    public static void main(String[] args) throws FileNotFoundException {
        Scanner scanner = new Scanner(new BufferedInputStream(new FileInputStream("B-small-attempt0.in")));
        PrintStream out = new PrintStream(new FileOutputStream("B-small.out"));
        int nTests = scanner.nextInt();
        for (int test = 1; test <= nTests; test++) {
            int n = scanner.nextInt();
            int s = scanner.nextInt();
            int p = scanner.nextInt();
            int [] t = new int[n];
            int potential = 0;
            int already = 0;
            for (int f = 0; f < n; f++) {
                t[f] = scanner.nextInt();
                int minScore = (t[f]+2) / 3;
                int maxScore = (t[f]+4) / 3;
                if (minScore >= p) {
                    already++;
                    continue;
                }
                if (maxScore >=p && t[f] > 1)
                    potential++;
            }

            out.printf("Case #%d: %d\n", test, already + Math.min(potential, s));
        }
        out.close();
    }
}
