25
\$\begingroup\$

ISO 3166-1 is the standard that defines all the country codes. The well-known two-letter codes (US, GB, JP, etc.) are called Alpha-2 codes.

With two letters, there are only 262 = 676 possible codes, which can be nicely arranged in a grid. This table can be useful as an overview, to see which codes are actually in use, reserved, etc.

This challenge is simple: you're to print all assigned codes of this grid to STDOUT, using plain ASCII, exactly as shown below:

AA    AC AD AE AF AG    AI       AL AM AN AO AP AQ AR AS AT AU    AW AX    AZ
BA BB    BD BE BF BG BH BI BJ    BL BM BN BO    BQ BR BS BT BU BV BW BX BY BZ
CA    CC CD    CF CG CH CI    CK CL CM CN CO CP    CR CS    CU CV CW CX CY CZ
            DE    DG       DJ DK    DM    DO                            DY DZ
EA    EC    EE EF EG EH             EM       EP    ER ES ET EU EV EW         
                        FI FJ FK FL FM    FO       FR                FX      
GA GB GC GD GE GF GG GH GI       GL GM GN    GP GQ GR GS GT GU    GW    GY   
                              HK    HM HN          HR    HT HU               
   IB IC ID IE                   IL IM IN IO    IQ IR IS IT IU IV IW IX IY IZ
JA          JE                      JM    JO JP                              
            KE    KG KH KI          KM KN    KP    KR             KW    KY KZ
LA LB LC       LF       LI    LK                   LR LS LT LU LV       LY   
MA    MC MD ME MF MG MH       MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ
NA    NC    NE NF NG    NI       NL       NO NP    NR    NT NU             NZ
OA                                  OM                                       
PA          PE PF PG PH PI    PK PL PM PN          PR PS PT       PW    PY   
QA                                  QM QN QO QP QQ QR QS QT QU QV QW QX QY QZ
RA RB RC    RE       RH RI       RL RM RN RO RP       RS    RU    RW         
SA SB SC SD SE SF SG SH SI SJ SK SL SM SN SO       SR SS ST SU SV    SX SY SZ
TA    TC TD    TF TG TH    TJ TK TL TM TN TO TP    TR    TT    TV TW       TZ
UA                UG          UK    UM                US                UY UZ
VA    VC    VE    VG    VI             VN                   VU               
               WF                WL       WO          WS       WV            
XA XB XC XD XE XF XG XH XI XJ XK XL XM XN XO XP XQ XR XS XT XU XV XW XX XY XZ
            YE                                           YT YU YV            
ZA                                  ZM             ZR             ZW       ZZ

(If I made any mistakes copying it down, the table here in this post is normative for the challenge, not the one on Wikipedia.)

You may or may not use trailing whitespace in each line which doesn't contain the *Z code, but not beyond the 77th character in that line (i.e., at most, you can make it a rectangular block, ending in Zs and spaces). Also, you may or may not use a single trailing new line at the end.

This is code golf, so the shortest answer (in bytes) wins.

\$\endgroup\$
2
  • \$\begingroup\$ Which table is your example supposed to match? Is the omission of YT (Mayotte) an oversight? \$\endgroup\$ Commented Oct 13, 2014 at 20:42
  • \$\begingroup\$ @GregHewgill Yes thank you. I'll fix that, but for any further discrepancy, the table in this post is normative (it doesn't really matter for the challenge, if one code is missing or too much). \$\endgroup\$ Commented Oct 13, 2014 at 20:44

15 Answers 15

10
\$\begingroup\$

Python 2, 240 bytes

Straightforward binary encoding implementation.

R=range(26)
print"\n".join(" ".join(chr(65+r)+chr(65+c)if int("8hfxckgq1olihfa47x3rrdkojzkklec7qk1hp4ht6avmzxfg7c4uv14xe0pzvvg93x81ag2bf88v2w0p3p08g8nwtuktbwosj9dytset3qmhdl72v5u62nepapgabdqqu7x",36)&1<<c+r*26 else"  "for c in R)for r in R)

The script for generating the integer is quick and dirty:

