title: Compute Average Two Numbers Without Overflow
signature: function computeAverageTwoNumbersWithoutOverflow(a: number, b: number): number {
source_py: def compute_average_two_numbers_without_overflow(a, b):
      return floor(((a + b) / 2))
source_cpp: int compute_average_two_numbers_without_overflow(int a, int b) {
    return ( a + b ) / 2;
  }
question_info.test_list: [{"idx": 0, "outputs": 22, "inputs": {"a": 1, "b": 44}}, {"idx": 1, "outputs": 33, "inputs": {"a": 6, "b": 61}}, {"idx": 2, "outputs": 47, "inputs": {"a": 75, "b": 20}}, {"idx": 3, "outputs": 34, "inputs": {"a": 51, "b": 17}}, {"idx": 4, "outputs": 22, "inputs": {"a": 19, "b": 25}}, {"idx": 5, "outputs": 90, "inputs": {"a": 82, "b": 98}}, {"idx": 6, "outputs": 46, "inputs": {"a": 72, "b": 21}}, {"idx": 7, "outputs": 44, "inputs": {"a": 48, "b": 41}}, {"idx": 8, "outputs": 14, "inputs": {"a": 12, "b": 17}}, {"idx": 9, "outputs": 60, "inputs": {"a": 41, "b": 80}}]
question_info.entry_cls_name: Solution
question_info.test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value: any): string{
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual: number, expected: number): boolean {
      return convertToString(actual) === convertToString(expected);
  }
  
  function driver(a: number, b: number, expected:number): string {
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(a, b),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver(1, 44, 22);
    console.log(`TEST-0...${result}`);
  
    result = driver(6, 61, 33);
    console.log(`TEST-1...${result}`);
  
    result = driver(75, 20, 47);
    console.log(`TEST-2...${result}`);
  
    result = driver(51, 17, 34);
    console.log(`TEST-3...${result}`);
  
    result = driver(19, 25, 22);
    console.log(`TEST-4...${result}`);
  
    result = driver(82, 98, 90);
    console.log(`TEST-5...${result}`);
  
    result = driver(72, 21, 46);
    console.log(`TEST-6...${result}`);
  
    result = driver(48, 41, 44);
    console.log(`TEST-7...${result}`);
  
    result = driver(12, 17, 14);
    console.log(`TEST-8...${result}`);
  
    result = driver(41, 80, 60);
    console.log(`TEST-9...${result}`);
  
  };
  
  main();
question_info.extension: ts
question_info.entry_fn_name: computeAverageTwoNumbersWithoutOverflow
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: tsc --target es2020 --lib es5,dom,es2015,es2020 __FILENAME__
question_info.commands: node __FILENAME__.js