Initial version
authorNeil Smith <NeilNjae@users.noreply.github.com>
Sun, 3 Dec 2023 10:54:11 +0000 (10:54 +0000)
committerNeil Smith <NeilNjae@users.noreply.github.com>
Sun, 3 Dec 2023 10:54:11 +0000 (10:54 +0000)
advent-of-code23.cabal
advent03/Main.hs [new file with mode: 0644]
data/advent03.txt [new file with mode: 0644]
data/advent03a.txt [new file with mode: 0644]
problems/day03.html [new file with mode: 0644]

index d2f2d162099f4d59c6df75a45f796bca22f2be9d..7316f4c085efed8af525a387fb74ce9d5c7b7faf 100644 (file)
@@ -105,4 +105,9 @@ executable advent02
   import: common-extensions, build-directives
   main-is: advent02/Main.hs
   build-depends: text, attoparsec
+
+executable advent03
+  import: common-extensions, build-directives
+  main-is: advent03/Main.hs
+  build-depends: linear, array
     
\ No newline at end of file
diff --git a/advent03/Main.hs b/advent03/Main.hs
new file mode 100644 (file)
index 0000000..f164bad
--- /dev/null
@@ -0,0 +1,103 @@
+-- Writeup at https://work.njae.me.uk/2022/12/14/advent-of-code-2022-day-12/
+
+import AoC
+
+
+import Data.Char
+import Data.List
+import Linear (V2(..), (^+^))
+import Data.Array.IArray
+
+type Position = V2 Int -- r, c
+type Engine = Array Position Char
+type NumPos = [Position]
+
+data NumberSeek = 
+  NumberSeek { inNumber :: Bool
+             , positions :: NumPos
+             , foundNumbers :: [NumPos]
+             } deriving (Show)
+
+
+main :: IO ()
+main = 
+  do  dataFileName <- getDataFileName
+      text <- readFile dataFileName
+      let engine = mkEngine text
+      let allNums = findNumbers engine
+      let partNums = filter (numTouchingSymbols engine) allNums
+      -- print engine
+      -- print $ findNumbers engine
+      print $ part1 engine partNums
+      print $ part2 engine partNums
+
+
+part1, part2 :: Engine -> [NumPos] -> Int
+part1 engine partNums = sum partNumValues
+  where partNumValues = map (readNumber engine) partNums
+
+part2 engine partNums = sum $ fmap product gearRatios
+  where sts = stars engine
+        touchingStars = fmap (adjacentNumbers partNums) sts
+        gears = filter ((==) 2 . length) touchingStars
+        gearRatios = [[readNumber engine n | n <- pNs] | pNs <- gears]
+
+mkEngine :: String -> Engine
+mkEngine text = grid
+  where rows = lines text
+        r = length rows - 1
+        c = (length $ head rows) - 1
+        grid = listArray ((V2 0 0), (V2 r c)) $ concat rows
+
+isEngineSymbol :: Char -> Bool
+isEngineSymbol c = (not $ isDigit c) && (c /= '.')
+
+findNumbers :: Engine -> [NumPos]
+findNumbers engine = numbers
+  where ((V2 r1 _), (V2 r2 _)) = bounds engine
+        rows = [r1..r2]
+        numbers = concatMap (foundNumbers . (findNumbersInRow engine)) rows
+
+findNumbersInRow :: Engine -> Int -> NumberSeek
+findNumbersInRow engine r
+  | inNumber finalSeek = NumberSeek False [] ((reverse $ positions finalSeek):foundNumbers finalSeek)
+  | otherwise = finalSeek
+  where finalSeek = foldl' (buildNumber engine) 
+                           (NumberSeek False [] []) 
+                           $ range $ rowBounds engine r
+  
+buildNumber :: Engine -> NumberSeek -> Position -> NumberSeek
+buildNumber engine NumberSeek{..} p 
+  | inNumber && isDigit c = NumberSeek True (p:positions) foundNumbers
+  | inNumber && not (isDigit c) = NumberSeek False [] ((reverse positions):foundNumbers)
+  | not inNumber && isDigit c = NumberSeek True [p] foundNumbers
+  | otherwise = NumberSeek False [] foundNumbers
+  where c = engine ! p
+
+rowBounds :: Engine -> Int -> (V2 Int, V2 Int)
+rowBounds engine r = (V2 r c1, V2 r c2)
+  where ((V2 _ c1), (V2 _ c2)) = bounds engine
+
+neighbours :: Position -> [Position]
+neighbours p = [p ^+^ V2 dr dc | dr <- [-1..1], dc <- [-1..1]
+                               , (dr, dc) /= (0, 0) ]
+
+touchingSymbol :: Engine -> Position -> Bool
+touchingSymbol engine p = any (isEngineSymbol . (engine !)) nbrs
+  where nbrs = filter (inRange (bounds engine)) $ neighbours p
+
+numTouchingSymbols :: Engine -> NumPos -> Bool
+numTouchingSymbols engine ps = any (touchingSymbol engine) ps
+
+readNumber :: Engine -> NumPos -> Int
+readNumber engine ps = read $ map (engine !) ps
+
+stars :: Engine -> [Position]
+stars engine = filter ((==) '*' . (engine !)) $ indices engine
+
+starTouchesNumber :: Position -> NumPos -> Bool
+starTouchesNumber star ps = not $ null $ intersect ps halo
+  where halo = neighbours star
+
+adjacentNumbers :: [NumPos] -> Position -> [NumPos]
+adjacentNumbers nums star = filter (starTouchesNumber star) nums
diff --git a/data/advent03.txt b/data/advent03.txt
new file mode 100644 (file)
index 0000000..4c9a7f3
--- /dev/null
@@ -0,0 +1,140 @@
+48.................501....33.....622..............763.........331.................161.683......................................980..........
+...491.842.....948*..................338.....*......=...........-...309.......633*....*....................*990...706...452......*..+.......
+...*...*....................426........*..408.........................*............659...............250.........&.......*.....767...403....
+363.....961...959#.508*223......843.406..........690................%..479.....................398.../....*............458..................
+......=.........................................*....@946........767.........907=.................@....158.850..+670..............10*790....
+.......39.306...679.%113...............665....874....................597...................861.........................840...855............
+.................*.........864.....154*....#..............1*......4..........341..................731*..........783.....#.......*204........
+..919...........706.....*......891........840..%473.........379....*149........-..115..519............668..........*423.....................
+...*.................398.190......$.............................#.......=.%530......$..*..............................................475...
+.543...@.............................834..729.&.........146......789.189........511...17........455*308..662.............530................
+.....142....437....138*755..&53.....*..........783........./.......................*......................................./....674..315....
+..........-./.......................826...%.....................752........414......480.................276.952...................-...*.....
+.......131.......*654..590.................819..........$..........-.347*..................294.....776...&...*........741.....830....230....
+..586%.....968...........+..........319..............628......516............933..........&........+..........600.....*........*............
+............*...................-..*.........................%........................726...876..........772..........99......145......785..
+...........710...............352...842..941...802.....133............474.&235.................*.............*561..........#...........*.....
+.......................................=...............*........=...................642.......774......*.........67..@921.374.......165.....
+..250........................8..........................968...375........224...#.......*............497.833........-........................
+...$.....................584..*978..107&....471...............................486....408......................................@241.-555.....
+......662$........%......&.....................*..#186...550........=309............................76.......399............................
+................281.........808....666.......207.........-...615.................59=....569.....197*...42...%...........572....+231...%.....
+....758.$777................%.....*...............433................646.834.............@.............*.........543...................769..
+....*................995...........628...............*..................*..............=..........341...583.112+...*.......74..=341.........
+.....775.................................744...278.128.......................126...940.839....=.....*............385.499...*............302.
+..........*177...574.............+.......+......*................561#...590.*......$.........231...586....................212...........#...
+.......418....................954..433.......484...........526...........*..643......-......................&..778...............701........
+.414..............493.....566.....*......=..................*....236...748..........543...593...*745.......57.........&.........*...........
+....*................*.....*....46....659..%.&980..........66....................36...........87...................994.......218...443......
+226.241.893%..........257..312............69........792............/...........+...................$257..................790........./...184
+................................................854*.............909.139..*276.680..&.........432............580....248.................*...
+....136*755...@.950......................173.............95..........+...............2.877.......*668......+..+.........918*.......62....571
+............333.*....812...$.428.................*496..................903@...258&.............-........650.................281......+......
+......500.......6....*...719.+......285.......955.....712*12..561.497..............667...&.843..777.................427................@....
+.....&............506..................=..359................#....................*.....24.../.........544.436..........492=........272.....
+.........377..........=............41-......+...........229........761...540....391..............*565.....*......449..........665.......#...
+.887....*.....906..141.....357...$.................%......*.................#.............-..874......811...9.....*....$113......*.967...628
+......406............../.......637.551....223....162.......251...........................702.*......%......*....&.905.........747...........
+....*...........321.....801............=.....-.#...............390........845..12............399...126....283.566.....124*102......&........
+..447..+....935...-..............41.68.87.92...105....178=....*..........*.......*..92..............................................21......
+......505...................................*................614....948..237..512......108.58..162...454@...........395.......5.............
+...........454..10.../............101........885.......................*..................*...*....................*........................
+..........%....*....534......114.*................../.95......427.210..674.......371.903......81....................922.....231...346.......
+...525........887...........#........162....211..166..@......*.....*.......281......*....................835.635............*.....*.....828.
+.....*..............571...............+........-.............933.629./25..*...........977........*............*...........178.....749..*....
+..993.........-................516/................394...56................477....545.*.......251.858......499....435.........&.........170.
+.......967..73.....&.....35.........656....842.....*......*........................*...749............%..........#...........622............
+......+...........366.86..*...........#.....=.....162...332.............-..........859............102..488.........................717......
+347.........32........#....393.................*.................252...262....951.......823...................784...358.603.......*.....515.
+......917..*.....$..........................642.394..195...*..................*....$......*.448.519................*......*....302..870.*...
+...-..*...674.....780.547....287....................*....504...................803.688.831....*..*...........617......./..476........*...9..
+.286..738................#.......-511..11.....581..268.....................439.............523..459...............69..373............887....
+......................*...................555*.........45....638...964.......-...$..........................................88*.............
+.........802...+805.77.648.....66.676........................&..../....26......708...+.-981...239%........953..................672..........
+......./.....#.............11.+......*....=...........756.............*.....-......298..................=...*..751.......433.........727....
+....553.......659....907...@......@..530.218.............*......259..821...716.980..........89..851...793.614.......943....*.....961*.......
+........*339........$..........373...............................*...............$.....667..$......*..........149.....+..613................
+..987..................*...................670...105.....347....383.605..................@....447...124..........*737...........562..15*445.
+........-.....595*7..215.839.781.............*..*...........$.............810....*............*...........350....................*..........
+.........929.............*......*...362@...890...975....#..........2....../...252.576.......78...........+........685.240......695..........
+.................475......598.152........................841.&880..#......................&....693....=.............=.....28........&384....
+............472..*.......................$..320.412*...................304...=.-.........395......=.113....601..............................
+..324.738.........968...................755..*......101.......476..........90..342........................*.....638..182/...........704..139
+.........*..610*......601...................356.../.......633*....971..........................806.....#...240...*...................../....
+........683.....326.....*..@........749.........390.........................163@....800..483..*........792.....94...........................
+...600................957..741...../....376............817..899.......194........50.....@....96.368..................@.......+600....-......
+..........338%..........................*...............#....#.........*....304..+....*...........*...................236............284....
+..423........................&763.............947.................371.187..*.......356.441......201.......................285...............
+............75................................*....................*......696........................#...............................670....
+...*..........*.........426.......635..-....449.758*.......314.......*..............................246.........*................58..*......
+574.322........937.......*........#...116...........40.......*.@752..400........180....@......918.........195.49......983....559*.....82....
+...........*.........527..842.............................817...................../.270...445..*............*...............................
+........622.235..869*..........922*...............125*610..............*459...............&....455...........21.......964...................
+...................................465..%542.........................47......272............+..........775.............*.....328.....@......
+.................732*........51.&..........................853.222.........................672....148....+.........572..499.+....*....12....
+....125..............581....*...909.787.......720*263......*....$..881%....623*891..515..........=..................*.........726.78........
+.....%..........715......935.........*....650............874.......................*.........127....................923.....................
+................$.............330*..444....$....653............%....345..915.....960.395...........823.706..734.341...............295...342.
+.............................................99..-...........465...&......*.............*416......*..........@....*...@......630.....*......
+.....@.........356.......................399.+......+.....................349..................542..............853.375.......=.......132...
+....77...=719.@.......*...../662...........*...233...781..............................&687................%.................................
+.....................791..................933.*..........931.....884*...........-...................../...112..%601..........857............
+583.....*292...................................438...................424......603.416.........484...104.....................*.......706.....
+.............................452.......549.............24...997....................*............*.........767...379..........192............
+........413.................&.....#......*....*.......*.........523.........443.412.....546......859..138*........&..66.576.................
+..................../...........348....816.106.391......................447.........../...*..895.......................*................595.
+...........#......771.675..................................673............*........176...856..=...627*308..696...............658............
+....489..51...174......%..676......$..........*........332.*.............373.350................-..........*.................*.....*........
+181.*........*...............*822.136..888.642.202.......*..65....958........*........358........510.....*..504..747...993....339..764......
+...........540........................................308...........@.895..942.506......*....791.......166......#...../..../...........668..
+...................452............-....631..............................*........&.....253..../............897......*....602................
+..748....249.24............21...847...&.....194...@...............@...865................................=....*.....550.....................
+....*.......*.....658...................573*.......679.....760/..431.................481..........907....130.912...............240...998....
+.605...............*.......25.......#..................................726..646....#..........607..*................698..........*...+......
+...........301&.572........#.....101...................148........55...........*.122........./........953..........-.....602.321.929.....998
+511.870...............@....................808.........*........*............257.......206............@........685..........*...............
+.............903...398.....588......114.......*...990...677.....182.10$...........%.........%.................%........................2*...
+................*...........*...490...........987....=......803.........98......485.493.868..945.805......-........89............=944....296
+......640.......669.........630..*.......................-....&..582.......341.........*.........*.........939......*.......................
+.........*34....................557.....130....265.....21........*...625..$...............*796..690................997...489....293.........
+....917.......916............@.................*.................948..&...........148...67..................833........./..........-...943..
+....$........*......849...4$..300..217........58..........................643.170...........................................................
+.........511..853......*..............*...........355.............35-.....-....@..636.....=...595..131...496..........................=687..
+............%........&..476......452...435.....%...*.....700..........391........*.....418.........*.........39*.&..........................
+.16...=.............500.....................426...469.....*.............&.....#..522.............939..............395.660...................
+...*.696.....*869........995.....413...................864.................991.......598......42.........................@..806..386........
+337.......983.....610........104*.......100*......................-............$79....@...461*....*685...270................*...*........240
+......................207...........311.....741..................337.........*.................381.......*........979.....712.374.879.......
+.......@.....554.........*.....485.....................853.............*..276.230...........7...........740...755*..................-.......
+....927.../.....#...#...46........*466...........=.................=.531...........593......*..%....................961.....@...............
+..........65......294..........................30..339..856.....966...........904..........791..841..........438.......#...747..............
+..419...................614................972.......*...............131.......=.......................716..........21......................
+.....=.79..............................&....*......76.....243..............115.......757...364..870....&...890......+...840..........55.....
+....................383....*48...571...124...749............*................-..&.....*......*...*........@.....................201./.......
+......752.....470.......+..........*........................964.......452........776...413...9..791...257.......687.....84......*...........
+.........*502.*......873..850..573..729....@.....197....................*...798.........................@......*........&.....65...200..357.
+...............307.............*..........597.....*...473.....=.......332....*..311..861*399...................472..................*.../...
+.820.....................65....754.............713......*.....739...........622...............768/..................................967.....
+....*.......180..........*...*.........218...............260......................519...933..........271.....36....132.....147..............
+.935..4......@..254...815..58.689.......*..........................159..............$...*..........*....&...$.......*......../.414*164......
+.......-.388.......%....................284...........833...770...*...........705.....697.......466.239.......332....489....................
+....#.....*...........@.......288............972.........-.*......723.....*....*................................*............=..........592.
+...535..........*.267..193.......*..367.....*..............132............509..776.790..@....466..........715.758...*115.....608............
+.............979..*..........8.353.....*...329...@544.913..........................*.....759.*......704..%............................712...
+...................52..170...*......459................/...#.......161........813.510.........207......@..........581..................*....
+............#...........*..978...........581.9*815..........450...............*.......................................604.......308...725...
+............16.........269............../.............195........217*216......890......................534.....84......-......-.............
+....339...........................459.......644..........*.........................636.....113...%154...*....................127.....#348...
+349...*.............402...735......@................182.121...134........%255.276...%...&.../............460....#......79...................
+....503....22.............#.....$............38.....+...........*....-11.......*......326...../....*853.........216......*.../180.....16....
+..........*......92.............456..619......*..-...........=...103..........190..........353..982......25*........465.209.................
+...485.350..........949...994.......*....379..3.22........972.........713.734.........262...........$.......846.......*.............333-....
+....................*..../....*121.729..+............325.............*.......*..........*........374..............+..769.....811............
+......-..............788...488....................................851....679......*......487.....................368.........*........*.....
+....612..528...255.................364.....................130.................317..251...............................665.206..972.957.184..
+..........*..../.......337..475*......&..391...347...795....*.........................*......722..666...............@.......................
+........823.$.....+.../.........716......*........*....*.....247......329...........697......*.....*....%.....168....624.........592........
+...98*.......916..915......245............277..&..353...719..........$.....................846.601.37...47......................*......519..
+......91..............720..*........$985......976......................834...........461.........*...........................266....#...*...
+68....................*....45..............&...........79*888.250*461.*.......%................574..........3*....408..380........383.192...
+...........836......383...........557.....672..........................764.....944............................827...........................
\ No newline at end of file
diff --git a/data/advent03a.txt b/data/advent03a.txt
new file mode 100644 (file)
index 0000000..624ea4f
--- /dev/null
@@ -0,0 +1,10 @@
+467..114..
+...*......
+..35..633.
+......#...
+617*......
+.....+.58.
+..592.....
+......755.
+...$.*....
+.664.598..
\ No newline at end of file
diff --git a/problems/day03.html b/problems/day03.html
new file mode 100644 (file)
index 0000000..6b784bf
--- /dev/null
@@ -0,0 +1,159 @@
+<!DOCTYPE html>
+<html lang="en-us">
+<head>
+<meta charset="utf-8"/>
+<title>Day 3 - Advent of Code 2023</title>
+<link rel="stylesheet" type="text/css" href="/static/style.css?31"/>
+<link rel="stylesheet alternate" type="text/css" href="/static/highcontrast.css?1" title="High Contrast"/>
+<link rel="shortcut icon" href="/favicon.png"/>
+<script>window.addEventListener('click', function(e,s,r){if(e.target.nodeName==='CODE'&&e.detail===3){s=window.getSelection();s.removeAllRanges();r=document.createRange();r.selectNodeContents(e.target);s.addRange(r);}});</script>
+</head><!--
+
+
+
+
+Oh, hello!  Funny seeing you here.
+
+I appreciate your enthusiasm, but you aren't going to find much down here.
+There certainly aren't clues to any of the puzzles.  The best surprises don't
+even appear in the source until you unlock them for real.
+
+Please be careful with automated requests; I'm not a massive company, and I can
+only take so much traffic.  Please be considerate so that everyone gets to play.
+
+If you're curious about how Advent of Code works, it's running on some custom
+Perl code. Other than a few integrations (auth, analytics, social media), I
+built the whole thing myself, including the design, animations, prose, and all
+of the puzzles.
+
+The puzzles are most of the work; preparing a new calendar and a new set of
+puzzles each year takes all of my free time for 4-5 months. A lot of effort
+went into building this thing - I hope you're enjoying playing it as much as I
+enjoyed making it for you!
+
+If you'd like to hang out, I'm @ericwastl@hachyderm.io on Mastodon and
+@ericwastl on Twitter.
+
+- Eric Wastl
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-->
+<body>
+<header><div><h1 class="title-global"><a href="/">Advent of Code</a></h1><nav><ul><li><a href="/2023/about">[About]</a></li><li><a href="/2023/events">[Events]</a></li><li><a href="https://teespring.com/stores/advent-of-code" target="_blank">[Shop]</a></li><li><a href="/2023/settings">[Settings]</a></li><li><a href="/2023/auth/logout">[Log Out]</a></li></ul></nav><div class="user">Neil Smith <a href="/2023/support" class="supporter-badge" title="Advent of Code Supporter">(AoC++)</a> <span class="star-count">6*</span></div></div><div><h1 class="title-event">&nbsp;&nbsp;<span class="title-event-wrap">{:year </span><a href="/2023">2023</a><span class="title-event-wrap">}</span></h1><nav><ul><li><a href="/2023">[Calendar]</a></li><li><a href="/2023/support">[AoC++]</a></li><li><a href="/2023/sponsors">[Sponsors]</a></li><li><a href="/2023/leaderboard">[Leaderboard]</a></li><li><a href="/2023/stats">[Stats]</a></li></ul></nav></div></header>
+
+<div id="sidebar">
+<div id="sponsor"><div class="quiet">Our <a href="/2023/sponsors">sponsors</a> help make Advent of Code possible:</div><div class="sponsor"><a href="https://merge.berlin/" target="_blank" onclick="if(ga)ga('send','event','sponsor','sidebar',this.href);" rel="noopener">THE MERGE</a> - The Developer Experience Conference in Berlin, June 2024 (created by the co-founder of GitHub)</div></div>
+</div><!--/sidebar-->
+
+<main>
+<article class="day-desc"><h2>--- Day 3: Gear Ratios ---</h2><p>You and the Elf eventually reach a <a href="https://en.wikipedia.org/wiki/Gondola_lift" target="_blank">gondola lift</a> station; he says the gondola lift will take you up to the <em>water source</em>, but this is as far as he can bring you. You go inside.</p>
+<p>It doesn't take long to find the gondolas, but there seems to be a problem: they're not moving.</p>
+<p>"Aaah!"</p>
+<p>You turn around to see a slightly-greasy Elf with a wrench and a look of surprise. "Sorry, I wasn't expecting anyone! The gondola lift isn't working right now; it'll still be a while before I can fix it." You offer to help.</p>
+<p>The engineer explains that an engine part seems to be missing from the engine, but nobody can figure out which one. If you can <em>add up all the part numbers</em> in the engine schematic, it should be easy to work out which part is missing.</p>
+<p>The engine schematic (your puzzle input) consists of a visual representation of the engine. There are lots of numbers and symbols you don't really understand, but apparently <em>any number adjacent to a symbol</em>, even diagonally, is a "part number" and should be included in your sum. (Periods (<code>.</code>) do not count as a symbol.)</p>
+<p>Here is an example engine schematic:</p>
+<pre><code>467..114..
+...*......
+..35..633.
+......#...
+617*......
+.....+.58.
+..592.....
+......755.
+...$.*....
+.664.598..
+</code></pre>
+<p>In this schematic, two numbers are <em>not</em> part numbers because they are not adjacent to a symbol: <code>114</code> (top right) and <code>58</code> (middle right). Every other number is adjacent to a symbol and so <em>is</em> a part number; their sum is <code><em>4361</em></code>.</p>
+<p>Of course, the actual engine schematic is much larger. <em>What is the sum of all of the part numbers in the engine schematic?</em></p>
+</article>
+<p>Your puzzle answer was <code>521601</code>.</p><article class="day-desc"><h2 id="part2">--- Part Two ---</h2><p>The engineer finds the missing part and installs it in the engine! As the engine springs to life, you jump in the closest gondola, finally ready to ascend to the water source.</p>
+<p>You don't seem to be going very fast, though. Maybe something is still wrong? Fortunately, the gondola has a phone labeled "help", so you pick it up and the engineer answers.</p>
+<p>Before you can explain the situation, she suggests that you look out the window. There stands the engineer, holding a phone in one hand and waving with the other. You're going so slowly that you haven't even left the station. You exit the gondola.</p>
+<p>The missing part wasn't the only issue - one of the gears in the engine is wrong. A <em>gear</em> is any <code>*</code> symbol that is adjacent to <em>exactly two part numbers</em>. Its <em>gear ratio</em> is the result of <span title="They're magic gears.">multiplying</span> those two numbers together.</p>
+<p>This time, you need to find the gear ratio of every gear and add them all up so that the engineer can figure out which gear needs to be replaced.</p>
+<p>Consider the same engine schematic again:</p>
+<pre><code>467..114..
+...*......
+..35..633.
+......#...
+617*......
+.....+.58.
+..592.....
+......755.
+...$.*....
+.664.598..
+</code></pre>
+<p>In this schematic, there are <em>two</em> gears. The first is in the top left; it has part numbers <code>467</code> and <code>35</code>, so its gear ratio is <code>16345</code>. The second gear is in the lower right; its gear ratio is <code>451490</code>. (The <code>*</code> adjacent to <code>617</code> is <em>not</em> a gear because it is only adjacent to one part number.) Adding up all of the gear ratios produces <code><em>467835</em></code>.</p>
+<p><em>What is the sum of all of the gear ratios in your engine schematic?</em></p>
+</article>
+<p>Your puzzle answer was <code>80694070</code>.</p><p class="day-success">Both parts of this puzzle are complete! They provide two gold stars: **</p>
+<p>At this point, you should <a href="/2023">return to your Advent calendar</a> and try another puzzle.</p>
+<p>If you still want to see it, you can <a href="3/input" target="_blank">get your puzzle input</a>.</p>
+<p>You can also <span class="share">[Share<span class="share-content">on
+  <a href="https://twitter.com/intent/tweet?text=I%27ve+completed+%22Gear+Ratios%22+%2D+Day+3+%2D+Advent+of+Code+2023&amp;url=https%3A%2F%2Fadventofcode%2Ecom%2F2023%2Fday%2F3&amp;related=ericwastl&amp;hashtags=AdventOfCode" target="_blank">Twitter</a>
+  <a href="javascript:void(0);" onclick="var ms; try{ms=localStorage.getItem('mastodon.server')}finally{} if(typeof ms!=='string')ms=''; ms=prompt('Mastodon Server?',ms); if(typeof ms==='string' && ms.length){this.href='https://'+ms+'/share?text=I%27ve+completed+%22Gear+Ratios%22+%2D+Day+3+%2D+Advent+of+Code+2023+%23AdventOfCode+https%3A%2F%2Fadventofcode%2Ecom%2F2023%2Fday%2F3';try{localStorage.setItem('mastodon.server',ms);}finally{}}else{return false;}" target="_blank">Mastodon</a
+></span>]</span> this puzzle.</p>
+</main>
+
+<!-- ga -->
+<script>
+(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+ga('create', 'UA-69522494-1', 'auto');
+ga('set', 'anonymizeIp', true);
+ga('send', 'pageview');
+</script>
+<!-- /ga -->
+</body>
+</html>
\ No newline at end of file