mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-25 21:00:31 +01:00
Compare commits
87 Commits
4e3c9c75c5
...
2021-day23
| Author | SHA1 | Date | |
|---|---|---|---|
| 81f244bde9 | |||
| 09b590e927 | |||
| 9dacb4c1ae | |||
| 07e03c1630 | |||
| 3accf9845d | |||
| fd26f58e25 | |||
| b2f9898714 | |||
| d757c389f0 | |||
| fd561a3e9d | |||
| 2fcdc6b8d2 | |||
| 8a3f0f843c | |||
| 23b5c39838 | |||
| 452f6e5f14 | |||
| 61fb240622 | |||
| aee25057d6 | |||
| a98332894f | |||
| 09e012c082 | |||
| 944d3e644a | |||
| d56f4ae8f8 | |||
| 53ca8d0043 | |||
| 6506af879a | |||
| 101ebee505 | |||
| cc81a7012b | |||
| 9c299f140c | |||
| ba1b7b693e | |||
| 7d331f9131 | |||
| dfd8b2b985 | |||
| 0f6167e90f | |||
| 3e2a3f5206 | |||
| 8cc2245492 | |||
| fb167ef899 | |||
| 4240f8fc8c | |||
| 9a4ac427e0 | |||
| c3929a56d8 | |||
| 9e37026f30 | |||
| a926243f0d | |||
| a35ae82548 | |||
| 8a0b72f111 | |||
| b5866b2d8a | |||
| 554683bc64 | |||
| 1031a8cdbb | |||
| 5c764f6627 | |||
| ffe8d27469 | |||
| d471f170b3 | |||
| 07cbf6cf53 | |||
| 6e3252ce5a | |||
| 0897e2e907 | |||
| 4d1fdd9cc0 | |||
| 84c160cf54 | |||
| 440d454911 | |||
| 50cd6d8171 | |||
| dde9c0adbf | |||
| e0e1bc26e8 | |||
| 77ce31980b | |||
| 8c78106846 | |||
| 22f767e8df | |||
| 3434966ac2 | |||
| c5f66fcc09 | |||
| c02f1e11c5 | |||
| d099614217 | |||
| 766ee91719 | |||
| 2f3eb50a5b | |||
| b369f9d36a | |||
| 1433b0cdbe | |||
| 5e52da6e6b | |||
| e50b812aed | |||
| fdef10a78e | |||
| 392aefb32d | |||
| fb358be8f0 | |||
| 612d3ecb6b | |||
| d08a4e0e4e | |||
| ed844a997c | |||
| c9468ba139 | |||
| 938eda0d22 | |||
| f413b08da6 | |||
| 10531e3422 | |||
| 2e0a7ea81d | |||
| 2c64028978 | |||
| 89159137fe | |||
| 186d91d1b7 | |||
| c985ba8a1a | |||
| cece8439a7 | |||
| 5f98b62f21 | |||
| affaf6e96f | |||
| a6996e5234 | |||
| a64eff96a4 | |||
| 7718fc59c6 |
46
.github/workflows/2021.yml
vendored
Normal file
46
.github/workflows/2021.yml
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
on:
|
||||
- push
|
||||
|
||||
name: Advent of Code 2021
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
strategy:
|
||||
matrix:
|
||||
toolchain:
|
||||
- stable
|
||||
- beta
|
||||
experimental: [false]
|
||||
include:
|
||||
- toolchain: nightly
|
||||
experimental: true
|
||||
|
||||
name: Continuous Integration
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: ${{ matrix.experimental }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Install toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: ${{ matrix.toolchain }}
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
|
||||
- name: Build binaries
|
||||
working-directory: 2021
|
||||
run: >
|
||||
cargo build --all-targets
|
||||
|
||||
- name: Run tests
|
||||
working-directory: 2021
|
||||
run: >
|
||||
cargo test
|
||||
|
||||
- name: Run clippy
|
||||
working-directory: 2021
|
||||
run: >
|
||||
cargo clippy -- --deny warnings
|
||||
8
.gitignore
vendored
8
.gitignore
vendored
@@ -56,3 +56,11 @@ docs/_build/
|
||||
# PyBuilder
|
||||
target/
|
||||
*.swp
|
||||
|
||||
# Rust lock
|
||||
*.lock
|
||||
|
||||
# Performance data
|
||||
perf.data
|
||||
perf.data.old
|
||||
flamegraph.svg
|
||||
|
||||
66
2019/aoc2019/day19.py
Normal file
66
2019/aoc2019/day19.py
Normal file
@@ -0,0 +1,66 @@
|
||||
import copy
|
||||
import itertools
|
||||
from collections import deque
|
||||
from typing import TextIO, Tuple
|
||||
|
||||
from aoc2019.intcode import Computer, read_program
|
||||
|
||||
|
||||
def query_position(x: int, y: int, computer: Computer) -> bool:
|
||||
computer = copy.deepcopy(computer)
|
||||
|
||||
computer.send_input(x)
|
||||
computer.send_input(y)
|
||||
computer.run()
|
||||
|
||||
return computer.get_output() == 1
|
||||
|
||||
|
||||
def find_line(y: int, x_min: int, x_max: int, computer: Computer) -> Tuple[int, int]:
|
||||
# First find start of the line:
|
||||
offset = 0
|
||||
|
||||
while not query_position(x_min, y, computer):
|
||||
offset += 1
|
||||
x_min += 1
|
||||
|
||||
x_max += offset
|
||||
while query_position(x_max, y, computer):
|
||||
x_max += 1
|
||||
|
||||
x_max -= 1
|
||||
|
||||
return x_min, x_max
|
||||
|
||||
|
||||
def part1(data: TextIO) -> int:
|
||||
computer = Computer(read_program(data))
|
||||
|
||||
x_min, x_max = (0, 0)
|
||||
total = 0
|
||||
|
||||
for y in range(50):
|
||||
x_min, x_max = find_line(y, x_min, x_max, computer)
|
||||
total += min(x_max, 49) - min(x_min, 50) + 1
|
||||
|
||||
return total
|
||||
|
||||
|
||||
def part2(data: TextIO) -> int:
|
||||
computer = Computer(read_program(data))
|
||||
|
||||
x_min, x_max = (0, 0)
|
||||
|
||||
lines = deque()
|
||||
|
||||
for y in itertools.count():
|
||||
x_min, x_max = find_line(y, x_min, x_max, computer)
|
||||
lines.append((x_min, x_max))
|
||||
|
||||
if len(lines) == 100:
|
||||
x_top_min, x_top_max = lines.popleft()
|
||||
|
||||
if x_top_max - x_min + 1 < 100:
|
||||
continue
|
||||
|
||||
return x_min * 10000 + y - 99
|
||||
138
2019/aoc2019/day24.py
Normal file
138
2019/aoc2019/day24.py
Normal file
@@ -0,0 +1,138 @@
|
||||
from typing import TextIO, Iterable, Tuple, List
|
||||
|
||||
|
||||
def read_board(data: TextIO) -> Tuple[Tuple[bool]]:
|
||||
return tuple(
|
||||
tuple(c == '#' for c in line.strip())
|
||||
for line in data
|
||||
)
|
||||
|
||||
|
||||
def flatten(it: Iterable[Iterable]) -> Iterable:
|
||||
for item in it:
|
||||
yield from item
|
||||
|
||||
|
||||
def neighbours(board: Tuple[Tuple[bool]], x: int, y: int) -> int:
|
||||
n = 0
|
||||
|
||||
if x > 0 and board[y][x - 1]:
|
||||
n += 1
|
||||
|
||||
if x + 1 < len(board[0]) and board[y][x + 1]:
|
||||
n += 1
|
||||
|
||||
if y > 0 and board[y - 1][x]:
|
||||
n += 1
|
||||
|
||||
if y + 1 < len(board) and board[y + 1][x]:
|
||||
n += 1
|
||||
|
||||
return n
|
||||
|
||||
|
||||
def advance_board(board: Tuple[Tuple[bool]]) -> Tuple[Tuple[bool]]:
|
||||
def create_row(y: int, row: Tuple[bool]):
|
||||
new_row = []
|
||||
for x, live in enumerate(row):
|
||||
if live:
|
||||
new_row.append(neighbours(board, x, y) == 1)
|
||||
else:
|
||||
new_row.append(neighbours(board, x, y) in [1, 2])
|
||||
|
||||
return tuple(new_row)
|
||||
|
||||
return tuple(create_row(y, row) for y, row in enumerate(board))
|
||||
|
||||
|
||||
def neighbours2(board: List[Tuple[Tuple[bool]]], x: int, y: int, z: int) -> int:
|
||||
existing = range(len(board))
|
||||
|
||||
if z in existing:
|
||||
# Normal board count, minus the middle tile if applicable
|
||||
n = neighbours(board[z], x, y) - board[z][2][2]
|
||||
else:
|
||||
n = 0
|
||||
|
||||
if z - 1 in existing:
|
||||
if y == 2:
|
||||
if x == 1:
|
||||
n += sum(board[z - 1][iy][0] for iy in range(5))
|
||||
elif x == 3:
|
||||
n += sum(board[z - 1][iy][4] for iy in range(5))
|
||||
elif x == 2:
|
||||
if y == 1:
|
||||
n += sum(board[z - 1][0])
|
||||
elif y == 3:
|
||||
n += sum(board[z - 1][4])
|
||||
|
||||
if z + 1 in existing:
|
||||
if y == 0:
|
||||
n += board[z + 1][1][2]
|
||||
elif y == 4:
|
||||
n += board[z + 1][3][2]
|
||||
|
||||
if x == 0:
|
||||
n += board[z + 1][2][1]
|
||||
elif x == 4:
|
||||
n += board[z + 1][2][3]
|
||||
|
||||
return n
|
||||
|
||||
|
||||
def advance_board2(board: List[Tuple[Tuple[bool]]]) -> List[Tuple[Tuple[bool]]]:
|
||||
layers = []
|
||||
|
||||
for z in range(-1, len(board) + 1):
|
||||
layer = []
|
||||
|
||||
for y in range(5):
|
||||
row = []
|
||||
|
||||
for x in range(5):
|
||||
if y == 2 and x == 2:
|
||||
row.append(False)
|
||||
continue
|
||||
|
||||
if z in range(len(board)):
|
||||
live = board[z][y][x]
|
||||
else:
|
||||
live = False
|
||||
|
||||
if live:
|
||||
row.append(neighbours2(board, x, y, z) == 1)
|
||||
else:
|
||||
row.append(neighbours2(board, x, y, z) in [1, 2])
|
||||
|
||||
layer.append(tuple(row))
|
||||
|
||||
layers.append(tuple(layer))
|
||||
|
||||
if sum(flatten(layers[0])) == 0:
|
||||
layers = layers[1:]
|
||||
if sum(flatten(layers[-1])) == 0:
|
||||
layers = layers[:-1]
|
||||
|
||||
return layers
|
||||
|
||||
|
||||
def part1(data: TextIO) -> int:
|
||||
board = read_board(data)
|
||||
|
||||
seen = set(board)
|
||||
|
||||
while True:
|
||||
board = advance_board(board)
|
||||
if board in seen:
|
||||
return sum(2 ** i for i, b in enumerate(flatten(board)) if b)
|
||||
|
||||
seen.add(board)
|
||||
|
||||
|
||||
def part2(data: TextIO, rounds: int = 200) -> int:
|
||||
board = [read_board(data)]
|
||||
|
||||
for _ in range(rounds):
|
||||
board = advance_board2(board)
|
||||
|
||||
return sum(flatten(flatten(board)))
|
||||
64
2019/tests/test_day24.py
Normal file
64
2019/tests/test_day24.py
Normal file
@@ -0,0 +1,64 @@
|
||||
import io
|
||||
|
||||
import pytest
|
||||
|
||||
from aoc2019.day24 import read_board, advance_board, part1
|
||||
|
||||
SAMPLE_START = """\
|
||||
....#
|
||||
#..#.
|
||||
#..##
|
||||
..#..
|
||||
#....
|
||||
"""
|
||||
|
||||
SAMPLE_STATES = """\
|
||||
....#
|
||||
#..#.
|
||||
#..##
|
||||
..#..
|
||||
#....
|
||||
|
||||
#..#.
|
||||
####.
|
||||
###.#
|
||||
##.##
|
||||
.##..
|
||||
|
||||
#####
|
||||
....#
|
||||
....#
|
||||
...#.
|
||||
#.###
|
||||
|
||||
#....
|
||||
####.
|
||||
...##
|
||||
#.##.
|
||||
.##.#
|
||||
|
||||
####.
|
||||
....#
|
||||
##..#
|
||||
.....
|
||||
##...
|
||||
""".split("\n\n")
|
||||
|
||||
|
||||
@pytest.mark.parametrize("cycles,state", enumerate(SAMPLE_STATES))
|
||||
def test_evolution_part1(cycles: int, state: str) -> None:
|
||||
with io.StringIO(SAMPLE_START) as f:
|
||||
board = read_board(f)
|
||||
|
||||
with io.StringIO(state) as f:
|
||||
final_state = read_board(f)
|
||||
|
||||
for _ in range(cycles):
|
||||
board = advance_board(board)
|
||||
|
||||
assert board == final_state
|
||||
|
||||
|
||||
def test_sample_part1() -> None:
|
||||
with io.StringIO(SAMPLE_START) as f:
|
||||
assert part1(f) == 2129920
|
||||
25
2021/Cargo.toml
Normal file
25
2021/Cargo.toml
Normal file
@@ -0,0 +1,25 @@
|
||||
[package]
|
||||
name = "aoc-2021"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
|
||||
[dependencies]
|
||||
clap = { version = "3.0.0-rc.0", features = ["derive"] }
|
||||
itertools = "0.10"
|
||||
nom = "7"
|
||||
|
||||
[dev-dependencies]
|
||||
criterion = "0.3"
|
||||
|
||||
[profile.release]
|
||||
# Keep debug information in release for better flamegraphs
|
||||
debug = true
|
||||
|
||||
[profile.bench]
|
||||
# And same for benchmarking
|
||||
debug = true
|
||||
|
||||
[[bench]]
|
||||
name = "days"
|
||||
harness = false
|
||||
22
2021/README.md
Normal file
22
2021/README.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# Advent of Code 2021
|
||||
|
||||
This folder contains the solution runner for Advent of Code 2021. All days will be solved in Rust,
|
||||
with the goal of having a total time across all puzzles of one second or less.
|
||||
|
||||
```
|
||||
aoc-2021
|
||||
|
||||
Advent of Code 2021 runner
|
||||
|
||||
USAGE:
|
||||
aoc-2021 [OPTIONS] <DAY>
|
||||
|
||||
ARGS:
|
||||
<DAY> Which day to run
|
||||
|
||||
OPTIONS:
|
||||
-2, --part2 Run part 2 instead of part 1
|
||||
-h, --help Print help information
|
||||
-i, --input <INPUT> Read input from the given file instead of stdin
|
||||
-t, --time Print time taken
|
||||
```
|
||||
45
2021/benches/days.rs
Normal file
45
2021/benches/days.rs
Normal file
@@ -0,0 +1,45 @@
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
|
||||
use aoc_2021::get_implementation;
|
||||
use criterion::criterion_group;
|
||||
use criterion::criterion_main;
|
||||
use criterion::BenchmarkId;
|
||||
use criterion::Criterion;
|
||||
|
||||
const DAYS_IMPLEMENTED: usize = 25;
|
||||
|
||||
fn read_input(day: usize) -> Vec<u8> {
|
||||
let input_path = format!("inputs/{:02}.txt", day);
|
||||
|
||||
let mut buffer = Vec::new();
|
||||
File::open(input_path)
|
||||
.expect("Failed to open input file")
|
||||
.read_to_end(&mut buffer)
|
||||
.expect("Failed to read input file");
|
||||
|
||||
buffer
|
||||
}
|
||||
|
||||
pub fn benchmark_days(c: &mut Criterion) {
|
||||
for day in 1..=DAYS_IMPLEMENTED {
|
||||
let input = read_input(day);
|
||||
|
||||
let part1 = get_implementation(day, false);
|
||||
|
||||
c.bench_with_input(BenchmarkId::new("part1", day), &input, |b, i| {
|
||||
b.iter(|| part1(&mut &i[..]));
|
||||
});
|
||||
|
||||
if day < 25 {
|
||||
let part2 = get_implementation(day, true);
|
||||
|
||||
c.bench_with_input(BenchmarkId::new("part2", day), &input, |b, i| {
|
||||
b.iter(|| part2(&mut &i[..]));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
criterion_group!(benches, benchmark_days);
|
||||
criterion_main!(benches);
|
||||
2000
2021/inputs/01.txt
Normal file
2000
2021/inputs/01.txt
Normal file
File diff suppressed because it is too large
Load Diff
1000
2021/inputs/02.txt
Normal file
1000
2021/inputs/02.txt
Normal file
File diff suppressed because it is too large
Load Diff
1000
2021/inputs/03.txt
Normal file
1000
2021/inputs/03.txt
Normal file
File diff suppressed because it is too large
Load Diff
601
2021/inputs/04.txt
Normal file
601
2021/inputs/04.txt
Normal file
@@ -0,0 +1,601 @@
|
||||
23,91,18,32,73,14,20,4,10,55,40,29,13,25,48,65,2,80,22,16,93,85,66,21,9,36,47,72,88,58,5,42,53,69,52,8,54,63,76,12,6,99,35,95,82,49,41,17,62,34,51,77,94,7,28,71,92,74,46,79,26,19,97,86,87,37,57,64,1,30,11,96,70,44,83,0,56,90,59,78,61,98,89,43,3,84,67,38,68,27,81,39,15,50,60,24,45,75,33,31
|
||||
|
||||
67 97 50 51 1
|
||||
47 15 77 31 66
|
||||
24 14 55 70 52
|
||||
76 46 19 32 73
|
||||
34 22 54 75 17
|
||||
|
||||
44 11 97 50 71
|
||||
66 7 24 9 67
|
||||
88 39 82 93 57
|
||||
77 5 6 58 51
|
||||
85 61 65 70 23
|
||||
|
||||
72 74 58 71 41
|
||||
4 57 45 89 67
|
||||
78 55 66 28 48
|
||||
82 61 87 85 84
|
||||
96 8 94 76 97
|
||||
|
||||
25 33 45 16 68
|
||||
60 27 22 13 29
|
||||
92 95 93 50 36
|
||||
43 1 66 51 99
|
||||
85 14 20 52 58
|
||||
|
||||
65 47 18 50 90
|
||||
44 25 11 70 81
|
||||
86 36 45 10 85
|
||||
43 89 74 0 14
|
||||
97 59 32 91 5
|
||||
|
||||
64 19 39 69 90
|
||||
41 5 59 37 42
|
||||
75 95 58 89 92
|
||||
20 3 85 48 71
|
||||
31 94 11 18 70
|
||||
|
||||
30 17 56 54 79
|
||||
63 12 51 57 5
|
||||
95 16 98 75 69
|
||||
80 87 71 39 48
|
||||
66 14 99 42 31
|
||||
|
||||
27 35 46 69 50
|
||||
3 16 84 39 42
|
||||
19 22 34 80 72
|
||||
40 54 66 30 10
|
||||
12 67 36 9 74
|
||||
|
||||
39 47 61 3 35
|
||||
15 33 45 79 58
|
||||
96 53 20 80 19
|
||||
75 85 73 6 64
|
||||
43 88 72 69 37
|
||||
|
||||
52 68 12 23 59
|
||||
79 32 37 87 69
|
||||
48 31 4 36 51
|
||||
77 2 92 67 8
|
||||
13 88 93 98 20
|
||||
|
||||
12 54 34 13 27
|
||||
79 85 62 76 71
|
||||
52 84 65 93 66
|
||||
40 89 73 95 74
|
||||
29 70 32 11 41
|
||||
|
||||
54 56 53 55 78
|
||||
21 85 43 75 79
|
||||
62 66 14 84 2
|
||||
32 13 83 38 7
|
||||
15 71 81 63 49
|
||||
|
||||
83 7 51 49 50
|
||||
89 59 9 72 80
|
||||
99 41 65 13 64
|
||||
74 95 75 54 90
|
||||
53 79 58 40 5
|
||||
|
||||
36 16 46 71 87
|
||||
73 13 84 3 38
|
||||
69 88 85 28 68
|
||||
63 94 0 86 1
|
||||
49 44 65 39 15
|
||||
|
||||
55 27 91 44 39
|
||||
6 75 14 22 99
|
||||
38 89 92 42 11
|
||||
20 60 3 70 15
|
||||
5 19 78 88 81
|
||||
|
||||
16 90 29 52 86
|
||||
60 61 96 47 91
|
||||
19 59 10 14 4
|
||||
18 35 50 20 25
|
||||
56 2 99 63 72
|
||||
|
||||
66 54 87 7 98
|
||||
55 45 62 38 99
|
||||
13 23 76 30 3
|
||||
75 68 5 51 46
|
||||
0 60 71 70 41
|
||||
|
||||
22 77 65 72 27
|
||||
88 9 25 44 0
|
||||
61 6 46 41 26
|
||||
74 78 20 86 87
|
||||
70 81 4 5 48
|
||||
|
||||
41 51 8 64 50
|
||||
96 40 45 85 53
|
||||
18 86 24 29 27
|
||||
90 11 39 82 88
|
||||
12 56 54 87 59
|
||||
|
||||
90 79 64 77 78
|
||||
97 12 72 27 86
|
||||
32 56 33 18 46
|
||||
95 5 51 6 80
|
||||
34 38 42 35 52
|
||||
|
||||
66 10 82 90 19
|
||||
38 69 71 77 72
|
||||
61 9 98 86 93
|
||||
56 7 88 28 47
|
||||
22 96 21 52 64
|
||||
|
||||
91 82 25 93 69
|
||||
95 79 84 35 90
|
||||
48 0 28 41 83
|
||||
23 55 88 71 65
|
||||
97 19 67 31 59
|
||||
|
||||
47 60 65 11 85
|
||||
97 36 64 96 70
|
||||
82 84 76 89 44
|
||||
67 26 28 21 41
|
||||
63 54 94 10 34
|
||||
|
||||
24 19 78 4 69
|
||||
52 38 7 58 21
|
||||
20 23 10 91 42
|
||||
44 36 25 45 49
|
||||
94 51 98 99 27
|
||||
|
||||
67 25 54 28 71
|
||||
9 14 89 91 46
|
||||
65 1 55 88 19
|
||||
59 45 26 84 73
|
||||
83 62 50 42 97
|
||||
|
||||
58 51 29 60 94
|
||||
34 79 39 19 91
|
||||
9 81 93 35 70
|
||||
4 23 80 33 75
|
||||
73 69 7 49 59
|
||||
|
||||
44 83 20 24 56
|
||||
41 50 77 55 10
|
||||
79 49 67 99 16
|
||||
36 57 33 15 98
|
||||
40 76 4 53 39
|
||||
|
||||
59 92 67 6 80
|
||||
64 90 15 40 7
|
||||
36 96 62 25 32
|
||||
44 91 52 43 19
|
||||
5 2 51 88 87
|
||||
|
||||
4 97 70 78 59
|
||||
90 43 62 50 41
|
||||
61 64 2 91 49
|
||||
19 82 85 30 73
|
||||
15 51 36 11 34
|
||||
|
||||
97 7 86 64 40
|
||||
15 46 84 0 58
|
||||
54 87 73 93 20
|
||||
48 94 32 4 77
|
||||
13 85 72 50 36
|
||||
|
||||
68 54 94 71 83
|
||||
81 53 33 12 58
|
||||
22 67 52 21 25
|
||||
79 90 59 92 41
|
||||
29 11 76 98 85
|
||||
|
||||
10 25 64 3 83
|
||||
21 87 97 78 7
|
||||
44 71 48 22 74
|
||||
80 72 90 29 63
|
||||
1 24 32 84 13
|
||||
|
||||
25 28 19 65 24
|
||||
98 32 4 6 99
|
||||
7 0 27 37 35
|
||||
72 11 1 76 73
|
||||
49 85 83 93 14
|
||||
|
||||
78 91 50 45 29
|
||||
35 27 18 48 87
|
||||
3 56 60 99 64
|
||||
84 61 15 77 40
|
||||
58 39 19 0 92
|
||||
|
||||
98 38 88 43 39
|
||||
48 93 4 52 66
|
||||
57 99 83 55 25
|
||||
91 35 42 12 23
|
||||
40 15 81 94 77
|
||||
|
||||
85 28 95 76 78
|
||||
39 66 18 47 49
|
||||
32 77 34 12 58
|
||||
69 15 45 6 41
|
||||
3 51 25 40 63
|
||||
|
||||
58 97 10 5 57
|
||||
47 86 24 78 98
|
||||
89 25 39 73 83
|
||||
11 15 99 68 66
|
||||
84 70 61 76 30
|
||||
|
||||
67 40 29 75 90
|
||||
71 31 41 37 52
|
||||
61 0 86 84 94
|
||||
25 96 9 21 6
|
||||
39 62 14 1 81
|
||||
|
||||
15 65 47 63 94
|
||||
82 21 32 38 67
|
||||
12 20 30 91 68
|
||||
16 79 4 28 45
|
||||
1 70 84 49 78
|
||||
|
||||
80 21 39 92 71
|
||||
48 8 87 0 38
|
||||
74 4 52 23 98
|
||||
53 89 61 30 46
|
||||
29 10 64 49 5
|
||||
|
||||
40 2 62 39 51
|
||||
4 24 19 73 75
|
||||
86 14 97 91 11
|
||||
43 7 77 71 28
|
||||
32 63 6 20 8
|
||||
|
||||
90 57 28 47 23
|
||||
10 41 77 52 31
|
||||
45 18 55 80 49
|
||||
76 50 16 96 81
|
||||
91 75 93 68 58
|
||||
|
||||
63 87 12 16 60
|
||||
36 52 94 39 91
|
||||
67 56 24 18 26
|
||||
73 80 46 1 84
|
||||
30 74 6 61 75
|
||||
|
||||
98 32 56 51 44
|
||||
58 78 71 74 26
|
||||
55 45 83 10 30
|
||||
54 47 93 62 23
|
||||
15 67 53 21 49
|
||||
|
||||
59 93 49 65 42
|
||||
9 74 58 52 18
|
||||
1 47 71 25 68
|
||||
45 92 67 60 73
|
||||
97 63 61 34 36
|
||||
|
||||
73 74 6 68 40
|
||||
76 85 1 26 91
|
||||
90 94 39 92 17
|
||||
80 51 20 77 67
|
||||
54 88 21 57 83
|
||||
|
||||
14 52 70 30 32
|
||||
60 69 75 10 24
|
||||
65 40 72 71 58
|
||||
80 73 84 96 4
|
||||
62 9 28 41 36
|
||||
|
||||
56 2 83 9 50
|
||||
75 42 5 3 72
|
||||
73 28 34 76 38
|
||||
49 33 30 80 46
|
||||
37 77 55 45 74
|
||||
|
||||
40 69 31 88 8
|
||||
58 27 78 26 95
|
||||
73 86 1 34 79
|
||||
12 83 2 75 92
|
||||
0 48 63 17 65
|
||||
|
||||
3 87 59 76 24
|
||||
90 10 44 28 21
|
||||
83 19 77 86 51
|
||||
81 88 42 94 15
|
||||
27 78 92 34 30
|
||||
|
||||
44 23 83 22 87
|
||||
75 53 91 93 89
|
||||
88 40 56 46 37
|
||||
0 4 80 24 7
|
||||
97 72 96 12 68
|
||||
|
||||
40 45 61 84 31
|
||||
85 12 27 82 50
|
||||
4 49 33 6 44
|
||||
51 36 15 0 14
|
||||
68 77 64 11 79
|
||||
|
||||
31 79 50 63 59
|
||||
13 4 6 54 7
|
||||
86 30 41 68 34
|
||||
16 35 48 11 70
|
||||
84 8 81 65 74
|
||||
|
||||
75 33 21 60 57
|
||||
7 86 82 18 68
|
||||
40 91 0 28 38
|
||||
90 36 92 94 55
|
||||
95 88 85 62 25
|
||||
|
||||
7 5 75 36 74
|
||||
40 37 58 92 93
|
||||
46 68 24 98 34
|
||||
32 88 67 62 53
|
||||
83 84 90 31 63
|
||||
|
||||
17 24 25 93 37
|
||||
16 36 59 81 41
|
||||
99 51 12 77 98
|
||||
80 32 28 18 39
|
||||
44 85 38 64 73
|
||||
|
||||
83 18 86 33 61
|
||||
21 88 94 62 67
|
||||
40 25 97 27 73
|
||||
71 90 63 87 6
|
||||
16 7 36 92 69
|
||||
|
||||
69 67 35 24 84
|
||||
79 44 66 37 75
|
||||
0 73 53 80 15
|
||||
74 20 32 12 60
|
||||
36 22 29 85 82
|
||||
|
||||
49 72 69 33 10
|
||||
45 81 43 0 22
|
||||
12 76 5 29 52
|
||||
82 40 42 63 85
|
||||
1 34 32 66 15
|
||||
|
||||
82 41 16 67 23
|
||||
30 84 25 88 48
|
||||
75 71 43 0 2
|
||||
35 3 68 26 50
|
||||
64 24 8 89 98
|
||||
|
||||
61 23 63 51 46
|
||||
21 59 99 97 91
|
||||
60 34 42 26 31
|
||||
12 64 38 96 24
|
||||
5 13 90 37 94
|
||||
|
||||
97 0 20 61 96
|
||||
92 39 43 57 64
|
||||
87 52 16 85 45
|
||||
60 41 86 6 53
|
||||
75 10 24 21 37
|
||||
|
||||
37 92 1 46 51
|
||||
33 5 88 47 19
|
||||
0 35 2 69 72
|
||||
67 56 49 20 63
|
||||
25 7 41 65 91
|
||||
|
||||
17 69 67 77 23
|
||||
16 79 81 51 57
|
||||
12 59 49 76 91
|
||||
1 55 41 87 38
|
||||
85 98 37 71 5
|
||||
|
||||
90 11 18 59 31
|
||||
61 1 28 2 27
|
||||
98 56 95 63 93
|
||||
24 83 36 85 72
|
||||
64 97 69 20 10
|
||||
|
||||
80 58 95 5 74
|
||||
6 20 13 59 63
|
||||
8 62 55 53 41
|
||||
48 70 28 10 47
|
||||
18 4 76 45 34
|
||||
|
||||
39 30 64 24 14
|
||||
42 6 0 33 57
|
||||
35 7 68 62 32
|
||||
70 65 44 82 31
|
||||
98 93 50 53 61
|
||||
|
||||
14 9 98 70 45
|
||||
27 86 6 21 76
|
||||
56 19 26 28 43
|
||||
78 87 58 89 97
|
||||
72 49 54 67 8
|
||||
|
||||
21 22 51 62 59
|
||||
38 64 30 40 94
|
||||
56 57 28 19 17
|
||||
50 32 83 97 48
|
||||
41 54 75 66 5
|
||||
|
||||
4 21 16 91 75
|
||||
17 87 68 38 66
|
||||
92 11 39 31 45
|
||||
58 41 96 85 98
|
||||
99 44 86 15 26
|
||||
|
||||
76 61 82 96 49
|
||||
98 10 93 22 56
|
||||
66 78 21 73 67
|
||||
3 39 15 85 87
|
||||
48 91 45 70 53
|
||||
|
||||
17 6 8 46 30
|
||||
81 53 76 21 63
|
||||
20 47 75 67 59
|
||||
69 58 5 62 92
|
||||
7 9 93 43 70
|
||||
|
||||
17 50 24 71 28
|
||||
30 31 37 48 80
|
||||
34 62 19 57 41
|
||||
88 49 51 93 98
|
||||
87 78 55 94 46
|
||||
|
||||
93 87 54 64 29
|
||||
81 66 35 43 25
|
||||
74 86 95 2 92
|
||||
42 94 45 51 17
|
||||
23 28 16 37 80
|
||||
|
||||
68 15 25 10 32
|
||||
60 51 45 38 4
|
||||
64 47 50 12 14
|
||||
86 61 31 67 2
|
||||
18 28 55 59 87
|
||||
|
||||
95 84 19 48 0
|
||||
12 22 97 6 89
|
||||
93 70 71 35 88
|
||||
49 18 37 58 36
|
||||
43 63 23 68 17
|
||||
|
||||
29 15 91 37 45
|
||||
3 98 33 73 39
|
||||
31 13 94 90 96
|
||||
81 87 78 93 42
|
||||
69 75 14 2 27
|
||||
|
||||
80 30 69 34 1
|
||||
59 23 20 85 31
|
||||
48 71 16 96 92
|
||||
66 99 39 53 52
|
||||
91 67 70 77 19
|
||||
|
||||
90 16 52 74 2
|
||||
41 39 95 59 1
|
||||
46 84 64 93 14
|
||||
92 48 25 28 98
|
||||
94 81 20 27 32
|
||||
|
||||
22 89 48 77 37
|
||||
54 59 30 71 38
|
||||
80 53 3 27 32
|
||||
25 23 35 79 91
|
||||
15 29 7 93 9
|
||||
|
||||
60 38 37 5 96
|
||||
51 77 28 63 80
|
||||
45 67 87 20 34
|
||||
56 26 61 85 82
|
||||
19 71 27 41 54
|
||||
|
||||
27 71 18 16 40
|
||||
88 3 61 74 52
|
||||
80 44 34 10 36
|
||||
15 2 1 4 11
|
||||
84 50 72 39 89
|
||||
|
||||
42 74 45 1 35
|
||||
0 63 38 12 85
|
||||
18 2 13 87 30
|
||||
44 67 68 41 70
|
||||
47 82 98 48 69
|
||||
|
||||
34 78 38 27 9
|
||||
91 47 69 51 73
|
||||
67 59 45 15 21
|
||||
30 24 89 5 2
|
||||
36 22 87 68 76
|
||||
|
||||
18 68 58 95 29
|
||||
72 24 70 47 79
|
||||
35 63 20 71 93
|
||||
60 59 34 49 81
|
||||
22 98 57 53 76
|
||||
|
||||
46 40 82 45 0
|
||||
2 22 28 38 97
|
||||
11 16 78 95 86
|
||||
80 85 83 17 67
|
||||
63 1 26 25 64
|
||||
|
||||
49 81 31 9 60
|
||||
33 15 29 38 66
|
||||
90 43 2 39 89
|
||||
24 40 63 36 91
|
||||
45 68 62 87 12
|
||||
|
||||
36 54 76 33 9
|
||||
60 7 25 96 61
|
||||
17 4 1 62 31
|
||||
93 83 79 30 73
|
||||
88 75 13 6 24
|
||||
|
||||
47 96 5 82 34
|
||||
76 67 30 15 2
|
||||
52 43 16 92 77
|
||||
58 13 18 78 84
|
||||
39 41 74 46 91
|
||||
|
||||
15 45 99 42 5
|
||||
41 61 58 14 55
|
||||
24 76 46 91 78
|
||||
52 56 81 92 59
|
||||
4 0 63 95 29
|
||||
|
||||
75 53 8 76 33
|
||||
82 60 7 32 97
|
||||
90 40 56 51 1
|
||||
15 48 4 41 71
|
||||
13 69 46 65 52
|
||||
|
||||
77 93 27 42 20
|
||||
0 68 31 51 52
|
||||
3 83 56 4 38
|
||||
54 65 86 72 16
|
||||
35 34 2 99 64
|
||||
|
||||
0 47 54 49 73
|
||||
11 61 18 69 16
|
||||
75 90 3 65 93
|
||||
22 57 84 96 8
|
||||
92 4 5 2 35
|
||||
|
||||
91 23 41 85 88
|
||||
68 28 9 70 74
|
||||
51 71 42 79 7
|
||||
61 77 57 82 18
|
||||
16 4 32 80 38
|
||||
|
||||
99 87 92 63 24
|
||||
51 64 22 9 94
|
||||
48 5 7 83 19
|
||||
11 27 46 2 17
|
||||
33 60 36 30 32
|
||||
|
||||
91 20 80 10 81
|
||||
55 78 8 67 7
|
||||
37 76 31 16 49
|
||||
30 33 63 68 28
|
||||
50 35 40 74 77
|
||||
|
||||
27 39 23 34 94
|
||||
51 18 60 8 98
|
||||
28 75 4 85 12
|
||||
96 2 15 29 88
|
||||
46 35 32 79 50
|
||||
|
||||
91 62 4 40 11
|
||||
92 47 56 5 3
|
||||
85 75 55 8 12
|
||||
25 48 13 31 21
|
||||
46 54 95 26 80
|
||||
|
||||
5 54 87 34 3
|
||||
96 12 67 6 14
|
||||
1 43 92 35 49
|
||||
31 72 65 85 2
|
||||
75 81 26 28 4
|
||||
|
||||
81 38 3 64 71
|
||||
69 53 19 1 67
|
||||
17 63 73 10 85
|
||||
37 15 91 20 62
|
||||
0 35 47 8 43
|
||||
500
2021/inputs/05.txt
Normal file
500
2021/inputs/05.txt
Normal file
@@ -0,0 +1,500 @@
|
||||
781,721 -> 781,611
|
||||
334,551 -> 119,551
|
||||
25,153 -> 765,893
|
||||
588,619 -> 588,683
|
||||
167,63 -> 439,335
|
||||
340,129 -> 35,129
|
||||
578,712 -> 509,712
|
||||
855,426 -> 855,649
|
||||
778,71 -> 778,411
|
||||
21,314 -> 631,924
|
||||
552,148 -> 148,552
|
||||
531,889 -> 789,889
|
||||
85,963 -> 986,62
|
||||
914,140 -> 257,797
|
||||
520,721 -> 794,721
|
||||
49,936 -> 960,25
|
||||
458,941 -> 839,560
|
||||
113,797 -> 113,604
|
||||
554,136 -> 554,655
|
||||
112,208 -> 112,504
|
||||
78,410 -> 169,319
|
||||
176,148 -> 906,878
|
||||
56,98 -> 835,877
|
||||
538,981 -> 178,621
|
||||
553,102 -> 553,688
|
||||
452,761 -> 452,70
|
||||
487,574 -> 487,589
|
||||
356,406 -> 154,406
|
||||
11,646 -> 11,416
|
||||
543,19 -> 924,400
|
||||
862,773 -> 929,773
|
||||
292,901 -> 292,97
|
||||
985,236 -> 667,236
|
||||
745,572 -> 667,572
|
||||
752,794 -> 775,817
|
||||
269,649 -> 269,198
|
||||
928,327 -> 469,786
|
||||
284,937 -> 755,466
|
||||
308,876 -> 308,790
|
||||
201,94 -> 988,881
|
||||
233,958 -> 903,288
|
||||
210,879 -> 91,879
|
||||
760,48 -> 133,675
|
||||
55,79 -> 956,980
|
||||
988,15 -> 15,988
|
||||
25,974 -> 966,33
|
||||
903,671 -> 292,60
|
||||
587,770 -> 403,954
|
||||
83,379 -> 432,728
|
||||
30,121 -> 334,425
|
||||
375,516 -> 375,409
|
||||
72,370 -> 72,152
|
||||
575,595 -> 575,363
|
||||
248,64 -> 896,712
|
||||
703,421 -> 395,421
|
||||
66,978 -> 977,67
|
||||
450,961 -> 450,773
|
||||
830,895 -> 830,661
|
||||
373,58 -> 442,58
|
||||
739,383 -> 739,712
|
||||
510,188 -> 510,99
|
||||
350,880 -> 248,880
|
||||
771,278 -> 549,278
|
||||
266,434 -> 266,838
|
||||
315,490 -> 884,490
|
||||
360,651 -> 428,583
|
||||
333,452 -> 333,109
|
||||
313,414 -> 713,14
|
||||
23,982 -> 989,16
|
||||
196,201 -> 889,894
|
||||
485,761 -> 99,375
|
||||
288,918 -> 50,680
|
||||
912,206 -> 142,976
|
||||
242,10 -> 841,609
|
||||
972,11 -> 16,967
|
||||
859,142 -> 390,611
|
||||
48,348 -> 212,348
|
||||
246,514 -> 726,34
|
||||
29,754 -> 29,706
|
||||
617,296 -> 224,689
|
||||
671,487 -> 397,213
|
||||
913,898 -> 155,140
|
||||
437,688 -> 18,269
|
||||
150,150 -> 869,869
|
||||
386,873 -> 940,319
|
||||
57,326 -> 148,417
|
||||
847,12 -> 319,540
|
||||
741,640 -> 520,640
|
||||
111,458 -> 111,754
|
||||
595,615 -> 861,881
|
||||
244,722 -> 905,722
|
||||
323,394 -> 323,304
|
||||
560,562 -> 560,678
|
||||
48,750 -> 48,228
|
||||
80,40 -> 80,723
|
||||
730,839 -> 191,300
|
||||
300,773 -> 977,96
|
||||
619,892 -> 827,892
|
||||
22,226 -> 656,226
|
||||
125,968 -> 125,637
|
||||
116,923 -> 512,923
|
||||
59,741 -> 59,499
|
||||
484,930 -> 487,930
|
||||
362,175 -> 362,778
|
||||
960,986 -> 53,79
|
||||
170,748 -> 576,748
|
||||
810,291 -> 743,291
|
||||
761,924 -> 339,502
|
||||
730,850 -> 920,850
|
||||
778,949 -> 778,766
|
||||
254,724 -> 254,394
|
||||
685,177 -> 685,441
|
||||
442,290 -> 833,290
|
||||
181,209 -> 72,100
|
||||
91,924 -> 953,62
|
||||
318,880 -> 318,659
|
||||
570,632 -> 570,966
|
||||
955,227 -> 667,227
|
||||
439,666 -> 439,224
|
||||
276,385 -> 276,56
|
||||
544,521 -> 544,867
|
||||
187,626 -> 187,13
|
||||
307,235 -> 859,235
|
||||
759,416 -> 668,416
|
||||
357,882 -> 981,882
|
||||
651,71 -> 651,457
|
||||
615,711 -> 615,502
|
||||
474,162 -> 305,162
|
||||
320,33 -> 320,48
|
||||
799,420 -> 799,389
|
||||
448,46 -> 313,46
|
||||
925,141 -> 925,928
|
||||
332,101 -> 332,373
|
||||
41,948 -> 749,948
|
||||
276,672 -> 207,672
|
||||
315,736 -> 86,736
|
||||
844,688 -> 466,688
|
||||
357,199 -> 107,199
|
||||
902,950 -> 14,62
|
||||
277,251 -> 923,251
|
||||
963,38 -> 34,967
|
||||
71,389 -> 577,389
|
||||
712,911 -> 712,573
|
||||
186,976 -> 148,938
|
||||
407,389 -> 637,619
|
||||
917,118 -> 917,960
|
||||
988,571 -> 362,571
|
||||
845,941 -> 189,285
|
||||
686,537 -> 306,537
|
||||
915,929 -> 946,960
|
||||
447,30 -> 447,364
|
||||
832,833 -> 832,888
|
||||
957,953 -> 203,199
|
||||
982,73 -> 400,655
|
||||
159,704 -> 159,844
|
||||
284,347 -> 159,347
|
||||
903,280 -> 93,280
|
||||
769,961 -> 140,332
|
||||
899,145 -> 293,751
|
||||
850,643 -> 148,643
|
||||
580,870 -> 739,870
|
||||
686,250 -> 686,237
|
||||
142,528 -> 142,936
|
||||
827,224 -> 827,287
|
||||
972,946 -> 155,946
|
||||
706,851 -> 862,851
|
||||
564,231 -> 564,428
|
||||
511,662 -> 511,752
|
||||
838,842 -> 585,842
|
||||
60,871 -> 870,61
|
||||
719,824 -> 719,648
|
||||
183,232 -> 936,985
|
||||
131,56 -> 953,878
|
||||
406,952 -> 80,952
|
||||
884,518 -> 945,518
|
||||
427,439 -> 662,439
|
||||
829,920 -> 829,634
|
||||
966,262 -> 966,933
|
||||
813,27 -> 813,934
|
||||
784,101 -> 784,160
|
||||
744,313 -> 744,850
|
||||
969,213 -> 206,976
|
||||
957,56 -> 28,985
|
||||
312,620 -> 312,680
|
||||
454,131 -> 454,776
|
||||
360,174 -> 175,359
|
||||
711,114 -> 692,95
|
||||
452,839 -> 938,839
|
||||
641,56 -> 641,334
|
||||
566,890 -> 51,890
|
||||
869,109 -> 869,102
|
||||
119,36 -> 119,796
|
||||
301,583 -> 301,451
|
||||
733,603 -> 733,714
|
||||
718,703 -> 581,566
|
||||
709,513 -> 915,513
|
||||
405,13 -> 572,13
|
||||
782,26 -> 391,26
|
||||
15,74 -> 858,917
|
||||
975,978 -> 38,41
|
||||
11,316 -> 982,316
|
||||
303,367 -> 303,129
|
||||
847,143 -> 847,158
|
||||
856,687 -> 856,870
|
||||
715,524 -> 715,812
|
||||
451,288 -> 272,467
|
||||
576,179 -> 119,179
|
||||
10,623 -> 10,44
|
||||
652,631 -> 796,775
|
||||
930,613 -> 913,613
|
||||
803,746 -> 803,566
|
||||
306,602 -> 306,137
|
||||
582,491 -> 582,296
|
||||
181,116 -> 231,116
|
||||
802,646 -> 802,884
|
||||
75,623 -> 75,424
|
||||
370,680 -> 370,923
|
||||
806,497 -> 939,497
|
||||
301,331 -> 818,331
|
||||
912,916 -> 27,31
|
||||
24,82 -> 683,741
|
||||
862,205 -> 316,751
|
||||
245,842 -> 383,842
|
||||
544,946 -> 518,920
|
||||
129,192 -> 18,303
|
||||
831,915 -> 31,115
|
||||
306,824 -> 454,676
|
||||
851,341 -> 125,341
|
||||
790,154 -> 790,988
|
||||
407,586 -> 477,656
|
||||
144,988 -> 925,207
|
||||
264,391 -> 264,466
|
||||
901,651 -> 646,651
|
||||
865,936 -> 390,461
|
||||
631,737 -> 631,166
|
||||
103,939 -> 937,105
|
||||
505,813 -> 505,218
|
||||
260,457 -> 141,457
|
||||
52,762 -> 54,762
|
||||
26,95 -> 889,958
|
||||
638,41 -> 330,41
|
||||
612,775 -> 191,354
|
||||
863,224 -> 863,287
|
||||
674,87 -> 674,110
|
||||
189,76 -> 954,841
|
||||
372,483 -> 503,483
|
||||
166,75 -> 619,75
|
||||
938,983 -> 18,63
|
||||
442,573 -> 858,157
|
||||
681,590 -> 878,590
|
||||
276,465 -> 500,241
|
||||
644,703 -> 651,710
|
||||
848,363 -> 254,363
|
||||
204,109 -> 216,97
|
||||
81,529 -> 81,674
|
||||
74,44 -> 978,948
|
||||
929,237 -> 598,237
|
||||
298,644 -> 298,712
|
||||
678,367 -> 360,685
|
||||
413,27 -> 413,799
|
||||
684,403 -> 684,500
|
||||
188,601 -> 972,601
|
||||
33,257 -> 33,897
|
||||
278,299 -> 278,635
|
||||
261,983 -> 804,440
|
||||
216,324 -> 216,526
|
||||
399,332 -> 399,613
|
||||
826,702 -> 826,332
|
||||
137,203 -> 624,203
|
||||
326,552 -> 36,262
|
||||
142,927 -> 343,927
|
||||
21,330 -> 410,719
|
||||
721,768 -> 289,336
|
||||
807,715 -> 807,287
|
||||
775,678 -> 62,678
|
||||
771,10 -> 491,10
|
||||
287,829 -> 287,599
|
||||
589,947 -> 767,947
|
||||
160,348 -> 798,986
|
||||
699,264 -> 108,855
|
||||
605,145 -> 568,145
|
||||
264,615 -> 545,615
|
||||
633,111 -> 11,733
|
||||
589,886 -> 589,897
|
||||
728,839 -> 78,189
|
||||
739,924 -> 948,924
|
||||
140,354 -> 830,354
|
||||
619,662 -> 332,662
|
||||
592,960 -> 592,290
|
||||
510,908 -> 510,828
|
||||
792,518 -> 792,749
|
||||
148,20 -> 832,704
|
||||
529,837 -> 863,503
|
||||
802,371 -> 301,371
|
||||
682,429 -> 682,537
|
||||
885,918 -> 38,71
|
||||
590,229 -> 795,24
|
||||
782,704 -> 244,704
|
||||
936,71 -> 981,71
|
||||
27,272 -> 27,253
|
||||
558,48 -> 558,69
|
||||
661,422 -> 661,145
|
||||
152,335 -> 152,362
|
||||
516,407 -> 26,407
|
||||
449,731 -> 592,731
|
||||
187,456 -> 594,863
|
||||
145,290 -> 15,290
|
||||
667,213 -> 214,666
|
||||
660,872 -> 660,605
|
||||
649,617 -> 986,954
|
||||
86,914 -> 959,41
|
||||
895,967 -> 24,96
|
||||
40,154 -> 762,154
|
||||
27,106 -> 855,934
|
||||
929,913 -> 319,303
|
||||
749,314 -> 387,676
|
||||
76,380 -> 824,380
|
||||
632,329 -> 632,436
|
||||
154,496 -> 154,528
|
||||
127,958 -> 127,613
|
||||
592,606 -> 363,606
|
||||
929,228 -> 929,890
|
||||
832,596 -> 801,565
|
||||
824,978 -> 134,978
|
||||
638,485 -> 638,291
|
||||
783,848 -> 783,77
|
||||
646,877 -> 646,117
|
||||
461,279 -> 850,668
|
||||
300,450 -> 115,265
|
||||
916,205 -> 145,976
|
||||
510,760 -> 124,760
|
||||
884,668 -> 884,153
|
||||
285,370 -> 705,790
|
||||
845,42 -> 17,870
|
||||
784,59 -> 71,772
|
||||
627,268 -> 333,562
|
||||
731,403 -> 22,403
|
||||
980,43 -> 43,980
|
||||
16,988 -> 973,31
|
||||
720,881 -> 300,881
|
||||
23,182 -> 723,882
|
||||
129,887 -> 51,887
|
||||
186,934 -> 186,452
|
||||
114,815 -> 39,815
|
||||
868,777 -> 868,222
|
||||
554,218 -> 911,218
|
||||
247,408 -> 777,938
|
||||
391,69 -> 285,69
|
||||
239,472 -> 614,847
|
||||
422,918 -> 422,245
|
||||
852,905 -> 852,634
|
||||
631,164 -> 17,778
|
||||
987,988 -> 11,12
|
||||
435,891 -> 435,136
|
||||
564,409 -> 767,612
|
||||
611,508 -> 611,535
|
||||
744,965 -> 631,965
|
||||
308,604 -> 509,604
|
||||
77,250 -> 589,762
|
||||
505,950 -> 685,950
|
||||
907,222 -> 850,222
|
||||
700,674 -> 754,620
|
||||
238,294 -> 53,479
|
||||
875,130 -> 875,544
|
||||
368,547 -> 368,965
|
||||
618,206 -> 311,206
|
||||
127,972 -> 852,247
|
||||
561,192 -> 982,613
|
||||
573,399 -> 573,464
|
||||
311,109 -> 764,562
|
||||
69,813 -> 809,813
|
||||
195,594 -> 317,594
|
||||
900,467 -> 638,467
|
||||
806,810 -> 806,918
|
||||
451,17 -> 128,17
|
||||
93,837 -> 878,52
|
||||
299,726 -> 531,958
|
||||
968,984 -> 18,34
|
||||
957,38 -> 14,38
|
||||
283,583 -> 32,332
|
||||
922,822 -> 953,853
|
||||
589,466 -> 753,466
|
||||
203,791 -> 933,791
|
||||
122,739 -> 778,83
|
||||
294,658 -> 289,658
|
||||
365,200 -> 365,513
|
||||
611,941 -> 701,941
|
||||
927,111 -> 107,931
|
||||
754,529 -> 181,529
|
||||
364,933 -> 567,933
|
||||
717,960 -> 717,11
|
||||
612,472 -> 612,807
|
||||
971,252 -> 531,252
|
||||
88,911 -> 387,911
|
||||
885,837 -> 75,27
|
||||
222,289 -> 714,781
|
||||
754,40 -> 293,501
|
||||
866,517 -> 949,517
|
||||
858,586 -> 331,586
|
||||
157,21 -> 731,595
|
||||
173,216 -> 822,865
|
||||
353,206 -> 353,318
|
||||
68,88 -> 957,88
|
||||
370,645 -> 200,815
|
||||
981,83 -> 89,975
|
||||
259,112 -> 259,435
|
||||
184,920 -> 825,279
|
||||
252,357 -> 252,56
|
||||
722,349 -> 368,703
|
||||
928,973 -> 597,973
|
||||
677,656 -> 788,545
|
||||
222,766 -> 527,461
|
||||
870,787 -> 972,889
|
||||
11,986 -> 986,11
|
||||
163,918 -> 748,333
|
||||
111,75 -> 823,75
|
||||
603,250 -> 375,478
|
||||
338,582 -> 338,454
|
||||
372,179 -> 452,179
|
||||
571,96 -> 571,723
|
||||
243,460 -> 267,460
|
||||
850,63 -> 43,870
|
||||
837,863 -> 113,139
|
||||
21,886 -> 709,198
|
||||
154,650 -> 181,650
|
||||
320,506 -> 320,706
|
||||
983,722 -> 983,657
|
||||
830,225 -> 190,865
|
||||
924,12 -> 11,925
|
||||
838,827 -> 258,247
|
||||
690,792 -> 690,582
|
||||
465,658 -> 146,977
|
||||
790,935 -> 39,184
|
||||
318,627 -> 318,125
|
||||
245,939 -> 291,939
|
||||
803,219 -> 254,768
|
||||
262,476 -> 441,476
|
||||
790,225 -> 790,372
|
||||
250,722 -> 613,722
|
||||
368,326 -> 368,474
|
||||
148,666 -> 394,912
|
||||
813,588 -> 238,13
|
||||
84,323 -> 84,957
|
||||
566,716 -> 822,716
|
||||
794,633 -> 459,633
|
||||
355,634 -> 237,634
|
||||
950,755 -> 950,867
|
||||
292,696 -> 340,696
|
||||
121,391 -> 361,631
|
||||
58,516 -> 624,516
|
||||
859,37 -> 184,712
|
||||
686,819 -> 428,819
|
||||
11,12 -> 988,989
|
||||
718,679 -> 280,679
|
||||
515,524 -> 515,664
|
||||
136,459 -> 136,56
|
||||
703,763 -> 703,858
|
||||
290,733 -> 290,33
|
||||
910,928 -> 910,21
|
||||
570,937 -> 570,808
|
||||
462,215 -> 462,747
|
||||
388,181 -> 712,505
|
||||
933,705 -> 933,601
|
||||
605,492 -> 188,492
|
||||
737,818 -> 564,818
|
||||
214,629 -> 735,108
|
||||
139,942 -> 598,942
|
||||
708,187 -> 541,187
|
||||
646,611 -> 325,611
|
||||
788,356 -> 718,426
|
||||
267,250 -> 267,930
|
||||
94,819 -> 94,191
|
||||
661,537 -> 661,363
|
||||
464,290 -> 471,297
|
||||
656,68 -> 337,68
|
||||
31,515 -> 797,515
|
||||
876,21 -> 81,21
|
||||
630,932 -> 21,323
|
||||
259,58 -> 542,58
|
||||
703,523 -> 703,949
|
||||
470,310 -> 470,20
|
||||
69,983 -> 977,75
|
||||
569,908 -> 569,931
|
||||
645,718 -> 645,665
|
||||
819,371 -> 819,705
|
||||
772,709 -> 772,736
|
||||
330,870 -> 382,818
|
||||
982,317 -> 982,778
|
||||
626,411 -> 626,887
|
||||
466,33 -> 466,635
|
||||
519,939 -> 519,131
|
||||
402,253 -> 402,300
|
||||
180,712 -> 826,66
|
||||
55,764 -> 941,764
|
||||
659,859 -> 659,944
|
||||
346,374 -> 346,500
|
||||
880,333 -> 880,767
|
||||
42,969 -> 983,28
|
||||
363,688 -> 363,148
|
||||
645,880 -> 265,500
|
||||
1
2021/inputs/06.txt
Normal file
1
2021/inputs/06.txt
Normal file
@@ -0,0 +1 @@
|
||||
1,4,2,4,5,3,5,2,2,5,2,1,2,4,5,2,3,5,4,3,3,1,2,3,2,1,4,4,2,1,1,4,1,4,4,4,1,4,2,4,3,3,3,3,1,1,5,4,2,5,2,4,2,2,3,1,2,5,2,4,1,5,3,5,1,4,5,3,1,4,5,2,4,5,3,1,2,5,1,2,2,1,5,5,1,1,1,4,2,5,4,3,3,1,3,4,1,1,2,2,2,5,4,4,3,2,1,1,1,1,2,5,1,3,2,1,4,4,2,1,4,5,2,5,5,3,3,1,3,2,2,3,4,1,3,1,5,4,2,5,2,4,1,5,1,4,5,1,2,4,4,1,4,1,4,4,2,2,5,4,1,3,1,3,3,1,5,1,5,5,5,1,3,1,2,1,4,5,4,4,1,3,3,1,4,1,2,1,3,2,1,5,5,3,3,1,3,5,1,5,3,5,3,1,1,1,1,4,4,3,5,5,1,1,2,2,5,5,3,2,5,2,3,4,4,1,1,2,2,4,3,5,5,1,1,5,4,3,1,3,1,2,4,4,4,4,1,4,3,4,1,3,5,5,5,1,3,5,4,3,1,3,5,4,4,3,4,2,1,1,3,1,1,2,4,1,4,1,1,1,5,5,1,3,4,1,1,5,4,4,2,2,1,3,4,4,2,2,2,3
|
||||
1
2021/inputs/07.txt
Normal file
1
2021/inputs/07.txt
Normal file
@@ -0,0 +1 @@
|
||||
1101,1,29,67,1102,0,1,65,1008,65,35,66,1005,66,28,1,67,65,20,4,0,1001,65,1,65,1106,0,8,99,35,67,101,99,105,32,110,39,101,115,116,32,112,97,115,32,117,110,101,32,105,110,116,99,111,100,101,32,112,114,111,103,114,97,109,10,0,300,57,112,318,46,306,343,452,129,184,1407,1206,447,50,9,522,166,475,80,275,1022,228,5,178,885,420,244,799,603,1267,598,12,1549,313,899,207,307,85,541,102,13,481,126,1566,148,190,806,1244,314,933,31,452,1048,179,456,907,26,1028,1520,353,589,1121,213,455,1199,251,240,1274,705,736,1119,962,286,407,425,332,132,561,467,209,1358,196,514,36,29,1116,659,720,236,292,404,208,270,132,75,221,0,168,688,1210,400,783,478,113,170,261,290,522,116,65,1417,775,16,418,1407,2,5,5,72,24,523,1253,1448,298,468,626,66,131,123,165,805,436,62,398,653,55,71,261,1177,343,405,27,30,1026,549,64,794,248,18,68,431,872,1154,360,145,206,74,1114,788,89,328,168,219,5,1126,1420,171,23,77,1395,171,462,84,807,25,1087,584,189,1594,1067,370,279,1341,422,21,359,693,20,943,1189,640,1086,291,32,1240,359,322,704,449,222,46,579,1656,1057,20,52,50,45,312,330,1258,306,232,108,406,657,37,9,228,757,1673,1597,450,1515,380,261,1277,11,698,63,1126,1098,528,690,364,392,311,448,928,144,1275,33,101,515,14,1252,483,631,331,744,62,10,1203,395,28,29,2,132,17,703,654,192,144,30,158,10,174,106,478,19,1635,359,1327,309,145,304,126,1012,521,687,279,7,589,1053,189,45,30,129,397,449,284,30,635,561,151,487,120,210,154,290,60,117,158,902,27,283,337,62,1127,5,697,835,454,526,1153,783,378,770,75,144,641,1152,0,230,1829,119,742,43,305,167,81,1002,106,251,346,64,934,90,1279,40,399,557,743,13,38,231,243,505,549,130,294,570,638,183,9,604,704,466,1506,930,32,964,73,269,606,1231,1238,428,639,1699,446,225,71,34,996,1101,179,826,32,304,343,718,119,253,366,292,52,195,2,752,603,454,247,216,72,307,816,530,329,669,395,257,451,430,415,977,424,852,544,161,234,1305,10,29,280,470,31,672,333,154,990,1429,451,316,287,1825,995,440,535,157,521,569,71,466,116,415,132,557,236,569,230,982,20,876,235,53,34,1453,539,88,349,248,72,21,1526,28,518,441,932,610,1058,1037,707,639,248,661,1142,60,684,68,93,1589,186,980,307,405,354,756,135,454,7,1242,183,1084,131,364,120,407,981,769,400,492,558,326,134,219,128,103,5,938,153,574,228,174,1181,527,506,382,359,3,316,1253,2,265,58,720,947,317,792,66,52,1868,1590,399,385,235,420,592,84,218,1685,254,283,445,179,694,1280,68,1169,297,766,1394,954,6,417,1654,255,399,1043,110,808,29,892,657,30,891,993,661,70,1176,289,126,38,1285,144,708,413,176,28,496,179,379,161,727,500,1215,941,1690,299,555,398,320,279,188,22,1098,187,114,173,1025,918,555,472,1285,210,1242,405,310,153,372,75,275,268,1059,387,65,423,215,92,1421,352,65,573,406,202,13,1054,1780,3,281,28,1246,298,535,417,189,1181,1565,990,1169,244,122,153,693,862,107,1185,13,4,1930,508,72,822,440,361,1617,24,1033,249,193,299,479,269,1082,1472,52,400,1706,1019,588,759,1256,185,377,55,825,468,189,94,15,74,446,23,370,1654,151,529,1126,306,114,455,288,412,349,440,158,726,127,1247,780,117,1039,68,26,147,793,88,670,992,215,285,528,736,501,70,805,890,802,495,416,1018,128,57,67,28,445,855,327,1,4,291,277,50,947,1096,408,843,237,755,110,628,1019,1059,1207,225,335,275,1431,397,632,346,576,292,49,65,161,287,481,352,56,118,232,630,1518,326,241,216,95,493,387,431,533,29,1196,433,19,15,759,227,927,40,652,1441,1046,1005,19,338,669,359,28,360,651,262,551,174,263,62,166,25,39,2,406,342,227,425,238,995,31,121,120,1047,1498,952,954,291,512,311,125,380,11,55,37,89,203,308,1631,299,182,1777,968,128,1279,305,167,290,43,1032,193,8,1783,636,331,239,16,62,432,1068,1421,639,10,693,118,851,1623,1198,1315,802,1042,657,574,726,510,161,178,456,263,361,498,902,927,975,335,955,98,1302,73,374,633,8,3,42,20,406,407,258,181,531,89,345,184,180,730,18,771,205,203,385,237,776,17,530,318,12,205,301,736,342,26,1008,111,1107,22,1044,870,200,428,378,0,718,534,28,513,399,57,1439,450,782,1183,805,43,604,710,310,950,282,1475,1233,75,501,446,439,12,739,151
|
||||
200
2021/inputs/08.txt
Normal file
200
2021/inputs/08.txt
Normal file
@@ -0,0 +1,200 @@
|
||||
gbdfcae ebcg cfg gc facegb fecab acfge cbfgda fedag caebfd | ecbg bfcagd faegc gcf
|
||||
eacgf efcab fgc fedagc gdeaf cged aebfgd adcgfbe gc bdgcaf | fgbacd cfega ecdg cg
|
||||
dfgae gcadef efb eb dcabf bgde edfba bcfaeg egcdfab fbgade | bged eafdb eb gfdea
|
||||
aefdb cafdgeb egdfac egdcba fcbd efd eadcb caefbd df aegbf | cfadeg abfedgc fde bfcd
|
||||
dc deafg ecd dbaefc adcfeg cfged ecbfg acdg cafdegb gfeadb | dcga edc adfebcg ecgfb
|
||||
befdc bcfge befad degfab cde aecbfd gcedaf eafcgdb dc bcad | bdeafc cde ebdcafg daebgcf
|
||||
cd egdacfb fdc fecgb gabdf fbcdg fcgdeb gdcfea debc ecfbga | gfecb fbgecd bcgef dc
|
||||
fagcdbe gec gbdea ce bgedc aecd cgbeaf cfbdg gebcda dbfgae | cfbaged cgbeaf ceg gadfbe
|
||||
gcbaf gfdb bdafc df adf adcbefg dcfeag cebad adfgcb faecgb | afd agfedc dcbfa gdfabc
|
||||
fbae cef fecdbg afbcg cefbga fe acdfgb gadce fbdacge fcage | fe abef gfbac cef
|
||||
cfdebg bg beg cabfeg fbgd acged ecgbd fdcbe cfbeda cebgadf | fbedc gadce gdaec bcfed
|
||||
gba ab fgbcd gedaf bcadge afbdgc cdgfbe agdfcbe bcfa bdfga | gab gdbfc ba fgdbcae
|
||||
fabdgce bfdgac cbaed dcb bgade fbaec fcde edbfac gfabec cd | dc cefd dc cd
|
||||
afc dbecafg fagce fbega fbgc edgca agecbf bafged eacdfb cf | cf bfdcaeg gfbc gfbc
|
||||
gedcb ebda cgbdfa fcaeg gab bfgdce ba agbce bdgecfa dgebca | bdgfce cebagd cbdgfae dcfbeg
|
||||
egbacf acdfe gfecb egdfcb dfgaceb dfb dgcb fdbce db bdeafg | fdb db db bdf
|
||||
cfeg eabcf gdefcab bef geabc bfcad egbadf cfgbae egcdba fe | fgec gaecfdb cagbef ef
|
||||
bafde dbgeac feacgbd cbaef bed bfgaed gafecd bgdf bd eafgd | db cfgdae caegdfb fabed
|
||||
afg bacg cdbgf gcdfab fdcae gafdeb dbgfce ga dcafg cedabfg | gaf bdafgc agbc ga
|
||||
edgca bafdcg acbdg cbdeag dce fgcea gdcfeb aebd ed gfdabce | ebgcad daeb edcga ced
|
||||
agecf abfegc dbefcga ad dafc fegdb adg afgde bdcega ecagdf | fadeg dfac dga da
|
||||
ceagdb gedac acfdbg cda bgecafd adgeb dcefg ca beac abgfde | aegbd baegd bdcagf abcdeg
|
||||
egaf bagdce dcgabf ea eab cgbfa cdfebga fbcae dfcbe fgbace | gdfaceb gfea dbcfe eba
|
||||
cfbega bge eg cgdebaf gedbc adeg bceadg bfadcg agbcd cdefb | ge ge cfedb fbgadec
|
||||
afc ca cabe gbefcd aebcgdf acedf gbafdc eagfd edcfab dfbce | gbfdcea fca aecbfd ceba
|
||||
af bcdag agbfde fdbca ebdfc adf dbefcga abedfc aefc dbgcfe | af acfe adf adcfbe
|
||||
badfe agebd gfaced gbdcafe aecfd fab dbfc geacbf adbcfe bf | fb ebagfc beadf dface
|
||||
bfeda gabefd agbedc ec fcadeb dfbaecg cea fdec afceb agfcb | fbcae cfde eac fedc
|
||||
ebcf eafgcb egdfba dfcag bacge faceg afe gdceab ef dgcbaef | fcbe febc bcaeg cbfe
|
||||
dafbc afdebg egfc ce eagbcd ceafgbd fgeba cbefa eac fcgeba | afegb cdagbe cbdaf gfaeb
|
||||
ecd dface cdgafe gcabfd edbgcfa gdacf fecg cdbaeg ec efbad | edbaf gcafd dcgbaf dafgceb
|
||||
gd fagbec bdfg gde cfgbe cefdbg gbdeacf agdcef bdceg bcdea | dg gcfeba dg ebdcg
|
||||
bg bgdeac abdg cgb fcbade gdbceaf fbdgce dbeca gaebc aegfc | cgb befgdc fedgcb gbc
|
||||
gac cgeda egcbafd gfdbce fadec ag degbca agecbf dagb gebcd | cdegb degcbaf cedaf edafc
|
||||
ecfab bfacdg bdga gb cfgba bfg gefdacb cegdfb fagdc cafedg | bfg cefba gb aedbcgf
|
||||
dgfce aeg cfbdgae acfgeb ebcafd ag gafed gaebfd bdga dbfea | gae cfbdae abedfg bgfdae
|
||||
cgbad cbaf fbgeda dfgcab fdcebg dbfcg decag cdagbfe bga ab | dfcabg cbfa fcedgab adfcbeg
|
||||
cegbadf edfgba cafeg dc agdebc dbgfe cdbefg dec dbcf edfcg | bdfc facdegb adfegb egbfd
|
||||
bedf cefadg ced ed bcegd gefabc agcdbfe cdgab gcfbe fgcdbe | ed cde bdgec dbecfg
|
||||
egfcab debfa ecd bfgec cdgb cd bdcef dgebcf ecdabgf egcadf | becfd cbgd gcdb fcbed
|
||||
bc dbfge gbecf caefdg gefabc abgdcf bfc baec efcag cebgafd | baec fegbc agfec cgbef
|
||||
bacegfd fbdgca egbcf fabce bdaefc dcaef dagefc ba dbae cab | daeb cbefa cab ab
|
||||
fgab cgdfae fcgebd gb bcg dbaegcf cabed gadcb gcafd gbfadc | gbc adcgf dgecbf cgb
|
||||
gdaeb df cgaebdf dfbe cbdagf eabdcg gfd aecgf aefdgb agedf | dfg gfcea febd ebdag
|
||||
ecbaf cagfdb aecgf gac ebga defagcb baedfc gfcde ag gfbeca | cadbfg gaecbf agbfec fecba
|
||||
edbgaf fbd egdbfca dagf gabde bdfge fd bgcfe efbcda eacdbg | fbd ebcdaf dbgaefc gefbda
|
||||
acdbg aefcdg cdg cegb acebfd abgdf cg fbegadc gcbdae eabdc | gc edafbcg gadbc cg
|
||||
fgcd bgdafe bacge dg facgde acfde agdec gdefbca deg aebcfd | gd eagdc ged ged
|
||||
egfa efdcba dfbgc cbfea ga abcfg edgcab bga fecgdab aebfcg | bga faegcbd bfeadc badcge
|
||||
bfeda ceagdb bf ebfacd edacb acefbdg begcdf bafc agfde feb | fb fb fbac bcegad
|
||||
bfdcea dcbgaf cbega dbage cea ce cbafg gefc bgacfed bfecag | abgfc ec cegf acdefb
|
||||
adgfce cdag cd fgecab cfgae ced fdbae gebdfc agbcefd ecafd | dfcae dc fdcae ebafcg
|
||||
dbeag begfad bfdegac dcb cb gcfda ecdgfb ceab gcabd dcebag | cbd cb cegbda bgcdef
|
||||
cdfaeb fgebad ea dcbgfa gcaebdf cegbd bdcae fabcd cfae eba | caef bafdce afec gfdbea
|
||||
bcfega gcbea bdfgeca gabcd bd gdcabe dafcg ecdb dba ebfadg | fceadbg fbaceg db bd
|
||||
gadcbe dgb debcaf fabgcd bcgfe bdgcf acfedbg gd cafdb gdaf | eafdcb bcfade badceg bdacfg
|
||||
gafce cabde cdf aefbdgc efacgd fgeacb ceafd df efgd badfgc | edfg acbegf dfc gedf
|
||||
afgce gbdecf bae adebcgf bgedca abecg abcd baefgd ba gbdec | ab dfagcbe gbeca ab
|
||||
de dcgaf gcfbed gdebfca acegb cde bcgafe abed gdacbe gecda | ed afgcedb deagc gcdaf
|
||||
gcdef ebfadc da dabefg daf fbaeg gaefcb dfeag gbdfcea bgad | gadfbe bafgce dgba afd
|
||||
bdfeg gecf fc egdfcb gcbedaf bfc dfcbe cbdfga baced abedfg | fcge fgdecb dcgfabe fgdeb
|
||||
bdf acbdfg bdaefg aefgbc abcde dagebfc fd dfcg cabdf cgfab | bfadc cabfg gfcdab fbaegc
|
||||
af cdfbega edbfac dfbgc fac adef adecb becagd acdfb efcbga | bcagfde bdfcae gfdecab eacbd
|
||||
egfcad bdgeac fdac fed cdage fd gcbfed baegf gfedcab gedfa | adceg fd afebg egdca
|
||||
fegba ecbafgd cfegba cgdab efbgad ec fadcge ecg bcef cegba | bgadc ce fecgdba baceg
|
||||
bdfaeg abgedc efadg bafd gfeba fcdebga adg aecgbf da ecfdg | ad ad dfba befcgad
|
||||
efadcg dacfb cfgab bfde eafdc decfbag decbfa bd bcd acebgd | debf cafde gcdafe fcgebad
|
||||
agd cgadef gcdebfa gd facge bdfgea eagbfc dcgaf cafdb ecdg | cbgfae ebfcga agcef bfdeag
|
||||
dfbge abefgd aefbcg dcfegb ba fgbad gedafbc bdea fba dcafg | agfdb fab fba fcbgde
|
||||
fcdab agbecd eacgfb gc fgeabd gdabc dgbea cbfdeag cag dceg | fcadb fbcad degba gca
|
||||
eag cbefg dfeagbc cdfbga egcba dcegba dace agedbf ae gadbc | cegba age agbdc dbcafg
|
||||
cdbag gfb dgceba cbfa gfdbac faebcgd deafg dgbaf fbegcd bf | eagdf febgcd fbdag gdfbce
|
||||
cdbgf afcebg acfdbe ed ced bdefagc dcgbea fbeac cbdfe adef | cfbde de dec ecd
|
||||
dfc fbcde dfcbga ecbgd egbdca fd eabfc edbfgc efdg cdfegab | df dgef fgbaedc df
|
||||
fcg egcbd gacefb dfgbc abfcgde bfdga cfed cf gdebac gbecdf | bfdcg fgc fbcdg agdbf
|
||||
fcabg acfbedg bfcgde ecbad agef ecfgba ecf fe dafbgc baecf | aegfbc cfe dbace fec
|
||||
edbagc cefbda bfdeg af agcf gfebdca fgdcab dgcba baf fabdg | bcadef dfgcab abdcfe gedfb
|
||||
acegf efbgcd dgbefac cgd bedga cbad agcedb dc egadc feagdb | badcgef cd dcgbfae cd
|
||||
bfc cdafeb bcega gdcf afgdbe egbfd caebfdg gcefb cf debcgf | gcebf bgedf dfbgea fc
|
||||
dgfaceb gcdf dabcg fd dfgba aefcbd bdacge gfabe afd dcagbf | daecgfb gbecda dacbfe gdcba
|
||||
fbgedc bfcda cfg dafbge fecdbag cagfd aecg agfde cg adgcfe | ecdfagb gfceda gaebdf gbfdea
|
||||
afbe gfa gfdcb af febcadg faegcb bcgea aedcbg eagfcd afgcb | bagcf gfdeca abfe af
|
||||
caefg efd fd abedc fcgd egdcaf egafbd gfcbea dafec abgedcf | gaebcf fcedga def egcafbd
|
||||
dcfab gefdcb bda da baefc baedcfg gfda dbceag cbfagd fbgdc | cdebga efdgbc fbcgead beafc
|
||||
bgfed fdaegcb bedagc da bdacfg gda eacfgb cadf dafgb cabgf | dgceab da dfbeg bcegad
|
||||
cedab fc adbfec faegcb adbgf cfa ecdf ebagcfd dcbfa ecgabd | becdaf cefd abdfc efcd
|
||||
cdgbea aeg agdec dafgbc gbed aegbcf ge aecfbgd cagbd cafde | ceafd bagcd gacdb cgbad
|
||||
dgfeb bedag cgdefa df gfdaeb cbdega gfdceba gbfec dafb gfd | fabecdg bdfa bdaf dfba
|
||||
gdfe acdbf ed bdegcf cegbfa cebfd deb badegfc fbcge bgaced | ebd efgcabd bfcda dfeg
|
||||
abfcedg gec fcgdbe gaebc gebfac efbdca gfea acbfe gbdca ge | agfe cge cdbgfe bcfdea
|
||||
fgbaed dacegb dacef egafd aecbgf adfcebg bdfg ged agfbe gd | agdfceb gd dg fbgd
|
||||
egdb acgbef edfac bd fgecb gbadfec bcafgd bcd bedcf gdecbf | bdc bedg gdbe efbgc
|
||||
cagbef acgbf fgcabde cgd gbda dg dbfgec ecafd dgfca dagbcf | agbcfe dcgfa dbagcf cgdafeb
|
||||
cb efbgc cgfae cgb gceafd beca fbcgae gefdb cbgadf dcfabeg | bgeacf bacedfg cbdgfa dfgbe
|
||||
cgbedf facgdb agfdc cga cafed gfcbd gcdbeaf degacb fbag ag | gbaf acfed gafcd cgfda
|
||||
egbdfca cadf bdafgc cbgfea cbgde bdcfg gfc cf fdbag gebdfa | eacdgfb fcda dfac adefcgb
|
||||
fdgea abcd ac cfabge cdbfeg gdebac acg gcdebaf gadce bcedg | gac abefgc ac gcaed
|
||||
eafdc eafbc agbe begcadf ba gcefba fgcbda gdbfce cba ecbgf | ba ab abeg adcgbf
|
||||
afg ga bdafe eadfg dagc gefcab edbcgf ceagfd ecgdf aedcbfg | agdc daefb debcafg fdaeb
|
||||
baf cbdgf afbecd gdcabfe dcfabg fadeg gbac gbadf ab cedgbf | fcdeba cbga afbdg bgca
|
||||
ebdfgca ebfdag gb bgf fdeagc gdbe cdfgba egfab abcef agdfe | gb gfbdea gdeb eafbg
|
||||
agbcdf fe gebad fea becf ecfbga cgabf aegfb fedgca acgbedf | ebgda ebdgacf fcbe aef
|
||||
gdbef bgfadec gfeab eab gdcfbe ab bfadeg fdab dcaebg acgfe | fgadbe fbedgc dgefb aeb
|
||||
adcbf fbdg bcf dcbag fecad cgafbd fb acdefgb bgefac dgcabe | dfcab cfb bf cdeaf
|
||||
dfgbca cdebagf cfe fcbga aefdg geafc bdecgf ce bgefac aceb | bace aebc gfbac efc
|
||||
adfegcb gcbaf fa adgcb acf efgacb fgcbed eadfbc agef fbgce | aefg acf gafe cfa
|
||||
fdegbc fcbad ec ebgaf gecfdba feacb caefgb degfba ecb geac | ecb ecb cfadb ebafc
|
||||
fegabc ebcgafd gfacde ge fcgeb ceg bagcf dcfbe ebga bdcfga | cefabdg fdceb abgcf gfeadc
|
||||
fdabcg bgafc fcbeag edbfg gadfceb ad adb dfca dcbgae dfabg | bdegf faedbcg da caegfbd
|
||||
cgfae gdbeca decaf fd dfbc fad dabegf daebc bedafgc efbcda | decfa fgcbdae fcbead dbegcaf
|
||||
dbeaf cb fabecdg bcfda gabfdc cbfg agdfce abc edgcba cgadf | bcdefag bcgf dafbc badcgf
|
||||
gbdcfa becfdg fdbcgea fgc cg fecdg efdgb ecadf gceb gadefb | gcbe fgcebda daecgbf aebcfgd
|
||||
cdega dgcaeb cbgea egdcaf gfacedb begfda cebfg cbda bag ba | ab egdac beafdcg faegcdb
|
||||
gab cgfab cfage fbaedc bcdg gb gacfbd defcagb gdebaf fadbc | bg fbacde gfabc dceagbf
|
||||
ge ebg cgdfb cedba bedgc ecag deagcb bfceda gdcfeab egdbfa | bge beg bafged cadbeg
|
||||
eabd ebacf ecd fdcbg dbafegc ed ceagdf fgceab ecfbda cdbef | dec dfcabe dec befca
|
||||
afbgdec cedb dc agdbf cegbf bfcedg cdg bdgfc baecgf ecfdag | cd dgefbc fdgcb cd
|
||||
gebdaf dgfae afe gafcbed agcfd febd edabg gbfeca bcdega fe | ebdag fedb egafd aegcbf
|
||||
gebdcf abefdcg deg bgdfc fcde gbfea gedabc edbgf ed bgfcda | efdbg fedacbg gbfacd fbdeg
|
||||
bcgd edagc gaebd bcdaeg fabedc bgefa fcadge agbfcde db adb | cgbdfae bdagcef badegc dab
|
||||
df fdb bfadceg bgeadf afbdce efdg dgbae dafbg cafbg abdgec | gdfe afcgb ebcgafd fbgacde
|
||||
gabce gdfaeb bcad cebdgfa fgcbae efgcd dga da cgdea cdeabg | ad agd gda gfedc
|
||||
fcabge edbfg fcaebd ea dcbagef gace gafcdb bafcg eaf fgbea | dcfbage aceg afbdceg ebcafd
|
||||
bafe egfcda be bfgaec gbe egcfbad fcaeg bdcaeg bgecf cfbdg | fabgced bfea gbcef gcfeb
|
||||
badfeg fgecb af cgaebd acfdbge gaf afcged gfaeb dfab egbad | fa fga abfd gabde
|
||||
afceg bcdfge fcaebg baegdcf cfg eabcdg bgfa efcad gcabe fg | abfg gf fbgecd acebgd
|
||||
acbedgf fb efgdc bgf gbcfd bgfdac dagcb fdbeag ebcdga fcab | bf gdebaf fb bf
|
||||
aecf cgbdefa bacged efbcga fdgcab febag af agf dgfeb ecabg | bcgdaf af cadfbge efca
|
||||
egfda fgceab acd bfcadeg dc dcega bfdcea gcdb cdbega eacbg | gabecd cd befgcad gdcb
|
||||
gecda dfegacb cgfae cdbfag fcbeag afg gf fbge dafecb caebf | dfaebc cfeab gf agdfbc
|
||||
gdafe cdgaeb egfdba da bfdgec gbfed eagcf egdbafc fbad dag | agfde dga dcgbfe abcdfeg
|
||||
acgdb gadfce cbefdga becad bcegdf bacgdf afbg ga dag dbcgf | abdgc gdeacf acdfbg ecdab
|
||||
gdfa eadbc gcafe dgc dg fcagde bcgfea decgfb egcda fbecagd | cegda cgdea gd dg
|
||||
ga egdbcfa aegcb cag egbcd gadceb gbcefd decafg badg cabfe | bagd cagfed gacdfeb cbegd
|
||||
cb deafc bcgd agfceb dbfega ecb deacb aebgd cbafdge ebdacg | dcgb adceb edgba ceb
|
||||
edgfab acgb becfdag bgf cgbdf cgfad dacbfg bg ecdbf afegdc | gfb bg gcfade gfbdeac
|
||||
caebg cgaf acgdfbe begcaf cf fdgeb agedcb ebgfc cfe fbcdea | dbfeagc cfe fbeagdc cf
|
||||
ageb bg adcbfge fcgea cbgaef cbdfa gfb fedacg bfgca fdcgeb | fbg afdcb ecgbdfa cgfdbe
|
||||
dgbfe aeg ea dcea dbeagfc fbacgd ecbdag gadbc bcafge adgbe | aedc ae gbdef daec
|
||||
dbafcg dbgaefc adfc egdab fdg df agefbc bdgcfe fbacg gdfba | bedgacf gcbaef cdfgab cafd
|
||||
eg fdgcabe gcadbe aebdc gced bagfde gea gbeac afbcg ecdbaf | agfbc fgdabe fcdgaeb feabcd
|
||||
fedb gfe defabgc caedg cgadbf feagd bdagfe fgbda efagbc ef | fe fgcbea ef dbfe
|
||||
bc agcb dfceg bafgdc gfabd fbdcg bcd ecgfbda ebadgf fbaedc | cbd fabcgd cgbfd bc
|
||||
ebfgc dbeg ed gefdc cde gfbecd fgdca caedfb gdbafec gefcab | fgdecb dgfce fbecg cabgfe
|
||||
ab ebda bfagdc becgd aecfg bag daecgb ebcag gbacdfe cfgbde | abedgc eafgc ebacg ab
|
||||
ecdbag dagbfe badef fcaed adc cd efbagdc cafge cfaebd dfbc | dcfb dca acd gcdabe
|
||||
cedbgaf ecbfg dagfec dgbea bdca gfdaeb ecgbd dbecga cd edc | ecbdga cde edbag dc
|
||||
egbfcd gbcafe ed defga dbgfa bcgdeaf cdea def eacdgf gacfe | bgfad ecda gbfad gcdefb
|
||||
dafge cea fdace agdc dbgfea ebdfgca dcbfe acedfg abecfg ca | defac gcad ac ca
|
||||
ecdba fbac eabcdf beadgfc acd efacgd ac agedbf bfdea ecgbd | aecbd agbefd bdgec dgebc
|
||||
bfegda bdage gdf gfdae bdfgace fgeb afdec fgdacb gf deagcb | fbaegcd fegb aedgb dfg
|
||||
cdaf fd bcdfge agebf dcgfae gfead baedcg gdcea egdbacf dgf | efgab df eagfd afgbe
|
||||
egfca egcb ceafdb fbc fbcaeg dgbfa cdfeagb fgcba agdcef cb | cb gcdfae eabgfc fgbca
|
||||
gdbca fdecba gdecfb feagbd ceb adfbgec bdgec ec efgdb cfge | ec ecbgd dacefb abfged
|
||||
edbcag cabd ecfdgb aegfd eagfcbd ac cga feagcb ebdgc dgeca | acfbdeg dfgea cga dgeca
|
||||
ebgacf adcf bcgedfa gdcabe abedf aef edabc fa befgd bfdaec | aefdb af cebad fae
|
||||
dageb de gde dgfbce cgdba gabefd afbge cgdebfa aefd ceafbg | efgbda agbdecf bfaegcd edg
|
||||
ce dec becf efdgb edfgcb ecbdag gdaefb beafgdc dagfc fecgd | ce fdbage gcdfeba gbcadef
|
||||
ecgfa ebadcf ed gcdfab cdefa gfdaeb dbec dbfgace cdbfa dfe | dceb cdfab ed ceagf
|
||||
cadg efgcdb gbcfad feabc agfcb afcdgbe dgbfa gcb fagbde gc | gdecbf adfgbc fbcgade gafbc
|
||||
gdcefa gefdb bcfeg eabc fagdbc ecagf bcf afcebg cb bfgaedc | fcgdba agbecf fcgeba fgdceab
|
||||
afgbc be cbeaf gfeb ebcdfag cfdbag cdfae cfegba cbeagd abe | gdecbaf cagfb bfgaec cabfdge
|
||||
eb egdb dcagb abe gcdabe agbce dgabcf fedbca fdcebag gfeca | gdbe agdcb gfcae cgadbf
|
||||
dbagc bcaedfg gade cadeb efgabc cabedg gca fgdbc ecafdb ag | dage cagdb dgcaeb cdgab
|
||||
gbecd eacdg cgb egacdbf gfdbec efbg bfced bg bdfcea bafgdc | acbfde bg gb gb
|
||||
fgbadc fbdag dbecg fbae dacgef ega ae afcbged ebgfad bgaed | ae bacfgd bfea agdbef
|
||||
dacfeg gecfd ad gadbfe gadbfec gda acde fcedgb acbfg fdcag | gefcd cdegf agd ad
|
||||
caegbd cfdeba edbac cfbegad fe fbea fdagc cef acdef bedgcf | ef cdafgeb fce edfca
|
||||
dgcae cedbfag facbdg fdc eacdbf bfegda dfcae fdbae cf cfeb | cf febgcda dfc cdf
|
||||
edfag dbeacg dbecafg agc gcefa gc bcfea cdfg fbdgae gefadc | dfacge fagbecd feacbdg bfaged
|
||||
abefdg fgdec ecadf efcdab ac dbeaf acdb acf cdegfab gecbfa | fca fdbega decaf cgafdeb
|
||||
bceafd fegcad edcagbf dbcage decba bafd df fcd bcfge cbfed | ebgfc eacbdf gadebc df
|
||||
egba cgdafbe begfc gacdfb dceaf cefbdg gfa ag gcebaf aecfg | acbgfd gabe fbgeac agfec
|
||||
cdgeb fdecag agdbefc gefbac cdaf ade fegdab cgead ad caefg | ecbgdaf dgceb cfgae dea
|
||||
cafbde fbgac edcg agdfeb eg dacgef fgcea aefdc dceagfb eag | afgec fbcga ceafgd bgceadf
|
||||
cefbg ceabd gd edbacgf aedfbc gaedcb cdbeg abfdcg gdc gead | cgd dgea gd cebad
|
||||
fadbg dagecf fea fbecga adce ae bedfcg egacbdf fdgec fdage | dcae caed dbefcg adgfb
|
||||
acged aec efgdcb ac fagc abdge abfdegc fdeacg cfaedb gedfc | egbcafd gaefcdb cae cagdfe
|
||||
fcbdage bafgec cab fcbae ac abdegf dbfec fbgae eagc cbfadg | acb dafegb acb bfeagdc
|
||||
af egfda gebdf gebdfa aefcdbg fbecda fgba daf cdeag dgbcfe | eagdc cefbgda daf daf
|
||||
dgebcf gcf agcbd fbecd fbcdg ebacgf aebfcd fdeg fegdabc fg | dacgb dfge fcdbe gedf
|
||||
bfacdg gafcb gefbd cd dgcfb dagc bdfagec bceadf fagceb bdc | begfd gbdfe afgcdbe fbeacgd
|
||||
bagf afe bdcaeg fdcbe af dafbe cbedgaf gfebad gdaeb aefcdg | baedcgf fa af cgadbef
|
||||
acdgf becgfa acd cagbf agcdbe fdba da bdcfag gfdec dcgafeb | bagfc da dca fdbacg
|
||||
cdabfe adbfc ecbaf cdae cdbfge dabgfc bfgae bec ce gadcbef | faecbd beadcfg dcae cgfedab
|
||||
bceag agd aced gdbafce bcfgae agdeb ad fabdcg fdbge egcbad | gaceb agd bdagec da
|
||||
cag dfgbeac ecdbgf ag gfabc ebag fabgec deafgc adcfb fcegb | dgaecf aebg bgea dcbfa
|
||||
afdb degbc agedcf da aed beacfg dgfecba efcab bdface cbdea | fbeca aecbd gdecaf ade
|
||||
cafebg afedcb gfeabcd fgcb cfa afdeg fc ecgab dacebg cfeag | bcgf bgcae gdfea bgcf
|
||||
feg gfcaed cfabdge gf degafb fdegc edfcab edgbc agcf cfade | gf gf gacf egf
|
||||
ceadf ecdgf eacbd cebagd dcabfge eaf fdceab fbad fgebca af | cefadb cefad bfad abedc
|
||||
gefabd cabdfeg dgceab dagef bdfacg egfdc edgab af feba fda | geadcb dagfceb fda af
|
||||
dfcea adgce dfebc gecfdba fadgbe dcefga cfga aebcdg efa fa | fa fae af gaedbf
|
||||
agbfd acbgedf faecb cegbad dgabfe gbc fcdg cfagb gc afdbgc | cg cg dfgbae cdfg
|
||||
efg bfacg feab efcagd fe bcagedf edgbc ebgcf afbegc bcfgda | dgecfa ef fgcba efba
|
||||
aebfdc bcfage dgbacf gface gbaecfd dfgce geab acfbg ea eac | cabfg ea cfagb eagb
|
||||
gba gdcea cdbfg acgdb gbecadf bfgecd dgcfab abfc ba fdeagb | ab febagdc dfgbac fdagcb
|
||||
dfcb gcebd dfgaec efdgc eagcb dfaebg afedcbg gbd gbcfde bd | gadebfc db febdga bgd
|
||||
eabd adcbg ceafg ecb be eacdbg acegb gbfcde adgcbf ecfdgba | cgfebad cbe ebacg dfgceb
|
||||
cefbgd cgdfa bagfced dabe fgceab abfeg gdbaef gbfad db gdb | aefdgb bd abdfegc fgabed
|
||||
100
2021/inputs/09.txt
Normal file
100
2021/inputs/09.txt
Normal file
@@ -0,0 +1,100 @@
|
||||
9899899864598765321239999546794323489012356910136789234678999765986432109874349897678921298754345856
|
||||
8798788978989899992398798932986734678943869872345679129789999843497643298765456789568910129983236745
|
||||
7676567899976998789977587891297945789654699964557789298999987932599954399897897893457891239765101234
|
||||
6545459789765497679765476789349657898765789985668999987899876893989876988998998932378932349874323457
|
||||
6435345678987984568974345678998998999997893596779789876789765689878989877569789949989864556995434567
|
||||
4323234799999876789743234789997899990199952129895698975678934599769998966445679897899876769876546789
|
||||
3210125899989987897654348999876789989987641016954987654699545678958986543234598786788989895989657899
|
||||
4391434989878999998776567898765434878999832345693198766789956799346995432123987655677899934598978978
|
||||
5989549876567899899987898997654323459876546598789239979899897890239876543099878434566789545987899769
|
||||
9878998765456789788798999998765434568997687678898945989999789994345987654987654312345689656976793244
|
||||
9767989654345897652649999899876685678998798899987899995697679879959998765699873201239798769865692123
|
||||
8656976543234789341234987676987899899219999912345678934987599767898999978798765412345689898764789045
|
||||
9947987654375693210359876565499999931929898924569789875699987659946792499899886643459898999893492123
|
||||
9858998765466789391398765454346789649898767895798999997893987548937921398965998754567987897632459234
|
||||
8769879876879899989989764321234698798789656896897689889902998437898943497994339867899986796543678945
|
||||
9897765989989999867879865430126789987654546789989549778919876545999654986789123979999765689954567956
|
||||
9976544393499987853467954321245678998793235678965434567924998656998965987991094989998654578899778998
|
||||
9999932239599876542346986434358789899986545689876545679895698787897896799432989999987943348799889999
|
||||
8987890198989987621234976565469896799998676896987656996789789898956789898549878909876821234589997891
|
||||
7896991987678998210123989679578935678999787965498899875678999989545789987699868912985310345678956932
|
||||
6545689998899879321234598798689323489899898978309987664567899975434699998989957899976431458999349893
|
||||
5434578999998765442456679899799912398789959793212986543446798766323578949879898998997643467921236789
|
||||
4323467899989887663567889979899893987664234689323985431234579654212349939765789987698754567890945699
|
||||
3214347999876998898779998765998789998543123456939876420256689799903467897654579876569866678999899789
|
||||
4301236897654459989899659984345678987655234597899987834569798987894979996543456987456978789298798999
|
||||
3213345789542345678978939873234789398976349989999998945678987676569899987632169876345989892197696989
|
||||
5624567899643456789568998764566991299987898767998999987989986543456789198721098765456799943987575878
|
||||
5438678978954567895478679875678992989998939654767899999899976432345899239433679899587899656943434567
|
||||
6648789367896788901234567987789889879899029953459987899769865431235678945954567998679978969832123458
|
||||
9859895456789899212349678999898776768799998764567896988998765610123479959895979989989967898751012345
|
||||
9967997667899954324568989789999654356679879985778934567899654321234567896789898978997856987632123456
|
||||
9878998789999876535679495698998743244598965797899323456998767434345798965698767869896549876543478567
|
||||
2989899899999987646789323457987653123697854698965414568959876545756799454987655456789659987754569678
|
||||
1095798998989899756793212568999761019986543569876501278945987767867895323986542345678978998978678899
|
||||
2124567897679789868965425799999832198765432479987612378929898989978976568997721239899989539989789999
|
||||
3236678998554678979996934989987543239874321389998724567998769694989989679999843345789894312999895689
|
||||
4545699965433459989989899976797654647989433479999837678909654543295798797899756789898765109876954799
|
||||
5666789876212567899876798765698987656897654567892948789219763210134569896798767991949966212965432878
|
||||
9877899998434678998555679954459898768998765789910959898923987321949698965329878910123954329896421267
|
||||
5989999997565789997434567892346789878919878894329878987894596439898997643201989543239865498765432349
|
||||
4399998998776899876723478921234567989329989999456989656789989598797689764312399654345986569989643578
|
||||
1299897679897939765434589210565699995498797998968996546789679987654578975323478965696798679698754689
|
||||
2989788567998929876547895342456988976987656877989965432433567976543459987634569996989899889579965691
|
||||
9976543456899998987656789756769876799876546766899876541012456798952348998545678989878954993499876792
|
||||
8765432337899987698767899897898765689985432345789987632323577899891276789789989878767893212988989893
|
||||
9875430123789976569898945989999854578997643487892398743439688998789345689899998765456789329776598954
|
||||
9965321934567895452959999878987543567898797698990129965998999987678956789998987654349899998665456895
|
||||
9875439899998954321234988768987654678999898979789249879867899876598967899987598985269989876542347896
|
||||
6986598798789865632459876543298765889899989563678956998756998765456978999876459876378978965431238987
|
||||
5597989587678978643598995432139876998798765472489767987645797654327899998764323987889769896670123598
|
||||
4459965454597897659987689321025987998679977321238989998434589765458954987643212498997656795431245789
|
||||
2398854323456989798776567992134699876468893210137999987514678976579763296543101359894245695432356897
|
||||
1987643412345678939654467689657899884245789543236789987623569989697654197653212346792136789565456795
|
||||
2498532101246989549743234578968998762136898654345698765434678999789765298894343478891017899877567896
|
||||
3987643212397999959832175999878999754547899865466789987545789567996978349965454567892128998987688987
|
||||
4998784323498999899943567899989398767898999989877995998766893459545989459876565678943469876898999798
|
||||
9859897654679987799654678967895459898919498694989234889877965667934696567989876789656778965569899659
|
||||
8743998767899866698769899345989969999902397543992125679989878799323597689999987898767889654398788945
|
||||
9632349878998754569889943239879898997893598679875234567897999989434698799989698989898999965235667896
|
||||
6531267989989986678997632198767767896789989789994345789976567978965699899978559678999987892123456789
|
||||
7545459899878998789898543986553656789899879897989976789987699869998789998765432568990196789014567891
|
||||
7656797658768899894698754965432348999998765956978987998798987658789892399986543479989985698925678992
|
||||
8769989545656789923999869876521234689998754349869898997679799645679901989987756569876674567896999989
|
||||
9898978934345679899897998765420127899976543209655789876567697536796899878999867898985543456789878978
|
||||
9997657921234698789656789876431236789898754498743678975434598987895679767899879987654102345678966466
|
||||
8987546892945987678945678987654345698789865999654569876545679799934698654568992976543212456789854345
|
||||
7895435789896976567998789998765456789679979898785678997697989689996789763499201987954323589898763234
|
||||
6796576798789895456899899989876577894578998789876899789989993498989899852178919998765454678997654346
|
||||
5987678987676789345901939876987689923489987654987987698778921397878989943267898999986869789039766467
|
||||
4599999876575689234899029965499897634590976543499996545567892986565679894356997896897999892123978578
|
||||
3459898765434590135678998764345976545692985432459896532346979875434598789459876785698989993239899989
|
||||
2599749854325679246999569878967989656789987653498789431234567994323987689998765834569878989398789992
|
||||
1987630965434994356789479989878998787896599765987678932345679765509876567899954323498769878987678891
|
||||
9999521398946789969892398995989999898965439899876567894467989876798765458998763214987654567898546789
|
||||
8998432987656899899901987854699987999654323934985458965678999987987654367959984523986543456789434899
|
||||
7987674598967958789319876543598996598743209129994346899899019998998765488945965439876431345678924997
|
||||
5499789679878945689498765432387897679654998998789235679999198999879896569239876567989642456789213456
|
||||
9329898789989235578999878541266799998769876987698945791098987898965987892123987678998753768995101234
|
||||
8910959895490123467899999320145987899898765976587997892397596987654998999934999789989967989654312689
|
||||
7892345986321434678978989431239986989987654989456789989996465698789869898899889898879878998765424578
|
||||
6996456795432375679767978932398895878996432198568999878789324249898756797765678987666989129987435699
|
||||
5979677986545699897659867893987674567987643987678968965679210136999645975654457896544598998976546989
|
||||
4367999987656988976543956895698543467998754599889757894568921245695439984323298989323567897987659878
|
||||
3246798998789867897432348986987674578979895789997645953457999356976698793210129678912378976498798767
|
||||
2124687899898756789321467999898765689357987899898756892345678968998997654323234567924459765349987656
|
||||
1012456923987645995436578987789876791268998989769878954596789989459898969864347979895689921234596545
|
||||
2423677899999766898656679876565987892379129678945989965678992191298769798765456798789789890145985434
|
||||
7634988998919878998787899985434598943468934589959999876899321019497653669986599987678998789959876515
|
||||
8795999687909989999998999875323459976567896799898921989987432198976442456797987876589998679899987601
|
||||
9989896545798998989659298765435678997878987899767899898976543987664321345679976565456895466789998312
|
||||
9878789434567897878943019876546899898989098987656965787987674976543210146798765434345689345679876543
|
||||
9965678923456996567932129987656998779692199998767893656899895698956343234999875323239791236799987654
|
||||
9876799544799987459543298598998999657569987999898912345678976989765464349878974210178943478989899785
|
||||
0999898765678942378954997459679996545498876891959101234567899878999878498769865323367894569876799876
|
||||
1298999898799865489769876323589989432397545790943212345678998967889989998659876554459965679965587997
|
||||
2997899939894987999878965104678978921239834899865623456789987654378999867543987678767897898743456898
|
||||
9876789921923999899999874324989867890398765689976784568891298763254987658902398789879998987652345999
|
||||
7665567890199895679765965449898756789459876789987896878932459542123496543212479893989459876541256899
|
||||
8543458932987684567964987598765435678968997895398987989656899643234569854324569912995312997632345789
|
||||
7652369543498543678932197679886545799878998943219998999768998754545698765537678929876109876543467899
|
||||
102
2021/inputs/10.txt
Normal file
102
2021/inputs/10.txt
Normal file
@@ -0,0 +1,102 @@
|
||||
[(<[(({{<{{[{({})}{<{}{}><()<>>}]}[{[({}{})]([{}()](<>{}))}[<<[]()]>[<[]<>>{[]()}]]]}{[[[{[][]}{[]()}]
|
||||
(<<{((({<(<{([()[]]<[]<>>)}>({[{<>()}]<[<>()]({}())>})){{[(<<><>>{<>()})<{[]{}}>][{[[]()]<[]()>}
|
||||
{({([({[[([<{(())([][])}<(<>())[[][]]>>{{{{}{}}{<>{}}}({{}<>}<<>()>)}]<<((<><>))<<[]>((){})>>[<{{}{}}
|
||||
(<[{{{[[[<[[[([]<>)]{{()()}<()()>}][({()<>}(()()))[<[][]>[[]<>]]]]([{[(){}]}(<[]{}>{{}()))]<
|
||||
{(<<({<{<<[[<[[]{}]>]<[<{}{}>[{}[]]]{[<>{})({})}>]><([[{(){}}{()[]}]])>><{({<[{}()]<{}[]>>(<
|
||||
<<[[<<[({[<[{{[]()}[()()]}[<{}{}>[<>]]]><[[(<>[])]]{{{{}<>}[{}()]}{<()>[{}[]]}}>](({<((){}
|
||||
<{[[((<{{[[(([(){}][()<>]))[(<()()>[[]<>]){[(){}][()[]]}]]]<([<[{}{}]([]<>)><<{}<>>{{}{}}>]<({[]{}}[{}{}]
|
||||
<<<{<[[[[([<([[]<>])[[<>{}][[]<>]]>{{[{}{}]}[[[]()]]}][[<((){})<[]<>>>]<{[(){}][[]<>]}<<[][]](()())>>]){<((
|
||||
[<{{({<<[{{<<(()())[{}[]]>{[<>{}]<[]<>>}>{[([]<>)[{}<>]](({}<>)[(){}])}}}[[(<{()}{<>()}>)<{<{}{}>([
|
||||
<{<[{[[<[({{[[{}[]][()()>]((<><>)[[]{}])}{({{}{}}[()])<{<>{}}(<>[])>}}<<(<<>[]>[()])>>)]({{[([<>])(<{}[]>{
|
||||
(({<{<{[[([<<{{}{}}>(<<>{}><()()>)>]{{(<{}>{{}[]})}(<([][]][<>[]]>{{<>{}}[<><>]})})(<[{{<>()}({}{})}{{{}[]}{<
|
||||
{{[<<{{(({{{<{<>{}}{[]{}}>[<[]{}>{()()})}}(<({[]()}[()<>])[{<>()}<[]()>]>[[[{}[]][<>{}]]<{<
|
||||
{{{<<<[(<[({([()()]))[<[()<>]{()()}>((()[])([]()))])][([<{{}()}<[]<>>>](([<>]<<>{}>){({}<>){[]<>
|
||||
<<({{[([{{<[[<()()>{(){}}]{{()<>}[(){}]}]{[({}{})([]<>)]}>(<([{}()](()[]))({<>()}<<>[]>)>[<[()<>]<
|
||||
{(<{{([{<{<(<({}{})([]())>)>{[{{{}[]}(<>{})}{([])<{}<>>}]<{<{}()><()[]>}<{[]{}}<[]>>>>}>}<(<<([
|
||||
([([(<{<[(<[{<<><>>(()<>)}(([]{}))][<(<>{})<{}>>{[()[]](<><>)}]>[[[{[]{}}[[]{}]]]<{[()[]]}[[{}{}]<<><>>]>])
|
||||
{<<({({{{[({[[<>[]]({}())]{[{}()]}}({[()()]{[]<>}}((()<>)<[]{}>))){[{{{}()}{{}()}}]}]}<<<[[<[]()>][
|
||||
{{[[[{<<[(([{[<>{}]<<><>>}{{<>}{[]<>}}]<[<<>[]>({}{})]>)({<{()()}>{{()[]}({}())}})}]<([{[<[][]>{()[]}]}]
|
||||
(<<[<[[[<{{[{{()}[{}[]]}[<{}<>>{[]{}}]]{{[()[]]<(){}>}}}(((<{}{}>{()()}))[<{<>()}{()<>}><[
|
||||
[[{[<([([<<[[[()()]{()<>}]({<>{}}[<>[]])]>(<([<>()]<()<>>)[[{}()]]>)>])]){({{{[{<({}[]){[]()}><<[
|
||||
(<[<[(([({{[({<>[]}[<>[]])[([]{})[<>[]]]]([<{}}[{}<>]][(()()){{}()}])}([<({}())[[]<>]>([[]{}]
|
||||
{([[((<(<([{([<>[]]{()})[(()[])]}])(<[<{{}()}>]>)>)>)){{{<<[<[<(<><>){<>[]}>[[<>{}]]]({<<>{}>
|
||||
<<(((({<<[{([({}{})[<>()]]<<(){}>({})>)}{<<{[]{}}{<><>}><{<>{}}[()[]]>}<(([][])(<>[]))<[<>[
|
||||
{{{[{[[([({{{<{}{}>{()}}((()[]]<<>{}>)}}<[{[{}[]]<<>[]>}{[{}[]][()<>]}]<<({}[]){()()}><{<>{}}(<>[]
|
||||
[[([(([({<[<([<>()][[]()])>{{<[]{}>[<>()]>[([]{})<(){}>]}]({[(()<>){{}()}]}<{(<><>)({}{})}{[[]<>]{{}()}}>
|
||||
(<{([{{([<{<<<<>[]><[]()>>[(()[])[<>()]]>{({()<>}{(){}})<<{}<>>{<>{}}>}}[[{<{}()>}<(()<>)[()<>]>]{[[<>
|
||||
<[[{({[<<<{{<[<>{}]({}<>)>(<()[]><[]>)}(<{{}()}<{}{}>>{{()}<[][]>})}[{({[]{}}(()[]))<[[]{}][[]{}]>}<{{<>{
|
||||
{({[[<{<([<((({}{})[{}{}])){{[()<>]<<>()>}[(<><>){[]}]}><<<<()<>>(()<>)>>[{([]){<>{}}}]>]){({{[{{}
|
||||
(<<[{[<<({<{<[<>[]][{}<>]>([{}<>]<<>()>)}{(<{}{}>{{}()})<([])>}>{(({[]())(<>[])){[[]<>][<><>]}
|
||||
[({(((<(<<{({<()()>({}()>}((<>[])[[]]))}>{<(<({}<>)([]())>[{()<>}<<>>])<<([])<[]()>>{(<>{})[<>{}]}>>[[
|
||||
<<{[(({<<{[{{<<>()>{<>{}}}({[]}{()})}][<[[[]()]]<<{}{}}[<>()]>>]}[<(([{}{}]<()<>>){{()<>}[[]<>]})<{<[
|
||||
(<[[{{{<<(<<[<()[]>(()[])]<[()()]([][])>><{({}<>)[<><>]}>><[(({}){[][]})((()()))]>){{<[([]<>)[<><>]
|
||||
[[[[<[<[[[<(([<>{}]<<>()>)(<<>()>{{}{}}))[([()()]([]<>))]>(<[([]())<[]<>>]{<{}{}>{{}{}}}){(<()[]
|
||||
{[<(<[[<{<{[{({}[])[<>{}]}<[()<>]>][(<{}<>>(()[])){{()()}<()[]>}]}[<[(()[])]({{}{}}(<>{}))>]>}<{{[{([]{})<(){
|
||||
(<[{{{{{{[{[{(<><>)({}<>)}[(()[]){<>[]}]]}[{([{}<>])}]]}((([{[[]][[]{}]}({<>()}[()[]])][({[
|
||||
(<<<<[[{{<<((<{}()>[<><>]))<[<<><>>([][])]<{{}<>}([]<>)>}>{{[(<><>){<>{}}]{<<>()>(()())}}[<[<><>]{{}
|
||||
{({[[<({<{[[[[[]<>](<>{})]((<>{})<[]()>)]([<()[]>({}<>)][[[]{}>[{}()]])]{({<[][]><[]()>}<(<>{})>)((({})
|
||||
{[([[{<<[{<<[<()()>[{}[]]]>{(({}{})([]<>))[[{}()][()<>]]}>[<(([][])){[{}{}][{}{}]}>{{<(){}>([]<>)}
|
||||
([{<{{{(<[{[{{[]}[()<>]}(<[]{}>{()<>})][(<[]><{}<>>)<([]{})(<>[])>]}][[{[<[]{}>][[<>[]]{<>[]}]}<((()[])(
|
||||
<(({{<<[[<<[[(<>[]){[][]}]{({}())(()<>)}]{({{}<>})}><([<<>()><{}[]>][[<>{}]({}())])[(([][])({}<
|
||||
[<<{{{[[[((<{([][])<<>()>}((<><>)([]{}))>))[<(<[<>()]><([][])<<><>>>)>[[<<{}{}>(<><>)><{[]{}}>}{({
|
||||
<<{<<[[[(((({{[][]}[{}[]]}(<<>{}><{}<>>))[(([]<>)<()[]>)<[<><>]>]))<<(<<<>{}>>{(<>[])})<[<<
|
||||
[<<{({{<[<[<<({}[])(<><>)>(([]{})([]<>))>]>]{[(<<{(){}}[[]<>]>>){([<{}()>[()()]](([]())[<><>]))
|
||||
{({<[<[{(<{[([[]<>]{<>})<{<>[]}([])>]}<{((<>[])[{}[]}){{{}{}}<[]<>>}}<{[[]{}](()[])}<(()())
|
||||
(({{<{<[[(<[([<>()][[]()])<({}<>)(()())>]{<<<>[]>{(){}}>}>([{({}())}{<[]>(())}]{<<[][]>({}[])>}))]
|
||||
{{<{{(<[[[{<<<[][]><{}[]>><(())[{}[]]>>}][<(([[][]][<>{}])(<[][]>)){{([][])<{}{}>}[[[]{}]{[
|
||||
[([{<[[<[{([{<[]{}>(<>{})}]<{[[]()]}[<()<>>]>)}][([[[([])<<>()>]{<{}<>>[()<>]}}((<{}{}>(()<>))(<{}
|
||||
([<{(<({((<{<{()[]]{[]<>}>(<[][]>(()<>))}{<[()[]](()())>{([][])<<>>}}>))(<[(({[]()}(()[]))([(){}]{<>
|
||||
([{{[{(<[((<<[[]()](()())>{<{}()}{[]}}>{(({}<>))<<<>{}>[{}()]>})[[((<>)<[]<>>)([()()]{<>{}})]<{[(){}]{[
|
||||
<[<[<[[[({{{[[()<>]([]())]}}{({[()()]}{{<>[]}<<>{}>})[[{[]()}[{}{}]][{<>()}<{}{}>])}})<<{([{()[]}<[]
|
||||
<([[<{<<{(<(<{[]}[{}()]>({()}{<>()})){{[[]()](<>[])}(<{}{}>(<><>))}><{{{(){}}<<><>>}}>){(([[()<>]<<><>
|
||||
{(([(<[<{[[<{(()[])[{}<>]}<<{}()>>>([({}<>){<>{}}]([()[]]{{}()}))]({[[[][]]]})]}>][({[{<<([]<>){()<>}>({<><
|
||||
([<(((<[<({<[({}{})((){})]{{()<>}<[]<>>}>{[{()[]}<<><>>]({{}<>}[[]<>])}})[[{([[][]](()[]))({()[]})}((((
|
||||
{<[{[(([<(<{<[<>{}]>[((){})({}())]}{(<(){}>{[]<>})([()<>](()<>})}>[(<{[][]}{<>[]}>[<[]<>><<
|
||||
[<<{((<(<((<<{[]<>}{[]<>}>{[<><>](()())}>{([<><>])[([]{})(<>[])]))(<<{[][]}{{}()}>[<<>{}>{{}{}}]><[({}{
|
||||
(<([((({{([[<<{}()><()[]>>[{()<>}{{}{}}]]{<({}{})[[]<>]>{(()[]){<>}}}][{{({}{})}<([]<>)<()[]>>
|
||||
({([[<<[[[[([<()()>{{}<>}]({{}[]}))]<{(<(){}>[()()])}>]{{<([<><>]{[]{}})<<{}<>>[()<>]>>}{[
|
||||
<({{(<<((<<(<({}{})<{}()>>{{<>}})([[{}()]{{}()}][<<><>>])><{[<[]()>[()()]]<([]())>}>>[<<<{()}<
|
||||
[[[(<((({{{{<{[][]}{<>{}}><{[]{}}<()[]>>}<([{}{}]{{}<>})>}<({[[]<>][[]<>]}[[()<>]<(){}>])>}{{(
|
||||
(<<{({[{({[{(([]<>)({}[])}[<(){}>]}]})}][({(<<{(()())}[<(){}>(()[])]><({<>{}}<()()>){<[][]>[(){}]}>>
|
||||
([({{{{{([{[{([][])<[][]>}<{()<>}<{}<>>>]}{[{([][])}<<()()>[{}[]]>]{<[[][]]{[]<>}>}}]<[(<<[]<
|
||||
[([<({(<({[<{[{}<>]}>{[(()<>){<>()}]}](([([])[<>{}]])<[[()()]{[]}](((){}]{[]{}})>)}[<[<{<>[]
|
||||
[({<[(<<{<[{[[(){}]<<><>>][<(){}>[{}[]]]}(({{}()}<[]<>>){([]()){{}()}})]><<(<<<>[]>{<>}>(({}()){<>()}))[[(<
|
||||
{{{{<{{<<{[<([()[]][{}[]])[{<>{}}[(){}])><((()[]){()[]})[[{}[]](()<>)]>]}>>}}>{{[[{<(<(({}<>)[<>()]){[
|
||||
([<{[<<[{({([<(){}>([])][(()<>)<<>()>])}{[([[][]]{{}()})<[{}]({}<>]>](([[]()]<{}<>>){<{}()>[[]()]})})[<
|
||||
<((<{({[<(<(<<{}<>>{[]()}><<()<>>([][])>){<<[]{}>{<>[]}>{[<>[]][()()]}}>(({{()}{()<>}}({[]<>}(<>{})))
|
||||
<[(<{{{<[(([{{[]<>}{{}()}}<[<><>]<<>[]>>]({((){})}))<(([<>()]<[][]>)(<()<>>([]<>)))>)]>[[[[[{[
|
||||
(({{(([{{((<{<<><>><{}<>}}{{{}{}}{[]()}}>[[(<>[])[{}{}]]{<()[]>[[]{}]}])){{{{{()<>}<<><>>}{<[]<>>[[]<>]
|
||||
(<{(((<<(({{{{[]()}}<<()()>{[]>>}[<{<>{}}{<><>}><{{}()}({}<>)>]}))(([((<(){}>({}()))<{<><>}<[]()>>)<(
|
||||
<[[<[(<<{((<[<[]()>([]<>)]{(<>[])[<>()]}>[<(()<>){[]()}>{{[]<>}([][])}])[<(([]<>){<>()})([{}()]<[]{}>)>({
|
||||
<<[[({<<({<{[({}[])<()<>>][[(){}]{[]()}]}[{<(){}>[<>[]]}{(<>[]>({}<>)}]><<([[]<>]({}))<{[]{}}(<><>
|
||||
<(({([<<(({[{[[]<>]({}())}[{<><>}[[]()]]][(<{}()>)[{{}{}}[{}{}]]]}<{(<()<>>{()<>})<[()[]][{}{}]>}[[(<>[])
|
||||
[<{<({{(({(<[{(){}})(<<>()><<>()>)>)<{<({}<>)[{}[]]>(<()()>(<><>))}{([<>[]][()<>])[{[]()}{[]}]}>}))<(
|
||||
[<{<[[(<([<[<<{}<>>>{[<>[]]({}())}>{[(<>{})[(){}]]{[<>[]]}}>][{<{<[]()>{{}{}}}[[[]<>]<(){}>]>([<<><>>[{}{}
|
||||
<<(({[<<{<([[{[]()}{<>()}]<[[][]]>][(((){}){<>{}})([{}()]<[]<>>)])>}>([[<<(<[]<>><()()>)<[()(
|
||||
{<({[{<<<{[({<()[]>}[<<>()>[(){}]])<[(<>())<[][]>](<[]()>[{}<>])>]((<(<>{}){<>{}}>{{[]()}([])})[<{{}
|
||||
[<([(<[{(<([<(<>[])[()()]>{[()<>][<><>]}]<[{{}[])]((<>())[[][]])>)>({(({<><>}({}[]))<{{}<>}([]<>)>)
|
||||
{<[[({<[([{<{({}()){{}{}>}>{{[()[]]}[(<>[])<{}()>]}}])[[<(([<>]<{}<>>)([{}]{<>}))<({<><>}([]<>))<[<>[]][
|
||||
{(<[[([[([{{[((){})(()<>)]}}[<(([]<>){{}{}})>{<[[]{}]{()()}>({{}()}[<>])}]][[(<[[]<>]<<><>>>
|
||||
<{[<{{((<({{{[()[]]([]<>)}({{}<>}<{}()>)}(((()<>)[[]{}])[([]<>)<{}()>])]([[<()[]><<>()>]]<{{[][]}[[]]}>))>)<<
|
||||
{([([<<((([(<([]<>){[][]}><{[]()}<<>{}>>)(<[<>()]([]<>)>[[[][]]<<>()>])]))(((<{<[]()><()<>>}([[]][()[]])>)<(
|
||||
{<[(<<((<<({{[{}[]][<>[]]}[{{}<>}((){})]}<([()<>][{}[]])<{<>[]}({}())>>)(<[<(){}>]{{()[]}<()()>}>(<<()[]>
|
||||
<(<{[({{<<{[({<>()}{<><>})(<{}{}>(<><>))]{<<{}<>>({}{})>}}[({(<>{})({}{})}{<{}{}><{}{}>})]}[<(
|
||||
{<[([<(([([<(<()[]>(<>[]))[[()][<>()]]>[[{{}{}}(()())][<(){}><{}<>>]]]<((<()>((){}))<{{}{}}
|
||||
((({{(({{[<[<{<>}<[]{}>>{([]{})<{}<>>}](<{<>{}}<<>()>><{(){}}[[]()]>)>({<([][]}<<>{}>><<{}()><{}{}>>}
|
||||
[([{[<[[({[(<{<>[]}[{}[]]>(({}[]}{[]<>}))[<{<>{}}{<>()}>(([]<>))]][<(([])<{}()>)[<{}<>>{[]<
|
||||
([<{(<[<[{([<[()[]]<()<>>>]{[{[]{}}<<>()>]}){[[[<><>][<>[]]]<({}[])<[]()>>](([[][]]<{}()>)[[<>{}]{()[]}])}}{
|
||||
[[[([{{(({<[[<<>{}>(<>())][((){})]]]{((<()<>>{[][]})((<>())(()<>))){<<<><>>(<>[])>}}}(({<([]
|
||||
({{[(([<(<([<{(){}}({}())><[{}<>]>]{(<<>{}><(){}>)})>){[<[<(()()}[<>{}]>((<><>)<<>()>)][([{}{}]){(<>[])[[
|
||||
{([{((({(((([(()<>){[]()}](<{}[]>[{}{}]))<((()()){{}{}})[<[]()>]>)[((<<>[]>[()[]])(<{}<>><<
|
||||
([[{[[[{<{[{{([]<>){()[]}}}]{({(()<>)({}{})}[<{}()>{[]{}}])<{[<>{}]}>}}>}]]]{<[({(<[<([]()){
|
||||
((({[<<<{{(([({}<>)<[]<>>][{{}{}}])){([[()<>]]({(){}}[<><>]))((<()()>[{}<>]){{()<>}(()[])})}}<({((
|
||||
<<<(<{(<([<{[[{}{}]]<{(){}}({}())>}[<<{}()><{}{}>><(()()){()<>}>]>]]>{<[([<<()<>>((){})>][[[()[]]<{}[]>]<(<>{
|
||||
([{<[[[[[[{(<<()<>>([][]>>)({{()[]}<[][]>}((()()){()[]}))}((([{}<>]([]<>)){<<>()>{[][]}}))]<<[[[[]()][[][]]
|
||||
{<<[[{{[([<<<{()<>}>[((){}){[]{}}]><({<>[]}[{}])([[][]]({}{}))>>[(([[]<>]){<()<>>[<>{}]}){<<(){}>({}{})>[{
|
||||
<{(<(<([(<<([<[]<>>(<>{})][([]())<[][]>])([[<>()](()[])])>({(<{}<>>([][]))}[{[[][]]{(){}]}]
|
||||
{[({{{[([{<((({}()){(){}})((<>[]){<>{}}))<<([][]){{}[]})[{{}{}}{{}[]}]>>}[{[[[<>[]]([]{})]<[{}()]<<><>>>](<((
|
||||
[[{[(({<[[[({((){})<()<>>}{{<>{}}[()()]}){[([]{})([]<>)][{{}}<<>()>])][{([{}<>]({}())){([]{}){
|
||||
((<[{(({<{<(((<>)<{}[]>)([<>[]]{()()}))>}>}[[<[{({[]{}}{[][]})}(<{{}[]}(()[])>(({}()){<>[]}))]<<([{}][()[]])>
|
||||
<(({<[[<{{<<<[{}{}]{(){}}>{<()<>>[<>{}]}>>}[[{[([][])(()())]<[()<>]>}{<<(){}>[()[]]>([[]<>]<[][]>)}][{
|
||||
<{((<({{({<<{([]<>]{<><>}}((<>[]){<><>})>>{<{[{}{}][<>[]]}>({{<><>}[[]]}<{(){}}[<>{}]>)}})}})<((<{[(<<()(
|
||||
[(({({{([([{{<[]<>>([][])}<[()<>]>}{(({}())[<>()])}]<({{{}{}}}({{}<>}<[]{}>))>)(<[[<()>((){})]
|
||||
10
2021/inputs/11.txt
Normal file
10
2021/inputs/11.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
5651341452
|
||||
1381541252
|
||||
1878435224
|
||||
6814831535
|
||||
3883547383
|
||||
6473548464
|
||||
1885833658
|
||||
3732584752
|
||||
1881546128
|
||||
5121717776
|
||||
19
2021/inputs/12.txt
Normal file
19
2021/inputs/12.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
lg-GW
|
||||
pt-start
|
||||
pt-uq
|
||||
nx-lg
|
||||
ve-GW
|
||||
start-nx
|
||||
GW-start
|
||||
GW-nx
|
||||
pt-SM
|
||||
sx-GW
|
||||
lg-end
|
||||
nx-SM
|
||||
lg-SM
|
||||
pt-nx
|
||||
end-ve
|
||||
ve-SM
|
||||
TG-uq
|
||||
end-SM
|
||||
SM-uq
|
||||
894
2021/inputs/13.txt
Normal file
894
2021/inputs/13.txt
Normal file
@@ -0,0 +1,894 @@
|
||||
899,112
|
||||
477,249
|
||||
462,60
|
||||
49,299
|
||||
1097,819
|
||||
890,74
|
||||
477,231
|
||||
1242,464
|
||||
57,641
|
||||
833,471
|
||||
1292,784
|
||||
1232,717
|
||||
898,227
|
||||
442,749
|
||||
893,116
|
||||
395,423
|
||||
1304,695
|
||||
211,186
|
||||
1097,243
|
||||
1004,46
|
||||
654,361
|
||||
1044,784
|
||||
745,284
|
||||
376,637
|
||||
634,737
|
||||
509,369
|
||||
242,395
|
||||
199,442
|
||||
397,170
|
||||
634,94
|
||||
954,15
|
||||
1019,219
|
||||
798,782
|
||||
340,262
|
||||
1299,598
|
||||
1133,23
|
||||
967,5
|
||||
291,675
|
||||
519,119
|
||||
97,698
|
||||
291,107
|
||||
301,592
|
||||
505,537
|
||||
1280,780
|
||||
340,632
|
||||
919,588
|
||||
733,884
|
||||
166,577
|
||||
530,840
|
||||
1197,187
|
||||
1004,605
|
||||
244,668
|
||||
38,368
|
||||
1241,170
|
||||
1161,199
|
||||
597,701
|
||||
594,140
|
||||
1161,691
|
||||
505,357
|
||||
666,381
|
||||
947,107
|
||||
1268,179
|
||||
984,585
|
||||
418,775
|
||||
805,471
|
||||
1074,455
|
||||
142,245
|
||||
284,403
|
||||
1064,557
|
||||
207,766
|
||||
485,759
|
||||
236,775
|
||||
38,309
|
||||
329,59
|
||||
1169,857
|
||||
791,775
|
||||
1310,809
|
||||
530,715
|
||||
571,401
|
||||
525,673
|
||||
1064,701
|
||||
304,110
|
||||
402,350
|
||||
1237,172
|
||||
646,287
|
||||
959,156
|
||||
62,320
|
||||
674,364
|
||||
959,738
|
||||
723,535
|
||||
177,423
|
||||
798,85
|
||||
497,859
|
||||
825,99
|
||||
473,593
|
||||
575,45
|
||||
505,215
|
||||
764,133
|
||||
109,684
|
||||
884,457
|
||||
356,879
|
||||
920,238
|
||||
310,233
|
||||
79,266
|
||||
177,663
|
||||
691,868
|
||||
1290,352
|
||||
714,745
|
||||
493,527
|
||||
1173,65
|
||||
1026,520
|
||||
284,473
|
||||
662,647
|
||||
557,522
|
||||
1190,667
|
||||
181,180
|
||||
1178,114
|
||||
990,3
|
||||
798,649
|
||||
428,224
|
||||
428,511
|
||||
254,567
|
||||
574,669
|
||||
468,672
|
||||
324,801
|
||||
1290,542
|
||||
120,702
|
||||
271,312
|
||||
145,817
|
||||
1082,187
|
||||
1014,493
|
||||
691,420
|
||||
718,544
|
||||
412,560
|
||||
420,368
|
||||
428,432
|
||||
326,585
|
||||
686,108
|
||||
1297,25
|
||||
1290,782
|
||||
689,893
|
||||
1046,798
|
||||
194,588
|
||||
423,873
|
||||
97,876
|
||||
748,634
|
||||
865,887
|
||||
296,493
|
||||
1046,350
|
||||
488,311
|
||||
1048,411
|
||||
344,152
|
||||
962,718
|
||||
410,893
|
||||
986,801
|
||||
527,274
|
||||
798,654
|
||||
736,107
|
||||
462,95
|
||||
999,826
|
||||
1119,595
|
||||
604,652
|
||||
261,124
|
||||
20,352
|
||||
581,50
|
||||
417,778
|
||||
820,260
|
||||
310,651
|
||||
95,21
|
||||
20,21
|
||||
629,32
|
||||
1133,471
|
||||
1082,885
|
||||
82,450
|
||||
1079,0
|
||||
798,334
|
||||
420,634
|
||||
1243,87
|
||||
290,262
|
||||
477,295
|
||||
226,511
|
||||
915,670
|
||||
364,632
|
||||
248,625
|
||||
1062,269
|
||||
331,324
|
||||
713,193
|
||||
739,65
|
||||
74,667
|
||||
1248,574
|
||||
903,490
|
||||
65,868
|
||||
1250,306
|
||||
149,695
|
||||
574,673
|
||||
246,787
|
||||
570,717
|
||||
1225,105
|
||||
214,36
|
||||
904,336
|
||||
991,726
|
||||
1054,661
|
||||
744,765
|
||||
324,353
|
||||
73,546
|
||||
667,150
|
||||
780,179
|
||||
1136,381
|
||||
920,14
|
||||
57,253
|
||||
825,404
|
||||
638,427
|
||||
170,297
|
||||
231,465
|
||||
792,140
|
||||
979,773
|
||||
669,8
|
||||
1216,10
|
||||
1020,262
|
||||
758,158
|
||||
879,516
|
||||
621,893
|
||||
1183,172
|
||||
370,25
|
||||
140,446
|
||||
1034,820
|
||||
301,289
|
||||
325,835
|
||||
167,794
|
||||
1293,304
|
||||
58,521
|
||||
108,504
|
||||
718,96
|
||||
621,393
|
||||
890,816
|
||||
977,180
|
||||
236,887
|
||||
1277,309
|
||||
197,53
|
||||
999,397
|
||||
1133,599
|
||||
619,26
|
||||
932,746
|
||||
842,149
|
||||
1236,765
|
||||
16,651
|
||||
1216,688
|
||||
1149,367
|
||||
743,819
|
||||
706,674
|
||||
1212,259
|
||||
130,623
|
||||
273,54
|
||||
284,25
|
||||
284,491
|
||||
485,411
|
||||
313,248
|
||||
79,406
|
||||
1046,96
|
||||
13,663
|
||||
35,710
|
||||
306,166
|
||||
560,206
|
||||
1168,245
|
||||
460,101
|
||||
363,362
|
||||
505,19
|
||||
1248,47
|
||||
264,432
|
||||
1280,767
|
||||
1031,100
|
||||
1158,869
|
||||
48,861
|
||||
334,653
|
||||
1135,822
|
||||
1175,595
|
||||
884,885
|
||||
512,85
|
||||
484,745
|
||||
900,449
|
||||
157,852
|
||||
497,266
|
||||
946,632
|
||||
217,236
|
||||
256,661
|
||||
248,558
|
||||
47,570
|
||||
1103,766
|
||||
1215,425
|
||||
842,672
|
||||
947,362
|
||||
996,710
|
||||
1033,75
|
||||
552,812
|
||||
62,798
|
||||
862,702
|
||||
756,803
|
||||
3,466
|
||||
934,677
|
||||
1252,521
|
||||
1220,103
|
||||
570,499
|
||||
997,438
|
||||
1245,677
|
||||
30,753
|
||||
900,673
|
||||
1119,593
|
||||
716,754
|
||||
264,350
|
||||
420,484
|
||||
1144,87
|
||||
6,695
|
||||
493,504
|
||||
669,231
|
||||
1051,695
|
||||
97,522
|
||||
97,565
|
||||
954,463
|
||||
674,595
|
||||
63,292
|
||||
961,409
|
||||
348,848
|
||||
166,359
|
||||
686,767
|
||||
192,575
|
||||
848,319
|
||||
925,477
|
||||
735,182
|
||||
326,107
|
||||
470,117
|
||||
1183,620
|
||||
370,822
|
||||
349,37
|
||||
957,78
|
||||
209,781
|
||||
30,464
|
||||
62,803
|
||||
94,884
|
||||
542,36
|
||||
1307,793
|
||||
398,681
|
||||
604,450
|
||||
376,329
|
||||
175,520
|
||||
495,820
|
||||
764,504
|
||||
768,858
|
||||
241,341
|
||||
502,869
|
||||
1,726
|
||||
252,675
|
||||
157,490
|
||||
672,427
|
||||
1059,355
|
||||
1151,820
|
||||
319,168
|
||||
1016,719
|
||||
726,302
|
||||
895,371
|
||||
527,620
|
||||
1151,436
|
||||
805,647
|
||||
540,705
|
||||
1153,547
|
||||
1304,199
|
||||
817,367
|
||||
88,126
|
||||
1074,439
|
||||
1289,140
|
||||
1096,702
|
||||
1243,359
|
||||
739,401
|
||||
448,702
|
||||
858,85
|
||||
810,291
|
||||
1120,754
|
||||
1190,702
|
||||
239,523
|
||||
805,215
|
||||
920,350
|
||||
1176,211
|
||||
853,221
|
||||
985,661
|
||||
428,670
|
||||
341,438
|
||||
566,129
|
||||
333,714
|
||||
853,124
|
||||
624,767
|
||||
1240,368
|
||||
641,250
|
||||
1236,227
|
||||
1218,484
|
||||
1303,840
|
||||
587,871
|
||||
408,892
|
||||
1004,838
|
||||
109,210
|
||||
716,140
|
||||
1093,658
|
||||
773,7
|
||||
654,309
|
||||
1049,677
|
||||
674,530
|
||||
318,831
|
||||
1118,767
|
||||
997,456
|
||||
740,717
|
||||
1238,791
|
||||
848,127
|
||||
541,259
|
||||
830,8
|
||||
363,219
|
||||
584,526
|
||||
672,651
|
||||
353,816
|
||||
457,322
|
||||
112,529
|
||||
1004,56
|
||||
161,390
|
||||
900,1
|
||||
169,135
|
||||
25,862
|
||||
584,220
|
||||
872,123
|
||||
893,778
|
||||
186,672
|
||||
341,194
|
||||
303,268
|
||||
992,383
|
||||
465,368
|
||||
13,25
|
||||
1168,240
|
||||
311,516
|
||||
713,701
|
||||
646,607
|
||||
1240,526
|
||||
510,558
|
||||
723,359
|
||||
842,558
|
||||
726,880
|
||||
979,757
|
||||
1202,257
|
||||
495,773
|
||||
70,686
|
||||
753,522
|
||||
94,688
|
||||
753,428
|
||||
273,532
|
||||
197,501
|
||||
485,722
|
||||
840,848
|
||||
420,816
|
||||
186,149
|
||||
698,403
|
||||
363,676
|
||||
1262,861
|
||||
512,112
|
||||
1201,658
|
||||
129,98
|
||||
1022,309
|
||||
1263,324
|
||||
569,660
|
||||
74,675
|
||||
80,409
|
||||
177,232
|
||||
455,4
|
||||
818,527
|
||||
480,397
|
||||
186,222
|
||||
1114,581
|
||||
783,620
|
||||
1201,236
|
||||
197,893
|
||||
1118,95
|
||||
489,728
|
||||
388,140
|
||||
604,242
|
||||
1216,240
|
||||
797,754
|
||||
756,539
|
||||
797,37
|
||||
1173,872
|
||||
622,623
|
||||
489,815
|
||||
117,143
|
||||
291,184
|
||||
863,128
|
||||
730,765
|
||||
73,722
|
||||
892,7
|
||||
488,535
|
||||
813,628
|
||||
940,822
|
||||
552,318
|
||||
273,840
|
||||
1086,289
|
||||
1280,464
|
||||
822,311
|
||||
149,295
|
||||
477,697
|
||||
391,588
|
||||
1237,348
|
||||
262,483
|
||||
6,199
|
||||
584,592
|
||||
485,539
|
||||
390,126
|
||||
490,738
|
||||
1170,373
|
||||
1140,297
|
||||
934,637
|
||||
396,436
|
||||
1233,385
|
||||
733,765
|
||||
947,219
|
||||
349,485
|
||||
490,746
|
||||
643,338
|
||||
1084,511
|
||||
979,122
|
||||
408,555
|
||||
820,290
|
||||
669,25
|
||||
1253,701
|
||||
813,72
|
||||
999,378
|
||||
1176,855
|
||||
1124,745
|
||||
132,780
|
||||
706,204
|
||||
581,157
|
||||
667,556
|
||||
562,410
|
||||
808,869
|
||||
428,383
|
||||
3,101
|
||||
996,632
|
||||
261,746
|
||||
577,10
|
||||
830,886
|
||||
489,838
|
||||
344,742
|
||||
1136,845
|
||||
398,661
|
||||
398,238
|
||||
1019,787
|
||||
142,649
|
||||
584,302
|
||||
438,771
|
||||
288,302
|
||||
1161,295
|
||||
92,634
|
||||
606,145
|
||||
970,632
|
||||
1034,74
|
||||
1079,894
|
||||
142,240
|
||||
1275,710
|
||||
820,746
|
||||
1173,22
|
||||
74,577
|
||||
855,890
|
||||
689,501
|
||||
497,347
|
||||
358,688
|
||||
636,364
|
||||
567,819
|
||||
1022,302
|
||||
758,736
|
||||
1253,253
|
||||
428,501
|
||||
821,815
|
||||
887,21
|
||||
1213,490
|
||||
764,705
|
||||
60,306
|
||||
1153,255
|
||||
1056,327
|
||||
601,168
|
||||
1099,634
|
||||
880,718
|
||||
1146,604
|
||||
1213,18
|
||||
1178,780
|
||||
822,535
|
||||
1161,471
|
||||
952,127
|
||||
1201,210
|
||||
688,623
|
||||
574,221
|
||||
890,634
|
||||
170,597
|
||||
157,42
|
||||
1084,393
|
||||
310,661
|
||||
666,8
|
||||
375,548
|
||||
597,193
|
||||
390,544
|
||||
65,677
|
||||
263,180
|
||||
621,449
|
||||
1165,714
|
||||
842,745
|
||||
582,473
|
||||
997,472
|
||||
1145,815
|
||||
25,32
|
||||
820,156
|
||||
612,520
|
||||
957,302
|
||||
770,705
|
||||
113,187
|
||||
1114,313
|
||||
825,411
|
||||
698,267
|
||||
813,347
|
||||
1236,667
|
||||
723,807
|
||||
169,815
|
||||
805,194
|
||||
1280,114
|
||||
1223,815
|
||||
820,820
|
||||
790,659
|
||||
850,101
|
||||
1250,588
|
||||
955,525
|
||||
676,782
|
||||
1113,221
|
||||
224,289
|
||||
1290,649
|
||||
284,421
|
||||
574,787
|
||||
1020,632
|
||||
1026,25
|
||||
961,530
|
||||
858,267
|
||||
1237,157
|
||||
1238,439
|
||||
952,206
|
||||
996,184
|
||||
1292,364
|
||||
969,707
|
||||
546,133
|
||||
619,555
|
||||
575,182
|
||||
584,880
|
||||
979,137
|
||||
30,268
|
||||
477,214
|
||||
797,857
|
||||
1039,582
|
||||
1144,359
|
||||
211,17
|
||||
790,235
|
||||
1180,623
|
||||
915,224
|
||||
477,471
|
||||
261,665
|
||||
833,295
|
||||
830,662
|
||||
601,138
|
||||
656,361
|
||||
922,688
|
||||
1262,145
|
||||
1231,406
|
||||
858,361
|
||||
616,816
|
||||
1290,270
|
||||
764,189
|
||||
320,689
|
||||
18,530
|
||||
813,266
|
||||
363,107
|
||||
577,436
|
||||
609,439
|
||||
560,464
|
||||
229,490
|
||||
480,886
|
||||
281,333
|
||||
202,267
|
||||
1078,10
|
||||
492,527
|
||||
929,362
|
||||
373,781
|
||||
381,586
|
||||
126,150
|
||||
246,109
|
||||
169,68
|
||||
508,691
|
||||
638,243
|
||||
741,234
|
||||
1081,404
|
||||
1290,245
|
||||
1034,298
|
||||
621,841
|
||||
821,728
|
||||
23,44
|
||||
1260,674
|
||||
1044,140
|
||||
217,628
|
||||
750,688
|
||||
1140,149
|
||||
552,736
|
||||
261,453
|
||||
192,95
|
||||
452,361
|
||||
1140,597
|
||||
726,368
|
||||
798,688
|
||||
519,147
|
||||
1082,707
|
||||
1294,19
|
||||
70,357
|
||||
840,693
|
||||
691,362
|
||||
1148,77
|
||||
311,68
|
||||
654,555
|
||||
90,710
|
||||
1049,770
|
||||
1019,184
|
||||
130,271
|
||||
403,707
|
||||
67,87
|
||||
837,593
|
||||
1213,404
|
||||
1294,518
|
||||
162,186
|
||||
893,330
|
||||
698,520
|
||||
87,75
|
||||
976,451
|
||||
157,266
|
||||
758,576
|
||||
719,154
|
||||
903,493
|
||||
822,583
|
||||
594,530
|
||||
70,144
|
||||
1153,628
|
||||
463,327
|
||||
1216,884
|
||||
654,533
|
||||
902,709
|
||||
714,597
|
||||
141,485
|
||||
634,112
|
||||
723,87
|
||||
833,231
|
||||
159,325
|
||||
977,714
|
||||
206,285
|
||||
853,572
|
||||
301,414
|
||||
1004,400
|
||||
750,884
|
||||
358,127
|
||||
1046,432
|
||||
520,235
|
||||
594,812
|
||||
801,873
|
||||
1169,37
|
||||
986,353
|
||||
1006,110
|
||||
1099,260
|
||||
915,695
|
||||
1062,784
|
||||
410,143
|
||||
1300,8
|
||||
1297,259
|
||||
348,737
|
||||
175,822
|
||||
348,157
|
||||
1037,54
|
||||
1014,849
|
||||
785,673
|
||||
518,866
|
||||
716,812
|
||||
418,119
|
||||
497,72
|
||||
1093,236
|
||||
1069,553
|
||||
566,765
|
||||
703,801
|
||||
1230,409
|
||||
1029,333
|
||||
1190,227
|
||||
94,206
|
||||
641,886
|
||||
1268,161
|
||||
1181,221
|
||||
417,116
|
||||
47,324
|
||||
1124,672
|
||||
870,140
|
||||
159,121
|
||||
440,226
|
||||
169,31
|
||||
428,462
|
||||
440,858
|
||||
395,672
|
||||
348,46
|
||||
236,632
|
||||
184,848
|
||||
735,712
|
||||
470,693
|
||||
243,782
|
||||
940,869
|
||||
154,603
|
||||
935,548
|
||||
1039,841
|
||||
490,143
|
||||
149,471
|
||||
920,880
|
||||
243,112
|
||||
706,652
|
||||
817,504
|
||||
465,884
|
||||
581,844
|
||||
914,884
|
||||
711,536
|
||||
90,343
|
||||
952,530
|
||||
1290,21
|
||||
135,595
|
||||
868,749
|
||||
1238,473
|
||||
898,667
|
||||
174,397
|
||||
1078,688
|
||||
990,689
|
||||
1272,368
|
||||
438,123
|
||||
400,262
|
||||
102,812
|
||||
1184,150
|
||||
691,666
|
||||
567,371
|
||||
982,107
|
||||
537,887
|
||||
800,110
|
||||
735,180
|
||||
32,623
|
||||
242,110
|
||||
632,334
|
||||
753,789
|
||||
411,65
|
||||
1290,737
|
||||
313,438
|
||||
900,751
|
||||
333,180
|
||||
426,457
|
||||
261,677
|
||||
440,140
|
||||
714,297
|
||||
527,172
|
||||
729,546
|
||||
673,142
|
||||
457,501
|
||||
1168,688
|
||||
1124,149
|
||||
664,383
|
||||
848,799
|
||||
480,381
|
||||
159,436
|
||||
867,821
|
||||
213,243
|
||||
378,148
|
||||
947,676
|
||||
72,473
|
||||
1133,645
|
||||
1150,653
|
||||
653,840
|
||||
912,233
|
||||
769,259
|
||||
1133,871
|
||||
913,724
|
||||
22,334
|
||||
|
||||
fold along x=655
|
||||
fold along y=447
|
||||
fold along x=327
|
||||
fold along y=223
|
||||
fold along x=163
|
||||
fold along y=111
|
||||
fold along x=81
|
||||
fold along y=55
|
||||
fold along x=40
|
||||
fold along y=27
|
||||
fold along y=13
|
||||
fold along y=6
|
||||
102
2021/inputs/14.txt
Normal file
102
2021/inputs/14.txt
Normal file
@@ -0,0 +1,102 @@
|
||||
SHHBNFBCKNHCNOSHHVFF
|
||||
|
||||
CK -> N
|
||||
VP -> B
|
||||
CF -> S
|
||||
FO -> V
|
||||
VC -> S
|
||||
BV -> V
|
||||
NP -> P
|
||||
SN -> C
|
||||
KN -> V
|
||||
NF -> P
|
||||
SB -> C
|
||||
PC -> B
|
||||
OB -> V
|
||||
NS -> O
|
||||
FH -> S
|
||||
NK -> S
|
||||
HO -> V
|
||||
NV -> O
|
||||
FV -> O
|
||||
FB -> S
|
||||
PS -> S
|
||||
FN -> K
|
||||
HS -> O
|
||||
CB -> K
|
||||
HV -> P
|
||||
NH -> C
|
||||
BO -> B
|
||||
FF -> N
|
||||
PO -> F
|
||||
BB -> N
|
||||
PN -> C
|
||||
BP -> C
|
||||
HN -> K
|
||||
CO -> P
|
||||
BF -> H
|
||||
BC -> S
|
||||
CV -> B
|
||||
VV -> F
|
||||
FS -> B
|
||||
BN -> P
|
||||
VK -> S
|
||||
PV -> V
|
||||
PP -> B
|
||||
PH -> N
|
||||
SS -> O
|
||||
SK -> S
|
||||
NC -> P
|
||||
ON -> F
|
||||
NB -> N
|
||||
CC -> N
|
||||
SF -> H
|
||||
PF -> H
|
||||
OV -> O
|
||||
KH -> C
|
||||
CP -> V
|
||||
PK -> O
|
||||
KC -> K
|
||||
KK -> C
|
||||
KF -> B
|
||||
HP -> C
|
||||
FK -> H
|
||||
BH -> K
|
||||
VN -> H
|
||||
OO -> S
|
||||
SC -> K
|
||||
SP -> B
|
||||
KO -> V
|
||||
KV -> F
|
||||
HK -> N
|
||||
FP -> N
|
||||
NN -> B
|
||||
VS -> O
|
||||
HC -> K
|
||||
BK -> N
|
||||
KS -> K
|
||||
VB -> O
|
||||
OH -> F
|
||||
KB -> F
|
||||
KP -> H
|
||||
HB -> N
|
||||
NO -> N
|
||||
OF -> O
|
||||
BS -> H
|
||||
VO -> H
|
||||
SH -> O
|
||||
SV -> K
|
||||
HF -> C
|
||||
CS -> F
|
||||
FC -> N
|
||||
VH -> H
|
||||
OP -> K
|
||||
OK -> H
|
||||
PB -> K
|
||||
HH -> S
|
||||
OC -> V
|
||||
VF -> B
|
||||
CH -> K
|
||||
CN -> C
|
||||
SO -> P
|
||||
OS -> O
|
||||
100
2021/inputs/15.txt
Normal file
100
2021/inputs/15.txt
Normal file
@@ -0,0 +1,100 @@
|
||||
5698271399793414121494916897678273334792458352199237144928619653191794144917556817941885991921787155
|
||||
5661218626919981949139858312691785612259857529334128895157352159114297128511813456894839991981828919
|
||||
1829946539172173769987529428979213588624889988719998181167931129997731961946189278688942251875931179
|
||||
1999119539431115938818955166792951461581819916221516821681692884358864981966117818421936138119178448
|
||||
8248487982679211958329811353187936515794549929583184191911666793879132359192179796818752613119298188
|
||||
7391613611139499971186919159397755657961352334771192112294557688911149919935819422199281134255797767
|
||||
8124729396114568961156298172414395681961627813193215526122172712983935817479529728239799416288287177
|
||||
9649211889945273498525484578866135611815817899936588391937238711562851327977738262898917714539618992
|
||||
1141741151396594515311116985514997126571483473844951949329748922961996548324126664446185813879832188
|
||||
6514441248746823748338931782958583948711212951974131921212693782738511196996128897191782852921157717
|
||||
9391886829151987712527174199971418888695457266233516772351113144394198243117872737133772919969819519
|
||||
1198331423874598397283651925996811591794589456846981969193281925566799829729889189889897828398875973
|
||||
3993119331859999411778999198997168314599391886293921999193929916292896686191667979558511312556596894
|
||||
4885648184914319438678987185948358172121994124174189148399374584265796556987819754991475787318732495
|
||||
7161834654516953633561499967999394938799899319729924222599794975138255185728879581989683917238688499
|
||||
5984849949933778929823916964338381451782979977879923213397398539961494556984787412996655398495998949
|
||||
5715125898984926281417488864215481241818325728147899985999237792243119997919523716364219919384984139
|
||||
9859999616929285298541192766179418656994667513839176241589982149119397731438826191347741844116719249
|
||||
8175137179841286592241832831664588945248987741981849615626887738291971771877815459199919596297762924
|
||||
1195455998712612867139126669399111711242319181378472389957511612195887919281465911167399661193991259
|
||||
6683294289715197916912936717981879539595921479689377149531198421412217683129512395995551899999253636
|
||||
4384549778929184387719457231348656645896889888925317219969479184937844937194733193727596993257773958
|
||||
3276812228776279165124713927385779131439398642869891821824228691957821333121694837396724995969152871
|
||||
9919942131189697791118151719399685129324814276422561998279371918941781591744772893513849374159719689
|
||||
9381491523919433281119518148692169889399181847183427693123932741321897894329241437714386791132191185
|
||||
9491214195479284697132149999835916255594317799411165638929858419125934487114527249742829613155512959
|
||||
6311661999995998283745198816594176551398793726177951929118916489667398222393341857119652996537191216
|
||||
6982112288787347411291733589694945315895949612819676734199121729449261277878511178985354939268994351
|
||||
3674562711198699238983994755221985299338191681822892997159181992896128148896975971957144448941814152
|
||||
9899194386288999913747123919122811877922937176682999664964885597922734185747279621687621731836928862
|
||||
2116816742597199191219978826825994722615889928911124939448369538185829869273435191136937156632583851
|
||||
4349941568369745619775621261571293998779732985286699593958874613332787391776856914459351828283129499
|
||||
2139545889871837989617135399996761155985919219131927394712919919165898258917812865693299999372143937
|
||||
2797918178177159361299151932139531949921215449467992544898132943871367946184259699282519985747111894
|
||||
1486233998921528551532861544482468798798911836599829829996424887757819971589876285997126989165281171
|
||||
8861164846365591334792621191572483286587764653747651579926829499721832813168648324199795414996798928
|
||||
9291853568543999152479124588672419544474748794822216282929683566381835292497918418175413139195238875
|
||||
4459193479395871171969518189835778911861995829613879912466644113246996925946217134981986998535612761
|
||||
3917415977315473896693284392244697742378915475693115524188981984797471519797297767819983299114674163
|
||||
9479997975888641554837851979187615719199134617129683999813865847829191959434496893219481276491982115
|
||||
1192917311668797426356261998346738779982194786382977926498879633266998527258133639952619989139917922
|
||||
7719288735263969519584635229174517995733918532265569199269899656492443157891869119696416131629593639
|
||||
2184119869185523966813259979736987537578526292398798983845392291835172615194758136222947294271887893
|
||||
8729953944813191318117475998726288371635861354847924941923488971912998769489173795899411912899358291
|
||||
4865718997911481411828882919717899614955999831128828316982172988928635967691754477941769257918149225
|
||||
2993917151292413828544861759731699793999794939134673192415919816989946192187733812832551933836349353
|
||||
2392657723121896915129994993779197965282385759494924426239478311328999729999373913937519813997858629
|
||||
1231999494818876979724169419419112419866229157682954926121898668165939174414423891657921992944249919
|
||||
9918532449129634933779591992923399274618345391686218726361524731393799762548689548319471496829728796
|
||||
9998799217976696793819516835698899484118485923118178917448293998592525822132531922781281129488216397
|
||||
5192761493599676289836184964748349843714842349297638881284681117695677295987225931879393958925236789
|
||||
7268883329987412183226822596174125816931195839329615165616819294836862793251385934133841918139897811
|
||||
6965568945376938749193143429716268629281259918717113392767177211856962116259137767717711199819531318
|
||||
9946637998921258586362681893277981845668197589625911332226897948938743394789819211693113189244919914
|
||||
4871851551891469283341781775791494521158119524555886558545149797364636497391519989229278417113895118
|
||||
1345983432979827816668993821658815763434864899249549719186967999197848321762371279955891998781349927
|
||||
6314411929798522969667512333572214219998191666968187141597233789569459669912829965921239279371936316
|
||||
3992169277898367859361361786747537912321799661448888219875991399581567758199888738334192143862413181
|
||||
2222496914541859183177213262919191272991899639234997678238191986198749293843119619698119988293199525
|
||||
5915371189328353219855382685759969775542849935211982181425259529898186916649392484997392838711191117
|
||||
8169587973671717318581118999998425389847631991852491196188179989154396999942138113786691868241134889
|
||||
5344685492577218115877995132456423826951924968919925139319849473936971671795487241479296442941929811
|
||||
1251739861149952116921832956986111819961136698717996819282184146866727525158711738228839674622782386
|
||||
9847314199798528792466291586899159199338477391961835887792183113688154215493472212798899991864295742
|
||||
5257272784491799827451173416779878548132798785993631488174276918175531348892491918523719192299467898
|
||||
7992979991181179831169821468119411577879187992796818917682661441819267843277919392835983139489719471
|
||||
4128797488218887928681673379728116122642549998949328966228125433858567196198751462818891984938354911
|
||||
3475959599312382511869439189922686358873981983568449243997159614192913999914236993319949291439999198
|
||||
1517571791296243999998371134995497132685919198842128735596841665424591185199389913668775951218689423
|
||||
5654967112585715992259299352411729124559287912759919919348673481869219527276935916149899615111454338
|
||||
7959995196194629598269761799738458135587969367688876114561929169848572742199927976195348111813159694
|
||||
8341237826999851918267518141919121565937312914613679117869654472139112992413357268683764935191892197
|
||||
9191144725134452491124119549826718699739659572818352415387359897217137915122751995997915493159884984
|
||||
6114992423997191951469189895299879231999121815923893319995434539493649119619119321913937699983662725
|
||||
8691733293139727547586431961128887545859836374323612455831994799481883935133399817678718165893368111
|
||||
9561258499233959148319937411137559674714812297689646923979591185916186723579892829686891551677119835
|
||||
3817583836164917989158856146991679117129286763822991921599939389559162988815144775134949221893987156
|
||||
8869393821317962938731194192326717912615937839319191487729718951863811937788448721968368554499469998
|
||||
9779931174618997891716996479823339528914111348193299619911134519591869598192982377992849895786861628
|
||||
9228849524211171112561193761591642939783616849941114962751144449512592397581717151998199129916399569
|
||||
3681981471397593418983945941198912291467516143121382229831485899639873221948653399284748979865113829
|
||||
4511319899177843659998889999335128559884168939718989492987161554392999453863694462822117736248363914
|
||||
6889791329888928324783251893783438993799912282811711691692819391686821652429416117277191688919199791
|
||||
1813466918799319576952728154162197258151141791197279928841612511822193355919372971629299829231292443
|
||||
6929796618267421196847896679863622321769172269232621692961879886142891298588221949715178615764931656
|
||||
2181488467213697845251891984157371193949716425395214118928493219545175866269193351849171839139818194
|
||||
9145886424872389992784162159124115362691198296549871231961989118911915871253826391146992645811797217
|
||||
7261813715196955953539695411269291743513585462916998619485955985198911978299891114856577679915119891
|
||||
2395375323918811172993132575669768211797188142297317469339437887956823821249292252996118812429293966
|
||||
3493698117398613593295939911464991949189591628859269618891373198822876449981519279397383938445938961
|
||||
7188399498811299474499795927858692591488691212476189948484913298291739588851722167749543818816918814
|
||||
6639711919811875921558499577359957913939617544713997397137148176493159178897792388987517214382594658
|
||||
9868637769618335566138613187813295523435485163161618919397998236266915715199319761642818478856959385
|
||||
1181969758279137971179348866926365624188612783894276496899793241258119122436174649949517195172514793
|
||||
6282561199121299888181471164167212292274611428169718849631799674421998399218169533259817922649993996
|
||||
7892189127116936145295482897726952912496729194898291625689311833439971918991813338319988542899569332
|
||||
1984849148728139499199899219892824339819797636941197152362487518771542766624971973432971739847999929
|
||||
1389955743198821981998929159786983988371511612124611537771554447966118799114165127857297139873268292
|
||||
7114948568589988719191915583826591117862589116475856191177131841299229935172958819245872994369999426
|
||||
4275554996585879411196552781973718511282969951492149869419418957345666452981882879663949917972311592
|
||||
1
2021/inputs/16.txt
Normal file
1
2021/inputs/16.txt
Normal file
@@ -0,0 +1 @@
|
||||
620D49005AD2245800D0C9E72BD279CAFB0016B1FA2B1802DC00D0CC611A47FCE2A4ACE1DD144BFABBFACA002FB2C6F33DFF4A0C0119B169B013005F003720004263644384800087C3B8B51C26B449130802D1A0068A5BD7D49DE793A48B5400D8293B1F95C5A3005257B880F5802A00084C788AD0440010F8490F608CACE034401AB4D0F5802726B3392EE2199628CEA007001884005C92015CC8051800130EC0468A01042803B8300D8E200788018C027890088CE0049006028012AB00342A0060801B2EBE400424933980453EFB2ABB36032274C026E4976001237D964FF736AFB56F254CB84CDF136C1007E7EB42298FE713749F973F7283005656F902A004067CD27CC1C00D9CB5FDD4D0014348010C8331C21710021304638C513006E234308B060094BEB76CE3966AA007C6588A5670DC3754395485007A718A7F149CA2DD3B6E7B777800118E7B59C0ECF5AE5D3B6CB1496BAE53B7ADD78C013C00CD2629BF5371D1D4C537EA6E3A3E95A3E180592AC7246B34032CF92804001A1CCF9BA521782ECBD69A98648BC18025800F8C9C37C827CA7BEFB31EADF0AE801BA42B87935B8EF976194EEC426AAF640168CECAF84BC004AE7D1673A6A600B4AB65802D230D35CF81B803D3775683F3A3860087802132FB32F322C92A4C402524F2DE006E8000854378F710C0010D8F30FE224AE428C015E00D40401987F06E3600021D0CE3EC228DA000574E4C3080182931E936E953B200BF656E15400D3496E4A725B92998027C00A84EEEE6B347D30BE60094E537AA73A1D600B880371AA36C3200043235C4C866C018E4963B7E7AA2B379918C639F1550086064BB148BA499EC731004E1AC966BDBC7646600C080370822AC4C1007E38C428BE0008741689D0ECC01197CF216EA16802D3748FE91B25CAF6D5F11C463004E4FD08FAF381F6004D3232CC93E7715B463F780
|
||||
1
2021/inputs/17.txt
Normal file
1
2021/inputs/17.txt
Normal file
@@ -0,0 +1 @@
|
||||
target area: x=14..50, y=-267..-225
|
||||
100
2021/inputs/18.txt
Normal file
100
2021/inputs/18.txt
Normal file
@@ -0,0 +1,100 @@
|
||||
[[3,[[6,3],[9,6]]],[6,[[0,9],[9,7]]]]
|
||||
[[[3,9],[[0,8],[7,6]]],[[[7,9],1],[1,3]]]
|
||||
[8,[[[9,6],[8,4]],4]]
|
||||
[5,[[1,2],[3,7]]]
|
||||
[[[[7,7],5],[[3,5],8]],4]
|
||||
[[[5,[0,7]],3],[[5,[5,3]],[1,[9,4]]]]
|
||||
[[[[3,5],[7,1]],6],[[[3,6],[5,6]],[[3,2],5]]]
|
||||
[[[[2,0],[3,0]],[5,7]],[[4,4],[[9,9],[9,3]]]]
|
||||
[[[[8,0],7],[[7,1],9]],[[3,[8,6]],8]]
|
||||
[[6,[7,5]],[[6,8],9]]
|
||||
[[[9,[1,8]],2],[[[4,0],[9,3]],1]]
|
||||
[[7,[1,[3,8]]],[[4,7],[8,1]]]
|
||||
[[[5,5],[[4,5],[2,9]]],[[[7,7],0],8]]
|
||||
[[[[4,7],3],5],[[[4,3],[3,8]],[[6,5],5]]]
|
||||
[[[[3,8],2],[1,7]],[[[3,1],4],9]]
|
||||
[[[[2,1],4],[[9,5],[1,4]]],[[3,5],[[9,1],9]]]
|
||||
[[[6,[1,8]],[0,0]],[9,[0,3]]]
|
||||
[[[[2,2],[3,3]],[[4,8],4]],[[[6,8],4],5]]
|
||||
[4,[[[7,8],[3,4]],[[3,2],9]]]
|
||||
[[[9,0],3],[[[7,1],4],7]]
|
||||
[[[1,4],8],[[7,5],[[8,0],[0,7]]]]
|
||||
[9,[[4,6],[[2,9],1]]]
|
||||
[[[[1,8],8],6],[[[2,0],6],[0,5]]]
|
||||
[[[5,5],[6,4]],[[3,8],[9,[7,6]]]]
|
||||
[[0,[8,[1,4]]],2]
|
||||
[[[[9,5],0],5],[9,[7,5]]]
|
||||
[[9,[4,8]],[[8,1],[[8,6],[7,1]]]]
|
||||
[4,[[[9,6],5],9]]
|
||||
[[[[3,7],6],0],[[7,7],[[2,7],[9,3]]]]
|
||||
[[[6,[3,7]],[[8,3],2]],[8,[6,[8,5]]]]
|
||||
[[[5,[2,7]],[[6,7],3]],[5,[[4,4],1]]]
|
||||
[[1,0],[[2,8],[[0,4],9]]]
|
||||
[[[1,4],6],[[[9,8],[1,0]],1]]
|
||||
[[3,4],[[1,[8,4]],8]]
|
||||
[[[[9,4],[0,7]],[[5,4],[8,2]]],2]
|
||||
[5,[[[8,7],[3,4]],[2,4]]]
|
||||
[[[[1,3],[8,6]],[[3,4],6]],[[8,5],[[9,3],[5,7]]]]
|
||||
[[0,[[0,9],[7,8]]],[3,9]]
|
||||
[0,[[8,[2,3]],[[3,5],[4,9]]]]
|
||||
[[[4,3],[[1,9],[1,5]]],[4,[[9,1],1]]]
|
||||
[[[[3,6],[2,5]],3],[[8,[8,0]],[[6,9],[5,8]]]]
|
||||
[7,[[3,[3,6]],[[6,9],[2,7]]]]
|
||||
[[[[8,3],[6,5]],[[3,9],2]],[6,1]]
|
||||
[[[2,0],[2,3]],8]
|
||||
[[1,[[8,7],2]],[[[9,4],8],[4,[9,0]]]]
|
||||
[[[6,7],[[5,2],3]],[[0,5],[[9,4],[2,6]]]]
|
||||
[[[9,[5,8]],[[9,3],[6,9]]],5]
|
||||
[[[5,[4,6]],[5,[3,2]]],[2,[9,[5,4]]]]
|
||||
[8,6]
|
||||
[[[4,8],[3,1]],[1,[[7,8],[7,5]]]]
|
||||
[[4,[[8,8],4]],[5,[8,[3,9]]]]
|
||||
[[[4,[9,0]],[[0,3],5]],[[5,[3,0]],[6,[2,3]]]]
|
||||
[[[4,0],8],[[[4,0],7],[[9,6],3]]]
|
||||
[[8,[[7,8],5]],[[[6,2],8],[1,[0,4]]]]
|
||||
[[1,[[3,4],[0,8]]],[[6,5],3]]
|
||||
[[5,2],[[8,6],[1,[9,7]]]]
|
||||
[5,[6,[[1,3],[1,0]]]]
|
||||
[[0,[[1,9],[5,6]]],[[[6,2],[5,1]],[[1,2],[1,0]]]]
|
||||
[[[7,1],4],[[[0,3],3],[[4,8],1]]]
|
||||
[[3,[9,[3,4]]],[1,[[0,0],[1,4]]]]
|
||||
[1,[7,[1,[3,7]]]]
|
||||
[[[0,[5,6]],[[7,4],[5,7]]],[[[6,8],[4,6]],9]]
|
||||
[[[9,8],[7,[1,3]]],3]
|
||||
[[[4,[0,3]],[[3,0],6]],[[2,[9,2]],1]]
|
||||
[[[[1,9],[3,3]],[8,1]],5]
|
||||
[[7,[5,2]],[[4,[0,1]],[3,3]]]
|
||||
[[[6,6],[0,6]],[[3,[5,9]],[[4,2],[4,3]]]]
|
||||
[[[7,[5,4]],[7,1]],9]
|
||||
[[6,[5,2]],[[7,[0,5]],4]]
|
||||
[[[8,1],[[7,6],[4,1]]],2]
|
||||
[[[[4,3],[1,4]],[9,6]],[3,[[2,5],3]]]
|
||||
[[[[9,3],[5,0]],1],[1,[[9,7],9]]]
|
||||
[[[8,5],[5,9]],[2,[4,[0,0]]]]
|
||||
[[[[7,9],2],[[8,8],[6,3]]],[7,[0,9]]]
|
||||
[[[[6,6],[0,2]],[2,[9,0]]],[[0,9],[9,9]]]
|
||||
[[[9,[1,3]],[6,5]],[[[1,1],8],[9,[7,2]]]]
|
||||
[[8,[[8,4],6]],[[4,[5,9]],0]]
|
||||
[[8,[5,[6,7]]],[[[1,9],9],[0,[0,9]]]]
|
||||
[[9,[9,[7,3]]],[4,[4,7]]]
|
||||
[[[[9,3],7],5],[[5,[8,5]],[0,[8,0]]]]
|
||||
[[[5,[9,0]],[[7,4],[5,3]]],[3,[[1,1],[1,8]]]]
|
||||
[[1,[[1,4],[5,9]]],[[[9,1],[6,5]],[9,[0,7]]]]
|
||||
[[[[9,4],9],[5,3]],[[[4,2],[2,2]],[[1,0],0]]]
|
||||
[[[6,[8,6]],9],[8,[[0,1],[9,7]]]]
|
||||
[[2,0],[5,[[8,3],4]]]
|
||||
[[[[0,2],0],8],[8,[[2,5],[8,2]]]]
|
||||
[[[[7,4],8],[9,[7,5]]],[8,[7,[5,3]]]]
|
||||
[[2,4],[3,[3,8]]]
|
||||
[[5,4],[[0,[5,8]],[4,3]]]
|
||||
[6,[[5,[4,7]],9]]
|
||||
[[[2,[6,8]],[5,5]],[[[3,0],4],[[6,6],[0,1]]]]
|
||||
[[[1,[4,2]],[[8,0],8]],[8,[[6,1],[0,0]]]]
|
||||
[[9,[2,[3,3]]],[[2,6],[[5,2],[5,8]]]]
|
||||
[[9,[4,4]],[[[8,6],1],2]]
|
||||
[2,[[[0,7],7],[[7,8],5]]]
|
||||
[[[4,0],[[1,1],[7,6]]],[[6,7],[[7,2],1]]]
|
||||
[[[[2,5],0],[[9,5],9]],[6,[7,[6,1]]]]
|
||||
[[[7,8],1],[[[6,2],0],[[9,7],[3,5]]]]
|
||||
[[[9,1],0],[3,[[6,1],[6,9]]]]
|
||||
[[[[9,0],0],[4,[7,0]]],[[6,[4,0]],[8,[4,2]]]]
|
||||
921
2021/inputs/19.txt
Normal file
921
2021/inputs/19.txt
Normal file
@@ -0,0 +1,921 @@
|
||||
--- scanner 0 ---
|
||||
-377,550,716
|
||||
405,-463,594
|
||||
-612,-603,479
|
||||
-673,637,-463
|
||||
536,-465,715
|
||||
821,322,-697
|
||||
-676,-693,500
|
||||
643,432,654
|
||||
366,-500,-472
|
||||
708,409,-755
|
||||
469,-498,555
|
||||
738,371,759
|
||||
600,282,729
|
||||
362,-630,-324
|
||||
-446,-778,-395
|
||||
-679,-672,612
|
||||
-450,654,697
|
||||
353,-429,-389
|
||||
-661,719,-393
|
||||
118,-178,-1
|
||||
702,313,-718
|
||||
-540,-676,-341
|
||||
-716,754,-469
|
||||
-313,635,722
|
||||
-546,-749,-540
|
||||
-46,-64,45
|
||||
|
||||
--- scanner 1 ---
|
||||
-393,569,-783
|
||||
823,673,744
|
||||
492,605,-667
|
||||
568,-702,420
|
||||
498,-690,338
|
||||
-442,536,-928
|
||||
-458,-493,-747
|
||||
-617,-342,422
|
||||
-654,709,686
|
||||
539,-496,-476
|
||||
540,570,-668
|
||||
-416,521,-829
|
||||
756,-480,-461
|
||||
-387,-515,-848
|
||||
-549,614,625
|
||||
-611,-406,507
|
||||
666,628,-671
|
||||
-592,-479,403
|
||||
632,-478,-385
|
||||
802,792,735
|
||||
860,679,648
|
||||
27,17,-91
|
||||
-624,571,775
|
||||
-535,-422,-848
|
||||
574,-745,303
|
||||
|
||||
--- scanner 2 ---
|
||||
558,-741,-564
|
||||
646,-807,485
|
||||
464,437,812
|
||||
-898,-528,468
|
||||
616,-770,-508
|
||||
-127,-22,17
|
||||
351,393,-850
|
||||
532,-629,-522
|
||||
-680,-690,-789
|
||||
600,353,768
|
||||
-655,-827,-770
|
||||
593,-678,448
|
||||
675,-648,590
|
||||
-808,525,-539
|
||||
-765,-461,537
|
||||
335,474,-887
|
||||
-777,396,-580
|
||||
241,407,-941
|
||||
-787,793,667
|
||||
-973,848,720
|
||||
-661,-763,-685
|
||||
-789,519,-676
|
||||
449,424,815
|
||||
-815,754,730
|
||||
-42,81,-107
|
||||
-877,-464,558
|
||||
|
||||
--- scanner 3 ---
|
||||
-436,572,-578
|
||||
746,-456,727
|
||||
-475,513,-649
|
||||
-451,-549,481
|
||||
-562,-572,-515
|
||||
774,-516,696
|
||||
-704,791,507
|
||||
768,-722,-551
|
||||
812,-661,-568
|
||||
-613,684,551
|
||||
700,767,716
|
||||
-303,592,-650
|
||||
116,21,-89
|
||||
-408,-507,547
|
||||
753,-717,750
|
||||
609,753,-601
|
||||
-62,-9,37
|
||||
553,672,-596
|
||||
836,-673,-599
|
||||
-467,-404,-483
|
||||
-660,817,634
|
||||
-609,-356,-546
|
||||
602,796,-590
|
||||
692,646,766
|
||||
-565,-477,532
|
||||
702,620,743
|
||||
|
||||
--- scanner 4 ---
|
||||
538,-453,-833
|
||||
-126,24,29
|
||||
-352,-473,-587
|
||||
-444,-449,-740
|
||||
691,-464,520
|
||||
626,828,344
|
||||
-565,-317,406
|
||||
775,942,-788
|
||||
-369,-409,417
|
||||
-708,823,-645
|
||||
727,935,-697
|
||||
-746,539,507
|
||||
-806,434,481
|
||||
-789,742,-763
|
||||
-556,-362,404
|
||||
-690,470,523
|
||||
593,877,489
|
||||
405,-436,-796
|
||||
317,-447,-785
|
||||
-404,-427,-788
|
||||
-13,189,-5
|
||||
-698,727,-823
|
||||
600,898,-737
|
||||
561,-551,518
|
||||
641,854,443
|
||||
733,-626,469
|
||||
|
||||
--- scanner 5 ---
|
||||
46,10,147
|
||||
758,-651,532
|
||||
-527,-618,452
|
||||
-823,464,-569
|
||||
690,764,759
|
||||
-564,-447,-551
|
||||
764,-302,-267
|
||||
684,881,802
|
||||
456,449,-735
|
||||
435,440,-616
|
||||
107,94,-30
|
||||
760,846,747
|
||||
-677,-709,468
|
||||
-647,455,-499
|
||||
-408,-549,-539
|
||||
398,536,-622
|
||||
-293,614,774
|
||||
829,-503,-276
|
||||
-385,-416,-489
|
||||
-272,801,808
|
||||
-563,-622,372
|
||||
-612,469,-575
|
||||
613,-622,632
|
||||
-278,753,780
|
||||
681,-373,-280
|
||||
812,-549,626
|
||||
|
||||
--- scanner 6 ---
|
||||
579,574,-541
|
||||
-505,493,-632
|
||||
618,658,359
|
||||
-341,743,774
|
||||
-322,-636,574
|
||||
716,580,-522
|
||||
366,-369,516
|
||||
-654,544,-722
|
||||
401,-424,440
|
||||
-413,-618,481
|
||||
-785,-692,-593
|
||||
-785,-599,-445
|
||||
466,-635,-650
|
||||
675,451,-553
|
||||
89,132,-70
|
||||
-427,825,855
|
||||
-398,-634,698
|
||||
570,-708,-669
|
||||
-60,27,13
|
||||
522,657,457
|
||||
-376,606,841
|
||||
-684,-621,-516
|
||||
485,-772,-675
|
||||
475,716,376
|
||||
-647,496,-573
|
||||
483,-412,510
|
||||
|
||||
--- scanner 7 ---
|
||||
512,585,-747
|
||||
807,772,880
|
||||
733,795,840
|
||||
-767,-876,-603
|
||||
-719,662,750
|
||||
-612,458,-552
|
||||
570,-882,858
|
||||
-589,-932,-661
|
||||
623,-601,-378
|
||||
-343,-464,739
|
||||
-589,632,-556
|
||||
746,-608,-532
|
||||
494,492,-838
|
||||
-652,610,660
|
||||
-554,584,-555
|
||||
111,-115,-49
|
||||
589,-757,885
|
||||
-618,631,899
|
||||
496,368,-762
|
||||
618,-644,-539
|
||||
696,-814,921
|
||||
-640,-913,-544
|
||||
737,746,813
|
||||
-310,-533,587
|
||||
-23,-193,76
|
||||
-85,0,-51
|
||||
-447,-527,622
|
||||
|
||||
--- scanner 8 ---
|
||||
-419,640,-664
|
||||
-722,-533,531
|
||||
705,861,595
|
||||
577,-689,716
|
||||
-842,-385,512
|
||||
632,-792,-344
|
||||
815,768,660
|
||||
490,-691,586
|
||||
-502,623,-798
|
||||
-554,-811,-585
|
||||
676,809,607
|
||||
560,496,-785
|
||||
-943,400,567
|
||||
415,-740,758
|
||||
679,-805,-531
|
||||
732,438,-813
|
||||
-792,347,621
|
||||
724,-803,-540
|
||||
-489,-738,-726
|
||||
-746,-370,499
|
||||
-2,59,-33
|
||||
558,494,-753
|
||||
-515,574,-768
|
||||
-486,-634,-564
|
||||
-122,-93,-71
|
||||
-872,325,554
|
||||
|
||||
--- scanner 9 ---
|
||||
506,-688,-561
|
||||
571,721,622
|
||||
503,-562,-503
|
||||
-709,-714,-463
|
||||
-835,437,457
|
||||
-948,-735,-497
|
||||
314,-589,962
|
||||
495,809,-475
|
||||
-788,360,-772
|
||||
-612,-499,488
|
||||
291,-602,907
|
||||
-580,-584,424
|
||||
-119,8,40
|
||||
-636,429,-805
|
||||
408,627,663
|
||||
555,634,776
|
||||
301,-483,836
|
||||
-799,-766,-396
|
||||
-671,423,-668
|
||||
-725,535,411
|
||||
10,-85,163
|
||||
554,772,-348
|
||||
-726,558,457
|
||||
507,-736,-526
|
||||
612,828,-526
|
||||
-444,-607,500
|
||||
|
||||
--- scanner 10 ---
|
||||
-643,-839,-726
|
||||
-663,-800,-791
|
||||
-17,49,1
|
||||
-428,-762,319
|
||||
-452,-869,434
|
||||
806,-584,-592
|
||||
-468,406,-817
|
||||
118,-97,56
|
||||
530,403,850
|
||||
-433,399,-634
|
||||
521,-484,654
|
||||
881,-476,-533
|
||||
954,-520,-545
|
||||
781,439,-557
|
||||
609,-463,682
|
||||
-327,671,688
|
||||
-542,-771,-726
|
||||
-328,557,674
|
||||
661,-458,693
|
||||
510,298,863
|
||||
-240,536,611
|
||||
785,322,-393
|
||||
-432,416,-779
|
||||
-475,-744,471
|
||||
518,305,832
|
||||
823,411,-365
|
||||
|
||||
--- scanner 11 ---
|
||||
-559,-302,-674
|
||||
-766,553,760
|
||||
-687,-322,850
|
||||
-800,-238,758
|
||||
370,-773,-566
|
||||
-851,883,-504
|
||||
-804,954,-655
|
||||
-716,-388,-711
|
||||
17,134,92
|
||||
884,-743,798
|
||||
905,900,-296
|
||||
-681,-359,-759
|
||||
-84,7,-30
|
||||
851,833,-390
|
||||
-756,459,918
|
||||
479,-816,-448
|
||||
-848,870,-519
|
||||
707,-731,809
|
||||
814,914,-406
|
||||
503,782,753
|
||||
544,911,722
|
||||
767,-719,748
|
||||
640,788,734
|
||||
572,-776,-603
|
||||
-781,-228,812
|
||||
-703,514,732
|
||||
|
||||
--- scanner 12 ---
|
||||
-593,845,571
|
||||
-95,162,7
|
||||
-509,-378,-516
|
||||
504,-445,343
|
||||
-400,708,-674
|
||||
-554,-465,-583
|
||||
431,-519,471
|
||||
-473,-359,-516
|
||||
-592,828,716
|
||||
-931,-358,491
|
||||
-906,-487,413
|
||||
-628,838,754
|
||||
-487,573,-751
|
||||
370,841,-913
|
||||
625,922,330
|
||||
663,833,302
|
||||
429,-748,-651
|
||||
358,939,-895
|
||||
244,-687,-680
|
||||
-794,-417,415
|
||||
621,805,494
|
||||
350,946,-926
|
||||
351,-656,-694
|
||||
-488,687,-737
|
||||
575,-504,385
|
||||
|
||||
--- scanner 13 ---
|
||||
-540,634,673
|
||||
764,-806,-384
|
||||
489,306,-588
|
||||
141,-5,-53
|
||||
577,221,-522
|
||||
-383,-685,663
|
||||
-575,616,539
|
||||
-558,-546,-541
|
||||
-444,-533,-673
|
||||
-356,-714,588
|
||||
-603,633,440
|
||||
791,-862,408
|
||||
763,728,555
|
||||
610,-722,-434
|
||||
758,-918,432
|
||||
693,-743,468
|
||||
-611,661,-390
|
||||
607,-706,-368
|
||||
-1,-144,-29
|
||||
-280,-701,796
|
||||
-706,583,-501
|
||||
-709,727,-493
|
||||
764,719,476
|
||||
763,692,397
|
||||
643,299,-606
|
||||
-566,-523,-601
|
||||
|
||||
--- scanner 14 ---
|
||||
-636,680,-483
|
||||
718,525,642
|
||||
822,571,-429
|
||||
534,-636,-655
|
||||
-464,-684,-415
|
||||
34,31,141
|
||||
-600,748,862
|
||||
-629,673,889
|
||||
719,758,705
|
||||
-438,-516,679
|
||||
-448,-588,801
|
||||
780,425,-363
|
||||
-616,881,965
|
||||
467,-723,-700
|
||||
-462,-614,-303
|
||||
806,549,-467
|
||||
668,-416,539
|
||||
746,-305,634
|
||||
-461,-456,687
|
||||
701,624,670
|
||||
-795,747,-546
|
||||
-726,811,-463
|
||||
-540,-743,-278
|
||||
-82,-24,3
|
||||
812,-408,536
|
||||
467,-742,-736
|
||||
|
||||
--- scanner 15 ---
|
||||
570,716,-401
|
||||
813,-522,-700
|
||||
-565,-663,616
|
||||
577,-384,448
|
||||
71,-43,-130
|
||||
-641,-610,619
|
||||
-731,-539,-421
|
||||
-448,392,521
|
||||
563,363,512
|
||||
-486,-548,601
|
||||
792,-612,-764
|
||||
638,513,555
|
||||
-760,-644,-580
|
||||
680,-591,-767
|
||||
533,452,650
|
||||
-701,454,-458
|
||||
698,-382,317
|
||||
-309,433,468
|
||||
576,631,-465
|
||||
-18,83,4
|
||||
-617,468,-599
|
||||
737,-417,381
|
||||
-678,-502,-550
|
||||
-643,510,-487
|
||||
595,735,-538
|
||||
-419,340,533
|
||||
|
||||
--- scanner 16 ---
|
||||
-99,-26,105
|
||||
-171,-173,17
|
||||
-808,-569,-752
|
||||
-430,-810,823
|
||||
276,298,847
|
||||
-545,545,909
|
||||
406,-582,-466
|
||||
797,-624,681
|
||||
-592,481,-545
|
||||
-566,579,670
|
||||
483,-511,-365
|
||||
283,346,756
|
||||
390,447,-285
|
||||
766,-707,633
|
||||
341,480,-430
|
||||
-591,-585,-737
|
||||
814,-646,819
|
||||
-404,-880,890
|
||||
-381,-806,850
|
||||
-544,516,-546
|
||||
-514,646,760
|
||||
320,473,796
|
||||
-718,539,-542
|
||||
364,432,-384
|
||||
-684,-567,-828
|
||||
335,-604,-365
|
||||
|
||||
--- scanner 17 ---
|
||||
-814,515,-501
|
||||
351,736,-672
|
||||
-840,-376,629
|
||||
-809,-483,615
|
||||
420,355,558
|
||||
452,-906,-323
|
||||
-512,341,793
|
||||
461,-873,-478
|
||||
534,356,572
|
||||
-618,422,726
|
||||
-901,-561,658
|
||||
-866,536,-417
|
||||
346,616,-702
|
||||
-798,-485,-246
|
||||
-31,-18,-10
|
||||
-785,-377,-340
|
||||
786,-490,414
|
||||
-885,-489,-394
|
||||
278,697,-583
|
||||
-163,40,154
|
||||
-828,605,-546
|
||||
-531,377,793
|
||||
555,268,635
|
||||
793,-482,383
|
||||
688,-502,396
|
||||
346,-856,-366
|
||||
|
||||
--- scanner 18 ---
|
||||
-599,-418,-687
|
||||
485,631,359
|
||||
-642,-843,277
|
||||
894,-574,-927
|
||||
137,-133,-101
|
||||
-513,528,790
|
||||
-703,425,-406
|
||||
623,-464,487
|
||||
843,-793,-941
|
||||
616,-512,636
|
||||
-661,-584,-635
|
||||
857,650,-567
|
||||
765,-461,546
|
||||
-612,-497,-702
|
||||
-561,611,821
|
||||
-770,355,-380
|
||||
485,724,507
|
||||
929,-711,-860
|
||||
-699,589,838
|
||||
948,668,-660
|
||||
-730,429,-357
|
||||
-605,-829,293
|
||||
-24,-73,10
|
||||
586,653,430
|
||||
-757,-881,273
|
||||
872,666,-784
|
||||
|
||||
--- scanner 19 ---
|
||||
805,-688,638
|
||||
106,-100,35
|
||||
673,664,467
|
||||
-736,-787,-834
|
||||
-702,-600,-813
|
||||
641,-450,-283
|
||||
561,430,-721
|
||||
-708,-739,-828
|
||||
571,-441,-459
|
||||
-562,-605,531
|
||||
-610,479,771
|
||||
590,617,600
|
||||
-611,307,692
|
||||
623,461,-542
|
||||
-300,636,-543
|
||||
755,-696,517
|
||||
-551,-598,488
|
||||
-557,-549,612
|
||||
-380,632,-579
|
||||
-77,14,78
|
||||
611,563,-698
|
||||
782,-698,664
|
||||
-396,723,-429
|
||||
546,708,493
|
||||
-539,440,712
|
||||
647,-455,-494
|
||||
|
||||
--- scanner 20 ---
|
||||
-73,-55,-94
|
||||
679,574,-740
|
||||
412,-822,-515
|
||||
-380,370,-593
|
||||
587,593,879
|
||||
-693,453,644
|
||||
-818,416,667
|
||||
722,670,792
|
||||
450,-652,686
|
||||
608,656,791
|
||||
-288,297,-533
|
||||
457,-835,651
|
||||
-749,-809,456
|
||||
691,374,-778
|
||||
-793,-809,-818
|
||||
421,-914,-678
|
||||
113,-67,36
|
||||
-695,-740,-793
|
||||
467,-797,687
|
||||
-788,-744,476
|
||||
538,-900,-564
|
||||
-579,-816,-811
|
||||
662,430,-653
|
||||
-720,-744,577
|
||||
-333,306,-554
|
||||
-711,301,691
|
||||
|
||||
--- scanner 21 ---
|
||||
-720,-494,-326
|
||||
-779,-506,-326
|
||||
725,743,-671
|
||||
643,-838,-672
|
||||
735,624,-742
|
||||
780,-444,760
|
||||
635,-395,727
|
||||
-773,-551,682
|
||||
523,664,668
|
||||
712,637,-797
|
||||
4,104,146
|
||||
-655,857,-500
|
||||
-883,800,504
|
||||
-152,-49,102
|
||||
-923,-626,725
|
||||
681,-418,775
|
||||
-827,-424,-336
|
||||
601,-802,-556
|
||||
520,538,726
|
||||
617,-733,-612
|
||||
-698,874,-492
|
||||
-834,-656,587
|
||||
-892,821,623
|
||||
519,490,691
|
||||
-920,866,-491
|
||||
-796,858,617
|
||||
|
||||
--- scanner 22 ---
|
||||
80,-91,68
|
||||
564,449,615
|
||||
694,505,-425
|
||||
820,-741,761
|
||||
697,526,-537
|
||||
-542,-761,600
|
||||
-615,-889,674
|
||||
630,595,-404
|
||||
558,522,416
|
||||
-23,-171,-90
|
||||
635,-555,-793
|
||||
552,-486,-729
|
||||
-335,769,464
|
||||
464,420,470
|
||||
683,-817,702
|
||||
-344,568,399
|
||||
-75,6,7
|
||||
-833,-862,-867
|
||||
-686,-847,615
|
||||
-836,-696,-870
|
||||
615,-645,-662
|
||||
-348,698,547
|
||||
-518,733,-640
|
||||
795,-819,632
|
||||
-874,-749,-817
|
||||
-387,735,-519
|
||||
-451,700,-480
|
||||
|
||||
--- scanner 23 ---
|
||||
-521,536,-591
|
||||
405,-522,-611
|
||||
598,-743,933
|
||||
739,728,856
|
||||
-767,828,470
|
||||
553,913,-698
|
||||
-311,-634,587
|
||||
808,645,792
|
||||
-303,-497,588
|
||||
-36,32,-25
|
||||
475,888,-569
|
||||
447,-593,-552
|
||||
-793,724,594
|
||||
533,-449,-537
|
||||
-589,-447,-308
|
||||
-454,455,-697
|
||||
649,708,725
|
||||
477,776,-639
|
||||
-632,-369,-400
|
||||
-809,762,616
|
||||
545,-781,880
|
||||
105,114,172
|
||||
-310,-582,457
|
||||
432,-740,930
|
||||
-618,-262,-369
|
||||
-454,491,-678
|
||||
|
||||
--- scanner 24 ---
|
||||
-574,-700,-914
|
||||
645,309,-801
|
||||
511,564,648
|
||||
-735,664,363
|
||||
464,628,796
|
||||
703,-469,305
|
||||
691,-453,440
|
||||
-552,404,-633
|
||||
710,348,-821
|
||||
-763,685,451
|
||||
496,-926,-724
|
||||
702,-429,236
|
||||
-885,-631,405
|
||||
1,-36,-128
|
||||
452,672,723
|
||||
-672,-700,-757
|
||||
-928,-818,431
|
||||
-916,-845,434
|
||||
-515,279,-610
|
||||
515,-953,-752
|
||||
645,377,-700
|
||||
421,-973,-621
|
||||
-625,-803,-884
|
||||
-774,690,503
|
||||
-400,386,-586
|
||||
|
||||
--- scanner 25 ---
|
||||
-660,-612,759
|
||||
44,-15,-25
|
||||
-564,539,589
|
||||
-501,550,610
|
||||
817,513,-563
|
||||
412,-387,533
|
||||
-535,416,-425
|
||||
-819,-717,730
|
||||
743,582,558
|
||||
666,604,559
|
||||
-690,-754,677
|
||||
790,542,-488
|
||||
836,-482,-889
|
||||
781,-535,-703
|
||||
-473,-665,-681
|
||||
-540,-734,-814
|
||||
-665,512,540
|
||||
-618,347,-489
|
||||
742,-472,-731
|
||||
341,-434,684
|
||||
425,-390,548
|
||||
593,616,664
|
||||
-555,506,-556
|
||||
-476,-644,-793
|
||||
893,526,-355
|
||||
|
||||
--- scanner 26 ---
|
||||
283,522,745
|
||||
-873,247,471
|
||||
628,-379,499
|
||||
336,469,783
|
||||
-605,567,-596
|
||||
-904,279,268
|
||||
-675,529,-760
|
||||
-944,-764,-808
|
||||
-898,-880,692
|
||||
286,356,742
|
||||
-18,5,-170
|
||||
-93,-106,-29
|
||||
360,663,-726
|
||||
622,-869,-722
|
||||
-946,250,385
|
||||
759,-386,584
|
||||
-742,-793,-828
|
||||
629,-387,636
|
||||
-776,-774,753
|
||||
-830,-795,-768
|
||||
746,-843,-826
|
||||
600,-885,-760
|
||||
-654,540,-697
|
||||
424,732,-643
|
||||
491,573,-706
|
||||
-885,-685,732
|
||||
|
||||
--- scanner 27 ---
|
||||
706,-520,-692
|
||||
-101,126,35
|
||||
771,564,-698
|
||||
-480,528,-493
|
||||
442,456,859
|
||||
559,502,806
|
||||
752,-472,-669
|
||||
514,541,941
|
||||
-584,455,-474
|
||||
-875,-543,521
|
||||
-499,391,-468
|
||||
-747,589,719
|
||||
771,471,-550
|
||||
-763,-660,-431
|
||||
726,-380,811
|
||||
-823,-531,550
|
||||
670,542,-627
|
||||
-782,-478,411
|
||||
677,-552,736
|
||||
675,-422,649
|
||||
851,-487,-643
|
||||
-702,-565,-536
|
||||
-852,-522,-461
|
||||
-43,-34,179
|
||||
-761,448,803
|
||||
-705,477,745
|
||||
|
||||
--- scanner 28 ---
|
||||
573,505,-684
|
||||
8,-24,126
|
||||
428,-551,785
|
||||
857,610,665
|
||||
-56,144,29
|
||||
-507,671,603
|
||||
-723,-628,-438
|
||||
-717,-596,681
|
||||
850,592,511
|
||||
495,394,-589
|
||||
464,-393,785
|
||||
-586,488,-809
|
||||
-697,-643,701
|
||||
-698,573,-725
|
||||
429,497,-687
|
||||
523,-436,-581
|
||||
-702,-787,657
|
||||
-789,-593,-508
|
||||
-533,539,692
|
||||
935,526,599
|
||||
540,-535,-553
|
||||
-778,-650,-426
|
||||
-354,610,678
|
||||
116,29,-19
|
||||
522,-669,-518
|
||||
-553,559,-659
|
||||
437,-472,786
|
||||
|
||||
--- scanner 29 ---
|
||||
683,-540,-630
|
||||
402,-538,-643
|
||||
-329,-493,653
|
||||
840,566,429
|
||||
722,647,510
|
||||
664,-649,866
|
||||
28,-140,-104
|
||||
878,620,-837
|
||||
-765,-884,-623
|
||||
732,696,-778
|
||||
-28,13,9
|
||||
-454,309,-532
|
||||
-327,-538,662
|
||||
948,661,-747
|
||||
-340,-585,849
|
||||
817,-625,774
|
||||
434,-525,-638
|
||||
865,-603,814
|
||||
-430,363,472
|
||||
900,551,520
|
||||
-446,294,528
|
||||
-808,-917,-481
|
||||
-563,315,-597
|
||||
-510,267,-682
|
||||
-758,-915,-590
|
||||
-404,258,412
|
||||
|
||||
--- scanner 30 ---
|
||||
-299,482,-468
|
||||
753,540,-526
|
||||
737,658,-630
|
||||
835,-810,469
|
||||
-294,373,-321
|
||||
-718,-593,401
|
||||
-757,-504,474
|
||||
-637,-474,469
|
||||
-294,618,-363
|
||||
356,-836,-662
|
||||
-536,-675,-691
|
||||
680,719,-521
|
||||
505,718,872
|
||||
-589,832,666
|
||||
885,-853,575
|
||||
-532,795,629
|
||||
-626,-630,-705
|
||||
-56,-7,92
|
||||
385,591,857
|
||||
-380,769,678
|
||||
468,-782,-762
|
||||
517,481,906
|
||||
464,-930,-675
|
||||
-557,-759,-743
|
||||
852,-698,584
|
||||
|
||||
--- scanner 31 ---
|
||||
-504,-722,764
|
||||
-471,-655,604
|
||||
620,778,-539
|
||||
-579,438,-698
|
||||
-750,-487,-538
|
||||
-649,474,-531
|
||||
-41,117,16
|
||||
305,-582,-421
|
||||
-635,-502,-459
|
||||
-524,762,878
|
||||
-469,-786,725
|
||||
276,-591,590
|
||||
365,-453,560
|
||||
420,460,710
|
||||
-635,417,-543
|
||||
372,470,792
|
||||
-182,-19,99
|
||||
253,-570,-392
|
||||
426,-548,665
|
||||
618,810,-537
|
||||
-697,-484,-614
|
||||
346,-635,-282
|
||||
479,460,722
|
||||
-606,786,771
|
||||
-653,734,906
|
||||
676,838,-365
|
||||
|
||||
--- scanner 32 ---
|
||||
-839,-599,715
|
||||
351,-528,-912
|
||||
377,598,754
|
||||
-751,502,-745
|
||||
498,820,-545
|
||||
-631,-549,-889
|
||||
566,-519,640
|
||||
-706,-506,-739
|
||||
-862,-551,669
|
||||
-524,788,651
|
||||
332,607,752
|
||||
-149,64,-129
|
||||
-455,732,635
|
||||
-833,512,-793
|
||||
496,852,-547
|
||||
324,880,-489
|
||||
-419,848,677
|
||||
6,95,-6
|
||||
-763,502,-686
|
||||
479,-649,638
|
||||
380,-540,-860
|
||||
641,-691,689
|
||||
424,411,741
|
||||
241,-593,-819
|
||||
-601,-411,-800
|
||||
-813,-584,814
|
||||
102
2021/inputs/20.txt
Normal file
102
2021/inputs/20.txt
Normal file
@@ -0,0 +1,102 @@
|
||||
#####..#.#######.##.#.#.#.#####..######...#.##.###...#.##..#####..###.#.####..#.##.#....#...##.###..#.#......####.#...#.####.#..#.###.#.#.#.###.###..########.##.#.#....#.#####.......###.#..#.#.###.###.###.#.......#.#....#.##.###.....##...#.#.#..#.#....##..#####...##...#.##..##.##.#...###...#.##...#...#.####.###...........#...#..##...##.###.##.###.....#.##...###.....#.#.###..##..#..##..#.....##..##....#....####...#.###.#######.#.##.####.....####.#.#.##.#####...#.##.##.#.##..####.#.#.######.#..###..#.##.##...
|
||||
|
||||
##.##....#..#....#.....#..##.#...######.##.##..#..##.###.##..##.#..#..####..##..#.#..###..##...##.##
|
||||
..##.###.##..##.###..#.###....##.#.#...##.#.#..####.#..#..##...##......###...###.#..##...##.##.##..#
|
||||
.#..####..##..###..#.....#....##....###..####.##.##.#.#.##..######..#####.#...##.#..##..##..##...##.
|
||||
..###.......##.#..#.##.##.#..#######..##.......###.###.###.#..###...#.#####..###....###.##..###..##.
|
||||
.#..####..###.#.#..#.#..##...#...#.##...##..##..##.#######.....#.#..#.#.#.#.#.#..#.##......####..##.
|
||||
##..#...###.##....####.###.###.#.#.#........##...#.#....#######.######...##.###...##.###.##.######..
|
||||
##..##...#....#....#####.#.....#....#.#..#.#.##...##.##...#.####...#####.#.#.##...#..##.##.##.##..##
|
||||
..#..##..#..#...####....#.....###....##.#..#...#..#.##.#....#.#.#...##.#..#..#..##....#.##..#..##.##
|
||||
..##....######.###.#.....##.##....###...#..#.....#...###.###....#...#.##.####..##.###....#####...##.
|
||||
.#..##.###.#......#.#####.####..####......###.....####..####..####..#.######.####..##.#...#.##.####.
|
||||
####..##.##.##..#.#...##.####..####.#...#.#.##..#.###.#.....#....###.####.###..#.#..#.#...#.#.##..##
|
||||
.##..#....###..#####.##.....###.##.###.######.#.###.#.##.#.#######....##..#.#.##..#.##...#######..##
|
||||
###.......###.....#.#.##....##..#.##...#....####.##.###.....#.####..#........#...####.##.#.##...##.#
|
||||
##.##....##..#####.#...####.....##..#..#...##.#...##.#..#..########...###.##...#.##...##.#..##.##...
|
||||
.#.###...#.###..##...####..#.###.##.#.#...#..###.#.####..#..##.##.####.###...##.##.###..#.#.####.##.
|
||||
#..#.#.#.#.#.#.#..#####.#....####.#.......#..#####..##..#..###....#...#..###.#..###.##..#.###.##.###
|
||||
....##..##.###..####.#.###.##.....#...#...##.##.#.###..##.#.#..#....#.####.##...#.#...#.#...###...#.
|
||||
##...#....##.#....###....#..##.##.####.#.#.##..##.####...#.#....####..#.##.....#....#...#..##...#...
|
||||
#.##...#.##..#.##.###..##...##.#.#..##..#.....###.#.####....#######.#.#.#####.#....##.#.....####....
|
||||
.....#####..###...#.#.#.#...#.#..#.###..##.##....##.###..###..###.#.#...#.#.##.###...#...##.#..#.##.
|
||||
...###.###.###.#..#.#.####.##...##.##..#####.......#.##.....#####..#.#######...#..#.###......#######
|
||||
#..##.....###..#.###..#..###.#.##...#...#......#.###..#...###...#..##......#.....##.####..##...#...#
|
||||
.....##..#.#.#..#.#.#.#####...#..#.......#..#..#....#..##..##.#.#..#.####..#...#..##...##...#..#####
|
||||
...##..#.#...#...#.####..#.##.###..##..###.......#..######.#.###.#..#.##.###.....########..#..#...#.
|
||||
#.#...##...#.##.##.#..#..#.#....##.#.#...#.#..####.#...#.#..######.#.##....#.#...##....#..#.#.##.###
|
||||
...#####.##.####.##...#..##.#..##...#..##..#.##...##..#.#.###......#.###.#.#..###...##..##.##..###..
|
||||
.##...###..#....#.#.....#..#.##..###.#..###..###.#..#.#.###..#...#..####..#.###.##.##.#.#.#..#..#..#
|
||||
.#..#.#.#..#####.##...#.#...###.####.##..###....######.##..##.#...#.###..###.###....##.#......#.##.#
|
||||
#..####.######....###..####.##.##.....#.##.####.##..##.#..##.#.#.#.##.##..#.###.##..####.##.#.##..##
|
||||
....#.#..........#.##....#.#..#.###.##.####.#.#..##.#..##.#..#.....###.#..###.######..##.#......####
|
||||
...#..#.##.###########...###.###..##......#..###.#.#...##.##...####.##..#.........##...##.###.###.#.
|
||||
.##.#####.#...#.###.#..#..#.#..#.##...#.#..##.#.####.##..######....##.####...#..###.####.#...##.#...
|
||||
...#.##..#..#.#..##..#.#..##.....#.##.#....#..#..#.#......##.####...####...##......##..##....####.#.
|
||||
####.##.#...#....#.#.#..###.##.###..#.###.#.#..#.##.##..##.##.#.#..#.####...###.####.##.....#.#...##
|
||||
#........#.###..#.#.#####...#.##.#.###...#..#...##.##..#.###....#.###..#.#.#.###.#.##.#....#......##
|
||||
...#.##..##.#..........#..#....###.#..#..#.#...###.##..#.#...###.####...####..#.####.######.#....#..
|
||||
##.#.####.##.#.##..#..##...###...###.##..##.#####..###..#..#.#..#.##...#.####...##.##..#.#.#..###...
|
||||
#.####..##..#.#..##..##.#..#..#...#.###.#.##.####.###.###...##.#####..##..####...##.##########.#.###
|
||||
####.##..###.####.#.######...#..#.##.#.....##.#....#...#.############..#.#.###.####.#.#..#.###....#.
|
||||
..###..#...##.#.##.##..######.###.###..#..#####....#.#....####.#..#.......##..#####.#...#.#.##....#.
|
||||
.#.##...#..#.##.####......#.#......######.#.#.##.#..##..#....##..##....#.##.###..#.##..#.#.....##...
|
||||
###..###.########..####.###.#...###.........##....##.##..#...#.##..##..#.#.####....######..#..#...##
|
||||
##.#..###..#.#..#...##.####.#..##..##...###.##.#......#........###...#.###..####..####..#####..###..
|
||||
#.##...##..##..#.#.###..###...###.....#.#.######.....##.....#.##..##.#...###.###.#.#..#.##.##.##.#..
|
||||
#..#.#####..#..#...#.#...#..##.#..#.###...#..###.###.#.#...#.###..#.###..#..##.##......##...#...###.
|
||||
#....#.##.....#.#...###....#..#.#.#..##.##..###.###..#..#.#..##.....###.#.#.#...#.##.#..##....####..
|
||||
#..#####...#...#####.###.#..#..#...####.##.#.#..#...#.####...##.##.....#.#.##.##.##.#....#.######..#
|
||||
###...##..##.##.##.#..##.##.#.##.##.#..#.#####..#.#..#.#..####....#.###..###...####.#....#...#.###.#
|
||||
##...####...##.######...#...#..##..###..###..#.##.#.#.#...##.#.###...#...########..#.#######...###..
|
||||
.###...#.#.####.#.#...##.#.###.#.###.#####.###..##.#..###..#.#...##...#####..##....#..#..##.#.#....#
|
||||
...#..#....#..#....#.#.##..#..#####....#..#.#..####..####.####.###......###..#..#..###.##.###...###.
|
||||
#.#...#.###.###....#..###..###...#..#####..#.##........###....###.###.##.###.#..##..#.....#.#.####.#
|
||||
#...#.#...#.#..#..#.##.##.#......#.#.#..###....#.#.#.#..#.#.###..#..#..##.#.#.#.##...#..###.####..#.
|
||||
#.#.##.####........#.##..#.#.#...##..#.#####.#..#.#..#.##.#..####.###.#####.#.##.#....##..#####.####
|
||||
#######.##..#.#..#...#..#..#.######..##.#.###.#...#..####..##.#.##.###.#.##.#.##..#...#.#..#.#.####.
|
||||
.##..#####.##.####.##.#....##.....###.......#.####.###....#...#.#####.###.#..#...##.#..##.#....###.#
|
||||
..####.#.#.....#...###.#...#.#...#.####..##..#..######......#...#.##.####..#.......#.##.......#.###.
|
||||
.##..#.#####..##..##.#..####.##.##.#.###.#.#.....#.....#.#...####....##.##...####......##.##.#######
|
||||
#.#.#..###..###..##.#..##...###..###..#..#.###.#..##.##...##..#..####....####.##.#.###...#..##.#.##.
|
||||
##.##.....######.#..##.#.#.###.##.###.##....######.##.#.##..#..##...#...#..#.#.#.######..#.###.##..#
|
||||
#..#.#.###.#.#.#.....###.######..##.##.#.#...#####.#...##.##.##.##....##....#..#.##.#.##..##...#...#
|
||||
..#.....#....#...#######..#.#.#.#.###.##.#.##.###..#..##..###..#.#####..###.......####.#..####..#...
|
||||
#..#.#...##.##..#.#.....###.##.#.#....###....#.##..#....#####.##.#####..###...####.#.#.#.###.#....##
|
||||
#....##..#..##..#.####..##.##....####..##..#..####.######.##..#.###.#.##....###.#....##....##.#.##.#
|
||||
.#.#.#.##.##...###.#.#...#...#..######.##.#.#.##.####.....#.#..#.######.......##.#####..#....#####.#
|
||||
.###.#.##...###.....##..#.#..##....#.###..##.##..####..##.#.###..##.#.#...##.#####.#.....#..#..#####
|
||||
#.#.###..#....####....#...#.###.#..#...###..###......##..##.#.#..#....#......###...##..#.##.##...#.#
|
||||
###.####.##.#.##.......##.....#.#.###......##..#.#....###..#.#.##.###.##.##.##.#..#.####.#......###.
|
||||
####...#...##...#.#.#..######.#####..##...#.##.##.####.##.#.##..#..#.#.##.#...#......#.##.#######...
|
||||
.##...#....#.##.#...#..#..#.####..#.#..........#.#.##......#.##.######.###.#####.#.#####.###.####...
|
||||
.##.##.##.###..###..##.#..#.###..#####.#..##.##.#.####....###.#..###...##..##..#.##..#...#..###.##.#
|
||||
#.....##..#...##.#...#.###.##..#.....##..#.##...#.##...#.#.##.#...#.#..###...#...#######...#.#.....#
|
||||
.######..#.####.#.##.##.#.#.#.#.###.#######...#..####.#.#..#####..#.....###.##...#.###.####.#.#.....
|
||||
#.####..##...####.##.#.##...####..##.#.#..####.##.#.###.##..##.##..###.##...##........###..#.#.##...
|
||||
#...#.##.....###.##.....####.####.##.##.##....##.#.#.#.##...#.#.##..#..##.....##.#...##..##...##..##
|
||||
#..#.###.#....#.##...##...#.#......##.###...#......##..#..##...##.#..###.#..#.#.#.##.........##.#.##
|
||||
.#.#..#..#.#..##...#.#...#..###.#...#.#.##.##....#.##.#...#.##.#..#.#..##..#.##...#.#.#..###.#.###..
|
||||
###...#.#..##.###...#..##.#..##.#.######..####..#.#.....##....##.####.###...#.#...#.#..#..#.###....#
|
||||
.####.###..##.##...#.....##.###.#..##..####.....#....##.....#....##..##...##....#..#..###.#...###.##
|
||||
..###..###.#.#....#.##........#...####...####...#.####.##.###.##...#.####.#.###..###.##...##...#.#.#
|
||||
###.#..#.#...#.#.#.....##.###...#..###.#....#.##.##.###..#######.###.#...###.####...#.#.###.#...####
|
||||
#.#....####..#.#.###..###.###.#.#.##...###.#..###.#.#.#...###..#...##...#..#..###..##.#..#.##...###.
|
||||
.###..##.#..#.#.#####.#..#.........##..##...#...#.#...##..#.##...###..#.#.#..####....#.####.##.#....
|
||||
##.....#######....#.###.##...##.##.#####.#....#########.##....##.###...#.###..##.###.#..##..#....#.#
|
||||
...#.##.#.......#.#....#..##..#..##...#.#.####...###.##..##...##.#.##.#.###.###.###..####..#######.#
|
||||
.#.###...##.##.#.......#.#...#..#####...##...#...#.#####.##.#......#.##...#.###.#.#..#.#..##..##.#.#
|
||||
...##...##.#.#...#...#.###..###....#.##...##.....#...##..##....#..##..#.#..#.#.#.........##.#####..#
|
||||
........#...#.......#.#..#..#......##..##...##......#.....#.#.......#.#####.#.#.#..#...#####.#..####
|
||||
#.#.###...###....#...######...#.#.#####.##..#..##.##..#..#..#..##...###..#.#.#..##...#.#.#.#.####..#
|
||||
.#..#...##...#....#.#.##.#.#....##.#....#...#.#.##.....#########.#....#.##..#..#.#.##..#.#..###....#
|
||||
##..#.#.#..###.....###.#..#.##..##....###.#..####.#.#.#..######..###..#.#.#...#...#...#.#..#.#..###.
|
||||
.#.##.#.####....#..#.#...#.##......#..#.....#...#....#.##########..#...#.#.###...####..###......##.#
|
||||
###...#....###.#.#..#...#..####.#...#.##..#.##.#...###.#.#..#.###.###...#......#..#.##.#..#####...##
|
||||
.###.##.#..###...#..####.###...#.##..##....######.#..##...#...#.##.....#.####.########.##....#.##.##
|
||||
.......######.#...#...#.###....##..#.###.#...##.##..###.#..##...#..########.#.#.#...#..#..##.##..#.#
|
||||
..###.##..#..#####.#.##.#..#...##..#.#..###.###....###...#..##......###..#....#.#.....#...#..##.#..#
|
||||
###..##..#.#....#####.#######..#..##...#..#...#.#........#...###.#.###..##.####..#.####.#..#..#...#.
|
||||
...#..###.#.#.#.###...#.......####..###.#.##.####.#..#.#..#########.#.....#...##..#.#.#..#.#.#.#...#
|
||||
####.#..##.##..#..###.######.#.#.###...#####.#.###.#####.#.#.#.#...#.#.#...#.#########.#..###.##.###
|
||||
.##...#.#.###....##..##..#.#.#.#.#..#..##.###...####..#..#.#.#.#####..##.#.#.##.##...#.....#...###.#
|
||||
2
2021/inputs/21.txt
Normal file
2
2021/inputs/21.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
Player 1 starting position: 9
|
||||
Player 2 starting position: 4
|
||||
420
2021/inputs/22.txt
Normal file
420
2021/inputs/22.txt
Normal file
@@ -0,0 +1,420 @@
|
||||
on x=-33..18,y=-35..11,z=-49..2
|
||||
on x=-14..32,y=5..49,z=-42..5
|
||||
on x=-28..18,y=-38..10,z=-14..33
|
||||
on x=-40..6,y=-22..32,z=-32..13
|
||||
on x=-14..37,y=-37..12,z=-31..19
|
||||
on x=-24..30,y=-40..6,z=-19..27
|
||||
on x=-29..15,y=-44..7,z=-22..22
|
||||
on x=-49..2,y=-29..15,z=-1..48
|
||||
on x=-1..45,y=-6..39,z=-16..37
|
||||
on x=-15..30,y=-35..14,z=4..49
|
||||
off x=20..39,y=29..46,z=-30..-15
|
||||
on x=-36..9,y=-8..38,z=-38..10
|
||||
off x=-22..-4,y=10..19,z=-4..10
|
||||
on x=-43..9,y=-37..16,z=-24..23
|
||||
off x=10..29,y=1..10,z=-2..16
|
||||
on x=-18..34,y=-39..8,z=-31..23
|
||||
off x=-2..7,y=-41..-23,z=4..23
|
||||
on x=-18..31,y=-27..27,z=-23..25
|
||||
off x=17..33,y=5..14,z=-26..-7
|
||||
on x=-29..25,y=-1..44,z=-5..44
|
||||
on x=-2089..22263,y=63383..83317,z=1521..34560
|
||||
on x=16324..26707,y=-76181..-51644,z=27623..60727
|
||||
on x=-95252..-74929,y=-36262..-8635,z=-14014..-4726
|
||||
on x=26087..56689,y=13866..33100,z=-77678..-54222
|
||||
on x=-58261..-34558,y=-52429..-39076,z=-46433..-17880
|
||||
on x=38567..59604,y=66243..73633,z=-4724..7559
|
||||
on x=-76223..-52004,y=-4022..17420,z=-56813..-31010
|
||||
on x=-28531..-6777,y=52497..78911,z=39320..53754
|
||||
on x=-1705..20943,y=71494..92397,z=2586..17205
|
||||
on x=43970..50168,y=-44993..-18711,z=-68417..-46597
|
||||
on x=-2878..23564,y=41697..70518,z=42674..68678
|
||||
on x=22987..51001,y=-74194..-62557,z=-40942..-24407
|
||||
on x=10735..33969,y=26636..35170,z=62555..84961
|
||||
on x=-87260..-58460,y=-25011..9170,z=-40488..-16433
|
||||
on x=-41317..-19098,y=55028..74495,z=9284..32979
|
||||
on x=57730..86394,y=-5618..4073,z=8825..29287
|
||||
on x=70498..95095,y=-26060..-15204,z=-11673..3577
|
||||
on x=-12181..6283,y=-76734..-56136,z=-41358..-26351
|
||||
on x=55479..68566,y=-65998..-51191,z=-388..13824
|
||||
on x=-7142..9719,y=17804..41523,z=-73454..-51015
|
||||
on x=-6780..13903,y=64955..76512,z=-35477..-12220
|
||||
on x=8140..17232,y=-84619..-62523,z=-28417..-860
|
||||
on x=-59883..-49433,y=-65970..-42610,z=8348..17483
|
||||
on x=-46361..-34652,y=-77141..-58593,z=-32375..2092
|
||||
on x=18682..23347,y=-70715..-62353,z=15488..48836
|
||||
on x=13625..33572,y=-53090..-39232,z=38313..62732
|
||||
on x=-7845..8128,y=72275..83684,z=9204..44598
|
||||
on x=30099..52396,y=-37319..-13384,z=-65551..-51334
|
||||
on x=66812..86665,y=-12147..-8315,z=-14456..18299
|
||||
on x=-80768..-62714,y=12166..32801,z=9298..28465
|
||||
on x=32917..51529,y=-39942..-11579,z=-77830..-58654
|
||||
on x=6795..30180,y=-52748..-23421,z=-79235..-66193
|
||||
on x=41104..59365,y=-65904..-44389,z=-58998..-32127
|
||||
on x=46835..68448,y=-13278..-4034,z=47409..74764
|
||||
on x=61812..89996,y=-11979..17125,z=-42861..-30521
|
||||
on x=36211..58568,y=65204..73638,z=-2374..22331
|
||||
on x=24752..29245,y=68946..77065,z=21993..33524
|
||||
on x=64234..90251,y=15294..35642,z=26838..33725
|
||||
on x=-19948..6112,y=-38109..-27877,z=62697..87704
|
||||
on x=-45769..-27330,y=-76264..-42424,z=34120..46556
|
||||
on x=-64655..-37560,y=32027..51779,z=36246..55408
|
||||
on x=46729..77810,y=30499..52592,z=22011..48493
|
||||
on x=-59194..-47087,y=61036..63539,z=-9127..12439
|
||||
on x=31894..45260,y=56306..80190,z=-39056..-4346
|
||||
on x=-28505..-11114,y=76279..91855,z=-17517..2342
|
||||
on x=-29827..357,y=-55982..-33070,z=53295..78681
|
||||
on x=61904..90365,y=-45148..-26196,z=-31689..-11315
|
||||
on x=-63745..-30029,y=-60515..-23200,z=-53318..-41274
|
||||
on x=35857..48971,y=-18159..16867,z=-83848..-48218
|
||||
on x=-58426..-37407,y=47038..72640,z=2498..22588
|
||||
on x=40878..41799,y=-86884..-48581,z=2168..20716
|
||||
on x=-26137..-535,y=60867..81985,z=-60883..-30553
|
||||
on x=-49390..-18873,y=19679..41934,z=64209..74274
|
||||
on x=-13205..4850,y=-54788..-33129,z=-74136..-52452
|
||||
on x=34452..69258,y=-18117..-14331,z=53496..73956
|
||||
on x=-26084..-6353,y=-28975..-2494,z=57753..84222
|
||||
on x=-55087..-32324,y=-62117..-47889,z=-36986..-26405
|
||||
on x=-49256..-42251,y=-58341..-32455,z=35370..57488
|
||||
on x=-29709..1208,y=44395..60836,z=44943..75568
|
||||
on x=9674..39186,y=-85531..-68265,z=11474..22020
|
||||
on x=-54733..-30617,y=-57541..-41688,z=44653..71542
|
||||
on x=58013..78420,y=-31202..-19242,z=18818..28322
|
||||
on x=-68634..-53973,y=-58009..-31614,z=-5131..5865
|
||||
on x=-16576..3952,y=63366..90574,z=8992..37515
|
||||
on x=-7386..14817,y=-14155..5703,z=66136..88553
|
||||
on x=19106..54924,y=-12140..15434,z=68415..80932
|
||||
on x=7336..31425,y=65432..82588,z=8047..29593
|
||||
on x=22525..33599,y=-68372..-39358,z=-68143..-43500
|
||||
on x=5213..21274,y=-39249..-27045,z=-91831..-72038
|
||||
on x=-31642..-16632,y=-2869..8672,z=66852..81506
|
||||
on x=70305..84886,y=-41625..-15439,z=-29089..-2340
|
||||
on x=-60096..-54846,y=-46888..-14091,z=-57849..-36369
|
||||
on x=-44911..-23725,y=-22548..198,z=55411..76767
|
||||
on x=-57512..-33022,y=-64054..-54691,z=22591..39559
|
||||
on x=535..39401,y=56745..78405,z=23560..28326
|
||||
on x=-56374..-39060,y=-77520..-41804,z=-7273..13316
|
||||
on x=7013..28554,y=32070..54196,z=47529..70955
|
||||
on x=-76288..-56876,y=-56665..-25593,z=-16778..-6302
|
||||
on x=-37510..-11747,y=61094..74622,z=-2370..18659
|
||||
on x=-58709..-30616,y=-33464..-11638,z=50961..72748
|
||||
on x=-55454..-27679,y=-82741..-59621,z=-9194..15631
|
||||
on x=13172..40388,y=11138..40063,z=-82760..-65315
|
||||
on x=14388..27772,y=-67554..-46788,z=-70583..-43179
|
||||
on x=15748..48411,y=-58853..-46690,z=45719..67485
|
||||
on x=-64826..-42121,y=-69677..-41462,z=-19124..10506
|
||||
on x=-38968..-4505,y=21318..56103,z=53808..76243
|
||||
on x=52992..73842,y=-45007..-30798,z=-40845..-17070
|
||||
on x=-72448..-52368,y=-13003..12727,z=-51653..-39744
|
||||
on x=-89717..-56812,y=-11429..11004,z=-33713..-29320
|
||||
on x=-82797..-68105,y=-907..18442,z=-48479..-36446
|
||||
on x=-52400..-36160,y=-2729..11358,z=-73134..-48314
|
||||
on x=-25713..-1239,y=45923..57024,z=-64104..-48955
|
||||
on x=-24274..3585,y=-91301..-60004,z=-36996..-8396
|
||||
on x=-72952..-55266,y=-33277..-2819,z=-34959..-11204
|
||||
on x=-66793..-46197,y=50987..54931,z=-27353..-16284
|
||||
on x=43392..52101,y=-14627..12623,z=-71060..-48522
|
||||
on x=-77723..-72809,y=6362..11492,z=9252..30717
|
||||
on x=32463..54093,y=18767..32223,z=-79630..-54627
|
||||
on x=26726..36372,y=-18434..723,z=54237..77721
|
||||
on x=62209..80598,y=-43071..-26185,z=11647..20283
|
||||
on x=-12408..8805,y=-82322..-75005,z=-7927..12271
|
||||
on x=66471..72381,y=-1981..28059,z=27987..48109
|
||||
on x=-80370..-49201,y=-61716..-49683,z=-30867..-7453
|
||||
on x=37596..66737,y=-68892..-60777,z=-33858..-8114
|
||||
on x=17321..30730,y=-52278..-42302,z=54029..68729
|
||||
on x=-77142..-71446,y=7200..27046,z=-14711..12602
|
||||
on x=-22544..-1958,y=-33075..-2255,z=-86145..-70682
|
||||
on x=55145..79591,y=-11592..16417,z=-30690..-11963
|
||||
on x=-13258..8815,y=64606..98004,z=-8762..6548
|
||||
on x=11099..20143,y=57055..77284,z=-23767..-18751
|
||||
on x=52489..83696,y=15746..31820,z=8280..43534
|
||||
on x=-66484..-41050,y=-57811..-31218,z=24204..41390
|
||||
on x=60564..85343,y=-27885..-15572,z=-28159..7052
|
||||
on x=-317..14600,y=68181..76576,z=-39440..-13155
|
||||
on x=-75121..-51737,y=-40321..-29860,z=15647..37621
|
||||
on x=-54204..-41260,y=5051..35207,z=53197..81544
|
||||
on x=36998..51680,y=51159..76975,z=5399..12759
|
||||
on x=-16863..16337,y=-80953..-58351,z=-59967..-35458
|
||||
on x=31744..60271,y=-14750..10965,z=49476..82924
|
||||
on x=-2256..18179,y=-73825..-67358,z=-34072..-25314
|
||||
on x=17732..43807,y=62479..77780,z=13938..28034
|
||||
on x=1622..28357,y=-82169..-57048,z=-25837..88
|
||||
on x=-40461..-9223,y=62104..86603,z=14710..22383
|
||||
on x=-81227..-61564,y=-42653..-23629,z=29983..44317
|
||||
on x=20880..48206,y=41863..67134,z=32598..46063
|
||||
on x=-96416..-62247,y=-18355..6029,z=-5981..7217
|
||||
on x=-57869..-30585,y=56288..73456,z=16646..22837
|
||||
on x=75450..92466,y=-20645..12847,z=-25402..-14103
|
||||
on x=-5465..14054,y=-35719..-4050,z=71849..89372
|
||||
on x=-61081..-25279,y=-66905..-48434,z=23859..40935
|
||||
on x=-7800..10807,y=71020..85725,z=-15915..7901
|
||||
on x=53985..76201,y=20582..53668,z=-1323..23345
|
||||
on x=-85787..-63425,y=27676..42137,z=-9285..-3133
|
||||
on x=48336..68487,y=-38490..98,z=41624..59831
|
||||
on x=-78012..-53039,y=30299..67166,z=19090..40584
|
||||
on x=5113..13878,y=-78897..-73837,z=11134..18475
|
||||
on x=41756..68743,y=-155..35498,z=50442..64705
|
||||
on x=-81270..-68840,y=-17576..-3690,z=-32135..-14787
|
||||
on x=8219..40862,y=8918..25218,z=-77252..-54208
|
||||
on x=39105..44578,y=66714..83921,z=15354..22292
|
||||
on x=46189..61321,y=43841..68088,z=19301..53413
|
||||
on x=-62770..-57542,y=-20733..14047,z=-67275..-32150
|
||||
on x=65480..84873,y=3073..19647,z=6345..23441
|
||||
on x=46867..47491,y=46506..52780,z=26672..40094
|
||||
on x=17013..41829,y=-11136..13219,z=-82179..-70797
|
||||
on x=-34036..-23731,y=33357..53053,z=51260..72738
|
||||
on x=31113..47177,y=-66933..-39151,z=-61354..-38916
|
||||
on x=34145..51166,y=-3683..10926,z=52987..77874
|
||||
on x=41954..65645,y=-56607..-45672,z=-4255..10356
|
||||
on x=-68089..-55495,y=46167..65284,z=-2384..10704
|
||||
on x=7890..33438,y=37201..73446,z=-61118..-42873
|
||||
on x=-7504..12073,y=-76259..-56952,z=29469..62400
|
||||
on x=13684..21664,y=-31197..-1820,z=68848..89615
|
||||
on x=-85435..-60015,y=-25411..-2834,z=-13167..8182
|
||||
on x=-76535..-58434,y=-29534..475,z=-33953..-16134
|
||||
on x=-59255..-45581,y=42904..53487,z=-44277..-36999
|
||||
on x=24422..52934,y=-69287..-47156,z=27348..40808
|
||||
on x=-77855..-49832,y=-40133..-15312,z=-44484..-35346
|
||||
on x=-41154..-18246,y=4608..24334,z=73408..80625
|
||||
on x=-49987..-14202,y=25483..46341,z=-72668..-53755
|
||||
on x=13538..18051,y=23397..42374,z=64790..80510
|
||||
on x=54955..79143,y=-54794..-41945,z=10831..26883
|
||||
on x=-18711..-1344,y=-66328..-31191,z=59213..66700
|
||||
on x=-42306..-25865,y=-84072..-59112,z=-10635..13499
|
||||
on x=-78607..-56882,y=28422..42754,z=-42069..-4658
|
||||
on x=70330..93330,y=3485..16587,z=-2226..11978
|
||||
on x=42999..75014,y=-73237..-35809,z=-16684..5008
|
||||
on x=14380..47360,y=-7768..2171,z=-75135..-69101
|
||||
on x=56578..76847,y=-38598..-29395,z=-32815..-15926
|
||||
on x=-12748..8540,y=15488..35223,z=54552..86464
|
||||
on x=3158..16552,y=-24454..1647,z=-80496..-74467
|
||||
on x=56473..73209,y=-3433..12083,z=-54506..-38799
|
||||
on x=51012..77530,y=30088..48866,z=8772..24396
|
||||
on x=17665..25364,y=39750..62592,z=46640..74482
|
||||
on x=-28714..-6773,y=9347..31266,z=73840..78208
|
||||
on x=8925..38027,y=59998..85715,z=-24137..-10466
|
||||
on x=53001..66549,y=-4287..21472,z=-73164..-44211
|
||||
on x=-54149..-45881,y=-28052..-10796,z=49458..62599
|
||||
on x=-21963..6658,y=66148..91598,z=-21298..6962
|
||||
on x=-11782..161,y=-91012..-60861,z=21515..30530
|
||||
on x=-76804..-69730,y=13746..32487,z=-23642..-13658
|
||||
on x=963..15271,y=-71045..-39328,z=-71381..-47851
|
||||
on x=67896..74688,y=-32914..-22017,z=12647..33400
|
||||
on x=12634..39919,y=-66590..-50495,z=50004..68679
|
||||
on x=8442..27410,y=9042..25167,z=68135..95195
|
||||
on x=-25776..-14278,y=-29280..-10089,z=69100..90070
|
||||
on x=64423..65336,y=3388..18317,z=-63336..-39916
|
||||
on x=35919..66955,y=14633..25424,z=55317..61335
|
||||
on x=-73286..-65915,y=-44128..-28250,z=22971..40421
|
||||
on x=15859..26558,y=-56047..-29767,z=42976..66388
|
||||
on x=-6917..5955,y=65260..87252,z=-24846..4318
|
||||
on x=-65972..-29473,y=32115..66783,z=35787..53459
|
||||
on x=-67248..-44667,y=33707..64039,z=-31788..-18880
|
||||
on x=45484..66247,y=38595..43467,z=4589..29393
|
||||
on x=13889..18349,y=66828..91044,z=14198..32527
|
||||
on x=54724..85550,y=-30589..-5424,z=35166..56213
|
||||
on x=-42965..-21638,y=-60889..-33965,z=43998..65167
|
||||
on x=-35930..-32769,y=-78331..-56047,z=-14735..9050
|
||||
on x=-24860..-8877,y=-80975..-43953,z=44660..63576
|
||||
on x=-14165..8370,y=-22173..-12379,z=57378..77093
|
||||
on x=71416..77554,y=-27428..6152,z=-49013..-27924
|
||||
on x=-93105..-68413,y=-35230..-13620,z=-20316..293
|
||||
on x=18417..29118,y=-86664..-54984,z=-36954..-22621
|
||||
on x=55918..67650,y=-41116..-22359,z=-41830..-26146
|
||||
off x=46522..78165,y=-65457..-45507,z=6815..36492
|
||||
off x=47885..74001,y=-31398..-10975,z=28012..47043
|
||||
on x=-91510..-71175,y=-16528..11618,z=-12499..8654
|
||||
off x=-84874..-61512,y=8619..38028,z=-54298..-34830
|
||||
on x=-83118..-51007,y=-45381..-31920,z=-23725..3021
|
||||
on x=10327..15960,y=-81856..-71010,z=-33630..-17410
|
||||
on x=23031..50754,y=-44713..-23633,z=-63299..-46320
|
||||
on x=-46257..-28480,y=-49238..-30841,z=47755..73142
|
||||
off x=20153..42123,y=-1222..5657,z=-77756..-63549
|
||||
off x=-61474..-57812,y=21117..35860,z=35705..60812
|
||||
off x=-79310..-66078,y=30244..44852,z=-9818..11212
|
||||
on x=71346..88869,y=-31928..-3884,z=-24256..-2336
|
||||
on x=-14150..11801,y=-57201..-51842,z=40079..61755
|
||||
on x=-40978..-28089,y=-42914..-23485,z=55939..67185
|
||||
off x=-23863..-13907,y=-536..10465,z=-90190..-61663
|
||||
on x=-5454..24659,y=-79999..-64557,z=27835..52330
|
||||
on x=72970..84571,y=10891..31328,z=-6227..5365
|
||||
off x=-29582..-11617,y=15192..35976,z=-79544..-70922
|
||||
off x=31030..48464,y=53376..61684,z=23041..44016
|
||||
off x=-10069..14806,y=35482..66322,z=-63854..-56881
|
||||
on x=53051..84557,y=-15724..16551,z=42287..54722
|
||||
on x=14308..26815,y=-13886..-3319,z=-79479..-57838
|
||||
off x=-59590..-50887,y=24924..38221,z=-57585..-33212
|
||||
on x=-63473..-31750,y=-64527..-52962,z=3041..21881
|
||||
off x=-31812..-7489,y=-22611..5463,z=-94027..-61918
|
||||
off x=-82927..-54190,y=-9326..-491,z=20413..40734
|
||||
on x=17422..42553,y=8312..32307,z=-71649..-69485
|
||||
off x=-78294..-58360,y=35412..45701,z=11726..40925
|
||||
on x=-21097..-3642,y=-8835..14381,z=-99475..-68222
|
||||
off x=-84402..-69432,y=-14573..10548,z=14300..22158
|
||||
on x=48734..68681,y=-34310..-26273,z=-52329..-23613
|
||||
off x=-35075..-15047,y=-46105..-25811,z=63394..85781
|
||||
on x=-86314..-54848,y=-46805..-24845,z=3445..37489
|
||||
on x=-63351..-50251,y=1886..23129,z=49969..56775
|
||||
off x=9515..27274,y=50806..72697,z=-49477..-25800
|
||||
on x=-35588..-13052,y=15904..42770,z=-81932..-66144
|
||||
off x=-46532..-36208,y=52000..73477,z=1265..25986
|
||||
off x=-87317..-63208,y=-17777..9520,z=-23859..-3922
|
||||
on x=-6728..4683,y=-95124..-75630,z=-29826..-12203
|
||||
on x=18636..43049,y=-80651..-64046,z=-24566..10269
|
||||
on x=34590..45757,y=-60461..-41469,z=-61769..-39386
|
||||
off x=69352..98422,y=4474..7247,z=-13318..-2831
|
||||
off x=-8443..8104,y=-47359..-17553,z=61091..78345
|
||||
on x=36926..56794,y=-55435..-27634,z=31804..55162
|
||||
on x=-43184..-19362,y=-73702..-61346,z=-50469..-12904
|
||||
off x=-12667..10577,y=9915..24867,z=-88319..-68574
|
||||
off x=-41812..-19280,y=-50846..-20974,z=-73207..-56898
|
||||
on x=25317..48114,y=45115..64793,z=-34388..-8697
|
||||
on x=-7572..26486,y=45477..70127,z=50627..71118
|
||||
on x=-65568..-53227,y=46928..71092,z=-13475..-291
|
||||
off x=-79123..-55369,y=-24021..-16788,z=17459..45068
|
||||
on x=26906..52136,y=17854..35117,z=-79712..-60188
|
||||
off x=73240..87023,y=-12287..13613,z=10048..23682
|
||||
off x=-2039..1086,y=20152..33227,z=72963..88128
|
||||
off x=-16444..-292,y=35253..51124,z=49972..79032
|
||||
off x=-31142..73,y=52811..81568,z=35320..52590
|
||||
off x=-45280..-38826,y=32419..56574,z=34445..72131
|
||||
off x=-76025..-59111,y=14..8694,z=-60123..-35050
|
||||
off x=-15911..3734,y=-23253..-9645,z=-88648..-77200
|
||||
off x=47880..75437,y=28421..53226,z=33581..53756
|
||||
off x=16705..55995,y=-22513..-5765,z=-79544..-52799
|
||||
off x=43351..73267,y=-30268..-23880,z=-69607..-39884
|
||||
on x=-49229..-24544,y=40180..60627,z=49877..77312
|
||||
on x=-67421..-46871,y=30102..60244,z=16607..38923
|
||||
on x=52711..81149,y=-10627..-8351,z=-48619..-22583
|
||||
on x=29102..45238,y=-70802..-50027,z=16042..39140
|
||||
off x=-87363..-61250,y=-1811..4566,z=-48295..-31466
|
||||
off x=52765..72819,y=-38051..-27751,z=22516..53729
|
||||
off x=-95898..-76590,y=-4285..-1522,z=-7096..27186
|
||||
off x=39546..65197,y=59713..74511,z=-14000..15914
|
||||
on x=27920..58905,y=-11677..424,z=-79346..-62053
|
||||
on x=-28804..-11775,y=72541..86610,z=-12598..7458
|
||||
on x=11013..13476,y=62070..76490,z=-39383..-17081
|
||||
off x=39439..48894,y=-72648..-38252,z=-48344..-12634
|
||||
on x=-70559..-52651,y=27489..46016,z=9134..42011
|
||||
on x=-20036..2910,y=-22525..-6028,z=-87710..-68411
|
||||
on x=-57816..-32833,y=51432..68426,z=-20978..2045
|
||||
off x=-79019..-59736,y=15304..30243,z=-45210..-32477
|
||||
off x=-90119..-75160,y=-24706..8541,z=-26255..-2577
|
||||
off x=-6777..14477,y=-71771..-33912,z=46706..60930
|
||||
off x=61137..75324,y=31584..49892,z=-26327..-14848
|
||||
on x=1100..22606,y=28697..54124,z=-81504..-52509
|
||||
off x=-71074..-58799,y=27675..44853,z=-58966..-20807
|
||||
off x=-71600..-42287,y=8542..25589,z=56065..61233
|
||||
on x=-45251..-35045,y=38191..54768,z=44757..67534
|
||||
off x=54620..79108,y=-56141..-42099,z=12070..29484
|
||||
on x=-13747..5593,y=-70633..-59152,z=35086..48154
|
||||
off x=-6784..14050,y=-65722..-55419,z=44065..49503
|
||||
off x=-2302..33895,y=7082..27279,z=-77945..-63272
|
||||
off x=-19701..-7304,y=-76198..-72082,z=28958..48047
|
||||
on x=12815..40193,y=37433..74447,z=-56868..-48723
|
||||
on x=16409..41021,y=-5541..8042,z=-75386..-63309
|
||||
off x=17361..35839,y=6486..33733,z=71504..85138
|
||||
on x=9825..32255,y=-68518..-48749,z=-80039..-57545
|
||||
off x=-62298..-50656,y=-1852..19142,z=44967..61407
|
||||
off x=-65488..-40004,y=-59621..-37464,z=-48950..-23715
|
||||
off x=-21676..-990,y=-79126..-51600,z=-55573..-22384
|
||||
on x=16547..46077,y=59890..75234,z=-23757..-11399
|
||||
on x=-87743..-69823,y=-36681..-16284,z=-11987..20192
|
||||
on x=-41729..-18632,y=-35288..-5409,z=-69092..-63322
|
||||
on x=40240..53567,y=51071..76567,z=-32328..-14382
|
||||
off x=-62904..-45149,y=32738..63897,z=-19593..-15038
|
||||
on x=21216..24135,y=-75210..-50944,z=-44984..-16166
|
||||
on x=-69562..-35055,y=58744..70823,z=-15501..-9281
|
||||
off x=-68150..-52172,y=26975..39630,z=-53507..-17045
|
||||
on x=51169..78842,y=11583..29490,z=29644..52457
|
||||
on x=-15373..4253,y=-97690..-61806,z=1940..31386
|
||||
on x=73779..78637,y=5371..23397,z=-27149..-10358
|
||||
on x=19250..44620,y=-7232..11656,z=-82542..-70642
|
||||
on x=39149..61967,y=-16335..12372,z=52676..65415
|
||||
off x=-23056..-4050,y=-38844..-16159,z=64555..74496
|
||||
off x=45322..60654,y=-64033..-45875,z=-6345..6738
|
||||
off x=54100..90830,y=-34444..-21517,z=5118..19759
|
||||
off x=-231..8241,y=-54245..-31025,z=62160..90247
|
||||
on x=-10127..-4636,y=-83774..-49558,z=30741..56326
|
||||
on x=-61249..-36895,y=58338..75723,z=-15361..7006
|
||||
off x=18751..41594,y=49217..65051,z=35222..37374
|
||||
off x=-19037..-9828,y=-67561..-45441,z=24792..52641
|
||||
on x=40827..72676,y=-15481..-1454,z=37617..66011
|
||||
off x=-64739..-34793,y=-25699..-17432,z=-67453..-38858
|
||||
on x=-18058..5742,y=-23939..-5488,z=-94889..-71764
|
||||
on x=35519..41049,y=-27602..-9277,z=49488..82039
|
||||
on x=9331..32089,y=-17498..8315,z=-80543..-76033
|
||||
off x=-34327..-11605,y=11327..29037,z=-77519..-64466
|
||||
off x=-71841..-43926,y=16818..21609,z=-69739..-45874
|
||||
on x=-56990..-48349,y=-68324..-43481,z=3016..7811
|
||||
off x=9304..25782,y=30245..56041,z=51315..85795
|
||||
off x=32607..48888,y=3690..28091,z=52295..84881
|
||||
off x=-2404..31293,y=58151..81212,z=-31998..-25149
|
||||
on x=-63323..-36977,y=54027..77083,z=-26641..8719
|
||||
off x=60302..80800,y=35514..54303,z=12123..40785
|
||||
off x=47486..64483,y=7507..25137,z=-73417..-59938
|
||||
off x=2177..22958,y=73828..91348,z=20624..37806
|
||||
off x=-68778..-38496,y=-15625..6286,z=50357..61804
|
||||
on x=42481..65067,y=414..25425,z=52357..76953
|
||||
on x=21032..42183,y=-46797..-14635,z=-74998..-57422
|
||||
on x=-57819..-39759,y=37245..65409,z=-31057..-9476
|
||||
on x=29358..58776,y=8103..20134,z=-73101..-67091
|
||||
off x=-26017..-15663,y=-53499..-40680,z=-81777..-63642
|
||||
off x=-75822..-54570,y=-54832..-37673,z=-36225..-20978
|
||||
on x=-30274..-12377,y=62717..73698,z=-51083..-18953
|
||||
on x=25463..45515,y=-79814..-55158,z=15540..44754
|
||||
off x=-58176..-42144,y=-44091..-18834,z=49801..63998
|
||||
off x=40488..54727,y=-80750..-51881,z=-8037..3647
|
||||
on x=66133..82929,y=-13321..9855,z=-45192..-21257
|
||||
off x=3029..23415,y=-78534..-62743,z=-50610..-16058
|
||||
on x=63368..74974,y=104..20701,z=37152..63545
|
||||
on x=40949..74694,y=-62178..-38585,z=2610..19835
|
||||
on x=-472..15977,y=64084..84976,z=-24559..2476
|
||||
off x=49194..76848,y=-47174..-24042,z=-33508..-8663
|
||||
off x=67399..78692,y=-28620..-16523,z=-19377..4508
|
||||
off x=56630..74700,y=-14438..20792,z=36581..74432
|
||||
on x=21015..41464,y=-9104..15645,z=-88506..-73629
|
||||
off x=-43920..-26879,y=14492..28620,z=59594..70987
|
||||
on x=-35951..-21806,y=7254..24763,z=54493..72173
|
||||
on x=3336..22348,y=-15737..-3592,z=60764..78216
|
||||
off x=56117..66807,y=20737..31533,z=-44715..-23712
|
||||
off x=13306..42710,y=68250..78199,z=-32910..-17468
|
||||
off x=-87878..-53833,y=18415..53070,z=-16577..2999
|
||||
on x=33630..50999,y=-67779..-48804,z=30503..55076
|
||||
off x=57002..86011,y=-10279..10607,z=19904..42650
|
||||
off x=18927..33193,y=-16636..-1801,z=-88904..-63937
|
||||
off x=21167..45110,y=-67846..-46840,z=-67041..-43159
|
||||
off x=15448..29805,y=-69142..-47763,z=-56592..-41006
|
||||
on x=-31981..-15095,y=-20248..3871,z=63022..87403
|
||||
off x=-50574..-43927,y=-45935..-22203,z=-54205..-39534
|
||||
off x=23509..30725,y=-59187..-39824,z=-55008..-29804
|
||||
on x=-6893..10692,y=-4433..17662,z=-79958..-63043
|
||||
off x=52839..82867,y=-54135..-43532,z=5074..22443
|
||||
off x=-19801..2279,y=-45316..-18060,z=-73077..-53175
|
||||
off x=-34124..-23489,y=-77318..-57778,z=-10644..21309
|
||||
on x=-62168..-39417,y=46644..71553,z=-12633..-2688
|
||||
on x=-50071..-22810,y=-45081..-19082,z=-71537..-54243
|
||||
on x=-3347..16680,y=71919..95169,z=-26699..-14243
|
||||
off x=-57262..-44366,y=32309..66254,z=-33394..-21315
|
||||
off x=71646..96656,y=-8202..21856,z=-6535..-796
|
||||
on x=-27944..-5589,y=47496..68996,z=51465..59779
|
||||
on x=8322..20036,y=-71459..-51821,z=28654..53172
|
||||
off x=-1130..11235,y=-72111..-54015,z=38692..55881
|
||||
on x=-69102..-39230,y=21462..55716,z=-47827..-41441
|
||||
on x=51340..80906,y=-52377..-19741,z=-34853..-23124
|
||||
off x=-37865..-22986,y=-62050..-50913,z=-69238..-43924
|
||||
on x=28721..62342,y=-8593..21244,z=52533..83625
|
||||
on x=52746..80495,y=22003..40732,z=-40093..-20844
|
||||
off x=35892..47834,y=-67866..-46589,z=34299..53539
|
||||
off x=18277..20309,y=-15322..3925,z=-94574..-68257
|
||||
off x=23509..40977,y=-81126..-48154,z=-21..33400
|
||||
on x=13627..46617,y=-2537..25688,z=-74686..-56092
|
||||
off x=4445..25422,y=1276..13484,z=-78843..-67185
|
||||
off x=-12411..9686,y=-80652..-50914,z=-61600..-42810
|
||||
on x=-18060..-1885,y=16610..43651,z=67414..76707
|
||||
on x=30774..44990,y=-6499..11812,z=-87416..-59474
|
||||
off x=-59552..-40954,y=48890..63902,z=-39700..-21599
|
||||
off x=12390..31538,y=65013..80718,z=-15195..9149
|
||||
off x=-82717..-58814,y=9792..34867,z=31729..41188
|
||||
off x=-62226..-36572,y=-17931..-2307,z=64240..74646
|
||||
5
2021/inputs/23.txt
Normal file
5
2021/inputs/23.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
#############
|
||||
#...........#
|
||||
###D#B#A#C###
|
||||
#B#D#A#C#
|
||||
#########
|
||||
252
2021/inputs/24.txt
Normal file
252
2021/inputs/24.txt
Normal file
@@ -0,0 +1,252 @@
|
||||
inp w
|
||||
mul x 0
|
||||
add x z
|
||||
mod x 26
|
||||
div z 1
|
||||
add x 14
|
||||
eql x w
|
||||
eql x 0
|
||||
mul y 0
|
||||
add y 25
|
||||
mul y x
|
||||
add y 1
|
||||
mul z y
|
||||
mul y 0
|
||||
add y w
|
||||
add y 1
|
||||
mul y x
|
||||
add z y
|
||||
inp w
|
||||
mul x 0
|
||||
add x z
|
||||
mod x 26
|
||||
div z 1
|
||||
add x 15
|
||||
eql x w
|
||||
eql x 0
|
||||
mul y 0
|
||||
add y 25
|
||||
mul y x
|
||||
add y 1
|
||||
mul z y
|
||||
mul y 0
|
||||
add y w
|
||||
add y 7
|
||||
mul y x
|
||||
add z y
|
||||
inp w
|
||||
mul x 0
|
||||
add x z
|
||||
mod x 26
|
||||
div z 1
|
||||
add x 15
|
||||
eql x w
|
||||
eql x 0
|
||||
mul y 0
|
||||
add y 25
|
||||
mul y x
|
||||
add y 1
|
||||
mul z y
|
||||
mul y 0
|
||||
add y w
|
||||
add y 13
|
||||
mul y x
|
||||
add z y
|
||||
inp w
|
||||
mul x 0
|
||||
add x z
|
||||
mod x 26
|
||||
div z 26
|
||||
add x -6
|
||||
eql x w
|
||||
eql x 0
|
||||
mul y 0
|
||||
add y 25
|
||||
mul y x
|
||||
add y 1
|
||||
mul z y
|
||||
mul y 0
|
||||
add y w
|
||||
add y 10
|
||||
mul y x
|
||||
add z y
|
||||
inp w
|
||||
mul x 0
|
||||
add x z
|
||||
mod x 26
|
||||
div z 1
|
||||
add x 14
|
||||
eql x w
|
||||
eql x 0
|
||||
mul y 0
|
||||
add y 25
|
||||
mul y x
|
||||
add y 1
|
||||
mul z y
|
||||
mul y 0
|
||||
add y w
|
||||
add y 0
|
||||
mul y x
|
||||
add z y
|
||||
inp w
|
||||
mul x 0
|
||||
add x z
|
||||
mod x 26
|
||||
div z 26
|
||||
add x -4
|
||||
eql x w
|
||||
eql x 0
|
||||
mul y 0
|
||||
add y 25
|
||||
mul y x
|
||||
add y 1
|
||||
mul z y
|
||||
mul y 0
|
||||
add y w
|
||||
add y 13
|
||||
mul y x
|
||||
add z y
|
||||
inp w
|
||||
mul x 0
|
||||
add x z
|
||||
mod x 26
|
||||
div z 1
|
||||
add x 15
|
||||
eql x w
|
||||
eql x 0
|
||||
mul y 0
|
||||
add y 25
|
||||
mul y x
|
||||
add y 1
|
||||
mul z y
|
||||
mul y 0
|
||||
add y w
|
||||
add y 11
|
||||
mul y x
|
||||
add z y
|
||||
inp w
|
||||
mul x 0
|
||||
add x z
|
||||
mod x 26
|
||||
div z 1
|
||||
add x 15
|
||||
eql x w
|
||||
eql x 0
|
||||
mul y 0
|
||||
add y 25
|
||||
mul y x
|
||||
add y 1
|
||||
mul z y
|
||||
mul y 0
|
||||
add y w
|
||||
add y 6
|
||||
mul y x
|
||||
add z y
|
||||
inp w
|
||||
mul x 0
|
||||
add x z
|
||||
mod x 26
|
||||
div z 1
|
||||
add x 11
|
||||
eql x w
|
||||
eql x 0
|
||||
mul y 0
|
||||
add y 25
|
||||
mul y x
|
||||
add y 1
|
||||
mul z y
|
||||
mul y 0
|
||||
add y w
|
||||
add y 1
|
||||
mul y x
|
||||
add z y
|
||||
inp w
|
||||
mul x 0
|
||||
add x z
|
||||
mod x 26
|
||||
div z 26
|
||||
add x 0
|
||||
eql x w
|
||||
eql x 0
|
||||
mul y 0
|
||||
add y 25
|
||||
mul y x
|
||||
add y 1
|
||||
mul z y
|
||||
mul y 0
|
||||
add y w
|
||||
add y 7
|
||||
mul y x
|
||||
add z y
|
||||
inp w
|
||||
mul x 0
|
||||
add x z
|
||||
mod x 26
|
||||
div z 26
|
||||
add x 0
|
||||
eql x w
|
||||
eql x 0
|
||||
mul y 0
|
||||
add y 25
|
||||
mul y x
|
||||
add y 1
|
||||
mul z y
|
||||
mul y 0
|
||||
add y w
|
||||
add y 11
|
||||
mul y x
|
||||
add z y
|
||||
inp w
|
||||
mul x 0
|
||||
add x z
|
||||
mod x 26
|
||||
div z 26
|
||||
add x -3
|
||||
eql x w
|
||||
eql x 0
|
||||
mul y 0
|
||||
add y 25
|
||||
mul y x
|
||||
add y 1
|
||||
mul z y
|
||||
mul y 0
|
||||
add y w
|
||||
add y 14
|
||||
mul y x
|
||||
add z y
|
||||
inp w
|
||||
mul x 0
|
||||
add x z
|
||||
mod x 26
|
||||
div z 26
|
||||
add x -9
|
||||
eql x w
|
||||
eql x 0
|
||||
mul y 0
|
||||
add y 25
|
||||
mul y x
|
||||
add y 1
|
||||
mul z y
|
||||
mul y 0
|
||||
add y w
|
||||
add y 4
|
||||
mul y x
|
||||
add z y
|
||||
inp w
|
||||
mul x 0
|
||||
add x z
|
||||
mod x 26
|
||||
div z 26
|
||||
add x -9
|
||||
eql x w
|
||||
eql x 0
|
||||
mul y 0
|
||||
add y 25
|
||||
mul y x
|
||||
add y 1
|
||||
mul z y
|
||||
mul y 0
|
||||
add y w
|
||||
add y 10
|
||||
mul y x
|
||||
add z y
|
||||
137
2021/inputs/25.txt
Normal file
137
2021/inputs/25.txt
Normal file
@@ -0,0 +1,137 @@
|
||||
>.v>>....v...v...v>...>>>...>v.v>.>.v>...>.>.v.>>>>.>.>.v>>v.v.>.>>vvv....>v.>v....v>vv.v.vvvv>>...>v>v...vvv>>>>..>v>...v>v..vv.>.>..v.v>.
|
||||
v.v.>.vv..v.v.>.......>.v.>>......>.v..>..v..>.vvvvv>v.>>vv>...vvvv.>>v>v>>v...v...v>.vv.v>.>.>..>>....v..>..vvv>.>vv>v....>>>v....>.vv...v
|
||||
..v...>vvv>>......>>..v.v..>.v.v>....v...>v>v..>>v>......>..v.>.>.>.v.>v>v..>.vv>.>...v.vv....>>>..>.v.v>..v...v.>v.>..>v>.v..>>v>v..>>>.v.
|
||||
.>vvv.>.>>>.v..v.>.v..vv>>>..v...v...v>v.>........>>>.>.v..vv>...v.v.vv>v>>>..>>>.v.vvv..>v.vv.v>..v>vv..>.>....>v>vv....v>...>v>v.>>>v>.>>
|
||||
v...v.v.v>.vv>>...vv.v.>v>.>..>>>>...>>vv>.v.>.>>vv.v.>>.>v.>vvvv>v.vv>>.>>.v>v..v.>.>...>>>>v.v>..>.>..v..>vv...v>vv...vvv>>.vv.v.v>.v...v
|
||||
>>v...v.v.>v>.>>>....>.>>v.>....>>>>v.....v>..>v.vv>.....>..>..v..v...>v..>v>..vvv>.>..v.vvv...>vvv>.vv>..>.v...v....v.v.v>.v.>>.v.v..>v.>>
|
||||
>v....v>>>........>....>..>.v>>....v..>...vv>v...v>.>>..v...v>>.......v>..>>.v......vv>>v>>>v.>v>.....>..vv..>v.>>..v.v..v..v>.vv>>>v>>v>vv
|
||||
v.>v.......>...vv..v.v>>v.v>....vv.v>..v..>..>v..>v..v..vv.vv.....>>>....>>v>.>....v>.>.v>...v.>v..v.v..>..>.vv...>.>v.....v.vvvvv..>.>v.>>
|
||||
>.>>..>.vvvv.>.vvv.vv.v>v>>vvv.vv......>...v.>.>vv>>..vv>v>..v>v>>..>.v..v.>>...>.v>>v.v.>.v.v>v>....>>...vv.v>..>v>.>>.>........>.....v>>.
|
||||
>.>v.>v..vv..v>v.vv.>v....>>.v>.>.vv...v>v.>.v>>vv.v>>..>>vvvv..vv>>.vv>.>>...>.>>..vvvv>.>>>.v.v.>>>v..>>..>.>>....vvvv.>..v>v.>...v>...vv
|
||||
>..v.>.>...>v>..>.......>vv.v.>>>.v>..>>>.>.>v...v.v>>>>>v>...>v>..>..>.v.>.>.vv>>v..>v>>.vv......vvv....>>>>v>v.....v.>v>.....>>>..>...>..
|
||||
.v..>>v>.>.>...vv.v.>vv...>.v...>>>.>..v...v...>>v>.>...>.>.v>v.v.>..>.>...v.>>.v...v..>.....vv..vvv.v.>..>v..>v....v>v...v.....vv..>..v.v.
|
||||
..>.>v..v.....>.>>v.>.v>.v>>>.>..>vvv.>.>....>v..v.....v>..>..>>..>v>v.>.v..>.vv.>...>.....v.....vv>......>..vv.>.vvv.v.v>v>v.>>.>>>>...v.>
|
||||
v..vv.v>v>>>..>...>...>vv.>.v.>vv.....>v.>>.>...v.>>...>vvv>v.v>v>v.v.>.......vv>.v>>.vv>.>.v...>..vv>v>..v>>>.....>>...vvv..>vv........v>.
|
||||
..v....v.>>>vv>.>.>>...>.>.v.v..vv......v.....>>.....vv>.vv.v>v..>....v.vv...>....v............>>.>>v...v.>.>>v>..>>>.....v.v..>vv>..v>>...
|
||||
.>v.vv.v.vv.>.>..v>.v...v....>>v...>v.....v.....>>.vv>v.vvv.v..vvv.vv>v.>..>>>v..>.vv...v..v>.v>>>..>>vv..>.v>.vv...v.>>......>..>...vvv.vv
|
||||
..v....>v.>>>v..vv>v..>....v.>.>v..>v..v.v>v.v>...>>>.v...vv>v>>>.v....>.vv.>v...v.v.>v.>vv.v.vvv.>v...v...>.v.>..v.v>>.....vv>>.v>v.......
|
||||
....>>vvv........>v.>.v..>.vv.....>..v..>..vv.>>...>.v...>v.>..>.>....>>>>.....v.v.....>v>.vvvv>.>v..>.vv..>vv>...v..v>>...v..>..v.>.v.....
|
||||
>v>v>>.v....>.v>.v>>..>..v>>v...>.>>>v...>>>vv....>..>.v.v.v..v.>...>.v.v.v.v>.>v...v>.v..vv....v.>...>v.v..>v.v..>...........>>>..>.v.vv..
|
||||
..v...>.>>.v>>.v.v>>.>..>>.>.......v>.v>vv..v.>.v...>v>..v...vv.>...v.>.vv.>..>.v>v.v.>..v>..>..vv>v.v.v>...v>v..>v.v.v.vvv..>v>vv>...vv.>>
|
||||
>.v>.v.>.vvv....v.v....v..vv.v.>>...v...>.v.>.v>v.>v.>.>>>..>v.vvv.v>.>v..>>...>v>..vv.....v.v..>..v.v>.v>v.....v.>vvvv.vv.v.>vv.v..v.>.>.v
|
||||
.>v>v>.v>>v..v>>v.v>..>v..>>.v.v..>..>v.vv>..>v>v.>.vv.>>.v....vvv>...v..v>.v.>.v.v..v>.v>v..>.>..v.v..>...vvv.>.vvv...v>v.....>....vv>....
|
||||
.v>.v>.v.vv>..>....>v......vv..>.>v.....>v>>.v>.......>.v.vvvv..>v....>.v..vv.>v.v..>.>.v>v.>...>.>..vv>.>>.....v.>>v....>...>>>v..v>v>.>..
|
||||
v>.v>>vv>>vv........>v.>..>>v..v.........v.v.vvv.>v>vvv>.......>>>....>>>v..>>..>>>.>......>.v>v..v.vv.>...v>>v..>>>..>.>vv...v>.>...vv>.v.
|
||||
.>...v....>.v>..v.>.vv>.>>v...vv.>..>>v...v.>..>>>vv..>.v.>.v.>.vv>.>>>>.vv>.>v..v>...>..v.v.v.v...v...v>>..v>.....v.>..v.v>.v.vv..vv.v...>
|
||||
.>..v>>...>v>.v>.>>..>>.vvvvv.v>v....v>v>....>v..v.>>>..>>vv..v>.v..>v>..>.>.v.>>>v...v...v>.v..v.v.....v>v..>.........>.>vvvvv>>vvvv..>...
|
||||
>v>......v..v..>v.>>.....>>.v.>..>.>>v.v.>..>.>.>.>v.>..>...v>>.....v.>>......>.>.vvv.>..vvvv..>.>....v..>>..v.>.>>..>.v...>..v>v>>.>....>>
|
||||
>v..>>.>v.>>.v>.>.>.>v.vvvv.v...>.....v....>>v.>vv>.>.>..v...>v>v.v.vv.>>.....>>...v.v>>v.v>.v..>..v>v..>..>.v.v.v.>.vv.>>>.v.v..v.>vv.v.>.
|
||||
v.....v....>>v.v.>..>..>>v>vv>.>v>>.>.vv..v..v>.>.v>.>..v>...>.>v>...v..>>vv...>.>..>v.v>...vvv.v>.>...v>v.vvv>v.>...v....>>>v>vvv>>>.v>...
|
||||
>.>>.vv>.v.v>>>.v>>.v....>v>......v...>>..>.v.>..v.>>.v>..v....>.>.>.v....>>>..>..v>.vv>..>v...v..vv.v...vv>.>..v>..>..vvv.....>>....v.>.vv
|
||||
...>.>.v>....>>v....v.v.>>v>v.v..>v.>>>v..>..>..>v.>.....v.v.v.>>...>.vv..>..v.>vvv...v>....>.v>v>>v>v..v..>.v..vv>..>>>.vv>vv.v>>.v.>>...v
|
||||
.>vv.v...>.>.>..>v.v.v>v...v....v>vv>>.>>.....v>>..v.v>.vv>.v>>vv..>v...v..>v>..>.v..>vv>..>>.v.>.vv>vv.........v>.v........v>>v..v>vv>v.>>
|
||||
.....>...vv.>.v.v..>vv.>.>.>>>..v>...>v...>.>>>.v..>>.>...v>>.v.v.v>>v..>.>>v.>vvv.vv>.>v..vv.>>....v...>v.......v.v.>.>.v.>>.....>v.....>.
|
||||
v>.>v.v>>.v.>vv.vv..v.>v.v........>vv.v>.....>v.>.v....v>.>>..v>.vvv...>.vv.>......>v.>.>..>v>.>..v..>..>..>.>..>>>v.>v.v.>..v.v>>>vv.>>>v>
|
||||
v>v....>...>..>v..v>.vv..vvv>>v.>.>>..>..v....vv..>v>v...>>>.......v.......v.v>....v>>>..>v.vv..v>.>>.vv...vvv.>.>>>>.>.>.>.>>....>>.>>..>.
|
||||
.v.>..vv..>.....>v.>v.>>>v..v>.v>....v>>...>..>>>v>.>>>.........>.>.v.>..v>..v>..vv>.>>v.vv....v>>.v>..v.>.v.>>...>...vv.v.v..vv.>>..v>v..v
|
||||
v>v>.>.v..>v>>.>>.>.>.v>>....v>vv>vv>..v.........>.>.>....v>vv>vv>..v.vv.......vv.vv>>v.v.v..v........v...>v>.>.v.vv..>.>>>>>....v.v...>>>.
|
||||
....vv..>..v>>..v.....v.v>v.>...v>>..>.>.v..v>.>>vv...>>..v.v>.>...>..v.....v>>vv>v..>.>..>.>....vv>..>.v...>.v....>...>.>..>.....vv>v.>v.v
|
||||
.>.v>v..>>...v.v...>...v>.v...v>>.>>....v..v.>.....>>...v.vvvv...vvv.>.>v>v.>>vv..>..>>..v>v.v>.>.v.>>..vv.>.>vv>vv.>.>.>..v..>..v.vv......
|
||||
vv.v.>v.v.>v>>.>....>v>>>vvvv..v.>........>vvv..>..v.....>...>.vv>..v.>v>..v.vv.>>>.>v...>.v>.....>.>v..>...>>>.>v.v..>.v>..vv..v>..vvv>..v
|
||||
.vv>>v>......>.>....vv>..>>.>.>v>..v...>v.>vv..>.>>v>...v>..>..>>>..v>v.v>.v..>v..vv>.>.>..>>...vv>..>v>v.>...vv..v...vvvv..vv>.v..>>.vv...
|
||||
.v.v>.vv....>...>..>>..>v>.>...>.>>..>.v..v..v>.>v...>>>.vv.>....v.v.v.vv>>v>v...>..>.v.v.v....vv.>>.>vvv>..>...vv....v>v>..>>>.v.....v.>>.
|
||||
v.>..vv>v>v>>>....>>....>>v..>..v.>.v.>vv.v.>.v>..>.>>>.v..v>>>.....>vv.v.>>vv....>>>.v>...>v.v.v>v.vv.>....v>>v>...>.v>...>v.v.>>>.vv>.>v>
|
||||
v.>...>>.>v.>>.>..v.v>..vvv.v....>>>vv.....v.v.>>v..v..>..vv..v>...>>.v>v>.>..v.>..>v..>.....>>..v>>v>>>v..>v.v>.>...v..>vv>v>....v..>>>>>v
|
||||
....>.>v>.v.v.>.>.vv>v.v>>>.>...v>v.....vv....v..v.v..vv>>>.v.vvv.v.>..v.vv.v...vvv>..v.>.>.v...vv>.v>.v.>..>vv....v>.>..>v.>>>v.>.>....>.v
|
||||
>>.>>>.>.>vv>..v.>>...v.>....v...vv..v>v>v...v>>v...v.v.>.....>.>>>.>v.v.>vv...v.>......>..>v.>vv.v>v.>...v>>..v.>v>.>.v>v..v.v>.vv.>....v>
|
||||
v..>...v.v....>.>.vvv>.......v>.>v.....v>.>>vvvvvv.v..v..>vv..v.>v..v...>.vv.>>.v...v.vv>..v>..>...>vv>>>...>>.v>..vv..>.....v>v>...>vv.v>.
|
||||
.vv.>v.vv.v.>.>...>v>..>>..>v.v.>>...>v.>>vv>vv..v..>>..>>.v.>>vv>v.>.vvvvv.v..>>>.vv..>>>>>..vv>...vvv....v>vv.>v..vv.....v..>>...>>>>..>.
|
||||
...v>.v..v.>.>.>.v>>.....v.v>.v.>v.v.>.>>>.v>.v>>.vv.>..v.v...vv.>...>.>v..>v....v.v>.>.v..vvv.v.....v.vv..>..v.>..>..v..v>.vvv>>.>..>.>>>.
|
||||
...v.>v.....>vv>v.v>...>vv>>..>.v.>..v>.v.v....v.>.v>.vv>.>..>..>>.v>..>v..>.v>vv.vvv>......>...>.>v>>>....>.v.v.v.v..>.v.>>v>.>v>.>..>v..v
|
||||
v>.v.vvv.v..>.....vv.v>..>>.....v..>.>...>>..v.v>>.>..v....>v>.>v..>.>....>>...>...vv>v.>>vv..>....>v>>v..v>...v.....>>.....v..vv.v.>>...>v
|
||||
v.vvv.>>.vv....>..>v...>>.v>....>v...>.vvv.v......vvv.>vv..vvv...>..v.>.v..vv.v>....v....>.v.v..v>.>...v>v>>>.vvvv..v.vv..>vv>.>v...v.v>..>
|
||||
vv.>....v...vv>.v...vvv.>>v.v>.....>...v>>.>>vv..v.....>vv.vvv>>.v.>>.v..v>>..v>.v.>v>.>.v.v.v..v>>>vv.......>>...v>vvvv>v>.>>v.v>.>>v.>..v
|
||||
v...>.vv..>v..>...>....vv....>.v.>>v>.......v...>>.....v....vv..>v.>.>..>...>>...v.v>v.>.>.....>..>.>.v......>.v.v.vv.>.vv.vv..vvv>vvvvvv>v
|
||||
vv.v>.>v>v..v.v...v.vvv..>v>.v>.v..v>v>>v>...>v.vv..v....v..>..v...vv>>.v..>>.>>v>..>..v.v..>v.v...>>.v>>.v>..v.....v.v.>>>.vvv.>...v.v...>
|
||||
v...v.>v.....>..>v>..>.>>>.v..>.>..>>>>>>v>vvv.>>vv.>>.>..>>v.>.v......v.>.v.v>v...vvvvv>...>.>.vvvv.....v>.>.>.>vv...>..vv....>v>>..>.v>..
|
||||
vv>..v...>.>...v..v.v....>..v>>...>.v>v.>...vv....vv.>...>.>..>>...v>..v>...>...>v..>>...vv.vv.>v...v.>>......>.>.>v>v...v.>...>.v.>.v.>>>.
|
||||
>...>.>.>>..v.....vv.v...>.>>..vvv.v.>>vv>...v.>...>.>.>v...v>.....>v>v>v....v..>>....vv..>v>v...>>v.>vv.>v.>..>....>...v..>.v....v.v..>v>.
|
||||
vv...>v.v>v.v..>>.>>>vv....v.>...>v.v.>>>v...vv..v.v..v.....>v..>>.>..>.v>.>>v..>vv..vvv>v.vvv..vv.v>....>>>>>.v>....>>>..v.>.>.v>......>>v
|
||||
>>.vv>>.>>...vvv.>.>.>>.v>.vv>..>..v.v>.v........v.v>vv.....v.v>v.v.v.v..>>..>v.>.vvv..>>..vv..>...v.v>>.v>....>>>>v.>v>vvv........v.....>.
|
||||
..>..v..v>>vv.>.....v..v.v..vvv.vv..>vv>..vv.v.>v>.>>>v>.v...v.v.v.v..>.v...>.v.vv>.vvv.vv>.v....>....>..>.vv>>v..v.v.>>....v.v>.v..v..v>>.
|
||||
.v>.v>>.....v.>.>v>.>..>>.vvv....>..>>>..v.v.>.>...>v.v>.vvv.>>.vv>v.>.v.v.>...v>vvv.>.v..>v..v>.>>.>>....>v...>..v>.>..v>..v...>v..v.>v>>v
|
||||
v.>.vv.v>...>v..v.>.vvvvv.v..>...>...vv>>..>>>vv.>>v>>>.>.>....vvv.>vv>..vv..>.>>.>>v>.vv..>>.....>.>>..>..>v..>..>>.v>>...vv>>.>..vvv...v.
|
||||
>>..>.v......v....>>.>...>>.>>..>vv.v>>.>.vv.>v.>v.>v..v>..v.v>.v.>v.>>>...>.v.>v..v..>>.v.v.vv>..>>v.v.v>...v>>v>>..>...v.>.....v>v>.>v.>>
|
||||
.v.v>>>>>vv>>.>.>>>.vv..v.>...v.>..>>v.v.vvv...>.>..v.>>.>>.vv..>>>>.vv...>.v.vv.v..v>v>>>.v>vv.v>..vv..>v..>v.>>..>v..v>.>..>.>...v>.v..vv
|
||||
.>.v...vvvv..v...>..>....v.>...v>>v.>v..v>v>..>>>v>...>..>vvv.v.>.v...>v>.v>>>>v...v.>v>....v.v>vv>.vv>.>>v..>...>vv...>.>v.>.vv.>...>v...v
|
||||
>.v.>.>...v>.v..>.v>>.>...v.>>..v.v>.v>.>vvv......>..>.>v>....>>.>v.v...v...>>>>.>..>...>.>v>.v..>...v..>>.v..v>.v>v...>v>>..>..v.>.>.v.v..
|
||||
.v.>>..>.>.v.>v..vv>>..>.>.v.>.>.v..vv..>...v..v.v>...>v..vv>.>vv>.vv>>.>>...v....>..>vv>>>.>.v>..v..vv>v.....>..>>......>.>>v>>.>.>v...vv.
|
||||
....v.>.>>>v.>....>>>v..v.v..vvv>.>v.>v..v..v.>>.....v.v..vv...>v.v...>>.>.v..>.v....v.>v.......vv....>.>v>vv>>..>v.....v>...>..>>>..v....v
|
||||
..>>>.....v>.v>v.vv>>.vv...>>.....v.>..v>v.>v>>.v..vv......>v.v.v.vv>>..v>v.v>..v.>.vvv.>.>>>...>....vv.>v>.....>.v.>..v..vv.>.>...>v>v.>>>
|
||||
...vvv......v.....>>>.....>.>..>.v.>.......>.>.v>v...>.vv>.>...v>.>>.>.>.>>.>vvv...v.v>>>>..v>..>>v..v.v.v..>.vv..v>v..v.v.v......>..vv.v>.
|
||||
v.v.v.v..v..vvv......>vv>>v..>>>>>v>v>.>.......>.>.>..>>>...>vv>.>.>...>..v>>>>.>.>v.>vvv...>.>..v.>.v...>.v>>vvv>vvv....v>>.v>.v>.v>....>.
|
||||
>>vvv.>>..>v.v...v.>v....v...v>>.vv>.vv..vv.v.v>vv.v.........>..v.vv>v>>>v....>...>...>vv.>.>.v>v..>>..>v>.vv..>v.>>>>>...v>...>vv>.v>.v..>
|
||||
>....>.v..>.>.>..>..vv...>>v>vv.>>.v>>>.v....>>>.v.>.v>.>>.vvv..v>>v.....>..v.v..>.vv.>....>>>v..>.v.>>v.....v..>>...v>.>>...>.v...>.>.v>>.
|
||||
v>.v>..>v....v.>>>v.v.v.....v>....vv...>v..vvv..>..>vv>vvv...v>>.vvv..vv>>v>.v...>.v......v>>...v.v....>..v..v>.v>...v.>.>...v.v.vvv..>>..>
|
||||
>v.>.......v>....v.v.>vv>..v>>.v.v.vv.....v........>.v...>.>.>>>v>....>vv>...>v.vv..>.>>v.>.v.>..>..v..>......>>>v>vv....v....>.v>.v.vv.>v>
|
||||
.v>..>..>.>...v.>.v>v..>.>.>.v.>>vvv..>.....v>.vv>v.v.v..>.v..........>v...>.>>.v>>vv.>...>v>..v>v>.>>>.>v.>.>...v.v.>v..>..v.v>..v.>>.vv.>
|
||||
..>.>v.vvv..v.v......>>>>>...>>v>....>v.>vv.........>>vv.vv.>v>...v>.>...vv...>v.>.>vv>....v...>>v>>..v>.>v.>vvv.>>.>v>..v.v>>....vv.v>>v>>
|
||||
>..>>v...v..>v.>..vv.>...v.>>.v.vvv.v..>..>>.v.>....>.>...vv.v..>>.v.>v....v...>..>.v.v>vv...vvvv>>v..>......>..v...>..v..>>........v...v..
|
||||
>v..v.>>......v.vvv.........>>..vv>>vv.>..>v....v.....>..vv..>.v.vv..>>.vv..>>.v.v..>..vvv>>....>...v.v..>v.>>.v.>>>>......v..>....>.v>>v.v
|
||||
.v.>>..>v>>.>...>>..>v.v.v>>v.>..>v..v>>.....>.vvvv>.>....>>.vv..>.>v.>.>>.>>>>..>.>vv>.v>..>.>vv>vvv..v>...v>.v>>.>..>>..>vv>v>.....v>.>v.
|
||||
>v.v..vv.v......vv..v>>....>>>.v..v>v.v>...v..v.v>.>.>..>v>>v>>>..>>v.>...v>>...>.vv.v.v..>..>.v>...>..v.>v...>.v.v>.>>vv>.vv..>v..>>v.vv..
|
||||
...>v..v.vvvv>..>v..v>.vv....v..v..v>vv.>.>v>.v..>.vv>>vv.v.....v.....>.vvv.vv>.>...>v...v>>.vvvvvv.v>......vv.......v..v...>.vvv.vv..>>.vv
|
||||
.vv.>v...v>>.v...v>v.v.vvv.>>v.v.v.....v..v>>.vvv...>v....>vv..>..>.>vv..v..vv.>vvvv.>>>v.v.vv>..>...v>>.v.v>.>>...>...>v>>vv...>v.>.vv>...
|
||||
>>v..v>>>v>v>.v.....>...>v.>.v.v.v..>.>.>...>.vv..>..>>...>v>.v.v.>.....>>>v..v.v..>v.v.v>v...v.>...>v>>.>...v>...>.>.>...v.v.v.....vv.>>>v
|
||||
.v.......v.>v>>.>>v..v.v..v>..>.>>..v....>>.v>.>..vv>>v..>v..v...>...>.....vv.v>...>.>v..>.v.>...vv....v...v..v.vvv.....v...vv...>>>.>v>.>.
|
||||
>>v.....vv.v>.v>.v.>>.vv>.v...v>.v>>v..>>v.>.>>v....>..>v>>>.>..v.v>..>>v>>.....v>.>v....vv.v.v.v.vv.>>>...v.vv>.v>...v>vv>vv..v.>..v....v.
|
||||
..>>...>......>....>v.v.v>.>...>>vv.v>>>.v.v>.>>>vv.v.>..>...>...v.....v....>..vv>>...vv..v..v>.v>.v.v..v...vvv..........>.>v.>.v.>v>v.>v>>
|
||||
..v..>>>>...vvv.v....>..>>...v>.>v.>v...v.>.>.v.v>.v.......>.>v.>.v..vv.....v.v.>.v..v>>...vvvvvvv...v....v..vv..>>..>>>..v.>vv>..v.>>>vv.v
|
||||
vv>.>.vv.v.v.....vv>>v..>v..vv.>>.>.>.v..v>v...>...v.v>>..>.v......v.>>.v.....v......>......>v.>v.v>>>v..>.v>..>.>v.v>..>v.v..v.>.>.>vvv..>
|
||||
>.v.......v>..>.vv>v....>v..>v..vv.v>>v>..>.>>..>..>..v.>v.....>.>>v....v>..v>...>v..>vvv.....vv>v>.v>vv.>v>>.vv>>.v.>.>...vv.v>vv..>.v...>
|
||||
vvv.>.>.>...v.v.vvvvv>.vv>.>...v.>.v..>.>...>v..v...>>vvvv.v>.v.>.vvv...vv.vv.>>.>.>.....vv..vv..vv>>>>.v>>v.>v.v.>>.v..>>v.v>..>>..>v>....
|
||||
v..>...vv...v>......v>...>.....>.>.v>.>vv>v>......>>.v..>.v.>..>>..vv.>v>.v..vv.v..v.>..>v....>..>.>.v.>>vvv..>v.v>v>v..>>.v.>v.v.>>.>>>v..
|
||||
v.........>>v>vv..>.>..>>>.v>...>v...>>.vv.v>...vv...v>>..v..>>>>.>v...vv.>vv>..v.v>...>v.....>.v>>..v.>v>.vvv.>.>v..v.>.v....>>>>.v...v.v>
|
||||
>>.>.>>.vv.>v.v.v.v>v....vvvvv..v.v>>>..>>.>..v>vvv>v.>v>>v>>..>>>>.v.v>.>.>.>>v.v.>v..v.v>>..vv....>....>>.>.vvv>.vv.....v>v.>>vv>v.v.v..>
|
||||
....vv....>....v>v>>...vv>>>.>..>.vv>v>.>>.v>vv..v...>>v..vv..>.vv.v>>>.>.v.v>.>.v>>...v....>.........>.....v>...>.>....vv..v>.v.>v...v....
|
||||
.>v.>.v>>v...>...>.....>.v>..vv>v>.vv>..>.v>.>...v.v.v.v.>v..vv...>...>vv.....>...v>v.>.>..>..v..v.v>.v..v>v.>v..>>...v....v.v>..vv.v>...>v
|
||||
>vvv.v>..vvv>.v>..v>.vv.v>>>vv......vvvvv>>.>v>..>vvv.v.vv>vvv....vvvv.v.>>.v>>..v>..v>v>.>vv.>...v.>>>v.>.>..>..v>>..>..>.v>>.>..>..v.v...
|
||||
.>v>v....>.>.v.....>v.v>.v..v>vv.vvv>.>..>vv..>..>v.>>...>.v>.v..>v..>.>...>..>...vv...>.>>v.>.vv>>....v.>.>.>vv>...v..>.v>v>v>...>v>....>v
|
||||
.>.>...vv.>>>...vv>.v..>>>..>.vv>v..>v.v....>>v>.v.vvv...v>...v..v>.>.>>>>>vv..v.>..v>..>vv>.v>>...v>>.>v.>.vv>.v..v..v...v>>>.v.>.>..>v>.>
|
||||
.>>v.vv.>>>>.>vvvv>>.>vv.>.vvv..>....v.>..>.>.v............>>...>>>>>.>.>>>...v..v.>.>.>..v..>.v>>.>v.>..v.>v.>.....>..>>>>v.v..>v>.>.>..>.
|
||||
.>v>.v..vv.>..v.v.>vvvv..>vv.v.>.v>vv>....v.v...>>..v>.>.>..v..v>.>>>v.>>>v>>...v..vv.vv.vvv...>..>..v..>>...>v.....v>vv....vv....vvv..>>..
|
||||
>v.v.vvvv.v.v....v.>>v....>>.>..>...>.>v>.....>v>v...>>v>...>.>..v.>v>>>..v..>.vv.>>>vv.vv.>v>.....>v.>>.v>.v>vvv.v...v....v...v....>v...v.
|
||||
v>>>v>>>.vv>vvv...v>v..>v>.v>..>.v..v>v....>.>>.v.....v.>>....vv.....v>v.>.>v...>>..>>>.>v.v.vv.>>v..v>vv.vv..>..>v.....v>>v.>.>>...vv.v...
|
||||
>vv.>.v>.>>....>v.>.>v>.>..>.v.vv.>>>>..v>v>vv>>v....>v>>.vv..>..vv>>v....v.v.>>>>v.....vv.v>>.v>....v..>..>>>v..>.>.>>v>.vv....vv>v>.....v
|
||||
..v>.v..>>vv>......>>.>...>..vv..v.v>>.>..>>..v>.....v>..v>>v.v.v.>>v..>v.>>.>vv....v>v>...vv>>>.v>v.v>.>..>v..v>.....v.>>.>v..>v>vv>>>..vv
|
||||
...>>>>>.v.v>..v.....vvv..>.>...vv..v...>.....>v.v..v..v.>v.vvvvv>v..vv.....v>.v.>.....>...>..>...v.>>v>..>.>vv.>>v.v.vv.v.v>..>.....>v>>v.
|
||||
vvv.>...>v>>>v...v.v.v..v...v.>>..vv.....>vv.>..>...>>....>>....>vv.v.>v...vv.vv>.>v.>v.>.>>...v>.....vv..vv.v>vv..>v>>>.>..>>>.vvv...>....
|
||||
..v>.v..>..>....v...>....v>v>v.vv..>>>.v.>.v..>..>>>..vv>>>.v>v.v>...>.v.>>.>.>...>.......v.v>>>.>...vv.v.>>.vv>v>v>..v.>v..v.>..>v.>..>v.>
|
||||
..>v.v...v>...>..v>...>>v>>>>>>.v.>.>.....>.v..v>v...vv.....>v.v.vv..>.v>v.>.>>>>>v.>>.v.v...v>v>>.v>..>vv>.>.vvv>v..>.v.>v>v>>..v>........
|
||||
...v..v>..vvv>...v>...vv....>..>...>...>v.>>vv.>v.>v...>vv>>v.>v......>...>.>..v..v.>v>>.>v>>>...vvv.vv.>..>..v..>>>vv..>...vv.vv>>...>..>.
|
||||
>.v...>>>>>>vvv..vvvvvv.vv..>.v>.v.v..vvv>v..>v>.>vvvvv>>..>.vv...>.v....>>>...v.vv..>......v..>..v.v....v....v.....>.v...v.vv>>..>..v..v.v
|
||||
...v>v..>.>..v...>v>v....>vvv>>>.v>>...>....vv>v...>v..>.v.>....v..>v..>.>v>.v.>..vv..v.....v..v..>....>.>.>v.>vv.vv.vv.>>v...vv.....v.>>v>
|
||||
v..vv..>...>.vv..v.v.....vv..>v......>v...v>v..v>.v>...>v>vvv>...v>v...>v.>>v......v>.>.........vv>....>vv>>v..v.v>..>vvv..>vvv..>.v.vv...v
|
||||
v.>v.>..vv>..>.....>>>....v.vv.v...vv.v.vvv..>....>>v>v>.>.v>>>.>.>.>...v.v...v.>v..v.>v>.vv.>>>.v.vv..>v>.v>..>vv>>.v>.>v..v..v>v>.>.>vvvv
|
||||
..>..>>......>.v>>>>.>v>..>.v....>...>>.v.v.vv....>.v>.>v.>>.>>v>.>..>vvvvv.v.>.v.v>.v>v.v>..>v..v.v.>v>>.>v>>.>.v.v..>.v.v>..>v...>.v>>.>>
|
||||
v....>.v>..v.>..v...>...>>v>.....v.....>..vv>v...v..vvv>.v..vv>v>v..>.>....>....v..v>>......v.>.vv>..>v.>>..v.....>.v>>.v...v>..>.>.v.v.>>v
|
||||
..v>.v....>v.v.>..>v.>.v....>.>v..v>...>v.v.....>..vv...v>....v.v..v>v.>.v>>>v>..>v.>...>.>...v..>>>v>v>....v>>v..v..>>....v>>.vv>.vv.>.v..
|
||||
>v..>...>..>>.vv.>v.>.....v>v.vv>vvv.v>>.>..v.>>..v..>.....>>.>vv.v.>>>v.>vv...v.>v>..>..>..v.vv...v...v>>>vv>.v.v..>>>..>.>v>...vv>.v..v>.
|
||||
....>vv.>vv.v>.v....>>v..v>.v.>>v>vv>..v.>>.>v>v.v..vv.v.>.v..>.......>.>v>.v>vvv>v.>.>..>>v>..vv>.vvv>.>>..v>vv.>>..>v>v>.v.>>........>>v.
|
||||
>.>vvv.>>.>..vvv.v...vvv..>>v.>>.v>.v..>v.v>..v.>...>..vv>v........>v..v>.v...v.v..vv.v...v.v>..>v.....vv...v.vvvv.>.v...>>......>>.>>...>v
|
||||
...>>...>>>v..vv...v>.>.v....v>v...>.>>>v.>>.............vv.>..v>.>v.>v.>..>.vv..>>.v..>>>>....v..>>v...v.v.>.>v>>>..>......>vvv>vvv>>.>>vv
|
||||
...v...v.v>>.>.>>>..v.v.>..>>.>.>.v>....>v...>>.v>>vv.....>>.>...v......v...>v.vv>>vv>....>.>>vv>v.>>>.>>vv..>.v..v>v...v.v..v...v..>v...>>
|
||||
..v..v>vvvv..>>..v>>.>>....v>>v...>>>..v.....v....>.>v.>>v>v...vv.....>>.>v..v.>..>v...>>.>.>>...>>...>>.>>...v>..v...>v...>v>>>..v.v.vvv..
|
||||
...v..v>>>v..>>>v..v>.>vv>.v.>.v...>..>vv>.v>>v>..v>>......>.v>>...v>v..>v.>...>......v.vv..v.>v...vvv>.>..v..v..v>v..>..>........>>...v...
|
||||
.>.v>...vv..v.v>>>v..>v>..v..>>v....v..v>...>v..>.v.>....>v>v.>>v.>.v....v.>.v.>>v>>.v>>..v.v..>v.>..vv>.>>>>>v.>.v>v.>...v.vvv...v.>v..>>>
|
||||
.v>.>>..>v.v>>..>>...>v..v..>..v.>>>.>.vv...v....v...>vv>v>..v..vv>......v>v.>>>.v...v.>>.>.>v..>....vv.vvv..>v..vvv>>.v.v>....vvv>vv.v.v..
|
||||
>..>v.>.>..>v.v.vv.>>.>....v.>v..>v.>>.vv..>.>>.>.v.>>..vvv>>.v...v.>.v.v>...>>...>...vvv>>vvvv.>v.>v..v..v.v..v..v...>.>...>>v.....>v..>v.
|
||||
..>....>...>>.>....vv.v.v>.......>v...v..>..>>......>>.v...>.>.>...>>.v.v.v..v>.>>>v...>>>.v..>....v..>v.>.vv......v..v..>.>>.>..vv.>.v..>.
|
||||
v>..v.v>.>...vv.v.>>..v>.vv.>v.>.>..v>>vv>>.v.>.>>.vv.>.>..v....v>>v....>.>.v.>.>v>v.>.v>v.>..>....v...v.v>v.>.>v.....>>>>v.v.>..v......v>.
|
||||
..v...>v>.>...>.....vv.vv>>.>..>.v.v>...v....>..v.>v.....>......v>....vv.v.v.>...v..v.v..v.>v.v.>vvv..v....>..>..v.>v.v.vvv.v.>>>....>v....
|
||||
>>..vv...>>.vv>vv>.>>...>...>.>v>>..vv.>.>.v.v.>>...>..>>v>v>...>.v>....>.>.....v..>>vv..>.>...v>>v......v.>v......>>>..>>.>.>.v>>v...>v...
|
||||
>>>..vv>v....v>..>......v..>vv.>>v>..>.>..vv.vv.v.>>..v...>.v.v..>>.>..v..vv.v.>>..>>.......>.>>v.v>v..>v>v>>>...vv..>v>..vvvv.>v>v.v>.>>v.
|
||||
.>....v.>>.v.v..>vv.>v..>v...>.vv.v.>vv.v...v...>v..v..v..v...>...v.>>>.>>.....>.>....>v>vvv..>.vv.vv.v...>v.>.v.>.>...>v..vv>>>.>...vvv>.>
|
||||
v.....>...v.>....>v..>v.>.vv.v>>v..>....>vvv.>>.>v.v.v.v..v...>v.>v...v>v...v.v>v...v.>v..v.vv..v>v..>..v.>...>..>....>..v.vv>>.v...v>.vv.v
|
||||
....>>.>.vv>>..v>>vvv.......>v...>>.vv>..>.vv>v>.v>v..>v...vvv..>>v>.>.v.v..>...vv...v..>..vv..vv...>..v..>v>...>.v>.v....v..vvv.>v.>v>vv..
|
||||
>v..v.....vv>v>..>>..v...>v>..>...v>>>>....v..vvvv>.........>..v.v>.v...v.v....v.>v.v>.>v..v.vvv>.v>.>..>>..>>>..v.>>>v.>..>.>v..>vvv.>v>..
|
||||
96
2021/src/common.rs
Normal file
96
2021/src/common.rs
Normal file
@@ -0,0 +1,96 @@
|
||||
use std::io::BufRead;
|
||||
use std::io::BufReader;
|
||||
use std::io::Read;
|
||||
use std::marker::PhantomData;
|
||||
use std::str::FromStr;
|
||||
|
||||
use nom::Finish;
|
||||
use nom::IResult;
|
||||
|
||||
pub struct LineIter<'a> {
|
||||
reader: BufReader<&'a mut dyn Read>,
|
||||
buffer: String,
|
||||
}
|
||||
|
||||
impl<'a> LineIter<'a> {
|
||||
pub fn new(input: &'a mut dyn Read) -> Self {
|
||||
Self {
|
||||
reader: BufReader::new(input),
|
||||
buffer: String::new(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the next line, or None
|
||||
///
|
||||
/// This is deliberately not an [Iterator] impl as those cannot hand out references to self.
|
||||
pub fn next(&mut self) -> Option<&str> {
|
||||
self.buffer.clear();
|
||||
|
||||
if matches!(self.reader.read_line(&mut self.buffer), Ok(n) if n > 0) {
|
||||
Some(self.buffer.trim_end_matches('\n'))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Line-based iterator/parser
|
||||
///
|
||||
/// For each line of the input, attempt to parse it as the requested type. Iteration is stopped on
|
||||
/// the first IO error or parse error, silently. Leading and trailing whitespace is stripped before
|
||||
/// attempting to parse.
|
||||
pub struct LineParser<'a, I>
|
||||
where
|
||||
I: FromStr,
|
||||
{
|
||||
iter: LineIter<'a>,
|
||||
_data: PhantomData<I>,
|
||||
}
|
||||
|
||||
impl<'a, I: FromStr> LineParser<'a, I> {
|
||||
pub fn new(input: &'a mut dyn Read) -> Self {
|
||||
Self {
|
||||
iter: LineIter::new(input),
|
||||
_data: PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<I: FromStr> Iterator for LineParser<'_, I> {
|
||||
type Item = I;
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
self.iter.next()?.parse().ok()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, I: FromStr> From<LineIter<'a>> for LineParser<'a, I> {
|
||||
fn from(iter: LineIter<'a>) -> Self {
|
||||
Self {
|
||||
iter,
|
||||
_data: PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Return two arguments in their natural PartialOrd order
|
||||
pub fn ordered<O: PartialOrd>(a: O, b: O) -> (O, O) {
|
||||
if a < b {
|
||||
(a, b)
|
||||
} else {
|
||||
(b, a)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn read_input<I, P, O>(mut input: I, parser: P) -> O
|
||||
where
|
||||
I: Read,
|
||||
P: for<'a> FnOnce(&'a [u8]) -> IResult<&'a [u8], O>,
|
||||
{
|
||||
let mut buffer = Vec::new();
|
||||
input.read_to_end(&mut buffer).unwrap();
|
||||
|
||||
let (_, output) = parser(&buffer).finish().unwrap();
|
||||
|
||||
output
|
||||
}
|
||||
40
2021/src/day01.rs
Normal file
40
2021/src/day01.rs
Normal file
@@ -0,0 +1,40 @@
|
||||
use std::io::Read;
|
||||
|
||||
use crate::common::LineParser;
|
||||
|
||||
fn part_generic(input: &mut dyn Read, window: usize) -> String {
|
||||
let numbers: Vec<u32> = LineParser::new(input).collect();
|
||||
|
||||
numbers
|
||||
.windows(window)
|
||||
.filter(|w| w.last() > w.first())
|
||||
.count()
|
||||
.to_string()
|
||||
}
|
||||
|
||||
pub fn part1(input: &mut dyn Read) -> String {
|
||||
part_generic(input, 2)
|
||||
}
|
||||
|
||||
pub fn part2(input: &mut dyn Read) -> String {
|
||||
part_generic(input, 4)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::test_implementation;
|
||||
|
||||
use super::*;
|
||||
|
||||
const SAMPLE: &[u8] = include_bytes!("samples/01.txt");
|
||||
|
||||
#[test]
|
||||
fn sample_part1() {
|
||||
test_implementation(part1, SAMPLE, 7);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sample_part2() {
|
||||
test_implementation(part2, SAMPLE, 5);
|
||||
}
|
||||
}
|
||||
86
2021/src/day02.rs
Normal file
86
2021/src/day02.rs
Normal file
@@ -0,0 +1,86 @@
|
||||
use std::io::Read;
|
||||
|
||||
use crate::common::LineIter;
|
||||
|
||||
enum Dir {
|
||||
Up,
|
||||
Down,
|
||||
Forward,
|
||||
}
|
||||
|
||||
fn parse_input(input: &mut dyn Read) -> Vec<(Dir, i32)> {
|
||||
let mut reader = LineIter::new(input);
|
||||
let mut moves = Vec::new();
|
||||
|
||||
while let Some(line) = reader.next() {
|
||||
let (dir, amount) = line.split_once(' ').unwrap();
|
||||
|
||||
let dir = match dir {
|
||||
"up" => Dir::Up,
|
||||
"down" => Dir::Down,
|
||||
"forward" => Dir::Forward,
|
||||
_ => panic!("Invalid direction '{}'", dir),
|
||||
};
|
||||
|
||||
moves.push((dir, amount.parse().unwrap()));
|
||||
}
|
||||
|
||||
moves
|
||||
}
|
||||
|
||||
pub fn part1(input: &mut dyn Read) -> String {
|
||||
let moves = parse_input(input);
|
||||
|
||||
let mut x = 0;
|
||||
let mut depth = 0;
|
||||
|
||||
for (dir, amount) in moves {
|
||||
match dir {
|
||||
Dir::Up => depth -= amount,
|
||||
Dir::Down => depth += amount,
|
||||
Dir::Forward => x += amount,
|
||||
}
|
||||
}
|
||||
|
||||
(x * depth).to_string()
|
||||
}
|
||||
|
||||
pub fn part2(input: &mut dyn Read) -> String {
|
||||
let moves = parse_input(input);
|
||||
|
||||
let mut x = 0;
|
||||
let mut depth = 0;
|
||||
let mut aim = 0;
|
||||
|
||||
for (dir, amount) in moves {
|
||||
match dir {
|
||||
Dir::Up => aim -= amount,
|
||||
Dir::Down => aim += amount,
|
||||
Dir::Forward => {
|
||||
x += amount;
|
||||
depth += aim * amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(x * depth).to_string()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::test_implementation;
|
||||
|
||||
use super::*;
|
||||
|
||||
const SAMPLE: &[u8] = include_bytes!("samples/02.txt");
|
||||
|
||||
#[test]
|
||||
fn sample_part1() {
|
||||
test_implementation(part1, SAMPLE, 150);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sample_part2() {
|
||||
test_implementation(part1, SAMPLE, 150);
|
||||
}
|
||||
}
|
||||
101
2021/src/day03.rs
Normal file
101
2021/src/day03.rs
Normal file
@@ -0,0 +1,101 @@
|
||||
use std::io::Read;
|
||||
|
||||
use crate::common::LineIter;
|
||||
|
||||
fn parse_bit(bit: char) -> usize {
|
||||
if bit == '1' {
|
||||
1
|
||||
} else {
|
||||
0
|
||||
}
|
||||
}
|
||||
|
||||
pub fn part1(input: &mut dyn Read) -> String {
|
||||
let mut reader = LineIter::new(input);
|
||||
|
||||
let mut totals: Vec<usize> = reader.next().unwrap().chars().map(parse_bit).collect();
|
||||
|
||||
let mut count = 1;
|
||||
|
||||
while let Some(line) = reader.next() {
|
||||
line.chars()
|
||||
.map(parse_bit)
|
||||
.zip(totals.iter_mut())
|
||||
.for_each(|(b, t)| *t += b);
|
||||
|
||||
count += 1;
|
||||
}
|
||||
|
||||
let bitmask = (1 << totals.len()) - 1;
|
||||
|
||||
let gamma = totals.into_iter().fold(0, |mut current, total| {
|
||||
current <<= 1;
|
||||
if total > count / 2 {
|
||||
current |= 1;
|
||||
};
|
||||
|
||||
current
|
||||
});
|
||||
|
||||
let epsilon = (!gamma) & bitmask;
|
||||
|
||||
(gamma * epsilon).to_string()
|
||||
}
|
||||
|
||||
fn find_remaining(mut strings: Vec<u32>, most: bool, len: usize) -> u32 {
|
||||
for pos in 1..=len {
|
||||
if strings.len() == 1 {
|
||||
break;
|
||||
}
|
||||
|
||||
let bit = 1 << (len - pos);
|
||||
|
||||
let occurrences = strings.iter().filter(|&&b| (b & bit) == bit).count();
|
||||
|
||||
let keep = if (occurrences * 2 < strings.len()) ^ most {
|
||||
bit
|
||||
} else {
|
||||
0
|
||||
};
|
||||
|
||||
strings.retain(|&b| (b & bit) == keep);
|
||||
}
|
||||
|
||||
strings[0]
|
||||
}
|
||||
|
||||
pub fn part2(input: &mut dyn Read) -> String {
|
||||
let mut strings = Vec::new();
|
||||
let mut reader = LineIter::new(input);
|
||||
let mut read_line = reader.next();
|
||||
let len = read_line.unwrap().len();
|
||||
|
||||
while let Some(line) = read_line {
|
||||
strings.push(u32::from_str_radix(line, 2).unwrap());
|
||||
read_line = reader.next();
|
||||
}
|
||||
|
||||
let oxygen = find_remaining(strings.clone(), true, len);
|
||||
let co2 = find_remaining(strings, false, len);
|
||||
|
||||
(oxygen * co2).to_string()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::test_implementation;
|
||||
|
||||
use super::*;
|
||||
|
||||
const SAMPLE: &[u8] = include_bytes!("samples/03.txt");
|
||||
|
||||
#[test]
|
||||
fn sample_part1() {
|
||||
test_implementation(part1, SAMPLE, 198);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sample_part2() {
|
||||
test_implementation(part2, SAMPLE, 230)
|
||||
}
|
||||
}
|
||||
141
2021/src/day04.rs
Normal file
141
2021/src/day04.rs
Normal file
@@ -0,0 +1,141 @@
|
||||
use std::io::Read;
|
||||
|
||||
use nom::bytes::complete::tag;
|
||||
use nom::character::complete::multispace1;
|
||||
use nom::multi::many1;
|
||||
use nom::multi::separated_list1;
|
||||
use nom::sequence::preceded;
|
||||
use nom::sequence::tuple;
|
||||
use nom::IResult;
|
||||
|
||||
use crate::common::read_input;
|
||||
|
||||
#[derive(Debug)]
|
||||
struct BingoCard([(bool, u8); 25]);
|
||||
|
||||
impl BingoCard {
|
||||
pub fn cross(&mut self, num: u8) -> Option<usize> {
|
||||
self.0
|
||||
.iter_mut()
|
||||
.enumerate()
|
||||
.find_map(|(pos, (ticked, x))| {
|
||||
if *x == num {
|
||||
*ticked = true;
|
||||
Some(pos)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn has_won(&self, crossed: usize) -> bool {
|
||||
// Check horizontal lines
|
||||
if self
|
||||
.0
|
||||
.chunks_exact(5)
|
||||
.nth(crossed / 5)
|
||||
.unwrap()
|
||||
.iter()
|
||||
.all(|&b| b.0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check vertical lines
|
||||
self.0.iter().skip(crossed % 5).step_by(5).all(|b| b.0)
|
||||
|
||||
// Diagonals do not count
|
||||
}
|
||||
|
||||
pub fn remaining(&self) -> u32 {
|
||||
self.0
|
||||
.iter()
|
||||
.filter_map(|&(ticked, num)| if !ticked { Some(num as u32) } else { None })
|
||||
.sum()
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_numbers(input: &[u8]) -> IResult<&[u8], Vec<u8>> {
|
||||
use nom::character::complete::u8;
|
||||
separated_list1(tag(","), u8)(input)
|
||||
}
|
||||
|
||||
fn parse_bingo(mut input: &[u8]) -> IResult<&[u8], BingoCard> {
|
||||
use nom::character::complete::u8;
|
||||
|
||||
let mut card = [0; 25];
|
||||
|
||||
let mut parse_num = preceded(multispace1, u8);
|
||||
|
||||
// fill doesn't work with preceded
|
||||
for num in &mut card {
|
||||
let result = parse_num(input)?;
|
||||
*num = result.1;
|
||||
input = result.0;
|
||||
}
|
||||
|
||||
Ok((input, BingoCard(card.map(|x| (false, x)))))
|
||||
}
|
||||
|
||||
fn parse_input(input: &[u8]) -> IResult<&[u8], (Vec<u8>, Vec<BingoCard>)> {
|
||||
tuple((parse_numbers, many1(parse_bingo)))(input)
|
||||
}
|
||||
|
||||
pub fn part1(input: &mut dyn Read) -> String {
|
||||
let (numbers, mut bingo_cards) = read_input(input, parse_input);
|
||||
|
||||
for number in numbers {
|
||||
for card in &mut bingo_cards {
|
||||
if matches!(card.cross(number), Some(pos) if card.has_won(pos)) {
|
||||
return (number as u32 * card.remaining()).to_string();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
panic!("None of the cards won")
|
||||
}
|
||||
|
||||
pub fn part2(input: &mut dyn Read) -> String {
|
||||
let (numbers, mut bingo_cards) = read_input(input, parse_input);
|
||||
let mut bingo_won = vec![false; bingo_cards.len()];
|
||||
let mut num_won = 0;
|
||||
let to_win = bingo_cards.len();
|
||||
|
||||
for num in numbers {
|
||||
for (won, card) in bingo_won.iter_mut().zip(bingo_cards.iter_mut()) {
|
||||
if *won {
|
||||
continue;
|
||||
}
|
||||
|
||||
if matches!(card.cross(num), Some(pos) if card.has_won(pos)) {
|
||||
*won = true;
|
||||
num_won += 1;
|
||||
|
||||
if num_won == to_win {
|
||||
return (num as u32 * card.remaining()).to_string();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
panic!("Not all cards won!")
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::test_implementation;
|
||||
|
||||
use super::*;
|
||||
|
||||
const SAMPLE: &[u8] = include_bytes!("samples/04.txt");
|
||||
|
||||
#[test]
|
||||
fn sample_part1() {
|
||||
test_implementation(part1, SAMPLE, 4512)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sample_part2() {
|
||||
test_implementation(part2, SAMPLE, 1924)
|
||||
}
|
||||
}
|
||||
99
2021/src/day05.rs
Normal file
99
2021/src/day05.rs
Normal file
@@ -0,0 +1,99 @@
|
||||
use std::collections::HashMap;
|
||||
use std::io::Read;
|
||||
use std::iter::repeat;
|
||||
|
||||
use nom::bytes::complete::tag;
|
||||
use nom::sequence::tuple;
|
||||
use nom::Finish;
|
||||
use nom::IResult;
|
||||
|
||||
use crate::common::ordered;
|
||||
use crate::common::LineIter;
|
||||
|
||||
type Coord = (u16, u16);
|
||||
|
||||
fn coordinates(input: &str) -> IResult<&str, Coord> {
|
||||
use nom::character::complete;
|
||||
|
||||
let (input, (x, _, y)) = tuple((complete::u16, complete::char(','), complete::u16))(input)?;
|
||||
|
||||
Ok((input, (x, y)))
|
||||
}
|
||||
|
||||
fn line_definition(input: &str) -> IResult<&str, (Coord, Coord)> {
|
||||
let (input, (begin, _, end)) = tuple((coordinates, tag(" -> "), coordinates))(input)?;
|
||||
|
||||
// Sorting the coordinates saves trouble later
|
||||
Ok((input, ordered(begin, end)))
|
||||
}
|
||||
|
||||
fn stripe(
|
||||
map: &mut HashMap<Coord, u16>,
|
||||
xs: impl Iterator<Item = u16>,
|
||||
ys: impl Iterator<Item = u16>,
|
||||
) {
|
||||
for (x, y) in xs.zip(ys) {
|
||||
*map.entry((x, y)).or_default() += 1;
|
||||
}
|
||||
}
|
||||
|
||||
fn part_common(input: &mut dyn Read, diagonals: bool) -> String {
|
||||
let mut reader = LineIter::new(input);
|
||||
let mut map = HashMap::new();
|
||||
|
||||
while let Some(line) = reader.next() {
|
||||
let (begin, end) = line_definition(line).finish().unwrap().1;
|
||||
|
||||
if begin.0 == end.0 {
|
||||
let y_range = begin.1..=end.1;
|
||||
stripe(&mut map, repeat(begin.0), y_range);
|
||||
} else if begin.1 == end.1 {
|
||||
let x_range = begin.0..=end.0;
|
||||
stripe(&mut map, x_range, repeat(begin.1));
|
||||
} else if diagonals {
|
||||
let x_range = begin.0..=end.0;
|
||||
let y_range = (begin.1.min(end.1))..=(begin.1.max(end.1));
|
||||
|
||||
if begin.1 > end.1 {
|
||||
// For a downward slope we need to reverse Y
|
||||
stripe(&mut map, x_range, y_range.rev());
|
||||
} else {
|
||||
stripe(&mut map, x_range, y_range);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
map.values().filter(|&&v| v > 1).count().to_string()
|
||||
}
|
||||
|
||||
pub fn part1(input: &mut dyn Read) -> String {
|
||||
part_common(input, false)
|
||||
}
|
||||
|
||||
pub fn part2(input: &mut dyn Read) -> String {
|
||||
part_common(input, true)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::test_implementation;
|
||||
|
||||
use super::*;
|
||||
|
||||
const SAMPLE: &[u8] = include_bytes!("samples/05.txt");
|
||||
|
||||
#[test]
|
||||
fn test_parser() {
|
||||
assert_eq!(line_definition("6,4 -> 2,0"), Ok(("", ((2, 0), (6, 4)))));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sample_part1() {
|
||||
test_implementation(part1, SAMPLE, 5)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sample_part2() {
|
||||
test_implementation(part2, SAMPLE, 12)
|
||||
}
|
||||
}
|
||||
63
2021/src/day06.rs
Normal file
63
2021/src/day06.rs
Normal file
@@ -0,0 +1,63 @@
|
||||
use std::io::Read;
|
||||
|
||||
fn fish_growth(fish: &[u8], days: usize) -> usize {
|
||||
let mut fish_per_day = [0usize; 9];
|
||||
|
||||
for &life in fish {
|
||||
fish_per_day[life as usize] += 1;
|
||||
}
|
||||
|
||||
for day in 0..days {
|
||||
let index = day % fish_per_day.len();
|
||||
let offspring_today = fish_per_day[index];
|
||||
|
||||
// The parents can be parents in 6 days
|
||||
fish_per_day[(index + 7) % fish_per_day.len()] += offspring_today;
|
||||
// The offspring from today will be ready the next time they come around
|
||||
}
|
||||
|
||||
fish_per_day.into_iter().sum()
|
||||
}
|
||||
|
||||
fn part_common(input: &mut dyn Read, days: usize) -> String {
|
||||
let mut buffer = String::new();
|
||||
input.read_to_string(&mut buffer).unwrap();
|
||||
|
||||
let fish: Vec<u8> = buffer
|
||||
.trim_end()
|
||||
.split(',')
|
||||
.map(|s| s.parse().unwrap())
|
||||
.collect();
|
||||
|
||||
fish_growth(&fish, days).to_string()
|
||||
}
|
||||
|
||||
pub fn part1(input: &mut dyn Read) -> String {
|
||||
part_common(input, 80)
|
||||
}
|
||||
|
||||
pub fn part2(input: &mut dyn Read) -> String {
|
||||
part_common(input, 256)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
const SAMPLE: [u8; 5] = [3, 4, 3, 1, 2];
|
||||
|
||||
#[test]
|
||||
fn sample_part1() {
|
||||
assert_eq!(fish_growth(&SAMPLE, 1), 5);
|
||||
assert_eq!(fish_growth(&SAMPLE, 2), 6);
|
||||
assert_eq!(fish_growth(&SAMPLE, 3), 7);
|
||||
assert_eq!(fish_growth(&SAMPLE, 4), 9);
|
||||
assert_eq!(fish_growth(&SAMPLE, 18), 26);
|
||||
assert_eq!(fish_growth(&SAMPLE, 80), 5934);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sample_part2() {
|
||||
assert_eq!(fish_growth(&SAMPLE, 256), 26984457539);
|
||||
}
|
||||
}
|
||||
111
2021/src/day07.rs
Normal file
111
2021/src/day07.rs
Normal file
@@ -0,0 +1,111 @@
|
||||
use std::io::Read;
|
||||
|
||||
use itertools::Itertools;
|
||||
|
||||
use crate::common::ordered;
|
||||
|
||||
fn read_input(input: &mut dyn Read) -> Vec<usize> {
|
||||
let mut buf = String::new();
|
||||
input.read_to_string(&mut buf).unwrap();
|
||||
|
||||
let mut crabs: Vec<usize> = buf
|
||||
.trim_end()
|
||||
.split(',')
|
||||
.map(|s| s.parse().unwrap())
|
||||
.collect();
|
||||
|
||||
crabs.sort_unstable();
|
||||
|
||||
crabs
|
||||
}
|
||||
|
||||
fn cost_at(pos: usize, crabs: &[usize]) -> usize {
|
||||
crabs
|
||||
.iter()
|
||||
.map(|&crab_pos| {
|
||||
if crab_pos > pos {
|
||||
crab_pos - pos
|
||||
} else {
|
||||
pos - crab_pos
|
||||
}
|
||||
})
|
||||
.sum()
|
||||
}
|
||||
|
||||
pub fn part1(input: &mut dyn Read) -> String {
|
||||
let crabs = read_input(input);
|
||||
|
||||
let median = crabs[crabs.len() / 2 + (crabs.len() % 2)];
|
||||
|
||||
cost_at(median, &crabs).to_string()
|
||||
}
|
||||
|
||||
pub fn sum_until(end: usize) -> usize {
|
||||
(end * (1 + end)) / 2
|
||||
}
|
||||
|
||||
fn cost_at2(pos: usize, groups: &[(usize, usize)]) -> usize {
|
||||
groups
|
||||
.iter()
|
||||
.map(|&(number, new_pos)| {
|
||||
let (first, last) = ordered(pos, new_pos);
|
||||
|
||||
number * sum_until(last - first)
|
||||
})
|
||||
.sum()
|
||||
}
|
||||
|
||||
fn ternary_search(mut min: usize, mut max: usize, callback: impl Fn(usize) -> usize) -> usize {
|
||||
while max - min > 6 {
|
||||
let mid1 = min + (max - min) / 3;
|
||||
let mid2 = max - (max - min) / 3;
|
||||
|
||||
let cost1 = callback(mid1);
|
||||
let cost2 = callback(mid2);
|
||||
|
||||
if cost1 < cost2 {
|
||||
max = mid2 - 1
|
||||
} else {
|
||||
min = mid1 + 1
|
||||
}
|
||||
}
|
||||
|
||||
// Ternary search isn't effective at such small intervals so we iterate the remaining part
|
||||
(min..=max).map(callback).min().unwrap()
|
||||
}
|
||||
|
||||
pub fn part2(input: &mut dyn Read) -> String {
|
||||
let groups: Vec<_> = read_input(input).into_iter().dedup_with_count().collect();
|
||||
|
||||
let min = groups.first().unwrap().1;
|
||||
let max = groups.last().unwrap().1;
|
||||
|
||||
ternary_search(min, max, |pos| cost_at2(pos, &groups)).to_string()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::test_implementation;
|
||||
|
||||
use super::*;
|
||||
|
||||
const SAMPLE: &[u8] = &*b"16,1,2,0,4,2,7,1,2,14";
|
||||
|
||||
#[test]
|
||||
fn sample_part1() {
|
||||
test_implementation(part1, SAMPLE, 37);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sample_part2() {
|
||||
test_implementation(part2, SAMPLE, 168);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_maths() {
|
||||
assert_eq!(sum_until(1), 1);
|
||||
assert_eq!(sum_until(2), 3);
|
||||
assert_eq!(sum_until(3), 6);
|
||||
assert_eq!(sum_until(4), 10);
|
||||
}
|
||||
}
|
||||
149
2021/src/day08.rs
Normal file
149
2021/src/day08.rs
Normal file
@@ -0,0 +1,149 @@
|
||||
use std::collections::VecDeque;
|
||||
use std::io::Read;
|
||||
use std::num::NonZeroU8;
|
||||
|
||||
use crate::common::LineIter;
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
struct Segments(NonZeroU8);
|
||||
|
||||
impl Segments {
|
||||
pub fn overlap(self, other: Segments) -> u32 {
|
||||
(self.0 | other.0).get().count_ones()
|
||||
}
|
||||
|
||||
pub fn len(self) -> u32 {
|
||||
self.0.get().count_ones()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<&'a str> for Segments {
|
||||
fn from(s: &'a str) -> Self {
|
||||
let mut buffer = 0;
|
||||
|
||||
for &b in s.as_bytes() {
|
||||
debug_assert!((b'a'..=b'g').contains(&b));
|
||||
|
||||
buffer |= 1 << (b - b'a');
|
||||
}
|
||||
|
||||
Self(NonZeroU8::new(buffer).unwrap())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn part1(input: &mut dyn Read) -> String {
|
||||
let mut reader = LineIter::new(input);
|
||||
|
||||
let mut total = 0;
|
||||
|
||||
while let Some(line) = reader.next() {
|
||||
total += line
|
||||
.split(' ')
|
||||
.skip_while(|&s| s != "|")
|
||||
.filter(|s| [2, 3, 4, 7].contains(&s.len()))
|
||||
.count();
|
||||
}
|
||||
|
||||
total.to_string()
|
||||
}
|
||||
|
||||
fn decode(line: &str, unmatched: &mut VecDeque<Segments>) -> usize {
|
||||
let mut mapping = [None; 10];
|
||||
|
||||
unmatched.clear();
|
||||
unmatched.extend(line.split(' ').filter(|&s| s != "|").map(Segments::from));
|
||||
|
||||
while let Some(segments) = unmatched.pop_front() {
|
||||
// Note: this loop might "deduce" a combination more than once, but deducing digits is
|
||||
// idempotent so it does not interfere.
|
||||
match segments.len() {
|
||||
2 => mapping[1] = Some(segments),
|
||||
3 => mapping[7] = Some(segments),
|
||||
4 => mapping[4] = Some(segments),
|
||||
5 => {
|
||||
// Could be 2, 3, or 5
|
||||
if let Some(one) = mapping[1] {
|
||||
if segments.overlap(one) == 5 {
|
||||
// No lines added, so must be a three
|
||||
mapping[3] = Some(segments);
|
||||
continue;
|
||||
} else if let Some(four) = mapping[4] {
|
||||
// Should be 6 for 5 and 7 for 2
|
||||
if segments.overlap(four) == 6 {
|
||||
mapping[5] = Some(segments);
|
||||
} else {
|
||||
mapping[2] = Some(segments);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
unmatched.push_back(segments);
|
||||
}
|
||||
6 => {
|
||||
// Could be 0, 6, or 9
|
||||
if let Some(one) = mapping[1] {
|
||||
if segments.overlap(one) == 7 {
|
||||
mapping[6] = Some(segments);
|
||||
continue;
|
||||
} else if let Some(four) = mapping[4] {
|
||||
if segments.overlap(four) == 6 {
|
||||
mapping[9] = Some(segments);
|
||||
} else {
|
||||
mapping[0] = Some(segments);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
unmatched.push_back(segments);
|
||||
}
|
||||
}
|
||||
7 => mapping[8] = Some(segments),
|
||||
_ => panic!("Invalid segments!"),
|
||||
}
|
||||
}
|
||||
|
||||
line.split(' ')
|
||||
.skip_while(|&s| s != "|")
|
||||
.skip(1)
|
||||
.map(|s| {
|
||||
let segments = Segments::from(s);
|
||||
mapping.iter().position(|s| &Some(segments) == s).unwrap()
|
||||
})
|
||||
.fold(0, |acc, n| acc * 10 + n)
|
||||
}
|
||||
|
||||
pub fn part2(input: &mut dyn Read) -> String {
|
||||
let mut reader = LineIter::new(input);
|
||||
let mut total = 0;
|
||||
|
||||
// Allocate work memory outside the decode function so we can reuse it
|
||||
let mut work_buffer = VecDeque::new();
|
||||
|
||||
while let Some(line) = reader.next() {
|
||||
total += decode(line, &mut work_buffer);
|
||||
}
|
||||
|
||||
total.to_string()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::test_implementation;
|
||||
|
||||
use super::*;
|
||||
|
||||
const SAMPLE1: &[u8] =
|
||||
&*b"acedgfb cdfbe gcdfa fbcad dab cefabd cdfgeb eafb cagedb ab | cdfeb fcadb cdfeb cdbaf";
|
||||
const SAMPLE2: &[u8] = include_bytes!("samples/08.txt");
|
||||
|
||||
#[test]
|
||||
fn sample_part1() {
|
||||
test_implementation(part1, SAMPLE1, 0);
|
||||
test_implementation(part1, SAMPLE2, 26);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sample_part2() {
|
||||
test_implementation(part2, SAMPLE1, 5353);
|
||||
test_implementation(part2, SAMPLE2, 61229);
|
||||
}
|
||||
}
|
||||
119
2021/src/day09.rs
Normal file
119
2021/src/day09.rs
Normal file
@@ -0,0 +1,119 @@
|
||||
use std::cmp::Reverse;
|
||||
use std::io::Read;
|
||||
|
||||
pub fn part1(input: &mut dyn Read) -> String {
|
||||
let mut buffer = Vec::new();
|
||||
input.read_to_end(&mut buffer).unwrap();
|
||||
|
||||
let lines: Vec<_> = buffer
|
||||
.split(|&s| s == b'\n')
|
||||
.filter(|s| !s.is_empty())
|
||||
.collect();
|
||||
|
||||
let mut total_danger = 0;
|
||||
|
||||
for y in 0..lines.len() {
|
||||
for x in 0..lines[y].len() {
|
||||
if x > 0 && lines[y][x - 1] <= lines[y][x] {
|
||||
continue;
|
||||
}
|
||||
|
||||
if x + 1 < lines[y].len() && lines[y][x + 1] <= lines[y][x] {
|
||||
continue;
|
||||
}
|
||||
|
||||
if y > 0 && lines[y - 1][x] <= lines[y][x] {
|
||||
continue;
|
||||
}
|
||||
|
||||
if y + 1 < lines.len() && lines[y + 1][x] <= lines[y][x] {
|
||||
continue;
|
||||
}
|
||||
|
||||
total_danger += 1 + (lines[y][x] - b'0') as i32;
|
||||
}
|
||||
}
|
||||
|
||||
total_danger.to_string()
|
||||
}
|
||||
|
||||
pub fn part2(input: &mut dyn Read) -> String {
|
||||
let mut buffer = Vec::new();
|
||||
input.read_to_end(&mut buffer).unwrap();
|
||||
|
||||
let mut visited_buffer = vec![false; buffer.len()];
|
||||
|
||||
let lines: Vec<_> = buffer
|
||||
.split(|&s| s == b'\n')
|
||||
.filter(|s| !s.is_empty())
|
||||
.collect();
|
||||
|
||||
let mut visited: Vec<_> = visited_buffer.chunks_exact_mut(lines[0].len()).collect();
|
||||
|
||||
let mut todo = Vec::new();
|
||||
|
||||
let mut sizes = Vec::with_capacity(4);
|
||||
|
||||
for y in 0..lines.len() {
|
||||
for x in 0..lines[0].len() {
|
||||
if visited[y][x] || lines[y][x] == b'9' {
|
||||
continue;
|
||||
}
|
||||
|
||||
todo.push((x, y));
|
||||
let mut size = 1;
|
||||
visited[y][x] = true;
|
||||
|
||||
while let Some((x, y)) = todo.pop() {
|
||||
let mut add = |x: usize, y: usize| {
|
||||
if lines[y][x] != b'9' && !visited[y][x] {
|
||||
size += 1;
|
||||
visited[y][x] = true;
|
||||
todo.push((x, y));
|
||||
}
|
||||
};
|
||||
|
||||
if x > 0 {
|
||||
add(x - 1, y);
|
||||
}
|
||||
|
||||
if x + 1 < lines[y].len() {
|
||||
add(x + 1, y);
|
||||
}
|
||||
|
||||
if y > 0 {
|
||||
add(x, y - 1)
|
||||
}
|
||||
|
||||
if y + 1 < lines.len() {
|
||||
add(x, y + 1);
|
||||
}
|
||||
}
|
||||
|
||||
sizes.push(Reverse(size));
|
||||
sizes.sort_unstable();
|
||||
sizes.truncate(3);
|
||||
}
|
||||
}
|
||||
|
||||
sizes.into_iter().fold(1, |a, Reverse(b)| a * b).to_string()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
use crate::test_implementation;
|
||||
|
||||
const SAMPLE: &[u8] = include_bytes!("samples/09.txt");
|
||||
|
||||
#[test]
|
||||
fn sample_part1() {
|
||||
test_implementation(part1, SAMPLE, 15);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sample_part2() {
|
||||
test_implementation(part2, SAMPLE, 1134);
|
||||
}
|
||||
}
|
||||
103
2021/src/day10.rs
Normal file
103
2021/src/day10.rs
Normal file
@@ -0,0 +1,103 @@
|
||||
use std::io::Read;
|
||||
|
||||
use crate::common::LineIter;
|
||||
|
||||
macro_rules! check_matching {
|
||||
($stack:ident, $total:ident, $match:literal, $score:literal) => {{
|
||||
if let Some($match) = $stack.pop() {
|
||||
continue;
|
||||
} else {
|
||||
$total += $score;
|
||||
break;
|
||||
}
|
||||
}};
|
||||
($stack:ident, $match:literal) => {{
|
||||
if let Some($match) = $stack.pop() {
|
||||
continue;
|
||||
} else {
|
||||
$stack.clear();
|
||||
break;
|
||||
}
|
||||
}};
|
||||
}
|
||||
|
||||
pub fn part1(input: &mut dyn Read) -> String {
|
||||
let mut reader = LineIter::new(input);
|
||||
|
||||
let mut stack = Vec::new();
|
||||
let mut total = 0;
|
||||
|
||||
while let Some(line) = reader.next() {
|
||||
stack.clear();
|
||||
|
||||
for &c in line.as_bytes() {
|
||||
match c {
|
||||
b'(' | b'[' | b'{' | b'<' => stack.push(c),
|
||||
b')' => check_matching!(stack, total, b'(', 3),
|
||||
b']' => check_matching!(stack, total, b'[', 57),
|
||||
b'}' => check_matching!(stack, total, b'{', 1197),
|
||||
b'>' => check_matching!(stack, total, b'<', 25137),
|
||||
_ => panic!("Invalid bracket '{}'", char::from(c)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
total.to_string()
|
||||
}
|
||||
|
||||
pub fn part2(input: &mut dyn Read) -> String {
|
||||
let mut reader = LineIter::new(input);
|
||||
|
||||
let mut stack = Vec::new();
|
||||
let mut scores = Vec::new();
|
||||
|
||||
while let Some(line) = reader.next() {
|
||||
for &c in line.as_bytes() {
|
||||
match c {
|
||||
b'(' | b'[' | b'{' | b'<' => stack.push(c),
|
||||
b')' => check_matching!(stack, b'('),
|
||||
b']' => check_matching!(stack, b'['),
|
||||
b'}' => check_matching!(stack, b'{'),
|
||||
b'>' => check_matching!(stack, b'<'),
|
||||
_ => panic!("Invalid bracket '{}'", char::from(c)),
|
||||
}
|
||||
}
|
||||
|
||||
if !stack.is_empty() {
|
||||
let score = stack
|
||||
.drain(..)
|
||||
.rev()
|
||||
.map(|c| match c {
|
||||
b'(' => 1,
|
||||
b'[' => 2,
|
||||
b'{' => 3,
|
||||
b'<' => 4,
|
||||
_ => 0,
|
||||
})
|
||||
.fold(0u64, |acc, s| 5 * acc + s);
|
||||
scores.push(score);
|
||||
}
|
||||
}
|
||||
|
||||
scores.sort_unstable();
|
||||
scores[scores.len() / 2].to_string()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
use crate::test_implementation;
|
||||
|
||||
const SAMPLE: &[u8] = include_bytes!("samples/10.txt");
|
||||
|
||||
#[test]
|
||||
fn sample_part1() {
|
||||
test_implementation(part1, SAMPLE, 26397);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sample_part2() {
|
||||
test_implementation(part2, SAMPLE, 288957);
|
||||
}
|
||||
}
|
||||
107
2021/src/day11.rs
Normal file
107
2021/src/day11.rs
Normal file
@@ -0,0 +1,107 @@
|
||||
use std::io::Read;
|
||||
|
||||
fn read_grid<'a>(input: &'_ mut dyn Read, buffer: &'a mut Vec<u8>) -> Vec<&'a mut [u8]> {
|
||||
input.read_to_end(buffer).unwrap();
|
||||
|
||||
let mut grid: Vec<&mut [u8]> = buffer.split_mut(|&b| b == b'\n').collect();
|
||||
|
||||
grid.iter_mut()
|
||||
.flat_map(|line| line.iter_mut())
|
||||
.for_each(|b| *b -= b'0');
|
||||
|
||||
grid
|
||||
}
|
||||
|
||||
fn advance(grid: &mut [&mut [u8]], todo: &mut Vec<(i8, i8)>) -> usize {
|
||||
let mut flashes = 0;
|
||||
|
||||
grid.iter_mut()
|
||||
.enumerate()
|
||||
.flat_map(|(y, line)| {
|
||||
line.iter_mut()
|
||||
.enumerate()
|
||||
.map(move |(x, value)| (x, y, value))
|
||||
})
|
||||
.for_each(|(x, y, value)| {
|
||||
*value += 1;
|
||||
if *value > 9 {
|
||||
todo.push((x as i8, y as i8));
|
||||
}
|
||||
});
|
||||
|
||||
while let Some((x, y)) = todo.pop() {
|
||||
flashes += 1;
|
||||
|
||||
for dy in -1..=1 {
|
||||
for dx in -1..=1 {
|
||||
if dx == 0 && dy == 0 {
|
||||
continue;
|
||||
}
|
||||
|
||||
let nx = usize::try_from(x + dx);
|
||||
let ny = usize::try_from(y + dy);
|
||||
|
||||
if let (Ok(nx), Ok(ny)) = (nx, ny) {
|
||||
if let Some(value) = grid.get_mut(ny).and_then(|line| line.get_mut(nx)) {
|
||||
*value += 1;
|
||||
if *value == 10 {
|
||||
todo.push((nx as i8, ny as i8));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
grid.iter_mut()
|
||||
.flat_map(|line| line.iter_mut())
|
||||
.filter(|b| **b > 9)
|
||||
.for_each(|b| *b = 0);
|
||||
|
||||
flashes
|
||||
}
|
||||
|
||||
pub fn part1(input: &mut dyn Read) -> String {
|
||||
let mut buffer = Vec::new();
|
||||
|
||||
let mut grid = read_grid(input, &mut buffer);
|
||||
let mut todo = Vec::new();
|
||||
|
||||
(0..100)
|
||||
.map(|_| advance(&mut grid, &mut todo))
|
||||
.sum::<usize>()
|
||||
.to_string()
|
||||
}
|
||||
|
||||
pub fn part2(input: &mut dyn Read) -> String {
|
||||
let mut buffer = Vec::new();
|
||||
|
||||
let mut grid = read_grid(input, &mut buffer);
|
||||
let mut todo = Vec::new();
|
||||
|
||||
let target: usize = grid.iter().map(|line| line.len()).sum();
|
||||
|
||||
(1..)
|
||||
.find(|_| advance(&mut grid, &mut todo) == target)
|
||||
.unwrap()
|
||||
.to_string()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
use crate::test_implementation;
|
||||
|
||||
const SAMPLE: &[u8] = include_bytes!("samples/11.txt");
|
||||
|
||||
#[test]
|
||||
fn sample_part1() {
|
||||
test_implementation(part1, SAMPLE, 1656);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sample_part2() {
|
||||
test_implementation(part2, SAMPLE, 195);
|
||||
}
|
||||
}
|
||||
102
2021/src/day12.rs
Normal file
102
2021/src/day12.rs
Normal file
@@ -0,0 +1,102 @@
|
||||
use std::collections::HashMap;
|
||||
use std::io::Read;
|
||||
|
||||
use crate::common::LineIter;
|
||||
|
||||
type EdgeMap = HashMap<String, Vec<String>>;
|
||||
|
||||
fn read_edges(input: &mut dyn Read) -> EdgeMap {
|
||||
let mut reader = LineIter::new(input);
|
||||
let mut edges = EdgeMap::new();
|
||||
|
||||
while let Some(line) = reader.next() {
|
||||
let (from, to) = line.split_once('-').unwrap();
|
||||
|
||||
edges
|
||||
.entry(from.to_owned())
|
||||
.or_default()
|
||||
.push(to.to_owned());
|
||||
|
||||
edges
|
||||
.entry(to.to_owned())
|
||||
.or_default()
|
||||
.push(from.to_owned());
|
||||
}
|
||||
|
||||
edges
|
||||
}
|
||||
|
||||
fn is_small(cave: &str) -> bool {
|
||||
cave.chars().all(|c| c.is_ascii_lowercase())
|
||||
}
|
||||
|
||||
fn dfs_routes<'a>(
|
||||
edges: &'a EdgeMap,
|
||||
route: &'_ mut Vec<&'a str>,
|
||||
pos: &'a str,
|
||||
mut small_twice: bool,
|
||||
) -> usize {
|
||||
match pos {
|
||||
"end" => return 1,
|
||||
"start" if !route.is_empty() => return 0,
|
||||
pos if is_small(pos) && route.contains(&pos) => {
|
||||
if small_twice {
|
||||
small_twice = false;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
|
||||
route.push(pos);
|
||||
|
||||
let routes = edges[pos]
|
||||
.iter()
|
||||
.map(|new_pos| dfs_routes(edges, route, new_pos, small_twice))
|
||||
.sum();
|
||||
|
||||
route.pop();
|
||||
|
||||
routes
|
||||
}
|
||||
|
||||
fn parts_common(input: &mut dyn Read, small_twice: bool) -> String {
|
||||
let edges = read_edges(input);
|
||||
let mut route = Vec::new();
|
||||
|
||||
dfs_routes(&edges, &mut route, "start", small_twice).to_string()
|
||||
}
|
||||
|
||||
pub fn part1(input: &mut dyn Read) -> String {
|
||||
parts_common(input, false)
|
||||
}
|
||||
|
||||
pub fn part2(input: &mut dyn Read) -> String {
|
||||
parts_common(input, true)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
use crate::test_implementation;
|
||||
|
||||
const SAMPLE1: &[u8] = include_bytes!("samples/12.1.txt");
|
||||
const SAMPLE2: &[u8] = include_bytes!("samples/12.2.txt");
|
||||
const SAMPLE3: &[u8] = include_bytes!("samples/12.3.txt");
|
||||
|
||||
#[test]
|
||||
fn sample_part1() {
|
||||
test_implementation(part1, SAMPLE1, 10);
|
||||
test_implementation(part1, SAMPLE2, 19);
|
||||
test_implementation(part1, SAMPLE3, 226);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sample_part2() {
|
||||
test_implementation(part2, SAMPLE1, 36);
|
||||
test_implementation(part2, SAMPLE2, 103);
|
||||
test_implementation(part2, SAMPLE3, 3509);
|
||||
}
|
||||
}
|
||||
116
2021/src/day13.rs
Normal file
116
2021/src/day13.rs
Normal file
@@ -0,0 +1,116 @@
|
||||
use std::io::Read;
|
||||
|
||||
use itertools::Itertools;
|
||||
use nom::branch::alt;
|
||||
use nom::bytes::complete::tag;
|
||||
use nom::combinator::map;
|
||||
use nom::multi::many0;
|
||||
use nom::sequence::preceded;
|
||||
use nom::sequence::separated_pair;
|
||||
use nom::sequence::terminated;
|
||||
use nom::IResult;
|
||||
|
||||
use crate::common::read_input;
|
||||
|
||||
type Coords = (u16, u16);
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
enum Fold {
|
||||
X(u16),
|
||||
Y(u16),
|
||||
}
|
||||
|
||||
fn parse_input(input: &[u8]) -> IResult<&[u8], (Vec<Coords>, Vec<Fold>)> {
|
||||
use nom::character::complete::char;
|
||||
|
||||
let parse_coordinates = many0(terminated(parse_coordinate, char('\n')));
|
||||
let parse_folds = many0(terminated(parse_fold, char('\n')));
|
||||
|
||||
separated_pair(parse_coordinates, char('\n'), parse_folds)(input)
|
||||
}
|
||||
|
||||
fn parse_coordinate(input: &[u8]) -> IResult<&[u8], Coords> {
|
||||
use nom::character::complete::char;
|
||||
use nom::character::complete::u16;
|
||||
|
||||
separated_pair(u16, char(','), u16)(input)
|
||||
}
|
||||
|
||||
fn parse_fold(input: &[u8]) -> IResult<&[u8], Fold> {
|
||||
use nom::character::complete::u16;
|
||||
|
||||
preceded(
|
||||
tag("fold along "),
|
||||
alt((
|
||||
preceded(tag("x="), map(u16, Fold::X)),
|
||||
preceded(tag("y="), map(u16, Fold::Y)),
|
||||
)),
|
||||
)(input)
|
||||
}
|
||||
|
||||
fn apply_fold(dots: &mut Vec<Coords>, fold: Fold) {
|
||||
match fold {
|
||||
Fold::X(coord) => dots.iter_mut().for_each(|(x, _)| {
|
||||
if *x >= coord {
|
||||
*x = 2 * coord - *x;
|
||||
}
|
||||
}),
|
||||
Fold::Y(coord) => dots.iter_mut().for_each(|(_, y)| {
|
||||
if *y >= coord {
|
||||
*y = 2 * coord - *y;
|
||||
}
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
fn print_dots(dots: &[Coords]) -> String {
|
||||
let (width, height) = dots.iter().fold((0, 0), |(xc, yc), &(xn, yn)| {
|
||||
(xc.max(xn as usize + 1), yc.max(yn as usize + 1))
|
||||
});
|
||||
|
||||
let mut buffer = vec![b' '; (width + 1) * height - 1];
|
||||
|
||||
for &(x, y) in dots {
|
||||
buffer[x as usize + (width + 1) * y as usize] = b'#';
|
||||
}
|
||||
|
||||
for line in buffer.chunks_exact_mut(width + 1) {
|
||||
line[width] = b'\n';
|
||||
}
|
||||
|
||||
String::from_utf8(buffer).unwrap()
|
||||
}
|
||||
|
||||
pub fn part1(input: &mut dyn Read) -> String {
|
||||
let (mut dots, folds) = read_input(input, parse_input);
|
||||
|
||||
apply_fold(&mut dots, folds[0]);
|
||||
|
||||
dots.sort_unstable();
|
||||
|
||||
dots.into_iter().unique().count().to_string()
|
||||
}
|
||||
|
||||
pub fn part2(input: &mut dyn Read) -> String {
|
||||
let (mut dots, folds) = read_input(input, parse_input);
|
||||
|
||||
folds
|
||||
.into_iter()
|
||||
.for_each(|fold| apply_fold(&mut dots, fold));
|
||||
|
||||
print_dots(&dots)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
use crate::test_implementation;
|
||||
|
||||
const SAMPLE: &[u8] = include_bytes!("samples/13.txt");
|
||||
|
||||
#[test]
|
||||
fn sample_part() {
|
||||
test_implementation(part1, SAMPLE, 17);
|
||||
}
|
||||
}
|
||||
123
2021/src/day14.rs
Normal file
123
2021/src/day14.rs
Normal file
@@ -0,0 +1,123 @@
|
||||
use std::io::Read;
|
||||
|
||||
use itertools::Itertools;
|
||||
use nom::bytes::complete::tag;
|
||||
use nom::bytes::complete::take_while;
|
||||
use nom::character::is_alphabetic;
|
||||
use nom::multi::many0;
|
||||
use nom::sequence::preceded;
|
||||
use nom::sequence::terminated;
|
||||
use nom::sequence::tuple;
|
||||
use nom::Finish;
|
||||
use nom::IResult;
|
||||
|
||||
type Rule = (u8, u8, u8);
|
||||
|
||||
type Pairs = [[u64; 26]; 26];
|
||||
type Rules = [[u8; 26]; 26];
|
||||
|
||||
fn parse_input(input: &[u8]) -> IResult<&[u8], (&[u8], Vec<Rule>)> {
|
||||
use nom::character::complete::char;
|
||||
use nom::number::complete::u8;
|
||||
|
||||
let parse_start = take_while(is_alphabetic);
|
||||
let parse_rule = tuple((u8, u8, preceded(tag(" -> "), u8)));
|
||||
|
||||
tuple((
|
||||
parse_start,
|
||||
preceded(tag("\n\n"), many0(terminated(parse_rule, char('\n')))),
|
||||
))(input)
|
||||
}
|
||||
|
||||
fn read_input(input: &mut dyn Read) -> (u8, u8, Pairs, Rules) {
|
||||
let mut buffer = Vec::new();
|
||||
input.read_to_end(&mut buffer).unwrap();
|
||||
|
||||
let (initial, rules) = parse_input(&buffer).finish().unwrap().1;
|
||||
|
||||
let mut pairs = Pairs::default();
|
||||
|
||||
for window in initial.windows(2) {
|
||||
pairs[(window[0] - b'A') as usize][(window[1] - b'A') as usize] += 1;
|
||||
}
|
||||
|
||||
let mut rule_map = Rules::default();
|
||||
for (first, second, product) in rules {
|
||||
rule_map[(first - b'A') as usize][(second - b'A') as usize] = product - b'A';
|
||||
}
|
||||
|
||||
(
|
||||
initial[0] - b'A',
|
||||
initial[initial.len() - 1] - b'A',
|
||||
pairs,
|
||||
rule_map,
|
||||
)
|
||||
}
|
||||
|
||||
fn update(pairs: Pairs, rules: &Rules) -> Pairs {
|
||||
let mut new_pairs = Pairs::default();
|
||||
|
||||
pairs.iter().enumerate().for_each(|(first, row)| {
|
||||
row.iter().enumerate().for_each(|(second, &count)| {
|
||||
let product = rules[first][second] as usize;
|
||||
new_pairs[first][product] += count;
|
||||
new_pairs[product][second] += count;
|
||||
})
|
||||
});
|
||||
|
||||
new_pairs
|
||||
}
|
||||
|
||||
fn parts_common(input: &mut dyn Read, rounds: usize) -> String {
|
||||
let (first, last, mut pairs, rules) = read_input(input);
|
||||
|
||||
(0..rounds).for_each(|_| pairs = update(pairs, &rules));
|
||||
|
||||
let mut pair_counts = [0; 26];
|
||||
pairs.iter().enumerate().for_each(|(first, row)| {
|
||||
row.iter().enumerate().for_each(|(second, &count)| {
|
||||
pair_counts[first] += count;
|
||||
pair_counts[second] += count;
|
||||
})
|
||||
});
|
||||
|
||||
pair_counts[first as usize] += 1;
|
||||
pair_counts[last as usize] += 1;
|
||||
|
||||
// Now everything is counted twice, so first half everything
|
||||
let counts = pair_counts.map(|pair_count| pair_count / 2);
|
||||
|
||||
match counts.into_iter().filter(|&c| c != 0).minmax() {
|
||||
itertools::MinMaxResult::NoElements => unreachable!(),
|
||||
itertools::MinMaxResult::OneElement(_) => 0,
|
||||
itertools::MinMaxResult::MinMax(min, max) => max - min,
|
||||
}
|
||||
.to_string()
|
||||
}
|
||||
|
||||
pub fn part1(input: &mut dyn Read) -> String {
|
||||
parts_common(input, 10)
|
||||
}
|
||||
|
||||
pub fn part2(input: &mut dyn Read) -> String {
|
||||
parts_common(input, 40)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
use crate::test_implementation;
|
||||
|
||||
const SAMPLE: &[u8] = include_bytes!("samples/14.txt");
|
||||
|
||||
#[test]
|
||||
fn sample_part1() {
|
||||
test_implementation(part1, SAMPLE, 1588);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sample_part2() {
|
||||
test_implementation(part2, SAMPLE, 2188189693529u64);
|
||||
}
|
||||
}
|
||||
157
2021/src/day15.rs
Normal file
157
2021/src/day15.rs
Normal file
@@ -0,0 +1,157 @@
|
||||
use std::cmp::Reverse;
|
||||
use std::collections::BinaryHeap;
|
||||
use std::io::Read;
|
||||
|
||||
use crate::common::LineIter;
|
||||
|
||||
type Point = (i32, i32);
|
||||
|
||||
struct Map {
|
||||
width: usize,
|
||||
data: Vec<u8>,
|
||||
}
|
||||
|
||||
impl Map {
|
||||
pub fn from_input(input: &mut dyn Read) -> Self {
|
||||
let mut reader = LineIter::new(input);
|
||||
|
||||
let mut data = reader.next().unwrap().as_bytes().to_owned();
|
||||
let width = data.len();
|
||||
|
||||
while let Some(line) = reader.next() {
|
||||
let line = line.as_bytes();
|
||||
debug_assert_eq!(line.len(), width);
|
||||
|
||||
data.extend_from_slice(line);
|
||||
}
|
||||
|
||||
data.iter_mut().for_each(|b| *b -= b'0');
|
||||
|
||||
Self { width, data }
|
||||
}
|
||||
|
||||
pub fn from_input2(input: &mut dyn Read) -> Self {
|
||||
let mut reader = LineIter::new(input);
|
||||
|
||||
let mut lines = Vec::new();
|
||||
|
||||
while let Some(line) = reader.next() {
|
||||
let mut line = line.as_bytes().to_owned();
|
||||
line.iter_mut().for_each(|b| *b -= b'0');
|
||||
lines.push(line);
|
||||
}
|
||||
|
||||
let mut data = Vec::new();
|
||||
let width = lines[0].len();
|
||||
|
||||
for _y_repeat in 0..5 {
|
||||
for line in &mut lines {
|
||||
data.extend_from_slice(line);
|
||||
|
||||
for _ in 0..4 {
|
||||
let starting_pos = data.len() - width;
|
||||
data.extend_from_within(starting_pos..);
|
||||
let starting_pos = data.len() - width;
|
||||
data[starting_pos..]
|
||||
.iter_mut()
|
||||
.for_each(|b| *b = (*b % 9) + 1);
|
||||
}
|
||||
|
||||
line.iter_mut().for_each(|b| *b = (*b % 9) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
Self {
|
||||
width: width * 5,
|
||||
data,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn shortest_path(&self, start: Point, end: Point) -> u32 {
|
||||
let mut todo = BinaryHeap::new();
|
||||
todo.push(Reverse((0, start)));
|
||||
|
||||
let mut best = vec![u32::MAX; self.data.len()];
|
||||
|
||||
let height = self.height() as i32;
|
||||
|
||||
while let Some(Reverse((distance, pos))) = todo.pop() {
|
||||
if pos == end {
|
||||
return distance;
|
||||
}
|
||||
|
||||
if best[self.index(pos)] < distance {
|
||||
continue;
|
||||
}
|
||||
|
||||
let (x, y) = pos;
|
||||
|
||||
for dy in -1..=1 {
|
||||
if y + dy < 0 || y + dy >= height {
|
||||
continue;
|
||||
}
|
||||
|
||||
for dx in -1..=1 {
|
||||
if x + dx < 0 || (x + dx) >= self.width as i32 || dx * dy != 0 {
|
||||
continue;
|
||||
}
|
||||
|
||||
let new = (x + dx, y + dy);
|
||||
let index = self.index(new);
|
||||
let new_distance = distance + self.data[index] as u32;
|
||||
|
||||
if best[index] <= new_distance {
|
||||
continue;
|
||||
}
|
||||
|
||||
best[index] = new_distance;
|
||||
|
||||
todo.push(Reverse((new_distance, new)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
panic!("No route found from {:?} to {:?}", start, end);
|
||||
}
|
||||
|
||||
pub fn height(&self) -> usize {
|
||||
self.data.len() / self.width
|
||||
}
|
||||
|
||||
pub fn index(&self, (x, y): Point) -> usize {
|
||||
y as usize * self.width + x as usize
|
||||
}
|
||||
}
|
||||
|
||||
pub fn part1(input: &mut dyn Read) -> String {
|
||||
let map = Map::from_input(input);
|
||||
|
||||
map.shortest_path((0, 0), (map.width as i32 - 1, map.height() as i32 - 1))
|
||||
.to_string()
|
||||
}
|
||||
|
||||
pub fn part2(input: &mut dyn Read) -> String {
|
||||
let map = Map::from_input2(input);
|
||||
|
||||
map.shortest_path((0, 0), (map.width as i32 - 1, map.height() as i32 - 1))
|
||||
.to_string()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
use crate::test_implementation;
|
||||
|
||||
const SAMPLE: &[u8] = include_bytes!("samples/15.txt");
|
||||
|
||||
#[test]
|
||||
fn sample_part1() {
|
||||
test_implementation(part1, SAMPLE, 40);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sample_part2() {
|
||||
test_implementation(part2, SAMPLE, 315);
|
||||
}
|
||||
}
|
||||
220
2021/src/day16.rs
Normal file
220
2021/src/day16.rs
Normal file
@@ -0,0 +1,220 @@
|
||||
use std::io::Read;
|
||||
|
||||
use nom::bits::complete::tag;
|
||||
use nom::bits::complete::take;
|
||||
use nom::branch::alt;
|
||||
use nom::combinator::map;
|
||||
use nom::multi::count;
|
||||
use nom::sequence::preceded;
|
||||
use nom::sequence::tuple;
|
||||
use nom::IResult;
|
||||
|
||||
type Input<'a> = (&'a [u8], usize);
|
||||
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
enum Contents {
|
||||
Literal(u64),
|
||||
Operator(u8, Vec<Packet>),
|
||||
}
|
||||
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
struct Packet {
|
||||
version: u8,
|
||||
contents: Contents,
|
||||
}
|
||||
|
||||
fn capacity(input: Input) -> usize {
|
||||
8 * input.0.len() - input.1 as usize
|
||||
}
|
||||
|
||||
impl Packet {
|
||||
pub fn version_sum(&self) -> u32 {
|
||||
match &self.contents {
|
||||
Contents::Literal(_) => self.version as u32,
|
||||
Contents::Operator(_, sub_packets) => {
|
||||
self.version as u32 + sub_packets.iter().map(Packet::version_sum).sum::<u32>()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn value(&self) -> u64 {
|
||||
match &self.contents {
|
||||
Contents::Literal(val) => *val,
|
||||
Contents::Operator(0, sub_packets) => sub_packets.iter().map(Packet::value).sum(),
|
||||
Contents::Operator(1, sub_packets) => sub_packets.iter().map(Packet::value).product(),
|
||||
Contents::Operator(2, sub_packets) => {
|
||||
sub_packets.iter().map(Packet::value).min().unwrap()
|
||||
}
|
||||
Contents::Operator(3, sub_packets) => {
|
||||
sub_packets.iter().map(Packet::value).max().unwrap()
|
||||
}
|
||||
Contents::Operator(5, sub_packets) => {
|
||||
(sub_packets[0].value() > sub_packets[1].value()) as u64
|
||||
}
|
||||
Contents::Operator(6, sub_packets) => {
|
||||
(sub_packets[0].value() < sub_packets[1].value()) as u64
|
||||
}
|
||||
Contents::Operator(7, sub_packets) => {
|
||||
(sub_packets[0].value() == sub_packets[1].value()) as u64
|
||||
}
|
||||
unknown => panic!("unknown packet {:?}", unknown),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_literal(mut input: Input) -> IResult<Input, Contents> {
|
||||
let mut val = 0;
|
||||
|
||||
loop {
|
||||
let (new_input, result) = take::<_, u8, usize, _>(5)(input)?;
|
||||
input = new_input;
|
||||
|
||||
val = (val << 4) | (result as u64 & 0xF);
|
||||
|
||||
if (result & 0x10) == 0 {
|
||||
return Ok((input, Contents::Literal(val)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_operator_len(input: Input) -> IResult<Input, Vec<Packet>> {
|
||||
const SIZE_LEN: usize = 15;
|
||||
|
||||
let (mut input, to_read) = take(SIZE_LEN)(input)?;
|
||||
|
||||
let mut packets = Vec::new();
|
||||
|
||||
let initial = capacity(input);
|
||||
|
||||
while initial - capacity(input) < to_read {
|
||||
let (new_input, packet) = parse_packet(input)?;
|
||||
input = new_input;
|
||||
packets.push(packet);
|
||||
}
|
||||
|
||||
Ok((input, packets))
|
||||
}
|
||||
|
||||
fn parse_operator_count(input: Input) -> IResult<Input, Vec<Packet>> {
|
||||
const SIZE_LEN: usize = 11;
|
||||
|
||||
let (input, to_read) = take(SIZE_LEN)(input)?;
|
||||
|
||||
count(parse_packet, to_read)(input)
|
||||
}
|
||||
|
||||
fn parse_packet(input: Input) -> IResult<Input, Packet> {
|
||||
let parse_literal_packet = preceded(tag(4u8, 3usize), parse_literal);
|
||||
|
||||
let parse_operator_packet = map(
|
||||
tuple((
|
||||
take(3usize),
|
||||
alt((
|
||||
preceded(tag(0u8, 1usize), parse_operator_len),
|
||||
preceded(tag(1u8, 1usize), parse_operator_count),
|
||||
)),
|
||||
)),
|
||||
|(operator, contents)| Contents::Operator(operator, contents),
|
||||
);
|
||||
|
||||
map(
|
||||
tuple((
|
||||
take(3usize),
|
||||
alt((parse_literal_packet, parse_operator_packet)),
|
||||
)),
|
||||
|(version, contents)| Packet { version, contents },
|
||||
)(input)
|
||||
}
|
||||
|
||||
fn convert_hex(hex: &[u8]) -> Vec<u8> {
|
||||
fn val(c: u8) -> u8 {
|
||||
match c {
|
||||
b'A'..=b'F' => c - b'A' + 10,
|
||||
b'0'..=b'9' => c - b'0',
|
||||
_ => panic!("Invalid hex digit {}", c),
|
||||
}
|
||||
}
|
||||
|
||||
let mut binary = Vec::with_capacity(hex.len() / 2);
|
||||
|
||||
binary.extend(
|
||||
hex.chunks_exact(2)
|
||||
.map(|chunk| (val(chunk[0]) << 4) | val(chunk[1])),
|
||||
);
|
||||
|
||||
binary
|
||||
}
|
||||
|
||||
pub fn part1(input: &mut dyn Read) -> String {
|
||||
let mut buffer = Vec::new();
|
||||
input.read_to_end(&mut buffer).unwrap();
|
||||
|
||||
let binary_data = convert_hex(&buffer);
|
||||
let (_, packet) = parse_packet((&binary_data, 0)).unwrap();
|
||||
|
||||
packet.version_sum().to_string()
|
||||
}
|
||||
|
||||
pub fn part2(input: &mut dyn Read) -> String {
|
||||
let mut buffer = Vec::new();
|
||||
input.read_to_end(&mut buffer).unwrap();
|
||||
|
||||
let binary_data = convert_hex(&buffer);
|
||||
let (_, packet) = parse_packet((&binary_data, 0)).unwrap();
|
||||
|
||||
packet.value().to_string()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::test_implementation;
|
||||
|
||||
use super::*;
|
||||
|
||||
const SAMPLE: &[&[u8]] = &[
|
||||
&*b"8A004A801A8002F478",
|
||||
&*b"620080001611562C8802118E34",
|
||||
&*b"C0015000016115A2E0802F182340",
|
||||
&*b"A0016C880162017C3686B18A3D4780",
|
||||
];
|
||||
|
||||
#[test]
|
||||
fn sample_part1() {
|
||||
let answers = [16, 12, 23, 31];
|
||||
|
||||
for (&sample, answer) in SAMPLE.into_iter().zip(answers) {
|
||||
test_implementation(part1, sample, answer);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_parse_literal() {
|
||||
let (_, packet) = parse_packet((&convert_hex(b"D2FE28"), 0)).unwrap();
|
||||
|
||||
assert_eq!(
|
||||
packet,
|
||||
Packet {
|
||||
version: 6,
|
||||
contents: Contents::Literal(2021)
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_parse_operator_len() {
|
||||
let (_, packet) = parse_packet((&convert_hex(b"38006F45291200"), 0)).unwrap();
|
||||
|
||||
assert_eq!(packet.version, 1);
|
||||
|
||||
assert!(matches!(packet.contents, Contents::Operator(6, _)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_parse_operator_count() {
|
||||
let (_, packet) = parse_packet((&convert_hex(b"EE00D40C823060"), 0)).unwrap();
|
||||
|
||||
assert_eq!(packet.version, 7);
|
||||
|
||||
assert!(matches!(packet.contents, Contents::Operator(3, _)));
|
||||
}
|
||||
}
|
||||
150
2021/src/day17.rs
Normal file
150
2021/src/day17.rs
Normal file
@@ -0,0 +1,150 @@
|
||||
use std::io::Read;
|
||||
use std::ops::RangeInclusive;
|
||||
|
||||
use nom::bytes::complete::tag;
|
||||
use nom::combinator::map;
|
||||
use nom::sequence::preceded;
|
||||
use nom::sequence::separated_pair;
|
||||
use nom::IResult;
|
||||
|
||||
use crate::common::read_input;
|
||||
|
||||
#[inline]
|
||||
fn solve_quadratic(a: f64, b: f64, c: f64) -> Option<f64> {
|
||||
let d = b * b - 4. * a * c;
|
||||
|
||||
if d < 0. {
|
||||
None
|
||||
} else {
|
||||
// Don't care about the smaller solution due to problem statement
|
||||
if a > 0. {
|
||||
Some((-b + d.sqrt()) / 2. / a)
|
||||
} else {
|
||||
Some((-b - d.sqrt()) / 2. / a)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn position(initial: i32, time: i32) -> i32 {
|
||||
time * (2 * initial - time + 1) / 2
|
||||
}
|
||||
|
||||
fn find_hit(initial: i32, range: &RangeInclusive<i32>) -> impl Iterator<Item = i32> + '_ {
|
||||
// y position at time x: f(x) = x * (1 + initial + initial - x) / 2
|
||||
// = -1/2x^2 + (initial + 0.5)x
|
||||
//
|
||||
// to hit, find x := (max(box) + min(box)) / 2 = f(x)
|
||||
// = -1/2x^2 + (initial + 0.5)x
|
||||
// -1/2x^2 + (initial + 0.5)x - (max(box) + min(box)) / 2 = 0
|
||||
let middle = *range.start() as f64;
|
||||
let b = initial as f64 + 0.5;
|
||||
let hit = if let Some(hit) = solve_quadratic(-0.5, b, -middle) {
|
||||
hit as i32
|
||||
} else {
|
||||
// Cause an empty range
|
||||
-1
|
||||
};
|
||||
|
||||
(0..=hit)
|
||||
.rev()
|
||||
.take_while(move |&n| range.contains(&position(initial, n)))
|
||||
}
|
||||
|
||||
fn find_speed(x: i32, range: &RangeInclusive<i32>) -> Option<(i32, i32)> {
|
||||
if *range.end() <= position(x, x) {
|
||||
// Can and should come to a full stop
|
||||
let max = solve_quadratic(0.5, 0.5, -*range.end() as f64)? as i32;
|
||||
|
||||
let min = (0..=max)
|
||||
.rev()
|
||||
.take_while(|&n| range.contains(&position(n, n)))
|
||||
.last()?;
|
||||
|
||||
Some((min, max))
|
||||
} else {
|
||||
// Might hit the target at speed
|
||||
let max = (x * x + 2 * *range.end() - x) / (2 * x);
|
||||
|
||||
let min = (0..=max)
|
||||
.rev()
|
||||
.take_while(|&n| range.contains(&position(n, n.min(x))))
|
||||
.last()?;
|
||||
|
||||
Some((min, max))
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_range(input: &[u8]) -> IResult<&[u8], RangeInclusive<i32>> {
|
||||
use nom::character::complete::i32;
|
||||
|
||||
map(separated_pair(i32, tag(".."), i32), |(start, end)| {
|
||||
start..=end
|
||||
})(input)
|
||||
}
|
||||
|
||||
fn parse_input(input: &[u8]) -> IResult<&[u8], (RangeInclusive<i32>, RangeInclusive<i32>)> {
|
||||
preceded(
|
||||
tag("target area: x="),
|
||||
separated_pair(parse_range, tag(", y="), parse_range),
|
||||
)(input)
|
||||
}
|
||||
|
||||
pub fn part1(input: &mut dyn Read) -> String {
|
||||
let (x_range, y_range) = read_input(input, parse_input);
|
||||
|
||||
let check_value =
|
||||
|y_speed| find_hit(y_speed, &y_range).any(|time| find_speed(time, &x_range).is_some());
|
||||
|
||||
debug_assert!(*y_range.start() < 0);
|
||||
let y_max = -*y_range.start();
|
||||
|
||||
(0..y_max)
|
||||
.rev()
|
||||
.find(|&speed| check_value(speed))
|
||||
.map(|speed| position(speed, speed))
|
||||
.unwrap()
|
||||
.to_string()
|
||||
}
|
||||
|
||||
pub fn part2(input: &mut dyn Read) -> String {
|
||||
let (x_range, y_range) = read_input(input, parse_input);
|
||||
|
||||
let num_options = |y_speed| {
|
||||
find_hit(y_speed, &y_range)
|
||||
.filter_map(|time| find_speed(time, &x_range))
|
||||
.reduce(|(a_min, a_max), (b_min, b_max)| (a_min.min(b_min), a_max.max(b_max)))
|
||||
.map(|(min, max)| max - min + 1)
|
||||
.unwrap_or(0)
|
||||
};
|
||||
|
||||
debug_assert!(*y_range.start() < 0);
|
||||
let y_max = -*y_range.start();
|
||||
|
||||
(-y_max..y_max).map(num_options).sum::<i32>().to_string()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::test_implementation;
|
||||
|
||||
use super::*;
|
||||
|
||||
const SAMPLE: &[u8] = &*b"target area: x=20..30, y=-10..-5";
|
||||
|
||||
#[test]
|
||||
fn test_find_hit() {
|
||||
assert_eq!(find_hit(2, &(-10..=-5)).collect::<Vec<_>>(), vec![7]);
|
||||
assert_eq!(find_hit(3, &(-10..=-5)).collect::<Vec<_>>(), vec![9]);
|
||||
assert_eq!(find_hit(0, &(-10..=-5)).collect::<Vec<_>>(), vec![5, 4]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sample_part1() {
|
||||
test_implementation(part1, SAMPLE, 45);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sample_part2() {
|
||||
test_implementation(part2, SAMPLE, 112);
|
||||
}
|
||||
}
|
||||
245
2021/src/day18.rs
Normal file
245
2021/src/day18.rs
Normal file
@@ -0,0 +1,245 @@
|
||||
use std::fmt::Debug;
|
||||
use std::io::Read;
|
||||
use std::mem::replace;
|
||||
|
||||
use nom::branch::alt;
|
||||
use nom::character::complete::newline;
|
||||
use nom::combinator::map;
|
||||
use nom::multi::many0;
|
||||
use nom::sequence::delimited;
|
||||
use nom::sequence::separated_pair;
|
||||
use nom::sequence::terminated;
|
||||
use nom::IResult;
|
||||
|
||||
use crate::common::read_input;
|
||||
|
||||
#[derive(Clone, Eq, PartialEq)]
|
||||
enum TurtleNumber {
|
||||
Literal(u8),
|
||||
Pair(Box<(TurtleNumber, TurtleNumber)>),
|
||||
}
|
||||
|
||||
impl TurtleNumber {
|
||||
pub fn add(self, other: Self) -> Self {
|
||||
let mut new = TurtleNumber::Pair(Box::new((self, other)));
|
||||
new.reduce();
|
||||
|
||||
new
|
||||
}
|
||||
|
||||
pub fn magnitude(&self) -> u32 {
|
||||
match self {
|
||||
TurtleNumber::Literal(num) => *num as u32,
|
||||
TurtleNumber::Pair(pair) => 3 * pair.0.magnitude() + 2 * pair.1.magnitude(),
|
||||
}
|
||||
}
|
||||
|
||||
fn reduce(&mut self) {
|
||||
loop {
|
||||
while self.try_explode(0).is_some() {}
|
||||
|
||||
if self.split() {
|
||||
continue;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn leftmost_add(&mut self, value: u8) {
|
||||
match self {
|
||||
TurtleNumber::Literal(num) => *num += value,
|
||||
TurtleNumber::Pair(pair) => pair.0.leftmost_add(value),
|
||||
}
|
||||
}
|
||||
|
||||
fn rightmost_add(&mut self, value: u8) {
|
||||
match self {
|
||||
TurtleNumber::Literal(num) => *num += value,
|
||||
TurtleNumber::Pair(pair) => pair.1.rightmost_add(value),
|
||||
}
|
||||
}
|
||||
|
||||
fn try_explode(&mut self, depth: usize) -> Option<(Option<u8>, Option<u8>)> {
|
||||
let pair = match self {
|
||||
TurtleNumber::Literal(_) => return None,
|
||||
TurtleNumber::Pair(pair) => pair,
|
||||
};
|
||||
|
||||
if depth == 4 {
|
||||
let original = replace(self, TurtleNumber::Literal(0));
|
||||
let pair = match original {
|
||||
TurtleNumber::Pair(pair) => *pair,
|
||||
_ => unreachable!("Already checked for pair above"),
|
||||
};
|
||||
|
||||
if let (TurtleNumber::Literal(first), TurtleNumber::Literal(second)) = pair {
|
||||
Some((Some(first), Some(second)))
|
||||
} else {
|
||||
panic!("Too deeply nested turtle number: {:?}", pair);
|
||||
}
|
||||
} else {
|
||||
match pair.0.try_explode(depth + 1) {
|
||||
Some((left, Some(right))) => {
|
||||
pair.1.leftmost_add(right);
|
||||
Some((left, None))
|
||||
}
|
||||
Some((left, None)) => Some((left, None)),
|
||||
None => match pair.1.try_explode(depth + 1) {
|
||||
Some((Some(left), right)) => {
|
||||
pair.0.rightmost_add(left);
|
||||
Some((None, right))
|
||||
}
|
||||
other => other,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn split(&mut self) -> bool {
|
||||
match self {
|
||||
TurtleNumber::Literal(num) if *num >= 10 => {
|
||||
let half = *num / 2;
|
||||
let other = *num - half;
|
||||
*self = TurtleNumber::from((half, other));
|
||||
true
|
||||
}
|
||||
TurtleNumber::Pair(pair) => pair.0.split() || pair.1.split(),
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Debug for TurtleNumber {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
Self::Literal(num) => write!(f, "{}", num),
|
||||
Self::Pair(pair) => write!(f, "[{:?},{:?}]", pair.0, pair.1),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Helper traits to easily convert tuples to turtle numbers
|
||||
impl From<u8> for TurtleNumber {
|
||||
fn from(num: u8) -> Self {
|
||||
TurtleNumber::Literal(num)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, U> From<(T, U)> for TurtleNumber
|
||||
where
|
||||
T: Into<TurtleNumber>,
|
||||
U: Into<TurtleNumber>,
|
||||
{
|
||||
fn from((left, right): (T, U)) -> Self {
|
||||
TurtleNumber::Pair(Box::new((left.into(), right.into())))
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_turtle(input: &[u8]) -> IResult<&[u8], TurtleNumber> {
|
||||
use nom::character::complete::char;
|
||||
use nom::character::complete::u8;
|
||||
|
||||
alt((
|
||||
map(u8, TurtleNumber::Literal),
|
||||
map(
|
||||
delimited(
|
||||
char('['),
|
||||
separated_pair(parse_turtle, char(','), parse_turtle),
|
||||
char(']'),
|
||||
),
|
||||
|pair| TurtleNumber::Pair(Box::new(pair)),
|
||||
),
|
||||
))(input)
|
||||
}
|
||||
|
||||
fn parse_input(input: &[u8]) -> IResult<&[u8], Vec<TurtleNumber>> {
|
||||
many0(terminated(parse_turtle, newline))(input)
|
||||
}
|
||||
|
||||
pub fn part1(input: &mut dyn Read) -> String {
|
||||
let turtles = read_input(input, parse_input);
|
||||
turtles
|
||||
.into_iter()
|
||||
.reduce(|a, b| a.add(b))
|
||||
.map(|num| num.magnitude())
|
||||
.unwrap()
|
||||
.to_string()
|
||||
}
|
||||
|
||||
pub fn part2(input: &mut dyn Read) -> String {
|
||||
let turtles = read_input(input, parse_input);
|
||||
|
||||
turtles
|
||||
.iter()
|
||||
.flat_map(|a| turtles.iter().map(|b| a.clone().add(b.clone()).magnitude()))
|
||||
.max()
|
||||
.unwrap()
|
||||
.to_string()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::test_implementation;
|
||||
|
||||
use super::*;
|
||||
|
||||
const SAMPLE: &[u8] = include_bytes!("samples/18.txt");
|
||||
|
||||
#[test]
|
||||
fn test_magnitude() {
|
||||
let num: TurtleNumber = (
|
||||
(((8, 7), (7, 7)), ((8, 6), (7, 7))),
|
||||
(((0, 7), (6, 6)), (8, 7)),
|
||||
)
|
||||
.into();
|
||||
|
||||
assert_eq!(num.magnitude(), 3488);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_add() {
|
||||
let input = TurtleNumber::from(((((4, 3), 4), 4), (7, ((8, 4), 9))));
|
||||
let result = input.add((1, 1).into());
|
||||
|
||||
let expected = TurtleNumber::from(((((0, 7), 4), ((7, 8), (6, 0))), (8, 1)));
|
||||
assert_eq!(result, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_explode() {
|
||||
let mut input1 = TurtleNumber::from((((((9, 8), 1), 2), 3), 4));
|
||||
let output1 = TurtleNumber::from(((((0, 9), 2), 3), 4));
|
||||
|
||||
input1.reduce();
|
||||
assert_eq!(input1, output1);
|
||||
|
||||
let mut input2 = TurtleNumber::from((7, (6, (5, (4, (3, 2))))));
|
||||
let output2 = TurtleNumber::from((7, (6, (5, (7, 0)))));
|
||||
|
||||
input2.reduce();
|
||||
assert_eq!(input2, output2);
|
||||
|
||||
let mut input3: TurtleNumber = TurtleNumber::from(((6, (5, (4, (3, 2)))), 1));
|
||||
let output3 = TurtleNumber::from(((6, (5, (7, 0))), 3));
|
||||
|
||||
input3.reduce();
|
||||
assert_eq!(input3, output3);
|
||||
|
||||
let mut input4 = TurtleNumber::from(((3, (2, (1, (7, 3)))), (6, (5, (4, (3, 2))))));
|
||||
let output4 = TurtleNumber::from(((3, (2, (8, 0))), (9, (5, (7, 0)))));
|
||||
|
||||
input4.reduce();
|
||||
assert_eq!(input4, output4);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sample_part1() {
|
||||
test_implementation(part1, SAMPLE, 4140);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sample_part2() {
|
||||
test_implementation(part2, SAMPLE, 3993);
|
||||
}
|
||||
}
|
||||
290
2021/src/day19.rs
Normal file
290
2021/src/day19.rs
Normal file
@@ -0,0 +1,290 @@
|
||||
use std::collections::HashSet;
|
||||
use std::io::Read;
|
||||
use std::ops::Add;
|
||||
use std::ops::Sub;
|
||||
|
||||
use nom::bytes::complete::tag;
|
||||
use nom::character::complete::newline;
|
||||
use nom::combinator::map;
|
||||
use nom::multi::many1;
|
||||
use nom::multi::separated_list1;
|
||||
use nom::sequence::delimited;
|
||||
use nom::sequence::preceded;
|
||||
use nom::sequence::terminated;
|
||||
use nom::sequence::tuple;
|
||||
use nom::IResult;
|
||||
|
||||
use crate::common::read_input;
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Default)]
|
||||
struct Point3(pub [i32; 3]);
|
||||
|
||||
impl Point3 {
|
||||
pub fn manhattan(&self) -> i32 {
|
||||
self.0.into_iter().map(i32::abs).sum()
|
||||
}
|
||||
}
|
||||
|
||||
impl Sub for Point3 {
|
||||
type Output = Self;
|
||||
|
||||
fn sub(self, rhs: Self) -> Self::Output {
|
||||
Point3([
|
||||
self.0[0] - rhs.0[0],
|
||||
self.0[1] - rhs.0[1],
|
||||
self.0[2] - rhs.0[2],
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
impl Add for Point3 {
|
||||
type Output = Self;
|
||||
|
||||
fn add(self, rhs: Self) -> Self::Output {
|
||||
Point3([
|
||||
self.0[0] + rhs.0[0],
|
||||
self.0[1] + rhs.0[1],
|
||||
self.0[2] + rhs.0[2],
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
struct Rotations<'a> {
|
||||
points: &'a [Point3],
|
||||
axes: [usize; 3],
|
||||
rotation_index: usize,
|
||||
}
|
||||
|
||||
impl<'a> Rotations<'a> {
|
||||
const ROTATIONS: [[i32; 3]; 8] = [
|
||||
[1, 1, 1],
|
||||
[1, 1, -1],
|
||||
[1, -1, 1],
|
||||
[1, -1, -1],
|
||||
[-1, 1, 1],
|
||||
[-1, 1, -1],
|
||||
[-1, -1, 1],
|
||||
[-1, -1, -1],
|
||||
];
|
||||
|
||||
pub fn new(points: &'a [Point3]) -> Self {
|
||||
Self {
|
||||
points,
|
||||
axes: [0, 1, 2],
|
||||
rotation_index: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Iterator for Rotations<'_> {
|
||||
type Item = Vec<Point3>;
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
if self.rotation_index >= Self::ROTATIONS.len() {
|
||||
if !next_permutation(&mut self.axes) {
|
||||
return None;
|
||||
}
|
||||
|
||||
self.rotation_index = 0;
|
||||
}
|
||||
|
||||
let axes = &self.axes;
|
||||
let rot = &Self::ROTATIONS[self.rotation_index];
|
||||
|
||||
let result = self
|
||||
.points
|
||||
.iter()
|
||||
.map(|Point3(coords)| {
|
||||
Point3([
|
||||
coords[axes[0]] * rot[0],
|
||||
coords[axes[1]] * rot[1],
|
||||
coords[axes[2]] * rot[2],
|
||||
])
|
||||
})
|
||||
.collect();
|
||||
|
||||
self.rotation_index += 1;
|
||||
|
||||
Some(result)
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_point(input: &[u8]) -> IResult<&[u8], Point3> {
|
||||
use nom::character::complete::char;
|
||||
use nom::character::complete::i32;
|
||||
|
||||
map(
|
||||
tuple((i32, preceded(char(','), i32), preceded(char(','), i32))),
|
||||
|(x, y, z)| Point3([x, y, z]),
|
||||
)(input)
|
||||
}
|
||||
|
||||
fn parse_input(input: &[u8]) -> IResult<&[u8], Vec<Vec<Point3>>> {
|
||||
use nom::character::complete::i32;
|
||||
let parse_header = delimited(tag("--- scanner "), i32, tag(" ---\n"));
|
||||
|
||||
let parse_scanner = preceded(parse_header, many1(terminated(parse_point, newline)));
|
||||
separated_list1(newline, parse_scanner)(input)
|
||||
}
|
||||
|
||||
fn try_overlap(
|
||||
correct: &[(Point3, HashSet<Point3>)],
|
||||
candidate: &[Point3],
|
||||
) -> Option<(Point3, Vec<Point3>)> {
|
||||
let mut relative = HashSet::new();
|
||||
for rot in Rotations::new(candidate) {
|
||||
for &start in &rot {
|
||||
relative.clear();
|
||||
|
||||
relative.extend(rot.iter().map(|&other| other - start));
|
||||
|
||||
if let Some((base, _)) = correct.iter().find(|(_, correct_relative)| {
|
||||
correct_relative.intersection(&relative).count() >= 12
|
||||
}) {
|
||||
// Found a solution, build the correct output
|
||||
let translated = relative.drain().map(|point| point + *base).collect();
|
||||
|
||||
return Some((start - *base, translated));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
fn parts_common(input: &mut dyn Read) -> (HashSet<Point3>, Vec<Point3>) {
|
||||
let mut scanners = read_input(input, parse_input);
|
||||
|
||||
let mut points: HashSet<_> = scanners[0].iter().copied().collect();
|
||||
|
||||
let mut todo = vec![std::mem::take(&mut scanners[0])];
|
||||
let mut scanners_found = vec![Point3::default()];
|
||||
|
||||
while let Some(matched) = todo.pop() {
|
||||
if scanners.iter().all(Vec::is_empty) {
|
||||
break;
|
||||
}
|
||||
|
||||
let relative: Vec<(Point3, HashSet<Point3>)> = matched
|
||||
.iter()
|
||||
.map(|&base| (base, matched.iter().map(|&other| (other - base)).collect()))
|
||||
.collect();
|
||||
|
||||
for candidate in &mut scanners {
|
||||
if candidate.is_empty() {
|
||||
continue;
|
||||
}
|
||||
|
||||
if let Some((scanner, result)) = try_overlap(&relative, candidate) {
|
||||
scanners_found.push(scanner);
|
||||
points.extend(result.iter().copied());
|
||||
todo.push(result);
|
||||
candidate.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(points, scanners_found)
|
||||
}
|
||||
|
||||
pub fn part1(input: &mut dyn Read) -> String {
|
||||
let (points, _) = parts_common(input);
|
||||
points.len().to_string()
|
||||
}
|
||||
|
||||
pub fn part2(input: &mut dyn Read) -> String {
|
||||
let (_, scanners) = parts_common(input);
|
||||
|
||||
scanners
|
||||
.iter()
|
||||
.flat_map(|&first| {
|
||||
scanners
|
||||
.iter()
|
||||
.map(move |&second| (first - second).manhattan())
|
||||
})
|
||||
.max()
|
||||
.unwrap()
|
||||
.to_string()
|
||||
}
|
||||
|
||||
pub fn next_permutation<T: Ord>(list: &mut [T]) -> bool {
|
||||
// Based on: https://en.cppreference.com/w/cpp/algorithm/next_permutation
|
||||
if list.len() <= 1 {
|
||||
return false;
|
||||
}
|
||||
|
||||
if let Some((i, val1)) = list
|
||||
.windows(2)
|
||||
.enumerate()
|
||||
.rev()
|
||||
.find_map(|(i, window)| (window[0] < window[1]).then(|| (i, &window[0])))
|
||||
{
|
||||
let it2 = list
|
||||
.iter()
|
||||
.enumerate()
|
||||
.skip(i + 1)
|
||||
.rev()
|
||||
.find_map(|(idx, val2)| (val1 < val2).then(|| idx))
|
||||
.expect("Unreachable, ascending pair exists");
|
||||
|
||||
list.swap(i, it2);
|
||||
list[(i + 1)..].reverse();
|
||||
true
|
||||
} else {
|
||||
list.reverse();
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
use crate::test_implementation;
|
||||
|
||||
const SAMPLE: &[u8] = include_bytes!("samples/19.txt");
|
||||
|
||||
#[test]
|
||||
fn test_next_permutation() {
|
||||
let mut list = [1, 2, 3];
|
||||
|
||||
assert!(next_permutation(&mut list));
|
||||
assert_eq!(list, [1, 3, 2]);
|
||||
|
||||
assert!(next_permutation(&mut list));
|
||||
assert_eq!(list, [2, 1, 3]);
|
||||
|
||||
assert!(next_permutation(&mut list));
|
||||
assert_eq!(list, [2, 3, 1]);
|
||||
|
||||
assert!(next_permutation(&mut list));
|
||||
assert_eq!(list, [3, 1, 2]);
|
||||
|
||||
assert!(next_permutation(&mut list));
|
||||
assert_eq!(list, [3, 2, 1]);
|
||||
|
||||
// Note the negation!
|
||||
assert!(!next_permutation(&mut list));
|
||||
assert_eq!(list, [1, 2, 3]);
|
||||
|
||||
// 24 is a bit too much to write out, but we can check the number
|
||||
let mut list2 = [1, 2, 3, 4];
|
||||
for _ in 1..24 {
|
||||
assert!(next_permutation(&mut list2));
|
||||
}
|
||||
|
||||
// Should be back to the start
|
||||
assert!(!next_permutation(&mut list2));
|
||||
assert_eq!(list2, [1, 2, 3, 4]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sample_part1() {
|
||||
test_implementation(part1, SAMPLE, 79);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sample_part2() {
|
||||
test_implementation(part2, SAMPLE, 3621);
|
||||
}
|
||||
}
|
||||
113
2021/src/day20.rs
Normal file
113
2021/src/day20.rs
Normal file
@@ -0,0 +1,113 @@
|
||||
use std::collections::HashSet;
|
||||
use std::io::Read;
|
||||
use std::mem::swap;
|
||||
|
||||
type Translation = [bool; 512];
|
||||
type Point = (i32, i32);
|
||||
type Field = HashSet<Point>;
|
||||
|
||||
fn read_input(input: &mut dyn Read) -> (Translation, Field) {
|
||||
let mut buffer = Vec::new();
|
||||
input.read_to_end(&mut buffer).unwrap();
|
||||
|
||||
let mut translation = [false; 512];
|
||||
|
||||
let mut it = buffer.split(|&b| b == b'\n');
|
||||
|
||||
translation
|
||||
.iter_mut()
|
||||
.zip(it.next().unwrap())
|
||||
.for_each(|(t, &c)| *t = c == b'#');
|
||||
|
||||
let mut field = Field::default();
|
||||
|
||||
for (y, line) in it.skip(1).enumerate() {
|
||||
for (x, _) in line.iter().enumerate().filter(|(_, &c)| c == b'#') {
|
||||
field.insert((x as i32, y as i32));
|
||||
}
|
||||
}
|
||||
|
||||
(translation, field)
|
||||
}
|
||||
|
||||
fn find_dimensions(field: &Field) -> ((i32, i32), (i32, i32)) {
|
||||
field
|
||||
.iter()
|
||||
.fold(((0, 0), (0, 0)), |((xmin, xmax), (ymin, ymax)), &(x, y)| {
|
||||
((xmin.min(x), xmax.max(x)), (ymin.min(y), ymax.max(y)))
|
||||
})
|
||||
}
|
||||
|
||||
fn advance(translation: &Translation, field: &Field, new_field: &mut Field, infinity: &mut bool) {
|
||||
const INDEX_MASK: usize = (1 << 9) - 1;
|
||||
new_field.clear();
|
||||
|
||||
let ((xmin, xmax), (ymin, ymax)) = find_dimensions(field);
|
||||
|
||||
for x in (xmin - 1)..=(xmax + 1) {
|
||||
let mut index = if *infinity { INDEX_MASK } else { 0 };
|
||||
|
||||
for y in (ymin - 1)..=(ymax + 1) {
|
||||
for dx in -1..=1 {
|
||||
index <<= 1;
|
||||
|
||||
let nx = x + dx;
|
||||
let ny = y + 1;
|
||||
|
||||
if nx < xmin || nx > xmax || ny < ymin || ny > ymax {
|
||||
index |= *infinity as usize;
|
||||
} else if field.contains(&(nx, ny)) {
|
||||
index |= 1;
|
||||
}
|
||||
}
|
||||
|
||||
index &= INDEX_MASK;
|
||||
|
||||
if translation[index] {
|
||||
new_field.insert((x, y));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*infinity = translation[if *infinity { 511 } else { 0 }]
|
||||
}
|
||||
|
||||
fn parts_common(input: &mut dyn Read, count: usize) -> String {
|
||||
let (translation, mut field) = read_input(input);
|
||||
let mut new_field = Field::new();
|
||||
let mut infinity = false;
|
||||
|
||||
for _ in 0..count {
|
||||
advance(&translation, &field, &mut new_field, &mut infinity);
|
||||
swap(&mut field, &mut new_field);
|
||||
}
|
||||
|
||||
field.len().to_string()
|
||||
}
|
||||
|
||||
pub fn part1(input: &mut dyn Read) -> String {
|
||||
parts_common(input, 2)
|
||||
}
|
||||
|
||||
pub fn part2(input: &mut dyn Read) -> String {
|
||||
parts_common(input, 50)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::test_implementation;
|
||||
|
||||
use super::*;
|
||||
|
||||
const SAMPLE: &[u8] = include_bytes!("samples/20.txt");
|
||||
|
||||
#[test]
|
||||
fn sample_part1() {
|
||||
test_implementation(part1, SAMPLE, 35);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sample_part2() {
|
||||
test_implementation(part2, SAMPLE, 3351);
|
||||
}
|
||||
}
|
||||
171
2021/src/day21.rs
Normal file
171
2021/src/day21.rs
Normal file
@@ -0,0 +1,171 @@
|
||||
use std::io::Read;
|
||||
|
||||
use crate::common::LineIter;
|
||||
|
||||
fn read_input(input: &mut dyn Read) -> (i32, i32) {
|
||||
let mut reader = LineIter::new(input);
|
||||
|
||||
let mut helper = || {
|
||||
reader
|
||||
.next()
|
||||
.unwrap()
|
||||
.split(' ')
|
||||
.last()
|
||||
.unwrap()
|
||||
.parse()
|
||||
.unwrap()
|
||||
};
|
||||
|
||||
let a = helper();
|
||||
let b = helper();
|
||||
|
||||
(a, b)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn simulate(die: i32, pos: i32) -> i32 {
|
||||
(pos + 3 * die + 3 - 1) % 10 + 1
|
||||
}
|
||||
|
||||
fn find_repetition(mut pos: i32, mut die: i32) -> i32 {
|
||||
let mut advance = 0;
|
||||
|
||||
for _ in 0..10 {
|
||||
pos = simulate(die, pos);
|
||||
advance += pos;
|
||||
die = (die + 6) % 10;
|
||||
}
|
||||
|
||||
advance
|
||||
}
|
||||
|
||||
pub fn part1(input: &mut dyn Read) -> String {
|
||||
const TARGET_SCORE: i32 = 1000;
|
||||
|
||||
let (mut a, mut b) = read_input(input);
|
||||
|
||||
let a10 = find_repetition(a, 1);
|
||||
let b10 = find_repetition(b, 4);
|
||||
|
||||
let a_win = TARGET_SCORE / a10;
|
||||
let b_win = TARGET_SCORE / b10;
|
||||
|
||||
let win = a_win.min(b_win);
|
||||
let mut a_score = win * a10;
|
||||
let mut b_score = win * b10;
|
||||
let mut die = 1;
|
||||
let mut rolls = 3 * 20 * win;
|
||||
|
||||
let (loser_score, rolls) = if a_win < b_win {
|
||||
while a_score < TARGET_SCORE {
|
||||
a = simulate(die, a);
|
||||
a_score += a;
|
||||
rolls += 3;
|
||||
|
||||
if a_score < TARGET_SCORE {
|
||||
b = simulate(die + 3, b);
|
||||
b_score += b;
|
||||
rolls += 3;
|
||||
}
|
||||
|
||||
die = (die + 6) % 10;
|
||||
}
|
||||
|
||||
(b_score, rolls)
|
||||
} else {
|
||||
while b_score < TARGET_SCORE {
|
||||
a = simulate(die, a);
|
||||
a_score += a;
|
||||
|
||||
b = simulate(die + 3, b);
|
||||
b_score += b;
|
||||
|
||||
rolls += 6;
|
||||
|
||||
die = (die + 6) % 10;
|
||||
}
|
||||
|
||||
(a_score, rolls)
|
||||
};
|
||||
|
||||
(loser_score * rolls).to_string()
|
||||
}
|
||||
|
||||
const MAX_TURNS: usize = 13;
|
||||
const ROLLS: [i32; 7] = [3, 4, 5, 6, 7, 8, 9];
|
||||
const FREQS: [u64; 7] = [1, 3, 6, 7, 6, 3, 1];
|
||||
|
||||
fn multiverse(pos: i32) -> ([u64; MAX_TURNS], [u64; MAX_TURNS]) {
|
||||
type State = [[u64; 10]; 21];
|
||||
|
||||
// Let's work with pos - 1 as pos for now, indexes nicer;
|
||||
let pos = pos as usize - 1;
|
||||
|
||||
let mut alive = [0; MAX_TURNS];
|
||||
let mut wins = [0; MAX_TURNS];
|
||||
|
||||
alive[0] = 1;
|
||||
|
||||
let mut current = [[0u64; 10]; 21];
|
||||
current[0][pos] = 1;
|
||||
let mut next = [[0u64; 10]; 21];
|
||||
|
||||
let mut helper = |turn, current: &State, next: &mut State| {
|
||||
next.iter_mut().flatten().for_each(|v| *v = 0);
|
||||
|
||||
for (score, score_row) in current.iter().enumerate() {
|
||||
for (pos, &pop) in score_row.iter().enumerate() {
|
||||
for (roll, freq) in ROLLS.into_iter().zip(FREQS) {
|
||||
let new_pos = (pos + (roll as usize)) % 10;
|
||||
let new_score = score + new_pos + 1; // +1 because above
|
||||
let new_pop = freq * pop;
|
||||
|
||||
if new_score >= next.len() {
|
||||
wins[turn] += new_pop;
|
||||
} else {
|
||||
alive[turn] += new_pop;
|
||||
next[new_score][new_pos] += new_pop;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
for turn in (1..MAX_TURNS).step_by(2) {
|
||||
helper(turn, ¤t, &mut next);
|
||||
helper(turn + 1, &next, &mut current);
|
||||
}
|
||||
|
||||
(wins, alive)
|
||||
}
|
||||
|
||||
pub fn part2(input: &mut dyn Read) -> String {
|
||||
let (a, b) = read_input(input);
|
||||
|
||||
let (a_wins, a_alive) = multiverse(a);
|
||||
let (b_wins, b_alive) = multiverse(b);
|
||||
|
||||
let a_winner: u64 = a_wins[1..].iter().zip(b_alive).map(|(&a, b)| a * b).sum();
|
||||
let b_winner: u64 = b_wins.into_iter().zip(a_alive).map(|(a, b)| a * b).sum();
|
||||
|
||||
a_winner.max(b_winner).to_string()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::test_implementation;
|
||||
|
||||
use super::*;
|
||||
|
||||
const SAMPLE: &[u8] = include_bytes!("samples/21.txt");
|
||||
|
||||
#[test]
|
||||
fn sample_part1() {
|
||||
test_implementation(part1, SAMPLE, 739785);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sample_part2() {
|
||||
test_implementation(part2, SAMPLE, 444356092776315u64);
|
||||
}
|
||||
}
|
||||
199
2021/src/day22.rs
Normal file
199
2021/src/day22.rs
Normal file
@@ -0,0 +1,199 @@
|
||||
use std::io::Read;
|
||||
|
||||
use nom::branch::alt;
|
||||
use nom::bytes::complete::tag;
|
||||
use nom::character::complete::newline;
|
||||
use nom::combinator::map;
|
||||
use nom::multi::separated_list1;
|
||||
use nom::sequence::preceded;
|
||||
use nom::sequence::separated_pair;
|
||||
use nom::sequence::tuple;
|
||||
use nom::IResult;
|
||||
|
||||
use crate::common::read_input;
|
||||
|
||||
type Point3 = [i32; 3];
|
||||
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
struct Cuboid {
|
||||
lower: Point3,
|
||||
upper: Point3,
|
||||
}
|
||||
|
||||
impl Cuboid {
|
||||
pub fn new(lower: Point3, upper: Point3) -> Self {
|
||||
// The input uses an inclusive range for representation, but an exclusive one simplifies a
|
||||
// lot of computations, so we convert here.
|
||||
Self::new_internal(lower, upper.map(|c| c + 1))
|
||||
}
|
||||
|
||||
fn new_internal(lower: Point3, upper: Point3) -> Self {
|
||||
debug_assert!(lower.iter().zip(&upper).all(|(a, b)| a < b));
|
||||
Self { lower, upper }
|
||||
}
|
||||
|
||||
pub fn is_small(&self) -> bool {
|
||||
self.lower
|
||||
.iter()
|
||||
.chain(&self.upper.map(|c| c - 1)) // begrudgingly convert back
|
||||
.all(|c| c.abs() <= 50)
|
||||
}
|
||||
|
||||
pub fn volume(&self) -> i64 {
|
||||
self.lower
|
||||
.iter()
|
||||
.zip(&self.upper)
|
||||
.map(|(&l, &h)| (h - l) as i64)
|
||||
.product()
|
||||
}
|
||||
|
||||
fn overlaps(&self, other: &Self) -> bool {
|
||||
self.lower
|
||||
.iter()
|
||||
.zip(&self.upper)
|
||||
.zip(other.lower.iter().zip(&other.upper))
|
||||
.all(|((&al, &ah), (&bl, &bh))| al < bh && bl < ah)
|
||||
}
|
||||
|
||||
pub fn retain_nonoverlapping(&self, other: &Self, new_cubes: &mut Vec<Self>) -> bool {
|
||||
if !self.overlaps(other) {
|
||||
// Cube can be kept as-is.
|
||||
return true;
|
||||
}
|
||||
|
||||
let mut lower = self.lower;
|
||||
let mut upper = self.upper;
|
||||
|
||||
for axis in 0..3 {
|
||||
if other.lower[axis] > self.lower[axis] {
|
||||
let mut new_upper = upper;
|
||||
new_upper[axis] = other.lower[axis];
|
||||
|
||||
new_cubes.push(Cuboid {
|
||||
lower,
|
||||
upper: new_upper,
|
||||
});
|
||||
|
||||
lower[axis] = other.lower[axis];
|
||||
}
|
||||
|
||||
if other.upper[axis] < self.upper[axis] {
|
||||
let mut new_lower = lower;
|
||||
new_lower[axis] = other.upper[axis];
|
||||
|
||||
new_cubes.push(Cuboid {
|
||||
lower: new_lower,
|
||||
upper,
|
||||
});
|
||||
|
||||
upper[axis] = other.upper[axis];
|
||||
}
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_tuple(input: &[u8]) -> IResult<&[u8], (i32, i32)> {
|
||||
use nom::character::complete::i32;
|
||||
separated_pair(i32, tag(".."), i32)(input)
|
||||
}
|
||||
|
||||
fn parse_cuboid(input: &[u8]) -> IResult<&[u8], Cuboid> {
|
||||
map(
|
||||
tuple((
|
||||
parse_tuple,
|
||||
preceded(tag(",y="), parse_tuple),
|
||||
preceded(tag(",z="), parse_tuple),
|
||||
)),
|
||||
|((xl, xh), (yl, yh), (zl, zh))| Cuboid::new([xl, yl, zl], [xh, yh, zh]),
|
||||
)(input)
|
||||
}
|
||||
|
||||
fn parse_input(input: &[u8]) -> IResult<&[u8], Vec<(bool, Cuboid)>> {
|
||||
let parse_state = alt((map(tag("on x="), |_| true), map(tag("off x="), |_| false)));
|
||||
let parse_line = tuple((parse_state, parse_cuboid));
|
||||
|
||||
separated_list1(newline, parse_line)(input)
|
||||
}
|
||||
|
||||
pub fn part1(input: &mut dyn Read) -> String {
|
||||
let commands = read_input(input, parse_input);
|
||||
let mut cubes = Vec::new();
|
||||
let mut new_cubes = Vec::new();
|
||||
|
||||
for (state, cube) in commands.into_iter().filter(|(_, c)| c.is_small()) {
|
||||
cubes.retain(|existing: &Cuboid| existing.retain_nonoverlapping(&cube, &mut new_cubes));
|
||||
|
||||
// Add new cubes to the end
|
||||
cubes.append(&mut new_cubes);
|
||||
|
||||
if state {
|
||||
cubes.push(cube);
|
||||
}
|
||||
}
|
||||
|
||||
cubes.iter().map(Cuboid::volume).sum::<i64>().to_string()
|
||||
}
|
||||
|
||||
pub fn part2(input: &mut dyn Read) -> String {
|
||||
let commands = read_input(input, parse_input);
|
||||
let mut cubes = Vec::new();
|
||||
let mut new_cubes = Vec::new();
|
||||
|
||||
for (state, cube) in commands {
|
||||
cubes.retain(|existing: &Cuboid| existing.retain_nonoverlapping(&cube, &mut new_cubes));
|
||||
|
||||
// Add new cubes to the end
|
||||
cubes.append(&mut new_cubes);
|
||||
|
||||
if state {
|
||||
cubes.push(cube);
|
||||
}
|
||||
}
|
||||
|
||||
cubes.iter().map(Cuboid::volume).sum::<i64>().to_string()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::test_implementation;
|
||||
|
||||
use super::*;
|
||||
|
||||
const SAMPLE1: &[u8] = include_bytes!("samples/22.1.txt");
|
||||
const SAMPLE2: &[u8] = include_bytes!("samples/22.2.txt");
|
||||
|
||||
#[test]
|
||||
fn test_overlap() {
|
||||
let cube_a = Cuboid {
|
||||
lower: [1, 1, 1],
|
||||
upper: [4, 4, 4],
|
||||
};
|
||||
|
||||
let cube_b = Cuboid {
|
||||
lower: [2, 2, 2],
|
||||
upper: [3, 3, 3],
|
||||
};
|
||||
|
||||
let mut new_cubes = Vec::new();
|
||||
|
||||
// B is fully inside A so it should overlap and the result should be empty
|
||||
assert!(!cube_b.retain_nonoverlapping(&cube_a, &mut new_cubes));
|
||||
assert_eq!(new_cubes, Vec::new());
|
||||
|
||||
// In the reverse case, we should have lots of new cubes
|
||||
assert!(!cube_a.retain_nonoverlapping(&cube_b, &mut new_cubes));
|
||||
assert_eq!(new_cubes.len(), 6);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sample_part1() {
|
||||
test_implementation(part1, SAMPLE1, 590784);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sample_part2() {
|
||||
test_implementation(part2, SAMPLE2, 2758514936282235u64);
|
||||
}
|
||||
}
|
||||
341
2021/src/day23.rs
Normal file
341
2021/src/day23.rs
Normal file
@@ -0,0 +1,341 @@
|
||||
use std::cmp::Reverse;
|
||||
use std::collections::hash_map::Entry;
|
||||
use std::collections::BinaryHeap;
|
||||
use std::collections::HashMap;
|
||||
use std::fmt::Display;
|
||||
use std::io::Read;
|
||||
use std::mem::swap;
|
||||
|
||||
use crate::common::LineIter;
|
||||
|
||||
type Item = (u32, u32, State);
|
||||
type Todo = BinaryHeap<Reverse<Item>>;
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Copy, Clone, Hash)]
|
||||
enum Pod {
|
||||
A,
|
||||
B,
|
||||
C,
|
||||
D,
|
||||
}
|
||||
|
||||
impl Pod {
|
||||
pub fn cost(self) -> u32 {
|
||||
match self {
|
||||
Pod::A => 1,
|
||||
Pod::B => 10,
|
||||
Pod::C => 100,
|
||||
Pod::D => 1000,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<char> for Pod {
|
||||
type Error = &'static str;
|
||||
|
||||
fn try_from(c: char) -> Result<Self, Self::Error> {
|
||||
match c {
|
||||
'A' => Ok(Pod::A),
|
||||
'B' => Ok(Pod::B),
|
||||
'C' => Ok(Pod::C),
|
||||
'D' => Ok(Pod::D),
|
||||
_ => Err("Invalid pod"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, PartialEq, Eq, PartialOrd, Ord, Clone, Hash)]
|
||||
struct State {
|
||||
hallway: [Option<Pod>; 7],
|
||||
rooms: [[Option<Pod>; 2]; 4],
|
||||
}
|
||||
|
||||
impl State {
|
||||
pub fn is_done(&self) -> bool {
|
||||
self == &State {
|
||||
hallway: [None; 7],
|
||||
rooms: [
|
||||
[Some(Pod::A); 2],
|
||||
[Some(Pod::B); 2],
|
||||
[Some(Pod::C); 2],
|
||||
[Some(Pod::D); 2],
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
fn add_to_queue(self, cost: u32, todo: &mut Todo, visited: &mut HashMap<Self, u32>) {
|
||||
let entry = visited.entry(self.clone());
|
||||
|
||||
if matches!(&entry, Entry::Occupied(entry) if *entry.get() <= cost) {
|
||||
// Already got a better one
|
||||
return;
|
||||
}
|
||||
|
||||
// print!("Next: \n{}", self);
|
||||
|
||||
// nightly only :'(
|
||||
// entry.insert(cost);
|
||||
*entry.or_default() = cost;
|
||||
|
||||
todo.push(Reverse((cost + self.estimate(), cost, self)))
|
||||
}
|
||||
|
||||
fn estimate(&self) -> u32 {
|
||||
// A* estimate. For every entry that is not already "at rest", the cost is the cost
|
||||
// required to get it to the top of its intended room.
|
||||
let mut estimate = 0;
|
||||
|
||||
for (x, &pod) in self.hallway.iter().enumerate() {
|
||||
if let Some(pod) = pod {
|
||||
let cost = if x == 0 {
|
||||
4 + pod as u32 * 2
|
||||
} else if x == 6 {
|
||||
4 + (3 - pod as u32) * 2
|
||||
} else if x <= (pod as usize) + 1 {
|
||||
2 + 2 * (pod as u32 + (x as u32 - 1))
|
||||
} else {
|
||||
2 + 2 * (x as u32 - pod as u32 - 2)
|
||||
};
|
||||
estimate += cost * pod.cost();
|
||||
}
|
||||
}
|
||||
|
||||
for (index, room) in self.rooms.iter().enumerate() {
|
||||
if let Some(last) = room
|
||||
.iter()
|
||||
.rposition(|&pod| !matches!(pod, Some(pod) if pod as usize == index))
|
||||
{
|
||||
for pos in 0..=last {
|
||||
if let Some(pod) = room[pos] {
|
||||
if pod as usize != index {
|
||||
let abs_diff = index.max(pod as usize) - index.min(pod as usize);
|
||||
estimate += (pos + 2 + 2 * abs_diff) as u32 * pod.cost();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
estimate
|
||||
}
|
||||
|
||||
pub fn generate_next(&self, cost: u32, todo: &mut Todo, visited: &mut HashMap<Self, u32>) {
|
||||
self.generate_hallway(cost, todo, visited);
|
||||
self.generate_rooms(cost, todo, visited);
|
||||
}
|
||||
|
||||
fn generate_rooms(&self, cost: u32, todo: &mut Todo, visited: &mut HashMap<Self, u32>) {
|
||||
for (index, room) in self.rooms.iter().enumerate() {
|
||||
// Check what part of the room should still move
|
||||
if let Some(last) = room
|
||||
.iter()
|
||||
.rposition(|&pod| !matches!(pod, Some(pod) if pod as usize == index))
|
||||
{
|
||||
for pos in 0..=last {
|
||||
let pod = match room[pos] {
|
||||
Some(pod) => pod,
|
||||
None => continue,
|
||||
};
|
||||
|
||||
// Check if we can move up
|
||||
if pos > 0 && room[pos - 1].is_none() {
|
||||
let mut new_state = self.clone();
|
||||
new_state.rooms[index].swap(pos, pos - 1);
|
||||
let new_cost = cost + pod.cost();
|
||||
new_state.add_to_queue(new_cost, todo, visited);
|
||||
}
|
||||
|
||||
// Check if we can move down
|
||||
if pos + 1 < room.len() && room[pos + 1].is_none() {
|
||||
let mut new_state = self.clone();
|
||||
new_state.rooms[index].swap(pos, pos + 1);
|
||||
let new_cost = cost + pod.cost();
|
||||
new_state.add_to_queue(new_cost, todo, visited);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if we can pop out of the room
|
||||
if let Some(pod) = room[0] {
|
||||
for pos in [index + 1, index + 2] {
|
||||
if self.hallway[pos].is_none() {
|
||||
let mut new_state = self.clone();
|
||||
swap(&mut new_state.rooms[index][0], &mut new_state.hallway[pos]);
|
||||
let new_cost = cost + pod.cost();
|
||||
new_state.add_to_queue(new_cost, todo, visited);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn generate_hallway(&self, cost: u32, todo: &mut Todo, visited: &mut HashMap<Self, u32>) {
|
||||
for index in 0..self.hallway.len() {
|
||||
let pod = if let Some(pod) = self.hallway[index] {
|
||||
pod
|
||||
} else {
|
||||
continue;
|
||||
};
|
||||
|
||||
// Check if we can move right
|
||||
if index + 1 < self.hallway.len() && self.hallway[index + 1].is_none() {
|
||||
let mut new_state = self.clone();
|
||||
new_state.hallway.swap(index, index + 1);
|
||||
let added_cost = if index == 0 || index == 5 {
|
||||
pod.cost()
|
||||
} else {
|
||||
2 * pod.cost()
|
||||
};
|
||||
|
||||
let new_cost = cost + added_cost;
|
||||
new_state.add_to_queue(new_cost, todo, visited);
|
||||
}
|
||||
|
||||
// Check if we can move left
|
||||
if index > 1 && self.hallway[index - 1].is_none() {
|
||||
let mut new_state = self.clone();
|
||||
new_state.hallway.swap(index, index - 1);
|
||||
let added_cost = if index == 1 || index == 6 {
|
||||
pod.cost()
|
||||
} else {
|
||||
2 * pod.cost()
|
||||
};
|
||||
|
||||
let new_cost = cost + added_cost;
|
||||
new_state.add_to_queue(new_cost, todo, visited);
|
||||
}
|
||||
|
||||
// Check if we can pop into a room to the right
|
||||
if (1..=4).contains(&index) && self.rooms[index - 1][0].is_none() {
|
||||
let mut new_state = self.clone();
|
||||
swap(
|
||||
&mut new_state.hallway[index],
|
||||
&mut new_state.rooms[index - 1][0],
|
||||
);
|
||||
|
||||
let new_cost = cost + 2 * pod.cost();
|
||||
new_state.add_to_queue(new_cost, todo, visited);
|
||||
}
|
||||
|
||||
if (2..=5).contains(&index) && self.rooms[index - 2][0].is_none() {
|
||||
let mut new_state = self.clone();
|
||||
swap(
|
||||
&mut new_state.hallway[index],
|
||||
&mut new_state.rooms[index - 2][0],
|
||||
);
|
||||
|
||||
let new_cost = cost + 2 * pod.cost();
|
||||
new_state.add_to_queue(new_cost, todo, visited);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for State {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
let helper = |opt_pod| match opt_pod {
|
||||
Some(Pod::A) => 'A',
|
||||
Some(Pod::B) => 'B',
|
||||
Some(Pod::C) => 'C',
|
||||
Some(Pod::D) => 'D',
|
||||
None => '.',
|
||||
};
|
||||
writeln!(f, "#############")?;
|
||||
write!(f, "#{}{}", helper(self.hallway[0]), helper(self.hallway[1]))?;
|
||||
for i in 2..=5 {
|
||||
write!(f, ".{}", helper(self.hallway[i]))?;
|
||||
}
|
||||
writeln!(f, "{}#", helper(self.hallway[6]))?;
|
||||
|
||||
for i in 0..(self.rooms[0].len()) {
|
||||
writeln!(
|
||||
f,
|
||||
" #{}#{}#{}#{}#",
|
||||
helper(self.rooms[0][i]),
|
||||
helper(self.rooms[1][i]),
|
||||
helper(self.rooms[2][i]),
|
||||
helper(self.rooms[3][i])
|
||||
)?;
|
||||
}
|
||||
|
||||
write!(f, " #########")
|
||||
}
|
||||
}
|
||||
|
||||
fn read_input(input: &mut dyn Read) -> State {
|
||||
let mut reader = LineIter::new(input);
|
||||
let mut state = State::default();
|
||||
|
||||
let _ = reader.next();
|
||||
let _ = reader.next();
|
||||
|
||||
let mut helper = |idx: usize| {
|
||||
reader
|
||||
.next()
|
||||
.unwrap()
|
||||
.chars()
|
||||
.filter_map(|c| Pod::try_from(c).ok())
|
||||
.zip(&mut state.rooms)
|
||||
.for_each(|(pod, room)| room[idx] = Some(pod))
|
||||
};
|
||||
|
||||
helper(0);
|
||||
helper(1);
|
||||
|
||||
state
|
||||
}
|
||||
|
||||
pub fn part1(input: &mut dyn Read) -> String {
|
||||
let state = read_input(input);
|
||||
let mut todo = Todo::new();
|
||||
|
||||
let mut visited = HashMap::new();
|
||||
visited.insert(state.clone(), 0);
|
||||
|
||||
todo.push(Reverse((state.estimate(), 0, state)));
|
||||
|
||||
while let Some(Reverse((_, cost, state))) = todo.pop() {
|
||||
if state.is_done() {
|
||||
return cost.to_string();
|
||||
}
|
||||
|
||||
// println!("\nExpanding:\n{}", state);
|
||||
|
||||
state.generate_next(cost, &mut todo, &mut visited);
|
||||
}
|
||||
|
||||
panic!("No route found!")
|
||||
}
|
||||
|
||||
pub fn part2(_input: &mut dyn Read) -> String {
|
||||
todo!()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
use crate::test_implementation;
|
||||
|
||||
const SAMPLE: &[u8] = include_bytes!("samples/23.txt");
|
||||
|
||||
#[test]
|
||||
fn test_is_done() {
|
||||
let state = State {
|
||||
hallway: Default::default(),
|
||||
rooms: [
|
||||
[Some(Pod::A); 2],
|
||||
[Some(Pod::B), Some(Pod::B)],
|
||||
[Some(Pod::C), Some(Pod::C)],
|
||||
[Some(Pod::D), Some(Pod::D)],
|
||||
],
|
||||
};
|
||||
|
||||
assert!(state.is_done());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sample_part1() {
|
||||
test_implementation(part1, SAMPLE, 12521);
|
||||
}
|
||||
}
|
||||
9
2021/src/day24.rs
Normal file
9
2021/src/day24.rs
Normal file
@@ -0,0 +1,9 @@
|
||||
use std::io::Read;
|
||||
|
||||
pub fn part1(_input: &mut dyn Read) -> String {
|
||||
todo!()
|
||||
}
|
||||
|
||||
pub fn part2(_input: &mut dyn Read) -> String {
|
||||
todo!()
|
||||
}
|
||||
85
2021/src/day25.rs
Normal file
85
2021/src/day25.rs
Normal file
@@ -0,0 +1,85 @@
|
||||
use std::io::Read;
|
||||
|
||||
fn read_input(input: &mut dyn Read) -> (usize, Vec<u8>) {
|
||||
let mut result = Vec::new();
|
||||
input.read_to_end(&mut result).unwrap();
|
||||
|
||||
let width = result.iter().position(|&c| c == b'\n').unwrap();
|
||||
result.retain(|c| !c.is_ascii_whitespace());
|
||||
|
||||
(width, result)
|
||||
}
|
||||
|
||||
fn advance(width: usize, state: &mut [u8]) -> bool {
|
||||
debug_assert_eq!(state.len() % width, 0);
|
||||
let mut changes = false;
|
||||
|
||||
// Move the eastbound herd
|
||||
for src in state.chunks_exact_mut(width) {
|
||||
let swap_last = src[0] == b'.' && src[width - 1] == b'>';
|
||||
let mut x = 0;
|
||||
|
||||
while x < src.len() - 1 {
|
||||
if src[x] == b'>' && src[x + 1] == b'.' {
|
||||
src.swap(x, x + 1);
|
||||
changes = true;
|
||||
x += 2;
|
||||
} else {
|
||||
x += 1;
|
||||
}
|
||||
}
|
||||
|
||||
if swap_last {
|
||||
src.swap(0, width - 1);
|
||||
changes = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Then move the southbound herd. Need to do by column because of the first entry special case
|
||||
for x in 0..width {
|
||||
let last_index = state.len() - width + x;
|
||||
let swap_last = state[x] == b'.' && state[last_index] == b'v';
|
||||
|
||||
let mut offset = x;
|
||||
|
||||
while offset < state.len() - width {
|
||||
if state[offset] == b'v' && state[offset + width] == b'.' {
|
||||
state.swap(offset, offset + width);
|
||||
changes = true;
|
||||
offset += 2 * width;
|
||||
} else {
|
||||
offset += width;
|
||||
}
|
||||
}
|
||||
|
||||
if swap_last {
|
||||
state.swap(x, last_index);
|
||||
changes = true;
|
||||
}
|
||||
}
|
||||
|
||||
changes
|
||||
}
|
||||
|
||||
pub fn part1(input: &mut dyn Read) -> String {
|
||||
let (width, mut state) = read_input(input);
|
||||
|
||||
(1..)
|
||||
.find(|_| !advance(width, &mut state))
|
||||
.unwrap()
|
||||
.to_string()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
use crate::test_implementation;
|
||||
|
||||
const SAMPLE: &[u8] = include_bytes!("samples/25.txt");
|
||||
|
||||
#[test]
|
||||
fn sample_part1() {
|
||||
test_implementation(part1, SAMPLE, 58);
|
||||
}
|
||||
}
|
||||
98
2021/src/lib.rs
Normal file
98
2021/src/lib.rs
Normal file
@@ -0,0 +1,98 @@
|
||||
use std::io::Read;
|
||||
|
||||
type Solution = fn(&mut dyn Read) -> String;
|
||||
|
||||
mod common;
|
||||
mod day01;
|
||||
mod day02;
|
||||
mod day03;
|
||||
mod day04;
|
||||
mod day05;
|
||||
mod day06;
|
||||
mod day07;
|
||||
mod day08;
|
||||
mod day09;
|
||||
mod day10;
|
||||
mod day11;
|
||||
mod day12;
|
||||
mod day13;
|
||||
mod day14;
|
||||
mod day15;
|
||||
mod day16;
|
||||
mod day17;
|
||||
mod day18;
|
||||
mod day19;
|
||||
mod day20;
|
||||
mod day21;
|
||||
mod day22;
|
||||
mod day23;
|
||||
mod day24;
|
||||
mod day25;
|
||||
|
||||
pub fn get_implementation(day: usize, part2: bool) -> Solution {
|
||||
if !part2 {
|
||||
match day {
|
||||
1 => day01::part1,
|
||||
2 => day02::part1,
|
||||
3 => day03::part1,
|
||||
4 => day04::part1,
|
||||
5 => day05::part1,
|
||||
6 => day06::part1,
|
||||
7 => day07::part1,
|
||||
8 => day08::part1,
|
||||
9 => day09::part1,
|
||||
10 => day10::part1,
|
||||
11 => day11::part1,
|
||||
12 => day12::part1,
|
||||
13 => day13::part1,
|
||||
14 => day14::part1,
|
||||
15 => day15::part1,
|
||||
16 => day16::part1,
|
||||
17 => day17::part1,
|
||||
18 => day18::part1,
|
||||
19 => day19::part1,
|
||||
20 => day20::part1,
|
||||
21 => day21::part1,
|
||||
22 => day22::part1,
|
||||
23 => day23::part1,
|
||||
24 => day24::part1,
|
||||
25 => day25::part1,
|
||||
_ => panic!("Unsupported part one for day {}", day),
|
||||
}
|
||||
} else {
|
||||
match day {
|
||||
1 => day01::part2,
|
||||
2 => day02::part2,
|
||||
3 => day03::part2,
|
||||
4 => day04::part2,
|
||||
5 => day05::part2,
|
||||
6 => day06::part2,
|
||||
7 => day07::part2,
|
||||
8 => day08::part2,
|
||||
9 => day09::part2,
|
||||
10 => day10::part2,
|
||||
11 => day11::part2,
|
||||
12 => day12::part2,
|
||||
13 => day13::part2,
|
||||
14 => day14::part2,
|
||||
15 => day15::part2,
|
||||
16 => day16::part2,
|
||||
17 => day17::part2,
|
||||
18 => day18::part2,
|
||||
19 => day19::part2,
|
||||
20 => day20::part2,
|
||||
21 => day21::part2,
|
||||
22 => day22::part2,
|
||||
23 => day23::part2,
|
||||
24 => day24::part2,
|
||||
_ => panic!("Unsupported part two for day {}", day),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn test_implementation(solution: Solution, data: &[u8], answer: impl ToString) {
|
||||
let result = solution(&mut &data[..]);
|
||||
|
||||
assert_eq!(answer.to_string(), result);
|
||||
}
|
||||
47
2021/src/main.rs
Normal file
47
2021/src/main.rs
Normal file
@@ -0,0 +1,47 @@
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::num::NonZeroUsize;
|
||||
use std::path::PathBuf;
|
||||
use std::time::Instant;
|
||||
|
||||
use clap::Parser;
|
||||
|
||||
use aoc_2021::get_implementation;
|
||||
|
||||
/// Advent of Code 2021 runner
|
||||
#[derive(Parser)]
|
||||
struct Opts {
|
||||
/// Which day to run
|
||||
day: NonZeroUsize,
|
||||
|
||||
/// Print time taken
|
||||
#[clap(short, long)]
|
||||
time: bool,
|
||||
|
||||
/// Run part 2 instead of part 1
|
||||
#[clap(short = '2', long)]
|
||||
part2: bool,
|
||||
|
||||
/// Read input from the given file instead of stdin
|
||||
#[clap(short, long)]
|
||||
input: Option<PathBuf>,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let opts: Opts = Opts::parse();
|
||||
|
||||
let mut input: Box<dyn Read> = if let Some(input) = opts.input {
|
||||
Box::new(File::open(&input).expect("Failed to open input"))
|
||||
} else {
|
||||
Box::new(std::io::stdin())
|
||||
};
|
||||
|
||||
let begin = Instant::now();
|
||||
let result = get_implementation(opts.day.get(), opts.part2)(&mut *input);
|
||||
|
||||
if opts.time {
|
||||
eprintln!("Execution time: {:?}", Instant::now().duration_since(begin));
|
||||
}
|
||||
|
||||
println!("{}", result);
|
||||
}
|
||||
10
2021/src/samples/01.txt
Normal file
10
2021/src/samples/01.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
199
|
||||
200
|
||||
208
|
||||
210
|
||||
200
|
||||
207
|
||||
240
|
||||
269
|
||||
260
|
||||
263
|
||||
6
2021/src/samples/02.txt
Normal file
6
2021/src/samples/02.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
forward 5
|
||||
down 5
|
||||
forward 8
|
||||
up 3
|
||||
down 8
|
||||
forward 2
|
||||
12
2021/src/samples/03.txt
Normal file
12
2021/src/samples/03.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
00100
|
||||
11110
|
||||
10110
|
||||
10111
|
||||
10101
|
||||
01111
|
||||
00111
|
||||
11100
|
||||
10000
|
||||
11001
|
||||
00010
|
||||
01010
|
||||
19
2021/src/samples/04.txt
Normal file
19
2021/src/samples/04.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
7,4,9,5,11,17,23,2,0,14,21,24,10,16,13,6,15,25,12,22,18,20,8,19,3,26,1
|
||||
|
||||
22 13 17 11 0
|
||||
8 2 23 4 24
|
||||
21 9 14 16 7
|
||||
6 10 3 18 5
|
||||
1 12 20 15 19
|
||||
|
||||
3 15 0 2 22
|
||||
9 18 13 17 5
|
||||
19 8 7 25 23
|
||||
20 11 10 24 4
|
||||
14 21 16 12 6
|
||||
|
||||
14 21 17 24 4
|
||||
10 16 15 9 19
|
||||
18 8 23 26 20
|
||||
22 11 13 6 5
|
||||
2 0 12 3 7
|
||||
10
2021/src/samples/05.txt
Normal file
10
2021/src/samples/05.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
0,9 -> 5,9
|
||||
8,0 -> 0,8
|
||||
9,4 -> 3,4
|
||||
2,2 -> 2,1
|
||||
7,0 -> 7,4
|
||||
6,4 -> 2,0
|
||||
0,9 -> 2,9
|
||||
3,4 -> 1,4
|
||||
0,0 -> 8,8
|
||||
5,5 -> 8,2
|
||||
10
2021/src/samples/08.txt
Normal file
10
2021/src/samples/08.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
be cfbegad cbdgef fgaecd cgeb fdcge agebfd fecdb fabcd edb | fdgacbe cefdb cefbgd gcbe
|
||||
edbfga begcd cbg gc gcadebf fbgde acbgfd abcde gfcbed gfec | fcgedb cgb dgebacf gc
|
||||
fgaebd cg bdaec gdafb agbcfd gdcbef bgcad gfac gcb cdgabef | cg cg fdcagb cbg
|
||||
fbegcd cbd adcefb dageb afcb bc aefdc ecdab fgdeca fcdbega | efabcd cedba gadfec cb
|
||||
aecbfdg fbg gf bafeg dbefa fcge gcbea fcaegb dgceab fcbdga | gecf egdcabf bgf bfgea
|
||||
fgeab ca afcebg bdacfeg cfaedg gcfdb baec bfadeg bafgc acf | gebdcfa ecba ca fadegcb
|
||||
dbcfg fgd bdegcaf fgec aegbdf ecdfab fbedc dacgb gdcebf gf | cefg dcbef fcge gbcadfe
|
||||
bdfegc cbegaf gecbf dfcage bdacg ed bedf ced adcbefg gebcd | ed bcgafe cdgba cbgef
|
||||
egadfb cdbfeg cegd fecab cgb gbdefca cg fgcdab egfdb bfceg | gbdfcae bgc cg cgb
|
||||
gcafb gcf dcaebfg ecagb gf abcdeg gaef cafbge fdbac fegbdc | fgae cfgab fg bagce
|
||||
5
2021/src/samples/09.txt
Normal file
5
2021/src/samples/09.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
2199943210
|
||||
3987894921
|
||||
9856789892
|
||||
8767896789
|
||||
9899965678
|
||||
10
2021/src/samples/10.txt
Normal file
10
2021/src/samples/10.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
[({(<(())[]>[[{[]{<()<>>
|
||||
[(()[<>])]({[<{<<[]>>(
|
||||
{([(<{}[<>[]}>{[]{[(<()>
|
||||
(((({<>}<{<{<>}{[]{[]{}
|
||||
[[<[([]))<([[{}[[()]]]
|
||||
[{[{({}]{}}([{[{{{}}([]
|
||||
{<[[]]>}<{[{[{[]{()[[[]
|
||||
[<(<(<(<{}))><([]([]()
|
||||
<{([([[(<>()){}]>(<<{{
|
||||
<{([{{}}[<[[[<>{}]]]>[]]
|
||||
10
2021/src/samples/11.txt
Normal file
10
2021/src/samples/11.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
5483143223
|
||||
2745854711
|
||||
5264556173
|
||||
6141336146
|
||||
6357385478
|
||||
4167524645
|
||||
2176841721
|
||||
6882881134
|
||||
4846848554
|
||||
5283751526
|
||||
7
2021/src/samples/12.1.txt
Normal file
7
2021/src/samples/12.1.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
start-A
|
||||
start-b
|
||||
A-c
|
||||
A-b
|
||||
b-d
|
||||
A-end
|
||||
b-end
|
||||
10
2021/src/samples/12.2.txt
Normal file
10
2021/src/samples/12.2.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
dc-end
|
||||
HN-start
|
||||
start-kj
|
||||
dc-start
|
||||
dc-HN
|
||||
LN-dc
|
||||
HN-end
|
||||
kj-sa
|
||||
kj-HN
|
||||
kj-dc
|
||||
18
2021/src/samples/12.3.txt
Normal file
18
2021/src/samples/12.3.txt
Normal file
@@ -0,0 +1,18 @@
|
||||
fs-end
|
||||
he-DX
|
||||
fs-he
|
||||
start-DX
|
||||
pj-DX
|
||||
end-zg
|
||||
zg-sl
|
||||
zg-pj
|
||||
pj-he
|
||||
RW-he
|
||||
fs-DX
|
||||
pj-RW
|
||||
zg-RW
|
||||
start-pj
|
||||
he-WI
|
||||
zg-he
|
||||
pj-fs
|
||||
start-RW
|
||||
21
2021/src/samples/13.txt
Normal file
21
2021/src/samples/13.txt
Normal file
@@ -0,0 +1,21 @@
|
||||
6,10
|
||||
0,14
|
||||
9,10
|
||||
0,3
|
||||
10,4
|
||||
4,11
|
||||
6,0
|
||||
6,12
|
||||
4,1
|
||||
0,13
|
||||
10,12
|
||||
3,4
|
||||
3,0
|
||||
8,4
|
||||
1,10
|
||||
2,14
|
||||
8,10
|
||||
9,0
|
||||
|
||||
fold along y=7
|
||||
fold along x=5
|
||||
18
2021/src/samples/14.txt
Normal file
18
2021/src/samples/14.txt
Normal file
@@ -0,0 +1,18 @@
|
||||
NNCB
|
||||
|
||||
CH -> B
|
||||
HH -> N
|
||||
CB -> H
|
||||
NH -> C
|
||||
HB -> C
|
||||
HC -> B
|
||||
HN -> C
|
||||
NN -> C
|
||||
BH -> H
|
||||
NC -> B
|
||||
NB -> B
|
||||
BN -> B
|
||||
BB -> N
|
||||
BC -> B
|
||||
CC -> N
|
||||
CN -> C
|
||||
10
2021/src/samples/15.txt
Normal file
10
2021/src/samples/15.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
1163751742
|
||||
1381373672
|
||||
2136511328
|
||||
3694931569
|
||||
7463417111
|
||||
1319128137
|
||||
1359912421
|
||||
3125421639
|
||||
1293138521
|
||||
2311944581
|
||||
1
2021/src/samples/17.txt
Normal file
1
2021/src/samples/17.txt
Normal file
@@ -0,0 +1 @@
|
||||
target area: x=20..30, y=-10..-5
|
||||
10
2021/src/samples/18.txt
Normal file
10
2021/src/samples/18.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
[[[0,[5,8]],[[1,7],[9,6]]],[[4,[1,2]],[[1,4],2]]]
|
||||
[[[5,[2,8]],4],[5,[[9,9],0]]]
|
||||
[6,[[[6,2],[5,6]],[[7,6],[4,7]]]]
|
||||
[[[6,[0,7]],[0,9]],[4,[9,[9,0]]]]
|
||||
[[[7,[6,4]],[3,[1,3]]],[[[5,5],1],9]]
|
||||
[[6,[[7,3],[3,2]]],[[[3,8],[5,7]],4]]
|
||||
[[[[5,4],[7,7]],8],[[8,3],8]]
|
||||
[[9,3],[[9,9],[6,[4,9]]]]
|
||||
[[2,[[7,7],7]],[[5,8],[[9,3],[0,2]]]]
|
||||
[[[[5,2],5],[8,[3,7]]],[[5,[7,5]],[4,4]]]
|
||||
136
2021/src/samples/19.txt
Normal file
136
2021/src/samples/19.txt
Normal file
@@ -0,0 +1,136 @@
|
||||
--- scanner 0 ---
|
||||
404,-588,-901
|
||||
528,-643,409
|
||||
-838,591,734
|
||||
390,-675,-793
|
||||
-537,-823,-458
|
||||
-485,-357,347
|
||||
-345,-311,381
|
||||
-661,-816,-575
|
||||
-876,649,763
|
||||
-618,-824,-621
|
||||
553,345,-567
|
||||
474,580,667
|
||||
-447,-329,318
|
||||
-584,868,-557
|
||||
544,-627,-890
|
||||
564,392,-477
|
||||
455,729,728
|
||||
-892,524,684
|
||||
-689,845,-530
|
||||
423,-701,434
|
||||
7,-33,-71
|
||||
630,319,-379
|
||||
443,580,662
|
||||
-789,900,-551
|
||||
459,-707,401
|
||||
|
||||
--- scanner 1 ---
|
||||
686,422,578
|
||||
605,423,415
|
||||
515,917,-361
|
||||
-336,658,858
|
||||
95,138,22
|
||||
-476,619,847
|
||||
-340,-569,-846
|
||||
567,-361,727
|
||||
-460,603,-452
|
||||
669,-402,600
|
||||
729,430,532
|
||||
-500,-761,534
|
||||
-322,571,750
|
||||
-466,-666,-811
|
||||
-429,-592,574
|
||||
-355,545,-477
|
||||
703,-491,-529
|
||||
-328,-685,520
|
||||
413,935,-424
|
||||
-391,539,-444
|
||||
586,-435,557
|
||||
-364,-763,-893
|
||||
807,-499,-711
|
||||
755,-354,-619
|
||||
553,889,-390
|
||||
|
||||
--- scanner 2 ---
|
||||
649,640,665
|
||||
682,-795,504
|
||||
-784,533,-524
|
||||
-644,584,-595
|
||||
-588,-843,648
|
||||
-30,6,44
|
||||
-674,560,763
|
||||
500,723,-460
|
||||
609,671,-379
|
||||
-555,-800,653
|
||||
-675,-892,-343
|
||||
697,-426,-610
|
||||
578,704,681
|
||||
493,664,-388
|
||||
-671,-858,530
|
||||
-667,343,800
|
||||
571,-461,-707
|
||||
-138,-166,112
|
||||
-889,563,-600
|
||||
646,-828,498
|
||||
640,759,510
|
||||
-630,509,768
|
||||
-681,-892,-333
|
||||
673,-379,-804
|
||||
-742,-814,-386
|
||||
577,-820,562
|
||||
|
||||
--- scanner 3 ---
|
||||
-589,542,597
|
||||
605,-692,669
|
||||
-500,565,-823
|
||||
-660,373,557
|
||||
-458,-679,-417
|
||||
-488,449,543
|
||||
-626,468,-788
|
||||
338,-750,-386
|
||||
528,-832,-391
|
||||
562,-778,733
|
||||
-938,-730,414
|
||||
543,643,-506
|
||||
-524,371,-870
|
||||
407,773,750
|
||||
-104,29,83
|
||||
378,-903,-323
|
||||
-778,-728,485
|
||||
426,699,580
|
||||
-438,-605,-362
|
||||
-469,-447,-387
|
||||
509,732,623
|
||||
647,635,-688
|
||||
-868,-804,481
|
||||
614,-800,639
|
||||
595,780,-596
|
||||
|
||||
--- scanner 4 ---
|
||||
727,592,562
|
||||
-293,-554,779
|
||||
441,611,-461
|
||||
-714,465,-776
|
||||
-743,427,-804
|
||||
-660,-479,-426
|
||||
832,-632,460
|
||||
927,-485,-438
|
||||
408,393,-506
|
||||
466,436,-512
|
||||
110,16,151
|
||||
-258,-428,682
|
||||
-393,719,612
|
||||
-211,-452,876
|
||||
808,-476,-593
|
||||
-575,615,604
|
||||
-485,667,467
|
||||
-680,325,-822
|
||||
-627,-443,-432
|
||||
872,-547,-609
|
||||
833,512,582
|
||||
807,604,487
|
||||
839,-516,451
|
||||
891,-625,532
|
||||
-652,-548,-490
|
||||
30,-46,-14
|
||||
7
2021/src/samples/20.txt
Normal file
7
2021/src/samples/20.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
..#.#..#####.#.#.#.###.##.....###.##.#..###.####..#####..#....#..#..##..###..######.###...####..#..#####..##..#.#####...##.#.#..#.##..#.#......#.###.######.###.####...#.##.##..#..#..#####.....#.#....###..#.##......#.....#..#..#..##..#...##.######.####.####.#.#...#.......#..#.#.#...####.##.#......#..#...##.#.##..#...##.#.##..###.#......#.#.......#.#.#.####.###.##...#.....####.#..#..#.##.#....##..#.####....##...##..#...#......#.#.......#.......##..####..#...#.#.#...##..#.#..###..#####........#..####......#..#
|
||||
|
||||
#..#.
|
||||
#....
|
||||
##..#
|
||||
..#..
|
||||
..###
|
||||
2
2021/src/samples/21.txt
Normal file
2
2021/src/samples/21.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
Player 1 starting position: 4
|
||||
Player 2 starting position: 8
|
||||
22
2021/src/samples/22.1.txt
Normal file
22
2021/src/samples/22.1.txt
Normal file
@@ -0,0 +1,22 @@
|
||||
on x=-20..26,y=-36..17,z=-47..7
|
||||
on x=-20..33,y=-21..23,z=-26..28
|
||||
on x=-22..28,y=-29..23,z=-38..16
|
||||
on x=-46..7,y=-6..46,z=-50..-1
|
||||
on x=-49..1,y=-3..46,z=-24..28
|
||||
on x=2..47,y=-22..22,z=-23..27
|
||||
on x=-27..23,y=-28..26,z=-21..29
|
||||
on x=-39..5,y=-6..47,z=-3..44
|
||||
on x=-30..21,y=-8..43,z=-13..34
|
||||
on x=-22..26,y=-27..20,z=-29..19
|
||||
off x=-48..-32,y=26..41,z=-47..-37
|
||||
on x=-12..35,y=6..50,z=-50..-2
|
||||
off x=-48..-32,y=-32..-16,z=-15..-5
|
||||
on x=-18..26,y=-33..15,z=-7..46
|
||||
off x=-40..-22,y=-38..-28,z=23..41
|
||||
on x=-16..35,y=-41..10,z=-47..6
|
||||
off x=-32..-23,y=11..30,z=-14..3
|
||||
on x=-49..-5,y=-3..45,z=-29..18
|
||||
off x=18..30,y=-20..-8,z=-3..13
|
||||
on x=-41..9,y=-7..43,z=-33..15
|
||||
on x=-54112..-39298,y=-85059..-49293,z=-27449..7877
|
||||
on x=967..23432,y=45373..81175,z=27513..53682
|
||||
60
2021/src/samples/22.2.txt
Normal file
60
2021/src/samples/22.2.txt
Normal file
@@ -0,0 +1,60 @@
|
||||
on x=-5..47,y=-31..22,z=-19..33
|
||||
on x=-44..5,y=-27..21,z=-14..35
|
||||
on x=-49..-1,y=-11..42,z=-10..38
|
||||
on x=-20..34,y=-40..6,z=-44..1
|
||||
off x=26..39,y=40..50,z=-2..11
|
||||
on x=-41..5,y=-41..6,z=-36..8
|
||||
off x=-43..-33,y=-45..-28,z=7..25
|
||||
on x=-33..15,y=-32..19,z=-34..11
|
||||
off x=35..47,y=-46..-34,z=-11..5
|
||||
on x=-14..36,y=-6..44,z=-16..29
|
||||
on x=-57795..-6158,y=29564..72030,z=20435..90618
|
||||
on x=36731..105352,y=-21140..28532,z=16094..90401
|
||||
on x=30999..107136,y=-53464..15513,z=8553..71215
|
||||
on x=13528..83982,y=-99403..-27377,z=-24141..23996
|
||||
on x=-72682..-12347,y=18159..111354,z=7391..80950
|
||||
on x=-1060..80757,y=-65301..-20884,z=-103788..-16709
|
||||
on x=-83015..-9461,y=-72160..-8347,z=-81239..-26856
|
||||
on x=-52752..22273,y=-49450..9096,z=54442..119054
|
||||
on x=-29982..40483,y=-108474..-28371,z=-24328..38471
|
||||
on x=-4958..62750,y=40422..118853,z=-7672..65583
|
||||
on x=55694..108686,y=-43367..46958,z=-26781..48729
|
||||
on x=-98497..-18186,y=-63569..3412,z=1232..88485
|
||||
on x=-726..56291,y=-62629..13224,z=18033..85226
|
||||
on x=-110886..-34664,y=-81338..-8658,z=8914..63723
|
||||
on x=-55829..24974,y=-16897..54165,z=-121762..-28058
|
||||
on x=-65152..-11147,y=22489..91432,z=-58782..1780
|
||||
on x=-120100..-32970,y=-46592..27473,z=-11695..61039
|
||||
on x=-18631..37533,y=-124565..-50804,z=-35667..28308
|
||||
on x=-57817..18248,y=49321..117703,z=5745..55881
|
||||
on x=14781..98692,y=-1341..70827,z=15753..70151
|
||||
on x=-34419..55919,y=-19626..40991,z=39015..114138
|
||||
on x=-60785..11593,y=-56135..2999,z=-95368..-26915
|
||||
on x=-32178..58085,y=17647..101866,z=-91405..-8878
|
||||
on x=-53655..12091,y=50097..105568,z=-75335..-4862
|
||||
on x=-111166..-40997,y=-71714..2688,z=5609..50954
|
||||
on x=-16602..70118,y=-98693..-44401,z=5197..76897
|
||||
on x=16383..101554,y=4615..83635,z=-44907..18747
|
||||
off x=-95822..-15171,y=-19987..48940,z=10804..104439
|
||||
on x=-89813..-14614,y=16069..88491,z=-3297..45228
|
||||
on x=41075..99376,y=-20427..49978,z=-52012..13762
|
||||
on x=-21330..50085,y=-17944..62733,z=-112280..-30197
|
||||
on x=-16478..35915,y=36008..118594,z=-7885..47086
|
||||
off x=-98156..-27851,y=-49952..43171,z=-99005..-8456
|
||||
off x=2032..69770,y=-71013..4824,z=7471..94418
|
||||
on x=43670..120875,y=-42068..12382,z=-24787..38892
|
||||
off x=37514..111226,y=-45862..25743,z=-16714..54663
|
||||
off x=25699..97951,y=-30668..59918,z=-15349..69697
|
||||
off x=-44271..17935,y=-9516..60759,z=49131..112598
|
||||
on x=-61695..-5813,y=40978..94975,z=8655..80240
|
||||
off x=-101086..-9439,y=-7088..67543,z=33935..83858
|
||||
off x=18020..114017,y=-48931..32606,z=21474..89843
|
||||
off x=-77139..10506,y=-89994..-18797,z=-80..59318
|
||||
off x=8476..79288,y=-75520..11602,z=-96624..-24783
|
||||
on x=-47488..-1262,y=24338..100707,z=16292..72967
|
||||
off x=-84341..13987,y=2429..92914,z=-90671..-1318
|
||||
off x=-37810..49457,y=-71013..-7894,z=-105357..-13188
|
||||
off x=-27365..46395,y=31009..98017,z=15428..76570
|
||||
off x=-70369..-16548,y=22648..78696,z=-1892..86821
|
||||
on x=-53470..21291,y=-120233..-33476,z=-44150..38147
|
||||
off x=-93533..-4276,y=-16170..68771,z=-104985..-24507
|
||||
5
2021/src/samples/23.txt
Normal file
5
2021/src/samples/23.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
#############
|
||||
#...........#
|
||||
###B#C#B#D###
|
||||
#A#D#C#A#
|
||||
#########
|
||||
9
2021/src/samples/25.txt
Normal file
9
2021/src/samples/25.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
v...>>.vv>
|
||||
.vv>>.vv..
|
||||
>>.>v>...v
|
||||
>>v>>.>.v.
|
||||
v>v.vv.v..
|
||||
>.>>..v...
|
||||
.vv..>.>v.
|
||||
v.v..>>v.v
|
||||
....v..v.>
|
||||
@@ -1,6 +1,6 @@
|
||||
# Advent of Code
|
||||
|
||||
[](https://travis-ci.org/bertptrs/adventofcode)
|
||||
[](https://github.com/bertptrs/adventofcode/actions/workflows/2021.yml)
|
||||
|
||||
This repository contains my solutions for Advent of Code. See:
|
||||
|
||||
@@ -10,3 +10,4 @@ This repository contains my solutions for Advent of Code. See:
|
||||
- [2018 edition](./2018)
|
||||
- [2019 edition](./2019)
|
||||
- [2020 edition](./2020)
|
||||
- [2021 edition](./2021)
|
||||
|
||||
Reference in New Issue
Block a user