title: Queries Counts Array Elements Values Given Range
signature: queries_counts_array_elements_values_given_range <- function(arr, n, x, y) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(arr, n, x, y, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(arr, n, x, y), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          list(9L, 16L, 19L, 24L, 36L, 38L, 42L, 49L, 51L, 53L, 53L, 57L, 57L, 58L, 71L, 78L, 78L, 92L, 92L, 93L), 13L, 12L, 13L, 
          0L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          list(28L, -74L, -18L, 10L, 26L, 28L, -96L, -80L, 82L, 94L, 22L, 50L, 72L, -90L, 76L, 50L, 20L, -44L, -80L), 18L, 13L, 13L, 
          0L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 30L, 21L, 31L, 
          0L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          list(25L, 8L, 66L, 90L, 50L, 65L, 76L, 90L, 27L), 4L, 8L, 5L, 
          0L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          list(-98L, -96L, -90L, -82L, -80L, -78L, -70L, -66L, -60L, -60L, -50L, -48L, -34L, -26L, -24L, -16L, -14L, -8L, -6L, 4L, 22L, 24L, 26L, 30L, 30L, 48L, 52L, 56L, 60L, 62L, 74L, 76L, 78L, 86L), 32L, 24L, 24L, 
          1L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          list(1L, 1L, 1L, 0L, 1L, 1L, 0L, 0L, 0L, 1L, 1L, 0L, 1L, 1L, 0L, 0L, 0L, 0L), 15L, 16L, 12L, 
          0L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          list(4L, 6L, 17L, 19L, 24L, 29L, 30L, 31L, 32L, 37L, 37L, 40L, 43L, 44L, 44L, 45L, 57L, 64L, 69L, 70L, 73L, 78L, 86L, 89L, 91L, 92L, 94L), 17L, 21L, 15L, 
          0L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          list(32L, -88L, 70L, -6L, 28L, -48L), 4L, 3L, 4L, 
          0L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 13L, 12L, 11L, 
          0L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          list(37L, 84L, 97L, 74L, 12L, 26L, 47L, 10L, 14L, 33L), 5L, 9L, 8L, 
          0L
      )))
  
  }
  
  main()
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;
  }