text:
Convert Input to Direction
Challenge
Given input in the form <n1>, <n2> where number can be -1, 0, or 1, return the corresponding cardinal direction. Positive numbers move East in the x-axis and South in the y-axis, Negative numbers move West in the x-axis and North in the y-axis.
Output must be in the form South East, North East, North. It is case-sensitive.
If the input is 0, 0, your program must return That goes nowhere, silly!.
Sample Input/Outpot:
1, 1 -> South East
0, 1 -> South
1, -1 -> North East
0, 0 -> That goes nowhere, silly!
This is code-golf, the shortest answer in bytes wins.

Loosely related

Some examples with W, NW and SW are needed.

@seshoumara I'm on mobile, so no backticks, but NW would be -1, -1

Are trailing Spaces allowed?

Uhh... Sure, I guess. As long as it looks the same.

Can we take +1 instead of 1?

No (15 chars minimum to comment)

Can we take the numbers in the opposite order? 1, 0 is "South"?

No. Must be x, y.

Can we take numbers as two separate command-line arguments?

@EriktheOutgolfer Yes, you can.

Japt, 55 51 bytes
`
SÆ
NÆ° `·gV +`
E†t
Wƒt`·gU ª`T•t goƒ Í2€e, Ðéy!

Explanation
                      // Implicit: U, V = inputs
`\nSÆ \nNÆ° `       // Take the string "\nSouth \nNorth ".
·                     // Split it at newlines, giving ["", "South ", "North "].
gV                    // Get the item at index V. -1 corresponds to the last item.
+                     // Concatenate this with
`\nE†t\nWƒt`·gU       // the item at index U in ["", "East", "West"].
ª`T•t goƒ Í2€e, Ðéy!  // If the result is empty, instead take "That goes nowhere, silly!".
                      // Implicit: output result of last expression

Try it online!

Um... I... ??? How on earth does this work? Does Japt have like some fancy things that replace common character pairs?

@HyperNeutrino Yes, Japt uses the shoco compression library which replaces common pairs of lowercase characters with a single byte.

Okay, that's really cool! I'll look into that, see if I can make any use out of it.

Python, 101 87 bytes
Really naive solution.
lambda x,y:['','South ','North '][y]+['','West','East'][x]or'That goes nowhere, silly!'

Thanks to @Lynn for saving 14 bytes! Changes: Using the string.split method actually makes it longer ;_; And also, negative indexes exist in python.

You can cut it down to 87 like this: lambda x,y:('','South ','North ')[y]+('','East','West')[x]or'That goes nowhere, silly!'

I found a neat way to get some directions, but unfortunately it doesn't seem like it will work for this challenge. Figured I'd share it anyways (perhaps someone craftier than I can figure out how to deal with its problems, like when x or y = 0): lambda x,y:'North htuoS'[::x][:6]+'EastseW'[::y][:4] Edit: it likely will now be too long, but you can make the second slicing [:6*x**2], likewise for the East/West string, if you can circumvent the error on the first slicing.

@Lynn lambda x,y:('North ','South ')[y+1]+('West','East')[x+1]or'That goes nowhere, silly!' is shorter by 2 bytes

@Lynn Oh, thanks! (I forgot about negative indexes!)

@DeadPossum That won't work because it will return South East for (0, 0). Thank you though!

@HyperNeutrino Yeah, I missed that

Here's a working variant of my alternate solution; I'm bummed that it's unfortunately 99 bytes (it would be closer if it didn't need the or 1).
lambda x,y:'North htuoS'[::y or 1][:6*y*y]+'EastseW'[::x or 1][:4*x*x]or"That goes nowhere, silly!"

PHP, 101 Bytes
[,$b,$a]=$argv;echo$a|$b?[North,"",South][1+$a]." ".[West,"",East][1+$b]:"That goes nowhere, silly!";

It's a long time since I programmed in PHP, but how does it know North, South, West and East are strings without double-quotes around them? Is this because of the empty String that shares the same array? If yes, does this also mean you cannot have an array with different types at once (like an array with both a string and an integer)?

@KevinCruijssen North is a constant http://php.net/manual/en/language.constants.php If the constant not exists it will be interpreted as string. An array in PHP can contain different types. strings can be specified in four ways http://php.net/manual/en/language.types.string.php

Perl 6, 79 bytes
{<<'' East South North West>>[$^y*2%5,$^x%5].trim||'That goes nowhere, silly!'}

Try it
Expanded:
{ # bare block lambda with placeholder parameters ｢$x｣ and ｢$y｣

  << '' East South North West >>\ # list of 5 strings
  [                               # index into that with:

    # use a calculation so that the results only match on 0
    $^y * 2 % 5, # (-1,0,1) => (3,0,2) # second parameter
    $^x % 5      # (-1,0,1) => (4,0,1) # first parameter

  ]
  .trim  # turn that list into a space separated string implicitly
         # and remove leading and trailing whitespace

  ||     # if that string is empty, use this instead
  'That goes nowhere, silly!'
}

JavaScript (ES6), 106 100 97 93 bytes
It's a very simple approach. It consists of a few ternary operators nested together -
f=a=>b=>a|b?(a?a>0?"South ":"North ":"")+(b?b>0?"East":"West":""):"That goes nowhere, silly!"

Test Cases

f=a=>b=>a|b?(a?a>0?"South ":"North ":"")+(b?b>0?"East":"West":""):"That goes nowhere, silly!"

console.log(f(1729)(1458));
console.log(f(1729)(-1458));
console.log(f(-1729)(1458));
console.log(f(-1729)(-1458));
console.log(f(0)(1729));
console.log(f(0)(-1729));
console.log(f(1729)(0));
console.log(f(-1729)(0));

a!=0 can be replaced by just a, since 0 is falsy and all other values are truthy. Also, taking input in currying syntax is shorter, and the array appoach is also shorter.

@Luke Thanks for the suggestion! I have edited the answer. Now, I am beating the PHP and Python solutions! All because of you!!! Thanks!

Save another byte by doing f=a=>b=> and calling the function like f(1729)(1458); which is the currying syntax that @Luke mentioned.

You can safely use a|b instead of a||b. Assuming that the input only consists of -1, 0 or 1 (which is unclear to me), you could replace a>0 and b>0 with ~a and ~b.

Also, you don't need these parentheses: a?(...):"" / b?(...):""

Are you sure you need the semi-colon at the end?

@Luke I think you should post it as an answer!

I don't think you need any of the parentheses ;)

He does... These parentheses cannot be left out: a|b?(...)+(...):"", all others can, saving 4B in total.

@ETHproductions Thanks a lot! I removed 4 of them. The rest 2 are necessary are necessary, as Luke mentions.

JavaScript (ES6), 86 bytes
a=>b=>["North ","","South "][b+1]+["West","","East"][a+1]||"That goes nowhere, silly!"

Explanation
Call it with currying syntax (f(a)(b)). This uses array indices. If both a and b are 0, the result is a falsy empty string. In that case, the string after the || is returned.
Try it
Try all test cases here:

let f=
a=>b=>["North ","","South "][b+1]+["West","","East"][a+1]||"That goes nowhere, silly!"

for (let i = -1; i < 2; i++) {
    for (let j = -1; j < 2; j++) {
        console.log(`${i}, ${j}: ${f(i)(j)}`);
    }
}

Batch, 156 bytes
@set s=
@for %%w in (North.%2 South.-%2 West.%1 East.-%1)do @if %%~xw==.-1 call set s=%%s%% %%~nw
@if "%s%"=="" set s= That goes nowhere, silly!
@echo%s%

The for loop acts as a lookup table to filter when the (possibly negated) parameter equals -1, and concatenating the matching words. If nothing is selected then the silly message is printed instead.

Japt, 56 bytes
N¬¥0?`T•t goƒ Í2€e, Ðéy!`:` SÆ NÆ°`¸gV +S+` E†t Wƒt`¸gU

Try it online! | Test Suite
Explanation:
N¬¥0?`Tt go Í2e, Ðéy!`:` SÆ NÆ°`¸gV +S+` Et Wt`¸gU
Implicit U = First input
         V = Second input

N¬¥0?`...`:` ...`qS gV +S+` ...`qS gU
N¬                                                     Join the input (0,0 → "00")
  ¥0                                                   check if input is roughly equal to 0. In JS, "00" == 0
    ?                                                  If yes:
      ...                                               Output "That goes nowhere, silly!". This is a compressed string
     `   `                                              Backticks are used to decompress strings
          :                                            Else:
           ` ...`                                       " South North" compressed
                 qS                                     Split on " " (" South North" → ["","South","North"])
                   gV                                   Return the string at index V
                     +S+                                +" "+
                        ` ...`                          " East West" compressed
                              qS gU                     Split on spaces and yield string at index U

Hint: 00 is exactly the same as 0, as the extra digit gets removed ;)

The second-best solution yet no upvote. I upvote for you.

GNU sed, 100 + 1(r flag) = 101 bytes
s:^-1:We:
s:^1:Ea:
s:-1:Nor:
s:1:Sou:
s:(.*),(.*):\2th \1st:
s:0...?::
/0/cThat goes nowhere, silly!

By design, sed executes the script as many times as there are input lines, so one can do all the test cases in one run, if needed. The TIO link below does just that.
Try it online!
Explanation:
s:^-1:We:                         # replace '-1' (n1) to 'We'
s:^1:Ea:                          # replace '1' (n1) to 'Ea'
s:-1:Nor:                         # replace '-1' (n2) to 'Nor'
s:1:Sou:                          # replace '1' (n2) to 'Sou'
s:(.*),(.*):\2th \1st:            # swap the two fields, add corresponding suffixes
s:0...?::                         # delete first field found that starts with '0'
/0/cThat goes nowhere, silly!     # if another field is found starting with '0',
                                  #print that text, delete pattern, end cycle now

The remaining pattern space at the end of a cycle is printed implicitly.

Scala, 107 bytes
a=>b=>if((a|b)==0)"That goes nowhere, silly!"else Seq("North ","","South ")(b+1)+Seq("West","","East")(a+1)

Try it online
To use this, declare this as a function and call it:
val f:(Int=>Int=>String)=...
println(f(0)(0))

How it works
a =>                                // create an lambda with a parameter a that returns
  b =>                              // a lambda with a parameter b
    if ( (a | b) == 0)                // if a and b are both 0
      "That goes nowhere, silly!"       // return this string
    else                              // else return
      Seq("North ","","South ")(b+1)    // index into this sequence
      +                                 // concat
      Seq("West","","East")(a+1)        // index into this sequence

C, 103 bytes
f(a,b){printf("%s%s",b?b+1?"South ":"North ":"",a?a+1?"East":"West":b?"":"That goes nowhere, silly!");}

Retina, 84 82 81 bytes
1 byte saved thanks to @seshoumara for suggesting 0...? instead of 0\w* ?
(.+) (.+)
$2th $1st
^-1
Nor
^1
Sou
-1
We
1
Ea
0...?

^$
That goes nowhere, silly!

Try it online!

The output is wrong. OP wants positive numbers to move S in the y-axis and negative numbers to move N.

@seshoumara Right, fixed it for same bytecount (just had to swap Nor and Sou)

Ok. Also, you can shave 1 byte by using 0...?.

@seshoumara Thanks for the tip :)

05AB1E, 48 45 43 bytes
õ'†Ô'…´)èUõ„ƒÞ „„¡ )èXJ™Dg_i“§µ—±æÙ,Ú¿!“'Tì

Try it online!
Explanation
õ'†Ô'…´)                                       # push the list ['','east','west']
        èU                                     # index into this with first input
                                               # and store the result in X
          õ„ƒÞ „„¡ )                           # push the list ['','south ','north ']
                    èXJ                        # index into this with 2nd input
                                               # and join with the content of X
                       ™                       # convert to title-case
                        Dg_i                   # if the length is 0
                            “§µ—±æÙ,Ú¿!“       # push the string "hat goes nowhere, silly!"
                                        'Tì    # prepend "T"

C#, 95 102 bytes

Golfed
(a,b)=>(a|b)==0?"That goes nowhere, silly!":(b<0?"North ":b>0?"South ":"")+(a<0?"West":a>0?"East":"");

Ungolfed
( a, b ) => ( a | b ) == 0
    ? "That goes nowhere, silly!"
    : ( b < 0 ? "North " : b > 0 ? "South " : "" ) +
      ( a < 0 ? "West" : a > 0 ? "East" : "" );

Ungolfed readable
// A bitwise OR is perfomed
( a, b ) => ( a | b ) == 0

    // If the result is 0, then the 0,0 text is returned
    ? "That goes nowhere, silly!"

    // Otherwise, checks against 'a' and 'b' to decide the cardinal direction.
    : ( b < 0 ? "North " : b > 0 ? "South " : "" ) +
      ( a < 0 ? "West" : a > 0 ? "East" : "" );

Full code
using System;

