For faster input

I found that calling
std::ios_base::sync_with_stdio (false);
before taking the inputs in cpp programs increases the speed of taking input. but can somebody explain me what it actually does to make the process faster.

This command turns off iostreams and stdio synchronization. It is on by default, which means that calls to iostreams and stdio functions can be freely interleaved even for the same underlying stream. When synchronization is turned off, mixing calls is no longer allowed, but iostreams can potentially operate faster.

3 Likes

you can also untie cin and cout to speed up the process…

cin.tie(NULL);
(use this)
check this for better explanations…
http://codeforces.com/blog/entry/5217