title: Compute Average Two Numbers Without Overflow 1
signature: function computeAverageTwoNumbersWithoutOverflow1(a: number, b: number): number {
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(9, 81, 45);
    console.log(`TEST-0...${result}`);
  
    result = driver(68, 79, 73);
    console.log(`TEST-1...${result}`);
  
    result = driver(51, 2, 26);
    console.log(`TEST-2...${result}`);
  
    result = driver(31, 49, 40);
    console.log(`TEST-3...${result}`);
  
    result = driver(14, 10, 12);
    console.log(`TEST-4...${result}`);
  
    result = driver(73, 9, 41);
    console.log(`TEST-5...${result}`);
  
    result = driver(51, 13, 32);
    console.log(`TEST-6...${result}`);
  
    result = driver(75, 67, 71);
    console.log(`TEST-7...${result}`);
  
    result = driver(98, 51, 74);
    console.log(`TEST-8...${result}`);
  
    result = driver(83, 74, 78);
    console.log(`TEST-9...${result}`);
  
  };
  
  main();
source_py: def compute_average_two_numbers_without_overflow_1(a, b):
      return (((a // 2) + (b // 2)) + (((a % 2) + (b % 2)) // 2))
source_cpp: int compute_average_two_numbers_without_overflow_1(int a, int b) {
    return ( a / 2 ) + ( b / 2 ) + ( ( a % 2 + b % 2 ) / 2 );
  }