Can you tell my mistake?

Also, I did not understand the way bhaiya has used the loop for test cases.

check now

it’s the value for k, for each value of k we will divide the array of mixtures into different halfs.

I am not talking about that.
while(scanf("%d",&n))!=EOF, I di not understand this

this means that we will take input of value of n, until the input.txt file reaches to end of file that is eof

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.