https://codeforces.com/contest/1737/submission/175037592 https://codeforces.com/contest/1737/submission/175037480 https://codeforces.com/contest/1737/submission/175037412

These three exactly same codes when submitted in GNU C++ 14 or 20 give wrong answers on test 4 and when submitted in GNU C++ 17 gives wrong answer on test 11, although they seem to work perfectly on my system, any clue why is it so? (p.s. failed system tests. :') )

Auto comment: topic has been updated by fkndonttrespass (previous revision, new revision, compare).Same issue. My B was passed in pretest and WA in tc 11 system test with c++17. AC with sqrtl instead of sqrt.

I faced the same issue during contest. So I had to write a sqrt() function of my own assuming sqrt() in C++ stl is not right. This code gets AC with sqrt() function in other GNU C++ . Apparently, for some reason sqrt() is returning the ceil value in some cases.

~~Because sqrt() is double function and since both double and long long has 8 bytes, it won't be able to convert to long long precisely.~~That's why I switched to C++20.

Getting WA on pretest X is better FSTs.

C++20 is more precise in my opinion

change sqrt to sqrt because the input is long long

Ac c++14 : 175143762, Ac c++17 : 175144031, Ac c++20 : 175144158

I just change the sqrt to sqrtl