title: Count Frequency K Matrix Size N Matrixi J Ij
signature: countFrequencyKMatrixSizeNMatrixiJIj(n, k) {
test_code: import 'dart:convert';
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  bool validateSolution(int actual, int expected){
      return actual.toString() == expected.toString();
  }
  
  String driver(n, k, int expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(n, k), expected)){
              return "PASSED";
          }
          return "FAILED";
      }catch(exception_object){
          return exception_object.runtimeType.toString();
      }
  }
  
  int main() {
  
      print("TEST-0...${driver(
          90, 74, 
          73)
      }");
  
      print("TEST-1...${driver(
          86, 36, 
          35)
      }");
  
      print("TEST-2...${driver(
          92, 38, 
          37)
      }");
  
      print("TEST-3...${driver(
          72, 71, 
          70)
      }");
  
      print("TEST-4...${driver(
          25, 57, 
          -6)
      }");
  
      print("TEST-5...${driver(
          11, 53, 
          -30)
      }");
  
      print("TEST-6...${driver(
          94, 80, 
          79)
      }");
  
      print("TEST-7...${driver(
          91, 75, 
          74)
      }");
  
      print("TEST-8...${driver(
          66, 58, 
          57)
      }");
  
      print("TEST-9...${driver(
          34, 88, 
          -19)
      }");
  
      return 0;
  }
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 );
  }