29 Commits

Author SHA1 Message Date
Mikaël Capelle
2fb65387f7 Backup local 2022 day 16. 2023-12-05 20:16:27 +01:00
Mikael CAPELLE
8dbf0f101c 2023 day 5. 2023-12-05 13:41:17 +01:00
Mikaël Capelle
b8d8df06d6 2023 day 5 part 1. 2023-12-05 07:22:56 +01:00
Mikaël Capelle
825ebea299 Prepare 2023 days. 2023-12-04 19:32:41 +01:00
Mikaël Capelle
869cd4477f 2023 day 4. 2023-12-04 19:30:44 +01:00
Mikaël Capelle
fd777627d6 2023 day 3. 2023-12-03 09:09:25 +01:00
Mikaël Capelle
98f605f30e 2023 day 2. 2023-12-02 09:47:52 +01:00
Mikaël Capelle
d51fed283c Fix 2023 day 1. 2023-12-01 20:27:42 +01:00
Mikael CAPELLE
e991cd8b04 2023: Day 1. 2023-12-01 10:41:13 +01:00
Mikael CAPELLE
10f67e6bfd Post-christmas cleaning. 2023-01-06 13:48:18 +01:00
Mikaël Capelle
f291b0aa3f Day 25. 2022-12-25 11:34:49 +01:00
Mikaël Capelle
0eb5b5a88f Faster day 24. 2022-12-24 23:00:14 +01:00
Mikaël Capelle
2ec0a3d5f9 Day 24. 2022-12-24 20:50:37 +01:00
Mikael CAPELLE
0327a3f36a Add day 23. 2022-12-23 13:25:22 +01:00
Mikaël Capelle
3732e70ef7 Ugly day 22. 2022-12-22 23:00:36 +01:00
Mikaël Capelle
b0cc6b4a46 Update day 22. 2022-12-22 18:46:59 +01:00
Mikael CAPELLE
8c24b9f9e2 Update day 22. 2022-12-22 17:22:56 +01:00
Mikael CAPELLE
dca6f6a08f Update day 22. 2022-12-22 17:00:09 +01:00
Mikael CAPELLE
8d7a20f575 Day 22 part 1. 2022-12-22 14:10:30 +01:00
Mikael CAPELLE
3934dfd152 Start day 22. 2022-12-22 08:20:09 +01:00
Mikael CAPELLE
b656e8929e Remove tqdm from day 19. 2022-12-21 17:39:43 +01:00
Mikael CAPELLE
c9c69f479b Day 21. 2022-12-21 09:44:05 +01:00
Mikaël Capelle
72ebcfff1f Clean day 20. 2022-12-20 23:39:26 +01:00
Mikaël Capelle
dd72bb3238 Add empty files for following days. 2022-12-20 21:51:38 +01:00
Mikael CAPELLE
c1dd74c57d Faster day 20. 2022-12-20 18:27:09 +01:00
Mikael CAPELLE
1bf2de62c7 Day 20, slow. 2022-12-20 13:39:36 +01:00
Mikael CAPELLE
df808bc98a Start day 20. 2022-12-20 12:35:01 +01:00
Mikaël Capelle
f46e190e98 Add all tests from previous days. 2022-12-19 22:32:15 +01:00
Mikaël Capelle
7f4a34b2d7 Day 19. 2022-12-19 22:09:20 +01:00
118 changed files with 10880 additions and 451 deletions

View File

@@ -2,19 +2,8 @@
import sys
lines = sys.stdin.readlines()
blocks = sys.stdin.read().split("\n\n")
values = sorted(sum(map(int, block.split())) for block in blocks)
# we store the list of calories for each elf in values, and we use the last element
# of values to accumulate
values: list[int] = [0]
for line in lines:
if not line.strip():
values = values + [0]
else:
values[-1] += int(line.strip())
# part 1
print(f"answer 1 is {max(values)}")
# part 2
print(f"answer 2 is {sum(sorted(values)[-3:])}")
print(f"answer 1 is {values[-1]}")
print(f"answer 2 is {sum(values[-3:])}")

View File

