title: Queries Counts Array Elements Values Given Range
signature: fun queriesCountsArrayElementsValuesGivenRange(arr: ArrayList<Int>, n: Int, x: Int, y: Int): Int {
source_py: def queries_counts_array_elements_values_given_range(arr, n, x, y):
      count = 0
      for i in range(n):
          if ((arr[i] >= x) and (arr[i] <= y)):
              count += 1
      return count
source_cpp: int queries_counts_array_elements_values_given_range(vector<int> arr, int n, int x, int y) {
    int count = 0;
    for ( int i = 0;
    i < n;
    i ++ ) {
      if ( arr [ i ] >= x && arr [ i ] <= y ) count ++;
    }
    return count;
  }
question_info.test_list: [{"idx": 0, "outputs": 0, "inputs": {"arr": [9, 16, 19, 24, 36, 38, 42, 49, 51, 53, 53, 57, 57, 58, 71, 78, 78, 92, 92, 93], "n": 13, "x": 12, "y": 13}}, {"idx": 1, "outputs": 0, "inputs": {"arr": [28, -74, -18, 10, 26, 28, -96, -80, 82, 94, 22, 50, 72, -90, 76, 50, 20, -44, -80], "n": 18, "x": 13, "y": 13}}, {"idx": 2, "outputs": 0, "inputs": {"arr": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "n": 30, "x": 21, "y": 31}}, {"idx": 3, "outputs": 0, "inputs": {"arr": [25, 8, 66, 90, 50, 65, 76, 90, 27], "n": 4, "x": 8, "y": 5}}, {"idx": 4, "outputs": 1, "inputs": {"arr": [-98, -96, -90, -82, -80, -78, -70, -66, -60, -60, -50, -48, -34, -26, -24, -16, -14, -8, -6, 4, 22, 24, 26, 30, 30, 48, 52, 56, 60, 62, 74, 76, 78, 86], "n": 32, "x": 24, "y": 24}}, {"idx": 5, "outputs": 0, "inputs": {"arr": [1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0], "n": 15, "x": 16, "y": 12}}, {"idx": 6, "outputs": 0, "inputs": {"arr": [4, 6, 17, 19, 24, 29, 30, 31, 32, 37, 37, 40, 43, 44, 44, 45, 57, 64, 69, 70, 73, 78, 86, 89, 91, 92, 94], "n": 17, "x": 21, "y": 15}}, {"idx": 7, "outputs": 0, "inputs": {"arr": [32, -88, 70, -6, 28, -48], "n": 4, "x": 3, "y": 4}}, {"idx": 8, "outputs": 0, "inputs": {"arr": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "n": 13, "x": 12, "y": 11}}, {"idx": 9, "outputs": 0, "inputs": {"arr": [37, 84, 97, 74, 12, 26, 47, 10, 14, 33], "n": 5, "x": 9, "y": 8}}]
question_info.extension: kts
question_info.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(arr: ArrayList<Int>, n: Int, x: Int, y: Int, expected:Int):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(arr, n, x, y), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver(arrayListOf(9, 16, 19, 24, 36, 38, 42, 49, 51, 53, 53, 57, 57, 58, 71, 78, 78, 92, 92, 93), 13, 12, 13, 0)
      println("TEST-0...${result}")
      
      result = driver(arrayListOf(28, -74, -18, 10, 26, 28, -96, -80, 82, 94, 22, 50, 72, -90, 76, 50, 20, -44, -80), 18, 13, 13, 0)
      println("TEST-1...${result}")
      
      result = driver(arrayListOf(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), 30, 21, 31, 0)
      println("TEST-2...${result}")
      
      result = driver(arrayListOf(25, 8, 66, 90, 50, 65, 76, 90, 27), 4, 8, 5, 0)
      println("TEST-3...${result}")
      
      result = driver(arrayListOf(-98, -96, -90, -82, -80, -78, -70, -66, -60, -60, -50, -48, -34, -26, -24, -16, -14, -8, -6, 4, 22, 24, 26, 30, 30, 48, 52, 56, 60, 62, 74, 76, 78, 86), 32, 24, 24, 1)
      println("TEST-4...${result}")
      
      result = driver(arrayListOf(1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0), 15, 16, 12, 0)
      println("TEST-5...${result}")
      
      result = driver(arrayListOf(4, 6, 17, 19, 24, 29, 30, 31, 32, 37, 37, 40, 43, 44, 44, 45, 57, 64, 69, 70, 73, 78, 86, 89, 91, 92, 94), 17, 21, 15, 0)
      println("TEST-6...${result}")
      
      result = driver(arrayListOf(32, -88, 70, -6, 28, -48), 4, 3, 4, 0)
      println("TEST-7...${result}")
      
      result = driver(arrayListOf(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), 13, 12, 11, 0)
      println("TEST-8...${result}")
      
      result = driver(arrayListOf(37, 84, 97, 74, 12, 26, 47, 10, 14, 33), 5, 9, 8, 0)
      println("TEST-9...${result}")
      
          
  }
  
  main()
question_info.entry_fn_name: queriesCountsArrayElementsValuesGivenRange
question_info.entry_cls_name: Solution
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: kotlinc -script __FILENAME__ -no-reflect -nowarn