title: Find The Missing Number 1
signature: fun findTheMissingNumber1(a: ArrayList<Int>, n: Int): Int {
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;
  }
question_info.test_list: [{"idx": 0, "outputs": -261, "inputs": {"a": [13, 27, 46, 59, 62, 82, 92], "n": 6}}, {"idx": 1, "outputs": 524, "inputs": {"a": [22, 86, -64, -20, -56, -16, 86, 42, 72, -90, 10, 42, 56, 8, 50, 24, -34, 0, -78, 64, 18, 20, -84, -22, 90, -20, 86, 26, -54, 0, 90, -48, 4, 88, 18, -64, -22, -74, 48, -36, -86, -24, 88, -64, 68, 62, 92], "n": 38}}, {"idx": 2, "outputs": 131, "inputs": {"a": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "n": 15}}, {"idx": 3, "outputs": -954, "inputs": {"a": [55, 89, 56, 85, 26, 4, 91, 91, 3, 77, 63, 59, 76, 90, 1, 94, 44, 70, 8, 54, 3, 91, 29, 95, 28, 75, 20], "n": 22}}, {"idx": 4, "outputs": 694, "inputs": {"a": [-94, -84, -80, -78, -66, -62, -54, -52, -26, -8, -8, -6, 4, 4, 8, 14, 26, 58, 60, 62, 62, 76, 78, 86, 92], "n": 18}}, {"idx": 5, "outputs": 341, "inputs": {"a": [1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0], "n": 25}}, {"idx": 6, "outputs": -506, "inputs": {"a": [1, 2, 7, 7, 9, 14, 23, 29, 31, 31, 35, 35, 38, 41, 44, 49, 49, 50, 51, 54, 55, 56, 57, 63, 67, 69, 73, 79, 79, 80, 86, 88, 93], "n": 24}}, {"idx": 7, "outputs": 227, "inputs": {"a": [78, -48, 16, 22, -16, 34, 56, -20, -62, -82, -74, -40, 20, -24, -46, 64, 66, -76, 58, -84, 96, 76, 86, -32, 46], "n": 12}}, {"idx": 8, "outputs": 463, "inputs": {"a": [0, 0, 0, 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": 29}}, {"idx": 9, "outputs": -697, "inputs": {"a": [73, 76, 25, 59, 40, 85, 90, 38, 13, 97, 93, 99, 45, 7], "n": 12}}]
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(a: ArrayList<Int>, n: Int, expected:Int):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(a, n), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver(arrayListOf(13, 27, 46, 59, 62, 82, 92), 6, -261)
      println("TEST-0...${result}")
      
      result = driver(arrayListOf(22, 86, -64, -20, -56, -16, 86, 42, 72, -90, 10, 42, 56, 8, 50, 24, -34, 0, -78, 64, 18, 20, -84, -22, 90, -20, 86, 26, -54, 0, 90, -48, 4, 88, 18, -64, -22, -74, 48, -36, -86, -24, 88, -64, 68, 62, 92), 38, 524)
      println("TEST-1...${result}")
      
      result = driver(arrayListOf(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), 15, 131)
      println("TEST-2...${result}")
      
      result = driver(arrayListOf(55, 89, 56, 85, 26, 4, 91, 91, 3, 77, 63, 59, 76, 90, 1, 94, 44, 70, 8, 54, 3, 91, 29, 95, 28, 75, 20), 22, -954)
      println("TEST-3...${result}")
      
      result = driver(arrayListOf(-94, -84, -80, -78, -66, -62, -54, -52, -26, -8, -8, -6, 4, 4, 8, 14, 26, 58, 60, 62, 62, 76, 78, 86, 92), 18, 694)
      println("TEST-4...${result}")
      
      result = driver(arrayListOf(1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0), 25, 341)
      println("TEST-5...${result}")
      
      result = driver(arrayListOf(1, 2, 7, 7, 9, 14, 23, 29, 31, 31, 35, 35, 38, 41, 44, 49, 49, 50, 51, 54, 55, 56, 57, 63, 67, 69, 73, 79, 79, 80, 86, 88, 93), 24, -506)
      println("TEST-6...${result}")
      
      result = driver(arrayListOf(78, -48, 16, 22, -16, 34, 56, -20, -62, -82, -74, -40, 20, -24, -46, 64, 66, -76, 58, -84, 96, 76, 86, -32, 46), 12, 227)
      println("TEST-7...${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, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), 29, 463)
      println("TEST-8...${result}")
      
      result = driver(arrayListOf(73, 76, 25, 59, 40, 85, 90, 38, 13, 97, 93, 99, 45, 7), 12, -697)
      println("TEST-9...${result}")
      
          
  }
  
  main()
question_info.entry_fn_name: findTheMissingNumber1
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