While solving this problem 1359C - Смешиваем воду . I observed a strange thing.
The same code is giving different outputs on different compilers. WA- 146913145 AC- 146915566
I found the test case for which the compilers gave different outputs.
Test Case
for this test case, c++17(64bit) is giving 499979 as output. but c++17 is giving 499981 as output which is as same as correct output.
I want to say that my outputs are compared to the outputs of the authors' solution which was run on c++17. But my solutions should be compared to the outputs which were run on c++17(64bit).
Same happened with me in a different question though, and actually compiling with c++14 and c++20(64 bit) gave answers that differed by 2!
I've played a bit with your code, and if you make #define double long double , it outputs correct answer on both compiliers. So, probably, there're some differences in the floating point treatment.
Please refer to https://mirror.codeforces.com/blog/entry/78161
Yes.
In short 32 bit g++ does a weird thing making doubles sometimes behave like long doubles. You can turn on the same behaviour in 64 bit g++ (shown here: 146961849). But what you really should do is to just use long double everywhere instead of double (if you need high precision).