package com.silverduner.codejam;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.HashMap;

public class Dancing {
	public static void main(String[] args) throws Exception {
		File input = new File("B-small-attempt0.in");
		BufferedReader in = new BufferedReader(new FileReader(input));

		File output = new File("1.out");
		BufferedWriter out = new BufferedWriter(new FileWriter(output));

		// parse input
		int N = Integer.parseInt(in.readLine());
		for(int i=0;i<N;i++) {
			String str = in.readLine();
			out.write("Case #"+(i+1)+": ");
			System.out.println("-------");
			String[] words = str.split(" ");
			int n = Integer.parseInt(words[0]);
			int suprise = Integer.parseInt(words[1]);
			int threshold = Integer.parseInt(words[2]);
			int[] scores = new int[n];
			for(int j=0;j<n;j++) {
				scores[j] = Integer.parseInt(words[3+j]);
			}
			int count = 0;
			for(int score : scores) {
				int a,b,c;
				boolean find = false;
				boolean sfind = false;
				for(a = 10; a>=0 && !find; a--) {
					if(3*a-4>score)
						continue;
					for(b = a; b>=0 && b >=a-2 && !find; b--) {
						for(c = b; c>=0 && c >=b-2 && c >=a-2 && !find; c--) {
							System.out.println(a+","+b+","+c);
							if(a+b+c==score) {
								if(a >= threshold) {
									if(a-c <= 1){
										count++;
										find = true;
										System.out.println("find!");
									}
									else if(a-c == 2){
										sfind = true;
										System.out.println("suprise!");
									}
								}
							}
							
						}
					}
				}
				if(!find && sfind && suprise > 0)
				{
					count++;
					suprise --;
				}
			}
			int maxCount = count;
			out.write(maxCount+"\n");
		}
		out.flush();
		out.close();
		in.close();
	}
}

import java.io.*;

class Programa
{
static boolean alcanza2(int a,int b)
{
  int j1=0,j2=0,j3=0;
  for (int i=0;i<=30;i++)
  {
     if (i+(i+2)+(i+2)==a)
     {
        j1=i;
	j2=i+2;
	j3=i+2;
     }	     
     if (i+i+(i+2)==a)
     {
        j1=i;
	j2=i+2;
        j3=i;	     
     }	     
     if (i+(i+1)+(i+2)==a)
     {
        j1=i;
	j2=i+2;
        j3=i+1;	     
     }	     
  // System.out.println(" "+a+" -> "+j1+" "+j2+" "+j3);
  }	  
  	
 if (j2>=b) 
	 return true;
 else
	return false;
	
}
	static boolean alcanza(int a,int b)
{
  int j1=0,j2=0,j3=0;
  for (int i=0;i<=30;i++)
  {
     if (i+(i+1)+(i+1)==a)
     {
        j1=i;
	     j2=i+1;
	     j3=i+1;
     }	     
     if (i+i+i==a)
     {
         j1=i;
	j2=i;
	     j3=i;
     }	     
     if (i+i+(i+1)==a)
     {
        j1=i;
	j2=i+1;
        j3=i;	     
     }	     
  }	  
   //System.out.println(" "+a+" -> "+j1+" "+j2+" "+j3);
 	
 if (j2>=b) 
	 return true;
 else
	return false;
	
}
public static int procesar(String linea)
{
	String vals[]=linea.split(" ");
	int n,s,p;
	int usados=0;
	int puntajes[];
	n=Integer.parseInt(vals[0]);
	s=Integer.parseInt(vals[1]);
	p=Integer.parseInt(vals[2]);
	puntajes=new int[n];
	for (int i=0;i<n;i++)
	  puntajes[i]=Integer.parseInt(vals[3+i]);
	
	int resultado=0;
	for (int i=0;i<n;i++)
	{
	  if (alcanza(puntajes[i],p))
		   resultado++;
	   else
	   {
	          if (alcanza2(puntajes[i],p) && usados<s)
		  {
		      usados++;
		      resultado++;
			  }
		  
		   }
	}		
	return resultado;
}	

	public static void main(String args[])
  {
  try{

  FileInputStream fstream = new FileInputStream(args[0]);
  
  DataInputStream in = new DataInputStream(fstream);
  BufferedReader br = new BufferedReader(new InputStreamReader(in));
  String strLine;
  strLine = br.readLine();
  int casos=Integer.parseInt(strLine);
  int caso=1; 	  
  int respuesta;
	  
	  while ((strLine = br.readLine()) != null)   {
              respuesta=procesar(strLine);
	      System.out.println("Case #"+caso+": "+respuesta);
              caso++;
	  }
  //Close the input stream
  in.close();
    }catch (IOException e){//Catch exception if any
  System.err.println("Error: " + e.getMessage());
  }
  }
}