I have a problem which will take 1000000 lines of inputs like below from console.
0 1 23 4 5 1 3 5 2 56 12 2 3 33 5 ... ...
I have used scanf,
Read a line at a time (if buffer not big enough for a line, expand and continue with larger buffer).
Then use dedicated functions (e.g. atoi) rather than general for conversion.
But, most of all, set up a repeatable test harness with profiling to ensure changes really do speed things up.