my take: https://pastebin.com/EQWj7sTk Decompiling it and messing with flags I couldn't convince writeln to be inlined and its still seems slow so it should be replaced with something each print was 2 asm instructions and writeln so its the majority of the time is with that