What if your solution got TLE due to denormal numbers? Would you add if(val<eps)val=0
everywhere? Today I found a simpler fix: let's include #include <xmmintrin.h>
and insert _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
at the beginning of the main function.
I confirmed this magic works on AtCoder, Codechef, Yandex, and, of course, on Codeforces.
Since it's written on the Wikipedia page, I won't be surprised if this is a well-known trick in some countries. However, I and my friends haven't heard of this, so it must be worth sharing.
Note that I know nothing about what exactly this snippet does, and I'm happy to hear from computer experts what the possible defects it has if such exist.
It might be a little hard to remember, but you can actually manipulate mxcsr register yourself as below without including any additional headers to achieve the same effect.
so learn silently don't brag here