def transform_stones(stones): new_stones = [] for stone in stones: if stone == 0: new_stones.append(1) elif len(str(stone)) % 2 == 0: # Split the stone str_stone = str(stone) mid = len(str_stone) // 2 left = int(str_stone[:mid]) right = int(str_stone[mid:]) new_stones.extend([left, right]) else: # Multiply by 2024 new_stones.append(stone * 2024) return new_stones def simulate_blinks(initial_stones, blinks): stones = initial_stones for _ in range(blinks): stones = transform_stones(stones) return stones # Read input from file file = "input.txt" with open(file, "r") as f: initial_stones = list(map(int, f.read().strip().split())) # Part 1: After 25 blinks stones_after_25_blinks = simulate_blinks(initial_stones, 25) print(len(stones_after_25_blinks)) # Part 2: After 75 blinks stones_after_75_blinks = simulate_blinks(initial_stones, 75) print(len(stones_after_75_blinks))