library
library copied to clipboard
montgomery64 does not work with m = 2 [bug]
Describe the bug
montgomery64 struct of dynamic modulo failed in case the modulo is 2, while it must work when m is prime, and 2 is a prime. https://nyaannyaan.github.io/library/modint/modint-montgomery64.hpp
Additional context
I used your implementation of montgomery64 in this problem, but it got RE. https://atcoder.jp/contests/abc270/submissions/35398727
This test consists of cases when p = 2, and it fails in these cases, while ACL have quite the same implementation and worked.