- // Disable IO buffering for C and C++ standard libraries
- setvbuf(stdin, NULL, _IONBF, 0);
- setvbuf(stdout, NULL, _IONBF, 0);
- cout.rdbuf()->pubsetbuf(NULL, 0);
- cin.rdbuf()->pubsetbuf(NULL, 0);
+ // Don't sync with C library I/O buffers, faster but now using printf()
+ // or scanf() could yield to issues because buffers are independent.
+ cout.sync_with_stdio(false);
+ cin.sync_with_stdio(false);