title: Count Frequency K Matrix Size N Matrixi J Ij
signature: count_frequency_k_matrix_size_n_matrixi_j_ij <- function(n, k) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(n, k, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(n, k), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          90L, 74L, 
          73L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          86L, 36L, 
          35L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          92L, 38L, 
          37L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          72L, 71L, 
          70L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          25L, 57L, 
          -6L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          11L, 53L, 
          -30L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          94L, 80L, 
          79L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          91L, 75L, 
          74L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          66L, 58L, 
          57L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          34L, 88L, 
          -19L
      )))
  
  }
  
  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 );
  }