namespace Namespace {
    class Program {
        static void Main( string[] args ) {
            Func<Int32, Int32, String> f = ( a, b ) =>
                ( a | b ) == 0
                    ? "That goes nowhere, silly!"
                    : ( b < 0 ? "North " : b > 0 ? "South " : "" ) +
                      ( a < 0 ? "West" : a > 0 ? "East" : "" );

            for( Int32 a = -1; a <= 1; a++ ) {
                for( Int32 b = -1; b <= 1; b++ ) {
                    Console.WriteLine( $"{a}, {b} = {f( a, b )}" );
                }
            }

            Console.ReadLine();
        }
    }
}

Releases

v1.1 - + 7 bytes - Wrapped snippet into a function.
v1.0 -  95 bytes - Initial solution.

Notes
I'm a ghost, boo!

That's a code snippet you need to wrap it in a function i.e. add the (a,b)=>{...} bit

You can use currying to save a byte a=>b=>, might not need the () around the a|b, you might be able to use interpolated strings to get the string built up nicer as well

Completely forgot to wrap into a function :S. For the () around the a|b, I do need it, otherwise Operator '|' cannot be applied to operands of type 'int' and 'bool'. I've also tried the interpolated strings, but didn't give much though due to the "" giving me errors.

Jelly, 40 bytes
Ṛị"“¡ƘƓ“¡+9“»,“wµ“¡ḳ]“»Kt⁶ȯ“¬ɼ¬<¬O÷ƝḤẎ6»

Try it online!

Swift 151 bytes
func d(x:Int,y:Int){x==0&&y==0 ? print("That goes nowhere, silly!") : print((y<0 ? "North " : y>0 ? "South " : "")+(x<0 ? "West" : x>0 ? "East" : ""))}

PHP, 95 bytes.
This simply displays the element of the array, and if there's nothing, just displays the "default" message.
echo['North ','','South '][$argv[1]+1].[East,'',West][$argv[2]+1]?:'That goes nowhere, silly!';

This is meant to run with the -r flag, receiving the coordenates as the 1st and 2nd arguments.

Röda, 100 bytes
f a,b{["That goes nowhere, silly!"]if[a=b,a=0]else[["","South ","North "][b],["","East","West"][a]]}

Try it online!
This is a trivial solution, similar to some other answers.

Java 7, 130 bytes
String c(int x,int y){return x==0&y==0?"That goes nowhere, silly!":"North xxSouth ".split("x")[y+1]+"WestxxEast".split("x")[x+1];}

