title: Multiply Large Integers Under Large Modulo
signature: int multiplyLargeIntegersUnderLargeModulo(int a, int b, int mod_arg2) {
test_code: #include <algorithm>
  #include <assert.h>
  #include <cstdlib>
  #include <iostream>
  #include <map>
  #include <set>
  #include <string>
  #include <tuple> 
  #include <unordered_map>
  #include <vector>
  #include <math.h>
  #include <cmath>
  #include <bits/stdc++.h>
  #include <numeric>
  #include <functional>
  
  using namespace std;
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  bool validateSolution(int actual, int expected){
      return actual == expected;
  }
  
  string driver(int a, int b, int mod_arg2, int expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(a, b, mod_arg2), expected)){
              return "PASSED";
          }
          return "FAILED";
      }
      catch (const std::overflow_error& exception_obj)
      {
          return typeid(exception_obj).name();
      }
      catch (const std::runtime_error& exception_obj)
      {
          return typeid(exception_obj).name();
      }
      catch (const std::exception& exception_obj)
      {
          return typeid(exception_obj).name();
      }
      catch (...)
      {
          return "UNK_ERROR";
      }
  }
  
  int main() {
      string result = "";
  
      result = driver(60, 24, 58, 48); 
      cout << "TEST-" << 0 << "..."
           <<  result
           << "\n";
  
      result = driver(46, 43, 29, 6); 
      cout << "TEST-" << 1 << "..."
           <<  result
           << "\n";
  
      result = driver(4, 50, 71, 58); 
      cout << "TEST-" << 2 << "..."
           <<  result
           << "\n";
  
      result = driver(67, 1, 66, 1); 
      cout << "TEST-" << 3 << "..."
           <<  result
           << "\n";
  
      result = driver(93, 35, 73, 43); 
      cout << "TEST-" << 4 << "..."
           <<  result
           << "\n";
  
      result = driver(89, 97, 8, 1); 
      cout << "TEST-" << 5 << "..."
           <<  result
           << "\n";
  
      result = driver(8, 78, 55, 19); 
      cout << "TEST-" << 6 << "..."
           <<  result
           << "\n";
  
      result = driver(53, 73, 22, 19); 
      cout << "TEST-" << 7 << "..."
           <<  result
           << "\n";
  
      result = driver(96, 92, 83, 34); 
      cout << "TEST-" << 8 << "..."
           <<  result
           << "\n";
  
      result = driver(38, 64, 83, 25); 
      cout << "TEST-" << 9 << "..."
           <<  result
           << "\n";
  
      return 0;
  }
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;
  }