How to take fast I/O in C++? I am solving a problem where number of test cases can be 10^6 so i guess fast I/O will help to speed up my solution.
| # | User | Rating |
|---|---|---|
| 1 | Benq | 3676 |
| 2 | Kevin114514 | 3659 |
| 3 | jiangly | 3640 |
| 4 | turmax | 3450 |
| 5 | tourist | 3382 |
| 6 | strapple | 3360 |
| 7 | Um_nik | 3354 |
| 8 | squareOf105 | 3348 |
| 9 | maroonrk | 3312 |
| 10 | idontwannadothis…e | 3191 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 156 |
| 2 | nik_exists | 151 |
| 3 | maspy | 149 |
| 4 | AmShZ | 145 |
| 5 | Um_nik | 143 |
| 6 | Errichto | 139 |
| 7 | BledDest | 136 |
| 8 | adamant | 135 |
| 9 | maroonrk | 132 |
| 10 | cry | 130 |
How to take fast I/O in C++? I am solving a problem where number of test cases can be 10^6 so i guess fast I/O will help to speed up my solution.
| Name |
|---|



Check out these links :
https://algocoding.wordpress.com/2015/04/23/fast-io-methods-for-competitive-programming/ http://codeforces.me/blog/entry/6251
+1 but sometimes it's not enough
Another possible way is to implement your own reader for integer/real/signed types using
getchar():In most cases coders use it to get top1 by execution time))
But in case
N = 10^6it may be useful to beat TL with solution that wasn't intended by jury.Thanks it did reduce my time but still TLE. I guess i have to improve my algo.