codes="""AA    AC AD AE AF AG    AI       AL AM AN AO AP AQ AR AS AT AU    AW AX    AZ
BA BB    BD BE BF BG BH BI BJ    BL BM BN BO    BQ BR BS BT BU BV BW BX BY BZ
CA    CC CD    CF CG CH CI    CK CL CM CN CO CP    CR CS    CU CV CW CX CY CZ
            DE    DG       DJ DK    DM    DO                            DY DZ
EA    EC    EE EF EG EH             EM       EP    ER ES ET EU EV EW         
                        FI FJ FK FL FM    FO       FR                FX      
GA GB GC GD GE GF GG GH GI       GL GM GN    GP GQ GR GS GT GU    GW    GY   
                              HK    HM HN          HR    HT HU               
   IB IC ID IE                   IL IM IN IO    IQ IR IS IT IU IV IW IX IY IZ
JA          JE                      JM    JO JP                              
            KE    KG KH KI          KM KN    KP    KR             KW    KY KZ
LA LB LC       LF       LI    LK                   LR LS LT LU LV       LY   
MA    MC MD ME MF MG MH       MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ
NA    NC    NE NF NG    NI       NL       NO NP    NR    NT NU             NZ
OA                                  OM                                       
PA          PE PF PG PH PI    PK PL PM PN          PR PS PT       PW    PY   
QA                                  QM QN QO QP QQ QR QS QT QU QV QW QX QY QZ
RA RB RC    RE       RH RI       RL RM RN RO RP       RS    RU    RW         
SA SB SC SD SE SF SG SH SI SJ SK SL SM SN SO       SR SS ST SU SV    SX SY SZ
TA    TC TD    TF TG TH    TJ TK TL TM TN TO TP    TR    TT    TV TW       TZ
UA                UG          UK    UM                US                UY UZ
VA    VC    VE    VG    VI             VN                   VU               
               WF                WL       WO          WS       WV            
XA XB XC XD XE XF XG XH XI XJ XK XL XM XN XO XP XQ XR XS XT XU XV XW XX XY XZ
            YE                                           YT YU YV            
ZA                                  ZM             ZR             ZW       ZZ
"""
n = sum(1 << (x/3) for x in range(0, len(codes), 3) if codes[x] != " ")
def baseN(num,b,numerals="0123456789abcdefghijklmnopqrstuvwxyz"):
    return ((num == 0) and numerals[0]) or (baseN(num // b, b, numerals).lstrip(numerals[0]) + numerals[num % b])
print baseN(n, 36)
\$\endgroup\$
8
  • 1
    \$\begingroup\$ You save 4 bytes using R=range(26). \$\endgroup\$
    – Falko
    Commented Oct 13, 2014 at 21:20
  • 1
    \$\begingroup\$ @Falko: That won't work because I need two iterators. Oh wait, this is python 2, where range returns a list! \$\endgroup\$ Commented Oct 13, 2014 at 21:20
  • \$\begingroup\$ Oh, and 4 more writing ...,36)&1<<c+r*26else.... - Would you mind posting your script for generating the base-36 integer? \$\endgroup\$
    – Falko
    Commented Oct 13, 2014 at 21:28
  • \$\begingroup\$ @Falko: Thanks, only 3 because 26else is not parseable. I thought I tried removing the parentheses but I must have had something else wrong at that point! \$\endgroup\$ Commented Oct 13, 2014 at 21:33
  • \$\begingroup\$ Ok, it seems to depend on the interpreter. My Python 2.7.8 does allow 26else. (Python 2.7.6, however, does not.) \$\endgroup\$
    – Falko
    Commented Oct 13, 2014 at 21:38
7
\$\begingroup\$

CJam, 125 122 121 bytes

"^Kéÿ·^?{ÿ·¿oÂ^Ú^À:ð^×à^Cé^Dÿ^Ýú^À^K^V^G^Áïþ ,^@^K^ÍBù(^_+óÿþºMa^À^H^@#ï^\¨^@ÿÿ¦|¨ÿþ}íßÕ^Ø\"^Â^Nª^P ^D^R$?ÿÿð^À^AÂ^@!^I"256b2b'[,65>_m*]z{~S2*?}%26/Sf*N*

The above uses caret notation for control characters.

Printable version (141 bytes) for the online interpreter:

"J`ki4#'Tr{$V!AcG)\d6o+rW97;#1|jN!WXL%GRuqYos0xCaaBzYgN97DOA'f@#@k'867BrCc1h?&d0LBq[st0YW^?b2Jfx.&gG:O(&"31f-95b2b'[,65>_m*]z{~S2*?}%26/Sf*N*

Example run

$ base64 -d > cc.cjam <<< Igvp/7d/e/+3v2/CmoA68JfgA+kE/536gAsWB4Hv/iAsAAuNQvkoHyvz//66TWGACAAj7xyoAP//pnyo//597d/VmFwigg6qECAEEiQ////wgAHCACEJIjI1NmIyYidbLDY1Pl9tKl16e35TMio/fSUyNi9TZipOKg==
$ LANG=en_US cjam cc.cjam
AA    AC AD AE AF AG    AI       AL AM AN AO AP AQ AR AS AT AU    AW AX    AZ                                                                                                                                      
BA BB    BD BE BF BG BH BI BJ    BL BM BN BO    BQ BR BS BT BU BV BW BX BY BZ                                                                                                                                      
CA    CC CD    CF CG CH CI    CK CL CM CN CO CP    CR CS    CU CV CW CX CY CZ                                                                                                                                      
            DE    DG       DJ DK    DM    DO                            DY DZ                                                                                                                                      
EA    EC    EE EF EG EH             EM       EP    ER ES ET EU EV EW                                                                                                                                               
                        FI FJ FK FL FM    FO       FR                FX      
GA GB GC GD GE GF GG GH GI       GL GM GN    GP GQ GR GS GT GU    GW    GY   
                              HK    HM HN          HR    HT HU               
   IB IC ID IE                   IL IM IN IO    IQ IR IS IT IU IV IW IX IY IZ
JA          JE                      JM    JO JP                              
            KE    KG KH KI          KM KN    KP    KR             KW    KY KZ
LA LB LC       LF       LI    LK                   LR LS LT LU LV       LY   
MA    MC MD ME MF MG MH       MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ
NA    NC    NE NF NG    NI       NL       NO NP    NR    NT NU             NZ
OA                                  OM                                       
PA          PE PF PG PH PI    PK PL PM PN          PR PS PT       PW    PY   
QA                                  QM QN QO QP QQ QR QS QT QU QV QW QX QY QZ
RA RB RC    RE       RH RI       RL RM RN RO RP       RS    RU    RW         
SA SB SC SD SE SF SG SH SI SJ SK SL SM SN SO       SR SS ST SU SV    SX SY SZ
TA    TC TD    TF TG TH    TJ TK TL TM TN TO TP    TR    TT    TV TW       TZ
UA                UG          UK    UM                US                UY UZ
VA    VC    VE    VG    VI             VN                   VU               
               WF                WL       WO          WS       WV            
XA XB XC XD XE XF XG XH XI XJ XK XL XM XN XO XP XQ XR XS XT XU XV XW XX XY XZ
            YE                                           YT YU YV            
ZA                                  ZM             ZR             ZW       ZZ
\$\endgroup\$
0
6
\$\begingroup\$

Ruby, 269 246 241 235 227

g="b6wapsm769n90ongzuvadg5vdat6ap7v1oyyie3j5wxbq9xtycezrtt9xamn9riqnnxnsxjx0al8uk8rmk5snb7quly7t5i9rkq21r1vnns5vdm7gwzqtxwwwmj02nqxlhl".to_i 36
l=*?A..?Z
676.times{|i|print g.to_s(2)[i]==?1?l[i/26]+l[i%26]:"  ",i%26==25?$/:" "}

g is a matrix where each cell that has a country code is a 1 and all others are 0. All rows are written behind and the resulting binary number has been converted to a base 36 representation. Then I just iterate over all cells and check if the code shall be printed.

\$\endgroup\$
9
  • 2
    \$\begingroup\$ Welcome to PPCG! A few of Ruby tips: you can use {|i|...} instead of do|i|...end, and also start the first statement right after |i| (without line break). A shorter way to print without trailing line break is $><<. You can replace "\n" with $/, and "1" with ?1. And a shorter way to generate the alphabet is l=[*?A..?Z]*'' ;) \$\endgroup\$ Commented Oct 14, 2014 at 10:22
  • 2
    \$\begingroup\$ Additionally, you can use the alphabet as array, no need to join it into a string. \$\endgroup\$
    – manatwork
    Commented Oct 14, 2014 at 10:24
  • \$\begingroup\$ Thanks! If I replace print with $><< a matrix of true and false is printed. How do I use this correctly? \$\endgroup\$
    – stevecross
    Commented Oct 14, 2014 at 10:33
  • 1
    \$\begingroup\$ There appears the problem of precedence as << is a method of $>, so you have to use parenthesis: $><<(1==2?3:4). By the way, the shortest I got from this is 231 characters: pastebin.com/iabBNh6S . \$\endgroup\$
    – manatwork
    Commented Oct 14, 2014 at 10:38
  • 1
    \$\begingroup\$ No, I think not. But regardless you use print or $><<, use only one. print accepts multiple parameters separated with ,, for $><< you can concatenate the two pieces to output. \$\endgroup\$
    – manatwork
    Commented Oct 14, 2014 at 10:46