@@ -6,10 +6,11 @@ import heapq
import itertools
import re
import sys
import time as time_p
from collections import defaultdict
from typing import FrozenSet, NamedTuple
from tqdm import tqdm
from tqdm import tqdm, trange
class Pipe(NamedTuple):
@@ -106,21 +107,128 @@ def part_1(
def part_2(
start_pipe: Pipe,
max_time: int,
distances: dict[tuple[Pipe, Pipe], int],
pipes: dict[str, Pipe],
relevant_pipes: FrozenSet[Pipe],
distances: dict[tuple[Pipe, Pipe], int],
):
def compute(pipes_for_me: FrozenSet[Pipe]) -> int:
return part_1(start_pipe, max_time, distances, pipes_for_me) + part_1(
start_pipe, max_time, distances, relevant_pipes - pipes_for_me
node_at_times: dict[
int, dict[tuple[Pipe, Pipe], dict[FrozenSet[Pipe], int]]
] = defaultdict(lambda: defaultdict(lambda: defaultdict(lambda: 0)))
node_at_times[0] = {(start_pipe, start_pipe): {frozenset(): 0}}
# map node + distance to
d1, d2, d3, d4 = 0, 0, 0, 0
best_flow = 0
for time in range(max_time):
print(
f"{time + 1:2d}/{max_time} - {best_flow:4d} - "
f"{sum(map(len, node_at_times[time].values())):7d} - "
f"{d1:.3f} {d2:.3f} {d3:.3f} {d4:.3f}"
)
combs = [
frozenset(relevant_pipes_1)
for r in range(2, len(relevant_pipes) // 2 + 1)
for relevant_pipes_1 in itertools.combinations(relevant_pipes, r)
]
d1, d2, d3, d4 = 0, 0, 0, 0
for (c_pipe, e_pipe), nodes in node_at_times[time].items():
for flowing, flow in nodes.items():
return max(compute(comb) for comb in tqdm(combs))
t1 = time_p.time()
c_best_flow = (
flow
+ sum(pipe.flow for pipe in flowing) * (max_time - time)
+ sum(
(
pipe.flow
* (
max_time
- time
- 1
- min(distances[c_pipe, pipe], distances[e_pipe, pipe])
)
for pipe in relevant_pipes
if pipe not in flowing
),
start=0,
)
)
d1 += time_p.time() - t1
if c_best_flow < best_flow:
continue
best_flow = max(
best_flow,
flow + sum(pipe.flow for pipe in flowing) * (max_time - time),
)
t1 = time_p.time()
if flowing != relevant_pipes:
for c_next_s, e_next_s in itertools.product(
c_pipe.tunnels, e_pipe.tunnels
):
c_next = pipes[c_next_s]
e_next = pipes[e_next_s]
update_with_better(
node_at_times[time + 1][c_next, e_next],
flow + sum(pipe.flow for pipe in flowing),
flowing,
)
d2 += time_p.time() - t1
t1 = time_p.time()
if c_pipe in relevant_pipes and c_pipe not in flowing:
for e_next_s in e_pipe.tunnels:
e_next = pipes[e_next_s]
update_with_better(
node_at_times[time + 1][c_pipe, e_next],
flow + sum(pipe.flow for pipe in flowing),
flowing | {c_pipe},
)
if e_pipe in relevant_pipes and e_pipe not in flowing:
for c_next_s in c_pipe.tunnels:
c_next = pipes[c_next_s]
update_with_better(
node_at_times[time + 1][c_next, e_pipe],
flow + sum(pipe.flow for pipe in flowing),
flowing | {e_pipe},
)
if (
e_pipe in relevant_pipes
and c_pipe in relevant_pipes
and e_pipe not in flowing
and c_pipe not in flowing
):
update_with_better(
node_at_times[time + 1][c_pipe, e_pipe],
flow + sum(pipe.flow for pipe in flowing),
flowing | {c_pipe, e_pipe},
)
update_with_better(
node_at_times[max_time][c_pipe, e_pipe],
flow + sum(pipe.flow for pipe in flowing) * (max_time - time),
flowing,
)
d3 += time_p.time() - t1
return max(
flow
for nodes_of_pipe in node_at_times[max_time].values()
for flow in nodes_of_pipe.values()
)
# === MAIN ===
@@ -159,4 +267,4 @@ relevant_pipes = frozenset(pipe for pipe in pipes.values() if pipe.flow > 0)
print(part_1(pipes["AA"], 30, distances, relevant_pipes))
# 1707, 2223
print(part_2(pipes["AA"], 26, distances, relevant_pipes))
print(part_2(pipes["AA"], 26, pipes, relevant_pipes, distances))

View File

@@ -1,17 +1,14 @@
# -*- encoding: utf-8 -*-
import heapq
import math
import sys
import time
from collections import defaultdict
from typing import Literal, TypedDict
from typing import Literal
import numpy as np
import parse
from tqdm import tqdm
Reagent = Literal["ore", "clay", "obsidian", "geode"]
REAGENTS: tuple[Reagent] = (
REAGENTS: tuple[Reagent, ...] = (
"ore",
"clay",
"obsidian",
@@ -20,23 +17,6 @@ REAGENTS: tuple[Reagent] = (
IntOfReagent = dict[Reagent, int]
lines = sys.stdin.read().splitlines()
blueprints: list[dict[Reagent, IntOfReagent]] = [
{
"ore": {"ore": 4},
"clay": {"ore": 2},
"obsidian": {"ore": 3, "clay": 14},
"geode": {"ore": 2, "obsidian": 7},
},
{
"ore": {"ore": 2},
"clay": {"ore": 3},
"obsidian": {"ore": 3, "clay": 8},
"geode": {"ore": 3, "obsidian": 12},
},
]
class State:
robots: IntOfReagent
@@ -64,11 +44,6 @@ class State:
and self.reagents == other.reagents
)
def __lt__(self, other) -> bool:
return isinstance(other, State) and tuple(
(self.robots[r], self.reagents[r]) for r in REAGENTS
) > tuple((other.robots[r], other.reagents[r]) for r in REAGENTS)
def __hash__(self) -> int:
return hash(tuple((self.robots[r], self.reagents[r]) for r in REAGENTS))
@@ -89,245 +64,45 @@ def dominates(lhs: State, rhs: State):
)
MAX_TIME = 24
blueprint = blueprints[1]
lines = sys.stdin.read().splitlines()
# parents: dict[State, tuple[State | None, int]] = {State(): (None, 0)}
# queue = [(0, State())]
# visited: set[State] = set()
# at_time: dict[int, list[State]] = defaultdict(lambda: [])
blueprints: list[dict[Reagent, IntOfReagent]] = []
for line in lines:
r = parse.parse(
"Blueprint {}: "
"Each ore robot costs {:d} ore. "
"Each clay robot costs {:d} ore. "
"Each obsidian robot costs {:d} ore and {:d} clay. "
"Each geode robot costs {:d} ore and {:d} obsidian.",
line,
)
# while queue:
# time, state = heapq.heappop(queue)
# if state in visited:
# continue
# print(time, state)
# visited.add(state)
# at_time[time].append(state)
# if time > MAX_TIME:
# continue
# if len(queue) % 200 == 0:
# print(len(queue), len(visited), time)
# can_build_any: bool = False
# for reagent in REAGENTS:
# needed = blueprint[reagent]
# if any(state.robots[r] == 0 for r in needed):
# continue
# time_to_complete = max(
# max(
# math.ceil((needed[r] - state.reagents[r]) / state.robots[r])
# for r in needed
# ),
# 0,
# )
# # if time_to_complete != 0:
# # continue
# if time + time_to_complete + 1 > MAX_TIME:
# continue
# wait = time_to_complete + 1
# reagents = {
# r: state.reagents[r] + wait * state.robots[r] - needed.get(r, 0)
# for r in REAGENTS
# }
# robots = state.robots.copy()
# robots[reagent] += 1
# state_2 = State(reagents=reagents, robots=robots)
# if state_2 in visited:
# continue
# if any(dominates(state_v, state_2) for state_v in at_time[time + wait]):
# continue
# # print(time + wait)
# # if any(dominates(state_3, state_2) for state_3 in at_time[time + wait]):
# # print("?")
# # continue
# if state_2 not in parents or parents[state_2][1] > time + wait:
# parents[state_2] = (state, time + wait)
# heapq.heappush(queue, (time + wait, state_2))
# can_build_any = True
# at_time[time + wait].append(state_2)
# if not can_build_any:
# state_2 = State(
# reagents={
# r: state.reagents[r] + state.robots[r] * (MAX_TIME - time)
# for r in REAGENTS
# },
# robots=state.robots,
# )
# if state_2 in visited:
# continue
# if state_2 not in parents or parents[state_2][1] > time + wait:
# parents[state_2] = (state, MAX_TIME)
# heapq.heappush(queue, (MAX_TIME, state_2))
# print(len(visited))
# print(max(state.reagents["geode"] for state in visited))
# exit()
# while states:
# state = states.pop()
# processed.append(state)
# if state.time > MAX_TIME:
# continue
# if len(states) % 100 == 0:
# print(len(states), len(processed), min((s.time for s in states), default=1))
# can_build_any: bool = False
# for reagent in REAGENTS:
# needed = blueprint[reagent]
# if any(state.robots[r] == 0 for r in needed):
# continue
# time_to_complete = max(
# max(
# math.ceil((needed[r] - state.reagents[r]) / state.robots[r])
# for r in needed
# ),
# 0,
# )
# if state.time + time_to_complete + 1 > MAX_TIME:
# continue
# wait = time_to_complete + 1
# reagents = {
# r: state.reagents[r] + wait * state.robots[r] - needed.get(r, 0)
# for r in REAGENTS
# }
# robots = state.robots.copy()
# robots[reagent] += 1
# can_build_any = True
# state_2 = State(time=state.time + wait, reagents=reagents, robots=robots)
# # print(f"{state} -> {state_2}")
# states.add(state_2)
# if not any(dominates(s2, state_2) for s2 in states):
# states.add(state)
# # print(f"can build {reagent} in {time_to_complete}")
# if not can_build_any:
# states.add(
# State(
# time=MAX_TIME + 1,
# reagents={
# r: state.reagents[r] + state.robots[r] * (MAX_TIME - state.time)
# for r in REAGENTS
# },
# robots=state.robots,
# )
# )
# if len(states) % 1000 == 0:
# print("filtering")
# states = {
# s1
# for s1 in states
# if not any(dominates(s2, s1) for s2 in states if s2 is not s1)
# }
# # if len(states) > 4:
# # break
# # break
# print(len(processed))
# print(max(state.reagents["geode"] for state in processed))
# exit()
# for t in range(1, 25):
# states = set()
# for state in state_after_t[t - 1]:
# robots_that_can_be_built = [
# robot
# for robot in REAGENTS
# if all(
# state.reagents[reagent] >= blueprint[robot].get(reagent, 0)
# for reagent in REAGENTS
# )
# ]
# new_states = set()
# # new reagents
# reagents = {
# reagent: state.reagents[reagent] + state.robots[reagent]
# for reagent in REAGENTS
# }
# # if we can build anything, there is no point in waiting
# if len(robots_that_can_be_built) != len(REAGENTS):
# new_states.add(State(robots=state.robots, reagents=reagents))
# for robot in robots_that_can_be_built:
# robots = state.robots.copy()
# robots[robot] += 1
# reagents = {
# reagent: state.reagents[reagent]
# + state.robots[reagent]
# - blueprint[robot].get(reagent, 0)
# for reagent in REAGENTS
# }
# new_states.add(State(robots=robots, reagents=reagents))
# new_states = [
# s1
# for s1 in new_states
# if not any(s1 is not s2 and dominates(s2, s1) for s2 in new_states)
# ]
# states = {
# s1 for s1 in states if not any(dominates(s2, s1) for s2 in new_states)
# }
# states.update(new_states)
# state_after_t[t] = states
# exit()
blueprints.append(
{
"ore": {"ore": r[1]},
"clay": {"ore": r[2]},
"obsidian": {"ore": r[3], "clay": r[4]},
"geode": {"ore": r[5], "obsidian": r[6]},
}
)
MAX_TIME = 24
blueprint = blueprints[0]
def run(blueprint: dict[Reagent, dict[Reagent, int]], max_time: int) -> int:
state_after_t: dict[int, list[State]] = {0: [State()]}
# since we can only build one robot per time, we do not need more than X robots
# of type K where X is the maximum number of K required among all robots, e.g.,
# in the first toy blueprint, we need at most 4 ore robots, 14 clay ones and 7
# obsidian ones
maximums = {
name: max(blueprint[r].get(name, 0) for r in REAGENTS) for name in REAGENTS
}
for t in range(1, 25):
print(t, len(state_after_t[t - 1]))
state_after_t: dict[int, set[State]] = {0: [State()]}
bests_for_robots: dict[tuple[int, ...], list[State]] = {}
bests_for_reagents: dict[tuple[int, ...], list[State]] = {}
for t in range(1, max_time + 1):
state_after_t[t] = []
t1 = time.time()
# list of new states at the end of step t that we are going to prune later
states_for_t: set[State] = set()
for state in state_after_t[t - 1]:
robots_that_can_be_built = [
@@ -339,17 +114,24 @@ for t in range(1, 25):
)
]
# print(t, robots_that_can_be_built)
new_states: set[State] = set()
# new reagents
states_for_t.add(
State(
robots=state.robots,
reagents={
reagent: state.reagents[reagent] + state.robots[reagent]
for reagent in REAGENTS
}
},
)
)
# if we can build anything, there is no point in waiting
new_states.add(State(robots=state.robots, reagents=reagents))
if "geode" in robots_that_can_be_built:
robots_that_can_be_built = ["geode"]
else:
robots_that_can_be_built = [
robot
for robot in robots_that_can_be_built
if state.robots[robot] < maximums[robot]
]
for robot in robots_that_can_be_built:
robots = state.robots.copy()
@@ -360,128 +142,45 @@ for t in range(1, 25):
- blueprint[robot].get(reagent, 0)
for reagent in REAGENTS
}
new_states.add(State(robots=robots, reagents=reagents))
for s1 in new_states:
r1 = tuple(s1.robots[r] for r in REAGENTS)
if r1 not in bests_for_robots:
bests_for_robots[r1] = [s1]
else:
is_dominated = False
for s2 in bests_for_robots[r1]:
if all(s2.reagents[r] >= s1.reagents[r] for r in REAGENTS):
is_dominated = True
break
if not is_dominated:
bests_for_robots[r1].append(s1)
r2 = tuple(s1.reagents[r] for r in REAGENTS)
if r2 not in bests_for_reagents:
bests_for_reagents[r2] = [s1]
else:
is_dominated = False
for s2 in bests_for_reagents[r2]:
if all(s2.robots[r] >= s1.robots[r] for r in REAGENTS):
is_dominated = True
break
if not is_dominated:
bests_for_reagents[r2].append(s1)
# state_after_t[t].extend(new_states)
t2 = time.time()
for bests in bests_for_robots.values():
dominated = [False for _ in range(len(bests))]
for i_s1, s1 in enumerate(bests):
if dominated[i_s1]:
continue
for i_s2, s2 in enumerate(bests[i_s1 + 1 :], start=i_s1 + 1):
if dominated[i_s2]:
continue
if all(s1.reagents[r] >= s2.reagents[r] for r in REAGENTS):
dominated[i_s2] = True
state_after_t[t].extend(
s1 for i_s1, s1 in enumerate(bests) if not dominated[i_s1]
)
for bests in bests_for_reagents.values():
dominated = [False for _ in range(len(bests))]
for i_s1, s1 in enumerate(bests):
if dominated[i_s1]:
continue
for i_s2, s2 in enumerate(bests[i_s1 + 1 :], start=i_s1 + 1):
if dominated[i_s2]:
continue
if all(s1.robots[r] >= s2.robots[r] for r in REAGENTS):
dominated[i_s2] = True
state_after_t[t].extend(
s1 for i_s1, s1 in enumerate(bests) if not dominated[i_s1]
)
t3 = time.time()
states_for_t.add(State(robots=robots, reagents=reagents))
# use numpy to switch computation of dominated states -> store each state
# as a 8 array and use numpy broadcasting to find dominated states
states_after = np.asarray(list(states_for_t))
np_states = np.array(
[
[state.robots[r] for r in REAGENTS] + [state.reagents[r] for r in REAGENTS]
for state in state_after_t[t]
[state.robots[r] for r in REAGENTS]
+ [state.reagents[r] for r in REAGENTS]
for state in states_after
]
)
dominated = np.zeros(len(np_states), dtype=bool)
t4 = time.time()
to_keep = []
while len(np_states) > 0:
first_dom = (np_states[1:] >= np_states[0]).all(axis=1).any()
# c = (np_states[None, :, :] <= np_states[:, None, :]).all(axis=-1)
# c[np.arange(len(np_states)), np.arange(len(np_states))] = False
# dominated = c.any(axis=0)
if first_dom:
np_states = np_states[1:]
else:
to_keep.append(np_states[0])
np_states = np_states[1:][~(np_states[1:] <= np_states[0]).all(axis=1)]
for i in range(len(np_states)):
if dominated[i]:
continue
dominated[i] = not (np_states[i + 1 :] <= np_states[i]).any(axis=1)
dominated[i + 1 :] = (np_states[i + 1 :] <= np_states[i]).all(axis=1)
t5 = time.time()
state_after_t[t] = list(np.array(state_after_t[t])[~dominated])
t6 = time.time()
print(
"->",
t,
len(state_after_t[t]),
dominated.sum(),
t2 - t1,
t3 - t2,
t4 - t3,
t5 - t4,
t6 - t5,
state_after_t[t] = {
State(
robots=dict(zip(REAGENTS, row[:4])),
reagents=dict(zip(REAGENTS, row[4:])),
)
for row in to_keep
}
# print("->", len(state_after_t[t]))
return max(state.reagents["geode"] for state in state_after_t[max_time])
# dominated = [False for _ in range(len(state_after_t[t]))]
# keep = set()
# for i_s1, s1 in enumerate(tqdm(state_after_t[t])):
# if dominated[i_s1]:
# continue
# for i_s2, s2 in enumerate(state_after_t[t][i_s1 + 1 :], start=i_s1 + 1):
# if dominated[i_s2]:
# continue
# if dominates(s1, s2):
# dominated[i_s2] = True
# elif dominates(s2, s1):
# dominated[i_s1] = True
# break
answer_1 = sum(
(i_blueprint + 1) * run(blueprint, 24)
for i_blueprint, blueprint in enumerate(blueprints)
)
print(f"answer 1 is {answer_1}")
# if not dominated[i_s1]:
# keep.add(s1)
# state_after_t[t] = list(keep)
# print(len(state_after_t[t]))
# print(sum(dominated))
# break
print(max(state.reagents["geode"] for state in state_after_t[24]))
answer_2 = run(blueprints[0], 32) * run(blueprints[1], 32) * run(blueprints[2], 32)
print(f"answer 2 is {answer_2}")

View File

@@ -2,19 +2,6 @@
import sys
lines = sys.stdin.readlines()
# the solution relies on replacing rock / paper / scissor by values 0 / 1 / 2 and using
# modulo-3 arithmetic
#
# in modulo-3 arithmetic, the winning move is 1 + the opponent move (e.g., winning move
# if opponent plays 0 is 1, or 0 if opponent plays 2 (0 = (2 + 1 % 3)))
#
# we read the lines in a Nx2 in array with value 0/1/2 instead of A/B/C or X/Y/Z for
# easier manipulation
values = [(ord(row[0]) - ord("A"), ord(row[2]) - ord("X")) for row in lines]
def score_1(ux: int, vx: int) -> int:
# here ux and vx are both moves: 0 = rock, 1 = paper, 2 = scissor
@@ -48,6 +35,19 @@ def score_2(ux: int, vx: int) -> int:
return (ux + vx - 1) % 3 + 1 + vx * 3
lines = sys.stdin.readlines()
# the solution relies on replacing rock / paper / scissor by values 0 / 1 / 2 and using
# modulo-3 arithmetic
#
# in modulo-3 arithmetic, the winning move is 1 + the opponent move (e.g., winning move
# if opponent plays 0 is 1, or 0 if opponent plays 2 (0 = (2 + 1 % 3)))
#
# we read the lines in a Nx2 in array with value 0/1/2 instead of A/B/C or X/Y/Z for
# easier manipulation
values = [(ord(row[0]) - ord("A"), ord(row[2]) - ord("X")) for row in lines]
# part 1 - 13526
print(f"score 1 is {sum(score_1(*v) for v in values)}")

77
2022/day20.py Normal file
View File

@@ -0,0 +1,77 @@
# -*- encoding: utf-8 -*-
from __future__ import annotations
import sys
class Number:
current: int
value: int
def __init__(self, value: int):
self.current = 0
self.value = value
def __str__(self):
return str(self.value)
def __repr__(self):
return str(self)
def decrypt(numbers: list[Number], key: int, rounds: int) -> int:
numbers = numbers.copy()
original = numbers.copy()
for index, number in enumerate(numbers):
number.current = index
for _ in range(rounds):
for number in original:
index = number.current
offset = (number.value * key) % (len(numbers) - 1)
target = index + offset
# need to wrap
if target >= len(numbers):
target = offset - (len(numbers) - index) + 1
for number_2 in numbers[target:index]:
number_2.current += 1
numbers = (
numbers[:target]
+ [number]
+ numbers[target:index]
+ numbers[index + 1 :]
)
else:
for number_2 in numbers[index : target + 1]:
number_2.current -= 1
numbers = (
numbers[:index]
+ numbers[index + 1 : target + 1]
+ [number]
+ numbers[target + 1 :]
)
number.current = target
index_of_0 = next(
filter(lambda index: numbers[index].value == 0, range(len(numbers)))
)
return sum(
numbers[(index_of_0 + offset) % len(numbers)].value * key
for offset in (1000, 2000, 3000)
)
numbers = [Number(int(x)) for i, x in enumerate(sys.stdin.readlines())]
answer_1 = decrypt(numbers, 1, 1)
print(f"answer 1 is {answer_1}")
answer_2 = decrypt(numbers, 811589153, 10)
print(f"answer 2 is {answer_2}")

109
2022/day21.py Normal file
View File

@@ -0,0 +1,109 @@
# -*- encoding: utf-8 -*-
import operator
import sys
from typing import Callable
def compute(monkeys: dict[str, int | tuple[str, str, str]], monkey: str) -> int:
value = monkeys[monkey]
if isinstance(value, int):
return value
else:
op: dict[str, Callable[[int, int], int]] = {
"+": operator.add,
"-": operator.sub,
"*": operator.mul,
"/": operator.floordiv,
}
value = op[value[1]](compute(monkeys, value[0]), compute(monkeys, value[2]))
monkeys[monkey] = value
return value
def invert(
monkeys: dict[str, int | tuple[str, str, str]], monkey: str, target: int
) -> dict[str, int | tuple[str, str, str]]:
"""
Revert the given mapping from monkey name to value or operation such that
the value from 'monkey' is computable by inverting operation until the root is
found.
Args:
monkeys: Dictionary of monkeys, that will be updated and returned.
monkey: Name of the monkey to start from.
target: Target value to set for the monkey that depends on root.
Returns:
The given dictionary of monkeys.
"""
monkeys = monkeys.copy()
depends: dict[str, str] = {}
for m, v in monkeys.items():
if isinstance(v, int):
continue
op1, _, op2 = v
assert op1 not in depends
assert op2 not in depends
depends[op1] = m
depends[op2] = m
invert_op = {"+": "-", "-": "+", "*": "/", "/": "*"}
current = monkey
while True:
dep = depends[current]
if dep == "root":
monkeys[current] = target
break
val = monkeys[dep]
assert not isinstance(val, int)
op1, ope, op2 = val
if op1 == current:
monkeys[current] = (dep, invert_op[ope], op2)
elif ope in ("+", "*"):
monkeys[current] = (dep, invert_op[ope], op1)
else:
monkeys[current] = (op1, ope, dep)
current = dep
return monkeys
lines = sys.stdin.read().splitlines()
monkeys: dict[str, int | tuple[str, str, str]] = {}
op_monkeys: set[str] = set()
for line in lines:
parts = line.split(":")
name = parts[0].strip()
try:
value = int(parts[1].strip())
monkeys[name] = value
except ValueError:
op1, ope, op2 = parts[1].strip().split()
monkeys[name] = (op1, ope, op2)
op_monkeys.add(name)
answer_1 = compute(monkeys.copy(), "root")
print(f"answer 1 is {answer_1}")
# assume the second operand of 'root' can be computed, and the first one depends on
# humn, which is the case is my input and the test input
p1, _, p2 = monkeys["root"] # type: ignore
answer_2 = compute(invert(monkeys, "humn", compute(monkeys.copy(), p2)), "humn")
print(f"answer 2 is {answer_2}")

226
2022/day22.py Normal file
View File

@@ -0,0 +1,226 @@
# -*- encoding: utf-8 -*-
import re
import sys
from typing import Callable
import numpy as np
VOID, EMPTY, WALL = 0, 1, 2
TILE_FROM_CHAR = {" ": VOID, ".": EMPTY, "#": WALL}
SCORES = {"E": 0, "S": 1, "W": 2, "N": 3}
board_map_s, direction_s = sys.stdin.read().split("\n\n")
# board
board_lines = board_map_s.splitlines()
max_line = max(len(line) for line in board_lines)
board = np.array(
[
[TILE_FROM_CHAR[c] for c in row] + [VOID] * (max_line - len(row))
for row in board_map_s.splitlines()
]
)
directions = [
int(p1) if p2 else p1 for p1, p2 in re.findall(R"(([0-9])+|L|R)", direction_s)
]
# find on each row and column the first and last non-void
row_first_non_void = np.argmax(board != VOID, axis=1)
row_last_non_void = board.shape[1] - np.argmax(board[:, ::-1] != VOID, axis=1) - 1
col_first_non_void = np.argmax(board != VOID, axis=0)
col_last_non_void = board.shape[0] - np.argmax(board[::-1, :] != VOID, axis=0) - 1
faces = np.zeros_like(board)
size = np.gcd(board.shape[0], board.shape[1])
for row in range(0, board.shape[0], size):
for col in range(row_first_non_void[row], row_last_non_void[row], size):
faces[row : row + size, col : col + size] = faces.max() + 1
SIZE = np.gcd(*board.shape)
# TODO: deduce this from the actual cube...
faces_wrap: dict[int, dict[str, Callable[[int, int], tuple[int, int, str]]]]
if board.shape == (12, 16): # example
faces_wrap = {
1: {
"W": lambda y, x: (4, 4 + y, "S"), # 3N
"N": lambda y, x: (4, 11 - x, "S"), # 2N
"E": lambda y, x: (11 - y, 15, "W"), # 6E
},
2: {
"W": lambda y, x: (11, 19 - y, "N"), # 6S
"N": lambda y, x: (0, 11 - y, "S"), # 1N
"S": lambda y, x: (11, 11 - x, "N"), # 5S
},
3: {
"N": lambda y, x: (x - 4, 8, "E"), # 1W
"S": lambda y, x: (15 - x, 8, "E"), # 5W
},
4: {"E": lambda y, x: (8, 19 - y, "S")}, # 6N
5: {
"W": lambda y, x: (7, 15 - y, "N"), # 3S
"S": lambda y, x: (7, 11 - x, "N"), # 2S
},
6: {
"N": lambda y, x: (19 - x, 11, "W"), # 4E
"E": lambda y, x: (11 - y, 11, "W"), # 1E
"S": lambda y, x: (19 - x, 0, "E"), # 2W
},
}
else:
faces_wrap = {
1: {
"W": lambda y, x: (3 * SIZE - y - 1, 0, "E"), # 4W
"N": lambda y, x: (2 * SIZE + x, 0, "E"), # 6W
},
2: {
"N": lambda y, x: (4 * SIZE - 1, x - 2 * SIZE, "N"), # 6S
"E": lambda y, x: (3 * SIZE - y - 1, 2 * SIZE - 1, "W"), # 5E
"S": lambda y, x: (x - SIZE, 2 * SIZE - 1, "W"), # 3E
},
3: {
"W": lambda y, x: (2 * SIZE, y - SIZE, "S"), # 4N
"E": lambda y, x: (SIZE - 1, SIZE + y, "N"), # 2S
},
4: {
"W": lambda y, x: (3 * SIZE - y - 1, SIZE, "E"), # 1W
"N": lambda y, x: (SIZE + x, SIZE, "E"), # 3W
},
5: {
"E": lambda y, x: (3 * SIZE - y - 1, 3 * SIZE - 1, "W"), # 2E
"S": lambda y, x: (2 * SIZE + x, SIZE - 1, "W"), # 6E
},
6: {
"W": lambda y, x: (0, y - 2 * SIZE, "S"), # 1N
"E": lambda y, x: (3 * SIZE - 1, y - 2 * SIZE, "N"), # 5S
"S": lambda y, x: (0, x + 2 * SIZE, "S"), # 2N
},
}
def wrap_part_1(y0: int, x0: int, r0: str) -> tuple[int, int, str]:
if r0 == "E":
return y0, row_first_non_void[y0], r0
elif r0 == "S":
return col_first_non_void[x0], x0, r0
elif r0 == "W":
return y0, row_last_non_void[y0], r0
elif r0 == "N":
return col_last_non_void[x0], x0, r0
assert False
def wrap_part_2(y0: int, x0: int, r0: str) -> tuple[int, int, str]:
cube = faces[y0, x0]
assert r0 in faces_wrap[cube]
return faces_wrap[cube][r0](y0, x0)
def run(wrap: Callable[[int, int, str], tuple[int, int, str]]) -> tuple[int, int, str]:
y0 = 0
x0 = np.where(board[0] == EMPTY)[0][0]
r0 = "E"
for direction in directions:
if isinstance(direction, int):
while direction > 0:
if r0 == "E":
xi = np.where(board[y0, x0 + 1 : x0 + direction + 1] == WALL)[0]
if len(xi):
x0 = x0 + xi[0]
direction = 0
elif (
x0 + direction < board.shape[1]
and board[y0, x0 + direction] == EMPTY
):
x0 = x0 + direction
direction = 0
else:
y0_t, x0_t, r0_t = wrap(y0, x0, r0)
if board[y0_t, x0_t] == WALL:
x0 = row_last_non_void[y0]
direction = 0
else:
direction = direction - (row_last_non_void[y0] - x0) - 1
y0, x0, r0 = y0_t, x0_t, r0_t
elif r0 == "S":
yi = np.where(board[y0 + 1 : y0 + direction + 1, x0] == WALL)[0]
if len(yi):
y0 = y0 + yi[0]
direction = 0
elif (
y0 + direction < board.shape[0]
and board[y0 + direction, x0] == EMPTY
):
y0 = y0 + direction
direction = 0
else:
y0_t, x0_t, r0_t = wrap(y0, x0, r0)
if board[y0_t, x0_t] == WALL:
y0 = col_last_non_void[x0]
direction = 0
else:
direction = direction - (col_last_non_void[x0] - y0) - 1
y0, x0, r0 = y0_t, x0_t, r0_t
elif r0 == "W":
left = max(x0 - direction - 1, 0)
xi = np.where(board[y0, left:x0] == WALL)[0]
if len(xi):
x0 = left + xi[-1] + 1
direction = 0
elif x0 - direction >= 0 and board[y0, x0 - direction] == EMPTY:
x0 = x0 - direction
direction = 0
else:
y0_t, x0_t, r0_t = wrap(y0, x0, r0)
if board[y0_t, x0_t] == WALL:
x0 = row_first_non_void[y0]
direction = 0
else:
direction = direction - (x0 - row_first_non_void[y0]) - 1
y0, x0, r0 = y0_t, x0_t, r0_t
elif r0 == "N":
top = max(y0 - direction - 1, 0)
yi = np.where(board[top:y0, x0] == WALL)[0]
if len(yi):
y0 = top + yi[-1] + 1
direction = 0
elif y0 - direction >= 0 and board[y0 - direction, x0] == EMPTY:
y0 = y0 - direction
direction = 0
else:
y0_t, x0_t, r0_t = wrap(y0, x0, r0)
if board[y0_t, x0_t] == WALL:
y0 = col_first_non_void[x0]
direction = 0
else:
direction = direction - (y0 - col_first_non_void[x0]) - 1
y0, x0, r0 = y0_t, x0_t, r0_t
else:
r0 = {
"E": {"L": "N", "R": "S"},
"N": {"L": "W", "R": "E"},
"W": {"L": "S", "R": "N"},
"S": {"L": "E", "R": "W"},
}[r0][direction]
return y0, x0, r0
y1, x1, r1 = run(wrap_part_1)
answer_1 = 1000 * (1 + y1) + 4 * (1 + x1) + SCORES[r1]
print(f"answer 1 is {answer_1}")
y2, x2, r2 = run(wrap_part_2)
answer_2 = 1000 * (1 + y2) + 4 * (1 + x2) + SCORES[r2]
print(f"answer 2 is {answer_2}")

105
2022/day23.py Normal file
View File

@@ -0,0 +1,105 @@
# -*- encoding: utf-8 -*-
import itertools
import sys
from collections import defaultdict
Directions = list[
tuple[
str, tuple[int, int], tuple[tuple[int, int], tuple[int, int], tuple[int, int]]
]
]
# (Y, X)
DIRECTIONS: Directions = [
("N", (-1, 0), ((-1, -1), (-1, 0), (-1, 1))),
("S", (1, 0), ((1, -1), (1, 0), (1, 1))),
("W", (0, -1), ((-1, -1), (0, -1), (1, -1))),
("E", (0, 1), ((-1, 1), (0, 1), (1, 1))),
]
def min_max_yx(positions: set[tuple[int, int]]) -> tuple[int, int, int, int]:
ys, xs = {y for y, x in positions}, {x for y, x in positions}
return min(ys), min(xs), max(ys), max(xs)
def print_positions(positions: set[tuple[int, int]]):
min_y, min_x, max_y, max_x = min_max_yx(positions)
print(
"\n".join(
"".join(
"#" if (y, x) in positions else "." for x in range(min_x - 1, max_x + 2)
)
for y in range(min_y - 1, max_y + 2)
)
)
def round(
positions: set[tuple[int, int]],
directions: Directions,
):
to_move: dict[tuple[int, int], list[tuple[int, int]]] = defaultdict(lambda: [])
for (y, x) in positions:
elves = {
(dy, dx): (y + dy, x + dx) in positions
for dy, dx in itertools.product((-1, 0, 1), (-1, 0, 1))
if (dy, dx) != (0, 0)
}
if not any(elves.values()):
to_move[y, x].append((y, x))
continue
found: str | None = None
for d, (dy, dx), d_yx_check in directions:
if not any(elves[dy, dx] for dy, dx in d_yx_check):
found = d
to_move[y + dy, x + dx].append((y, x))
break
if found is None:
to_move[y, x].append((y, x))
positions.clear()
for ty, tx in to_move:
if len(to_move[ty, tx]) > 1:
positions.update(to_move[ty, tx])
else:
positions.add((ty, tx))
directions.append(directions.pop(0))
POSITIONS = {
(i, j)
for i, row in enumerate(sys.stdin.read().splitlines())
for j, col in enumerate(row)
if col == "#"
}
# === part 1 ===
p1, d1 = POSITIONS.copy(), DIRECTIONS.copy()
for r in range(10):
round(p1, d1)
min_y, min_x, max_y, max_x = min_max_yx(p1)
answer_1 = sum(
(y, x) not in p1 for y in range(min_y, max_y + 1) for x in range(min_x, max_x + 1)
)
print(f"answer 1 is {answer_1}")
# === part 2 ===
p2, d2 = POSITIONS.copy(), DIRECTIONS.copy()
answer_2 = 0
while True:
answer_2 += 1
backup = p2.copy()
round(p2, d2)
if backup == p2:
break
print(f"answer 2 is {answer_2}")

100
2022/day24.py Normal file
View File

@@ -0,0 +1,100 @@
# -*- encoding: utf-8 -*-
import heapq
import math
import sys
from collections import defaultdict
lines = sys.stdin.read().splitlines()
winds = {
(i - 1, j - 1, lines[i][j])
for i in range(1, len(lines) - 1)
for j in range(1, len(lines[i]) - 1)
if lines[i][j] != "."
}
n_rows, n_cols = len(lines) - 2, len(lines[0]) - 2
CYCLE = math.lcm(n_rows, n_cols)
east_winds = [{j for j in range(n_cols) if (i, j, ">") in winds} for i in range(n_rows)]
west_winds = [{j for j in range(n_cols) if (i, j, "<") in winds} for i in range(n_rows)]
north_winds = [
{i for i in range(n_rows) if (i, j, "^") in winds} for j in range(n_cols)
]
south_winds = [
{i for i in range(n_rows) if (i, j, "v") in winds} for j in range(n_cols)
]
def run(start: tuple[int, int], start_cycle: int, end: tuple[int, int]):
def heuristic(y: int, x: int) -> int:
return abs(end[0] - y) + abs(end[1] - x)
# (distance + heuristic, distance, (start_pos, cycle))
queue = [(heuristic(start[0], start[1]), 0, ((start[0], start[1]), start_cycle))]
visited: set[tuple[tuple[int, int], int]] = set()
distances: dict[tuple[int, int], dict[int, int]] = defaultdict(lambda: {})
while queue:
_, distance, ((y, x), cycle) = heapq.heappop(queue)
if ((y, x), cycle) in visited:
continue
distances[y, x][cycle] = distance
visited.add(((y, x), cycle))
if (y, x) == (end[0], end[1]):
break
for dy, dx in (0, 0), (-1, 0), (1, 0), (0, -1), (0, 1):
ty = y + dy
tx = x + dx
n_cycle = (cycle + 1) % CYCLE
if (ty, tx) == end:
heapq.heappush(queue, (distance + 1, distance + 1, ((ty, tx), n_cycle)))
break
if ((ty, tx), n_cycle) in visited:
continue
if (ty, tx) != start and (ty < 0 or tx < 0 or ty >= n_rows or tx >= n_cols):
continue
if (ty, tx) != start:
if (ty - n_cycle) % n_rows in south_winds[tx]:
continue
if (ty + n_cycle) % n_rows in north_winds[tx]:
continue
if (tx + n_cycle) % n_cols in west_winds[ty]:
continue
if (tx - n_cycle) % n_cols in east_winds[ty]:
continue
heapq.heappush(
queue,
((heuristic(ty, tx) + distance + 1, distance + 1, ((ty, tx), n_cycle))),
)
return distances, next(iter(distances[end].values()))
start = (
-1,
next(j for j in range(1, len(lines[0]) - 1) if lines[0][j] == ".") - 1,
)
end = (
n_rows,
next(j for j in range(1, len(lines[-1]) - 1) if lines[-1][j] == ".") - 1,
)
distances_1, forward_1 = run(start, 0, end)
print(f"answer 1 is {forward_1}")
distances_2, return_1 = run(end, next(iter(distances_1[end].keys())), start)
distances_3, forward_2 = run(start, next(iter(distances_2[start].keys())), end)
print(f"answer 2 is {forward_1 + return_1 + forward_2}")

29
2022/day25.py Normal file
View File

@@ -0,0 +1,29 @@
# -*- encoding: utf-8 -*-
import sys
lines = sys.stdin.read().splitlines()
coeffs = {"2": 2, "1": 1, "0": 0, "-": -1, "=": -2}
def snafu2number(number: str) -> int:
value = 0
for c in number:
value *= 5
value += coeffs[c]
return value
def number2snafu(number: int) -> str:
values = ["0", "1", "2", "=", "-"]
res = ""
while number > 0:
mod = number % 5
res = res + values[mod]
number = number // 5 + int(mod >= 3)
return "".join(reversed(res))
answer_1 = number2snafu(sum(map(snafu2number, lines)))
print(f"answer 1 is {answer_1}")

View File

@@ -20,6 +20,6 @@ n_per_group = 3
part2 = sum(
priorities[c]
for i in range(0, len(lines), n_per_group)
for c in set.intersection(*map(set, (lines[i : i + n_per_group])))
for c in set(lines[i]).intersection(*lines[i + 1 : i + n_per_group])
)
print(f"score 2 is {part2}")

View File

@@ -2,8 +2,6 @@
import sys
data = sys.stdin.read().strip()
def index_of_first_n_differents(data: str, n: int) -> int:
for i in range(len(data)):
@@ -12,5 +10,8 @@ def index_of_first_n_differents(data: str, n: int) -> int:
return -1
data = sys.stdin.read().strip()
print(f"answer 1 is {index_of_first_n_differents(data, 4)}")
print(f"answer 2 is {index_of_first_n_differents(data, 14)}")

30
2022/inputs/day19.txt Normal file
View File

@@ -0,0 +1,30 @@
Blueprint 1: Each ore robot costs 4 ore. Each clay robot costs 4 ore. Each obsidian robot costs 4 ore and 12 clay. Each geode robot costs 4 ore and 19 obsidian.
Blueprint 2: Each ore robot costs 4 ore. Each clay robot costs 4 ore. Each obsidian robot costs 2 ore and 11 clay. Each geode robot costs 2 ore and 7 obsidian.
Blueprint 3: Each ore robot costs 3 ore. Each clay robot costs 3 ore. Each obsidian robot costs 2 ore and 13 clay. Each geode robot costs 3 ore and 12 obsidian.
Blueprint 4: Each ore robot costs 2 ore. Each clay robot costs 3 ore. Each obsidian robot costs 3 ore and 18 clay. Each geode robot costs 2 ore and 19 obsidian.
Blueprint 5: Each ore robot costs 2 ore. Each clay robot costs 4 ore. Each obsidian robot costs 3 ore and 19 clay. Each geode robot costs 4 ore and 13 obsidian.
Blueprint 6: Each ore robot costs 4 ore. Each clay robot costs 4 ore. Each obsidian robot costs 3 ore and 7 clay. Each geode robot costs 4 ore and 11 obsidian.
Blueprint 7: Each ore robot costs 4 ore. Each clay robot costs 4 ore. Each obsidian robot costs 4 ore and 15 clay. Each geode robot costs 4 ore and 17 obsidian.
Blueprint 8: Each ore robot costs 3 ore. Each clay robot costs 4 ore. Each obsidian robot costs 4 ore and 13 clay. Each geode robot costs 3 ore and 7 obsidian.
Blueprint 9: Each ore robot costs 4 ore. Each clay robot costs 4 ore. Each obsidian robot costs 2 ore and 12 clay. Each geode robot costs 3 ore and 15 obsidian.
Blueprint 10: Each ore robot costs 4 ore. Each clay robot costs 3 ore. Each obsidian robot costs 4 ore and 18 clay. Each geode robot costs 4 ore and 11 obsidian.
Blueprint 11: Each ore robot costs 4 ore. Each clay robot costs 4 ore. Each obsidian robot costs 4 ore and 8 clay. Each geode robot costs 2 ore and 15 obsidian.
Blueprint 12: Each ore robot costs 4 ore. Each clay robot costs 3 ore. Each obsidian robot costs 4 ore and 8 clay. Each geode robot costs 3 ore and 7 obsidian.
Blueprint 13: Each ore robot costs 4 ore. Each clay robot costs 3 ore. Each obsidian robot costs 3 ore and 10 clay. Each geode robot costs 2 ore and 10 obsidian.
Blueprint 14: Each ore robot costs 2 ore. Each clay robot costs 3 ore. Each obsidian robot costs 3 ore and 13 clay. Each geode robot costs 2 ore and 20 obsidian.
Blueprint 15: Each ore robot costs 3 ore. Each clay robot costs 4 ore. Each obsidian robot costs 3 ore and 19 clay. Each geode robot costs 3 ore and 8 obsidian.
Blueprint 16: Each ore robot costs 3 ore. Each clay robot costs 3 ore. Each obsidian robot costs 2 ore and 16 clay. Each geode robot costs 2 ore and 18 obsidian.
Blueprint 17: Each ore robot costs 4 ore. Each clay robot costs 4 ore. Each obsidian robot costs 2 ore and 9 clay. Each geode robot costs 3 ore and 19 obsidian.
Blueprint 18: Each ore robot costs 4 ore. Each clay robot costs 4 ore. Each obsidian robot costs 2 ore and 11 clay. Each geode robot costs 4 ore and 8 obsidian.
Blueprint 19: Each ore robot costs 3 ore. Each clay robot costs 4 ore. Each obsidian robot costs 3 ore and 12 clay. Each geode robot costs 3 ore and 17 obsidian.
Blueprint 20: Each ore robot costs 3 ore. Each clay robot costs 3 ore. Each obsidian robot costs 2 ore and 14 clay. Each geode robot costs 3 ore and 17 obsidian.
Blueprint 21: Each ore robot costs 4 ore. Each clay robot costs 4 ore. Each obsidian robot costs 2 ore and 15 clay. Each geode robot costs 3 ore and 16 obsidian.
Blueprint 22: Each ore robot costs 4 ore. Each clay robot costs 4 ore. Each obsidian robot costs 2 ore and 16 clay. Each geode robot costs 4 ore and 16 obsidian.
Blueprint 23: Each ore robot costs 3 ore. Each clay robot costs 4 ore. Each obsidian robot costs 4 ore and 19 clay. Each geode robot costs 4 ore and 11 obsidian.
Blueprint 24: Each ore robot costs 4 ore. Each clay robot costs 4 ore. Each obsidian robot costs 4 ore and 18 clay. Each geode robot costs 4 ore and 9 obsidian.
Blueprint 25: Each ore robot costs 4 ore. Each clay robot costs 3 ore. Each obsidian robot costs 2 ore and 17 clay. Each geode robot costs 3 ore and 16 obsidian.
Blueprint 26: Each ore robot costs 3 ore. Each clay robot costs 4 ore. Each obsidian robot costs 2 ore and 20 clay. Each geode robot costs 4 ore and 7 obsidian.
Blueprint 27: Each ore robot costs 2 ore. Each clay robot costs 2 ore. Each obsidian robot costs 2 ore and 8 clay. Each geode robot costs 2 ore and 14 obsidian.
Blueprint 28: Each ore robot costs 3 ore. Each clay robot costs 4 ore. Each obsidian robot costs 3 ore and 20 clay. Each geode robot costs 3 ore and 14 obsidian.
Blueprint 29: Each ore robot costs 4 ore. Each clay robot costs 3 ore. Each obsidian robot costs 4 ore and 20 clay. Each geode robot costs 4 ore and 8 obsidian.
Blueprint 30: Each ore robot costs 3 ore. Each clay robot costs 4 ore. Each obsidian robot costs 4 ore and 18 clay. Each geode robot costs 3 ore and 13 obsidian.

5000
2022/inputs/day20.txt Normal file

File diff suppressed because it is too large Load Diff

1835
2022/inputs/day21.txt Normal file

File diff suppressed because it is too large Load Diff

202
2022/inputs/day22.txt Normal file

File diff suppressed because one or more lines are too long

70
2022/inputs/day23.txt Normal file
View File

@@ -0,0 +1,70 @@
#...#.####.......###.#..##.#####.#...##.##.##.#.#.#...#.#...##...#..#.
#.#.####.#.#.###...#####.##..####..#.###...#.#...........#..#.#..##...
#.#####....#..###.#.###..##.#.#.#..#...###...####.#.##.#.#..#.###.#..#
.#..##.....##.##.#.#...##.#.##..#..##.#.#...#####...####..###...##..#.
##...###..##....##.#.#...#...#...##...#..#.#..##..###..##......####.#.
#..##.#.#...####.....###.#...#####.....##.##.#....#.#.......####..#.#.
..#.###....###..##.....#...#...#####....#.###.....###..###.#####..#...
#..###..##...##.#.#...##.#.#.#.###.#######.#.###...#..#.######....##.#
#.....###.....####.#..#...##..#.#.#...##....##.###.#.#...#.#.#..#.###.
.#...#......#......##..##.#....#.......##....##...#####...###..#.#.###
.#.####...#.###.##..##.#.#.##.##.####..####.###.#######..##...#..###..
.....##......#.#.##.######....#.#.#.#####.##.#.##...#.#..###.#.#.###..
.#.##.#.#.##..###.#..#...#####..##..#.#####...#....#..#.#...#.##.#....
.####...#....#.#.##.#.##.####......#......###....####.....#######....#
.###...########.##.#..#.#...#.##..####.##.#####.#..#.#....##...#...##.
#..###..####.#....#.#..#####.##.#.##...#.#.###.###.#.#....###...#.##.#
###..#.###.#.#####.###....###..#...##.###.#..##.####.#.#.#.###...##.#.
.#####.#..##..#...#.##.#..##.#.#.#...##.##..####..#.##.........#..##.#
.#.###...#....#.##.######..#...##.#...###.##...###...########..#.#.###
.######.#...##.####.##..#..#...#.#..##.##.#.##.#.#.#.##.#.###..##.##.#
#...####.#.#..##.#...##.#.#...##.#......####...#..#....##.##..#.###.#.
#....##..#.##....#######.#...#..#.####.##.....###.####.#.###..#..####.
..##..##.#....########..#.##.......#...#.#.........##.#.#..#....####..
.#..##.#.#.##...#.....##...##.#.#...#....#..#####.#..#..#.###..#.#.###
#.##.##............##.##.....##.#...#.#..##..#.#..###.....#..#..#..#.#
..#.....#..#..#.#.....#...###.#.#..#....##.##...#...##.##....#..##...#
..##...##.##......#...#..#####....#..#......###.#..#####...####.#....#
#..###.##..####.#....#..##.#..##.##.#.#..######.........#.##....######
..#.######.#.##...#..####..##....##..###.#.###.#.#..#.##.##.###.#..#.#
..#.####.###.#.#..###..#######.#..##.#....#.#####.###....#.#..###...##
....#....#..###.#...#......#..##...##..##.#.###...###.#.#.#.#..#...#.#
#....#..##..##.###.####.#######.###.###...#...#..###...#...#.#..#.##.#
#...###.##..#.#..#.#..#.#.#..###..####.##.##.#...###.#.###########...#
##...#...#...#..##....#...#...#....###.#######.....#.#.##...##..#.#..#
.....##.##.#.#.#..#..###....##.#....####.#.##.####..#.##.#..##.##.###.
....##.#....#####.#.##.........##.######.#..###..###..#.#.##.###.....#
...##..#####....##..####....##..###.##.##..##...#.#.###.#.#.##.#.##...
..#..####.#..#.##.##.#..####..#.#...##.....#...#....###..#.#.##..#.##.
#####.#..#.#.###..#.#.###.#######.#.#...#........##..#...#.##..#.##.#.
.#..###.###.#..##.####.##.###...#..#.#.....#.#.#...#....#.###..##.#.#.
.#.#.....##.##.#.####..##.#.#...#.#..#.....#..#....#......#.######.##.
...##.##..#....###...#..#.#..#.#.#.##..##.#..#.####..####.#.#.........
#.###.#...#....#...#.###.....#..#...##.#.#.####..#...#.#.#..####......
##.###.#.#####.#.##....#..#..##..##..#..##..##...#.#.##.##....#...##..
.###..###....#...##..###..#....###.....#..##...###.###.###..##.#..####
#.###........#..##.#.....#.....#...##.#####.#.##..##....####.#...##.#.
#.#.#..###.##.###..###..##..######..##.#####......#.##....##.#..###.#.
###...##.#.#.#.#.#.######...#..##.....#.#######.#..#..###.#.###.#...#.
###..######......#.###..#.....#########....#####.##..#...#.#...###..##
##.#..######..#.###..#.###.###.#.#####.####.....#...#.#...#####.#..##.
...####.#.#####.##...##..#.######.###....#.###.#.##.#####...#.#.#.####
#..###.########.#.###.#.####.###.###.#..#.##.#.#####..####.#.###...###
#..#.....#.###.#.##.###.#.....#..#....#####.#.#...##.###.######.###.##
##.#.#...###.#.#..#.#.###....###..#.##.#..#..###.#..#######.##.###.###
.##..##.#..#.#####.###.#.#.#......#.#.##.#...#.######.##...#.###.#####
#####....#.##....##.###..#.###..###.##...####.###.###..##.####.#.##.##
#......#.##.##.##.#....#.##.##..########.#....#..#..###.#####.#.#..##.
.#..#...#..##.#..###...#......##.##.###.....#.#.#.#..#.#####.##..#.###
.##.##.#.##.###..#..##.####.#.#..####.#.#.......##.......##.....#####.
####...##...#.#.#..###.#####.#.#.#.##.#..##......#.###.##..#...#...#.#
...........##.#.####.#.#########..###....#...#.......#..####..#####.#.
.#.###.##.#..####..#.###.#.#####..##.#......#.#..#####.##.#.###.#.##.#
###..#...#.##.####.#.##...#..#.......######...#....##....#.....#...#..
####.#.#...#.#.#######.##...#..#.#..#####...#..#.#..##.##.....##.##.#.
###..##..#..#.#.##.##..#..##..##..#####.#.##..##.####.##.##...#.####.#
#.##.#.#..##..####.....#.###..#....###.#.##.###.#.#.#.######.##....#..
.#.#..##..#.###.#.....##.##..##....####..#.#..#..##########.#...#...#.
###.####.#.#.##.#......#.###......##.###..##.##.#..#....#.##.#..#.....
.....##.......###.#..####.#.#.#.###..##...##...####.#.##.#.#.#..#.#.##
..##.##.#..#.##.....#...##.#...#.###..##.#.##...#..#.....###.#.#####..

22
2022/inputs/day24.txt Normal file
View File

@@ -0,0 +1,22 @@
#.######################################################################################################################################################
#.v><><<>^^^<><<>.^v<>v^>v^v^^<..^v>^>^vv.>v^<<>^.v<vvv<.>><v>><^>><>^<><v<>>>><v>v<^<>^.v..v^vv<v<<vv.v>>v<>v.<..^<vv<^v^v.v>>v>><^v>^<.vv^^<<><<>v>><#
#.vv<vv<>.v<<<<<>>vv<>^v^^<^<>><.<^>^<^>^<v<<<<v>v>><.><.^><>vv<^^><<<<>^<.<v^.vv^vv>v>^.<<<><v<.v.<><<v^^v>^^<^>>^.<v^v.v><<v^vv<<v>^v>><^^<^<v>^>><v<#
#<v^>v^vv<><v><<^<>^<^vv>v>>^^><<<vv><v.v.^><<^><>v>^<^v<<^>v<vv><v<<^.vv^>>>.^v>v.><v>v<^<^^<><<>><<^^^>v<^>>^v>>vv.<>^<><<^v>><^.>v^v><<^^^^<v<>^v<v.#
#<<^<vv^<^><>^><>^vv.v^v>><^^<>^<>>^><^.^^<.v...>^^.^<<v<vvv>>>v^..^v.v<^><>.>v^.vv<^^vv>vv^.^.vv<v>>^>v.^^^<v<>><vv^>>^^.v>.v^^<^>vvv^<<v^<v<^><^>v<>>#
#<.<^>>^<v><^>^^.>>v^<v^vvv>>vv.v^<>^^>v<<vv^<>^v.<<<^>>>.^>vvv.^^^<^><<^><v>><^.^>vv^^vv.><<v<^<v^^^.>v>^>v.^^<<^^^>^><><<vv<.<>v>vv>><^^v>>vvv^<...<<#
#><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^.>><vv^vv^<v<<>.>.>>.vv.v<.^<^<>>^><><^.v>>v^^v><>><<<vv<<>v><>^.>>^>v^^><^<v<<><vv^>>.<^<.^<^>vvv>^<.v<^<>.><.>>v<^>^v<<.^<v>^<#
#<>.<v^>.^<<^v^.<<^>v^^vv<^><^<^>><v^^vvv<<vvvv>>^v><<>^>vvvvv^<<v^.>^<.<^>.^>^><v^<>>.<<^^vv>>>^>vv><vvv^v.>^vv><<<<>^v^^^.>.^>>^^v^v>v>vv^<<^vv^<>v<>#
#<<>v>v>>v^^v><^<.vv<^>^^>.v^<.^^vv>.<>^<>v>^>vvv<vv^>v^><<<v>vv<..^v^v>v.v><^.<^>.v<v><v>v^>^<<<<<>^.v<^.<v.<<^>v^^^<^<<>v.<<^<<<<.<^><<<^<v<v>>v>.><>#
#>>.>vvv<<..>^^vv^>.<.v..v^^>^v<<>>>vv.<v>vv^<vv^v><v^^.<<.><..><^><<>^<<><v<.<v.<^<^.^<^<<><><<^v^>.<<v^^>.^<...v.^<^^<><><>v^<><^>^>^v^.>^^>^.vv.<v^>#
#>.<><v>v<v>v>^v^^v>.v^.v>v>.<>>>^vv<<v>>^>^.^<^vv.vvvv<<>v<^^.>v<^v<<^><^.^^v<>.v<vv><v<v>vvv>^^>v>..<<<v..>v..<^^^<v>^^<<vv<>>^^v^.vv<><^>>.^<<^>>v.>#
#><v..vv^<v^<>>v<>..<^>v^^><.>vv^vv^<^^v<>vv<.vv^^<>^>>^v<^^<<>^vv>v><>v<^vvv^<>><>^^^v^<v.v^<<^^>>>>><^^>><^v>>vv^v><^>^<<^.v>vv>^.v^<vv^v>>>vv>v^v<^>#
#...>><v.<v<>^.v.v..^>^<><vv^><<<vv^<vv.><^.vv>>><v^v^>^v>>v<.^<^^<v^<>v<^<><<<.^<<vv.<>>^v^^.v>.<v>^.^>v^.v><^<<>>>^.<<<^v<<<><^>.^.^v><>^>><vv<v.<.^>#
#<^vv>>v>v<^><^^^<^>vv<>vv>^^^.><><^>v>><v.<>vv^^<^<<<v^<><v>v^v>^<><><><><>^^>><>..^^>v<...vv<^>><.vv<^<v><v<vv^.><>v^<>v.^>>>v<<^<<^vv.>^<.^<>^<v^^^>#
#>>^vv^.<<.<.<>>vvv<<<..<v><^<>^><<>^.<<^^^<v^<<v.<vv<^<>>vv^>.v^v<^<>>vv<<^>>.v>.v>^^^vvv^v<^><v^><>><^<.>v^^^<vv^>^v<v^<vv><>..^><.>^^<^>>..^.v^<^<v>#
#<<><^^><v^v<^^<vv>><v..>>>^><>>>v>v>v>v><>>^vv><>>v>>vvvv<<^><>v^>vv>^.>>v.^<v<^.>>>^^v>>><vvv>><.<v<^<v<^v<v<<vvv..^^<<^<.<><<<<^<>v<<<^^>.^v>^^v<^^<#
#>v^^^<v>^^<v<<<vv><^v.v<v^^^vvv<<><><^^><^^>>>>>><^>^^.>vv>^><<<v<<<^vv.^^^<v>v<^^^^>.^^vv<^<.<v^<vv^^^>><..><^>v><<v>v>^v^>>^^>vv.v^^^>^^vv.<<v.^><<.#
#<^v<<^^vvv.>v>v>.v><v<^^>^>^>^^v>v^vv^<.^.>>>>>v<>.<<.<^<<vvv..<^>^><^>^<^<<>><^>v<v^v>^v^^^>>>>v>^>>^<v..><.>>^^><^<^.<v^>^.v>^^vv^v.<>>>>.v.<<>^^vv>#
#<v^v.>.>^v>^<v.<^<^>v^>^^.>.>v<>>>^>vv<>v<>^>v^<<^<.<<^>v^<><>><^^<^^v<>>vv<<.<>v>.>^^^>><^^<^vv.><v<.<<^^>^>><>v><^vv.>v^v^v..<vvv..<<v<v^<<v>^<^>><<#
#<^v<v^^v^>^<>v^<^<>>..>><>v<.^<.>v.>^v.>>^^<^v>>v^.v>^><>>vv.<<<>v>^.>v>..<<<v.<v^<>^>^<>v<^<v<><^>^v><.<<^^^<^.<<<^.^v^^.>^.<<vv>^v><<>^<^v^^>^v><<^>#
######################################################################################################################################################.#

124
2022/inputs/day25.txt Normal file
View File

@@ -0,0 +1,124 @@
21-0==1=-0
102211-220011-----
1=2=111=10=-
12-2=022=2
1=--=11
12-2211000=0011-0-
1=1-
2=0-10-=21-2
1210-
2=1-=
1=0=12=2112--11=
2--211=200
20-02-20
12=12=0=0=1
22===21=-0102-012=
1--=-121
1=02=2-=
12-0-20
2=---=0102--00=22
1=2==0=2=
11-1112
2--012
12=12=--212-0-==-02
1=220
20===1
2210-02=12-022-=1-
22--1-==1
211-1=1=0-==1
10
1-1-02
1=-2==-0=21
1=102
20121021
1=2=22=001200-==1020
10211-1-20--10-1=
1222==1--=1--11-=
11211211
1=101-20=
1=1-11=0=000
1=-=101
2
1000-2
1==0=210=1=21222-=2
1=1==2-
2--020=2=2===-
2-
2=0
222101=22=-21=11
2=
121201-0-20-2-=11=
10=
1212=20=2=-=-1--1
2-20-=212=01
1=1--00--0=12=-00
22--
22
22===1=-0-22-
111-=
2-111=0021=2
200=22-=12-2=
1==-=1=0
1--=02-0002=
1=-=2-2=2-
2=2222220=2==001
1=00==11=-20-=2-2
1---0=-=
1-0==10-=22001
1=02=02-1=0111
1-=010-21-=21==02
10200-2=-=20120-2
1=-
10=122-
210-1=-=2011-0--1
2==-1=20
1=-=101-20=221-1
210
1-=-==-0-=02=---
1-=1=-=12=0
1-=0---12-0=
210-==1021=010=1
1=-212
11=1=-=2211=101222-
2=-==--=2
1=11-200--=
1120-
11=-0=221=0101=
11-1=-
1-12-2=0
1012-22=1-
20-122=-1=
1-100=0=101-0
20-1=1=0
1102=
21
10=20=11
1-=2001
1-20=12-0221102-==
1-1--010100=-1=
221002==2102-2=1
2012=121-22
110222002=01
212102-1=1=-211
210-=12
1=-1-0101=1-12
12--21=1
10=-12
100-122211=--2=
101102001
11011=-
211-0=-=0
1-2=01-1=
1-022-=00000
2==-0==2=--00=
10=--2000==
1---=--1-110-02
11-012
2==-2210-0
212
22-=-12111
2--=
2=2=12-100
10-12===0-
1==0=0=22012201
211-1--22

14
2022/tests/day1.txt Normal file
View File

@@ -0,0 +1,14 @@
1000
2000
3000
4000
5000
6000
7000
8000
9000
10000

146
2022/tests/day10.txt Normal file
View File

@@ -0,0 +1,146 @@
addx 15
addx -11
addx 6
addx -3
addx 5
addx -1
addx -8
addx 13
addx 4
noop
addx -1
addx 5
addx -1
addx 5
addx -1
addx 5
addx -1
addx 5
addx -1
addx -35
addx 1
addx 24
addx -19
addx 1
addx 16
addx -11
noop
noop
addx 21
addx -15
noop
noop
addx -3
addx 9
addx 1
addx -3
addx 8
addx 1
addx 5
noop
noop
noop
noop
noop
addx -36
noop
addx 1
addx 7
noop
noop
noop
addx 2
addx 6
noop
noop
noop
noop
noop
addx 1
noop
noop
addx 7
addx 1
noop
addx -13
addx 13
addx 7
noop
addx 1
addx -33
noop
noop
noop
addx 2
noop
noop
noop
addx 8
noop
addx -1
addx 2
addx 1
noop
addx 17
addx -9
addx 1
addx 1
addx -3
addx 11
noop
noop
addx 1
noop
addx 1
noop
noop
addx -13
addx -19
addx 1
addx 3
addx 26
addx -30
addx 12
addx -1
addx 3
addx 1
noop
noop
noop
addx -9
addx 18
addx 1
addx 2
noop
noop
addx 9
noop
noop
noop
addx -1
addx 2
addx -37
addx 1
addx 3
noop
addx 15
addx -21
addx 22
addx -6
addx 1
noop
addx 2
addx 1
noop
addx -10
noop
noop
addx 20
addx 1
addx 2
addx 2
addx -6
addx -11
noop
noop
noop

27
2022/tests/day11.txt Normal file
View File

@@ -0,0 +1,27 @@
Monkey 0:
Starting items: 79, 98
Operation: new = old * 19
Test: divisible by 23
If true: throw to monkey 2
If false: throw to monkey 3
Monkey 1:
Starting items: 54, 65, 75, 74
Operation: new = old + 6
Test: divisible by 19
If true: throw to monkey 2
If false: throw to monkey 0
Monkey 2:
Starting items: 79, 60, 97
Operation: new = old * old
Test: divisible by 13
If true: throw to monkey 1
If false: throw to monkey 3
Monkey 3:
Starting items: 74
Operation: new = old + 3
Test: divisible by 17
If true: throw to monkey 0
If false: throw to monkey 1

5
2022/tests/day12.txt Normal file
View File

@@ -0,0 +1,5 @@
Sabqponm
abcryxxl
accszExk
acctuvwj
abdefghi

23
2022/tests/day13.txt Normal file
View File

@@ -0,0 +1,23 @@
[1,1,3,1,1]
[1,1,5,1,1]
[[1],[2,3,4]]
[[1],4]
[9]
[[8,7,6]]
[[4,4],4,4]
[[4,4],4,4,4]
[7,7,7,7]
[7,7,7]
[]
[3]
[[[]]]
[[]]
[1,[2,[3,[4,[5,6,7]]]],8,9]
[1,[2,[3,[4,[5,6,0]]]],8,9]

2
2022/tests/day14.txt Normal file
View File

@@ -0,0 +1,2 @@
498,4 -> 498,6 -> 496,6
503,4 -> 502,4 -> 502,9 -> 494,9

14
2022/tests/day15.txt Normal file
View File

@@ -0,0 +1,14 @@
Sensor at x=2, y=18: closest beacon is at x=-2, y=15
Sensor at x=9, y=16: closest beacon is at x=10, y=16
Sensor at x=13, y=2: closest beacon is at x=15, y=3
Sensor at x=12, y=14: closest beacon is at x=10, y=16
Sensor at x=10, y=20: closest beacon is at x=10, y=16
Sensor at x=14, y=17: closest beacon is at x=10, y=16
Sensor at x=8, y=7: closest beacon is at x=2, y=10
Sensor at x=2, y=0: closest beacon is at x=2, y=10
Sensor at x=0, y=11: closest beacon is at x=2, y=10
Sensor at x=20, y=14: closest beacon is at x=25, y=17
Sensor at x=17, y=20: closest beacon is at x=21, y=22
Sensor at x=16, y=7: closest beacon is at x=15, y=3
Sensor at x=14, y=3: closest beacon is at x=15, y=3
Sensor at x=20, y=1: closest beacon is at x=15, y=3

10
2022/tests/day16.txt Normal file
View File

@@ -0,0 +1,10 @@
Valve AA has flow rate=0; tunnels lead to valves DD, II, BB
Valve BB has flow rate=13; tunnels lead to valves CC, AA
Valve CC has flow rate=2; tunnels lead to valves DD, BB
Valve DD has flow rate=20; tunnels lead to valves CC, AA, EE
Valve EE has flow rate=3; tunnels lead to valves FF, DD
Valve FF has flow rate=0; tunnels lead to valves EE, GG
Valve GG has flow rate=0; tunnels lead to valves FF, HH
Valve HH has flow rate=22; tunnel leads to valve GG
Valve II has flow rate=0; tunnels lead to valves AA, JJ
Valve JJ has flow rate=21; tunnel leads to valve II

3
2022/tests/day2.txt Normal file
View File

@@ -0,0 +1,3 @@
A Y
B X
C Z

7
2022/tests/day20.txt Normal file
View File

@@ -0,0 +1,7 @@
1
2
-3
3
-2
0
4

15
2022/tests/day21.txt Normal file
View File

@@ -0,0 +1,15 @@
root: pppw + sjmn
dbpl: 5
cczh: sllz + lgvd
zczc: 2
ptdq: humn - dvpt
dvpt: 3
lfqf: 4
humn: 5
ljgn: 2
sjmn: drzm * dbpl
sllz: 4
pppw: cczh / lfqf
lgvd: ljgn * ptdq
drzm: hmdt - zczc
hmdt: 32

14
2022/tests/day22.txt Normal file
View File

@@ -0,0 +1,14 @@
...#
.#..
#...
....
...#.......#
........#...
..#....#....
..........#.
...#....
.....#..
.#......
......#.
10R5L5R10L4R5L5

7
2022/tests/day23.txt Normal file
View File

@@ -0,0 +1,7 @@
....#..
..###.#
#...#.#
.#...##
#.###..
##.#.##
.#..#..

6
2022/tests/day24.txt Normal file
View File

@@ -0,0 +1,6 @@
#.######
#>>.<^<#
#.<..<<#
#>v.><>#
#<^v^^>#
######.#

13
2022/tests/day25.txt Normal file
View File

@@ -0,0 +1,13 @@
1=-0-2
12111
2=0=
21
2=01
111
20012
112
1=-1=
1-12
12
1=
122

6
2022/tests/day3.txt Normal file
View File

@@ -0,0 +1,6 @@
vJrwpWtwJgWrhcsFMMfFFhFp
jqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL
PmmdzqPrVvPwwTWBwg
wMqvLMZHhHMvwLHjbvcjnnSBnvTQFn
ttgJtRGJQctTZtZT
CrZsJsPPZsGzwwsLwLmpwMDw

6
2022/tests/day4.txt Normal file
View File

@@ -0,0 +1,6 @@
2-4,6-8
2-3,4-5
5-7,7-9
2-8,3-7
6-6,4-6
2-6,4-8

9
2022/tests/day5.txt Normal file
View File

@@ -0,0 +1,9 @@
[D]
[N] [C]
[Z] [M] [P]
1 2 3
move 1 from 2 to 1
move 3 from 1 to 3
move 2 from 2 to 1
move 1 from 1 to 2

1
2022/tests/day6.txt Normal file
View File

@@ -0,0 +1 @@
mjqjpqmgbljsphdztnvjfqwrcgsmlb

23
2022/tests/day7.txt Normal file
View File

@@ -0,0 +1,23 @@
$ cd /
$ ls
dir a
14848514 b.txt
8504156 c.dat
dir d
$ cd a
$ ls
dir e
29116 f
2557 g
62596 h.lst
$ cd e
$ ls
584 i
$ cd ..
$ cd ..
$ cd d
$ ls
4060174 j
8033020 d.log
5626152 d.ext
7214296 k

5
2022/tests/day8.txt Normal file
View File

@@ -0,0 +1,5 @@
30373
25512
65332
33549
35390

8
2022/tests/day9.txt Normal file
View File

@@ -0,0 +1,8 @@
R 4
U 4
L 3
D 1
R 4
D 1
L 5
R 2

45
2023/day1.py Normal file
View File

@@ -0,0 +1,45 @@
import sys
lines = sys.stdin.read().splitlines()
lookups_1 = {str(d): d for d in range(1, 10)}
lookups_2 = lookups_1 | {
d: i + 1
for i, d in enumerate(
(
"one",
"two",
"three",
"four",
"five",
"six",
"seven",
"eight",
"nine",
)
)
}
def find_values(lookups: dict[str, int]) -> list[int]:
values: list[int] = []
for line in filter(bool, lines):
first_digit = min(
lookups,
key=lambda lookup: index
if (index := line.find(lookup)) >= 0
else len(line),
)
last_digit = max(
lookups,
key=lambda lookup: index if (index := line.rfind(lookup)) >= 0 else -1,
)
values.append(10 * lookups[first_digit] + lookups[last_digit])
return values
print(f"answer 1 is {sum(find_values(lookups_1))}")
print(f"answer 2 is {sum(find_values(lookups_2))}")

13
2023/day10.py Normal file
View File

@@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

13
2023/day11.py Normal file
View File

@@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

13
2023/day12.py Normal file
View File

@@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

13
2023/day13.py Normal file
View File

@@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

13
2023/day14.py Normal file
View File

@@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

13
2023/day15.py Normal file
View File

@@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

13
2023/day16.py Normal file
View File

@@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

13
2023/day17.py Normal file
View File

@@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

13
2023/day18.py Normal file
View File

@@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

13
2023/day19.py Normal file
View File

@@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

45
2023/day2.py Normal file
View File

@@ -0,0 +1,45 @@
import operator
import sys
from functools import reduce
from typing import Literal, TypeAlias, cast
CubeType: TypeAlias = Literal["red", "blue", "green"]
MAX_CUBES: dict[CubeType, int] = {"red": 12, "green": 13, "blue": 14}
# parse games
lines = sys.stdin.read().splitlines()
games: dict[int, list[dict[CubeType, int]]] = {}
for line in filter(bool, lines):
id_part, sets_part = line.split(":")
games[int(id_part.split(" ")[-1])] = [
{
cast(CubeType, s[1]): int(s[0])
for cube_draw in cube_set_s.strip().split(", ")
if (s := cube_draw.split(" "))
}
for cube_set_s in sets_part.strip().split(";")
]
# part 1
answer_1 = sum(
id
for id, set_of_cubes in games.items()
if all(
n_cubes <= MAX_CUBES[cube]
for cube_set in set_of_cubes
for cube, n_cubes in cube_set.items()
)
)
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = sum(
reduce(
operator.mul,
(max(cube_set.get(cube, 0) for cube_set in set_of_cubes) for cube in MAX_CUBES),
)
for set_of_cubes in games.values()
)
print(f"answer 2 is {answer_2}")

13
2023/day20.py Normal file
View File

@@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

13
2023/day21.py Normal file
View File

@@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

13
2023/day22.py Normal file
View File

@@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

13
2023/day23.py Normal file
View File

@@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

13
2023/day24.py Normal file
View File

@@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

13
2023/day25.py Normal file
View File

@@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

53
2023/day3.py Normal file
View File

@@ -0,0 +1,53 @@
import string
import sys
from collections import defaultdict
NOT_A_SYMBOL = "." + string.digits
lines = sys.stdin.read().splitlines()
values: list[int] = []
gears: dict[tuple[int, int], list[int]] = defaultdict(list)
for i, line in enumerate(lines):
j = 0
while j < len(line):
# skip everything until a digit is found (start of a number)
if line[j] not in string.digits:
j += 1
continue
# extract the range of the number and its value
k = j + 1
while k < len(line) and line[k] in string.digits:
k += 1
value = int(line[j:k])
# lookup around the number if there is a symbol - we go through the number
# itself but that should not matter since it only contains digits
found = False
for i2 in range(max(0, i - 1), min(i + 1, len(lines) - 1) + 1):
for j2 in range(max(0, j - 1), min(k, len(line) - 1) + 1):
assert i2 >= 0 and i2 < len(lines)
assert j2 >= 0 and j2 < len(line)
if lines[i2][j2] not in NOT_A_SYMBOL:
found = True
if lines[i2][j2] == "*":
gears[i2, j2].append(value)
if found:
values.append(value)
# continue starting from the end of the number
j = k
# part 1
answer_1 = sum(values)
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = sum(v1 * v2 for v1, v2 in filter(lambda vs: len(vs) == 2, gears.values()))
print(f"answer 2 is {answer_2}")

41
2023/day4.py Normal file
View File

@@ -0,0 +1,41 @@
import sys
from dataclasses import dataclass
@dataclass(frozen=True)
class Card:
id: int
numbers: list[int]
values: list[int]
lines = sys.stdin.read().splitlines()
cards: list[Card] = []
for line in lines:
id_part, e_part = line.split(":")
numbers_s, values_s = e_part.split("|")
cards.append(
Card(
id=int(id_part.split()[1]),
numbers=[int(v.strip()) for v in numbers_s.strip().split()],
values=[int(v.strip()) for v in values_s.strip().split()],
)
)
winnings = [sum(1 for n in card.values if n in card.numbers) for card in cards]
# part 1
answer_1 = sum(2 ** (winning - 1) for winning in winnings if winning > 0)
print(f"answer 1 is {answer_1}")
# part 2
card2cards = {i: list(range(i + 1, i + w + 1)) for i, w in enumerate(winnings)}
card2values = {i: 0 for i in range(len(cards))}
for i in range(len(cards)):
card2values[i] += 1
for j in card2cards[i]:
card2values[j] += card2values[i]
print(f"answer 2 is {sum(card2values.values())}")

129
2023/day5.py Normal file
View File

@@ -0,0 +1,129 @@
import sys
from typing import Sequence
MAP_ORDER = [
"seed",
"soil",
"fertilizer",
"water",
"light",
"temperature",
"humidity",
"location",
]
lines = sys.stdin.read().splitlines()
# mappings from one category to another, each list contains
# ranges stored as (source, target, length), ordered by start and
# completed to have no "hole"
maps: dict[tuple[str, str], list[tuple[int, int, int]]] = {}
# parsing
index = 2
while index < len(lines):
p1, _, p2 = lines[index].split()[0].split("-")
# extract the existing ranges from the file - we store as (source, target, length)
# whereas the file is in order (target, source, length)
index += 1
values: list[tuple[int, int, int]] = []
while index < len(lines) and lines[index]:
n1, n2, n3 = lines[index].split()
values.append((int(n2), int(n1), int(n3)))
index += 1
# sort by source value
values.sort()
# add a 'fake' interval starting at 0 if missing
if values[0][0] != 0:
values.insert(0, (0, 0, values[0][0]))
# fill gaps between intervals
for i in range(len(values) - 1):
next_start = values[i + 1][0]
end = values[i][0] + values[i][2]
if next_start != end:
values.insert(
i + 1,
(end, end, next_start - end),
)
# add an interval covering values up to at least 2**32 at the end
last_start, _, last_length = values[-1]
values.append((last_start + last_length, last_start + last_length, 2**32))
assert all(v1[0] + v1[2] == v2[0] for v1, v2 in zip(values[:-1], values[1:]))
assert values[0][0] == 0
assert values[-1][0] + values[-1][-1] >= 2**32
maps[p1, p2] = values
index += 1
def find_range(
values: tuple[int, int], map: list[tuple[int, int, int]]
) -> list[tuple[int, int]]:
"""
Given an input range, use the given mapping to find the corresponding list of
ranges in the target domain.
"""
r_start, r_length = values
ranges: list[tuple[int, int]] = []
# find index of the first and last intervals in map that overlaps the input
# interval
index_start, index_end = -1, -1
for index_start, (start, _, length) in enumerate(map):
if start <= r_start and start + length > r_start:
break
for index_end, (start, _, length) in enumerate(
map[index_start:], start=index_start
):
if r_start + r_length >= start and r_start + r_length < start + length:
break
assert index_start >= 0 and index_end >= 0
# special case if one interval contains everything
if index_start == index_end:
start, target, length = map[index_start]
ranges.append((target + r_start - start, r_length))
else:
# add the start interval part
start, target, length = map[index_start]
ranges.append((target + r_start - start, start + length - r_start))
# add all intervals between the first and last (excluding both)
index = index_start + 1
while index < index_end:
start, target, length = map[index]
ranges.append((target, length))
index += 1
# add the last interval
start, target, length = map[index_end]
ranges.append((target, r_start + r_length - start))
return ranges
def find_location_ranges(seeds: Sequence[tuple[int, int]]) -> Sequence[tuple[int, int]]:
for map1, map2 in zip(MAP_ORDER[:-1], MAP_ORDER[1:]):
seeds = [s2 for s1 in seeds for s2 in find_range(s1, maps[map1, map2])]
return seeds
# part 1 - use find_range() with range of length 1
seeds_p1 = [(int(s), 1) for s in lines[0].split(":")[1].strip().split()]
answer_1 = min(start for start, _ in find_location_ranges(seeds_p1))
print(f"answer 1 is {answer_1}")
# # part 2
parts = lines[0].split(":")[1].strip().split()
seeds_p2 = [(int(s), int(e)) for s, e in zip(parts[::2], parts[1::2])]
answer_2 = min(start for start, _ in find_location_ranges(seeds_p2))
print(f"answer 2 is {answer_2}")

13
2023/day6.py Normal file
View File

@@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

13
2023/day7.py Normal file
View File

@@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

13
2023/day8.py Normal file
View File

@@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

13
2023/day9.py Normal file
View File

@@ -0,0 +1,13 @@
import sys
from collections import defaultdict
from dataclasses import dataclass
lines = sys.stdin.read().splitlines()
# part 1
answer_1 = ...
print(f"answer 1 is {answer_1}")
# part 2
answer_2 = ...
print(f"answer 2 is {answer_2}")

1000
2023/inputs/day1.txt Normal file

File diff suppressed because it is too large Load Diff

0
2023/inputs/day10.txt Normal file
View File

0
2023/inputs/day11.txt Normal file
View File

0
2023/inputs/day12.txt Normal file
View File

0
2023/inputs/day13.txt Normal file
View File

0
2023/inputs/day14.txt Normal file
View File

0
2023/inputs/day15.txt Normal file
View File

0
2023/inputs/day16.txt Normal file
View File

0
2023/inputs/day17.txt Normal file
View File

0
2023/inputs/day18.txt Normal file
View File

0
2023/inputs/day19.txt Normal file
View File

100
2023/inputs/day2.txt Normal file
View File

@@ -0,0 +1,100 @@
Game 1: 7 blue, 6 green, 3 red; 3 red, 5 green, 1 blue; 1 red, 5 green, 8 blue; 3 red, 1 green, 5 blue
Game 2: 9 green, 1 blue, 12 red; 1 blue, 18 green, 8 red; 2 blue, 6 green, 13 red; 3 blue, 13 red, 7 green; 5 blue, 4 red, 4 green; 6 blue, 7 green, 4 red
Game 3: 5 blue, 9 red, 14 green; 10 green, 3 blue; 11 red, 2 blue, 8 green; 5 red, 2 blue; 5 blue, 7 green, 8 red
Game 4: 2 red, 3 blue, 2 green; 17 green, 6 blue, 1 red; 3 blue, 5 green, 1 red; 4 red, 1 blue, 16 green; 5 red, 4 blue, 13 green; 14 green, 5 blue, 6 red
Game 5: 3 red, 17 green, 10 blue; 9 blue, 5 green; 14 green, 9 blue, 11 red
Game 6: 4 green, 18 blue, 3 red; 6 green, 8 blue, 9 red; 4 green, 9 blue, 7 red; 9 red, 1 green, 12 blue
Game 7: 1 blue, 14 green; 1 red, 4 blue, 15 green; 3 blue, 6 green; 3 blue, 2 green, 1 red; 1 red, 3 green, 1 blue
Game 8: 10 red, 3 blue, 3 green; 5 blue, 7 red, 3 green; 3 red, 3 green, 11 blue; 1 red, 7 green, 10 blue; 13 blue, 5 green, 5 red; 1 green, 17 blue, 3 red
Game 9: 1 blue, 6 green; 7 green, 2 red; 3 red, 2 green; 1 blue, 4 red, 3 green; 7 green, 1 blue, 1 red
Game 10: 14 green, 6 blue, 1 red; 8 green, 5 red, 1 blue; 8 green, 5 blue, 5 red; 2 green, 3 blue, 5 red
Game 11: 1 blue, 2 green; 1 blue, 1 green, 7 red; 1 blue, 4 green, 7 red; 2 red, 2 green, 1 blue
Game 12: 5 blue, 12 green, 12 red; 11 green, 3 red; 14 green, 3 blue, 18 red
Game 13: 2 green, 6 red; 6 red, 5 blue; 7 red, 3 blue, 8 green; 7 red, 8 green; 3 blue, 2 green, 3 red; 1 blue, 8 red, 6 green
Game 14: 18 green, 6 blue, 5 red; 5 blue, 15 red, 19 green; 7 green, 11 blue, 20 red; 5 red, 18 green, 7 blue
Game 15: 3 red, 16 green, 1 blue; 11 green, 6 red, 1 blue; 12 green, 2 red; 17 green, 1 blue, 14 red
Game 16: 3 red, 2 green, 5 blue; 1 green, 6 blue, 1 red; 1 green, 2 blue, 3 red; 1 blue, 1 red; 5 blue, 1 green, 2 red
Game 17: 3 blue, 6 red; 1 blue, 2 red; 1 blue, 1 green, 7 red; 1 green, 7 red, 2 blue; 7 red, 1 blue; 1 green, 8 red, 1 blue
Game 18: 6 green, 10 red; 6 red, 7 green; 10 red, 11 green; 10 red, 2 blue, 5 green
Game 19: 2 blue; 1 blue, 4 green, 6 red; 7 green, 6 red, 2 blue; 2 blue, 5 red, 4 green; 1 green, 10 red
Game 20: 6 red, 5 green, 10 blue; 5 blue, 5 green, 9 red; 7 blue, 3 green, 3 red; 9 blue, 12 red, 1 green
Game 21: 4 red, 18 blue, 14 green; 3 green, 14 blue, 5 red; 5 green, 12 blue; 1 blue, 2 red, 1 green; 5 red, 11 green, 7 blue; 17 green, 4 red, 15 blue
Game 22: 1 blue, 14 green, 4 red; 7 green, 10 red; 9 green, 1 blue, 9 red; 1 blue, 8 green, 5 red
Game 23: 4 blue, 5 green, 2 red; 6 blue, 8 red, 4 green; 4 blue, 17 red, 14 green
Game 24: 3 green, 8 blue; 3 blue, 5 green, 13 red; 17 red, 4 green
Game 25: 19 red, 9 blue, 1 green; 3 green, 18 red, 6 blue; 1 green, 7 red, 7 blue; 8 blue, 1 red
Game 26: 10 green, 12 blue, 2 red; 9 red; 10 blue, 12 green, 9 red
Game 27: 2 blue, 8 green, 6 red; 5 green, 9 red; 4 red, 11 green
Game 28: 10 blue, 20 red; 14 blue, 3 green, 2 red; 9 red, 12 blue, 1 green
Game 29: 4 red, 1 blue, 2 green; 1 green, 6 red, 1 blue; 15 red
Game 30: 1 red, 13 blue, 6 green; 3 blue, 4 green; 19 blue, 11 green; 1 red, 11 green, 14 blue
Game 31: 10 red, 12 green; 12 green, 10 red; 2 blue, 15 red, 12 green; 2 green, 2 blue, 15 red; 9 green, 5 red, 2 blue
Game 32: 5 blue, 5 green, 8 red; 5 green, 6 red; 5 blue, 8 red, 4 green; 5 green, 3 blue, 6 red
Game 33: 1 red, 9 green, 5 blue; 17 green, 4 blue; 3 green, 2 blue; 10 green, 2 blue; 1 blue, 4 green; 2 green, 9 blue
Game 34: 11 blue, 11 red, 9 green; 13 red, 3 blue, 5 green; 9 green, 12 blue, 5 red; 13 red, 8 blue, 5 green
Game 35: 1 green, 3 red, 7 blue; 1 red, 3 green, 9 blue; 1 blue, 2 green, 1 red; 11 blue, 5 red, 6 green
Game 36: 4 blue, 12 green, 16 red; 7 blue, 11 green; 8 green, 5 blue, 1 red; 14 green, 3 red
Game 37: 13 red, 5 blue, 9 green; 1 red, 10 blue, 14 green; 1 green, 2 blue, 10 red; 13 red, 10 blue; 1 blue, 8 green
Game 38: 3 red, 4 blue, 8 green; 1 red, 11 blue, 4 green; 13 blue, 8 green; 3 red, 3 green, 10 blue; 1 red, 1 blue, 1 green; 1 green, 2 red, 10 blue
Game 39: 9 red, 7 blue, 1 green; 15 red, 4 green, 1 blue; 2 green, 8 blue, 7 red; 6 blue, 11 red; 12 red, 2 blue, 7 green
Game 40: 13 red, 3 green, 1 blue; 3 green, 10 red; 16 red
Game 41: 1 blue, 3 red; 7 blue, 5 red, 3 green; 4 red, 3 blue, 2 green; 2 blue, 5 red, 1 green; 3 green, 4 red, 3 blue; 5 blue, 2 red
Game 42: 1 red, 4 green; 11 red, 4 green; 13 red; 1 blue, 10 red; 1 blue, 2 red, 4 green
Game 43: 11 green, 13 red, 1 blue; 11 green, 9 red, 2 blue; 7 green; 13 green, 15 red; 1 blue, 14 green
Game 44: 5 green, 14 blue, 15 red; 13 blue, 15 green; 9 green, 15 red, 6 blue
Game 45: 16 red, 8 blue; 1 green, 4 blue, 6 red; 4 blue, 8 red; 12 red, 3 blue, 3 green; 2 green, 4 red, 4 blue; 2 green, 8 blue, 10 red
Game 46: 12 blue, 3 green, 12 red; 9 red, 9 blue; 3 green, 12 red; 10 red, 6 green; 2 red, 7 blue
Game 47: 9 green, 6 red; 1 blue, 7 red, 10 green; 1 green, 2 red; 1 red, 3 green
Game 48: 9 blue, 5 green, 13 red; 14 green, 4 red; 15 red, 9 green, 1 blue; 4 blue, 6 red, 13 green; 9 green, 8 blue, 8 red
Game 49: 5 blue, 3 red; 1 green, 2 red, 5 blue; 1 green, 7 blue; 3 green
Game 50: 8 red, 6 green; 10 blue, 4 green, 6 red; 8 green, 11 blue, 9 red
Game 51: 5 blue; 13 blue; 1 red, 2 blue, 1 green; 1 red, 8 blue
Game 52: 7 blue; 1 red, 2 green, 12 blue; 1 red, 5 blue; 2 red, 7 blue, 4 green; 3 green, 2 red, 2 blue
Game 53: 10 blue, 12 red; 3 green, 5 blue, 3 red; 14 red, 4 green, 7 blue; 1 red, 14 blue
Game 54: 2 blue, 14 red, 3 green; 3 green, 7 red; 2 blue, 3 green, 9 red; 3 green, 7 red; 1 green, 14 red, 1 blue
Game 55: 3 green, 9 red, 12 blue; 5 blue, 5 green, 2 red; 7 green, 14 red, 12 blue
Game 56: 1 blue, 3 red, 4 green; 5 red, 8 green, 1 blue; 3 green, 1 blue, 2 red
Game 57: 8 blue, 13 red, 2 green; 3 blue, 5 red; 7 red, 2 green; 2 red, 5 blue, 3 green; 1 green, 4 blue
Game 58: 4 green, 3 red, 2 blue; 5 green, 2 blue, 10 red; 11 green, 1 red, 2 blue; 4 red, 5 green
Game 59: 5 green; 4 green, 2 blue; 1 red, 9 green; 7 green, 2 blue; 16 green, 1 blue
Game 60: 6 green, 5 blue, 1 red; 5 blue, 3 green, 6 red; 1 green, 5 blue, 14 red; 6 red, 4 blue, 3 green
Game 61: 2 green, 6 red, 6 blue; 6 blue, 3 red; 1 green, 2 red, 2 blue; 1 red, 2 green; 5 red, 1 green, 2 blue; 2 green, 6 red, 6 blue
Game 62: 18 green, 8 blue, 1 red; 8 green, 4 red; 13 blue, 1 red, 3 green; 7 blue, 2 green, 4 red; 4 blue, 12 green, 5 red; 12 green, 11 blue
Game 63: 2 red, 3 blue; 10 green, 13 red, 1 blue; 11 red, 3 green, 4 blue
Game 64: 1 green, 16 red; 17 blue, 9 red, 1 green; 14 red, 7 blue
Game 65: 7 blue, 11 red, 11 green; 7 red, 11 green; 3 blue, 13 red, 11 green; 5 green, 6 blue; 11 blue, 8 red, 3 green
Game 66: 3 blue, 1 green, 3 red; 5 blue, 2 green, 5 red; 1 blue, 2 green, 7 red; 2 blue, 6 red; 7 red, 2 green, 2 blue; 2 red
Game 67: 1 blue, 6 red, 2 green; 1 blue, 10 green, 6 red; 8 red, 2 blue, 4 green; 7 green, 9 red, 1 blue; 8 red, 7 green; 5 green, 1 blue
Game 68: 15 blue, 8 green, 2 red; 6 blue, 2 green; 5 red, 6 green, 8 blue; 6 red, 11 green, 7 blue; 1 red, 3 blue; 5 red, 6 green, 5 blue
Game 69: 5 blue, 4 green; 1 green, 11 red, 9 blue; 4 green, 15 blue, 6 red; 11 blue, 4 green, 5 red; 8 red, 3 green; 5 blue, 8 red
Game 70: 5 blue, 4 red, 8 green; 6 blue, 6 green; 14 blue, 7 red, 1 green; 2 green, 6 blue, 3 red; 7 red, 11 blue, 3 green
Game 71: 13 red, 6 blue, 10 green; 7 red, 12 green; 9 green, 14 red, 2 blue
Game 72: 9 red, 3 green, 3 blue; 8 red, 7 blue, 5 green; 3 blue, 2 green, 1 red; 1 red, 2 blue, 2 green; 10 red, 7 green, 6 blue
Game 73: 4 green, 3 red; 1 red; 2 red, 2 blue, 2 green; 1 blue, 3 red, 1 green; 2 blue, 3 red, 2 green; 1 red, 1 blue
Game 74: 12 green, 4 red, 4 blue; 3 red, 13 green; 1 red, 13 green, 1 blue; 1 red, 3 blue, 6 green; 6 blue, 5 red, 4 green; 7 blue, 5 green, 1 red
Game 75: 11 red, 1 green; 12 blue, 1 red; 2 blue, 1 green, 4 red; 11 red; 12 red, 6 green, 10 blue; 4 green, 5 blue, 7 red
Game 76: 2 blue, 5 red, 6 green; 1 red, 10 green, 11 blue; 7 red, 11 green; 4 red, 10 blue, 10 green; 7 blue, 16 green, 2 red
Game 77: 2 blue, 11 red, 4 green; 6 green, 3 blue, 2 red; 2 blue, 2 red, 7 green; 8 red, 14 blue, 5 green; 5 green, 2 blue, 18 red
Game 78: 9 red, 7 green, 6 blue; 12 blue, 6 red; 1 red, 15 blue, 7 green; 3 blue, 11 green, 1 red
Game 79: 3 blue; 1 blue; 1 red, 1 blue, 1 green; 3 blue; 5 blue, 1 red; 1 blue, 1 green, 1 red
Game 80: 18 blue, 13 green, 7 red; 18 blue, 3 green, 3 red; 2 red, 9 blue, 14 green
Game 81: 11 blue, 6 green, 3 red; 8 green, 12 red, 10 blue; 5 red, 4 blue, 13 green
Game 82: 2 blue, 3 red; 4 blue, 17 red; 9 red; 12 red; 1 green, 6 blue, 7 red; 20 red
Game 83: 1 blue, 1 red; 3 red, 1 blue; 3 red, 5 green; 1 blue, 2 green, 4 red; 5 green, 3 blue, 2 red
Game 84: 4 red, 2 blue, 2 green; 8 red, 10 blue; 1 green, 15 red, 8 blue
Game 85: 15 green; 11 red, 2 blue, 5 green; 8 red, 2 blue, 12 green; 15 red, 10 green; 10 red, 15 green; 17 red, 1 blue, 11 green
Game 86: 6 blue, 1 red; 2 green, 1 red, 8 blue; 2 green, 10 blue; 10 blue, 2 green; 1 red, 5 blue
Game 87: 4 red, 4 blue; 18 red, 8 blue; 16 red; 4 red, 1 green, 3 blue; 14 red, 9 blue
Game 88: 11 green, 7 blue, 4 red; 3 red; 2 blue, 12 red, 19 green; 13 red, 3 blue, 2 green
Game 89: 1 green, 1 red; 1 blue, 1 red, 6 green; 6 green, 3 red; 5 green, 2 red, 6 blue; 7 blue, 2 red, 8 green; 1 red, 2 blue
Game 90: 3 green, 3 red, 3 blue; 5 green, 2 blue, 3 red; 1 blue, 2 red; 11 green, 1 blue, 2 red; 1 green, 3 blue, 4 red
Game 91: 7 blue, 2 red; 2 blue, 1 red, 1 green; 6 blue, 1 red; 1 red, 7 blue
Game 92: 11 green, 16 blue; 17 red, 7 blue, 9 green; 11 green, 3 blue, 12 red; 2 blue, 1 green, 6 red
Game 93: 6 red, 1 blue, 3 green; 1 blue, 8 red, 7 green; 3 red, 5 green; 1 red, 2 green; 3 red, 7 green; 2 green, 15 red, 1 blue
Game 94: 7 blue, 2 red, 2 green; 9 blue, 4 red, 2 green; 9 blue, 5 red, 3 green; 1 blue, 4 red, 3 green; 4 red, 1 green, 7 blue; 9 blue, 3 green, 3 red
Game 95: 1 blue, 2 green, 2 red; 6 green, 6 red, 1 blue; 3 blue, 5 red, 2 green; 1 blue; 5 green, 2 red, 2 blue
Game 96: 3 blue, 6 red, 5 green; 5 blue, 8 green, 9 red; 2 red, 5 green, 1 blue; 6 green, 4 blue, 3 red; 2 green, 2 blue; 6 blue, 4 green
Game 97: 6 green, 8 blue, 5 red; 9 green, 6 blue; 3 green, 3 blue; 2 blue, 10 green, 4 red
Game 98: 11 blue, 1 green, 9 red; 5 green, 1 blue, 6 red; 13 blue, 6 green, 10 red; 6 blue, 4 green, 9 red
Game 99: 4 red, 3 green, 3 blue; 6 blue, 4 green, 11 red; 3 green, 15 red; 1 blue, 6 green, 14 red
Game 100: 14 green, 6 blue, 12 red; 2 green, 1 blue, 2 red; 12 red, 7 blue, 3 green; 1 blue, 12 red, 8 green

0
2023/inputs/day20.txt Normal file
View File

0
2023/inputs/day21.txt Normal file
View File

0
2023/inputs/day22.txt Normal file
View File

0
2023/inputs/day23.txt Normal file
View File

0
2023/inputs/day24.txt Normal file
View File

0
2023/inputs/day25.txt Normal file
View File

140
2023/inputs/day3.txt Normal file
View File

@@ -0,0 +1,140 @@
......124..................418.......587......770...........672.................564............................438..........512......653....
665/...*......................*599.....*.983......794*..140..*...........@..963*....................445........*......*.........709.....*...
.......246.....581......701..........108....%.532........../.73..699...927............................*....579.354.464..............298..86.
........................*.....@...............%........$............+.........167..................408............................$..*......
....914......335.......513..245....106=...............974................749.....*.702.......589........803........*176..386.....631..340...
....*.......*...........................48...203@.............767......*..../.362...$......................*159.381.........................
..620.....430.....612.507.........365.....................335../........938.................154.........@....................682............
.....................*...........*..................470.........................889...........*.....@.489.....453$.329..334............86...
..........324...............431..58..533-../..-...../......*405.................$.............47..474..............*......*.......930.*.....
............/.....*350....................400.502...............$...........168.......855.635....................258.......794...+.....846..
........................560...72.945..............866..........783..328....*....116......*...........179..904........682$..........333......
.....674...........152....*....*....*815.........*........$609.............737../................583*........*.84..............767*.........
..../......55@....+........645.914................987..................*..........972.........#.......80..750........588................=260
.....................349&...................../.................754.407..203*720./.......207...14...............=88...+...767...............
.........*824.............890.......269....893..271*139..645....*...................233...%................428...........*.........79.......
..........................#............*.................@.../...316...844.............*........@439...287*......*974.....182...............
....*.....50.......671+.................267........634*....417............-.598.....531....891................331................358.....341
.883.561..*....428.........../14...742...........@.....654.....809../716.......*456.....=....*........$..............................607....
...........835..*..796*............*..............321......612*.......................299..203....962..431..........277.......40......$.....
......+591.....916.....294.........446..111......................237*77.....&........................-................*...150*....*......873
....%..................................*.....................819............522.................922................738.........214.595..&...
...552.........*...............+545.....627...........601......*..801..............867.....954....*.984.....752..........*830...............
............276...939.............................979....*.........*........866*.....*.......*..963.-.................172...................
278................*......@..........52........51*....851..766@..515.949=.......736...456...107............796.@668..................#......
...*...431.................616..............................................79..................651.806.....%.............554.........740...
.969...-............................-..........721.......555.657....+.........*....#....704........*.................556...*....196.........
................*228..........312.201.....490...%.........*..#...815........896..417.....=....890.....274....884.683*.......327...*.........
......@......742.............*........393*....=........715..............535...................*.........................529.....741.....#...
.......386........244......196...............815...........869....+580...*...................71........654...454..346=.$.............909....
....................................................265...$.............738..401...984...........265.....*......*...............-...........
.......=.....184....148....14.........685...990..................80..=....../........$.......511....%.....424..400......184..551............
.....71......*.......@............812.........&..$.....573*613.....*.677.......#.......299..&.......................933.....................
...=.......142...917...-989....76*....230...*....105.............920.....+......371.......*............660..692.........553*........%.......
341................&.....................=.29.............643.82......*...714............222....934......*....@.............178..581..+.....
...............874...129.......................739*971.......*.......176.............3.@...........*..219..40..........#.............168....
.....179..............*...741.......524...................................757.=633..*...136......63........*..........399...................
.......*....315....307....*.....%..*.............718......371....=....654*..........89...................194........................+.23....
.....737.........&........540.253...80...273......*.........&...773............492.................722........113....970..=195....702.......
..............869..........................*.539...434...............393*933......*........679.874..%......=....*...........................
............................$....148......43...*............@....................67.876........=......./..388..920......423.........-.......
..118*773.142....%565.......397....*.........352..#..........217......................*....865......257..................*........421.415...
............&.........898.............607..........897...631.................787...840.......*..............684.........34.359.........*....
........995....235.....@.........#.......*.932*.............*73...940..997..#..........&.&...942...$.727..........115.........*122....380...
................-................131...........265...827...........*....*............797.490.....845..*..........#....+823..................
............96.......................383.......................53.292....19...536......................42..668..................579......666
...-..487............680..&...*45...&........801.............*.*.................-........374.....................128..109.......%....*.....
.611.+..............*.....151................=......739....622..572................103...........683.....245..748*....*............298.67...
........*735......911...................562........@.........................458.....*...753........................275.362*................
.....683......702.....736.230.....457.........................13................*..126...........458........................890.........992.
...............*......*..........*.......499........10.........+...227.227...542..........................167....661....................*...
.............691.7....135.62..157..570..*....304......*...........*......*................$589....#946....*.........*............132....190.
........687.......*.........*............768..-...453..643.........844....706...%......................509........767......*................
...........*....485......859...........*.........................................92...268.........193.....................385.....991*722...
...-.....18..................217......853................................28..............*........@.......+......302........................
...103......60=..*352...........*916........351.....347..=..452.810....................304..........539.346.......*....................*....
......................610..........................=....990.....=...819....*496..797.................*........946..44..................261..
.......630.............*........882.........................173....*...............*....903....44.....318.212.@.......-.....................
.......-......-...........@..=.....*841.....812.......515......*....713....+.....566....*...................*......344..297....356.430..%...
.........*482..453.......279.554./............#..320..*.....................671......873........&...637$.....413........@.........*.....906.
....263...........................861......*....*.....908......365....123.......494.............134.................808.......*.....*.......
..........465.....520%.....................432.76..........160........*......................26.......218....14.......*......598.874.844....
...417......%.............138.....................$..............84..............272...573.....*.296.*................585...................
...*................596...&......................783.....992..........*....982.....*.........857..*...314...797..265........*....*..547.#...
....260........75....*...........389....616=.........5.....*.....695..427..*....780....-425......872..........*...*.......49....599.....19..
..............+.......389...........*33.........596.......600......*......67......................................567.......................
...802............................$.....302....*.....-93........434............$........554../339..............................277..........
.....*....................$.....822.....*.....89...........233..........602.....911.....#..........958............475......773*.........%989
..849.............228..868..217......679.......................99*...../............................*.......................................
.........253.........*......*....................643..............796......-200...355..469.........174......=........174....279.638.........
295*22..*............664...462.-238...................&765.........................*........................241..............$.......%......
.......937.....25....................422.264.................244...........628...340..................106.........................551.....82
897*.........../..60.......361.......*......#.....164.........*.......804*....%..........670*194........#.......#..........83...............
....754............*.................51..47.......*.........487...585.....202........838..................28...734...*457..............427..
............155...705......................*....912.....887..........................*....*875...........*........................&.........
..952.621......*.............+983...........832.....783....@.......432#...+........530.223.............456......462...257*100......763......
..........=..905........................892...............................262..85..........#..................-../.....................671..
.........994...............476.............%.665...524...53*........939*........*..........703..497.........186............=.567........*...
154...............$412......&..........-.....&.....-........41.109......282......676...........%....&80.@...............439...*.....@...997.
........+130..................296.....308................@.....*...902..................................77....833.....%.....932.102.48......
................407%.%685......*..........927.=222........426.450...*........12.....82...../..570................*...798..........*.........
..825.....................923.429......#..*........#630...........409..314*..........*...569.....*....273..648...961.............279........
...=..827=..........293.....#.........875.401.............457.433..........690.....600............929......*..............*245.......93..94.
.............557.......*.......................52........@..........284.......................450......................986..........*.......
........................463.....583..708...........................+........101....834.445.......*.....336...................694...333......
....556....923................./......*..433.....182....181.........................*..*......492..598.*............260.....*...............
......*.....*....430...............960....*...+..&.......*..=96.....628.282...@355.833.883...........*..468...420...........288.............
...140...682......*..945...150............7.654....+83.941...........*......@................#....7.780.......*......922.........334........
.............365..49.......$...590............................608.........503......./......36.....*.......74...340.....*....................
..........@..*.......870.-.....*...284*556................288..*...@.............$.526............587....*...........387....................
.......188....626.$......372.733.............................*..97.466.....776.541......................413.950..........696.162............
...../.............755...........62......99...............224...............-.........333......................*..337.....*....#......%233..
442..7.......=...................#...........875*705.548..............963...............*......180.....581...350.....*....513...............
..............377....................................*.........#......*.........291......981..*...........*..........74..............&......
......895.........644...................613.......540...........756.............%............390.263....754........#.....713-.....450.......
...85*....$.............297......%.........*..........156............974./870....................*...........12....426.................483..
.......774............#..*.....872.............361......-...196..................849...........419............*.........221....667..........
...................961....604...........644....*...............*........../927......*......503................124........-......../...238...
....370.............................531*......174.693.........349..................495.......*....925.......................................
.....+...104....582...602*604...123..................*..896..........71@.....................767...............573@....656......%...........
140........*...@...............*.........-........592..*....................806..692.....511...............755..........*......917...636....
..........905.......462.....+...655......860..150.....800..903.......8*920..........*867.@...................=..........269.................
....582..................217........842.........*...........*..................912...............551...615.......-..........343*129....+....
....*........................./.....................752..347...275...127.@........*.....804.....#....+.#.........252...845............671...
..862..........38..........293....429...@............*.......*...#.....*..245....330.......*18.....182.....$538..........&..725.............
.................=.............46*....696.............581.664.........608...........................................%.......=...............
...*724.....977.............................../................565...............#15...............................782.........359....$.....
529.....373.*............198.983.....980..559..592...100.579......*889..145..839..............790.....496....193......................545...
.........*..560..769.......*.....775...*.............*....@..104................*...%..820.....*......*.....*.............245...160.........
.....338............@......28.......*...725.687....761......%...............%..423.773..*.....315....765..69.................*...*..........
.851*.....619...333..............907..........*.........512....536..........98.........434....................48.613.973..941...554..751....
....................*564....122.............608........$.........-.........................48.........435.......*.......*............&......
...........165*967...........-..799.186.938......@.615...317........................630...........551*................345...................
....968............281.546.......*.....*.......225.......*...162....372.........&85...+...177@...........719..55................360*........
.......*.......%.......#.......226....................341.....*......*.............................341.........*...........989&.....321..618
....884..554.163...%...............*423.233.................653...557....$....910...................*...........109....772..................
..................854......167..560......@.....311...958..............492.....*.....*877.........@...911..797%...........*..................
....852.815.....9.................................*....#...../..941.........960..494........56.375.....................50..+......=...106...
....*......*461.&.......739....$..........=.$562.276.......408.....=.....................=...%.................769.........893..463..*......
.133..................-........797.....313...........................................20.214.....357..776.471......*687.@.............527....
.......14........899...845..........*..........+.....46........634........914.....84../...............*.....*780.......878..%36.435.........
542.....*...........$........*833...257..329-.147...........+........150..*......*.......907...........429.........................*....#...
.....517..799.44@.........230..........................477.579...........836......839.....-.....................964.704.............194..310
298.......*....................307..800......346.65.....*..........414........@.......619........&442.............*..*......................
...........510...+.....837.237*.........../.....*.....270.....818$..+..........27....*.................163.....140....647....764.163........
................181...*..........536#....335......................................610..170...............*.-....................*.......&...
.......................832........................#........&........611.........................&55...428..472....586......111........768...
.......763.....................................461.........381......-............566..814.....*.....................*........./............8
.............+.......................318............695............................=..%....323.756............711..663............827.......
...........526....=....675...353&.....@..982#......*..................+.62...880+..................631.......$......................-.118...
..................655....*....................795..30...922*.......978...+.&.........539...........-....719.................599.............
......2...574%..................#.698...475.....*...........652./...........464.163$...*..338*966.........................../.....534..386..
......*.......................404..#............747...703........231...-...............................................................*....
.......906.................................&575.........&....457.......633...395..761...355.#780....3+......799+...............496...264....
311............967.682............%.838...........253..........@..551.......@....*.....*.............................487.........*..........
..........@.......*......925....376....&...419......=.............*..............20..952.111/....648.&........748................834..706...
..443....940.............*....................*..........................820.684...................@.755........*........106.283............
..............397.........803...84............627..........704.983..........*................522............................*....541........
.....32....$.....#...643*..............116........./905......*..../...........311......811$.*........*890..........924..670........=....882.
......*.....81.....*.....636.......317...*...................899.............*....*698............626....................-..+..@.......*....
.......877......256.714...................825.........458....................869..............................54............28.823..110.....

203
2023/inputs/day4.txt Normal file
View File

@@ -0,0 +1,203 @@
Card 1: 8 86 59 90 68 52 55 24 37 69 | 10 55 8 86 6 62 69 68 59 37 91 90 24 22 78 61 58 89 52 96 95 94 13 36 81
Card 2: 6 42 98 5 17 31 13 36 63 61 | 99 88 14 20 63 5 56 33 6 21 92 13 17 7 31 93 30 74 98 15 11 36 61 42 47
Card 3: 16 58 72 77 1 67 33 82 68 7 | 16 37 15 75 78 1 49 82 22 45 83 58 77 79 50 88 98 67 33 72 42 29 35 7 68
Card 4: 75 35 37 6 29 54 64 57 82 4 | 8 33 27 85 84 54 75 37 4 57 70 29 64 94 17 6 38 41 82 81 71 35 47 51 19
Card 5: 23 85 52 77 81 50 28 59 87 82 | 70 65 12 35 9 41 62 31 47 66 58 15 76 46 68 67 55 86 17 38 18 1 75 79 13
Card 6: 77 64 13 36 68 88 16 75 25 95 | 25 64 55 58 75 66 23 16 27 68 69 88 13 9 39 42 29 65 83 97 32 89 53 96 94
Card 7: 31 12 76 29 48 96 41 49 21 37 | 94 81 65 82 15 33 53 91 88 37 46 29 3 80 95 67 11 27 31 30 49 89 78 41 90
Card 8: 20 5 52 31 46 25 88 95 39 83 | 36 62 48 39 69 3 81 11 61 95 43 85 34 46 5 8 13 45 10 17 2 88 70 52 89
Card 9: 8 85 89 55 77 9 40 5 57 37 | 56 84 62 42 49 50 51 35 75 25 13 74 68 1 99 48 41 94 45 66 17 69 23 29 67
Card 10: 74 1 7 89 97 82 75 9 11 42 | 94 71 41 30 50 58 23 81 35 6 97 57 67 85 98 10 87 43 96 77 31 8 54 72 65
Card 11: 38 29 6 5 4 84 34 1 94 23 | 89 48 51 84 49 33 50 65 79 53 12 8 5 1 35 69 83 57 11 42 67 26 9 6 55
Card 12: 35 83 44 75 36 65 85 87 60 72 | 8 3 91 33 59 29 56 26 21 60 80 88 25 5 51 47 46 44 41 31 62 79 76 89 55
Card 13: 8 56 97 66 32 70 25 76 18 20 | 15 50 91 65 3 67 98 81 9 44 18 92 13 64 96 47 87 46 7 33 66 71 82 88 90
Card 14: 37 52 63 28 19 89 44 76 98 24 | 70 13 59 31 17 84 90 6 62 19 74 36 94 1 15 12 29 95 47 92 23 67 60 58 53
Card 15: 71 70 25 51 95 86 66 37 27 53 | 14 20 30 17 59 96 11 68 46 13 75 44 40 62 32 7 81 91 73 64 93 83 35 80 49
Card 16: 97 4 63 22 75 73 5 52 34 26 | 33 98 64 47 90 94 28 35 43 30 73 51 7 27 10 40 97 37 34 32 22 71 63 21 80
Card 17: 15 18 29 55 14 25 69 4 59 75 | 66 4 82 23 94 22 26 16 55 69 75 20 76 25 29 59 15 18 70 2 28 39 95 14 40
Card 18: 26 40 70 42 37 68 25 76 56 97 | 33 97 28 13 24 50 66 53 67 84 26 68 42 56 92 40 65 76 25 32 70 93 85 37 94
Card 19: 56 61 7 53 48 88 77 73 27 79 | 50 81 29 15 46 19 33 89 54 85 58 73 68 34 84 2 40 27 44 94 88 62 14 1 56
Card 20: 34 89 62 72 6 30 16 53 78 2 | 2 78 73 89 85 40 47 30 34 8 60 23 72 26 62 96 6 91 29 16 57 46 59 53 94
Card 21: 65 18 22 53 8 31 32 84 39 9 | 75 16 70 3 14 61 34 9 38 71 8 49 53 52 81 18 45 82 41 44 32 63 65 51 69
Card 22: 44 80 76 71 36 1 50 87 23 27 | 1 76 83 67 87 68 25 80 8 23 57 29 52 4 50 64 24 44 77 45 27 32 36 73 71
Card 23: 68 90 10 43 73 63 85 47 11 96 | 9 29 53 84 4 6 25 82 11 21 73 83 20 95 66 27 80 26 70 33 85 47 17 74 98
Card 24: 51 68 2 69 39 86 55 70 6 54 | 72 17 14 26 91 52 96 86 66 64 51 2 92 53 36 39 89 42 40 68 55 37 6 54 7
Card 25: 74 92 43 35 29 93 39 53 10 54 | 86 35 10 18 92 43 56 25 44 53 93 39 29 54 11 12 55 61 83 41 21 69 81 4 74
Card 26: 80 19 99 93 76 67 70 60 39 9 | 98 2 26 95 21 49 44 9 31 58 83 46 14 99 4 78 12 56 89 71 66 29 47 64 96
Card 27: 92 52 5 46 49 62 74 72 44 87 | 37 93 24 29 5 88 72 81 62 50 69 33 52 19 23 8 84 1 70 87 95 96 61 63 49
Card 28: 79 80 98 59 54 45 91 16 11 4 | 80 10 98 45 78 91 1 65 12 11 4 82 88 79 54 55 8 99 59 67 68 16 25 3 70
Card 29: 52 30 9 13 44 71 48 63 65 27 | 90 31 17 80 44 39 85 93 58 65 8 63 16 35 40 1 73 68 52 6 97 99 13 10 61
Card 30: 12 19 35 9 82 20 72 61 50 67 | 11 84 77 14 46 29 62 28 81 98 43 12 15 72 35 99 19 97 75 1 20 7 82 60 52
Card 31: 21 58 93 11 50 25 88 77 64 29 | 42 1 31 30 99 69 54 32 88 24 95 15 55 56 14 45 19 33 87 34 7 93 79 23 74
Card 32: 39 87 70 22 46 95 69 3 58 80 | 85 95 24 45 84 22 37 12 33 43 93 96 27 56 70 67 91 58 10 68 69 40 97 82 13
Card 33: 91 42 78 76 77 27 22 98 94 70 | 80 17 63 21 37 52 46 44 2 7 73 86 49 40 23 4 92 60 43 76 29 22 24 69 42
Card 34: 11 50 70 95 32 81 26 57 7 76 | 83 64 65 46 87 56 28 98 90 11 96 40 99 3 16 12 61 19 97 76 51 92 93 34 15
Card 35: 80 28 55 51 98 5 92 54 73 78 | 78 66 10 38 36 51 1 83 94 33 42 17 62 56 59 21 86 25 46 48 63 12 45 31 65
Card 36: 63 76 16 74 10 14 50 73 81 35 | 3 68 1 76 62 53 67 97 13 85 28 65 32 72 34 98 57 20 71 17 64 48 8 56 44
Card 37: 37 1 38 62 56 27 17 8 21 98 | 78 31 14 23 18 62 4 2 97 88 59 34 57 46 81 16 36 58 86 35 72 61 7 80 28
Card 38: 56 30 92 44 33 11 16 45 72 60 | 74 86 59 87 22 81 46 32 52 21 78 10 57 1 13 85 49 75 95 29 8 38 77 54 50
Card 39: 66 83 99 18 79 70 57 25 86 55 | 8 41 50 87 77 7 78 84 53 35 43 26 13 29 30 69 91 65 32 59 31 45 56 15 48
Card 40: 64 46 22 83 33 38 95 75 69 89 | 82 65 45 68 75 33 69 49 22 95 89 74 53 46 38 25 83 64 8 59 81 16 94 27 60
Card 41: 90 26 49 5 76 98 92 64 19 32 | 47 35 49 45 13 67 73 55 4 64 79 63 89 57 5 75 85 91 25 88 74 70 28 68 86
Card 42: 45 52 92 43 76 96 4 86 53 62 | 96 53 55 18 95 44 25 45 47 66 62 2 52 60 10 3 1 37 87 92 98 70 9 86 23
Card 43: 9 64 57 76 21 30 38 98 85 1 | 11 22 92 81 58 59 48 75 2 32 15 84 27 56 86 99 98 66 54 96 20 37 67 12 29
Card 44: 11 41 84 1 76 6 64 8 31 44 | 11 1 33 58 55 6 84 44 70 20 64 41 90 98 72 42 8 38 4 39 76 17 18 69 31
Card 45: 88 12 95 1 24 71 70 49 79 8 | 86 57 43 12 90 78 70 76 24 95 39 8 1 13 47 71 49 75 15 32 2 77 58 79 21
Card 46: 84 91 96 41 17 76 9 36 81 1 | 82 5 99 19 43 20 86 69 37 44 95 41 55 65 96 70 24 47 77 15 31 36 2 79 22
Card 47: 48 80 18 4 40 11 90 17 27 68 | 33 40 15 99 48 12 25 27 44 17 50 94 68 63 11 29 80 4 18 42 32 90 19 2 91
Card 48: 44 30 51 97 22 57 87 17 53 11 | 35 17 81 22 11 30 75 80 74 54 79 16 78 97 89 87 51 37 43 72 53 57 27 94 23
Card 49: 31 2 7 13 9 33 95 41 57 34 | 25 90 77 13 1 95 18 17 34 92 10 33 80 2 82 66 91 73 70 86 21 7 42 47 19
Card 50: 16 44 77 76 23 81 47 29 62 22 | 35 27 83 47 88 76 98 64 31 86 48 42 95 67 25 44 17 51 18 26 12 1 90 99 62
Card 51: 55 68 41 17 28 83 64 62 22 13 | 24 6 23 22 64 7 83 74 44 34 28 68 13 32 26 50 62 17 12 41 97 55 16 1 9
Card 52: 96 79 43 83 37 25 86 24 66 34 | 79 18 6 2 64 62 86 48 65 34 29 68 9 87 76 71 3 69 61 41 40 35 37 55 32
Card 53: 46 1 10 43 47 17 62 52 58 75 | 58 14 52 71 31 75 55 50 8 99 63 23 4 13 10 62 16 17 82 43 56 46 76 83 65
Card 54: 75 33 27 30 87 32 68 89 44 17 | 73 28 31 97 27 9 57 14 15 20 39 82 38 36 43 58 75 4 44 30 33 80 16 48 17
Card 55: 70 11 9 44 14 32 83 10 99 71 | 65 48 21 75 83 71 92 2 34 22 11 14 39 31 63 25 88 15 80 76 96 90 52 70 99
Card 56: 17 38 6 13 3 67 87 64 37 68 | 41 7 53 11 5 62 93 28 65 8 56 32 1 69 47 18 82 40 20 12 80 37 89 43 2
Card 57: 64 29 46 22 61 56 32 20 97 72 | 31 14 29 44 74 22 1 56 4 52 58 45 50 78 67 11 97 72 16 20 27 57 61 83 85
Card 58: 62 85 13 46 79 37 99 81 91 8 | 98 17 85 23 33 94 35 2 47 20 3 11 36 96 43 46 25 60 59 10 22 55 87 58 28
Card 59: 58 36 55 31 69 91 21 51 56 10 | 19 49 73 6 34 27 40 65 11 55 44 67 37 97 14 85 84 89 72 29 64 15 70 68 94
Card 60: 46 40 95 45 75 74 7 38 10 81 | 32 38 4 61 78 5 39 99 86 33 2 98 83 42 11 75 27 73 81 9 54 37 40 12 80
Card 61: 40 29 73 56 91 44 24 77 1 5 | 87 52 80 45 70 48 47 44 69 17 16 6 82 66 37 42 39 3 10 15 97 13 40 99 62
Card 62: 54 55 29 80 70 50 97 89 33 68 | 21 3 76 73 6 42 2 91 19 18 72 92 94 11 77 32 52 8 81 48 35 16 27 12 84
Card 63: 19 45 77 86 6 33 83 91 52 36 | 18 68 60 58 84 29 9 67 21 99 24 80 69 96 25 85 46 50 95 27 61 4 90 63 88
Card 64: 88 23 57 8 93 17 20 42 54 51 | 12 78 82 80 85 43 73 44 84 89 15 36 30 10 25 29 7 99 61 60 86 14 26 28 83
Card 65: 92 13 3 54 4 95 28 72 8 15 | 15 60 66 33 82 95 94 69 71 59 54 99 40 31 83 17 13 80 28 72 4 92 45 87 46
Card 66: 1 42 10 66 94 21 46 95 73 32 | 64 99 3 86 69 71 95 78 60 28 5 19 35 85 67 7 32 16 39 66 89 42 31 43 58
Card 67: 87 50 23 52 5 22 88 82 59 72 | 26 59 48 90 82 55 50 37 87 35 2 52 72 11 40 23 54 88 19 33 5 97 86 22 30
Card 68: 21 89 80 14 73 61 9 7 68 48 | 18 89 38 26 32 21 79 15 14 86 44 55 95 41 80 7 9 29 73 1 13 48 68 28 61
Card 69: 9 82 65 50 57 40 96 36 83 60 | 96 17 88 60 40 74 33 19 41 23 82 89 92 72 50 83 4 7 56 34 9 36 52 57 65
Card 70: 40 63 61 64 3 21 52 11 66 53 | 82 42 13 30 44 72 74 83 45 70 38 33 80 8 64 48 49 73 19 51 85 47 90 84 92
Card 71: 92 24 98 94 89 41 1 93 28 32 | 28 61 92 13 53 89 43 23 32 66 81 93 94 38 90 36 24 68 1 91 98 41 29 67 64
Card 72: 29 61 68 1 78 69 33 45 39 18 | 81 12 36 28 73 75 18 35 42 33 95 68 3 79 39 8 24 82 87 45 11 91 23 51 1
Card 73: 15 33 51 46 80 95 67 71 97 16 | 23 7 93 94 55 33 5 84 28 32 15 59 98 6 46 17 86 43 39 81 36 42 63 71 82
Card 74: 95 9 16 72 30 20 41 97 45 90 | 30 72 49 66 36 9 82 98 95 16 48 57 46 86 47 90 20 85 54 74 73 4 22 60 32
Card 75: 82 55 49 44 75 57 19 59 38 4 | 21 78 35 6 93 75 28 41 83 72 55 22 64 89 70 47 23 29 20 99 48 53 27 65 13
Card 76: 19 31 41 50 27 43 74 21 51 44 | 24 79 71 16 49 37 60 14 8 33 52 40 98 6 34 62 56 4 10 30 39 48 99 67 22
Card 77: 39 23 28 96 98 50 40 34 79 74 | 85 68 79 33 48 23 56 10 89 38 50 71 17 28 6 74 53 4 98 26 8 22 39 31 66
Card 78: 80 31 82 32 70 17 68 44 22 97 | 72 6 95 57 13 94 37 44 70 46 32 69 22 56 40 15 77 88 17 82 31 47 71 18 68
Card 79: 37 53 75 59 72 43 65 74 81 26 | 37 23 11 48 45 86 74 2 59 58 92 12 65 78 16 97 57 76 67 26 18 41 43 54 49
Card 80: 63 41 23 39 40 10 26 93 24 73 | 30 19 74 40 49 90 22 65 78 10 24 93 73 41 51 7 61 15 29 39 63 16 64 23 37
Card 81: 88 68 74 9 97 46 11 87 39 10 | 40 3 14 85 64 43 42 97 90 9 39 13 29 72 47 10 48 4 68 96 99 25 98 65 57
Card 82: 81 48 21 57 65 39 12 66 95 33 | 16 33 79 85 92 52 50 34 15 22 9 45 74 17 24 63 28 72 84 62 58 77 41 64 83
Card 83: 45 33 86 43 63 96 25 88 53 15 | 73 93 79 18 2 26 21 65 28 57 52 88 1 80 33 38 76 3 56 35 6 23 34 24 13
Card 84: 31 74 96 40 36 99 91 92 63 10 | 78 38 59 27 84 34 31 72 19 91 12 45 57 92 32 44 70 50 10 24 87 33 49 65 61
Card 85: 24 20 39 42 78 57 12 64 40 44 | 68 34 77 20 21 12 35 23 97 3 50 65 42 18 84 41 43 69 94 37 76 57 31 45 79
Card 86: 51 48 14 80 3 72 92 15 35 43 | 50 69 18 76 63 30 58 19 65 16 70 55 54 12 87 62 60 68 93 83 1 44 26 98 27
Card 87: 11 4 31 73 5 81 2 32 29 51 | 3 47 9 18 16 19 66 36 23 70 91 64 69 87 51 84 43 65 35 42 63 72 82 54 93
Card 88: 94 10 52 17 78 45 99 66 8 81 | 11 31 71 59 41 88 67 30 47 98 33 21 37 15 53 20 36 58 57 91 39 28 49 70 86
Card 89: 28 68 50 39 98 57 78 71 11 48 | 95 67 79 86 53 17 66 60 77 6 44 54 19 31 74 80 63 99 47 12 91 21 70 8 10
Card 90: 36 90 94 26 59 84 63 38 48 39 | 69 56 39 88 89 97 26 38 83 55 87 13 33 68 95 94 18 48 36 44 59 84 63 90 66
Card 91: 89 3 61 68 53 85 66 81 11 78 | 29 10 81 58 22 47 19 3 36 98 61 85 89 78 39 17 50 53 11 66 68 24 4 86 25
Card 92: 57 5 56 91 64 38 89 47 55 74 | 73 51 48 19 57 98 64 9 74 65 53 47 54 72 69 38 56 1 21 6 91 40 55 5 89
Card 93: 6 86 18 53 9 82 70 81 89 26 | 21 69 75 10 8 86 89 70 47 23 78 96 98 53 6 9 2 81 31 56 39 55 18 1 42
Card 94: 86 78 79 57 3 2 5 69 30 53 | 80 2 53 90 3 30 48 79 5 78 19 35 62 59 97 56 13 12 70 86 10 69 51 55 57
Card 95: 64 51 15 84 25 94 88 80 20 33 | 1 90 50 47 32 15 20 51 84 65 64 55 39 94 19 66 40 25 88 43 80 34 29 3 92
Card 96: 83 88 94 87 79 45 49 91 99 33 | 91 53 72 37 87 40 26 88 33 49 89 99 24 59 94 52 75 83 79 71 62 50 92 28 6
Card 97: 51 91 36 6 68 9 97 78 39 80 | 18 97 68 34 91 61 78 3 23 84 8 16 36 96 65 99 59 80 58 90 14 32 1 41 74
Card 98: 92 41 9 7 52 86 83 40 8 63 | 47 17 14 35 34 22 19 52 79 7 81 92 1 82 93 73 25 58 60 39 59 27 3 16 41
Card 99: 72 47 22 4 62 58 31 91 34 50 | 49 65 94 71 82 25 24 9 64 62 50 60 14 84 16 93 1 46 8 19 47 44 21 10 11
Card 100: 96 18 53 37 54 98 30 84 58 45 | 30 59 89 23 8 35 85 6 36 54 37 17 92 79 27 39 4 61 11 80 19 58 72 51 47
Card 101: 67 26 23 99 78 60 55 82 83 11 | 60 22 91 21 18 29 67 62 34 93 56 59 49 52 38 79 28 11 17 77 76 20 2 99 92
Card 102: 28 94 4 54 77 42 17 44 59 48 | 24 13 61 6 5 83 50 77 76 37 90 71 79 47 8 98 41 75 59 70 89 16 30 17 45
Card 103: 65 69 32 77 64 99 24 71 73 90 | 20 26 72 17 16 46 86 2 28 13 88 45 5 70 95 55 33 65 49 68 50 58 85 83 22
Card 104: 78 17 88 26 65 79 8 18 47 25 | 31 86 76 30 84 44 62 97 81 42 14 72 25 32 82 5 54 69 98 52 68 13 92 3 58
Card 105: 72 63 74 24 23 67 34 26 50 73 | 11 70 76 89 84 92 79 33 82 44 71 48 35 8 59 14 93 15 29 18 55 3 38 77 28
Card 106: 36 40 51 81 60 96 34 49 85 89 | 72 15 7 40 60 97 68 52 36 55 87 96 85 89 49 61 78 34 37 27 76 5 51 81 12
Card 107: 56 6 20 66 35 45 14 19 62 52 | 15 27 93 17 77 19 35 43 80 72 47 88 8 70 71 92 83 82 10 97 25 90 44 69 87
Card 108: 33 44 49 78 10 26 20 65 77 13 | 33 54 2 24 17 20 26 7 93 5 3 77 81 46 92 78 49 65 32 51 44 95 13 29 10
Card 109: 51 25 49 60 83 75 46 43 50 41 | 96 12 53 50 78 92 60 15 76 6 5 34 41 23 25 70 20 75 86 73 30 39 32 48 95
Card 110: 13 22 99 91 47 53 35 34 37 77 | 79 35 1 13 88 57 76 89 81 15 53 56 99 34 6 68 77 32 91 47 87 37 4 24 16
Card 111: 17 21 92 30 95 1 52 5 27 46 | 86 24 6 51 99 68 16 34 19 76 31 10 56 63 58 97 87 26 40 73 8 54 69 18 90
Card 112: 52 83 38 39 95 12 57 14 46 85 | 12 95 85 14 89 50 52 17 92 18 38 34 55 83 16 66 19 88 4 20 46 57 77 39 11
Card 113: 6 25 93 3 52 46 2 13 70 7 | 67 46 40 2 3 77 35 50 57 52 55 75 53 72 97 89 34 84 15 31 23 7 58 25 21
Card 114: 24 53 25 12 17 82 14 50 3 74 | 91 83 57 50 96 68 52 11 56 44 89 95 15 13 54 20 76 48 30 88 53 55 93 65 47
Card 115: 95 81 49 37 80 70 7 60 75 99 | 29 74 98 94 49 59 60 86 75 93 72 56 87 82 76 32 33 4 46 70 27 83 1 35 2
Card 116: 80 67 54 68 98 47 12 56 77 60 | 45 81 47 78 29 39 56 42 80 54 68 90 37 2 16 96 5 38 14 59 7 30 6 67 20
Card 117: 6 59 84 35 1 53 28 77 94 24 | 97 62 40 54 93 44 90 63 26 64 91 75 6 4 22 82 80 2 69 12 77 21 53 49 10
Card 118: 86 30 39 49 32 29 27 68 97 50 | 2 48 36 99 83 4 38 5 47 77 66 1 20 10 14 15 63 78 89 91 85 80 41 28 54
Card 119: 87 78 77 15 85 99 2 35 45 11 | 58 51 62 42 63 90 37 22 8 83 34 31 67 35 72 17 91 7 88 49 13 39 59 4 18
Card 120: 80 21 33 94 26 68 73 35 83 3 | 67 9 94 49 27 50 40 30 60 90 86 91 98 69 6 15 36 71 38 31 17 33 41 70 84
Card 121: 81 17 27 59 99 69 49 14 83 91 | 20 77 55 73 87 36 25 56 54 58 45 68 80 18 3 15 65 31 96 40 75 30 92 42 23
Card 122: 22 44 29 27 77 20 86 34 5 99 | 63 19 97 74 4 39 7 52 87 31 81 45 23 18 53 47 50 73 80 2 70 94 26 66 14
Card 123: 39 40 61 53 56 60 96 5 68 25 | 97 98 6 79 81 32 51 26 59 13 10 2 3 77 88 80 63 90 52 12 87 29 49 18 76
Card 124: 78 19 92 75 56 95 2 16 43 44 | 95 2 56 4 92 66 53 88 21 16 43 78 17 44 85 48 12 19 52 40 69 75 59 82 26
Card 125: 14 43 38 9 8 62 17 28 12 11 | 80 19 38 43 11 34 29 9 32 12 62 28 77 72 17 69 33 96 94 78 67 8 93 90 4
Card 126: 60 95 93 99 11 49 20 75 37 54 | 54 42 19 49 92 95 11 34 74 93 60 52 99 5 7 75 20 12 68 98 43 50 36 37 56
Card 127: 73 24 71 80 58 62 17 41 61 43 | 68 43 79 58 87 67 6 62 20 41 93 71 27 88 23 17 24 42 52 13 61 80 81 84 73
Card 128: 99 10 91 58 70 47 80 30 96 57 | 46 57 3 72 4 87 70 10 59 7 96 48 28 97 91 58 47 76 36 80 8 23 19 30 99
Card 129: 50 3 78 8 80 11 57 52 94 47 | 63 60 38 92 50 65 91 88 53 17 96 42 66 28 1 25 75 76 73 87 90 36 82 24 68
Card 130: 38 42 33 70 61 58 73 88 74 29 | 83 92 77 58 56 74 55 93 38 46 29 28 37 68 33 73 91 61 12 64 25 88 42 31 70
Card 131: 92 46 42 96 12 14 95 84 57 78 | 11 6 82 41 73 55 8 93 76 98 99 86 31 21 78 29 32 70 62 23 95 15 9 77 52
Card 132: 40 97 45 2 19 99 29 98 37 20 | 5 56 36 21 33 83 32 98 66 20 16 37 97 93 40 78 43 77 99 29 87 96 2 30 39
Card 133: 97 81 10 23 75 6 53 27 35 47 | 37 93 8 92 68 65 15 85 25 67 61 56 5 42 88 18 76 87 60 46 59 94 86 57 91
Card 134: 96 66 54 61 10 85 98 40 13 41 | 90 58 9 38 28 24 57 52 5 81 80 62 34 54 79 49 2 95 1 18 41 65 82 32 42
Card 135: 54 79 66 83 45 35 10 27 41 94 | 67 42 4 89 51 95 1 63 90 40 65 23 98 7 86 9 97 3 11 61 92 69 77 80 2
Card 136: 37 86 74 45 70 95 33 28 82 32 | 67 13 62 8 63 41 78 40 24 91 11 48 7 85 59 81 44 37 45 90 66 70 35 33 94
Card 137: 75 89 5 18 91 57 37 63 85 40 | 27 34 9 51 76 41 69 86 95 81 36 82 1 38 10 99 7 47 21 77 8 30 19 71 60
Card 138: 9 67 82 54 5 98 7 6 40 96 | 13 83 90 88 44 17 82 24 47 84 23 85 62 45 72 91 58 46 38 32 25 79 70 59 33
Card 139: 1 6 65 80 35 91 63 22 60 50 | 79 84 81 92 75 36 88 90 86 16 53 17 44 43 15 94 73 51 14 42 33 98 74 57 4
Card 140: 24 43 8 76 91 79 42 68 81 70 | 65 36 56 57 16 69 38 86 85 37 22 9 98 33 45 25 95 28 52 2 27 6 14 46 55
Card 141: 62 32 78 2 21 45 75 48 91 85 | 38 42 3 20 21 56 48 75 86 45 40 91 33 73 25 85 16 78 2 24 72 26 32 61 62
Card 142: 90 10 32 43 65 91 24 22 34 62 | 91 26 72 81 7 11 32 10 90 33 34 87 35 24 29 3 59 62 2 65 22 43 57 74 79
Card 143: 16 52 66 56 50 57 77 71 73 40 | 71 43 80 59 36 39 77 40 11 4 64 16 85 52 49 73 56 57 10 9 86 46 66 6 50
Card 144: 61 56 14 66 2 73 39 8 33 97 | 26 8 47 67 16 18 37 39 14 9 61 33 97 2 66 56 73 4 75 11 62 68 49 44 34
Card 145: 75 65 92 85 73 18 70 95 49 22 | 25 8 49 2 16 13 97 33 93 66 75 85 73 71 65 18 22 53 92 38 44 50 62 70 95
Card 146: 78 62 86 83 26 23 80 2 77 87 | 23 96 38 63 83 22 20 86 77 21 67 66 75 5 36 47 26 61 80 87 82 16 78 46 2
Card 147: 84 36 18 42 50 12 64 61 99 91 | 18 75 61 76 74 12 1 41 28 91 64 24 55 36 27 3 84 99 42 50 95 83 31 7 22
Card 148: 61 91 60 18 68 50 73 29 23 87 | 18 76 33 5 27 97 31 37 21 38 56 91 60 87 23 55 58 61 50 45 14 29 72 68 73
Card 149: 46 97 81 18 85 95 91 43 72 87 | 32 23 1 49 66 96 24 16 42 22 81 51 72 8 20 37 44 71 45 25 90 88 5 94 74
Card 150: 17 99 20 36 33 78 9 87 81 84 | 37 8 79 65 31 99 45 36 81 90 73 11 49 46 87 84 3 33 19 12 57 9 20 48 17
Card 151: 35 46 49 80 66 75 99 77 8 53 | 75 24 5 67 4 53 49 61 19 23 26 97 93 77 46 66 35 40 99 39 30 80 76 25 8
Card 152: 11 80 39 1 30 36 16 85 33 66 | 26 66 60 2 94 16 81 48 80 43 85 96 51 68 33 63 88 54 6 36 37 59 5 1 47
Card 153: 49 86 25 83 96 8 93 88 24 57 | 66 60 51 33 57 95 49 79 63 2 93 58 65 70 55 76 87 27 1 46 11 52 80 84 54
Card 154: 38 41 75 30 91 6 14 66 47 57 | 34 56 11 70 71 60 22 81 41 74 39 67 79 98 87 42 62 3 32 57 55 46 33 16 51
Card 155: 25 31 45 21 68 57 73 20 71 32 | 20 18 98 53 60 7 38 10 12 19 77 64 79 74 17 33 83 88 28 16 32 21 89 69 65
Card 156: 19 35 39 37 84 50 62 95 96 56 | 89 24 92 67 4 47 54 59 72 84 3 5 76 96 23 1 58 86 32 21 78 88 68 44 48
Card 157: 24 68 39 72 23 93 81 51 45 25 | 96 33 76 99 5 70 93 18 24 68 6 64 49 92 45 80 15 77 4 57 25 13 44 28 2
Card 158: 51 18 46 75 2 80 20 72 17 29 | 97 55 47 23 20 4 39 24 64 11 31 16 90 29 93 72 18 45 27 46 61 70 80 68 67
Card 159: 34 10 70 56 51 9 99 32 15 74 | 13 31 44 56 63 20 99 81 40 78 84 90 50 52 85 19 41 10 45 71 22 28 26 8 14
Card 160: 69 49 13 23 36 64 24 18 57 7 | 54 62 96 36 7 10 28 64 1 85 3 63 73 21 27 37 49 47 75 34 97 30 77 32 9
Card 161: 35 16 44 25 42 62 95 77 89 34 | 29 26 11 78 97 23 28 36 10 96 54 81 17 22 80 27 77 44 41 34 20 51 76 24 75
Card 162: 60 17 28 76 67 12 41 15 53 70 | 41 19 35 64 65 15 37 22 80 66 55 40 45 81 17 98 85 74 57 4 16 91 49 5 68
Card 163: 57 3 82 45 28 70 50 17 85 48 | 68 87 47 62 58 31 88 92 98 90 46 29 5 85 93 24 95 99 39 75 55 33 65 49 14
Card 164: 33 81 13 87 53 48 79 70 17 91 | 92 57 21 4 36 27 62 1 46 80 31 72 5 94 58 99 75 67 83 25 51 9 26 52 63
Card 165: 55 70 45 36 72 59 81 16 69 98 | 60 7 43 54 66 78 83 23 25 94 48 67 26 56 53 58 2 4 27 31 34 39 49 85 74
Card 166: 94 64 48 15 36 35 79 23 77 33 | 78 80 25 5 18 34 92 69 84 86 26 13 89 65 29 3 7 39 71 31 42 21 51 48 55
Card 167: 13 34 54 2 20 16 89 79 88 9 | 47 75 25 82 72 76 51 37 95 22 71 55 54 74 9 33 97 83 27 2 79 28 17 91 24
Card 168: 33 82 70 88 7 46 96 67 26 89 | 73 8 22 1 59 45 92 24 43 41 15 64 3 58 83 63 57 82 20 18 91 13 77 60 19
Card 169: 91 4 32 45 55 98 80 52 9 33 | 20 45 37 28 69 61 60 81 12 33 51 74 15 97 50 86 72 99 2 41 70 58 19 40 39
Card 170: 45 72 63 87 70 33 89 41 4 18 | 25 9 19 49 26 63 11 73 54 64 70 37 45 82 30 1 90 24 87 42 4 40 91 71 18
Card 171: 74 99 84 26 66 10 95 8 75 68 | 34 62 37 97 57 65 75 74 6 67 68 96 4 1 95 55 52 82 13 47 63 48 94 26 77
Card 172: 62 99 47 83 94 8 51 70 9 76 | 94 99 83 26 57 76 18 67 22 80 61 34 8 39 65 78 13 81 70 51 62 93 9 3 33
Card 173: 42 99 9 18 48 61 36 83 13 84 | 7 69 44 61 35 54 27 3 60 55 99 84 32 48 18 19 72 42 89 65 4 92 79 75 13
Card 174: 48 34 46 43 53 51 72 35 19 3 | 72 43 57 51 14 34 2 36 53 25 94 81 87 61 19 35 23 4 99 26 48 46 7 90 86
Card 175: 46 59 27 28 82 13 99 35 18 6 | 36 90 70 87 64 31 42 71 50 27 76 45 99 32 21 20 9 88 23 93 17 46 80 85 59
Card 176: 92 44 3 29 10 7 66 4 57 21 | 36 68 61 87 65 1 53 95 60 2 34 47 75 42 82 8 83 79 54 74 93 26 69 22 32
Card 177: 89 23 17 80 22 65 98 11 94 3 | 91 28 37 99 63 60 42 87 23 98 71 39 82 93 57 68 62 13 75 77 22 26 53 48 90
Card 178: 11 75 56 47 64 88 91 66 59 12 | 41 97 40 26 42 67 23 28 31 99 85 30 11 94 81 55 74 89 52 64 65 69 3 38 43
Card 179: 31 97 46 27 96 57 45 30 64 82 | 36 42 81 54 85 31 1 29 8 84 28 50 64 76 10 67 77 39 21 4 75 78 99 47 12
Card 180: 10 32 84 45 87 16 82 14 95 8 | 21 8 41 66 56 42 77 83 90 9 55 61 19 38 23 50 28 62 99 58 33 11 84 39 98
Card 181: 90 54 11 49 95 88 15 75 18 2 | 30 5 68 41 71 52 56 10 50 60 81 51 27 94 42 55 6 87 78 66 72 96 36 12 62
Card 182: 73 1 91 2 99 75 30 29 48 89 | 46 51 34 7 18 57 64 9 23 68 16 19 85 70 66 72 5 87 12 4 25 97 10 89 60
Card 183: 16 20 31 39 75 36 78 33 88 69 | 57 17 8 70 79 37 6 48 51 85 30 45 98 26 3 83 29 58 87 54 61 35 74 43 66
Card 184: 69 50 38 49 9 96 75 82 80 14 | 23 99 30 83 78 9 50 40 14 74 75 8 37 69 82 42 26 49 96 1 38 58 80 84 7
Card 185: 44 66 49 89 36 28 30 85 32 68 | 44 28 66 72 33 65 31 67 36 30 99 89 12 25 32 76 68 85 48 90 78 92 13 49 82
Card 186: 46 48 6 52 24 19 51 76 11 47 | 93 63 78 33 31 86 68 10 74 70 3 83 36 4 54 79 8 77 38 57 97 27 22 29 53
Card 187: 49 12 70 83 40 68 15 78 88 95 | 72 31 40 69 37 65 71 35 9 44 49 95 89 68 50 41 20 58 16 60 90 22 28 96 10
Card 188: 86 47 96 63 55 29 91 31 59 23 | 55 77 30 23 91 75 86 47 29 31 78 67 4 92 96 26 63 37 80 54 1 11 32 15 98
Card 189: 40 97 46 63 66 58 54 35 33 59 | 75 17 57 71 55 62 43 96 85 98 83 37 40 23 65 94 93 25 72 78 46 47 28 33 56
Card 190: 94 41 57 47 6 24 65 59 44 20 | 95 86 26 77 87 47 18 27 16 85 57 61 66 37 35 38 23 42 50 60 98 71 62 8 25
Card 191: 57 32 39 19 48 77 27 96 10 61 | 68 82 86 70 75 35 11 24 69 56 45 95 67 44 25 36 90 47 74 39 27 55 66 87 12
Card 192: 50 94 12 32 88 76 95 23 46 49 | 60 9 6 37 42 50 96 15 95 66 34 94 91 4 33 29 14 92 16 80 98 64 12 57 36
Card 193: 32 25 53 7 71 31 80 42 92 63 | 84 78 28 90 27 24 5 67 63 75 81 12 31 55 46 60 89 98 37 16 86 23 72 43 22
Card 194: 79 47 88 9 97 76 62 23 72 84 | 77 78 67 65 91 79 64 38 41 26 89 16 10 71 86 82 47 75 61 11 34 66 7 3 70
Card 195: 22 47 95 56 66 98 44 73 50 30 | 92 33 28 65 16 60 8 45 56 2 47 84 25 55 58 17 35 88 38 95 81 63 43 57 98
Card 196: 76 23 10 43 9 32 46 62 84 79 | 22 4 49 42 23 55 13 35 90 9 24 52 65 26 95 94 18 37 47 79 56 59 54 86 48
Card 197: 65 44 24 84 49 62 6 54 42 20 | 25 72 90 58 77 60 59 73 11 39 91 19 21 28 62 8 41 66 87 56 64 52 80 82 24
Card 198: 63 44 64 86 78 25 92 90 99 70 | 62 29 51 81 21 6 75 58 54 90 18 10 59 98 97 41 4 52 53 64 80 28 92 11 9
Card 199: 7 15 47 28 44 22 74 76 40 56 | 78 24 95 38 25 36 77 46 89 45 18 42 3 75 62 90 52 81 83 85 80 26 4 23 71
Card 200: 85 88 3 44 54 19 9 71 29 53 | 72 42 56 55 33 68 65 86 58 3 57 83 12 31 96 9 13 62 70 80 17 29 41 27 6
Card 201: 10 51 69 82 56 40 94 9 90 78 | 57 92 89 1 99 87 5 73 80 28 2 6 67 70 33 18 17 78 16 95 69 44 38 24 55
Card 202: 44 47 79 75 24 50 86 80 62 87 | 66 91 36 15 28 81 57 69 30 14 10 20 27 18 77 46 95 72 39 23 38 34 60 37 26
Card 203: 59 31 79 81 4 21 24 54 48 62 | 37 90 25 51 70 77 18 17 97 52 40 75 43 3 91 50 87 67 42 15 14 63 6 13 5

250
2023/inputs/day5.txt Normal file
View File

@@ -0,0 +1,250 @@
seeds: 3640772818 104094365 1236480411 161072229 376099792 370219099 1590268366 273715765 3224333694 68979978 2070154278 189826014 3855332650 230434913 3033760782 82305885 837883389 177854788 2442602612 571881366
seed-to-soil map:
496269031 1203272644 52136246
548405277 496269031 457095898
1005501175 953364929 249907715
soil-to-fertilizer map:
217408321 2086205436 25053699
2604208456 1670861921 31003781
1631572552 0 258383552
129225554 3768288787 36192668
2421205388 2905533654 126666762
242462020 3399542287 357404885
866152503 3032200416 253960559
2039921781 2262442546 381283607
2635212237 2714844607 190689047
3613008578 1753855801 23976114
3636984692 1503365158 167496763
1340671861 2111259135 274956
1889956104 806620565 149965677
0 3286160975 113381312
2987089260 956586242 546778916
2547872150 3756947172 11341615
3846919647 3807789063 43277850
3533868176 258383552 79140402
165418222 1701865702 51990099
1120113062 586061766 220558799
2559213765 2217447855 44994691
3807789063 4255836712 39130584
3890197497 3851066913 404769799
1340946817 1777831915 42087923
2881175496 2111534091 105913764
113381312 2643726153 15844242
1383034740 337523954 248537812
2825901284 2659570395 55274212
599866905 1819919838 266285598
fertilizer-to-water map:
3950520280 1751042330 139651634
936578795 3912173308 42397072
3553681000 1722281506 28760824
697953317 651809140 90189394
3582441824 876081661 368078456
978975867 2358439651 252255693
1495879532 2678320518 199775133
1910380638 3308279888 122339216
3355092099 1561901004 91630618
3187667509 2033753243 70292073
2752202873 3816184128 41568037
648600286 479585511 49353031
3149600631 2356473769 1965882
1695654665 2629130810 49189708
201901143 385568770 94016741
536376004 741998534 3182157
2472303091 3954570380 279899782
539558161 257732262 15304877
3131165165 2610695344 18435466
3446722717 1890693964 106958283
2793770910 1653531622 40823934
9849113 65680232 192052030
2878736712 2104045316 252428453
1792836692 2878095651 117543946
2172585320 1244160117 273599019
2060645804 3884012463 28160845
3257959582 3719051611 97132517
408449515 745180691 127926489
876081661 4234470162 60497134
1231231560 3043631916 264647972
3151566513 1997652247 36100996
2446184339 3430619104 26118752
803816626 582518586 69290554
554863038 9849113 40157204
2146325022 3857752165 26260298
788142711 50006317 15673915
295917884 273037139 112531631
2834594844 1517759136 44141868
4090171914 3456737856 204795382
2088806649 3661533238 57518373
1744844373 2995639597 47992319
2032719854 1694355556 27925950
595020242 528938542 53580044
water-to-light map:
556810106 840812947 14926117
2598413684 2184905392 114045192
2130064037 1600958027 248227533
1271028210 1253957270 39538107
3521286912 4262821917 32145379
1930562940 1944404618 64932992
4252373354 3302720391 42593942
1109026743 279496091 162001467
725777554 2565853410 3969864
2712458876 1330352326 185715465
4039742261 3173278185 129442206
0 2064417497 120487895
299311037 855739064 257499069
729747418 1849185560 95219058
1373001379 767226476 66231296
571736223 688212171 79014305
1878676528 2890412515 51886412
2898174341 682278717 5933454
1781236499 441497558 97440029
3090089298 3673052565 50139248
1365646204 833457772 7355175
1738475707 2412172480 42760792
1995495932 2569823274 134568105
3193548680 3476912261 196140304
824966476 538937587 143341130
3553432291 3723191813 486309970
3140228546 4209501783 53320134
968307606 1113238133 140719137
4169184467 3090089298 83188887
650750528 204469065 75027026
1439232675 2704391379 186021136
2511835025 1516067791 84890236
1625253811 2298950584 113221896
3389688984 3345314333 131597928
2378291570 0 22623317
2596725261 2942298927 1688423
1310566317 2009337610 55079887
2940964744 201446459 3022606
120487895 22623317 178823142
2904107795 1293495377 36856949
2400914887 2454933272 110920138
light-to-temperature map:
1244459013 624435822 80444775
2608592263 3309263777 172991510
3165402867 2278806547 335097905
292819381 1643978777 105413752
704475267 462426854 15399493
3696584161 2678497330 345840247
2891254573 3613542439 34162874
1894523870 281665589 180761265
1706897891 1456352798 187625979
398233133 1877125477 198159658
4176101046 3482255287 104541624
2278806547 3662029939 329785716
3500500772 4098883907 196083389
4280642670 3647705313 14324626
4149492660 3024337577 11203522
85784517 0 207034864
2925417447 3231118601 78145176
0 1749392529 85784517
4160696182 3215713737 15404864
4042424408 3991815655 107068252
1129076520 207034864 74630725
596392791 1348270322 108082476
3100809989 2613904452 64592878
1326100451 1114082357 234187965
2864509045 3586796911 26745528
2781583773 3132788465 82925272
1560288416 477826347 146609475
3003562623 3035541099 97247366
719874760 704880597 409201760
1324903788 1875928814 1196663
1203707245 1835177046 40751768
temperature-to-humidity map:
2622049454 736812858 79169969
3979548277 2854489162 116161222
0 2175018874 84480806
567798788 2400631546 48501534
3627076350 2837901836 16587326
1459224370 1289368272 21397154
3018037189 3252694507 93925363
4095709499 4063232797 21404553
1675574530 2560175285 695067
650203851 328659590 327259736
3143763337 3475937023 49576
1591893253 2091337597 83681277
3655324442 3516768137 39649206
1125784995 2259499680 94582805
1082589333 280432563 43195662
1676269597 1011614859 3965286
3955996260 4039680780 23552017
2701219423 684725863 52086995
977463587 2387091631 13539915
3643663676 3346619870 11660766
3143812913 3556417343 483263437
2907111949 3358280636 110925240
2293944099 2615629615 132579811
991003502 920029028 91585831
1513630670 1015580145 78262583
196718861 1310765426 316320664
1680234883 1638774240 331394507
2011629390 815982827 1882146
2874635247 4084637350 32476702
3701704795 2998403042 254291465
2426523910 1093842728 195525544
2837901836 3475986599 8980753
3694973648 3469205876 6731147
3111962552 3484967352 31800785
616300322 662956301 21769562
1220367800 1627086090 10492300
1480621524 2354082485 33009146
2846882589 2970650384 27752658
1352028950 323628225 5031365
2753306418 655919326 7036975
513039525 2560870352 54759263
84480806 1637578390 1195850
2013511536 0 280432563
85676656 2449133080 111042205
1357060315 817864973 102164055
638069884 2748209426 12133967
1230860100 1970168747 121168850
humidity-to-location map:
3071447765 3790677895 35519893
501148922 1470714761 60946444
949413779 3960084356 1114317
2276139972 547813284 42132370
261623667 0 220957931
0 220957931 207965683
2629055810 2988733812 367963097
936813255 2507216386 12600524
3106967658 2402339659 33240399
909841910 3356696909 11084951
1030029700 920191219 341387512
2503236334 3572469232 125819476
1371417212 1666455982 273052538
2997018907 3367781860 25674024
3311094548 2519816910 468916902
2021404744 1531661205 83389724
3140208057 1939508520 59879232
259387264 428923614 2236403
950528096 1334878052 79501604
2446901229 1414379656 56335105
1644469750 3393455884 140294896
3022692931 3698288708 48754834
4042169428 1999387752 252797868
1805974329 3981490698 215430415
1784764646 501148922 21209683
889549885 3961198673 20292025
3780011450 522358605 10399946
2104794468 1261578731 73299321
3790411396 3842084182 118000174
2318272342 2252185620 113574154
4003450976 3533750780 38718452
2178093789 4196921113 98046183
3908411570 3747043542 43634353
562095366 2435580058 71636328
2431846496 532758551 15054733
920926861 3826197788 15886394
3952045923 1615050929 51405053
207965683 431160017 51421581
633731694 2365759774 36579885
670311579 700952913 219238306
3200087289 589945654 111007259

0
2023/inputs/day6.txt Normal file
View File

0
2023/inputs/day7.txt Normal file
View File

0
2023/inputs/day8.txt Normal file
View File

0
2023/inputs/day9.txt Normal file
View File

7
2023/tests/day1.txt Normal file
View File

@@ -0,0 +1,7 @@
two1nine
eightwothree
abcone2threexyz
xtwone3four
4nineeightseven2
zoneight234
7pqrstsixteen

0
2023/tests/day10.txt Normal file
View File

0
2023/tests/day11.txt Normal file
View File

0
2023/tests/day12.txt Normal file
View File

0
2023/tests/day13.txt Normal file
View File

0
2023/tests/day14.txt Normal file
View File

0
2023/tests/day15.txt Normal file
View File

0
2023/tests/day16.txt Normal file
View File

0
2023/tests/day17.txt Normal file
View File

Some files were not shown because too many files have changed in this diff Show More