#include #include using namespace std; template constexpr decltype((T1)1 % (T2)1) GCD(const T1 a, const T2 b) noexcept { decltype((T1)1 % (T2)1) x = a, y = b, z = 0; while (y != 0) z = x % y, x = y, y = z; return x; } template constexpr bool is_squared(const T1 target, T2 l, T2 r) noexcept { while (l + 1 < r) { const T2 c = l + (r - l) / 2; const decltype((T1)1 * (T2)1) c_squared = static_cast(c) * c; if (c_squared < target) l = c + 1; else if (c_squared != target) r = c; else return true; } return false; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); uint64_t A, B; cin >> A >> B; if (is_squared(GCD(A, B), 1, 1'000'000'001)); return 0; }