| # | User | Rating |
|---|---|---|
| 1 | Benq | 3676 |
| 2 | jiangly | 3670 |
| 3 | Kevin114514 | 3657 |
| 4 | maroonrk | 3355 |
| 5 | Um_nik | 3353 |
| 6 | squareOf105 | 3346 |
| 7 | tourist | 3343 |
| 8 | strapple | 3324 |
| 9 | heuristica | 3322 |
| 10 | jiangbowen | 3291 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 158 |
| 2 | nik_exists | 150 |
| 2 | maspy | 150 |
| 4 | AmShZ | 143 |
| 5 | Um_nik | 141 |
| 6 | Errichto | 139 |
| 7 | adamant | 137 |
| 8 | BledDest | 133 |
| 8 | maroonrk | 133 |
| 10 | qwexd | 130 |
|
+5
|
|
+16
I'm sorry I forgot to test this earlier. Indeed, However, when I tested other environments that use libc++, such as Ubuntu 24.04 with |
|
+16
Since you've chosen MSYS2 as the distribution for installing GCC, why not try installing However, the |
|
0
So does the MSC++ (MSVisualC++), which has disappeared since the MSVCRT event. |
|
0
This release also includes Also, it is easy to make the Clang use existing MSVC toolkits, by passing |
|
0
No, it's not fixed at least for C++. My further tests show that the bug is just hidden somewhere else. Need some other methods for this bug. See my test and conclusions. |
|
+5
Auto comment: topic has been updated by tatianyi (previous revision, new revision, compare). |
|
0
Months later, CodeForces upgraded its system to Windows Server 2022, meaning that it is finally possible to upgrade almost everything. The .NET8 supports the AOT technology which could accelerate C# codes to the native level. Although .NET6 is a relatively new LTS version, There's no reason not to upgrade .NET in the future. |
|
0
The easiest way to avoid it is to remove those pragmas, especially "target" directives. It's a bug affecting every GCC13 on any platform, and Clang if it's using GCC13's libstdc++. C++ is the tier-0 fast language for competitive programming in Codeforces, I think it's not particularly useful to do so when this language already has a big advantage over others. |
|
0
UPD: It's not fixed at least for C++.Further investigation shows that the bug is just hidden somewhere else. Need some other methods for this bug. See my test and conclusions. Original post↓ It is fixed by updating the system to Windows Server 2022, those legacy 32-bit compilers seemed to benefit from this (you can try copying 253400416 to custom test, and TLE would not happen). As MikeMirzayanov said, they are working on resolving the situation more systematically. MikeMirzayanov did not reveal how they fixed the problem, but I suppose they also migrated the 64-bit compilers to the UCRT version of the mingw64 toolchain. |
|
0
I'm just a Windows user and rarely use Linux. It's my fault that I didn't read the doc thoroughly, and compile and build the libc++ myself. For me, I usually don't compile those libs. Instead, I tend to use existing packages. I install the MSC++ and clang-cl using VCInstaller, and install the MinGW clang using msys2-mingw-w64-ucrt toolchain which acts like a "Linux environment" that comes with GCC by default. The latter is way much easier than building with CMake. Thus, it naturally comes with libstdc++ as it's bundled with GCC toolchain and library. On the other hand, if you try to sync with CodeForces' language config (I mean, see the word "winlibs" in that quote), you could download the GCC + LLVM/Clang/LLD/LLDB release, which is similar to the aforementioned "msys2-mingw-w64-ucrt" version. In this case, I used your code and compiled it with the -Wall flag. It does generate a warning message, and the Although users can not use the pragma directive to enable O3 optimization, the O2 for clang is already nice enough for competitive programming. I'm not saying that clang O2 is necessarily better than GCC O2 or even O3. After all, this thing isn't absolute as we encounter different results. It's enough for this use, I think. Apart from that, as for the __int128 problem, I simply added it failed to compile both for MinGW clang and MinGW GCC(11.4 and 13.2, ucrt). Clang Even unexpectedly, on some online compilers like Customtest of CodeForces and Godbolt, it still failed to compile. GCC As far as I tested, only GCC 12.2 on AtCoder could pass this code. It's confusing and may come with some additional compile flags that control those behaviours. |
|
+2
The new Windows Server 2022 is deployed already. You can use the code in custom test to get info about the system: For Windows only And now the output is |
|
0
Well, in my simple tests, things don't seem to be the same as you say. The clang on Linux or Windows is usually bundled with libstdc++; it seems that only on MacOS is the clang by default bundled with libc++. The bad performance of many STL implementations of libc++ is surely concerning. I got to know that for C++17 However, as for me, I can hardly use libc++ for clang on Windows. I tried to install and configure that but failed. The result is, that I can only use clang-cl or MinGW clang version, whose default configuration is using msSTL or MinGW libstdc++. In my test case, the clang-cl that uses msSTL would report warning: unknown pragma ignored [-Wunknown-pragmas], but the MinGW clang doesn't. It does use MinGW libstdc++, but in my point of view, it is compatible with almost all GCC's compiler features and library features. So as a newbie participant, in my point of view, I still hold the point that for competitive programming, the MinGW clang is almost no different in the usage experience, even the clang-cl would have better performance than the "default" libc++ clang. Maybe what you are concerned about would not appear on the Windows platform with those two versions? |
|
+5
The clang++ is just a compiler frontend that doesn't come along with an STL implementation. On Windows, it could use MSC++'s MSSTL, or use MinGW64-UCRT's libstdc++. I would call the former "clang-cl", and the latter "MinGW clang". The clang-cl would be compatible with most MSC++ compile commands, and MinGW clang would be compatible with most GCC compile commands. MikeMirzayanov didn't mention which clang would be migrated to (or both?). If it's clang-cl, almost all the behaviour would be as similar as MSC++ (except VLA extension), such as 64-bit However, clang could manually set its compile target to MinGW, or automatically do this if it's installed with MinGW (e.g. the packed one with winlibs, currently it provides clang17 with UCRT and clang18 with MSVCRT, but clang18 with UCRT may be coming soon). In this case, all headers that libstdc++ has could be used normally, even with full precompile header Although GCC is much more thoroughly tested as so many OJ are using this, Clang would have a much more aggressive optimisation and better performance due to many tests of participants (say, much faster or even TLEs become ACs after switching GCC to clang on Atcoder). What's more, both clang-cl and MinGW clang have the almost same optimisation ability for my test codes on Windows, thus is no worry about its code generation. And of course, it makes sense to add both compilers and let users decide. |
|
+8
No. See ToxicPie9's test code: It takes about 9 seconds on the CF custom test, while testing this code locally using UCRT mingw64 gcc13.2, it takes no time, showing that this version is still the buggy MSVCRT one. |
|
0
Maybe not, because UCRTmingw64 gcc13.2 and msvc2022 would not trigger this weird 9s bug. But the MSVCRTmingw64 gcc13.2 (including the one recently back) would do. |
|
0
|
|
+8
LL operations in the 32-bit environment are much slower than expected because there is no x64 CPU instruction nor registers to use. In that case, the 32-bit compilers could only simulate the x64 code by taking the data apart (high 32 bits and low 32 bits), calculating those parts individually (without efficient instructions either), and putting it back together. If the code depends heavily on LL type, it could highly TLE as those operations aforementioned are too slow. Also, this TLE on the editorial reflects that the proposer of this question may not have thought about other programming languages (especially those non-compile-based). They were too focused on the details of efficient algorithms and ignored the constant-level effects of the environment/different languages. Fun fact: LL type in 32-bit compilers may be a typedef of |
|
On
ToxicPie9 →
You won't believe how this simple trick defeated the unexplained bug destroying every top LGM, 3 years ago
0
Not only C++20(64) but also other compilers using MSCVRT, along with MSC++2017. |
|
On
ToxicPie9 →
You won't believe how this simple trick defeated the unexplained bug destroying every top LGM, 3 years ago
0
Switching the whole server to Linux is not as easy as upgrading it to later Windows versions. If CF would install an update to obtain UCRT or just simply switch to Windows10/11 or Winserver2016/2019/2022, it could prevent those bugs from happening by using UCRT-based mingw64 version of GCC, Clang and MSVC compiler instead of using MSVCRT version. |
|
0
|
|
+3
As an alternative, you can use std::make_heap, std::push_heap and std::pop_heap which use a (sub)range of STL containers (e.g. vector) to construct a heap in place: These functions also have their C++20 "std::ranges" version like |
|
+8
but these two are already added in STL with C++17 |
|
0
The Visual Studio on CodeForces itself remained in a considerably old version (VS2017 32-bit) because the system that CodeForces uses is Windows 7 (or… Windows Server 2008?) which may be difficult or even cannot upgrade to any newer version! Due to the same reason, the .NET8 cannot be installed on CF, its minimum system requirement is Windows 8.1 (or Windows Server 2012 R2). Thus, unless CF upgrade itself to Windows Server 2022 or newer, we can neither see MSC++latest(VS2022 64-bit) nor C#12 in the language list. The latest version of MSC++ can be VS2019 with full C++20 and C++latest (a bit newer than C++20) 64-bit target output. The .NET, however, version 6.0 is both the latest and LTS one CF can support. Maybe you can contact Vladosiya for more info? I'm just a common newbie participant without such lang-tune-experience. |
|
0
In Visual C++ 2019 or later versions, you can use the header If you take a peek into this header, you will see the line:
and that's how they store an int128 number. It seems that there is no built-in conversion function for these class types, so you may have to use This thread from the MS developer community discussed the VC++ support for 128-bit integer type, and after this port, you can add it with any supported C++ standards. Source code of this header. About non-trivial floating-types, the C++23 standard header However, according to the standards, these headers and other extended floating-types are supposed to be optional. Oops. |
|
0
In my opinion, the compiler "Microsoft Visual C++ 2022" and "Clang-cl 16" are nice to take the role of "preliminary C++23 compiler", or even, replace the 32-bit compiler "Microsoft Visual C++ 2017". The MSC++2022 compiler has implemented the full features of C++20 so early, far away from other compilers. What's more, it has built-in Signed128 and a precompile-header "__msvc_all_public_headers.hpp" just like those GNU compilers did, and of course, bugfixes and performance optimizations. It also supports legacy C++17 mode. Furthermore, upgrading MSC++ to the 2022 version will also benefit the compiler Clang-cl, which has the most stable support of C++20 and C++23 (see aforementioned support list). Currently, the clang-cl aka "Clang diagnostics" doesn't support any c++20 headers as the MSC++2017 lacks support for these headers, which makes it bearly usable. By the way, the winlibs.com build also has a Mingw64-clang version, packed up with latest stable GCC build (13.2), and it would be great if this clang compiler and the clang-cl compiler are set side-by-side; In that case, one participant can freely choose which STL that clang compiler using:
|
|
+21
Oh, thank you! Your answer solved my confusion. I'm using this compiler after contests. Since MSVC seems to appear more often in projects, I expected to practice using this compiler as I may deal with it a lot in the future. |
|
+11
Auto comment: topic has been updated by tatianyi (previous revision, new revision, compare). |
| Name |
|---|


