From fc2392d3b86099a0fab6962edfb0ab552d7a6c2b Mon Sep 17 00:00:00 2001 From: kirreen Date: Mon, 4 Dec 2023 22:15:58 +0100 Subject: [PATCH] solved day 1 in python, and day3a/b in c... maybe i'll free() later --- day1/day1.py | 20 + day1/input.bakeasy | 4 + day1/output | 1001 ++++++++++++++++++++++++++++++++ day2/' | 106 ++++ day2/day2b | Bin 15896 -> 15896 bytes day2/day2b.c | 5 +- day3/day3a | Bin 0 -> 16120 bytes day3/day3a.c | 203 +++++++ day3/erik.out | 269 +++++++++ day3/erik.out2 | 1097 +++++++++++++++++++++++++++++++++++ day3/erik.out3 | 1092 ++++++++++++++++++++++++++++++++++ day3/input | 140 +++++ day3/input.bakeasy | 10 + day3/mathias.out | 1092 ++++++++++++++++++++++++++++++++++ day3/mathias.out2 | 1092 ++++++++++++++++++++++++++++++++++ day3/output.txt | 1387 ++++++++++++++++++++++++++++++++++++++++++++ day3/symbolList | 5 + day3/test | Bin 0 -> 16016 bytes day3/test.c | 106 ++++ day3/test.out | 62 ++ day3/test.out2 | 1092 ++++++++++++++++++++++++++++++++++ 21 files changed, 8781 insertions(+), 2 deletions(-) create mode 100644 day1/day1.py create mode 100644 day1/input.bakeasy create mode 100644 day1/output create mode 100644 day2/' create mode 100755 day3/day3a create mode 100644 day3/day3a.c create mode 100644 day3/erik.out create mode 100644 day3/erik.out2 create mode 100644 day3/erik.out3 create mode 100644 day3/input create mode 100644 day3/input.bakeasy create mode 100644 day3/mathias.out create mode 100644 day3/mathias.out2 create mode 100644 day3/output.txt create mode 100644 day3/symbolList create mode 100755 day3/test create mode 100644 day3/test.c create mode 100644 day3/test.out create mode 100644 day3/test.out2 diff --git a/day1/day1.py b/day1/day1.py new file mode 100644 index 0000000..7b4a87f --- /dev/null +++ b/day1/day1.py @@ -0,0 +1,20 @@ +numbers = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "hoppasfanintedenhärstringenfinnsiinputfilen", + "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"] +file = open("./input", "r") +sum = 0 + +for line in file: + first = 999999 + last = i = 0 + index = [0, 0] + for number in numbers: + if (line.find(number)) != -1: + if (first := min(line.find(number), first)) is line.find(number): + index[0] = i + if (last := max(line.rfind(number), last)) is line.rfind(number): + index[1] = i + i += 1 + + sum += (index[0] % 10) * 10 + index[1] % 10 + +print(sum) diff --git a/day1/input.bakeasy b/day1/input.bakeasy new file mode 100644 index 0000000..7bbc69a --- /dev/null +++ b/day1/input.bakeasy @@ -0,0 +1,4 @@ +1abc2 +pqr3stu8vwx +a1b2c3d4e5f +treb7uchet diff --git a/day1/output b/day1/output new file mode 100644 index 0000000..cf1d87b --- /dev/null +++ b/day1/output @@ -0,0 +1,1001 @@ +69 +82 +28 +11 +98 +19 +59 +52 +16 +42 +38 +49 +73 +43 +26 +86 +66 +45 +17 +46 +78 +15 +62 +11 +79 +52 +45 +47 +24 +45 +77 +14 +37 +98 +52 +63 +63 +26 +54 +54 +83 +44 +16 +75 +67 +25 +51 +94 +52 +41 +57 +88 +47 +43 +17 +41 +55 +71 +71 +48 +81 +54 +29 +12 +34 +76 +75 +22 +68 +65 +18 +71 +93 +97 +25 +24 +26 +57 +92 +15 +67 +66 +81 +99 +83 +24 +33 +87 +48 +17 +12 +94 +66 +53 +29 +86 +41 +14 +38 +91 +71 +11 +93 +41 +44 +32 +99 +91 +13 +75 +26 +68 +19 +55 +48 +47 +77 +22 +84 +62 +38 +49 +95 +73 +19 +38 +46 +54 +42 +66 +31 +91 +46 +51 +93 +24 +68 +16 +56 +24 +55 +82 +69 +27 +59 +53 +19 +95 +43 +19 +78 +16 +57 +73 +72 +89 +59 +17 +49 +55 +96 +44 +24 +86 +39 +76 +57 +94 +21 +99 +62 +27 +71 +11 +84 +24 +34 +53 +74 +95 +88 +77 +59 +11 +17 +31 +88 +76 +64 +18 +66 +22 +84 +66 +44 +18 +91 +91 +66 +82 +51 +88 +77 +65 +29 +52 +17 +65 +81 +66 +27 +56 +15 +22 +26 +69 +28 +74 +84 +96 +92 +57 +18 +35 +65 +54 +82 +36 +71 +48 +25 +66 +56 +21 +32 +44 +35 +24 +69 +91 +86 +77 +39 +55 +12 +87 +96 +94 +62 +73 +71 +58 +16 +75 +52 +77 +51 +82 +41 +46 +33 +28 +15 +68 +23 +89 +36 +98 +68 +99 +47 +52 +33 +38 +74 +66 +28 +39 +99 +52 +41 +61 +81 +25 +59 +19 +57 +66 +98 +46 +38 +82 +93 +66 +63 +58 +38 +73 +59 +81 +99 +45 +88 +15 +42 +57 +32 +56 +73 +96 +57 +66 +57 +93 +93 +59 +78 +15 +88 +89 +19 +56 +51 +71 +32 +19 +82 +81 +12 +51 +68 +43 +92 +88 +17 +11 +31 +96 +88 +58 +71 +71 +33 +92 +85 +34 +91 +61 +27 +31 +81 +45 +67 +15 +22 +28 +25 +48 +56 +97 +53 +77 +73 +69 +19 +27 +38 +36 +49 +11 +45 +81 +77 +65 +64 +69 +86 +85 +16 +81 +62 +42 +59 +57 +51 +46 +94 +18 +82 +76 +81 +29 +66 +68 +23 +99 +37 +43 +74 +31 +69 +47 +64 +64 +15 +26 +96 +47 +72 +62 +94 +46 +57 +99 +83 +29 +39 +75 +54 +89 +43 +27 +29 +28 +45 +34 +77 +86 +83 +32 +16 +55 +44 +11 +38 +54 +85 +26 +58 +63 +67 +97 +94 +16 +26 +73 +72 +77 +24 +48 +65 +57 +55 +48 +27 +72 +93 +12 +17 +89 +65 +45 +41 +22 +82 +26 +41 +95 +91 +97 +57 +76 +56 +44 +39 +87 +91 +22 +18 +98 +38 +22 +47 +85 +38 +61 +41 +94 +27 +75 +54 +66 +26 +79 +78 +61 +99 +44 +27 +48 +73 +33 +43 +28 +27 +33 +41 +67 +81 +12 +42 +15 +72 +27 +84 +44 +59 +43 +93 +44 +55 +21 +57 +42 +94 +51 +74 +25 +94 +34 +33 +57 +67 +69 +44 +78 +44 +33 +98 +53 +29 +87 +72 +69 +46 +21 +48 +56 +89 +87 +18 +62 +34 +99 +52 +39 +24 +27 +26 +92 +32 +95 +93 +55 +49 +15 +43 +69 +77 +65 +54 +26 +93 +27 +59 +59 +45 +99 +94 +72 +29 +86 +78 +61 +37 +21 +68 +48 +41 +81 +16 +42 +47 +56 +78 +64 +55 +44 +26 +72 +45 +77 +56 +24 +78 +92 +39 +38 +45 +28 +15 +21 +62 +79 +68 +64 +77 +77 +61 +85 +94 +17 +13 +48 +93 +68 +26 +29 +98 +85 +29 +91 +56 +11 +17 +88 +81 +43 +95 +54 +29 +72 +84 +15 +29 +93 +13 +55 +66 +34 +89 +42 +33 +12 +44 +23 +55 +22 +79 +26 +89 +57 +11 +87 +98 +16 +67 +12 +71 +14 +43 +55 +72 +24 +62 +25 +88 +63 +41 +61 +65 +45 +98 +95 +98 +32 +45 +77 +55 +25 +48 +61 +88 +15 +36 +51 +93 +35 +31 +74 +63 +37 +41 +68 +65 +83 +58 +13 +58 +63 +74 +82 +71 +18 +19 +29 +87 +53 +86 +27 +91 +12 +44 +77 +71 +83 +51 +78 +82 +49 +74 +11 +85 +81 +18 +34 +59 +89 +24 +98 +78 +99 +54 +18 +56 +61 +28 +79 +46 +73 +17 +45 +93 +88 +27 +67 +48 +11 +32 +66 +96 +55 +63 +89 +97 +69 +92 +93 +62 +64 +41 +15 +37 +66 +84 +18 +32 +43 +11 +24 +74 +81 +41 +38 +39 +87 +65 +27 +99 +99 +46 +17 +71 +22 +17 +22 +28 +81 +81 +68 +11 +18 +57 +71 +66 +52 +91 +99 +28 +33 +75 +57 +22 +41 +71 +38 +33 +72 +64 +66 +76 +77 +11 +48 +13 +74 +72 +82 +24 +44 +39 +68 +22 +24 +62 +65 +37 +34 +29 +42 +75 +65 +99 +77 +63 +91 +14 +83 +46 +73 +54 +52 +37 +86 +26 +95 +19 +78 +99 +49 +35 +79 +16 +66 +94 +61 +86 +89 +44 +78 +11 +77 +85 +43 +42 +35 +56 +44 +12 +72 +51 +13 +38 +69 +18 +91 +88 +45 +38 +81 +91 +95 +54 +89 +91 +88 +22 +22 +92 +95 +77 +98 +13 +51 +25 +88 +46 +35 +41 +43 +27 +86 +23 +58 +65 +11 +26 +15 +41 +89 +98 +17 +43 +22 +11 +66 +79 +44 +79 +22 +79 +38 +82 +74 +97 +26 +96 +31 +56 +69 +47 +74 +29 +46 +28 +77 +69 +49 +22 +91 +58 +51 +25 +91 +53 +63 +63 +64 +79 +74 +94 +76 +66 +12 +75 +59 +66 +85 +33 +51 +13 +51 +81 +42 +63 +64 +34 +23 +22 +86 +16 +32 +49 +21 +82 +85 +55 +66 +19 +94 +72 +74 +31 +47 +88 +66 +88 +37 +42 +55 +55291 diff --git a/day2/' b/day2/' new file mode 100644 index 0000000..18f799c --- /dev/null +++ b/day2/' @@ -0,0 +1,106 @@ +#include +#include +#include + +#define MAX_GAMES 101 + +// cubes, R, G, B +const int cubes[3] = {12, 13, 14}; +const char *colors[] = {"red", "green", "blue"}; + +int getCubes(char *ptr); + +int main () +{ + int gameID = 0; + int gameSum = 0; + char row[160]; + char *ptr; + int length = 0; + int gameCubes[3] = {0, 0, 0}; + int gameHands = 0; + int offset = 0; + int game[MAX_GAMES] = {0}; + for (int i = 1; i < MAX_GAMES; i++) + game[i] = i; + int powerSum = 0; + + + FILE *input; + input = fopen("./input", "r"); + // for each row + while(fgets(row, 160, input) != NULL) { + // increment game count + gameID++; + gameHands = 1; + offset = 0; + for (int i = 0; i < 3; i++) gameCubes[i] = 0; + + printf("%s\n", row); + + // not neccesary to decide length when we know amount of ';'? + // length = strchr(row, '\n') - &row[0]; + // change each ; to \0 + ptr = row; + while(ptr = strchr(ptr, ';')) { + ptr[0] = '\0'; + gameHands++; + ptr++; + } + + printf("\nGame %d hands: %d\n", gameID, gameHands); + + // for each 'hand' (semicolon) ((NULL-char)) + for(gameHands; gameHands > 0; gameHands--) { + printf("%s\n", row + offset); + // for each color + for(int i = 0; i < 3; i++) { + // use strstr to find color, + // move pointer to the beginning of said colour + ptr = strstr(row + offset, colors[i]); + // if (strstr(row, colors[i]) != NULL) + if (ptr != NULL) { + if (gameCubes[i] < getCubes(ptr)) + gameCubes[i] = getCubes(ptr); + } + // higher than colors[i]? invalidate the game + if (gameCubes[i] > cubes[i]) { + game[gameID] = 0; + // printf("Game %d invalid\n", gameID); + } + } + // pointer = strstr \0 + 1 + offset += strlen(&row[offset]) + 1; + ptr = row + offset; + } + // printf("Game %d required RGB: %d, %d, %d\n", + // gameID, gameCubes[0],gameCubes[1],gameCubes[2] + // ); + + powerSum += gameCubes[0] * gameCubes[1] * gameCubes[2]; + printf("Game %d powersum: %d\nCurrent Total: %d\n", gameID, gameCubes[0] * gameCubes[1] * gameCubes[2], powerSum); + } + for (int i = gameID + 1; i < MAX_GAMES; i++) + game[i] = 0; + for (int i = 0; i < MAX_GAMES; i++) { + gameSum += game[i]; + } + printf("Game ID sum: %d\n", gameSum); + printf("Total power sum: %d\n", powerSum); +} + +int getCubes(char *ptr) +{ + int num = 0; + + // get two chars: pointer -3, pointer -2 + // convert them to an int + if (ptr[-3] >= '0' && ptr[-3] <= '9') { + num += (ptr[-3] - '0') * 10; + } + if (ptr[-2] >= '0' && ptr[-2] <= '9') { + num += ptr[-2] - '0'; + } + + return num; +} diff --git a/day2/day2b b/day2/day2b index bba0ef62f41b034c93d4f23a9feebda76f0935d2..014ee40596890d5678b618fd6e2267c00e3e4d6b 100755 GIT binary patch delta 1247 zcmZ`(O=uHQ5Z<>*e^S%NYFbbNwu&Gqmg=c3qE*yK(TiFTjx$e;B@YzpR*4NUcnW~};aOvN=4dS_R(CN(E zVqn#EG2IpyJn6P4J@TZ-o;2=BgPwG`Eb&xk0>nwI_+}TpxG}%NpV%U{>S`_n!*WET z;&M}F@N0|;%+Sfm^c>ov@daC42La3QRL!eKEHn$!Gm>nl`8QNBgb6WABhZ#keK1=f zBs|6z6-c%iDpk^y<&BaQZrVvvX-y{+oQz>=e37TbJ{POo&JnP9s<;Q*@&+zRn8h>c zFs_q7&C=PMNY3!AIN zdMl-5mbfYRgXac-;jZ^LHdUFvBghOwfdhJzRGQ#v0LEno7qh%M(+_bh zz@l~xeIg$cC%giLJP9hUCVv0n15E%LKhgN2Ek-~(t5=i=m=o|DvyQgE4YHUO*m=gsR?-(c4}h1`{S|J#on02Ll%=ZVHMv^xG delta 1222 zcmZ`&Pe>F|7@s%0sZ;6}{-Hw3J%k-1u}*83B&ye;lSUDNL3=0&GB7IGb{57LPOm9w z9N5DW9*Tl6mFZCAifrUSC2U?gl(&dAFF_Dw*7SYf%ub8Yz|Q>M_xJbx_IvqEJ~P$8 zG^f2=A>n#=gE-4M^s!f9*BJ&^`K z1J6o_B+T>DL7O=yFx3bGj3V07*^iz$4*=_NYr{knR-6a)kdRkt_~ZNB6r&KcJPPv} zG!XLya>F*BsB+UiaWO2lvRxA9d2d8iXEeyfj3P#<*(K><4M_#5XK&DxhN}#Lk6YrP zkNv$$vi2x)a9Y{MC4qTl1*LSKaf2)@^voW>u^_t@vrY1GqlnqcmD2JF;4g_j&x5ek zij^_`*_!Wr0x6&{%Zu=mbi}~c*JuQdp6-E?Y_f>Ocfy4;e zVIvJBO})CYv&QrTSvfTRxkYotLHVKrV^pAe1j;RCKyHhD0<@Veb^Wovc{!O zOqQi65GXNPw*Pp`(!y1&S%?%21u6v#F#yE4bZ`^Hy_g-x{{d7yhAuIe5CeKtfS3=% z5qA;4>-0bq=z*VfcF7ah0HBt5Z4kq?8KDcq=;9h=gaq`#wUK0{wVm1ckL8ZacQD4*> #include -#define MAX_GAMES 101 +#define MAX_GAMES 100 // cubes, R, G, B const int cubes[3] = {12, 13, 14}; @@ -36,7 +36,6 @@ int main () offset = 0; for (int i = 0; i < 3; i++) gameCubes[i] = 0; - printf("\nGame %d hands: %d\n", gameID, gameHands); printf("%s\n", row); // not neccesary to decide length when we know amount of ';'? @@ -49,6 +48,8 @@ int main () ptr++; } + printf("\nGame %d hands: %d\n", gameID, gameHands); + // for each 'hand' (semicolon) ((NULL-char)) for(gameHands; gameHands > 0; gameHands--) { printf("%s\n", row + offset); diff --git a/day3/day3a b/day3/day3a new file mode 100755 index 0000000000000000000000000000000000000000..f4beb8a618da460d66fcae0d3b19aa0a2c16465e GIT binary patch literal 16120 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 literal 0 HcmV?d00001 diff --git a/day3/day3a.c b/day3/day3a.c new file mode 100644 index 0000000..3e0d0c9 --- /dev/null +++ b/day3/day3a.c @@ -0,0 +1,203 @@ +#include +#include +#include +#include +#include +#include + +int rows = 0; +int columns; + +typedef struct { + int pos[2]; + int sum; + int len; + +} number; +typedef struct { + int length; + int listSize; + long unsigned int gearSum; + number numbers[]; +} numberList; + +numberList *findNumbers(); +numberList *addNumber(numberList *list, int sum, int len, int col, int row); +int readNumber(char **schematic, int *len, int *col, int row); +unsigned long int checkNumbers(char **schematic, numberList *list, int rows, int columns); + +int main () +{ + int columnsc = 0; + char c; + + numberList *list = malloc(sizeof(int) * 2 + sizeof(long unsigned int) + sizeof(number) * 8); + list->listSize = 8; + list->length = 0; + + FILE *input; + input = fopen("./input", "r"); + + // see dimensions of file + while ((c = fgetc(input)) != EOF) { + if (c == '\n') { + rows++; + if (columns < columnsc) + columns = columnsc; + columnsc = 0; + } else { // I could probably not do this every row but w/e + columnsc++; + } + } + + // allocate memory for the char array array + char **schematic = malloc(columns * sizeof(char*)); + for (int i = 0; i < columns; i++) + schematic[i] = malloc(rows * sizeof(char*)); + + // read the file again to fill up the array + rewind(input); + for (int row = 0; row < rows; row++) { + for (int col = 0; col < columns; col++) { + schematic[col][row] = fgetc(input); + } + fgetc(input); // discard \n + } + fclose(input); + + // just print the damn thing + // for (int row = 0; row < rows; row++) { + // for (int col = 0; col < columns; col++) { + // printf("%c", schematic[col][row]); + // } + // printf("\n"); + // } + printf("\nRows: %d\nColumns: %d\n\n", rows, columns); + + list = findNumbers(schematic, list); + printf("Found %d numbers.\n", list->length); + + printf("Total sum is %lu.\n", checkNumbers(schematic, list, rows, columns)); + printf("Gear ratio sum is %lu.\n", list->gearSum); +} + +// Test gear: count how many numbers are around it, if 2, multiply and return product +int checkGear(char **schematic, int col, int row) +{ + int numbers[2]; + int foundNumbers = 0; + int ratio = 0; + for (int y = row - 1; y <= row + 1; y++) { + if (y < 0) y++; + for (int x = col + 1; x >= col - 1; x--) { + if (x >= columns) x--; + if (x < 0) break; + + while (x < columns - 1 &&(schematic[x][y] >= '0' && schematic[x][y] <= '9' + && schematic[x + 1][y] >= '0' && schematic[x + 1][y] <= '9')) { + x++; + } + if (schematic[x][y] >= '0' && schematic[x][y] <= '9') { + if (foundNumbers >= 2) { + foundNumbers++; + } + + int len = 0; // TODO: Really not needed + numbers[foundNumbers] = readNumber(schematic, &len, &x, y); + foundNumbers++; + } + + } + } + + if (foundNumbers == 2) { + ratio = numbers[0] * numbers[1]; + printf("Values: %d and %d = %d\n", numbers[0], numbers[1], numbers[0] * numbers[1]); + } + return ratio; +} + +// Why is len a ptr? because I need to return two values duh +int readNumber(char **schematic, int *len, int *col, int row) +{ + int sum = 0; + while (*col >= 0 && schematic[*col][row] >= '0' && schematic[*col][row] <= '9') { + sum += (schematic[*col][row] - '0') * (int)pow(10, *len); + (*len)++; + (*col)--; + } + + (*col)++; + return sum; +} +// for each number in list, check adjacent fields +unsigned long int checkNumbers(char **schematic, numberList *list, int rows, int columns) +{ + unsigned long int sum = 0; + int previous; + for(int i = 0; i < list->length; i++) { + // make sure col or row is never too high / low + number num = list->numbers[i]; + for (int row = num.pos[1] - 1; row <= num.pos[1] + 1; row++) { + if (row < 0) row++; + if (row >= rows) break; + for (int col = num.pos[0] - 1; col < num.pos[0] + num.len + 1; col++) { + if (col < 0) col++; + if (col >= columns) break; + char c = schematic[col][row]; + + if (!isdigit(c) && c != '.'){ + previous = num.sum; + sum += num.sum; + goto nextIteration; + } + } + } + nextIteration: + } + + return sum; + +} + +// för varje position i 2D-arrayen, om siffra, leta efter dess "start" genom att gå åt vänster +// lagra en "pekare" till starten, längden (antalet siffror) och totalvärdet +// ^ gör en lista av dessa +// hoppa till slutet av den man hittade och iterera vidare genom sökfältet +numberList *findNumbers(char **schematic, numberList *list) +{ + for (int row = 0; row < rows; row++) { + for (int col = columns - 1; col >= 0; col--) { + if (schematic[col][row] == '*') { + int sum = checkGear(schematic, col, row); + printf("%d + %d = ", list->gearSum, sum); + list->gearSum += sum; + printf("%d\n", list->gearSum); + } + if (schematic[col][row] >= '0' && schematic[col][row] <= '9') { + int len = 0; + int sum = readNumber(schematic, &len, &col, row); + list = addNumber(list, sum, len, col, row); + } + } + } + + return list; +} + +numberList *addNumber(numberList *list, int sum, int len, int col, int row) +{ + if (list->length >= list->listSize) { + list->listSize = list->listSize * 2; + printf("Resizing!\n", list->listSize, list->length); + printf("size: %d length: %d\n", list->listSize, list->length); + list = realloc(list, list->listSize * sizeof(number) + sizeof(int) * 2 + sizeof(long unsigned int)); + } + list->numbers[list->length].pos[0] = col + 1; + list->numbers[list->length].pos[1] = row; + list->numbers[list->length].sum = sum; + list->numbers[list->length].len = len; + list->length++; + + return list; +} diff --git a/day3/erik.out b/day3/erik.out new file mode 100644 index 0000000..3ade994 --- /dev/null +++ b/day3/erik.out @@ -0,0 +1,269 @@ +Values: 101 and 893 +Values: 102 and 403 +Values: 103 and 343 +Values: 108 and 845 +Values: 110 and 773 +Values: 114 and 362 +Values: 114 and 480 +Values: 116 and 326 +Values: 116 and 988 +Values: 117 and 981 +Values: 126 and 390 +Values: 135 and 531 +Values: 145 and 313 +Values: 14 and 289 +Values: 152 and 280 +Values: 152 and 382 +Values: 154 and 203 +Values: 163 and 837 +Values: 164 and 650 +Values: 165 and 152 +Values: 165 and 717 +Values: 165 and 93 +Values: 167 and 364 +Values: 174 and 54 +Values: 175 and 666 +Values: 177 and 37 +Values: 17 and 735 +Values: 189 and 142 +Values: 202 and 184 +Values: 203 and 445 +Values: 203 and 604 +Values: 205 and 674 +Values: 206 and 193 +Values: 212 and 290 +Values: 213 and 760 +Values: 218 and 130 +Values: 218 and 639 +Values: 224 and 235 +Values: 225 and 919 +Values: 226 and 717 +Values: 229 and 902 +Values: 22 and 380 +Values: 230 and 793 +Values: 238 and 302 +Values: 240 and 969 +Values: 241 and 822 +Values: 241 and 881 +Values: 241 and 968 +Values: 253 and 984 +Values: 254 and 837 +Values: 257 and 875 +Values: 263 and 325 +Values: 263 and 746 +Values: 264 and 438 +Values: 266 and 387 +Values: 266 and 749 +Values: 267 and 7 +Values: 271 and 486 +Values: 273 and 806 +Values: 281 and 396 +Values: 289 and 447 +Values: 306 and 434 +Values: 310 and 752 +Values: 320 and 670 +Values: 322 and 769 +Values: 329 and 664 +Values: 332 and 491 +Values: 334 and 978 +Values: 335 and 318 +Values: 336 and 814 +Values: 336 and 883 +Values: 339 and 238 +Values: 343 and 283 +Values: 347 and 222 +Values: 347 and 817 +Values: 348 and 252 +Values: 349 and 924 +Values: 355 and 485 +Values: 355 and 838 +Values: 355 and 981 +Values: 356 and 891 +Values: 359 and 793 +Values: 359 and 807 +Values: 359 and 936 +Values: 365 and 553 +Values: 370 and 961 +Values: 375 and 838 +Values: 378 and 251 +Values: 378 and 91 +Values: 381 and 53 +Values: 381 and 922 +Values: 385 and 294 +Values: 387 and 875 +Values: 389 and 963 +Values: 394 and 427 +Values: 398 and 332 +Values: 3 and 162 +Values: 414 and 583 +Values: 419 and 261 +Values: 420 and 833 +Values: 424 and 227 +Values: 424 and 296 +Values: 439 and 299 +Values: 441 and 367 +Values: 44 and 224 +Values: 450 and 576 +Values: 454 and 245 +Values: 458 and 592 +Values: 460 and 105 +Values: 464 and 13 +Values: 473 and 709 +Values: 476 and 350 +Values: 488 and 409 +Values: 489 and 21 +Values: 498 and 268 +Values: 49 and 212 +Values: 509 and 310 +Values: 510 and 823 +Values: 512 and 723 +Values: 522 and 940 +Values: 524 and 978 +Values: 526 and 785 +Values: 527 and 73 +Values: 529 and 554 +Values: 536 and 501 +Values: 544 and 599 +Values: 544 and 619 +Values: 548 and 699 +Values: 566 and 266 +Values: 568 and 719 +Values: 569 and 498 +Values: 571 and 394 +Values: 580 and 308 +Values: 586 and 811 +Values: 588 and 243 +Values: 58 and 85 +Values: 591 and 169 +Values: 595 and 958 +Values: 5 and 434 +Values: 5 and 714 +Values: 600 and 826 +Values: 601 and 424 +Values: 609 and 477 +Values: 612 and 680 +Values: 617 and 179 +Values: 617 and 519 +Values: 622 and 769 +Values: 631 and 92 +Values: 637 and 324 +Values: 640 and 859 +Values: 643 and 698 +Values: 64 and 38 +Values: 64 and 971 +Values: 652 and 398 +Values: 653 and 734 +Values: 654 and 991 +Values: 661 and 598 +Values: 661 and 771 +Values: 662 and 587 +Values: 663 and 369 +Values: 667 and 742 +Values: 676 and 218 +Values: 678 and 233 +Values: 679 and 532 +Values: 679 and 670 +Values: 67 and 914 +Values: 688 and 586 +Values: 691 and 689 +Values: 694 and 101 +Values: 695 and 766 +Values: 698 and 616 +Values: 69 and 437 +Values: 700 and 831 +Values: 701 and 918 +Values: 702 and 242 +Values: 703 and 256 +Values: 704 and 195 +Values: 704 and 29 +Values: 704 and 94 +Values: 705 and 699 +Values: 710 and 112 +Values: 712 and 250 +Values: 717 and 911 +Values: 721 and 336 +Values: 723 and 507 +Values: 725 and 830 +Values: 727 and 179 +Values: 734 and 666 +Values: 735 and 361 +Values: 739 and 701 +Values: 741 and 637 +Values: 746 and 984 +Values: 749 and 491 +Values: 74 and 312 +Values: 74 and 374 +Values: 750 and 557 +Values: 750 and 638 +Values: 755 and 662 +Values: 75 and 313 +Values: 777 and 693 +Values: 782 and 420 +Values: 784 and 828 +Values: 784 and 940 +Values: 785 and 798 +Values: 788 and 964 +Values: 790 and 120 +Values: 793 and 790 +Values: 797 and 211 +Values: 806 and 675 +Values: 810 and 889 +Values: 813 and 998 +Values: 818 and 136 +Values: 81 and 56 +Values: 826 and 963 +Values: 82 and 23 +Values: 833 and 589 +Values: 834 and 346 +Values: 842 and 118 +Values: 844 and 906 +Values: 846 and 144 +Values: 848 and 904 +Values: 849 and 226 +Values: 851 and 949 +Values: 85 and 258 +Values: 860 and 219 +Values: 866 and 859 +Values: 86 and 308 +Values: 87 and 586 +Values: 889 and 66 +Values: 88 and 235 +Values: 89 and 265 +Values: 8 and 581 +Values: 900 and 152 +Values: 900 and 649 +Values: 908 and 496 +Values: 90 and 496 +Values: 910 and 620 +Values: 914 and 192 +Values: 91 and 794 +Values: 922 and 751 +Values: 928 and 730 +Values: 931 and 60 +Values: 932 and 344 +Values: 935 and 486 +Values: 938 and 59 +Values: 939 and 180 +Values: 943 and 445 +Values: 944 and 333 +Values: 947 and 740 +Values: 948 and 675 +Values: 949 and 11 +Values: 950 and 524 +Values: 950 and 912 +Values: 953 and 808 +Values: 954 and 665 +Values: 956 and 998 +Values: 957 and 474 +Values: 961 and 208 +Values: 962 and 308 +Values: 965 and 914 +Values: 96 and 421 +Values: 971 and 225 +Values: 972 and 408 +Values: 974 and 767 +Values: 975 and 360 +Values: 985 and 514 +Values: 98 and 55 +Values: 990 and 739 +Values: 9 and 402 diff --git a/day3/erik.out2 b/day3/erik.out2 new file mode 100644 index 0000000..0a1a598 --- /dev/null +++ b/day3/erik.out2 @@ -0,0 +1,1097 @@ +100 +101 +101 +101 +102 +103 +103 +104 +104 +105 +107 +108 +108 +11 +110 +110 +111 +112 +114 +114 +114 +116 +116 +116 +117 +118 +118 +118 +119 +12 +12 +120 +121 +124 +126 +126 +127 +128 +128 +128 +13 +130 +132 +135 +136 +138 +139 +14 +14 +142 +144 +144 +145 +146 +152 +152 +152 +152 +154 +156 +157 +157 +158 +161 +161 +162 +162 +162 +163 +163 +163 +163 +164 +165 +165 +165 +165 +165 +166 +166 +167 +169 +169 +17 +172 +174 +175 +176 +177 +179 +179 +179 +18 +180 +181 +181 +184 +188 +189 +19 +191 +192 +193 +193 +193 +194 +194 +195 +196 +196 +196 +196 +196 +197 +198 +199 +199 +201 +201 +202 +203 +203 +203 +203 +205 +205 +206 +206 +207 +208 +208 +209 +21 +211 +211 +211 +212 +212 +212 +213 +213 +214 +215 +216 +217 +218 +218 +218 +219 +22 +220 +222 +222 +224 +224 +224 +224 +224 +225 +225 +226 +226 +227 +229 +23 +23 +230 +230 +233 +233 +235 +235 +235 +238 +238 +239 +24 +240 +240 +241 +241 +241 +241 +241 +242 +243 +244 +245 +250 +251 +252 +253 +254 +254 +256 +256 +257 +258 +260 +261 +262 +262 +263 +263 +264 +265 +266 +266 +266 +267 +267 +267 +268 +268 +270 +270 +271 +272 +273 +278 +279 +28 +280 +280 +280 +281 +281 +281 +283 +284 +284 +284 +287 +288 +289 +289 +29 +29 +290 +294 +295 +296 +298 +298 +299 +299 +3 +3 +300 +302 +302 +304 +304 +306 +307 +308 +308 +308 +308 +309 +31 +310 +310 +310 +311 +311 +312 +313 +313 +313 +313 +315 +316 +316 +317 +318 +32 +320 +321 +322 +324 +324 +325 +325 +326 +329 +332 +332 +332 +333 +333 +334 +334 +334 +335 +335 +336 +336 +336 +336 +338 +338 +339 +339 +340 +340 +341 +343 +343 +344 +345 +346 +346 +347 +347 +348 +349 +35 +350 +350 +350 +354 +354 +355 +355 +355 +356 +357 +357 +357 +359 +359 +359 +359 +36 +360 +361 +362 +362 +363 +364 +365 +365 +366 +367 +367 +368 +369 +37 +37 +370 +370 +372 +374 +375 +375 +378 +378 +379 +38 +38 +380 +380 +380 +381 +381 +381 +382 +383 +384 +385 +385 +385 +385 +387 +387 +387 +389 +389 +39 +390 +394 +394 +395 +396 +397 +398 +398 +398 +401 +402 +403 +403 +404 +407 +408 +409 +409 +414 +414 +415 +418 +419 +420 +420 +420 +420 +421 +421 +422 +423 +424 +424 +424 +425 +426 +427 +427 +428 +431 +432 +432 +433 +434 +434 +436 +437 +438 +438 +439 +439 +44 +440 +441 +441 +441 +444 +445 +445 +446 +446 +447 +447 +447 +447 +448 +449 +450 +451 +451 +452 +454 +455 +458 +460 +462 +463 +464 +464 +464 +465 +466 +468 +470 +471 +473 +474 +474 +476 +476 +476 +477 +480 +480 +482 +483 +485 +485 +486 +486 +486 +488 +489 +49 +49 +49 +490 +491 +491 +492 +496 +496 +498 +498 +5 +5 +5 +501 +501 +501 +501 +503 +505 +507 +508 +509 +509 +51 +510 +511 +512 +514 +515 +517 +518 +518 +519 +522 +524 +524 +524 +526 +526 +527 +527 +528 +529 +53 +53 +530 +531 +532 +536 +536 +54 +54 +544 +544 +544 +548 +55 +553 +554 +557 +557 +558 +56 +56 +560 +561 +562 +565 +566 +566 +568 +569 +569 +57 +571 +576 +578 +579 +58 +58 +580 +581 +582 +583 +584 +585 +586 +586 +586 +586 +587 +588 +589 +589 +59 +59 +591 +591 +592 +593 +595 +595 +596 +598 +599 +60 +60 +60 +60 +600 +601 +603 +604 +604 +607 +608 +608 +609 +61 +612 +614 +616 +617 +617 +619 +619 +62 +62 +620 +622 +624 +625 +629 +63 +631 +632 +632 +633 +637 +637 +638 +639 +64 +64 +640 +640 +643 +644 +644 +645 +647 +649 +65 +650 +650 +650 +651 +652 +653 +654 +66 +66 +661 +661 +661 +662 +662 +662 +663 +664 +664 +665 +666 +666 +666 +666 +667 +67 +67 +67 +670 +670 +672 +672 +674 +675 +675 +676 +678 +678 +679 +679 +679 +680 +682 +684 +684 +688 +688 +689 +69 +69 +691 +691 +691 +692 +693 +694 +694 +694 +695 +697 +698 +698 +698 +699 +699 +699 +7 +70 +700 +701 +701 +701 +702 +703 +704 +704 +704 +705 +705 +706 +707 +708 +708 +709 +709 +710 +710 +711 +712 +712 +713 +713 +714 +716 +717 +717 +717 +718 +719 +719 +72 +721 +721 +723 +723 +724 +724 +725 +726 +727 +727 +728 +728 +73 +73 +730 +731 +734 +734 +734 +735 +735 +736 +739 +739 +74 +74 +74 +740 +740 +740 +741 +741 +741 +742 +742 +743 +744 +744 +744 +746 +746 +746 +748 +749 +749 +749 +75 +750 +750 +750 +751 +751 +752 +752 +753 +754 +755 +757 +758 +760 +761 +765 +766 +767 +767 +768 +769 +769 +77 +771 +772 +773 +773 +774 +774 +775 +777 +78 +781 +782 +783 +784 +784 +785 +785 +786 +788 +788 +788 +789 +790 +790 +790 +790 +791 +791 +792 +792 +793 +793 +793 +793 +794 +795 +796 +797 +798 +8 +8 +80 +801 +803 +806 +806 +807 +807 +808 +81 +81 +810 +811 +813 +814 +814 +815 +817 +817 +818 +82 +82 +822 +823 +825 +826 +826 +826 +826 +827 +828 +828 +83 +830 +831 +833 +833 +834 +837 +837 +838 +838 +838 +838 +84 +84 +842 +842 +844 +844 +845 +845 +846 +848 +849 +849 +85 +85 +85 +851 +854 +859 +859 +86 +86 +860 +860 +862 +864 +866 +87 +871 +874 +874 +875 +875 +877 +88 +88 +88 +881 +883 +884 +884 +885 +887 +889 +889 +889 +89 +890 +891 +893 +893 +895 +896 +896 +897 +897 +9 +9 +90 +90 +90 +900 +900 +901 +901 +902 +904 +906 +908 +908 +91 +91 +91 +91 +910 +911 +911 +911 +912 +912 +914 +914 +914 +914 +914 +915 +916 +917 +918 +918 +919 +92 +922 +922 +923 +923 +923 +924 +925 +925 +926 +926 +927 +927 +928 +929 +93 +93 +930 +930 +931 +931 +932 +932 +933 +935 +936 +936 +938 +939 +939 +94 +94 +940 +940 +941 +942 +942 +942 +943 +944 +944 +945 +947 +948 +948 +948 +949 +949 +95 +950 +950 +952 +953 +954 +954 +955 +956 +956 +957 +957 +958 +959 +959 +959 +96 +96 +960 +961 +961 +962 +963 +963 +963 +964 +964 +965 +968 +968 +969 +969 +97 +97 +970 +971 +971 +971 +972 +973 +974 +975 +977 +977 +978 +978 +978 +978 +98 +981 +981 +984 +984 +984 +984 +985 +985 +987 +988 +988 +989 +990 +990 +991 +992 +993 +993 +998 +998 +998 diff --git a/day3/erik.out3 b/day3/erik.out3 new file mode 100644 index 0000000..f90cbf9 --- /dev/null +++ b/day3/erik.out3 @@ -0,0 +1,1092 @@ +100 +101 +101 +101 +102 +103 +103 +104 +104 +105 +107 +108 +108 +11 +110 +110 +111 +112 +114 +114 +114 +116 +116 +116 +117 +118 +118 +118 +119 +12 +12 +120 +121 +124 +126 +126 +127 +128 +128 +128 +13 +130 +132 +135 +136 +138 +139 +14 +14 +142 +144 +144 +145 +146 +152 +152 +152 +152 +154 +156 +157 +157 +158 +161 +161 +162 +162 +162 +163 +163 +163 +163 +164 +165 +165 +165 +165 +165 +166 +166 +167 +169 +169 +17 +172 +174 +175 +176 +177 +179 +179 +179 +18 +180 +181 +181 +184 +188 +189 +19 +191 +192 +193 +193 +193 +194 +194 +195 +196 +196 +196 +196 +196 +197 +198 +199 +199 +201 +201 +202 +203 +203 +203 +203 +205 +205 +206 +206 +207 +208 +208 +209 +21 +211 +211 +211 +212 +212 +212 +213 +213 +214 +215 +216 +217 +218 +218 +218 +219 +22 +220 +222 +222 +224 +224 +224 +224 +224 +225 +225 +226 +226 +227 +229 +23 +23 +230 +230 +233 +233 +235 +235 +235 +238 +238 +239 +24 +240 +240 +241 +241 +241 +241 +241 +242 +243 +244 +245 +250 +251 +252 +253 +254 +254 +256 +256 +257 +258 +260 +261 +262 +262 +263 +263 +264 +265 +266 +266 +266 +267 +267 +267 +268 +268 +270 +271 +272 +273 +278 +279 +28 +280 +280 +280 +281 +281 +281 +283 +284 +284 +284 +287 +288 +289 +289 +29 +29 +290 +294 +295 +296 +298 +298 +299 +299 +3 +3 +300 +302 +302 +304 +304 +306 +307 +308 +308 +308 +308 +309 +31 +310 +310 +310 +311 +311 +312 +313 +313 +313 +313 +315 +316 +316 +317 +318 +32 +320 +321 +322 +324 +324 +325 +325 +326 +329 +332 +332 +332 +333 +333 +334 +334 +335 +335 +336 +336 +336 +336 +338 +338 +339 +339 +340 +340 +343 +343 +344 +345 +346 +346 +347 +347 +348 +349 +35 +350 +350 +350 +354 +354 +355 +355 +355 +356 +357 +357 +357 +359 +359 +359 +359 +36 +360 +361 +362 +362 +363 +364 +365 +365 +366 +367 +367 +368 +369 +37 +37 +370 +370 +372 +374 +375 +375 +378 +378 +379 +38 +38 +380 +380 +380 +381 +381 +381 +382 +383 +384 +385 +385 +385 +385 +387 +387 +387 +389 +389 +39 +390 +394 +394 +395 +396 +397 +398 +398 +398 +401 +402 +403 +403 +404 +407 +408 +409 +409 +414 +414 +415 +418 +419 +420 +420 +420 +420 +421 +421 +422 +423 +424 +424 +424 +425 +426 +427 +427 +428 +431 +432 +432 +433 +434 +434 +436 +437 +438 +438 +439 +439 +44 +440 +441 +441 +441 +444 +445 +445 +446 +446 +447 +447 +447 +447 +448 +449 +450 +451 +451 +452 +454 +455 +458 +460 +462 +463 +464 +464 +465 +466 +468 +470 +471 +473 +474 +474 +476 +476 +476 +477 +480 +480 +482 +483 +485 +485 +486 +486 +486 +488 +489 +49 +49 +49 +490 +491 +491 +492 +496 +496 +498 +498 +5 +5 +5 +501 +501 +501 +501 +503 +505 +507 +508 +509 +509 +51 +510 +511 +512 +514 +515 +517 +518 +518 +519 +522 +524 +524 +524 +526 +526 +527 +527 +528 +529 +53 +53 +530 +531 +532 +536 +536 +54 +54 +544 +544 +544 +548 +55 +553 +554 +557 +557 +558 +56 +56 +560 +561 +562 +565 +566 +566 +568 +569 +569 +57 +571 +576 +578 +579 +58 +58 +580 +581 +582 +583 +584 +585 +586 +586 +586 +586 +587 +588 +589 +589 +59 +59 +591 +591 +592 +593 +595 +595 +596 +598 +599 +60 +60 +60 +60 +600 +601 +603 +604 +604 +607 +608 +608 +609 +61 +612 +614 +616 +617 +617 +619 +619 +62 +62 +620 +622 +624 +625 +629 +63 +631 +632 +632 +633 +637 +637 +638 +639 +64 +64 +640 +640 +643 +644 +644 +645 +647 +649 +65 +650 +650 +650 +651 +652 +653 +654 +66 +66 +661 +661 +662 +662 +662 +663 +664 +664 +665 +666 +666 +666 +666 +667 +67 +67 +67 +670 +670 +672 +672 +674 +675 +675 +676 +678 +678 +679 +679 +679 +680 +682 +684 +684 +688 +688 +689 +69 +69 +691 +691 +691 +692 +693 +694 +694 +694 +695 +697 +698 +698 +698 +699 +699 +699 +7 +70 +700 +701 +701 +701 +702 +703 +704 +704 +704 +705 +705 +706 +707 +708 +708 +709 +709 +710 +710 +711 +712 +712 +713 +713 +714 +716 +717 +717 +717 +718 +719 +719 +72 +721 +721 +723 +723 +724 +724 +725 +726 +727 +727 +728 +728 +73 +73 +730 +731 +734 +734 +734 +735 +735 +736 +739 +739 +74 +74 +74 +740 +740 +740 +741 +741 +741 +742 +742 +743 +744 +744 +744 +746 +746 +746 +748 +749 +749 +749 +75 +750 +750 +750 +751 +751 +752 +752 +753 +754 +755 +757 +758 +760 +761 +765 +766 +767 +767 +768 +769 +769 +77 +771 +772 +773 +773 +774 +774 +775 +777 +78 +781 +782 +783 +784 +784 +785 +785 +786 +788 +788 +788 +789 +790 +790 +790 +790 +791 +791 +792 +792 +793 +793 +793 +793 +794 +795 +796 +797 +798 +8 +8 +80 +801 +803 +806 +806 +807 +807 +808 +81 +81 +810 +811 +813 +814 +814 +815 +817 +817 +818 +82 +82 +822 +823 +825 +826 +826 +826 +826 +827 +828 +828 +83 +830 +831 +833 +833 +834 +837 +837 +838 +838 +838 +838 +84 +84 +842 +842 +844 +844 +845 +845 +846 +848 +849 +849 +85 +85 +85 +851 +854 +859 +859 +86 +86 +860 +860 +862 +864 +866 +87 +871 +874 +874 +875 +875 +877 +88 +88 +88 +881 +883 +884 +884 +885 +887 +889 +889 +889 +89 +890 +891 +893 +893 +895 +896 +896 +897 +897 +9 +9 +90 +90 +90 +900 +900 +901 +901 +902 +904 +906 +908 +908 +91 +91 +91 +91 +910 +911 +911 +911 +912 +912 +914 +914 +914 +914 +914 +915 +916 +917 +918 +918 +919 +92 +922 +922 +923 +923 +923 +924 +925 +925 +926 +926 +927 +927 +928 +929 +93 +93 +930 +930 +931 +931 +932 +932 +933 +935 +936 +936 +938 +939 +939 +94 +94 +940 +940 +941 +942 +942 +942 +943 +944 +944 +945 +947 +948 +948 +948 +949 +949 +95 +950 +950 +952 +953 +954 +954 +955 +956 +956 +957 +957 +958 +959 +959 +959 +96 +96 +960 +961 +961 +962 +963 +963 +963 +964 +964 +965 +968 +968 +969 +969 +97 +97 +970 +971 +971 +971 +972 +973 +974 +975 +977 +977 +978 +978 +978 +978 +98 +981 +981 +984 +984 +984 +984 +985 +985 +987 +988 +988 +989 +990 +990 +991 +992 +993 +993 +998 +998 +998 diff --git a/day3/input b/day3/input new file mode 100644 index 0000000..47a3e47 --- /dev/null +++ b/day3/input @@ -0,0 +1,140 @@ +..224.....487...................718.....................378............................................284........310......313..........311. +....*..............................*744....486*485......*......741......@...359.#666...439................*925....*......$..+........@...... +.235................758..440...........................251....*......262.....*..........*......................752......774.......515....... +.........705%..@746........+..942*591.347.470...#..257.........637...........793.......299..../.....813....509......464......&.........688.. +.....82................................*.../..901.....*..................836.....&............814...*........*..............80...17*....*... +.../...*...679.661.....299...........222.............875.....213...161............964...894.........998.....310....258.85...........735.586. +.650..23..#......*.......................................760*........@./........................202...................*.....339............. +..............598......#.....536....702*.........705..........793......957............./........*...935...........965....................... +..................*.357...+.....@.......242.......*......283..*...=956.......118.......959...184...*..............*....401*527.....348...161 +.63=...955.523..77......978.846....849..........699..........790........=911.*.....87...............486.........914..............=.......... +.........*.........842......*.......*..................*127....................844...*....946.......................235...209@...710.735.... +...........@.........*.....144....226....298........560.....253.........431......*...586.......723..../...482.......&...................*... +...........871../918........................+....................329*......%.....906.............*...350.....@...............365.......361.. +......................536............................+..793..........664.....739................507......289.....256%...73..*............... +.356..834..............*.........96.939..............28.+....=..............*...........................*................$.553..........526. +...*...*.............501..746....*..-.......=.................890.....+...701..............807........447......97$..%...........58......$... +.891....346...699...........*.421......+....666......198*791......340.433............#...%...*.......................316........*.....%..... +..............%........81.984...........462....................../..........116...711....963...$................380.......745...85....224... +.........370......923..@.....................563...........188+.........326*...................67.815..............*582..................... +.........*........-........#530.........489........59...................................................#.....57.........100.*.......441*161 +.637*....961...........118...........21*...........@..216+.........................+....432*.*309..64....992.......81......=.781.644........ +.....324.........126......*166...............&...................385*..............233............*................*..436...........*517.... +.88*.........390*................355..335...372....+254..............294...$589........&..803/.....38..-...........56..$.................... +....235.-.........+196...948....*........-................359.........................398.............608..../.................145..346..... +........915.................-.485.945.................936*................114.............118...............490.536..............*.%........ +.663........61.......856..........+....343....859...............*345.......*...=862............711.............................313.....606.. +........23...$.....@..................*......................316.....529.362.............49......................307*791.................... +225...............281...#..222.....@..283..............675............*.........911*90..-.....914..%39....509............................... +.......797*....$........23..../...895.............67.......164.896.....554.....................*............=..............460........181... +...........211.474...............................@...........*....*201..........911.717.#....192.75..679...........$.........*.........=.... +....355.........................&.....................678.650......................*.....128.....*.....*.........925..230...105............. +....*.......409#.......*897.....698....427.........+....*.......*...............................313...670..521.......*....&.............*308 +...838..335.................367........-..........325....233...224...950......688.....199.774.........................793.108........501.... +...........*..102..924.349...+..595....................................*................&..............395+.....................753......... +.........318...*......*........*....676...759.154...................524...........908.........694.211................173...........*214..424 +....458........403...........958.98....*........*..............688......957...488..+...........*.../....................................*... +.......*.............591...............218.....203.....196$.......+....*........*......................765......971......./....927*741..227. +......592..%60.$.....*.....885/....287...............................474.........409......226.174.......@........*.....230.................. +...............162.169.................510..962..............17......................32@..*...*.................225....................-.... +.....880...................201.....823*........*...914.724.........89...&.......267=.....717.54.436..........60...............&.........69.. +710........601....306.287.....+.........65...308....&...=.../......*.....926..................................*........278.415......-....... +..............*..*......&..........241.%...................827../.265.............662.678......@...#......@.....$......-............734.144. +.............424..434.....701.....*........380*731.............24.................*...&........973..741....728..357......................... +........304.................*...881................238.....740.........947........587...22...........................271*........603....@... +...................266.....918....................*..........+.519.617..*...826..........*............./268..974.........486.376....*.295... +...939.........363.*...............378..........302....586........*....740...=..........380........931...........................12......... +...*..........-.....387...............*..588..............*..../...............315...................-...712..491.........956.....#......... +.180.454...................104..661...91...*.............811....370......471...-....419....804..........*...................*............... +.....*.......@../464........%..*............243.....578...................&..........*...........604..250.....784....750....998............. +.....245....165.................771...................&.......#.691...768....654....261.........................*.......*............566.... +441..................91.....194.......643...932*............379.#....$.......*.................86.............940..263.638...........*...... +...+.............%.../.......#.........*........344...795..................991..........544....*..................*..........767...266...... +.......-..708..727.....191$......*.....698....=...................990................+.....*....308.......@......325.........*.........44... +...18.397....=.....93.........649.900.........62....-........322.....*.......@......339....619..........404..........540........./....*..... +..../...............%............................742............*...........196................874.205........96#..............203.224...... +.........704...727.................496.......*........135....769........./.................%....&....*.../..=.........757................... +........*........*..424..........&........714.5........*...........@....884...............114.......674.144..83..........*302...........%... +........29....179..*............104..................531....629.455..................473......300....................254..............640... +..................296.......................................................1........*.......%..............548........*.....103............ +....381...........................365#..713.282.......%744....................../....709...#...=...431...$.*......*.....837.....*9.....*.... +......*.90.....347.179#...................%.......359..........92............304...*.....923.446.......385.699.....749..............193.206. +....922.+.......*.......-197.....................*.......128........273....@.....758..............439...................650*54.736#......... +................817..-..........152..594..949..807.......$...224...*.....124............889.......=...................................625... +....139....667......239........*...........*.......387........%..806........../...........*..788....632...........=8......584-......*.%..... +...........*.................280...........11.........*726............181......761..-....66.....%....-................64...........14....... +............742.736.725..........708.667..........332.......828*750......-.........425.......................944.....*...................926 +.719...110...........*.....348...=..........121......*........................................*.......961.....*.......971...........+....... +..../.....*629........830..*............91....&..241..491...930............561................889....*....710.333..............163...311.... +......%...................252.../..................*...........*270.......................165.....208.......*..................../.......694 +...914...126...267.183........952..$645......414.822................................69.......-..........=..112.464..267....359..........*... +.............7*..........................806.../.....931.....*.....355..............*....928...........854.........-..............*993...101 +439.897...........%...........8......381...*........*....748..987....*............437.......*....954.......................*................ +.......*595....783........49.....110.$...675...8...60.....=........981........&..........730....*.............336.......120.790..........386 +............90..............*212...*..........*.......985.....153........*..12...912*383......665.....754.....-.....................950..... +......790#.*........896@.........773....777..581..514*....910.....5.....579.............................=.......#.....................*..... +...&.......496...........347..............*...............*...................../............................790..............334......912.. +692............609....&.......694..........693...213....620......695......871..385.......82..........785.......................*..163....... +.........#....*......984.........*.................=............*.......................................*.545...-............978.....*...... +......971...477.............465......196*313..........447.......766......49.......126*480.............798......792..359*193...........837... +................157...........+..................773.=..............752$....................447*565..........................*53............ +.384%..........@.........449............470..749...@.........@792..............138..527.......................339.....299.505...........287. +......691........700........@......96..........*........721*.....................@....*...942......845........*......-.........713.......... +.....*......260/...*...........................491..452.....336.......................73....+..960..........238...........163$..&...=.@..... +....689.............831...282....709.960.............=.............204............................#..............59...97..........199..111.. +........................$........../........-....498......................557....&...........972............450............................. +.............653........476...398.........619...*.....*280..923..............*31..691.........*........=...*.....67......782................ +..............*....%..........*.........+......268...........&........428....................408....740....576....*.......*.........$....... +....-../...734......317.114.332...795...743.........................-..=..908...........381.......................914...420.*647....528..... +..284.825...............*......................721/.=929.........324.....*....167.561...*.....815*466....................................... +..............389..304.480.......851..@....585..............942%......#.496....*....-.53................170....938*..........518............ +........368..*.....@..............*....941..+.......*...............930.........364.......522......................59.........+....$....652. +...........+.963...................949...........828.784......860............*......420.....*..................*......548...........310.*... +.....476...............*...............=...94.+..................&........589.833....*..426.940.....&.....959.993.&88....................398 +.......*................624....917...838..*...664.......721........................833...$.......672......$............19................... +....350.......................&....=..............333.................707....................................240..336....=...746.263..$463.. +.........................-.........220.....663...../.............*849..#..631.....712....=.../...308.580.............*..........*........... +.78@......../..........422....444.............*...............281............*...*....447..37.......*................814.................... +........./...788...810.........&..............369..985....-................92................................684...............74........... +......279.........*......128/....464........#...../......944........978...............163..984*5.@............+.......165......*....285..... +..................889.............*.......969........................%.......5......&....$........272....................*......374......... +.........&..............@948..*..13.358........796.............632............*....789........91*..............*66........152............... +........508...+..............3...........544.....$.517.....703....*774.......434............/....794........932............................. +...$...........241.....74...........974..*...954............*.......................375..772...........218.........414...........*366....252 +.501..566...............*..........*....599.....#........256.....468@..942.101.........*..........156...*.............*.......998........... +...../.............263.312....+..767..............#.........................*...&95..838.162=.....+....130.........583..544.......176....... +............................936......826.......421.......-139.......982...893.......................*..................*........./.......... +.284.....=724...................661.$....694........85..........438.............51...............616.698.*36.....262......357+........224... +....@..........491........+........................@......193......*596...........%../844...387.................$.....132.........%......... +.......84..............362.................................*..98..........&................*....14....394..........$..............56........ +.........*432.....512................704......424.............*............74........196%..875...*.....*............132.......229........... +..............723*.........568........*..108........672......55.172...217.........................289.427........................*.......... +.........#795.........214....*.336...94....*....988................%..&.............*86......*...............838&.......540.......902....... +.922...........288........719.....*........845...&..558......#...................524......195.704.....................................77.... +...*....842....../...166........883...-................*503..451..305../....600............................900..280.....*169...586.......... +751....*.........../.*......944......116....416.........................877....*....418...194........644..*....=.....244..........#.....354. +.......118......208...................................788...................826........$....$...207.....@..152...........893*608.......&.... +..948.......................203../....206.............*....341./977.916.........49...#........@....-............+385........................ +...*......266.................*...607...@.990......964..............-..........*.....340...697........62..............526.....-............. +..675.....*..........612....604.............*..............492.884...........212...............*157....*...679.........*....706...716%.518.. +......103.749..989...*...................739..............$......=..=..................212..684.....35.......*.........785..............+... +..343*......../.......680.....................*423.................476....&....420..............241..*......532.....+.......864$.....&...... +..................826........403..311...60.451.............+...........562....../.......306.......*..............420..................321... +...241..............*...........+..=....@......*240.......845....@.........740.................968..389.177*...................640.......... +......*82...........963...211%...............38...............901.....404.........&..253..............-.....37.........218.501...*....320... +....*...........................#215...264......298........................*970..801....*....569...............3.......*......%..859.*...... +.136.818...212...........91*72........*.........-...750.....775*728.29.270...............984.&...371..........*.........639..........670.... +...........*.../959................438.....524......*...943.........*................755...................162.................446#......... +..........290.............751................*.....557..*...483.............421.........*............189.%................/................. +....................9.786..-......835.......978........445.%..........350........860..662.......#...*....354........*.....682............... +.117..57+....441...*....+............................................../............*.........88....142..........%.927...................... +...*...........*..402....................874.....734.926$../...............*633......219.84/............662...205...................334..... +...981........367........338...332/.........=......*......119....375#.334.......146..............%.....$................384.............-511 +........165................=....................666.....................#..614.....-..%744..617.887.......848*.............................. +...........*.203.593...158....*..........152..............+817.....866.......&...............*......../.......904........701.165.80......... +404..977.93..*....*....*...396.281......*....953....*................*.........116..97.70=..179....107..338................$...*....622..... +......=.....445........................382.....*...672................859......*...%....................&..........-.571......717....*...... +..................240............175..........808..............225..........988............/604..............232.448..*..651......769....... +.........569*....*........975*.....*....968..............585.....*................26.................................394....@.142........... +......*......498..969.........360.666...%.........................919.......360........-.*.........%...................................484.. +...407................886...................................84......................933...101....58........839..425......................... diff --git a/day3/input.bakeasy b/day3/input.bakeasy new file mode 100644 index 0000000..b20187f --- /dev/null +++ b/day3/input.bakeasy @@ -0,0 +1,10 @@ +467..114.. +...*...... +..35..633. +......#... +617*...... +.....+.58. +..592..... +......755. +...$.*.... +.664.598.. diff --git a/day3/mathias.out b/day3/mathias.out new file mode 100644 index 0000000..f90cbf9 --- /dev/null +++ b/day3/mathias.out @@ -0,0 +1,1092 @@ +100 +101 +101 +101 +102 +103 +103 +104 +104 +105 +107 +108 +108 +11 +110 +110 +111 +112 +114 +114 +114 +116 +116 +116 +117 +118 +118 +118 +119 +12 +12 +120 +121 +124 +126 +126 +127 +128 +128 +128 +13 +130 +132 +135 +136 +138 +139 +14 +14 +142 +144 +144 +145 +146 +152 +152 +152 +152 +154 +156 +157 +157 +158 +161 +161 +162 +162 +162 +163 +163 +163 +163 +164 +165 +165 +165 +165 +165 +166 +166 +167 +169 +169 +17 +172 +174 +175 +176 +177 +179 +179 +179 +18 +180 +181 +181 +184 +188 +189 +19 +191 +192 +193 +193 +193 +194 +194 +195 +196 +196 +196 +196 +196 +197 +198 +199 +199 +201 +201 +202 +203 +203 +203 +203 +205 +205 +206 +206 +207 +208 +208 +209 +21 +211 +211 +211 +212 +212 +212 +213 +213 +214 +215 +216 +217 +218 +218 +218 +219 +22 +220 +222 +222 +224 +224 +224 +224 +224 +225 +225 +226 +226 +227 +229 +23 +23 +230 +230 +233 +233 +235 +235 +235 +238 +238 +239 +24 +240 +240 +241 +241 +241 +241 +241 +242 +243 +244 +245 +250 +251 +252 +253 +254 +254 +256 +256 +257 +258 +260 +261 +262 +262 +263 +263 +264 +265 +266 +266 +266 +267 +267 +267 +268 +268 +270 +271 +272 +273 +278 +279 +28 +280 +280 +280 +281 +281 +281 +283 +284 +284 +284 +287 +288 +289 +289 +29 +29 +290 +294 +295 +296 +298 +298 +299 +299 +3 +3 +300 +302 +302 +304 +304 +306 +307 +308 +308 +308 +308 +309 +31 +310 +310 +310 +311 +311 +312 +313 +313 +313 +313 +315 +316 +316 +317 +318 +32 +320 +321 +322 +324 +324 +325 +325 +326 +329 +332 +332 +332 +333 +333 +334 +334 +335 +335 +336 +336 +336 +336 +338 +338 +339 +339 +340 +340 +343 +343 +344 +345 +346 +346 +347 +347 +348 +349 +35 +350 +350 +350 +354 +354 +355 +355 +355 +356 +357 +357 +357 +359 +359 +359 +359 +36 +360 +361 +362 +362 +363 +364 +365 +365 +366 +367 +367 +368 +369 +37 +37 +370 +370 +372 +374 +375 +375 +378 +378 +379 +38 +38 +380 +380 +380 +381 +381 +381 +382 +383 +384 +385 +385 +385 +385 +387 +387 +387 +389 +389 +39 +390 +394 +394 +395 +396 +397 +398 +398 +398 +401 +402 +403 +403 +404 +407 +408 +409 +409 +414 +414 +415 +418 +419 +420 +420 +420 +420 +421 +421 +422 +423 +424 +424 +424 +425 +426 +427 +427 +428 +431 +432 +432 +433 +434 +434 +436 +437 +438 +438 +439 +439 +44 +440 +441 +441 +441 +444 +445 +445 +446 +446 +447 +447 +447 +447 +448 +449 +450 +451 +451 +452 +454 +455 +458 +460 +462 +463 +464 +464 +465 +466 +468 +470 +471 +473 +474 +474 +476 +476 +476 +477 +480 +480 +482 +483 +485 +485 +486 +486 +486 +488 +489 +49 +49 +49 +490 +491 +491 +492 +496 +496 +498 +498 +5 +5 +5 +501 +501 +501 +501 +503 +505 +507 +508 +509 +509 +51 +510 +511 +512 +514 +515 +517 +518 +518 +519 +522 +524 +524 +524 +526 +526 +527 +527 +528 +529 +53 +53 +530 +531 +532 +536 +536 +54 +54 +544 +544 +544 +548 +55 +553 +554 +557 +557 +558 +56 +56 +560 +561 +562 +565 +566 +566 +568 +569 +569 +57 +571 +576 +578 +579 +58 +58 +580 +581 +582 +583 +584 +585 +586 +586 +586 +586 +587 +588 +589 +589 +59 +59 +591 +591 +592 +593 +595 +595 +596 +598 +599 +60 +60 +60 +60 +600 +601 +603 +604 +604 +607 +608 +608 +609 +61 +612 +614 +616 +617 +617 +619 +619 +62 +62 +620 +622 +624 +625 +629 +63 +631 +632 +632 +633 +637 +637 +638 +639 +64 +64 +640 +640 +643 +644 +644 +645 +647 +649 +65 +650 +650 +650 +651 +652 +653 +654 +66 +66 +661 +661 +662 +662 +662 +663 +664 +664 +665 +666 +666 +666 +666 +667 +67 +67 +67 +670 +670 +672 +672 +674 +675 +675 +676 +678 +678 +679 +679 +679 +680 +682 +684 +684 +688 +688 +689 +69 +69 +691 +691 +691 +692 +693 +694 +694 +694 +695 +697 +698 +698 +698 +699 +699 +699 +7 +70 +700 +701 +701 +701 +702 +703 +704 +704 +704 +705 +705 +706 +707 +708 +708 +709 +709 +710 +710 +711 +712 +712 +713 +713 +714 +716 +717 +717 +717 +718 +719 +719 +72 +721 +721 +723 +723 +724 +724 +725 +726 +727 +727 +728 +728 +73 +73 +730 +731 +734 +734 +734 +735 +735 +736 +739 +739 +74 +74 +74 +740 +740 +740 +741 +741 +741 +742 +742 +743 +744 +744 +744 +746 +746 +746 +748 +749 +749 +749 +75 +750 +750 +750 +751 +751 +752 +752 +753 +754 +755 +757 +758 +760 +761 +765 +766 +767 +767 +768 +769 +769 +77 +771 +772 +773 +773 +774 +774 +775 +777 +78 +781 +782 +783 +784 +784 +785 +785 +786 +788 +788 +788 +789 +790 +790 +790 +790 +791 +791 +792 +792 +793 +793 +793 +793 +794 +795 +796 +797 +798 +8 +8 +80 +801 +803 +806 +806 +807 +807 +808 +81 +81 +810 +811 +813 +814 +814 +815 +817 +817 +818 +82 +82 +822 +823 +825 +826 +826 +826 +826 +827 +828 +828 +83 +830 +831 +833 +833 +834 +837 +837 +838 +838 +838 +838 +84 +84 +842 +842 +844 +844 +845 +845 +846 +848 +849 +849 +85 +85 +85 +851 +854 +859 +859 +86 +86 +860 +860 +862 +864 +866 +87 +871 +874 +874 +875 +875 +877 +88 +88 +88 +881 +883 +884 +884 +885 +887 +889 +889 +889 +89 +890 +891 +893 +893 +895 +896 +896 +897 +897 +9 +9 +90 +90 +90 +900 +900 +901 +901 +902 +904 +906 +908 +908 +91 +91 +91 +91 +910 +911 +911 +911 +912 +912 +914 +914 +914 +914 +914 +915 +916 +917 +918 +918 +919 +92 +922 +922 +923 +923 +923 +924 +925 +925 +926 +926 +927 +927 +928 +929 +93 +93 +930 +930 +931 +931 +932 +932 +933 +935 +936 +936 +938 +939 +939 +94 +94 +940 +940 +941 +942 +942 +942 +943 +944 +944 +945 +947 +948 +948 +948 +949 +949 +95 +950 +950 +952 +953 +954 +954 +955 +956 +956 +957 +957 +958 +959 +959 +959 +96 +96 +960 +961 +961 +962 +963 +963 +963 +964 +964 +965 +968 +968 +969 +969 +97 +97 +970 +971 +971 +971 +972 +973 +974 +975 +977 +977 +978 +978 +978 +978 +98 +981 +981 +984 +984 +984 +984 +985 +985 +987 +988 +988 +989 +990 +990 +991 +992 +993 +993 +998 +998 +998 diff --git a/day3/mathias.out2 b/day3/mathias.out2 new file mode 100644 index 0000000..604493a --- /dev/null +++ b/day3/mathias.out2 @@ -0,0 +1,1092 @@ +224 +235 +718 +744 +486 +485 +378 +251 +262 +666 +284 +925 +310 +752 +774 +313 +515 +741 +637 +359 +793 +439 +299 +705 +746 +440 +942 +591 +901 +814 +80 +347 +222 +470 +257 +875 +964 +813 +998 +509 +310 +17 +735 +688 +586 +650 +82 +23 +679 +661 +598 +213 +760 +161 +957 +258 +85 +357 +702 +242 +959 +202 +184 +77 +978 +536 +705 +699 +793 +790 +956 +935 +486 +965 +914 +401 +527 +63 +911 +118 +710 +955 +846 +144 +849 +226 +127 +560 +87 +586 +209 +871 +842 +844 +906 +350 +235 +735 +361 +918 +298 +329 +664 +431 +723 +507 +482 +28 +256 +365 +553 +536 +501 +793 +890 +739 +701 +289 +447 +73 +356 +891 +834 +346 +96 +421 +939 +666 +433 +97 +316 +526 +746 +984 +462 +198 +791 +711 +963 +807 +58 +85 +224 +699 +340 +67 +81 +188 +116 +326 +380 +582 +370 +961 +923 +530 +992 +781 +441 +161 +637 +324 +489 +21 +59 +216 +233 +432 +309 +100 +118 +166 +372 +385 +294 +64 +38 +81 +56 +644 +517 +88 +235 +126 +390 +254 +589 +398 +803 +608 +436 +915 +196 +355 +485 +335 +490 +948 +359 +936 +145 +313 +346 +945 +345 +316 +114 +362 +862 +61 +281 +343 +283 +307 +791 +23 +895 +529 +554 +911 +90 +49 +39 +797 +211 +474 +222 +914 +192 +509 +67 +164 +650 +896 +201 +128 +925 +460 +105 +181 +698 +911 +717 +75 +313 +679 +670 +355 +838 +409 +897 +325 +678 +233 +224 +230 +793 +108 +308 +501 +427 +335 +318 +367 +950 +524 +199 +395 +102 +403 +924 +349 +595 +958 +753 +214 +676 +218 +154 +203 +908 +694 +211 +424 +227 +458 +592 +196 +688 +957 +474 +488 +409 +230 +927 +741 +60 +162 +591 +169 +885 +765 +971 +225 +32 +226 +717 +174 +54 +69 +510 +823 +962 +308 +926 +267 +415 +201 +914 +724 +827 +89 +265 +60 +734 +601 +424 +306 +434 +287 +65 +24 +973 +741 +728 +357 +278 +241 +881 +380 +731 +662 +587 +678 +701 +918 +271 +486 +295 +238 +302 +740 +947 +740 +22 +380 +268 +603 +266 +387 +519 +617 +826 +939 +180 +363 +378 +91 +586 +811 +370 +931 +12 +588 +243 +315 +712 +250 +956 +998 +454 +245 +165 +464 +104 +661 +771 +471 +419 +261 +578 +379 +784 +940 +750 +638 +932 +344 +691 +768 +654 +991 +566 +266 +441 +727 +91 +194 +643 +698 +86 +308 +263 +325 +397 +191 +649 +900 +62 +339 +544 +619 +404 +767 +708 +742 +990 +196 +203 +44 +224 +18 +93 +322 +769 +96 +714 +5 +884 +114 +874 +205 +674 +144 +83 +704 +29 +727 +179 +104 +135 +531 +455 +757 +302 +640 +424 +296 +473 +709 +300 +254 +837 +365 +744 +304 +923 +446 +385 +548 +699 +749 +103 +9 +193 +206 +381 +922 +179 +713 +758 +90 +347 +817 +197 +359 +807 +124 +650 +54 +736 +239 +128 +273 +806 +439 +152 +280 +949 +11 +224 +761 +889 +66 +8 +584 +14 +625 +667 +742 +387 +726 +425 +788 +632 +828 +750 +181 +64 +971 +725 +830 +708 +332 +491 +889 +944 +333 +311 +719 +110 +629 +348 +252 +121 +961 +208 +914 +952 +241 +822 +930 +270 +710 +112 +163 +645 +165 +854 +694 +101 +267 +7 +414 +987 +69 +437 +267 +993 +783 +806 +675 +931 +60 +355 +981 +928 +730 +120 +790 +897 +595 +381 +748 +12 +954 +665 +49 +212 +110 +773 +8 +581 +579 +912 +383 +336 +790 +90 +496 +896 +985 +514 +754 +790 +950 +912 +692 +777 +693 +910 +620 +385 +984 +334 +978 +971 +609 +477 +694 +213 +695 +766 +785 +798 +792 +163 +837 +196 +313 +126 +480 +359 +193 +465 +447 +752 +447 +565 +53 +505 +384 +157 +773 +792 +449 +749 +491 +721 +336 +138 +527 +73 +339 +238 +299 +691 +689 +260 +700 +831 +942 +163 +713 +199 +111 +452 +960 +476 +709 +619 +691 +498 +268 +280 +557 +31 +972 +408 +740 +450 +576 +653 +734 +317 +398 +332 +743 +923 +67 +914 +782 +420 +528 +284 +825 +324 +428 +647 +114 +480 +721 +929 +908 +496 +381 +53 +815 +466 +941 +942 +930 +167 +364 +561 +938 +59 +389 +963 +304 +851 +949 +585 +828 +784 +518 +310 +368 +589 +833 +522 +940 +993 +652 +398 +624 +838 +664 +860 +420 +833 +672 +88 +476 +350 +94 +426 +959 +917 +220 +19 +463 +422 +333 +849 +281 +707 +447 +37 +336 +814 +746 +263 +78 +788 +663 +369 +631 +92 +712 +308 +580 +279 +444 +944 +810 +889 +128 +969 +985 +984 +5 +272 +684 +74 +374 +464 +13 +978 +789 +163 +165 +152 +508 +948 +3 +5 +434 +91 +794 +66 +932 +241 +796 +632 +774 +772 +501 +544 +599 +703 +256 +366 +998 +74 +312 +974 +767 +954 +468 +375 +838 +218 +130 +414 +583 +566 +936 +421 +101 +893 +95 +162 +156 +139 +616 +698 +544 +176 +724 +826 +36 +357 +284 +362 +85 +438 +596 +51 +844 +262 +56 +193 +74 +387 +875 +132 +84 +432 +98 +55 +196 +14 +289 +394 +427 +512 +723 +704 +94 +229 +902 +795 +568 +719 +108 +845 +172 +217 +86 +524 +195 +704 +838 +336 +883 +988 +451 +922 +751 +288 +116 +558 +503 +877 +169 +244 +842 +118 +208 +166 +600 +826 +900 +152 +280 +586 +418 +194 +644 +893 +608 +354 +607 +788 +964 +977 +340 +697 +207 +385 +948 +675 +203 +604 +206 +916 +49 +212 +706 +266 +749 +990 +739 +157 +684 +62 +526 +785 +716 +612 +680 +492 +884 +476 +679 +532 +518 +103 +343 +989 +423 +451 +562 +35 +420 +864 +321 +845 +420 +241 +968 +826 +963 +403 +311 +60 +240 +38 +901 +177 +37 +241 +82 +211 +801 +389 +640 +859 +136 +818 +215 +970 +253 +984 +218 +639 +501 +320 +670 +91 +72 +264 +438 +298 +775 +728 +569 +3 +162 +212 +290 +959 +750 +557 +29 +446 +524 +978 +943 +445 +755 +662 +354 +682 +751 +483 +88 +189 +142 +927 +57 +9 +402 +786 +350 +860 +219 +205 +117 +981 +441 +367 +926 +119 +633 +84 +332 +874 +734 +666 +375 +887 +662 +511 +338 +334 +146 +744 +848 +904 +165 +93 +396 +281 +817 +614 +617 +179 +107 +203 +445 +593 +158 +152 +382 +672 +866 +859 +70 +701 +165 +717 +977 +953 +808 +116 +988 +97 +338 +448 +622 +769 +604 +571 +394 +569 +498 +240 +969 +975 +360 +175 +666 +225 +919 +651 +407 +968 +933 +101 +58 diff --git a/day3/output.txt b/day3/output.txt new file mode 100644 index 0000000..f4a3554 --- /dev/null +++ b/day3/output.txt @@ -0,0 +1,1387 @@ +..224.....487...................718.....................378............................................284........310......313..........311. +....*..............................*744....486*485......*......741......@...359.#666...439................*925....*......$..+........@...... +.235................758..440...........................251....*......262.....*..........*......................752......774.......515....... +.........705%..@746........+..942*591.347.470...#..257.........637...........793.......299..../.....813....509......464......&.........688.. +.....82................................*.../..901.....*..................836.....&............814...*........*..............80...17*....*... +.../...*...679.661.....299...........222.............875.....213...161............964...894.........998.....310....258.85...........735.586. +.650..23..#......*.......................................760*........@./........................202...................*.....339............. +..............598......#.....536....702*.........705..........793......957............./........*...935...........965....................... +..................*.357...+.....@.......242.......*......283..*...=956.......118.......959...184...*..............*....401*527.....348...161 +.63=...955.523..77......978.846....849..........699..........790........=911.*.....87...............486.........914..............=.......... +.........*.........842......*.......*..................*127....................844...*....946.......................235...209@...710.735.... +...........@.........*.....144....226....298........560.....253.........431......*...586.......723..../...482.......&...................*... +...........871../918........................+....................329*......%.....906.............*...350.....@...............365.......361.. +......................536............................+..793..........664.....739................507......289.....256%...73..*............... +.356..834..............*.........96.939..............28.+....=..............*...........................*................$.553..........526. +...*...*.............501..746....*..-.......=.................890.....+...701..............807........447......97$..%...........58......$... +.891....346...699...........*.421......+....666......198*791......340.433............#...%...*.......................316........*.....%..... +..............%........81.984...........462....................../..........116...711....963...$................380.......745...85....224... +.........370......923..@.....................563...........188+.........326*...................67.815..............*582..................... +.........*........-........#530.........489........59...................................................#.....57.........100.*.......441*161 +.637*....961...........118...........21*...........@..216+.........................+....432*.*309..64....992.......81......=.781.644........ +.....324.........126......*166...............&...................385*..............233............*................*..436...........*517.... +.88*.........390*................355..335...372....+254..............294...$589........&..803/.....38..-...........56..$.................... +....235.-.........+196...948....*........-................359.........................398.............608..../.................145..346..... +........915.................-.485.945.................936*................114.............118...............490.536..............*.%........ +.663........61.......856..........+....343....859...............*345.......*...=862............711.............................313.....606.. +........23...$.....@..................*......................316.....529.362.............49......................307*791.................... +225...............281...#..222.....@..283..............675............*.........911*90..-.....914..%39....509............................... +.......797*....$........23..../...895.............67.......164.896.....554.....................*............=..............460........181... +...........211.474...............................@...........*....*201..........911.717.#....192.75..679...........$.........*.........=.... +....355.........................&.....................678.650......................*.....128.....*.....*.........925..230...105............. +....*.......409#.......*897.....698....427.........+....*.......*...............................313...670..521.......*....&.............*308 +...838..335.................367........-..........325....233...224...950......688.....199.774.........................793.108........501.... +...........*..102..924.349...+..595....................................*................&..............395+.....................753......... +.........318...*......*........*....676...759.154...................524...........908.........694.211................173...........*214..424 +....458........403...........958.98....*........*..............688......957...488..+...........*.../....................................*... +.......*.............591...............218.....203.....196$.......+....*........*......................765......971......./....927*741..227. +......592..%60.$.....*.....885/....287...............................474.........409......226.174.......@........*.....230.................. +...............162.169.................510..962..............17......................32@..*...*.................225....................-.... +.....880...................201.....823*........*...914.724.........89...&.......267=.....717.54.436..........60...............&.........69.. +710........601....306.287.....+.........65...308....&...=.../......*.....926..................................*........278.415......-....... +..............*..*......&..........241.%...................827../.265.............662.678......@...#......@.....$......-............734.144. +.............424..434.....701.....*........380*731.............24.................*...&........973..741....728..357......................... +........304.................*...881................238.....740.........947........587...22...........................271*........603....@... +...................266.....918....................*..........+.519.617..*...826..........*............./268..974.........486.376....*.295... +...939.........363.*...............378..........302....586........*....740...=..........380........931...........................12......... +...*..........-.....387...............*..588..............*..../...............315...................-...712..491.........956.....#......... +.180.454...................104..661...91...*.............811....370......471...-....419....804..........*...................*............... +.....*.......@../464........%..*............243.....578...................&..........*...........604..250.....784....750....998............. +.....245....165.................771...................&.......#.691...768....654....261.........................*.......*............566.... +441..................91.....194.......643...932*............379.#....$.......*.................86.............940..263.638...........*...... +...+.............%.../.......#.........*........344...795..................991..........544....*..................*..........767...266...... +.......-..708..727.....191$......*.....698....=...................990................+.....*....308.......@......325.........*.........44... +...18.397....=.....93.........649.900.........62....-........322.....*.......@......339....619..........404..........540........./....*..... +..../...............%............................742............*...........196................874.205........96#..............203.224...... +.........704...727.................496.......*........135....769........./.................%....&....*.../..=.........757................... +........*........*..424..........&........714.5........*...........@....884...............114.......674.144..83..........*302...........%... +........29....179..*............104..................531....629.455..................473......300....................254..............640... +..................296.......................................................1........*.......%..............548........*.....103............ +....381...........................365#..713.282.......%744....................../....709...#...=...431...$.*......*.....837.....*9.....*.... +......*.90.....347.179#...................%.......359..........92............304...*.....923.446.......385.699.....749..............193.206. +....922.+.......*.......-197.....................*.......128........273....@.....758..............439...................650*54.736#......... +................817..-..........152..594..949..807.......$...224...*.....124............889.......=...................................625... +....139....667......239........*...........*.......387........%..806........../...........*..788....632...........=8......584-......*.%..... +...........*.................280...........11.........*726............181......761..-....66.....%....-................64...........14....... +............742.736.725..........708.667..........332.......828*750......-.........425.......................944.....*...................926 +.719...110...........*.....348...=..........121......*........................................*.......961.....*.......971...........+....... +..../.....*629........830..*............91....&..241..491...930............561................889....*....710.333..............163...311.... +......%...................252.../..................*...........*270.......................165.....208.......*..................../.......694 +...914...126...267.183........952..$645......414.822................................69.......-..........=..112.464..267....359..........*... +.............7*..........................806.../.....931.....*.....355..............*....928...........854.........-..............*993...101 +439.897...........%...........8......381...*........*....748..987....*............437.......*....954.......................*................ +.......*595....783........49.....110.$...675...8...60.....=........981........&..........730....*.............336.......120.790..........386 +............90..............*212...*..........*.......985.....153........*..12...912*383......665.....754.....-.....................950..... +......790#.*........896@.........773....777..581..514*....910.....5.....579.............................=.......#.....................*..... +...&.......496...........347..............*...............*...................../............................790..............334......912.. +692............609....&.......694..........693...213....620......695......871..385.......82..........785.......................*..163....... +.........#....*......984.........*.................=............*.......................................*.545...-............978.....*...... +......971...477.............465......196*313..........447.......766......49.......126*480.............798......792..359*193...........837... +................157...........+..................773.=..............752$....................447*565..........................*53............ +.384%..........@.........449............470..749...@.........@792..............138..527.......................339.....299.505...........287. +......691........700........@......96..........*........721*.....................@....*...942......845........*......-.........713.......... +.....*......260/...*...........................491..452.....336.......................73....+..960..........238...........163$..&...=.@..... +....689.............831...282....709.960.............=.............204............................#..............59...97..........199..111.. +........................$........../........-....498......................557....&...........972............450............................. +.............653........476...398.........619...*.....*280..923..............*31..691.........*........=...*.....67......782................ +..............*....%..........*.........+......268...........&........428....................408....740....576....*.......*.........$....... +....-../...734......317.114.332...795...743.........................-..=..908...........381.......................914...420.*647....528..... +..284.825...............*......................721/.=929.........324.....*....167.561...*.....815*466....................................... +..............389..304.480.......851..@....585..............942%......#.496....*....-.53................170....938*..........518............ +........368..*.....@..............*....941..+.......*...............930.........364.......522......................59.........+....$....652. +...........+.963...................949...........828.784......860............*......420.....*..................*......548...........310.*... +.....476...............*...............=...94.+..................&........589.833....*..426.940.....&.....959.993.&88....................398 +.......*................624....917...838..*...664.......721........................833...$.......672......$............19................... +....350.......................&....=..............333.................707....................................240..336....=...746.263..$463.. +.........................-.........220.....663...../.............*849..#..631.....712....=.../...308.580.............*..........*........... +.78@......../..........422....444.............*...............281............*...*....447..37.......*................814.................... +........./...788...810.........&..............369..985....-................92................................684...............74........... +......279.........*......128/....464........#...../......944........978...............163..984*5.@............+.......165......*....285..... +..................889.............*.......969........................%.......5......&....$........272....................*......374......... +.........&..............@948..*..13.358........796.............632............*....789........91*..............*66........152............... +........508...+..............3...........544.....$.517.....703....*774.......434............/....794........932............................. +...$...........241.....74...........974..*...954............*.......................375..772...........218.........414...........*366....252 +.501..566...............*..........*....599.....#........256.....468@..942.101.........*..........156...*.............*.......998........... +...../.............263.312....+..767..............#.........................*...&95..838.162=.....+....130.........583..544.......176....... +............................936......826.......421.......-139.......982...893.......................*..................*........./.......... +.284.....=724...................661.$....694........85..........438.............51...............616.698.*36.....262......357+........224... +....@..........491........+........................@......193......*596...........%../844...387.................$.....132.........%......... +.......84..............362.................................*..98..........&................*....14....394..........$..............56........ +.........*432.....512................704......424.............*............74........196%..875...*.....*............132.......229........... +..............723*.........568........*..108........672......55.172...217.........................289.427........................*.......... +.........#795.........214....*.336...94....*....988................%..&.............*86......*...............838&.......540.......902....... +.922...........288........719.....*........845...&..558......#...................524......195.704.....................................77.... +...*....842....../...166........883...-................*503..451..305../....600............................900..280.....*169...586.......... +751....*.........../.*......944......116....416.........................877....*....418...194........644..*....=.....244..........#.....354. +.......118......208...................................788...................826........$....$...207.....@..152...........893*608.......&.... +..948.......................203../....206.............*....341./977.916.........49...#........@....-............+385........................ +...*......266.................*...607...@.990......964..............-..........*.....340...697........62..............526.....-............. +..675.....*..........612....604.............*..............492.884...........212...............*157....*...679.........*....706...716%.518.. +......103.749..989...*...................739..............$......=..=..................212..684.....35.......*.........785..............+... +..343*......../.......680.....................*423.................476....&....420..............241..*......532.....+.......864$.....&...... +..................826........403..311...60.451.............+...........562....../.......306.......*..............420..................321... +...241..............*...........+..=....@......*240.......845....@.........740.................968..389.177*...................640.......... +......*82...........963...211%...............38...............901.....404.........&..253..............-.....37.........218.501...*....320... +....*...........................#215...264......298........................*970..801....*....569...............3.......*......%..859.*...... +.136.818...212...........91*72........*.........-...750.....775*728.29.270...............984.&...371..........*.........639..........670.... +...........*.../959................438.....524......*...943.........*................755...................162.................446#......... +..........290.............751................*.....557..*...483.............421.........*............189.%................/................. +....................9.786..-......835.......978........445.%..........350........860..662.......#...*....354........*.....682............... +.117..57+....441...*....+............................................../............*.........88....142..........%.927...................... +...*...........*..402....................874.....734.926$../...............*633......219.84/............662...205...................334..... +...981........367........338...332/.........=......*......119....375#.334.......146..............%.....$................384.............-511 +........165................=....................666.....................#..614.....-..%744..617.887.......848*.............................. +...........*.203.593...158....*..........152..............+817.....866.......&...............*......../.......904........701.165.80......... +404..977.93..*....*....*...396.281......*....953....*................*.........116..97.70=..179....107..338................$...*....622..... +......=.....445........................382.....*...672................859......*...%....................&..........-.571......717....*...... +..................240............175..........808..............225..........988............/604..............232.448..*..651......769....... +.........569*....*........975*.....*....968..............585.....*................26.................................394....@.142........... +......*......498..969.........360.666...%.........................919.......360........-.*.........%...................................484.. +...407................886...................................84......................933...101....58........839..425......................... + +Rows: 140 +Columns: 140 + +Resizing! +size: 16 length: 8 +Resizing! +size: 32 length: 16 +Resizing! +size: 64 length: 32 +Resizing! +size: 128 length: 64 +Resizing! +size: 256 length: 128 +Resizing! +size: 512 length: 256 +Resizing! +size: 1024 length: 512 +Resizing! +size: 2048 length: 1024 +Found 1224 numbers. +0: 311 +1: 313 +2: 310 +3: 284 +4: 378 +5: 718 +6: 487 +7: 224 +8: 925 +9: 439 +10: 666 +11: 359 +12: 741 +13: 485 +14: 486 +15: 744 +16: 515 +17: 774 +18: 752 +19: 262 +20: 251 +21: 440 +22: 758 +23: 235 +24: 688 +25: 464 +26: 509 +27: 813 +28: 299 +29: 793 +30: 637 +31: 257 +32: 470 +33: 347 +34: 591 +35: 942 +36: 746 +37: 705 +38: 17 +39: 80 +40: 814 +41: 836 +42: 901 +43: 82 +44: 586 +45: 735 +46: 85 +47: 258 +48: 310 +49: 998 +50: 894 +51: 964 +52: 161 +53: 213 +54: 875 +55: 222 +56: 299 +57: 661 +58: 679 +59: 339 +60: 202 +61: 760 +62: 23 +63: 650 +64: 965 +65: 935 +66: 957 +67: 793 +68: 705 +69: 702 +70: 536 +71: 598 +72: 161 +73: 348 +74: 527 +75: 401 +76: 184 +77: 959 +78: 118 +79: 956 +80: 283 +81: 242 +82: 357 +83: 914 +84: 486 +85: 87 +86: 911 +87: 790 +88: 699 +89: 849 +90: 846 +91: 978 +92: 77 +93: 523 +94: 955 +95: 63 +96: 735 +97: 710 +98: 209 +99: 235 +100: 946 +101: 844 +102: 127 +103: 842 +104: 482 +105: 723 +106: 586 +107: 431 +108: 253 +109: 560 +110: 298 +111: 226 +112: 144 +113: 361 +114: 365 +115: 350 +116: 906 +117: 329 +118: 918 +119: 871 +120: 73 +121: 256 +122: 289 +123: 507 +124: 739 +125: 664 +126: 793 +127: 536 +128: 526 +129: 553 +130: 28 +131: 939 +132: 96 +133: 834 +134: 356 +135: 58 +136: 97 +137: 447 +138: 807 +139: 701 +140: 890 +141: 746 +142: 501 +143: 316 +144: 433 +145: 340 +146: 791 +147: 198 +148: 666 +149: 421 +150: 699 +151: 346 +152: 891 +153: 224 +154: 85 +155: 745 +156: 380 +157: 963 +158: 711 +159: 116 +160: 462 +161: 984 +162: 81 +163: 582 +164: 815 +165: 67 +166: 326 +167: 188 +168: 563 +169: 923 +170: 370 +171: 161 +172: 441 +173: 100 +174: 57 +175: 59 +176: 489 +177: 530 +178: 644 +179: 781 +180: 81 +181: 992 +182: 64 +183: 309 +184: 432 +185: 216 +186: 21 +187: 118 +188: 961 +189: 637 +190: 517 +191: 436 +192: 233 +193: 385 +194: 166 +195: 126 +196: 324 +197: 56 +198: 38 +199: 803 +200: 589 +201: 294 +202: 254 +203: 372 +204: 335 +205: 355 +206: 390 +207: 88 +208: 346 +209: 145 +210: 608 +211: 398 +212: 359 +213: 948 +214: 196 +215: 235 +216: 536 +217: 490 +218: 118 +219: 114 +220: 936 +221: 945 +222: 485 +223: 915 +224: 606 +225: 313 +226: 711 +227: 862 +228: 345 +229: 859 +230: 343 +231: 856 +232: 61 +233: 663 +234: 791 +235: 307 +236: 49 +237: 362 +238: 529 +239: 316 +240: 23 +241: 509 +242: 39 +243: 914 +244: 90 +245: 911 +246: 675 +247: 283 +248: 222 +249: 281 +250: 225 +251: 181 +252: 460 +253: 554 +254: 896 +255: 164 +256: 67 +257: 895 +258: 23 +259: 797 +260: 679 +261: 75 +262: 192 +263: 717 +264: 911 +265: 201 +266: 474 +267: 211 +268: 105 +269: 230 +270: 925 +271: 128 +272: 650 +273: 678 +274: 355 +275: 308 +276: 521 +277: 670 +278: 313 +279: 427 +280: 698 +281: 897 +282: 409 +283: 501 +284: 108 +285: 793 +286: 774 +287: 199 +288: 688 +289: 950 +290: 224 +291: 233 +292: 325 +293: 367 +294: 335 +295: 838 +296: 753 +297: 395 +298: 595 +299: 349 +300: 924 +301: 102 +302: 424 +303: 214 +304: 173 +305: 211 +306: 694 +307: 908 +308: 524 +309: 154 +310: 759 +311: 676 +312: 318 +313: 488 +314: 957 +315: 688 +316: 98 +317: 958 +318: 403 +319: 458 +320: 227 +321: 741 +322: 927 +323: 971 +324: 765 +325: 196 +326: 203 +327: 218 +328: 591 +329: 230 +330: 174 +331: 226 +332: 409 +333: 474 +334: 287 +335: 885 +336: 60 +337: 592 +338: 225 +339: 32 +340: 17 +341: 962 +342: 510 +343: 169 +344: 162 +345: 69 +346: 60 +347: 436 +348: 54 +349: 717 +350: 267 +351: 89 +352: 724 +353: 914 +354: 823 +355: 201 +356: 880 +357: 415 +358: 278 +359: 926 +360: 308 +361: 65 +362: 287 +363: 306 +364: 601 +365: 710 +366: 144 +367: 734 +368: 678 +369: 662 +370: 265 +371: 827 +372: 241 +373: 357 +374: 728 +375: 741 +376: 973 +377: 24 +378: 731 +379: 380 +380: 701 +381: 434 +382: 424 +383: 603 +384: 271 +385: 22 +386: 587 +387: 947 +388: 740 +389: 238 +390: 881 +391: 304 +392: 295 +393: 376 +394: 486 +395: 974 +396: 268 +397: 826 +398: 617 +399: 519 +400: 918 +401: 266 +402: 12 +403: 931 +404: 380 +405: 740 +406: 586 +407: 302 +408: 378 +409: 363 +410: 939 +411: 956 +412: 491 +413: 712 +414: 315 +415: 588 +416: 387 +417: 804 +418: 419 +419: 471 +420: 370 +421: 811 +422: 91 +423: 661 +424: 104 +425: 454 +426: 180 +427: 998 +428: 750 +429: 784 +430: 250 +431: 604 +432: 578 +433: 243 +434: 464 +435: 566 +436: 261 +437: 654 +438: 768 +439: 691 +440: 771 +441: 165 +442: 245 +443: 638 +444: 263 +445: 940 +446: 86 +447: 379 +448: 932 +449: 643 +450: 194 +451: 91 +452: 441 +453: 266 +454: 767 +455: 544 +456: 991 +457: 795 +458: 344 +459: 44 +460: 325 +461: 308 +462: 990 +463: 698 +464: 191 +465: 727 +466: 708 +467: 540 +468: 404 +469: 619 +470: 339 +471: 322 +472: 62 +473: 900 +474: 649 +475: 93 +476: 397 +477: 18 +478: 224 +479: 203 +480: 96 +481: 205 +482: 874 +483: 196 +484: 742 +485: 757 +486: 769 +487: 135 +488: 496 +489: 727 +490: 704 +491: 302 +492: 83 +493: 144 +494: 674 +495: 114 +496: 884 +497: 5 +498: 714 +499: 424 +500: 640 +501: 254 +502: 300 +503: 473 +504: 455 +505: 629 +506: 531 +507: 104 +508: 179 +509: 29 +510: 103 +511: 548 +512: 1 +513: 296 +514: 9 +515: 837 +516: 431 +517: 709 +518: 744 +519: 282 +520: 713 +521: 365 +522: 381 +523: 206 +524: 193 +525: 749 +526: 699 +527: 385 +528: 446 +529: 923 +530: 304 +531: 92 +532: 359 +533: 179 +534: 347 +535: 90 +536: 736 +537: 54 +538: 650 +539: 439 +540: 758 +541: 273 +542: 128 +543: 197 +544: 922 +545: 625 +546: 889 +547: 124 +548: 224 +549: 807 +550: 949 +551: 594 +552: 152 +553: 817 +554: 584 +555: 8 +556: 632 +557: 788 +558: 806 +559: 387 +560: 239 +561: 667 +562: 139 +563: 14 +564: 64 +565: 66 +566: 761 +567: 181 +568: 726 +569: 11 +570: 280 +571: 926 +572: 944 +573: 425 +574: 750 +575: 828 +576: 332 +577: 667 +578: 708 +579: 725 +580: 736 +581: 742 +582: 971 +583: 961 +584: 121 +585: 348 +586: 110 +587: 719 +588: 311 +589: 163 +590: 333 +591: 710 +592: 889 +593: 561 +594: 930 +595: 491 +596: 241 +597: 91 +598: 830 +599: 629 +600: 694 +601: 208 +602: 165 +603: 270 +604: 252 +605: 359 +606: 267 +607: 464 +608: 112 +609: 69 +610: 822 +611: 414 +612: 645 +613: 952 +614: 183 +615: 267 +616: 126 +617: 914 +618: 101 +619: 993 +620: 854 +621: 928 +622: 355 +623: 931 +624: 806 +625: 7 +626: 954 +627: 437 +628: 987 +629: 748 +630: 381 +631: 8 +632: 897 +633: 439 +634: 386 +635: 790 +636: 120 +637: 336 +638: 730 +639: 981 +640: 60 +641: 8 +642: 675 +643: 110 +644: 49 +645: 783 +646: 595 +647: 950 +648: 754 +649: 665 +650: 383 +651: 912 +652: 12 +653: 153 +654: 985 +655: 212 +656: 90 +657: 579 +658: 5 +659: 910 +660: 514 +661: 581 +662: 777 +663: 773 +664: 896 +665: 790 +666: 912 +667: 334 +668: 790 +669: 347 +670: 496 +671: 163 +672: 785 +673: 82 +674: 385 +675: 871 +676: 695 +677: 620 +678: 213 +679: 693 +680: 694 +681: 609 +682: 692 +683: 978 +684: 545 +685: 984 +686: 837 +687: 193 +688: 359 +689: 792 +690: 798 +691: 480 +692: 126 +693: 49 +694: 766 +695: 447 +696: 313 +697: 196 +698: 465 +699: 477 +700: 971 +701: 53 +702: 565 +703: 447 +704: 752 +705: 773 +706: 157 +707: 287 +708: 505 +709: 299 +710: 339 +711: 527 +712: 138 +713: 792 +714: 749 +715: 470 +716: 449 +717: 384 +718: 713 +719: 845 +720: 942 +721: 721 +722: 96 +723: 700 +724: 691 +725: 163 +726: 238 +727: 960 +728: 73 +729: 336 +730: 452 +731: 491 +732: 260 +733: 111 +734: 199 +735: 97 +736: 59 +737: 204 +738: 960 +739: 709 +740: 282 +741: 831 +742: 689 +743: 450 +744: 972 +745: 557 +746: 498 +747: 782 +748: 67 +749: 691 +750: 31 +751: 923 +752: 280 +753: 619 +754: 398 +755: 476 +756: 653 +757: 576 +758: 740 +759: 408 +760: 428 +761: 268 +762: 528 +763: 647 +764: 420 +765: 914 +766: 381 +767: 908 +768: 743 +769: 795 +770: 332 +771: 114 +772: 317 +773: 734 +774: 466 +775: 815 +776: 561 +777: 167 +778: 324 +779: 929 +780: 721 +781: 825 +782: 284 +783: 518 +784: 938 +785: 170 +786: 53 +787: 496 +788: 942 +789: 585 +790: 851 +791: 480 +792: 304 +793: 389 +794: 652 +795: 59 +796: 522 +797: 364 +798: 930 +799: 941 +800: 368 +801: 310 +802: 548 +803: 420 +804: 860 +805: 784 +806: 828 +807: 949 +808: 963 +809: 398 +810: 88 +811: 993 +812: 959 +813: 940 +814: 426 +815: 833 +816: 589 +817: 94 +818: 476 +819: 19 +820: 672 +821: 833 +822: 721 +823: 664 +824: 838 +825: 917 +826: 624 +827: 463 +828: 263 +829: 746 +830: 336 +831: 240 +832: 707 +833: 333 +834: 350 +835: 580 +836: 308 +837: 712 +838: 631 +839: 849 +840: 663 +841: 220 +842: 814 +843: 37 +844: 447 +845: 281 +846: 444 +847: 422 +848: 78 +849: 74 +850: 684 +851: 92 +852: 985 +853: 369 +854: 810 +855: 788 +856: 285 +857: 165 +858: 5 +859: 984 +860: 163 +861: 978 +862: 944 +863: 464 +864: 128 +865: 279 +866: 374 +867: 272 +868: 5 +869: 969 +870: 889 +871: 152 +872: 66 +873: 91 +874: 789 +875: 632 +876: 796 +877: 358 +878: 13 +879: 948 +880: 932 +881: 794 +882: 434 +883: 774 +884: 703 +885: 517 +886: 544 +887: 3 +888: 508 +889: 252 +890: 366 +891: 414 +892: 218 +893: 772 +894: 375 +895: 954 +896: 974 +897: 74 +898: 241 +899: 998 +900: 156 +901: 101 +902: 942 +903: 468 +904: 256 +905: 599 +906: 566 +907: 501 +908: 176 +909: 544 +910: 583 +911: 130 +912: 162 +913: 838 +914: 95 +915: 767 +916: 312 +917: 263 +918: 893 +919: 982 +920: 139 +921: 421 +922: 826 +923: 936 +924: 224 +925: 357 +926: 262 +927: 36 +928: 698 +929: 616 +930: 51 +931: 438 +932: 85 +933: 694 +934: 661 +935: 724 +936: 284 +937: 132 +938: 387 +939: 844 +940: 596 +941: 193 +942: 491 +943: 56 +944: 394 +945: 14 +946: 98 +947: 362 +948: 84 +949: 229 +950: 132 +951: 875 +952: 196 +953: 74 +954: 424 +955: 704 +956: 512 +957: 432 +958: 427 +959: 289 +960: 217 +961: 172 +962: 55 +963: 672 +964: 108 +965: 568 +966: 723 +967: 902 +968: 540 +969: 838 +970: 86 +971: 988 +972: 94 +973: 336 +974: 214 +975: 795 +976: 77 +977: 704 +978: 195 +979: 524 +980: 558 +981: 845 +982: 719 +983: 288 +984: 922 +985: 586 +986: 169 +987: 280 +988: 900 +989: 600 +990: 305 +991: 451 +992: 503 +993: 883 +994: 166 +995: 842 +996: 354 +997: 244 +998: 644 +999: 194 +1000: 418 +1001: 877 +1002: 416 +1003: 116 +1004: 944 +1005: 751 +1006: 608 +1007: 893 +1008: 152 +1009: 207 +1010: 826 +1011: 788 +1012: 208 +1013: 118 +1014: 385 +1015: 49 +1016: 916 +1017: 977 +1018: 341 +1019: 206 +1020: 203 +1021: 948 +1022: 526 +1023: 62 +1024: 697 +1025: 340 +1026: 964 +1027: 990 +1028: 607 +1029: 266 +1030: 518 +1031: 716 +1032: 706 +1033: 679 +1034: 157 +1035: 212 +1036: 884 +1037: 492 +1038: 604 +1039: 612 +1040: 675 +1041: 785 +1042: 35 +1043: 684 +1044: 212 +1045: 739 +1046: 989 +1047: 749 +1048: 103 +1049: 864 +1050: 532 +1051: 241 +1052: 420 +1053: 476 +1054: 423 +1055: 680 +1056: 343 +1057: 321 +1058: 420 +1059: 306 +1060: 562 +1061: 451 +1062: 60 +1063: 311 +1064: 403 +1065: 826 +1066: 640 +1067: 177 +1068: 389 +1069: 968 +1070: 740 +1071: 845 +1072: 240 +1073: 241 +1074: 320 +1075: 501 +1076: 218 +1077: 37 +1078: 253 +1079: 404 +1080: 901 +1081: 38 +1082: 211 +1083: 963 +1084: 82 +1085: 859 +1086: 3 +1087: 569 +1088: 801 +1089: 970 +1090: 298 +1091: 264 +1092: 215 +1093: 670 +1094: 639 +1095: 371 +1096: 984 +1097: 270 +1098: 29 +1099: 728 +1100: 775 +1101: 750 +1102: 72 +1103: 91 +1104: 212 +1105: 818 +1106: 136 +1107: 446 +1108: 162 +1109: 755 +1110: 943 +1111: 524 +1112: 438 +1113: 959 +1114: 189 +1115: 421 +1116: 483 +1117: 557 +1118: 751 +1119: 290 +1120: 682 +1121: 354 +1122: 662 +1123: 860 +1124: 350 +1125: 445 +1126: 978 +1127: 835 +1128: 786 +1129: 9 +1130: 927 +1131: 142 +1132: 88 +1133: 441 +1134: 57 +1135: 117 +1136: 334 +1137: 205 +1138: 662 +1139: 84 +1140: 219 +1141: 633 +1142: 926 +1143: 734 +1144: 874 +1145: 402 +1146: 511 +1147: 384 +1148: 146 +1149: 334 +1150: 375 +1151: 119 +1152: 332 +1153: 338 +1154: 367 +1155: 981 +1156: 848 +1157: 887 +1158: 617 +1159: 744 +1160: 614 +1161: 666 +1162: 165 +1163: 80 +1164: 165 +1165: 701 +1166: 904 +1167: 866 +1168: 817 +1169: 152 +1170: 158 +1171: 593 +1172: 203 +1173: 622 +1174: 338 +1175: 107 +1176: 179 +1177: 70 +1178: 97 +1179: 116 +1180: 953 +1181: 281 +1182: 396 +1183: 93 +1184: 977 +1185: 404 +1186: 717 +1187: 571 +1188: 859 +1189: 672 +1190: 382 +1191: 445 +1192: 769 +1193: 651 +1194: 448 +1195: 232 +1196: 604 +1197: 988 +1198: 225 +1199: 808 +1200: 175 +1201: 240 +1202: 142 +1203: 394 +1204: 26 +1205: 585 +1206: 968 +1207: 975 +1208: 569 +1209: 484 +1210: 360 +1211: 919 +1212: 666 +1213: 360 +1214: 969 +1215: 498 +1216: 425 +1217: 839 +1218: 58 +1219: 101 +1220: 933 +1221: 84 +1222: 886 +1223: 407 +998 +Total sum is 541660. diff --git a/day3/symbolList b/day3/symbolList new file mode 100644 index 0000000..ca472c5 --- /dev/null +++ b/day3/symbolList @@ -0,0 +1,5 @@ +(inclusive list) +33:47 +58:63 +91:96 +123:126 diff --git a/day3/test b/day3/test new file mode 100755 index 0000000000000000000000000000000000000000..4beb0d345447c6caac7d4d52a3b094e95487663d GIT binary patch literal 16016 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 literal 0 HcmV?d00001 diff --git a/day3/test.c b/day3/test.c new file mode 100644 index 0000000..de68892 --- /dev/null +++ b/day3/test.c @@ -0,0 +1,106 @@ +#include +#include +#include +#include +#include + +#define MAP_SIZE 140 + +typedef struct{ + int x, y; + int width; + int value; +}NumberBox; + +char map[MAP_SIZE*MAP_SIZE] = {0}; +bool touching_symbol[MAP_SIZE*MAP_SIZE] = {false}; +NumberBox number_boxes[10000] = {0}; + +bool is_touching_symbol( int x, int y) { + for( int test_y=y-1; test_y<=y+1; test_y ++ ) { + for( int test_x=x-1; test_x<=x+1; test_x ++ ) { + if( test_y < 0 || test_x < 0 || test_y >= MAP_SIZE || test_x >= MAP_SIZE) continue; + char c = map[ test_y*MAP_SIZE+test_x]; + if( !isdigit(c) && c != '.') { + return true; + } + } + } + return false; +} + +int main() +{ + FILE *fp = fopen( "./input", "r"); + char line[256]; + + int y = 0; + while ( fgets( line, 256, fp ) != NULL) { + memcpy( &map[MAP_SIZE*y++], line, MAP_SIZE ); + } + + int all_sum = 0; + int schematic_sum = 0; + int num_number_boxes = 0; + for( int y=0; y= next_line || num_start == NULL ) break; + char* num_end = num_start + strspn( num_start, "0123456789"); + if( num_end > next_line) num_end = next_line; + + // Extract the number + char number_string[ 64] = {0}; + strncpy( number_string, num_start, num_end-num_start); + int value = atoi( number_string ); + int x = num_start-&map[y*MAP_SIZE]; + int width = num_end - num_start; + + // Store the number box for the next part of the problem + NumberBox nb = {x,y, width, value}; + number_boxes[ num_number_boxes++ ] = nb; + + // Are any of the digits touching a symbol + bool is_touching = false; + for( int x_pos=x; x_pos= x && number_boxes[ n_box].y >=y ) { + ratio *= number_boxes[n_box].value; + printf("%d *", number_boxes[n_box].value, ratio); + num_touching ++; + } + } + if( num_touching >= 2) { + printf(" + %d", sum_of_gear_ratios); + sum_of_gear_ratios += ratio; + printf(" = %d\n", sum_of_gear_ratios); + } + } + } + } + printf( "\nSum of gear ratios: %d\n", sum_of_gear_ratios); +} diff --git a/day3/test.out b/day3/test.out new file mode 100644 index 0000000..a43f826 --- /dev/null +++ b/day3/test.out @@ -0,0 +1,62 @@ + +Sum of schematic numbers: 539590235 *744 *486 *485 * + 0 = 235710 +251 *925 *752 *637 *793 *299 *942 *591 * + 235710 = 792432 +222 *875 *998 *310 *17 *735 * + 792432 = 804927 +586 *23 *598 *760 *702 *242 * + 804927 = 974811 +184 *77 *699 *790 *486 *914 *401 *527 * + 974811 = 1186138 +144 *226 *127 *560 * + 1186138 = 1257258 +586 *906 *361 *329 *664 * + 1257258 = 1475714 +507 *553 *501 *701 *447 *891 *346 *421 *984 *198 *791 * + 1475714 = 1632332 +85 *326 *582 *961 *781 *441 *161 * + 1632332 = 1703333 +637 *324 * + 1703333 = 1909721 +21 *432 *309 *166 *385 *294 * + 1909721 = 2022911 +38 *56 *517 *88 *235 * + 2022911 = 2043591 +390 *485 *936 *313 *345 *316 * + 2043591 = 2152611 +362 *283 *307 *791 * + 2152611 = 2395448 +554 *911 *90 * + 2395448 = 2477438 +797 *211 * + 2477438 = 2645605 +192 *650 *201 *105 *313 *670 *838 *897 *233 *224 *793 *308 *501 * + 2645605 = 2799913 +318 *524 *403 *958 *214 *218 *203 *227 *592 *474 *409 *927 *741 * + 2799913 = 3486820 +169 *225 *717 *54 *823 *308 *265 *424 *434 *881 *380 *731 * + 3486820 = 3764600 +587 *918 *271 *486 * + 3764600 = 3896306 +302 *740 *380 *387 *180 *91 *811 *243 *250 *998 *245 *771 *261 *940 *638 *932 *344 * + 3896306 = 4216914 +991 *266 *698 *308 *325 *649 *900 * + 4216914 = 4801014 +619 *224 *769 *714 *5 * + 4801014 = 4804584 +674 *29 *179 *531 *302 *296 *709 *837 *699 *749 *9 *193 *206 * + 4804584 = 4844342 +922 *758 *817 *807 *650 *54 * + 4844342 = 4879442 +806 *280 *11 *66 *14 *742 *726 *828 *750 * + 4879442 = 5500442 +971 *830 *491 *889 *333 *629 *252 *208 *822 *270 *112 *101 *7 *987 *437 *993 *675 *60 *981 *730 *120 *790 * + 5500442 = 5595242 +595 *665 *212 *773 *581 *579 *912 *383 * + 5595242 = 5944538 +496 *514 *912 *693 *620 *978 *477 *766 *798 *837 *196 *313 * + 5944538 = 6005886 +126 *480 * + 6005886 = 6066366 +359 *193 * + 6066366 = 6135653 +447 *565 * + 6135653 = 6388208 +53 *505 * + 6388208 = 6414973 +491 *721 *336 * + 6414973 = 6657229 +73 *238 *689 *831 *268 *280 *31 *408 *576 *734 *332 *914 *420 *647 *480 *496 *53 *815 *466 * + 6657229 = 7037019 +364 *938 *59 * + 7037019 = 7092361 +963 *949 *828 *784 * + 7092361 = 7741513 +589 *833 * + 7741513 = 8232150 +940 *993 *398 *624 *833 *350 *849 *281 * + 8232150 = 8470719 +814 *369 *92 *889 *984 *5 * + 8470719 = 8475639 +374 *13 *152 *3 *434 *91 *794 * + 8475639 = 8547893 +66 *932 * + 8547893 = 8609405 +774 *599 *256 *366 *998 * + 8609405 = 8974673 +312 *767 *838 *130 *583 *893 *616 *698 * + 8974673 = 9404641 +36 *596 *875 *432 *55 *289 *427 *723 *94 *902 *719 *845 *86 *524 * + 9404641 = 9449705 +195 *704 * + 9449705 = 9586985 +883 *751 *503 *169 *244 * + 9586985 = 9628221 +118 *826 *152 *893 *608 * + 9628221 = 10171165 +964 *675 *604 *212 *749 *739 *157 *684 * + 10171165 = 10278553 +785 *680 *532 *343 *423 *451 * + 10278553 = 10469326 +968 *963 *240 *38 * + 10469326 = 10478446 +177 *37 * + 10478446 = 10484995 +82 *859 *136 *818 * + 10484995 = 10596243 +970 *984 *639 *670 *91 *72 * + 10596243 = 10602795 +438 *775 *728 * + 10602795 = 11166995 +162 *290 *557 *978 *445 *662 *142 *927 *402 *219 *981 *367 *633 *666 *848 *904 * + 11166995 = 11933587 +93 *396 *281 * + 11933587 = 12044863 +179 *445 *382 *672 *859 *717 *808 *988 *769 *394 *569 *498 * + 12044863 = 12328225 +969 *975 *360 * + 12328225 = 12679225 +666 *919 *407 *101 * +Sum of gear ratios: 12679225 diff --git a/day3/test.out2 b/day3/test.out2 new file mode 100644 index 0000000..f90cbf9 --- /dev/null +++ b/day3/test.out2 @@ -0,0 +1,1092 @@ +100 +101 +101 +101 +102 +103 +103 +104 +104 +105 +107 +108 +108 +11 +110 +110 +111 +112 +114 +114 +114 +116 +116 +116 +117 +118 +118 +118 +119 +12 +12 +120 +121 +124 +126 +126 +127 +128 +128 +128 +13 +130 +132 +135 +136 +138 +139 +14 +14 +142 +144 +144 +145 +146 +152 +152 +152 +152 +154 +156 +157 +157 +158 +161 +161 +162 +162 +162 +163 +163 +163 +163 +164 +165 +165 +165 +165 +165 +166 +166 +167 +169 +169 +17 +172 +174 +175 +176 +177 +179 +179 +179 +18 +180 +181 +181 +184 +188 +189 +19 +191 +192 +193 +193 +193 +194 +194 +195 +196 +196 +196 +196 +196 +197 +198 +199 +199 +201 +201 +202 +203 +203 +203 +203 +205 +205 +206 +206 +207 +208 +208 +209 +21 +211 +211 +211 +212 +212 +212 +213 +213 +214 +215 +216 +217 +218 +218 +218 +219 +22 +220 +222 +222 +224 +224 +224 +224 +224 +225 +225 +226 +226 +227 +229 +23 +23 +230 +230 +233 +233 +235 +235 +235 +238 +238 +239 +24 +240 +240 +241 +241 +241 +241 +241 +242 +243 +244 +245 +250 +251 +252 +253 +254 +254 +256 +256 +257 +258 +260 +261 +262 +262 +263 +263 +264 +265 +266 +266 +266 +267 +267 +267 +268 +268 +270 +271 +272 +273 +278 +279 +28 +280 +280 +280 +281 +281 +281 +283 +284 +284 +284 +287 +288 +289 +289 +29 +29 +290 +294 +295 +296 +298 +298 +299 +299 +3 +3 +300 +302 +302 +304 +304 +306 +307 +308 +308 +308 +308 +309 +31 +310 +310 +310 +311 +311 +312 +313 +313 +313 +313 +315 +316 +316 +317 +318 +32 +320 +321 +322 +324 +324 +325 +325 +326 +329 +332 +332 +332 +333 +333 +334 +334 +335 +335 +336 +336 +336 +336 +338 +338 +339 +339 +340 +340 +343 +343 +344 +345 +346 +346 +347 +347 +348 +349 +35 +350 +350 +350 +354 +354 +355 +355 +355 +356 +357 +357 +357 +359 +359 +359 +359 +36 +360 +361 +362 +362 +363 +364 +365 +365 +366 +367 +367 +368 +369 +37 +37 +370 +370 +372 +374 +375 +375 +378 +378 +379 +38 +38 +380 +380 +380 +381 +381 +381 +382 +383 +384 +385 +385 +385 +385 +387 +387 +387 +389 +389 +39 +390 +394 +394 +395 +396 +397 +398 +398 +398 +401 +402 +403 +403 +404 +407 +408 +409 +409 +414 +414 +415 +418 +419 +420 +420 +420 +420 +421 +421 +422 +423 +424 +424 +424 +425 +426 +427 +427 +428 +431 +432 +432 +433 +434 +434 +436 +437 +438 +438 +439 +439 +44 +440 +441 +441 +441 +444 +445 +445 +446 +446 +447 +447 +447 +447 +448 +449 +450 +451 +451 +452 +454 +455 +458 +460 +462 +463 +464 +464 +465 +466 +468 +470 +471 +473 +474 +474 +476 +476 +476 +477 +480 +480 +482 +483 +485 +485 +486 +486 +486 +488 +489 +49 +49 +49 +490 +491 +491 +492 +496 +496 +498 +498 +5 +5 +5 +501 +501 +501 +501 +503 +505 +507 +508 +509 +509 +51 +510 +511 +512 +514 +515 +517 +518 +518 +519 +522 +524 +524 +524 +526 +526 +527 +527 +528 +529 +53 +53 +530 +531 +532 +536 +536 +54 +54 +544 +544 +544 +548 +55 +553 +554 +557 +557 +558 +56 +56 +560 +561 +562 +565 +566 +566 +568 +569 +569 +57 +571 +576 +578 +579 +58 +58 +580 +581 +582 +583 +584 +585 +586 +586 +586 +586 +587 +588 +589 +589 +59 +59 +591 +591 +592 +593 +595 +595 +596 +598 +599 +60 +60 +60 +60 +600 +601 +603 +604 +604 +607 +608 +608 +609 +61 +612 +614 +616 +617 +617 +619 +619 +62 +62 +620 +622 +624 +625 +629 +63 +631 +632 +632 +633 +637 +637 +638 +639 +64 +64 +640 +640 +643 +644 +644 +645 +647 +649 +65 +650 +650 +650 +651 +652 +653 +654 +66 +66 +661 +661 +662 +662 +662 +663 +664 +664 +665 +666 +666 +666 +666 +667 +67 +67 +67 +670 +670 +672 +672 +674 +675 +675 +676 +678 +678 +679 +679 +679 +680 +682 +684 +684 +688 +688 +689 +69 +69 +691 +691 +691 +692 +693 +694 +694 +694 +695 +697 +698 +698 +698 +699 +699 +699 +7 +70 +700 +701 +701 +701 +702 +703 +704 +704 +704 +705 +705 +706 +707 +708 +708 +709 +709 +710 +710 +711 +712 +712 +713 +713 +714 +716 +717 +717 +717 +718 +719 +719 +72 +721 +721 +723 +723 +724 +724 +725 +726 +727 +727 +728 +728 +73 +73 +730 +731 +734 +734 +734 +735 +735 +736 +739 +739 +74 +74 +74 +740 +740 +740 +741 +741 +741 +742 +742 +743 +744 +744 +744 +746 +746 +746 +748 +749 +749 +749 +75 +750 +750 +750 +751 +751 +752 +752 +753 +754 +755 +757 +758 +760 +761 +765 +766 +767 +767 +768 +769 +769 +77 +771 +772 +773 +773 +774 +774 +775 +777 +78 +781 +782 +783 +784 +784 +785 +785 +786 +788 +788 +788 +789 +790 +790 +790 +790 +791 +791 +792 +792 +793 +793 +793 +793 +794 +795 +796 +797 +798 +8 +8 +80 +801 +803 +806 +806 +807 +807 +808 +81 +81 +810 +811 +813 +814 +814 +815 +817 +817 +818 +82 +82 +822 +823 +825 +826 +826 +826 +826 +827 +828 +828 +83 +830 +831 +833 +833 +834 +837 +837 +838 +838 +838 +838 +84 +84 +842 +842 +844 +844 +845 +845 +846 +848 +849 +849 +85 +85 +85 +851 +854 +859 +859 +86 +86 +860 +860 +862 +864 +866 +87 +871 +874 +874 +875 +875 +877 +88 +88 +88 +881 +883 +884 +884 +885 +887 +889 +889 +889 +89 +890 +891 +893 +893 +895 +896 +896 +897 +897 +9 +9 +90 +90 +90 +900 +900 +901 +901 +902 +904 +906 +908 +908 +91 +91 +91 +91 +910 +911 +911 +911 +912 +912 +914 +914 +914 +914 +914 +915 +916 +917 +918 +918 +919 +92 +922 +922 +923 +923 +923 +924 +925 +925 +926 +926 +927 +927 +928 +929 +93 +93 +930 +930 +931 +931 +932 +932 +933 +935 +936 +936 +938 +939 +939 +94 +94 +940 +940 +941 +942 +942 +942 +943 +944 +944 +945 +947 +948 +948 +948 +949 +949 +95 +950 +950 +952 +953 +954 +954 +955 +956 +956 +957 +957 +958 +959 +959 +959 +96 +96 +960 +961 +961 +962 +963 +963 +963 +964 +964 +965 +968 +968 +969 +969 +97 +97 +970 +971 +971 +971 +972 +973 +974 +975 +977 +977 +978 +978 +978 +978 +98 +981 +981 +984 +984 +984 +984 +985 +985 +987 +988 +988 +989 +990 +990 +991 +992 +993 +993 +998 +998 +998