137. Modular Exponentiation
MediumFast Power
Print aᵇ mod m.
Input format
A single line: a b m
Output format
aᵇ mod m
Example 1
Input
2 10 1000
Output
24
Example 2
Input
3 0 7
Output
1
Constraints
0 ≤ a, b ≤ 10¹⁸ 1 ≤ m ≤ 10⁹
Read input from standard input and print the answer to standard output. Your code is judged against 5 test cases, most of them hidden.
Loading the MyLoginn IDE…