how to solve primitive queries of february challenge 2017 ?

Can someone tell me how to solve this question ? -link

This question is a duplicate, please look at forums before you post :). here: https://discuss.codechef.com/questions/91516/how-would-you-solve-distnum3

This is such a great resource that you are providing and you give it away for free Best Torrenting Site To Download Torrent I love seeing websites that understand the value of providing a quality resource for free. It is the old what goes around comes around routine.

Spam link/website removed.

//