# What is the purpose of "header" and "footer" for C++ submissions using TIO?

What are the rules for using c++ in code golf? In TIO, there is a header section and a footer section. Can you put your #includes in the header section?

Do you use this template?

HEADER: [#include...]
CODE: <function>
FOOTER: <main method, runs function>


Try it online!

• If in doubt, submit a full program. Mar 25 '18 at 9:27

If your submission require the includes, then no you may not put the #includes in the header. It is consensus that imports/includes should count towards your score.
The reason the header and footer exist is so that you can put boilerplate code in there for testing your program, but then have your byte count not be affected by the boilerplate. For example, if you submitted a function to add two numbers together, such as
int s(int a,int b){return a+b;}

Note that here, I am putting the #include <iostream> in the header because that is needed for the testcase, not the function. If you were submitting a function that required a library such as string or vector, then that would still need to go under code and count towards your byte-count.