How do you calculate the length of my program for "The 10 shortest solutions"?

Modified on Thu, 9 Jul at 12:43 PM

First, we count the total number of bytes in all files. In particular, windows-style newlines `\r\n` are counted as 2 bytes. If you are using windows and want a short solution, you should ensure that you're using Unix-style newlines: `\n`.

Second, we also count the total length of all filenames, including the extension. The shortest file name that matches any of the following RegEx patterns will not be counted in the length:

  • <default filename>.<ext> (where <default filename> is the name of the file that Kattis' editor automatically creates)
  • [Mm]ain.<ext>
  • [Pp]rogram.<ext>
  • [Ss]olution.<ext>
  • [Kk]attis.<ext>
  • [Cc]hallenge.<ext>
  • [Pp]roblem[A-Za-z0-9].<ext>
  • [A-Za-z].<ext> (a single letter)

Where <ext> is the RegEx [A-Za-z0-9+]{1,5}. All supported languages on Kattis match this RegEx.



The sum of these two parts is the length of your submission.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article