-
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.
-
advent_of_code_2022
Discontinued My solutions to Advent of Code 2022 https://adventofcode.com/2022 [Moved to: https://github.com/PetchyAL/AoC2022] (by PetchyAL)
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
-
AdventOfCode
Hacky solutions for [Advent of Code](https://adventofcode.com), working on past problems (by AllanTaylor314)
-
adventofcode
Advent of Code solutions of 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 and 2023 in Scala (by sim642)
-
AoC2022
A collection for my Advent of Code (https://adventofcode.com/) solutions using the Nim programming languages (https://nim-lang.org/) (by genius487)
-
advent-of-code-2022
This is my Laravel project for Advent of Code 2022. I play around with Laravel and PHP. Some answers, variables, functions, methods, etc. may be dum or rushed. (by MarkoKaartinen)
-
AoC2022
Discontinued My solutions to Advent of Code 2022 [Moved to: https://github.com/d12bb/AdventOfCode] (by d12bb)
-
AoC2020
Advent Of Code, yearly puzzle extravaganza in the days leading up to Christmas. (by GoldenQubicle)
-
Advent-of-Code
My repository for holding my solutions to the Advent of Code challenges. More info: https://adventofcode.com/ (by MichaelRol)
-
advent-of-code-2022
Solutions to Advent of Code 2022 puzzles https://adventofcode.com/2022 (by Lysander6)
-
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)
-
adventofcode2022
My solutions for Advent of Code 2022, written with TypeScript + Node (by Jacob-Lockwood)
-
Advent-of-Code
This repo contains my solutions to the advent of code event. Learn more about advent of code at https://adventofcode.com (by AhmarTheRed)
-
Advent-Of-Code-2022
My solutions for Advent Of Code 2022. Every day is written in another language, chosen randomly. (by Jomy10)
-
AdventOfCode-Day5-SupplyStacks
C# .NET Core console application that solves the AdventOfCode Day 5 puzzle - Supply stacks
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
I'm learning F# this year and also used a recursive approach... and fold in some areas.
I'm not saying mine is good, but fmt.Sscanf and slices.Clone would help make your code shorter. https://github.com/alsm/aoc2022/blob/master/day5/day5.go
Still somewhat happy with the solution. Source
It was absolutely all about the parsing here, i'm pretty happy with my parser overall. I thought today was a really fun one
F# - Single fold and single iteration so far for all the days so far. Active pattern to parse and act.
Python, 193/185
Python 3 116/125
Python 2472/2297
C# 1173/1051
395 / 386
Today's language of choice is Haxe, solution can be found here
Dyalog APL (78/45) ⎕IO←1 ⋄ p q←{⍵⊆⍨×≢¨⍵}⊃⎕NGET'p5.txt'1 p←~∘' '¨↓(0 1 0 0⍴⍨≢⊃p)⌿⍉↑1↓⊖p ⋄ q←⍎¨¨'\d+'⎕S'&'¨q f←{(⍺↓¨⍵),¨⍺⍺¨⌽⍺↑¨⍵} ⋄ g←{(-⊃⍺)0⍺⍺f@(1↓⍺)⊢⍵} ⊃∘⌽¨⊃⌽g/(⌽q),⊂p ⍝ part 1 ⊃∘⌽¨⊃⊢g/(⌽q),⊂p ⍝ part 2
Python 3, nothing fancy, but I thought it looked nice, repo at: https://github.com/Misterguruman/Advent-of-code-2022/blob/master/day5/day5.py
Noulith 5/5
Repo Link
Ruby 2535/2975: Code
Python (repo). I was particularly pleased with how quick the parsing was.
Solution
Haskell. Had my solution coded up way before I even began to figure out parsing the crates. This might've been easier to just brute force over the raw string/text, but I like what I came up with!
Elixir - as with everyone else who didn't manually break it out, the bulk of the effort was spent parsing the file
part1.py
Solution
Header file (defining types): https://github.com/willkill07/AdventOfCode2022/blob/main/days/Day05.hpp Source file: https://github.com/willkill07/AdventOfCode2022/blob/main/days/Day05.cpp
It's got a larger symbol set, but it's still relatively code-like. If you want some obtuseness, try out Hexagony where you code in a hexagonal grid, using a hexagonal memory, or Malbolge, who's entire goal is to be as hard to code in as possible.
Python ~40ms
My Scala solution.
Spent way too much time trying to parse input. Javascript solution
C++
Rust
Nice use of fold there, I used recursion myself instead.
Nim
Tries to write an elegant solution in Python https://github.com/infinity1729/Advent-of-Code-2022-solutions/blob/main/D5Q1.py
Erlang
Vanilla JavaScript / ES6
Rust - 101 LOC (excluding unit tests).
TypeScript: https://github.com/AdrienPoupa/advent-of-code/blob/main/2022/05/solution.ts
C#
Full Code: [Github](https://github.com/sotsoguk/adventOfCode2022/blob/main/python/day05/day05.py
Part one
full solution
Clojure (GitHub)
Part 1 was where I went through the pain of parsing the input - this involved multiple passes over the stack diagram and was generally quite painful. This was also the first time I had to use the stack to store temporary values - figuring out which registers could be used was complex enough that I'd prefer to have the compiler do it for me. The actual simulation of the moving boxes could be implemented directly, but required dynamic allocation, which I also did for the first time. Note that I can't free an allocation, but we shouldn't have large enough allocations to the point where memory leaks become an issue. And then I spent a while debugging. I found out that:
Prolog
Python 3 https://github.com/hannahjayne/aoc/blob/main/2022/05/05_solution.py
my code
Python, using regular expressions for parsing and double-eneded queues to model crate stacks.
Python: https://github.com/BastiaanRudolf/adventofcode22/blob/main/day5/solution.py
My Day 05 in Elixir
My Day 5 code on GitHub
I'm doing different language each day, all solutions here.
c#, repo here. One of the rare occasions where I decided to manipulate the input by hand, essentially rotating the crates so the stacks just become strings. So the example input becomes;
Julia using DataStructures Stack
Elixir, thoughts, full code. Today's elixir:
Elixir Code
Day 05 Solution
My Day 5 solution in Haskell
Solution for day 5
Go/Golang
Part 1 Part 2
JavaScript
ngn/k, my answers repo.
Rust: https://github.com/vstepanyuk/advent2022/blob/main/src/day05.rs
Haskell, runs in 10 ms.
I'm getting closer and closer to using MegaParsec for those silly input data format parsing. That being said, I ended up liking my today's solution:
Code: Github
C, this was the first day that parsing the input took significantly longer than solving the problem. I'm happy with the approach I ended up taking, though. [Github]
Part 2
I've hardcoded the locations of the crates in the input string, which makes the code quite readable, IMO: https://github.com/domm/advent_of_code/blob/main/2022/05_1.pl
Rust (repo). Fairly simple, I'm really enjoying the input parsing bit of the challenges.
F# github
My solution in Clojure
Typescript solution: https://github.com/j-tegen/advent-of-code-2022/blob/main/src/day5/index.ts
Rust
C# efficiency > reuse Source
Full solution including the tests available on GitHub
It's not very pretty or elegant, but my code is on Github
Scala. Parsing wasn't as hard as I thought it would be using transpose and then just filtering non-alphanumeric characters. I initially parsed to a Map[Int, mutable.Stack[Char]] but then that bit me in part 2 when I would have to "reset" it (dang mutability!). So instead I parse to Map[Int, String] and just build the mutable stacks twice.
code
Likewise. https://github.com/UnicycleBloke/aoc2022/blob/main/day05/day05.cpp.
See the code here. Later today I'll document how the code works.
Solution here (in python): https://github.com/wutata/AdventOfCode2022/blob/main/day05/day5-1.py
Python 3: github
Not sure about this solution in RUST for today with linked lists...
Here is my solution
java: github
Rust (making use of easily parsing text to structs using FromStr trait): code
Haskell
Github
Kotlin solution
Kotlin: Pretty happy about my refactoring :)
... In any case, ended up with way more lines than should be pasted here (or necessary): goto github
Solution: github
Rust and Python
Kotlin. Finally used a few tricks from the Kotlin blog. Using java.util.Stack to simulate stacks was funny in part 1 and required intermediate reversing stack in part 2.
COBOL - source
Day 5 solution in Rust🦀: github (raw).
You can check my solutions from last year https://github.com/WilliamLP/AdventOfCode/tree/master/2021 I made it up to day 14 / 17 and used that WITH RECURSIVE / UNNEST / ARRAY_AGG pattern a lot.
Solutions posted on my github.
Part 1, Part 2
Zig Part 1: https://github.com/clalos/AoC-2022/blob/main/day5a/main.zig Part 2: https://github.com/clalos/AoC-2022/blob/main/day5b/main.zig
It does exist, for RangeReplaceableCollection.
Works grood.
JavaScript https://github.com/FriendlyUser1/adventofcode/blob/main/2022/day5/stacks.js
My attempt with Python. Parsing using re, modeling stacks using defaultdict + deque...pretty fun all told (says the guy using batteries included, high level language :).
Rust
SIMD + C
Scala 3 Late for the party, but decided to add my map-based solution https://github.com/lupari/aoc2022/blob/main/src/main/scala/assignments/Day05.scala
My Kotlin solution have similarities with many other solutions.
Very ugly, very hardcoded, very dirty, and a really quick C# solution. Will clean up it in the next couple of days.
My actual solution is here: https://github.com/seanhandley/adventofcode2022/tree/main/ruby/day_5
HashMap for parsing stacks and Vec> for operations. Full code here.
Not a fan of my solution for today, would love to simplify it in some way... GitHub
My Rust solution. I went for readability.
Ruby solutions for day 5, part 1 and part 2.
Rust solution: https://github.com/scratchmex/advent_of_code_2022/blob/main/day05/src/main.rs. I attach only the parsing code
Python (Part 1 and 2): Github
Flexible parsing with two regexes: https://github.com/jeffreygroneberg/AoC22/blob/main/src/main/java/day05/SupplyStacksCrane.java
Go solution abusing of slices
Full Code
githbub
Today’s solution in C#, including generic parser.
Python 3- Parts 1 & 2: GitHub. No imports, 11 lines, 434 characters.
Practicing my Rust skills with AoC Day 5 Link to Github
I'm new to java, so any feedback would be great for me <3
Source
GitHub
I was pretty proud of my TypeScript solution today. My parser accepts any number of columns and rows, and the solution for part 2 was as easy as removing a .reverse():
TypeScript Solution
My solution for part 1&2 (on github) in readable bash script logging each step to stdout.
Mine is a bit longer https://github.com/finalcut/advent_of_code_2022/blob/main/day5/src/main.rs
Learning Haskell now. Any pointers on my solution? https://github.com/drewhayward/advent-of-code-2022/blob/master/day05/stack.hs
Another python solution, I somehow found an easy way to parse the input right away! github
Python
GitHub
Kotlin solution, fun with some extension functions.
Swift (Github)
#!/usr/bin/env swift sh import Algorithms // https://github.com/apple/swift-algorithms typealias Label = Character typealias Instruction = (amount: Int, source: Int, destination: Int) struct StandardInput: Sequence, IteratorProtocol { func next() -> String? { return readLine(strippingNewline: false) } } let sections = StandardInput() .compactMap { $0 } .split(separator: "\n") .map { Array($0) } let stacks = parseStacks(from: sections[0]) let instructions = parseInstructions(from: sections[1]) print(apply(instructions, to: stacks, oneAtATime: true)) print(apply(instructions, to: stacks, oneAtATime: false)) // MARK: - Private private func parseStacks(from section: [String]) -> [[Label]] { let crates = section.map { let start = $0.index($0.startIndex, offsetBy: 1) return Array($0.suffix(from: start).striding(by: 4)) } let stackCount = crates[0].count var stacks: [[Label]] = Array(repeating: [Label](), count: stackCount) crates.reversed().forEach { for (index, label) in $0.enumerated() { stacks[index].append(label) } } return stacks.map { $0.filter { $0.isLetter } } } private func parseInstructions(from section: [String]) -> [Instruction] { return section.map { let tokens = $0.dropLast().split(separator: " ") return (Int(tokens[1])!, Int(tokens[3])! - 1, Int(tokens[5])! - 1) } } private func apply( _ instructions: [Instruction], to stacks: [[Label]], oneAtATime: Bool ) -> String { var stacks = stacks instructions.forEach { let cargo = Array(stacks[$0.source].suffix($0.amount)) stacks[$0.source] = stacks[$0.source].dropLast($0.amount) stacks[$0.destination].append( contentsOf: oneAtATime ? cargo.reversed() : cargo ) } return String(stacks.map { $0.last! }) }
Ruby
At first I did a solution using lists instead of vectors for both parts, but it was very clear after I finished it that vectors were the best data structure for the job, as it implements the stack abstraction (peek, pop, conj) but also provides subvec, which makes the crate-mover-9001 implementation much cleaner in my opinion.
Here's the repo.
Typescript
Javascript: https://github.com/Brela/advent-of-code/blob/main/JS/dailyAdventChallenges/day5.js
Here's mine, both parts in Rust
Day 5 Rust 2022_05
[Github](https://github.com/daysleeperx/Advent-Of-Code-2022/blob/main/day05/SupplyStacks.idr)
Back again with an overengineered, DI and testable C# solution, GitHub.
I got a late start on my Common Lisp solution for Day 5. Fortunately, part 2 fell out of my part 1 solution.
Zig
C# solution using Stacks, nothing fancy :) https://github.com/hariharansubramanian/AdventOfCode-Day5-SupplyStacks/blob/master/Program.cs
That makes sense. I've been working on the assumption that my code isn't leaving my GitHub. So, #HARDCODE ALL THE WAY BABY!!!
Inspired by other solutions I made mine a little bit cleaner (github)
Chapel: a serial version and sketch of a parallel one
Part 1
part 1 and 2
Part 1: Most of the code is parsing the data. Had a bit a fun using "functions" (aka GOSUB/RETURN) instead of GOTOs, making the thing a little bit less hard to read.
Kotlin, Bash + Git (yes, here is screencast)
Code: https://github.com/TenViki/advent-of-code/tree/main/2022/src/05 Visualization: https://vikithedev.eu/aoc/2022/05/
Code: https://github.com/robing29/adventofcode2022/tree/main/aoc2022/aoc2022-day5
Source