# Day 2: Gift Shop [https://adventofcode.com/2025/day/2](https://adventofcode.com/2025/day/2) ## Description ### Part One You get inside and take the elevator to its only other stop: the gift shop. "Thank you for visiting the North Pole!" gleefully exclaims a nearby sign. You aren't sure who is even allowed to visit the North Pole, but you know you can access the lobby through here, and from there you can access the rest of the North Pole base. As you make your way through the surprisingly extensive selection, one of the clerks recognizes you and asks for your help. As it turns out, one of the younger Elves was playing on a gift shop computer and managed to add a whole bunch of invalid product IDs to their gift shop database! Surely, it would be no trouble for you to identify the invalid product IDs for them, right? They've even checked most of the product ID ranges already; they only have a few product ID ranges (your puzzle input) that you'll need to check. For example: 11-22,95-115,998-1012,1188511880-1188511890,222220-222224, 1698522-1698528,446443-446449,38593856-38593862,565653-565659, 824824821-824824827,2121212118-2121212124 (The ID ranges are wrapped here for legibility; in your input, they appear on a single long line.) The ranges are separated by commas (`,`); each range gives its _first ID_ and _last ID_ separated by a dash (`-`). Since the young Elf was just doing silly patterns, you can find the _invalid IDs_ by looking for any ID which is made only of some sequence of digits repeated twice. So, `55` (`5` twice), `6464` (`64` twice), and `123123` (`123` twice) would all be invalid IDs. None of the numbers have leading zeroes; `0101` isn't an ID at all. (`101` is a _valid_ ID that you would ignore.) Your job is to find all of the invalid IDs that appear in the given ranges. In the above example: * `11-22` has two invalid IDs, _`11`_ and _`22`_. * `95-115` has one invalid ID, _`99`_. * `998-1012` has one invalid ID, _`1010`_. * `1188511880-1188511890` has one invalid ID, _`1188511885`_. * `222220-222224` has one invalid ID, _`222222`_. * `1698522-1698528` contains no invalid IDs. * `446443-446449` has one invalid ID, _`446446`_. * `38593856-38593862` has one invalid ID, _`38593859`_. * The rest of the ranges contain no invalid IDs. Adding up all the invalid IDs in this example produces _`1227775554`_. _What do you get if you add up all of the invalid IDs?_ ### Part Two The clerk quickly discovers that there are still invalid IDs in the ranges in your list. Maybe the young Elf was doing other silly patterns as well? Now, an ID is invalid if it is made only of some sequence of digits repeated _at least_ twice. So, `12341234` (`1234` two times), `123123123` (`123` three times), `1212121212` (`12` five times), and `1111111` (`1` seven times) are all invalid IDs. From the same example as before: * `11-22` still has two invalid IDs, _`11`_ and _`22`_. * `95-115` now has two invalid IDs, _`99`_ and _`111`_. * `998-1012` now has two invalid IDs, _`999`_ and _`1010`_. * `1188511880-1188511890` still has one invalid ID, _`1188511885`_. * `222220-222224` still has one invalid ID, _`222222`_. * `1698522-1698528` still contains no invalid IDs. * `446443-446449` still has one invalid ID, _`446446`_. * `38593856-38593862` still has one invalid ID, _`38593859`_. * `565653-565659` now has one invalid ID, _`565656`_. * `824824821-824824827` now has one invalid ID, _`824824824`_. * `2121212118-2121212124` now has one invalid ID, _`2121212121`_. Adding up all the invalid IDs in this example produces _`4174379265`_. _What do you get if you add up all of the invalid IDs using these new rules?_