I solved this problem(https://www.codechef.com/problems/SORTSUB7EZ) by using the assumption that:- "all the remainders of ai(wrt any integer) belong to range [0, (ai+1)/2-1]" but idk the proof, can anyone help?
PS: i tried a few values of ai and found out that assumption.




