In this problem, my solution (code starts at line 71) is getting Wrong Answer.
I read the editorial.
My solution is the same as the editorial but without binary search.
I wrote a stress test which compared my solution with the editorialists code.
Using large T for different values of N, I could find no case where my answer was different.
stress test code
I cannot find any mistake in my logic or implementation.
Any help would be appreciated.