title: Modular Exponentiation Power In Modular Arithmetic
signature: pub fn modular_exponentiation_power_in_modular_arithmetic(x: i32, y: i32, p: i32) -> i32 {
test_code: use std::collections::HashMap;
  use std::collections::HashSet;
  use std::cmp::*;
  use std::collections::*;
  use std::fmt::*; 
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  pub fn validate_solution(actual: i32, expected: i32)->bool{
  return actual==expected
  }
  pub fn driver(x: i32, y: i32, p: i32, expected: i32)->String{
      if validate_solution(PLACEHOLDER_FN_NAME(x, y, p), expected) {
        return "PASSED".to_string();
      };
      return "FAILED".to_string();
  
  }
  
  fn main() {
      println!("TEST-0...{}", driver(
        45, 5, 68, 
        61
      ));
      
      println!("TEST-1...{}", driver(
        67, 25, 49, 
        18
      ));
      
      println!("TEST-2...{}", driver(
        26, 91, 44, 
        4
      ));
      
      println!("TEST-3...{}", driver(
        33, 61, 9, 
        0
      ));
      
      println!("TEST-4...{}", driver(
        35, 8, 13, 
        3
      ));
      
      println!("TEST-5...{}", driver(
        68, 41, 5, 
        3
      ));
      
      println!("TEST-6...{}", driver(
        14, 76, 20, 
        16
      ));
      
      println!("TEST-7...{}", driver(
        5, 89, 13, 
        5
      ));
      
      println!("TEST-8...{}", driver(
        23, 42, 45, 
        19
      ));
      
      println!("TEST-9...{}", driver(
        37, 63, 56, 
        29
      ));
      
  }
source_py: def modular_exponentiation_power_in_modular_arithmetic(x, y, p):
      res = 1
      x = (x % p)
      while (y > 0):
          if ((y & 1) == 1):
              res = ((res * x) % p)
          y = (y >> 1)
          x = ((x * x) % p)
      return res
source_cpp: int modular_exponentiation_power_in_modular_arithmetic(int x, unsigned int y, int p) {
    int res = 1;
    x = x % p;
    while ( y > 0 ) {
      if ( y & 1 ) res = ( res * x ) % p;
      y = y >> 1;
      x = ( x * x ) % p;
    }
    return res;
  }