What is the best way to print large outputs in CP in C++?

Hey everyone, I’ve been working on a question where I need to print a lot of integers as the output (10^6 digits for each testcase) and I think I’ve worked out the algorithm but I feel maybe it’s the output part that might be giving me the TLE. Sorry in advanced if this is a very beginner question.

Cout in c++ works just fine, if you want to make it even faster, write cout.tie(0); in main function
Even printf is fast.
You almost never get TLE due to IO method used

3 Likes