This documentation is automatically generated by online-judge-tools/verification-helper
View the Project on GitHub gtnao/algorithm
#include "src/math/mod_pow.hpp"
#pragma once #include <bits/stdc++.h> using namespace std; template <typename T = long long> T mod_pow(T a, T n, T mod) { T res = 1; while (n > 0) { if (n & 1) { res = res * a % mod; } a = a * a % mod; n >>= 1; } return res; }
#line 2 "src/math/mod_pow.hpp" #include <bits/stdc++.h> using namespace std; template <typename T = long long> T mod_pow(T a, T n, T mod) { T res = 1; while (n > 0) { if (n & 1) { res = res * a % mod; } a = a * a % mod; n >>= 1; } return res; }