commit 13c0d281b76f83a2cbccb298f9fe75c12fc8e737
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date: Mon, 11 Dec 2023 15:14:47 +0100
Initial commit, some solutions
Diffstat:
A | .gitignore | | | 1 | + |
A | 2023/01/1a.c | | | 21 | +++++++++++++++++++++ |
A | 2023/01/1b.c | | | 28 | ++++++++++++++++++++++++++++ |
A | 2023/01/in.txt | | | 1000 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | 2023/02/2a.c | | | 33 | +++++++++++++++++++++++++++++++++ |
A | 2023/02/2b.c | | | 33 | +++++++++++++++++++++++++++++++++ |
A | 2023/02/in.txt | | | 100 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | 2023/03/3a.c | | | 51 | +++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | 2023/03/3b.c | | | 66 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | 2023/03/extra.txt | | | 3 | +++ |
A | 2023/03/in.txt | | | 140 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | 2023/03/testcase.txt | | | 10 | ++++++++++ |
A | 2023/04/4a.c | | | 43 | +++++++++++++++++++++++++++++++++++++++++++ |
A | 2023/04/4b.c | | | 45 | +++++++++++++++++++++++++++++++++++++++++++++ |
A | 2023/04/in.txt | | | 212 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | 2023/05/5a.c | | | 45 | +++++++++++++++++++++++++++++++++++++++++++++ |
A | 2023/05/5b.c | | | 71 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | 2023/05/example.txt | | | 33 | +++++++++++++++++++++++++++++++++ |
A | 2023/05/in.txt | | | 258 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | 2023/06/6a.c | | | 44 | ++++++++++++++++++++++++++++++++++++++++++++ |
A | 2023/06/6b.txt | | | 1 | + |
A | 2023/06/in.txt | | | 2 | ++ |
A | 2023/06/in2.txt | | | 2 | ++ |
A | 2023/07/7a.c | | | 58 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | 2023/07/7b.c | | | 58 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | 2023/07/in.txt | | | 1000 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | 2023/08/8a.c | | | 35 | +++++++++++++++++++++++++++++++++++ |
A | 2023/08/8b.c | | | 96 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | 2023/08/ex2.txt | | | 10 | ++++++++++ |
A | 2023/08/in.txt | | | 752 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | 2023/09/9a.c | | | 46 | ++++++++++++++++++++++++++++++++++++++++++++++ |
A | 2023/09/9b.c | | | 46 | ++++++++++++++++++++++++++++++++++++++++++++++ |
A | 2023/09/in.txt | | | 200 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | 2023/10/10a.c | | | 76 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | 2023/10/10b.c | | | 156 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | 2023/10/in.txt | | | 140 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | 2023/11/11a.c | | | 39 | +++++++++++++++++++++++++++++++++++++++ |
A | 2023/11/11b.c | | | 39 | +++++++++++++++++++++++++++++++++++++++ |
A | 2023/11/in.txt | | | 140 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | 2023/README.md | | | 18 | ++++++++++++++++++ |
A | README.md | | | 3 | +++ |
41 files changed, 5154 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -0,0 +1 @@
+*/*/a.out
diff --git a/2023/01/1a.c b/2023/01/1a.c
@@ -0,0 +1,21 @@
+#include <stdio.h>
+
+#define N 10000
+
+int main() {
+ char *buf, line[N];
+ int first, last, sum;
+
+ sum = 0;
+ while ((buf = fgets(line, N, stdin)) != NULL) {
+ for (first = -1; *buf; buf++) {
+ if (*buf < '0' || *buf > '9')
+ continue;
+ first = first == -1 ? *buf - '0' : first;
+ last = *buf - '0';
+ }
+ sum += 10 * first + last;
+ }
+ printf("%d\n", sum);
+ return 0;
+}
diff --git a/2023/01/1b.c b/2023/01/1b.c
@@ -0,0 +1,28 @@
+#include <stdio.h>
+#include <string.h>
+
+#define N 10000
+
+char *nums[10] = { "zero (unused)", "one", "two", "three", "four", "five",
+ "six", "seven", "eight", "nine" };
+
+int main() {
+ char *buf, line[N];
+ int j, first, last, sum;
+
+ sum = 0;
+ while ((buf = fgets(line, N, stdin)) != NULL) {
+ for (first = -1; *buf; buf++) {
+ for (j = 1; j < 10; j++)
+ if (!strncmp(buf, nums[j], strlen(nums[j])))
+ *buf = j + '0';
+ if (*buf < '0' || *buf > '9')
+ continue;
+ first = first == -1 ? *buf - '0' : first;
+ last = *buf - '0';
+ }
+ sum += 10 * first + last;
+ }
+ printf("%d\n", sum);
+ return 0;
+}
diff --git a/2023/01/in.txt b/2023/01/in.txt
@@ -0,0 +1,1000 @@
+four82nine74
+hlpqrdh3
+eightsevenhrsseven988
+324pzonenine
+fglpbone79fourvrgcmgklbmthree
+fmbbkvthdcdmcjxzclk42six4
+four22xcqsnvktnpfshtmm
+qmfsccxsixfivelnmpjqjcsc1sixpfpmeight
+eight1nine5nine9six
+s4r91seven
+6pspkslrnxpplkhgqlcqfour
+sixeightnzrzgjvsrnmtqgx5
+sixtwo1
+h6
+five8pbcsllrbvg787
+dpfhfeight28onefourtwo
+vxqbtkxjtwoz3seven
+8ksrcjrcmpbq9rtvtvrbgljzqvbnxddnzt
+mpftpsgp6fourvdmltwojd9
+2fivetwosix
+3qqx2
+jsbdh16snnllpvvgnggfive5nhjpgdzh
+4fmgmmbonegtsnqfdqt1pm
+2onendvlmcrvzsnpr83nine
+8ninelfhkhnqtdfour
+8reight
+84gnprjhr3eightsixsix
+1nc7two
+3zcgkgrnd1d4
+nmfqfivervqkxmkdpnine51
+1fdtrptkb3
+nineone7kks
+ninelzgncpeight966427
+eightrsniner9
+nine7two4
+253slq
+lkhthreetwo982rrc
+fivegdsfnfour64sixtqfour
+dkfdtgnine9
+1six15ninebgnzhtbmlxpnrqoneightfhp
+32fivefivexjvckfourseven5seven
+onexxzvptxkn42eightvsdgszdjgp
+three6sevennine
+mvsrflqjsix22lhd2twodkltkmsk
+threetnbfsfxxhseven51cjvmkvzkdhr2
+11twoxjszm93
+trr62fivedvktlheight19
+4hxthreepqptvkkzmfsevenfourxeight
+5shqhrjtdgsninepblpjprtqptz
+ptwone9kzvjhhfive7qjsblztmfvthreeqrhhmbgjpqrgqhcgzntmvskhh
+xltqzgqxbkq7krgnthtqbm3636
+nvvxfxbgldrb2seven7twokxzbfkvptflnhlqjrthreeoneights
+7fcvckqszbj
+eight1ninethreeninenbmcsqtrl7
+zkqmlqmtszrbvnjnvsevennine9sevenqjrlxqjlql
+428
+8seven16nineeight
+24bkfzsrxjtbzbknqqxtfftzlnrkeight
+two372eightnine
+skxf5zpnmzqgvzjv9sixtwo
+1fivedsghrseven4
+8hmb75twotwo
+2hsnpfourthree3h88cz
+6qkqxszvghrdslpckhfivedlx
+pnxvtbflleightjpfzlqxhr22ckjrnzhnbvdnj1xnfhmb
+cdscn4xksngscvnseven
+65oneightpln
+ninesix11six41seven5twonesl
+f411d
+sixonedqppgfdfbthree1sj1sevenqhdjlg
+eightsixhzshtg5oneone
+tbhdgzphkkvbbclmhgvb3three
+dpsxdfmzstpd7rzf3
+kzpctbr3oneninevgcxcvsconeightgk
+blmpjv6ltxfqsqfjnjgxtseven82
+99four
+onexsxs3sixdnfqlffjnnrfive
+4sevenzdjvrqjlx33
+brtbqvzcdtlkn83sevenmmtwo
+5bnlmjtmeight
+twotwofive2fqbfvqhp65eight
+dstwoneninekfourphth4lrfjjrh
+mqsndqcxt3
+5mbfxskgnh1twoqbxfbcjkzf
+6fourzdcmdl78pvxxjrplmtmvhh
+3mzgttvpt8gvzoneseven21
+8253fgfhpmponef8
+nineninelhntskjvd25
+1czbccmrlch27three
+one4l5four
+sixmcnsxf5two
+onethree2five7vzhctscktrcx
+14szp5fqtqfzcd
+6cgpzjprtsjd8five4vjzfhgkbbf9
+7gt
+4lzx
+fonexgjsnine8
+1twomvdvdrrneight8fivenine
+59eightthreesevenctwon5
+2dxfivenqflqppm3bmtmblbkltwomc
+36mplfgblgff6
+threeseven8gf9sevennine85
+hfssbghbnonesvdm7onekssjbthxjjvnqmcgmrcx
+eightfrbrstlh8
+eight34sevendlhvhszcnvdlvctkdzsgq
+seven2eightmtsmflrx2three44rsk
+fg6
+mbf44
+5926386nine
+48vqvcffsq2eight7zktszfour
+djstrfnqsixone8oneightc
+5seventwoqtr3eight5
+dttwo88three
+8rdxmnrtmt
+r2tzcbr867onetwo
+2v489four2
+vsmfszr5
+84nxrm48
+5cp4five51three
+four3six3
+4zglqmdngeight1sqb
+3twosrlvbzfh6nkrhmnjqeightseven
+eightgjhs276five
+j15one683
+hnnonefvhnxggtwoz2five
+threeseven2fourkltqmthree
+bmksn4
+11ntrt
+5tctbxqjcngdhffqqrjfive
+vcstnf1
+98tgzlvtwobjpxj6
+one6j5hqgbvhtmsjkbt7mglhvjjxmtwo
+1sixq
+three8lbqdd38ljfourtwoccntjgnmv
+two5msdsntdrjl4six15tdpnknrxnine
+sevenzkbfmqxb2sixsevenbvnbxtxvfournine
+1nzdfninednkhghlscsc
+onefive3gvjsqqgx7seventhree
+8dglgts4slg5sixninevzsj
+dxdmkshgssevenfour967ninetwo
+4ninevrhsbqnjtwo
+358fiveseven
+two8sixzt2
+93ninefztjqrhdlxxsjnnflczbsjqpkrmsixtngxqk
+ltpnkxtwoeightcfpjhthree5brzhffour
+four3five6q645qxn
+fourjxqghk6
+8dznl428nine
+1djftqndtmkcbptxs22
+27one
+543
+qgtbvgnl4tzfgch7zqtmpsix
+fourxfgqcsgxbg741922nine
+two4sixmkvkftwo5one
+lrlnnbdzr82g58fkgvfninezmqv
+2xbkhjbrlztnphmcsfcln
+2xlxksqkb
+rcnzsrtfive9scnnvqx6kmkvgmxlpqtkmbjtvsfmvseven
+6oneninekfpnbngn2
+2nnxlthmxqc9eighttcznxdchdthree
+dznqtbkgtwo5zpthvsnone
+7nxjjzhfhpshccknpbpttrjhqkxmmssvtlxtmbxlhvtjczone5twonecf
+96eight
+7qvckkdtvzjd
+14nine1two
+eight87one8ncdzkptqrgtfclsevenc
+8fourfive
+jjqbpmp42589stwosix
+vtrbqpv9sevenone1qlvmzkthnnsevenseven
+pxnxptttxh6fourmbpcldrlfnjtcxtwoonefour
+8njghfrsix82
+gvns197fsgtwo
+9sljnsix8
+rnine7ninethreenjxnrqgzbxbtvrltbss
+4stzbqg44f
+3ninesevennvvdmgkxzmttcxfbsvjrg
+eightsix3twofmnvs
+one2fmzxnhhrnvlttxnhbrjsgjsqkvfn5
+qz9ptnxfngfrh65bvvbhtsrsntczgj
+qfvqfpb2txnxxd2fiventvznljcqj
+fiveqvmzqlgzdbvqzjbllzeight5bgt
+qggflvv753clcqqjqmngdm6onefour
+3fourfiveeightbbgcgtwo857
+one5nineeightg44
+6zmqxcl16twofivedjxhzmhffive
+jnnsixsixtwo2bgsnbrzlnlltb
+six63oneightgdg
+pftmhdnqdgfive1three42four
+8hkcjlskh82
+84
+1ninefour9sxmppxjqqxpn
+ndrgrhsp1gxcrfgxctv
+fiverzmcmbqd78gqm
+fiveeight4
+vxktmrcdlsfiveoneftvqnnvjfour8sixlmldnrceight
+hpfprllctdjtwo9ksszn8eightcfdbzz
+nine5fourfbgf8one7t
+8sqxm5
+6fxcxhn
+2prktdcvnine1
+2vqrlpffvjlfourktdhxxgvonedvnsvlld
+qk7294fl
+sevenfivesevensevensn4
+rnpqmrgczhllzszvkfzmcljzpthree8
+fdcqknlctq74
+1xnvpvfgsbslkkktxxhn
+one5eight3zrldkdj
+nlvgbz71fourk33
+sixfourfour6three2three
+7lszpqqq795nzdfxbzsqlsix
+one8nkqdtctsjj
+7xfphzjzndr1
+keightwo25hmqthbeight
+2sixdm
+l4eight1fourfour
+2ldzseven3eightmdmsgkrrfivetwobbzz
+mtwoneonezdfour22two6
+7fnjbjqdxvkntlfkhkvnzt
+dhqsqnslccxgdd63x
+nine6fourthree
+7qzbrpplm9
+pqbdbxxxggn9fivebfttnine
+58h152eightjmjqlzjjp
+8vjrtblqzsx
+7sevenonesevenhqkvxxsvrsix
+four6hcxdtwozjnpsdtpzxxninevzvsxffxpctcjbtmlm
+3xznljnjz4ms3seven
+8892
+3jrzlmpnxhfivefivetwoseven7
+onethreetjpmpvpr6threethreeone
+one5thcfourndbphpxszjmt7eightwof
+r5s
+fmjzjqlnhxqhvbdvdfbdnb4
+nine9mrqdgnkc
+nm5jxpjgsm31stkvxjseven5
+hplgpfrtlb8dgsbbljfdgknfvqbonexbcddflz
+4bmfrjvj81vvnztchfrjfive
+xvvb2nfqxdmpzjvrbmvvtmc16
+txrfivecjq6hlgjbvzp3threefourone
+sixlthreeeightn9hqmxhxfjrb15
+six6eightone3
+9six7
+nineoneseven2eightbr5nine
+sixqqdsdmtkgkfq9
+3fivefiveffive
+8eightfive2six
+7rnlhrhlfive
+kvkrxgkk6one2ninermqtpbbnmpdpjxc
+nhltwonesix3five3two45sixk
+eightsmjnzfzjk8
+sixhxsprkfour5b9
+vkvhvhrvbnvz7rg944
+ccvzjppvjtthreetwoqdc4eight
+threefive9qlg3hkhvrbdxzdthree11
+onesevenczvffoureight28
+three39jddkzzjninetwo5
+63nine3sixlqnbtrq7jctmgdmk
+zxsqngxxfd9rvjjt14978five
+9983eight
+sevenddfpzjp3skz
+bzdpg73eight71ppzkeight3
+onevphctjs4
+twofive2jxsthree8sixqeightwozrv
+6klpdhhsdng
+thxtwonefive57rpseven2
+qtcdgdfj77sixrhtczdcbp3
+seventhree47
+threekjqqht883
+two3jfgsdnqbxcbzjtteight
+5zcpgcgsixdskfszmmq9hxtknineqmhg8
+snjs1lxkpbk5
+seventwo7bknk9
+rstbvlzlk1tpqjsjmhgdcvpfdqzl2bcbtn
+3eight4six2
+twonine8xkqp3eightgheightxplcqbvppj
+ninevkrvzvseven6eightcmmvgzb
+77n7fourthreecrcq
+xlvszfhhffhmvxfour8skpvl
+9nine3kfhgngkd1
+sevenfivesxdxhtkmeight4
+28four92
+mjzm465qffive9
+dqlghfxbkfourfivegfkmgmdgzxtm1
+six13lrc
+8qbvnhbplbl6
+13lmgbfsgnxone1
+ttdznnjsgjtwo5
+eightfourtwotwoltjxfourone3
+8threethreeeighthbbxfbmpj611
+ninekpjcrvlqbmsixseven5four
+8jmgspsevenfour7
+6nineone5hthbrbsjrhbnn2
+ninezzdlfiveseven4
+fhrxvsevenlvnztq4one
+cvmlmzz8njtfztfzfoneonejbckeight6
+ninexdgtgjjnrb1hrhjvchm
+63gqjvjtmzgkpbfthreesix
+fkstfchxcbrkfivemzhfdhsffd4mnbbmgprxcgmsl
+87rslqkvbzncfxddt
+7fiveeightxqjhdkbbgdjksn
+four375
+sixftdrnbzq84688three
+eightseven8kqdcbgtmvlsvxx24fqrfp
+four7vprrmq91
+six85ndzvnplxhkmrjftsixeight
+5twofourzfdxbffive
+4jbvmpnqcpbdfrkzone9ndcxtgsfive
+nine3jzpsrhb
+nine6cpqsfour
+78kzczxbcthreesixxtdkflhzfour5
+14sixsevennzgfnmppnmcddd9six
+fourncvgmhfl2fivefnlndmj
+rzgqvdgksz6six
+23seven2rhlv5
+9xlnnvnvccj
+3fivethreembplpfdjnineseven2
+jk1
+3threevgklhnnnccrmone2
+threefourfive4
+qtpbdrsix67threekslkmqt
+five3ghvqnrhtbqnvtmdlnine
+84lvnfx9nine
+nine7onethree46
+vtshvtcch5kxkzgkfourrtmbq
+5czsbzl3threeeighttwo
+38nine
+twovcxn9sixklflgptlkt
+fcjpjrxdleight87
+cfn6
+sixfourtpzpnsvghlqp3ssptlls
+trsjxmzvhxgvtzrhxqbb66nfp1knf
+twosevenmdmmcjjgxj96qxrqqteight
+sfcpfs9dpkvxrmjfiveseven
+6dblskzfsrpcnszqtwo9rgrdkjshb5three
+5fourfsblzr3onesix
+gcxsc9
+txjtwone12
+twovpgthxxrpsevenqxpmlbrr3three5
+csqkgmzl93xrxjs64gptsix
+33qjjzgjtrsflgpr6
+twoeightseven6zdtdltvzsxvlgsevensixpmxlfrb
+gjnvdxbveightone8two
+24vjdfhninezfvlgrdvsh8
+ninehn1685nineone
+twoonegsix4threeninezrsnvrltqlms
+5cdfdldjxddrjhncxtsndl8
+1mqg3nspfxnkfoursix9nine
+1tfcrfpqmk1stfrrnrz
+721dgsmsixjtxcxmj4jhkdsfj
+9plbxnrnlgsvtshfgzbkfive5qfbzgrxzk
+fourgjdt2
+ninethreeqqxrjjgskm1fourseven6
+rbrr1
+threekrslrrqngjtwo6
+llkbxgqp2cmnmgdfgrcshlmseightgjzs
+66sixeightthree
+64vdnrrqfxonespgfhzdcdrbrqone
+threervnhkgdg7oneeight
+nkbrvsvlzkonermsvxh65dlvxbxvlnq8
+twozbkclqppd9txxzbvfppz3
+two9nine
+7vnlqfgxlmninek2two
+qjzggvqj1ninefourrc2szbmczr
+seven6kfkkm7
+nqlgfzmdfsevenshvcnxdjvxveightfour9
+seventdrqkrxkeight75qjfbb44
+four3cxhlvthree3tcvrzk
+six5seven2
+3ninehcsjfstwo5xsgmkz6
+3fourlnthree1fourseven
+lsxzsskbsqmeightcrddxvxk93fivevfshztv
+nxqxrsevenl3eight
+239fourjcrffkeightfivezmfsvqvpz2
+hprcp6
+rklbzvhll4nstdjb7fourthreeonefour
+9jlnthv
+65six4dvtftwo
+nine5five3kqvrs183
+sixrgtckzc7nmczdx8three2
+4six61pzjhnhpbnmsq
+1fivembsixsevenddmrlkfour1
+qhgxrbnfc8one2vxc
+rdsttzt1sixonefive
+lsdoneight5pmlztbkvzffourfour7
+7g3
+3sevenlnjfvms9two
+dclkonefour5
+tskeightwo9one25ddmdmkqrpffoureight2
+rmkqgbh1slrtshgkgbdsftvbgm4
+qkhxmpfzf51
+648
+three4gfnxzrs2
+hmcskdltfourllp7sixfiveszgnfbpjt
+hf27ninep1fqdbglxngkf7
+seven6bfhtdztzvqhqnj2xfxchxpfc9
+8vfksvbfive9lxjhcfive
+626txvseventwo
+1bgzkmzx1
+nineeightlzv2l
+8ninetwo68twohhntdvjpzfone
+jsjfive535fdfnj3
+fnzrsevenhcgzccslt92twonine71
+4twothreemx
+6vbtgjssfoneqpsrdfrbcgmrfckfourpzdlb
+91svfsxrseight
+nzmnpbdqjdh2four
+blqjhjxplrxsevenonefive13
+fivef11gtdpgbdrxnbtrfqxfb7r
+l5fivethreenine
+oneffcdpqmvpcdcn6six944
+4mmfjltf7
+29threenine26
+8zrthtv56
+c21hxksz
+nqcbjkb7
+fourxtkrn7bvpbqtcg78
+qjvmvzbkxlseven756
+6g31dk1mnsgxhbdvndjgvsjr
+73eight
+61jlzgrrpkvgdpjzbbqkxp
+3368nineeightwodzl
+9tlqcrxsix7
+cmrrnf8five1
+4three72
+hhcghmtvznine6nineseventwo
+22tvjnfvzshdtpxzxrnzvtwo
+8threeqlkxrkfsevenfivegxmbhqg
+5mzzsldbk7ninefourjfjv
+rloneightcjhxsstwotwombktzlkdxtwo8
+three92nine1sixeightwof
+drxgb14twoone
+7one7seven258nineoneighthkd
+4four4sixninem
+fivejkjpdbfpsttjnpkv4one8phckjllc
+5bmeighteightgkjfkjthree
+98lkzpdnvs7chnmkxzql
+twosix2two15xzkpmctwo
+951
+four481six
+3tdvlonefiveone
+88fourgktxksmhninecfpljsix
+cphlzlx45fourxjphtthree
+6eight4gfjjdvslqv1six1kxlmn2eightwof
+5vxrzxgdpg7vrsrxrrhncfour
+5threethreemrzfbjq
+ninecsg9lseven828bjttzx
+5kqnine
+fivetdhxq39
+rcvlsix6pqzsggz59
+47fnrs
+724onesixtwo
+tdbb7
+sevenseven4
+two7mlzgdqthree
+2gxzbnlrglnvmqmzbznfngxfeightnrcrqsjnftfourone
+fivetwovsbvrfour2ndmltmprsqkbbztwo
+j3twoc6mmzt
+six47nine6tkpjleightwopzf
+sevenmshrczkdqfiverkmhlqjzqqhgppbsm58
+pkbgvlvzckvone26rfqbmtwo6
+sr9qsxjnine9zbc6three
+eight4qxlmtwo27threesix6
+fourone417oneone
+6fpvfbrrtwoeight
+79rj4eight88
+6vhfivevrj
+7tmqhchfive6jxgmqcfmq59eight
+threeone3xqcrjzszhseven2csbflgnds
+1qsxxxmsknhseven3nine
+fivemqxjlggcnsngflb5qtshllseven1onefive
+7476qfcmqqbfhvrvksfztskmzgvjjsrsc
+twosxlbrgdtptwo16
+kffmtjnjjk2fourtgv6rvsrzcvdrklplndseven
+eightzhrfgpjfqgccn2khrfdzfour28
+ninetwoxvnhfdjsxslone4four
+92nine48b
+ptwonefourclthree56
+hshqjfknineeightlkdxvxcsljfptlbb6kt
+fxjbr1four
+nine36gqbt6
+nsbcvzninebvlpvlx1three
+1ltlxzlmzxhjlfvtnrrpdk
+3jpqgspseven5qm
+553npbeightxf
+fourbspjfbxk4
+238
+xjrsdsvgncxddpmj3tlqone89
+68bkvsslntwo
+dxcmpjfprnthree98sbh
+reightwoeightseven76xqfhvbkfouronegkrfvdzzdx
+9lfpjff
+gcvs5
+hnctpgpxdlvklfsdfour2hnvtklhgqxhjpzknine
+ceightwoninefivetwo9plndfive4
+pjnzdrhtddjgllbf9f25eightb
+fpsdpfl8cnhkjtzhfbhdftkvm
+3cqqkflmjmpfmkk79lvkjljd71
+bfpfmkjpnkgspsz7nine
+threethreetmpntmpg3lfzzsrzr36plfvxv
+nvssix83
+dznrcvvgb8
+csrffxrtvmpfgbkcmmdlzxneightzvfgxdpljpcnrcn5
+9sixtxxthree
+seveneight2kpzpvvtzq8
+jbmmeighttwo12seven96bcvcs
+b68pvjcsnine8
+4vphtk7
+mxmjvnbqseven2
+3two2foureightxvvtxpcdmsdzvkg2mthmx
+cxslpdtnnx5five65
+97mp3qbkxmhl5dkphzgmpg5
+7f11sixcnrqone
+8fxjdjxc6drjxnhptdeightseven1six
+sixffvgcsfourhmnrf8
+qtpjrmlgnlkbbbr7sjcpm91five3
+5pqv69one
+eightnine8
+1three8
+39cspknxbsjhtfourpcbqsvlgz
+5nine15
+zgjgjfcdphnqqv4eightsixsevenkv
+6ggfxblx47nine2onenine
+1twoone2xfxfcr5
+sjvpxd7ncpclnc57one1
+4sixdgone
+89ptctqvnpg
+threefour1four4
+8seven5pfeightfive8hclpxjgftc3
+mznfsbmdtltwoqlf9
+425
+n51891
+one5l
+8ninefive2jhhbnjsvdqtlmsjgshvlvlh
+58ggdlkpcmkgeight2vcprcttwo
+twoseven3eightfivesevend
+krrzfivexrmvdtbr1zvqpmthreeonenqnmx
+2sixhjpxptnthreezkfsix
+jchkkkgrdmkvdgksevensevenfour8five6
+1tzbzthree
+xkone7zvgtv5qvln
+6fivetwohjblzsixnine
+onelpgkpggl9nsdxtgh4tgjfgpcsn3
+bjdxc7krrt16xbgvl
+sevenrpftshchmkkflxseven4eightsix
+groneightfftfvk6
+hrcshqtxpqgxeightsix1xxxrczpcr
+foureightthree9sdffivebdtrng
+ninefourthree9eighttwonine7xjrsm
+fivefour64
+51onefivetkcdbbslzmeighttwo8
+4rssgjpzgnczqtdrfivesix7bjxslhzthreefive
+5kgkv7ninethree
+84ninepsbvzkgrvqpzmtqgmcxpvgfbffns
+fourrvdzsntddfoursevenqq54lgdrtdcq
+4nineeightfdh
+9twoonefour2kmnb9
+qcvmnq13tsptksgmqj8
+113twonine4zjsbtjkpbdsix
+sevencvnineq6jvnshmg
+pjhmbnjqflvp452sevenfive69
+2three1sixninekmfcsbsevenfive3oneightg
+six3six62onevrhtsskzrhtthree
+5bxcmdnrf1szdgfournine
+fourxdxmk6
+3lsnfgffnlrqboneeight
+9sfsv4gqhpbqg86
+two17567fournqkmh
+7threesevenzgxvkhf
+vlmz7sevenfourfour8bqzdrdktklfivefq
+xxsvcqqeight6flrffzxpfourkzfstj9
+fourlzpdxg3knxgl
+msb246fourlc1crhlbjgdgr6
+1q1cmrmqponeightd
+twoeightncz513
+nine1nine
+8sixonesixnine
+193sixthree2rgthk
+tvhqp44hmjhzvmhgrbprgttgrt
+52bdszlvsvgzonefiveeight
+sdxnpkllmnninethree5jxsgkdbmknfrfvthree2
+six23hdzmppf67threeseven
+eight5nine76vbggdlp
+4onevrxnnbszk
+9ninezhdsfbfive12
+sixnine5xqmkmthz
+fiveskklnrr13sevenfour3nqs1
+sixqcxqnjxxzqmdlqtwo83
+8eight7
+9psvqdzpchr
+492jseven1
+xrccslcthreetsnfoursixsixsix1
+gskqmvnclfgxbtcq9hsix
+5two4twofive
+sqqhrvtszzjs1vfskhsdsvvhlskn
+nineseveneightcjcgnb9three3xfkst8
+ktwone4one73
+five6xncdddspkcbgklzlzn687
+xgnlvnskgklcpdqvks2
+zscmhb7mrrshccm
+five8hplscnineeight
+2hrgc86dsgjbvsrv9
+8lncmqrxcnm9ctpxjxlz8
+jdqt39336
+1gntnqbstzrnine5cqlrrtfllb13kfleight
+3jscjlvvkd89
+5nineseven66nine6twoonetwonek
+sevenxrqj4bfivesix1
+8msix8
+six6ninesevenfourbttvtt66
+4cmvvdfdgqphjzleight
+55mltlnxc4dmcrhjsjc8seven
+26197jtlvpsixcmzkslvzh
+rjzn2
+krlvgxone54hdddkspmfkpnzcbtbz
+four2two2
+one5vjjs3one6six
+6cmt88three
+reightwo7lrjqxbmgjj3seven2
+ntrkndgqzpfkjrone9
+5dvktjpseightxxmbtrm
+four6seven9936six7
+fourhqstnjbbdscjngp5fpxmg
+77five
+qrzg9five1qqcsonekgvckmmpfx6mpxd
+qzjqstcll7donekkpmkgpdthkjclrpth
+14seven
+bpbfnnq4rpppcjfeightsfcsqzg
+2one7eighttwo2vhzhjpgg9xhsdvlgxf
+eightonepn38ztcqzbthjz8
+lnsix7eightskqhrbx
+sixvnpkpsdzsbjgjkbxreight8five4
+vfrvkmnvnhk5one
+eight9nine7
+oneone5
+7584zprfmjtwo1
+4szpqtwoflcr9bhtthreeeight5
+385
+ninekdqknptxhsevenmrmjzqjvnppsrgbkv9jeight7
+5fs1sixeightthree
+sevenxkvxzqhckfourninetwo3eight
+9eightgfjvv
+xh8
+brbs3fiverzrtwo4jtdsvrljxone
+qcvfnlvfivetwofourgsdlcmkb5
+klnsqmblkffsq4threetwo6
+nine4eightx8eightwohrk
+c1
+sevennine55eightttlbshbfive3
+6ssmtjnxsixthreengrlndcb3
+vgpq8sixsix
+96xhrnine9
+grpsjz1zqzthreeone2four
+r6twosevenrdmczdz
+jdjz4ninefour
+one88
+ninerzdfc8rxnfbpndznctqd4tlb
+cshoneightnbdfmpdh2fnvjtxtshseven
+gtpljthree1six
+63eightfournncq
+twoonegsdpfkfqdf7
+xccnnscfivexbqmxfouroneeightgvndxgnine3
+mktvsff76bfqkq9fivetwo8lv
+3four5
+qhdgmcninethreevssbxqbsd35
+one6mprksdcz6hpxhrdznfpkmp
+six55ninernnmmlgmblttbgph8pqrjtjhtdj
+jnpbmnbqonemjcsgbg1
+9eightfourmkknzgmqh7two
+7five9
+2eight44skdlfbhfsshpvhgfseven
+2cqrzrhbfn
+three8419two7
+rvpblkzgkmxkghsbfn3one
+nine58
+74spkcfzsdmkf2six1
+2threeseven
+sf84qnthree5bmxnrmqff3seven
+oneonecxxv96
+gpdbgxgjqzdzlxgqphdr63twofourkspvxmvrfx
+fivesflg9fivesixonexfb1
+8pc56fourqpqmfour2eight
+3qvgqqldcr8
+tssixfourlbqstcmj1
+pf2sixpzxcpmxtp7twoseven
+5429
+drtlhzlqltwosevenfivetwo29
+eightlqtfronebqhdh1nineonembxnbpgg
+vlvnzcpbpqeightjspbbqqeight6
+sixkkmgcnhdfldplzk3five
+93ninekcmgjm8ckqjdz
+3dmskrqjd9
+five5threefivesix
+lgvbpdnp8oneeight7eight
+seven37
+2onesixtgbqbnn9eight
+5ndhfjrvt5fivetrhzsmqtwo
+bdcrhzdr33ninefive9
+cgsdzcninetwofive6one
+fiveljbtcqcqdglvjnd8onefour
+two2b5lzbjsqx7
+three593sevenfivetwovptpnmxffrkbsp
+sixonesixthree8btmzlnkvxt
+2jf59
+eightfivethreenine57qpdkcfr
+eightsix31threeeight512
+fourseven2twoninenineeightone
+pqtnqdtsix1
+3zpnvhlsjcmcdvzzlqp5
+sixvnmhckrzxfmjglc964nine
+mftxdnhdzmfnrgvvz59nlhhvr7spjrh
+eightls148mmvsjjldzlmvxjd
+3five5mlfhszsevensixthree
+4zpllkssevenfourtgbhdkltwoc
+ffourhnjhmtxxfjg511
+63jddsfqsmjdmgxnthree3four
+eight3onetwotwo7
+fmfour9tvfourfourtwonef
+qseven91two2fgnzcjnm
+rpzmsseven1jcxvxgnvthreeeight
+onefourrflrntpkskseven1kthreetwo
+5lpmhn1six
+ttvdgvf67btpqbslt
+3twovkbrhqsmv2lzggdlbfvgonenine
+rstknqvqtwo55sixjpzmgjsm
+nkgfnrxzj7jszsixfiveeightsixfourflqlzmhl
+sevenbbbmdgbv9oneightqg
+mzmksix42oneonexxmndklncn3bqj
+3xxcsfonefour
+1threeeightnine46zzscxblntplpd
+6four77sneight
+pcjxrxtwoseven71threethree
+5spmqztljvbtthreefivenineonesl
+6zlkxrbhlgf6
+228
+2seventhreesixfoursrhxxrcd
+vhkkr33
+twokzcchqdmpf3
+qrz9
+8lfkxtknx
+76n
+dpxthreeqgtjsqs33pzjxgrmtck
+1xhhdhqv6sixlcgfour
+four9chmvmrqmfq
+one5cvxtvjc96three3
+one6eight
+sevenxdncpgzqqv6five9
+fnlrctrph4mpdninetwo4threedm
+one3nine5two
+8prrdscmtgfivecsnxjrpssix56
+foursclkcvrkvkhrbnnchlsbllfive6djnprhmkxfnine
+five2twojknineddzszxsgxxgzfour
+9532chktx5
+two47
+42sscxflsevenjssjmzn3xgzpvfsneight
+7fltzgtkmqkgjj
+1one5six
+6gstggspddlninezrzcl5eightqdvjlgz
+eight2stxftmtsbn
+vqpqvbjvgklxrtvnkgsvlljgxlpxthkeight8fp
+sixpjhzscgthree8eight
+vgxfxhssbsixfivehxllx9
+nrszzljfrthree8
+dvthfklrvtworxtvhljnsqnbcnpj5eight53
+76threeqclnine
+eightvdc7one2four
+46five1threeeight3six
+five52k557sixxctdrb
+hk2twoggmfchleightxnshxrcvncbxvrzhone7
+21rpnnttwo4fivefivedvtpfmnbmg
+onetkgkv14sixdjfznpdrvl
+onezctthreemfnqcczxpffz2six5
+kzeightwovrtjp94vhn9mjlrxqm9xdzbvgqfqt
+34one17hl
+9332r
+zeightwottpsrgnljcmnglbfsxdkgffrlgm6jnzvkxn9
+pmzdljpgsix7
+zmhxkpskqzgrkptwofour4
+pkoneightsix7
+9695tfivexmspcgz
+ninerrlfckbs7vcmbhkninelbhfclninesevenbppk
+78k2qhvkzgkgkskhfiveone8
+ndxnqczhlkdvd97threeseven
+jmmdfvftbeightone8eight1twosevenseven
+five9six98grthvvqdjbrkxn1
+4qxvqfrkgnfcxkkdm1mnczs
+n3b
+three9bzfour57
+8threexkglxf2
+onedxfivedxvgxjmzkone3kbmplxbkdnpknjzrbmt
+nine3two9fivefrmjgxkrtrmzh
+tlgpkzfdlnine9fivezdl
+9fourtsnhlf5ljxrhflckjrrzfjbndhlcbv
+3tthree6zqrhbpqczsixrgvlcpm5
+twosixnzqtvhhnm8
+five6one6
+4fournine946nine7
+one8rzlnlcvdseven4seven
+tnmkgnbrzg5nmlqsevenone7oneeight
+eight985sjrfjdhtkrbd
+4threexlm6twoone5mthree
+four8fiveghddxqlp
+1kjtrpktpkq
+2grqpqfsclsgdzmkglxbzxcshrs811one
+9seven94ffkfdmvxr
+8tvnnbpj7bjmvlnnj
+sixthreeflggjxmlk54
+6five6ninecjdmkggsixnine
+sfjlhbbx6onexxjsix4z
+9bbnhtpgbntzlxct85
+2bltznvqgs8sixsix
+nms7vst8
+eight9vnrqbv
+two663
+1h6prckcqdqn
+2ninesevensixtwogkvtjrp6rbgc
+sbsncmpsixhfvttwo27fsb
+fourtwoshvjffjdeight83knlxbdjphsn
+bkbhjcgkjbcgjsix1
+cfkpjctlnztlsgjonehrmvtl7vksr
+8eightphhd
+6eighttwosix5one
+8dtnqgtrddjfqmlrptphfxkcgoneeight7
+32eightjfgtqjllmxtf6s
+twovqnctjcvsdfjbhtnzccd2gshchnhrpx
+twovqqpbrf9
+four4onelkjf15psdspgvvdfcvmnkhmfive
+xdpg4ninetsbrmpqfive
+fiveonefive19
+46qtppz
+twoseveneighteight72
+fivefourthreesevenbxtpqctslbkeight2qmvgth
+355ncxjffxt
+eight4zslht5six
+sdnsrghmbxxjhjqd1njqjcghsspmggzd2
+vcthxnqqkvqsjrkxrs71onetwo
+fivexcjvm9
+3kddthreehfhjmq9ninesix6
+rclqzddvxtm2nineninethreefour
+vlfgxbkdgnxrsprd386onethreetwo
+5sixjscbvzkxtl5fourone
+317dnqnqntwo65jnthjbxnfive
+mxtwonethreetwo2ninefour35lnhczqfpt4
+nlctnjrr9twopthreefmxgjeightwofqh
+nz8threefourbhcjvssgcnine
+sevensixzspvzjseven9
+six6onetwocnvmjfour4eightone
+7xfd5qlmtzhhgr
+8twonesch
+nineqvlsrfpdn2
+ptrfgdnine7gpxsix
+pfx4sixfoursix4fivesix
+68lqzp
+nine53jmtsxjptgmzpfoureight31
+two1msjf8
+gpgrpptthreetwomfrmkszrv8
+3five4
+threelqgs2kjvlsbmjkf
+4fourzgqkfhqhvhpgfkt
+jnlbcbgrp7
+onecdcmbrqxxlpbd1rthree
+99mbfdcgbhv
+nine6cvmfourfivesixhcsqfpxkdk
+eighthjbqsbz6ndpkdlnpmpxqvpmsrbvksnnleightnzxmjg
+gvvpnfzbb7zxfschnrteight6two5tnp
+sixrctqxdpkxpfdkglvthreenine47rzs
+jtwonefour8rkmtclhlf97fqpjmggtztwo
+slmfjkfgbjt6
+8lbh
+eightnqtfvvm2
+vseven31
+one54qrnzfrbdqfive
+8twokfivel9
+vfcsqvxkdxfiveqdvgqdmstn5
+5l63
+two8fourzskrqbcszfzbchlh9ldcp6
+hqhszsgmqzlksq5
+sb6fivefourpmtptjtkzhbxjjnqsixkt9
+twohrktppz5sevenhppmnjzlrkdqddsgs
+two37ninefive
+fourllczb9
+sixfourone83two
+ktgpc7
+fjsnkdj6sixsixtworlhgnbqlbm
+51zscxpk6onesevenjxxzcp6hqrtjmhqpk
+dmxfcfmfsbfpjfive4
+one47
+9jdlkcpzsevengfddvzxdnfkxf8
+fourdxnine3four39
+nine1one7fjcjjckngthreec
+5dlqjlbpt
+twooneeight9gf6zvtsqvrlnf
+three3six7
+3jnhfivethree
+1pzdqvjftwofive348
+four7kcrqkf9
+9cxglsdg
+twobgmghbrqdngthreervxjbmp7xvrskhfcf
+cpvhhkgmftttdtwoqfncthree1tzlbqcr5
+kmxqkfmlgtmztzpr74ninebqgcjkksljrphc
+mrsmtdhpsixslxg9five7
+53two
+xpfzv3
+twosdjhone551twozgqc4
+89fourfournfhc
+five7chqddxtwo1tjmlhqsix
+dkrnxgh5xqzcnjzrhg
+lcvfqpglmntwo1sixthreevdndckjgpkzpsp
+foursixnineseven1llbdvckff
+6four15fivettfivefive
+684cfnqfxkxgeightnfgqqmthreelbfxxdsmn
+fourdcxxseven28hxqqfhxtd
+1threegjffmjrfxppnsqthree
+3khnfmcmtj33
+9ninejvdl88
+3four9seven8fourmpjpkn7
+tmfourkc1sixfournglfl
+24xgscdtfxhttglvhczrstpfcjvnine2fiveone
+psqoneight4twojxkcvgdteight1rhcgmkmmjbbnzdhqj
+sfrgqk1two
+fiverzjbzssone4nineninefive
+twonineonergqsg2eight7eightwolf
+rztthree6sixsixxsxtvjthree
+78fourcvthree
+17hjphkdthree
+tdprffbgqseven7
+58eightbchzffmkhh8twofivethree
+zpbfstbb71hgldfkrvfourthreeonesixfour
+fiveseven1eightnine
+four8nine4vxpfpgxtlfhcrndscfgn4seven
+pgtznpnqvm1one1dfsix16
+ddffoureightpmqkznnseven75two
+6lklqx1sevenzhfdb1
+mq113scstpnnveightfive3nine
+threetwox79
+284mrsixthreefour
+1seven7zk4lldz2
+271nine2fourfive9
+fourthree37xxkvlgsixzpkblnine
+xbbnj2eight33
+seven5sevenonekzpnhzx
+247xgmlnntrcsixbstnine
+3ninezxtbqbfgtdjpgmjv
+tvxkssrfthree3
+fourfoureight12
+onefdszsvrzt2fdeightzkbmz
+cqrqkfgb3sevenqtqntxxhqlvrcthreefour
+2one5ptslgxsp4six4two6
+rskmbsfglone913vlmqtmpvfsevenp
+7c
+nkzrdb66crhk
+onevdttzljsmzvvhlf1tzqsqnnchdxbmngtlzzjdszvlvfzhx
+eightbtstrjzmfmzvcgsbgfxfour4one1
+pttthttfftkp41
+two9rlqrxvsevenfive
+v2four4
+two2one
+rdvhthhzrmeight5jtgf
+flshgbbtztkjfive8
+7sfc181fivefive
+fivenine1bfnchprbsix
+six2zpqshtndsgsevenone3one4
+fq8
+seven4eightvzfq7kthqh
+4vxtllmlnine8gsqkngfdzeight
+vhfzmbgseven5
+skqfzlconefivertzchfkvthreeeightfive22
+72oneeightone
+7ccs8vjx7vvszsn
+xrtmgqk95five849
+threebqeight8hg
+drdhjjtdrdxonenineninefourfkzrrggvz97
+8xxldtmdctllqssgdqp83
+dfqrjzv9rqbtn6
+3ninenhgqkglfvjbmgcdrsbhfournine
+five821
+54foursix7pv2qsix
+7197threescjkqhpqvzgjthpmcgtzrcd
+ltpzstwo78fivefourstwox
+mcqcmxxzcmpzrz4ntgnsgqbqjmkzpqvxtvsixrzzr3seven
+foursixfourzrnxsixgpx7eight
+41448sevenhxjpbvhvlmqrpjsvhblts
+1geightgtxlzdmpprjvg856five
+2tgrll648four
+3pkcd6eight948
+94sfznqjqlkvfjgczm
+twockgseven4seven6bp
+sixsix6eightsixeight
+nine3threenpsmshnchm
+threemqfptponesevendbjs17
+2ninehnsnnvj21fkeightwodmz
+jcptspngbc38nvtnrmvqtwo1
+6qsmcvfoursmlsevensix4lkpxxcnk
+xmtjrsrkjd5
+7psvffqn4
+3sh
+jdklghtbz1eightrhvfmnlknlghg77
+62tbtjfkltkdrxsxhhxpvbfvpnrpflh
+fpctmmvvnbftv2
+nkxmdshm5twoseven672
+88788jnscmpqr66sxcjx
diff --git a/2023/02/2a.c b/2023/02/2a.c
@@ -0,0 +1,33 @@
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define N 10000
+
+#define MAX(x, y) ((x)>(y) ? (x) : (y))
+
+int color[26] = { ['r'-'a'] = 0, ['g'-'a'] = 1, ['b'-'a'] = 2 };
+
+int main() {
+ char *buf, line[N];
+ int i, sum, x, maxc[3];
+
+ for (i = 1, sum = 0; (buf = fgets(line, N, stdin)) != NULL; i++) {
+ maxc[0] = maxc[1] = maxc[2] = 0;
+ while (*buf++ != ':');
+ while (*buf++) {
+ if (*buf < '0' || *buf > '9')
+ continue;
+ x = atoi(buf);
+ while (*buf < 'a' || *buf > 'z')
+ buf++;
+ maxc[color[*buf-'a']] = MAX(maxc[color[*buf-'a']], x);
+ }
+ if (maxc[0] <= 12 && maxc[1] <= 13 && maxc[2] <= 14)
+ sum += i;
+ }
+
+ printf("%d\n", sum);
+ return 0;
+}
diff --git a/2023/02/2b.c b/2023/02/2b.c
@@ -0,0 +1,33 @@
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define N 10000
+
+#define MAX(x, y) ((x)>(y) ? (x) : (y))
+
+int color[26] = { ['r'-'a'] = 0, ['g'-'a'] = 1, ['b'-'a'] = 2 };
+
+int main() {
+ char *buf, line[N];
+ int sum, x, maxc[3];
+
+ sum = 0;
+ while ((buf = fgets(line, N, stdin)) != NULL) {
+ maxc[0] = maxc[1] = maxc[2] = 0;
+ while (*buf++ != ':');
+ while (*buf++) {
+ if (*buf < '0' || *buf > '9')
+ continue;
+ x = atoi(buf);
+ while (*buf < 'a' || *buf > 'z')
+ buf++;
+ maxc[color[*buf-'a']] = MAX(maxc[color[*buf-'a']], x);
+ }
+ sum += maxc[0] * maxc[1] * maxc[2];
+ }
+
+ printf("%d\n", sum);
+ return 0;
+}
diff --git a/2023/02/in.txt b/2023/02/in.txt
@@ -0,0 +1,100 @@
+Game 1: 1 red, 10 blue, 5 green; 11 blue, 6 green; 6 green; 1 green, 1 red, 12 blue; 3 blue; 3 blue, 4 green, 1 red
+Game 2: 3 red, 5 green; 5 green, 7 red; 1 blue, 7 red, 3 green; 3 red, 2 blue; 5 green, 4 red
+Game 3: 4 blue, 4 green; 2 green, 2 blue; 8 green, 2 red, 3 blue
+Game 4: 3 blue, 15 green; 16 green; 2 red, 7 green; 2 blue, 14 green
+Game 5: 8 green, 6 red, 16 blue; 8 red, 12 green; 1 red, 9 green, 16 blue; 8 red, 3 green; 2 blue, 5 red, 10 green; 15 red, 4 blue, 8 green
+Game 6: 5 blue, 2 green; 6 red, 3 green; 4 green, 4 blue, 2 red; 14 blue, 2 red
+Game 7: 2 green, 6 blue, 1 red; 2 blue, 1 red; 8 blue; 5 blue, 1 green; 6 blue, 1 red; 2 blue
+Game 8: 1 red, 10 blue, 1 green; 6 blue, 1 red; 3 blue, 2 green; 1 red, 1 blue, 3 green; 13 blue; 10 blue, 3 green, 3 red
+Game 9: 2 blue; 8 green, 3 blue; 4 green; 14 green, 1 red, 2 blue; 3 blue, 1 red, 12 green
+Game 10: 1 blue, 7 green; 1 red, 3 green, 5 blue; 1 blue, 5 green, 1 red; 13 green, 5 blue, 2 red
+Game 11: 1 green, 10 red, 6 blue; 15 red, 12 blue; 18 red, 1 green, 1 blue
+Game 12: 16 red, 8 blue, 1 green; 15 red, 3 blue, 1 green; 5 red
+Game 13: 6 red, 7 blue, 7 green; 3 blue, 4 red, 13 green; 1 blue, 6 red, 11 green; 2 red, 1 blue, 14 green; 8 green, 5 blue, 2 red; 4 blue, 18 green, 4 red
+Game 14: 16 red, 3 blue, 1 green; 7 green, 3 red; 16 red, 15 green, 3 blue; 3 blue, 13 red, 10 green
+Game 15: 1 blue, 1 red; 3 blue, 2 green; 1 red; 2 red, 2 green, 3 blue; 3 blue, 1 red, 3 green
+Game 16: 9 red, 3 blue; 13 red, 9 blue; 9 blue, 10 red; 5 red, 10 blue, 1 green; 2 red, 6 green, 8 blue; 6 green, 13 red, 5 blue
+Game 17: 15 red, 17 green, 8 blue; 18 red, 16 blue, 15 green; 8 blue, 17 green, 10 red; 5 green, 3 red, 12 blue
+Game 18: 2 blue, 11 red, 2 green; 1 green, 11 red, 11 blue; 1 red, 4 blue; 10 blue, 9 red; 1 blue, 7 red
+Game 19: 2 blue, 3 green, 5 red; 8 blue, 16 green; 12 red, 7 blue, 8 green; 9 green, 1 blue; 3 red, 16 green, 10 blue
+Game 20: 3 blue, 5 green, 6 red; 2 red, 8 blue, 7 green; 7 green, 3 blue; 2 red, 11 blue; 1 green, 6 red, 3 blue
+Game 21: 16 red, 3 blue, 8 green; 10 red, 15 blue, 3 green; 6 green, 13 red, 15 blue; 11 green, 13 blue, 10 red
+Game 22: 8 green, 1 blue; 2 blue, 9 green, 3 red; 2 red, 2 blue; 1 red, 3 blue, 8 green; 2 blue, 1 green; 1 green, 2 blue
+Game 23: 2 blue, 8 red, 5 green; 9 green, 2 blue; 10 red, 2 green; 12 red, 1 blue; 11 green, 2 blue, 13 red; 7 green
+Game 24: 6 red; 13 green, 7 red, 10 blue; 7 green, 9 red, 1 blue; 3 blue, 2 green, 2 red
+Game 25: 7 green, 1 red, 2 blue; 8 green, 2 blue, 5 red; 5 blue, 8 green, 4 red; 5 blue, 2 green, 1 red; 5 green, 3 red, 7 blue; 3 blue, 6 green, 1 red
+Game 26: 6 green, 3 red; 1 blue, 2 green, 2 red; 2 green, 2 red, 3 blue; 4 blue, 8 red, 2 green; 1 red, 1 green, 1 blue; 6 red, 5 blue
+Game 27: 4 green, 13 blue, 2 red; 2 red, 7 green, 10 blue; 14 blue, 11 green, 1 red; 10 blue, 15 green
+Game 28: 4 green, 13 red, 7 blue; 2 red, 5 blue; 5 blue, 4 green
+Game 29: 6 green, 15 red; 1 blue, 6 red, 8 green; 6 green, 1 blue; 12 red; 1 green, 7 red, 1 blue
+Game 30: 4 blue, 4 green, 2 red; 6 blue, 9 red, 20 green; 9 blue, 4 red, 2 green; 8 red, 8 blue, 1 green; 6 green, 12 blue, 2 red; 8 green, 8 red
+Game 31: 9 blue; 1 red, 2 blue, 5 green; 2 blue, 2 red, 9 green; 2 blue, 1 red, 8 green; 11 green, 2 red, 3 blue; 7 green, 5 blue
+Game 32: 15 red, 5 green; 4 green, 2 blue, 3 red; 1 blue, 9 red; 1 blue, 15 red; 4 blue, 2 red, 8 green; 3 green, 3 blue
+Game 33: 13 blue, 1 red, 1 green; 8 blue, 6 red; 4 blue, 2 red
+Game 34: 5 blue, 9 red, 7 green; 8 red, 6 green, 5 blue; 2 blue, 7 green, 12 red
+Game 35: 4 blue, 15 red; 1 green, 10 blue, 7 red; 9 red, 3 green, 1 blue; 13 red, 9 blue; 3 blue, 2 red
+Game 36: 4 blue, 18 green, 2 red; 5 green, 6 blue, 11 red; 6 red, 12 blue, 14 green; 19 green, 10 blue, 7 red; 7 red, 8 green, 9 blue
+Game 37: 16 blue, 5 green, 18 red; 3 blue, 14 green, 1 red; 4 blue, 3 green, 14 red; 12 green, 7 red, 15 blue; 15 green, 11 blue, 2 red; 8 blue, 13 green, 6 red
+Game 38: 6 red, 4 blue, 12 green; 3 red, 11 blue; 16 green, 2 blue, 8 red; 4 blue, 11 red, 4 green; 17 green, 7 red, 10 blue; 9 blue, 15 green, 1 red
+Game 39: 1 green, 1 red, 10 blue; 1 red, 5 blue, 2 green; 4 red, 7 blue; 9 red, 6 green, 5 blue; 1 green, 2 blue, 9 red
+Game 40: 13 blue, 11 red, 12 green; 8 green, 11 red, 4 blue; 2 blue, 2 green, 12 red; 2 green, 3 red, 13 blue; 13 blue, 6 red, 2 green; 4 green, 6 red, 8 blue
+Game 41: 12 red, 4 green, 13 blue; 4 red, 7 blue, 10 green; 17 green, 17 red, 11 blue
+Game 42: 1 red, 1 green; 1 red, 4 green; 1 blue, 4 red, 4 green; 3 red; 1 blue, 3 green, 1 red
+Game 43: 7 blue, 10 green; 5 blue, 2 green; 2 blue, 1 green, 4 red; 14 red, 6 green, 7 blue; 4 green, 14 red, 8 blue; 4 green, 6 red
+Game 44: 9 green, 4 red; 4 red, 6 green; 5 red, 2 blue, 7 green; 9 blue, 1 green, 14 red
+Game 45: 20 blue, 4 red, 6 green; 3 blue, 1 green, 6 red; 8 blue, 8 green, 11 red
+Game 46: 1 green, 6 red; 6 red, 3 blue, 3 green; 6 red, 3 blue, 4 green; 1 blue, 5 red; 1 green, 4 red, 1 blue; 2 green, 4 red
+Game 47: 12 green, 8 red, 4 blue; 7 green, 6 red, 11 blue; 4 red, 11 blue, 12 green
+Game 48: 1 green, 3 blue; 13 green, 3 red, 11 blue; 7 blue, 1 green, 2 red; 7 red, 15 green, 4 blue; 4 red, 8 blue, 10 green; 15 green, 8 blue, 6 red
+Game 49: 2 red; 2 red, 9 blue; 4 blue, 1 green
+Game 50: 10 blue, 1 green, 18 red; 13 red, 1 green, 7 blue; 4 red, 2 green, 9 blue; 2 green, 4 red, 10 blue; 7 blue, 3 red; 19 red, 9 blue
+Game 51: 2 green, 2 red, 5 blue; 9 red, 5 blue; 3 red, 10 blue; 9 blue, 6 red, 7 green; 2 red, 5 blue
+Game 52: 6 blue, 3 green; 5 green, 3 blue, 5 red; 1 blue, 2 green, 2 red
+Game 53: 2 blue, 9 green, 15 red; 18 red, 1 blue; 13 red, 12 green; 7 green, 2 blue, 9 red
+Game 54: 18 green; 2 red, 6 green; 6 red, 9 green, 1 blue; 1 blue, 4 green, 5 red; 3 red; 3 green, 4 red
+Game 55: 5 red, 2 blue, 5 green; 10 blue, 4 green, 8 red; 15 green, 9 blue, 9 red; 1 green, 9 blue
+Game 56: 8 green, 11 blue, 1 red; 1 blue, 1 red, 4 green; 8 blue
+Game 57: 5 green, 4 blue; 1 blue, 4 green; 1 red, 1 green, 3 blue; 1 red, 2 blue, 6 green
+Game 58: 8 green, 10 red, 10 blue; 8 blue, 6 green, 12 red; 9 green, 11 blue, 1 red; 12 red, 5 green, 11 blue; 7 red, 2 green, 8 blue
+Game 59: 10 red, 1 green, 3 blue; 16 red, 1 green, 4 blue; 9 red, 2 blue; 1 red
+Game 60: 11 blue, 13 green, 10 red; 15 red, 12 blue; 3 blue, 9 green, 6 red; 12 blue, 5 green
+Game 61: 2 blue, 7 red; 3 green, 14 blue, 11 red; 7 red, 10 blue; 6 blue, 3 green, 4 red; 10 blue
+Game 62: 1 blue, 7 green; 6 red, 12 green, 1 blue; 8 red
+Game 63: 1 blue, 3 green, 1 red; 8 green, 10 red, 1 blue; 8 green, 11 red; 1 blue, 11 green, 5 red; 8 green, 11 red, 2 blue; 2 blue, 10 red, 6 green
+Game 64: 17 green, 2 blue; 12 blue, 8 green; 11 green, 3 red, 4 blue; 5 red, 9 green, 14 blue
+Game 65: 7 blue, 12 green, 5 red; 13 green, 5 blue, 4 red; 4 blue, 8 green, 1 red; 5 red, 10 green, 10 blue; 5 red, 5 blue, 15 green; 4 red, 9 green, 10 blue
+Game 66: 8 green, 2 red; 8 red, 4 green; 5 red, 2 blue, 7 green
+Game 67: 10 green, 7 blue, 2 red; 15 blue, 1 green, 9 red; 2 red, 7 green, 18 blue; 3 green, 5 blue, 8 red; 10 green, 11 blue, 1 red; 10 green, 4 red, 17 blue
+Game 68: 13 green, 10 blue, 7 red; 1 red, 15 green, 7 blue; 17 green, 14 red, 3 blue; 6 green, 8 blue, 6 red; 4 red, 3 blue, 5 green
+Game 69: 1 red, 6 green, 3 blue; 3 red, 4 blue, 6 green; 2 blue, 2 red, 1 green; 6 blue, 9 green, 2 red; 5 green, 6 blue
+Game 70: 1 green, 1 red, 3 blue; 2 green, 4 blue, 8 red; 5 red, 2 green, 3 blue; 3 green, 1 red, 3 blue; 3 green, 4 blue
+Game 71: 11 blue, 13 green; 1 red, 11 green, 3 blue; 6 blue, 14 green, 1 red; 5 blue, 17 green
+Game 72: 3 blue, 10 green, 4 red; 2 green, 6 red, 13 blue; 1 green, 1 blue, 6 red; 5 red, 1 blue, 1 green; 2 green, 5 red, 5 blue; 9 blue, 10 green, 6 red
+Game 73: 6 red, 4 green, 1 blue; 1 blue, 5 red, 3 green; 2 red, 11 green, 3 blue
+Game 74: 13 green, 2 red, 2 blue; 5 blue, 6 green; 12 green, 3 red, 4 blue; 2 green
+Game 75: 9 red, 10 blue, 6 green; 12 blue, 9 red; 11 red, 6 green; 12 blue, 2 red, 1 green
+Game 76: 1 green, 2 blue, 5 red; 2 blue, 1 green; 1 blue, 2 green, 1 red; 2 blue, 1 red; 3 green, 3 red
+Game 77: 5 green, 12 blue, 3 red; 11 blue, 9 green, 13 red; 8 blue, 13 green, 13 red
+Game 78: 2 red, 3 blue, 1 green; 1 green, 19 blue, 1 red; 7 blue, 2 green, 2 red
+Game 79: 5 red, 1 blue, 4 green; 1 blue, 9 green, 10 red; 13 red, 1 green; 1 blue, 1 red, 5 green
+Game 80: 13 green, 2 blue; 1 red, 4 blue, 13 green; 5 red, 7 green, 4 blue
+Game 81: 3 red, 4 blue, 12 green; 16 green, 5 red, 1 blue; 4 blue, 2 red, 2 green; 4 blue, 5 red, 13 green; 8 red, 4 blue, 13 green; 16 green, 3 red
+Game 82: 6 red, 3 green, 2 blue; 1 green, 6 red, 2 blue; 3 blue, 8 green, 9 red
+Game 83: 3 green, 3 red, 1 blue; 3 blue, 4 green, 3 red; 3 blue, 4 green, 1 red; 2 red, 8 green, 2 blue
+Game 84: 5 red, 6 blue, 3 green; 1 blue, 2 green; 3 green, 2 blue, 2 red; 1 red, 3 green, 6 blue; 12 red, 2 green; 4 blue, 2 green, 4 red
+Game 85: 11 green, 4 blue, 9 red; 13 red, 1 blue, 11 green; 7 green, 8 blue, 7 red; 1 red, 4 blue
+Game 86: 3 blue, 19 green, 7 red; 19 green, 1 red, 1 blue; 9 green, 2 red; 7 red, 6 green, 1 blue
+Game 87: 1 blue, 1 green, 4 red; 1 green, 6 red; 6 red, 2 blue; 8 red, 3 blue
+Game 88: 9 red, 6 blue; 4 red, 1 blue, 2 green; 1 green, 10 blue, 6 red; 2 blue, 1 green, 10 red; 7 red, 9 blue
+Game 89: 3 blue, 15 green, 1 red; 1 red, 13 green, 3 blue; 4 blue, 14 green, 4 red; 10 green, 1 blue
+Game 90: 1 red, 13 green; 3 green, 1 red, 5 blue; 5 blue, 6 green; 14 green, 4 blue; 3 blue, 10 green; 13 green, 1 red
+Game 91: 13 green, 11 red, 4 blue; 14 red, 1 green, 10 blue; 4 red, 2 green, 3 blue
+Game 92: 2 red, 3 blue, 6 green; 2 red, 2 blue, 8 green; 14 blue, 1 red, 1 green
+Game 93: 15 blue, 2 red, 13 green; 8 green, 2 red, 8 blue; 6 blue, 1 red, 2 green
+Game 94: 5 red, 4 green, 9 blue; 1 red, 5 green, 4 blue; 11 blue, 4 green, 2 red
+Game 95: 9 blue, 3 green; 2 green, 12 blue; 10 green, 3 blue; 1 green, 1 red, 10 blue
+Game 96: 4 blue, 2 red; 3 green, 10 blue, 7 red; 2 blue, 7 green, 1 red; 13 blue, 9 green; 10 blue, 4 green, 1 red
+Game 97: 6 red, 4 green; 1 blue, 13 red; 3 green, 13 red
+Game 98: 1 red, 13 blue, 1 green; 7 green, 5 blue, 3 red; 15 blue, 6 green; 4 blue, 5 green; 13 blue, 2 green, 1 red; 4 blue, 3 red, 2 green
+Game 99: 1 red, 2 green; 2 red, 2 blue, 1 green; 3 green, 1 blue, 6 red; 3 red, 4 green; 5 red, 1 blue, 4 green; 1 blue, 2 red, 1 green
+Game 100: 9 green, 2 blue, 12 red; 2 blue, 14 red, 2 green; 14 red, 12 green
diff --git a/2023/03/3a.c b/2023/03/3a.c
@@ -0,0 +1,51 @@
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define N 1000
+
+bool isnum(char c) { return c >= '0' && c <= '9'; }
+bool issymbol(char c) { return c != '.' && c != 0 && c != '\n' && !isnum(c); }
+
+int grab(char *buf) {
+ int x;
+
+ if (!isnum(*buf))
+ return 0;
+
+ while (isnum(*buf)) buf--;
+ buf++;
+ x = atoi(buf);
+ while (isnum(*buf)) *buf++ = '.';
+
+ return x;
+}
+
+int main() {
+ char line[N], prev[N];
+ bool l, c, r, ul, uc, ur;
+ int i, sum;
+
+ sum = 0;
+ memset(line, '.', N);
+ memset(prev, '.', N);
+ while (fgets(&line[1], N-1, stdin) != NULL) {
+ for (i = 1; line[i]; i++) {
+ l = issymbol(line[i-1]);
+ c = issymbol(line[i]);
+ r = issymbol(line[i+1]);
+ ul = issymbol(prev[i-1]);
+ uc = issymbol(prev[i]);
+ ur = issymbol(prev[i+1]);
+ if (l || r || ul || uc || ur)
+ sum += grab(&line[i]);
+ if (l || c || r)
+ sum += grab(&prev[i]);
+ }
+ memcpy(prev, line, N);
+ }
+
+ printf("%d\n", sum);
+ return 0;
+}
diff --git a/2023/03/3b.c b/2023/03/3b.c
@@ -0,0 +1,66 @@
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define N 1000
+
+bool isnum(char c) { return c >= '0' && c <= '9'; }
+
+int grab(char *buf) {
+ int x;
+
+ if (!isnum(*buf))
+ return 0;
+
+ while (isnum(*buf)) buf--;
+ buf++;
+ x = atoi(buf);
+ while (isnum(*buf)) *buf++ = '.';
+
+ return x;
+}
+
+void push(int *j, int *g, char *buf) {
+ g[*j] = grab(buf);
+ if (g[*j] > 0) (*j)++;
+}
+
+int main() {
+ char *cont, line[N], prev[N], next[N], backup[3][N];
+ int i, sum, j, g[9];
+
+ sum = 0;
+ memset(line, '.', N);
+ memset(prev, '.', N);
+ memset(next, '.', N);
+ cont = fgets(&next[1], N-1, stdin);
+ while (cont != NULL) {
+ memcpy(line, next, N);
+ cont = fgets(&next[1], N-1, stdin);
+ for (i = 1; line[i]; i++) {
+ if (line[i] == '*') {
+ memcpy(backup[0], prev, N);
+ memcpy(backup[1], line, N);
+ memcpy(backup[2], next, N);
+ j = 0;
+ push(&j, g, &prev[i-1]);
+ push(&j, g, &prev[i]);
+ push(&j, g, &prev[i+1]);
+ push(&j, g, &line[i-1]);
+ push(&j, g, &line[i+1]);
+ push(&j, g, &next[i-1]);
+ push(&j, g, &next[i]);
+ push(&j, g, &next[i+1]);
+ if (j == 2) sum += g[0] * g[1];
+ memcpy(prev, backup[0], N);
+ memcpy(line, backup[1], N);
+ memcpy(next, backup[2], N);
+ }
+ }
+ memcpy(prev, line, N);
+ }
+
+ printf("%d\n", sum);
+ return 0;
+}
diff --git a/2023/03/extra.txt b/2023/03/extra.txt
@@ -0,0 +1,3 @@
+1*.
+.*.
+1..
diff --git a/2023/03/in.txt b/2023/03/in.txt
@@ -0,0 +1,140 @@
+.........398.............551.....................452..................712.996.................646.40...1.....875..958.553...................
+..................................661..-844......*.../781...835..#163....*.......698.239.........*.....*.............*............*57.......
+.....................&...............*......+..139..................................*.........-.......282......................301..........
+........518..........918..-....472..172....776......207............38........................860..............274..945.....162..............
+........@..........#.....845..*........................*.............*....896...+.....153................@......*...*.......#.........441...
+..................740.21.....303...744.........190......173.395...729...-....&..925....@..5..............172...566..193...........#.........
+...598...967*.........*...........*.......164.=......91......*...........192................292...........................414=.215..........
+.............238.......661.....-.149.....&..........*........299...@644.................919*......*661..760....@.110*.......................
+.............................742.............$...125...+......................696..............523.......@..166......496..............#462..
+.588-.........#867.........................945.......457..505........%875......./.....+.........................965.........190.671.........
+........24.........278........934....*569................*..........................180............................=...........*............
+....988...*....151..@.........@............&...........242.................409................807..900#...417.886...........................
+...........330..#.......................729........&.........105......482..........679.........#...........*....$......752...749............
+...=............................../.............995...........*..689.....*.....-....#..............*604..696.......489..........+...193.&336
+..287.........17..737.......468....869.+.....................673...*......480...860........23...435............-..%.........................
+..............*............./..........552.............529.......271.+864..............848..#................771.......216........588...@...
+...........262.................185.........688....848.....*56...............%....$.......*...............362..............-..............250
+..507..............812.........*......................112.....556........754......841....959.........2..*...........248......232.527........
+....$....................478.627....175..........960.....+.....*......................#........790...=........503.....*.....$......*...%....
+..........................%........*........694.....*.......930...451+....248.......20..........*...........$...$..285..203......904..184...
+........531......30..969........435..772.........234..542.................*...............706....351.......571..........*...................
+.........#.......*...................*....&.8.........*.......313....+...807..398...........=.........540.........+....867............#.....
+............34...231.......934*....802..120........965........*.....424......*.........@.................@......974...........53......619...
+.....504....*........640.......127.............................671......316...538....151.......498........................914*..............
+......./.562........*...............504.....................................*.................+.....=..........835...................500....
+..787.........*122..149...$.................*....227.335....863*396......941.230.................847...215.......%..49..982..73.....*.......
+...-.......843..........240...932....@...352.830....*....*........................950........11...........*..........*........+.....819.....
+......354...........-...............66............&...501...................*.........39......*............513.651...482....................
+.....................160.........................437......&..797....551..337.383..735...*...546.............................................
+.......=........184......./.......67........476.........336....#......=...........*....426..........972..../960.....981......684*...........
+2...473....#....%......449........*......=.....%...........................877..890........+..../...................................834.....
+...........498..............926..887......147..................%.260...+..................965...939..../................894.....659*........
+....163...........*237................409......858...........184.*....33.......705...993*.............139..791....955.....@.639......668.455
+.......*.................128.....................-................677...........&........899...@....%......*.........*.........$.......*....
+613&.208..975......./837.-........772.554...........635#...927...........392....................761.300.....42.......68.................969.
+................389......................*.@...851.........*....344........*...90.....@231......................+...................182.....
+...-.286.296...&.......424...313......656..758....*.../..294...............722.#.......................689.......853.................%......
+546..+......*.................*...698...........664..190.....637.10...122........-758.........&753.827*.................#..@.....777....177.
+........490....$.............961.*....31..@................&..+..@.........781.........................................690.285.....*........
+...........*...421................720.*..133.=............298.......933.....&..=......805.461....531.......888.....................965......
+.....923*..310........219.302.................107.....457.....186#.*............691......*........*....89..*.....*..%695.946$...............
+........................#..........867.87...........................9......................623.432....*....678.819................+670......
+....673.......#809.68................*..$...127......422.......954........516*291.685..661..........163........................=............
+.....*....................648.....325........-......*....308..*....................-.....=.709&.366.........................219.............
+..132...439......$.......*.............134...........188.....134...257*38.300.77=...............................707.....................357.
+...........*..298........602..............%......940.......................*...........986@......438........710*...........594.....919......
+.....667..77................................305..*.......................941.....126...............*...............637......*..549*....116..
+......................876+..#516...........*....467.....981.....................*.......726.737.....434..149......%......776................
+.......@474..%..............................506........*........58............92.../37...*.....*633........+.........605.....239*72.........
+...148.......262......729....430.....................748...&...*...995...925........................*................*......................
+......=............................*....655..............254.566..*.....................*628.-356..769.............805......................
+.........229.................48@.251......*.......................733...521..........593..................148..............59%..632.........
+............*....69......................758........477........-......+......654.............................*173....................543....
+..........624.....#..480......@.................959....*......124..980...233*..........278........799/.260*........130......../741......*...
+............................373...=........265........436..%......................552.....*.........................*..423...............733
+316..93.............205............606....................994.316........824.#654...*..860.........947.956..470...550.+.............*682....
+......%....*487............185.........955..-...................$.364....-.........874......#865......*....../...................756........
+...........................*....512....*.....702.852....595.........*........942.......357........620....=......814..107....................
+....#275..650....204..840.......%......57.........*....#...........71.540/.........616....&.......*......899....=.....%....627.....435...849
+.....................*....../.....483.............363........................832..=............&..855.............-..........%.....@........
+..697..+..........661......36......-...*........%.........644...49......245..@...............434...............237...=................=.....
+.......398....773.............*131...248.300....627..............*.......=..........261....................422........621....780&..599......
+...............*......855@.517.....&......*..............592.721.714...........195.....%...........701.612..................................
+....855......943................182.......726..................*........274.6.....%.......799.........*........584..............972.........
+.....*............92.....637....................648............781.......*...-.............*............513...........542*.......@..........
+..249....834........+.........190....................216...........123...263.........................72.........413.......829...............
+............*...773.....*510....*.211=.................%...988......................488-.......214...#...........*....................315...
+.........+..508...&..144.....873........403....484../........@..606.533........918=...............*...........421.............230.528.......
+......650................34................-...%...74..........*......-..............*119.......25..749.....%............828.*....@....68...
+379.............&275..../.....768*805...................112.....237.......*855.....20........................773.....987.*....814.....*.....
+.........$.929.......&....................436..669.........@...........363...................278.....229.........402*................646....
+......897...*.......528............662@..........$.....#..........789.......&....436..282.............*.....................863.=...........
+..........311...........902..819....................118..679..710.......$...314...*......*181..345.530..$..388*......791....*...347.....#...
+.279................74*....$.................237...........#.*.........900......604............&.......455.....485.....*.548.........477....
+............928........734..............440.@.........................................989..........902...............431.................896
+........279........949.....659.....952....*....797.795...$...............4*..............*........*..........960*568........491.....236.....
+..........@.549.....*........$.670*.....254....*...*......184......&42.....129..........121.....486..................*.........&............
+...486......*.....846.......................757..................%.............................................699..829.....................
+....*..88..321...........4......535....594.......=...........=.511..167....-......*............853...............*.......87...........763...
+.303..$...................=.....*.........#..265..697.....462.......&...360....163.528.........*......774...127...770....@........891./.....
+........31......731..+278......667.....#........=...........................................328...591..*............................*...31..
+...................*.......927........420.650.......21.......918.......464.685.451..@................*..317....471*47.384...217..83.15..*...
+....234..219....303..700........#348........#.....%...@.......=...+..................403......419...82................&..........&.......798
+....*....*..........+..................738......857.....203*.....746...........................*..................*.........#...............
+...768.527.....77..................%........................623......393............643.......832........647+..773.421...402...29.370.......
+.................*175.......352.564.....237...*.+681.............=...*......&37...........832......../..........................*../..%.....
+......187..............218...................46......817.......893.139.............*..253*........436............../....619*.772.....532....
+.....*........165...+..................910......647.$..................@.511....143...................784..416...373........................
+..442...834...*....566....+876...34-..+........*...........507.......348.*............*..................*....%........590..................
+.........*..157.....................................344.......@..........988.......745.867............526..+...........*.....109.331.254-...
+.....456.............%..375*...........*.......199.+.........................846............=...............656.................*...........
+....*.......266...893.......441.....686.2...............455*748.............*..../980........726..................384................76.....
+....59......&..............................389..../.............427......645...............-......551..167..............130........*...*....
+.................=......10.....642........*.......536.29*........=...566........72*904..935...155*.......+...$360...703..*..252..870...739..
+.......252.......158......*......*.........695...........949............*............................................*.........*............
+.......*................830.......758...........................917...377......*519..622*439..../802..........665....481....231.............
+.......823..563.....................................167........*............334...................................................../.......
+..............*.................&.418/.&49......209*.......495..783..............185...%.............418/..........470.............289..831.
+.............60.559..........599............247......@.......$......170....884..*.......387..........................*......................
+.................*......*61.......................954...........216..*....*............................@.331....695.958.891*............351.
+......$...396........947.......234*....................994.981.......85....819.....435......./......594.....-...../.........592.............
+......605..*........................16....$.....907%....*..*...629.............958*....950.321...................................671........
+..........867.....821........987.....*...928.........275..687..*...904...300............*........864...................960.111.....*.148.19.
+..494.............*......410...#...517..........700...........714...*................988...........*.............445..*....*....473....-....
+.....*138............221*..............970......#....717...........26......$.....749..........253..330....214....*.........293..............
+.................%..........636..#........-.............*............./....180......&.532........*........*...403...........................
+............*..684......242...*...653..............374...822..........575...............*.....133...#...440...............322..780..........
+.........685..............*..658.......224...-.................%..........*118.........322........615.......981..........................806
+.337..............856..843............*....816....448..83=...824.839...568........989.........562......594.....*..........*21...833.........
+.....708...........*.......355.........437.......*..................*......*........-.944....../..185.....*...286..723..........+....552.652
+........-..73.......230....*......................927.%137.......754....490....782.......-...........*945.682......$...+............*.......
+............*.616=......*.595.......*...842..........................84.......*..................+....................80.........383..1.....
+..........357.........492...........771........68..........927*363..*.......262......69*224.......882.785..&313.............................
+...............................%391..............*....865............947.........583........*120........*..............449..../.../557......
+.........................634........8.....610..240.......*......508..............*.......875............297...717.941..*.......92...........
+.....874*180...&107.100......................*............453.......561....738.758..168.......................*....*....835........260..97..
+.650.....................230..................980.....................*....=...........*...605..396..........753..642..........537..........
+...*...........149.......&..........797.219............./743...................=.......333..*......*....882.................40*.............
+....103...348....%...............86..$.....*..99....................&...........25...........749..950..*.........................&..........
+.........@..............719.175.........652.....*............/......565.191.575.........................583........#./...........223........
+...........................*................295..358.806..520.............*..-...................%....+.....118..632.709...901...........790
+..562....221........735...........338..........*......+..........980....315............682....630.....762......*............................
+...............761....*......408.%.......971..246.................*................307......................949...............553...........
+.................*....194...*...............+...../.....$....$...301..............*.....857..........752#..........680.188..................
+..............551..........689.......*29...........345.75...898..................625....-......#732................&..../....876........576.
+..................................487......326*71......................143..................%........#.=.......................=............
+..42*....563......./..........976.......................496..233..224.....................270.....540..114....972.208....*...*.......950....
+.....667........915...283.....*........161*.......*764.........-....#.178...634+......569....................+........945...340.$.....*.....
+.........550............*.....973.694......209.228.....................*.................#..+..179@....832.......@..............67.448......
+............*...337..284..656......*..433............126.............860...857....*........411.........@.....=...977.....................726
+...815...896.....*.......*......993.....*.....309.....-..........735........./...985...*.....................797......842........$93........
+.....*.........424.......348........94...82.....*..........#25..*.....46*380...#......618.902.142.......972......$906...-....%96........482.
+.....12.............................../.......340...46.756.....327..=.........897...........@....*435...*..........................*546.....
+.................................185.....654........*.....*........772..+959............................581...13...918..388/....895.........
+.90............915.......758.664*........../.......885...564../160................830.869...........474.......*.......#.....................
+...*.....510....@........$..........$..............................813..795..........*....210........%......438..........786.......778.77...
+....984.....%...............+..712...83..*....130..................+....*...545.............*......+.............../.727./....826......*....
+................490......519../...........16....%...42.822..486......214..../...............985.480..............798....................249.
+........369*........317*.........632...#.............=...*.$........................-703.............+341............88.....*659...@........
+............595.........566.............847............456...................................182.........................791........533.....
diff --git a/2023/03/testcase.txt b/2023/03/testcase.txt
@@ -0,0 +1,10 @@
+467..114..
+...*......
+..35..633.
+......#...
+617*......
+.....+.58.
+..592.....
+......755.
+...$.*....
+.664.598..
diff --git a/2023/04/4a.c b/2023/04/4a.c
@@ -0,0 +1,43 @@
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define N 1000
+
+bool isnum(char c) { return c >= '0' && c <= '9'; }
+
+int main() {
+ char *buf, line[N];
+ int i, j, x, sum, nw, nr, w[100], r[100];
+
+ sum = 0;
+ while ((buf = fgets(line, N, stdin)) != NULL) {
+ nr = nw = 0;
+ while (*buf != ':') buf++;
+ while (*buf != '|') {
+ buf++;
+ if (!isnum(*buf)) continue;
+ w[nw++] = atoi(buf);
+ while (isnum(*buf)) buf++;
+ }
+ while (*buf != '\n') {
+ buf++;
+ if (!isnum(*buf)) continue;
+ r[nr++] = atoi(buf);
+ while (isnum(*buf)) buf++;
+ }
+ for (x = 0, i = 0; i < nr; i++) {
+ for (j = 0; j < nw; j++) {
+ if (r[i] == w[j]) {
+ x++;
+ break;
+ }
+ }
+ }
+ sum += 1 << (x-1);
+ }
+
+ printf("%d\n", sum);
+ return 0;
+}
diff --git a/2023/04/4b.c b/2023/04/4b.c
@@ -0,0 +1,45 @@
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define N 1000
+
+bool isnum(char c) { return c >= '0' && c <= '9'; }
+
+int main() {
+ char *buf, line[N];
+ int c, i, j, x, sum, nw, nr, w[100], r[100], sc[N];
+
+ sum = c = 0;
+ memset(sc, 0, N * sizeof(int));
+ while ((buf = fgets(line, N, stdin)) != NULL) {
+ nr = nw = 0;
+ sc[++c]++;
+ while (*buf != ':') buf++;
+ while (*buf != '|') {
+ buf++;
+ if (!isnum(*buf)) continue;
+ w[nw++] = atoi(buf);
+ while (isnum(*buf)) buf++;
+ }
+ while (*buf != '\n') {
+ buf++;
+ if (!isnum(*buf)) continue;
+ r[nr++] = atoi(buf);
+ while (isnum(*buf)) buf++;
+ }
+ for (x = 0, i = 0; i < nr; i++) {
+ for (j = 0; j < nw; j++) {
+ if (r[i] == w[j]) {
+ sc[(++x) + c] += sc[c];
+ break;
+ }
+ }
+ }
+ sum += sc[c];
+ }
+
+ printf("%d\n", sum);
+ return 0;
+}
diff --git a/2023/04/in.txt b/2023/04/in.txt
@@ -0,0 +1,212 @@
+Card 1: 69 12 75 19 83 56 73 53 52 91 | 83 63 56 30 77 94 12 81 42 69 52 70 6 97 20 43 61 22 75 19 73 32 74 53 91
+Card 2: 23 55 24 84 90 10 87 73 74 45 | 20 66 51 78 9 76 86 96 72 70 84 35 74 90 56 55 23 38 58 45 87 2 80 8 10
+Card 3: 70 32 38 23 86 54 26 16 9 1 | 67 50 39 70 59 77 63 30 3 45 23 16 72 1 86 7 9 32 26 68 38 54 65 34 64
+Card 4: 33 50 19 63 92 1 58 34 84 8 | 35 61 49 86 40 20 22 71 84 51 64 62 33 85 45 3 54 83 1 29 82 19 92 8 11
+Card 5: 74 9 54 83 22 15 81 64 47 70 | 21 74 59 85 17 36 5 79 87 7 13 23 47 45 96 29 68 65 3 22 4 34 46 90 40
+Card 6: 29 55 56 13 58 71 36 30 15 11 | 99 17 90 29 22 68 61 55 11 13 37 94 30 60 56 92 44 71 42 31 8 26 14 51 35
+Card 7: 92 70 97 62 33 45 85 59 82 73 | 92 35 11 49 88 14 85 42 40 41 69 51 82 73 5 87 60 62 33 97 70 16 59 13 45
+Card 8: 5 22 64 46 32 90 57 83 37 38 | 87 47 91 35 39 64 73 83 71 22 10 45 1 76 37 13 20 66 67 21 86 92 38 12 52
+Card 9: 7 49 62 79 37 91 3 58 74 19 | 17 7 58 2 53 95 52 62 83 41 42 36 4 94 64 97 20 32 3 73 81 22 57 37 9
+Card 10: 84 33 81 45 99 96 76 97 40 2 | 81 26 11 34 83 25 45 76 2 85 33 64 57 99 93 75 96 8 84 44 79 87 97 40 70
+Card 11: 37 41 20 56 16 42 43 11 55 4 | 4 16 71 31 45 53 73 55 6 83 69 2 94 18 58 88 20 41 46 56 11 19 37 43 22
+Card 12: 9 81 46 38 55 60 39 43 42 93 | 94 39 38 21 60 97 24 33 34 59 82 55 43 12 88 81 46 9 83 93 22 30 41 98 42
+Card 13: 15 89 14 33 57 55 75 53 80 34 | 59 53 36 57 11 80 75 2 73 15 56 89 33 97 48 77 74 41 14 28 31 35 95 55 34
+Card 14: 85 50 16 90 98 55 13 71 20 9 | 16 44 4 98 45 50 77 64 55 5 78 90 54 95 48 12 8 28 94 83 9 27 88 85 13
+Card 15: 41 85 80 55 27 32 26 68 57 77 | 78 39 9 22 31 86 48 18 16 98 15 51 44 21 28 54 87 82 13 36 47 12 55 75 30
+Card 16: 30 86 48 11 24 68 95 82 44 45 | 68 91 65 86 42 44 82 56 58 18 77 20 95 54 21 90 22 14 24 33 6 63 40 36 28
+Card 17: 81 84 89 44 27 49 36 8 70 22 | 75 47 8 2 36 10 34 44 71 48 31 82 70 42 92 93 81 72 94 22 51 91 73 67 78
+Card 18: 95 62 99 37 38 52 88 92 79 54 | 65 87 72 84 10 1 24 94 59 16 15 64 49 92 78 17 28 69 55 67 6 91 96 58 60
+Card 19: 89 92 19 42 96 33 44 1 76 36 | 77 11 55 81 43 20 90 14 54 52 34 10 4 74 12 99 83 17 51 5 21 56 91 37 61
+Card 20: 7 4 51 9 16 56 3 81 85 21 | 31 78 15 17 35 55 83 33 48 12 60 77 92 65 30 72 43 39 64 62 63 1 14 58 5
+Card 21: 95 47 9 72 82 48 84 37 23 65 | 89 61 26 7 99 77 11 50 71 12 55 54 31 49 81 32 33 74 52 97 79 3 91 76 37
+Card 22: 58 37 93 89 50 61 52 95 36 3 | 66 71 42 29 82 73 9 72 54 19 46 24 23 59 64 5 41 48 55 53 25 62 74 34 78
+Card 23: 92 82 9 63 64 65 48 93 19 7 | 35 24 41 95 87 67 10 91 57 40 80 17 47 98 77 79 25 1 32 53 11 3 14 42 73
+Card 24: 62 60 83 65 7 43 18 53 91 4 | 20 34 93 41 36 25 44 97 30 5 32 42 75 71 84 23 76 89 33 26 65 52 78 81 70
+Card 25: 90 68 7 51 3 89 62 67 18 23 | 74 6 13 70 15 80 59 32 35 42 44 50 49 73 63 4 82 27 68 31 92 29 98 11 85
+Card 26: 22 28 52 16 49 54 55 51 89 20 | 99 51 82 24 18 65 55 72 85 36 86 95 71 61 77 38 12 4 96 89 7 97 40 66 91
+Card 27: 64 40 71 56 94 62 60 72 22 55 | 3 27 22 64 74 31 55 70 78 40 94 13 42 93 9 28 45 98 57 33 1 16 21 92 24
+Card 28: 59 21 57 48 64 98 34 84 95 52 | 14 65 50 8 74 29 62 64 59 60 88 23 7 36 12 52 34 58 97 35 70 86 79 73 31
+Card 29: 81 89 72 63 67 2 97 19 58 70 | 25 72 10 81 70 58 1 37 62 67 96 21 35 26 20 97 14 39 74 29 12 57 18 91 42
+Card 30: 74 61 1 98 5 68 20 47 81 78 | 76 47 32 58 16 19 41 17 18 82 70 68 27 7 55 1 24 11 59 94 30 90 85 26 53
+Card 31: 37 24 52 75 26 62 71 8 59 92 | 39 58 75 3 9 86 84 91 88 42 14 83 18 52 50 37 63 24 5 71 23 62 94 61 92
+Card 32: 66 87 81 58 95 41 47 76 20 12 | 83 96 14 38 27 35 68 13 91 84 48 99 29 23 52 31 9 17 79 89 3 51 81 6 56
+Card 33: 78 15 62 95 50 63 29 61 12 25 | 86 2 50 27 46 48 74 55 36 81 54 42 47 18 98 91 4 76 33 21 49 26 56 35 68
+Card 34: 15 2 1 97 6 42 96 67 17 86 | 28 45 73 8 56 52 53 97 5 35 86 3 54 4 32 88 23 60 1 47 95 74 10 49 39
+Card 35: 89 99 6 27 26 8 68 57 36 97 | 12 36 35 28 38 86 8 89 46 52 4 39 93 63 20 91 50 11 27 83 74 92 67 79 18
+Card 36: 49 27 7 26 25 78 74 32 59 55 | 83 15 44 67 85 28 41 42 58 3 16 51 34 37 66 5 9 82 73 96 27 65 33 29 92
+Card 37: 68 79 22 61 9 78 29 17 1 83 | 76 94 25 60 90 1 49 88 11 72 37 45 93 97 53 77 27 63 31 74 46 95 40 26 12
+Card 38: 44 96 29 49 85 92 98 40 83 80 | 11 58 2 79 32 48 56 4 24 76 66 94 1 17 47 63 38 9 75 82 99 53 91 33 88
+Card 39: 53 13 83 11 12 39 30 77 37 87 | 51 62 47 76 93 34 98 45 6 95 89 41 21 40 88 19 26 43 99 14 67 29 73 59 42
+Card 40: 23 63 92 24 4 35 93 36 73 88 | 74 42 70 10 4 50 88 92 73 41 76 45 11 36 23 35 24 78 18 59 8 63 72 83 93
+Card 41: 12 94 49 20 27 52 98 66 99 92 | 20 11 63 14 77 39 38 12 49 94 92 36 55 93 74 30 96 95 66 51 99 27 86 52 90
+Card 42: 30 27 40 59 75 19 90 81 61 31 | 95 81 45 27 59 19 38 18 30 91 85 89 75 82 4 77 34 61 46 98 40 31 86 90 21
+Card 43: 80 31 91 49 76 14 72 62 26 51 | 13 4 52 90 31 11 76 34 58 91 49 80 29 55 14 98 22 51 72 83 26 57 92 62 85
+Card 44: 24 43 54 74 83 21 57 8 19 84 | 57 19 88 15 24 31 74 12 43 95 83 21 10 67 54 76 8 59 52 9 71 92 25 84 55
+Card 45: 80 50 79 31 57 43 19 36 61 14 | 94 76 21 26 67 80 72 39 14 82 34 85 18 43 10 65 20 64 23 47 89 69 55 17 98
+Card 46: 52 26 71 96 24 93 64 38 80 29 | 52 36 72 62 64 81 86 16 63 29 15 8 23 46 38 31 33 73 88 93 24 74 21 96 26
+Card 47: 31 96 28 34 83 59 91 19 40 62 | 21 28 97 6 96 54 66 33 19 93 74 91 25 80 67 31 34 17 27 37 60 62 92 4 98
+Card 48: 51 27 11 76 40 10 80 12 9 37 | 78 4 35 30 14 29 96 51 20 56 18 22 93 76 94 46 74 26 75 28 3 59 39 9 31
+Card 49: 41 77 24 13 3 6 14 1 51 9 | 14 93 10 17 61 40 73 6 41 95 13 62 71 98 56 29 75 24 51 26 88 7 85 84 94
+Card 50: 59 38 20 44 13 84 74 98 31 15 | 40 10 8 25 20 3 38 80 32 77 26 29 61 31 1 35 98 9 63 62 84 4 88 39 73
+Card 51: 24 63 74 81 52 1 65 22 13 85 | 95 58 64 76 73 90 72 28 91 26 39 27 83 37 77 70 79 55 78 43 42 69 11 88 86
+Card 52: 42 46 68 26 43 2 38 23 81 67 | 71 88 3 29 63 14 81 64 9 12 13 76 32 62 53 90 99 37 80 61 87 50 75 79 17
+Card 53: 1 26 8 25 54 65 53 56 99 73 | 42 46 51 32 9 55 63 91 66 69 33 34 79 11 67 27 92 21 83 77 35 38 98 74 59
+Card 54: 75 47 66 55 72 60 38 53 62 21 | 71 40 89 51 75 31 93 45 53 13 92 11 98 68 44 87 74 61 8 39 30 63 1 7 76
+Card 55: 54 71 4 44 61 59 64 50 73 47 | 20 7 31 66 69 37 30 42 86 43 83 34 70 78 56 15 3 50 41 67 88 17 46 81 96
+Card 56: 90 32 94 66 80 55 96 47 11 51 | 46 69 89 30 50 65 16 83 17 44 88 70 12 91 74 67 86 63 15 29 26 60 57 14 23
+Card 57: 87 98 51 22 7 28 33 12 17 70 | 4 47 38 40 95 74 97 58 53 43 21 54 35 27 46 85 16 10 14 94 3 36 66 86 5
+Card 58: 88 63 18 90 57 37 62 58 72 28 | 74 5 7 24 73 85 3 77 22 19 32 44 25 69 93 86 98 46 56 26 34 50 79 23 55
+Card 59: 40 77 65 18 14 43 94 95 45 10 | 39 28 14 2 95 70 44 45 34 83 18 65 94 74 40 33 73 78 87 72 64 77 10 43 50
+Card 60: 34 55 62 11 10 76 53 25 7 35 | 88 79 26 19 38 90 78 53 46 52 17 15 83 56 69 75 99 62 10 35 6 36 7 45 28
+Card 61: 36 39 79 7 83 22 10 74 86 85 | 74 72 51 10 55 84 22 36 54 71 39 34 83 57 75 60 86 94 53 85 37 97 9 65 42
+Card 62: 91 20 88 6 48 82 11 10 95 40 | 6 88 60 44 89 18 81 68 58 71 76 20 85 40 11 59 10 92 82 66 91 54 48 95 30
+Card 63: 44 80 81 49 32 24 40 41 77 94 | 56 54 99 69 58 10 49 74 11 21 68 16 87 98 1 84 83 81 78 41 76 60 63 13 22
+Card 64: 81 32 24 86 14 28 10 21 92 70 | 74 87 58 24 96 12 92 14 33 68 76 99 85 70 69 19 13 3 94 21 48 97 32 1 20
+Card 65: 18 20 67 41 90 98 61 52 11 42 | 89 90 34 87 57 88 6 62 96 13 28 11 61 40 77 67 2 66 81 36 42 18 91 52 56
+Card 66: 26 28 58 35 42 73 29 23 77 95 | 84 98 34 95 15 63 36 92 48 28 35 83 39 93 16 6 23 81 59 42 52 62 57 22 70
+Card 67: 22 63 17 14 53 95 13 20 40 16 | 60 31 90 27 49 86 32 95 87 65 74 98 43 33 67 28 61 63 17 82 9 50 21 75 85
+Card 68: 93 69 87 27 83 7 73 81 88 14 | 81 97 83 73 87 1 10 55 88 41 14 26 56 63 44 71 27 7 64 69 37 11 42 93 61
+Card 69: 15 42 34 80 13 97 21 26 20 65 | 16 28 38 12 43 56 11 4 79 39 93 40 8 34 23 19 53 67 29 77 68 27 30 94 46
+Card 70: 18 7 31 15 28 1 78 41 58 48 | 42 56 25 1 92 97 84 63 26 95 12 50 53 48 14 78 13 28 22 37 71 77 91 41 38
+Card 71: 5 70 37 60 66 16 81 11 47 43 | 38 1 83 8 75 23 70 60 11 39 4 81 74 14 79 53 51 13 32 78 58 66 24 80 92
+Card 72: 40 51 21 14 88 48 31 20 39 76 | 5 19 68 18 92 35 77 32 86 84 37 42 28 13 78 71 75 98 87 29 94 16 30 67 89
+Card 73: 47 29 76 34 14 96 15 43 69 74 | 83 61 59 89 11 60 98 28 22 6 66 53 71 13 68 67 58 56 46 96 76 50 20 33 97
+Card 74: 96 21 62 93 84 51 60 98 28 35 | 21 8 57 98 63 93 78 12 56 43 24 33 11 26 54 4 3 47 17 96 66 64 81 85 16
+Card 75: 55 16 42 20 26 84 76 39 29 51 | 64 30 44 8 58 22 78 39 40 15 38 54 85 20 57 82 4 67 86 72 37 51 96 16 18
+Card 76: 46 64 22 56 81 45 68 54 14 24 | 36 29 56 79 48 60 46 12 23 24 7 94 93 30 50 43 83 68 62 63 90 70 72 74 39
+Card 77: 27 51 60 83 18 46 10 23 57 44 | 1 9 39 85 30 36 8 46 84 22 69 29 81 50 2 78 73 74 95 34 77 70 5 20 12
+Card 78: 84 85 50 14 34 1 25 10 54 15 | 17 39 78 70 29 33 49 32 55 76 50 93 72 73 12 56 24 61 90 8 69 58 98 86 96
+Card 79: 91 20 66 77 51 88 69 81 79 30 | 90 45 13 85 78 55 86 76 65 34 59 22 37 99 49 94 60 54 46 17 84 28 61 44 74
+Card 80: 4 9 37 77 89 91 29 31 62 57 | 69 6 94 11 58 93 26 3 55 43 53 32 86 20 65 21 68 81 56 15 1 72 27 71 23
+Card 81: 26 19 49 67 15 54 44 27 25 64 | 71 44 75 54 64 48 22 27 30 28 72 77 67 65 15 23 7 19 85 89 42 49 26 25 16
+Card 82: 78 13 96 18 46 74 53 16 73 33 | 37 96 16 58 35 13 83 73 61 4 69 92 65 11 75 53 23 49 12 22 79 33 78 74 98
+Card 83: 93 82 29 5 95 96 57 16 94 67 | 39 29 16 81 94 95 5 77 32 48 67 6 19 2 96 24 53 82 65 57 93 51 44 49 58
+Card 84: 7 48 34 66 4 31 74 99 33 96 | 96 58 25 36 28 24 30 35 42 20 13 97 60 85 1 53 52 26 48 70 14 99 75 8 5
+Card 85: 6 44 69 84 80 37 35 82 90 30 | 84 91 57 69 27 82 16 71 30 53 18 80 13 9 35 6 20 4 44 11 37 73 90 41 12
+Card 86: 4 75 26 24 90 91 69 77 29 60 | 5 72 80 64 4 73 29 13 90 37 3 26 59 77 7 84 60 81 69 46 99 24 35 75 91
+Card 87: 70 57 68 5 86 89 95 31 87 83 | 17 9 47 62 86 53 82 74 46 31 67 64 14 70 98 57 71 95 30 25 28 68 89 84 59
+Card 88: 51 56 93 33 14 71 37 77 2 58 | 2 8 18 63 35 7 99 93 39 73 25 77 58 83 14 51 27 56 33 40 24 37 80 71 72
+Card 89: 86 49 19 13 54 47 56 26 81 52 | 48 40 43 63 35 85 98 86 22 55 26 46 17 19 68 34 56 13 64 27 72 47 49 54 24
+Card 90: 60 81 8 65 64 32 28 87 18 6 | 2 64 62 81 3 28 38 9 96 8 45 40 42 83 65 32 87 6 60 4 50 36 33 68 18
+Card 91: 75 42 51 6 29 41 94 61 55 22 | 68 95 31 64 41 37 22 76 6 81 51 75 67 79 33 70 94 55 58 56 42 61 29 15 13
+Card 92: 34 7 3 23 79 80 98 40 88 48 | 90 88 94 61 31 59 23 47 81 85 86 48 63 35 73 52 79 70 20 1 97 28 51 75 42
+Card 93: 76 61 71 49 23 84 64 10 82 73 | 23 45 76 31 93 10 84 49 68 62 28 72 20 38 82 13 25 81 60 19 9 7 34 21 89
+Card 94: 76 15 19 25 37 72 78 80 62 57 | 13 19 98 73 48 37 92 68 44 93 90 72 21 60 76 80 23 57 25 20 15 78 89 62 51
+Card 95: 20 96 12 88 73 61 75 18 5 17 | 22 1 64 19 3 42 63 80 84 35 43 89 51 94 54 28 32 70 31 56 4 59 79 30 7
+Card 96: 97 67 10 32 57 41 94 26 74 43 | 67 32 18 55 93 61 21 29 69 83 39 92 58 23 41 59 87 30 50 25 10 94 52 71 43
+Card 97: 18 90 8 91 82 70 88 76 32 45 | 58 78 45 86 23 72 85 30 17 27 93 43 25 79 57 11 71 33 44 89 13 46 3 26 48
+Card 98: 99 17 45 67 83 78 76 93 5 52 | 32 23 76 40 96 56 26 9 29 63 1 33 15 75 85 5 82 70 99 30 41 58 16 42 86
+Card 99: 81 50 99 31 96 61 90 8 36 89 | 22 75 6 93 9 11 88 53 47 44 59 64 35 69 29 46 3 15 91 92 30 67 45 26 56
+Card 100: 14 92 52 90 63 31 25 23 47 75 | 92 52 39 94 90 66 36 68 35 63 3 5 75 86 50 30 48 2 34 64 45 17 95 53 93
+Card 101: 17 15 32 41 78 12 24 52 34 20 | 36 55 92 11 62 40 16 53 21 56 78 71 31 42 85 6 45 46 57 69 12 49 65 94 20
+Card 102: 95 72 92 52 48 6 12 90 89 11 | 78 79 33 36 18 60 54 35 48 47 44 29 70 91 59 99 72 22 88 75 83 20 68 15 2
+Card 103: 26 92 77 86 75 71 40 99 18 42 | 70 85 45 30 69 51 62 5 72 35 23 48 12 2 31 6 57 9 43 65 55 34 74 64 82
+Card 104: 58 47 91 85 1 98 77 97 11 59 | 41 60 46 2 62 94 30 17 48 38 65 58 61 45 7 81 14 33 13 66 49 36 35 83 16
+Card 105: 52 94 29 51 24 72 81 38 22 98 | 89 25 2 20 19 87 35 31 27 63 58 93 79 74 42 73 6 70 45 56 68 10 23 71 4
+Card 106: 53 31 52 12 77 13 57 75 83 33 | 32 21 47 79 18 85 20 31 1 81 17 57 99 36 11 68 29 15 83 38 72 13 10 44 45
+Card 107: 10 29 45 39 88 11 84 46 33 50 | 33 49 53 88 29 25 93 69 3 58 7 39 10 44 46 71 11 87 50 65 81 84 4 45 98
+Card 108: 36 89 17 61 91 20 40 8 82 47 | 45 3 43 62 8 57 20 30 40 99 61 36 38 82 16 90 17 87 9 89 91 47 66 86 68
+Card 109: 8 13 16 10 53 17 67 40 36 84 | 8 19 31 95 42 34 1 83 91 94 12 18 14 65 11 74 63 81 54 22 41 33 97 4 15
+Card 110: 55 85 53 30 52 59 96 36 33 21 | 30 96 65 49 85 9 55 78 90 37 68 59 48 51 21 14 50 67 10 52 33 36 70 57 53
+Card 111: 40 29 81 28 52 78 5 33 87 77 | 45 50 80 64 55 81 77 54 92 29 93 3 21 84 78 65 40 34 98 43 13 5 94 33 18
+Card 112: 91 31 32 89 65 14 81 46 80 17 | 51 89 58 46 80 29 50 14 91 66 57 98 31 82 39 17 99 81 13 55 43 32 77 18 65
+Card 113: 64 3 12 40 34 93 80 96 45 88 | 36 64 17 44 61 80 34 12 28 42 98 77 66 40 45 96 19 93 3 48 10 25 88 22 30
+Card 114: 36 43 48 47 24 7 71 13 72 75 | 48 60 50 52 64 85 45 68 8 55 62 91 71 97 98 24 70 20 43 80 76 7 18 96 1
+Card 115: 64 82 48 63 66 62 79 40 51 17 | 28 52 96 36 84 33 68 92 98 18 37 26 21 16 82 4 43 6 9 79 30 75 42 77 91
+Card 116: 84 70 36 38 87 33 64 45 8 91 | 94 74 91 84 60 36 10 33 45 55 37 62 90 31 19 44 25 8 78 38 87 18 64 70 20
+Card 117: 10 92 76 54 73 71 68 49 53 27 | 60 92 53 82 6 49 67 27 5 61 4 90 68 73 10 75 76 54 17 71 95 50 37 87 84
+Card 118: 10 68 81 55 1 91 64 75 92 39 | 76 94 8 44 86 7 78 15 41 25 4 51 66 53 36 14 59 69 74 5 88 33 45 83 17
+Card 119: 35 23 45 13 9 14 94 6 12 41 | 6 16 52 24 84 17 92 79 14 38 11 32 54 83 63 43 74 64 45 94 68 67 66 78 10
+Card 120: 68 33 17 3 24 21 79 44 84 6 | 85 10 6 5 52 32 45 46 8 24 86 2 29 27 12 11 40 69 64 21 13 68 33 93 63
+Card 121: 77 42 71 14 17 27 4 75 45 8 | 80 77 32 94 3 25 64 63 72 49 42 38 35 36 93 26 67 89 17 66 12 92 96 65 90
+Card 122: 94 91 9 21 25 86 37 13 93 96 | 41 14 54 30 68 50 12 6 76 91 8 95 3 53 5 2 98 56 90 38 21 39 20 45 16
+Card 123: 49 59 88 74 16 29 83 17 60 47 | 92 9 95 48 86 89 56 7 83 16 97 78 23 65 62 30 28 29 17 6 59 96 37 88 49
+Card 124: 68 64 89 27 10 36 12 38 87 46 | 35 12 29 70 80 69 18 38 31 97 53 33 56 66 36 73 58 60 44 61 94 63 2 22 17
+Card 125: 77 92 88 57 3 61 54 44 15 22 | 30 37 2 15 24 49 19 86 62 70 60 88 79 11 1 98 71 55 14 48 51 35 23 16 96
+Card 126: 76 29 81 69 87 79 10 49 62 31 | 95 22 29 33 69 91 46 40 78 92 34 52 65 98 99 28 2 35 73 86 4 94 31 25 88
+Card 127: 1 99 64 88 36 28 92 32 63 9 | 54 71 17 24 48 47 99 74 64 39 88 35 79 80 84 2 33 20 16 27 59 37 6 97 55
+Card 128: 52 58 71 21 38 88 83 79 39 10 | 31 43 84 97 85 48 50 17 82 22 18 75 24 36 5 23 63 95 94 87 91 8 37 7 54
+Card 129: 10 54 52 8 38 60 47 73 42 33 | 89 74 88 23 66 70 92 16 36 65 78 41 49 99 53 5 57 11 29 98 56 44 97 64 35
+Card 130: 35 26 36 87 14 85 88 54 5 53 | 73 42 64 66 27 59 98 8 68 70 47 67 81 25 40 93 91 6 77 20 99 31 50 43 61
+Card 131: 91 7 42 28 60 68 25 80 57 93 | 29 34 10 71 68 30 7 22 28 91 21 49 23 93 60 20 57 80 78 25 13 42 84 17 43
+Card 132: 36 98 95 88 82 61 75 30 43 54 | 44 64 42 70 77 99 84 80 59 53 37 18 26 56 97 33 31 50 15 41 52 58 63 93 65
+Card 133: 83 91 98 86 39 72 13 19 42 73 | 26 42 36 4 8 84 38 12 95 48 55 37 91 25 81 32 50 14 21 33 77 92 59 2 97
+Card 134: 1 13 47 70 17 85 19 63 38 92 | 59 99 23 55 72 92 44 40 53 68 88 14 69 65 35 32 28 79 75 74 34 27 87 77 47
+Card 135: 22 93 70 76 73 17 69 24 74 61 | 5 29 39 92 65 69 79 57 66 23 46 22 77 7 93 73 24 38 95 6 97 43 76 42 31
+Card 136: 23 4 75 77 41 61 88 73 50 82 | 59 73 86 29 27 58 82 2 69 84 4 34 49 12 6 80 46 19 7 92 72 88 38 39 63
+Card 137: 48 73 51 4 52 69 74 67 65 81 | 76 28 5 72 91 18 27 83 47 67 21 11 34 62 14 90 13 49 85 74 66 58 65 4 78
+Card 138: 55 32 80 57 86 78 54 90 97 41 | 30 14 80 39 32 55 54 11 82 87 68 2 99 3 47 78 40 69 5 77 53 50 56 86 74
+Card 139: 29 52 70 64 28 93 18 55 36 88 | 88 49 38 44 56 59 25 16 20 36 75 14 62 84 6 71 86 63 91 10 57 67 98 85 52
+Card 140: 65 34 63 69 67 18 50 40 49 82 | 40 21 18 65 87 49 15 32 3 82 95 41 4 42 29 93 88 57 56 62 12 68 2 27 67
+Card 141: 8 82 31 30 9 54 80 98 17 42 | 26 8 5 36 70 86 66 59 50 13 15 9 68 3 39 77 92 2 96 61 48 84 83 82 32
+Card 142: 72 5 32 33 45 44 21 3 2 27 | 22 24 30 55 9 81 56 72 97 76 92 10 19 98 63 57 88 7 18 32 5 61 29 49 12
+Card 143: 58 47 61 98 96 94 85 76 73 52 | 44 70 20 86 62 68 22 78 28 32 73 12 72 88 69 59 24 56 60 6 35 49 91 58 83
+Card 144: 17 14 55 39 13 61 42 84 57 52 | 69 43 76 8 83 92 38 36 91 2 24 74 10 9 7 45 79 23 89 34 28 31 40 18 37
+Card 145: 55 36 9 53 67 98 95 11 45 1 | 37 27 61 31 70 54 19 34 81 89 76 17 25 66 4 56 49 13 35 32 96 5 26 2 68
+Card 146: 91 9 31 61 30 48 11 81 37 42 | 60 99 4 49 50 5 90 32 6 58 18 63 45 25 82 74 96 35 43 69 14 62 46 15 41
+Card 147: 86 99 81 30 94 65 52 77 17 26 | 40 17 34 85 77 86 65 7 93 33 4 42 48 75 94 81 99 52 56 26 15 23 35 60 30
+Card 148: 96 30 61 70 40 69 55 19 13 11 | 94 7 48 88 43 69 62 29 38 30 31 56 50 58 81 52 46 55 97 3 40 1 33 18 23
+Card 149: 45 36 22 56 75 66 27 73 9 71 | 38 11 75 36 64 69 14 77 84 40 15 73 76 35 19 86 93 95 32 8 78 9 66 49 48
+Card 150: 81 99 76 52 43 11 72 20 8 24 | 9 49 45 72 81 25 55 76 77 99 95 12 8 24 74 20 11 16 52 43 51 21 46 14 13
+Card 151: 85 27 15 60 95 55 48 2 94 3 | 45 73 81 78 57 79 3 27 92 71 94 56 83 60 74 1 15 43 42 23 85 2 95 58 84
+Card 152: 70 52 7 99 4 8 85 74 56 12 | 44 79 62 12 4 99 74 2 85 52 9 70 58 55 54 56 95 8 13 64 7 75 63 22 82
+Card 153: 31 8 18 89 88 79 35 59 76 41 | 47 71 86 22 60 76 42 34 35 3 52 68 92 58 91 89 33 8 88 59 1 18 31 41 79
+Card 154: 68 9 55 95 61 25 59 32 40 58 | 12 29 2 34 23 94 72 78 66 48 64 5 52 96 20 91 57 92 85 37 87 75 73 90 43
+Card 155: 33 70 62 54 30 96 26 3 95 86 | 59 28 6 57 49 78 27 90 13 10 58 82 17 50 73 38 15 74 25 91 60 32 96 55 80
+Card 156: 80 8 47 81 20 82 38 54 30 22 | 51 97 20 38 49 45 22 17 39 64 35 54 81 80 28 90 68 30 47 86 41 53 42 34 8
+Card 157: 11 62 36 43 32 20 96 27 21 4 | 69 25 22 37 83 29 62 20 78 13 46 51 9 98 60 21 96 53 43 3 33 63 84 32 77
+Card 158: 75 49 89 67 22 1 92 73 60 41 | 62 49 7 96 60 22 75 13 1 21 29 64 41 71 83 58 12 34 57 52 19 76 67 40 3
+Card 159: 67 64 27 71 93 18 11 49 56 76 | 14 82 35 60 67 64 27 50 72 85 24 49 47 68 40 87 84 78 93 16 36 73 51 70 91
+Card 160: 74 20 49 81 99 35 53 68 50 88 | 32 76 60 21 93 45 11 44 9 23 34 30 57 51 18 88 14 81 75 99 52 19 73 72 12
+Card 161: 31 6 20 34 1 25 35 86 54 83 | 10 16 63 35 6 92 14 90 94 83 71 46 85 54 49 21 37 76 58 75 84 22 86 57 43
+Card 162: 71 2 91 45 18 67 32 35 70 4 | 80 33 18 86 13 25 41 28 1 74 5 51 63 27 7 77 43 40 66 60 30 52 55 45 96
+Card 163: 56 80 7 96 74 20 25 91 42 15 | 13 7 87 92 8 85 17 20 60 62 27 50 51 58 59 21 74 99 12 18 32 64 6 71 75
+Card 164: 4 62 31 56 10 21 45 51 59 28 | 21 74 82 81 59 55 37 88 56 11 22 63 31 99 86 26 5 16 57 83 24 97 1 42 60
+Card 165: 94 10 52 85 46 27 60 31 82 72 | 36 85 26 9 51 41 49 87 66 70 76 32 16 46 62 88 27 44 84 34 78 4 65 81 10
+Card 166: 8 14 12 94 28 37 96 13 36 70 | 67 69 85 45 29 71 7 26 97 91 11 48 65 22 12 81 60 34 77 25 80 10 38 24 8
+Card 167: 16 2 11 60 29 32 85 84 18 37 | 72 73 99 87 80 49 68 2 25 19 44 51 45 78 24 10 82 92 28 50 36 58 5 11 33
+Card 168: 88 20 78 53 45 93 64 86 62 7 | 55 16 24 32 82 9 1 91 81 34 94 61 89 76 40 58 88 2 23 25 49 44 83 42 21
+Card 169: 30 43 68 19 84 46 34 79 83 40 | 75 12 72 24 86 81 2 96 41 69 8 7 98 20 16 38 77 44 32 17 73 51 35 76 27
+Card 170: 36 65 99 63 11 80 98 57 2 75 | 63 44 48 60 89 80 16 30 82 85 69 5 98 36 47 43 37 78 75 7 2 79 40 55 90
+Card 171: 41 22 51 44 98 50 68 64 39 18 | 29 39 55 97 42 28 81 76 98 49 93 51 20 2 18 44 50 90 22 64 45 41 94 68 60
+Card 172: 45 51 90 61 87 12 43 42 26 30 | 30 22 90 14 5 8 42 43 61 87 50 29 34 26 53 93 95 1 51 58 91 45 18 12 78
+Card 173: 95 73 34 88 4 83 91 10 1 20 | 45 30 58 70 65 47 74 99 25 32 6 3 94 97 76 11 50 21 36 18 38 7 55 60 95
+Card 174: 12 23 97 6 85 48 73 1 78 46 | 78 39 29 27 6 73 46 22 75 95 42 12 23 93 89 85 20 1 97 72 48 58 24 70 91
+Card 175: 88 37 59 56 86 58 64 51 35 47 | 93 82 64 79 88 28 51 13 23 59 71 47 37 83 70 25 35 86 58 56 61 67 78 62 50
+Card 176: 86 97 60 68 91 83 55 56 75 16 | 68 10 99 70 61 43 50 6 59 75 4 97 34 91 44 71 67 93 69 38 73 48 33 17 83
+Card 177: 41 33 14 32 99 37 64 21 36 56 | 41 14 24 64 74 43 99 36 33 89 17 71 49 21 37 57 32 85 72 47 8 20 5 28 56
+Card 178: 99 62 41 81 76 89 17 83 43 40 | 44 38 51 82 98 49 65 85 20 17 72 5 28 96 97 46 10 4 34 7 55 15 47 29 36
+Card 179: 67 25 97 77 59 39 10 51 95 48 | 98 93 29 51 97 84 95 50 67 59 10 39 44 20 48 60 25 96 12 89 21 77 52 76 47
+Card 180: 12 42 91 75 77 56 92 58 51 99 | 38 66 35 19 51 90 73 3 49 81 92 10 77 48 83 58 78 99 54 72 29 47 69 34 56
+Card 181: 15 26 91 99 68 10 89 79 80 98 | 33 78 6 84 91 99 42 66 26 15 89 39 80 29 98 10 53 17 56 31 59 35 51 79 68
+Card 182: 75 8 59 52 93 56 14 29 18 84 | 68 14 10 56 1 78 11 84 69 36 13 93 21 8 65 31 44 18 50 53 2 4 38 88 75
+Card 183: 75 72 67 62 88 12 44 69 3 64 | 62 14 70 41 95 11 5 15 67 35 79 46 49 93 64 2 18 34 21 94 44 6 76 10 72
+Card 184: 86 33 8 63 89 57 81 61 21 1 | 49 80 47 26 39 40 67 25 90 64 24 91 37 95 28 5 15 50 66 73 19 33 9 97 54
+Card 185: 61 96 4 67 63 22 49 26 6 45 | 1 48 72 52 91 5 77 6 26 57 33 75 71 21 22 73 66 74 54 11 65 19 37 67 4
+Card 186: 19 10 50 72 54 85 38 31 28 15 | 64 20 30 78 74 31 83 46 43 12 28 36 84 11 66 96 75 7 76 93 2 18 42 38 86
+Card 187: 37 68 16 30 95 54 73 20 43 32 | 7 8 62 54 26 33 24 43 57 99 31 23 36 3 15 45 55 75 37 95 29 27 5 46 67
+Card 188: 33 20 43 74 98 62 11 84 97 69 | 69 92 30 64 72 2 20 46 31 88 43 50 79 1 53 9 17 81 57 65 67 28 74 90 34
+Card 189: 61 87 63 36 35 72 26 28 7 81 | 6 66 52 40 56 80 92 58 13 10 69 93 98 99 60 88 39 49 9 42 15 33 68 3 23
+Card 190: 78 91 72 67 59 99 42 32 1 60 | 47 85 79 17 22 28 68 18 21 45 87 92 9 7 46 4 34 70 29 40 69 74 62 71 5
+Card 191: 16 48 31 54 96 68 61 8 17 66 | 46 66 88 70 4 77 99 22 15 59 74 2 3 1 64 26 83 10 78 23 82 29 63 65 92
+Card 192: 67 82 32 99 43 58 18 51 57 53 | 7 33 49 21 75 62 23 63 87 20 54 88 3 35 97 17 89 96 91 80 10 22 95 1 48
+Card 193: 26 51 55 42 14 31 58 68 8 99 | 19 90 31 26 8 51 16 99 68 79 64 58 3 39 71 83 27 25 15 45 72 59 55 14 95
+Card 194: 80 66 34 35 6 61 70 16 17 89 | 69 40 76 34 56 72 97 48 59 74 18 62 22 28 4 67 75 35 29 24 31 53 58 11 16
+Card 195: 95 17 24 31 47 66 68 97 94 73 | 19 62 61 53 48 24 78 60 26 71 59 95 79 47 18 64 44 1 83 8 2 34 21 69 81
+Card 196: 46 48 79 80 21 12 6 74 75 36 | 5 26 16 89 2 8 92 3 61 30 42 99 12 41 4 35 10 40 84 53 82 22 73 19 20
+Card 197: 7 77 19 60 25 30 6 1 35 27 | 49 79 83 32 6 38 77 5 10 48 25 78 19 4 51 12 1 7 68 23 56 60 11 57 27
+Card 198: 49 36 93 56 47 94 23 10 45 12 | 55 49 93 12 56 62 77 30 51 94 36 7 39 5 58 18 26 81 23 47 91 1 45 10 84
+Card 199: 34 24 33 74 17 76 57 77 44 56 | 80 78 15 5 22 44 33 13 92 35 3 10 34 7 30 12 16 75 76 31 99 11 61 50 45
+Card 200: 5 39 53 88 71 70 89 92 64 13 | 1 68 12 39 88 57 92 61 23 40 45 30 5 53 71 3 96 67 54 14 89 70 97 64 51
+Card 201: 7 67 93 60 6 36 71 31 81 89 | 38 46 14 11 68 41 4 37 63 60 71 78 97 29 66 57 49 27 39 76 6 7 36 59 99
+Card 202: 94 24 81 14 27 51 34 97 6 23 | 31 10 81 59 51 42 94 2 23 20 43 14 96 68 97 49 24 33 34 87 38 60 82 66 27
+Card 203: 37 24 75 91 72 29 33 28 94 84 | 72 7 94 73 36 11 41 48 96 1 37 25 28 8 29 34 18 87 76 66 33 98 59 24 35
+Card 204: 53 42 58 63 3 49 77 25 36 66 | 62 46 7 2 42 36 63 86 1 15 3 30 8 77 9 5 70 73 97 93 55 6 28 39 91
+Card 205: 2 21 51 89 80 42 10 83 36 33 | 12 97 24 23 30 69 39 77 20 32 31 47 8 28 42 34 50 21 10 76 91 45 98 29 73
+Card 206: 23 81 70 32 76 55 85 60 83 42 | 6 25 29 21 20 45 66 36 10 52 91 46 59 64 53 14 63 98 35 30 82 93 65 87 58
+Card 207: 67 88 35 9 86 83 66 72 85 1 | 78 94 65 31 95 41 43 71 9 80 24 51 11 8 16 61 50 64 75 66 30 39 37 15 86
+Card 208: 41 54 96 97 65 57 84 28 67 77 | 83 41 80 98 73 86 55 4 64 48 57 35 28 59 54 79 58 10 40 19 2 81 72 3 30
+Card 209: 74 3 40 51 39 68 60 85 63 11 | 75 14 83 78 28 58 86 25 45 43 79 71 23 94 76 89 84 15 32 87 72 21 26 65 50
+Card 210: 10 13 69 85 17 52 50 98 95 41 | 90 74 94 71 10 84 67 1 32 31 87 64 62 27 34 75 80 3 60 58 82 20 28 17 92
+Card 211: 61 30 95 15 73 81 69 52 26 3 | 59 8 35 56 83 5 41 71 45 4 91 73 51 93 90 89 72 28 98 9 2 18 40 47 16
+Card 212: 98 19 95 93 62 76 36 70 1 55 | 5 22 21 58 75 85 31 67 49 73 47 90 34 24 99 37 50 11 23 48 96 87 6 29 91
diff --git a/2023/05/5a.c b/2023/05/5a.c
@@ -0,0 +1,45 @@
+#include <inttypes.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define N 100
+
+bool isnum(char c) { return c >= '0' && c <= '9'; }
+
+int main() {
+ char *buf, line[N];
+ int64_t i, m, ns, seed[N], next[N], r[3];
+
+ for (ns = 0, buf = fgets(line, N, stdin); *buf; buf++) {
+ if (!isnum(*buf)) continue;
+ next[ns++] = atoll(buf);
+ while (isnum(*buf)) buf++;
+ }
+
+
+ while ((buf = fgets(line, N, stdin)) != NULL) {
+ if (!isnum(*buf)) {
+ memcpy(seed, next, ns * sizeof(int64_t));
+ fgets(line, N, stdin); /* Discard description */
+ continue;
+ }
+
+ for (i = 0; *buf; buf++) {
+ r[i++] = atoll(buf);
+ while (isnum(*buf)) buf++;
+ }
+
+ for (i = 0; i < ns; i++)
+ if (seed[i] >= r[1] && seed[i] < r[1] + r[2])
+ next[i] = seed[i] + (r[0] - r[1]);
+ }
+
+ m = next[0];
+ for (i = 1; i < ns; i++)
+ m = m > next[i] ? next[i] : m;
+
+ printf("%" PRId64 "\n", m);
+ return 0;
+}
diff --git a/2023/05/5b.c b/2023/05/5b.c
@@ -0,0 +1,71 @@
+/* For part 2 we save ranges as (first, last) instead of (first, length) */
+
+#include <inttypes.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define N 10000
+
+#define MIN(a, b) ((a)<(b)?(a):(b))
+#define MAX(a, b) ((a)>(b)?(a):(b))
+
+bool isnum(char c) { return c >= '0' && c <= '9'; }
+
+void append(int64_t dst[][2], int64_t src[][2], int64_t *nr, int64_t *nnr) {
+ for (int i = 0; i < *nnr; i++) {
+ dst[i+*nr][0] = src[i][0];
+ dst[i+*nr][1] = src[i][1];
+ }
+ *nr += *nnr;
+ *nnr = 0;
+}
+
+int64_t readl(int64_t nums[], char *buf) {
+ int64_t i;
+ for (i = 0; *buf; buf++) {
+ if (!isnum(*buf)) continue;
+ nums[i++] = atoll(buf);
+ while (isnum(*buf)) buf++;
+ }
+ return i;
+}
+
+int main() {
+ char *buf, line[N];
+ int64_t i, li, ri, m, nr, nnr, r[3], range[N][2], next[N][2], aux[N];
+
+ nnr = readl(aux, fgets(line, N, stdin)) / 2;
+ for (i = 0; i < nnr; i++) {
+ next[i][0] = aux[2*i];
+ next[i][1] = aux[2*i+1] + next[i][0] - 1;
+ }
+
+ for (nr = 0; (buf = fgets(line, N, stdin)) != NULL; ) {
+ if (!isnum(*buf)) {
+ append(range, next, &nr, &nnr);
+ continue;
+ }
+
+ readl(r, buf);
+ for (i = 0; i < nr; i++) {
+ li = range[i][0];
+ ri = range[i][1];
+ if (li > ri || r[1] > ri || r[1]+r[2]-1 < li) continue;
+ range[i][1] = MIN(ri, r[1]-1);
+ next[nnr][0] = MAX(li, r[1]) + r[0]-r[1];
+ next[nnr++][1] = MIN(ri, r[1]+r[2]-1) + r[0]-r[1];
+ range[nr][0] = MAX(li, r[1]+r[2]);
+ range[nr++][1] = ri;
+ }
+ }
+
+ append(range, next, &nr, &nnr);
+ for (i = 0, m = -1; i < nr; i++)
+ if (range[i][0] <= range[i][1])
+ m = m == -1 || m > range[i][0] ? range[i][0] : m;
+
+ printf("%" PRId64 "\n", m);
+ return 0;
+}
diff --git a/2023/05/example.txt b/2023/05/example.txt
@@ -0,0 +1,33 @@
+seeds: 79 14 55 13
+
+seed-to-soil map:
+50 98 2
+52 50 48
+
+soil-to-fertilizer map:
+0 15 37
+37 52 2
+39 0 15
+
+fertilizer-to-water map:
+49 53 8
+0 11 42
+42 0 7
+57 7 4
+
+water-to-light map:
+88 18 7
+18 25 70
+
+light-to-temperature map:
+45 77 23
+81 45 19
+68 64 13
+
+temperature-to-humidity map:
+0 69 1
+1 0 69
+
+humidity-to-location map:
+60 56 37
+56 93 4
diff --git a/2023/05/in.txt b/2023/05/in.txt
@@ -0,0 +1,258 @@
+seeds: 1347397244 12212989 2916488878 1034516675 2821376423 8776260 2240804122 368941186 824872000 124877531 1597965637 36057332 4091290431 159289722 1875817275 106230212 998513229 159131132 2671581775 4213184
+
+seed-to-soil map:
+2988689842 4194451945 100515351
+2936009234 3353543976 52680608
+588295233 2638661119 66434163
+3932833115 2936009234 88315480
+3525561241 3331695912 21848064
+1622262003 1969921080 210668061
+2160566101 909457337 162053391
+1832930064 1887384181 82536899
+3625461917 3024324714 307371198
+3547409305 3680043285 78052612
+1915466963 588295233 240773057
+3089205193 3758095897 436356048
+4021148595 3406224584 273818701
+2156240020 2705095282 4326081
+1164190025 2180589141 458071978
+2477360206 829068290 80389047
+2322619492 2709421363 154740714
+654729396 1377923552 509460629
+2557749253 1211672006 166251546
+2724000799 1071510728 140161278
+
+soil-to-fertilizer map:
+3961802244 3774724750 90737174
+3164426550 3931513861 70563571
+147221566 1279409424 704464
+1394834067 2074132435 40845148
+3795834030 2142537807 47621185
+4083197470 4095560143 199407153
+2722903919 2876212954 93296050
+3467494732 2775293966 100918988
+1809650294 1815421878 66426374
+505665614 275280169 12031240
+2142537807 4002077432 60985377
+1577608496 331482268 177958690
+2590855103 2196397738 132048816
+1942888942 1978207624 24340152
+756722275 120895382 4815243
+3435289775 3899308904 32204957
+1967229094 715059087 147748489
+3955563498 2190158992 6238746
+356096070 125710625 149569544
+2520387506 2704826369 70467597
+517696854 2041922514 32209921
+1755567186 0 54083108
+348569226 1280113888 7526844
+761537518 1597328127 34415327
+1114796271 1631743454 128592301
+0 1494456232 102871895
+1070625412 287311409 44170859
+549906775 1287640732 206815500
+102871895 710084154 4974933
+1298474695 1881848252 96359372
+3843455215 2549697361 112108283
+3761987050 3865461924 33846980
+4052539418 2674168317 30658052
+1435679215 862807576 141929281
+795952845 1004736857 274672567
+3729489716 4063062809 32497334
+2203523184 3085216895 316864322
+2931907860 3402081217 11267883
+107846828 2002547776 39374738
+2816199969 2969509004 115707891
+3568413720 3413349100 161075996
+2943175743 2328446554 221250807
+3234990121 3574425096 200299654
+4282604623 2661805644 12362673
+147926030 509440958 200643196
+1876076668 54083108 66812274
+1243388572 1760335755 55086123
+
+fertilizer-to-water map:
+2460553918 850437816 63304366
+1259757436 1986466040 193004355
+2879827793 2638634287 61837387
+39629536 0 3143529
+2160922553 2535779758 68016930
+2523858284 922523353 36811379
+52449107 1199799263 207670511
+2692884203 2603796688 34837599
+3755186617 147251641 492169035
+3266515480 3620937477 292130997
+1596851845 4077877285 217090011
+2727721802 913742182 8781171
+3055087322 3913068474 164808811
+2228939483 2179470395 229525704
+3668162112 1052896909 87024505
+3219896133 1539684314 30399976
+1510550909 1679599925 86300936
+0 3143529 39629536
+2560669663 1407469774 132214540
+1452761791 1142010145 57789118
+260119618 2700471674 920465803
+3250296109 1036677538 16219371
+1813941856 1026924408 9753130
+4247355652 2488168114 47611644
+1823694986 959334732 67589676
+2831305507 639420676 48522286
+2736502973 52449107 94802534
+1180585421 2408996099 79172015
+2941665180 1765900861 113422142
+2458465187 1139921414 2088731
+3558646477 1570084290 109515635
+1891284662 687942962 162494854
+2053779516 1879323003 107143037
+
+water-to-light map:
+2196302869 3170532562 121192468
+3065704582 2916528129 254004433
+2858667310 1154274853 9085577
+3789349818 1163360430 70779786
+2064226029 1434838179 90165206
+1448515654 725716988 103420445
+2690533041 2124509945 168134269
+347894075 3345882022 38285799
+3966625235 2618593488 35838159
+4186823059 4134088017 89981817
+1701108140 1088713231 65561622
+2589948930 2518009377 100584111
+4283393470 4230658428 11573826
+0 3384167821 347894075
+1638541363 2061943168 62566777
+1296314418 573515752 152201236
+1065865126 194284013 230449292
+1766669762 1991838394 70104774
+830054797 2292644214 110248534
+3595088014 3291725030 12245358
+1978385607 1905997972 85840422
+3607333372 424733305 148782447
+3511869770 2833309885 83218244
+4134088017 4242232254 52735042
+2154391235 3303970388 41911634
+494720868 3732061896 335333929
+1836774536 1234140216 141611071
+2317495337 1633544379 272453593
+4002463394 2402892748 64932431
+940303331 829137433 125561795
+1551936099 954699228 27518372
+4276804876 4224069834 6588594
+3756115819 2467825179 33233999
+2867752887 0 19073457
+386179874 1525003385 108540994
+1579454471 1375751287 59086892
+3319709015 2501059178 16950199
+3336659214 19073457 175210556
+3860129604 982217600 106495631
+2886826344 2654431647 178878238
+
+light-to-temperature map:
+977891457 1797846421 453265654
+3607226990 3913974738 161345346
+2303244644 3266224873 12707372
+1537599301 3278932245 264559714
+354466514 3168465761 62294113
+747844586 3543491959 55668994
+2982698313 3599160953 269886589
+2067998119 2251112075 27763866
+59336731 230685734 266868096
+3768572336 1500157846 31849471
+3856743875 939537646 438223421
+2095761985 59336731 146190926
+326204827 4075320084 28261687
+1502134302 3230759874 35464999
+1431157111 868560455 70977191
+2315952016 2579115195 227102616
+1802159015 1532007317 265839104
+2241952911 807268722 61291733
+3297512098 497553830 309714892
+852851251 4103581771 2643427
+3252584902 3869047542 44927196
+855494678 1377761067 122396779
+2543054632 4106225198 139404427
+2682459059 2278875941 300239254
+803513580 4245629625 49337671
+416760627 205527657 25158077
+3800421807 2806217811 56322068
+441918704 2862539879 305925882
+
+temperature-to-humidity map:
+3507573 490548898 11693081
+545755853 699222305 569882925
+3794976513 167435410 77260251
+0 1526297837 3507573
+1335234764 1766508370 36536350
+2131780538 502241979 64264976
+3707588652 1679120509 87387861
+96082543 2288930706 220305732
+1371771114 1529805410 106547120
+481810045 3044354609 63945808
+15200654 1426594789 7560739
+3206337878 109359655 58075755
+2445677382 2019348918 269581788
+1909096745 3571407035 4209780
+3138678479 4049712539 66833109
+3400069156 3490205314 81201721
+4084645800 3846924477 65868498
+2353535073 1434155528 92142309
+1716598669 3935506457 114206082
+3264413633 4116545648 30901597
+1913306525 3628450464 218474013
+3205511588 3461720938 826290
+2748703371 2770603565 195642711
+2715259170 244990096 33149766
+1478318234 3108300417 88629505
+22761393 0 73321150
+3295315230 3575616815 45887125
+3872236764 278139862 212409036
+2196045514 1269105230 157489559
+2972004168 2509236438 123906332
+316388275 3296299168 165421770
+1685215763 3025113077 18894296
+2748408936 244695661 294435
+3704521599 4147447245 3067053
+1215008024 566506955 120226740
+1830804751 3912792975 22713482
+1704110059 686733695 12488610
+3488217401 1803044720 216304198
+1872711004 3044007373 347236
+1566947739 2652335541 118268024
+3481270877 3621503940 6946524
+2944346082 3462547228 27658086
+3095910500 1636352530 42767979
+1115638778 3196929922 99369246
+3341202355 2966246276 58866801
+1853518233 2633142770 19192771
+1873058240 73321150 36038505
+
+humidity-to-location map:
+336906655 0 11018487
+4177510177 2085057023 105144397
+1299579245 2985741466 175347598
+643133711 2270603056 161424888
+2404489601 1000033728 105953201
+4282654574 2864154964 12312722
+3409171342 3327025690 30826088
+2119751049 2190201420 80401636
+3393269098 3357851778 15902244
+82121354 319849190 39107402
+1953814423 3161089064 165936626
+64524116 385149760 17597238
+3439997430 2057119912 27937111
+0 358956592 26193168
+347925142 11018487 93152804
+1484466972 2432027944 360604841
+2510442802 643133711 347359888
+26193168 402746998 38330948
+1190305465 2946259551 39481915
+2200152685 1105986929 204336916
+3467934541 2792632785 71522179
+804558599 3373754022 385746866
+3539456720 1310323845 638053457
+2857802690 3759500888 535466408
+121228756 104171291 215677899
+1229787380 2876467686 69791865
+1474926843 990493599 9540129
+1845071813 1948377302 108742610
diff --git a/2023/06/6a.c b/2023/06/6a.c
@@ -0,0 +1,44 @@
+#include <inttypes.h>
+#include <math.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define N 100000
+
+#define MIN(a, b) ((a)<(b)?(a):(b))
+#define MAX(a, b) ((a)>(b)?(a):(b))
+
+bool isnum(char c) { return c >= '0' && c <= '9'; }
+
+int64_t readl(int64_t nums[], char *buf) {
+ int64_t i;
+ for (i = 0; *buf; buf++) {
+ if (!isnum(*buf)) continue;
+ nums[i++] = atoll(buf);
+ while (isnum(*buf)) buf++;
+ }
+ return i;
+}
+
+int main() {
+ char line[N], clean[N];
+ int64_t i, n, p, D, x1, x2, t[N], d[N];
+
+ n = readl(t, fgets(line, N, stdin));
+ readl(d, fgets(line, N, stdin));
+
+ p = 1;
+ for (i = 0; i < n; i++) {
+ D = t[i]*t[i] - 4*d[i];
+ if (D < 0) p = 1;
+ double sq = sqrt(D);
+ x1 = (int64_t)floor((t[i] - sq)/2) + 1;
+ x2 = (int64_t)ceil((t[i] + sq)/2) - 1;
+ p *= x2 - x1 + 1;
+ }
+
+ printf("%" PRId64 "\n", p);
+ return 0;
+}
diff --git a/2023/06/6b.txt b/2023/06/6b.txt
@@ -0,0 +1 @@
+Just use 6a and modify the input file manually
diff --git a/2023/06/in.txt b/2023/06/in.txt
@@ -0,0 +1,2 @@
+Time: 41 96 88 94
+Distance: 214 1789 1127 1055
diff --git a/2023/06/in2.txt b/2023/06/in2.txt
@@ -0,0 +1,2 @@
+Time: 41968894
+Distance: 214178911271055
diff --git a/2023/07/7a.c b/2023/07/7a.c
@@ -0,0 +1,58 @@
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define N 100000
+
+int value[255] = {
+ ['2'] = 2, ['3'] = 3, ['4'] = 4, ['5'] = 5,
+ ['6'] = 6, ['7'] = 7, ['8'] = 8, ['9'] = 9,
+ ['T'] = 10, ['J'] = 11, ['Q'] = 12, ['K'] = 13, ['A'] = 14
+};
+
+typedef struct {
+ char c[5];
+ int64_t b;
+} hand_t;
+
+int strength(hand_t h) {
+ int i, c2, c1, s, x[15];
+
+ memset(x, 0, 15 * sizeof(int));
+ for (i = 0, s = 0; i < 5; i++) {
+ s = s * 15 + value[h.c[i]];
+ x[value[h.c[i]]]++;
+ }
+ for (i = 2, c1 = 0, c2 = 0; i < 15; i++) {
+ if (c1 < x[i]) {
+ c2 = c1;
+ c1 = x[i];
+ } else if (c2 < x[i]) c2 = x[i];
+ }
+
+ return (c1*5 + c2) * 759375 + s;
+}
+
+int compare(const void *h1, const void *h2) {
+ return strength(*(hand_t *)h1) - strength(*(hand_t *)h2);
+}
+
+int main() {
+ char line[N];
+ hand_t hand[N];
+ int64_t i, n, p;
+
+ for (n = 0; fgets(line, N, stdin) != NULL; n++) {
+ memcpy(hand[n].c, line, 5);
+ hand[n].b = atoll(line+6);
+ }
+
+ qsort(hand, n, sizeof(hand_t), &compare);
+
+ for (i = 0, p = 0; i < n; i++)
+ p += hand[i].b * (i+1);
+
+ printf("%" PRId64 "\n", p);
+ return 0;
+}
diff --git a/2023/07/7b.c b/2023/07/7b.c
@@ -0,0 +1,58 @@
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define N 100000
+
+int value[255] = {
+ ['2'] = 2, ['3'] = 3, ['4'] = 4, ['5'] = 5,
+ ['6'] = 6, ['7'] = 7, ['8'] = 8, ['9'] = 9,
+ ['T'] = 10, ['J'] = 1, ['Q'] = 12, ['K'] = 13, ['A'] = 14
+};
+
+typedef struct {
+ char c[5];
+ int64_t b;
+} hand_t;
+
+int strength(hand_t h) {
+ int i, c2, c1, s, x[15];
+
+ memset(x, 0, 15 * sizeof(int));
+ for (i = 0, s = 0; i < 5; i++) {
+ s = s * 15 + value[h.c[i]];
+ x[value[h.c[i]]]++;
+ }
+ for (i = 2, c1 = 0, c2 = 0; i < 15; i++) {
+ if (c1 < x[i]) {
+ c2 = c1;
+ c1 = x[i];
+ } else if (c2 < x[i]) c2 = x[i];
+ }
+
+ return ((c1+x[1])*5 + c2) * 759375 + s;
+}
+
+int compare(const void *h1, const void *h2) {
+ return strength(*(hand_t *)h1) - strength(*(hand_t *)h2);
+}
+
+int main() {
+ char line[N];
+ hand_t hand[N];
+ int64_t i, n, p;
+
+ for (n = 0; fgets(line, N, stdin) != NULL; n++) {
+ memcpy(hand[n].c, line, 5);
+ hand[n].b = atoll(line+6);
+ }
+
+ qsort(hand, n, sizeof(hand_t), &compare);
+
+ for (i = 0, p = 0; i < n; i++)
+ p += hand[i].b * (i+1);
+
+ printf("%" PRId64 "\n", p);
+ return 0;
+}
diff --git a/2023/07/in.txt b/2023/07/in.txt
@@ -0,0 +1,1000 @@
+3A399 27
+46645 201
+8A9K4 40
+88333 578
+55353 817
+99Q99 146
+553J5 45
+AAQ2A 547
+TKQ2K 120
+57592 534
+7Q49K 229
+JK949 744
+688T6 657
+98888 392
+4K638 337
+J8888 96
+Q92KJ 778
+48J96 374
+955J6 307
+62TT6 896
+934AK 776
+44654 720
+AJAAA 568
+K6J5Q 162
+T29A4 342
+46342 467
+22227 694
+TQ4TT 468
+88688 728
+88999 183
+Q7T6J 463
+92T9J 884
+KAQQQ 299
+3275Q 913
+Q5535 82
+93A4J 48
+J9888 552
+2QTQ4 846
+44554 795
+JJJJJ 348
+TT477 733
+58883 460
+77377 317
+357J3 725
+T9J4Q 346
+88228 953
+Q4858 982
+5T5TT 405
+TTKTT 322
+QKKKK 197
+A5Q5A 956
+2T22A 962
+TQJTT 734
+84TAK 360
+T39Q7 375
+QJJTT 925
+62236 928
+474T7 302
+37KK3 411
+7J474 325
+55K5J 850
+TTJ2T 780
+Q5259 127
+93K6J 191
+T996T 333
+99929 193
+9JKK3 115
+2A647 409
+3AAAA 966
+85K58 464
+22893 607
+QJQJJ 471
+59T9T 690
+K8484 167
+TKKK2 526
+44243 273
+KQ888 792
+6J3K3 216
+44446 169
+325QK 461
+47T2T 990
+7J78J 410
+A7JJA 562
+2253J 598
+QK385 103
+65556 721
+TTQQ9 943
+Q4Q44 176
+JJ8JJ 539
+J799A 237
+994QK 510
+78996 458
+AK663 145
+QAA78 767
+2Q662 797
+A696A 572
+QA82J 975
+T7KJQ 126
+722JT 416
+2J222 57
+6Q937 719
+AKJ58 39
+QQJQJ 582
+AJATT 187
+Q484A 384
+T9T87 272
+5T7T3 699
+44K44 812
+44228 505
+983Q5 444
+55355 74
+J2JJ2 353
+TJ2T2 883
+Q96J9 708
+7KKKK 447
+557J5 280
+AT4T7 407
+AQ9JJ 73
+K6K2J 597
+K7Q7K 394
+QQ4JQ 635
+2JK35 269
+94934 78
+99K9K 235
+K7K27 91
+QQQTQ 588
+773A3 702
+26232 110
+AA44A 909
+33Q3Q 313
+83335 518
+7AA84 287
+484T4 662
+7JKK7 29
+9J999 38
+Q58T9 17
+29JQ7 355
+772TT 783
+JK66K 473
+TKKTK 433
+52T56 318
+8Q734 628
+K43J7 226
+AA569 77
+J4A54 988
+84J4J 500
+97TQ9 240
+4K554 305
+27999 847
+8QQ83 85
+57638 521
+K5KK9 974
+97K3Q 234
+T88TT 747
+22JAT 71
+TJ337 983
+TA3QK 555
+87686 372
+5KKKK 828
+QK868 168
+99J59 813
+AA28A 875
+47382 837
+27K77 46
+2KKKJ 10
+22292 448
+K4KKK 774
+A3A9K 428
+99222 184
+Q9Q4Q 336
+QQQQ4 631
+KJQTT 249
+T3K46 644
+929J9 165
+2KK22 527
+AKAA5 358
+Q2224 369
+T273J 265
+282JJ 28
+Q488Q 513
+38J88 633
+3T3T3 283
+88855 863
+6J39Q 75
+J44K4 543
+27272 731
+5576K 880
+JTTKT 400
+55J55 750
+2QQ99 919
+4668Q 55
+9A999 5
+JK294 536
+TJ937 692
+KKKKJ 86
+647J4 625
+94227 308
+6AJ5J 841
+99AA5 224
+685A7 24
+TAAKK 112
+286K4 762
+J5Q8A 232
+33323 494
+2A6Q3 495
+JQKT2 37
+AAAQA 978
+K34KJ 703
+7J74T 994
+2J828 723
+5T3T4 535
+48658 140
+J99JJ 954
+TT826 678
+KK3J8 840
+TTT6J 439
+7QQ6T 589
+58585 963
+TTT2A 190
+JQT52 261
+66J76 682
+925KQ 951
+T3223 141
+J78QJ 785
+QQ277 567
+4K6TK 349
+K888K 309
+2J664 713
+75657 218
+96J96 614
+23727 610
+89477 134
+T8456 957
+7K47A 230
+A3AA3 107
+24KK3 538
+65J48 119
+JA98K 647
+KKT6T 935
+A4AAK 248
+K7779 225
+J5574 438
+Q6QQQ 697
+39QTT 469
+K9J62 282
+2K242 971
+QJJK6 41
+49J77 122
+393KK 403
+Q222Q 789
+88Q8Q 587
+4Q8AA 247
+63396 211
+KKJJK 111
+JQ4K7 918
+79775 506
+T5T55 532
+8J558 125
+2QAK8 641
+59548 537
+345K6 106
+Q42K7 695
+88KKK 934
+4J8J6 519
+644JJ 612
+J796K 368
+3J633 621
+66T3A 707
+7Q3K3 768
+A258Q 866
+9463A 820
+58555 843
+36T4J 914
+96K4A 8
+Q34J7 654
+88QAA 651
+AA5J5 58
+73333 740
+JTT9T 609
+3QQQQ 871
+33957 442
+84888 446
+83Q83 742
+K2K3K 243
+JKJ94 377
+K62K2 385
+6QJ87 704
+847J7 61
+87J89 594
+77JQQ 54
+56KA5 56
+AAQQ9 233
+A8AKT 236
+37KKA 711
+J8279 244
+J2Q23 987
+666J6 939
+3JJ77 16
+QQQKQ 104
+96QQ4 398
+J38JA 585
+8QKQ8 899
+4TJK2 806
+66686 421
+5T4T5 889
+K4944 206
+65KQ6 443
+36366 59
+TJT36 996
+JAA3A 367
+4985K 395
+999QQ 926
+832J6 821
+88K7K 890
+J7777 902
+35855 991
+332KK 710
+76AT7 365
+533K3 65
+AAAA9 864
+45TT4 758
+TJJTT 418
+282TT 178
+T536K 474
+J5J3A 259
+Q3QAA 796
+222JJ 793
+Q4666 64
+93TT9 219
+69555 26
+449JA 238
+64935 754
+7K24K 622
+Q7999 932
+55474 288
+J5QQ5 929
+J794A 669
+44K4K 634
+8T6A5 808
+77252 7
+JA8Q4 70
+3JTKJ 181
+34433 845
+A3444 548
+84889 262
+4A9TQ 32
+85A88 189
+73883 321
+7T776 274
+K62QJ 138
+TQ7TQ 80
+6A7AA 786
+TA379 872
+25T33 584
+73747 965
+Q28KQ 1000
+2A222 144
+94993 345
+A9238 172
+8468T 630
+99646 649
+69KK7 210
+QK5K6 457
+6QJ6Q 12
+36339 643
+88A4J 63
+K57JK 549
+77888 382
+T4J56 198
+AQQA7 481
+644K2 492
+T46AA 397
+5J3TJ 861
+J7J79 20
+3333A 42
+QQ555 892
+3AJT5 36
+J4K8A 208
+874TJ 376
+J999J 215
+A8AK3 782
+84444 504
+TT2TT 905
+8746J 752
+AA5A5 449
+A75JT 204
+55595 379
+KK665 775
+22244 364
+22283 152
+AA25A 149
+AA3KA 826
+K399K 981
+93384 97
+46494 347
+3TQJ4 19
+KKK7Q 158
+776J2 267
+7A77J 486
+A4454 9
+6857K 858
+3J3TT 435
+339J3 99
+JAQJQ 105
+82367 571
+3QQ3Q 556
+QJTJQ 599
+696T3 334
+JKA22 829
+J6686 576
+92Q4J 217
+8288K 289
+7JJKA 904
+33383 613
+J339T 315
+88483 503
+9995A 319
+8K92J 483
+TJ244 266
+KJ957 574
+74A44 148
+77KK7 591
+QJQ75 898
+88J8J 885
+92K54 137
+64647 579
+66226 560
+JJ488 839
+43J42 673
+3K3K3 849
+99977 108
+JTT47 113
+2634T 68
+TJQT5 838
+77Q77 763
+2AAKA 972
+78QJ7 257
+6J923 544
+2J2KK 164
+259K3 882
+88K78 602
+4786Q 924
+42444 650
+8536T 52
+AQTT5 546
+3333J 581
+3K984 501
+A8832 685
+34J55 133
+62985 700
+4353J 386
+44454 23
+77772 116
+65665 679
+KKK7J 124
+A7578 749
+5AQ54 396
+7KK8Q 807
+7T7T8 911
+73JJT 157
+98A99 753
+446J4 477
+4T43A 205
+TT999 798
+88885 915
+9Q64J 659
+7767K 357
+A5329 559
+85KKK 739
+9969J 714
+QJQQ9 427
+KT4KT 15
+5T5J5 638
+J74AJ 736
+56666 524
+5T558 930
+2233A 350
+7AA4A 502
+QAAA7 595
+7737T 151
+JQ4Q6 677
+67864 691
+2KK3Q 117
+8272K 414
+75J57 159
+443J4 479
+55KK5 207
+K88TK 910
+3Q9J9 332
+JAJAJ 338
+69369 339
+82KJ6 335
+K39KK 773
+99492 422
+3T663 270
+T5958 328
+9A45K 715
+23593 922
+JKK37 765
+KJKT7 769
+Q74QQ 173
+6232T 729
+227Q2 436
+7AQK4 430
+8Q4JQ 509
+J8248 297
+TT779 306
+A3K34 852
+97228 832
+TJTJ7 300
+A8898 553
+82TJQ 4
+92738 131
+AAAJJ 440
+TT972 51
+69AQK 646
+QQ7QJ 705
+4JK85 718
+7Q63T 220
+44A24 737
+7QAQT 292
+66699 979
+3Q974 329
+TTT6T 648
+85288 686
+989QT 278
+7Q6AK 964
+66466 251
+99744 271
+TTQTQ 163
+3433T 177
+K2333 142
+QQ4Q4 938
+9Q6Q9 787
+47T63 831
+2J56T 493
+94494 72
+25552 869
+936K2 390
+A8AA8 605
+3TT35 727
+2A24T 129
+94999 323
+64A2J 824
+K7676 756
+QQQQ7 18
+882J8 748
+2J77A 611
+222TJ 959
+T6266 722
+823J3 627
+8T569 771
+58KK3 331
+59329 209
+K9K87 6
+82484 150
+9444A 98
+TQ445 487
+J999K 462
+JT4TT 246
+5A455 640
+67KAJ 687
+6A83J 570
+36J6J 90
+6AK6A 573
+88K88 781
+5A3K4 931
+22J27 499
+44T44 948
+K44TT 213
+554K5 927
+6528A 202
+999JT 667
+7J256 401
+A2272 937
+2QJ3Q 900
+63736 973
+32522 933
+T666T 664
+88992 706
+JK267 603
+QQ99Q 316
+AKKKK 507
+8688J 862
+48858 970
+66229 378
+K495Q 14
+79539 761
+A33K3 491
+QAQQQ 417
+T92JA 620
+AQQ8J 475
+64A4K 295
+4A824 231
+8KTK3 453
+229K5 969
+Q3Q53 284
+Q6K34 35
+QJQ8Q 402
+39922 69
+J9TK8 920
+4Q3K8 881
+454AA 999
+556Q9 531
+22K22 496
+6AA39 291
+792K3 810
+TQQTJ 660
+J677K 764
+QTTTT 998
+22223 529
+3333Q 842
+2AAJA 755
+J64K6 466
+TJA4T 693
+J2622 441
+42442 566
+754K8 459
+35826 976
+4743T 676
+693TA 672
+58887 391
+K4899 434
+TTTT3 88
+356T2 894
+77784 212
+3373T 399
+78777 895
+Q97TT 950
+88T8T 760
+J48K2 663
+J3A3A 424
+555T5 25
+37373 389
+J6J46 174
+4TAKT 171
+6TKQ7 624
+5A775 3
+TT3T3 326
+28558 489
+TJ38T 936
+6AK66 254
+44664 223
+77QQ7 87
+Q2829 675
+5TTJ5 995
+T2T9J 454
+7878A 264
+83843 84
+JKKK3 802
+98436 192
+3AA22 940
+555A5 136
+J333J 221
+97KJ3 636
+JK582 801
+5Q82K 515
+25J2T 180
+34234 746
+JQ4K9 255
+224J2 668
+68999 639
+7T77T 886
+6A92Q 629
+JJ55J 161
+99599 429
+6JQ3Q 43
+4699A 361
+75AT2 917
+T9TTT 514
+55A95 551
+J6A96 47
+AAJAT 617
+64669 222
+QQ9QQ 626
+44J44 688
+Q3355 92
+J8J8J 835
+T4382 363
+J359A 296
+49Q49 653
+AAT66 908
+44T72 961
+AKA44 901
+49994 290
+A344A 732
+JJQJK 777
+J8JQ8 819
+A89T9 565
+72A72 868
+K7867 153
+K6663 179
+K76K7 854
+9T265 419
+9K7K9 865
+7797J 426
+25KKJ 670
+75575 11
+75955 431
+TK99Q 684
+KJ273 76
+57525 285
+J3AAJ 263
+Q7QQT 590
+Q77AQ 879
+33626 423
+AAA77 139
+76584 730
+2K9QQ 356
+22225 857
+44KKK 656
+954K6 814
+79TA5 135
+KQKKJ 62
+5QQ88 311
+77K87 452
+ATTTT 370
+J64QA 815
+29399 985
+2T792 351
+5782A 324
+57T74 294
+TQJ53 182
+42222 645
+K4Q92 320
+77A7K 583
+AA999 977
+T77TK 279
+5T586 799
+6K67Q 301
+6J8J2 67
+99JJT 344
+A395K 540
+35AAA 779
+68QT3 557
+45T3K 175
+587Q2 717
+8QK39 616
+73574 550
+T8A36 986
+333AA 800
+2KKKK 393
+9Q6T9 250
+A88A8 203
+J4J44 194
+848J8 281
+5A49Q 44
+8J88A 406
+8JTTT 877
+77767 955
+22K46 199
+6A9AT 387
+T5Q7K 482
+52999 577
+Q6685 632
+TQJQQ 525
+77477 712
+K5656 601
+KKA7A 380
+AA66A 373
+83ATT 942
+3JJ9K 508
+89988 791
+TQ746 757
+8J99T 743
+KKK22 642
+J44K2 980
+K9KAA 830
+9AAA9 260
+558J5 870
+KQKK2 352
+JT4T4 498
+K647T 967
+9K364 569
+44833 844
+T2922 856
+T3463 276
+2TTT2 60
+Q542A 724
+7J724 992
+KT92K 286
+8K388 888
+4394Q 600
+Q747Q 818
+433J4 945
+66J45 381
+55J59 912
+9A5A5 606
+3K98A 195
+9J49A 523
+2642J 944
+9K8Q7 89
+3J335 241
+J639J 564
+63J79 383
+5Q4J7 455
+777T7 674
+6793A 166
+KK9KK 277
+4TA95 873
+KQJA9 81
+2T777 834
+4K44A 109
+93572 312
+33537 258
+756KQ 304
+4J449 770
+27JKQ 412
+KK8KK 596
+J9666 415
+34943 93
+85J6K 404
+J6QJ5 118
+4A452 343
+7548A 327
+6644J 472
+T3A7Q 887
+T3J3J 661
+QQ79Q 516
+73JAT 592
+2QQQJ 413
+QJ523 541
+82878 488
+722T2 256
+4KA4K 923
+96T99 490
+3AKK6 696
+6J6JJ 147
+922JA 593
+J88K6 371
+52245 867
+84664 637
+T2T22 853
+T26A9 952
+8686J 253
+J6AA3 53
+6A65A 701
+JAJTA 745
+3843A 859
+39399 114
+J28Q3 121
+98KT4 13
+TTQTA 772
+39KTT 683
+53J53 298
+47434 671
+4J33Q 542
+9Q9J9 214
+TTTT8 984
+A45K7 891
+K488K 916
+AJ636 997
+7QQQ7 563
+68877 359
+655QQ 790
+3AA4A 855
+T4TTT 958
+9246Q 666
+85K48 485
+AJ283 484
+54J5K 21
+KK9K9 2
+Q69Q3 22
+J4555 809
+J322J 921
+752J5 530
+6K43K 480
+6AAAA 836
+92A29 803
+66888 665
+25529 83
+2AJ22 558
+89999 476
+Q8777 155
+7787J 388
+Q2765 123
+TJ2TK 833
+55AA5 903
+22662 33
+7QQQ2 575
+7J77J 561
+72878 874
+QQJQQ 154
+T693Q 520
+5TT3T 31
+JQQ44 340
+2JJ2Q 804
+J24T2 784
+K7J3J 811
+7KTJT 156
+8848Q 228
+44944 947
+K5426 893
+A55A8 655
+AAKK8 619
+75555 751
+Q2222 816
+TJJ9J 906
+J4224 314
+26A7K 738
+97J54 1
+7KK7K 794
+3KKK5 451
+955K9 827
+Q9QA2 293
+J2A28 200
+J2K77 341
+83888 196
+J97K7 823
+75TJ9 186
+J7638 49
+46K36 128
+92JJJ 735
+29A87 185
+89449 100
+3KAJK 445
+QQ343 586
+8466J 79
+T3T37 362
+252T4 528
+A3A5J 242
+6QQQT 822
+7AJA6 615
+K9625 268
+KK3AK 517
+5Q5Q8 658
+T87K3 618
+57629 788
+A7A7Q 160
+889TQ 741
+TT59T 425
+Q2KQJ 30
+A4K3K 143
+6664K 456
+KK4J4 726
+TTTTJ 437
+QT824 132
+J555J 478
+75KK9 354
+94979 34
+K846J 432
+QQ887 130
+TT97T 170
+66TQ6 878
+57K78 993
+88JK8 608
+AK5Q3 907
+AATAA 989
+QJQ8J 533
+8QQQQ 522
+5JQ49 102
+T3T65 188
+66446 759
+3Q695 275
+AAQTA 689
+43J33 623
+TJ444 968
+Q28Q2 330
+J777T 450
+QT3JQ 420
+T327A 897
+QKQKK 580
+92KA7 946
+7A93K 497
+6KAAA 239
+889TA 50
+K5KK5 511
+J443J 303
+TTT7J 310
+QAK8A 252
+J8658 805
+896K6 680
+88482 876
+69QJQ 408
+4A3J2 941
+8868T 94
+7766Q 851
+62J25 825
+3TT9T 716
+Q5KKK 860
+K7488 95
+33343 766
+JT888 366
+J8885 681
+J66J6 554
+JA65K 604
+QTJ44 848
+583QJ 465
+89Q79 66
+27477 512
+JTK33 101
+TTTQK 652
+A4ATA 545
+J3A33 470
+34QAK 245
+6Q668 698
+66777 709
+5K557 227
+43666 949
+66A6A 960
diff --git a/2023/08/8a.c b/2023/08/8a.c
@@ -0,0 +1,35 @@
+#include <inttypes.h>
+#include <math.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define N 30000
+
+bool isnum(char c) { return c >= '0' && c <= '9'; }
+int index(char *c) { return c[0]-'A' + (c[1]-'A' + (c[2]-'A')*26)*26; }
+
+int map[N][2];
+
+int main() {
+ char *buf, dir[N], line[N];
+ int n, i, s;
+
+ n = strlen(fgets(dir, N, stdin)) - 1;
+
+ fgets(line, N, stdin);
+ while ((buf = fgets(line, N, stdin)) != NULL) {
+ i = index(buf);
+ while (*buf != '(') buf++;
+ map[i][0] = index(buf+1);
+ while (*buf != ' ') buf++;
+ map[i][1] = index(buf+1);
+ }
+
+ for (i = index("AAA"), s = 0; i != index("ZZZ"); s++)
+ i = map[i][dir[s % n] == 'R'];
+
+ printf("%d\n", s);
+ return 0;
+}
diff --git a/2023/08/8b.c b/2023/08/8b.c
@@ -0,0 +1,96 @@
+/*
+I hate this stupid problem. If you read the description carefully (which is
+what I did), you would think that the problem is much, much harder than it
+actually is. In reality, the author made many assumptions about the possible
+paths that made is super easy. Let's see a few:
+
+- Different ghost's path do not end up in the same Z-node (this is not super
+ important for the solution).
+- Each ghost has exactly one Z-node in its path (one could think about this
+ when reading the strange remark that "there are as many A-nodes as Z-nodes",
+ which does not look important at first).
+- Each ghosts meets a Z-node exactly once before entering a loop (this is
+ a fundamental and incredibly strong assupmtion).
+- If a ghost encounters a Z-node after X steps, it will encounter it exactly
+ every X steps (like WTF I don't even have to solve a system of congruences?
+ what is this, a problem for babies?)
+
+Fuck.
+
+This code does not even solve the problem by the way, it computes some data
+about the path that each ghost takes. Then you can figure out the solution
+with a pocket calculator, or by hand.
+*/
+#include <inttypes.h>
+#include <math.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define N 1000
+
+typedef struct { char last; int next[2]; } node_t;
+typedef struct { int preplen, plen, nz, z[N], zid[N]; } source_t;
+
+int ind(char s[3], char m[][3], int n) {
+ for (int j = 0; j < n; j++)
+ if (s[0] == m[j][0] && s[1] == m[j][1] && s[2] == m[j][2])
+ return j;
+
+ return -1;
+}
+
+int v[N*N];
+source_t worksource(int i, node_t *nodes, char *dir, int n, int k) {
+ source_t s;
+ int state;
+
+printf("Working source %d\n", i);
+
+ memset(v, 0, sizeof(int) * N*N);
+ for (int j = i, d = 0, l = 1; true; d = (d+1)%k) {
+ j = nodes[j].next[dir[d] == 'R'];
+ state = j*k+d;
+if (nodes[j].last == 'Z') printf("Found Z %d at %d\n", j, l);
+ if (v[state]) {
+ s.preplen = v[state]-1;
+ s.plen = l - v[state];
+printf("Stopping at %d. Preperiod: %d, period: %d\n", l, s.preplen, s.plen);
+ return s;
+ } else v[state] = l++;
+ }
+
+ return s;
+}
+
+int main() {
+ node_t nodes[N];
+ source_t src[N];
+ char *buf, dir[N], line[N], name[N][3], lstr[N][3], rstr[N][3];
+ int k, i, n, m, s;
+
+ k = strlen(fgets(dir, N, stdin)) - 1;
+ fgets(line, N, stdin);
+ for (n = 0; (buf = fgets(line, N, stdin)) != NULL; n++) {
+ memcpy(name[n], buf, 3);
+ nodes[n].last = name[n][2];
+ while (*buf != '(') buf++;
+ memcpy(lstr[n], buf+1, 3);
+ while (*buf != ' ') buf++;
+ memcpy(rstr[n], buf+1, 3);
+ }
+
+ for (i = 0; i < n; i++) {
+ nodes[i].next[0] = ind(lstr[i], name, n);
+ nodes[i].next[1] = ind(rstr[i], name, n);
+ }
+
+printf("%d %d\n", n, k);
+
+ for (i = 0, m = 0; i < n; i++)
+ if (nodes[i].last == 'A')
+ src[m++] = worksource(i, nodes, dir, n, k);
+
+ return 0;
+}
diff --git a/2023/08/ex2.txt b/2023/08/ex2.txt
@@ -0,0 +1,10 @@
+LR
+
+OOA = (OOB, XXX)
+OOB = (XXX, OOZ)
+OOZ = (OOB, XXX)
+TTA = (TTB, XXX)
+TTB = (TTC, TTC)
+TTC = (TTZ, TTZ)
+TTZ = (TTB, TTB)
+XXX = (XXX, XXX)
diff --git a/2023/08/in.txt b/2023/08/in.txt
@@ -0,0 +1,752 @@
+LRRLRRLRRLRRRLRRLRRRLRRLRRRLRLRLLRLRLRRLLLRLRLRRRLRRLRLRRRLRRLRRLRRLLLRRLRRRLRRRLRLLRRLRLLRRLRRRLRRLRLRRRLRLRLRRLRLRRRLLRRRLLRRRLRLRRRLRRLLRRLRRRLRRLRRLLRRLRRLRRRLLLRRRLRRLRRLRRLRLRRRLRRLLLLRLRRLRRRLRLLRRLRLLRRLRRRLRRRLRRRLLRRLRRLRRLRRRLRRLRRRLLRLRRRLRRRLRRRLLRRRLRRLRRRR
+
+LRL = (MCG, TRC)
+TNJ = (LMV, PMP)
+GQK = (MGD, DBP)
+KVK = (LHC, NMM)
+PQX = (SLC, LSD)
+GRR = (XCR, BJT)
+RBF = (VDM, BFG)
+TKN = (VDH, HGQ)
+MMJ = (LTR, CNQ)
+CCX = (FJJ, FKD)
+VHD = (JFQ, DDH)
+NRL = (CTM, XTJ)
+SNH = (QDH, PSQ)
+JTM = (VFH, QBR)
+BJT = (GJL, JXD)
+LBJ = (JFQ, DDH)
+FPN = (PBT, SJR)
+CGR = (NJC, CNF)
+RCM = (GTQ, BBT)
+BQQ = (FNS, KPL)
+NSF = (SLD, SJV)
+QFQ = (XNX, GHT)
+QCZ = (JPG, NLJ)
+RJD = (QDT, NSG)
+CNK = (SKK, NFL)
+CBR = (QDT, NSG)
+QMV = (HXG, FHS)
+DNL = (XLX, RDT)
+XRS = (DHT, RDP)
+GHV = (FHS, HXG)
+MJM = (GQB, XCC)
+GQC = (NKG, NSF)
+RKH = (KVG, JCQ)
+DKT = (LTN, LTN)
+THR = (PHF, VKN)
+BQV = (BTS, SCG)
+BJJ = (GQC, QRR)
+CQL = (LHK, BCD)
+LXX = (LCX, FJV)
+NSG = (VSX, DFN)
+LSD = (JRL, KXC)
+QKB = (NLJ, JPG)
+HSK = (CFN, NTM)
+BLL = (JJQ, MSN)
+SQD = (BLK, LBK)
+KVP = (DBB, RHN)
+MLJ = (QQR, HDH)
+QVB = (GMN, TDP)
+HJB = (GPG, XDT)
+NBX = (NVT, SNB)
+CLL = (PLG, LHS)
+AAA = (JXS, MFQ)
+CHN = (RNL, FHV)
+JHT = (JQF, JQX)
+KSB = (VDL, VBD)
+HBT = (CKB, CCX)
+JXH = (MQH, PRD)
+DBB = (XHL, CHN)
+PBD = (RDB, VHH)
+SDV = (VMG, NTV)
+BJS = (NNG, RQH)
+SLM = (BRB, FLG)
+VDH = (QPG, GKG)
+KNS = (VQX, HFR)
+HBF = (RQC, MXC)
+JSF = (KPL, FNS)
+HLS = (TJQ, TKM)
+TRV = (BVN, GKF)
+NLJ = (GBH, JCT)
+SVM = (DKT, XLG)
+THK = (NTM, CFN)
+MDK = (DNL, VXV)
+MHV = (DQQ, MQX)
+CNF = (QQH, SLN)
+XJK = (VFH, QBR)
+FNT = (HXR, HXR)
+KCT = (CPX, FXC)
+BDB = (NMP, JGG)
+LRZ = (JXC, TNJ)
+JBQ = (NDL, KSJ)
+LJQ = (GHT, XNX)
+HKD = (HFH, VHJ)
+VDM = (GTD, HRP)
+QQH = (THC, THR)
+PRD = (KFR, TJK)
+KKH = (VTJ, LSR)
+LQS = (SJQ, RHD)
+RLF = (LCR, SGG)
+JHK = (PDJ, TRV)
+QHG = (VMS, PKS)
+JRL = (GVJ, SKL)
+XDV = (PJL, JRN)
+TSV = (KCR, QJP)
+JSN = (QFQ, LJQ)
+RLA = (JSN, JVD)
+KPD = (RDK, NSS)
+HXP = (RQT, QTS)
+DDB = (SFH, RHV)
+JGG = (BJG, JTS)
+VBD = (SGD, FRJ)
+HRP = (RJD, CBR)
+RRT = (MLJ, MLJ)
+NVD = (KHM, RBF)
+TNK = (QSX, KVD)
+NST = (CDL, VGL)
+FLF = (SNF, KRN)
+LHS = (BSD, DTD)
+NCV = (KSB, PTG)
+FMX = (QKX, XFP)
+KMB = (FDM, BSX)
+CRH = (CVV, DDS)
+VGL = (JLS, CPK)
+DBF = (KGB, PXQ)
+RNM = (HTP, LVL)
+HKC = (XML, RTK)
+JLC = (TKN, VSV)
+FLB = (NNG, RQH)
+QKH = (GQM, LSB)
+DTD = (FTJ, HCK)
+BXS = (HKD, FDK)
+TKV = (RHN, DBB)
+QBJ = (KNS, DXQ)
+LBS = (BHT, SFM)
+VMS = (CTJ, DDC)
+FQJ = (FVQ, GKR)
+RQC = (LRF, HCM)
+SSG = (GQK, HDV)
+KPL = (GQS, MDK)
+GJN = (PNN, CPB)
+LHK = (QPD, GSV)
+KFR = (KPD, DTV)
+QXC = (QVM, BHJ)
+XRH = (PKM, FPN)
+CKL = (BBT, GTQ)
+FPK = (CRV, MGR)
+LTK = (LVT, HXF)
+BLK = (BRT, BQN)
+BSX = (XMS, XJN)
+MMR = (JCG, HHX)
+DVM = (LHK, BCD)
+RCJ = (BDB, CFK)
+QLN = (DDB, LDQ)
+GKF = (QLV, FNP)
+BXQ = (NKT, FFN)
+HCM = (FPK, KQB)
+HKG = (GQK, HDV)
+FNS = (GQS, MDK)
+CTJ = (NST, HDJ)
+QQS = (GQB, XCC)
+ZZZ = (MFQ, JXS)
+MGK = (CRH, BRV)
+LCR = (FRD, KMK)
+BKD = (BNR, BKM)
+LDB = (KLM, SCC)
+PLS = (PBL, CRG)
+FQR = (PNR, NCV)
+TNL = (CDT, MKC)
+KVH = (FJQ, SHJ)
+KPT = (KGB, PXQ)
+GQM = (BXQ, VLP)
+FDR = (GLC, KGF)
+DDC = (NST, HDJ)
+MTJ = (TMT, TMB)
+PBJ = (LTK, VFB)
+JXS = (SBL, CQB)
+XML = (BMK, QBL)
+XSK = (KSN, KSN)
+TKM = (TKQ, NTX)
+XFP = (HBX, RMX)
+DXQ = (VQX, HFR)
+KRN = (CNK, JDM)
+TJQ = (TKQ, NTX)
+VQX = (LBJ, VHD)
+TGX = (HLK, LDJ)
+MCX = (GDH, BNS)
+DKM = (TVC, LPB)
+VXD = (GCF, SVD)
+FGB = (BKM, BNR)
+VNN = (VCS, BSR)
+FXX = (LHC, NMM)
+JKR = (TQN, GXV)
+FRJ = (TDK, PKQ)
+MMQ = (SCC, KLM)
+XGL = (MSN, JJQ)
+GTQ = (DMV, LLK)
+KML = (MCX, CTT)
+LBH = (LSR, VTJ)
+BDS = (XJK, JTM)
+FVH = (TSV, HHC)
+KXN = (LRL, QKK)
+HND = (HNQ, FSG)
+JQS = (QLL, RKH)
+CKD = (TBT, HBT)
+PXP = (NXC, TTK)
+VHP = (QJC, QKH)
+KQL = (BQV, RJR)
+FSG = (JBH, GPH)
+BVN = (QLV, FNP)
+HNV = (XFH, BKL)
+CNJ = (MNT, DCG)
+VSV = (HGQ, VDH)
+PXB = (RRT, RRT)
+FNK = (TKC, LTM)
+VTX = (LDJ, HLK)
+KKG = (QDL, SNT)
+CTT = (GDH, BNS)
+FJJ = (FNT, FNT)
+JCS = (DDB, LDQ)
+GDH = (TPG, DND)
+FMF = (XHB, BNH)
+QLL = (JCQ, KVG)
+NJK = (RDB, VHH)
+LHC = (QDS, SXP)
+QHS = (KQL, SXQ)
+BJQ = (BXB, HQT)
+GJL = (BTX, GJC)
+BNR = (NJK, PBD)
+NFL = (NSC, FTL)
+SKK = (FTL, NSC)
+MQN = (FMF, KPC)
+XHB = (DCS, SQD)
+MDT = (TDP, GMN)
+XBL = (TMT, TMB)
+HFH = (XDV, DMD)
+BSR = (VTX, TGX)
+LDH = (BJQ, XJJ)
+GXX = (KKL, RCJ)
+PQZ = (HDH, QQR)
+CXH = (VXD, SGC)
+HPB = (VHR, FNQ)
+LLF = (QVM, BHJ)
+VQQ = (FQD, MQN)
+GSV = (NDT, SLM)
+GLR = (HVD, DMF)
+SLC = (JRL, KXC)
+RHV = (HBC, TFR)
+PVX = (PLS, SJS)
+LLK = (BDC, PNK)
+SLL = (FJQ, SHJ)
+LKT = (VPF, SSC)
+MXC = (LRF, HCM)
+FTL = (QSR, SVH)
+GCF = (JTF, HJB)
+VHZ = (RRN, TSH)
+LNB = (DQQ, MQX)
+DRQ = (XML, RTK)
+XLG = (LTN, VLD)
+LBL = (VVF, SPR)
+MBB = (NFG, NFG)
+QJC = (GQM, LSB)
+LSR = (BJS, FLB)
+MQH = (TJK, KFR)
+DFN = (LXG, LLL)
+MSN = (KXN, MPV)
+JCT = (MHV, LNB)
+TPG = (CJJ, RRD)
+GCV = (NVT, SNB)
+LNL = (GXX, DJM)
+XFT = (TSH, RRN)
+FSS = (SLC, LSD)
+TKT = (TVC, LPB)
+XBN = (NBX, GCV)
+RQT = (QKF, XRS)
+XCC = (MXL, RLF)
+RTH = (QVB, MDT)
+DBP = (HNV, XCG)
+QQB = (JMF, PBJ)
+KSJ = (NCS, RNM)
+GNQ = (CPX, FXC)
+HHX = (JKT, SVM)
+SGG = (KMK, FRD)
+SMM = (SJS, PLS)
+VPK = (LTM, TKC)
+VLD = (QKB, QCZ)
+LTR = (TFX, FVN)
+VCL = (DKM, TKT)
+HXG = (MTG, SNM)
+KGB = (MRV, LFD)
+JGK = (CNJ, RXF)
+FMV = (FRT, MNF)
+SLD = (KVH, SLL)
+VVL = (TNJ, JXC)
+GDP = (RBF, KHM)
+XDT = (RML, JHK)
+JKP = (NDL, KSJ)
+BNH = (SQD, DCS)
+LFD = (LQC, HLS)
+NHC = (JHT, SSM)
+VPF = (NRN, LBL)
+BHT = (LQS, MCP)
+SNT = (RHL, BDS)
+BQN = (XGL, BLL)
+FVN = (HGP, QKM)
+NXC = (KQJ, FMV)
+NKG = (SJV, SLD)
+HSF = (HPB, NFR)
+QKM = (RRR, PMK)
+PJL = (XBN, PFX)
+MRP = (LCX, FJV)
+XSQ = (FDK, HKD)
+TVC = (GHN, QQC)
+XLX = (DKJ, NNT)
+VSX = (LLL, LXG)
+FQD = (FMF, KPC)
+PNJ = (XCR, BJT)
+QDV = (QRJ, BFS)
+QVG = (GLC, KGF)
+BMK = (RJS, FLF)
+SXQ = (BQV, RJR)
+BGL = (CSB, SBH)
+BJG = (CNH, PQJ)
+RSG = (QFT, VPD)
+VVF = (DRQ, HKC)
+BBT = (LLK, DMV)
+HGQ = (GKG, QPG)
+HMD = (PHT, PCD)
+PPL = (CKL, RCM)
+QLA = (TSH, RRN)
+KBG = (HBT, TBT)
+RHD = (HKG, SSG)
+GQB = (RLF, MXL)
+QFA = (QQR, HDH)
+KPC = (BNH, XHB)
+XNX = (FVH, MNH)
+HBX = (NFD, VJF)
+SVD = (HJB, JTF)
+DMD = (JRN, PJL)
+PKJ = (BJQ, XJJ)
+TFX = (HGP, QKM)
+MCH = (PKD, PFF)
+SGD = (PKQ, TDK)
+RRJ = (KCT, GNQ)
+PJD = (VLM, JJZ)
+PHF = (PQX, FSS)
+PKQ = (NTP, MMR)
+VPD = (QHB, NHC)
+FRD = (GDP, NVD)
+SFH = (HBC, TFR)
+JRN = (XBN, PFX)
+HSB = (MRP, LXX)
+RMX = (NFD, VJF)
+SBH = (JXH, TSQ)
+NTP = (JCG, HHX)
+PSX = (FMX, PCR)
+LCQ = (PKS, VMS)
+LKV = (SMM, PVX)
+SGC = (SVD, GCF)
+CQB = (LDD, QDV)
+FRT = (XCV, HSF)
+KGT = (SGC, VXD)
+TRC = (PSX, NQC)
+BSG = (PKD, PFF)
+CKB = (FJJ, FKD)
+SSM = (JQF, JQX)
+DKJ = (BKD, FGB)
+TKC = (TXS, FQJ)
+JQX = (DVQ, NLN)
+BDC = (KNL, DSV)
+FJV = (MTJ, XBL)
+DND = (CJJ, RRD)
+PPH = (MMQ, LDB)
+FTJ = (LKT, GNX)
+JKV = (RFM, MGK)
+KCR = (LLF, QXC)
+RFN = (LJL, CFX)
+HCF = (NFG, HSR)
+NTV = (JXG, VHP)
+QQR = (DTX, HND)
+BTX = (QVG, FDR)
+JQK = (SXQ, KQL)
+NJC = (SLN, QQH)
+RML = (PDJ, TRV)
+SNF = (JDM, CNK)
+KMK = (GDP, NVD)
+XSH = (DXQ, KNS)
+DTX = (HNQ, FSG)
+BNS = (TPG, DND)
+KHM = (BFG, VDM)
+SBF = (MGK, RFM)
+NFD = (PKJ, LDH)
+BHJ = (VNN, CGL)
+TXS = (FVQ, GKR)
+CRV = (NTQ, SDV)
+GHT = (FVH, MNH)
+RBN = (RQC, MXC)
+KKL = (BDB, CFK)
+NLN = (RBN, HBF)
+QFT = (NHC, QHB)
+QBL = (FLF, RJS)
+RHG = (PNN, CPB)
+MNF = (XCV, HSF)
+SJS = (CRG, PBL)
+FDK = (VHJ, HFH)
+HXM = (JJD, JJD)
+PNN = (QDK, MMJ)
+GCS = (TTK, NXC)
+VJF = (LDH, PKJ)
+GTD = (CBR, RJD)
+RRD = (TPL, XVR)
+JXC = (LMV, PMP)
+NXH = (MKC, CDT)
+HCK = (GNX, LKT)
+BRC = (QLL, RKH)
+KQB = (CRV, MGR)
+TMB = (MCH, BSG)
+XJN = (RSX, JGK)
+HQP = (SFM, BHT)
+HQT = (MBB, HCF)
+THC = (VKN, PHF)
+TPL = (NGD, QQB)
+NGD = (PBJ, JMF)
+GVJ = (RNT, LKV)
+QDK = (LTR, CNQ)
+JXG = (QKH, QJC)
+TQN = (KRL, QCV)
+RDB = (JQS, BRC)
+MPV = (LRL, QKK)
+SJQ = (HKG, SSG)
+XHL = (RNL, FHV)
+LRF = (KQB, FPK)
+GNX = (SSC, VPF)
+VXV = (XLX, RDT)
+MTG = (CCR, CRR)
+NFG = (BHH, BHH)
+DSV = (PXB, PJN)
+CVT = (KPT, DBF)
+RHL = (JTM, XJK)
+CBQ = (GXL, PQB)
+BHH = (JXS, MFQ)
+DMV = (BDC, PNK)
+NSS = (HQP, LBS)
+FVM = (PRP, RFN)
+NCS = (HTP, LVL)
+QPD = (NDT, SLM)
+GJC = (FDR, QVG)
+CFK = (JGG, NMP)
+HDV = (MGD, DBP)
+PNB = (PQB, GXL)
+RXA = (NLJ, JPG)
+CNH = (JSF, BQQ)
+VXL = (HXR, XQQ)
+QKF = (RDP, DHT)
+QTS = (QKF, XRS)
+VDL = (SGD, FRJ)
+FCM = (TQN, GXV)
+BHQ = (GQC, QRR)
+BSD = (FTJ, HCK)
+CJJ = (TPL, XVR)
+PLG = (DTD, BSD)
+LQC = (TKM, TJQ)
+NTM = (KLG, PPL)
+SHJ = (NRL, NMS)
+QDL = (BDS, RHL)
+PCR = (XFP, QKX)
+XCG = (XFH, BKL)
+LMV = (GCS, PXP)
+JJD = (QQV, QQV)
+HGP = (PMK, RRR)
+TNF = (RQT, QTS)
+SFM = (MCP, LQS)
+MNR = (RFN, PRP)
+LLL = (CBQ, PNB)
+RJS = (SNF, KRN)
+BRV = (CVV, DDS)
+GGK = (LHS, PLG)
+HVD = (GBJ, VQQ)
+KQJ = (FRT, MNF)
+PMK = (CGR, PQR)
+MFB = (GGK, CLL)
+HLK = (NTG, KMB)
+BKL = (CQL, DVM)
+SVT = (CSB, SBH)
+FGD = (PNR, NCV)
+LVT = (VCL, XTQ)
+MFQ = (SBL, CQB)
+SCC = (KKH, LBH)
+JMF = (VFB, LTK)
+GLC = (FBS, DNB)
+HFT = (MMQ, LDB)
+PNR = (PTG, KSB)
+SNM = (CRR, CCR)
+TJK = (DTV, KPD)
+PQR = (NJC, CNF)
+VPM = (QDL, SNT)
+DHT = (KGT, CXH)
+RPK = (KML, XRL)
+VFH = (HSB, QBV)
+FNP = (JBQ, JKP)
+JLS = (QLN, JCS)
+XMS = (JGK, RSX)
+FRK = (GGK, CLL)
+PDJ = (GKF, BVN)
+QDH = (JLC, QTG)
+PFX = (GCV, NBX)
+BXB = (MBB, MBB)
+TTK = (KQJ, FMV)
+PKS = (DDC, CTJ)
+KLG = (RCM, CKL)
+CSV = (QVB, MDT)
+NNG = (DXR, BPD)
+HHC = (KCR, QJP)
+LVL = (CSQ, TKJ)
+QHB = (JHT, SSM)
+JDM = (SKK, NFL)
+JCQ = (TNK, LPJ)
+TSQ = (MQH, PRD)
+JTS = (PQJ, CNH)
+RCR = (KCT, GNQ)
+LXG = (CBQ, PNB)
+TKQ = (HXP, TNF)
+PKM = (PBT, SJR)
+GXV = (QCV, KRL)
+HJS = (BBX, RPK)
+CPX = (XSK, XSK)
+JXD = (BTX, GJC)
+CVV = (HXM, VDB)
+SBL = (LDD, QDV)
+HBC = (VPM, KKG)
+DXR = (CVT, KKS)
+VDB = (JJD, BVS)
+XQQ = (VVL, LRZ)
+PQB = (BXS, XSQ)
+NTX = (HXP, TNF)
+SCG = (VMQ, HJS)
+GHN = (SBF, JKV)
+VXR = (SGL, LMC)
+NQF = (VPD, QFT)
+DDS = (HXM, VDB)
+KLM = (LBH, KKH)
+SGL = (QRL, KLQ)
+GKR = (CSV, RTH)
+QDT = (DFN, VSX)
+MNT = (SNH, FPP)
+TDP = (TKV, KVP)
+KNL = (PXB, PXB)
+GMN = (KVP, TKV)
+MXL = (SGG, LCR)
+PKD = (FXX, KVK)
+SXP = (FNK, VPK)
+NTG = (BSX, FDM)
+QSR = (KBG, CKD)
+FHV = (XCL, MBP)
+RDT = (NNT, DKJ)
+SPR = (HKC, DRQ)
+FFN = (JHD, GLR)
+FBS = (QXL, FTF)
+VLP = (FFN, NKT)
+KXC = (SKL, GVJ)
+TKJ = (FQR, FGD)
+LHH = (PHT, PCD)
+CTM = (GHV, QMV)
+VHH = (JQS, BRC)
+MQX = (MJM, QQS)
+BBX = (XRL, KML)
+LKK = (PKM, FPN)
+RNT = (PVX, SMM)
+JSA = (TNJ, JXC)
+RDK = (LBS, HQP)
+RXF = (MNT, DCG)
+HDH = (HND, DTX)
+VKN = (FSS, PQX)
+LSB = (VLP, BXQ)
+BPD = (CVT, KKS)
+TMT = (BSG, MCH)
+QLV = (JBQ, JKP)
+LPJ = (KVD, QSX)
+QDS = (VPK, FNK)
+GQS = (VXV, DNL)
+DTV = (NSS, RDK)
+SNB = (JLB, LLV)
+NMM = (SXP, QDS)
+CSB = (TSQ, JXH)
+PFF = (FXX, KVK)
+VHJ = (XDV, DMD)
+XFX = (KSN, THB)
+CCR = (NQF, RSG)
+VMQ = (BBX, RPK)
+HXR = (VVL, VVL)
+SJV = (KVH, SLL)
+CFN = (KLG, PPL)
+DDH = (RHG, GJN)
+FLG = (HMD, LHH)
+FVQ = (RTH, CSV)
+RTK = (BMK, QBL)
+NSC = (SVH, QSR)
+MKC = (FCM, JKR)
+XTJ = (GHV, QMV)
+CNQ = (FVN, TFX)
+SJR = (BJJ, BHQ)
+MGR = (NTQ, SDV)
+XFH = (DVM, CQL)
+QSX = (GRR, PNJ)
+QKX = (HBX, RMX)
+LBK = (BQN, BRT)
+PXQ = (MRV, LFD)
+LDQ = (SFH, RHV)
+MNH = (HHC, TSV)
+XCV = (HPB, NFR)
+KLQ = (QBJ, XSH)
+FTF = (SCQ, RGC)
+JJQ = (MPV, KXN)
+LJL = (VDV, SJJ)
+DNB = (FTF, QXL)
+CFX = (VDV, SJJ)
+JKT = (DKT, DKT)
+SJJ = (THK, HSK)
+CDL = (JLS, CPK)
+QCV = (XRH, LKK)
+XCR = (GJL, JXD)
+KMJ = (MLJ, PQZ)
+MPS = (DJM, GXX)
+GBJ = (MQN, FQD)
+PNK = (KNL, DSV)
+BRB = (HMD, LHH)
+PBT = (BJJ, BHQ)
+JPG = (JCT, GBH)
+HSR = (BHH, ZZZ)
+DQQ = (QQS, MJM)
+MCP = (SJQ, RHD)
+LTM = (TXS, FQJ)
+KKS = (KPT, DBF)
+DCG = (FPP, SNH)
+TDK = (MMR, NTP)
+QJP = (LLF, QXC)
+NFR = (FNQ, VHR)
+FKD = (FNT, VXL)
+LMC = (KLQ, QRL)
+PBL = (FVM, MNR)
+JHD = (DMF, HVD)
+CRR = (RSG, NQF)
+JJZ = (JVD, JSN)
+RQH = (DXR, BPD)
+HXF = (VCL, XTQ)
+CRG = (MNR, FVM)
+VHR = (QHG, LCQ)
+VCS = (VTX, TGX)
+FPP = (QDH, PSQ)
+KSN = (XFT, XFT)
+BVS = (QQV, PJD)
+RSX = (RXF, CNJ)
+FXC = (XSK, XFX)
+HDJ = (CDL, VGL)
+QQC = (SBF, JKV)
+LPB = (GHN, QQC)
+LRJ = (QHS, JQK)
+SCQ = (RCR, RRJ)
+PQJ = (JSF, BQQ)
+GKG = (VMJ, LRJ)
+SSC = (NRN, LBL)
+NVT = (JLB, LLV)
+KVD = (GRR, PNJ)
+XRL = (CTT, MCX)
+BTS = (VMQ, HJS)
+KRL = (XRH, LKK)
+RRN = (BGL, SVT)
+FHS = (SNM, MTG)
+QPG = (VMJ, LRJ)
+QKK = (TRC, MCG)
+VDV = (THK, HSK)
+GPH = (VXR, GKQ)
+RNL = (XCL, MBP)
+SLN = (THC, THR)
+CPB = (MMJ, QDK)
+NMS = (XTJ, CTM)
+RJR = (BTS, SCG)
+CGL = (VCS, BSR)
+MBP = (MFB, FRK)
+NNT = (FGB, BKD)
+HTP = (CSQ, TKJ)
+GPG = (RML, JHK)
+QRL = (QBJ, XSH)
+BCD = (GSV, QPD)
+QQV = (VLM, VLM)
+PRP = (CFX, LJL)
+TFR = (KKG, VPM)
+LDD = (QRJ, BFS)
+QVM = (VNN, CGL)
+KGF = (FBS, DNB)
+GBH = (MHV, LNB)
+JCG = (JKT, SVM)
+FJQ = (NMS, NRL)
+QXL = (RGC, SCQ)
+NRN = (SPR, VVF)
+FDM = (XMS, XJN)
+RFM = (BRV, CRH)
+NKT = (GLR, JHD)
+HFR = (VHD, LBJ)
+THB = (XFT, VHZ)
+XJJ = (BXB, HQT)
+QTG = (VSV, TKN)
+NQC = (PCR, FMX)
+JLB = (HFT, PPH)
+GXL = (BXS, XSQ)
+PSQ = (QTG, JLC)
+NDT = (BRB, FLG)
+PJN = (RRT, KMJ)
+TBT = (CKB, CCX)
+JBH = (GKQ, VXR)
+XVR = (QQB, NGD)
+BRT = (XGL, BLL)
+PCD = (MPS, LNL)
+SKL = (RNT, LKV)
+TSH = (BGL, SVT)
+JQF = (DVQ, NLN)
+DVQ = (RBN, HBF)
+RGC = (RCR, RRJ)
+QRJ = (TNL, NXH)
+XCL = (MFB, FRK)
+VLM = (JSN, JVD)
+RDP = (KGT, CXH)
+VTJ = (FLB, BJS)
+LCX = (XBL, MTJ)
+JVD = (QFQ, LJQ)
+BKM = (NJK, PBD)
+VMJ = (QHS, JQK)
+DMF = (VQQ, GBJ)
+CDT = (FCM, JKR)
+NTQ = (NTV, VMG)
+QRR = (NSF, NKG)
+NDL = (RNM, NCS)
+KVG = (LPJ, TNK)
+DCS = (BLK, LBK)
+JFQ = (RHG, GJN)
+GKQ = (SGL, LMC)
+JTF = (GPG, XDT)
+SVH = (CKD, KBG)
+RRR = (PQR, CGR)
+RHN = (CHN, XHL)
+HNQ = (GPH, JBH)
+BFG = (GTD, HRP)
+LLV = (PPH, HFT)
+NMP = (BJG, JTS)
+CSQ = (FQR, FGD)
+MRV = (HLS, LQC)
+LDJ = (KMB, NTG)
+PHT = (LNL, MPS)
+DJM = (RCJ, KKL)
+PTG = (VBD, VDL)
+PMP = (PXP, GCS)
+LTN = (QKB, QKB)
+BFS = (NXH, TNL)
+MGD = (XCG, HNV)
+QBV = (MRP, LXX)
+VFB = (LVT, HXF)
+XTQ = (TKT, DKM)
+QBR = (QBV, HSB)
+CPK = (QLN, JCS)
+MCG = (NQC, PSX)
+VMG = (VHP, JXG)
+FNQ = (LCQ, QHG)
diff --git a/2023/09/9a.c b/2023/09/9a.c
@@ -0,0 +1,46 @@
+#include <inttypes.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define N 1000
+
+#define isnum(c) (c == '-' || (c >= '0' && c <= '9'))
+
+int64_t readl(int64_t nums[], char *buf) {
+ int64_t i;
+ for (i = 0; *buf; buf++) {
+ if (!isnum(*buf)) continue;
+ nums[i++] = atoll(buf);
+ while (isnum(*buf)) buf++;
+ }
+ return i;
+}
+
+bool isconstant(int64_t a[], int n) {
+ for (int i = 0; i < n-1; i++)
+ if (a[i] != a[i+1])
+ return false;
+ return true;
+}
+
+int64_t next(int64_t a[], int64_t n) {
+ int64_t x = a[n-1];
+ if (isconstant(a, n))
+ return x;
+ for (int i = 0; i < n-1; i++)
+ a[i] = a[i+1] - a[i];
+ return x + next(a, n-1);
+}
+
+int main() {
+ char line[N];
+ int64_t s, a[N];
+
+ for (s = 0; fgets(line, N, stdin) != NULL; )
+ s += next(a, readl(a, line));
+
+ printf("%" PRId64 "\n", s);
+ return 0;
+}
diff --git a/2023/09/9b.c b/2023/09/9b.c
@@ -0,0 +1,46 @@
+#include <inttypes.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define N 1000
+
+#define isnum(c) (c == '-' || (c >= '0' && c <= '9'))
+
+int64_t readl(int64_t nums[], char *buf) {
+ int64_t i;
+ for (i = 0; *buf; buf++) {
+ if (!isnum(*buf)) continue;
+ nums[i++] = atoll(buf);
+ while (isnum(*buf)) buf++;
+ }
+ return i;
+}
+
+bool isconstant(int64_t a[], int n) {
+ for (int i = 0; i < n-1; i++)
+ if (a[i] != a[i+1])
+ return false;
+ return true;
+}
+
+int64_t next(int64_t a[], int64_t n) {
+ int64_t x = a[0];
+ if (isconstant(a, n))
+ return x;
+ for (int i = 0; i < n-1; i++)
+ a[i] = a[i+1] - a[i];
+ return x - next(a, n-1);
+}
+
+int main() {
+ char line[N];
+ int64_t s, a[N];
+
+ for (s = 0; fgets(line, N, stdin) != NULL; )
+ s += next(a, readl(a, line));
+
+ printf("%" PRId64 "\n", s);
+ return 0;
+}
diff --git a/2023/09/in.txt b/2023/09/in.txt
@@ -0,0 +1,200 @@
+28 38 58 115 255 558 1167 2343 4564 8699 16328 30378 56447 105549 199601 381868 735876 1418100 2712150 5115341 9472583
+24 34 56 103 191 343 593 990 1602 2520 3862 5777 8449 12101 16999 23456 31836 42558 56100 73003 93875
+12 30 66 118 187 291 486 901 1807 3760 7885 16402 33536 67001 130303 246169 451478 804146 1392500 2347766 3860393
+11 7 -1 -10 4 101 392 1052 2337 4631 8595 15584 28661 54781 109041 222274 453659 910327 1775963 3349730 6094694
+13 26 56 110 200 360 677 1347 2785 5847 12267 25493 52275 105732 211455 420013 833076 1658291 3323777 6713131 13636877
+24 36 50 68 92 124 166 220 288 372 474 596 740 908 1102 1324 1576 1860 2178 2532 2924
+4 10 18 35 81 207 523 1232 2664 5299 9766 16819 27345 42607 65306 103013 177906 352348 792280 1916515 4732055
+2 4 15 46 115 246 479 915 1841 4022 9326 21995 51143 115539 252570 534754 1099830 2205374 4328183 8346246 15873877
+6 16 41 104 240 508 1016 1959 3670 6684 11815 20246 33632 54216 84958 129677 193206 281560 402117 563812 777344
+10 24 59 127 240 410 649 969 1382 1900 2535 3299 4204 5262 6485 7885 9474 11264 13267 15495 17960
+1 3 19 65 161 334 621 1072 1753 2749 4167 6139 8825 12416 17137 23250 31057 40903 53179 68325 86833
+1 3 14 46 118 256 493 869 1431 2233 3336 4808 6724 9166 12223 15991 20573 26079 32626 40338 49346
+5 20 54 111 200 339 551 863 1338 2203 4189 9270 22068 52271 118490 254073 515553 994838 1837662 3275301 5689494
+11 19 37 74 152 315 630 1176 2019 3189 4728 6991 11599 23863 58350 151043 385257 945993 2232085 5082986 11226568
+-6 -5 -1 6 16 29 45 64 86 111 139 170 204 241 281 324 370 419 471 526 584
+19 44 79 123 175 234 299 369 443 520 599 679 759 838 915 989 1059 1124 1183 1235 1279
+20 26 41 76 144 261 459 824 1572 3189 6707 14297 30581 65483 140200 299218 633600 1324592 2722729 5487182 10824554
+2 13 49 134 316 686 1400 2714 5060 9211 16601 29879 53781 96407 171038 298877 513930 873445 1482345 2550372 4520094
+7 22 55 116 218 381 645 1090 1862 3209 5540 9533 16335 27918 47680 81409 138761 235440 396309 659706 1083288
+23 34 43 54 73 105 151 202 234 223 220 555 2284 8074 23894 62315 149406 340397 757350 1681105 3771572
+-2 9 31 72 157 346 769 1701 3724 8065 17266 36441 75513 153008 302220 580858 1085650 1973817 3493849 6028622 10154597
+17 35 83 175 326 554 878 1305 1800 2233 2292 1349 -1702 -8485 -20570 -37084 -47977 -18173 145725 659887 1980386
+6 19 49 119 273 598 1257 2530 4856 8858 15310 24963 38082 53479 66865 68818 44405 -18660 -94790 -14282 809438
+17 21 22 20 15 7 -4 -18 -35 -55 -78 -104 -133 -165 -200 -238 -279 -323 -370 -420 -473
+8 23 59 139 312 672 1383 2710 5056 9005 15371 25253 40096 61758 92583 135480 194008 272467 375995 510671 683624
+9 16 34 63 103 154 216 289 373 468 574 691 819 958 1108 1269 1441 1624 1818 2023 2239
+8 19 59 140 275 481 794 1315 2308 4381 8817 18206 37692 77458 157694 318613 640892 1287715 2591041 5226414 10560561
+8 21 37 57 82 107 117 88 -4 -163 -339 -377 54 1555 5117 12270 25264 47285 82709 137397 219034
+22 34 44 52 58 62 64 64 62 58 52 44 34 22 8 -8 -26 -46 -68 -92 -118
+28 57 114 220 416 779 1446 2651 4785 8494 14832 25483 43057 71450 116238 185052 287858 437047 647230 934638 1316054
+16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96
+28 39 48 62 97 180 347 630 1022 1413 1518 905 -557 -1064 7553 50137 189888 570667 1494764 3559032 7883557
+5 0 3 30 106 262 542 1035 1947 3728 7269 14184 27192 50614 91000 157901 264801 430224 679031 1043922 1567158
+4 21 55 119 239 461 864 1591 2913 5356 9967 18894 36631 72557 145803 294037 588486 1158435 2229571 4181885 7634411
+8 11 15 33 81 182 384 805 1728 3777 8206 17321 35023 67400 123199 213865 352632 551879 817609 1139457 1474069
+6 15 30 69 162 358 754 1560 3223 6658 13679 27799 55705 109973 214073 411584 783020 1476065 2758724 5110417 9373988
+18 26 37 54 84 138 231 382 614 954 1433 2086 2952 4074 5499 7278 9466 12122 15309 19094 23548
+3 -2 -7 -12 -17 -22 -27 -32 -37 -42 -47 -52 -57 -62 -67 -72 -77 -82 -87 -92 -97
+16 32 61 121 242 466 847 1451 2356 3652 5441 7837 10966 14966 19987 26191 33752 42856 53701 66497 81466
+13 35 79 160 302 554 1015 1865 3399 6061 10475 17470 28096 43628 65555 95551 135425 187047 252247 332684 429682
+13 6 -9 -20 11 156 538 1364 2981 5967 11279 20495 36207 62647 106658 179157 297277 487420 789503 1262734 1993315
+14 11 18 51 141 348 790 1714 3660 7803 16602 34939 71995 144184 279550 524126 950858 1671811 2854498 4743307 7687145
+2 7 22 56 123 242 437 737 1176 1793 2632 3742 5177 6996 9263 12047 15422 19467 24266 29908 36487
+19 34 68 128 220 349 519 733 993 1300 1654 2054 2498 2983 3505 4059 4639 5238 5848 6460 7064
+21 48 85 132 195 292 468 836 1684 3739 8772 20876 48964 111327 243473 510946 1029407 1994954 3728471 6738732 11810049
+11 27 55 108 210 394 696 1143 1733 2405 2997 3190 2436 -132 -5810 -16455 -34641 -63841 -108637 -174960 -270362
+12 12 12 25 90 292 791 1869 4012 8064 15537 29266 54829 103647 199701 393835 793523 1623291 3344337 6885726 14081159
+5 13 31 72 164 358 736 1410 2499 4070 6039 8076 9700 11088 15835 38309 120943 371965 1044017 2693426 6497234
+-1 -4 4 46 162 411 867 1607 2698 4206 6273 9338 14615 24985 46510 90835 178809 345728 648682 1176574 2063472
+8 16 23 40 92 216 455 847 1408 2108 2839 3374 3316 2036 -1401 -8323 -20552 -40520 -71401 -117260 -183220
+27 54 93 143 215 340 581 1059 2009 3892 7603 14833 28665 54510 101519 184641 327535 566586 956321 1576571 2541779
+18 25 37 63 114 201 333 515 746 1017 1309 1591 1818 1929 1845 1467 674 -679 -2763 -5777 -9950
+11 23 58 131 266 508 956 1834 3618 7240 14408 28142 53779 101035 188408 352630 668776 1292502 2547568 5104551 10339633
+20 30 55 112 230 464 919 1792 3444 6514 12092 22012 39486 70717 129039 244932 488666 1018738 2181538 4711697 10130222
+8 15 22 29 36 43 50 57 64 71 78 85 92 99 106 113 120 127 134 141 148
+8 17 18 5 -32 -110 -256 -510 -928 -1585 -2578 -4029 -6088 -8936 -12788 -17896 -24552 -33091 -43894 -57391 -74064
+0 6 28 73 155 304 573 1043 1826 3066 4938 7645 11413 16484 23107 31527 41972 54638 69672 87153 107071
+8 14 26 39 49 61 112 320 974 2687 6657 15139 32341 66134 131237 254984 487637 921079 1723959 3210704 5981290
+-3 6 32 88 209 468 1005 2092 4276 8669 17497 35106 69812 137381 267702 517614 995199 1904592 3626038 6854228 12829699
+16 14 18 32 52 64 53 40 180 979 3722 11247 29252 68383 147421 297965 571096 1046604 1845466 3146378 5207268
+0 19 60 146 330 708 1432 2721 4864 8205 13096 19800 28322 38142 47820 54439 52848 34663 -13020 -109250 -281238
+19 37 70 119 185 269 372 495 639 805 994 1207 1445 1709 2000 2319 2667 3045 3454 3895 4369
+8 18 30 51 92 174 350 764 1787 4310 10347 24225 54843 119816 252855 516572 1024178 1975442 3715028 6825207 12270294
+9 31 64 108 163 229 306 394 493 603 724 856 999 1153 1318 1494 1681 1879 2088 2308 2539
+27 36 46 65 110 223 504 1178 2725 6116 13214 27417 54640 104755 193632 345950 598975 1007532 1650430 2638633 4125506
+-3 -9 -19 -25 -9 63 252 660 1449 2882 5441 10155 19412 38768 80661 171586 365345 766697 1572457 3141343 6110353
+9 13 16 19 30 81 256 730 1819 4041 8188 15409 27304 46029 74412 116080 175597 258613 372024 524143 724882
+8 17 26 35 44 53 62 71 80 89 98 107 116 125 134 143 152 161 170 179 188
+13 29 69 150 300 564 1014 1770 3055 5340 9688 18482 36824 75023 152753 305660 595433 1124631 2057879 3651414 6293380
+19 39 64 101 169 299 534 929 1551 2479 3804 5629 8069 11251 15314 20409 26699 34359 43576 54549 67489
+26 48 79 119 168 226 293 369 454 548 651 763 884 1014 1153 1301 1458 1624 1799 1983 2176
+16 28 45 62 80 120 240 563 1330 3003 6482 13603 28310 59352 126262 272164 590489 1279633 2753130 5858989 12311553
+16 27 38 49 60 71 82 93 104 115 126 137 148 159 170 181 192 203 214 225 236
+16 26 52 107 212 412 806 1601 3204 6384 12578 24502 47411 91748 178785 352718 706597 1437520 2962583 6158201 12843931
+15 23 44 100 234 527 1138 2396 4995 10379 21457 43857 88008 172421 328611 608145 1092295 1904695 3227218 5318970 8537806
+19 35 67 125 219 359 555 817 1155 1579 2099 2725 3467 4335 5339 6489 7795 9267 10915 12749 14779
+14 9 -2 -25 -60 -96 -107 -38 250 1146 3714 10678 28555 72047 172745 395881 871826 1854119 3824278 7677249 15042442
+0 14 48 119 263 559 1175 2446 5004 10002 19512 37235 69743 128583 233715 418934 740144 1287614 2203656 3707527 6129775
+-6 -13 -11 9 54 127 233 409 798 1797 4331 10342 23629 51210 105348 206191 384454 682459 1149765 1826027 2697892
+14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 -1 -2 -3 -4 -5 -6
+9 15 23 41 93 228 528 1127 2265 4422 8622 17094 34685 71869 151157 320706 682873 1452897 3076233 6455943 13379245
+26 38 54 85 154 309 648 1354 2736 5284 9786 17637 31605 57512 107535 206117 399770 772302 1467138 2718337 4891512
+7 2 -4 -11 -19 -28 -38 -49 -61 -74 -88 -103 -119 -136 -154 -173 -193 -214 -236 -259 -283
+17 40 72 120 202 355 665 1340 2867 6327 14000 30508 64985 135242 275772 552897 1092529 2128842 4085140 7700052 14210216
+-3 -4 -7 -12 -19 -28 -39 -52 -67 -84 -103 -124 -147 -172 -199 -228 -259 -292 -327 -364 -403
+9 21 38 62 99 161 268 450 749 1221 1938 2990 4487 6561 9368 13090 17937 24149 31998 41790 53867
+2 9 39 99 204 393 760 1519 3132 6545 13600 27720 54996 105835 197349 356668 625334 1064865 1763453 2843561 4469892
+20 33 49 75 125 228 457 1004 2337 5480 12453 26893 54846 105671 192927 335020 555266 880875 1340177 1957191 2742379
+18 21 16 6 5 57 270 860 2190 4774 9202 15936 24945 35235 44593 50493 54394 73951 171296 510662 1464845
+10 11 18 38 71 100 71 -142 -790 -2316 -5409 -10945 -19511 -29701 -33227 -2480 138638 579164 1757487 4641596 11293649
+25 33 43 67 138 323 742 1611 3346 6797 13731 27756 55976 111792 219447 421300 789851 1449309 2618271 4700169 8479106
+27 42 62 88 120 169 286 615 1492 3635 8492 18826 39628 79522 153115 285551 522357 951296 1749478 3279940 6279276
+-1 11 47 125 280 574 1106 2022 3525 5885 9449 14651 22022 32200 45940 64124 87771 118047 156275 203945 262724
+13 21 51 115 225 393 631 951 1365 1885 2523 3291 4201 5265 6495 7903 9501 11301 13315 15555 18033
+20 35 53 83 140 245 425 713 1148 1775 2645 3815 5348 7313 9785 12845 16580 21083 26453 32795 40220
+10 26 63 132 248 429 694 1074 1663 2751 5098 10427 22235 47044 96239 188667 354200 638496 1109225 1864062 3040786
+6 -1 -9 -15 -17 -13 13 141 635 2188 6391 16606 39556 88146 186315 377108 735668 1389501 2549183 4553679 7935653
+9 15 43 117 265 514 885 1388 2017 2745 3519 4255 4833 5092 4825 3774 1625 -1997 -7533 -15495 -26471
+7 22 41 65 106 207 489 1245 3117 7431 16845 36609 76972 157632 315649 618971 1188707 2234572 4109585 7392185 13006510
+10 9 5 -1 3 51 224 700 1840 4321 9327 18809 35825 64971 112914 189038 306214 481705 738217 1105107 1619759
+12 16 30 69 148 282 486 775 1164 1668 2302 3081 4020 5134 6438 7947 9676 11640 13854 16333 19092
+1 0 10 42 98 172 270 462 979 2368 5718 12970 27324 53756 99658 175614 296325 481696 758098 1159818 1730710
+8 19 38 73 142 283 562 1079 1973 3430 5708 9217 14739 23954 40566 72513 136014 262573 510546 983505 1858428
+9 24 57 114 205 359 643 1184 2197 4026 7209 12582 21441 35785 58667 94684 150641 236428 366153 559578 843909
+8 14 22 32 44 58 74 92 112 134 158 184 212 242 274 308 344 382 422 464 508
+24 34 44 54 64 74 84 94 104 114 124 134 144 154 164 174 184 194 204 214 224
+16 30 63 126 233 405 686 1187 2184 4316 8979 19130 40965 87415 185254 389023 807192 1649322 3307839 6494862 12463897
+-7 -7 1 32 121 335 787 1666 3321 6479 12739 25563 52073 106047 212569 414805 783321 1428197 2513885 4276266 7040633
+-2 1 4 7 10 13 16 19 22 25 28 31 34 37 40 43 46 49 52 55 58
+13 27 38 41 36 48 177 688 2156 5707 13455 29337 60698 121182 235783 449463 842011 1554867 2842648 5177133 9461476
+15 42 93 182 326 549 884 1374 2086 3178 5119 9300 19562 45721 111199 268798 632393 1439844 3177921 6832092 14389654
+7 28 73 151 265 408 559 679 707 556 109 -785 -2315 -4712 -8253 -13265 -20129 -29284 -41231 -56537 -75839
+8 5 13 42 97 177 284 446 766 1532 3473 8340 20149 47680 109278 241921 518597 1082840 2220086 4508651 9140126
+17 27 40 71 149 317 632 1165 2001 3239 4992 7387 10565 14681 19904 26417 34417 44115 55736 69519 85717
+24 37 47 65 117 257 594 1347 2963 6367 13474 28217 58615 120994 248715 510261 1046343 2144574 4386122 8926186 18016274
+11 16 36 80 158 277 445 706 1254 2711 6703 16929 40991 93338 199774 404089 777493 1431666 2536382 4342822 7213860
+0 -2 8 48 141 321 657 1303 2580 5096 9915 18799 34571 61685 107144 181982 303624 499562 812938 1310810 2096097
+4 15 39 91 211 473 995 1967 3741 7078 13740 27774 58093 123376 261026 543285 1106377 2204300 4310572 8314176 15899538
+-7 6 36 87 163 272 446 788 1568 3411 7651 16966 36460 75419 150039 287505 531891 952452 1654990 2797097 4608209
+13 29 56 95 152 244 405 692 1191 2023 3350 5381 8378 12662 18619 26706 37457 51489 69508 92315 120812
+15 27 59 125 237 417 722 1283 2361 4428 8300 15415 28528 53504 103742 210470 445527 969865 2133765 4678765 10135083
+20 31 57 122 274 596 1223 2377 4439 8101 14695 26909 50338 96812 191434 387177 794467 1639641 3377468 6902112 13932807
+10 37 91 200 416 820 1528 2716 4696 8091 14175 25464 46666 86122 157896 284700 501870 862641 1445003 2360456 3765020
+6 24 54 95 153 251 440 812 1516 2778 4926 8421 13895 22197 34448 52106 77042 111628 158838 222363 306741
+9 24 49 84 125 162 193 281 693 2172 6405 16762 39393 84782 169869 320863 576881 994560 1653801 2664816 4176661
+3 10 23 57 149 386 945 2142 4499 8866 16685 30566 55492 101260 187366 352765 675303 1309938 2562335 5026719 9836291
+15 29 55 109 226 481 1024 2134 4299 8344 15672 28779 52397 95981 178896 340733 660899 1294259 2533505 4914517 9388784
+14 33 78 166 331 644 1248 2423 4711 9165 17861 34963 68917 136884 273538 548338 1099300 2198986 4383250 8701159 17195603
+7 5 5 7 11 17 25 35 47 61 77 95 115 137 161 187 215 245 277 311 347
+0 2 9 21 38 60 87 119 156 198 245 297 354 416 483 555 632 714 801 893 990
+8 11 29 79 200 478 1087 2365 4957 10076 19965 38689 73433 136495 248086 439830 758518 1269449 2059289 3241351 4974534
+9 26 71 154 282 459 686 961 1279 1632 2009 2396 2776 3129 3432 3659 3781 3766 3579 3182 2534
+-8 -9 -1 23 70 147 261 419 628 895 1227 1631 2114 2683 3345 4107 4976 5959 7063 8295 9662
+14 38 88 183 349 621 1047 1694 2656 4064 6098 9001 13095 18799 26649 37320 51650 70666 95612 127979 169537
+1 4 7 10 13 16 19 22 25 28 31 34 37 40 43 46 49 52 55 58 61
+10 17 33 71 156 319 593 1016 1655 2681 4550 8393 16823 35591 76964 166498 356232 749489 1545759 3118955 6149158
+-2 5 20 55 147 378 896 1945 3924 7507 13868 25067 44665 78648 136752 234293 394618 652305 1057252 1679807 2617103
+-2 -3 -3 12 76 250 640 1443 3044 6202 12405 24581 48599 96524 193673 393656 809674 1677915 3482413 7194006 14714566
+-5 -2 2 11 40 131 388 1045 2594 6015 13162 27362 54272 103007 187497 327953 552225 896728 1406510 2133961 3135644
+-1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21
+6 23 51 90 140 201 273 356 450 555 671 798 936 1085 1245 1416 1598 1791 1995 2210 2436
+22 44 78 135 237 421 758 1410 2772 5783 12540 27421 59046 123639 250801 493519 945638 1772306 3262446 5917591 10599023
+24 37 60 106 197 375 727 1435 2867 5730 11311 21837 40990 74618 131688 225532 375442 608675 962934 1489396 2256363
+12 20 49 112 222 392 635 964 1392 1932 2597 3400 4354 5472 6767 8252 9940 11844 13977 16352 18982
+2 7 24 61 126 227 372 569 826 1151 1552 2037 2614 3291 4076 4977 6002 7159 8456 9901 11502
+12 11 22 60 158 379 821 1618 2953 5122 8728 15159 27666 53731 110255 234858 510014 1112985 2415218 5172306 10872818
+17 24 49 120 294 677 1456 2952 5715 10719 19792 36560 68444 130715 254454 501802 994701 1968430 3870295 7539464 14530122
+25 40 65 122 253 535 1117 2293 4630 9184 17861 34010 63355 115342 204806 353380 588983 939636 1414390 1959381 2372399
+25 52 90 138 195 260 332 410 493 580 670 762 855 948 1040 1130 1217 1300 1378 1450 1515
+0 2 24 87 221 468 885 1547 2550 4014 6086 8943 12795 17888 24507 32979 43676 57018 73476 93575 117897
+19 32 61 117 214 369 603 947 1457 2242 3509 5629 9228 15307 25395 41739 67535 107204 166717 253973 379234
+23 32 38 44 60 103 197 373 669 1130 1808 2762 4058 5769 7975 10763 14227 18468 23594 29720 36968
+4 11 19 35 76 180 439 1069 2539 5797 12662 26510 53500 104832 201057 380617 717363 1357502 2598934 5062820 10063437
+10 19 23 14 -24 -121 -314 -610 -897 -761 888 6598 22021 59353 144459 331532 733040 1580211 3343069 6963206 14293206
+3 17 48 105 201 354 600 1028 1847 3495 6800 13203 25053 45984 81384 138966 229451 367373 572016 868493 1288977
+-4 -3 10 49 132 289 583 1147 2252 4449 8873 17855 36050 72341 142802 274973 513588 927669 1618516 2727541 4442064
+19 39 74 133 236 422 765 1415 2696 5313 10758 22099 45557 93732 192181 392487 797276 1606233 3197558 6267150 12058959
+-7 -10 -13 -16 -19 -22 -25 -28 -31 -34 -37 -40 -43 -46 -49 -52 -55 -58 -61 -64 -67
+21 44 74 122 221 432 849 1603 2865 4848 7808 12044 17897 25748 36015 49149 65629 85956 110646 140222 175205
+18 26 39 66 116 198 321 494 726 1026 1403 1866 2424 3086 3861 4758 5786 6954 8271 9746 11388
+21 40 78 164 356 766 1605 3259 6420 12322 23187 43106 79841 148586 279840 535679 1042583 2055644 4079972 8092520 15934162
+20 37 62 95 136 185 242 307 380 461 550 647 752 865 986 1115 1252 1397 1550 1711 1880
+0 2 15 48 121 283 642 1407 2942 5832 10961 19602 33519 55081 87388 134409 201132 293726 419715 588164 809877
+8 13 15 13 15 42 131 338 755 1592 3455 8105 20256 51423 127543 303162 686530 1482119 3060047 6065853 11589253
+12 30 59 93 125 157 214 361 722 1498 2987 5640 10262 18599 34737 67942 137708 281702 566759 1101727 2048287
+-3 10 49 127 264 492 863 1464 2440 4028 6633 11078 19417 37246 79490 183510 436575 1030078 2361565 5219525 11107638
+16 33 54 90 174 378 846 1849 3867 7702 14625 26559 46299 77769 126315 199032 305122 456279 667096 955488 1343124
+19 43 88 176 343 647 1194 2198 4111 7897 15598 31482 64323 131829 269087 544536 1090317 2160903 4249054 8320480 16296305
+22 41 67 112 212 447 969 2039 4084 7808 14445 26357 48398 90840 175255 345646 688410 1366499 2675535 5132758 9613680
+12 25 47 89 162 277 445 677 984 1377 1867 2465 3182 4029 5017 6157 7460 8937 10599 12457 14522
+5 0 -7 -1 49 197 534 1225 2596 5304 10634 21018 41034 79540 154415 302881 602927 1215420 2462671 4968277 9895903
+-9 -14 -15 1 65 237 627 1430 2974 5775 10594 18507 31038 50464 80459 127293 201992 324897 538038 942790 1811370
+2 4 0 -10 -11 41 233 709 1684 3458 6430 11112 18143 28303 42527 61919 87766 121552 164972 219946 288633
+7 26 67 150 317 656 1342 2714 5434 10819 21508 42739 84695 166680 324376 622208 1174037 2177180 3967333 7105608 12513901
+12 22 38 64 119 247 532 1123 2276 4424 8309 15295 28210 53572 107038 225653 493336 1090494 2385292 5093646 10548309
+14 12 10 19 59 159 357 700 1244 2054 3204 4777 6865 9569 12999 17274 22522 28880 36494 45519 56119
+2 14 43 115 280 632 1341 2710 5286 10076 18959 35465 66244 123814 231609 433008 806986 1494370 2740499 4962479 8852304
+16 36 82 165 307 556 1007 1841 3405 6374 12066 23034 44170 84820 163047 314653 612780 1210538 2432293 4964944 10250289
+10 8 10 20 58 188 557 1451 3382 7223 14402 27147 48738 83665 137509 216252 324578 462546 619794 766166 837338
+9 22 46 85 154 288 571 1200 2601 5616 11777 23672 45407 83249 146871 252546 431725 752582 1369644 2629419 5280540
+16 20 35 87 210 449 878 1653 3133 6129 12402 25663 53593 111897 232285 477770 971150 1946550 3840269 7447123 14183748
+22 44 94 197 405 821 1643 3250 6376 12465 24392 47913 94545 187207 371116 734593 1448530 2841203 5540681 10747619 20760527
+4 15 42 101 226 487 1024 2115 4318 8768 17778 36006 72647 145461 288069 563007 1084756 2059673 3853830 7105719 12909204
+15 23 48 115 271 611 1319 2724 5371 10107 18182 31365 52075 83527 129893 196478 289911 418351 591708 821879 1122999
+7 6 17 48 107 202 341 532 783 1102 1497 1976 2547 3218 3997 4892 5911 7062 8353 9792 11387
+-4 3 25 70 153 309 619 1270 2682 5750 12268 25628 51937 101824 193553 358902 655155 1190487 2177891 4048307 7684230
+-2 4 19 40 65 112 264 766 2210 5847 14057 30979 63235 120551 215877 364424 581237 878545 1269600 1800115 2661524
+18 30 45 58 64 58 35 -10 -82 -186 -327 -510 -740 -1022 -1361 -1762 -2230 -2770 -3387 -4086 -4872
+8 20 59 143 292 523 844 1247 1700 2138 2453 2483 2000 697 -1826 -6077 -12688 -22432 -36241 -55225 -80692
+11 12 8 -7 -28 -26 65 361 1041 2360 4662 8393 14114 22514 34423 50825 72871 101892 139412 187161 247088
+6 6 19 54 113 189 264 307 272 96 -303 -1028 -2205 -3985 -6546 -10095 -14870 -21142 -29217 -39438 -52187
+26 40 63 112 222 455 906 1708 3036 5116 8278 13187 21602 38439 76677 167925 383519 874229 1941697 4162964 8603981
+12 19 31 58 110 209 412 843 1741 3551 7128 14215 28539 58216 120779 253209 531098 1103839 2256973 4519124 8840092
+14 28 47 71 102 153 266 539 1162 2462 4957 9419 16946 29043 47712 75551 115862 172768 251339 357727 499310
+19 22 38 89 208 457 958 1941 3833 7447 14380 27796 53861 104226 200137 378978 704206 1279303 2264473 3888958 6437241
+20 38 83 177 353 665 1204 2120 3650 6152 10145 16355 25767 39683 59786 88210 127616 181274 253151 348005 471485
+18 33 52 75 103 147 258 596 1573 4137 10313 24197 53757 114135 233848 466630 914030 1767831 3387708 6439669 12137157
+16 32 61 98 136 164 171 173 281 836 2678 7743 20501 51456 125378 299753 704238 1621680 3648963 8007452 17127734
+0 9 25 62 141 293 566 1037 1844 3286 6097 12096 25583 56164 124287 271914 582905 1221701 2506400 5046590 10003946
+-4 12 56 141 280 486 772 1151 1636 2240 2976 3857 4896 6106 7500 9091 10892 12916 15176 17685 20456
diff --git a/2023/10/10a.c b/2023/10/10a.c
@@ -0,0 +1,76 @@
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define N 1000
+
+typedef enum { EAST, SOUTH, WEST, NORTH } direction_t;
+
+int main() {
+ char map[N][N];
+ int i, j, k, n, s;
+ direction_t dir;
+
+ for (n = 0; fgets(map[n], N, stdin) != NULL; n++) ;
+
+ for (i = 0; i < n; i++)
+ for (j = 0; map[i][j]; j++)
+ if (map[i][j] == 'S')
+ goto found_s;
+
+found_s:
+ if (map[i][j+1] == '7' || map[i][j+1] == '-' || map[i][j+1] == 'J') {
+ j++;
+ dir = EAST;
+ goto found_direction;
+ }
+ if (map[i+1][j] == 'L' || map[i+1][j] == '|' || map[i+1][j] == 'J') {
+ i++;
+ dir = SOUTH;
+ goto found_direction;
+ }
+ if (j > 0 && (map[i][j-1] == 'L' || map[i][j-1] == '-' || map[i][j-1] == 'F')) {
+ j--;
+ dir = WEST;
+ goto found_direction;
+ }
+
+found_direction:
+ for (k = 1; map[i][j] != 'S'; k++) {
+ switch (map[i][j]) {
+ case '|':
+ if (dir == SOUTH) i++;
+ if (dir == NORTH) i--;
+ break;
+ case '-':
+ if (dir == EAST) j++;
+ if (dir == WEST) j--;
+ break;
+ case '7':
+ if (dir == EAST) { i++; dir = SOUTH; }
+ if (dir == NORTH) { j--; dir = WEST; }
+ break;
+ case 'F':
+ if (dir == WEST) { i++; dir = SOUTH; }
+ if (dir == NORTH) { j++; dir = EAST; }
+ break;
+ case 'J':
+ if (dir == EAST) { i--; dir = NORTH; }
+ if (dir == SOUTH) { j--; dir = WEST; }
+ break;
+ case 'L':
+ if (dir == WEST) { i--; dir = NORTH; }
+ if (dir == SOUTH) { j++; dir = EAST; }
+ break;
+ default:
+ printf("Error: dead path\n");
+ return 1;
+ }
+ }
+
+ s = (k+1)/2;
+
+ printf("%d\n", s);
+ return 0;
+}
diff --git a/2023/10/10b.c b/2023/10/10b.c
@@ -0,0 +1,156 @@
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define N 1000
+#define set(i, j, c) if (newmap[i][j] == '.') newmap[i][j] = c;
+
+typedef enum { EAST, SOUTH, WEST, NORTH } direction_t;
+
+char map[N+2][N+2], newmap[N+2][N+2];
+int n, si, sj, count[26] = {0};
+direction_t sdir;
+
+void printmap(char m[][N+2]) {
+ for (int i = 1; i < n; i++) {
+ for (int j = 1; m[i][j] != 'B'; j++)
+ printf("%c", m[i][j]);
+ printf("\n");
+ }
+}
+
+void color_rl(direction_t dir, int i, int j) {
+ switch (dir) {
+ case EAST:
+ set(i-1, j, 'L');
+ set(i+1, j, 'R');
+ break;
+ case SOUTH:
+ set(i, j+1, 'L');
+ set(i, j-1, 'R');
+ break;
+ case WEST:
+ set(i-1, j, 'R');
+ set(i+1, j, 'L');
+ break;
+ case NORTH:
+ set(i, j+1, 'R');
+ set(i, j-1, 'L');
+ break;
+ default:
+ break;
+ }
+}
+
+direction_t firstdir(int i, int j) {
+ if (map[i][j+1] == '7' || map[i][j+1] == '-' || map[i][j+1] == 'J')
+ return EAST;
+ if (map[i+1][j] == 'L' || map[i+1][j] == '|' || map[i+1][j] == 'J')
+ return SOUTH;
+ return WEST;
+}
+
+void advance(int *i, int *j, direction_t dir) {
+ if (dir == EAST) { (*j)++; }
+ else if (dir == SOUTH) { (*i)++; }
+ else if (dir == WEST) { (*j)--; }
+ else (*i)--;
+}
+
+direction_t newdir(int i, int j, direction_t dir) {
+ switch (map[i][j]) {
+ case '|':
+ case '-':
+ return dir;
+ case '7':
+ if (dir == EAST) return SOUTH;
+ if (dir == NORTH) return WEST;
+ case 'F':
+ if (dir == WEST) return SOUTH;
+ if (dir == NORTH) return EAST;
+ case 'J':
+ if (dir == EAST) return NORTH;
+ if (dir == SOUTH) return WEST;
+ case 'L':
+ if (dir == WEST) return NORTH;
+ if (dir == SOUTH) return EAST;
+ default:
+ printf("Error: dead path at (%d, %d)\n", i, j);
+ exit(1);
+ }
+ return EAST;
+}
+
+void walk_and_color_rl(char c) {
+ int i = si, j = sj;
+ direction_t dir = sdir;
+
+ newmap[i][j] = c;
+ color_rl(dir, i, j);
+ advance(&i, &j, dir);
+ for (; map[i][j] != 'S'; advance(&i, &j, dir)) {
+ newmap[i][j] = c;
+ color_rl(dir, i, j);
+ dir = newdir(i, j, dir);
+ color_rl(dir, i, j);
+ }
+ color_rl(dir, i, j);
+}
+
+void fill(int i, int j, char c) {
+ if (newmap[i][j] != '.' && newmap[i][j] != 'R' && newmap[i][j] != 'L')
+ return;
+
+ newmap[i][j] = c;
+ count[c-'a']++;
+ fill(i, j+1, c);
+ fill(i, j-1, c);
+ fill(i+1, j, c);
+ fill(i-1, j, c);
+}
+
+int main() {
+ /* Get input */
+ for (n = 1; fgets(&map[n][1], N, stdin) != NULL; n++) ;
+
+ /* Add borders, copy to newmap */
+ for (int i = 0; i < N+2; i++) {
+ for (int j = 0; j < N+2; j++) {
+ newmap[i][j] = map[i][j];
+ if (map[i][j] == 0 || map[i][j] == '\n')
+ newmap[i][j] = map[i][j] = 'B';
+ }
+ }
+
+ /* Find S and set the initial direction */
+ for (si = 1; si < n; si++)
+ for (sj = 1; map[si][sj] != 'B'; sj++)
+ if (map[si][sj] == 'S')
+ goto found_s;
+
+found_s:
+ /* Set the initial direction and walk the path mark it with X */
+ sdir = firstdir(si, sj);
+ walk_and_color_rl('X');
+
+ /* Replace the unnecessary pipe symbols with dots */
+ for (int i = 1; i < N; i++)
+ for (int j = 1; map[i][j] != 'B'; j++)
+ if (newmap[i][j] != 'X')
+ newmap[i][j] = '.';
+
+ /* Walk again the path and mark adjacent dots left and right */
+ walk_and_color_rl('Y');
+
+ /* Mark the remaining dots left and right */
+ for (int i = 1; i < n; i++)
+ for (int j = 1; newmap[i][j] != 'B'; j++)
+ if (newmap[i][j] == 'R' || newmap[i][j] == 'L')
+ fill(i, j, newmap[i][j] + 'a' - 'A');
+
+ printmap(newmap);
+ printf("r: %d\nl: %d\n", count['r'-'a'], count['l'-'a']);
+ printf("Check with the map printed above which one is 'inside'\n");
+ return 0;
+}
diff --git a/2023/10/in.txt b/2023/10/in.txt
@@ -0,0 +1,140 @@
+F--FJ77F-L7---J-F777-F7|77F|-J-F|77|F-L-J-77-L7FL77-7|----.F7-|-|.7-.-FL-FF-FF77.|.F-F-.F|.7.F.7-F-77.J7|----7LL7F|7|-F-J-777-77.F-7-FL77FF|
+F7FJ.LF-7JJ||.JF-J-7F-FLJJ|F7JFL|LJ.|.|7LFF-J|J-L7LJFJF||.F.FFJFF7L7.L-JF7.FLL-FJ-J7F|L-7|F7.7-|.J7|F-7LJ|FFL7J-77||LF-JJ|L7JLLJLL--F7|.LFFJ
+LL7|7FJFJ7L--LJ|.LF7--|JJL-.|7FF-7.LJ-LLJFLJL|.|.LJ||.7JF-7F|L-|J|L7F||LFJL|.7J|LJ.--77|.LLFF77||7F|JLF-77-|7F7LFJLJ-FJJ-7FLL7J.|7|7.L.FLF77
+||FJ--.F-7FL7JJL7.|JL-LF777FFF7|-FJJ.L||--JF7JLL|777LL-.|FLL|.|J.|L|-L7.LFL7-JF7F77..L7F7JF7|L77JLFJJ.L7|LLJJJLFJFJJ.JJJ.L7.||FLFFF7F|FJ-||F
+||JJF|-J7L|.LJ7..-J.|JL||F7F7JFF-7J.7|F7J-L|J-|-J7-7-|.FFL7LJ77|FJ7|JLJL--.||L|FFJ--LLJJFF|LJFJ77.||..F7J7FF|L7JF|J777|-|JJF|J7.L|.|FLF7FFJ|
+|J|-|7JF77L-|JF-7J-7J-||LJLJL--7.|FF77|||..LF7-7L77F--L77L|FF|L77LFF-7JJFLFF7|F7-J-LF|7F-7L-7|7F7.F77F-7FL|77F7LFJ-JFLJFJJ-LJJ|L.|FF-7FL7JFJ
+|LJJ||LL|77F|JLF7|FL-F7L-7F7F7FJF-7||-||77.F|.FL7|7LF7|L7|LF7JLJ|F-||JL-7|F|L-J|JJJ.FF-JFJF-JL7|L7||7L7L-7.FJ|J|LJ7.|.J|..FJ|L7.-7JLL||L-.JJ
+|F|LF7.||-FJ||.L7-|.F|L--J|LJLJ-|FJ||L||F7F7777L|7F7FF7J|F7||7.FF|F|JL7J-F.L7F7|F7F7JL-7|-L-7FJ|FJ||F7L7FJ7|.|LL|FL--F-L7FF-|FJ-L|.-.L-7-FL7
+L-F---|7.FLJJF||L...|L---7L7F7.FJL7||FJ||LJ|F77FFF7F7|L7FJ||L--7F-7-7-J7-|7LLJ|LJ|||JFL||F7F|L7|L-J|||-||F7F|J7FLJ-7-7-LF7LF|7JF-JL77LLL7.|J
+J7F7JL|LFL-JJF77|-F-----7|FJ||7L-7||||FJ|F-J|L7F7||||L7|L7||F--JL7|-F7L7.|7FF7L7FJ||F7FJ||L7L7LJF-7||L-J||L-77L-J|-F-LF7.77L7J.|F7L-7-|JL|L|
+.|L|FJ..LLL.FF-77F|F---7||L7|L-7FJLJ||L7|L-7|FJ|||LJL7|L7|LJL7J|FJL-J|J||LFFJL-JL-J|||L7||FJ7L-7|JLJL7F-JL7FJ-|J7LF77|||-L.LL|F.LJLL|7-7LL-J
+-.|LJ||-F7|FJ.FF7.LJJF7|LJFJ|F-JL-7FJL7LJF-J||FJ|L--7|L7|L-7FJ.FL7F--JF7J.FJF7F---7LJL7|LJL-7-FJL7-F7|L---J|JF7LF-JLFF7||L-F--JF7|.LL77|JL-|
+LLJ.LLJFJJ-7-FF||.J|J||L-7L7|L--7FJL-7L-7|F7|LJFJ7F-JL7||F-JL-77F|L---J|-FJFJLJLF-JF--J|F7F7L7|F7L7|||F----J.||7FFL7F7FJ7JFL||||LJ..L|7J|FF7
+.||-.L|-|7.J7F-J|7--FJL-7L7||F--JL7F-JF-JLJLJF7L-7L--7|||L--7FJF7|F----J.|FJJLF7|F7|LF7||LJL7|LJL7||LJL7F--77||-F7.F7-JF7.-7L777.FF7F.L7--||
+-|7.|||JLF7.FJF7L77.L--7L-JLJL7F--JL-7L--7F7FJL--JF7FJ||L7F-JL7|LJL-7F-77LJ7F7||LJ|L7|LJL7F-J|F--J||F--JL7FJFJ|FJL-J|7JFJ.L777JF7-J--JFJ7|.7
+F77FFF---L7-L-JL7|77LF-JF7F7F-JL----7|F-7||LJF7F7.||L7||FJL-7FJ|F7F7LJFJF7|FJ|||F-JFJ|F--JL--JL-7FJ|L-7F7|L7|FJL7F--J---7L7FJ|FLL7.F|LLJ7L7|
+|J|7.F7|.F-.|FF-J|F7LL--J||LJ7F-----J|L7|||F7|LJL7|L-JLJL-7FJL7||LJL--JFJL7L7|||L-7L7|L------7LFJL7|F-J|||FJ|L-7|L-7||-J7L7.FFJL|LJ-L7.|77L7
+JF||7|F|7.|7|FL-7|||F7F--JL--7L--7F-7|FJ||||||F--JL----7F-JL-7||L--7LF7L-7|FJ||L--JFJ|F------JFJF7||L7L||||-L7FJ|F-JF7.|F-J7L|FF7-JJ-7--.|J|
+F|LJ-|.|LFLJ|77FJLJLJ|L--7F--JF7-||FJLJFJ|||LJL-7F7F7F-J|F7F7|||F--JFJ|-FJLJFJL---7|||L-7F---7|FJ||L7L-JLJ|F-J|FJL7FJ|7F7.F|||FF|LLJ.||.LJJF
+7J.F7J7---J.LLFJF---7|F7FJL--7|L7LJL-7FJFJ||F---J||||L-7||LJLJ||L--7L7L7L--7L7-F7FJL-JF-JL7F-JLJFJ|-L7F---JL7FJL7FJ|FJFJ|.F77JFFF.FFF7F-JL7J
+F777.LF-JJ7F7LL7|F--J|||L7F--JL7L7F--JL7L7|||F7.FJ|||F7||L---7||F--J-L7|F7J|FJFJ|L-7F-JF7FJL7F7FJFJF-JL---7FJL7FJL-JL7L7|FJL77FJL.F7.7JJ.|J7
+|F-J--7|.FJ-F7L|||F-7LJ|-|L7F7-L7|L--7FJFJ||LJL7L7||||||L7F--J||L--7F-J||L-JL-JFJF7|L7FJ|L-7|||L7||L7F----JL7FJ|F7F-7L-JLJF-J-J-J.||FJ|.F7.|
+LLJ7FF-77|7-L|L||||-L-7L-JFJ|L-7|L7F7||.L7LJF--JF||||||L7|L--7LJF--JL-7|L----7FJ-|LJFJ|FJF-S|||FJ|F7||F-7.F7|L7||||FJF----JFF7J|FFLJJ7L-FJFJ
+.FLF-LJ--LL7FF7LJ||F--JF-7|FJF-JL7|||||F7|F7|F7F7||||||FJL7F7|F-JF7F7FJ|LF7F7||F7|F7L7|L7L-7|||L7||||||FJFJLJFJ||LJL-JF7F7LF||-.JL|-L-7||||J
+LF7L|.|LLJJLFJL-7LJL--7|.|||FJF7FJLJLJ|||LJ|||LJLJ||LJ||F7LJ||L7FJ|||L7L7|LJLJLJ|LJ|FJ|FJF-JLJL7|LJ||LJ|FJF-7L-JL---7FJLJL-7||..|7..F-J7-||.
+F|7F-F---J.|L-7FJ-|JF7LJFJLJL-J|L---7FJ||F7|LJF7F7|L7FJLJL7FJ|FJ|FJ|L7|FJL----7FJ-FJ|||||L-7F7FJL7FJL7FJL7|-L-7F----JL7F7F-J|L7.-7..JJ.J.77-
+-J||.|7|.F-FF7|L-7F-J|F-JF--7F-J-F--J|FJ||||F-JLJLJFJL--7J||FJL-JL7|FJ|L7-F7F-J|-FJFJFJ|F-7||||F-JL7J||F7|L--7|L-7LF7.LJ|L-7|FJ7JLF.|-||FL-7
+|-F--F77-77FJ|L7FJL-7LJF7|F-JL--7L--7||FJ|LJL7F7-F7L--7FJFJ|L-7F7FJ|L7L7|FJ||F7L7L7L7L7LJFJLJ|||F-7|FJ||||F--JL--JFJL-7FJF7||L--7.|-J7LL7-|7
+L||-FJ||LF-JFJFJ|F--JF-JLJL-7F-7|F--JLJ|7L-7FJ||FJL7F7|L7L7L--J|||FJFJL||L7|LJL7L7|FJ-|F-JF7J||LJFJ|L7||LJL7F7F--7|F--JL7|LJ|F--JF|||||-LFF7
+F|7.JL-F-JF7L7L7|L---JJF----JL7LJL----7|F7||L-J||F-J||L7L7|F---J||L7L7FJ|L|L7F-JFJ|L7FJL--J|FJ|F7L7|L||L-7FJ|||F-J|L7-F7|L--JL----7J77FF-J|L
+-JL7JFLL7FJL7L-J|F----7L-----7|F77F7F-J|||FJF--J||F7||LL7LJL---7LJJL7|L7|FJFJL-7L7|FJL-7F--JL7||L7|L7||F7||7||||F7|FJFJLJF-7F-----JJL|JL77FJ
+.J.|-J..LJ7LL7F-JL-7F7L------JLJ|FJ|L-7||||FJF7FJ|||||F7L-7F---JF--7||J|||FJF7|L7|||F7FJL7F-7|||FJL7||LJ||L-J||LJLJL-JF7FJFJL-7.L-|F-7.LJJ.|
+|FFJ7.FF7F7F-JL7-F7LJL--7F7F---7|L7|F7|LJLJL-J|L7||||LJ|F-J|F7F7L-7LJL7|||L7||F-J||||||F-JL7||LJ|F7|||F-J|F--J|F---7F7|LJ7L-7FJ7||FFJ.F7FJ--
+-|7|F7FJLJLJF-7L7|L7F---J|||F--JL-JLJ|L7F-----JFJ||||F-JL-7LJ||L7FJF--J|||FJ||L-7LJ|||||F7FJ|L-7|||||||F7|L7JFJL--7|||L-7-F7||-F-LJL|7|-|-L|
+.|F-JLJF----J-|FJ|FJL--7FJLJL7F-----7|-||F7F7F7L7|||||F7F7L7FJL7|L7|F7L||||-||F7L-7|||||||L7|F7|||||||||||FJFJF7F-JLJL7FJ|||||J|7J|.LJJ|||F|
+FLL-7F7|F7F---JL7|L7F7FJ|F7F-J|F7F--J|FJ|||||||FJ|||||||||FJL-7||FJ|||FJ||L7||||F-J||||||L7|||LJ||||||||LJL-JFJLJF7F7JLJ-FJ|LJ||7--JJ|-7F||J
+||7.LJLJ|LJF---7LJFJ||L-J||L--J||L--7||FJ|LJ|||L7||||LJLJ|L-7FJ|LJJ||||FJL7|||||L7FJ|||LJFJ||L-7||LJ|||||F7F-JLF-JLJL-7F7L7|F-7JJ|.LF|7.-L|-
+F7-F-7F7L--JJF-JF-J7||F--JL--7FJL---J||L7|.FJ||FJ||||F7F-JF-JL7L7F-J|||L7FJ||LJ|FJ|FJ|L7JL7||F-J||F-J|||FJLJ.F7L7F----J|L-JLJFJJ-FL7L-F7J.|.
+F77L7LJ|-F7F7L-7L7F7|||F7F--7|L7F---7||.|L7|FJ||FJ||LJ|L-7L--7L-JL-7|LJ7|L7|L-7||FJL7L7L-7|||L77LJ|F7|||L----JL-JL----7L7F-7FJF7JFJL7|||FF|J
+|L--JF7L-JLJL-7|FJ||||LJ||F-JL7LJF7FJ||FJFJLJFJ|L-J|F7L7FL7F-JF----JL--7|FJL7FJ||L7FJ.|F7|LJL7L-7JLJ||LJJF-7F--7F7F7F7L7LJFJL-JL-7.L7F-|-FJJ
+|F--7||F7F7F-7|||FJLJ|F7LJL7F7L7FJLJJLJL7L-7-L7|F--J||FJF-JL7FJF7F7F-7FJ||-FJL7||FJ||FJ||L-7FJF7L-7FJ|F--JFJL-7||||||L7L7FJF-7F--J7FJ|LL-|J.
+LJF-J|||LJLJFJLJ|L-7FJ|L7F7LJL7LJF--7F7FJF7|F7LJL7F7||L7L7F7|L-JLJ||FJ|7|L7|F-JLJL7L7L7||F-JL7||F-J|FJL--7L---JLJ||LJFJFJ|FJ7|L-7J|-L-7J|F77
+FFJF7|LJF7F-JF-7L--JL7|FJ|L7F7|F-JF-J||L-J|LJL--7|||||FJFJ|||F7F-7||L7L7L-J|L---7FJFJ7||||F7FJ||L7JLJF7F7L7F7F7LFJL-7L-JF|L-7L-7|F7J|LF77J-J
+FL-J||F-JLJF7L7L7F--7||L7L7||LJL7|L--JL--7L7F---JLJ||||.L-JLJ||L7LJL7L7L-7-L----JL7L-7LJ|LJ|L7|L7L-7FJLJL-J|||L7L7F7L-7F7|F-JF7LJ||JL-|LJ.|J
+7FL|||L--7FJL7||LJF7|||FJFJLJF-7|F------7L7|L----7FJ||L7F--7FJL-JF7FJFJF7L-------7|F7|F-JF7|L|L7|F-JL7F----JLJFJL|||F7LJLJL-7||F7|L7J|L77FL7
+|7JFJ|L||||F-J|F--JLJLJL-JF7FJ|LJL-----7L7|L7F---JL-J|FJL-7LJF7F7|LJFL7|L-7F-7F7FJ|||||F-J|L7L-J|L7F-J|F------JF7LJLJL-7F---J|||||FJ|F--|J7.
+L7-|FJF|FJ||F-JL-7F7F7F7F-J||JF---7F---JFJ|FJL-7F7F-7||F--JF-JLJ|L-7F-JL-7||7|||L7||||||F-JFJJF7L-JL--JL-------JL7F7F-7LJF---JLJ|||F7|||LJF7
+L|-LJFJ-L7|||F---J|LJ||||7FJL7L-7FJL-7F7L-JL7F7LJLJFJ||L7F-JF---JF7|L7F7FJ|L7||L-JLJLJLJ|F-JF-JL--7FF7F---7F-----J|||FJFFJF-----J|LJL7JFLFL-
+.|.|||JJ|LJLJL7F-7|F7LJLJFJF7|F-JL--7LJL-7F7LJL--7FJL||LLJF-JF7F7|||FJ||L7|FJ|L----7F---J|F7|F7F-7L-J|L--7LJF-7F7FJ|||F7L7L---7F-JF7FJ.7.|L|
+--J-LJF-F-7F7FLJFJ||L----JFJLJL7F--7L7F-7LJL---7||L-7LJF--JF7|LJ||LJL7|L7||L7L7F--7|L7F-7||LJ|LJLL--7L--7L--JFJ|||FJ||||-L7F--J|F7|LJJ7F7J-7
+F7.|7.JLL7LJ|F7-L-JL-----7|F---J|F7L7LJ|L---7F7L7L--JF7L--7|||F-JL-7FJ|7LJ|FJFJL7FJ|F||FJ||F7L7F----JF-7L----JJ|LJL-J|||F-JL---J||L----J|.--
+LLFF-F7F7L-7LJL7F7F------J|L----J||FJF7F---7||L7L----JL7|FJ|LJ|F-7FJL7L--7|L7|F7|L7|FJ||FJLJL-JL--7F7|FJF---7F7L7F---J||L7F----7||F7F-7FJ-LJ
+L--|FJL|L--JF-7LJLJF7F-7F7|F----7|LJFJLJF7FJLJ7L7F--7F7L7|FJF7||L|L-7L7F7||FJ||LJJLJL-J||F7F-----7LJLJL7|F--J||FJL--7FJL-JL7FF7LJLJ|||||...|
+||LL77LL-7F7L7|F-7FJ||J||LJL---7|L--JF--JLJF7FF7|L-7LJL-JLJFJLJL7L7FJFJ||||L7|||F---7F-J|||L----7L----7LJL---JLJF---JL7F--7L-JL---7||7LJF-7F
+7J7LLF.L7||L-J||FLJ7LJFJ|F-7JF-J|F7F7L-----JL-J||F7L7F7JF7LL-7F7L7LJLL-JLJ|FJ|L7L-7FJL-7||L-----JF---7L--------7L-----JL-7|F------J|L-7----7
+LL7JF|F.FJ|JF-JL7F-7JFJFJL7L-JF7LJLJL-----7F7F-J||L7LJL-JL7F-J|L7L7F7JF--7|L7|FJF-JL---J||F------J7F-JF-------7|F7F------J|L---7-|L|F-J7-F-L
+.FL-FJJFL7||L7F-JL7L-JFJF7L---JL---------7||LJF7LJFL-7F-7FJL-7|FL7LJL-JF7||FJ||.L7F----7|LJLF7F----JF-JF7F7F7FJ|||L--7F--7|F7F-JF77|L7----.L
+F-LJ.|.LFJ|-JLJF--JF7FJFJ|F7F77F-------7FJLJF-JL7F7F7|L7||F-7||F7|F7F--JLJLJLLJ-JLJF7F7LJJF-J||F--7FJF-JLJLJLJFJ|L7F7LJF7|LJLJF-JL7L7|7.|LJJ
+-.|FL-7|L-J7|F7L-7FJLJ7L7LJLJL-JF7F7FF7|L--7|F--J|||||FJLJL7|LJ|LJ||L7F7F7J|.|LLFFFJ||L7F7L-7|LJF-JL7L----7F-7L-J7||L7FJLJLF7F|F--JFLJJ7.F|J
+|-F-JF|-F7F--JL7FJ|F---7L-7F7F7FJLJL-J|L7F7LJL---JLJ||L--7FJL--JF7|L7LJLJL-77F77F7L7||FJ||7FJL7JL---JF7F--J|FJF7F7|L7||F7F7|L-JL---7J|7|FL-7
+FFL7L7J7||L-7F-J|FJL7F7L--J|||||F-----J|||L--7F7F-7FJL7F-JL----7||L7L7F7F7FJFJL-JL7|LJL7||FJF7|F7F-7||LJF--JL7||||L7||LJLJLJF---7F7L-7-L-J||
+--7LF-7F||F7||F7LJ7-LJL--7FJLJLJL7F----7|L--7||LJ7LJF7LJ.F7FF77||L7L7||LJLJJL----7|L-7FJ||L-J||||L7L7L--JF-7FJ|||L7LJL7F---7L--7|||F-JLL|--J
+L7|.|L-FJLJ||||L7F7FF7F--J|F7L|F7LJF---JL-7FJLJF----JL7FFJL7|L7LJ-|FJLJ.LJ7L|F--7|L--JL7|L77FJ|||.|FJF7F7L7LJFJLJFJ.F7LJF-7|F7FJLJLJJJ7F--J|
+|LJ|L7JL--7LJLJFJ||FJ|L--7||L7FJL--JF--7F7LJF7FJF7F--7L7|F7LJFJLF-JL---7-FF-7L-7|L----7|L7L7L7|||FJL-JLJL-JF-JF7FJF7||F7|FJLJ|L--7LJ..FLJLL7
+LJ77-L7||FJF7F7|J||L7L---J|L7LJF----JF-J|L7J|||FJLJF7L-J||L--J7.L7F7F--JFLL7L--JL--7F7||LL7|FJ|||L---------JF-J|L-JLJLJLJL--7L---JL|7|7.7|F7
+|.F77.-J7|FJLJ||FJL7L-----J-L--JF----JLFJFJFJLJL-7FJL7LFJL7.F-777||LJ7|-F||L---7F-7LJLJL--J|L7LJL---------7FJF7|F-7F7F-7F7F7L---7J.|J.L7||J|
+L7|L7FJLF||-F7||L-7L7F----7F7F7LL------JFJ-L7F---JL7FJFJF7L-JFJF7|L-7-77L7FL-F-J|.L7F---7F7L-JF-7F-------7|L-J|LJ-LJLJ|||LJL----JLFJ-7.FJ||L
+L7J-LLFF-J|FJ|||F-JFJL---7||LJL7F-------JF7FJL--7F7|L-JFJL---JL|||F7|-77LLJ|.L7FJF-J|F--J|L---JFJL-7F----JL---JF7JF7-F7|L-----7F77JL-J-L-FFL
+-J-|JLL|F7|L7LJLJF7L-7F7FJLJF-7|L--7F-7F7|||F---J|LJF--JF7F----J|LJLJF7FF|J|FFJL7L7FJL---JF7F-7|F7FJL7F--------JL-JL-J||F--7F7LJ|7.|-FL|7J.|
+L.F.F-JLJLJJL7F-7|L-7||||F--J7||F7FJL7||LJLJ|F7F-JF7|-F7|||F---7L-7JJ7|||.LJFL--JFJ|F7F7F7||L7|LJLJ.FJL7F-----7F----7FJ|L-7LJ|F7L777-L|JL77.
+FFL-J-F7J|JJ|||.LJF-JLJ|LJF--7||||L7FJLJF-7FJ|LJF7|LJFJLJ|||F77L--J|JL7F-.|.|LLF7L-J|LJLJLJL-JL--7F-JF7|L-7F7FJL---7|L7|F7L-7LJL-J-JF-7-J.F7
+J..FF-JL7F7F-J|F7FJF7F7L-7|F7LJLJL-J|F7FJFJL-JF-J|L-7|F--J|LJL7F---7--7J--F7L-FJL---JF7F7F7F---7FJL-7|LJ|FJ|||F7F--JL-JLJL--JJF-7L|.|||FLFF7
+.FFFL--7LJ|L--J||L7|LJL7FJLJL7F-7F--J|LJ||F7F7L-7L--J|||F-JF--J|F--JFFJ7.|.F77|F-----JLJLJLJF--JL---J|F--JFJ|LJ||F--7F-7F7F7F7|FJ7J.-7-F7L7J
+|-LJ|JL|F7L---7||-LJF--J|F7F-JL7LJ7F7L-7FJ||||F-JF--7|L-JF7L---JL-7F7|7LJJFLFFJ|F-----7F----JF7F7F-7FJL---JFJF7LJ|F-JL7LJLJLJLJ||.7FL||L|7.L
+L7.F||.||L-7F7LJ|F-7L--7|||L---JF--JL--JL-J|||L--JF-J|F--JL-7F-7F-J||F7J|J|J|L7|L-7F-7|L7F7F-J|||L7LJF-----JFJL-7||F7L|F7F7F7F7|7F777|F.L|||
+FL7FF7-LJF-J|L-7LJFJF--JLJL---77L---------7LJ|F7F7L--JL----7|L7LJ|7|LJL---7|F.||F7LJFJL-J||L7FLJ|FJF-JF--7F7L7F7LJLJL-J|LJLJLJLJFJ|7LL|F-FLJ
+LLL|JFJ|JL--JF7|F7L-JF7F7F7F-7L-7F--------JF7||||L7F--7F--7|L7|JF--JF---7FJ7L-LJ||F-JF---JL-JF--JL7L--JF7LJL-J|L-7F7F--J.F7F7F-7|FJ.-.LL7|.|
+.|.L-|-F--7F-JLJ|L-7FJ||LJLJLL-7|L-7F-7F---J||||L7|L-7|L-7||LLJLL--7|JF7LJ7|7|F-J|L--JF---7F7L----JLF7FJ|F----JF7LJ|L----JLJLJFJ||F7.7-L|--F
+|-.L-|LL-7|L7F7FJF-JL7||F----7FJL--JL7LJF---JLJ|FJL7FJL-7|LJLF7.|JFJL7||F7F--7|F7|F-7FL7F7LJL----7F7||L7|L---7FJL7FJF-7F---7F7L-JL-77|J7L.|J
+-.7|.|FF-JL-J||L7L7F-J|||F7F7LJF-----JF-JJF--7LLJF7|L--7||F-7||7F7L7FJ||||L7FJLJ|LJFJF7LJL------7LJLJ|-|L---7LJF-JL7|JLJF7J||L7F---JJ.|LJ-F7
+.L|J--7L7F-7FJL-J7||F7LJLJLJL7FJF----7L7F7|F-JF77||L---J|||FJ||FJL-J|FJLJL7|L7F-JF7L-J|F--------JF--7L-JF--7L--JJF7LJF7FJL7LJFJ|F--7.FLLJFF7
+F||LF.|7||F||F--7FJ||L7F---7FJ|7L---7L7|||||F7|L-JL----7LJ||FJ|L---7||F---J|FJL--JL7F7|L-7F-7F7F7|F-JF--JF7L-----JL-7|||F7L7.L-J|F-J-.|.L|.|
+.LJ-J-77LJFJ||F7LJFJL7|L-7FJL-JF----J7|LJLJLJLJF---7F--JLFJLJFJF7F7|||L-7-FJL-7FF7L|||L7|LJFLJLJLJL--JF--JL--7F-----J|LJ|L-JF7F-J|L|J.-7-LFJ
+L|J.JF|F|LL7|LJL--JF7||F-J|F7F7L-----7|F7F7F7F7||F7|L7.F7|F--JFJLJLJ|L7FJFJF--JFJ|FJ|L7L7F7F--7F-7F7F7L--7FF7LJJF----JF7L---JLJF-JF77|LL.F||
+||F77LJ---L||-F----JLJLJF7LJLJ|F7F7F-JLJLJLJ||||FJ|L-JFJLJL--7|F---7|7|L7|FJF7||FJL7|7L7|||L-7|L7LJLJL7F7L-JL7F7|F-7F-J|F7F-7F7L--J|J.F|.-FL
+|.L-|-LJL|7LJFJF7F7F-7F7|L7F-7LJLJLJJF7LF7F7LJLJL7L7F7|F--7F-JLJF--JL7|FJ||FJL-JL7FJ|F-JLJ|F-J|FJF7F-7LJL---7LJLJL7|L-7||||-LJL----J-7LJ7FJ|
+FJ.||L|.LJFLFL7|LJLJFJ||L7||FJF7F----JL-JLJL--7F-JFJ|||L-7LJF7LFJF-7FJ||FJLJF----JL-J|F7F7LJF7LJFJLJJL-----7|F7F7FJL7FJLJLJF7F7F-7JL7.FL|JJ7
+7J.-7.L-F|J.F7LJF---JFJ|FJLJL-JLJF7F----------JL7FJ7|||F-JF-J|FJFJFJL7||L7F-JFF7F7F77LJLJL7FJL7FJF7F------7|||||||F7LJF--7||LJ|L7|F-7-F.LJ-L
+F77-|F|F|||F|L-7L---7|7LJF-----7FJLJ7F--7F7F7F7FJ|F-JLJL7|L-7|L-JLL-7LJL-JL--7||||||F7FF--J|F7LJ-||L-----7LJLJLJ|LJL-7L-7|FJF7L7|LJFJ.|7L7FJ
+L||.77F|J-F-L-7L--7FJ|F7-L----7|L----JF-J||||||L7||F---7L7F-JL7F---7L--7F--7FJ|||||LJL7L--7|||FF-J|F7LF7FJF7F7F7L----JF7|||FJL7LJF7L7F--.|-J
+..L-L|7JF7FJJLL--7|L-J|L7F----JL-7LF--JF7|||LJL-JLJ|F77L-JL-7FJL7F7L---JL7FLJFJ|||L--7L-7|LJ|L-JF-J|L-J|L-JLJLJL-7F--7|||||L-7L7FJL-J-JF7J-|
+FJ7L|.F.|JL-F-7F-JL--7|FJL------7L-JF--JLJLJF7F---7LJL7F7F--J|F7LJL-----7L7F7L7|||F-7|F-JF7|L--7|F7L--7L------7F-J|F-J|||LJF-JFJL-77||FLF.FL
+FLL-FLJF77FFL7LJF7F-7|||F7F7F7F-JF--JF-7F-7FJ||F-7L---J||L-7FJ||F7F-7F--JFJ|L7||||L7|||F7|L----JLJL7F7L------7LJF7|L--JLJF7L77L---JF7-77L-JJ
+J7LF|---J|L--L7FJLJFJ||||||LJLJF7L7F-J-|L7LJ7LJL7L---7J|L7FJ|FJ|||L7|L--7L-JFJ|||L-JLJLJ|L----7F--7LJL-------JF-JLJF7F---JL7L------7LJJ7F||J
+LJ-J7FJ||L..7.LJF7-L7LJ|||L--7FJL-JL--7L7L---7F-JF-7FJFJFJL7||FJ||FJ|F7-|F--JFJ|L----7F-JF7F--J|F-JF7F7F-7F7F7|F7F7||L----7L7F-7F-7|JJ.-JJ-7
+F7|LL|||-7J-F---JL--JF7LJL---J|F7F----J7L--7FJL-7|7LJ.L7|F7||||-||L7|||FJL7F7L7L7F7F-JL7|||L--7|L7FJ||||-LJLJ|||LJLJ|F-7F-JFJL7LJLLJ.LL-|LLJ
+---F7||J-|J-L------7FJL7F7F--7||LJF---7F7F7LJF--JL-7F7FJ||LJLJL7||FJ||||F-J|L7|FJ||L-7FJFJ|LF7||FJ|FJ|||F-7F-J|L---7|L7||F7L7FJF-7.|7|..|77F
+L7LJ-L.LFFF--------J|F-J||L7FJ||F-JF7FJ|||L-7L---7FJ|||FJL7F-7FJ||L7||||L-7|FJ|L7||F7||||FJFJ|LJL-JL7|LJL7LJJFJF7F-JL-JLJ|L7|L-JFJ7F7.-7||7|
+.F-F.|J-|LL-----7F7FJ|F7|L-JL-JLJF-JLJFJLJF-JF7FFJL7|||L7L|L7LJFJL-JLJLJF-J||FJFJ|||||L7||L|FJ.F---7|L--7L---JFJLJF------JFJL--7|.L|.-7L-J.|
+-7JJF-.FLFLF----J|||FJ|LJF-7F7F-7L-7FFJF--JF-JL7|F7LJ|L7L7|FJF-JF7F-7F-7|F-J|L7L7|||||FJ|L-J|F7L--7|L---JF7F-7|F--JF7F7F7FJ||F7LJ--7F7F-JLF.
+|.|FJ.7JL|FL7F7F7|LJ|FJF7L7|||L7|F7|FJFJF7JL--7LJ||F-JLL7LJ||L--JLJFJL7LJL-7L7L7||||LJL7L--7||L7F-J|LF---J|L7|LJF7FJLJLJ|L---J|-||JL--LJ.-J7
+J.-L7--7JLFLLJLJLJF7LJFJL-JLJ|FJLJ|LJFJ|||F7F7L7FJLJF7F7|F7L77F7F7FJF7L7-F7L7|FJ|||L--7|F7FJLJFJL-7L7L-7F7L-JL7FJ|L----7|F---7L777||.LFJF|-J
+|7-LL-FJ.FFL|FF---JL--JF----7LJF-7L--JJFJ|||||L|L-7|||||||L-JFJ||LJFJL7L7||.||L7|||JF-J||||F--JJF7|FJF7LJL---7LJLL7F-7FJ|L--7|FJJ-JJFF-7|-7|
+FJJ|L|L-|7-LJFL7F7F7F7FJF---JF7|JL--7F7L7|||||FJF-JFJLJ|||F7FJFJL--JJJL7||L7||FJ||L7L-7||||L7F-7|||L-J|F7F--7|F-7LLJ-|L7L7F-JLJ|L---|J|||.||
+J|L|-7|.L|-||-LLJ||LJLJFL7F7FJLJF---J||.||||||L7|F7L7F-J|||||FJ|LF7.FF7||L7||||FJ|FJF7||||L7|L7|||L7F-J||L77|LJFJF7F7L-J7|L-7|LL7L7L7JF-J-F7
+F7-7-|77J|.FF7FF-J|F-----J|LJF--JF7F7|L7|||||L7|LJ|FJL7FJ|||||F7FJL7FJ||L7||||||FJ|FJ||||L-J|FJ|||FJL7FJ|FJFJF7|FJLJL7F77L--J--.F.J-L-7J|JLJ
+|JJLJJL7.|7|||FL-7|L---7F7|F7L---J||||L||||||FJ|F-JL-7||FJ|||LJ||F7||FJ|FJ|||||LJFJ||||LJF7J|||||LJF7LJFJL7L-JLJL7F--J|L----7JJF77FFLJ|.7..L
+J7|-|.LJJJ-F|7F7LLJFF--J||||L-----J|||FJ|||LJL7|L7F7FJ||L7|||F-JLJ||||FJL7|LJ||F7L7L7|L-7|L-JL7||F-JL--JF7L------JL-7L|F----JJ|||JLL..L-F-7.
+L|F-7-FL7J.L|-||F7F-JF7FJ|||F7F7F7FJ||L7||L--7||FJ|||7LJFJ|||L-7F7||||L-7|L7FJ||L-JFJ|F7||F7F-JLJL7F--7FJ|F-----7F-7L-JL----7F-JL777F-J.L|LF
+.J7LJ|FJ|J.F7.||||L--J|L7||LJLJ||LJFLJ-LJ|F--JLJL7||L--7L7|||F-J|LJ|||F7||FJL7||F-7L7||||LJ|L-7F--J|F-JL7|L-7F-7LJ-|F-------JL-7FJF7JL-J7|FF
+LFJJLLJF7LFJL-JLJ|F---JFJ||F---JL-7F-----J|F7|F7FJ|L7F7L7||||L-7L-7|||||||L7J||LJFJFJ|||L7LL7FJL7F7||F-7|L-7LJFJF-7|L-----7F7F7|L-J|7-|.7-|F
+FFJ..LFFJ|L7F---7LJF7F7L7||L7F7F7FJL-7F--7LJL7||L7|FJ|L7|LJLJF-JF7|LJ||||L7L7||F-JFJ.LJ|FJF7||F7LJLJ||-|L-7L7FJFJFJ|F7F7F7LJLJLJF--J7..FJJL|
+F-77---J77.LJF--JF7|||L7|||7LJ||||JF7LJF-JF-7LJL7||L7L7|L-7JFJF7||L-7||||FJFJ||L-7L---7LJ||LJLJ|FF--JL7|F7|.|L-JFJ|LJLJ|||F---7FJFJ..LJ7F--J
+J--7J.|J|L7LFJF--J|||L7LJLJF--J|||FJL--JF7L7L7F-J||7L7||F-JFJFJ|||F7|||||L-JFJ|F-JF7F7L7F-JF7F7L7L7F-7||||L7L7F-JJF7F-7|||L-7FJL-7F7-|.|-L7J
+|.-F7---7JF-L7|F--J|L-JF7F7L-7FJLJL7F-7FJ|FJ||L-7||F-J||L-7L7|FJ|||||LJ|L--7L7|L-7||||FJL7FJLJL7L7LJ-||LJL-JFJ|LF7|LJFJ||L7FJL7F7L7.||7|.FJF
+7-|J.|LLJF7FFLJL7F-JF--JLJ|F7LJF7F7||FJL7|L7FJF7|||L7FJL7FJFJ|L7||||L7JL7F7|.LJJFJ|||||LFJ|F--7L7L--7|L----7L7L-JLJF7L7|L7|L-7||L-J.F--7-J..
+|.77.J-LJ7F-LJJFJ|-|L--7F7LJL--JLJLJ||F7||FJL7|LJLJFJL7FJ|JL7|FJ|||L7L-7LJ||F---JFJ|||L7L7LJF-JFJF--J|F7F--JJL7F---JL-JL-JL--J|L7|L---LJJJ77
+-.L|--L-JF|.||-L7|-F7F-J||F7F---7F7FJ||||||LFJL--7.L7FJL7L-7|||FJ||J|F-JF-J|L--7FJFJ||FJF|F7L-7L7L-7|LJ|L---7-|L-----------7J7L7|77F|77J..FL
+.-.|L7F|JJLJ-7JFLJ.|LJF-JLJLJF7FJ|||-|||||L7|F7F7L-7||F-JF-J||||FJ|FJL-7L7FJ7F7|L7L-J|||FJ||F7|FJF7L--7|F---JFJF7F7F7F-7F-7L7JFLJJF-J-|-F-||
+-77L7L|J7.LJJJ|F|J-L7FJF----7|LJFJ||FJ|LJ|FJLJLJ|F-JLJ|F7L-7||||L7|L7F-J|||FFJLJFJF--JL7L7|LJLJL7||F-7||L--7FJFJ||LJLJFLJ|L-J-JJLFJJ--J-|-J7
+|7F.F7L-FF.L|L|7J.F-JL7|F7F7LJF7|FJ|L7|F-JL7F-7FJL--7J||L7FJ||||FJ|FJL--7|L7L7F7|7L-7F7|FJL7F7F-J||L7LJ|F-7|L7L7|L-7F7F-----7J.F7L.F7J.FL7.|
+L-|F7FLFJF7.-7L7-FL-7FJLJLJL7FJ||L7L7LJL-7FJL7LJF--7L7||FJ|.||LJ|FJL-7F7||FJ-LJ|L7F-J||||F7LJ|L7FJL7||FJ|FJ|7L7|L-7LJ||F----JLF-J7L-J|-FJ.LJ
+|FFLJJFLJLL-|77|.F-7LJ.F7FF7||F|L7L7L7F7FJL-7L-7L-7|FJLJL7|-||F-J|F--J|||||F---JFJL-7||||||F7L7|L7FJL7L7||FJF-JL7FJF7LJL-7|LL-.||77LF-F-L-.|
+LLF7|F7J.LJ.||L7FL7L---JL-JLJ|FJFJ.|FJ|LJF7FJJFJF-J|L-7F-J||LJ|F7|L-7FJLJ||L-7F7|F--J|||LJ|||FJ|FJL7FJL||LJFL-7FJL7|L7F7FJ-J||-LL77.J-||L|7J
+7JLJ||LL7-|7LJLL-L|F7F--7F--7|L7L7FJL7|F7||L-7L7L7FJF7||F7L7-FJ|||F-J|F--JL-7|||||F7FJLJJFJ|||-|L7-|L-7|L7F---JL-7|L7||LJ.LFF7.JJLJ.L|FF--J.
+L7.LL...|.|L-7|J7.LJ||F7LJF7||J|FJL7FJ||||L7FJFJFJL7|LJ|||FJJL7|LJL-7||F7F-7|||||LJ|L---7L7||L7L-JFJF-J|FJL-7F7F-J|FJLJ.|-F-J|77FLJ-JL-J..F|
+L77.FL.7--JL|F7-F---JLJ|F-JLJ|FJL-7||FJ|||FJL7L-JFL|L77LJ||JJ-LJFF7FJ||||L7LJLJ||7FJF7F7|FJ|L7L--7L7L-7||F7J||LJ.FJ|F7F-7FJLF77-|.|F-J.|.FF7
+FL7F-.LL|-|.LL--L--7F--JL----JL7F7|||L7|LJL-7L--7-||FJ-L7LJFFF---JLJFJ|||FJJ|LFJL7L7|||||L7|FJF--JLL7FJLJ||FJL7J-L7LJLJFJ7J||J|LLL7LJJ|7-J.J
+7-L77FJ.7.J7.|.L|LLLJ.LLF------J|||||FJL--7FJF--JL-LJJ7.7JF7-L---7F7|FJ||L-77L|F7|J||||||FLJL7L----7|L7JFJLJF7L7-JL7F-7|LJ|FJF-7|.|7..|7..|J
+LJF---..|7|LJ|7FJ.|FF|JJL----7F-J||LJL-7F-JL-JJJ|7L|JLF-|LF7--JLFJ|LJ|FJL-7|-FJ|LJFJ|||LJF---JF7F--JL7L7L7F7|L-JJF-JL7LJJ-FLFJF-L.L7..L-7FF7
+.F||7..F|--7-|-7.FFF|J|JF----JL7-|L--7-|||-L7|7FL7-|L7.FJ-F.F|J-|FJJJ||7FLLJJL7|7L|FJ||7.L--7FJ|L-7J||FJLLJLJJJ-F|F7FJL|JF7|.L|JJL-JF-FJL7FJ
+F|L-J|F-J|-|-|||7-FJL7|-L-7F-7FJFJF--J-LJ-7LF-7L77JL.7F|J-|-F|7-LJ7-FLJ-|JFJ.||L7-|||LJF----JL7L7FJJFJL777L|FJ7FLLJ||-FJ|LJF--J7F-FL|L|.F|LJ
+L7-.7J|.L|||---||J||FFL.J7LJFJ|-L7L--7F7JLJ7L-J|.||FL---F-J|L7-7J.L-7J|FF.|-7-L7L7LJ7LLL--7F7FJ|LJF-JF7|.||LJLFJ-|-LJ-|.L7F|||LFJF7LJ.7-LJF7
+L7-7|F-L7LJ||.L|JFFFJ7J-L77FL7L-7L7F7LJL7FJ-F|--7FL7J|..LJ|L7|F--FLLJ.F||FJJ|7LL-J-L|-F7|-|||L--7.L-7|LJ7LJ7|.|LJLF7FL--JF-.--J.|JJ.FFJF|.LF
+FJJ|F7F-7J.JJ-F7JLLJ.J-7F777J|F-J-LJ|F7FJJFFFJ||F-|7-F7.LLF-F|-J-F7-JF-L7LL.LF-LJJJLJJL7J-LJL-7FJ7|L|L7.|JJFF-JJ-LL|F7.|-J|FJJJ.L-F77|F-JL7|
+F7.--JJ-L-7LJJJL7L|J-LL7.F---J|F7F|-LJ||J.FF---F-||-7.77-.-FJ|7..JJJ.L7|-|.|-||L7JLLL-LJ||.J-LLJ7L7.L7|7J-7-FJ|..-7LLJF|J-F|.|LL77|.LJJ|-L-7
+|77|.LJ.FLLJ|F7J|FF7F7LJ-L---7LJ|-JFLFJL7-JJ|.L|FFJ--7.|L|7.-J-L77L7|J-L7.F7-J7F77-7F7FF|-JJ.|FL7-J7LLJ7JF--J|L--F|...F|7JF---FJ|7-7||LF7J7|
+F-J-7J|-||F77F|-|F|LJ|FJ.FLF-JF-J|-FLL--J-|-J7.FFJ|-J7F-7LJ-JJ|.||||.LFLF7JLL|||L--JJL|-7L|JFJ7.F7LJ7|J|||JF|FL7--LJJ7F|J||L|-J-|J.F-L-FL7FJ
+L-J.J.||.L7J.7JF|-|-|FF|7FLL--J-L77|-|J|FL7.FL--|-F7FJLL7-77J.F7L|-|7FJ-|L7-7.|L-7.FJJL||.|FFJJ-|J|FJJ--7|-|-7JF7|F7---LJF7.|7.L.|F|JL--J|7.
+|--7J-L7--FJ.LL-7LFJLL7--FFLL.L--FJ|--7---L-7L7-LFF|J-LL|.|7L7JL-L-FJLJ.J.L-FLJ7-J77JJ.L--L|--L-J--|-FJL|JJL7J--J-JJJ.L..L--LF|J.F|--F-JJL|-
diff --git a/2023/11/11a.c b/2023/11/11a.c
@@ -0,0 +1,39 @@
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define N 1000
+
+#define ABS(a) ((a)>0 ? (a) : -(a))
+
+uint8_t dr[N], dc[N];
+int64_t i, j, k, n, p, g[N*N][2];
+
+int main() {
+ char line[N];
+ for (i = 0; fgets(line, N, stdin) != NULL; i++) {
+ for (j = 0; line[j] != '\n'; j++) {
+ if (line[j] == '#') {
+ g[n][0] = i;
+ g[n++][1] = j;
+ dr[i] = dc[j] = 1;
+ }
+ }
+ }
+
+ for (k = 1; k < i; k++) dr[k] += dr[k-1];
+ for (k = 1; k < j; k++) dc[k] += dc[k-1];
+
+ for (i = 0; i < n; i++) {
+ g[i][0] += g[i][0] - dr[g[i][0]];
+ g[i][1] += g[i][1] - dc[g[i][1]];
+ }
+
+ for (i = 0; i < n; i++)
+ for (j = i+1; j < n; j++)
+ p += ABS(g[i][0] - g[j][0]) + ABS(g[i][1] - g[j][1]);
+
+ printf("%" PRId64 "\n", p);
+ return 0;
+}
diff --git a/2023/11/11b.c b/2023/11/11b.c
@@ -0,0 +1,39 @@
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define N 1000
+
+#define ABS(a) ((a)>0 ? (a) : -(a))
+
+uint8_t dr[N], dc[N];
+int64_t i, j, k, n, p, g[N*N][2];
+
+int main() {
+ char line[N];
+ for (i = 0; fgets(line, N, stdin) != NULL; i++) {
+ for (j = 0; line[j] != '\n'; j++) {
+ if (line[j] == '#') {
+ g[n][0] = i;
+ g[n++][1] = j;
+ dr[i] = dc[j] = 1;
+ }
+ }
+ }
+
+ for (k = 1; k < i; k++) dr[k] += dr[k-1];
+ for (k = 1; k < j; k++) dc[k] += dc[k-1];
+
+ for (i = 0; i < n; i++) {
+ g[i][0] += 999999 * (g[i][0] - dr[g[i][0]]);
+ g[i][1] += 999999 * (g[i][1] - dc[g[i][1]]);
+ }
+
+ for (i = 0; i < n; i++)
+ for (j = i+1; j < n; j++)
+ p += ABS(g[i][0] - g[j][0]) + ABS(g[i][1] - g[j][1]);
+
+ printf("%" PRId64 "\n", p);
+ return 0;
+}
diff --git a/2023/11/in.txt b/2023/11/in.txt
@@ -0,0 +1,140 @@
+...#...........#..............#..................................................#...................#...................#..................
+................................................................................................#..............#...........................#
+..................................#...................#.......................................................................#.............
+.......................#....................................................................#...............................................
+........#........................................................#.......#..................................................................
+..............................................#............#......................................................#.........................
+...............#.....................#...............................#...........................#..........................#...............
+....#...........................#................................................#.......................#..........................#.......
+............................................................................................................................................
+......................................................................................#......#..............................................
+............#.......#.......................#.....#...........#.............................................................................
+.........................#..................................................................................................................
+................................................................................................................#...........................
+..............................#.......#............................................................#.................#.................#....
+............................................................................................#...............................................
+.............................................................#.......#............#.......................#..............#.................#
+.......#....................................................................................................................................
+...............................................................................................................................#............
+...............#............#......#...........................................#.......#....................................................
+.........................................#................#.......#............................#.....#......................................
+...................................................#...................................................................#....................
+..............................................#.................................................................#..................#........
+...................#.......................................................................#................................................
+.#......................................................................#...................................................................
+.......................#.....#............#................#......................#.............................................#...........
+...............#....................#.......................................#................................#...........................#..
+............................................................................................................................................
+....................#................................................#...........................#.................#........................
+...........#....................................#...................................#.......#.........#.....................................
+..#...................................................#..................#.................................................................#
+..................................#...............................#........................................................#................
+..........................................................................................................#.................................
+......................................................................#.................#.......#.....................#.....................
+.......................................#..........#.........................................................................................
+......#........................#..................................................#.........................................................
+....................#.................................#................................................#.................................#..
+...........#...................................................................................................#............#...............
+...................................#.............................#.............#.................#.................................#........
+.............................#..........................................................#.................#..........#......................
+........................#................#..................#..................................................................#............
+...................#.....................................................#.......................................#..........................
+...................................................#.................................#...................................#..................
+..........#.............................................................................................#...................................
+......................................#.........................................#................#.....................................#....
+.....................................................................#..................#...................#...............................
+........................#..........................................................................................#........#...............
+.#...............................................#..........................................#.........#....................................#
+.............................#.............#..........#.....................................................................................
+..............#...................#..............................................#........................#.................................
+....................#.................................................#.....................................................................
+.................................................................................................#................................#.........
+....................................................#............................................................#..........................
+................#..........................................#.......#.....................#...............................#...............#..
+.....#................#.....................................................................................................................
+#...............................................#............................................#.............#....................#...........
+..........#.................#.............#............#....................................................................................
+.....................................................................................#......................................................
+..................#.................#....................................#......................#....................#......................
+.............................................................#................................................#.............................
+................................#.............#...................................#.......#.................................................
+.....................................................................#.........................................................#............
+...........#.........................................................................................#......................................
+.....................#..............................#.........................#.....................................................#.......
+..............................#.....#.......#.............................................................#.................................
+.....#................................................................................#...........#.............#...........#..............#
+................#...............................................#................................................................#..........
+#...........................................................................................#........................#......................
+..........................#.....#...........................................................................................................
+.........................................................#................#.............................................................#...
+......#............................................................................#........................................................
+.........................................#.........................................................#..........#.............................
+.....................#....................................................................#...............................#.................
+..................................................................................................................................#.........
+............#......................#.............................#.......#..................................................................
+...........................................................#...................#.............#........#....................................#
+#.......................................#........#..............................................................#...........................
+.................#..................................................................#.......................................................
+......................................................................................................................#.................#...
+............................................................................................................................................
+................................................................#.............................................#.............................
+......#.........................#........#............................#.........................................................#...........
+............................................................................................................................................
+.....................................................#.............................................#........................................
+.............#..........#.................................#........#........................................................................
+...................#.........................................................#.................#............#........................#......
+.............................................#.........................................#....................................................
+............................................................................................................................................
+.#.........#..........................................#....................................#................................................
+.................#...................#...................................#...............................#.......................#..........
+.......#..............#........#...................................................................................#........................
+................................................................#....................#...........#....................................#.....
+.........................................#.............................................................................#....................
+...#.....................#......................#............................#..............................................................
+...................................#..................................#......................#..............................#...............
+............#......................................................................................#........................................
+...............................#...........#................#....................#........................................................#.
+..........................................................................................................#.................................
+...........................#......................................#....................................................#............#.......
+...#.....#...............................................#................#...................#..................#..........................
+.............................................#................................................................................#.............
+...............#........#...................................................................................................................
+....................................#................#...............#.................#..........#.........................................
+..........................................#........................................................................#........................
+...........................#.....................#....................................................#.....................................
+.................................#.............................................................................................#............
+.........#.....................................................#...............................#............................................
+.............................................#............................#.............................................#................#..
+#..........................................................#........................#.......................................................
+.............#.......#................................................#.......#...................#................#........................
+..........................#................................................................................#................................
+.......................................#.......................................................................................#............
+......................................................................................#.....................................................
+.......................#.....#......................#...............................................................................#......#
+........#....................................#............#.............#...................................................#...............
+.................#................................................#...........#........................................#....................
+...........................................................................................#......#.........................................
+.#....................................#.........#...........................................................................................
+.......................................................#................................................#........#..............#...........
+...........#................................................................................................................................
+..................................................................................#.............#.....................#.....................
+............................................................#..............................................#........................#.......
+..#................................#.......#..................................#.............................................................
+.......................#.............................................................#.....#...............................................#
+.........#..........................................#..........................................................#............................
+................#........................................#...........................................#................................#.....
+...............................#........#.........................#.............#...........................................................
+.............................................#....................................................................#.............#...........
+....................................#........................#......................#...........#.......................#...................
+...................#.............................#.......................................#..................................................
+.............#..........................................................#...................................................................
+........#..................................................................................................#................................
+............................................................................................................................#............#..
+#........................................#......................#..................................................#................#.......
+.....................#.............#.....................#............................#.........#...........................................
+.....#.....................#................................................................................................................
+.........................................................................#..................................................................
+.............#...............................................#....................#..................................#........#.............
+........................#...........................#....................................................#..................................
+........................................#........................#...............................#.............#..........#..........#......
+..#.......................................................#...................#.............#...............................................
diff --git a/2023/README.md b/2023/README.md
@@ -0,0 +1,18 @@
+# Advent of Code 2023
+
+This is my first year trying the AoC. I decided to use C because it is the
+language I know the best and I am familiar with the standard library.
+
+## Instructions
+
+Compile with `-std=c99` and other required options, for example
+
+```
+$ cc -std=c99 -lm 06/6a.c
+```
+
+My solutions read from stdin, so run the e.g. with
+
+```
+$ ./a.out <in.txt
+```
diff --git a/README.md b/README.md
@@ -0,0 +1,3 @@
+My solutions for the [Advent of Code](https://adventofcode.com).
+
+See `year/README.md` for instructions.