Weak test cases, even editorial solution doesn't handle them


If A,B,C are both close to 1e9, then the product will overflow, and we cant find the lcm, I wasted 20 mins trying to get around the overflow.

Even the editorial solution doesn’t handle that, one of the solutions tries to avoid overflow but that will fail for A,B,C prime.

I took a chance and removed the check for overflow, the solution passed, weak test cases;


yes , you are right.
I too had the same problem.


It is so true. I changed everything to BigInteger in Java and made it work.