#pragma once #include <cstdint> #include <utility> namespace haar_lib { int64_t gcd(int64_t a, int64_t b) { if (a < b) std::swap(a, b); if (b == 0) return a; return gcd(b, a % b); } int64_t lcm(int64_t a, int64_t b) { return a / gcd(a, b) * b; } } // namespace haar_lib
#line 2 "Mylib/Number/gcd_lcm.cpp" #include <cstdint> #include <utility> namespace haar_lib { int64_t gcd(int64_t a, int64_t b) { if (a < b) std::swap(a, b); if (b == 0) return a; return gcd(b, a % b); } int64_t lcm(int64_t a, int64_t b) { return a / gcd(a, b) * b; } } // namespace haar_lib