If your submission require the includes, then no you may not put the #include
s 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;}
then this is a valid 31-byte solution. However, people looking at it can't immediately verify that this solution is correct because it needs certain boilerplate to run. So you could put some additional code in the header and footer to make it a testcase, like Try it online! without drastically inflating your byte count.
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.