From 30de9566c5469deccbebea1817386dcbdff3ddfb Mon Sep 17 00:00:00 2001 From: Tyrel Souza Date: Thu, 5 Dec 2024 01:15:48 -0500 Subject: [PATCH] day5 part1: --- 2024/full/day05.txt | 1367 ++++++++++++++++++++++++++++++++++++++++ 2024/python/day05.py | 55 ++ 2024/samples/day05.txt | 28 + 3 files changed, 1450 insertions(+) create mode 100644 2024/full/day05.txt create mode 100644 2024/python/day05.py create mode 100644 2024/samples/day05.txt diff --git a/2024/full/day05.txt b/2024/full/day05.txt new file mode 100644 index 0000000..85d9d9b --- /dev/null +++ b/2024/full/day05.txt @@ -0,0 +1,1367 @@ +32|86 +27|29 +27|46 +29|68 +29|74 +29|59 +82|51 +82|12 +82|11 +82|69 +69|47 +69|49 +69|84 +69|95 +69|21 +66|31 +66|86 +66|64 +66|68 +66|32 +66|59 +76|44 +76|22 +76|32 +76|92 +76|11 +76|47 +76|95 +87|49 +87|82 +87|32 +87|88 +87|92 +87|65 +87|96 +87|18 +64|19 +64|96 +64|35 +64|86 +64|15 +64|76 +64|44 +64|22 +64|73 +92|62 +92|61 +92|52 +92|29 +92|88 +92|38 +92|82 +92|51 +92|12 +92|54 +13|64 +13|76 +13|94 +13|21 +13|31 +13|47 +13|87 +13|18 +13|84 +13|44 +13|73 +21|82 +21|62 +21|51 +21|52 +21|22 +21|38 +21|92 +21|32 +21|65 +21|49 +21|45 +21|61 +22|54 +22|65 +22|11 +22|38 +22|88 +22|29 +22|12 +22|94 +22|92 +22|32 +22|46 +22|45 +22|19 +47|44 +47|92 +47|27 +47|22 +47|19 +47|62 +47|52 +47|21 +47|54 +47|95 +47|18 +47|81 +47|85 +47|94 +54|35 +54|85 +54|66 +54|39 +54|13 +54|49 +54|23 +54|62 +54|61 +54|52 +54|12 +54|51 +54|32 +54|64 +54|79 +52|13 +52|42 +52|69 +52|51 +52|61 +52|96 +52|15 +52|73 +52|29 +52|59 +52|68 +52|35 +52|12 +52|76 +52|64 +52|39 +12|13 +12|51 +12|59 +12|96 +12|68 +12|83 +12|87 +12|74 +12|44 +12|69 +12|64 +12|42 +12|23 +12|76 +12|39 +12|47 +12|31 +61|15 +61|13 +61|44 +61|73 +61|29 +61|69 +61|83 +61|42 +61|39 +61|59 +61|31 +61|23 +61|76 +61|96 +61|64 +61|68 +61|87 +61|35 +49|11 +49|46 +49|32 +49|79 +49|39 +49|64 +49|85 +49|13 +49|66 +49|61 +49|35 +49|51 +49|52 +49|38 +49|23 +49|12 +49|59 +49|73 +49|62 +35|45 +35|22 +35|47 +35|74 +35|18 +35|96 +35|88 +35|95 +35|19 +35|15 +35|76 +35|69 +35|27 +35|94 +35|92 +35|65 +35|31 +35|68 +35|84 +35|21 +85|86 +85|13 +85|42 +85|81 +85|69 +85|61 +85|79 +85|29 +85|31 +85|87 +85|15 +85|35 +85|83 +85|46 +85|12 +85|96 +85|68 +85|64 +85|23 +85|52 +85|51 +23|35 +23|96 +23|47 +23|18 +23|86 +23|68 +23|92 +23|22 +23|45 +23|87 +23|13 +23|42 +23|69 +23|76 +23|39 +23|21 +23|73 +23|44 +23|84 +23|79 +23|15 +23|31 +81|96 +81|73 +81|13 +81|31 +81|59 +81|46 +81|35 +81|15 +81|64 +81|29 +81|83 +81|42 +81|87 +81|79 +81|69 +81|39 +81|12 +81|68 +81|52 +81|86 +81|76 +81|61 +81|23 +45|85 +45|32 +45|46 +45|59 +45|38 +45|29 +45|12 +45|11 +45|61 +45|49 +45|62 +45|27 +45|95 +45|83 +45|65 +45|81 +45|54 +45|94 +45|66 +45|52 +45|88 +45|82 +45|19 +45|51 +51|73 +51|31 +51|96 +51|83 +51|74 +51|42 +51|13 +51|68 +51|76 +51|18 +51|35 +51|87 +51|59 +51|86 +51|15 +51|69 +51|47 +51|84 +51|44 +51|39 +51|64 +51|23 +51|79 +51|29 +15|76 +15|21 +15|18 +15|66 +15|84 +15|45 +15|92 +15|87 +15|19 +15|49 +15|38 +15|44 +15|65 +15|54 +15|42 +15|27 +15|47 +15|82 +15|96 +15|94 +15|95 +15|22 +15|88 +15|74 +74|92 +74|85 +74|38 +74|32 +74|65 +74|18 +74|82 +74|47 +74|88 +74|95 +74|84 +74|54 +74|62 +74|45 +74|19 +74|22 +74|49 +74|81 +74|27 +74|94 +74|21 +74|66 +74|11 +74|44 +11|23 +11|59 +11|51 +11|79 +11|31 +11|62 +11|42 +11|86 +11|46 +11|13 +11|29 +11|69 +11|15 +11|12 +11|64 +11|81 +11|68 +11|73 +11|39 +11|61 +11|83 +11|35 +11|52 +11|85 +46|31 +46|61 +46|29 +46|69 +46|79 +46|51 +46|87 +46|74 +46|23 +46|35 +46|13 +46|83 +46|39 +46|76 +46|47 +46|59 +46|73 +46|12 +46|42 +46|15 +46|86 +46|96 +46|68 +46|64 +31|47 +31|45 +31|95 +31|27 +31|19 +31|68 +31|84 +31|22 +31|96 +31|69 +31|88 +31|94 +31|44 +31|76 +31|87 +31|74 +31|21 +31|42 +31|54 +31|65 +31|92 +31|15 +31|18 +31|49 +19|11 +19|23 +19|65 +19|82 +19|27 +19|61 +19|85 +19|83 +19|29 +19|12 +19|52 +19|54 +19|81 +19|62 +19|51 +19|46 +19|32 +19|13 +19|95 +19|49 +19|88 +19|66 +19|59 +19|38 +94|46 +94|82 +94|83 +94|23 +94|51 +94|27 +94|81 +94|52 +94|61 +94|65 +94|62 +94|66 +94|12 +94|59 +94|95 +94|19 +94|88 +94|38 +94|49 +94|54 +94|32 +94|11 +94|29 +94|85 +84|94 +84|88 +84|12 +84|65 +84|27 +84|61 +84|66 +84|21 +84|95 +84|54 +84|92 +84|85 +84|49 +84|45 +84|82 +84|62 +84|81 +84|38 +84|52 +84|11 +84|32 +84|19 +84|22 +84|46 +86|84 +86|74 +86|45 +86|15 +86|47 +86|44 +86|65 +86|94 +86|96 +86|31 +86|68 +86|18 +86|21 +86|42 +86|73 +86|76 +86|27 +86|35 +86|22 +86|95 +86|92 +86|69 +86|87 +86|19 +42|27 +42|96 +42|18 +42|95 +42|65 +42|66 +42|38 +42|21 +42|88 +42|74 +42|49 +42|87 +42|45 +42|76 +42|47 +42|32 +42|19 +42|92 +42|22 +42|82 +42|44 +42|54 +42|84 +42|94 +96|45 +96|65 +96|19 +96|66 +96|44 +96|18 +96|32 +96|95 +96|38 +96|84 +96|49 +96|22 +96|94 +96|47 +96|74 +96|92 +96|76 +96|82 +96|21 +96|54 +96|11 +96|27 +96|62 +96|88 +18|49 +18|27 +18|62 +18|92 +18|46 +18|88 +18|22 +18|95 +18|94 +18|19 +18|66 +18|38 +18|32 +18|84 +18|81 +18|12 +18|21 +18|52 +18|54 +18|65 +18|45 +18|82 +18|11 +18|85 +95|85 +95|82 +95|59 +95|23 +95|66 +95|27 +95|51 +95|13 +95|49 +95|38 +95|83 +95|54 +95|39 +95|12 +95|81 +95|62 +95|29 +95|46 +95|32 +95|88 +95|61 +95|52 +95|65 +95|11 +88|52 +88|54 +88|39 +88|62 +88|38 +88|82 +88|46 +88|49 +88|66 +88|11 +88|61 +88|83 +88|81 +88|32 +88|79 +88|51 +88|12 +88|86 +88|64 +88|29 +88|59 +88|85 +88|23 +88|13 +68|49 +68|95 +68|15 +68|45 +68|76 +68|88 +68|22 +68|82 +68|65 +68|96 +68|27 +68|19 +68|18 +68|21 +68|42 +68|84 +68|94 +68|87 +68|44 +68|92 +68|54 +68|38 +68|74 +68|47 +65|51 +65|12 +65|27 +65|46 +65|85 +65|49 +65|11 +65|81 +65|32 +65|62 +65|83 +65|59 +65|66 +65|39 +65|79 +65|82 +65|61 +65|29 +65|54 +65|88 +65|23 +65|13 +65|52 +65|38 +79|47 +79|42 +79|19 +79|35 +79|68 +79|94 +79|69 +79|73 +79|64 +79|86 +79|95 +79|21 +79|96 +79|18 +79|92 +79|44 +79|76 +79|84 +79|87 +79|45 +79|31 +79|22 +79|74 +79|15 +62|35 +62|52 +62|59 +62|42 +62|79 +62|85 +62|12 +62|87 +62|13 +62|29 +62|68 +62|46 +62|64 +62|69 +62|73 +62|51 +62|31 +62|15 +62|81 +62|83 +62|39 +62|86 +62|23 +62|61 +44|94 +44|45 +44|88 +44|18 +44|85 +44|19 +44|46 +44|92 +44|38 +44|65 +44|22 +44|81 +44|52 +44|66 +44|49 +44|11 +44|95 +44|27 +44|84 +44|54 +44|32 +44|62 +44|82 +44|21 +38|46 +38|85 +38|81 +38|61 +38|59 +38|29 +38|66 +38|32 +38|82 +38|35 +38|62 +38|52 +38|83 +38|73 +38|51 +38|31 +38|12 +38|13 +38|79 +38|64 +38|39 +38|23 +38|11 +38|86 +39|44 +39|45 +39|69 +39|79 +39|18 +39|84 +39|22 +39|96 +39|31 +39|42 +39|35 +39|76 +39|64 +39|74 +39|86 +39|19 +39|68 +39|94 +39|92 +39|15 +39|73 +39|47 +39|21 +39|87 +83|87 +83|23 +83|15 +83|35 +83|22 +83|42 +83|64 +83|18 +83|39 +83|69 +83|21 +83|96 +83|59 +83|31 +83|86 +83|79 +83|44 +83|73 +83|13 +83|47 +83|76 +83|74 +83|68 +83|84 +59|86 +59|31 +59|42 +59|87 +59|76 +59|79 +59|18 +59|84 +59|47 +59|39 +59|44 +59|74 +59|23 +59|13 +59|21 +59|96 +59|92 +59|22 +59|73 +59|68 +59|35 +59|64 +59|69 +59|15 +73|15 +73|84 +73|88 +73|42 +73|65 +73|76 +73|92 +73|94 +73|68 +73|27 +73|54 +73|74 +73|69 +73|45 +73|96 +73|22 +73|18 +73|47 +73|95 +73|87 +73|19 +73|21 +73|31 +73|44 +32|12 +32|35 +32|23 +32|85 +32|68 +32|83 +32|64 +32|73 +32|29 +32|52 +32|61 +32|39 +32|51 +32|11 +32|13 +32|15 +32|81 +32|46 +32|69 +32|62 +32|79 +32|31 +32|59 +27|61 +27|51 +27|64 +27|85 +27|83 +27|62 +27|66 +27|32 +27|13 +27|39 +27|81 +27|23 +27|82 +27|49 +27|59 +27|54 +27|38 +27|52 +27|12 +27|11 +27|88 +27|79 +29|21 +29|84 +29|64 +29|35 +29|39 +29|18 +29|69 +29|23 +29|44 +29|15 +29|87 +29|96 +29|76 +29|86 +29|83 +29|47 +29|13 +29|73 +29|31 +29|42 +29|79 +82|73 +82|81 +82|59 +82|52 +82|13 +82|62 +82|32 +82|79 +82|83 +82|35 +82|46 +82|86 +82|66 +82|31 +82|64 +82|85 +82|39 +82|61 +82|23 +82|29 +69|18 +69|74 +69|65 +69|76 +69|54 +69|88 +69|27 +69|92 +69|96 +69|44 +69|22 +69|87 +69|68 +69|15 +69|38 +69|42 +69|94 +69|19 +69|45 +66|62 +66|23 +66|79 +66|61 +66|35 +66|83 +66|85 +66|69 +66|46 +66|81 +66|39 +66|73 +66|52 +66|29 +66|11 +66|12 +66|13 +66|51 +76|62 +76|88 +76|27 +76|65 +76|45 +76|66 +76|19 +76|82 +76|74 +76|38 +76|54 +76|84 +76|85 +76|49 +76|94 +76|18 +76|21 +87|47 +87|22 +87|84 +87|27 +87|66 +87|76 +87|21 +87|44 +87|54 +87|95 +87|94 +87|45 +87|19 +87|38 +87|74 +87|11 +64|68 +64|84 +64|95 +64|65 +64|18 +64|87 +64|94 +64|21 +64|42 +64|31 +64|92 +64|45 +64|69 +64|47 +64|74 +92|27 +92|94 +92|49 +92|19 +92|65 +92|11 +92|85 +92|45 +92|46 +92|81 +92|83 +92|32 +92|66 +92|95 +13|35 +13|69 +13|68 +13|45 +13|92 +13|86 +13|42 +13|96 +13|74 +13|39 +13|22 +13|15 +13|79 +21|19 +21|46 +21|81 +21|11 +21|95 +21|94 +21|27 +21|85 +21|12 +21|54 +21|88 +21|66 +22|61 +22|95 +22|82 +22|62 +22|81 +22|27 +22|49 +22|52 +22|66 +22|85 +22|51 +47|38 +47|65 +47|32 +47|88 +47|45 +47|66 +47|82 +47|11 +47|84 +47|49 +54|86 +54|46 +54|83 +54|59 +54|38 +54|82 +54|11 +54|81 +54|29 +52|87 +52|31 +52|46 +52|74 +52|83 +52|79 +52|23 +52|86 +12|73 +12|35 +12|79 +12|29 +12|15 +12|86 +12|61 +61|74 +61|47 +61|18 +61|86 +61|79 +61|51 +49|82 +49|86 +49|83 +49|81 +49|29 +35|44 +35|87 +35|73 +35|42 +85|73 +85|59 +85|39 +23|74 +23|64 +81|51 + +79,64,35,74,22,94,19 +35,31,68,42,96,74,47,44,18,84,21,22,45,19,95,65,27 +94,76,47,44,18,87,86,95,84,35,74,73,68,19,42,15,65 +52,46,12,61,51,29,83,59,23,13,39,79,64,86,35,73,31,69,68,15,42,87,96 +19,69,92,18,27,74,44,88,21,68,45,47,22,42,54,76,65,84,15,94,31 +51,29,83,23,39,79,64,35,73,87,96,76,47,44,18 +27,52,23,79,66,39,81 +13,83,62,51,29,88,82,85,38,39,59,61,27,52,46,66,32,79,12 +52,32,46,83,12,95,49,29,66,82,11,88,61,59,27 +47,22,92,45,94,19,95,65,88,38,82,32,11,85,81 +13,39,79,64,86,35,73,31,69,68,15,42,87,76,74,47,44,18,84,21,22,92,45 +88,38,32,11,62,85,81,52,46,12,61,29,83,59,39,79,64 +85,51,64,29,32,13,12,79,35,39,52 +12,92,65,49,19,45,95,81,11,88,32,85,66,51,27,94,54,38,61,82,52,29,46 +69,68,15,42,87,96,76,74,47,44,18,21,22,92,45,94,19,95,65,27,88,54,49 +12,61,51,29,83,59,23,13,39,79,64,86,35,31,68,15,42,87,96,74,47 +64,22,84,95,73,44,74,45,15 +44,38,54,95,65,19,52,22,81,85,32 +87,65,45,84,44,73,86,42,96 +12,83,11,49,81,62,61,38,35,29,39,23,64,51,13,32,66,86,46,82,85 +73,68,96,74,47,44,22,94,88 +45,27,54,82,11,12,83 +85,81,46,88,95,29,51,82,38 +54,66,32,11,62,52,29,83,59 +54,61,11,23,19,65,81 +15,42,47,21,92,38,82 +65,85,19,45,27,88,84,46,18,21,32 +47,96,79,42,15,21,31,84,22,69,76,74,44,68,86,87,92,39,94,18,64 +59,32,12,13,64,68,81,83,29,11,69,79,52 +47,84,92,27,88,82,66,32,11,62,81 +82,62,45,46,54,38,49,52,84,88,85 +29,83,79,86,73,44,84 +45,74,19,54,47,44,69,15,92,96,76,65,31,21,42,27,94,68,22,84,87,18,95 +27,88,54,49,82,66,32,11,62,52,46,12,61,51,29,83,59,23,13,39,79 +32,11,85,46,12,61,79,86,35,31,68 +12,51,29,83,59,23,13,39,79,64,86,35,31,69,15,96,47 +42,76,87,18,22,79,35,86,92,39,15,45,69,47,68,74,31,13,96,44,73 +42,35,87,22,94,47,86,69,68,39,21,73,44,76,45,31,74,15,92,64,18 +96,64,29,42,68,47,87,13,39,76,51,83,35,12,61,73,31,59,23 +35,73,15,79,81,85,11 +54,82,66,81,12,29,83,79,86 +15,87,73,23,59,74,46 +29,83,59,23,13,64,86,35,31,69,68,15,42,87,96,76,74,47,44,18,84 +94,19,95,65,27,88,54,49,38,82,66,32,11,62,85,81,52,46,12,61,51,29,59 +84,21,22,92,45,94,19,95,65,27,88,54,49,38,82,66,32,11,62,85,81,52,12 +23,79,35,69,68,15,87,96,76,74,47,44,18,21,92 +59,87,84,96,83,18,74,73,35,23,39,69,64,42,13,21,86,47,44,15,76 +59,29,52,46,88,32,81,39,83,64,12 +22,44,76,47,18,74,21,15,95,88,54,87,94,65,82,96,38,42,27 +84,94,95,65,27,54,82,66,32,11,62,81,52 +46,12,61,51,83,23,13,39,64,86,35,73,69,15,42,87,76 +38,82,66,11,62,85,46,61,51,29,83,59,23,13,39,79,64,86,73 +19,95,65,27,88,54,49,38,82,66,32,11,62,81,52,46,51,29,83,59,23 +54,21,94,84,22,19,96,74,45,65,68,38,49,27,87 +18,39,13,92,35,21,69,44,73,87,74,64,84,96,68,42,22,86,79,15,45,31,47 +11,85,95,82,62,88,19,83,65,27,46,54,29,12,49,61,94,45,52,32,66 +32,85,81,38,82,49,92,66,29,65,52,45,62,19,51,11,61,94,88 +15,42,87,96,76,47,18,84,21,22,92,45,94,19,95,65,27,88,49,38,82 +83,29,13,74,86,79,15,87,64,42,51,47,59,31,23 +62,81,52,46,12,61,51,29,83,59,23,13,64,86,35,31,69,68,42 +32,22,92,85,45,88,94,21,27,62,65,82,38,61,12,66,95,49,81,19,54 +59,35,61,46,79,86,12,69,39,31,73,83,29,96,81,68,13,51,87,23,52 +68,79,96,46,64,31,59,52,73,51,39,81,61,15,35 +38,92,27,88,66,44,62 +11,52,83,39,62,38,51,29,61,66,54,82,88,23,64 +42,87,96,74,47,18,84,22,45,94,27,88,54,38,66 +96,76,47,44,18,84,21,22,92,45,94,19,95,65,27,88,49,38,66,32,11 +96,21,19,27,49,38,66,32,11 +22,92,45,94,19,65,27,88,54,49,38,82,66,32,11,62,85,81,52,46,12,61,51 +61,29,83,59,23,13,79,64,86,35,73,69,68,87,96,76,74,47,44 +22,45,94,19,65,27,88,54,49,38,82,32,11,62,85,81,52,46,12,61,51 +38,96,21,68,19,88,18,27,45,44,92,94,84 +29,12,69,68,96,23,59,35,51,39,87,52,64,76,73 +13,73,86,52,83,81,85,35,29,39,46,51,66,82,38,59,62,32,61 +42,79,23,51,62,59,68,39,73 +46,12,29,39,31,69,15,87,74 +81,79,39,49,27,51,46,82,62 +38,82,62,85,81,46,12,51,59,13,79,64,86,35,73 +68,35,92,27,96,94,42 +65,32,76,92,45,54,49,74,47,94,11,38,95,21,44,96,18,19,27,22,82,88,66 +49,82,66,32,85,52,46,12,51,29,83,23,13,64,35 +81,52,46,12,61,51,29,83,59,13,39,79,86,35,73,31,69,15,42,87,96 +68,42,76,74,44,18,22,94,19,95,65,27,88,54,49 +96,86,23,42,39 +76,74,47,44,18,84,22,92,45,94,19,95,65,88,54,49,38,82,66,32,11 +59,79,64,86,73,15,42,87,76,47,44,18,84,21,22 +29,61,31,87,68,51,64,13,39,73,74,44,83 +84,21,22,92,45,94,95,27,54,49,38,82,66,11,62,85,81 +19,54,49,32,12,83,23 +87,18,45,94,95,49,82,66,32 +18,76,32,88,45,65,74,54,19,11,96,22,21,92,44,49,84,47,95,94,38,66,27 +87,47,42,69,22,73,68,44,88,18,19,65,31 +19,49,92,38,54,21,94,62,45,84,65,22,82 +23,83,13,85,49,66,82,29,38,32,11,95,88 +32,11,85,81,52,51,59,23,13,39,79,64,86,35,31,69,68 +23,13,39,79,73,69,42,87,76,74,44,84,21 +65,38,82,32,62,85,81,52,46,61,51,29,59,13,39 +79,59,85,51,46 +95,12,51,27,45,65,92,22,82,52,49 +95,88,18,84,32,54,21,11,82,66,46,94,81,38,92,19,52,62,45,27,49,65,85 +81,39,59,82,12,46,86,79,31,51,83 +62,61,68,35,42,83,59 +88,54,49,38,82,66,32,11,62,85,52,12,61,51,29,23,13,39,64 +31,69,87,96,74,47,84,21,65 +79,86,35,73,31,69,68,15,87,96,44,18,84,21,22,92,45,94,19 +96,18,13,47,35,42,74,92,69,87,76,73,79,39,15,44,45 +47,44,18,45,94,19,54,38,32,85,81 +68,42,87,96,47,44,84,22,92,94,19,95,65,88,54,49,38 +19,62,38,32,22,81,66,54,52,92,65,18,84,85,21,95,49,46,45,88,82 +84,35,44,76,86,29,68 +21,92,45,94,19,95,27,49,38,82,11,81,52,46,12 +11,18,85,65,95,27,74,88,49 +61,85,29,46,79,11,32,39,54,49,13,88,52,59,83,51,27 +96,13,39,83,76,61,68,87,69,59,74,42,31,44,35,64,86,29,79 +27,18,92,38,88,47,85,82,65,22,66,81,44,95,32,49,11 +62,29,12,38,85,46,52,45,88,65,49,83,95,61,19,82,54 +44,19,47,65,49,27,54,92,69 +73,96,94,74,69,68,76,18,22,87,84,86,42,79,39,45,47,64,92,15,44,35,31 +94,27,54,88,52,45,83,82,62,49,66,46,65,12,81,11,38 +49,38,54,81,29,13,51,27,95,83,32,88,23,59,11,65,66,62,12,52,46 +79,74,12,13,46,69,29,96,76 +83,51,46,35,74,12,15 +31,15,52,23,51,39,86,85,87,81,46 +62,85,81,52,46,12,61,51,29,83,59,23,13,39,79,64,86,35,73,31,68,15,42 +35,73,31,69,68,15,42,87,96,76,47,44,18,84,21,92,45,94,95,65,27 +44,86,76,59,18,87,15,84,21,64,73,79,42,83,31,68,96,74,39,35,13,23,47 +96,42,64,39,83,81,23 +11,85,81,52,46,12,61,51,29,83,59,23,13,79,64,35,73,31,69,68,15 +94,95,88,11,62,85,52,46,12,83,59 +88,66,32,81,52,12,29 +32,11,62,85,81,46,12,61,51,29,83,59,23,13,39,79,64,86,35,73,31,69,68 +74,47,44,84,21,22,92,45,94,19,95,65,27,88,54,49,82,32,11,62,85 +51,86,15,35,13,29,52,31,85,39,73,42,69,64,87,46,81 +65,82,44,62,88,27,11,18,52,92,22,45,84,38,94,32,81,19,66,54,21 +15,96,13,35,21,68,86,39,18,83,79 +42,87,96,76,74,47,44,18,21,22,92,45,94,19,95,65,27,88,49,82,66 +11,46,39,12,81,65,61,82,38 +81,38,54,85,32,12,62,13,52,29,83,82,51,23,61,46,27,65,11,66,95 +32,62,85,81,52,46,12,61,51,29,83,59,23,39,64,86,35,73,31,69,68 +65,83,88,39,11,38,82 +85,52,46,61,51,29,83,59,39,79,64,86,73,31,68,15,87 +88,84,95,82,38,66,18,94,11,92,45,74,76,19,32,44,65,47,27 +38,82,66,32,11,62,81,46,12,61,51,29,83,39,79,64,86,35,73 +73,31,68,15,42,87,96,76,44,18,84,21,94,19,95,65,27 +23,85,64,11,83,35,66,49,62,82,61,59,38 +21,94,38,62,52,66,49 +46,61,29,59,23,64,73,69,68,15,42 +45,94,19,95,65,27,88,54,49,38,82,66,32,11,62,85,81,52,46,12,61,29,83 +95,74,21,47,82,19,27,54,62,49,84,45,32,38,88,22,44,11,92,76,66 +94,66,19,74,92,21,85,18,38,54,47 +66,44,27,74,65,54,92,82,19,76,38,47,84,22,45 +68,15,87,74,44,18,27,49,38 +87,31,68,42,35,79,86,76,84,21,69,73,39,15,18,13,96,83,44 +68,64,83,96,69,18,23,21,44,84,31 +65,27,54,49,38,82,66,32,11,62,85,81,52,46,12,61,29,83,59,23,39 +66,86,51,39,85 +64,86,73,31,69,68,15,42,87,96,76,74,47,44,18,84,21,22,92,45,94,19,95 +92,82,29,32,62,85,11 +62,79,23,51,29,13,66,83,32,39,59,49,88,64,82,46,52 +52,61,59,68,42,87,76 +38,32,86,62,51,61,23,81,79,13,73 +21,42,76,84,18,47,96,35,59,69,83,74,73,87,44,68,13,39,64,86,31,23,15 +82,66,32,62,81,52,46,12,61,51,29,23,13,79,64,86,35,73,31 +73,29,13,39,81,61,85,69,46,83,35,32,23,79,86,64,66,52,62,51,12,31,11 +29,62,13,54,27,66,59,65,85,46,81,12,23,32,83 +95,76,32,74,27,62,19,18,82,21,65,11,92 +83,66,23,13,61,69,12,29,62 +47,22,76,21,32,19,54,92,38,87,18,45,82 +12,32,85,95,82 +35,68,96,47,84,18,92,73,95,87,27,94,45 +92,94,19,65,66,32,62,85,46,12,29 +19,31,54,92,69,68,42 +45,19,95,65,27,88,54,49,38,82,66,11,62,85,81,52,46,61,83 +86,46,35,52,64,12,83,13,32,59,51 +27,66,92,61,82,62,95,45,11,22,52,46,51 +65,87,18,54,94,84,82,92,15,96,21,47,76,27,88,22,49,45,95 +87,15,74,21,96,64,73,69,59,42,22,35,86,39,68 +73,31,69,68,15,42,87,96,76,74,47,44,18,84,22,92,45,94,19,95,65,27,88 +42,96,44,18,45,94,65,88,54 +95,44,22,27,62,32,88,66,49,82,38,18,21,65,52,81,19,85,45 +23,61,52,51,15,83,12,39,73,69,42,62,68 +21,44,66,62,32,95,49,65,11,19,47,88,84,92,82,85,54,81,27,94,22 +31,68,92,39,35,23,76,18,87,42,22,96,64,13,74,86,79 +76,44,61,86,29,51,39 +59,64,73,11,39,86,79,23,38,32,83,46,52 +39,42,74,69,79,23,12,15,59,64,68,61,73,29,51,13,86,96,35,76,87,47,83 +74,35,42,45,96,21,73,92,94,64,39 +92,45,94,19,65,27,54,49,38,82,66,32,11,62,85,81,52,46,12,61,51 +59,13,39,86,15,87,96,76,44,18,22 +51,29,83,59,23,13,79,86,35,31,69,15,42,87,96,76,74,47,18 diff --git a/2024/python/day05.py b/2024/python/day05.py new file mode 100644 index 0000000..64c54f6 --- /dev/null +++ b/2024/python/day05.py @@ -0,0 +1,55 @@ +import matrix +import shared + +def read(rows): + second = False + rules = [] + updates = [] + for row in rows: + if second: + updates.append(list(map(int, row.split(",")))) + elif row == "": + second = True + else: + rules.append(list(map(int, row.split("|")))) + return rules, updates + + +# @shared.profile +def part1(rows): + rules, updates = read(rows) + bad = [] + for idx, update in enumerate(updates): + for first, second in rules: + if first in update and second in update: + first_idx = update.index(first) + second_idx = update.index(second) + if first_idx > second_idx: + bad.append(idx) + break + total = 0 + for idx, update in enumerate(updates): + if idx in bad: + continue + total += update[len(update) // 2] + print(total) + + +# @shared.profile +def part2(rows): + pass + +def main(): + rows = [row for row in shared.load_rows(5)] + with shared.elapsed_timer() as elapsed: + part1(rows) + print("🕒", elapsed()) + + rows = [row for row in shared.load_rows(5, True)] + with shared.elapsed_timer() as elapsed: + part2(rows) + print("🕒", elapsed()) + + +if __name__ == "__main__": + main() diff --git a/2024/samples/day05.txt b/2024/samples/day05.txt new file mode 100644 index 0000000..9d146d6 --- /dev/null +++ b/2024/samples/day05.txt @@ -0,0 +1,28 @@ +47|53 +97|13 +97|61 +97|47 +75|29 +61|13 +75|53 +29|13 +97|29 +53|29 +61|53 +97|53 +61|29 +47|13 +75|47 +97|75 +47|61 +75|61 +47|29 +75|13 +53|13 + +75,47,61,53,29 +97,61,53,29,13 +75,29,13 +75,97,47,61,53 +61,13,29 +97,13,75,29,47