Getting wrong answer but for no reason,

My code: https://ideone.com/RkUJQa

Change the printing line in your code to

 cout <<fixed<<setprecision(4)<< (double)(sum)/q.size() << " ";

as they need precision upto 4 decimal spaces

Done with this change, but please tell me how Kartik bhaiya was able to get AC even without writting fixed setprecion(4), in the video solution.

I haven’t seen the video , so not sure. But usually we have to do this only.

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.