aboutsummaryrefslogtreecommitdiff
path: root/src/2022/day25/aoc.h
blob: 06f1f06ae95ac029598c9815d6e7b430586b383b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "common.h"
#include "stdint.h"
#include <vector>

namespace aoc2022 {

struct snafu {
  char* digits = nullptr;
  size_t length = 0;

  void print() const noexcept {
    for (size_t i = 0; i < length; i++) {
      printf("%c", *(digits + i));
    }
  }

  snafu(line_view lv) {
    length = lv.length - 1;
    digits = (char*)malloc(length);
    memcpy(digits, lv.line, length);
  }
};

std::pair<std::string, int64_t> day25(line_view);
} // namespace aoc2022