logo

adventofcode

Code used to solve https://adventofcode.com/, one branch per year git clone https://hacktivis.me/git/adventofcode.git

day1.0 (349B)


  1. #!/bin/sh
  2. # SPDX-FileCopyrightText: 2022 Haelwenn (lanodan) Monnier <contact+adventofcode@hacktivis.me>
  3. # SPDX-License-Identifier: BSD-3-Clause
  4. # Find the Elf carrying the most Calories. How many total Calories is that Elf carrying?
  5. awk 'BEGIN { sum = 0 } { if(/^$/){ print sum; sum = 0 } else { sum += $1 } } END { print sum }' | sort -n | tail -1