You need to write a program that sums all codepoints of the input string. ## Rules * The input will always be in printable ASCII. * The sum of the codepoints of your source must be exactly 2540. * You are allowed to use your language's own code page to calculate your program's codepoints. * Null bytes (which don't contribute to your codepoint sum) are banned. * The program must not work with any consecutive substring removed. * This is Code Golf. Your score is the length of your source code, the shorter being better.
Top Answer Python 3
# [Python 3] IDLE, 24 bytes sum(map(ord,_+'Ο'))-927 [Try it online!][TIO-khjewg4s] The Unicode character `Ο` (not to be confused with `O`) has character code 927, but only uses two bytes in UTF-8. Splitting the `+'Ο'` and the `-927` means that no contiguous substring can be removed without breaking the program. (My original, 18-byte version used a comment at the end, which doesn't satisfy this requirement.) I get the feeling that this is not within the spirit of the rules, but it *is* within the letter. [Python 3]: https://docs.python.org/3/ [TIO-khjewg4s]: https://tio.run/##fVBBTsMwELz3FUsusdUQUThUVGqewAcARVGyoRvsteW4EryGH/GlsDERASSYi60Zz4x3/Ws8Ob6ZOuyhb56xDuiNGk9ojD5sQNAHZ6F1HQJZ70KUu/VksJbTNtylR4YYRzhCMpajNxRV/sC5TiqJcvUZ5gIMQAyh4SdUuwIMskpuDVvYLZ0zWjH9qkqR5eBosdzTYXjU@stCvbhoBHYR7hzjGjbDB2L5VVVVeQGSVJYl/Jc2A1@wVe1Pbp5m2Cx9BBfHbzOsjUsb8TyDwYhph7KQzbpmUf05Ki3sSoYsy6bxbJVtvHKhK@pt/v6Wa315e72fRNR/qh8 "Python 3 – Try It Online"