NOTINCOM :: Wrong-answer

What’s wrong in my code
https://www.codechef.com/viewsolution/19000005

A typo!!! The inner ‘for’ loop should be “for(long int l=1;l<=b;l++)”.

Resolving this should get you 47pts. For the rest 53pts, you need to implement set (Complexity: O(N)), or apply binary search on sorted array (Complexity: O(N.lg N)).