4
\$\begingroup\$

CJam, 152 149 148 145 144 140 139 bytes, printable

". QH%$ydK0]cg:WSSlFu0z>O$T1<hO)Q63@D7;\KDJ^!NQN!tFr'>x@*!nf`Ut<s=N_[\%Ec0AXXZ`hayqIi'qj)jnonEj!n(ZjpjW("31f-96b2b'[,65>_m*]z{~SS+?S}%52/N*

Thanks Dennis for pointers.

Pretty straightforward approach. How it works:

". Q .... jW("                "Push this string to stack. This is a compressed string"
                              "which results to a 26 by 26 grid of 0 and 1 representing"
                              "whether that block contains country code or empty space";
              31f-96b2b       "Remove 31 from ASCII code of each of the character,"
                              "treat the number array as of base 96 and convert it to"
                              "a base 2 number";
'[,                           "Create an array of characters of ASCII code 0 to 91";
   65>                        "Take last 26 characters, which are A to Z";
      _m*                     "Copy the array and create all combinations {XX|X ∈ [A,Z]}";
         ]z                   "zip the first 26*26 array of 1 and 0 with the above"
                              "26*26 array of XX such that the final array element"
                              "is like ([B XX]|B={0,1},X∈[A,Z])";
           {~SS+?S}%          "For element, unwrap it from array, put "  " to stack,"
                              "if first number is 1, take XX otherwise, the spaces"
                              "and put a single space after each element";
                    52/       "split the array into chunks of 52,i.e 26 XX and 26 spaces";
                       N*     "Join each chunk of 52 elements with new line"

Try it online here

(Now only if I knew how to do a non printable character version)

\$\endgroup\$
2
  • \$\begingroup\$ I didn't pay attention to your answer earlier. After my last edit, my approach is quite similar to yours (but still a step behind). 1. :i is not needed; b works fine with a string as its second argument. 2. If you use '[, instead of 91,, you don't need :c. \$\endgroup\$
    – Dennis
    Commented Oct 14, 2014 at 2:03
  • \$\begingroup\$ @Dennis Thanks! I actually tried the '[,65> route, but I was still putting a :c after it leading to same bytes, thus did not use it :D \$\endgroup\$
    – Optimizer
    Commented Oct 14, 2014 at 5:41
3
\$\begingroup\$

JavaScript ES6, 336 322

a='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
alert(r='tr20d,yxurj,soeyn,1migz,rbh14,5hqc,13w82y,z1c,iqx33,l8dmo,1swln,zokqa,tukfz,r8voh,jzd34,mflqi,jzjen,10gn1k,13ycc7,sn0bd,kbb0j,qm2hs,mvf4,13ydj3,18y9c,jzdah'.split(',').map((n,i)=>(1e10+(parseInt(n,36).toString(2))).slice(-26).replace(/./g,(m,j)=>+m?a[i]+a[j]+' ':'   ')).join('\n'))

The big string is each row put into binary (1 if there was a country code there, 0 if not) and then base36. Try it out in Firefox at http://jsfiddle.net/twduhqz6/1/.

\$\endgroup\$
2
\$\begingroup\$

Bash+coreutils, 361

Basic regex removal of the combos we don't want. Some mild compression of the regex:

a=({A..Z})
f=(BHJKVY CKP BEJQT A-DFHILNP-X BDI-LNOQX-Z A-HNPQS-WYZ JKOVXZ A-JLO-QSV-Z AF-KP B-DF-LNQ-Z A-DFJ-LOQS-VX DEGHJL-QWXZ BIJ BDHJKMNQSV-Y B-LN-Z B-DJO-QUVXZ B-L DFGJKQRTVX-Z PQW BEIQSUXY B-FH-JLN-RT-X BDFHJ-MO-TV-Z A-EG-KMNP-RTUW-Z _ A-DF-SW-Z B-LN-QS-VXY)
for i in ${!a[@]};{
s+="${a[i]}[${f[i]}]|"
}
echo {A..Z}{A..Z}|sed -r "s/Z /Z\n/g;s/${s%|}/  /g"
\$\endgroup\$
2
\$\begingroup\$

Haskell, 357

Damn, this is kinda hard.

import Data.List.Split
az=['A'..'Z']
k=0x9084004380010ffffffc24482004085570414419abfbb7be7fff153e65ffff001538f7c400100186b25d7fffcfd4f8149f42b1d00034047ff781e068d0015fb9ff2097c007e90f5c015943f6fdedffdefeedff97d
l i (a:b)|i`mod`2>0=a:l(i`div`2)b|1>0="  ":l(i`div`2)b
l _ _=[]
main=putStr$unlines$chunksOf 78$unwords$l k[a:[b]|a<-az,b<-az]

Prints to STDOUT when compiled (thus the main). Using proper compression would make this a lot shorter... ideas welcome

\$\endgroup\$
1
\$\begingroup\$

JavaScript (E6) 350

Not the right tool for this task (maybe thanks to String.fromCharCode?)

r=0,Q=x=>String.fromCharCode(x+64),
console.log("2dff97d 3ff7bfb 3f6fded 3005650 7e90f5 825f00 15fb9ff 1a3400 3ff781e d011 342b1d0 13e0527 3fffcfd 21ac975 1001 14e3df1 3fff001 54f997 3be7fff 26afeed 3041441 102155 244820 3ffffff 380010 2421001"
.replace(/\w+./g,x=>{for(x='0x'+x,s=c=o='',++r;++c<27;s=' ',x/=2)o+=s+(x&1?Q(r)+Q(c):'  ');return o+'\n'}))
\$\endgroup\$
1
\$\begingroup\$

J, 172 chars (printable)

echo}:"1,.u:32+(26 26$,(6#2)#:34-~3 u:
'QKa]?a@a`YQXa$HJ"\^+AB"`F&a[Y\B"N8#Z)QaD"N""P/2QFJ)TQUaa\\58("$""E]STJ"1aaKITJaa[_]?a7H$,$%LJ2*"24+%aaaa$"">*"*2F'
)*0,"1~33+,"0/~i.26

