Our great sponsors
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
-
AdventOfCode
My Advent of Code solutions. I also upload videos of my solves: https://www.youtube.com/channel/UCuWLIm0l4sDpEe28t41WITA
-
Advent-of-Code
A repository holding all of my solutions to Advent of Code problems (by Noble-Mushtak)
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
-
AdventOfCode
Hacky solutions for [Advent of Code](https://adventofcode.com), working on past problems (by AllanTaylor314)
-
advent-of-code
Solutions for (some) Advent of Code challenges (2015-2020) http://adventofcode.com/ (by LiquidLemon)
-
aoc
My attempts at Advent of Code, along with a smaller helper library to streamline daily AoC tasks. (by hrushikeshrv)
-
adventofcode
Advent of Code solutions of 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 and 2023 in Scala (by sim642)
-
aoc2022
Trying to solve Advent of Code 2022 in 25 different languages (1 day = 1 language) (by GoldsteinE)
-
advent-of-code-2022
Joel Eisner's completed TypeScript code challenges for "Advent of Code" 2022 (by joeleisner)
-
adventOfCode
Advent of code solutions, probably mostly in C++, but maybe in Rust in the (near) future. (by osalbahr)
-
aoc-2022
Python 3 solutions to the Advent of Code 2022 coding puzzles (https://adventofcode.com/2022). (by charlescochran)
-
advent-of-code-go
All 8 years of adventofcode.com solutions in Go/Golang; 2015 2016 2017 2018 2019 2020 2021 2022
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
https://github.com/ephemient/aoc2022/blob/main/hs/src/Day13Fast.hs https://github.com/ephemient/aoc2022/blob/main/kt/src/commonMain/kotlin/com/github/ephemient/aoc2022/Day13Fast.kt https://github.com/ephemient/aoc2022/blob/main/py/aoc2022/day13_fast.py
Python3, 31/31. Video. Code.
Python 3, 27/22: Here is my Part 1 and Part 2 code.
Elixir 257/310 code
Python [534/562]
Ruby (759/701)
Rust solution (178/172)
Typescript 1476/1274
Github
GitHub Link
Full code here: https://github.com/kolonialno/adventofcode/commit/13c09d85a322a4ca3f8901fa58119f46cbf45a2c
GitHub Link
Module with parse and compare, part 1, part 2.
Python3 5506/4866 code
Livebook on Github
Elixir, 2919/2773, code, thoughts
Pretty proud of my Rust solution today. [GitHub link](https://github.com/rossmacarthur/advent/blob/trunk/2022/13.rs)
Rust
Simple Python solution - https://github.com/hrushikeshrv/aoc/blob/main/2022/day13.py
Rust. Obs crashed and I didn't notice it until the end so here are partial recordings: twitch, youtube.
Finally took out megaparsec for my Haskell solution today. Using Haskell in general feel like cheating today :p
Python: https://github.com/kezif/adventofcode_2022/blob/master/day13.py
Shared code lib
Haskell, 8 ms.
Kotlin using Json deserialisation.
My Kotlin solution part 1 & 2 I used recursion for parsing and comparison:
My Scala solution.
my haskell solution
30 lines of code, lightly golfed, but mostly pretty readable.
Python 3: https://github.com/Nuhser/Advent-of-Code/blob/master/2022/day13.py
Part2
Rust: https://github.com/szaffarano/advent-of-code-2022/tree/master/rust/src/day-12
TypeScript - Took some time to make TypeScript happy about all the types.
Consider this my Penance as extra challenge on day 13
php in 2ms. Happy accident was that I wrote the right compare function for part1, so part2 was trivial.
My tree implem:
New version @GitHub.
I am using FuncSharp, but that's just to be able to employ functional constructs.
Scala
Code
rust
Python
Javascript
Haskell. Implementing nested lists is fun! The parser was surprisingly straightforward (except for an issue where it was expecting an extra newline at the end of my input), and the bulk of the problem was handled by implementing Ord instances for my data types.
Late start today as well. I really thought today would be the day that I'd have to abandon my goal of no heap allocations. But, luckily I had an arena allocator available that I could fairly easily adapt to store data on the stack. And with some tweaks we have today's solution:
Late start today as well. I really thought today would be the day that I'd have to abandon my goal of no heap allocations. But, luckily I had an arena allocator available that I could fairly easily adapt to store data on the stack. And with some tweaks we have today's solution:
I started the SimpleParser class in february when I was doing older advent of code puzzles.
Go
I used yhirose's PEG (parsing expression grammar) libraryfor parsing.
Python readable easy-to-understand easy-to-implement parser (Recursive Descent) While one could argue this style of parser is overkill here, I always found it a strategy for an easy, "don't have to think too hard" parser and scales well for complex recursive grammars
Python 3
Rust
Scala using µJson. Really happy with how concise this is. I was able to parse everything into a Packet class that extends Ordered, which gives us the compare function. So once that was implemented recursively according to the rules we were given, I was able to jsut call .sorted for part 2.
Part 1
Rust - code
Haskell
Yeah, I was playing around with structured pattern matching myself and drastically shortened my code. I do like some of the choices u/4HbQ made though, I may continue refactoring this!
Yes, for some reason, I remembered Learn Rust With Entirely Too Many Linked Lists and decided I don’t want to implemented nested structures :D
Dlang solution, using JSON parsing from the standard library. At first I misunderstood the problem and kept getting failures in the second pair. I thought [2,3,4] vs [4] meant that the right list will run out of items after having successfully compared 2 and 4, but then I learned that this would only happen if 2 and 4 were equal (thanks to this thread). This made me realize that a binary comparison wasn't enough and pushed me to write the convoluted ternary comparison function below :
Here's the external-sort version, and the smart version thanks to /u/large-atom. I still prefer the floppy version :)
C# solution using .NET Interactive and Jupyter Notebook. A bit of a tricky one today. Like many, used JSON parsing using the new System.Text.Json library. Then used a custom Comparer for the OrderBy LINQ method for Part 2.
Python: GitHub
C# Source
Solution available here.
Rust
PowerShell
TypeScript (Deno)
Complete program runs in 463 µs on Apple M1, 2.61 ms on Pi 4. See comments at the top of the source file for how I measured. My comparison function:
Full solution: https://github.com/SuddenGunter/adventofcode/pull/56/files
Started really late today but here it is: Part 1 + 2 [JavaScript, JS]
Kotlin
Rust
Pretty proud of this one, concise and readable. Granted, I couldn't resist using serde_json to bypass all the parsing code.
Github
Any suggestions would be welcome. My day13.py code here
Header + Source
The code at github!
My C++ solution, slightly spiffed up.
Yet another Rust solution.
Nice! I ended up doing basically the same thing yesterday! SWI Prolog
My original solution was not as elegant, and definitely less fun :).
I'm using a different language for each of the days. Check it out!
My code is here https://github.com/djotaku/adventofcode/blob/66d74babd2ed37f56858096bc5598149448b6839/2022/Day_13/Python/solution.py
Kotlin also
Really enjoyed parsing this one
Python 3 https://github.com/charlescochran/aoc-2022/blob/master/day_13.py I originally wrote a comparator function which pretty much worked exactly how the part 1 problem is specified, but then I realized that with sufficient hacking, you can coerce the packets to sort correctly using Python's built-in alphabetical sorting. This involves 1. wrapping all the integers in a bunch of lists such that they are all nested the exact same amount and 2. doing some string substitutions to handle certain edge cases. My program solves part 2 in about 30 ms (CPU time). I'm curious how that timing compares to anyone who just did a normal sort with the custom comparator function developed in Part 1 (using Python)?
Posting my solution for the first time here because I'm kinda proud of it :^)
Hi u/Yuras20 I tested the program with the example and my input. However, I just picked a random solution here and tested with their data. Both our programs gave the same solution.