import java.util.*;

public class B {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int T = sc.nextInt();
        B th = new B();
        for (int i = 0; i < T; i++) {
            int n = sc.nextInt();
            int s = sc.nextInt();
            int p = sc.nextInt();
            int[] t = new int[n];
            for (int j = 0; j < n; j++) {
                t[j] = sc.nextInt();
            }
            int c = th.getAnswer(s,p,t);
            System.out.println("Case #" + (i+1) + ": " + c);
        }
    }
    public int getAnswer(int s, int p, int[] t) {
        int A1 = p + p-1+p-1;
        int A2 = p + p-2+p-2;
        if (A1 < 0)
            A1 = 0;
        if (A2 < 0)
            A2 = 1;
        int remain = s;
        int count = 0;
        int n = t.length;
        for (int i = 0; i < n; i++) {
            if (t[i] >= A1) {
                count++;
            } else if (t[i] < A1 && t[i] >= A2) {
                if (remain > 0) {
                    remain--;
                    count++;
                }
            }
        }
        return count;
    }
}


package com.jagsaund.codejam.qualifcation;

import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

public class DancingWithGooglers {
  private List<List<Integer>> _sets;
  private int _numOfSurprisingTriplets;
  private int _minResult;
  
  public DancingWithGooglers() {
    _sets = new ArrayList<List<Integer>>();
  }
  
  public String run(String line) {
    int[] googlers = null;
    int numOfGooglers;
    
    int pos = 0;
    
    StringTokenizer tokenizer = new StringTokenizer(line);
    
    while (tokenizer.hasMoreElements()) {
      int v = Integer.parseInt(tokenizer.nextToken());
      if (pos == 0) {
        numOfGooglers = v;
        googlers = new int[numOfGooglers];
      } else if (pos == 1) {
        _numOfSurprisingTriplets = v;
      } else if (pos == 2) {
        _minResult = v;
      } else {
        googlers[pos-3] = v;
      }
      
      pos++;
    }
    
    int count = 0;
    
    for (int number : googlers) {
      getIntegerSet(number);
      
      if (_sets.size() > 0) {
        if (_sets.size() == 1) {
          List<Integer> set = _sets.get(0);
          
          int low = Integer.MAX_VALUE;
          int high = Integer.MIN_VALUE;
          
          for (int n : set) {
            if (n < low) low = n;
            if (n > high) high = n;
          }
          
          if ((high - low) == 2 && _numOfSurprisingTriplets > 0) {
            _numOfSurprisingTriplets--;
            count++;
          } else if ((high - low) < 2) {
            count++;
          }
        
        } else {
          count++;
        }
      }
      
      
//      if (number == 0 && _minResult == 0) count++;
      
      _sets.clear();
    }
    
    return count + "";
  }
  
  private void getIntegerSet(int x) {
    getIntegerSet(x, x, new ArrayList<Integer>());
  }
  
  private void getIntegerSet(int x, int max, List<Integer> prefix) {
    if (x == 0) {
      if (prefix.size() <= 3) {
        if (prefix.size() == 2) {
          prefix.add(0);
        }
        
        if (prefix.size() == 1) {
          prefix.add(0);
          prefix.add(0);
        }
        
        if (prefix.size() == 0) {
          prefix.add(0);
          prefix.add(0);
          prefix.add(0);
        }
        
        int low = Integer.MAX_VALUE;
        int high = Integer.MIN_VALUE;
        
        for (int n : prefix) {
          if (n < low) low = n;
          if (n > high) high = n;
        }
        
        if (high >= _minResult && (high - low) <= 2 && high <= 10) {
          _sets.add(prefix);  
        }
      }
      
      return;
    }
    
    for (int i=Math.min(x, max); i>=1; i--) {
      List<Integer> tmp = new ArrayList<Integer>(prefix);
      tmp.add(i);
      getIntegerSet(x-i, i, tmp);
    }
  }
}
