[Solved] why is cin/cout slower than scanf/ printf
The speed difference is largely due to the iostream I/O functions maintaining synchronization with the C I/O functions. We can turn this off with a call to std::ios::sync_with_stdio(false); By default standard C++ streams are synchronized to the standard C stream after each input/output operation. Once synchronization is turned off, the C++ standard streams are allowed … Read more