Day 1: Dusty Shed

Megathread guidelines

  • Keep top level comments as only solutions, if you want to say something other than a solution put it in a new post. (replies to comments can be whatever)
  • You can send code in code blocks by using three backticks, the code, and then three backticks or use something such as https://topaz.github.io/paste/ if you prefer sending it through a URL

FAQ

  • codeinabox@programming.dev
    link
    fedilink
    English
    arrow-up
    6
    ·
    1 day ago

    I decided to solve it in Python, which was easier than I expected because of Counter.

    import sys
    from collections import Counter
    
    with open(sys.argv[1], encoding="utf-8") as f:
        counts = Counter()
    
        while True:
            id = f.readline().rstrip()
            if id == "":
                break
    
            counts[id] += 1
    
        initial = 1
        for id, _ in counts.most_common(3):
            initial = initial * int(id)
    
        print(initial)