I have tried solving this http://www.codechef.com/problems/CHEFD/ problem using sqrt decomposition technique,but im getting AC for some cases and wrong answer for some cases......Can anyone share mediscuss your idea using sqrt decomposition method for this problem,thanks......