pub fn mod_pow(mut base: i64, mut exp: i64, m: i64) -> i64 {
    let mut result = 1 % m;
    while exp > 0 {
        if exp % 2 == 1 {
            result = (result * base) % m;
        }
        base = (base * base) % m;
        exp /= 2;
    }
    result
}
/// Modular exponentiation by repeated squaring: returns base^exp % m.
Modular exponentiation by repeated squaring: returns base^exp % m.
Modular exponentiation by repeated squaring : returns base^exp % m .
pub fn mod_pow(mut base: i64, mut exp: i64, m: i64) -> i64 {
    let mut result = 1 % m;
    while exp > 0 {
        if exp % 2 == 1 {
            result = (result * base) % m;
        }
        base = (base * base) % m;
        exp /= 2;
    }
    result
}
pub fn mod_pow ( mut base : i64 , mut exp : i64 , m : i64 ) -> i64 { let mut result = 1 % m ; while exp > 0 { if exp % 2 == 1 { result = ( result * base ) % m ; } base = ( base * base ) % m ; exp /= 2 ; } result }
Modular exponentiation by repeated squaring: returns base^exp % m.
Modular exponentiation by repeated squaring : returns base^exp % m .
base
i64
exp
i64
m
i64
base
i64
exp
i64
m
i64