From 4299855be75478ebceb20b7d030305814855eaa0 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Tue, 11 Dec 2018 11:07:05 +0100 Subject: [PATCH] Initial commit (day3p1) --- day1p1/Makefile | 8 + day1p1/input | 1000 ++++++++++++++++++++++++++++++++++ day1p1/main | Bin 0 -> 16912 bytes day1p1/main.c | 25 + day1p1/main.lua | 7 + day1p2/Makefile | 16 + day1p2/input | 1000 ++++++++++++++++++++++++++++++++++ day1p2/main | Bin 0 -> 17200 bytes day1p2/main.c | 75 +++ day1p2/main_hash | Bin 0 -> 17248 bytes day2p1/Makefile | 8 + day2p1/input | 250 +++++++++ day2p1/main | Bin 0 -> 16992 bytes day2p1/main.c | 57 ++ day2p2/Makefile | 12 + day2p2/input | 250 +++++++++ day2p2/main | Bin 0 -> 17232 bytes day2p2/main.c | 68 +++ day3p1/Makefile | 12 + day3p1/input | 1331 ++++++++++++++++++++++++++++++++++++++++++++++ day3p1/main | Bin 0 -> 17248 bytes day3p1/main.c | 92 ++++ 22 files changed, 4211 insertions(+) create mode 100644 day1p1/Makefile create mode 100644 day1p1/input create mode 100755 day1p1/main create mode 100644 day1p1/main.c create mode 100644 day1p1/main.lua create mode 100644 day1p2/Makefile create mode 100644 day1p2/input create mode 100755 day1p2/main create mode 100644 day1p2/main.c create mode 100755 day1p2/main_hash create mode 100644 day2p1/Makefile create mode 100644 day2p1/input create mode 100755 day2p1/main create mode 100644 day2p1/main.c create mode 100644 day2p2/Makefile create mode 100644 day2p2/input create mode 100755 day2p2/main create mode 100644 day2p2/main.c create mode 100644 day3p1/Makefile create mode 100644 day3p1/input create mode 100755 day3p1/main create mode 100644 day3p1/main.c diff --git a/day1p1/Makefile b/day1p1/Makefile new file mode 100644 index 0000000..042aa30 --- /dev/null +++ b/day1p1/Makefile @@ -0,0 +1,8 @@ +CFLAGS := -Wall -Wextra -std=c17 -D_GNU_SOURCE + +.PHONY: all +all: main + +.PHONY: clean +clean: + rm -f main diff --git a/day1p1/input b/day1p1/input new file mode 100644 index 0000000..a363fa3 --- /dev/null +++ b/day1p1/input @@ -0,0 +1,1000 @@ +-6 +-7 ++2 +-4 +-10 ++2 +-6 +-11 +-19 +-1 +-14 ++2 +-12 ++5 +-2 ++8 +-9 ++7 +-10 +-14 ++3 +-1 ++19 ++17 +-4 ++15 +-17 ++20 ++14 ++15 +-19 ++17 +-6 ++19 ++19 ++13 +-11 +-13 ++17 ++16 ++11 +-4 +-3 ++17 ++10 +-5 +-16 +-2 +-15 ++10 ++10 +-1 ++17 +-6 ++18 +-3 +-13 +-5 ++19 ++7 ++11 ++6 +-7 +-9 ++17 ++11 ++7 ++17 ++4 ++17 +-6 +-4 +-18 ++8 +-4 ++12 ++7 ++1 +-15 +-15 +-14 +-5 +-13 +-18 ++13 +-6 ++10 +-9 +-14 +-13 +-1 +-18 ++11 ++10 ++8 ++7 ++11 ++6 ++9 ++8 ++5 +-18 +-7 +-6 +-7 ++15 ++2 +-15 ++3 +-12 +-10 +-3 +-19 ++1 ++5 +-19 +-8 ++10 +-13 ++7 ++20 +-13 +-9 ++10 ++7 ++12 +-1 ++9 ++19 +-9 +-35 +-21 ++1 +-19 +-19 +-19 ++11 ++15 +-3 ++9 ++10 ++3 +-12 +-17 +-15 ++1 ++7 ++1 ++14 +-16 ++10 ++2 +-5 +-16 ++4 +-19 +-23 ++1 ++9 ++15 ++12 ++7 +-15 +-12 +-15 +-7 ++18 +-8 ++19 ++12 ++9 +-14 ++4 ++16 ++18 +-17 +-25 +-20 +-21 ++6 ++1 ++11 +-6 +-10 +-3 +-8 +-4 +-6 +-11 +-16 ++1 ++7 +-17 ++5 ++14 +-16 +-6 ++11 ++6 +-13 ++19 ++18 +-7 +-8 +-2 ++12 +-5 ++1 ++11 ++19 +-1 +-19 +-23 ++16 +-19 ++5 +-3 +-4 +-5 +-10 +-1 +-16 +-1 +-9 ++8 ++3 +-7 ++12 ++2 ++4 +-2 ++5 +-2 +-8 ++18 ++2 ++18 ++15 ++15 +-5 ++13 +-7 +-29 ++3 ++3 ++14 ++1 +-4 ++2 +-9 ++17 +-16 ++14 ++1 ++6 ++12 ++7 ++16 +-6 +-13 ++27 ++46 ++9 ++6 +-1 +-11 ++13 ++11 +-3 +-12 ++21 ++8 +-16 ++14 +-7 +-10 +-9 +-15 +-8 ++62 +-6 ++27 ++52 ++6 ++11 ++15 +-17 ++16 ++8 ++12 ++6 +-13 ++9 +-18 +-5 +-20 +-19 +-3 ++17 ++18 +-2 +-19 +-10 ++12 +-20 ++3 ++8 ++1 ++1 ++16 ++6 ++19 +-14 ++19 ++15 +-9 ++10 ++18 ++15 +-7 +-7 +-4 +-12 ++11 +-19 ++17 +-4 ++3 ++19 ++17 ++10 ++16 +-17 ++14 ++4 ++8 +-7 ++3 ++16 ++12 ++4 ++14 ++8 +-11 ++19 +-11 +-17 ++7 +-12 ++1 ++8 ++1 ++8 +-12 +-11 +-9 ++18 +-19 +-13 +-10 +-8 ++2 ++20 ++12 +-14 ++15 +-19 ++10 +-16 +-3 +-1 ++5 +-12 +-9 ++7 +-4 ++5 +-17 +-17 ++19 +-13 ++22 +-14 ++1 ++15 +-14 +-19 +-15 +-16 ++19 ++10 +-18 +-1 ++4 +-16 ++7 ++8 +-16 +-14 +-5 +-14 +-7 +-22 ++18 ++6 ++7 ++49 ++18 ++10 ++14 +-10 ++11 +-3 +-10 +-13 ++5 ++4 ++5 +-2 ++17 ++10 +-12 ++16 ++14 ++5 ++14 ++4 +-15 ++21 ++18 +-7 ++13 ++17 +-19 ++8 ++16 ++1 +-13 +-25 +-17 ++4 +-1 ++18 ++25 +-19 +-28 +-9 +-7 ++14 +-9 ++8 +-7 ++24 ++1 ++23 +-15 ++22 ++60 +-22 ++104 ++36 +-14 ++174 ++12 ++4 ++4 ++4 +-5 +-30 +-8 +-17 ++66 ++38 +-1 ++22 +-10 +-31 +-146 ++53 +-93 ++184 +-14 ++140 +-5 +-171 ++68756 +-2 ++9 +-8 ++15 +-10 +-19 +-6 ++12 ++3 ++7 +-8 +-12 +-6 +-6 ++1 +-13 +-5 +-1 ++14 ++18 +-1 ++2 ++12 +-10 ++16 +-10 +-15 +-19 ++10 ++3 +-18 +-3 +-5 +-16 ++10 ++3 +-11 ++3 ++3 +-17 +-16 +-9 ++14 ++7 +-14 ++17 +-12 ++10 ++11 ++16 +-6 +-6 +-21 ++7 ++12 +-16 +-2 +-13 +-17 ++7 +-9 +-3 ++9 +-7 +-1 ++5 ++18 +-4 ++16 ++11 +-1 +-15 ++14 ++14 +-10 ++14 +-7 ++10 ++6 ++6 ++5 ++6 +-4 ++12 ++4 ++2 +-19 ++12 ++3 +-12 +-1 ++24 ++16 ++14 ++5 +-3 +-11 ++16 ++18 ++9 +-13 +-4 ++2 ++14 +-6 +-9 ++12 ++6 ++15 ++3 ++10 +-14 ++17 ++8 ++8 +-3 +-7 ++12 ++7 +-13 ++19 ++1 ++10 ++2 ++17 ++18 +-7 ++1 ++5 ++11 ++20 +-3 +-11 ++15 +-12 ++9 +-10 ++14 +-17 ++18 +-9 +-16 +-19 +-8 ++4 +-18 +-17 +-8 +-14 +-8 +-8 +-14 +-7 ++3 +-18 ++19 ++1 +-10 ++7 +-16 +-11 ++17 +-18 ++2 +-3 +-12 +-2 ++18 +-8 ++10 ++10 ++5 +-16 +-16 +-7 ++1 +-4 +-16 ++15 ++15 +-23 +-2 +-23 +-16 +-2 ++13 +-8 ++29 ++38 +-1 +-4 +-10 ++7 ++27 +-8 ++15 ++13 ++20 ++19 +-17 +-8 +-17 ++7 ++1 ++3 +-9 ++14 +-18 ++17 ++5 ++17 ++13 ++15 +-10 ++6 +-15 +-19 +-1 +-12 ++4 ++6 +-14 ++23 +-2 ++13 +-12 ++20 +-7 ++22 +-11 +-8 ++9 ++17 +-4 ++1 ++14 +-5 +-4 +-18 +-19 ++38 +-4 ++18 +-16 ++9 ++14 +-5 ++17 ++13 +-9 ++4 +-12 +-2 ++9 ++13 ++24 +-7 +-5 ++8 ++19 ++19 ++11 +-16 +-11 ++7 +-13 ++16 ++14 +-10 ++4 ++19 ++16 ++4 +-3 ++8 ++8 +-7 +-17 +-18 +-3 +-6 ++4 ++13 +-6 ++17 +-9 ++14 +-9 +-17 ++8 ++5 ++12 ++5 +-11 +-1 ++21 +-1 ++9 ++13 ++4 ++6 ++3 ++5 ++4 ++10 +-4 +-9 +-3 +-14 +-1 ++7 ++7 ++18 ++11 ++16 +-6 ++10 +-6 ++15 +-7 +-5 ++9 ++15 ++26 +-16 +-4 +-23 +-17 +-14 ++3 ++3 +-5 ++1 +-18 +-4 ++17 ++1 +-11 +-17 ++16 +-11 +-1 ++19 +-1 ++7 ++21 +-26 +-4 ++19 ++17 ++12 +-20 +-14 ++21 +-20 +-22 +-23 +-15 ++3 ++5 +-18 +-8 +-17 +-2 ++10 +-12 +-7 +-5 +-15 ++11 +-17 +-7 +-10 ++11 ++14 +-18 +-6 +-3 +-6 ++17 ++15 ++3 +-7 +-12 ++25 ++23 ++13 +-6 +-10 +-24 ++7 +-14 ++8 +-14 +-2 +-21 +-10 +-3 +-20 +-10 ++2 ++16 +-12 ++9 ++9 +-16 ++17 +-26 +-18 ++10 +-7 +-2 +-16 ++6 ++18 ++5 +-30 +-3 +-18 ++19 ++12 ++17 ++35 ++13 ++16 +-11 ++17 +-8 +-2 +-8 +-5 ++8 ++29 ++16 +-1 +-36 ++8 +-52 +-6 ++148 ++18 +-20 ++15 +-10 +-10 +-9 +-6 ++12 +-5 +-18 +-9 ++37 +-16 ++18 +-20 +-4 ++26 ++11 +-18 ++4 ++11 ++2 ++20 +-27 +-15 ++43 ++50 ++4 ++17 ++21 +-1 +-1 +-11 +-60 ++137 +-23 ++52 ++14 ++11 ++8 ++24 ++13 ++86 ++31 ++321 ++68009 +-18 +-17 ++14 ++17 +-12 ++11 ++10 +-8 ++19 +-2 ++6 +-1 +-15 ++17 +-19 +-19 +-5 +-18 +-12 +-8 +-20 ++3 +-10 ++6 +-15 +-5 +-2 +-137857 diff --git a/day1p1/main b/day1p1/main new file mode 100755 index 0000000000000000000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(4IBl8>rxyCDF?Txl=v|7L}RMr@wIf+sDS|?4MdZkqscJb ztqX^k2c^M4Vvu=4C!*j_Lp83I99QCra4c#NWGIU(kpLQq+;Bu?9v&i(s*FG$2Q`$% z_*3^NgJKvDhQO92%|aW`ng!*-abPGMgj!?Z3;uX`1)4K>1k3|())2fcdEVszj>3Hn zOlk0)t|eM`64Jg#6mwn5BYqM-xR)S%TAvcSp-i7>-X#v#!+LvK#}aNKMS*7fHsEi= z-h%3<^)4Z`pT0l&=0)doALMbbMfTNVy-e7R!GVO^Cd`sO?TZcohbClC>u18tP^M49 zU6wiwIovyuJ*~3|&Fv>W!ed~Mdohw}Jx*9FYBIN<8gLRa7*n#Rbvxm-P&CJn`u~)$ zZxMR5za-S#!zyP<{GJ02V92ya1w z-k#RK2ZcSg(`--j2arKu)P7nA4hnm!hxD;7eYyhzazZ^@MD~?gM$3@B9 xct!*s-{WoYq4v=Hu@X3HyUv`|;>B@DUpG0YdbLtq)91JU`7TYvVKOj@>|Y{;_IUsR literal 0 HcmV?d00001 diff --git a/day1p1/main.c b/day1p1/main.c new file mode 100644 index 0000000..ed97992 --- /dev/null +++ b/day1p1/main.c @@ -0,0 +1,25 @@ +#include +#include + +int main() +{ + int value = 0; + char *line = NULL; + size_t line_len = 0; + FILE *f = fopen("input", "r"); + if (!f) { + perror("input"); + return 1; + } + + while (getline(&line, &line_len, f) != -1) { + long number = strtol(line, NULL, 0); + value += number; + } + + printf("%d\n", value); + + free(line); + fclose(f); + return 0; +} diff --git a/day1p1/main.lua b/day1p1/main.lua new file mode 100644 index 0000000..237889e --- /dev/null +++ b/day1p1/main.lua @@ -0,0 +1,7 @@ +value = 0 + +for line in io.lines("input") do + value = value + tonumber(line) +end + +print(value) diff --git a/day1p2/Makefile b/day1p2/Makefile new file mode 100644 index 0000000..bd1e009 --- /dev/null +++ b/day1p2/Makefile @@ -0,0 +1,16 @@ +CFLAGS := -Wall -Wextra -std=c17 -D_GNU_SOURCE + +LIBS := glib-2.0 +CFLAGS += $(shell pkg-config --cflags $(LIBS)) +LDLIBS := $(shell pkg-config --libs $(LIBS)) + +.PHONY: all +all: main main_hash + +.PHONY: clean +clean: + rm -f main main_hash + +main_hash: CFLAGS += -DUSE_HASH +main_hash: main.c + $(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@ diff --git a/day1p2/input b/day1p2/input new file mode 100644 index 0000000..a363fa3 --- /dev/null +++ b/day1p2/input @@ -0,0 +1,1000 @@ +-6 +-7 ++2 +-4 +-10 ++2 +-6 +-11 +-19 +-1 +-14 ++2 +-12 ++5 +-2 ++8 +-9 ++7 +-10 +-14 ++3 +-1 ++19 ++17 +-4 ++15 +-17 ++20 ++14 ++15 +-19 ++17 +-6 ++19 ++19 ++13 +-11 +-13 ++17 ++16 ++11 +-4 +-3 ++17 ++10 +-5 +-16 +-2 +-15 ++10 ++10 +-1 ++17 +-6 ++18 +-3 +-13 +-5 ++19 ++7 ++11 ++6 +-7 +-9 ++17 ++11 ++7 ++17 ++4 ++17 +-6 +-4 +-18 ++8 +-4 ++12 ++7 ++1 +-15 +-15 +-14 +-5 +-13 +-18 ++13 +-6 ++10 +-9 +-14 +-13 +-1 +-18 ++11 ++10 ++8 ++7 ++11 ++6 ++9 ++8 ++5 +-18 +-7 +-6 +-7 ++15 ++2 +-15 ++3 +-12 +-10 +-3 +-19 ++1 ++5 +-19 +-8 ++10 +-13 ++7 ++20 +-13 +-9 ++10 ++7 ++12 +-1 ++9 ++19 +-9 +-35 +-21 ++1 +-19 +-19 +-19 ++11 ++15 +-3 ++9 ++10 ++3 +-12 +-17 +-15 ++1 ++7 ++1 ++14 +-16 ++10 ++2 +-5 +-16 ++4 +-19 +-23 ++1 ++9 ++15 ++12 ++7 +-15 +-12 +-15 +-7 ++18 +-8 ++19 ++12 ++9 +-14 ++4 ++16 ++18 +-17 +-25 +-20 +-21 ++6 ++1 ++11 +-6 +-10 +-3 +-8 +-4 +-6 +-11 +-16 ++1 ++7 +-17 ++5 ++14 +-16 +-6 ++11 ++6 +-13 ++19 ++18 +-7 +-8 +-2 ++12 +-5 ++1 ++11 ++19 +-1 +-19 +-23 ++16 +-19 ++5 +-3 +-4 +-5 +-10 +-1 +-16 +-1 +-9 ++8 ++3 +-7 ++12 ++2 ++4 +-2 ++5 +-2 +-8 ++18 ++2 ++18 ++15 ++15 +-5 ++13 +-7 +-29 ++3 ++3 ++14 ++1 +-4 ++2 +-9 ++17 +-16 ++14 ++1 ++6 ++12 ++7 ++16 +-6 +-13 ++27 ++46 ++9 ++6 +-1 +-11 ++13 ++11 +-3 +-12 ++21 ++8 +-16 ++14 +-7 +-10 +-9 +-15 +-8 ++62 +-6 ++27 ++52 ++6 ++11 ++15 +-17 ++16 ++8 ++12 ++6 +-13 ++9 +-18 +-5 +-20 +-19 +-3 ++17 ++18 +-2 +-19 +-10 ++12 +-20 ++3 ++8 ++1 ++1 ++16 ++6 ++19 +-14 ++19 ++15 +-9 ++10 ++18 ++15 +-7 +-7 +-4 +-12 ++11 +-19 ++17 +-4 ++3 ++19 ++17 ++10 ++16 +-17 ++14 ++4 ++8 +-7 ++3 ++16 ++12 ++4 ++14 ++8 +-11 ++19 +-11 +-17 ++7 +-12 ++1 ++8 ++1 ++8 +-12 +-11 +-9 ++18 +-19 +-13 +-10 +-8 ++2 ++20 ++12 +-14 ++15 +-19 ++10 +-16 +-3 +-1 ++5 +-12 +-9 ++7 +-4 ++5 +-17 +-17 ++19 +-13 ++22 +-14 ++1 ++15 +-14 +-19 +-15 +-16 ++19 ++10 +-18 +-1 ++4 +-16 ++7 ++8 +-16 +-14 +-5 +-14 +-7 +-22 ++18 ++6 ++7 ++49 ++18 ++10 ++14 +-10 ++11 +-3 +-10 +-13 ++5 ++4 ++5 +-2 ++17 ++10 +-12 ++16 ++14 ++5 ++14 ++4 +-15 ++21 ++18 +-7 ++13 ++17 +-19 ++8 ++16 ++1 +-13 +-25 +-17 ++4 +-1 ++18 ++25 +-19 +-28 +-9 +-7 ++14 +-9 ++8 +-7 ++24 ++1 ++23 +-15 ++22 ++60 +-22 ++104 ++36 +-14 ++174 ++12 ++4 ++4 ++4 +-5 +-30 +-8 +-17 ++66 ++38 +-1 ++22 +-10 +-31 +-146 ++53 +-93 ++184 +-14 ++140 +-5 +-171 ++68756 +-2 ++9 +-8 ++15 +-10 +-19 +-6 ++12 ++3 ++7 +-8 +-12 +-6 +-6 ++1 +-13 +-5 +-1 ++14 ++18 +-1 ++2 ++12 +-10 ++16 +-10 +-15 +-19 ++10 ++3 +-18 +-3 +-5 +-16 ++10 ++3 +-11 ++3 ++3 +-17 +-16 +-9 ++14 ++7 +-14 ++17 +-12 ++10 ++11 ++16 +-6 +-6 +-21 ++7 ++12 +-16 +-2 +-13 +-17 ++7 +-9 +-3 ++9 +-7 +-1 ++5 ++18 +-4 ++16 ++11 +-1 +-15 ++14 ++14 +-10 ++14 +-7 ++10 ++6 ++6 ++5 ++6 +-4 ++12 ++4 ++2 +-19 ++12 ++3 +-12 +-1 ++24 ++16 ++14 ++5 +-3 +-11 ++16 ++18 ++9 +-13 +-4 ++2 ++14 +-6 +-9 ++12 ++6 ++15 ++3 ++10 +-14 ++17 ++8 ++8 +-3 +-7 ++12 ++7 +-13 ++19 ++1 ++10 ++2 ++17 ++18 +-7 ++1 ++5 ++11 ++20 +-3 +-11 ++15 +-12 ++9 +-10 ++14 +-17 ++18 +-9 +-16 +-19 +-8 ++4 +-18 +-17 +-8 +-14 +-8 +-8 +-14 +-7 ++3 +-18 ++19 ++1 +-10 ++7 +-16 +-11 ++17 +-18 ++2 +-3 +-12 +-2 ++18 +-8 ++10 ++10 ++5 +-16 +-16 +-7 ++1 +-4 +-16 ++15 ++15 +-23 +-2 +-23 +-16 +-2 ++13 +-8 ++29 ++38 +-1 +-4 +-10 ++7 ++27 +-8 ++15 ++13 ++20 ++19 +-17 +-8 +-17 ++7 ++1 ++3 +-9 ++14 +-18 ++17 ++5 ++17 ++13 ++15 +-10 ++6 +-15 +-19 +-1 +-12 ++4 ++6 +-14 ++23 +-2 ++13 +-12 ++20 +-7 ++22 +-11 +-8 ++9 ++17 +-4 ++1 ++14 +-5 +-4 +-18 +-19 ++38 +-4 ++18 +-16 ++9 ++14 +-5 ++17 ++13 +-9 ++4 +-12 +-2 ++9 ++13 ++24 +-7 +-5 ++8 ++19 ++19 ++11 +-16 +-11 ++7 +-13 ++16 ++14 +-10 ++4 ++19 ++16 ++4 +-3 ++8 ++8 +-7 +-17 +-18 +-3 +-6 ++4 ++13 +-6 ++17 +-9 ++14 +-9 +-17 ++8 ++5 ++12 ++5 +-11 +-1 ++21 +-1 ++9 ++13 ++4 ++6 ++3 ++5 ++4 ++10 +-4 +-9 +-3 +-14 +-1 ++7 ++7 ++18 ++11 ++16 +-6 ++10 +-6 ++15 +-7 +-5 ++9 ++15 ++26 +-16 +-4 +-23 +-17 +-14 ++3 ++3 +-5 ++1 +-18 +-4 ++17 ++1 +-11 +-17 ++16 +-11 +-1 ++19 +-1 ++7 ++21 +-26 +-4 ++19 ++17 ++12 +-20 +-14 ++21 +-20 +-22 +-23 +-15 ++3 ++5 +-18 +-8 +-17 +-2 ++10 +-12 +-7 +-5 +-15 ++11 +-17 +-7 +-10 ++11 ++14 +-18 +-6 +-3 +-6 ++17 ++15 ++3 +-7 +-12 ++25 ++23 ++13 +-6 +-10 +-24 ++7 +-14 ++8 +-14 +-2 +-21 +-10 +-3 +-20 +-10 ++2 ++16 +-12 ++9 ++9 +-16 ++17 +-26 +-18 ++10 +-7 +-2 +-16 ++6 ++18 ++5 +-30 +-3 +-18 ++19 ++12 ++17 ++35 ++13 ++16 +-11 ++17 +-8 +-2 +-8 +-5 ++8 ++29 ++16 +-1 +-36 ++8 +-52 +-6 ++148 ++18 +-20 ++15 +-10 +-10 +-9 +-6 ++12 +-5 +-18 +-9 ++37 +-16 ++18 +-20 +-4 ++26 ++11 +-18 ++4 ++11 ++2 ++20 +-27 +-15 ++43 ++50 ++4 ++17 ++21 +-1 +-1 +-11 +-60 ++137 +-23 ++52 ++14 ++11 ++8 ++24 ++13 ++86 ++31 ++321 ++68009 +-18 +-17 ++14 ++17 +-12 ++11 ++10 +-8 ++19 +-2 ++6 +-1 +-15 ++17 +-19 +-19 +-5 +-18 +-12 +-8 +-20 ++3 +-10 ++6 +-15 +-5 +-2 +-137857 diff --git a/day1p2/main b/day1p2/main new file mode 100755 index 0000000000000000000000000000000000000000..f559aeb163d1a40f7f09a8f2c24f59f5ee22a3e2 GIT binary patch literal 17200 zcmeHOeQX@X6`%9Pi6P0^1P9ze$u*GHLHJ@ji7|vUdydapS9anCn-7&_Ip3}ABlqFn z?FAe0Vbvt!>N;4IB19_@RVqcOQV~#u0s@E7B(w+uYKv*p%FrabD^!>QsezL1do%OS zd+R%dREhqxW9`0qzxOe-Z)evtxAX1_bhMSZT#SmFeVcLaJb@@uFtd>~7*kj?TMXx~ zvy0h6fEU1_NU@y`lnDXR3aRG?igu4mxt(4t^@vgrk)mCxa!fWrlvN2$v@6G|4C9#cXO*A$>+(_oSp`hb-D&kS8DXqfdy$(@uMsdKN_O7`JM8C|Efn@0vb|Dqsg?aFDleC< zjYfK#)~}6*>!Oi(dZ=!wxv8#cy)TvUHS+65|ERllTMzFNjxP!=zdqm*L;1aXH|}dX z-LT_r&*Zarb{P-v{LL-t5*3dEMffu$wz$M>H7`+c{+_5B-YSPFsV ztU-O5g{LZFUScft7}SgD|Fi`Ds}lH=CGepV_~{b(p%VD@C2$|$UO4RKAOOX#D_jEK zUjo0s1pZnH93K}i9QN`i0ITdE@Uw7Ku?yLRQYc*PLcE4OXv0meUo%gi!T9Wlqps0c zkE61lY3<#eT3Ao&{gITRC%ZehL=$nnJJ=i5nWpu}5^*hM1e1oQ3Du&C{aP@Y3=V63 zNnK~e1P2H8cv#yLjHdEfT)!2&5W=>bSYHA(*r1+FCX&z?v=iE`g$8zOeZfeS4JIRT zqmL!^TO;u>OBqQc5oIww7K#nBzECugf~Ir>o-^!dXeg-lMdHC|rsaE-@BgY=qhq<-6;T?d@)hFRxxl(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h!RF8Q_MZlc)xOIsREf^!Ek%XyKf#kw@xVc0 zqWM1MgWL6qC;AH5!mKcFPro-!*8vEH^aMA@6Fvn396QuLtwSi^p7QExe32d9$G5>2 zub=E`Jvt>PkhLJQ7P2RL8iZDRrbz92K}RG@gzSjE4+5+Gh$1vcq&@Z1ZcqHjP(feR zf0}PjNPB9B^sy~#`4kw$q(#NI4X8A)LKF9bjqyEtQ6Mu)J hzC$%%vR8_#%O<3DNfDn9n+g}@t`-_@n}LmG{{^O)2nYZG literal 0 HcmV?d00001 diff --git a/day1p2/main.c b/day1p2/main.c new file mode 100644 index 0000000..0ebe100 --- /dev/null +++ b/day1p2/main.c @@ -0,0 +1,75 @@ +#include +#include + +#include + +/* + * Apparently using a hash table for this is much faster... + * + * $ time ./main + * 69285 + * ./main 271,27s user 0,11s system 99% cpu 4:33,04 total + * $ time ./main_hash + * 69285 + * ./main_hash 0,13s user 0,02s system 98% cpu 0,156 total + */ + +#ifndef USE_HASH +gpointer g_array_lookup(GArray *array, gpointer item, guint size) +{ + for (gchar *i = array->data; i < array->data + array->len * size; i += size) { + if (memcmp(i, item, size) == 0) { + return i; + } + } + return NULL; +} +#endif + +int main() +{ + long value = 0; + char *line = NULL; + size_t line_len = 0; + FILE *f = fopen("input", "r"); + if (!f) { + perror("input"); + return 1; + } + +#ifdef USE_HASH + GHashTable *hash = g_hash_table_new(g_direct_hash, g_direct_equal); + g_hash_table_insert(hash, GINT_TO_POINTER(value), GINT_TO_POINTER(TRUE)); +#else + GArray *array = g_array_new(FALSE, FALSE, sizeof(long)); + g_array_append_val(array, value); +#endif + + while (1) { + rewind(f); + while (getline(&line, &line_len, f) != -1) { + long number = strtol(line, NULL, 0); + value += number; + +#ifdef USE_HASH + if (g_hash_table_lookup(hash, GINT_TO_POINTER(value))) goto found; + g_hash_table_insert(hash, GINT_TO_POINTER(value), GINT_TO_POINTER(TRUE)); +#else + if (g_array_lookup(array, &value, sizeof(long))) goto found; + g_array_append_val(array, value); +#endif + } + } +found: + + printf("%ld\n", value); + +#ifdef USE_HASH + g_hash_table_destroy(hash); +#else + g_array_free(array, TRUE); +#endif + free(line); + fclose(f); + return 0; +} diff --git a/day1p2/main_hash b/day1p2/main_hash new file mode 100755 index 0000000000000000000000000000000000000000..d4b2a7d7584326ad7e8dfc4a524a876bb4575f3e GIT binary patch literal 17248 zcmeHPeQX@X6`%9Pi4&5u6C7}pK&~N?98_P&i|-umcE^<#M;SuQ}hD zyFG9asBTRnuEx|wZAJN`4gCXAR8_QU5lyQ$kdT-PA%g@p>4yv?=#CG?G!TWfWc%Li zyz}n*7PWsBsXNy0oA-MkGy8V-V{Yg9n~~0K6&??x;$=56&Mh?%NeKKmk_KZE3$e>! ze-&HB<^wzrHc5!>w7}m+VgWUV>aqX1t>(#b{Lz91}|BRV76BTDha znBaC?__NbCkYOQ;x>$Ce(c)OI^&>ZzHXAS_N_Mw^9rp7-Efn@$qCKa$ghc;|io<0a zl8Jqrn>Qrm4ar0*H`Fi`+T5_YIgm{Un)q>}f7ET?-ov|ur;|dZw9;uM#Q*e6}EG{jy-O}w+P&>&tN?F z!Pd|e2;wLXGNq%tONpx)wJ(v?)J%8R)?_-Rc1QOmRi-F?1L>5K)uI_qQ4H0xihW8v zkx^rsqTZ8>CRvH?k7oOUL!xNtQc0=zS%G9ay+1c-#o}sK%cKuj!9*&nW;8s281{TK z>rD@;DK@BPGU*I-6?z%luf+QIE4|S~k_~1ODXo`f)cX>tI0JuLI>~xt$#hm_eX0hR zGag@TD5~@(Qqg4Meq_iY@RBH-s z;-?4i0JwQ!Pj$L4AYx!1hJQx!0QMqO>3&t4NGw77PJSL4%dJSj6Q+Xg76x=*r~B}X zcy3OL`!?Z+1^%#Pv_m-Y6E_<;-g~Goh)kMr@rdGzQzm>7M~vOH3BSyQ7fkqK6Fy_Y zFE`;AOn9vcuagXB0T7HH6~AQE5T|DZBJ~pP8AF^ue>ulkP%}K7;?yF{hD`V} zj<`EF0&WD{2)Ge&Bk<*mz`5$HFUl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G} z%Z!I^T+y_qyb_&%Nf^;|I(pDBlUDj5PQ65XOe3D{={X1!2WL=aN>u5T460-pt=l4- zHACCdV&J?>sa{+dEnnOc+1$3VR3gvW0K$*Dq3Ozl-m*;?o7!(}j5OgdJv(^ z!5%BR57bKAw2N~%lVzrRMJSoF%uuAct-*?RDy}n`4eiS&a8fT37a`)hqM0rciXTkE zpG~c_EjeJOGl^8PgfSpXo83_|P`Tc2ON3;ILYCQwJau`J0l-Eg0EOj|g z^s~5VZNm0E-(?zv%$az+W^6e!PJ5mgGrf)#6?NOU0RIqc6)vCW&rG@g{Cg}HLk^!? zkf*g9+w(k|=~fC35-r0h%l5p^+6j!N>}=2Tai*srb0+1k2;GSst;N`$=j}}0^=Cb% z`(aOOJLY+Q&$LmMrHdnOgbEM-90FhYF<|cW@M +#include + +int compare_char(const void *a, const void *b) +{ + return *(const char *)a - *(const char *)b; +} + +char find_reoccurrence(const char *array, const ssize_t len, const int times) +{ + if (!len) return 0; + if (!times) return 0; + + char current = *array; + int count = 0; + + for (const char *i = array; i < array + len; i++) { + if (*i == current) { + count++; + continue; + } + if (count == times) return current; + current = *i; + count = 1; + } + + return count == times ? current : 0; +} + +int main() +{ + char *line = NULL; + size_t line_len = 0; + ssize_t len = 0; + FILE *f = fopen("input", "r"); + if (!f) { + perror("input"); + return 1; + } + + int twice = 0; + int thrice = 0; + + while ((len = getline(&line, &line_len, f)) != -1) { + while (line[len - 1] == '\n') line[--len] = '\0'; + qsort(line, len, sizeof(char), compare_char); + + if (find_reoccurrence(line, len, 2)) twice++; + if (find_reoccurrence(line, len, 3)) thrice++; + } + + printf("%d\n", twice * thrice); + + free(line); + fclose(f); + return 0; +} diff --git a/day2p2/Makefile b/day2p2/Makefile new file mode 100644 index 0000000..c711967 --- /dev/null +++ b/day2p2/Makefile @@ -0,0 +1,12 @@ +CFLAGS := -Wall -Wextra -std=c17 -D_GNU_SOURCE + +LIBS := glib-2.0 +CFLAGS += $(shell pkg-config --cflags $(LIBS)) +LDLIBS := $(shell pkg-config --libs $(LIBS)) + +.PHONY: all +all: main + +.PHONY: clean +clean: + rm -f main diff --git a/day2p2/input b/day2p2/input new file mode 100644 index 0000000..cae7310 --- /dev/null +++ b/day2p2/input @@ -0,0 +1,250 @@ +wkzhyfdpluzeqvajtbbosngkxc +wrzhyfdplumeqvajtbioskfksc +wrzhyfdolumyqvajtbiosngkxs +urzhyfdplbmeqvrjtbiosngkxc +wrzhyfrulumeqvajtbiosngkxf +wrzhnfdprumvqvajtbiosngkxc +wrzhyfpplumeivajtbiosrgkxc +wrzhybdplumeqvaftbiosxgkxc +wrzgyfdplumeqvaltbiosngcxc +wrzhbfdzlumeqvajtbipsngkxc +wrzhyfdplumwqeajtbiosngxxc +wrzhyddplumeqvajtbimsngkxo +wrzhyfdplumsqdajtfiosngkxc +wrzvyfdplumeqjajtbkosngkxc +wrzhyfddlumeqvujtbiosngxxc +nrzhywdplumeqvajtbtosngkxc +wzzhyfdplomeqvdjtbiosngkxc +urzhyfdplumeqvaatbiosngkxb +wtzyyfdplumeqvajtbiosngkxl +wrzhyfdhlumnqvajebiosngkxc +wrzhyfdplumpqvajtbiosnyjxc +wrzdyfdplumeqvajtviospgkxc +wrzhyfdplzmeqvajtbiosegfxc +wrzhyfdglumkqvajtwiosngkxc +wrzhtfdplgmeqvaqtbiosngkxc +wrzhyfdplumeqvajxpiosngexc +frzhyfdplvmeqvajtbiosngkxp +wrzhyfkplumeqvajtbfosngkpc +irzhyfqplumeqvajtbiosngktc +wrzhyfdpluvoqvajtbioingkxc +wrzhyfdplumemvautbuosngkxc +wfzhyflplumeqvijtbiosngkxc +wrzhyfdglumeqvzjkbiosngkxc +wrzcyfdplaneqvajtbiosngkxc +wrzhbfdplumeqwajtbiosngpxc +szdhyfdplumeqvajtbiosngkxc +krzhyfdplumeqvajtxilsngkxc +brzhyfmplumexvajtbiosngkxc +wrzhyvdplumeqvajtbiosiglxc +orzhyfdplumeqvaotbcosngkxc +hrzhyfdplumeqvaptbiocngkxc +wwzhyfdklummqvajtbiosngkxc +wrzhyfdppymeqvvjtbiosngkxc +wsehyudplumeqvajtbiosngkxc +wrzhyzpplumeqvajtbioscgkxc +wrzhyfqpyumeqvajtbiusngkxc +urzhyfdpdumeqmajtbiosngkxc +wrzhyfdrlumxqvajtbiosnakxc +wrthyfdplumeskajtbiosngkxc +wrzhyfdplymeqvajtbiesbgkxc +wrzhyfdqlumeqyajtciosngkxc +trzhsfdplumeqyajtbiosngkxc +wpzhyfdplimeqvajtbiosngfxc +wrzhhfdplrmeqvajtbiosngkxx +wrzhycdpgumeqvajtbioslgkxc +wrzhyfdelumeqvajgtiosngkxc +wrzhyfdplutebvajtbiosygkxc +wrzhyfdplukeqvajtbiorngkec +erzhyfdilumeqvajwbiosngkxc +wrzhyfdplumnivxjtbiosngkxc +wrzhyfdplumebvajtoiovngkxc +wrzhyfdplumeqvajtbtosnwkxe +wrzhyfxplumevvajtciosngkxc +wbzhyfdxlumeqvajtriosngkxc +wrzyyfdplumeqvajmbiosngkxb +wfthyfdplumeqvajtbiosngkdc +wrzhuedplumeqvajtbgosngkxc +wrzhifdplumeqvajtsrosngkxc +wrzhyfdplumqqvajtaiosngkac +krzhyfvvlumeqvajtbiosngkxc +wrzhyfdplzmeqqajtbiosngkvc +wrzhyfqplumeqvajtbiosngdxy +wrzhyfdpluieqvajtbiosngjjc +wrzhyfdvlumeqrajdbiosngkxc +wrzhcfdpxumeqvajtbiotngkxc +wrzhyfdprumeqvaitbiosngexc +wrzhygdplumeqvpjtbiasngkxc +wrzhyndplumeqvajtpiosngkoc +wrzhyfdplumedvajtriowngkxc +wezjyndplumeqvajtbiosngkxc +wrmhyfdplumewiajtbiosngkxc +wrztyfdplumeqnajtbiobngkxc +wrzhyfdpyumeqvajjbijsngkxc +wrfhyfdplumeqkajtbiosnqkxc +wrzhyfdpllmezvartbiosngkxc +wszhyfdplumeqeajtbiqsngkxc +wrzhyfdplumeqwajtbnosnikxc +wrzvyfqulumeqvajtbiosngkxc +drzhyfdplureqvajtbiqsngkxc +wrzhyfdplumeqjamtbigsngkxc +wrzhyfdplumeqvajbbiosngzrc +grzhyfdpuumeqvajtbicsngkxc +wrrhyfdplumeqvajtgiosnggxc +wrzhyfkplumvqvajtbiosnhkxc +wrzhyfdplumeqvajtbicspgkxa +wrzhyfdplumeqvajtiiosnggoc +wfzhyfdplumyqvaytbiosngkxc +wrzhyfdpcumeqvajtbibsnfkxc +wrzhyfdplumeqvajtbigsnzkmc +wrzhyfdplcmeqvqjtriosngkxc +wrzhypdplwmeqvajtbiosnvkxc +wrziyfdmlumeqvaatbiosngkxc +wkzhyfdplsmeqvajobiosngkxc +wrzhyfdplumeqvkjvliosngkxc +wzzbyfdplumeqvajtbiolngkxc +wrzhyfdplvweqvajtbipsngkxc +wrzhyvdplumeqvujtbiosnfkxc +wrbhyfdplumedvajtbiosnhkxc +wrzhofdplumeqvajtbiosnskxy +wrzhyfdplumeqvaetbiohwgkxc +wezhyfoplumeqvajtbiosngmxc +wrzhykdblumeqvajtbiosngkjc +wrzhyddplwmeqvajtbioungkxc +wrzhyldplumqqvajpbiosngkxc +wrzhyfdtlumeqvajtbiusngkcc +wrzhyfdilumeqvajtbiosdgkxk +wrvhywdplumeqvajtbiosngoxc +wrzhyfdpyumeqvajtkiomngkxc +wrzhyfdpbummqvajtbiosngcxc +wrzhyfdpljmeqvajlbiosngjxc +wrzhyfdpmuieqdajtbiosngkxc +wrzgrfdplumeqvaktbiosngkxc +wrzhgrdpluueqvajtbiosngkxc +wazhyfdplhmeqvaqtbiosngkxc +wruhyfdplumeqvujtliosngkxc +wrzvyfdslumeqvajtbiwsngkxc +wrzhyfdplumeivactbiosqgkxc +wrzpyfdpbumeqvajtbioszgkxc +bgzhyfdplumeyvajtbiosngkxc +wrzhyfkplumeqvajtbiotngkxh +wrdhyfhplumexvajtbiosngkxc +brzhyfdpgumeqvgjtbiosngkxc +arzhqfdpeumeqvajtbiosngkxc +wrzhyftplumeqvajfbiosnykxc +wrzhyfdpcumeqvartbtosngkxc +wrzhvfzplumdqvajtbiosngkxc +wrzhyfdjlumeqvaetbiosjgkxc +wrbhyfdplumeqvajjjiosngkxc +wrxhyfdplumeqvajtbiyskgkxc +wpzhyydplumeqvajtbiosqgkxc +wrzhyfdplumzqvajtbzoongkxc +crzhyfdplnmeqvajtbjosngkxc +wrzhyfdpluveusajtbiosngkxc +wrzhypdpluyecvajtbiosngkxc +wrnhyfdplumeqvajtbioengoxc +wrzhypdplumefvajybiosngkxc +wrzhyfdplumeqvattviosngkdc +wrzhyfdplqmeqbajtbiostgkxc +wrghyfdpluveqvajtbiosngkxn +wryhyfdplumeqvajrbiopngkxc +wrzhyqdplumeqvajtbiwsngkxt +wrmoyfdpluheqvajtbiosngkxc +wrghyfdnlumeqvyjtbiosngkxc +wrzpyfdplumevvaatbiosngkxc +wrzhyfdplumhqvajtbiodngxxc +wrzhyfdplumeqcajtbioyjgkxc +wrzhyfdplumeqvajabirsngkgc +wrzhtfnplukeqvajtbiosngkxc +wqzhyfdplumeqvajtbiopegkxc +lrzhzfdplumeqdajtbiosngkxc +wrzzyfdplumeqvajnkiosngkxc +wrzhyfdflmmeqvajmbiosngkxc +wrzoyfdplumeqvjjtpiosngkxc +wrzhyfdpmpmeqvajhbiosngkxc +krvhyfdplumeqvajtbiossgkxc +wrzhyfdplumeqvaetviosnmkxc +wrzhyfzclumeqvajtbiosngwxc +wrzhyfdpvumeqvajtbiosngkcv +wrzhyfdpoumeqvajtbiozngoxc +wrzhyfwglumeqvajtbxosngkxc +wrshyfdplumeqiajtbiosngklc +wrzhyfdptdmeqvajtziosngkxc +wrwhyfdplumeqqajtbiosngkxj +wrzlyfypldmeqvajtbiosngkxc +wrzhyfdplumeqvajtbirknikxc +wrzhyhdplumeqvajtbmosnbkxc +wyzhyfiplumeqvwjtbiosngkxc +wrzgyfsplumeqvajtziosngkxc +wrzhrfdllumepvajtbiosngkxc +wrzayfdplumeqvajtbiosqgktc +whzhyfdplemnqvajtbiosngkxc +wazhyfdplumeqvaptbioongkxc +wrzhyfdpluueqvajtbiosnglvc +wrzhyfdplumjqvajmbionngkxc +wrzhofdplvmeqvajtbiosnqkxc +wrzhfidpluzeqvajtbiosngkxc +wrzhlfdpcumeqvaatbiosngkxc +wrzhyfdplumewvajtbiosigkoc +wrzjyfdplwmeqvajtbiodngkxc +wrzhyfdplumeqnsjtniosngkxc +wrzxyfdplxmeqvajtbiosngkdc +wrzhyfdplumpqvartbuosngkxc +orzhyfdplumeqzsjtbiosngkxc +wrzhyfdplumebvawtbiosngkxt +wrztyfdulumeqvajtbiosngkxy +wrzhytdplumeqvajtbznsngkxc +wrzhvfdplumeqvajtbinsngkxu +wezmyfdplumeqvajhbiosngkxc +wrzhhftplumeqvajtaiosngkxc +wrzhyfgplumeqvajtbioskgjxc +ujuhyfdplumeqvajtbiosngkxc +wryhymdplumeqvaftbiosngkxc +wrzhygdplumeqvajibiosfgkxc +frzhyfdppumeqvavtbiosngkxc +wruhyfdylumeqvajzbiosngkxc +wrzhzfdplumeqvajtbwosygkxc +wrzhyfdplumeqvaeteiojngkxc +wrhhyfdplumeqvajtiiopngkxc +irzhyfdplumeqvajtbiosngryc +wrvhycdpzumeqvajtbiosngkxc +wrzhyfdplumyqwajtboosngkxc +wrzthfdplumeqvajtbioengkxc +mrzhyfdalumeqvajtbiosngcxc +wrzhyfdflumpqvajtbiosngkmc +wrzhyfxplumeqvajtbiosnvkxo +wrzhyfdglumeqvajtbiosnfkxu +wrzhyfdnrumeqpajtbiosngkxc +wrzhlipplumeqvajtbiosngkxc +wrzhkfdplumemvajtbiohngkxc +wrziyfdmlumeqvaatbiosngkoc +wrzhyfdplwceqvajtbiosngzxc +wrzhyfdplumpqvactbiosngixc +wdzhyfdhdumeqvajtbiosngkxc +wnzhyfdplumeqvajtbbosngrxc +wrzhyfdblumeqvajtbiosngvxw +wyzhyfxpkumeqvajtbiosngkxc +wrzhywdplumjqvajgbiosngkxc +wrzhyfdpxumhqvajtbiokngkxc +wrzhxfpplumeqvajtbiosngkxk +mrzhyfdplumeqkajubiosngkxc +drzhyfdplumeqvajtbioingnxc +wrekyfdplumeqvajtbidsngkxc +wrzhyfdplumeanyjtbiosngkxc +wrzhyddpluzeqvajtbiosngtxc +wrzfyfdplumeqvaqtbiosngkxr +wrghywdpluneqvajtbiosngkxc +wrzhyfdplueeqvaptbioyngkxc +wrzhyqdpllmeqvajtbiosngdxc +whzhyfdxlumeqvajtbiosngksc +wrzjyfdplumeqvuitbiosngkxc +brzhyfdplumeqhajtbiolngkxc +wrzhyfqclureqvajtbiosngkxc +wwzhpfdplureqvajtbiosngkxc +wrzhyfdplumeqvavebijsngkxc +wrzhyfdpuumeqvajtsiosnkkxc +wrxhyfuplumeqvajtbiosngpxc +wrzhyfdplumeqvujlbiospgkxc +wrzvyfdplumeqvajtbiwsngpxc +wrzhyndplumeqvajtbiwsnekxc +wrzhkfdpoumeqvautbiosngkxc diff --git a/day2p2/main b/day2p2/main new file mode 100755 index 0000000000000000000000000000000000000000..94de502b3fb0c3c5fd22174bba17b215f5de7c0c GIT binary patch literal 17232 zcmeHO3v64}89t8tNK5OaU4c+uE~6}Ei<|Vdu&!XIaeFhRrId!p2Hd)~lUPmc%)ahY z1S28^;bnmgO&dZ?RFj6-gr>j{s@Nu_v`fmgvGN!MHa5cmIV&6CsleKL-+#{elj|EB zO`9}nlaF=pfBx@(oOAwr&b{~eo^xBUbxVcIB{;doMyf~5Ps1p&cOM6 zah{k5cn%J~7CUKYg%U8W)Ov1EvU^y|o%B4d$CPVGl>6 z3WZ?G^6B!tWQ^pM=V{tU3P?=tb`+cOIw=<8n+oY6-R^Ns*^XGU%W1ouwqrV}%VWy% zq?pigRQq$%X2>WpC0$B8-n1f=_j-w&ObwjGVI&`WK6KQ5 z-+Jqc1wURia!F>zeXk7cC)sCkkPm9tT>&p;7ZP?R4oXeI-@pCyzubGv_}8yH@3Qv> zxN9n*zK)QMbldPrbHYm@T`unUQER+7U}x(d4deo4XS6=&sP7uBb50j_yR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Zxn1g=sei`q@2>$Cey^;D89tB zX{zW>sKR|m&f;vlo78@#LIvSV?eDfidqAzEqMe+>uBK?RNBH6iE9wh0wbWUm4$XDM z)4o0F7&axwBEm;pXDHPve3AWe_*2wMD#^ZRG8IF!q?%?-$db{n5E)C7FtiHP>ZE5=ZSt62Tj4){;19{^+IM({2XDd0U5jf8`_@f#jL2Q z)4mz_N0^&&`8*F`x=!2idxf0**?ewCp604-&+`SQwOT;aK#CLF^SqLt(=;b!d!8RN z^^=h;IaqNMWHk3=d!BzV#rj~Gxc;oibT6bdmt~&kDNO6Ny|exr7B?e9F=cz6&oJfr zG?(ve{{d~^q#g47oGH)e$sTWiv*LF*Fp7zuX4Au8B~AH%3ysRUa-L`ghuz+*?U-gs z$(9`M#djgI+vDM?lBO#i9ggkU<^2wOo|iG@|7BR;;Z7XX_8foV)tZ_ztI=8Qe;5L) zKihk?0n=tS)YMu26Tt2EJRf9QLqc2P>(9^#G9DcKzX;Co=l;cZd>vndEvc|Q&sWFwi)t-o_Qdu~--6I? zFZ^1&UeP|yGGRNW??7O;@AE6oK5ftSblNljAu{BP>wnO%Bts?ay-GZN{scKHU#m~! zY|sA_vVe3c*(vuuB~j;L?XXk-KS$&E3plvleE(bkjO(r})w!lo(Z4&KbGfWb!?c+F Nyp2l3?J#h#;-7v0gTVj* literal 0 HcmV?d00001 diff --git a/day2p2/main.c b/day2p2/main.c new file mode 100644 index 0000000..22da8f2 --- /dev/null +++ b/day2p2/main.c @@ -0,0 +1,68 @@ +#include + +#include + +int strcmpmatch(const char *a, const char *b) +{ + int result = 0; + while (*a && *b) if (*a++ == *b++) result++; + return result; +} + +void stripnoncommon(char *a, const char *b) +{ + while (*a && *b) { + if (*a++ != *b++) { + memmove(a - 1, a, strlen(a)); + a--; + } + } + *a = '\0'; +} + +int main() +{ + gchar *contents; + gchar **strings; + GError *err = NULL; + + g_file_get_contents("input", &contents, NULL, &err); + if (err) { + fprintf(stderr, "%s\n", err->message); + g_error_free(err); + return 1; + } + g_strstrip(contents); + strings = g_strsplit(contents, "\n", -1); + g_free(contents); + + int bestmatch_len = 0; + char *bestmatch_1 = NULL; + char *bestmatch_2 = NULL; + + for (char **first = strings; *first; first++) { + for (char **second = strings; *second; second++) { + if (first == second) continue; + + int len = strcmpmatch(*first, *second); + if (len <= bestmatch_len) continue; + bestmatch_1 = *first; + bestmatch_2 = *second; + bestmatch_len = len; + } + } + + if (!bestmatch_1 || !bestmatch_2) { + puts("No match found!"); + goto end; + } + + char *final = g_strdup(bestmatch_1); + stripnoncommon(final, bestmatch_2); + puts(final); + g_free(final); + +end: + g_strfreev(strings); + return 0; +} diff --git a/day3p1/Makefile b/day3p1/Makefile new file mode 100644 index 0000000..c711967 --- /dev/null +++ b/day3p1/Makefile @@ -0,0 +1,12 @@ +CFLAGS := -Wall -Wextra -std=c17 -D_GNU_SOURCE + +LIBS := glib-2.0 +CFLAGS += $(shell pkg-config --cflags $(LIBS)) +LDLIBS := $(shell pkg-config --libs $(LIBS)) + +.PHONY: all +all: main + +.PHONY: clean +clean: + rm -f main diff --git a/day3p1/input b/day3p1/input new file mode 100644 index 0000000..51c36f3 --- /dev/null +++ b/day3p1/input @@ -0,0 +1,1331 @@ +#1 @ 527,351: 24x10 +#2 @ 384,468: 27x21 +#3 @ 547,294: 19x13 +#4 @ 910,172: 19x18 +#5 @ 409,238: 25x10 +#6 @ 677,768: 28x15 +#7 @ 864,215: 15x23 +#8 @ 961,184: 13x24 +#9 @ 469,837: 27x24 +#10 @ 732,616: 10x21 +#11 @ 755,237: 24x22 +#12 @ 63,940: 17x18 +#13 @ 381,528: 27x18 +#14 @ 964,69: 28x20 +#15 @ 464,847: 10x22 +#16 @ 777,846: 24x17 +#17 @ 323,659: 26x12 +#18 @ 456,31: 22x6 +#19 @ 252,240: 14x18 +#20 @ 742,392: 19x17 +#21 @ 607,796: 24x19 +#22 @ 330,946: 23x15 +#23 @ 890,419: 29x20 +#24 @ 683,508: 15x14 +#25 @ 735,167: 10x3 +#26 @ 772,736: 28x27 +#27 @ 712,413: 6x3 +#28 @ 829,51: 29x26 +#29 @ 128,330: 29x22 +#30 @ 475,927: 12x14 +#31 @ 921,59: 24x28 +#32 @ 409,852: 29x16 +#33 @ 391,577: 23x22 +#34 @ 123,173: 20x13 +#35 @ 292,780: 25x27 +#36 @ 452,786: 27x29 +#37 @ 537,74: 28x27 +#38 @ 943,46: 27x18 +#39 @ 732,163: 19x13 +#40 @ 226,306: 18x24 +#41 @ 591,834: 13x15 +#42 @ 478,863: 23x13 +#43 @ 710,408: 16x24 +#44 @ 59,450: 20x17 +#45 @ 973,165: 17x18 +#46 @ 768,223: 26x27 +#47 @ 254,654: 24x13 +#48 @ 157,961: 19x29 +#49 @ 965,552: 19x19 +#50 @ 521,805: 11x19 +#51 @ 729,906: 19x27 +#52 @ 210,340: 17x17 +#53 @ 345,447: 27x22 +#54 @ 957,562: 11x29 +#55 @ 655,610: 23x12 +#56 @ 469,206: 17x15 +#57 @ 717,448: 28x24 +#58 @ 494,88: 29x17 +#59 @ 906,982: 26x11 +#60 @ 865,539: 23x27 +#61 @ 308,521: 27x20 +#62 @ 746,452: 20x14 +#63 @ 831,632: 19x20 +#64 @ 81,119: 13x22 +#65 @ 367,881: 10x28 +#66 @ 672,435: 12x16 +#67 @ 171,727: 21x20 +#68 @ 143,28: 12x23 +#69 @ 618,127: 23x26 +#70 @ 914,36: 16x19 +#71 @ 353,827: 11x24 +#72 @ 593,308: 18x20 +#73 @ 105,433: 19x27 +#74 @ 843,818: 27x25 +#75 @ 562,275: 24x20 +#76 @ 334,185: 29x29 +#77 @ 756,32: 24x17 +#78 @ 796,388: 18x25 +#79 @ 862,122: 10x28 +#80 @ 297,776: 16x22 +#81 @ 233,80: 25x20 +#82 @ 903,335: 25x12 +#83 @ 396,481: 15x15 +#84 @ 939,112: 13x13 +#85 @ 740,842: 12x16 +#86 @ 941,902: 19x25 +#87 @ 439,495: 13x25 +#88 @ 799,753: 21x19 +#89 @ 764,110: 29x15 +#90 @ 179,241: 13x15 +#91 @ 799,328: 19x26 +#92 @ 194,262: 14x29 +#93 @ 305,169: 20x26 +#94 @ 978,563: 20x24 +#95 @ 292,254: 7x15 +#96 @ 409,350: 16x18 +#97 @ 943,712: 10x22 +#98 @ 667,975: 27x15 +#99 @ 652,39: 24x23 +#100 @ 61,13: 15x24 +#101 @ 31,646: 16x28 +#102 @ 13,738: 18x14 +#103 @ 913,417: 26x17 +#104 @ 56,302: 14x28 +#105 @ 675,758: 23x13 +#106 @ 427,237: 21x20 +#107 @ 871,205: 19x25 +#108 @ 563,88: 25x25 +#109 @ 923,371: 17x12 +#110 @ 26,127: 13x27 +#111 @ 875,293: 28x15 +#112 @ 767,409: 14x21 +#113 @ 390,419: 28x25 +#114 @ 438,211: 20x10 +#115 @ 160,41: 20x21 +#116 @ 754,302: 21x19 +#117 @ 146,930: 21x13 +#118 @ 806,77: 10x24 +#119 @ 390,722: 15x16 +#120 @ 339,81: 16x18 +#121 @ 453,442: 16x17 +#122 @ 880,714: 28x26 +#123 @ 952,929: 29x25 +#124 @ 843,432: 14x11 +#125 @ 620,343: 29x22 +#126 @ 102,576: 26x16 +#127 @ 10,682: 13x16 +#128 @ 81,896: 18x10 +#129 @ 884,555: 15x26 +#130 @ 70,784: 10x12 +#131 @ 32,428: 19x13 +#132 @ 14,926: 14x20 +#133 @ 219,107: 18x13 +#134 @ 517,57: 29x28 +#135 @ 658,788: 11x27 +#136 @ 273,315: 10x15 +#137 @ 598,306: 10x11 +#138 @ 797,408: 12x25 +#139 @ 156,204: 7x10 +#140 @ 40,534: 25x23 +#141 @ 649,872: 16x16 +#142 @ 271,648: 25x19 +#143 @ 856,10: 10x11 +#144 @ 916,155: 26x17 +#145 @ 845,635: 20x16 +#146 @ 186,217: 20x15 +#147 @ 756,742: 19x22 +#148 @ 399,409: 14x22 +#149 @ 57,166: 20x20 +#150 @ 975,560: 20x15 +#151 @ 89,81: 12x11 +#152 @ 478,336: 22x11 +#153 @ 772,305: 15x24 +#154 @ 940,556: 22x10 +#155 @ 539,912: 16x24 +#156 @ 910,408: 14x23 +#157 @ 473,843: 14x29 +#158 @ 819,883: 15x16 +#159 @ 948,481: 29x17 +#160 @ 761,34: 10x12 +#161 @ 171,456: 10x14 +#162 @ 705,463: 18x16 +#163 @ 483,845: 26x20 +#164 @ 254,244: 6x9 +#165 @ 955,182: 28x29 +#166 @ 156,377: 17x20 +#167 @ 471,680: 26x24 +#168 @ 652,64: 14x19 +#169 @ 356,477: 14x19 +#170 @ 233,48: 14x13 +#171 @ 827,547: 25x14 +#172 @ 385,294: 15x17 +#173 @ 635,285: 15x12 +#174 @ 181,217: 10x24 +#175 @ 447,681: 12x14 +#176 @ 21,543: 16x12 +#177 @ 170,336: 20x26 +#178 @ 232,237: 20x14 +#179 @ 40,387: 19x12 +#180 @ 216,813: 15x25 +#181 @ 806,393: 10x23 +#182 @ 234,192: 28x13 +#183 @ 917,40: 6x16 +#184 @ 430,827: 18x20 +#185 @ 684,251: 25x10 +#186 @ 114,340: 12x15 +#187 @ 597,187: 20x16 +#188 @ 598,954: 19x10 +#189 @ 370,75: 28x25 +#190 @ 96,772: 29x27 +#191 @ 969,178: 11x28 +#192 @ 618,458: 22x16 +#193 @ 533,62: 26x23 +#194 @ 445,80: 24x27 +#195 @ 171,749: 23x25 +#196 @ 427,251: 23x25 +#197 @ 780,317: 18x22 +#198 @ 613,684: 18x16 +#199 @ 153,408: 12x13 +#200 @ 290,884: 4x12 +#201 @ 500,90: 29x23 +#202 @ 628,320: 27x19 +#203 @ 387,257: 10x17 +#204 @ 967,799: 19x16 +#205 @ 397,124: 10x20 +#206 @ 770,10: 26x22 +#207 @ 925,362: 28x19 +#208 @ 528,959: 22x20 +#209 @ 876,165: 19x20 +#210 @ 20,934: 11x15 +#211 @ 67,588: 20x12 +#212 @ 925,7: 15x12 +#213 @ 121,186: 26x10 +#214 @ 425,208: 21x13 +#215 @ 871,570: 12x29 +#216 @ 882,261: 11x29 +#217 @ 938,206: 27x17 +#218 @ 386,485: 10x28 +#219 @ 198,932: 11x19 +#220 @ 173,347: 20x26 +#221 @ 260,222: 19x19 +#222 @ 208,592: 23x12 +#223 @ 879,526: 21x16 +#224 @ 211,691: 20x13 +#225 @ 950,394: 11x23 +#226 @ 289,642: 15x17 +#227 @ 340,81: 16x27 +#228 @ 813,968: 23x19 +#229 @ 160,938: 20x12 +#230 @ 29,33: 19x17 +#231 @ 896,270: 18x25 +#232 @ 781,750: 21x18 +#233 @ 298,598: 11x10 +#234 @ 261,871: 15x27 +#235 @ 294,497: 22x25 +#236 @ 362,53: 15x20 +#237 @ 850,193: 22x20 +#238 @ 317,205: 28x15 +#239 @ 670,848: 18x12 +#240 @ 925,379: 19x23 +#241 @ 434,745: 16x18 +#242 @ 388,4: 12x12 +#243 @ 969,97: 22x20 +#244 @ 269,834: 27x24 +#245 @ 574,828: 21x23 +#246 @ 415,229: 26x18 +#247 @ 196,688: 29x21 +#248 @ 149,52: 20x11 +#249 @ 957,620: 24x22 +#250 @ 962,720: 13x24 +#251 @ 674,441: 20x28 +#252 @ 948,395: 24x28 +#253 @ 100,721: 20x23 +#254 @ 814,573: 12x19 +#255 @ 757,405: 10x20 +#256 @ 817,633: 19x16 +#257 @ 741,49: 18x18 +#258 @ 923,715: 21x23 +#259 @ 398,358: 12x25 +#260 @ 625,662: 23x28 +#261 @ 38,49: 13x22 +#262 @ 230,800: 22x23 +#263 @ 127,112: 15x28 +#264 @ 229,240: 27x12 +#265 @ 699,80: 22x26 +#266 @ 877,525: 21x13 +#267 @ 266,741: 17x21 +#268 @ 297,379: 11x13 +#269 @ 103,469: 15x24 +#270 @ 955,761: 19x24 +#271 @ 371,244: 27x23 +#272 @ 813,964: 18x23 +#273 @ 887,857: 21x29 +#274 @ 582,337: 19x20 +#275 @ 209,439: 25x14 +#276 @ 560,186: 14x18 +#277 @ 18,340: 23x13 +#278 @ 659,347: 21x22 +#279 @ 923,928: 29x16 +#280 @ 776,916: 14x24 +#281 @ 296,143: 13x13 +#282 @ 26,912: 23x18 +#283 @ 980,326: 15x13 +#284 @ 628,910: 12x21 +#285 @ 454,356: 21x18 +#286 @ 74,368: 13x22 +#287 @ 6,657: 28x17 +#288 @ 595,719: 20x29 +#289 @ 934,75: 23x23 +#290 @ 618,337: 24x13 +#291 @ 777,632: 17x11 +#292 @ 247,164: 29x21 +#293 @ 625,920: 14x27 +#294 @ 0,376: 25x25 +#295 @ 252,176: 25x17 +#296 @ 772,262: 28x17 +#297 @ 264,385: 18x14 +#298 @ 181,819: 21x24 +#299 @ 326,192: 17x18 +#300 @ 392,611: 15x29 +#301 @ 625,815: 10x10 +#302 @ 191,760: 20x14 +#303 @ 398,582: 24x26 +#304 @ 328,837: 28x12 +#305 @ 728,617: 23x11 +#306 @ 835,357: 15x10 +#307 @ 69,941: 15x10 +#308 @ 811,957: 21x15 +#309 @ 92,796: 12x20 +#310 @ 652,972: 14x12 +#311 @ 133,766: 21x20 +#312 @ 550,169: 24x23 +#313 @ 515,985: 22x11 +#314 @ 980,12: 10x15 +#315 @ 754,945: 26x18 +#316 @ 855,418: 10x28 +#317 @ 971,846: 20x22 +#318 @ 6,135: 20x10 +#319 @ 449,751: 12x18 +#320 @ 704,428: 26x16 +#321 @ 571,210: 27x15 +#322 @ 498,4: 10x13 +#323 @ 745,299: 22x13 +#324 @ 341,852: 19x13 +#325 @ 26,663: 28x18 +#326 @ 864,42: 20x15 +#327 @ 135,148: 24x28 +#328 @ 256,215: 12x28 +#329 @ 467,499: 22x11 +#330 @ 836,259: 12x11 +#331 @ 46,879: 27x22 +#332 @ 498,950: 27x25 +#333 @ 973,645: 23x24 +#334 @ 752,417: 5x5 +#335 @ 136,97: 12x20 +#336 @ 660,170: 14x19 +#337 @ 351,819: 19x26 +#338 @ 556,363: 29x29 +#339 @ 566,381: 13x23 +#340 @ 780,721: 28x10 +#341 @ 799,945: 13x29 +#342 @ 874,135: 20x14 +#343 @ 47,158: 16x10 +#344 @ 426,611: 12x21 +#345 @ 864,334: 26x24 +#346 @ 356,905: 27x10 +#347 @ 503,522: 13x21 +#348 @ 187,965: 22x11 +#349 @ 591,774: 11x19 +#350 @ 764,192: 15x13 +#351 @ 935,563: 18x26 +#352 @ 772,413: 20x19 +#353 @ 975,365: 18x29 +#354 @ 355,652: 13x29 +#355 @ 665,35: 14x19 +#356 @ 291,136: 27x26 +#357 @ 335,341: 20x13 +#358 @ 26,146: 25x25 +#359 @ 305,593: 19x20 +#360 @ 330,702: 19x15 +#361 @ 589,605: 21x13 +#362 @ 250,867: 29x12 +#363 @ 854,124: 27x13 +#364 @ 266,582: 20x12 +#365 @ 520,445: 15x18 +#366 @ 11,744: 12x17 +#367 @ 92,624: 28x14 +#368 @ 181,307: 24x29 +#369 @ 397,815: 23x28 +#370 @ 319,51: 20x11 +#371 @ 922,705: 11x21 +#372 @ 300,755: 19x14 +#373 @ 331,987: 17x8 +#374 @ 832,634: 20x12 +#375 @ 576,38: 17x25 +#376 @ 923,402: 22x11 +#377 @ 544,898: 24x21 +#378 @ 369,15: 21x24 +#379 @ 141,130: 10x28 +#380 @ 711,333: 22x26 +#381 @ 390,881: 29x13 +#382 @ 975,0: 14x17 +#383 @ 863,703: 22x21 +#384 @ 68,658: 28x15 +#385 @ 934,919: 21x27 +#386 @ 941,476: 15x18 +#387 @ 547,12: 13x22 +#388 @ 455,440: 26x21 +#389 @ 443,348: 24x20 +#390 @ 663,137: 12x10 +#391 @ 239,727: 22x13 +#392 @ 465,762: 10x13 +#393 @ 142,7: 24x22 +#394 @ 519,829: 10x28 +#395 @ 851,784: 25x21 +#396 @ 515,319: 16x10 +#397 @ 74,437: 18x21 +#398 @ 117,123: 19x27 +#399 @ 220,354: 25x27 +#400 @ 797,320: 25x20 +#401 @ 437,711: 19x21 +#402 @ 860,780: 19x23 +#403 @ 273,920: 13x20 +#404 @ 658,34: 15x12 +#405 @ 890,17: 21x19 +#406 @ 836,120: 23x19 +#407 @ 896,300: 28x12 +#408 @ 969,247: 11x25 +#409 @ 185,238: 10x23 +#410 @ 895,5: 14x26 +#411 @ 971,948: 22x12 +#412 @ 960,77: 11x14 +#413 @ 461,93: 11x26 +#414 @ 757,448: 15x10 +#415 @ 714,411: 29x11 +#416 @ 847,205: 4x7 +#417 @ 972,625: 17x27 +#418 @ 749,64: 17x24 +#419 @ 732,397: 29x13 +#420 @ 329,579: 18x12 +#421 @ 25,208: 23x10 +#422 @ 689,205: 17x19 +#423 @ 698,553: 25x23 +#424 @ 267,258: 14x18 +#425 @ 634,182: 17x18 +#426 @ 203,51: 14x21 +#427 @ 643,829: 26x22 +#428 @ 791,959: 29x29 +#429 @ 934,3: 28x10 +#430 @ 239,748: 20x14 +#431 @ 210,767: 25x16 +#432 @ 207,932: 20x14 +#433 @ 811,93: 22x21 +#434 @ 628,425: 18x27 +#435 @ 591,716: 19x12 +#436 @ 856,42: 19x12 +#437 @ 635,313: 24x26 +#438 @ 626,186: 11x12 +#439 @ 438,712: 22x27 +#440 @ 111,736: 21x10 +#441 @ 332,452: 20x10 +#442 @ 202,426: 21x17 +#443 @ 445,613: 28x21 +#444 @ 169,741: 20x16 +#445 @ 807,114: 29x24 +#446 @ 208,649: 17x19 +#447 @ 627,593: 25x10 +#448 @ 28,815: 20x25 +#449 @ 354,701: 7x10 +#450 @ 970,852: 13x20 +#451 @ 348,99: 11x21 +#452 @ 449,840: 21x29 +#453 @ 437,706: 24x23 +#454 @ 742,100: 12x29 +#455 @ 481,166: 12x11 +#456 @ 332,392: 13x28 +#457 @ 557,718: 24x20 +#458 @ 819,876: 25x16 +#459 @ 975,324: 15x26 +#460 @ 26,202: 10x19 +#461 @ 862,76: 13x23 +#462 @ 792,47: 19x17 +#463 @ 511,305: 16x13 +#464 @ 794,596: 25x25 +#465 @ 745,556: 17x17 +#466 @ 227,705: 20x13 +#467 @ 221,87: 13x14 +#468 @ 922,771: 27x24 +#469 @ 861,720: 29x10 +#470 @ 729,521: 23x16 +#471 @ 485,495: 10x21 +#472 @ 26,736: 29x15 +#473 @ 453,26: 29x20 +#474 @ 361,87: 28x24 +#475 @ 199,667: 28x15 +#476 @ 47,217: 28x24 +#477 @ 967,538: 15x15 +#478 @ 725,115: 20x23 +#479 @ 494,900: 15x11 +#480 @ 320,625: 20x15 +#481 @ 690,511: 13x10 +#482 @ 430,391: 12x17 +#483 @ 949,467: 27x23 +#484 @ 857,50: 11x19 +#485 @ 502,480: 22x18 +#486 @ 64,170: 28x25 +#487 @ 971,542: 7x4 +#488 @ 917,337: 12x15 +#489 @ 0,877: 11x12 +#490 @ 453,62: 24x28 +#491 @ 861,544: 15x15 +#492 @ 750,751: 22x11 +#493 @ 939,382: 24x21 +#494 @ 761,188: 10x27 +#495 @ 168,467: 21x19 +#496 @ 743,937: 18x10 +#497 @ 790,118: 14x22 +#498 @ 760,384: 24x29 +#499 @ 83,367: 29x20 +#500 @ 89,672: 22x21 +#501 @ 354,184: 20x19 +#502 @ 206,204: 13x20 +#503 @ 338,563: 14x28 +#504 @ 918,167: 26x18 +#505 @ 631,788: 28x13 +#506 @ 89,332: 7x15 +#507 @ 441,390: 18x14 +#508 @ 305,961: 26x10 +#509 @ 637,722: 24x16 +#510 @ 543,851: 15x10 +#511 @ 387,604: 10x24 +#512 @ 410,950: 19x25 +#513 @ 750,306: 24x29 +#514 @ 422,473: 24x26 +#515 @ 947,731: 20x12 +#516 @ 328,420: 25x27 +#517 @ 488,893: 17x20 +#518 @ 462,777: 19x21 +#519 @ 234,682: 15x20 +#520 @ 867,12: 15x19 +#521 @ 434,879: 14x23 +#522 @ 671,347: 18x19 +#523 @ 770,299: 23x24 +#524 @ 193,753: 25x13 +#525 @ 321,754: 11x12 +#526 @ 402,560: 19x18 +#527 @ 430,688: 25x26 +#528 @ 42,374: 14x18 +#529 @ 186,927: 20x19 +#530 @ 477,497: 15x23 +#531 @ 516,777: 25x23 +#532 @ 65,113: 24x21 +#533 @ 291,167: 15x29 +#534 @ 898,461: 27x16 +#535 @ 337,106: 17x20 +#536 @ 336,344: 10x22 +#537 @ 137,706: 29x18 +#538 @ 552,704: 17x18 +#539 @ 144,821: 29x13 +#540 @ 213,106: 21x21 +#541 @ 482,193: 17x22 +#542 @ 329,984: 29x15 +#543 @ 28,264: 21x29 +#544 @ 960,431: 14x23 +#545 @ 196,674: 16x21 +#546 @ 310,31: 19x25 +#547 @ 98,344: 25x15 +#548 @ 762,103: 11x16 +#549 @ 315,723: 11x13 +#550 @ 872,9: 16x25 +#551 @ 172,289: 26x19 +#552 @ 341,471: 10x11 +#553 @ 500,630: 22x25 +#554 @ 405,701: 26x27 +#555 @ 480,339: 11x4 +#556 @ 736,251: 27x24 +#557 @ 948,275: 12x18 +#558 @ 823,578: 26x20 +#559 @ 503,0: 14x19 +#560 @ 336,533: 28x13 +#561 @ 498,736: 28x28 +#562 @ 749,210: 26x27 +#563 @ 810,40: 21x20 +#564 @ 283,282: 12x24 +#565 @ 498,33: 14x12 +#566 @ 594,490: 26x20 +#567 @ 764,783: 19x11 +#568 @ 219,329: 27x16 +#569 @ 445,492: 16x12 +#570 @ 578,788: 16x18 +#571 @ 323,826: 21x13 +#572 @ 65,222: 22x18 +#573 @ 642,750: 19x20 +#574 @ 933,387: 22x19 +#575 @ 144,322: 25x13 +#576 @ 173,923: 14x24 +#577 @ 637,45: 26x14 +#578 @ 21,559: 23x28 +#579 @ 646,880: 10x26 +#580 @ 495,899: 23x29 +#581 @ 416,842: 23x20 +#582 @ 621,121: 13x19 +#583 @ 978,239: 17x27 +#584 @ 724,627: 21x13 +#585 @ 503,751: 18x5 +#586 @ 559,84: 14x15 +#587 @ 904,786: 22x26 +#588 @ 62,691: 12x25 +#589 @ 50,499: 14x22 +#590 @ 474,367: 26x18 +#591 @ 290,508: 17x16 +#592 @ 274,895: 12x26 +#593 @ 654,734: 16x19 +#594 @ 131,167: 29x16 +#595 @ 818,739: 19x23 +#596 @ 586,269: 19x17 +#597 @ 690,760: 28x25 +#598 @ 214,691: 15x18 +#599 @ 858,30: 14x18 +#600 @ 357,202: 21x23 +#601 @ 452,2: 23x29 +#602 @ 978,663: 12x12 +#603 @ 362,853: 23x12 +#604 @ 288,299: 14x14 +#605 @ 680,750: 15x10 +#606 @ 906,953: 19x17 +#607 @ 369,496: 11x18 +#608 @ 555,827: 19x28 +#609 @ 614,95: 15x18 +#610 @ 227,755: 20x21 +#611 @ 942,548: 28x10 +#612 @ 908,314: 17x28 +#613 @ 643,0: 12x22 +#614 @ 26,668: 11x11 +#615 @ 124,50: 10x21 +#616 @ 465,174: 23x18 +#617 @ 22,197: 26x23 +#618 @ 711,854: 17x29 +#619 @ 266,541: 23x14 +#620 @ 300,872: 19x22 +#621 @ 977,101: 18x22 +#622 @ 523,960: 15x29 +#623 @ 387,90: 11x18 +#624 @ 262,264: 15x25 +#625 @ 177,155: 29x12 +#626 @ 132,161: 23x26 +#627 @ 46,769: 24x19 +#628 @ 840,51: 15x18 +#629 @ 273,401: 23x25 +#630 @ 392,580: 18x25 +#631 @ 74,380: 6x6 +#632 @ 709,25: 11x16 +#633 @ 223,201: 14x28 +#634 @ 25,115: 12x28 +#635 @ 36,351: 22x26 +#636 @ 540,596: 10x20 +#637 @ 703,772: 29x22 +#638 @ 51,668: 23x26 +#639 @ 181,212: 28x11 +#640 @ 376,2: 28x24 +#641 @ 654,34: 29x12 +#642 @ 792,716: 18x27 +#643 @ 390,634: 16x14 +#644 @ 303,945: 21x22 +#645 @ 754,123: 17x11 +#646 @ 565,594: 19x16 +#647 @ 699,871: 20x23 +#648 @ 363,74: 12x24 +#649 @ 275,388: 22x25 +#650 @ 776,557: 26x20 +#651 @ 683,847: 12x21 +#652 @ 599,848: 22x10 +#653 @ 78,599: 24x21 +#654 @ 123,565: 29x16 +#655 @ 232,712: 24x20 +#656 @ 392,862: 11x27 +#657 @ 199,104: 24x18 +#658 @ 36,609: 20x24 +#659 @ 755,478: 23x16 +#660 @ 136,772: 13x10 +#661 @ 13,977: 28x16 +#662 @ 575,423: 14x21 +#663 @ 720,586: 26x11 +#664 @ 948,907: 8x12 +#665 @ 221,730: 27x20 +#666 @ 28,352: 26x11 +#667 @ 129,777: 24x18 +#668 @ 454,857: 25x23 +#669 @ 53,457: 12x13 +#670 @ 607,558: 25x10 +#671 @ 71,839: 10x26 +#672 @ 174,755: 12x20 +#673 @ 290,251: 12x24 +#674 @ 142,351: 21x22 +#675 @ 476,376: 29x10 +#676 @ 972,770: 27x28 +#677 @ 488,214: 26x14 +#678 @ 87,785: 15x18 +#679 @ 638,11: 19x28 +#680 @ 896,977: 11x16 +#681 @ 96,948: 27x24 +#682 @ 135,371: 10x23 +#683 @ 815,113: 24x24 +#684 @ 263,820: 25x19 +#685 @ 943,140: 29x23 +#686 @ 546,30: 12x15 +#687 @ 278,379: 11x26 +#688 @ 239,494: 27x17 +#689 @ 43,542: 15x4 +#690 @ 847,84: 21x10 +#691 @ 54,681: 24x16 +#692 @ 665,121: 19x26 +#693 @ 473,90: 12x10 +#694 @ 284,224: 29x24 +#695 @ 271,969: 22x13 +#696 @ 893,324: 14x14 +#697 @ 892,510: 10x17 +#698 @ 827,808: 16x20 +#699 @ 559,53: 18x24 +#700 @ 839,105: 29x29 +#701 @ 691,970: 20x16 +#702 @ 821,736: 16x10 +#703 @ 583,212: 29x22 +#704 @ 348,850: 11x25 +#705 @ 180,520: 14x22 +#706 @ 824,92: 26x29 +#707 @ 632,174: 10x27 +#708 @ 822,95: 29x19 +#709 @ 940,563: 11x16 +#710 @ 825,837: 27x28 +#711 @ 601,429: 18x15 +#712 @ 700,453: 17x15 +#713 @ 901,96: 24x14 +#714 @ 617,62: 23x11 +#715 @ 738,575: 15x17 +#716 @ 605,593: 27x15 +#717 @ 802,865: 25x14 +#718 @ 564,594: 13x17 +#719 @ 33,52: 12x14 +#720 @ 112,152: 13x11 +#721 @ 757,392: 20x28 +#722 @ 520,317: 10x10 +#723 @ 746,9: 11x23 +#724 @ 291,53: 21x14 +#725 @ 554,93: 17x27 +#726 @ 596,172: 15x28 +#727 @ 441,878: 13x14 +#728 @ 802,424: 28x14 +#729 @ 293,188: 23x29 +#730 @ 539,108: 22x15 +#731 @ 296,293: 20x25 +#732 @ 290,523: 27x26 +#733 @ 700,852: 16x26 +#734 @ 919,478: 23x21 +#735 @ 664,850: 15x13 +#736 @ 72,612: 27x27 +#737 @ 872,73: 15x23 +#738 @ 891,7: 21x10 +#739 @ 754,381: 21x15 +#740 @ 670,38: 27x16 +#741 @ 269,327: 24x22 +#742 @ 735,619: 24x21 +#743 @ 632,338: 27x12 +#744 @ 178,346: 14x28 +#745 @ 656,599: 20x12 +#746 @ 94,494: 20x15 +#747 @ 393,960: 13x16 +#748 @ 887,265: 18x13 +#749 @ 362,337: 10x28 +#750 @ 890,192: 24x28 +#751 @ 599,973: 13x17 +#752 @ 61,316: 25x28 +#753 @ 647,28: 19x24 +#754 @ 194,649: 29x24 +#755 @ 43,36: 24x18 +#756 @ 147,396: 29x16 +#757 @ 70,372: 19x25 +#758 @ 305,758: 13x10 +#759 @ 281,165: 11x21 +#760 @ 317,838: 15x14 +#761 @ 216,333: 29x14 +#762 @ 19,984: 12x13 +#763 @ 17,894: 26x12 +#764 @ 174,386: 12x27 +#765 @ 180,743: 15x10 +#766 @ 75,855: 15x21 +#767 @ 946,533: 29x23 +#768 @ 477,511: 17x22 +#769 @ 519,480: 23x12 +#770 @ 775,272: 21x25 +#771 @ 510,332: 28x24 +#772 @ 900,26: 24x12 +#773 @ 605,343: 29x23 +#774 @ 216,860: 29x26 +#775 @ 200,263: 15x17 +#776 @ 343,313: 17x10 +#777 @ 407,472: 13x11 +#778 @ 780,175: 14x22 +#779 @ 852,214: 21x20 +#780 @ 477,699: 24x17 +#781 @ 593,598: 24x25 +#782 @ 798,308: 27x28 +#783 @ 740,38: 11x13 +#784 @ 222,492: 27x24 +#785 @ 740,757: 11x25 +#786 @ 635,850: 23x12 +#787 @ 295,17: 29x27 +#788 @ 297,388: 14x11 +#789 @ 753,78: 27x29 +#790 @ 216,681: 12x27 +#791 @ 273,530: 14x26 +#792 @ 815,40: 27x19 +#793 @ 869,594: 17x22 +#794 @ 265,972: 22x18 +#795 @ 904,568: 21x16 +#796 @ 824,386: 28x23 +#797 @ 727,448: 19x25 +#798 @ 516,639: 14x14 +#799 @ 287,365: 19x29 +#800 @ 701,889: 12x13 +#801 @ 25,896: 8x6 +#802 @ 321,624: 12x14 +#803 @ 600,282: 16x16 +#804 @ 952,399: 10x17 +#805 @ 41,609: 29x13 +#806 @ 489,605: 14x29 +#807 @ 361,493: 18x12 +#808 @ 316,357: 12x28 +#809 @ 714,401: 10x11 +#810 @ 194,927: 26x20 +#811 @ 952,280: 10x17 +#812 @ 960,208: 22x29 +#813 @ 744,225: 17x20 +#814 @ 787,931: 18x24 +#815 @ 863,939: 23x20 +#816 @ 548,201: 15x23 +#817 @ 262,362: 22x25 +#818 @ 297,651: 16x14 +#819 @ 454,753: 24x27 +#820 @ 772,900: 17x18 +#821 @ 375,737: 17x23 +#822 @ 209,216: 23x29 +#823 @ 487,280: 18x15 +#824 @ 847,71: 12x23 +#825 @ 808,688: 15x29 +#826 @ 593,599: 18x13 +#827 @ 633,977: 28x10 +#828 @ 585,277: 13x16 +#829 @ 632,722: 18x11 +#830 @ 320,931: 25x21 +#831 @ 866,693: 18x14 +#832 @ 136,797: 26x29 +#833 @ 249,705: 12x5 +#834 @ 851,460: 23x27 +#835 @ 114,148: 21x13 +#836 @ 970,756: 29x17 +#837 @ 213,434: 28x23 +#838 @ 105,505: 28x11 +#839 @ 334,666: 13x13 +#840 @ 162,208: 23x17 +#841 @ 671,397: 17x25 +#842 @ 729,47: 28x20 +#843 @ 959,868: 18x28 +#844 @ 69,829: 17x23 +#845 @ 473,795: 11x14 +#846 @ 359,637: 29x12 +#847 @ 349,205: 10x12 +#848 @ 430,488: 18x18 +#849 @ 924,35: 16x18 +#850 @ 712,27: 4x10 +#851 @ 894,278: 13x26 +#852 @ 66,321: 16x6 +#853 @ 311,375: 13x20 +#854 @ 821,803: 11x17 +#855 @ 28,147: 22x20 +#856 @ 165,932: 20x18 +#857 @ 254,895: 12x10 +#858 @ 307,837: 28x29 +#859 @ 705,206: 18x18 +#860 @ 102,283: 26x25 +#861 @ 444,620: 14x24 +#862 @ 652,758: 12x17 +#863 @ 210,334: 14x27 +#864 @ 948,557: 24x11 +#865 @ 51,708: 17x14 +#866 @ 190,475: 29x17 +#867 @ 665,778: 13x17 +#868 @ 337,475: 25x26 +#869 @ 533,521: 23x14 +#870 @ 35,347: 29x23 +#871 @ 109,342: 23x14 +#872 @ 892,869: 28x26 +#873 @ 325,944: 10x26 +#874 @ 22,195: 14x26 +#875 @ 46,714: 24x11 +#876 @ 617,337: 12x25 +#877 @ 98,950: 22x19 +#878 @ 823,492: 13x29 +#879 @ 853,264: 10x18 +#880 @ 410,843: 28x29 +#881 @ 207,654: 14x22 +#882 @ 736,22: 18x15 +#883 @ 173,963: 29x12 +#884 @ 5,878: 27x13 +#885 @ 906,949: 17x27 +#886 @ 868,82: 14x16 +#887 @ 517,967: 13x20 +#888 @ 606,958: 26x16 +#889 @ 206,691: 15x21 +#890 @ 254,909: 21x13 +#891 @ 428,123: 20x10 +#892 @ 547,100: 10x26 +#893 @ 67,452: 29x15 +#894 @ 833,811: 18x26 +#895 @ 561,636: 24x13 +#896 @ 701,748: 28x20 +#897 @ 766,432: 24x15 +#898 @ 869,31: 16x14 +#899 @ 935,471: 19x19 +#900 @ 343,465: 15x11 +#901 @ 630,458: 29x12 +#902 @ 30,919: 6x5 +#903 @ 494,40: 17x18 +#904 @ 599,671: 23x13 +#905 @ 506,103: 20x17 +#906 @ 104,56: 23x11 +#907 @ 110,154: 13x15 +#908 @ 508,36: 17x18 +#909 @ 24,128: 15x21 +#910 @ 214,676: 16x27 +#911 @ 265,894: 18x24 +#912 @ 158,226: 29x19 +#913 @ 79,505: 27x25 +#914 @ 4,670: 11x16 +#915 @ 912,838: 27x25 +#916 @ 277,352: 16x22 +#917 @ 661,399: 11x22 +#918 @ 410,461: 20x24 +#919 @ 261,220: 27x18 +#920 @ 396,116: 10x13 +#921 @ 313,839: 24x12 +#922 @ 784,329: 5x11 +#923 @ 217,475: 29x23 +#924 @ 938,56: 11x10 +#925 @ 468,86: 26x14 +#926 @ 920,396: 26x18 +#927 @ 895,469: 10x11 +#928 @ 821,483: 11x24 +#929 @ 862,663: 19x10 +#930 @ 904,93: 18x20 +#931 @ 195,803: 22x22 +#932 @ 40,327: 27x19 +#933 @ 16,47: 18x19 +#934 @ 344,854: 12x8 +#935 @ 551,510: 18x12 +#936 @ 100,299: 19x26 +#937 @ 195,426: 11x17 +#938 @ 541,379: 18x23 +#939 @ 759,712: 10x25 +#940 @ 708,858: 4x13 +#941 @ 30,937: 24x10 +#942 @ 346,318: 11x16 +#943 @ 452,667: 11x21 +#944 @ 477,202: 10x15 +#945 @ 16,747: 13x15 +#946 @ 15,55: 10x10 +#947 @ 718,907: 25x25 +#948 @ 790,128: 22x23 +#949 @ 226,692: 27x22 +#950 @ 322,759: 11x18 +#951 @ 458,918: 26x12 +#952 @ 308,34: 11x18 +#953 @ 523,802: 26x26 +#954 @ 549,107: 4x13 +#955 @ 909,597: 21x29 +#956 @ 332,488: 12x16 +#957 @ 937,897: 27x26 +#958 @ 905,971: 10x28 +#959 @ 558,643: 23x29 +#960 @ 590,961: 10x28 +#961 @ 830,264: 16x12 +#962 @ 773,323: 27x28 +#963 @ 941,85: 9x9 +#964 @ 753,477: 12x25 +#965 @ 905,402: 25x13 +#966 @ 877,51: 27x10 +#967 @ 149,706: 20x11 +#968 @ 162,517: 29x28 +#969 @ 634,755: 22x16 +#970 @ 80,809: 26x27 +#971 @ 22,384: 15x10 +#972 @ 882,659: 21x28 +#973 @ 23,131: 28x27 +#974 @ 205,529: 16x18 +#975 @ 512,822: 28x21 +#976 @ 278,412: 28x22 +#977 @ 508,627: 29x10 +#978 @ 569,74: 25x15 +#979 @ 495,610: 17x14 +#980 @ 659,334: 10x26 +#981 @ 980,801: 14x23 +#982 @ 851,408: 12x14 +#983 @ 726,871: 27x19 +#984 @ 175,972: 20x12 +#985 @ 97,578: 11x15 +#986 @ 75,265: 18x22 +#987 @ 737,838: 12x10 +#988 @ 976,569: 21x11 +#989 @ 255,584: 28x12 +#990 @ 963,919: 14x22 +#991 @ 369,65: 21x29 +#992 @ 916,563: 23x13 +#993 @ 208,376: 29x24 +#994 @ 85,268: 16x12 +#995 @ 300,424: 18x20 +#996 @ 581,295: 20x27 +#997 @ 827,840: 21x20 +#998 @ 580,436: 20x15 +#999 @ 341,405: 10x18 +#1000 @ 560,78: 10x11 +#1001 @ 120,4: 29x26 +#1002 @ 543,607: 15x15 +#1003 @ 1,845: 10x14 +#1004 @ 257,731: 21x21 +#1005 @ 70,779: 12x10 +#1006 @ 21,565: 10x20 +#1007 @ 175,207: 11x19 +#1008 @ 350,853: 6x14 +#1009 @ 824,545: 12x13 +#1010 @ 431,64: 28x28 +#1011 @ 451,677: 10x10 +#1012 @ 445,678: 17x23 +#1013 @ 73,193: 10x14 +#1014 @ 650,794: 23x16 +#1015 @ 264,966: 17x28 +#1016 @ 320,425: 27x23 +#1017 @ 74,695: 16x21 +#1018 @ 340,944: 28x10 +#1019 @ 333,469: 24x29 +#1020 @ 686,542: 22x28 +#1021 @ 496,39: 21x21 +#1022 @ 869,923: 14x21 +#1023 @ 871,907: 26x25 +#1024 @ 84,330: 21x21 +#1025 @ 329,714: 24x22 +#1026 @ 813,474: 15x25 +#1027 @ 761,550: 23x25 +#1028 @ 698,352: 28x11 +#1029 @ 531,16: 19x10 +#1030 @ 312,503: 19x25 +#1031 @ 297,302: 20x24 +#1032 @ 476,801: 13x22 +#1033 @ 350,539: 16x11 +#1034 @ 480,788: 16x17 +#1035 @ 316,881: 13x18 +#1036 @ 975,365: 19x28 +#1037 @ 84,89: 19x17 +#1038 @ 616,542: 10x24 +#1039 @ 931,532: 27x26 +#1040 @ 601,673: 17x7 +#1041 @ 874,135: 26x17 +#1042 @ 532,180: 23x16 +#1043 @ 476,2: 29x18 +#1044 @ 97,435: 18x25 +#1045 @ 812,812: 5x10 +#1046 @ 865,63: 17x20 +#1047 @ 913,158: 21x15 +#1048 @ 78,412: 16x23 +#1049 @ 864,137: 13x11 +#1050 @ 385,637: 24x19 +#1051 @ 122,494: 15x28 +#1052 @ 942,101: 29x21 +#1053 @ 288,153: 27x15 +#1054 @ 802,898: 23x17 +#1055 @ 447,182: 24x10 +#1056 @ 598,599: 10x22 +#1057 @ 622,812: 13x18 +#1058 @ 685,850: 6x14 +#1059 @ 656,523: 22x25 +#1060 @ 904,109: 25x12 +#1061 @ 28,139: 7x11 +#1062 @ 23,809: 25x20 +#1063 @ 391,954: 12x17 +#1064 @ 474,19: 14x22 +#1065 @ 204,579: 20x23 +#1066 @ 314,863: 22x25 +#1067 @ 573,235: 16x14 +#1068 @ 520,446: 15x12 +#1069 @ 355,662: 17x19 +#1070 @ 70,408: 27x26 +#1071 @ 769,519: 18x17 +#1072 @ 554,905: 4x5 +#1073 @ 948,834: 29x13 +#1074 @ 276,856: 21x24 +#1075 @ 975,453: 17x24 +#1076 @ 735,723: 27x15 +#1077 @ 82,397: 20x18 +#1078 @ 162,500: 14x28 +#1079 @ 411,88: 12x24 +#1080 @ 830,703: 22x25 +#1081 @ 227,862: 23x11 +#1082 @ 523,78: 15x26 +#1083 @ 363,876: 13x29 +#1084 @ 741,767: 26x28 +#1085 @ 934,379: 13x29 +#1086 @ 13,541: 27x27 +#1087 @ 738,521: 10x13 +#1088 @ 253,967: 16x12 +#1089 @ 440,729: 15x24 +#1090 @ 245,491: 22x14 +#1091 @ 405,69: 18x21 +#1092 @ 303,207: 24x29 +#1093 @ 896,72: 12x28 +#1094 @ 704,440: 17x19 +#1095 @ 666,157: 14x28 +#1096 @ 229,742: 11x14 +#1097 @ 964,880: 23x16 +#1098 @ 855,20: 29x29 +#1099 @ 307,590: 19x13 +#1100 @ 79,340: 26x19 +#1101 @ 315,591: 11x14 +#1102 @ 216,651: 15x13 +#1103 @ 575,387: 19x14 +#1104 @ 17,416: 19x23 +#1105 @ 132,32: 19x23 +#1106 @ 146,316: 24x21 +#1107 @ 121,131: 18x22 +#1108 @ 921,835: 24x13 +#1109 @ 233,42: 16x24 +#1110 @ 215,80: 22x13 +#1111 @ 624,808: 17x15 +#1112 @ 805,807: 16x19 +#1113 @ 845,195: 13x27 +#1114 @ 119,20: 21x20 +#1115 @ 596,950: 18x19 +#1116 @ 904,203: 26x12 +#1117 @ 176,150: 10x28 +#1118 @ 436,759: 16x16 +#1119 @ 949,388: 29x21 +#1120 @ 643,532: 16x24 +#1121 @ 279,411: 25x25 +#1122 @ 865,141: 11x19 +#1123 @ 755,752: 13x25 +#1124 @ 189,346: 10x23 +#1125 @ 928,599: 17x28 +#1126 @ 935,376: 14x25 +#1127 @ 68,585: 10x25 +#1128 @ 940,553: 21x27 +#1129 @ 586,944: 21x24 +#1130 @ 216,58: 28x27 +#1131 @ 760,390: 26x23 +#1132 @ 7,843: 15x11 +#1133 @ 772,529: 11x17 +#1134 @ 453,774: 10x10 +#1135 @ 148,216: 22x18 +#1136 @ 481,514: 25x19 +#1137 @ 972,755: 20x22 +#1138 @ 80,425: 11x6 +#1139 @ 641,289: 19x17 +#1140 @ 750,412: 10x18 +#1141 @ 17,142: 25x11 +#1142 @ 434,431: 13x13 +#1143 @ 301,602: 11x19 +#1144 @ 664,736: 17x23 +#1145 @ 152,222: 21x16 +#1146 @ 555,234: 22x17 +#1147 @ 816,387: 18x13 +#1148 @ 783,165: 17x23 +#1149 @ 397,681: 12x26 +#1150 @ 83,339: 13x15 +#1151 @ 402,447: 20x21 +#1152 @ 201,95: 10x22 +#1153 @ 784,256: 28x10 +#1154 @ 58,374: 22x15 +#1155 @ 213,472: 14x10 +#1156 @ 807,59: 16x23 +#1157 @ 126,26: 25x26 +#1158 @ 888,493: 13x20 +#1159 @ 613,421: 27x15 +#1160 @ 361,815: 29x13 +#1161 @ 656,175: 10x26 +#1162 @ 962,429: 21x18 +#1163 @ 884,922: 15x23 +#1164 @ 931,179: 14x12 +#1165 @ 830,838: 14x18 +#1166 @ 154,201: 15x17 +#1167 @ 19,962: 27x24 +#1168 @ 536,929: 15x10 +#1169 @ 225,864: 16x21 +#1170 @ 956,390: 22x11 +#1171 @ 18,915: 27x25 +#1172 @ 153,487: 28x16 +#1173 @ 470,261: 23x23 +#1174 @ 384,530: 20x17 +#1175 @ 218,873: 18x21 +#1176 @ 829,416: 25x22 +#1177 @ 132,548: 18x20 +#1178 @ 106,467: 28x12 +#1179 @ 310,418: 23x26 +#1180 @ 94,894: 19x11 +#1181 @ 607,96: 24x13 +#1182 @ 223,74: 12x19 +#1183 @ 749,424: 14x15 +#1184 @ 626,41: 21x10 +#1185 @ 772,769: 28x23 +#1186 @ 199,114: 28x29 +#1187 @ 519,968: 21x25 +#1188 @ 210,727: 10x26 +#1189 @ 792,859: 28x24 +#1190 @ 658,180: 28x13 +#1191 @ 759,250: 20x15 +#1192 @ 473,176: 15x10 +#1193 @ 565,819: 18x13 +#1194 @ 568,842: 21x20 +#1195 @ 36,277: 29x21 +#1196 @ 46,137: 18x22 +#1197 @ 859,248: 16x22 +#1198 @ 215,119: 17x17 +#1199 @ 475,844: 18x10 +#1200 @ 25,888: 24x24 +#1201 @ 490,609: 24x29 +#1202 @ 890,170: 11x22 +#1203 @ 627,320: 26x15 +#1204 @ 362,64: 27x21 +#1205 @ 790,956: 25x25 +#1206 @ 42,783: 10x18 +#1207 @ 967,125: 28x19 +#1208 @ 938,706: 26x17 +#1209 @ 365,888: 5x11 +#1210 @ 777,562: 26x24 +#1211 @ 166,188: 28x29 +#1212 @ 136,492: 27x18 +#1213 @ 756,112: 25x12 +#1214 @ 121,102: 12x29 +#1215 @ 225,704: 27x13 +#1216 @ 312,775: 25x10 +#1217 @ 413,851: 12x14 +#1218 @ 75,579: 28x24 +#1219 @ 817,682: 27x12 +#1220 @ 212,546: 24x14 +#1221 @ 419,207: 24x12 +#1222 @ 862,575: 26x26 +#1223 @ 611,580: 15x28 +#1224 @ 571,607: 28x26 +#1225 @ 164,401: 22x25 +#1226 @ 143,491: 26x14 +#1227 @ 962,565: 19x24 +#1228 @ 723,759: 19x24 +#1229 @ 787,615: 10x15 +#1230 @ 181,943: 28x10 +#1231 @ 246,692: 19x25 +#1232 @ 947,551: 27x26 +#1233 @ 294,57: 18x17 +#1234 @ 752,897: 26x20 +#1235 @ 745,3: 29x19 +#1236 @ 420,613: 19x12 +#1237 @ 433,226: 29x12 +#1238 @ 966,840: 28x17 +#1239 @ 780,434: 10x16 +#1240 @ 684,241: 17x23 +#1241 @ 357,91: 10x28 +#1242 @ 688,75: 20x29 +#1243 @ 262,497: 10x25 +#1244 @ 88,777: 27x21 +#1245 @ 671,977: 22x10 +#1246 @ 298,759: 19x24 +#1247 @ 663,349: 20x23 +#1248 @ 525,109: 23x28 +#1249 @ 841,837: 20x20 +#1250 @ 147,161: 19x15 +#1251 @ 75,161: 26x21 +#1252 @ 222,635: 23x28 +#1253 @ 839,688: 27x27 +#1254 @ 819,295: 20x28 +#1255 @ 77,378: 27x23 +#1256 @ 38,342: 27x11 +#1257 @ 934,46: 14x18 +#1258 @ 164,323: 16x19 +#1259 @ 198,482: 16x16 +#1260 @ 225,713: 26x18 +#1261 @ 292,515: 18x18 +#1262 @ 915,38: 11x23 +#1263 @ 924,121: 15x29 +#1264 @ 800,465: 23x15 +#1265 @ 215,733: 12x25 +#1266 @ 362,354: 23x29 +#1267 @ 962,547: 24x25 +#1268 @ 477,912: 20x22 +#1269 @ 518,3: 23x14 +#1270 @ 398,929: 21x29 +#1271 @ 603,70: 16x15 +#1272 @ 425,212: 25x20 +#1273 @ 753,89: 28x25 +#1274 @ 910,975: 29x23 +#1275 @ 917,113: 21x25 +#1276 @ 279,881: 27x27 +#1277 @ 84,351: 18x10 +#1278 @ 451,26: 13x20 +#1279 @ 164,240: 26x14 +#1280 @ 578,348: 28x25 +#1281 @ 472,795: 15x10 +#1282 @ 762,924: 24x12 +#1283 @ 524,792: 24x13 +#1284 @ 708,892: 22x17 +#1285 @ 50,345: 16x11 +#1286 @ 446,763: 15x21 +#1287 @ 639,794: 22x13 +#1288 @ 626,587: 15x14 +#1289 @ 54,514: 16x15 +#1290 @ 653,39: 16x28 +#1291 @ 337,441: 29x21 +#1292 @ 499,323: 20x27 +#1293 @ 18,42: 25x16 +#1294 @ 130,787: 10x14 +#1295 @ 801,246: 21x27 +#1296 @ 776,628: 19x23 +#1297 @ 826,359: 17x13 +#1298 @ 666,973: 12x26 +#1299 @ 234,662: 29x19 +#1300 @ 875,659: 11x11 +#1301 @ 607,474: 11x26 +#1302 @ 546,858: 10x14 +#1303 @ 645,745: 23x18 +#1304 @ 387,293: 21x20 +#1305 @ 347,692: 28x26 +#1306 @ 341,630: 21x13 +#1307 @ 604,405: 17x29 +#1308 @ 599,576: 20x23 +#1309 @ 793,948: 11x29 +#1310 @ 167,734: 12x13 +#1311 @ 917,167: 16x15 +#1312 @ 717,866: 21x14 +#1313 @ 617,177: 19x14 +#1314 @ 870,325: 14x14 +#1315 @ 318,568: 11x26 +#1316 @ 396,14: 29x11 +#1317 @ 176,934: 20x18 +#1318 @ 857,665: 29x15 +#1319 @ 849,465: 29x23 +#1320 @ 433,128: 20x18 +#1321 @ 137,113: 27x22 +#1322 @ 333,838: 26x22 +#1323 @ 735,64: 15x18 +#1324 @ 153,375: 23x24 +#1325 @ 416,214: 21x22 +#1326 @ 17,122: 17x24 +#1327 @ 736,44: 18x12 +#1328 @ 14,970: 28x12 +#1329 @ 233,342: 17x24 +#1330 @ 446,410: 17x24 +#1331 @ 308,708: 27x23 diff --git a/day3p1/main b/day3p1/main new file mode 100755 index 0000000000000000000000000000000000000000..16f902f26e40ccbe819f5aa8db1938867e2a7dba GIT binary patch literal 17248 zcmeHOeQ;FO6~DWiK)|qB5QGAi=SSLT$r3&r5aeyh3olLr5ee#`K9=kz*B(jZ0Ifb{NO0)Q%2g{exjTl(C}%p@2$lv|3YZ+ep#w79HaU3`J#o&b{|+-oEVG z=|7$6%-+ntbI$LabMJlU-Fx4?dG|h`H8t36Hb%+8Ze}RCCJRKB3T3%ufT*mNT>;l` zve|4L$R!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+0sO}W@Mi$WxLNCS5O77-*-TCYeytgh z{9?eT*vGyvQh?_@pArZKV(vE97Kue;ao9Z8#zxPk7_lw`j(~*xQ8>Nf3mYB5@Mdq& z@WsNBsNs$Gu(ohlchDd6``q7MP`f0*5grW*$U`drP%N^YwMV>Ne!~~<>e>!2Cdt6c zU$zqFgG8nP;d7G5f~-Z19`fObfA|5TTpMxPC>JxGXA;MXa@B?b$E4`# zW90K5ipo8Sl$(P%yp)SEcXWGK%)1$AEFx$pad5=RAL(Z9P&npyd+HjiW8Mxab%f&X z&G7&nRSfu;8>LQfw3E4g+e46_ps|S1Z1qQ?fp92CFhCda2fgSZx$a<$xp`3CF@F#6 z*k?c&<|n7z{!ZCTI(^_vlJF4SMR*Vo8GE||ZBS|$@`8(-7a%f&2gKaaal4>1<{3c# zO9jA$2Yc(pL)&oQrNk5uj@Wr4h&o#i~+Lioi-H@eHfy+XS6Zz9Ra|2+w1R;M~Ul67B zF_`d#d6?5ZAmCb*{AnFRv_=|J{mG8#7SQ9`mSkG55G8+W{izN+fWerOKdozs()yap zx8DCQ>0c)^r1cL`THm8TPW7z*djP|j$YnRa)J2k%{*NJ1URUCg;)Z0izassJj+l*s zw`9+LV)1v$c|Xxc3AFn!N@56`{^vF9C<;OY + +#include + +struct claim { + unsigned id; + unsigned x; + unsigned y; + unsigned w; + unsigned h; +}; + +struct claim *parseclaims(unsigned *len, const char *fname) +{ + FILE *f = fopen(fname, "r"); + if (!f) { + perror(fname); + return NULL; + } + + GArray *array = g_array_new(FALSE, FALSE, sizeof(struct claim)); + *len = 0; + + char *line = NULL; + size_t line_len = 0; + while (getline(&line, &line_len, f) != -1) { + struct claim claim = {0}; + + // Haha what is proper parsing + sscanf(line, "#%u @ %u,%u: %ux%u", + &claim.id, + &claim.x, + &claim.y, + &claim.w, + &claim.h + ); + + g_array_append_val(array, claim); + (*len)++; + } + + free(line); + fclose(f); + struct claim *res = (struct claim *)g_array_free(array, FALSE); + return res; +} + +int main() +{ + unsigned claims_len; + struct claim *claims = parseclaims(&claims_len, "input"); + if (!claims) return 1; + + char (*tilemap)[1000] = g_malloc0(sizeof(char[1000][1000])); + + for (struct claim *claim = claims; + claim < claims + claims_len; claim++) { + // Basic sanity check + if (claim->y > 1000 || + claim->y + claim->h > 1000 || + claim->x > 1000 || + claim->x + claim->w > 1000) { + fprintf(stderr, "Warning: Ignoring out-of-bounds claim: " + "#%u @ %u,%u: %ux%u\n", + claim->id, + claim->x, + claim->y, + claim->w, + claim->h + ); + continue; + } + + for (unsigned y = claim->y; y < claim->y + claim->h; y++) { + for (unsigned x = claim->x; x < claim->x + claim->w; x++) { + if (tilemap[y][x] >= 2) continue; + tilemap[y][x]++; + } + } + } + + int tally = 0; + for (char *i = *tilemap; i < *tilemap + 1000 * 1000; i++) { + if (*i >= 2) tally++; + } + + printf("%d\n", tally); + + g_free(claims); + g_free(tilemap); + return 0; +}