2022-12-04 00:52:52 +01:00
# [Day 3](https://adventofcode.com/2022/day/3)
:gift::gift::gift:
2022-12-04 01:07:50 +01:00
2022-12-04 00:52:52 +01:00
Today's language: **C**
2022-12-04 01:07:50 +01:00
2023-12-09 13:46:15 +01:00
Lines of code: **78**
Execution time: **0,001 s**
2022-12-05 14:24:14 +01:00
Extra: Task 1 in **vimscript** , generated by OpenAI with just a few fixes by myself
2023-12-09 13:46:15 +01:00
<!-- including ChatGPT extra -->
2022-12-04 01:07:50 +01:00
All the characters (the Elf's items) occuring in (half) a line (backpack) are stored as bits in an unsigned long, duplicate characters can then be determined by bitwise and-ing these numbers.
2022-12-04 00:52:52 +01:00
```shell
# Find the item type that appears in both compartments of each rucksack. What is the sum of the priorities of those item types?
gcc main.c -o day3
./day3
2022-12-05 14:24:14 +01:00
# OpenAI vim script
vim rucksack_items.txt
# in vim:
# :source day3-1.vim
2022-12-04 00:52:52 +01:00
```