StackOverflow Answer
- Retrieved from http://stackoverflow.com/a/9371717/ on April 13, 2017
- Posted by user Vaughn Cato on Feb 21 '12 at 3:24
By default, cin
is synchronized with stdio, which causes it to avoid any input buffering. If you add this to the top of your main, you should see much better performance:
std::ios_base::sync_with_stdio(false);