def part1(): input = read_input(day=10) score = 0 for line in input: corrupted_score, _ = SyntaxChecker.score(line) score += corrupted_score return score
def part1() -> int: range_str = read_input(day=4)[0] pw_min, pw_max = range_str.split('-') valid = valid_passwords(pw_min, pw_max) print(valid) # debug print(sorted(valid)) return len(valid)
def part2(): input = read_input(day=10) incomplete_scores = [] for line in input: _, incomplete_score = SyntaxChecker.score(line) if incomplete_score: incomplete_scores.append(incomplete_score) # take middle return sorted(incomplete_scores)[len(incomplete_scores) // 2]
def part1() -> int: wire1_str, wire2_str = read_input(day=3) wire1 = wire1_str.split(',') wire2 = wire2_str.split(',') inters = intersections(wire1, wire2) min_distance = float("inf") for inter in inters: min_distance = min(min_distance, manhattan_distance(Point(0, 0), inter)) return min_distance
def part1() -> int: ops_str = read_input(day=2)[0] parser = IntcodeParser(ops_str) # 1202 program alarm state parser[1] = 12 parser[2] = 2 for instruction in parser: parser.process(instruction) return parser[0]
def part2() -> int: ops_str = read_input(day=2)[0] for noun in range(100): for verb in range(100): parser = IntcodeParser(ops_str) parser[1] = noun parser[2] = verb for instruction in parser: parser.process(instruction) if parser[0] == 19690720: return 100 * noun + verb return -1
def part2() -> int: masses = [int(line) for line in read_input(day=1)] return _calculate_total_fuel(_recursive_fuel_required, masses)
def part2(): depths = [int(line) for line in read_input(day=1)] return _num_depth_increases_sliding_window(depths)
def part1(): depths = [int(line) for line in read_input(day=1)] return _num_depth_increases(depths)
def part2(): cmd_strs = read_input(day=2) submarine = AimSubmarine() submarine.process_cmd_strs(cmd_strs) return submarine.mult
def part2(): binary_strs = read_input(day=3) oxygen_generator_rating, co2_scrubber_rating = _get_life_support_ratings( binary_strs) return oxygen_generator_rating * co2_scrubber_rating
def part1(): binary_strs = read_input(day=3) gamma, epsilon = _to_gamma_epsilon(binary_strs) return gamma * epsilon