Do you execute the program from inside code::blocks or as a standalone one ?
From inside (green arrow at the top, or submenu Build/Run, or Ctrl-F10) it should work with gcc 13.1 as shown in your configuration. (It works for me, so gcc 13.1 is OK).
As standalone, running directly your .exe, you can have a problem if your Windows main PATH contains the old compiler path. C:\MingW64\bin should appear before the old compiler path (because your program need to know where is the right dll version of libstdc++-6.dll).
PS : for your information, it's also OK with gcc 8.1 but you have to force C++17 compatibility (at least) in the compiler options (as indicated in the journal during compile and link).