Not able to understand why this gives WA

CodeChef: Practical coding for everyone

Approach: Finding the LCM of all pairs and reporting the lowest of all as the answer.

Issue: I am not sure, why this is failing the large input test cases. I am handling everything in long long int

You have initialised ans to INT_MAX, which will serve as infinity in smaller testcases but for original testcases, Ai ranges upto 10^9. LCM can range upto 10^18.

e.g. LCM (999999929, 999999937) = 999,999,866,000,004,473.

just initialise ans with 1e18 and you are good to go