What is wrong with my code for STDDEV problem of practice / ICPC(2017)?

I am getting WA for my code. I have seen others solution for the given problem which used same approach but it was AC.
Please an somebody tell me what is wrong with my code.

Problem Link

My Solution