I'm trying to solve https://www.codechef.com/problems/COOLSBST on codechef, I tried to think of solution that involves precomuting and square decomposition or sorting the test cases based on L and R but couldn't figure it out. can somebody explain how to solve it using square decomposition? thanks in advance.