There are some bugs and features exists while compiling a c++ code,it looks weird but really exists on standard c++ compiler.I'll write down the bugs and features here to remind you to aware of them.
1.stl::vector:fail to use operator "=".
I was trying to implent the merge function of segment tree while solving the task,and the initial code is
and found that it will get WA on test #6 using the language C++14(GCC 6-32).Then I found out that the
might got wrong.That because the location of lc[u] changed after using lc.push_back() and the same as rc[u],so the operator "=" might not work.
The bug have been fixed since C++17(GCC 7-32),but if you compile your code using language C++ and the previous version before C++17(GCC 7-32),the bug still exists.
2.vector:Can vector be compiled by head file ?
I've participated on a school contest and found that a code with stl :: vector ran successfully without head file <vector>,after that,I made some testing and found something miraculous:
If the compiler is on Windows system (on codeforces,Dev c++ on Windows,etc),you can use <algorithm> instead of <vector> to compile stl :: vector,but if the compiler is on Linux system (Luogu,and so on),<algorithm> is unable to compile stl :: vector.Also, in Windows <iostream> is able to compile stl :: vector and it's invalid to use <iostream> to compile stl :: vector in Linux.So,for participants,especially for Chinese who is willing to engage on Olympics in informatics,please be aware of this.
3.Have to trun __int128 to long long or int by hand
When I was writting codes,I found that:
__int128 I = 1;
fx[i] = I * (I * s1 * mod * fx2[i] + I * s2 * mod2 * fx[i]) % (mod * mod2) % 1000000007;
The code goes wrong due to __int128 goes wrong when turning to int or long long while printing or setting int or long long varibles.It should be:
__int128 I = 1;
fx[i] = (long long)(I * (I * s1 * mod * fx2[i] + I * s2 * mod2 * fx[i]) % (mod * mod2)) % 1000000007;
instead.
For more such bugs and features,you can reply to the comment and I'll put some of them that sometimes exists but not well-known here.



