Print all Country Codes
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)
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
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.