Prashant | Sat, 18 Jul, 2020 | 472
It's the header file that includes every header files, i.e., links every header file to our program.
The following code chunk is enough to include every header file needed to be linked in the program.
#include <bits/stdc++.h> Using namespace std;
Like you don’t need to put your time on writing & finding each header file to be mentioned, instead, just add this piece of code chunk.
It’s true that including <bits/stdc++.h>, makes the program size larger and increase the complexity time. Also it’s not part of standard library and can only be used in gcc compiler. Other compilers like MSVC(Microsoft Visual C++) don’t have this header.
Though <bits/stdc++.h> has such pitfalls, we are not at all bothered by this, since our only focus is on competitive coding context, where we are only concerned about run time complexity, not compile time. Also gcc is used everywhere. Thus using <bits/stdc++.h> is a very efficient coding style for solving competetive programming.
One more thing can be very tricky is when we have functional problems to solve. There may be case we have a functional problem, where we need to write the function only & rest of the code is already given (can’t be modified). In such case, we may need to use STL, but so such header file is included in the given code for STL. In such case, it might seem that, we can’t use STL here & we need to take any other way, which is not at all efficient. If you think so, wait a minute!!!
You can add #include <bits/stdc++.h> anywhere in the code, since it’s an ANCI MACRO. That’s why just write #include <bits/stdc++.h> before where you start using STL. (Before the function). That’s all.