title: Number Indexes Equal Elements Given Range
signature: number_indexes_equal_elements_given_range <- function(a, n, l, r) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(a, n, l, r, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(a, n, l, r), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          list(4L, 13L, 13L, 16L, 16L, 19L, 39L, 41L, 48L, 52L, 57L, 62L, 65L, 67L, 76L, 84L, 88L, 91L, 95L, 96L, 97L, 98L), 18L, 12L, 17L, 
          0L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          list(62L, 76L, 86L, -8L, 84L, -6L, 72L, 84L, 6L, -50L, -18L, -94L, 54L, 90L, -74L, -64L, -26L, -14L, -32L, 62L, 10L, 4L, 70L, -28L, 8L, 18L, 4L, -62L, -76L, 84L, -78L, -4L, 84L, 98L, 58L, -68L, 42L, -6L, 34L, -38L, 52L, -84L, 78L), 32L, 38L, 23L, 
          0L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L), 10L, 6L, 6L, 
          0L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          list(11L, 75L, 98L, 29L, 62L, 53L, 48L, 91L, 86L, 66L, 48L, 94L), 8L, 6L, 6L, 
          0L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          list(-94L, -84L, -70L, -70L, -40L, -40L, -36L, -24L, 10L, 48L, 62L, 74L), 11L, 7L, 8L, 
          0L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          list(1L, 0L, 1L, 1L, 0L, 1L, 0L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 1L, 0L, 1L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 1L, 1L, 0L, 0L), 36L, 40L, 37L, 
          0L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          list(1L, 2L, 6L, 7L, 10L, 11L, 13L, 19L, 19L, 25L, 29L, 30L, 32L, 34L, 35L, 45L, 45L, 46L, 47L, 48L, 48L, 53L, 58L, 61L, 64L, 65L, 67L, 75L, 76L, 81L, 81L, 84L, 84L, 85L, 86L, 94L, 94L, 96L, 99L), 25L, 19L, 37L, 
          4L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          list(-56L, 42L, -34L, -12L, -86L, 82L, -96L, -66L, 30L, 16L, -40L, 72L, 84L, 94L, -48L, -30L, 26L, 50L, 42L, -44L, -50L, 22L, -38L, 8L, 34L, 94L, 2L, 16L, -32L, 18L, -58L, 12L, -26L, 28L, -62L), 21L, 30L, 26L, 
          0L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          list(0L, 0L, 0L, 0L, 1L, 1L, 1L), 4L, 5L, 5L, 
          0L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          list(6L, 29L), 1L, 1L, 1L, 
          0L
      )))
  
  }
  
  main()
source_py: def number_indexes_equal_elements_given_range(a, n, l, r):
      count = 0
      for i in range(l, r):
          if (a[i] == a[(i + 1)]):
              count += 1
      return count
source_cpp: int number_indexes_equal_elements_given_range(vector<int> a, int n, int l, int r) {
    int count = 0;
    for ( int i = l;
    i < r;
    i ++ ) if ( a [ i ] == a [ i + 1 ] ) count += 1;
    return count;
  }