import java.util.*;
public class Test {
  public static void main(String[] args){
    Scanner in = new Scanner(System.in);
    int T = in.nextInt();

    for(int i = 1; i<=T; i++) {
      int n = in.nextInt();
      int s = in.nextInt();
      int p = in.nextInt();
      int result = 0;
      for(int j = 0; j<n; j++){
        int x = canAddUp(in.nextInt(), p);
        if(x == 0) {
          result++;
        } else if (x==1 && s > 0) {
          result++;
          s--;
        }
      }
      System.out.println("Case #"+i+": "+result);
    }
  }

  public static int canAddUp(int sum, int limit) {
    boolean flag = false;
    for(int i = 0; i<=sum; i++) {
      for(int j = 0; i+j <= sum; j++) {
        int k = sum-(i+j);
        int a = Math.abs(i-j);
        int b = Math.abs(i-k);
        int c = Math.abs(j-k);
        if(a > 2 || b > 2 || c> 2){
          continue;
        }

        if (i>=limit || j>=limit || k>=limit) {
          if(a < 2 && b < 2 && c < 2) {
            return 0;
          }else{
            flag = true;
          }
        }
      }
    }
    return (flag) ? 1 : 2;
  }
}

package _2012.QualificationRound.B;

import java.util.ArrayList;

import Utils.InputFile;
import Utils.OutputFile;

public class B {

	
	
	
	
	private static void solve(InputFile inputFile, OutputFile outputFile){
		
		int nbCases = Integer.parseInt(inputFile.getNextLine());
		
		for(int caseNumber = 0; caseNumber < nbCases; caseNumber++){
			String[] line = inputFile.getNextLine().split(" ");
			int nbGooglers = Integer.parseInt(line[0]);
			int nbSurprising = Integer.parseInt(line[1]);
			int noteSeuil = Integer.parseInt(line[2]);
			int result = 0;
			
			for(int i = 3; i < 3+nbGooglers; i++){
				int totalNote = Integer.parseInt(line[i]);
				int maxWithoutSurprise = -1;
				int maxWithSurprise = -1;
				
				if(totalNote == 0){
					maxWithoutSurprise = 0;
					maxWithSurprise = -1;
				}
				else if(totalNote == 1){
					maxWithoutSurprise = 1;
					maxWithSurprise = -1;
				}
				else if(totalNote == 2){
					maxWithoutSurprise = 1;
					maxWithSurprise = 2;
				}
				else if(totalNote == 3){
					maxWithoutSurprise = 1;
					maxWithSurprise = 2;
				}
				else if(totalNote == 4){
					maxWithoutSurprise = 2;
					maxWithSurprise = 2;
				}
				else if(totalNote == 5){
					maxWithoutSurprise = 2;
					maxWithSurprise = 3;
				}
				else if(totalNote == 6){
					maxWithoutSurprise = 2;
					maxWithSurprise = 3;
				}
				else if(totalNote == 7){
					maxWithoutSurprise = 3;
					maxWithSurprise = 3;
				}
				else if(totalNote == 8){
					maxWithoutSurprise = 3;
					maxWithSurprise = 4;
				}
				else if(totalNote == 9){
					maxWithoutSurprise = 3;
					maxWithSurprise = 4;
				}
				else if(totalNote == 10){
					maxWithoutSurprise = 4;
					maxWithSurprise = 4;
				}
				else if(totalNote == 11){
					maxWithoutSurprise = 4;
					maxWithSurprise = 5;
				}
				else if(totalNote == 12){
					maxWithoutSurprise = 4;
					maxWithSurprise = 5;
				}
				else if(totalNote == 13){
					maxWithoutSurprise = 5;
					maxWithSurprise = 5;
				}
				else if(totalNote == 14){
					maxWithoutSurprise = 5;
					maxWithSurprise = 6;
				}
				else if(totalNote == 15){
					maxWithoutSurprise = 5;
					maxWithSurprise = 6;
				}
				else if(totalNote == 16){
					maxWithoutSurprise = 6;
					maxWithSurprise = 6;
				}
				else if(totalNote == 17){
					maxWithoutSurprise = 6;
					maxWithSurprise = 7;
				}
				else if(totalNote == 18){
					maxWithoutSurprise = 6;
					maxWithSurprise = 7;
				}
				else if(totalNote == 19){
					maxWithoutSurprise = 7;
					maxWithSurprise = 7;
				}
				else if(totalNote == 20){
					maxWithoutSurprise = 7;
					maxWithSurprise = 8;
				}
				else if(totalNote == 21){
					maxWithoutSurprise = 7;
					maxWithSurprise = 8;
				}
				else if(totalNote == 22){
					maxWithoutSurprise = 8;
					maxWithSurprise = 8;
				}
				else if(totalNote == 23){
					maxWithoutSurprise = 8;
					maxWithSurprise = 9;
				}
				else if(totalNote == 24){
					maxWithoutSurprise = 8;
					maxWithSurprise = 9;
				}
				else if(totalNote == 25){
					maxWithoutSurprise = 9;
					maxWithSurprise = 9;
				}
				else if(totalNote == 26){
					maxWithoutSurprise = 9;
					maxWithSurprise = 10;
				}
				else if(totalNote == 27){
					maxWithoutSurprise = 9;
					maxWithSurprise = 10;
				}
				else if(totalNote == 28){
					maxWithoutSurprise = 10;
					maxWithSurprise = 10;
				}
				else if(totalNote == 29){
					maxWithoutSurprise = 10;
					maxWithSurprise = -1;
				}
				else if(totalNote == 30){
					maxWithoutSurprise = 10;
					maxWithSurprise = -1;
				}
				if(maxWithoutSurprise >= noteSeuil){
					result++;
				} else if(maxWithSurprise  >= noteSeuil && nbSurprising > 0){
					result++;
					nbSurprising--;
				}
				
			}
			
			
			String resultString = "" + result;
			
			outputFile.writeResult(resultString);
			
		}
		
		
		
		
		
	}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	public static void main(String[] args) {
		
		InputFile inputFile = new InputFile("B", "large");
		OutputFile outputFile = new OutputFile(inputFile);
		solve(inputFile, outputFile);
		outputFile.endFile();
		
	}
	
	
	
}
