title: Multiply Large Integers Under Large Modulo
signature: func multiplyLargeIntegersUnderLargeModulo(a int, b int, mod_arg2 int) int {
test_code: package main
  
  import (
      "fmt"
      "reflect"
      "math"
      "sort"
  )
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  func validateSolution(actual int, expected int) bool {
      return reflect.DeepEqual(actual,expected)
  }
  
  func driver(a int, b int, mod_arg2 int, expected int) string {
      if validateSolution(PLACEHOLDER_FN_NAME(a, b, mod_arg2),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver(60, 
  	24, 
  	58, 48)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(46, 
  	43, 
  	29, 6)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(4, 
  	50, 
  	71, 58)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(67, 
  	1, 
  	66, 1)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver(93, 
  	35, 
  	73, 43)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver(89, 
  	97, 
  	8, 1)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver(8, 
  	78, 
  	55, 19)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver(53, 
  	73, 
  	22, 19)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver(96, 
  	92, 
  	83, 34)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver(38, 
  	64, 
  	83, 25)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
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;
  }