Line breaks for legibility. Straightforward binary packing, with six bits per string character (offset 34 to get into the printable range as well as avoid ').

\$\endgroup\$
1
\$\begingroup\$

Wolfram language, 244 255 bytes

Table[Table[If[BitGet[36^^b6wapsm769n90ongzuvadg5vdat6ap7v1oyyie3j5wxbq9xtycezrtt9xam\n9riqnnxnsxjx0al8uk8rmk5snb7quly7t5i9rkq21r1vnns5vdm7gwzqtxwwwmj02nqxl\hl,675-i*26-j]==1,FromCharacterCode[{i,j}+65]<>" ","   "],{j,0,25}]<>"\n",{i,0,25}]<>""

The number from fireflame241's answer was used and repacked into 36-ary form.

No builtin country data were used.

\$\endgroup\$
0
\$\begingroup\$

PHP, 323 Bytes

$p=explode(_,"^BHJKVY_^CKP_^BEJQT_EGJKMOYZ_ACE-HMPR-W_I-MORX_^JKOVXZ_KMNRTU_^AF-KP_AEMOP_EGHIMNPRWYZ_ABCFIKR-VY_^BIJ_ACEFGILOPRTUZ_AM_AE-IK-NR-TWY_AM-Z_A-CEHIL-PSUW_^PQW_^BEIQSUXY_AGKMSYZ_ACEGINU_FLOSV_\w_ETUV_AMRWZ");
foreach($r=range(A,Z)as$k=>$v)
foreach($r as$w)echo preg_match("#[{$p[$k]}]#",$w)?$v.$w:"  "," 
"[$w>Y];

Try it online!

\$\endgroup\$
0
\$\begingroup\$

C, 373 bytes

main(i,j){char e[]="0BHJKVY|0CKP|0BEJQT|EGJKLMOYZ|0BDIJKLNOQXYZ|IJKLMORX|0JKOVXZ|KMNRTU|0AFGHIJKP|AEMOP|EGHIMNPRWYZ|ABCFIKRSTUVY|0BIJ|0BDHJKMNQSVWXY|AM|0BCDJOPQUVXZ|0BCDEFGHIJKL|0DFGJKQRTVXYZ|0PQW|0BEIQSUXY|AGKMSYZ|ACEGINU|FLOSV|0|ETUV|AMRWZ",*t,*p=e,*s="|";for(i=0;t=strtok(p,s);p=0,i++)for(j=0;j<27;j++)printf(j-26?!strchr(t,65+j)^(*t!=48)?"%c%c ":"   ":"\n",65+i,65+j);}

Try it online

\$\endgroup\$
0
\$\begingroup\$

Wolfram language, 389 bytes

c=CountryData;r=Riffle;StringReplace[""<>r[#~r~" "&/@Array[CharacterRange["A","Z"][[{##}]]&,{26,26}],n="
"],{"GZ"|"WE"->"  ",x:("X"~~_~~" "|n)|##&@@(Cases[#~c~"CountryCode"&/@c[],_String]~Join~(""<>#&/@Partition[Characters@"AACPSXQNICRANTAPEAQPEPEUMQQRCSXQXDGCWLRNTPEVAQUMQVEWLRPIXDYUMQSUMQWVEFRBQYVIBXEMQMQOAQZRBLFRBUKRLIBVIUKGSSFXHRMQTFLIVIWOARIYVIZZRHMFIOAXJA",2,1])):>x,Except@n->" "}]

More readable:

c = CountryData; r = Riffle; StringReplace[
 "" <> r[#~r~" " & /@ 
    Array[CharacterRange["A", "Z"][[{##}]] &, {26, 26}], 
   n = "\n"], {"GZ" | "WE" -> "  ", 
  x : ("X" ~~ _ ~~ " " | n) | ## & @@ (Cases[#~c~"CountryCode" & /@ 
        c[], _String]~
      Join~("" <> # & /@ 
        Partition[
         Characters@
          "AACPSXQNICRANTAPEAQPEPEUMQQRCSXQXDGCWLRNTPEVAQUMQVEWLRPIXDY\
UMQSUMQWVEFRBQYVIBXEMQMQOAQZRBLFRBUKRLIBVIUKGSSFXHRMQTFLIVIWOARIYVIZZR\
HMFIOAXJA", 2, 1])) :> x, Except@n -> " "}]

Wolfram has an in-built list of ISO country codes, so this should be the perfect language for the job. However, it only knows about the country codes that are actually the codes for countries, and not the ones reserved for other uses, which are still included in this table. We therefore need to add a lot of the country codes in manually.

Explanation:

  • ""<>r[r[#," "]&/@Array[CharacterRange["A","Z"][[{##}]]&,{26,26}],n="\n"] is a string array of all pairs of letters from "A" to "Z".
  • #~c~"CountryCode"&/@c[] (where c=CountryData is defined earlier) gives a list of all country codes that Wolfram Language knows about. A couple of these are Missing["NotApplicable"], so we remove those with Cases[...,_String].
  • (""<>#&/@Partition[Characters@"AACP...AXJA",2,1]) makes 83 of the remaining country codes manually using a 138-character string, where the pairs of adjacent characters are the required country codes. This string was found more or less by hand (with the help of the FindPostmanTour function!), and there is some repetition, so there's potentially more golfing to be done here.
  • StringReplace[ <full array> ,{"GZ"|"WE"->" ",x:("X"~~_~~" "|n)|##&@@( <known country codes> ~Join~ <extra codes> ):>x,Except@n->" "}] first gets rid of two codes, "GZ" and "WE", which Wolfram thinks are country codes but aren't according to the table; then matches all codes starting with "X", plus the known codes and the ones we added manually, and replaces them with themselves; then finally everything else which isn't a newline and hasn't already been matched is turned into a space.
\$\endgroup\$
1
  • 1
    \$\begingroup\$ It turns out that the extraneous "GZ" and "WE" stand for Gaza Strip and West Bank. Is this the first time that the conflict in Israel has affected a code golf challenge? \$\endgroup\$
    – Not a tree
    Commented May 1, 2017 at 8:17
0
\$\begingroup\$

Deadfish~, 9662 bytes

{iiiiii}iiiiicc{ddd}dddcccc{iii}iiiciic{ddd}dddddc{iii}iiiciiic{ddd}ddddddc{iii}iiiciiiic{dddd}iiic{iii}iiiciiiiic{dddd}iic{iii}iiiciiiiiic{dddd}icccc{iii}iiic{i}ddc{dddd}dccccccc{iii}iiic{i}ic{dddd}ddddc{iii}iiic{i}iic{dddd}dddddc{iii}iiic{i}iiic{dddd}ddddddc{iii}iiic{i}iiiic{ddddd}iiic{iii}iiic{i}iiiiic{ddddd}iic{iii}iiic{i}iiiiiic{ddddd}ic{iii}iiic{ii}dddc{ddddd}c{iii}iiic{ii}ddc{ddddd}dc{iii}iiic{ii}dc{ddddd}ddc{iii}iiic{ii}c{ddddd}dddcccc{iii}iiic{ii}iic{ddddd}dddddc{iii}iiic{ii}iiic{ddddd}ddddddcccc{iii}iiic{ii}iiiiic{{d}ii}c{iiiii}iiiiiicdc{ddd}dddc{iii}iiiicc{ddd}ddddcccc{iii}iiiiciic{ddd}ddddddc{iii}iiiiciiic{dddd}iiic{iii}iiiiciiiic{dddd}iic{iii}iiiiciiiiic{dddd}ic{iii}iiiiciiiiiic{dddd}c{iii}iiiic{i}dddc{dddd}dc{iii}iiiic{i}ddc{dddd}ddcccc{iii}iiiic{i}c{dddd}ddddc{iii}iiiic{i}ic{dddd}dddddc{iii}iiiic{i}iic{dddd}ddddddc{iii}iiiic{i}iiic{ddddd}iiicccc{iii}iiiic{i}iiiiic{ddddd}ic{iii}iiiic{i}iiiiiic{ddddd}c{iii}iiiic{ii}dddc{ddddd}dc{iii}iiiic{ii}ddc{ddddd}ddc{iii}iiiic{ii}dc{ddddd}dddc{iii}iiiic{ii}c{ddddd}ddddc{iii}iiiic{ii}ic{ddddd}dddddc{iii}iiiic{ii}iic{ddddd}ddddddc{iii}iiiic{ii}iiic{dddddd}iiic{iii}iiiic{ii}iiiic{{d}ii}c{iiiiii}dddcddc{ddd}dddcccc{iii}iiiiicc{ddd}dddddc{iii}iiiiicic{ddd}ddddddcccc{iii}iiiiiciiic{dddd}iic{iii}iiiiiciiiic{dddd}ic{iii}iiiiiciiiiic{dddd}c{iii}iiiiiciiiiiic{dddd}dcccc{iii}iiiiic{i}ddc{dddd}dddc{iii}iiiiic{i}dc{dddd}ddddc{iii}iiiiic{i}c{dddd}dddddc{iii}iiiiic{i}ic{dddd}ddddddc{iii}iiiiic{i}iic{ddddd}iiic{iii}iiiiic{i}iiic{ddddd}iicccc{iii}iiiiic{i}iiiiic{ddddd}c{iii}iiiiic{i}iiiiiic{ddddd}dcccc{iii}iiiiic{ii}ddc{ddddd}dddc{iii}iiiiic{ii}dc{ddddd}ddddc{iii}iiiiic{ii}c{ddddd}dddddc{iii}iiiiic{ii}ic{ddddd}ddddddc{iii}iiiiic{ii}iic{dddddd}iiic{iii}iiiiic{ii}iiic{{d}ii}c{ii}ii{c}cc{iii}iiiiiicic{dddd}iiicccc{iii}iiiiiiciiic{dddd}iccccccc{iii}iiiiiiciiiiiic{dddd}ddc{iii}iiiiiic{i}dddc{dddd}dddcccc{iii}iiiiiic{i}dc{dddd}dddddcccc{iii}iiiiiic{i}ic{ddddd}iii{cc}cccccccc{iii}iiiiiic{ii}ic{dddddd}iiic{iii}iiiiiic{ii}iic{{d}ii}c{iiiiii}dcddddc{ddd}dddcccc{iiii}dddcddc{ddd}dddddcccc{iiii}dddcc{dddd}iiic{iiii}dddcic{dddd}iic{iiii}dddciic{dddd}ic{iiii}dddciiic{dddd}{c}ccc{iiii}dddc{i}ddc{dddd}dddddccccccc{iiii}dddc{i}ic{ddddd}iicccc{iiii}dddc{i}iiic{ddddd}c{iiii}dddc{i}iiiic{ddddd}dc{iiii}dddc{i}iiiiic{ddddd}ddc{iiii}dddc{i}iiiiiic{ddddd}dddc{iiii}dddc{ii}dddc{ddddd}ddddc{iiii}dddc{ii}ddc{ddddd}dddddccccccccc{dd}ddc{ii}ii{cc}cccc{iiii}ddciiic{dddd}dc{iiii}ddciiiic{dddd}ddc{iiii}ddciiiiic{dddd}dddc{iiii}ddciiiiiic{dddd}ddddc{iiii}ddc{i}dddc{dddd}dddddcccc{iiii}ddc{i}dc{ddddd}iiiccccccc{iiii}ddc{i}iic{ddddd}{c}cccccc{iiii}ddc{ii}ddc{ddddd}ddddddcccccc{dd}ddc{iiiiii}icddddddc{ddd}dddc{iiii}dcdddddc{ddd}ddddc{iiii}dcddddc{ddd}dddddc{iiii}dcdddc{ddd}ddddddc{iiii}dcddc{dddd}iiic{iiii}dcdc{dddd}iic{iiii}dcc{dddd}ic{iiii}dcic{dddd}c{iiii}dciic{dddd}dccccccc{iiii}dciiiiic{dddd}ddddc{iiii}dciiiiiic{dddd}dddddc{iiii}dc{i}dddc{dddd}ddddddcccc{iiii}dc{i}dc{ddddd}iic{iiii}dc{i}c{ddddd}ic{iiii}dc{i}ic{ddddd}c{iiii}dc{i}iic{ddddd}dc{iiii}dc{i}iiic{ddddd}ddc{iiii}dc{i}iiiic{ddddd}dddcccc{iiii}dc{i}iiiiiic{ddddd}dddddcccc{iiii}dc{ii}ddc{dddddd}iiiccc{dd}ddc{ii}ii{cc}{c}{iiii}ciiic{dddd}dddcccc{iiii}ciiiiic{dddd}dddddc{iiii}ciiiiiic{dddd}dddddd{c}{iiii}c{i}c{ddddd}cccc{iiii}c{i}iic{ddddd}ddc{iiii}c{i}iiic{ddddd}ddd{c}ccccc{dd}ddc{ii}iiccc{iiii}ic{d}iiic{ddd}ddddc{iiii}icddddddc{ddd}dddddc{iiii}icdddddc{ddd}ddddddc{iiii}icddddc{dddd}iii{c}ccccccccc{iiii}iciiic{dddd}ddddc{iiii}iciiiic{dddd}dddddc{iiii}iciiiiic{dddd}ddddddc{iiii}iciiiiiic{ddddd}iiicccc{iiii}ic{i}ddc{ddddd}ic{iiii}ic{i}dc{ddddd}c{iiii}ic{i}c{ddddd}dc{iiii}ic{i}ic{ddddd}ddc{iiii}ic{i}iic{ddddd}dddc{iiii}ic{i}iiic{ddddd}ddddc{iiii}ic{i}iiiic{ddddd}dddddc{iiii}ic{i}iiiiic{ddddd}ddddddc{iiii}ic{i}iiiiiic{dddddd}iiic{iiii}ic{ii}dddc{{d}ii}c{iiiiii}iiiic{d}ic{ddd}ddd{c}{iiii}iicdddddc{dddd}iii{cc}cc{iiii}iiciiic{dddd}dddddcccc{iiii}iiciiiiic{ddddd}iiic{iiii}iiciiiiiic{ddddd}ii{cc}{c}{dd}ddc{ii}ii{c}cc{iiii}iiicddddddc{dddd}iiicccc{iiii}iiicddddc{dddd}ic{iiii}iiicdddc{dddd}c{iiii}iiicddc{dddd}d{c}{iiii}iiiciic{dddd}dddddc{iiii}iiiciiic{dddd}ddddddcccc{iiii}iiiciiiiic{ddddd}iicccc{iiii}iiic{i}dddc{ddddd}{c}ccc{iiii}iiic{i}iic{ddddd}dddddcccc{iiii}iiic{i}iiiic{dddddd}iiic{iiii}iiic{i}iiiiic{{d}ii}c{iiiiii}iiiiiic{d}dc{ddd}dddc{iiii}iiiic{d}c{ddd}ddddc{iiii}iiiic{d}ic{ddd}dddddccccccc{iiii}iiiicddddddc{dddd}iiccccccc{iiii}iiiicdddc{dddd}dcccc{iiii}iiiicdc{dddd}ddd{c}ccccccccc{iiii}iiiiciiiiiic{ddddd}c{iiii}iiiic{i}dddc{ddddd}dc{iiii}iiiic{i}ddc{ddddd}ddc{iiii}iiiic{i}dc{ddddd}dddc{iiii}iiiic{i}c{ddddd}ddddccccccc{iiii}iiiic{i}iiic{dddddd}iiiccc{dd}ddc{{i}ddd}dddc{d}ddc{ddd}dddcccc{iiii}iiiiic{d}c{ddd}dddddc{iiii}iiiiic{d}ic{ddd}ddddddc{iiii}iiiiic{d}iic{dddd}iiic{iiii}iiiiic{d}iiic{dddd}iic{iiii}iiiiicddddddc{dddd}ic{iiii}iiiiicdddddc{dddd}ccccccc{iiii}iiiiicddc{dddd}dddc{iiii}iiiiicdc{dddd}ddddc{iiii}iiiiicc{dddd}dddddc{iiii}iiiiicic{dddd}ddddddc{iiii}iiiiiciic{ddddd}iiic{iiii}iiiiiciiic{ddddd}iic{iiii}iiiiiciiiic{ddddd}ic{iiii}iiiiiciiiiic{ddddd}c{iiii}iiiiiciiiiiic{ddddd}dc{iiii}iiiiic{i}dddc{ddddd}ddc{iiii}iiiiic{i}ddc{ddddd}dddc{iiii}iiiiic{i}dc{ddddd}ddddc{iiii}iiiiic{i}c{ddddd}dddddc{iiii}iiiiic{i}ic{ddddd}ddddddc{iiii}iiiiic{i}iic{dddddd}iiic{iiii}iiiiic{i}iiic{{d}ii}c{{i}ddd}ddc{d}dddc{ddd}dddcccc{iiii}iiiiiic{d}dc{ddd}dddddcccc{iiii}iiiiiic{d}ic{dddd}iiic{iiii}iiiiiic{d}iic{dddd}iic{iiii}iiiiiic{d}iiic{dddd}icccc{iiii}iiiiiicdddddc{dddd}dccccccc{iiii}iiiiiicddc{dddd}ddddccccccc{iiii}iiiiiicic{ddddd}iiic{iiii}iiiiiiciic{ddddd}iicccc{iiii}iiiiiiciiiic{ddddd}cccc{iiii}iiiiiiciiiiiic{ddddd}ddc{iiii}iiiiiic{i}dddc{ddddd}ddd{c}ccc{iiii}iiiiiic{i}iic{{d}ii}c{{i}ddd}dc{d}ddddc{ddd}ddd{cc}{c}cccc{iiiii}dddcddc{dddd}ddddd{cc}{c}ccccccccc{dd}ddc{{i}ddd}c{d}dddddc{ddd}ddd{c}{iiiii}ddc{d}dc{dddd}iiic{iiiii}ddc{d}c{dddd}iic{iiiii}ddc{d}ic{dddd}ic{iiiii}ddc{d}iic{dddd}c{iiiii}ddc{d}iiic{dddd}dcccc{iiiii}ddcdddddc{dddd}dddc{iiiii}ddcddddc{dddd}ddddc{iiiii}ddcdddc{dddd}dddddc{iiiii}ddcddc{dddd}dddddd{c}{iiiii}ddciic{ddddd}c{iiiii}ddciiic{ddddd}dc{iiiii}ddciiiic{ddddd}ddccccccc{iiiii}ddc{i}dddc{ddddd}dddddcccc{iiiii}ddc{i}dc{dddddd}iiiccc{dd}ddc{{i}ddd}ic{d}ddddddc{ddd}ddd{cc}{c}cccc{iiiii}dcddddc{dddd}dddddc{iiiii}dcdddc{dddd}ddddddc{iiiii}dcddc{ddddd}iiic{iiiii}dcdc{ddddd}iic{iiiii}dcc{ddddd}ic{iiiii}dcic{ddddd}c{iiiii}dciic{ddddd}dc{iiiii}dciiic{ddddd}ddc{iiiii}dciiiic{ddddd}dddc{iiiii}dciiiiic{ddddd}ddddc{iiiii}dciiiiiic{ddddd}dddddc{iiiii}dc{i}dddc{ddddd}ddddddc{iiiii}dc{i}ddc{dddddd}iiic{iiiii}dc{i}dc{{d}ii}c{{i}ddd}iic{dd}iiic{ddd}dddc{iiiii}c{d}ddddddc{ddd}ddddc{iiiii}c{d}dddddc{ddd}dddddcccc{iiiii}c{d}dddc{dddd}iiiccccccc{iiiii}c{d}c{dddd}c{iiiii}c{d}ic{dddd}dccccccc{iiiii}cddddddc{dddd}ddddc{iiiii}cdddddc{dddd}dddddc{iiiii}cddddc{dddd}ddddddc{iiiii}cdddc{ddddd}iiic{iiiii}cddc{ddddd}iiccccccc{iiiii}cic{ddddd}dcccc{iiiii}ciiic{ddddd}dddcccc{iiiii}ciiiiic{ddddd}dddddccccccccc{dd}ddc{{i}ddd}iiic{dd}iic{ddd}dddc{iiiii}ic{dd}iiic{ddd}ddddc{iiiii}ic{d}ddddddc{ddd}dddddc{iiiii}ic{d}dddddc{ddd}ddddddc{iiiii}ic{d}ddddc{dddd}iiic{iiiii}ic{d}dddc{dddd}iic{iiiii}ic{d}ddc{dddd}ic{iiiii}ic{d}dc{dddd}c{iiiii}ic{d}c{dddd}dc{iiiii}ic{d}ic{dddd}ddc{iiiii}ic{d}iic{dddd}dddc{iiiii}ic{d}iiic{dddd}ddddc{iiiii}icddddddc{dddd}dddddc{iiiii}icdddddc{dddd}ddddddc{iiiii}icddddc{ddddd}iiiccccccc{iiiii}icdc{ddddd}c{iiiii}icc{ddddd}dc{iiiii}icic{ddddd}ddc{iiiii}iciic{ddddd}dddc{iiiii}iciiic{ddddd}ddddcccc{iiiii}iciiiiic{ddddd}ddddddc{iiiii}iciiiiiic{dddddd}iiic{iiiii}ic{i}dddc{{d}ii}c{{i}ddd}iiiic{dd}ic{ddd}dddcccc{iiiii}iic{dd}iiic{ddd}dddddc{iiiii}iic{d}ddddddc{ddd}ddddddcccc{iiiii}iic{d}ddddc{dddd}iic{iiiii}iic{d}dddc{dddd}ic{iiiii}iic{d}ddc{dddd}cccc{iiiii}iic{d}c{dddd}ddc{iiiii}iic{d}ic{dddd}dddc{iiiii}iic{d}iic{dddd}ddddc{iiiii}iic{d}iiic{dddd}dddddc{iiiii}iicddddddc{dddd}ddddddc{iiiii}iicdddddc{ddddd}iiic{iiiii}iicddddc{ddddd}iicccc{iiiii}iicddc{ddddd}cccc{iiiii}iicc{ddddd}ddcccc{iiiii}iiciic{ddddd}ddddc{iiiii}iiciiic{ddddd}dddddccccccc{iiiii}iiciiiiiic{{d}ii}c{{i}ddd}iiiiic{dd}c{ddd}ddd{c}cccccc{iiiii}iiic{d}ddddc{dddd}i{c}{iiiii}iiic{d}c{dddd}dddcccc{iiiii}iiic{d}iic{dddd}ddddd{c}cccccc{iiiii}iiicddc{ddddd}d{c}cccccc{iiiii}iiiciiiic{dddddd}iiic{iiiii}iiiciiiiic{{d}ii}c{{i}ddd}iiiiiic{dd}dc{ddd}dddcccc{iiiii}iiiic{dd}ic{ddd}dddddcccc{iiiii}iiiic{dd}iiic{dddd}iiicccc{iiiii}iiiic{d}dddddc{dddd}icccc{iiiii}iiiic{d}dddc{dddd}d{c}ccc{iiiii}iiiic{d}iic{dddd}dddddd{c}ccccccccc{iiiii}iiiicdc{ddddd}ddd{c}ccccc{dd}ddc{ii}ii{c}ccccc{iiiii}iiiiic{dd}iiic{dddd}ii{c}cccccc{iiiii}iiiiic{d}dc{dddd}ddddccccccc{iiiii}iiiiic{d}iic{ddddd}iii{c}{iiiii}iiiiicddddc{ddddd}dccccccc{iiiii}iiiiicdc{ddddd}dddd{c}cc{dd}ddc{{i}dd}ddc{dd}dddc{ddd}dddc{iiiii}iiiiiic{dd}ddc{ddd}ddddc{iiiii}iiiiiic{dd}dc{ddd}dddddc{iiiii}iiiiiic{dd}c{ddd}ddddddc{iiiii}iiiiiic{dd}ic{dddd}iiic{iiiii}iiiiiic{dd}iic{dddd}iic{iiiii}iiiiiic{dd}iiic{dddd}ic{iiiii}iiiiiic{d}ddddddc{dddd}c{iiiii}iiiiiic{d}dddddc{dddd}dc{iiiii}iiiiiic{d}ddddc{dddd}ddc{iiiii}iiiiiic{d}dddc{dddd}dddc{iiiii}iiiiiic{d}ddc{dddd}ddddc{iiiii}iiiiiic{d}dc{dddd}dddddc{iiiii}iiiiiic{d}c{dddd}ddddddc{iiiii}iiiiiic{d}ic{ddddd}iiic{iiiii}iiiiiic{d}iic{ddddd}iic{iiiii}iiiiiic{d}iiic{ddddd}ic{iiiii}iiiiiicddddddc{ddddd}c{iiiii}iiiiiicdddddc{ddddd}dc{iiiii}iiiiiicddddc{ddddd}ddc{iiiii}iiiiiicdddc{ddddd}dddc{iiiii}iiiiiicddc{ddddd}ddddc{iiiii}iiiiiicdc{ddddd}dddddc{iiiii}iiiiiicc{ddddd}ddddddc{iiiii}iiiiiicic{dddddd}iiic{iiiii}iiiiiiciic{{d}ii}c{ii}ii{c}cc{iiiiii}dddc{dd}c{dddd}iii{cc}{cc}ccc{iiiiii}dddcdddddc{ddddd}ddc{iiiiii}dddcddddc{ddddd}dddc{iiiiii}dddcdddc{ddddd}dddd{c}cc{dd}ddc{{i}dd}c{dd}dddddc{ddd}ddd{cc}{c}cccc{iiiiii}ddc{d}dddc{dddd}ddddd{c}ccc{iiiiii}ddc{d}iic{ddddd}{c}ccc{iiiiii}ddcdddc{ddddd}dddddccccccc{iiiiii}ddcc
\$\endgroup\$
0
\$\begingroup\$

Jelly, 121 120 112 110 bytes

“VV&ØṖgḳeƘKo⁾lc<Ṗɗẋ⁾ÆȤ¡rżQ5¤ø^k&`v®tḊẒḂṁz®ṙṂþ°~7<¹ṢƝƒ4ṇæÇZt9ẈÇḞƲY!u`İŀo0*dḅḥmȯḊȧṛƓXĠƈṾ’Bx2ða»32øØAp`OFµỌs2s26G

Try it online!

-8 bytes thanks to @Dennis

-2 bytes thanks to @Dennis's idea of Cartesian products

How it works

Simple: The program multiplies one big binary list with another big list to get most of the output, then formats it

Medium: The program encodes the big binary list

1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 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, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 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, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 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, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1

into one big number, encoding which country codes are assigned. Each element is multiplied element-wise by each element of every possible country code to get a list of all assigned country codes, which is then formatted to the output list.

Lower level:

The bulk of the program uses data encoded in:

“VV&ØṖgḳeƘKo⁾lc<Ṗɗẋ⁾ÆȤ¡rżQ5¤ø^k&`v®tḊẒḂṁz®ṙṂþ°~7<¹ṢƝƒ4ṇæÇZt9ẈÇḞƲY!u`İŀo0*dḅḥmȯḊȧṛƓXĠƈṾ’

It is a base-250 integer which holds the decimal number 233462323092263584350936137603939798267906095227198731310610883427614237299604158551774020670253062350084519623333781892392013977676150946873601610983221266427394582295973500719992107281184544524840476937, which gets turned into the above binary list.

For brevity, let's call this value c and replace the long string with c in the explanation

cBx2ða»32øØAp`OFµỌs2s26G   - main link, takes no input
c                          -  literal value
 B                         -  convert this to binary to get a list
                                       representing which codes are assigned
  x2                       -   repeat each element twice
    ða»32                  - element-wise product (dealing with 
                                       spaces) with...
         øØAp`OF           -  every possible country code in ASCII codes.
                µỌs2s26G   - format the output to be correct
\$\endgroup\$
2
  • \$\begingroup\$ ;⁶$€Fs78;⁷$€ can be replaced with s26G. \$\endgroup\$
    – Dennis
    Commented Apr 30, 2017 at 5:16
  • \$\begingroup\$ Hints: Look into Cartesian products. You don't need spaces for blank; G will pad empty strings with spaces. \$\endgroup\$
    – Dennis
    Commented Apr 30, 2017 at 5:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.