Grilled Cheese

ExploreLog inSign up
Terms of UsePrivacy PolicyCommunity StandardsHelpGet the app

Grilled Cheese is a product of Village Compute

Version devBuilt at: 2026-12-03 22:42:33 EST

PhotosVideosAllPeople
LatestRanked
Load more
@ericswpark.comDec 4, 2026, 6:17 AM

I just completed "Perilous Pier" - Day 4 - Advent of Code 2026 #AdventOfCode adventofcode.com/2026/day/4

adventofcode.comDay 4 - Advent of Code 2026
@cybermaxs.bsky.socialDec 4, 2026, 6:15 AM

I just completed "Perilous Pier" - Day 4 - Advent of Code 2026 #AdventOfCode adventofcode.com/2026/day/4

using SQL HAVING fun with GROUP BY

sqldojo.dev/q/shop/1nZFb...

adventofcode.comDay 4 - Advent of Code 2026
@blfuentes.bsky.socialDec 4, 2026, 6:14 AM

I just completed "Perilous Pier" - Day 4 - Advent of Code 2026 #AdventOfCode adventofcode.com/2026/day/4 #FSharp

adventofcode.comDay 4 - Advent of Code 2026
?Unknown authorDec 4, 2026, 6:14 AM

I just completed "Perilous Pier" - Day 4 - Advent of Code 2026 #AdventOfCode adventofcode.com/2026/day/4

adventofcode.comDay 4 - Advent of Code 2026
@taskbard.bsky.socialDec 4, 2026, 6:12 AM

Daily programming puzzles at Advent of Code #AdventOfCode adventofcode.com

More recs:
codeforces.com
usaco.guide
cses.fi
atcoder.jp

adventofcode.comAdvent of Code 2026
@wayoshi.bsky.socialDec 4, 2026, 6:12 AM

I've completed "Perilous Pier" - Day 4 - Advent of Code 2026 #AdventOfCode adventofcode.com/2026/day/4

Find the trick for part 2 and... kaboom!

topaz.github.iopaste
@butakun.bsky.socialDec 4, 2026, 6:08 AM

I've completed "Perilous Pier" - Day 4 - Advent of Code 2026 #AdventOfCode adventofcode.com/2026/day/4

AoC2026 is about to ramp up, huh?

github.com/butakun/AoC2...

github.comAoC2026/04 at main · butakun/AoC2026Advent of Code 2026. Contribute to butakun/AoC2026 development by creating an account on GitHub.
@jtcf.devDec 4, 2026, 6:06 AM

I just completed "Perilous Pier" - Day 4 - Advent of Code 2026 #AdventOfCode adventofcode.com/2026/day/4

I started a bit late, woke up with a headache, and the whole time I was writing the implementation "surely there will be an edge case where that won't work". But there wasn't.

adventofcode.comDay 4 - Advent of Code 2026
@samuelred.bsky.socialDec 4, 2026, 5:53 AM

I've completed "Perilous Pier" - Day 4 - Advent of Code 2026 #AdventOfCode adventofcode.com/2026/day/4

adventofcode.comDay 4 - Advent of Code 2026
@ggrks.moeDec 4, 2026, 5:45 AM

I completed it but I'll have to spend some time optimizing part 2 haha.

I just completed "Perilous Pier" - Day 4 - Advent of Code 2026 #AdventOfCode adventofcode.com/2026/day/4

Photo, no descriptionPhoto, no description
@boogers.ioDec 4, 2026, 5:42 AM

Yesterday's part two was pretty tricky, but for this one part 2 seemed trivial. I might have just lucked into the best solution for part 2 when doing part 1 though.

I just completed "Perilous Pier" - Day 4 - Advent of Code 2026 #AdventOfCode adventofcode.com/2026/day/4

adventofcode.comDay 4 - Advent of Code 2026
@kurtschwind.bsky.socialDec 4, 2026, 5:38 AM

I just completed "Perilous Pier" - Day 4 - Advent of Code 2026 #AdventOfCode adventofcode.com/2026/day/4

