CHEFRAIL Wrong Answer

Could anyone please point out the mistake in my solution.
my WA code
I solved this as it is in editorial. O(N * sqrt(N))