550x gains with some C ++ / mixed gnarly low level assembly vs standard C++ is pretty shocking to me.
With that in mind, I propose the following solution.
`print(976563)`
... std::cin >> v; ...
Oh come on! That's I/O for every item, I'm surprised it's not even slower.
Alexander Monakov has called the attention of the highload Telegram chat to this paper[0], saying:
So one wonders if it's not really a matter of reading the RAM in the right pattern to appease the prefetchers but of using values in the right pattern to create the right pattern of stalls to get the highest frequency.[0]: https://tu-dresden.de/zih/forschung/ressourcen/dateien/proje...