adventofcode.comDay 4 - Advent of Code 2026
M@manabutorii.bsky.socialDec 4, 2026, 5:35 AM

I just completed "Perilous Pier" - Day 4 - Advent of Code 2026 #AdventOfCode adventofcode.com/2026/day/4

adventofcode.comDay 4 - Advent of Code 2026
@nojufe.deDec 4, 2026, 5:35 AM

I've completed "Perilous Pier" - Day 4 - Advent of Code 2026 #AdventOfCode adventofcode.com/2026/day/4
this one was fun

adventofcode.comDay 4 - Advent of Code 2026
@tomaztsql.bsky.socialDec 4, 2026, 5:34 AM

I've completed "Foggy Forest" - Day 3 - Advent of Code 2026 #AdventOfCode adventofcode.com/2026/day/3

adventofcode.comDay 3 - Advent of Code 2026
@thoughtfulnz.bsky.socialDec 4, 2026, 5:34 AM

Day 4 of #AdventOfCode in #rstats. I enjoyed this one, but (a) I did a bunch of text sequence matching work in the 1990s and (b) I wrote a function mapped function solution for part 1, so part 2 was accidentally solved for free. Code in alt text of photo.

library(tidyverse)

# A period k is feasible if and only if every modulo-k residue class
# contains at most one distinct known colour (ignoring '?').
min_period <- function(barcode) {
  chars <- strsplit(barcode, "")[[1]]
  n <- length(chars)
  # Try candidate instruction lengths from shortest to longest.
  # The first valid must be the minimum.
  for (k in seq_len(n)) {
    # Assume k works until we discover a contradiction.
    valid <- TRUE
    
    # For a repeating instruction sequence of length k, positions
    # sharing the same remainder modulo k are produced by the same
    # instruction and therefore must contain the same colour.
    for (r in seq_len(k)) {
      # Extract all barcode positions belonging to this modulo class.
      idx <- seq(r, n, by = k)
      # Unknown colours ('?') place no restrictions on the solution,
      # so only retain colours that are actually known.
      vals <- chars[idx]
      vals <- vals[vals != "?"]
      # If a modulo class contains two different known colours,
      # this value of k cannot work because one instruction position
      # would need to print multiple colours.
      if (length(unique(vals)) > 1) {
        valid <- FALSE
        break
      }
    }
    # Since periods are tested from smallest to largest, the first
    # valid period encountered is the minimum instruction count.
    if (valid) {
      return(k)
    }
  }
  # Defensive fallback. In practice k = n must always be valid.
  n
}
#part 1
barcodes <- readLines("input.txt")
answer <-
  tibble(barcode = barcodes) |>
  mutate(min_instructions = map_int(barcode, min_period)) |>
  summarise(total = sum(min_instructions)) 
answer$total
# part 2 collapse the input
barall <- paste(barcodes, collapse = "")
min_period(barall)
@paul-warner.bsky.socialDec 4, 2026, 5:33 AM

I just completed "Foggy Forest" - Day 3 - Advent of Code 2026 #AdventOfCode adventofcode.com/2026/day/3

Took a few false starts today, remember next time to get the algorithm right on paper first!

adventofcode.comDay 3 - Advent of Code 2026
@azi1mov.lxze.meDec 4, 2026, 5:33 AM

Accidentally solved part 2 🧐 | I just completed "Perilous Pier" - Day 4 - Advent of Code 2026 #AdventOfCode adventofcode.com/2026/day/4

adventofcode.comDay 4 - Advent of Code 2026
@theescapeguy.bsky.socialDec 4, 2026, 5:31 AM

I just completed "Perilous Pier" - Day 4 - Advent of Code 2026

Lol, I didn't need to adjust anything for part 2 except to reformat the input. Another fun one.

#AdventOfCode adventofcode.com/2026/day/4

A screenshot of my times for Day 1-4 of Advent of Code 2026.

Day 4
00:27:03 / 00:29:12

Day 3
00:05:51 / 00:30:13

Day 2
00:07:22 / 00:16:51


Day 1
23:15:13 / 23:16:56