Explanation:
String c(int x, int y){               // Method with x and y integer parameters and String return-type
  return x==0&y==0 ?                  //  If both x and y are 0:
     "That goes nowhere, silly!"      //   Return "That goes nowhere, silly!"
    :                                 //  Else:
     "North xxSouth ".split("x"[y+1]  //   Get index y+1 from array ["North ","","South "] (0-indexed)
     + "WestxxEast".split("x")[x+1];  //   Plus index x+1 from array ["West","","East"] (0-indexed)
}                                     // End of method

Test code:
Try it here.
class M{
  static String c(int x,int y){return x==0&y==0?"That goes nowhere, silly!":"North xxSouth ".split("x")[y+1]+"WestxxEast".split("x")[x+1];}

  public static void main(String[] a){
    System.out.println(c(1, 1));
    System.out.println(c(0, 1));
    System.out.println(c(1, -1));
    System.out.println(c(0, 0));
  }
}

Output:
South East
South
North East
That goes nowhere, silly!

CJam, 68 bytes
"
South
North

East
West"N/3/l~W%.=s_Q"That goes nowhere, silly!"?

Try it online! or verify all test cases
Prints one trailing space on [0 -1] or [0 1] (North or South).
Explanation
"\nSouth \nNorth \n\nEast\nWest"  e# Push this string
N/                                e# Split it by newlines
3/                                e# Split the result into 3-length subarrays,
                                  e#  gives [["" "South " "North "]["" "East" "West"]]
l~                                e# Read and eval a line of input
W%                                e# Reverse the co-ordinates
.=                                e# Vectorized get-element-at-index: accesses the element
                                  e#  from the first array at the index given by the
                                  e#  y co-ordinate. Arrays are modular, so -1 is the last
                                  e#  element. Does the same with x on the other array.
s                                 e# Cast to string (joins the array with no separator)
_                                 e# Duplicate the string
Q"That goes nowhere, silly!"?     e# If it's non-empty, push an empty string. If its empty,
                                  e#  push "That goes nowhere, silly!"


text:
Shh... Can You Split a Secret?
In Applied Cryptography by Bruce Schneier (which I have been reading quite a lot recently), a protocol for splitting secrets is discussed. Here is a brief description:

Trent generates a random byte string, R, the same length as the message, M.
Trent XORS M with R to make S.
He gives R to Alice and S to Bob.

Your task is to, given an input, split the input into two output files or print the split secret to STDOUT. One output/part of output should contain the random string; the other should contain the original input XOR'd with the random string. Input and output may be to/from files or to/from STDIN/STDOUT. Outputting to STDERR is also allowed.
There are a few restrictions, however:

Your program must take 1 input (1 input filename & 2 outputs if doing file I/O), and output the random string and the original string XOR'd with that random string into the other.
Your program must be cryptographically secure. All random number generators must be cryptographically secure. For example, /dev/random is fine, but the Mersenne Twister (usually randint(number,number) is not. Any random number generator must be explicitly cryptographically secure.

If you want to know anything more about what "cryptographically secure" means, check here.

Standard rules and loopholes apply.

This is code-golf, so the code with the fewest bytes will win.
May the best coder prosper...

-1 for the cryptographically secure part. It doesn't add much to the challenge, other than making answers work around that restriction.  It's not harder, just another step.

@Riker I felt like that adds to the challenge, personally, but I hear you.

This is similar, but this isn't necessarily alphanumeric.

"random string" String of bits, bytes, or printable ASCII chars?

@ETHproductions If you aren't doing file I/O, these aren't needed.

@ETHproductions Bytes

Also, a thank you to whoever starred this question.

@ETHproductions You're welcome :)

Is XORing done bitwise for each byte? Can we assume any character-to-bytes encoding?

Can we take input and output as arrays of bytes, rather than strings?

@LuisMendo It is done for each byte, and you can assume any encoding that actually exists.

@ETHproductions Yes. I actually encourage that, in fact.

Is I/O in hexadecimal acceptable?

Bash + coreutils + openssl, 91 bytes
0000000: 63 3d 22 6f 70 65 6e 73 73 6c 20 65 6e 63 20 2d  c="openssl enc -
0000010: 61 65 73 2d 31 32 38 2d 63 74 72 20 2d 4b 20 24  aes-128-ctr -K $
0000020: 28 78 78 64 20 2d 70 73 20 2d 6c 20 31 36 20 2f  (xxd -ps -l 16 /
0000030: 64 65 76 2f 72 61 6e 64 6f 6d 29 20 2d 69 76 20  dev/random) -iv
0000040: 30 22 0a 24 63 3c 24 31 0a 74 72 20 01 2d ff 20  0".$c<$1.tr .-.
0000050: 5c 30 3c 24 31 7c 24 63 3e 26 32                 \0<$1|$c>&2

Takes a filename as argument and splits the secret to STDOUT and STDERR. Input and output are in raw binary format.
Sample run
$ cat input.txt
Bruce
$ bash split input.txt 2> >(xxd -ps >& 2) | xxd -ps
d5725c26aa3b
97002945cf31
$ printf %02x $[0xd5725c26aa3b ^ 0x97002945cf31] | xxd -r -ps
Bruce

Haskell, 178 Bytes
import System.Entropy
import qualified Data.ByteString as B
import Data.Bits
main|f<-B.init=do b<-B.getLine;r<-getEntropy.B.length$f b;B.putStrLn.pack.B.zipWith xor r$f b;print r

Unfortunately, I can't quite think of a way to do this without three big imports.
More readable version:
main=do b<-B.getLine
        r<-getEntropy . B.length $ B.init b
        B.putStrLn . pack . B.zipWith xor r $ f b
        print r

Basically, it reads a line from stdin, makes a random number with that length and then prints the xor'd version and the random number

JavaScript (ES6), 77 76 bytes

let f =
M=>[R=crypto.getRandomValues(new Uint8Array(M.length)),M.map((c,i)=>c^R[i])]

let g = m => console.log(f([...m].map(c=>c.charCodeAt())).map(x=>`[${x.join(", ")}]`).join(",\n"))
g("Secret message")
g("\0\0\0\0\0\0\0\0")

I think this is what's being asked for. It takes in an array of bytes and outputs [random bytes, XORed message]. I'm assuming that crypto.getRandomValues is cryptographically secure (else I don't know why it exists), and that Math.random isn't. Otherwise I could save 28 bytes.

This is the kind of answer I wanted!

Python 3, 85 bytes
import os
s=input()
k=os.urandom(len(s))
print(list(k),[j^ord(i)for i,j in zip(k,s)])

The only part that might need explaining is the list comprehension ([j^ord...])
It combines the input with the random key (zip([1,2,3],[4,5,6])==[(1,4),(2,5),(3,6)])
and xors them together.

Ruby, 88 76 bytes
Edit: I guess the outputs don't have to be strings strings?
m=gets.bytes
p r=`head -c#{m.size}</dev/random`.bytes,m.zip(r).map{|a,b|a^b}

Java, 292 bytes
Not sure if 100% correct
enum e{;public static void main(String[]a){java.security.SecureRandom r=new java.security.SecureRandom();byte[]b=a[0].getBytes(),c=new byte[b.length],d=new byte[c.length];int i=-1;r.nextBytes(c);while(++i<b.length)d[i]=(byte)(b[i]^c[i]);System.out.println(new String(c)+"\n"+new String(d));}}

Takes the input as first argument, outputs key and XOR'ed string to STDOUT separated by newlines.
Ungolfed with comments:
enum e {
    ;

    public static void main(String[] a) {
        java.security.SecureRandom r = new java.security.SecureRandom();            // Secure random
        byte[] b = a[0].getBytes(), c = new byte[b.length], d = new byte[c.length]; // 3 arrays
        int i = -1;                                                                 // Index
        r.nextBytes(c);                                                             // Key
        while (++i < b.length) d[i] = (byte) (b[i] ^ c[i]);                         // XOR the input with key
        System.out.println(new String(c) + "\n" + new String(d));                   // Output key and XORed string
    }
}

This is a perfectly acceptable answer.

You could drop the java.security. as any modern IDE can auto-import that unambiguously.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Shortest example of code that is compiled and increasing the optimization level makes it take longer
Just curious if someone can provide a short example of code that causes a compiler's optimizer to behave incorrectly:

without optimization (or at lower optimization), code takes X seconds to run
with optimization (or at higher optimization), code takes Y seconds to run where Y > X

In other words, the optimizer's cost model causes it to make a poor decision with a specific case, even though (presumably) it makes good decisions in general.
This is meant for C (with gcc the comparisons should be between -O0, -O1, -O2, -O3 in increasing order of optimization), but any compiled language should work.

Welcome to PPCG! This site is for specific code challenges, where multiple answers can exist for the community to see. From what I can see, this could be a potential code challenge; however, all code-challenges need some sort of scoring system to objectively determine a winner. If you're wondering whether or not this is possible, Stack Overflow might be a more suitable place to look.

This challenge has a creative premise, but I feel like issues such as winning criteria could have been worked out better if it was posted in the sandbox. Regardless, thanks for posting and welcome!

Good idea, but, as I learned when I joined PPCG, try posting it in the sandbox first.

This seems machine specific. For example, GCC's -ftree-vectorize (on at -O3) automatically vectorizes loops using SIMD instruxtions. On most computers, this is a win, but, especially on older Intel CPUs, their SIMD units were quite slow.

Also you might need to cross compile to get it to show the poor behavior. Compile it on a modern processor then put it on a machine with a first generation SSEx unit for whatever SSE has the relevant instruction.

I've got an example where gcc produces slightly better code when using -Os (which is basically O2 + trying to save space) than when using -O3. Does that count?

@Christoph yes please that would be interesting :-)

Could someone help me come up with a simple objective scoring system? (e.g. shortest code where the version with increased optimization is at least 20% slower)

C (gcc 6.2.0-5ubuntu12 x86_64), 58 bytes
typedef struct{long a,b}s;s f(long*c){return(s){*c,c[1]};}

Compiled with -O1, we get the following assembly code (minus boilerplate):
f:
    movq    8(%rdi), %rdx
    movq    (%rdi), %rax
    ret

With -O3, it looks like this:
f:
    movdqu  (%rdi), %xmm0
    movaps  %xmm0, -24(%rsp)
    movq    -24(%rsp), %rax
    movq    -16(%rsp), %rdx
    ret

This is obviously worse (the first version copies from memory to registers directly, the second version copies from memory into the wrong register, back into scratch space in memory, and then from there into the correct registers, which is just doing more work for no gain).
This is a pretty longstanding example of a silly gcc miscompilation. In older versions of gcc, the -O3 code was even worse (containing a full function setup/teardown sequence, stack protection checks, and the like); it seems to have improved somewhat in the more recent versions.
Incidentally, clang produces code almost identical to gcc's -O1 at any positive optimization level (the only difference is that sometimes the two assignments are done in the other order).

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
How much does this Integer score?
The Challenge
Given an integer, calculate its score as described below.
The score is calculated by raising each digit of the input Integer to the power n, where n denotes the index of the digit in Input (beginning with 1) when counted from left to right (the index of leftmost digit should be 1), and then summing them all together. If the original number happens to be prime, then add the largest digit of the input integer to the score, else subtract the smallest digit of the input integer from it.
Input
Your program should take an integer as input. You can take the input in whatever way you want to.
Output
Output the score of the input integer through whatever medium your programming language supports. Function return is also allowed.

Test Cases
 5328   ->  (5^1)+(3^2)+(2^3)+(8^4)-2 = 4116
 3067   ->  (3^1)+(0^2)+(6^3)+(7^4)+7 = 2627
 7      ->  (7^1)+7                   = 14

Scoring
This is code-golf, so the shortest code in bytes wins!

Hello and welcome to the site! In order for questions to be considered on-topic here it needs an "objective winning criterion"  that means that there needs to be some goal everyone is attempting to attain with there answers.  The most common one is [tag:code-golf] which means answers should aim to minimize their source length.

Aside from being off topic because there is no winning criterion (a formality, as tagging it with, e.g., code-golf would solve that), there are a few issues. 1. Where do we get 5^1 + 3^2 + 2^3 + 8^4 from? That doesn't seem to be explained anywhere. 2. Strings are forbidden, but what about arrays? 3. If we write a program, how are we supposed to take input if we're not allowed to use strings?

There is a Sandbox where you can post challenge ideas and get feedback from the community without it affecting your site reputation. It's generally a good idea to leave it in there for at least a week

To be clear, you mean the largest/smallest digit numerically, not the rightmost/leftmost digit, right?

This challenge was made code golf so it could be reopened. That means the shortest answer should be accepted.

Ohm, 17 16 bytes (CP437)
EDIT: Fixed so that it checks the input's primality.
▓_^≥ⁿ;Σ┼Dp?╧+¿╤-

One of these days I need to get around to implementing vectorization. Maybe then I'll finally beat 05AB1E!
Explanation:
▓_^≥ⁿ;Σ┼Dp?╧+¿╤-    Main wire: arguments: n

▓    ;              Map the following over all digits of n:
 _^≥ⁿ                 Raise the digit to the (index + 1)th power
      Σ             Push the sum of all that
       ┼Dp          Is n prime?
          ?         If so...
           ╧+         Add the maximum digit of n to the sum
             ¿      Else...
              ╤-      Subtract the minimum digit of n from the sum
                    (Implicit output)

Unfortunately, you should be checking if the original input is prime, not the sum. Also I have no idea how to run this D:

@Someguy That's not what the challenge says...?

Also, this is a fairly new language, so there's not a TIO link. You'll have to go to the page linked in the header and download the interpreter.

just found out that a moderator edited my question and changed it. I'll switch it back, that was not your fault.

@Someguy Alright, fixed!

Congratulations, you tied for first place!

Mathematica, 63 bytes
s+Max@If[PrimeQ[s=Tr[d^Range@Length[d=IntegerDigits@#]]],d,-d]&

Pure function taking a positive integer as input and returning an integer. Directly performs the indicated computation, with all the long Mathematica command names that requires. Perhaps the one innovation is noticing that, if d is the list of digits of the input, then the last addition/subtraction is the same as adding Max[d] if the initial sum was prime, and adding Max[-d] if not.

05AB1E, 16 bytes
DpiZëW(}¹gL¹SmO+

Try it online!
Explanation
D                  # duplicate input
 piZ               # if input is prime then max digit of input
    ëW(            # else -min digit of input
       }           # end if
        ¹gL        # range [1 ... len(input)]
           ¹S      # input split into digits
             m     # pow
              O    # sum
               +   # add

Dg needs simplified with a desperate intensity. I wish there were a get(a) push length.

@carusocomputing: True. That's a function that actually often needs a get.

I don't see a good byte for it though, unfortunately, that won't break existing code and is 1 byte.

@carusocomputing: Yeah, there aren't any useless 1-byte commands left.

For an input of 3067, your program should return 2627. It appears that your program is not adding the largest number given a prime input! For that reason, I can not accept your solution.

@Someguy: For the input 3067, the sum is 2620 which is definitely not prime, so it should subtract the smallest number 0 leading to the result 2620.

@Emigna 3067 is a prime number. If you can edit your solution to fix this problem (it shouldn't be too hard) then I will declare you the victor!

@Someguy: You just edited the question though. It said If the number achieved by following the this procedure over the input integer happens to be prime, then add the largest digit of the input integer to the score, else subtract the smallest digit of the input integer from it.

I will actually save a byte changing the code to the new spec though.

That was not the original specification, for some reason a moderator came in and changed my entire problem lol. It's not your fault. But if you post a new solution I'll give you the win.

@Someguy: That explains it. It's been changed to follow the new/original spec :)

@Emigna nicely done, congratulations!

@Someguy Well, I was the culprit. I wrongly interpreted the test cases, so my edit actually went against your original intention. And none of Suggested Edit Reviewer figured out the mistake! (Don't be angry; as I am the one who got this reopened and I am one who got you eleven up votes; besides, when the question was reopened, I was the one who posted in the chat room, The Nineteenth Byte, that this question, having been reopened, needed to be out of the abyss it was in at that time (it had 4 down votes). So, just don't be angry! :) I hope you are not :). Thanks for reading such long comment!!

@Arjun I am not mad at you at all! In fact, I'm glad you got this reopened. The mistake you made was nominal and it's really not a big deal.

@Arjun And you should be a moderator!

Mathematica, 68 bytes
#+If[PrimeQ@#,Max@x,-Min@x]&@Tr[(x=IntegerDigits@#)^Range[Tr[1^x]]]&

Explanation

Sets x equal to the list of digits of the input, then raises that to the power Range[Tr[1^x]], effectively raising the first digit to the power 1, the second digit to the power 2, and so on up to Tr[1^x], the length of x. Tr sums the resulting list, which is then passed into the function #+If[PrimeQ@#,Max@x,-Min@x]&.

Nicely done, congratulations!

JavaScript, 173 bytes
Add an f= at the beginning and invoke like f(n).
n=>{k=(n+"").split``;t=k.map((c,i)=>c**(i+1)).reduce((c,p)=>c+p);j=1;for(i=2;i<n;i++){j=n%i||n==2?1:0;if(!j)break}return j?t+Math.max.apply(Math,k):t-Math.min.apply(Math,k)}

Explanation
Takes in an Integer. Converts it into String. Then, converts it into Array. Uses map over the Array to make a new array having all its elements raised to their index+1th (+1 because JavaScript used zero-based indexes). Then uses reduce to sum them all together. Checks whether the obtained number is prime.  If it is then it returns the obtained number incremented  by the largest digit of the Array otherwise returns the obtained number decremented by smallest digit of it.

Test Cases

f=n=>{k=(n+"").split``;t=k.map((c,i)=>c**(i+1)).reduce((c,p)=>c+p);j=1;for(i=2;i<n;i++){j=n%i||n==2?1:0;if(!j)break}return j?t+Math.max.apply(Math,k):t-Math.min.apply(Math,k)}

console.log(f(5328));
console.log(f(3067));
console.log(f(7));
console.log(f(123));
console.log(f(1729));
console.log(f(2));
console.log(f(1458));
console.log(f(91));

For an input of 3067, your program should return 2627. It appears that your program is not adding the largest number given a prime input! For that reason, I can not accept your solution.

@Someguy The code was made to add the largest number only when the obtained number happened to be a prime. It's just the recent edit that you made that made my solution go wrong for the test cases. Nevertheless, I have edited the solution to reflect the edition of the question.

Python 3: 260 167 bytes
def s(n):
 t,l=0,list(str(n))
 for i,d in enumerate(l):t+=int(d)**(int(i)+1)
  for i in range(2,n-1):
   if n%i==0:t-=int(min(l))
  else:t+=int(max(l))
  break
 return t

93 bytes saved by Wheat Wizard

This is what I use: https://mothereff.in/byte-counter. I recommend removing some whitespace to save bytes

Hello and welcome to the site!  I see a couple of improvements that you can make here. 1) When double indenting use spaces for one level of indentation and tabs for 2 this will save you bytes on indentation. 2) Your first for loop can be put on one list by simply removing the whitespace between the : and the t.  3) you can move the two breaks outside of the if/else statement and combine them into a single break to save bytes.  Once that is done you can put each part of the if/else onto its own line.

Here is a implementation of my suggestions.

Ruby, 98 bytes
->n{i= ~s=0
a=n.digits
a.map{|d|s+=d**(a.size-i+=1)}
s>1&&(2...s).all?{|i|s%i>0}?s+a.max: s-a.min}

I've never coded in Ruby but can't you remove the whitespace in a.max: s-a.min?

Nope. :foo is a Symbol literal.

It's been a while since I golfed in Ruby, but I think every instance of each can be replaced with map unless you're making use of the unchanged return value.

You're right. I was using the slightly different behavior of each while golfing, realized I didn't need it, but forgot to switch back to map.

PHP, 174 bytes
function s($i){$i=str_split($i);foreach($i as $k=>$x){$r+=pow($x,$k+1);}if(p($r)){$r+=max($i);}else{$r-=min($i);}print$r;}function p($n){for($i=$n;--$i&&$n%$i;);return$i==1;}

Try it online!

Python 2, 111 bytes
g=lambda n,z=1:n and(n%10)**len(`n`)+g(n/10,0)+int(['-'+min(`n`),max(`n`)][all(n%x for x in range(2,n))*n>1])*z

Try it Online!
Recursive function which calculates the sum starting with the last digit.
n and(n%10)**len(`n`)+g(n/10,1) is the recursive portion of the function
int(['-'+min(`n`),max(`n`)][...])*z returns 0 for all iterations except the first
all(n%x for x in range(2,n))*n>1] is the primality test
Alternate solution (115 bytes):
lambda n:sum(int(j)**(i+1)for i,j in enumerate(`n`))+int(['-'+min(`n`),max(`n`)][all(n%x for x in range(2,n))*n>1])

Try it Online!

Python 3, 118 bytes
*a,=map(int,input())
x=sum(n**-~i for i,n in enumerate(a))
print(x+(-min(a),max(a))[all(x%z for z in range(2,x))*x>1])

Try it online!
Thanks to @math_junkie for pointing out a bug.

This fails for input 1. It should output 0, not 2


text:
The Tenacious Thai Calendar
In the Thai calendar the year 2017 corresponds to 2560. The Thai calendar is always 543 years ahead of the Gregorian calendar.
Observant coders will note that 2560 is equal to \$2^9 \times 5\$, in other words it has 10 prime factors. This will not happen again for another 896 years! We call a year tenacious if it has exactly ten prime factors.
Write a program which outputs a truthy value if the current year using the Thai calendar, based on the system clock, is tenacious, and a falsey value otherwise.
Test cases:

If the program is run during 2017, true
If the program is run during any of the years 2018 to 2912, false
If the program is run during 2913, true (\$2913+543 = 2^7 \times 3^3\$)

If using a language or running in an environment without a system clock, is it acceptable to take the current time as input?

Bash + coreutils, 35 bytes
factor $[`date +%Y`+543]|awk NF==11

Output is either a non-empty string (truthy) or an empty string (falsy).
Try it online!
Alternate version: 37 bytes.
date -d 543year +%Y|factor|awk NF==11

Not as golfy, but I like this one.
Try it online!
How it works
The arithmetic expansion
$[`date +%Y`+543]
executes date +%Y to get the current (full) year and adds 543 to the year.
Factor takes the sum as an argument and prints it prime factorization: first the number to be factored, then a list of individual prime factors.
Finally, awk filters the input, printing only lines with exactly 11 fields (the number plus 10 prime factors).

Let us continue this discussion in chat.

05AB1E, 10 bytes
žg543+ÒgTQ

Try it online!
or as a Test suite
Explanation
      Òg     # the number of primefactors with duplicates of
žg           # the current year
  543+       # plus 543
        TQ   # equals 10

CJam, 13 bytes
et0=543+mf,A=

Try it online!
Explanation
et0=  e# Get current year.
543+  e# Add 543.
mf    e# Get prime factors with multiplicity.
,     e# Get length.
A=    e# Equals 10?

Mathematica, 37 31 bytes
5 bytes saved due to lanlock4.
PrimeOmega[#&@@Date[]+543]==10&

Anonymous function. Takes no input and returns True or False as output.

Now is implicit. You can use DateValue@"Year".

Do you need the & at the end? Also, Date[][[1]] is a couple of bytes shorter than DateValue@"Year" (if you don't mind that Date is obsolete).

You can save a byte with #&@@Date[] in place of Date[][[1]]. Also, I think "Mathematica + REPL environment" is a valid programming language here, for which you don't need the terminating &.

@GregMartin Oh well, I've never been a big fan of that

Pyth, 11 bytes
qlP+543.d3T

Online interpreter available here.
Explanation
       .d3   get current year
   +543      add 543
  P          get prime factors of result
 l           count number of prime factors
q         T  check if equal to 10 (result is implicitly printed)

Japt, 18 14 13 bytes
543+Ki¹k l ¥A

Saved 4 bytes thanks to ETHproductions.
Saved 1 byte thanks to obarakon.
Try it online!

Nice answer! You can save a byte if you move things around: A¥º543+Ki¹k l or 543+Ki¹k l ¥A

@obarakon Thanks! Why is ¹ used, wouldn't ) do the same thing?

Yep, you can use ) instead.

Python 2, 92 89 bytes
-3 bytes thanks to Jonathan Allan

import time
y=time.gmtime()[0]+543
c=i=1
exec"i+=1\nwhile 1>y%i:y/=i;c-=1\n"*y
print-9==c

Try it online!
Iterate up to the year, extracting (and couting) the prime factors.
The exec line is equivalent to :
for i in range(2,y):
 while not(y%i):
  y=y/i
  c=c-1

A 3 byte save: c=i=1; c-=1; print-9==c.

Octave, 31 bytes
nnz(factor(clock()(1)+543))==10

Try it online!
Two tricks used here:

clock()(1) to index directly into the output of clock (clock(1) doesn't work)
nnz instead of numel, as all entries are guaranteed to be nonzero.

Alternate version, same byte count
nnz(factor(max(clock)+543))==10

This version can only be used for years exceeding 30, but obviously disregarding time travel this includes all years in which the program can be executed. It works in Matlab as well.

PHP, 111 68 66
$a=date(Y)+543;for($i=2;$i<$a;)$b+=$a%$i?!++$i:!!$a/=$i;echo$b==9;

directly counts the number of prime factors.
$a=date(Y)+543;             // current year
for($i=2;$i<$a;)            // while $i lower than the year
$b+=$a%$i?!++$i:!!$a/=$i;   // if $i divides $a: $a/=$i and ++$b | if not: ++$i
echo$b==9;                  // output if it has 10 prime factors

Old idea: 111 90
for($i=1;++$i<1e3;)for($j=1;++$j<1e3;)${$i*$j}=($$i?:1)+($$j?:1);echo${date('Y')+543}==10;

This doesn't use a prime factortoring builtin but basically a counting prime sieve to get the number of prime factors of a number < 10000. This maps to the 4 digit year that PHP provides using date('Y'):
for($i=1;++$i<1e3;)          // for each number smaller sqrt(1e4)
for($j=1;++$j<1e3;)          // do sqrt(1e4) times
${$i*$j}=($$i?:1)+($$j?:1);  // n_factors[i*j] = n_factors[i] + n_factors[j]
echo${date('Y')+543}==10;          // output 1 if the current year has 10 prime factors or nothing if it doesn't

-2 bytes: Y needs no quotes with -nr.

On Your old idea: why initialize? $a[$i*$j]=($a[$i]?:1)+($a[$j]?:1) saves 13 bytes. $j=++$i<1e4 saves one. And no quotes for Y two more.

J, 18 bytes
Program body:
10=#q:543+{.6!:0''
Try it online!
10= is ten equal to
# the tally of
q: the prime factors of
543+ this number added to
{. the head (first item, i.e. the year) of
6!:0'' the date (as Y M D h m s)

JavaScript (ES6), 79 75 bytes
f=(y=+Date().slice(11,15)+543,d=2,n=10)=>y>1?y%d?f(y,d+1,n):f(y/d,d,n-1):!n

Port of my Batch answer. Pass in the Thai calendar year if you want to perform a specific test. Edit: Saved 4 bytes thanks to @dandavis.

how about new Date().getYear()+2443

@Matt Ugh, that's not what MDN says it does... but it's deprecated, so I'm not sure I should be using it anyway.

passing 2017 == false?  shortners: +Date().slice(11,15)+543 and y? instead of y>1

@dandavis y? is pointless, y is never zero.

MATL, 14 bytes
1&Z'543+Yfn10=

Try it online!
1&Z'   % Current year
543+   % Add 543
Yf     % Prime factor decomposition
n      % Number of elements
10=    % Equal to 10? Implicitly display

Batch, 123 bytes
@set/ay=%date:~-4%+543,n=d=2
:l
@set/ar=y%%d,d+=1
@if %r%==0 set/ay/=d-=1,n+=1
@if %y% gtr 1 goto l
@if %n%==12 echo 1

You can fake out the script by manually overriding the date variable before running it.

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
How Many Holes?
Challenge
Given a graphical input of a shape, determine how many holes there are in it.
Not Duplicate
This question was marked as a possible duplicate of Count Islands. I believe this challenge is different from the Count Island challenge because in this one, you have to figure out how to eliminate blocks that touch the border.
Input
Input will be given as some 2D form of input, either a multiline string, an array of strings, or an array of character arrays. This represents the shape. The shape is guaranteed to be in only one piece, connected by edge. Please specify how you want input to be taken.
Output
Output is a single integer stating how many holes there are in the shape. A trailing newline is permitted, but no other leading or trailing whitespace. In other words, the output must match the regular expression ^\d+\n?$.
What is a hole?
These are single holes:
####
#  #
#  #
####

####
#  #
# ##
###

#####
# # #
#   #
#####

These are not holes:
########
########
#   ####
#   ####
# ######
#
########

###
#
###

##########
#
# ########
# #      #
# # #### #
# #   ## #
# ###### #
#        #
##########

Pretty much, if it the gap joins the outside edge, it is not a hole.
Test cases
#####
# # # -> 2
#####

#####
#
# ### -> 1
# # #
#####

####
## # -> 1 (things are connected by edges)
# ##
####

###
### -> 0 (You must handle shapes with no holes, but input will always contain at least one filled space)
###

You can use any character in place of the '#', and in place of the spaces.
Objective Scoring Criteria
The score is given as the number of bytes in your program.
Winning
The winner will be the submission with the lowest score, by April 4th.

Related

Could you add ###|# #|##  as a test case? That should be 0, right?

Related

Possible duplicate of Code-Golf: Count Islands

@SIGSEGV Thank you for pointing that out; however, I believe that this challenge has a critical component that makes it different enough from the other challenge to warrant its own post (I edited in the difference). Please let me know what you think, and we may want to start a discussion in chat if necessary.

@HyperNeutrino It seems like just detecting spaces instead of islands

@SIGSEGV related, but definitely not a duplicate. Finding closed areas is certainly not the same thing as finding connected points.

@SIGSEGV The main (and realistically only) difference is that holes touching the edge don't count here, but islands touching the edge there do count.

Please explain what you mean by "connected by edge". I would expect this to refer to two cells which are directly above/below, or to the left/right of each other, but in the third test case, it appears that you refer to two cells sharing only a corner this way.

@feersum That is to say, two blocks are considered connected if they share an edge (above/below or left/right), so in the third test case, the two cells share only a corner, which means that they are not connected, which means that there is only 1 hole instead of the 2 that some people might expect.

Um... if there are two empty spaces and they are not connected, how is there not at least two holes?

@feersum No, I meant the two filled spaces aren't connected. So like that means that the empty spaces are the same hole. Sorry.

MATLAB / Octave, 18 bytes
@(g)1-bweuler(g,4)

Try it online!
This is an anonymous function taking a logical matrix as input. The object is formed by the true entries (with the specified connectivity), the empty space are the false entries.
bweuler then calculates the euler number of the binary image represented by that matrix, that is the number of objects minus the number of holes.

Mathematica, 59 57 bytes
1/.ComponentMeasurements[#,"Holes",CornerNeighbors->0>1]&

There's a built-in for that. Takes input as a 2D matrix of 1s (walls) and 0s (holes). For convenience, here are all the test cases in this input format:
{{{1,1,1,1},{1,0,0,1},{1,0,0,1},{1,1,1,1}},
 {{1,1,1,1},{1,0,0,1},{1,0,1,1},{1,1,1,0}},
 {{1,1,1,1,1},{1,0,1,0,1},{1,0,0,0,1},{1,1,1,1,1}},
 {{1,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,1},{1,0,0,0,1,1,1,1},{1,0,0,0,1,1,1,1},{1,0,1,1,1,1,1,1},{1,0,0,0,0,0,0,0},{1,1,1,1,1,1,1,1}},
 {{1,1,1},{1,0,0},{1,1,1}},
 {{1,1,1,1,1,1,1,1,1,1},{1,0,0,0,0,0,0,0,0,0},{1,0,1,1,1,1,1,1,1,1},{1,0,1,0,0,0,0,0,0,1},{1,0,1,0,1,1,1,1,0,1},{1,0,1,0,0,0,1,1,0,1},{1,0,1,1,1,1,1,1,0,1},{1,0,0,0,0,0,0,0,0,1},{1,1,1,1,1,1,1,1,1,1}},
 {{1,1,1,1,1},{1,0,1,0,1},{1,1,1,1,1}},
 {{1,1,1,1,1},{1,0,0,0,0},{1,0,1,1,1},{1,0,1,0,1},{1,1,1,1,1}},
 {{1,1,1,1},{1,1,0,1},{1,0,1,1},{1,1,1,1}}}

Alternative solution, 59 bytes
This was my original approach. It's also based on the component-related built-ins, but doesn't count the holes directly (instead it treats the holes themselves as components).
Max@*MorphologicalComponents@*DeleteBorderComponents@*Image

Takes the same input format as above, but with the roles of 0s and 1s swapped.
The reason I need to convert this to an Image first is that, otherwise, Mathematica would consider all the 1-cells as part of a single component (because it treats the matrix as a component-label matrix). Hence, if any 1-cell borders the margin, it would delete all of them. When DeleteBorderComponents is used on an image instead, then it will do an implicit connectivity check to find the components.
Alternatively, I could call MorphologicalComponents first, which would turn the input into a suitable label matrix, but if I do DeleteBorderComponents second it's no longer guaranteed that the maximum component label corresponds to the number of components (because I might delete a smaller component).

Really, Mathematica has got built-ins for just everything...

@Mr.Xcoder I have a good challenge idea: Find a challenge for which Mathematica has no builtin.

@HyperNeutrino good idea, but I think that the users of Mathematica will heavily downvote it, unfortunately, and I don't know if the community will react well... =]

@HyperNeutrino, there's probably a builtin for that too :-)

@BrianMinton Haha. There's probably a built-in in Mathematica called GenerateBuiltin. It generates a built-in for any challenge that doesn't have a built-in. Also, I feel bad for Martin Ender's inbox, so if you want, let's continue this discussion here

Python 2, 282 bytes
+100 to handle diagonal touches TT_TT (do we really need that?)
-119 thanks to @Rod guidance :)
Try it online. Takes array of arrays of chars '#' and whitespace as input.
A=input()
c=0
X=len(A[0])-1
Y=len(A)-1
def C(T):
 x,y=T
 global g
 if A[y][x]<'#':
    if y<1or y==Y or x<1or x==X:g=0
    A[y][x]='#';map(C,zip([x]*3+[min(x+1,X)]*3+[max(x-1,0)]*3,[y,min(y+1,Y),max(y-1,0)]*3))
while' 'in sum(A,[]):i=sum(A,[]).index(' ');g=1;C((i%-~X,i/-~X));c+=g
print c

Searches for first whitespace and mark it as non-empty ('#'). Recursively check all of it's surrounding, while filling all empty cells. If any empty cell of current "hole" appears to be on border counter won't change, otherwise it would be increased by 1. Repeat process, until there is no more whitespaces.

You can use sum(A,[]) to flatten

Also you can check this answer, it has the same recursive logic, and also have some other tricks (like the function "renaming" in the first line)

@Rod Trick with sum is very good, thank you. I'm now working on getting all 8 directions without all this uglyness, your answer might help. I'll update after that

Note that on my answer I called the recursive function inside a list comprehension just to use less bytes, but on your case you can check the list length to see if the current cell belong to borders (the content of the list will be a lot of Nones, but that is irrelevant)

You can use list unpacking on x=T[0];y=T[1] -> x,y=T, you (probably) don't need to declare g=1 on 3rd line, and you can use < or > to compare strings (it will take the ord() value of each char) allowing you to replace A[y][x]!='#' with A[y][x]<'#', since ' '<'#'.

@Rod I forgot about unpacking, thank you! It's a bit funny to me, but indeed this declaration of g can be omitted

Sorry about the diagonal cases TT-TT but yes you need it.

Perl 5, 154 bytes
152 bytes of code + 2 bytes for -p0 flag.
s/^ | $/A/gm;s/^.*\K | (?=.*$)/A/&&redo;/.*/;$@="@+"-1;for$%(A,X){$~="(.?.?.{$@})?";(s/$%$~ /$%$1$%/s||s/ $~$%/$%$1$%/s)&&redo}s/ /X/&&++$\&&redo}{$\|=0

Try it online!
I think the code is quite self-explanatory.

If you need some explanations to understand, here are a few steps of the transformations done by the program on a simple input (coming from here), followed by some explanations bellow:

######
#
# ####
# #  #
#### #
######

######
#    A
# ####
# #  #
#### #
######

######
#AAAAA
#A####
#A#  #
#### #
######

######
#AAAAA
#A####
#A#X #
#### #
######

######
#AAAAA
#A####
#A#XX#
####X#
######

First, s/^ | $/A/gm;s/^.*\K | (?=.*$)/A/&&redo will replace the spaces in the border (1st regex for left/right, 2nd for bottom/top) with A (I choose that character quite arbitrary).
Then, we get the width the shape with /.*/;$@="@+"-1;.
Now, we want to replace every space that is connected to a A with a A (because if a space is connected to a A, it means it can't be part of a hole. That's done by for$%(A,X){(s/$%(.?.?.{$@})? /$%$1$%/s||s/ (.?.?.{$@})?$%/$%$1$%/s)&&redo}. (you'll notice that this is done once for the As and one for the Xs - explanations for the X are bellow). There are two regex here: s/$%(.?.?.{$@})? /$%$1$%/s deals with the spaces that are on the right or bottom of a A. And s/ (.?.?.{$@})?$%/$%$1$%/s with the spaces on top or left of a A.
At this point, the only spaces that are left in the string are part of holes.
While there are still spaces, we repeat:
 - To know how much holes there are, we replace a space with a X (s/ /X/) and increment the counter of holes ($\++), and redo the entire program (actually, we only want to redo the for loop, but it's less bytes to redo the whole program).
 - Then, the for loop will replace every space that is connected to a X with a X, as they are part of the same hole.
At the end, $\|=0 ensures that if there are no holes, a 0 is printed instead of an empty string. And $\ is implicitly printed thanks to -p flag.

Python 2, 233 225 222 bytes
math_junkie: -8 bytes
Takes 2d array of booleans/integers (0/1) as input
s=input()
o=[-1,0,1]
m=lambda x,y:0if x in[-1,len(s[0])]or y in[-1,len(s)]else 1if s[y][x]else(s[y].__setitem__(x,1),all([m(x+a,y+b)for a in o for b in o]))[1]
e=enumerate
print sum(m(x,y)-c for y,l in e(s)for x,c in e(l))

Try it online!
Formatted version:
s = input()
o = [-1, 0, 1]
m = lambda x,y:
    0 if x in [-1, len(s[0])] or y in [-1, len(s)]
      else
        1 if s[y][x]
          else
            (s[y].__setitem__(x, 1),
             all([m(x + a, y + b) for a in o for b in o]))[1]
e = enumerate
print sum(m(x, y) - c for y, l in e(s) for x, c in e(l))

You can save a few bytes with print sum(m(x,y)... instead of a= and print a

Also, some minor whitespace golfs: TIO

Snails, 48 bytes
!{\ z`+~}\ {t\ z!.!~=((lu|u.+r)!(.,~},!{t\ z!.!~

Ungolfed:
!{
    (\   z)+
    ~
}
\
{
    t \
    z !.!~
    ={
        (lu|u.+r)
        !(.,~)
    }
},
!{
    t \
    z !.!~
}

C# 7, 364 bytes
Less than happy with this... maybe someone else can sort it out... If I have the energy later I will invert the first loop, and see if that can help to trim the bounds checking.
using C=System.Console;class P{static void Main(){string D="",L;int W=0,H=0,z;for(;(L=C.ReadLine())!=null;H+=W=L.Length)D+=L;int[]S=new int[H*9];int Q(int p)=>S[p]<p?Q(S[p]):p;void R(int r)=>S[Q(r+=z)]=S[r]>0?z:0;for(z=H;z-->0;)if(D[z]<33){S[z]=z;R(1);R(W);R(W+1);R(W-1);}for(;++z<H;)S[Q(z)]*=z>H-W-2|z%W<1|z%W>W-2?0:1;for(;W<H;)z+=Q(W)<W++?0:1;C.WriteLine(z-H);}}

Try it online
Complete program, accepts input to standard in, output to standard out. Uses disjoint sets to determine provisional holes, and when kills any touch the borders (with some dodgyness for the top-edge).
Formatted and commented code:
using C=System.Console;

class P
{
    static void Main()
    {
        string D="", // the whole map
            L; // initally each line of the map, later each line of output

        // TODO: some of thse might be charable
        int W=0, // width, later position
            H=0, // length (width * height)
            z; // position, later counter

        // read map and width
        for(;(L=C.ReadLine())!=null; // read a line, while we can
                H+=W=L.Length) // record the width, and increment height
            D+=L; // add the line to the map

        // disjoint sets
        int[]S=new int[H*9]; // generousness (relieve some bounds checking)
        // note that S[x] <= x, because we call R with decending values of z

        // returns whatever p points to
        int Q(int p)=>S[p]<p?Q(S[p]):p;
        // points whatever r points to at z if r is empty
        void R(int r)=>S[Q(r+=z)]=S[r]>0?z:0; // note that is never called when z=0

        // fill out disjoint sets
        for(z=H;z-->0;)
            if(D[z]<33) // if cell is empty
            {
                S[z]=z; // point it at itself

                // point the things next  to z at z
                R(1);
                R(W);
                R(W+1);
                R(W-1);
            }

        // zero sets which are against the left, bottom, or right edges
        for(;++z<H;)
            S[Q(z)]*=z>H-W-2|z%W<1|z%W>W-2?0:1; // TODO?: this suggests inverting the first loop (NOTE: would break S[x]<=x)

        // starting from the second row, count all the sets that point to this cell (ignores any non-zeros pointing to first row)
        for(;W<H;)
            z+=Q(W)<W++?0:1;

        C.WriteLine(z-H);
    }
}

Convert it to a Func<List<string>, int> to remove the fluff and console stuff. However, I've seen you have local functions so you may not be able to have them in a func. Could just compile to a method int h(string[] s) { }.

I'm sure there's a lot more that can be simplified here...

@TheLethalCoder I shan't be converting this to a different form, I don't like answers as functions (wouldn't need to be a lambda, as you said). Yeah... the whole thing feels bloated... but I spent a good while mutating it and didn't make any substantial progress, so I did a few passes of 'bitty' golfing and pushed it. Feel free to submit a shorter version, I'm less than attached to this one.

I mean just converting it to a method and removing all the console stuff, as that would no longer be needed, is going to knock 50-100 bytes off (just a guess but it will knock a lot off).

@TheLethalCoder indeed; I just don't like submitting functions as answers. Standard Input is pretty Standard, and a 'complete program' is easy to compile and run anywhere. Don't get me started on untyped lambdas... Obviously, if there was a competing Java answer, then I'd have to slacking my standards a bit...

Fair enough but I think you are spiting yourself with it! Especially on anonymous functions there's no need to ignore them and they are a really useful feature (more so for code golf).

JavaScript (ES6), 192 bytes

v=a=>Math.min(...a=a.map(s=>s.length))==Math.max(...a);
f=(s,t=(u=` `.repeat(w=s.search`
`+1))+`
`+s.replace(/^|$/gm,` `)+`
`+u,v=t.replace(RegExp(`( |@)([^]{${w},${w+2}})?(?!\\1)[ @]`),`@$2@`))=>t!=v?f(s,v):/ /.test(t)?f(s,t.replace(` `,`@`))+1:-1
<textarea id=i rows=10 cols=10></textarea><input type=button value=Count onclick=o.textContent=/^[\s#]+$/.test(i.value)*v(i.value.split`\n`)?f(i.value):`Invalid_Entry`><span id=o>

Based on my answer to Detect Failing Castles. First the string is padded with spaces to make an area around the shape. The RegExp then looks for two adjacent squares, one containing an @, one containing a space, and replaces them both with an @. If it can't do this, it fills in a space with an @ and counts this as a new hole. Finally one is subtracted to account for the surrounding area.

Can you provide a TIO link of some sort? Thanks!


text:
Count the number of Hamming distance sequences
The Hamming distance between two strings of equal length is the number of positions at which the corresponding symbols are different.
Let P be a binary string of length n and T be a binary string of length 2n-1.  We can compute the n Hamming distances between P and every n-length substring of T in order from left to right and put them into an array (or list).
Example Hamming distance sequence
Let P = 101 and T = 01100. The sequence of Hamming distances you get from this pair is 2,2,1.
Task
For increasing n starting at n=1, consider all possible pairs of binary strings P of length n and T of length 2n-1.  There are 2**(n+2n-1) such pairs and hence that many sequences of Hamming distances.  However many of those sequences will be identical . The task is to find how many are distinct for each n.
Your code should output one number per value of n.
Score
Your score is  the highest n your code reaches on my machine in 5 minutes.   The timing is for the total running time, not the time just for that n.
Who wins
The person with the highest score wins. If two or more people end up with the same score then it is the first answer that wins.
Example answers
For n from 1 to 8 the optimal answers are 2, 9, 48, 297, 2040, 15425, 125232, 1070553.
Languages and libraries
You can use any available language and libraries you like. Where feasible, it would be good to be able to run your code so please include a full explanation for how to run/compile your code in Linux if at all possible.
My Machine The timings will be run on my 64-bit machine. This is a standard ubuntu install with 8GB RAM, AMD FX-8350 Eight-Core Processor and Radeon HD 4250.  This also means I need to be able to run your code.
Leading answers

11 in C++ by feersum. 25 seconds.
11 in C++ by Andrew Epstein.  176 seconds.
10 in Javascript by Neil. 54 seconds.
9 in Haskell by nimi. 4 minutes and 59 seconds.
8 in Javascript by fəˈnɛtɪk. 10 seconds.

.. any available free* languages?

[tag:fastest-code]? not [tag:fastest-algorithm]? You know, people could go with language with a darn fast interpreter and make a significant difference in time, but time complexity is always same, so It somewhat makes it fair.

Related.

@SIGSEGV fastest-code leaves more space for optimizations through both code level optimizations and a good algorithm. So I do think that faster-code is better than faster-algorithm.

C++11 (should get to 11 or 12)
At the moment this is single-threaded.
To compile:
g++ -std=c++11 -O2 -march=native feersum.cpp

#include <iostream>
#include <unordered_set>
#include <vector>
#include <unordered_map>
#include <string.h>

using seq = uint64_t;
using bitvec = uint32_t;
using seqset = std::unordered_set<seq>;
using std::vector;

#define popcount __builtin_popcount
#define MAX_N_BITS 4

bitvec leading(bitvec v, int n) {
    return v & ((1U << n) - 1);
}
bitvec trailing(bitvec v, int n, int total) {
    return v >> (total - n);
}

bitvec maxP(int n) {
    return 1 << (n - 1);  // ~P, ~T symmetry
}

void prefixes(int n, int pre, int P, seqset& p) {
    p.clear();
    for (bitvec pref = 0; pref < (1U << pre); pref++) {
        seq s = 0;
        for (int i = 0; i < pre; i++) {
            seq ham = popcount(trailing(pref, pre - i, pre) ^ leading(P, pre - i));
            s |= ham << i * MAX_N_BITS;
        }
        p.insert(s);
    }
}

vector<seqset> suffixes(int n, int suf, int off) {
    vector<seqset> S(maxP(n));
    for (bitvec P = 0; P < maxP(n); P++) {
        for (bitvec suff = 0; suff < (1U << suf); suff++) {
            seq s = 0;
            for (int i = 0; i < suf; i++) {
                seq ham = popcount(leading(suff, i + 1) ^ trailing(P, i + 1, n));
                s |= ham << (off + i) * MAX_N_BITS;
            }
            S[P].insert(s);
        }
    }
    return S;
}

template<typename T>
void mids(int n, int npre, int nsuf, int mid, bitvec P, T& S, const seqset& pre) {
    seq mask = (1ULL << (npre + 1) * MAX_N_BITS) - 1;
    for(bitvec m = 0; m < 1U << mid; m++) {
        int pc = popcount(P ^ m);
        if(pc * 2 > n) continue; // symmetry of T -> ~T : replaces x with n - x
        seq s = (seq)pc << npre * MAX_N_BITS;
        for(int i = 0; i < npre; i++)
            s |= (seq)popcount(trailing(P, n - npre + i, n) ^ leading(m, n - npre + i)) << i * MAX_N_BITS;
        for(int i = 0; i < nsuf; i++)
            s |= (seq)popcount(leading(P, mid - 1 - i) ^ trailing(m, mid - 1 - i, mid)) << (npre + 1 + i) * MAX_N_BITS;
        for(seq a: pre)
            S[(s + a) & mask].insert(P | (s + a) << n);
    }
}

uint64_t f(int n) {
    if (n >= 1 << MAX_N_BITS) {
        std::cerr << "n too big";
        exit(1);
    }
    int tlen = 2*n - 1;
    int mid = n;
    int npre = (tlen - mid) / 2;
    if(n>6) --npre;
    int nsuf = tlen - npre - mid;
    seqset preset;
    auto sufs = suffixes(n, nsuf, npre + 1);
    std::unordered_map<seq, std::unordered_set<uint64_t>> premid;
    for(bitvec P = 0; P < maxP(n); P++) {
        prefixes(n, npre, P, preset);
        mids(n, npre, nsuf, mid, P, premid, preset);
    }
    uint64_t ans = 0;
    using counter = uint8_t;
    vector<counter> found((size_t)1 << nsuf * MAX_N_BITS);
    counter iz = 0;
    for(auto& z: premid) {
        ++iz;
        if(!iz) {
            memset(&found[0], 0, found.size() * sizeof(counter));
            ++iz;
        }
        for(auto& pair: z.second) {
            seq s = pair >> n;
            uint64_t count = 0;
            bitvec P = pair & (maxP(n) - 1);
            for(seq t: sufs[P]) {
                seq suff = (s + t) >> (npre + 1) * MAX_N_BITS;
                if (found[suff] != iz) {
                    ++count;
                    found[suff] = iz;
                }
            }
            int middle = int(s >> npre * MAX_N_BITS) & ~(~0U << MAX_N_BITS);
            ans += count << (middle * 2 != n);
        }
    }

    return ans;
}

int main() {
    for (int i = 1; ; i++)
        std::cout << i << ' ' << f(i) << std::endl;
}

Get's to 11 in less than 30 seconds!

In case it's of interest: feersum.cpp:111:61: warning: shifting a negative signed value is undefined [-Wshift-negative-value]             int middle = int(s >> npre * MAX_N_BITS) & ~(~0 << MAX_N_BITS);

Haskell, score 9
import Data.Bits
import Data.List
import qualified Data.IntSet as S

main = mapM_ (print . S.size . S.fromList . hd) [1..9]

hd :: Int -> [Int]
hd n = [foldl' (\s e->s*m+e) 0 [popCount $ xor p (shiftR t i .&. m)|i<-[(0::Int)..n-1]] | let m=2^n-1,p<-[(0::Int)..2^n-1],t<-[(0::Int)..2^(2*n-1)-1]]

Compile with -O3. It takes 6min35s on my 6 year old laptop hardware to run up to n=9, so maybe it's under 5min on the reference hardware.
> time ./113785
2
9
48
297
2040
15425
125232
1070553
9530752

real  6m35.763s
user  6m27.690s
sys   0m5.025s

6 year laptop? Damn, that's some outdated tech!

@SIGSEGV: maybe it's outdated, but besides counting the number of Hamming distance sequences it does its job quite well.

JavaScript, score 10
findHamming = m => {
    if (m < 2) return 2;
    let popcnt = x => x && (x & 1) + popcnt(x >> 1);
    let a = [...Array(1 << m)].map((_,i) => popcnt(i));
    let t = 0;
    let n = (1 << m) - 1;
    for (let c = 0; c <= m; c++) {
        for (let g = 0; g <= c; g++) {
            let s = new Set;
            for (let i = 1 << m; i--; ) {
                for (let j = 1 << (m - 1); j--; ) {
                    if (a[i ^ j + j] != c) continue;
                    for (let k = 1 << m - 1; k--; ) {
                        if (a[i ^ k] != g) continue;
                        let f = j << m | k;
                        let h = 0;
                        for (l = m - 1; --l; ) h = h * (m + 1) + a[i ^ f >> l & n];
                        s.add(h);
                    }
                }
            }
            t += s.size * (g < c ? 2 : 1);
        }
    }
    return t;
};
let d = Date.now(); for (let m = 1; m < 11; m++) console.log(m, findHamming(m), Date.now() - d);

Explanation: Calculating n=10 is difficult because there are over two billion pairs and over 26 billion potential sequences. In order to speed things up I split the calculation up into 121 bins. Because the sequences are invariant under bitwise complement, I can assume without loss of generality that the middle bit of T is zero. This means that I can determine the first and last elements of the sequence independently from the the top n-1 and bottom n-1 bits of T. Each bin corresponds to a different pair of first and last elements; I then loop through all the possible sets of top and bottom bits that correspond to each bin and calculate the remaining elements of the sequence, finally counting the unique sequences for each bin. It then remains to total all 121 bins. Originally taking 45 hours, this now completed in a little under three and a half minutes on my AMD FX-8120. Edit: Thanks to @ChristianSievers for a 50% speedup. Full output:
1 2 0
2 9 1
3 48 1
4 297 2
5 2040 7
6 15425 45
7 125232 391
8 1070553 1844
9 9530752 15364
10 86526701 153699

Your code gives no output currently.

@felipa Not sure what you mean. It's an anonymous function, so you call it (perhaps by assigning it to a variable first and then calling the variable as if it was a function) and pass it n as a parameter. (Sorry for the bad choice of parameter name there.)

The question asks for code that prints out answer for n up to the highest value it can get to in 5 minutes. "Your code should output one number per value of n."

It would be great if your code worked up from n = 1 and outputted the timing at each stage.  From the question " The timing is for the total running time, not the time just for that n."

@Lembik Added timing code and also worked around bug for n=1 (don't know offhand why it hangs).

Is the timing  in hundredths of a second?

@Lembik Sorry, I should have said, it's in milliseconds.

Great! There is another symmetry in the construction of Hamming distance sequences: when P and T are reversed, the resulting sequence is also reversed, so the set to count is closed under reversal. I'm not sure about the best way to use this fact, but it gives an easy way to improve your program: let g only go up to c, and add twice the bin size unless c=g. (Some extra work should also be able to speed up the case c=g, but that might not be worth the effort.)

@ChristianSievers Very nice! I'm slightly disappointed that I only get a 50% speedup though.

Huh? We've reduced 121 bins (in the n=10 case) to 66. What did you expect?

I expected a (121-66)/66*100=83% speedup.

(actual speedup 58%, misread my screen sorry, still less than 83%)

I see. More than the expected fraction of 1/(m+1) fall into the c=g case, putting more pressure on the set. Also, how long does the computation of a take?

@ChristianSievers Indeed, for n=10 the c=g case accounts for about 15% of the distinct sequences. (I don't know how many unique sequences is accounts for. Also, a is trivial to compute; it takes a second for n=20.)

C++, score 10 11
This is a translation of @Neil's answer into C++, with some simple parallelization. n=9 completes in 0.4 seconds, n=10 in 4.5 seconds, and n=11 in approximately 1 minute on my 2015 Macbook Pro. Also, thanks to @ChristianSievers. Due to his comments on @Neil's answer, I noticed some additional symmetries. From the original 121 buckets (for n=10), to 66 buckets when accounting for reversal, I've gotten down to just 21 buckets.
#include <iostream>
#include <cstdint>
#include <unordered_set>
#include <thread>
#include <future>
#include <vector>

using namespace std;

constexpr uint32_t popcnt( uint32_t v ) {
    uint32_t c = v - ( ( v >> 1 ) & 0x55555555 );
    c = ( ( c >> 2 ) & 0x33333333 ) + ( c & 0x33333333 );
    c = ( ( c >> 4 ) + c ) & 0x0F0F0F0F;
    c = ( ( c >> 8 ) + c ) & 0x00FF00FF;
    c = ( ( c >> 16 ) + c ) & 0x0000FFFF;
    return c;
}

template<uint32_t N>
struct A {
    constexpr A() : arr() {
        for( auto i = 0; i != N; ++i ) {
            arr[i] = popcnt( i );
        }
    }
    uint8_t arr[N];
};

uint32_t n = ( 1 << M ) - 1;
constexpr auto a = A < 1 << M > ();

uint32_t work( uint32_t c, uint32_t g, uint32_t mult ) {
    unordered_set<uint64_t> s;
    // Empirically derived "optimal" value
    s.reserve( static_cast<uint32_t>( pow( 5, M ) ) );

    for( int i = ( 1 << M ) - 1; i >= 0; i-- ) {
        for( uint32_t j = 1 << ( M - 1 ); j--; ) {
            if( a.arr[i ^ j + j] != c ) {
                continue;
            }

            for( uint32_t k = 1 << ( M - 1 ); k--; ) {
                if( a.arr[i ^ k] != g ) {
                    continue;
                }

                uint64_t f = j << M | k;
                uint64_t h = 0;

                for( uint32_t l = M - 1; --l; ) {
                    h = h * ( M + 1 ) + a.arr[i ^ ( f >> l & n )];
                }

                s.insert( h );
            }
        }
    }

    return s.size() * mult;

}

int main() {
    auto t1 = std::chrono::high_resolution_clock::now();

    if( M == 1 ) {
        auto t2 = std::chrono::high_resolution_clock::now();
        auto seconds = chrono::duration_cast<chrono::milliseconds>( t2 - t1 ).count() / 1000.0;
        cout << M << ": " << 2 << ", " << seconds << endl;
        return 0;
    }

    uint64_t t = 0;
    vector<future<uint32_t>> my_vector;

    if( ( M & 1 ) == 0 ) {
        for( uint32_t c = 0; c <= M / 2; ++c ) {
            for( uint32_t g = c; g <= M / 2; ++g ) {
                uint32_t mult = 8;

                if( c == M / 2 && g == M / 2 ) {
                    mult = 1;
                } else if( g == c || g == M / 2 ) {
                    mult = 4;
                }

                my_vector.push_back( async( work, c, g, mult ) );
            }

        }

        for( auto && f : my_vector ) {
            t += f.get();
        }

    } else {
        for( uint32_t c = 0; c <= ( M - 1 ) / 2; ++c ) {
            for( uint32_t g = c; g <= M - c; ++g ) {
                uint32_t mult = 4;

                if( g == c || g + c == M ) {
                    mult = 2;
                }

                my_vector.push_back( async( work, c, g, mult ) );
            }

        }

        for( auto && f : my_vector ) {
            t += f.get();
        }

    }

    auto t2 = std::chrono::high_resolution_clock::now();
    auto seconds = chrono::duration_cast<chrono::milliseconds>( t2 - t1 ).count() / 1000.0;
    cout << M << ": " << t << ", " << seconds << endl;
    return 0;
}

Use the following script to execute the code:
#!/usr/bin/env bash

for i in {1..10}
do
    clang++ -std=c++14 -march=native -mtune=native -Ofast -fno-exceptions -DM=$i hamming3.cpp -o hamming
    ./hamming
done

The output was as follows: (The format is M: result, seconds)
1: 2, 0
2: 9, 0
3: 48, 0
4: 297, 0
5: 2040, 0
6: 15425, 0.001
7: 125232, 0.004
8: 1070553, 0.029
9: 9530752, 0.419
10: 86526701, 4.459
11: 800164636, 58.865

n=12 took 42 minutes to calculate on a single thread, and gave a result of 7368225813.

How would you compile this in ubuntu using clang?

@felipa I think the answer is sudo apt-get install libiomp-dev.

It would be great if your code worked up from n = 1 and outputted the timing at each stage.  From the question " The timing is for the total running time, not the time just for that n."

Rather than reimplementing it you could probably just use __builtin_popcount.

@Lembik: I'll make the changes later today. @Neil: The popcnt function only gets evaluated at compile time, and I don't know how to use __builtin_popcount in a constexpr context. I could go with the naïve implementation and it wouldn't affect the run time.

Unfortunately it uses too much RAM for n = 11 for me to test.

I was thinking you could use __builtin_popcount() instead of a.arr[], as it should compile to a single instruction anyway, which avoids hitting memory, so might actually be faster.

@Neil: I tried out your suggestion. It did indeed compile to a single instruction, but profiling with valgrind indicated that using a.arr[] was faster. I suspect that due to the table's small size, it is able to remain in L1 cache.

Huh, I hadn't realised how big L1 cache is these days. Also, nice going for calculating n=12.

How much RAM did calculating n = 11 and 12 take for you?

Could you change the code so that it works up from n = 1? At the moment I have to run it for each n separately and add the times.

@Lembik: n=11 on a single thread took 1534 MB at peak, n=11 on multiple threads took 7166 MB at peak, and n=12 on a single thread took 11521 MB at peak.

I need -pthread as in g++ -Wall -pthread -std=c++14 -DM=10 hamming.cpp -Ofast -o hamming.  Do you really mean if( a.arr[i ^ j + j] != c ) {  . I ask as i ^ j + j means i ^ (j + j) (so feersum tells me).

That's very impressive! I see that by flipping the bits in P only (or T only, but we already fixed one bit there), we get a distance sequence where every entry e is replaced by n-e, so the (c,g) bin is bijective to the (n-c,n-g) one. But what is your other symmetry in the even n case?

BTW, I wonder if it's worth while not running through all possible j and k and checking if they have the correct hamming distance, but instead have lists of all numbers of a given hamming weight and bitwise xor only those to i.

Oh I see! Flipping every second bit in P and T gives a distance sequence where every second entry changes to n-e, establishing a correspondance between the (c,g) and the (c,n-g) bin when n is even.

@ChristianSievers: Honestly I didn't even think about it at that level. I just printed the size of the 121 bins, and then grouped them together by identical values. Then, I just looked at the minimal (c,g) pairs and identified a pattern.

JavaScript 2,9,48,297,2040,15425,125232,1070553,9530752
Run in console:
console.time("test");
h=(w,x,y,z)=>{retVal=0;while(x||y){if(x%2!=y%2)retVal++;x>>=1;y>>=1}return retVal*Math.pow(w+1,z)};
sum=(x,y)=>x+y;
for(input=1;input<10;input++){
  hammings=new Array(Math.pow(input+1,input));
  for(i=1<<(input-1);i<1<<input;i++){
    for(j=0;j<1<<(2*input);j++){
      hamming=0;
      for(k=0;k<input;k++){
        hamming+=(h(input,(j>>k)%(1<<input),i,k));
      }
      hammings[hamming]=1;
    }
  }
  console.log(hammings.reduce(sum));
}
console.timeEnd("test");

Try it online!
Or as a Stack Snippet:

h=(w,x,y,z)=>{retVal=0;while(x||y){if(x%2!=y%2)retVal++;x>>=1;y>>=1}return retVal*Math.pow(w+1,z)};

function findHamming() {
  console.time("test");
  input = parseInt(document.getElementById("input").value);
  hammings=new Array(Math.pow(input+1,input));
  for(i=1<<(input-1);i<1<<input;i++){
    for(j=0;j<1<<(2*input);j++){
      hamming=0;
      for(k=0;k<input;k++){
        hamming+=(h(input,(j>>k)%(1<<input),i,k));
      }
      hammings[hamming]=1;
    }
  }
  document.getElementById("output").innerHTML = hammings.reduce((x,y)=>x+y);
  console.timeEnd("test");
}
<input type="text" id="input" value="6">
<button onclick="findHamming()"> Run </button>
<pre id="output">

The code preinitializes the array to make adding 1s to the array much faster
The code finds all the hamming distance sequences and treating them as numbers base (input+1), uses them to place 1s in an array. As a result, this generates an array with the n 1s where n is the number of unique hamming distance sequences. Finally, the number of 1s is counted using array.reduce() to sum all of the values in the array.
This code will not be able to run for input of 10 as it hits memory limits
This code runs in O(2^2n) time because that's how many elements it generates.

Unsurprisingly, trying to create a 26*10^9 element array doesn't work

n = 9 takes 5 minutes and 30 seconds for me using node.js so is just too slow.

@Lembik n = 8 originally took 24 seconds on my PC, but I was able to optimise the code so that n = 8 took 6 seconds. I then tried n = 9 and that took 100 seconds.

@Neil You should submit an answer !

It would be great if your code worked up from n = 1 and outputted the timing at each stage.  From the question " The timing is for the total running time, not the time just for that n."

What unit is the time in?

Time is in milliseconds


text:
Print the Greek national anthem
In March 25, 1821, Greece fought its great war of independence. In order to honor this, your task is to print the Greek national anthem:
Σε γνωρίζω από την κόψη
του σπαθιού την τρομερή.
Σε γνωρίζω από την όψη
που με βιά μετράει τη γη.
Απ' τα κόκκαλα βγαλμένη,
των Ελλήνων τα ιερά!
Και σαν πρώτα ανδρειωμένη,
χαίρε ω χαίρε Λευτεριά!
Και σαν πρώτα ανδρειωμένη,
χαίρε ω χαίρε Λευτεριά!
Και σαν πρώτα ανδρειωμένη,
χαίρε ω χαίρε Λευτεριά!

This is my own version of the anthem (punctuation, capitalization), although the lyrics are the original.

Any builtins printing or returning this text are forbidden, just in case.
The printed text must be exactly as above, with an optional trailing newline.
The output must be in UTF-8, unless it can't be supported at all, in which case the output must be encoded in the closest supported alternative.

"Any builtins printing or returning this text are forbidden" - I'm looking at you, Mathematica!

@steenbergh This might be sufficiently different because of the 2-byte Unicode chars involved.

@ETHproductions imho it's the same, but more restrictive towards the languages eligible to compete...

I don't suppose any of the golf langs have dictionaries of foreign words, yet? Tisk tisk.

I'm fairly certain nearly all languages can output this text in UTF-8. For example, Î£ in ISO-8859-1, when interpreted in UTF-8, is Σ. (Useful tool)

Can we shop marking these as dupes of the rick roll? This is not a dupe.

@Okx It's pretty similar.

@Okx https://codegolf.meta.stackexchange.com/a/6957/45941

Is UTF-16 output acceptable?

@ConorO'Brien Only if UTF-8 isn't supported (i.e. your solution is probably valid).

Jelly, 180 174 163 bytes
60r26;“WSNME‘ȷ_Ọ;“ ¶.',!”“¢Iç÷ṀDė3H⁷'UBV“ñẸḣY]ṭżẸ-dƒjṭ{^ṣ8ḞkƊK“ẈḊbƝÑk?Æ.)Aɱ3ẎƬṠ⁵ʂ÷Gẏp⁴ṇ1ẸR ¬,F°0>ST$[?ṘȦŀẎcFẈṃijȯÆḋ“¦ḟw2ðƊhSẏ¥ẏ5ƒẉɦ⁺Ʋ⁴Ɓ¦ÞIzƥṙḊOḊ-÷~øWḤ0ṃ’ṃ€6676ḃ4¤ị

Try it online!

There is some really hard golfing going on (...ṃ...ṃ€...ḃ...)... Congrats for the shortest answer (that deserves more upvotes)!

Python 3, 263 bytes
s="BT R\h`NUh P_k cV\ %skgV\n"
print(''.join(i if 47>ord(i)else chr(ord(i)+865)for i in s%"Y"+"c^d b_PWX^l cV\ c`^[T`M.\n"+s%""+"_^d [T QXK [Tc`KTX cV RV.\n0_' cP YkYYPZP QRPZ[L\V,\nch\ 4ZZM\h\ cP XT`K!"+"\n9PX bP\ _`mcP P\S`TXh[L\V,\nfPN`T h fPN`T :TdcT`XK!"*3))

Try it online!
Use the same repetition technique that mbomb007 used, but I replaced all characters higher than 47 (all greek letters), u913~u974 with u48~u109 ,and then undo this before printing

Java 7, 320 319 300 294 293 bytes
void Z(){String a="AS Q[g_MTg O^j bU[ ",b="8OW aO[ ^_lbO O[R_SWgZK[U,\neOM_S g eOM_S 9ScbS_WJ!\n";for(char C:(a+"XjfU\nb]c a^OVW]k bU[ b_]ZS_L.\n"+a+"jfU\n^]c ZS PWJ ZSb_JSW bU QU.\n/^' bO XjXXOYO PQOYZK[U,\nbg[ 3YYL[g[ bO WS_J!\n"+b+b+b).toCharArray())System.out.print((char)(C>46?C+866:C));}

Try it online!
This outputs the anthem with a trailing newline. I converted the function from returning a String to a void so that it would print the String instead of returning it and save bytes.
Will golf further in the morning Golfers don't sleep :P
Explanation (outdated)
String Z(){
  // X contains the value of the Greek Anthem
  String X="",
  // a and b contain some repeated parts of the anthem
         a="AS Q[g_MTg O^j bU[ ",
         b="8OW aO[ ^_lbO O[R_SWgZK[U,\neOM_S g eOM_S 9ScbS_WJ!\n";
  // Then we loop over every char in this string
  for(char C: (a+"XjfU\nb]c a^OVW]k bU[ b_]ZS_L.\n"+a+"jfU\n^]c ZS PWJ ZSb_JSW bU QU.\n/^' bO XjXXOYO PQOYZK[U,\nbg[ 3YYL[g[ bO WS_J!\n"+b+b+b).toCharArray())
    // Adding 866 to the char if it is greater than `.` 46
    // (we also want to preserve the punctuation)
    X+=(char)(C>46?C+866:C);
  return X;
}

To get to this reduced String, I manually checked subtracting which numbers from the code points would be the best. These values would have to lie between   and ~. In order to make the detection of whether a char is punctuation (., ', !,  ) or not, it would be best if all the values lied above . (46). And there shouldn't be any \s in the String because otherwise Java thinks they are escape sequences, and so I have to escape them. Finally I came up with subtracting 866 from the Greek characters.

Why not make it a Lambda?

@ГригорийПерельман Because it's Java 7 :P

@ГригорийПерельман Because the output includes a lambda character and lambdas in lambdas go horribly wrong

Bubblegum, 190 bytes
0000000: d5 8e b5 61 04 51 10 43 f3 ad 62 9c 98 ed 16 cd  ...a.Q.C..b.....
0000010: cc 4c a1 c3 e3 bb 65 ec 40 6a c9 9a 6f cc 1c df  .L....e.@j..o...
0000020: f2 8c a4 b7 c2 3b 12 c3 0c 0d 4f b8 83 11 52 9e  .....;....O...R.
0000030: 18 26 dc e6 b9 71 1f 19 1a 43 c9 73 1e 23 8b 34  .&...q...C.s.#.4
0000040: 77 3c 30 ee 71 1b 13 e4 28 34 5e 7c b9 f4 52 bc  w<0.q...(4^|..R.
0000050: 43 8d 44 ef e1 66 f4 3f f7 9b ba 1d a8 9e 34 4c  C.D..f.?......4L
0000060: 05 ed 87 ef c0 eb 23 41 11 fc 8e ca 44 bd e1 f6  ......#A....D...
0000070: 92 2f 26 a1 16 4a 9d 13 54 3e 4e e5 d0 a7 b2 03  ./&..J..T>N.....
0000080: 34 c8 d6 55 97 27 5e ff 01 95 ce 21 1a 1f bf b2  4..U.'^....!....
0000090: 45 a8 d9 5f 88 f0 8a 89 ff 62 4f 2f 89 db dc e1  E.._.....bO/....
00000a0: 65 b0 f8 8c 58 26 35 50 f0 97 7a 24 65 e4 7b e3  e...X&5P..z$e.{.
00000b0: 89 fd 99 f0 26 e6 81 b2 4e 2e e6 99 fd 01        ....&...N.....

Try it online!

Python 3, 350 345 bytes
s="Σε γνωρίζω από την %sόψη\n"
print(s%'κ'+"του σπαθιού την τρομερή.\n"+s%''+"που με βιά μετράει τη γη.\nΑπ' τα κόκκαλα βγαλμένη,\nτων Ελλήνων τα ιερά!"+"\nΚαι σαν πρώτα ανδρειωμένη,\nχαίρε ω χαίρε Λευτεριά!"*3)

Try it online

You can remove sep for -5 bytes

PowerShell, 332 270 261 bytes
-join([char[]]"$(($a='=O MWc[IPc KZf ^QW')) TfbQ
^Y_ ]ZKRSYg ^QW ^[YVO[H.
$a fbQ
ZY_ VO LSF VO^[FOS ^Q MQ.
+Z' ^K TfTTKUK LMKUVGWQ,
^cW /UUHWcW ^K SO[F!
$('4KS ]KW Z[h^K KWN[OScVGWQ,
aKI[O c aKI[O 5O_^O[SF!
'*3)"|%{([char](870+$_),$_)[+$_-in10,32,33,39,44,46]})

Try it online!
This takes the munged string as a char-array, feeds it one at a time through a loop |%{...} each iteration either outputting the character straight $_ or incrementing it by 870 before re-casting as a char (based on whether it's a punctuation or not). A few other tricks sets $a as a repeat phrase, and de-triplicates the last three stanzas. Those are all -joined together into a full string and then output is implicit.
Edit - Woo! This is the 1100th PowerShell answer on the site! :D

It's only the 12th answer? ;)

Your latest version produces the proper output. It seems that PowerShell converts the code to UTF-8 (even if it's UTF-8 encoded) before processing it.

@Dennis Kinda. Everything under the hood in PowerShell is UTF-16 encoded, so there likely is indeed conversion going on.

Windows 10 Batch, 424 404 bytes
@chcp>nul 65001
@set s="Σε γνωρίζω από την κόψη"
@set t="Και σαν πρώτα ανδρειωμένη," "χαίρε ω χαίρε Λευτεριά!"
@for %%l in (%s% "του σπαθιού την τρομερή." %s:κ=% "που με βιά μετράει τη γη." "Απ' τα κόκκαλα βγαλμένη," "των Ελλήνων τα ιερά!" %t% %t% %t%) do @echo %%~l

Notes:

Don't use Notepad to save this, it will add a BOM which will cause the script to fail.
The chcp call fails if your Command Prompt is configured to use Raster Fonts. Change them to e.g. Lucida Console (does not require restart).
The batch file seems to require a reasonably new version of Windows; Windows XP wasn't at all happy with chcp 65001.

Edit: Saved 20 bytes thanks to @ConorO'Brien.

isn't this only 420 bytes?

@Mr.Xcoder My Windows text editor uses MS-DOS line endings, and I can't be bothered to claim the small saving.

Why not just @set t="Και σαν πρώτα ανδρειωμένη," "χαίρε ω χαίρε Λευτεριά!" and replace %t% %u% with %t%?

@ConorO'Brien That's just genius. Thanks!

Japt, 197 196 195 bytes
`0fxtc
pkq ol]¸ky2ci2mk?mZ.
0xtc
lkq ? ^eX ?pmXae2c _c.
=l'2] fxff]g] ^_]g1pui AggZiui2] eamX!`+`
F]e o]i lmzp] ]i\`µeu1s][µ u s][µ Gaqpa´X!`³ d0`Oa _ium[¿ ]lx2ci `1`hYic,
`2" p""[=F-~]"_c +852 d

Test it online! Contains three 0x95 bytes which have been replaced with ?.

Are there unprintables in this?

@ConorO'Brien Yep, clarified

///, 324 323 bytes
/P/ρ//p/π//n/η//z/Σε γνωρίζω από τnν //k/Και σαν pPώτα ανδPειωμένn,
χαίPε ω χαίPε ΛευτεPιά!/zκόψn
του σπαθιού τnν τPομεPή.
zόψn
pου με βιά μετράει τn γn.
Αp' τα κόκκαλα βγαλμένn,
των Ελλήνων τα ιεPά!kkk

Try it online!
Maybe it could be golfed more, but I'm tired.
It works by replacing characters like k with longer text. I also made some character substitutions, because the Greek characters have more bytes than characters like p. Simple enough.
-1 byte thanks to @ErictheOutgolfer.

You have an unnecessary newline after ΛευτεPιά!/, you can remove it so that the output doesn't have a leading newline.

@EriktheOutgolfer Done, thanks.

Retina, 199 bytes

:pkq olWdeky=ci=mkhamT._:lkq ha XeR hapmRae=c Yc._0l'=W fxffWgW XYWghSic,_pui 4ggTiui=W eamR!###
:
Ia YiumUbu Wlx=ci fxtc_
#
_9We oWi lmzpW WiZmaeuhSic,_;u ;AaqpameR!
=
 p
;
sWUma
2=`f

T`w`¶Α-ώ

Try it online!
Woohoo, just under 200 bytes.
Explanation
The main idea is to avoid the actual Unicode characters for the most part, because they just blow up the byte count if they are used everwhere. Instead, I represent each Greek letter by an ASCII letter or digit. It turns out that the relevant letters from Α (that's an alpha) to ώ span exactly 62 code points. That's 10 + 26 + 26, the number of ASCII digits and letters. The other Unicode character we've got is ¶, which Retina uses to represent linefeeds. We can save a few more bytes by replacing that with _. Then the shorthand w in transliteration stages contains exactly the 63 characters we've used as substitutions, and we can represent the range this is mapped to using only 3 2-byte characters (¶ and the two ends of the Greek letter range).
Hence, the code is fairly illegible for the most part, since this substitution is done in the very last stage. Let's undo this to make a bit more sense of the code:

:του σπαθιού=ην=ρομερή.¶:που με βιά μετράει=η γη.¶Απ'=α κόκκαλα βγαλμένη,¶των Ελλήνων=α ιερά!###
:
Σε γνωρίζω από=ην κόψη¶
#
¶Και σαν πρώτα ανδρειωμένη,¶;ω ;Λευτεριά!
=
 τ
;
χαίρε
2=`κ

That looks a bit more like the stuff we want to output. The very first stage simply sets up the overall framework. It contains all the unique parts of the output as well as some more placeholders for repeated parts:

: stands for the first and third line. They end up being slightly different, because the κ is missing from the third line, which is why the very last stage removes the second κ in the result.
# stands for the last two lines, which are repeated three times.
; stands for the repeated χαίρε in those lines.
= stands for a word beginning with τ (and the space preceding it). There are just enough of those for this to save a single byte.

Python 2.7, 190 bytes
zlib abuse. Hexdump:
00000000: efbb bf70 7269 6e74 2278 9cbd 8cb1 0e82  ...print"x......
00000010: 4010 44fb fb8a b5b2 31fc 7f6b 61a3 252d  @.D.....1..ka.%-
00000020: 4216 5ccf e5b8 701b 96e8 2568 5ca5 b4b7  B.\...p...%h\...
00000030: 7ac9 cc9b 2909 ba98 a5b9 66c0 b480 fa08  z...).....f.....
00000040: fdf2 f04e c719 a684 371e 9fdf 5065 1c48  ...N....7...Pe.H
00000050: eac2 95bf 838f 9fcc 1f08 5aae 0c2a 15b1  ..........Z..*..
00000060: 55d0 f9c2 edd3 1614 edb5 ef31 20b4 1d86  U..........1 ...
00000070: e11c fdce 698e 7008 a18e 4613 98a4 dab8  ....i.p...F.....
00000080: 2332 4c18 21c9 cb32 8c17 21ce ab7f c746  #2L.!..2..!....F
00000090: 0832 ac3c d1ac 24fc afc9 1bcf bfdc ec22  .2.<..$........"
000000a0: 2e64 6563 6f64 6528 227a 6970 2229 2e64  .decode("zip").d
000000b0: 6563 6f64 6528 2267 7265 656b 2229       ecode("greek")

As @Dennis points out, this needs to be run in a terminal in order for it to correctly produce UTF-8 output.

How do you make this work? I get a UnicodeEncodeError.

@Dennis TIO's Python 2 is pretty bad compared to repl.it for example. Repl.it works if the source contains non-ASCII and you don't specify another encoding at the top. So try using Ideone and repl.it.

@mbomb007 If these online interpreters make any modifications to the source code before running the interpreter, they've created a new language for the purposes of PPCG. In any case, the first three bytes of this answer are a UTF-8 byte-otder mark, but the source code is not valid UTF-8.

@Dennis: I have my terminal set to UTF-8. I believe the TIO error is from the virtual terminal being set to ASCII - adding a echo -ne '.encode("utf8")' >> code.py line in the middle resolves the issue. I don't think relying on a UTF-8 terminal is too crazy, but if it is then I'll amend the answer.

If your answer works in one setup, it is valid; no arguments. My conversation with @mbomb007 was based on my misguided assumption that Python couldn't process the source file, but as you correctly pointed out, the decoding step is what's causing problems. The issue doesn't seem to be as simple as tweaking some settings though. Everything on TIO uses UTF-8 default, including Python.

After some testing on my local machine, I discovered that python anthem.py works just fine, but python anthem.py | cat does not, so it looks like Python produces one kind of output if STDOUT is a TTY and another kind if not. The current setup doesn't allow creating PTYs, but I'll see if I can fix that. As far as your answer goes, I'd make a remark that it has to be run in a terminal.

Bash + GNU iconv, 214
a="�� ������� ��� ��� "
l="
��� ��� ����� �����������,
����� � ����� ��������!"
iconv -f GREEK<<<"$a����
��� ������� ��� �������.
$a���
��� �� ��� ������� �� ��.
��' �� ������� ��������,
��� ������� �� ����!$l$l$l"

This just uses the iconv utility to convert from the GREEK encoding (byte per char) to utf-8, along with removing a bit of redundancy by storing repetitions in variables.
Don't try to copy directly from the above - lots of unprintables get munged when pasting.  Instead, create the script as follows:
base64 -d << EOF > greek.sh
YT0i0+Ug4+358d/m+SDh8Pwg9OftICIKbD0iCsrh6SDz4e0g8PH+9OEg4e3k8eXp+ezd7ecsCvfh
3/HlIPkg9+Hf8eUgy+X19OXx6dwhIgppY29udiAtZiBHUkVFSzw8PCIkYer8+OcK9O/1IPPw4ejp
7/0g9OftIPTx7+zl8d4uCiRh/PjnCvDv9SDs5SDi6dwg7OX08dzl6SD05yDj5y4KwfAnIPThIOr8
6urh6+Eg4uPh6+zd7ecsCvT57SDF6+ve7fntIPThIOnl8dwhJGwkbCRsIg==
EOF

The space in -f GREEK is not required. Using a heredoc instead of a herestring saves an additional byte.

PHP, 296 Bytes
<?=gzinflate(base64_decode("1Y+9DoJAEIR7Et7hrGyMz3gEiJKgiYWNlrYIAUXkL7zB7Cs5e0ZDZ22u2Nvdme/mcEFtcMMoiQQo8JDEoBQrqZEIDUaDTlLZovE9DiaJjYRiUeKJlu3uI5OI/gkDatZ87Xv4Sf5yreOq16AiNnN3R8xQo3UGZTXKPYhd6qR00dDxlOi1rSjR64ArRjQrjSyJ/uHIaY9cw7isqm5d1GxB5Ik2vhKycGslkP1bwx53qhiCzhl3w1WhC8NvzTqcSY1pVnb75/QX"));

PHP, 349 Bytes
echo$y="Σε γνωρίζω από την"," κόψη\nτου σπαθιού την τρομερή.\n$y όψη\nπου με βιά μετράει τη γη.\nΑπ' τα κόκκαλα βγαλμένη,\nτων Ελλήνων τα ιερά!\n".$z="Και σαν πρώτα ανδρειωμένη,\nχαίρε ω χαίρε Λευτεριά!\n",$z.$z;

Bubblegum, 194 187 bytes
00000000: d58e 3542 0541 1005 f33d c590 e070 45dc  ..5B.A...=...pE.
00000010: dd2d 2444 d77d f706 f5ae c4f4 a019 f18f  .-$D.}..........
00000020: daab 8b47 7247 4aaf 3dad f146 a13d 47ac  ...GrGJ.=..F.=G.
00000030: 551d 3a6d 52d2 3b1a 1d6a 9732 f2f5 a82d  U.:mR.;..j.2...-
00000040: a70d ad12 5351 fbf2 e87b 4b9b 5a63 a423  ....SQ...{K.Zc.#
00000050: d71a afcb d1ff dc6f ea6a a0da a523 a1e6  .......o.j...#..
00000060: 39e4 81f7 4c4e 1df6 0d55 7aea 9956 67ac  9...LN...Uz..Vg.
00000070: 1107 2d1a 1a62 5a2b 13d2 9076 bcd0 532e  ..-..bZ+...v..S.
00000080: 7a5d ed99 fe15 2d2d aff4 567e ddd6 e486  z]....--..V~....
00000090: 9f8a b827 b617 1bc4 365c d59a 8ec3 8ad5  ...'....6\......
000000a0: 645a 3303 edfd a1ee 10f3 667d a73d f7a7  dZ3.......f}.=..
000000b0: e281 5c5b da0c e47a 92d9 1f              ..\[...z...

You can reverse this hexdump with xxd -r.
Thanks Dennis for redirecting me to Zopfli :)

Give someone else a chance to post, will ya?

@mbomb007 OP is just a normal competitor, so I let anyone beat me :P

You should've waited a couple days before posting your solution, giving someone else a chance to try that language. It's not cool to post a challenge and post a really short answer immediately after.

Python 3, 246 bytes
q=b'Qc akwo]dw _nz rek '
print(''.join(chr(b+b//63*850)for b in
q+b'hzve\nrms qn_fgm{ rek romjco\.\n'+q+b"zve\nnms jc `gZ jcroZcg re ae.\n?n' r_ hzhh_i_ `a_ij[ke,\nrwk Cii\kwk r_ gcoZ!"+b'\nH_g q_k no|r_ _kbocgwj[ke,\nu_]oc w u_]oc IcsrcogZ!'*3))

Try it online!
My take on Rod’s approach.

Jolf, 187 bytes
Being encoded in the greek codepage helps.
ΆΆγ"Σε γνωρίζω από την κόψη
'του σπαθιού την τρομερή.
"-γ'κ«που με βιά μετράει τη γη.
Απ' τα κόκκαλα βγαλμένη,
των Ελλήνων τα ιερά!
»*3"Και σαν πρώτα ανδρειωμένη,
χαίρε ω χαίρε Λευτεριά!

Try it here! It's all greek to me...

The output must be in UTF-8. Is that even possible with in-browser interpreters? As far as I know, in-browser JavaScript uses UTF-16.

@Dennis I asked the OP for clarification, and he said that it's probably ok