title: Count Frequency K Matrix Size N Matrixi J Ij
signature: function countFrequencyKMatrixSizeNMatrixiJIj($n, $k) {
test_code: <?php
  
  
  // SOLUTION CODE 
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function validateSolution($actual, $expected){
      return serialize($actual) == serialize($expected);
  }
  
  function driver($n, $k, $expected){
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME($n, $k), $expected)){
          return "PASSED";
        }
        return "FAILED";
      }
      catch (Exception $exception_obj) {
        return get_class($exception_obj);
      }
  }
  
  function main(){
      printf("TEST-0...%s\n",driver(
        90, 74, 
        73));
      
      printf("TEST-1...%s\n",driver(
        86, 36, 
        35));
      
      printf("TEST-2...%s\n",driver(
        92, 38, 
        37));
      
      printf("TEST-3...%s\n",driver(
        72, 71, 
        70));
      
      printf("TEST-4...%s\n",driver(
        25, 57, 
        -6));
      
      printf("TEST-5...%s\n",driver(
        11, 53, 
        -30));
      
      printf("TEST-6...%s\n",driver(
        94, 80, 
        79));
      
      printf("TEST-7...%s\n",driver(
        91, 75, 
        74));
      
      printf("TEST-8...%s\n",driver(
        66, 58, 
        57));
      
      printf("TEST-9...%s\n",driver(
        34, 88, 
        -19));
      
  }
  
  main();
  ?>
source_py: def count_frequency_k_matrix_size_n_matrixi_j_ij(n, k):
      if ((n + 1) >= k):
          return (k - 1)
      else:
          return (((2 * n) + 1) - k)
source_cpp: int count_frequency_k_matrix_size_n_matrixi_j_ij(int n, int k) {
    if ( n + 1 >= k ) return ( k - 1 );
    else return ( 2 * n + 1 - k );
  }