title: Multiply Large Integers Under Large Modulo
signature: function multiplyLargeIntegersUnderLargeModulo(a: number, b: number, mod_arg2: number): number {
source_py: def multiply_large_integers_under_large_modulo(a, b, mod):
      res = 0
      a = (a % mod)
      while b:
          if (b & 1):
              res = ((res + a) % mod)
          a = ((2 * a) % mod)
          b >>= 1
      return res
source_cpp: long long multiply_large_integers_under_large_modulo(long long a, long long b, long long mod) {
    long long res = 0;
    a %= mod;
    while ( b ) {
      if ( b & 1 ) res = ( res + a ) % mod;
      a = ( 2 * a ) % mod;
      b >>= 1;
    }
    return res;
  }
question_info.test_list: [{"idx": 0, "outputs": 48, "inputs": {"a": 60, "b": 24, "mod_arg2": 58}}, {"idx": 1, "outputs": 6, "inputs": {"a": 46, "b": 43, "mod_arg2": 29}}, {"idx": 2, "outputs": 58, "inputs": {"a": 4, "b": 50, "mod_arg2": 71}}, {"idx": 3, "outputs": 1, "inputs": {"a": 67, "b": 1, "mod_arg2": 66}}, {"idx": 4, "outputs": 43, "inputs": {"a": 93, "b": 35, "mod_arg2": 73}}, {"idx": 5, "outputs": 1, "inputs": {"a": 89, "b": 97, "mod_arg2": 8}}, {"idx": 6, "outputs": 19, "inputs": {"a": 8, "b": 78, "mod_arg2": 55}}, {"idx": 7, "outputs": 19, "inputs": {"a": 53, "b": 73, "mod_arg2": 22}}, {"idx": 8, "outputs": 34, "inputs": {"a": 96, "b": 92, "mod_arg2": 83}}, {"idx": 9, "outputs": 25, "inputs": {"a": 38, "b": 64, "mod_arg2": 83}}]
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, mod_arg2: number, expected:number): string {
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(a, b, mod_arg2),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver(60, 24, 58, 48);
    console.log(`TEST-0...${result}`);
  
    result = driver(46, 43, 29, 6);
    console.log(`TEST-1...${result}`);
  
    result = driver(4, 50, 71, 58);
    console.log(`TEST-2...${result}`);
  
    result = driver(67, 1, 66, 1);
    console.log(`TEST-3...${result}`);
  
    result = driver(93, 35, 73, 43);
    console.log(`TEST-4...${result}`);
  
    result = driver(89, 97, 8, 1);
    console.log(`TEST-5...${result}`);
  
    result = driver(8, 78, 55, 19);
    console.log(`TEST-6...${result}`);
  
    result = driver(53, 73, 22, 19);
    console.log(`TEST-7...${result}`);
  
    result = driver(96, 92, 83, 34);
    console.log(`TEST-8...${result}`);
  
    result = driver(38, 64, 83, 25);
    console.log(`TEST-9...${result}`);
  
  };
  
  main();
question_info.extension: ts
question_info.entry_fn_name: multiplyLargeIntegersUnderLargeModulo
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