Read the problem very carefully if you think that you can't solve it then re-read it again with the problemStatement, input and output slowly and carefully. INPUT: May all the numbers are distinct or are less than 10^5 or something like that is given in the input OUTPUT: See exactly what you have to print. Breakdown the problem Statement in the smallest part and do it in paper before solving it in code. DONT SEE STANDINGS DURING THE CONTEST.