def run() -> tuple(Solution, Solution): data: Dataset = day(15, lambda row: list(map(int, list(row)))) m = Map(data, 5) return ( Map(data).shortest_path(), Map(data, 5).shortest_path(), )
def run() -> tuple(Solution, Solution): data: Dataset = day(13) points, folds = parse_data(data) return ( len(fold_all(points, folds, 1)), print_code(fold_all(points, folds)), )
def run() -> tuple(Solution, Solution): data: Dataset = day(14) formula, rules = parse_data(data) return (Reaction(formula, rules).step(10).count(), Reaction(formula, rules).step(40).count())
def run() -> tuple(Solution, Solution): data: Dataset = day(16) packet = PacketParser.parse_hex(data) return (packet.version_sum(), packet.eval())
def run() -> tuple(Solution, Solution): data = day(5, lambda line: Line(*parse_numbers(line))) return (max_overlapping_lines(filter(Line.is_horizontal, data)), max_overlapping_lines(data))
def run() -> tuple(Solution, Solution): data: Dataset = day(11, lambda line: list(map(int, list(line)))) return ( FlashingMatrix(data).run(100), FlashingMatrix(data).find_first_synchronized() )
def run() -> tuple(Solution, Solution): data = day(2) return ( final_position(data, position_class=Position), final_position(data, position_class=AimPosition) )
def run(): data = day(1, apply=int) return ( find_increasing(data), find_increasing_triples(data) )
def run() -> tuple(Solution, Solution): data = day(6, parse_numbers) return (len(Aquarium(data[0]).next_day(80)), len(Aquarium(data[0]).next_day(256)))
def run() -> tuple(Solution, Solution): data = day(3) return (power_consumption(data), LifeSupportRating(data).value)
def run() -> tuple(Solution, Solution): data: Dataset = day(17, parse_target) hits = list(all_hits(data)) return (max(hits), len(hits))
def run() -> tuple(Solution, Solution): data = day(10) return ( corrupted_score(data), autocomplete_score(data) )
def run() -> tuple(Solution, Solution): data: Dataset = day(9, lambda line: list(map(int, list(line)))) hm = HeatMap(data) print(hm) return (hm.risk_factor(), hm.three_biggest_basins())
def run() -> tuple(Solution, Solution): data = day(4, parse_numbers) numbers, boards = parse_data(data) return (first_winning_score(boards, numbers), last_winning_score(boards, numbers))
def run() -> tuple(Solution, Solution): data: Dataset = day(12, lambda line: line.split('-')) caves = Graph(data) return (caves.number_of_paths(), caves.number_of_paths(with_second_visit=True))