title: Count Frequency K Matrix Size N Matrixi J Ij
signature: fun countFrequencyKMatrixSizeNMatrixiJIj(n: Int, k: Int): Int {
test_code: package main
  
  import kotlin.text.*
  import kotlin.math.*
  
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  fun validateSolution(actual:Int, expected:Int):Boolean{
    return actual.equals(expected)
  }
  fun driver(n: Int, k: Int, expected:Int):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(n, k), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver(90, 74, 73)
      println("TEST-0...${result}")
      
      result = driver(86, 36, 35)
      println("TEST-1...${result}")
      
      result = driver(92, 38, 37)
      println("TEST-2...${result}")
      
      result = driver(72, 71, 70)
      println("TEST-3...${result}")
      
      result = driver(25, 57, -6)
      println("TEST-4...${result}")
      
      result = driver(11, 53, -30)
      println("TEST-5...${result}")
      
      result = driver(94, 80, 79)
      println("TEST-6...${result}")
      
      result = driver(91, 75, 74)
      println("TEST-7...${result}")
      
      result = driver(66, 58, 57)
      println("TEST-8...${result}")
      
      result = driver(34, 88, -19)
      println("TEST-9...${result}")
      
          
  }
  
  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 );
  }