Using 4016017 threads and asynchronous exceptions to solve ADC1.1 0 ▲ Romes' Blog 1 day ago · 9 min read1853 words · Tech · hide Once in a while I feel like doing something silly. So… here’s a solution to the first and easiest Advent of Code challenge using O(n2)O(n^2) threads and asynchronous exceptions, uninterruptible masking, and even IO-fixpoints. Beware! The Haskell in this post is not for the faint of heart. 1 The obvious solution To get the problem statement out of the way, here’s my one-liner solution: import Data.List main = print . product . map (read . head) . take 3 . reverse . sortOn length . group . sort . lines =<< readFile "i" The input is given in a file called i, and it’s just a list of numbers like: 100 222 300 222 400 In this list, the number occurring more often is 222, which occurs twice. The problem is simply to take the three numbers occurring more often and taking their product. The “official” input has 2004 lines. This solution should be easy to read, even for non-Haskellers. Just read it right to left, starting with readFile (because f . g stands for function composition, “f after… Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town