MikeMirzayanov's blog

By MikeMirzayanov, history, 4 hours ago, In English

Hello, Codeforces!

Together with Vladosiya, we've added support for the 64-bit g++14 C++23. You can find it under the name GNU G++23 14.2 (64 bit, winlibs).

If you're using Windows, you can easily install it via our minimalistic package manager, PBOX, by running the command pbox install gcc14-64-winlibs.

Thanks to the WinLibs project! We used the distribution from this page: https://winlibs.com/ GCC 14.2.0 (with POSIX threads) + LLVM/Clang/LLD/LLDB 18.1.8 + MinGW-w64 12.0.0 UCRT - release 1, Win64.

Your solutions will be compiled using the following command line: g++ -Wall -Wextra -Wconversion -static -DONLINE_JUDGE -Wl,--stack=268435456 -O2 -std=c++23 program.cpp.

Now you can start using C++23 features!

Please note that support for GNU G++23 14.2 (64 bit, winlibs) is currently experimental. We invite you to join in the testing and experimentation process. Share your thoughts and experiences in the comments!

It seems this distribution experiences performance degradation, which can lead to time limit exceeded verdict in some cases. For now, we don't recommend using it in real contests.

  • Vote: I like it
  • +461
  • Vote: I do not like it

»
4 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Cool

»
4 hours ago, # |
  Vote: I like it +14 Vote: I do not like it

clang diag when back

»
4 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

ha?

»
4 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Finally the wait is over...[Hooray]

»
4 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

its perf is really bad, last contest's E1 gave 1800ms in +23, 1600ms in +20 and 1200ms in +17

»
4 hours ago, # |
  Vote: I like it +31 Vote: I do not like it

That's great! Thanks a lot!

»
4 hours ago, # |
  Vote: I like it -14 Vote: I do not like it

first comment hooray!!! attractors

»
4 hours ago, # |
Rev. 4   Vote: I like it -7 Vote: I do not like it

I'd just tried to use new compiler in this submission 277680488, got TLE

but previously absolutely same solution 277680737 (1 char difference to be able to submit it again) gave me AC

MikeMirzayanov please pay attention on it

»
3 hours ago, # |
  Vote: I like it +5 Vote: I do not like it

Cant use print :(

»
3 hours ago, # |
  Vote: I like it +7 Vote: I do not like it

Savior-of-Cross bro can finally rest after asking from last 5 months.

»
2 hours ago, # |
  Vote: I like it +1 Vote: I do not like it

Oh finally!, it is amazing, thanks a lot!!!

»
2 hours ago, # |
  Vote: I like it +2 Vote: I do not like it

Thank you.

std::format will be very useful to make many output statements cleaner for those not using printf style format strings.

Before: std::cout << a << " + " << b << " = " << a+b << '\n';

After: std::cout << std::format("{} + {} = {}\n", a, b, a+b);

»
110 minutes ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Quick benchmarking got really weird: an $$$\mathcal{O}(n \log^2{n})$$$ code on 1991C - Absolute Zero used like double runtime in C++23 compared to C++20:

Was it a bug, or was it intended that way...?

Extra: trying to use set in that approach yielded 1500ms for C++20 (TL=2s), and instant TLE for C++23.

  • »
    »
    98 minutes ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    Extra #2: The runtime difference is seven-fold for $$$\mathcal{O}(n \log{n})$$$ ? [more precisely, $$$\mathcal{O}(n \log{\left( \max{a_i} - \min{a_i} \right)})$$$ ]

»
87 minutes ago, # |
  Vote: I like it +20 Vote: I do not like it

As of now, C++23 is not in the best shape, but when GCC will finally implement it, it will go hard.

Mainly for competitive programming, a C++23 gold nugget is std::print.

Finally clunky output with std::cout goes away in favor of elegant:

std::println("The meaning of the {} is {}", "universe" 42); // prints "The meaning of the universe is 42"

"Oh, nice printing, cool" you might think, but it gets better:

std::vector<std::pair<int, std::string>> vec = { {0, "hii"}, {1, "arul"} };
std::print("{}", vec); // prints [(0, "hii"), (1, "arul")]
// or not, they are not implemented yet :p
  • It is faster than std::cout or printf (so maybe fast io hack won't be as used)

Also additional cool things are std::flat_set and std::flat_map that are basically(very roughly speaking) more cache-friendly counterparts of std::set and std::map. Will it be better than std::set and std::map for competitive programming? Time will tell, right now they are not even implemented in GCC.

Also there's deducing this which makes recursive lambdas not as weird (i am a certified lambda glazer, which means that deducing this is epic and cool)

Summarizing, C++23 adds great features for competitive programming. In theory. In reality, GCC 14.2 doesn't implement most features that folks on codeforces would find interesting

»
73 minutes ago, # |
  Vote: I like it 0 Vote: I do not like it

Amazing! No more cout (=

Thank you very much for the effort put into making c++23 available!

»
1 minute ago, # |
  Vote: I like it 0 Vote: I do not like it

Thanks a lot!!!!!