title: Find The Missing Number 1
signature: find_the_missing_number_1 <- function(a, n) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(a, n, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(a, n), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          list(13L, 27L, 46L, 59L, 62L, 82L, 92L), 6L, 
          -261L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          list(22L, 86L, -64L, -20L, -56L, -16L, 86L, 42L, 72L, -90L, 10L, 42L, 56L, 8L, 50L, 24L, -34L, 0L, -78L, 64L, 18L, 20L, -84L, -22L, 90L, -20L, 86L, 26L, -54L, 0L, 90L, -48L, 4L, 88L, 18L, -64L, -22L, -74L, 48L, -36L, -86L, -24L, 88L, -64L, 68L, 62L, 92L), 38L, 
          524L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 15L, 
          131L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          list(55L, 89L, 56L, 85L, 26L, 4L, 91L, 91L, 3L, 77L, 63L, 59L, 76L, 90L, 1L, 94L, 44L, 70L, 8L, 54L, 3L, 91L, 29L, 95L, 28L, 75L, 20L), 22L, 
          -954L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          list(-94L, -84L, -80L, -78L, -66L, -62L, -54L, -52L, -26L, -8L, -8L, -6L, 4L, 4L, 8L, 14L, 26L, 58L, 60L, 62L, 62L, 76L, 78L, 86L, 92L), 18L, 
          694L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          list(1L, 0L, 0L, 0L, 1L, 0L, 0L, 1L, 1L, 0L, 0L, 0L, 1L, 1L, 0L, 0L, 1L, 0L, 0L, 1L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 0L, 0L), 25L, 
          341L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          list(1L, 2L, 7L, 7L, 9L, 14L, 23L, 29L, 31L, 31L, 35L, 35L, 38L, 41L, 44L, 49L, 49L, 50L, 51L, 54L, 55L, 56L, 57L, 63L, 67L, 69L, 73L, 79L, 79L, 80L, 86L, 88L, 93L), 24L, 
          -506L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          list(78L, -48L, 16L, 22L, -16L, 34L, 56L, -20L, -62L, -82L, -74L, -40L, 20L, -24L, -46L, 64L, 66L, -76L, 58L, -84L, 96L, 76L, 86L, -32L, 46L), 12L, 
          227L
      )))
  
      cat(sprintf("TEST-8...%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, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 29L, 
          463L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          list(73L, 76L, 25L, 59L, 40L, 85L, 90L, 38L, 13L, 97L, 93L, 99L, 45L, 7L), 12L, 
          -697L
      )))
  
  }
  
  main()
source_py: def find_the_missing_number_1(a, n):
      (i, total) = (0, 1)
      for i in range(2, (n + 2)):
          total += i
          total -= a[(i - 2)]
      return total
source_cpp: int find_the_missing_number_1(vector<int> a, int n) {
    int i, total = 1;
    for ( i = 2;
    i <= ( n + 1 );
    i ++ ) {
      total += i;
      total -= a [ i - 2 ];
    }
    return total;
  }