Problem: https://mirror.codeforces.com/contest/1459/problem/C
The algorithm is all about up to 4*10^5 many gcd computations of large integers. It appears that Haskell is too slow for even this!
C++ code passes in ~ 1.3 sec.
Haskell code on the other hand exceeds TL (2 sec). Switching from Integer to Int64 did not help a bit. Disappointing.
Any ideas on optimizing it?