This documentation is automatically generated by competitive-verifier/competitive-verifier
// competitive-verifier: STANDALONE
#include "src/Math/mod_inv.hpp"
constexpr auto f= mod_inv(2, 1000000007);
static_assert(f == 500000004);
constexpr auto g= mod_inv(3, 998244353);
static_assert(g == 332748118);
signed main() { return 0; }
#line 1 "test/alone/constexpr_mod_inv.test.cpp"
// competitive-verifier: STANDALONE
#line 2 "src/Math/mod_inv.hpp"
#include <utility>
#include <type_traits>
#include <cassert>
template <class Uint> constexpr inline Uint mod_inv(Uint a, Uint mod) {
std::make_signed_t<Uint> x= 1, y= 0, z= 0;
for (Uint q= 0, b= mod, c= 0; b;) z= x, x= y, y= z - y * (q= a / b), c= a, a= b, b= c - b * q;
return assert(a == 1), x < 0 ? mod - (-x) % mod : x % mod;
}
#line 4 "test/alone/constexpr_mod_inv.test.cpp"
constexpr auto f= mod_inv(2, 1000000007);
static_assert(f == 500000004);
constexpr auto g= mod_inv(3, 998244353);
static_assert(g == 332748118);
signed main() { return 0; }