on last CodeForces, the problem A of Div1 Contest (this problem) was about some GCD operations. My solution (by the way, totally overkill, despite the fact that some people may have used the same idea) used binary search and some prefix sum matrix (for checking if GCD on range equals 1), only considering primes smaller than 40,050. Although it is getting AC (my solution during the contest, translated to english), I figured out a case where it fails:
(actually, it could be any prime numbers greater than 40,050.)
In this case the solution is -1 (because the gcd of two equal numbers is the number itself), however, my code prints 1 as the answer. Is there anything that can be done about this?