├── .gitignore ├── ChangeLog.md ├── Day01.hs ├── Day02.hs ├── Day03.hs ├── Day04.hs ├── Day05.hs ├── Day06.hs ├── Day07.hs ├── Day08.hs ├── Day09.hs ├── Day10.hs ├── Day11.hs ├── Day12.hs ├── Day13.hs ├── Day14.hs ├── Day15.hs ├── Day16-functions.hs ├── Day16.hs ├── Day17.hs ├── Day18.hs ├── Day19.hs ├── Day20.hs ├── Day21.hs ├── Day22.hs ├── Day23.hs ├── Day24.hs ├── Day25.hs ├── LICENSE ├── Setup.hs ├── advent2016.cabal ├── asmprog-final ├── .gitignore ├── ChangeLog.md ├── LICENSE ├── Main.hs ├── Optimizer.hs ├── Setup.hs ├── Small.hs └── asmprog-final.cabal ├── inputs ├── input1.txt ├── input10.txt ├── input11.txt ├── input12.txt ├── input18.txt ├── input2.txt ├── input20.txt ├── input21.txt ├── input22.txt ├── input23.txt ├── input24.txt ├── input25.txt ├── input3.txt ├── input4.txt ├── input6.txt ├── input7.txt ├── input8.txt └── input9.txt └── lib ├── AsmProg.hs ├── Common.hs ├── GridCoord.hs ├── Search.hs ├── SmallBitSet.hs └── UnboxFunctions.hs /.gitignore: -------------------------------------------------------------------------------- 1 | .ghc.environment.* 2 | dist/ 3 | dist-*/ 4 | .HTF/ 5 | .cabal-sandbox/ 6 | .stack-work/ 7 | cabal-dev 8 | *# 9 | *.aux 10 | *.chi 11 | *.chs.h 12 | *.dSYM 13 | *.dylib 14 | *.dyn_hi 15 | *.dyn_o 16 | *.eventlog 17 | *.hi 18 | *.hp 19 | *.o 20 | *.a 21 | *.prof 22 | *.so 23 | *~ 24 | .*.swo 25 | .*.swp 26 | .DS_Store 27 | .hpc 28 | .hsenv 29 | TAGS 30 | cabal.project.local 31 | cabal.sandbox.config 32 | codex.tags 33 | docs 34 | stack.yaml 35 | tags 36 | wiki 37 | wip 38 | -------------------------------------------------------------------------------- /ChangeLog.md: -------------------------------------------------------------------------------- 1 | # Revision history for advent2016 2 | 3 | ## 0.1.0.0 -- YYYY-mm-dd 4 | 5 | * First version. Released on an unsuspecting world. 6 | -------------------------------------------------------------------------------- /Day01.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import Common 4 | import GridCoord 5 | 6 | import Data.List 7 | import qualified Data.Set as Set 8 | import Text.Megaparsec 9 | import Text.Megaparsec.Char 10 | 11 | -- | Vectors used for incremental steps 12 | data Vec = Vec !Int !Int 13 | deriving (Eq, Ord, Show, Read) 14 | 15 | data Command = Command !Char !Int 16 | 17 | parser :: Parser [Command] 18 | parser = (Command <$> oneOf "LDRU" <*> number) `sepBy` string ", " 19 | 20 | main :: IO () 21 | main = 22 | do cmds <- parseOrDie parser <$> readInputFile 1 23 | let path = computePath cmds 24 | print (part1 path) 25 | print (part2 path) 26 | 27 | -- | Given a list of steps determine the ultimate Manhattan-distance from 28 | -- the starting position. 29 | part1 :: [Coord] -> Int 30 | part1 = manhattanDistance origin . last 31 | 32 | part2 :: [Coord] -> Maybe Int 33 | part2 = fmap (manhattanDistance origin) . duplicate 34 | 35 | computePath :: [Command] -> [Coord] 36 | computePath = toCoords origin . toSteps north 37 | where 38 | north = Vec 0 (-1) 39 | 40 | -- | Find the first duplicate element in a list 41 | duplicate :: Ord a => [a] -> Maybe a 42 | duplicate = aux Set.empty 43 | where 44 | aux _ [] = Nothing 45 | aux seen (x:xs) 46 | | Set.member x seen = Just x 47 | | otherwise = aux (Set.insert x seen) xs 48 | 49 | -- | Compute steps taken by following a list of commands 50 | toSteps :: 51 | Vec {- ^ initial direction -} -> 52 | [Command] {- ^ commands -} -> 53 | [Vec] {- ^ list of directions -} 54 | toSteps dir0 cmds = concat (snd (mapAccumL aux dir0 cmds)) 55 | where 56 | aux dir (Command lr steps) = 57 | let dir' = turn lr dir 58 | in (dir', replicate steps dir') 59 | 60 | toCoords :: 61 | Coord {- ^ origin -} -> 62 | [Vec] {- ^ steps -} -> 63 | [Coord] {- ^ path -} 64 | toCoords = scanl step 65 | 66 | turn :: Char -> Vec -> Vec 67 | turn 'L' (Vec dx dy) = Vec (-dy) dx 68 | turn 'R' (Vec dx dy) = Vec dy (-dx) 69 | turn c _ = error ("Bad instruction: " ++ [c]) 70 | 71 | step :: Coord -> Vec -> Coord 72 | step (Coord x y) (Vec dx dy) = Coord (x + dx) (y + dy) 73 | -------------------------------------------------------------------------------- /Day02.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import Common 4 | import Data.Foldable (foldl') 5 | import Data.Array 6 | import GridCoord 7 | 8 | main :: IO () 9 | main = 10 | do cmds <- lines <$> readInputFile 2 11 | putStrLn (computeCode keys1 cmds) 12 | putStrLn (computeCode keys2 cmds) 13 | 14 | keys1 :: Array Coord Char 15 | keys1 = listArray (Coord (-1) (-1), Coord 1 1) 16 | "123\ 17 | \456\ 18 | \789" 19 | 20 | keys2 :: Array Coord Char 21 | keys2 = listArray (Coord (-2) (-2), Coord 2 2) 22 | "..1..\ 23 | \.234.\ 24 | \56789\ 25 | \.ABC.\ 26 | \..D.." 27 | 28 | computeCode :: Array Coord Char -> [String] -> String 29 | computeCode ks cmds = map (ks!) (tail (scanl (process ks) origin cmds)) 30 | 31 | process :: 32 | Array Coord Char {- ^ key pad -} -> 33 | Coord {- ^ starting position -} -> 34 | String {- ^ command -} -> 35 | Coord {- ^ stopping position -} 36 | process ks = foldl' aux 37 | where 38 | aux pos mov 39 | | isValid ks pos' = pos' 40 | | otherwise = pos 41 | where 42 | pos' = step pos mov 43 | 44 | isValid :: Array Coord Char -> Coord -> Bool 45 | isValid ks i = maybe False (/= '.') (indexArray ks i) 46 | 47 | step :: Coord -> Char -> Coord 48 | step (Coord x y) mov = 49 | case mov of 50 | 'L' -> Coord (x-1) y 51 | 'R' -> Coord (x+1) y 52 | 'U' -> Coord x (y-1) 53 | 'D' -> Coord x (y+1) 54 | _ -> error ("Bad move: " ++ [mov]) 55 | -------------------------------------------------------------------------------- /Day03.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import Common 4 | import Data.List 5 | import Data.List.Split 6 | 7 | main :: IO () 8 | main = 9 | do input <- parseInput <$> readInputFile 3 10 | print (count goodTriangle input) 11 | print (count goodTriangle (rearrange input)) 12 | 13 | parseInput :: String -> [[Int]] 14 | parseInput = chunksOf 3 . map read . words 15 | 16 | rearrange :: [[a]] -> [[a]] 17 | rearrange = chunksOf 3 . concat . transpose 18 | 19 | goodTriangle :: [Int] -> Bool 20 | goodTriangle xs = x + y > z 21 | where 22 | [x,y,z] = sort xs 23 | -------------------------------------------------------------------------------- /Day04.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import Common 4 | import Data.Char 5 | import Data.Monoid 6 | import Data.Foldable 7 | import Data.List 8 | import Text.Megaparsec 9 | import Text.Megaparsec.Char 10 | import qualified Data.Map as Map 11 | 12 | data Entry = Entry { roomName :: [String], sectorId :: Int, roomHash :: String } 13 | 14 | hashLength :: Int 15 | hashLength = 5 16 | 17 | main :: IO () 18 | main = 19 | do input <- parseLines parser <$> readInputFile 4 20 | let valid = filter isGoodEntry input 21 | print (sum (map sectorId valid)) 22 | for_ valid $ \e -> 23 | putStrLn $ show (sectorId e) 24 | ++ ": " 25 | ++ decryptEntry e 26 | 27 | decryptEntry :: Entry -> String 28 | decryptEntry e = unwords (map (map (decrypt (sectorId e))) (roomName e)) 29 | 30 | isGoodEntry :: Entry -> Bool 31 | isGoodEntry e = roomHash e == computeHash (concat (roomName e)) 32 | 33 | computeHash :: String -> String 34 | computeHash x = take hashLength (map fst (sortBy ordering (Map.toList counts))) 35 | where 36 | counts = Map.fromListWith (+) [ (a,1::Int) | a <- x ] 37 | ordering (xa,xn) (ya,yn) 38 | = compare yn xn -- descending 39 | <> compare xa ya -- ascending 40 | 41 | parser :: Parser Entry 42 | parser = Entry 43 | <$> some letterChar `endBy` char '-' 44 | <*> number 45 | <*> bracketed (some letterChar) 46 | 47 | decrypt :: Int -> Char -> Char 48 | decrypt n c = chr ((ord c - ord 'a' + n) `mod` 26 + ord 'a') 49 | -------------------------------------------------------------------------------- /Day05.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import Crypto.Hash.MD5 4 | import qualified Data.IntMap as IntMap 5 | import Data.IntMap (IntMap) 6 | import qualified Data.ByteString as BS 7 | import qualified Data.ByteString.Char8 as B 8 | import Data.Monoid 9 | import System.IO 10 | import Text.Printf 11 | 12 | main :: IO () 13 | main = 14 | do hSetBuffering stdout NoBuffering 15 | putStrLn password1 16 | putStrLn password2 17 | 18 | input :: B.ByteString 19 | input = B.pack "ffykfhsq" 20 | 21 | passwordLen :: Int 22 | passwordLen = 8 23 | 24 | password1 :: String 25 | password1 = fst <$> take passwordLen digitStream 26 | 27 | password2 :: String 28 | password2 = replicate passwordLen '_' 29 | ++ go 0 IntMap.empty digitStream' 30 | where 31 | digitStream' = 32 | [ (key, val) | (pos,val) <- digitStream 33 | , let key = fromEnum pos - fromEnum '0' 34 | , 0 <= key, key < passwordLen 35 | ] 36 | 37 | go _ seen _ | length seen == passwordLen = "" 38 | go _ _ [] = error "password generation underflow!" 39 | go n seen ((key,val) : rest) 40 | | IntMap.member key seen = render n seen ++ go (n+1) seen rest 41 | | otherwise = render n seen' ++ go (n+1) seen' rest 42 | where 43 | seen' = IntMap.insert key val seen 44 | 45 | spinner :: String 46 | spinner = "◐◓◑◒" 47 | 48 | spinnerLen :: Int 49 | spinnerLen = length spinner 50 | 51 | render :: Int -> IntMap Char -> String 52 | render n seen = 53 | '\r' : (spinner !! (n`rem`spinnerLen)) : ' ' : 54 | [ IntMap.findWithDefault '_' key seen | key <- [0 .. passwordLen - 1 ] ] 55 | 56 | hexRep :: BS.ByteString -> String 57 | hexRep bs = printf "%02x" =<< BS.unpack bs 58 | 59 | digitStream :: [(Char,Char)] 60 | digitStream = go (0 :: Int) 61 | where 62 | go i = 63 | case splitAt 5 (hexRep (hash (input <> B.pack (show i)))) of 64 | ("00000",c1:c2:_) -> (c1,c2) : go (i+1) 65 | _ -> go (i+1) 66 | -------------------------------------------------------------------------------- /Day06.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import Common 4 | import Data.List 5 | import qualified Data.Map as Map 6 | import Data.Ord 7 | 8 | main :: IO () 9 | main = 10 | do input <- lines <$> readInputFile 6 11 | putStrLn (decode id input) 12 | putStrLn (decode Down input) 13 | 14 | decode :: Ord a => (Int -> a) -> [String] -> String 15 | decode f xs = mostCommon f <$> transpose xs 16 | 17 | mostCommon :: (Ord a, Ord b) => (Int -> b) -> [a] -> a 18 | mostCommon f = fst . maximumBy (comparing (f . snd)) . tally 19 | 20 | tally :: Ord a => [a] -> [(a,Int)] 21 | tally xs = Map.toList (Map.fromListWith (+) [(x,1) | x <- xs]) 22 | -------------------------------------------------------------------------------- /Day07.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import Common 4 | import Control.Monad 5 | import Data.List 6 | import Text.Megaparsec 7 | import Text.Megaparsec.Char 8 | 9 | main :: IO () 10 | main = 11 | do xs <- parseLines parser <$> readInputFile 7 12 | print (length (filter supportsTLS xs)) 13 | print (length (filter supportsSSL xs)) 14 | 15 | newtype Address = Address [Segment] 16 | deriving (Read, Show, Ord, Eq) 17 | 18 | data Segment = Supernet String | Hypernet String 19 | deriving (Read, Show, Ord, Eq) 20 | 21 | parser :: Parser Address 22 | parser = Address <$> many segment 23 | where 24 | segment = Hypernet <$> bracketed (many letterChar) <|> 25 | Supernet <$> some letterChar 26 | 27 | supportsTLS :: Address -> Bool 28 | supportsTLS (Address xs) = any checkSupernet xs && all checkHypernet xs 29 | where 30 | checkSupernet (Supernet ys) = hasABBA ys 31 | checkSupernet _ = False 32 | 33 | checkHypernet (Hypernet ys) = not (hasABBA ys) 34 | checkHypernet _ = True 35 | 36 | hasABBA ys = any isABBA (tails ys) 37 | 38 | isABBA (w:x:y:z:_) = w == z && x == y && w /= x 39 | isABBA _ = False 40 | 41 | supportsSSL :: Address -> Bool 42 | supportsSSL (Address xs) = 43 | not $ null $ do Supernet s <- xs 44 | x:y:z:_ <- tails s 45 | guard (x == z && x /= y) 46 | Hypernet h <- xs 47 | guard ( [y,x,y] `isInfixOf` h ) 48 | -------------------------------------------------------------------------------- /Day08.hs: -------------------------------------------------------------------------------- 1 | {-# Language TupleSections #-} 2 | module Main (main) where 3 | 4 | import Common 5 | import Control.Concurrent 6 | import Control.Monad 7 | import Data.Array.IO 8 | import Data.Foldable 9 | import Text.Megaparsec 10 | import Text.Megaparsec.Char 11 | 12 | rows, cols :: Int 13 | rows = 6 14 | cols = 50 15 | 16 | data Command 17 | = Rect !Int !Int 18 | | RotateCol !Int !Int 19 | | RotateRow !Int !Int 20 | deriving Show 21 | 22 | main :: IO () 23 | main = 24 | do xs <- readInputFile 8 25 | interp (parseLines parser xs) 26 | 27 | interp :: [Command] -> IO () 28 | interp cmds = 29 | do a <- newArray ((0,0),(cols-1,rows-1)) False 30 | :: IO (IOUArray (Int,Int) Bool) 31 | 32 | for_ cmds $ \cmd -> 33 | do interpCommand a cmd 34 | print cmd 35 | drawScreen a 36 | threadDelay 25000 37 | 38 | n <- countPixels a 39 | putStrLn ("Pixels: " ++ show n) 40 | 41 | drawScreen :: IOUArray (Int,Int) Bool -> IO () 42 | drawScreen a = 43 | for_ [0..5] $ \y -> 44 | do xs <- traverse (\x -> readArray a (x,y)) [0..cols-1] 45 | putStrLn (map toBlock xs) 46 | 47 | countPixels :: IOUArray (Int,Int) Bool -> IO Int 48 | countPixels a = 49 | do xs <- getElems a 50 | return $! length (filter id xs) 51 | 52 | toBlock :: Bool -> Char 53 | toBlock True = '█' 54 | toBlock False = ' ' 55 | 56 | interpCommand :: IOUArray (Int,Int) Bool -> Command -> IO () 57 | interpCommand a (Rect xn yn) = 58 | for_ [0 .. xn-1] $ \x -> 59 | for_ [0 .. yn-1] $ \y -> 60 | writeArray a (x,y) True 61 | 62 | interpCommand a (RotateCol x n) = rotate a (x,) rows n 63 | interpCommand a (RotateRow y n) = rotate a (,y) cols n 64 | 65 | rotate :: (Ix i, MArray a e m) => a i e -> (Int -> i) -> Int -> Int -> m () 66 | rotate a f len n = 67 | do reverseRange a f 0 (len-1-n) 68 | reverseRange a f (len-n) (len-1) 69 | reverseRange a f 0 (len-1) 70 | 71 | reverseRange :: (Ix i, MArray a e m) => a i e -> (Int -> i) -> Int -> Int -> m () 72 | reverseRange a f lo hi = 73 | when (lo < hi) $ 74 | do swap a (f lo) (f hi) 75 | reverseRange a f (lo+1) (hi-1) 76 | 77 | swap :: (MArray a e m, Ix i) => a i e -> i -> i -> m () 78 | swap a i j = 79 | do t <- readArray a i 80 | writeArray a i =<< readArray a j 81 | writeArray a j t 82 | 83 | parser :: Parser Command 84 | parser = 85 | RotateRow <$ wholestring "rotate row y=" <*> number <* string " by " <*> number <|> 86 | RotateCol <$ wholestring "rotate column x=" <*> number <* string " by " <*> number <|> 87 | Rect <$ string "rect " <*> number <* char 'x' <*> number 88 | -------------------------------------------------------------------------------- /Day09.hs: -------------------------------------------------------------------------------- 1 | {-# Language LambdaCase #-} 2 | module Main where 3 | 4 | import Common 5 | import Control.Monad 6 | import Text.Megaparsec 7 | import Text.Megaparsec.Char 8 | 9 | main :: IO () 10 | main = 11 | do xs <- lines <$> readInputFile 9 12 | print (sum (map decode1 xs)) 13 | print (sum (map decode2 xs)) 14 | 15 | decode1 :: String -> Int 16 | decode1 = mkDecode (\n xs -> n * length xs) 17 | 18 | decode2 :: String -> Int 19 | decode2 = mkDecode (\n xs -> n * decode2 xs) 20 | 21 | mkDecode :: 22 | (Int -> String -> Int) {- ^ repeated segment logic -} -> 23 | String {- ^ input string -} -> 24 | Int {- ^ decoded length -} 25 | mkDecode f = parseOrDie (sum <$> many (plain <|> repeated)) 26 | where 27 | plain = length <$> some (satisfy (/='(')) 28 | repeated = 29 | do len <- char '(' *> number <* char 'x' 30 | f <$> number <* char ')' <*> replicateM len anySingle 31 | -------------------------------------------------------------------------------- /Day10.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import Common 4 | import Data.Map (Map) 5 | import qualified Data.Map as Map 6 | import Text.Megaparsec 7 | import Text.Megaparsec.Char 8 | 9 | main :: IO () 10 | main = 11 | do solution <- followInstructions . parseLines parseInstr <$> readInputFile 10 12 | 13 | print [ who | (who,Two 17 61) <- Map.toList solution] 14 | 15 | print $ product [ v | i <- [0..2] 16 | , let One v = solution Map.! Output i ] 17 | 18 | -- Types --------------------------------------------------------------- 19 | 20 | data Instr = Value !Int !Target | Gives !Target !Target !Target 21 | deriving Show 22 | 23 | data Target = Bot !Int | Output !Int 24 | deriving (Eq, Ord, Show) 25 | 26 | data Holding = One !Int | Two !Int !Int 27 | deriving Show 28 | 29 | -- Parsing ------------------------------------------------------------- 30 | 31 | parseInstr :: Parser Instr 32 | parseInstr = 33 | Value <$ string "value " <*> number <* string " goes to " <*> target 34 | <|> Gives <$> target <* string " gives low to " 35 | <*> target <* string " and high to " 36 | <*> target 37 | 38 | target :: Parser Target 39 | target = Bot <$ string "bot " <*> number <|> 40 | Output <$ string "output " <*> number 41 | 42 | -- Solving ------------------------------------------------------------- 43 | 44 | followInstructions :: [Instr] -> Map Target Holding 45 | followInstructions xs = result 46 | where 47 | result = Map.fromListWithKey combine (concatMap aux xs) 48 | 49 | aux (Value val tgt) = [ (tgt, One val) ] 50 | aux (Gives src lo hi) = [ (lo , One l), (hi, One h) ] 51 | where Two l h = result Map.! src 52 | 53 | 54 | combine :: Target -> Holding -> Holding -> Holding 55 | combine _ (One x) (One y) = Two (min x y) (max x y) 56 | combine tgt _ _ = error ("Bad combination for " ++ show tgt) 57 | -------------------------------------------------------------------------------- /Day11.hs: -------------------------------------------------------------------------------- 1 | {-# Language TemplateHaskell #-} 2 | module Main (main) where 3 | 4 | import Control.Lens 5 | import Data.Bits 6 | import Data.List 7 | import Data.Maybe 8 | import Search (bfsOn) 9 | import SmallBitSet (SmallBitSet) 10 | import qualified SmallBitSet as SBS 11 | 12 | -- Types --------------------------------------------------------------- 13 | 14 | data Floor = Floor !SmallBitSet !SmallBitSet -- ^ gen micro 15 | deriving (Eq, Ord, Show) 16 | 17 | data Building = Building 18 | { _bldgSteps :: !Int 19 | , _lowerFloors :: [Floor] 20 | , _currentFloor :: {-# UNPACK #-} !Floor 21 | , _higherFloors :: [Floor] 22 | } 23 | deriving Show 24 | 25 | makeLenses ''Building 26 | 27 | -- Main logic and parameters ------------------------------------------- 28 | 29 | main :: IO () 30 | main = 31 | do print (solutionSteps part1) 32 | print (solutionSteps part2) 33 | 34 | part1 :: Building 35 | part1 = Building 0 [] ( mkFloor [0] [0]) 36 | [ mkFloor [1..4] [] 37 | , mkFloor [] [1..4] 38 | , mkFloor [] [] ] 39 | 40 | part2 :: Building 41 | part2 = Building 0 [] ( mkFloor [0..2] [0..2]) 42 | [ mkFloor [3..6] [] 43 | , mkFloor [] [3..6] 44 | , mkFloor [] [] ] 45 | 46 | solutionSteps :: Building -> Maybe Int 47 | solutionSteps b = 48 | listToMaybe [ b'^.bldgSteps | b' <- bfsOn mkRep advanceBuilding b 49 | , isSolved b' ] 50 | 51 | --Floor operations ----------------------------------------------------- 52 | 53 | mkFloor :: [Int] -> [Int] -> Floor 54 | mkFloor xs ys = Floor (SBS.fromList xs) (SBS.fromList ys) 55 | 56 | isEmptyFloor :: Floor -> Bool 57 | isEmptyFloor (Floor x y) = SBS.null x && SBS.null y 58 | 59 | isValidFloor :: Floor -> Bool 60 | isValidFloor (Floor gens mics) = SBS.null gens || SBS.null (mics SBS.\\ gens) 61 | 62 | floorUnion :: Floor -> Floor -> Floor 63 | floorUnion (Floor x y) (Floor u v) = Floor (SBS.union x u) (SBS.union y v) 64 | 65 | floorDifference :: Floor -> Floor -> Floor 66 | floorDifference (Floor x y) (Floor u v) = Floor (x SBS.\\ u) (y SBS.\\ v) 67 | 68 | pickFromFloor :: Floor -> [Floor] 69 | pickFromFloor (Floor gs ms) = pair ++ twoGens ++ twoMics ++ oneGen ++ oneMic 70 | where 71 | gens = SBS.toList gs 72 | mics = SBS.toList ms 73 | twoGens = do xs <- SBS.fromList <$> pick2 gens 74 | return $! Floor xs SBS.empty 75 | twoMics = do xs <- SBS.fromList <$> pick2 mics 76 | return $! Floor SBS.empty xs 77 | pair = do x <- SBS.singleton <$> 78 | take 1 (SBS.toList (SBS.intersection gs ms)) 79 | return $! Floor x x 80 | oneGen = do x <- SBS.singleton <$> gens 81 | return $! Floor x SBS.empty 82 | oneMic = do x <- SBS.singleton <$> mics 83 | return $! Floor SBS.empty x 84 | 85 | pick2 :: [a] -> [[a]] 86 | pick2 xs = [ [x,y] | x:ys <- tails xs, y <- ys ] 87 | 88 | floorRep :: Floor -> Int 89 | floorRep (Floor gens mics) = SBS.setRep gens `shiftL` 7 .|. SBS.setRep mics 90 | 91 | -- Building operations ------------------------------------------------- 92 | 93 | isSolved :: Building -> Bool 94 | isSolved b = null (b^.higherFloors) && all isEmptyFloor (b^.lowerFloors) 95 | 96 | advanceBuilding :: Building -> [Building] 97 | advanceBuilding b = 98 | [ b3 & bldgSteps +~ 1 99 | | subset <- pickFromFloor (b^.currentFloor) 100 | , b1 <- updateCurrentFloor (`floorDifference` subset) b 101 | , b2 <- move (Lens lowerFloors) (Lens higherFloors) b1 102 | ++ move (Lens higherFloors) (Lens lowerFloors) b1 103 | , b3 <- updateCurrentFloor (floorUnion subset) b2 104 | ] 105 | 106 | updateCurrentFloor :: (Floor -> Floor) -> Building -> [Building] 107 | updateCurrentFloor f b = 108 | [ b' | let (fl',b') = b & currentFloor <%~ f, isValidFloor fl' ] 109 | 110 | {-# INLINE move #-} 111 | move :: 112 | ReifiedLens' Building [Floor] -> 113 | ReifiedLens' Building [Floor] -> 114 | Building -> 115 | [Building] 116 | move (Lens back) (Lens front) b = 117 | [ b & back %~ cons (b^.currentFloor) 118 | & currentFloor .~ x 119 | & front .~ xs 120 | | x:xs <- [ b^.front ] 121 | ] 122 | 123 | -- | Characterize a 4-floor building with up to 7 generator/chip pairs 124 | mkRep :: Building -> Int 125 | mkRep (Building _ x _ z) = foldl' aux (length x) (x ++ z) 126 | where 127 | aux acc fl = acc `shiftL` 14 .|. floorRep fl 128 | -------------------------------------------------------------------------------- /Day12.hs: -------------------------------------------------------------------------------- 1 | {-# Language LambdaCase #-} 2 | module Main where 3 | 4 | import AsmProg 5 | import Common 6 | import Control.Lens 7 | import Data.Foldable 8 | import qualified Data.Map.Strict as Map 9 | import Data.Map (Map) 10 | import qualified Data.Vector as Vector 11 | import Data.Vector 12 | import Text.Megaparsec 13 | import Text.Megaparsec.Char 14 | 15 | main :: IO () 16 | main = 17 | do program <- Vector.fromList . parseLines parseFile <$> readInputFile 12 18 | print (execute program 0) 19 | print (execute program 1) 20 | 21 | data Inst 22 | = Copy Value !Register 23 | | Inc !Register 24 | | Dec !Register 25 | | Jnz Value !Int 26 | deriving Show 27 | 28 | parseFile :: Parser Inst 29 | parseFile = 30 | Copy <$ wholestring "cpy " <*> pValue <* char ' ' <*> pReg <|> 31 | Jnz <$ wholestring "jnz " <*> pValue <* char ' ' <*> number <|> 32 | Inc <$ wholestring "inc " <*> pReg <|> 33 | Dec <$ wholestring "dec " <*> pReg 34 | 35 | execute :: Vector Inst -> Int -> Registers 36 | execute program c = zeroRegisters &~ mainEntry 37 | where 38 | mainEntry = 39 | do reg C .= c 40 | goto 0 41 | 42 | step = \case 43 | Copy i o -> 1 <$ (reg o <~ rval i) 44 | Inc r -> 1 <$ (reg r += 1) 45 | Dec r -> 1 <$ (reg r -= 1) 46 | Jnz i o -> do v <- rval i 47 | return $! if v == 0 then 1 else o 48 | 49 | goto pc = strictState $ 50 | for_ (program Vector.!? pc) $ \o -> 51 | do offset <- step o 52 | goto (pc + offset) 53 | -------------------------------------------------------------------------------- /Day13.hs: -------------------------------------------------------------------------------- 1 | {-# Language TransformListComp #-} 2 | module Main where 3 | 4 | import Data.Bits 5 | import Data.List 6 | import GridCoord 7 | import Search (bfsOn) 8 | 9 | myInput :: Int 10 | myInput = 1350 11 | 12 | data Entry = Entry { entrySteps :: !Int, entryCoord :: Coord } 13 | deriving (Eq, Show) 14 | 15 | main :: IO () 16 | main = 17 | do let entries = bfsOn entryCoord nextEntries initialEntry 18 | print [ steps | Entry steps (Coord 31 39) <- entries, then take 1 ] 19 | print $ length [ () | Entry steps _ <- entries 20 | , then takeWhile by steps <= 50 ] 21 | 22 | initialEntry :: Entry 23 | initialEntry = Entry 0 (Coord 1 1) 24 | 25 | isValidCoord :: Coord -> Bool 26 | isValidCoord (Coord x y) = 27 | x >= 0 && y >= 0 && 28 | even (popCount (x*x + 3*x + 2*x*y + y + y*y + myInput)) 29 | 30 | nextEntries :: Entry -> [Entry] 31 | nextEntries (Entry steps coord) 32 | = [ Entry (steps+1) c | c <- cardinalNeighbors coord, isValidCoord c ] 33 | -------------------------------------------------------------------------------- /Day14.hs: -------------------------------------------------------------------------------- 1 | {-# Language OverloadedStrings #-} 2 | module Main where 3 | 4 | import Control.Monad 5 | import Crypto.Hash.MD5 6 | import Data.ByteString.Builder 7 | import Data.ByteString.Builder.Extra 8 | import Data.List 9 | import Data.Monoid 10 | import qualified Data.ByteString as B 11 | import qualified Data.ByteString.Char8 as B8 12 | import qualified Data.ByteString.Lazy as L 13 | 14 | myinp :: B.ByteString 15 | myinp = "qzyelonm" 16 | 17 | main :: IO () 18 | main = 19 | do print (solve 1) 20 | print (solve 2017) 21 | 22 | -- | Hash a bytestring to to ASCII encoded, lowercase hex 23 | hashmd5 :: B.ByteString -> B.ByteString 24 | hashmd5 25 | = L.toStrict 26 | . toLazyByteStringWith md5strategy L.empty 27 | . byteStringHex 28 | . hash 29 | where 30 | md5strategy = untrimmedStrategy 32 32 31 | 32 | iteratedHash :: Int -> B.ByteString -> B.ByteString 33 | iteratedHash n x 34 | | n <= 0 = x 35 | | otherwise = iteratedHash (n-1) (hashmd5 x) 36 | 37 | seed :: Int -> B.ByteString 38 | seed i = myinp <> B8.pack (show i) 39 | 40 | solve :: Int -> Int 41 | solve iterations = 42 | search (map (B8.unpack . iteratedHash iterations . seed) [0..]) !! 63 43 | 44 | search :: [String] -> [Int] 45 | search hashes = 46 | [ i | (i,h:hs) <- zip [0..] (tails hashes) 47 | , start <- take 1 [ x | x:y:z:_ <- tails h, x==y, y==z] 48 | , any (replicate 5 start `isInfixOf`) (take 1000 hs) 49 | ] 50 | -------------------------------------------------------------------------------- /Day15.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | data Disc = Disc !Int !Int deriving Show 4 | 5 | main :: IO () 6 | main = 7 | do print (solve input1) 8 | print (solve input2) 9 | 10 | input1, input2 :: [Disc] 11 | input1 = 12 | [ Disc 13 1 13 | , Disc 19 10 14 | , Disc 3 2 15 | , Disc 7 1 16 | , Disc 5 3 17 | , Disc 17 5 18 | ] 19 | input2 = input1 ++ [Disc 11 0] 20 | 21 | -- | Correct a disc for when the object will reach it 22 | fixup :: Int -> Disc -> Disc 23 | fixup i (Disc a b) = Disc a (i+b) 24 | 25 | -- | Figure out what time to drop the capsule 26 | solve :: [Disc] -> Int 27 | solve = snd 28 | . foldl aux (1,0) 29 | . zipWith fixup [1..] 30 | 31 | aux :: (Int,Int) -> Disc -> (Int,Int) 32 | aux (stepSize, wait) (Disc a b) = (lcm stepSize a, wait') 33 | where 34 | wait':_= filter (\i -> (i+b)`rem`a == 0) [wait, wait+stepSize .. ] 35 | -------------------------------------------------------------------------------- /Day16-functions.hs: -------------------------------------------------------------------------------- 1 | -- Parallelized, functional that runs in 0.7 seconds with -N 2 | -- and which uses around 36k maximum residency using 1 thread. 3 | 4 | {-# Language MagicHash #-} 5 | module Main (main) where 6 | 7 | import Data.Vector.Unboxed (Vector) 8 | import qualified Data.Vector.Unboxed as Vector 9 | import Control.Parallel.Strategies (parMap, rseq) 10 | import System.IO 11 | import UnboxFunctions 12 | import GHC.Prim 13 | 14 | myInput :: Vector.Vector Bool 15 | myInput = fromList' (toBool <$> "01111001100111011") 16 | 17 | -- Allow vector allocate the right size of vector 18 | fromList' :: Vector.Unbox a => [a] -> Vector a 19 | fromList' xs = Vector.fromListN (length xs) xs 20 | 21 | toBool :: Char -> Bool 22 | toBool x = x == '1' 23 | 24 | fromBool :: Bool -> Char 25 | fromBool x = if x then '1' else '0' 26 | 27 | part1, part2 :: Int 28 | part1 = 272 29 | part2 = 35651584 30 | 31 | main :: IO () 32 | main = 33 | do hSetBuffering stdout NoBuffering 34 | putStrLn (solve part1) 35 | putStrLn (solve part2) 36 | 37 | solve :: Int -> String 38 | solve n = buildChecksum n (buildLookup n) 39 | 40 | buildChecksum :: Int -> (Int# -> Bool) -> String 41 | buildChecksum sz f 42 | | odd sz = parMap rseq (fromBool . (f $#)) [0..sz-1] 43 | | otherwise = buildChecksum (sz`quot`2) $ unbox $ \i -> 44 | (f $# i*2) == (f $# (i*2+1::Int)) 45 | 46 | buildLookup :: Int -> Int# -> Bool 47 | buildLookup sz = aux (Vector.length myInput) 48 | (unbox (Vector.unsafeIndex myInput)) 49 | where 50 | aux n f 51 | | n >= sz = f 52 | | otherwise = aux (2*n+1) $ unbox $ \i -> 53 | case compare i n of 54 | LT -> f $# i 55 | GT -> not $ f $# 2*n-i 56 | EQ -> False 57 | -------------------------------------------------------------------------------- /Day16.hs: -------------------------------------------------------------------------------- 1 | -- Fast implementation that uses about 80mb of RAM and about 0.2seconds 2 | module Main where 3 | 4 | import Data.Monoid 5 | import Data.Vector.Unboxed (Vector) 6 | import qualified Data.Vector.Unboxed as Vector 7 | 8 | myInput :: Vector.Vector Bool 9 | myInput = Vector.fromList (toBool <$> "01111001100111011") 10 | 11 | toBool :: Char -> Bool 12 | toBool x = x == '1' 13 | 14 | fromBool :: Bool -> Char 15 | fromBool x = if x then '1' else '0' 16 | 17 | part1, part2 :: Int 18 | part1 = 272 19 | part2 = 35651584 20 | 21 | expand :: Int -> Vector Bool -> Vector Bool 22 | expand n seed 23 | | Vector.length seed >= n = Vector.take n seed 24 | | otherwise = expand n 25 | $ seed <> Vector.singleton False <> 26 | Vector.map not (Vector.reverse seed) 27 | 28 | checksum v 29 | | odd n = fromBool <$> Vector.toList v 30 | | otherwise = checksum 31 | $ Vector.generate (n`quot`2) $ \i -> 32 | v Vector.! (2*i) == v Vector.! (2*i+1) 33 | where 34 | n = Vector.length v 35 | 36 | main :: IO () 37 | main = 38 | do putStrLn (checksum (expand part1 myInput)) 39 | putStrLn (checksum (expand part2 myInput)) 40 | -------------------------------------------------------------------------------- /Day17.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import Control.Monad 4 | import Crypto.Hash.MD5 5 | import Data.List 6 | import Search (bfs) 7 | import qualified Data.ByteString as BS 8 | import qualified Data.ByteString.Char8 as B8 9 | import Text.Printf 10 | 11 | input :: String 12 | input = "lpvhkcbi" 13 | 14 | 15 | main :: IO () 16 | main = 17 | do let paths = [ path | (3,3,path) <- bfs nextStates initialState ] 18 | shortestPath = head paths 19 | longestPath = last paths 20 | putStrLn shortestPath 21 | print (length longestPath) 22 | 23 | 24 | initialState :: (Int,Int,String) 25 | initialState = (0,0,"") 26 | 27 | 28 | isValidLocation :: Int -> Int -> Bool 29 | isValidLocation x y = 0 <= x && x < 4 30 | && 0 <= y && y < 4 31 | 32 | 33 | nextStates :: (Int,Int,String) -> [(Int,Int,String)] 34 | nextStates (3,3,path) = [] 35 | nextStates (x,y,path) = 36 | do step <- directions path 37 | let (x',y') = move step x y 38 | guard (isValidLocation x' y') 39 | return (x',y',path++[step]) 40 | 41 | hexRep :: BS.ByteString -> String 42 | hexRep bs = printf "%02x" =<< BS.unpack bs 43 | 44 | hashmd5 :: String -> String 45 | hashmd5 str = hexRep (hash (B8.pack str)) 46 | 47 | 48 | directions :: String -> [Char] 49 | directions path = ways 50 | where 51 | a:b:c:d:_ = hashmd5 (input ++ path) 52 | 53 | isOpen x = x `elem` "bcdef" 54 | 55 | ways = [ 'U' | isOpen a ] ++ 56 | [ 'D' | isOpen b ] ++ 57 | [ 'L' | isOpen c ] ++ 58 | [ 'R' | isOpen d ] 59 | 60 | 61 | move :: Char -> Int -> Int -> (Int,Int) 62 | move 'U' x y = (x,y-1) 63 | move 'D' x y = (x,y+1) 64 | move 'L' x y = (x-1,y) 65 | move 'R' x y = (x+1,y) 66 | -------------------------------------------------------------------------------- /Day18.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import Common (count, readInputFile) 4 | import Data.List (tails) 5 | 6 | rule :: Char -> Char -> Char 7 | rule x y 8 | | x == y = '.' 9 | | otherwise = '^' 10 | 11 | next :: String -> String 12 | next xs = [ rule x y | x:_:y:_ <- tails ("." ++ xs ++ ".") ] 13 | 14 | problem :: String -> Int -> Int 15 | problem input n = 16 | count ('.'==) $ concat $ take n $ iterate next input 17 | 18 | main = 19 | do input <- head . lines <$> readInputFile 18 20 | print (problem input 40) 21 | print (problem input 400000) 22 | -------------------------------------------------------------------------------- /Day19.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import Data.Sequence (Seq) 4 | import qualified Data.Sequence as Seq 5 | 6 | elves :: Int 7 | elves = 3012210 8 | 9 | main :: IO () 10 | main = 11 | do print (part1 [1..elves]) 12 | print (part2 [1..elves]) 13 | 14 | part1 :: [a] -> Maybe a 15 | part1 = part1' [] 16 | 17 | part1' :: [a] -> [a] -> Maybe a 18 | part1' [] [] = Nothing 19 | part1' [] [x] = Just x 20 | part1' ys (x:_:xs) = part1' (x:ys) xs 21 | part1' ys xs = part1' [] (xs ++ reverse ys) 22 | 23 | part2 :: [a] -> Maybe a 24 | part2 = part2' . Seq.fromList 25 | 26 | part2' :: Seq a -> Maybe a 27 | part2' xs = 28 | case Seq.viewl xs of 29 | Seq.EmptyL -> Nothing 30 | x Seq.:< ys 31 | | Seq.null ys -> Just x 32 | | otherwise -> part2' ((l Seq.>< Seq.drop 1 r) Seq.|> x) 33 | where (l,r) = Seq.splitAt (half (length ys)) ys 34 | half x = (x-1) `div` 2 35 | -------------------------------------------------------------------------------- /Day20.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import Common (Parser, parseLines, readInputFile) 4 | import Data.List (sort) 5 | import Text.Megaparsec.Char (char) 6 | import Text.Megaparsec.Char.Lexer (decimal) 7 | 8 | type Blacklist = [(Integer,Integer)] 9 | 10 | parseEntry :: Parser (Integer,Integer) 11 | parseEntry = (,) <$> decimal <* char '-' <*> decimal 12 | 13 | main :: IO () 14 | main = 15 | do blacklist <- processBlacklist . parseLines parseEntry <$> readInputFile 20 16 | print (lowest blacklist) 17 | print (countValid blacklist) 18 | 19 | -- | Remove overlaps and ensure that the blacklist surrounds 20 | -- the whole address space. 21 | processBlacklist :: Blacklist -> Blacklist 22 | processBlacklist xs = 23 | removeOverlap (sort ([(-1,-1),(2^32,2^32)] ++ xs)) 24 | 25 | lowest :: Blacklist -> Integer 26 | lowest ((_,hi):_) = hi+1 27 | lowest _ = 0 28 | 29 | removeOverlap :: Blacklist -> Blacklist 30 | removeOverlap ((lo1,hi1):(lo2,hi2):rest) 31 | | hi1 >= lo2-1 = removeOverlap ((lo1, max hi1 hi2) : rest) 32 | removeOverlap (x:xs) = x : removeOverlap xs 33 | removeOverlap [] = [] 34 | 35 | countValid :: Blacklist -> Integer 36 | countValid xs = sum (zipWith gapSize xs (tail xs)) 37 | where 38 | gapSize (_,hi1) (lo2,_) = lo2 - hi1 - 1 39 | -------------------------------------------------------------------------------- /Day21.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import Common 4 | import Text.Megaparsec 5 | import Text.Megaparsec.Char 6 | import Data.List 7 | 8 | data Scramble 9 | = RotateRight Int 10 | | RotateLeft Int 11 | | SwapPosition Int Int 12 | | SwapLetter Char Char 13 | | RotateChar Char 14 | | ReversePositions Int Int 15 | | MovePosition Int Int 16 | deriving Show 17 | 18 | parseScramble :: Parser Scramble 19 | parseScramble = 20 | RotateRight 1 <$ wholestring "rotate right 1 step" <|> 21 | RotateRight <$ wholestring "rotate right " <*> number <* string " steps" <|> 22 | RotateLeft 1 <$ wholestring "rotate left 1 step" <|> 23 | RotateLeft <$ wholestring "rotate left " <*> number <* string " steps" <|> 24 | SwapPosition <$ wholestring "swap position " <*> number <* string " with position " <*> number <|> 25 | SwapLetter <$ wholestring "swap letter " <*> letterChar <* string " with letter " <*> letterChar <|> 26 | RotateChar <$ wholestring "rotate based on position of letter " <*> letterChar <|> 27 | ReversePositions <$ wholestring "reverse positions " <*> number <* string " through " <*> number <|> 28 | MovePosition <$ wholestring "move position " <*> number <* string " to position " <*> number 29 | 30 | part1, part2 :: String 31 | part1 = "abcdefgh" 32 | part2 = "fbgdceah" 33 | 34 | main = 35 | do inp <- parseLines parseScramble <$> readInputFile 21 36 | putStrLn $ foldl (flip forward) part1 inp 37 | putStrLn $ foldr backward part2 inp 38 | 39 | rotateRight :: Int -> [a] -> [a] 40 | rotateRight n xs = b ++ a 41 | where 42 | n' = n `mod` length xs 43 | (a,b) = splitAt (length xs - n') xs 44 | 45 | rotateLeft :: Int -> [a] -> [a] 46 | rotateLeft n xs = b ++ a 47 | where 48 | n' = n `mod` length xs 49 | (a,b) = splitAt (n') xs 50 | 51 | set :: Int -> a -> [a] -> [a] 52 | set i x xs = a ++ [x] ++ b 53 | where 54 | (a,_:b) = splitAt i xs 55 | 56 | forward scram = 57 | case scram of 58 | RotateRight i -> rotateRight i 59 | RotateLeft i -> rotateLeft i 60 | SwapPosition i j -> \xs -> set i (xs!!j) 61 | $ set j (xs!!i) xs 62 | SwapLetter x y -> map $ \a -> if a == x then y else if a == y then x else a 63 | RotateChar e -> rotatePositionOf e 64 | ReversePositions i j -> reverseRange i j 65 | MovePosition i j -> movePosition i j 66 | 67 | backward scram = 68 | case scram of 69 | RotateRight i -> rotateLeft i 70 | RotateLeft i -> rotateRight i 71 | SwapPosition i j -> \xs -> set i (xs!!j) 72 | $ set j (xs!!i) xs 73 | SwapLetter x y -> map $ \a -> if a == x then y else if a == y then x else a 74 | RotateChar e -> \xs -> 75 | let Just r = find (\a -> rotatePositionOf e a == xs) 76 | $ map (`rotateRight` xs) [0..] 77 | in r 78 | ReversePositions i j -> reverseRange i j 79 | MovePosition i j -> movePosition j i 80 | 81 | rotatePositionOf e xs = rotateRight j xs 82 | where 83 | Just i = elemIndex e xs 84 | j | i >=4 = i + 2 85 | | otherwise = i + 1 86 | 87 | reverseRange i j xs = a ++ reverse c ++ d 88 | where 89 | (a,b) = splitAt i xs 90 | (c,d) = splitAt (j-i+1) b 91 | 92 | movePosition i j xs = c ++ [x] ++ d 93 | where 94 | (a,x:b) = splitAt i xs 95 | (c,d) = splitAt j (a++b) 96 | -------------------------------------------------------------------------------- /Day22.hs: -------------------------------------------------------------------------------- 1 | {-# Language RecordWildCards #-} 2 | module Main where 3 | 4 | import Common 5 | import Control.Monad 6 | import GridCoord 7 | import Search 8 | import Text.Megaparsec 9 | import Text.Megaparsec.Char 10 | import Data.Array (Array) 11 | import qualified Data.Array as Array 12 | 13 | data Node = Node { nodeSize, nodeUsed :: !Int } 14 | deriving (Show) 15 | 16 | parseNode :: Parser (Coord, Node) 17 | parseNode = 18 | do x <- string "/dev/grid/node-x" *> number 19 | y <- string "-y" *> number <* space 20 | nodeSize <- number <* char 'T' <* space 21 | nodeUsed <- number <* char 'T' <* space 22 | _avail <- number <* char 'T' <* space 23 | _percent <- number <* char '%' 24 | return (Coord x y, Node{..}) 25 | 26 | parseInput :: String -> Array Coord Node 27 | parseInput 28 | = coordArray (error "hole in grid") . parseLines parseNode 29 | . unlines . drop 2 . lines -- header lines 30 | 31 | -- Hardcode a constant I computed for my particular input. 32 | -- This problem doesn't favor a general solution, so I didn't 33 | -- bother encoding my analysis of what constitutes an immobile 34 | -- node into my program 35 | cutoff = 100 36 | 37 | main :: IO () 38 | main = 39 | do grid <- parseInput <$> readInputFile 22 40 | let start = findStart grid 41 | hole = findHole grid 42 | print $ viable grid 43 | print $ head 44 | [ cost | (ss, cost) <- astar (next grid) (SearchState start hole) 45 | , searchGoal ss == origin 46 | ] 47 | 48 | viable grid = length 49 | [() | (c1,n1) <- Array.assocs grid 50 | , (c2,n2) <- Array.assocs grid 51 | , c1 /= c2 52 | , nodeUsed n1 /= 0 53 | , nodeUsed n1 <= nodeSize n2 - nodeUsed n2 ] 54 | 55 | findStart grid = 56 | maximum [ Coord x 0 | Coord x 0 <- Array.range (Array.bounds grid) ] 57 | 58 | findHole grid = head [ c | (c,n) <- Array.assocs grid, nodeUsed n == 0 ] 59 | 60 | data SearchState = SearchState 61 | { searchGoal, searchHole :: !Coord } 62 | deriving (Eq, Ord, Read, Show) 63 | 64 | next :: Array Coord Node -> SearchState -> [(SearchState, Int, Int)] 65 | next grid SearchState{..} = 66 | [ (SearchState newGoal newHole,1,h) 67 | | newHole <- cardinalNeighbors searchHole 68 | , node <- indexArray grid newHole 69 | , nodeSize node < cutoff 70 | , let newGoal 71 | | searchGoal == newHole = searchHole 72 | | otherwise = searchGoal 73 | 74 | h = manhattanDistance newGoal origin 75 | + manhattanDistance newHole newGoal 76 | - 1 ] 77 | -------------------------------------------------------------------------------- /Day23.hs: -------------------------------------------------------------------------------- 1 | {-# Language TemplateHaskell, LambdaCase #-} 2 | module Main where 3 | 4 | import AsmProg 5 | import Common 6 | import Control.Lens 7 | import Control.Monad.Trans.State.Strict 8 | import Data.Foldable 9 | import Data.Map (Map) 10 | import qualified Data.Map as Map 11 | import Data.Vector (Vector) 12 | import qualified Data.Vector as Vector 13 | import Text.Megaparsec hiding (State) 14 | import Text.Megaparsec.Char 15 | 16 | data Inst 17 | = Copy Value !Register 18 | | Inc !Register 19 | | Dec !Register 20 | | Jnz Value Value 21 | | Tgl Value 22 | deriving Show 23 | 24 | data Machine = Machine 25 | { _machRegisters :: !Registers 26 | , _machProgram :: !(Vector Inst) 27 | } 28 | 29 | makeLenses '' Machine 30 | 31 | instance HasRegisters Machine where 32 | reg r = machRegisters . reg r 33 | {-# INLINE reg #-} 34 | 35 | main :: IO () 36 | main = 37 | do program <- Vector.fromList . parseLines parseFile <$> readInputFile 23 38 | print (execute program 7) 39 | print (execute program 12) 40 | 41 | parseFile :: Parser Inst 42 | parseFile = 43 | Copy <$ wholestring "cpy " <*> pValue <* char ' ' <*> pReg <|> 44 | Jnz <$ wholestring "jnz " <*> pValue <* char ' ' <*> pValue <|> 45 | Tgl <$ wholestring "tgl " <*> pValue <|> 46 | Inc <$ wholestring "inc " <*> pReg <|> 47 | Dec <$ wholestring "dec " <*> pReg 48 | 49 | execute :: Vector Inst -> Int -> Int 50 | execute program0 a = 51 | evalState mainEntry (Machine zeroRegisters program0) 52 | where 53 | mainEntry = 54 | do reg A .= a 55 | goto 0 56 | 57 | step pc o = 58 | case o of 59 | Copy i o -> (reg o <~ rval i) >> goto (pc+1) 60 | Inc r -> (reg r += 1) >> goto (pc+1) 61 | Dec r -> (reg r -= 1) >> goto (pc+1) 62 | Tgl r -> do v <- rval r 63 | toggle (pc+v) 64 | goto (pc+1) 65 | Jnz i o -> do v <- rval i 66 | o' <- rval o 67 | goto (if v == 0 then pc+1 else pc+o') 68 | 69 | toggle :: Int -> State Machine () 70 | toggle pc = 71 | machProgram . ix pc %= \oper -> 72 | case oper of 73 | Inc x -> Dec x 74 | Dec x -> Inc x 75 | Tgl (Reg x) -> Inc x 76 | Jnz x (Reg y) -> Copy x y 77 | Copy x y -> Jnz x (Reg y) 78 | _ -> error ("Nonsense toggle: " ++ show pc ++ " " ++ show oper) 79 | 80 | goto pc = strictState $ 81 | do program <- use machProgram 82 | case program Vector.!? pc of 83 | Just o -> step pc o 84 | Nothing -> use (reg A) 85 | 86 | -------------------------------------------------------------------------------- /Day24.hs: -------------------------------------------------------------------------------- 1 | {-# Language BangPatterns #-} 2 | module Main where 3 | 4 | import Common 5 | import Data.Bits 6 | import Data.Char 7 | import Data.Foldable 8 | import Data.Maybe 9 | import GridCoord 10 | import Search 11 | import qualified Data.Array.Unboxed as Array 12 | import Data.Array.Unboxed (Array) 13 | import qualified SmallBitSet as SBS 14 | import SmallBitSet (SmallBitSet) 15 | 16 | data Entry = Entry {-# UNPACK #-} !Coord !SmallBitSet 17 | deriving (Eq, Ord) 18 | 19 | parseInput :: String -> Array Coord Char 20 | parseInput file = 21 | coordArray '#' 22 | [ (Coord row col, x) 23 | | (row,r) <- [0..] `zip` lines file 24 | , (col,x) <- [0..] `zip` r 25 | ] 26 | 27 | main :: IO () 28 | main = 29 | do maze <- parseInput <$> readInputFile 24 30 | 31 | let targets = SBS.fromList 32 | $ mapMaybe digitToInt' 33 | $ Array.elems maze 34 | 35 | [start] = [ c | (c,x) <- Array.assocs maze, x == '0' ] 36 | 37 | endings = 38 | [ (here,steps) 39 | | (seen,here,steps) <- 40 | bfsOn 41 | (\(seen,here,_steps) -> Entry here seen) 42 | (next maze) 43 | (SBS.singleton 0, start,0) 44 | , seen == targets ] 45 | 46 | print $ head [ steps | (_ ,steps) <- endings ] 47 | print $ head [ steps | (end,steps) <- endings, end == start ] 48 | 49 | next :: 50 | Array Coord Char -> 51 | (SmallBitSet, Coord, Int) -> 52 | [(SmallBitSet, Coord, Int)] 53 | next maze (seen,here,steps) = 54 | [ (seen',here',steps') 55 | | let !steps' = steps + 1 56 | , here' <- cardinalNeighbors here 57 | , let x = maze Array.! here' 58 | , x /= '#' 59 | , let !seen' = case digitToInt' x of 60 | Just i -> SBS.insert i seen 61 | Nothing -> seen 62 | ] 63 | 64 | digitToInt' :: Char -> Maybe Int 65 | digitToInt' x 66 | | isDigit x = Just (digitToInt x) 67 | | otherwise = Nothing 68 | -------------------------------------------------------------------------------- /Day25.hs: -------------------------------------------------------------------------------- 1 | {-# Language MonoLocalBinds, TemplateHaskell, LambdaCase #-} 2 | module Main where 3 | 4 | import AsmProg 5 | import Common 6 | import Control.Lens 7 | import Data.List 8 | import Data.Map (Map) 9 | import qualified Data.Map as Map 10 | import Data.Set (Set) 11 | import qualified Data.Set as Set 12 | import Data.Vector (Vector) 13 | import qualified Data.Vector as Vector 14 | import Text.Megaparsec 15 | import Text.Megaparsec.Char 16 | import Control.Monad.Trans.State 17 | 18 | data Progress = NeedOne | NeedZero 19 | 20 | data Machine = Machine 21 | { _machRegisters :: !Registers 22 | , _machProgress :: !Progress 23 | , _machTargets :: !(Set (Int,Registers)) 24 | } 25 | 26 | makeLenses ''Machine 27 | 28 | instance HasRegisters Machine where 29 | reg r = machRegisters . reg r 30 | {-# INLINE reg #-} 31 | 32 | main :: IO () 33 | main = 34 | do program <- Vector.fromList . parseLines parseFile <$> readInputFile 25 35 | print $ find (execute program) [1..] 36 | 37 | data Inst 38 | = Copy Value !Register 39 | | Inc !Register 40 | | Dec !Register 41 | | Jnz Value Value 42 | | Out Value 43 | deriving Show 44 | 45 | parseFile :: Parser Inst 46 | parseFile = 47 | Copy <$ wholestring "cpy " <*> pValue <* char ' ' <*> pReg <|> 48 | Jnz <$ wholestring "jnz " <*> pValue <* char ' ' <*> pValue <|> 49 | Inc <$ wholestring "inc " <*> pReg <|> 50 | Dec <$ wholestring "dec " <*> pReg <|> 51 | Out <$ wholestring "out " <*> pValue 52 | 53 | execute :: Vector Inst -> Int -> Bool 54 | execute program a = 55 | evalState theMain (Machine zeroRegisters NeedZero mempty) 56 | where 57 | theMain = do reg A .= a 58 | goto 0 59 | 60 | step pc = \case 61 | Out o -> 62 | do v <- rval o 63 | progress <- use machProgress 64 | case (progress, v) of 65 | (NeedOne, 1) -> 66 | do machProgress .= NeedZero 67 | goto (pc+1) 68 | 69 | (NeedZero, 0) -> 70 | do registers <- use machRegisters 71 | targets <- use machTargets 72 | let now = (pc,registers) 73 | if Set.member now targets then 74 | return True 75 | else 76 | do machTargets . contains now .= True 77 | machProgress .= NeedOne 78 | goto (pc+1) 79 | 80 | _ -> return False 81 | 82 | Copy i o -> do reg o <~ rval i 83 | goto (pc+1) 84 | 85 | Inc r -> do reg r += 1 86 | goto (pc+1) 87 | 88 | Dec r -> do reg r -= 1 89 | goto (pc+1) 90 | 91 | Jnz i o -> do v <- rval i 92 | o' <- rval o 93 | let pcOff = if v == 0 then 1 else o' 94 | goto (pc+pcOff) 95 | 96 | goto pc = strictState $ 97 | case (program Vector.!? pc) of 98 | Nothing -> return False 99 | Just o -> step pc o 100 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Eric Mertens 2 | 3 | Permission to use, copy, modify, and/or distribute this software for any purpose 4 | with or without fee is hereby granted, provided that the above copyright notice 5 | and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 8 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 9 | FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 10 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 11 | OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 12 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 13 | THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /advent2016.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 2.4 2 | name: advent2016 3 | version: 0.1.0.0 4 | license: ISC 5 | license-file: LICENSE 6 | author: Eric Mertens 7 | maintainer: emertens@galois.com 8 | copyright: 2016 Eric Mertens 9 | build-type: Simple 10 | extra-source-files: ChangeLog.md 11 | 12 | library 13 | hs-source-dirs: lib 14 | exposed-modules: Common, Search, GridCoord, AsmProg, UnboxFunctions, SmallBitSet 15 | build-depends: 16 | base ^>=4.14, 17 | megaparsec ^>=9.0, 18 | containers >=0.5 && <0.7, 19 | array >= 0.5 && <0.6, 20 | lens ^>= 5.0, 21 | mtl >=2.2 && <2.3, 22 | ghc-prim 23 | default-language: Haskell2010 24 | 25 | executable Day01 26 | main-is: Day01.hs 27 | build-depends: advent2016, base, megaparsec, containers 28 | default-language: Haskell2010 29 | 30 | executable Day02 31 | main-is: Day02.hs 32 | build-depends: advent2016, base, array >=0.5 && <0.6 33 | default-language: Haskell2010 34 | 35 | executable Day03 36 | main-is: Day03.hs 37 | build-depends: advent2016, base, split >=0.2 && <0.3 38 | default-language: Haskell2010 39 | 40 | executable Day04 41 | main-is: Day04.hs 42 | build-depends: advent2016, base, containers, megaparsec 43 | default-language: Haskell2010 44 | 45 | executable Day05 46 | main-is: Day05.hs 47 | build-depends: advent2016, base, containers, cryptohash-md5, bytestring ^>=0.10, 48 | default-language: Haskell2010 49 | 50 | executable Day06 51 | main-is: Day06.hs 52 | build-depends: advent2016, base, containers 53 | default-language: Haskell2010 54 | 55 | executable Day07 56 | main-is: Day07.hs 57 | build-depends: advent2016, base, megaparsec 58 | default-language: Haskell2010 59 | 60 | executable Day08 61 | main-is: Day08.hs 62 | build-depends: advent2016, base, array >=0.5 && <0.6, megaparsec 63 | default-language: Haskell2010 64 | 65 | executable Day09 66 | main-is: Day09.hs 67 | build-depends: advent2016, base, megaparsec 68 | default-language: Haskell2010 69 | 70 | executable Day10 71 | main-is: Day10.hs 72 | build-depends: advent2016, base, containers, megaparsec 73 | default-language: Haskell2010 74 | 75 | executable Day11 76 | main-is: Day11.hs 77 | build-depends: advent2016, base, lens 78 | default-language: Haskell2010 79 | 80 | executable Day12 81 | main-is: Day12.hs 82 | build-depends: advent2016, base, containers, megaparsec, vector, lens 83 | default-language: Haskell2010 84 | 85 | executable Day13 86 | main-is: Day13.hs 87 | build-depends: advent2016, base 88 | default-language: Haskell2010 89 | 90 | executable Day14 91 | main-is: Day14.hs 92 | build-depends: base, bytestring ^>=0.10, cryptohash-md5 93 | default-language: Haskell2010 94 | 95 | executable Day15 96 | main-is: Day15.hs 97 | build-depends: base 98 | default-language: Haskell2010 99 | 100 | executable Day16 101 | main-is: Day16.hs 102 | build-depends: base, vector 103 | default-language: Haskell2010 104 | 105 | executable Day17 106 | main-is: Day17.hs 107 | build-depends: advent2016, bytestring, base, cryptohash-md5 108 | default-language: Haskell2010 109 | 110 | executable Day18 111 | main-is: Day18.hs 112 | build-depends: advent2016, base 113 | default-language: Haskell2010 114 | 115 | executable Day19 116 | main-is: Day19.hs 117 | build-depends: containers, base 118 | default-language: Haskell2010 119 | 120 | executable Day20 121 | main-is: Day20.hs 122 | build-depends: base, advent2016, megaparsec 123 | default-language: Haskell2010 124 | 125 | executable Day21 126 | main-is: Day21.hs 127 | build-depends: base, advent2016, megaparsec 128 | default-language: Haskell2010 129 | 130 | executable Day22 131 | main-is: Day22.hs 132 | build-depends: base, advent2016, megaparsec, array 133 | default-language: Haskell2010 134 | 135 | executable Day23 136 | main-is: Day23.hs 137 | build-depends: advent2016, base, containers, megaparsec, vector, lens, transformers 138 | default-language: Haskell2010 139 | 140 | executable Day24 141 | main-is: Day24.hs 142 | build-depends: advent2016, base, array, containers 143 | default-language: Haskell2010 144 | 145 | executable Day25 146 | main-is: Day25.hs 147 | build-depends: advent2016, base, containers, megaparsec, vector, lens, transformers 148 | default-language: Haskell2010 149 | -------------------------------------------------------------------------------- /asmprog-final/.gitignore: -------------------------------------------------------------------------------- 1 | dump-core/ 2 | -------------------------------------------------------------------------------- /asmprog-final/ChangeLog.md: -------------------------------------------------------------------------------- 1 | # Revision history for asmprog-final 2 | 3 | ## 0.1.0.0 -- YYYY-mm-dd 4 | 5 | * First version. Released on an unsuspecting world. 6 | -------------------------------------------------------------------------------- /asmprog-final/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017, Eric Mertens 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above 12 | copyright notice, this list of conditions and the following 13 | disclaimer in the documentation and/or other materials provided 14 | with the distribution. 15 | 16 | * Neither the name of Eric Mertens nor the names of other 17 | contributors may be used to endorse or promote products derived 18 | from this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | -------------------------------------------------------------------------------- /asmprog-final/Main.hs: -------------------------------------------------------------------------------- 1 | {-# Language TypeFamilies #-} -- for PrimMonad 2 | {-# Language GeneralizedNewtypeDeriving #-} 3 | 4 | module Main (main) where 5 | 6 | import Control.Applicative (Alternative((<|>), some, many), liftA, liftA2) 7 | import Control.Exception (throwIO) 8 | import Control.Monad (MonadPlus, when, guard) 9 | import Control.Monad.Primitive (PrimMonad(primitive, PrimState)) 10 | import Control.Monad.Trans.State (StateT(runStateT), gets, modify', state) 11 | import Control.Monad.Trans.Reader (ReaderT(ReaderT,runReaderT)) 12 | import Control.Monad.Trans.Writer (WriterT, execWriterT, tell) 13 | import Control.Monad.Trans.Class (MonadTrans(lift)) 14 | import Data.Foldable (find, fold) 15 | import Data.Functor.Identity (Identity,runIdentity) 16 | import Data.Maybe (fromMaybe) 17 | import Data.Semigroup (Semigroup, Endo(Endo,appEndo), (<>)) 18 | import Data.Text (Text) 19 | import qualified Data.Text.IO as Text 20 | import qualified Data.Vector as V 21 | import Data.Vector (Vector) 22 | import Data.Void (Void) 23 | import qualified Data.Vector.Unboxed.Mutable as MV 24 | import Data.Vector.Unboxed.Mutable (Unbox, MVector) 25 | import qualified Text.Megaparsec as P 26 | import qualified Text.Megaparsec.Char as P 27 | import qualified Text.Megaparsec.Char.Lexer as P 28 | import Control.Monad.ST (stToIO) 29 | import Debug.Trace 30 | 31 | type Parser = P.Parsec Void Text 32 | 33 | filename12, filename23, filename25 :: FilePath 34 | filename12 = "../inputs/input12.txt" 35 | filename23 = "../inputs/input23.txt" 36 | filename25 = "../inputs/input25.txt" 37 | 38 | main :: IO () 39 | main = do run25 40 | 41 | run12 :: IO () 42 | run12 = 43 | do putStrLn "Problem 12" 44 | program12 <- loadFile basicInstructions filename12 45 | let compute12 c = runIdentity $ evalMachineT 46 | $ do C =: c; runUntilEnd (eval <$> program12); reg A 47 | print (compute12 0) 48 | print (compute12 1) 49 | 50 | run23 :: IO () 51 | run23 = 52 | do putStrLn "Problem 23" 53 | program23 <- loadFile (toggleInstruction:basicInstructions) filename23 54 | let compute23 a = stToIO $ evalMachineT $ runToggleT (length program23) 55 | $ do A =: a; runUntilEnd (toggleEval <$> program23); reg A 56 | print =<< compute23 7 57 | print =<< compute23 12 -- takes under 2 minutes on my computer 58 | 59 | run25 :: IO () 60 | run25 = 61 | do putStrLn "Problem 25" 62 | (pgm1, pgm2) <- V.unzip <$> loadFile (outputInstruction:basicInstructions) filename25 63 | putStrLn "First 50 outputs when A initialized to 1" 64 | print $ take 50 $ runIdentity $ evalMachineT $ execOutputListT 65 | $ do A =: 1; runUntilEnd (eval <$> pgm1) 66 | print $ find (isGoodLoop (eval <$> pgm2)) [1..] 67 | 68 | ------------------------------------------------------------------------ 69 | -- Instructions 70 | ------------------------------------------------------------------------ 71 | 72 | data Register = PC | A | B | C | D 73 | 74 | data Expr = ExprInt !Int | ExprRegister !Register 75 | 76 | -- | Instructions common to problems 12, 23, and 25 77 | class BasicOps a where 78 | inc :: Register -> a 79 | dec :: Register -> a 80 | cpy :: Expr -> Register -> a 81 | jnz :: Expr -> Expr -> a 82 | 83 | -- | Instructions unique to problem 23 84 | class OutputOp a where 85 | out :: Expr -> a 86 | 87 | -- | Instructions unique to problem 25 88 | class ToggleOp a where 89 | tgl :: Expr -> a 90 | 91 | ------------------------------------------------------------------------ 92 | -- Registers and a monadic interface to managing them. 93 | ------------------------------------------------------------------------ 94 | 95 | class Monad m => MonadRegisters m where 96 | reg :: Register -> m Int 97 | (=:) :: Register -> Int -> m () 98 | 99 | (+=), (-=) :: MonadRegisters m => Register -> Int -> m () 100 | r += d = do x <- reg r; r =: x+d 101 | r -= d = r += negate d 102 | infix 2 =:, +=, -= 103 | 104 | value :: MonadRegisters m => Expr -> m Int 105 | value (ExprInt i) = return i 106 | value (ExprRegister r) = reg r 107 | 108 | ------------------------------------------------------------------------ 109 | -- Implementation of basic instructions in terms of a register machine 110 | ------------------------------------------------------------------------ 111 | 112 | newtype Eval m = Eval { eval :: m () } 113 | 114 | instance MonadRegisters m => BasicOps (Eval m) where 115 | inc r = Eval $ do r += 1; PC += 1 116 | dec r = Eval $ do r -= 1; PC += 1 117 | cpy i o = Eval $ do v <- value i; o =: v; PC += 1 118 | jnz cond offset = Eval $ 119 | do x <- value cond 120 | o <- if x == 0 then return 1 else value offset 121 | PC += o 122 | {-# INLINE inc #-} 123 | {-# INLINE dec #-} 124 | {-# INLINE cpy #-} 125 | {-# INLINE jnz #-} 126 | 127 | ------------------------------------------------------------------------ 128 | -- Implementation of out instruction 129 | ------------------------------------------------------------------------ 130 | 131 | class Monad m => MonadOutput m where 132 | recordOutput :: Int -> m () 133 | 134 | instance (MonadRegisters m, MonadOutput m) => OutputOp (Eval m) where 135 | out o = Eval $ do recordOutput =<< value o; PC += 1 136 | 137 | ------------------------------------------------------------------------ 138 | -- Implementation of the primitive tgl instrution 139 | ------------------------------------------------------------------------ 140 | 141 | class Monad m => MonadToggleFlag m where 142 | isToggled :: Int -> m Bool 143 | togglePC :: Int -> m () 144 | 145 | instance (MonadRegisters m, MonadToggleFlag m) => ToggleOp (Eval m) where 146 | tgl x = Eval $ 147 | do offset <- value x 148 | pc <- reg PC 149 | togglePC (pc+offset) 150 | PC =: pc+1 151 | 152 | ------------------------------------------------------------------------ 153 | -- Alternative evaluation type that can support toggling 154 | ------------------------------------------------------------------------ 155 | 156 | -- | Like 'Eval', but dispatches to the "toggled" instruction when toggle flag is set 157 | newtype ToggleEval m = ToggleEval { toggleEval :: m () } 158 | 159 | instance (MonadRegisters m, MonadToggleFlag m) => BasicOps (ToggleEval m) where 160 | inc x = toggler (inc x ) (dec x) 161 | dec x = toggler (dec x ) (inc x) 162 | jnz x y = toggler (jnz x y) (cpy x `needReg` y) 163 | cpy x y = toggler (cpy x y) (jnz x (ExprRegister y)) 164 | 165 | instance (MonadRegisters m, MonadToggleFlag m) => ToggleOp (ToggleEval m) where 166 | tgl x = toggler (tgl x) (inc `needReg` x) 167 | 168 | -- | Instructions flipped to invalid operations become no-ops 169 | needReg :: MonadRegisters m => (Register -> Eval m) -> Expr -> Eval m 170 | needReg f (ExprRegister r) = f r 171 | needReg _ _ = Eval (PC += 1) 172 | 173 | toggler :: (MonadRegisters m, MonadToggleFlag m) => Eval m -> Eval m -> ToggleEval m 174 | toggler (Eval normal) (Eval toggled) = ToggleEval $ 175 | do x <- isToggled =<< reg PC 176 | if x then toggled else normal 177 | {-# INLINE toggler #-} 178 | 179 | ------------------------------------------------------------------------ 180 | -- MachineT: An implementation of MonadRegisters 181 | ------------------------------------------------------------------------ 182 | 183 | newtype MachineT m a = MachineT (StateT Registers m a) 184 | deriving (Functor, Applicative, Monad, Alternative, MonadPlus, MonadTrans) 185 | 186 | data Registers = Registers 187 | { registerPC, registerA, registerB, registerC, registerD :: !Int } 188 | deriving (Show, Eq) 189 | 190 | instance PrimMonad m => PrimMonad (MachineT m) where 191 | type PrimState (MachineT m) = PrimState m 192 | primitive = lift . primitive 193 | 194 | instance Monad m => MonadRegisters (MachineT m) where 195 | reg r = MachineT $ 196 | gets $ case r of 197 | PC -> registerPC 198 | A -> registerA 199 | B -> registerB 200 | C -> registerC 201 | D -> registerD 202 | r =: x = MachineT $ 203 | modify' $ \rs -> case r of 204 | PC -> rs { registerPC = x } 205 | A -> rs { registerA = x } 206 | B -> rs { registerB = x } 207 | C -> rs { registerC = x } 208 | D -> rs { registerD = x } 209 | {-# INLINE (=:) #-} 210 | {-# INLINE reg #-} 211 | 212 | runMachineT :: Registers -> MachineT m a -> m (a, Registers) 213 | runMachineT r (MachineT m) = runStateT m r 214 | 215 | evalMachineT :: Monad m => MachineT m a -> m a 216 | evalMachineT m = fst <$> runMachineT initialRegisters m 217 | 218 | initialRegisters :: Registers 219 | initialRegisters = Registers 0 0 0 0 0 220 | 221 | ------------------------------------------------------------------------ 222 | -- OutputT 223 | ------------------------------------------------------------------------ 224 | 225 | -- | An implementation of 'MonadOutput' that checks for alternating output 226 | newtype OutputT m a = OutputT (StateT Int m a) 227 | deriving (Functor, Applicative, Monad, MonadTrans) 228 | 229 | runOutputT :: Int -> OutputT m a -> m (a, Int) 230 | runOutputT x (OutputT m) = runStateT m x 231 | 232 | -- | Run an 'OutputT' but ignore the /result/ and keep the output counter. 233 | execOutputT :: Functor m => Int -> OutputT m a -> m Int 234 | execOutputT x o = snd <$> runOutputT x o 235 | 236 | -- | Pass registers through to underlying machine 237 | instance MonadRegisters m => MonadRegisters (OutputT m) where 238 | x =: y = lift (x =: y) 239 | reg x = lift (reg x) 240 | 241 | instance MonadPlus m => MonadOutput (OutputT m) where 242 | recordOutput x = OutputT $ 243 | do n <- state $ \n -> let n' = n+1 in n' `seq` (n,n') 244 | guard (x == if even n then 0 else 1) 245 | 246 | ------------------------------------------------------------------------ 247 | -- OutputListT 248 | ------------------------------------------------------------------------ 249 | 250 | -- | An implementation of MonadOutput that gathers outputs in list 251 | newtype OutputListT m a = OutputListT (WriterT (Endo [Int]) m a) 252 | deriving (Functor, Applicative, Monad, MonadTrans) 253 | 254 | -- | Run an 'OutputListT' computation and ignore the /result/ keeping only 255 | -- the output list. 256 | execOutputListT :: Monad m => OutputListT m a -> m [Int] 257 | execOutputListT (OutputListT m) = (`appEndo` []) <$> execWriterT m 258 | 259 | instance Monad m => MonadOutput (OutputListT m) where 260 | recordOutput = OutputListT . tell . Endo . (:) 261 | 262 | -- | Pass registers through to underlying monad 263 | instance MonadRegisters m => MonadRegisters (OutputListT m) where 264 | x =: y = lift (x =: y) 265 | reg x = lift (reg x) 266 | {-# INLINE (=:) #-} 267 | {-# INLINE reg #-} 268 | 269 | ------------------------------------------------------------------------ 270 | -- ToggleT 271 | ------------------------------------------------------------------------ 272 | 273 | -- | Monad transformer implementing 'MonadToggleFlag' 274 | newtype ToggleT m a = ToggleT (ReaderT (MVector (PrimState m) Bool) m a) 275 | deriving (Functor, Applicative, Monad, Alternative, MonadPlus) 276 | 277 | instance MonadTrans ToggleT where lift = ToggleT . lift -- GND can't handle this one 278 | 279 | -- | Run a togglable machine with all instructions set to not be toggled. 280 | runToggleT :: PrimMonad m => Int {- program size -} -> ToggleT m a -> m a 281 | runToggleT n (ToggleT m) = runReaderT m =<< MV.replicate n False 282 | 283 | -- | Check that given index is in range for given vector 284 | inRange :: Unbox a => MVector s a -> Int -> Bool 285 | inRange v i = i >= 0 && i < MV.length v 286 | 287 | instance PrimMonad m => MonadToggleFlag (ToggleT m) where 288 | isToggled i = ToggleT $ ReaderT $ \v -> 289 | if inRange v i then MV.read v i else return False 290 | togglePC i = ToggleT $ ReaderT $ \v -> 291 | when (inRange v i) (MV.modify v not i) 292 | {-# INLINE isToggled #-} 293 | {-# INLINE togglePC #-} 294 | 295 | -- | Pass registers through to underlying monad 296 | instance MonadRegisters m => MonadRegisters (ToggleT m) where 297 | x =: y = lift (x =: y) 298 | reg x = lift (reg x) 299 | {-# INLINE (=:) #-} 300 | {-# INLINE reg #-} 301 | 302 | ------------------------------------------------------------------------ 303 | -- Functions for executing a whole program 304 | ------------------------------------------------------------------------ 305 | 306 | -- | Big-step machine semantics. Runs machine until it halts. 307 | runUntilEnd :: MonadRegisters m => Vector (m ()) -> m () 308 | runUntilEnd program = go where 309 | go = do pc <- reg PC 310 | case program V.!? pc of 311 | Nothing -> return () 312 | Just m -> do m; go 313 | 314 | 315 | -- | Predicate for machines that loop while producing a good output stream. 316 | isGoodLoop :: 317 | Vector (OutputT (MachineT Maybe) ()) {- ^ instructions -} -> 318 | Int {- ^ initial register A value -} -> 319 | Bool {- ^ is 0,1 generator -} 320 | isGoodLoop program start = isWorking (go s0 <$> step s0) 321 | where 322 | -- initial machine state 323 | s0 = (0, initialRegisters { registerA = start }) 324 | 325 | -- small-step machine semantics 326 | step (outs, regs) = 327 | do op <- program V.!? registerPC regs 328 | runMachineT regs (execOutputT outs op) 329 | 330 | -- machine produced a postive, even number of outputs 331 | isProductive (out1, _) (out2, _) = out1 /= out2 && even (out1 - out2) 332 | 333 | -- machine is at same PC with same registers 334 | isLooping (_, regs1) (_, regs2) = regs1 == regs2 335 | 336 | -- Things are working if they return Just True 337 | isWorking = fromMaybe False 338 | 339 | -- advance the slow machine once and fast twice. check if the machine looped 340 | go slow fast 341 | | isLooping slow fast = isProductive slow fast 342 | | otherwise = isWorking 343 | $ liftA2 go (step slow) (step =<< step fast) 344 | 345 | ------------------------------------------------------------------------ 346 | -- Parser logic 347 | ------------------------------------------------------------------------ 348 | 349 | -- | Parse the file using the set of possible instructions. 350 | loadFile :: [(String, Parser a)] -> FilePath -> IO (Vector a) 351 | loadFile instructions filename = 352 | do txt <- Text.readFile filename 353 | case P.parse (parseLines (dispatch instructions)) filename txt of 354 | Left e -> throwIO e 355 | Right p -> return $! V.fromList p 356 | 357 | -- | Parser the lines of the file using a single parser 358 | parseLines :: Parser a -> Parser [a] 359 | parseLines p = P.sepEndBy p P.eol <* P.eof 360 | 361 | -- | Select a parser by selecting via the next alphabetic lexeme 362 | dispatch :: [(String,Parser a)] -> Parser a 363 | dispatch xs = 364 | do name <- lexeme (some P.letterChar) 365 | case lookup name xs of 366 | Just p -> p 367 | Nothing -> fail ("unexpected '" ++ name ++ "'") 368 | 369 | -- | Wrap a parser to handle trailing whitespace 370 | lexeme :: Parser a -> Parser a 371 | lexeme = P.lexeme (P.skipMany (P.char ' ')) 372 | 373 | -- | Parse a single register 374 | pRegister :: Parser Register 375 | pRegister = dispatch [("a",pure A),("b",pure B),("c",pure C),("d",pure D)] 376 | 377 | -- | Parse a register or a integer constant 378 | pExpr :: Parser Expr 379 | pExpr = ExprRegister <$> pRegister 380 | <|> ExprInt . fromInteger <$> lexeme (P.signed (pure ()) P.decimal) 381 | 382 | ------------------------------------------------------------------------ 383 | -- Individual instruction names and argument parsers 384 | ------------------------------------------------------------------------ 385 | 386 | -- | Basic machine instructions common to all programs 387 | basicInstructions :: BasicOps a => [(String, Parser a)] 388 | basicInstructions = 389 | [ ("inc", strict (liftA inc pRegister )) 390 | , ("dec", strict (liftA dec pRegister )) 391 | , ("jnz", strict (liftA2 jnz pExpr pExpr )) 392 | , ("cpy", strict (liftA2 cpy pExpr pRegister)) ] 393 | {-# INLINE basicInstructions #-} 394 | 395 | strict :: Monad m => m a -> m a 396 | strict m = do x <- m; return $! x 397 | {-# INLINE strict #-} 398 | 399 | -- | Toggle machine instruction specific to proram 23 400 | toggleInstruction :: ToggleOp a => (String, Parser a) 401 | toggleInstruction = ("tgl", strict (liftA tgl pExpr)) 402 | {-# INLINE toggleInstruction #-} 403 | 404 | -- | Output machine instruction specific to proram 25 405 | outputInstruction :: OutputOp a => (String, Parser a) 406 | outputInstruction = ("out", strict (liftA out pExpr)) 407 | {-# INLINE outputInstruction #-} 408 | 409 | ------------------------------------------------------------------------ 410 | -- String builder representation 411 | ------------------------------------------------------------------------ 412 | 413 | -- | Newtype'd 'ShowS' used to interpret instructions as pretty-printed output 414 | newtype Render = Render (Endo String) 415 | deriving (Monoid, Semigroup) 416 | 417 | renderProgram :: Foldable t => t Render -> String 418 | renderProgram = renderToString . fold 419 | 420 | renderToString :: Render -> String 421 | renderToString (Render m) = m `appEndo` "" 422 | 423 | fromShowS :: ShowS -> Render 424 | fromShowS = Render . Endo 425 | 426 | rString :: String -> Render 427 | rString = fromShowS . showString 428 | 429 | rExpr :: Expr -> Render 430 | rExpr (ExprRegister r) = rRegister r 431 | rExpr (ExprInt i) = fromShowS (shows i) 432 | 433 | rRegister :: Register -> Render 434 | rRegister r = rString $ case r of PC -> "pc"; A -> "a"; B -> "b"; C -> "c"; D -> "d" 435 | 436 | ------------------------------------------------------------------------ 437 | -- Renderer interpretation of machine instructions --------------------- 438 | ------------------------------------------------------------------------ 439 | 440 | instance BasicOps Render where 441 | inc x = rString "inc " <> rRegister x <> rString "\n" 442 | dec x = rString "dec " <> rRegister x <> rString "\n" 443 | cpy x y = rString "cpy " <> rExpr x <> 444 | rString " " <> rRegister y <> rString "\n" 445 | jnz x y = rString "jnz " <> rExpr x <> 446 | rString " " <> rExpr y <> rString "\n" 447 | 448 | instance ToggleOp Render where 449 | tgl x = rString "tgl " <> rExpr x <> rString "\n" 450 | 451 | instance OutputOp Render where 452 | out x = rString "out " <> rExpr x <> rString "\n" 453 | 454 | ------------------------------------------------------------------------ 455 | -- Multiple interpretations in parallel 456 | ------------------------------------------------------------------------ 457 | 458 | instance (BasicOps a, BasicOps b) => BasicOps (a,b) where 459 | inc x = (inc x , inc x ) 460 | dec x = (dec x , dec x ) 461 | cpy x y = (cpy x y, cpy x y) 462 | jnz x y = (jnz x y, jnz x y) 463 | 464 | instance (ToggleOp a, ToggleOp b) => ToggleOp (a,b) where 465 | tgl x = (tgl x, tgl x) 466 | 467 | instance (OutputOp a, OutputOp b) => OutputOp (a,b) where 468 | out x = (out x, out x) 469 | -------------------------------------------------------------------------------- /asmprog-final/Optimizer.hs: -------------------------------------------------------------------------------- 1 | {-# Language TemplateHaskell #-} 2 | module Optimizer where 3 | 4 | import Language.Haskell.TH 5 | 6 | explode :: Name -> ExpQ -> ExpQ 7 | explode name f = 8 | do TyConI (DataD _ _ _ _ constructors _) <- reify name 9 | xName <- newName "x" 10 | lam1E (varP xName) 11 | (caseE (varE xName) 12 | [ match (conP constructorName []) 13 | (normalB (appE f (conE constructorName))) 14 | [] 15 | | NormalC constructorName [] <- constructors 16 | ]) 17 | -------------------------------------------------------------------------------- /asmprog-final/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /asmprog-final/Small.hs: -------------------------------------------------------------------------------- 1 | {-# Language BangPatterns #-} 2 | {-# Language MagicHash #-} 3 | {-# Language TemplateHaskell #-} 4 | {-# Language RankNTypes #-} 5 | 6 | module Small where 7 | 8 | import Control.Monad 9 | import Control.Monad.Trans.Class 10 | import Control.Monad.Trans.State 11 | import Control.Applicative 12 | import Data.Monoid 13 | import GHC.Exts 14 | ------------------------------------------------------------------------ 15 | -- Instructions 16 | ------------------------------------------------------------------------ 17 | 18 | data Register = PC | A | B | C | D 19 | deriving Read 20 | 21 | data Registers = Registers 22 | { registerPC, registerA, registerB, registerC, registerD :: !Int } 23 | deriving (Show, Eq) 24 | 25 | ------------------------------------------------------------------------ 26 | -- Implementation of basic instructions in terms of a register machine 27 | ------------------------------------------------------------------------ 28 | 29 | example str = increment (read str) 30 | 31 | increment :: Register -> State Registers () 32 | increment = cases (\r -> do x <- reg r 33 | set r (x+1) 34 | x <- reg PC 35 | set r (x+1)) 36 | 37 | cases x = \r -> case r of 38 | A -> inline x A 39 | B -> inline x B 40 | C -> inline x C 41 | D -> inline x D 42 | PC -> inline x PC 43 | 44 | ------------------------------------------------------------------------ 45 | -- MachineT: An implementation of MonadMachine 46 | ------------------------------------------------------------------------ 47 | 48 | reg A = gets registerA 49 | reg B = gets registerB 50 | reg C = gets registerC 51 | reg D = gets registerD 52 | reg PC = gets registerPC 53 | {-# INLINE reg #-} 54 | 55 | set A x = modify' $ \rs -> rs { registerA = x } 56 | set B x = modify' $ \rs -> rs { registerB = x } 57 | set C x = modify' $ \rs -> rs { registerC = x } 58 | set D x = modify' $ \rs -> rs { registerD = x } 59 | set PC x = modify' $ \rs -> rs { registerPC = x } 60 | {-# INLINE set #-} 61 | 62 | newtype Machine = Machine (forall r. (Registers -> r) -> Registers -> r) 63 | 64 | instance Monoid Machine where 65 | mempty = Machine id 66 | mappend (Machine f) (Machine g) = Machine (\k rs -> f (g k) rs) 67 | -------------------------------------------------------------------------------- /asmprog-final/asmprog-final.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 2.4 2 | name: asmprog-final 3 | version: 0.1.0.0 4 | synopsis: Implementations of adventofcode.com 2016 problems 12,23 and 25 5 | description: This implementation explores using a final encoding of the 6 | assembly language to support both alternate interpreters for 7 | the language while also supporting addition of instructions 8 | while preserving reuse of the previous implementations. 9 | license: BSD-3-Clause 10 | license-file: LICENSE 11 | author: Eric Mertens 12 | maintainer: emertens@gmail.com 13 | copyright: 2016 Eric Mertens 14 | build-type: Simple 15 | extra-source-files: ChangeLog.md 16 | 17 | executable asmprog-final 18 | main-is: Main.hs 19 | other-modules: Optimizer 20 | ghc-options: -O2 21 | default-language: Haskell2010 22 | build-depends: base ^>=4.14, 23 | megaparsec ^>=9.0, 24 | primitive >=0.6 && <0.8, 25 | text >=1.2 && <1.3, 26 | transformers >=0.5 && <0.6, 27 | template-haskell ^>=2.16, 28 | vector >=0.12 && <0.13 29 | 30 | if flag(dump-core) 31 | build-depends: dump-core 32 | ghc-options: -fplugin=DumpCore 33 | 34 | flag dump-core 35 | default: False 36 | description: Enable the dump-core GHC plugin 37 | -------------------------------------------------------------------------------- /inputs/input1.txt: -------------------------------------------------------------------------------- 1 | R1, R1, R3, R1, R1, L2, R5, L2, R5, R1, R4, L2, R3, L3, R4, L5, R4, R4, R1, L5, L4, R5, R3, L1, R4, R3, L2, L1, R3, L4, R3, L2, R5, R190, R3, R5, L5, L1, R54, L3, L4, L1, R4, R1, R3, L1, L1, R2, L2, R2, R5, L3, R4, R76, L3, R4, R191, R5, R5, L5, L4, L5, L3, R1, R3, R2, L2, L2, L4, L5, L4, R5, R4, R4, R2, R3, R4, L3, L2, R5, R3, L2, L1, R2, L3, R2, L1, L1, R1, L3, R5, L5, L1, L2, R5, R3, L3, R3, R5, R2, R5, R5, L5, L5, R2, L3, L5, L2, L1, R2, R2, L2, R2, L3, L2, R3, L5, R4, L4, L5, R3, L4, R1, R3, R2, R4, L2, L3, R2, L5, R5, R4, L2, R4, L1, L3, L1, L3, R1, R2, R1, L5, R5, R3, L3, L3, L2, R4, R2, L5, L1, L1, L5, L4, L1, L1, R1 2 | -------------------------------------------------------------------------------- /inputs/input10.txt: -------------------------------------------------------------------------------- 1 | bot 152 gives low to bot 155 and high to bot 70 2 | bot 166 gives low to bot 27 and high to bot 8 3 | bot 167 gives low to output 4 and high to bot 34 4 | bot 75 gives low to bot 7 and high to bot 113 5 | value 43 goes to bot 90 6 | bot 109 gives low to bot 188 and high to bot 13 7 | bot 32 gives low to bot 3 and high to bot 164 8 | bot 24 gives low to bot 62 and high to bot 149 9 | bot 161 gives low to bot 8 and high to bot 139 10 | bot 56 gives low to bot 114 and high to bot 124 11 | bot 192 gives low to bot 20 and high to bot 67 12 | bot 159 gives low to bot 104 and high to bot 206 13 | bot 196 gives low to bot 35 and high to bot 152 14 | bot 171 gives low to bot 67 and high to bot 141 15 | bot 90 gives low to bot 187 and high to bot 200 16 | bot 184 gives low to bot 132 and high to bot 198 17 | bot 89 gives low to bot 206 and high to bot 147 18 | bot 155 gives low to bot 121 and high to bot 69 19 | bot 200 gives low to bot 174 and high to bot 87 20 | bot 148 gives low to output 19 and high to bot 156 21 | bot 1 gives low to bot 99 and high to bot 131 22 | bot 44 gives low to bot 119 and high to bot 177 23 | bot 98 gives low to bot 172 and high to bot 65 24 | bot 160 gives low to bot 197 and high to bot 202 25 | bot 168 gives low to output 7 and high to bot 126 26 | bot 27 gives low to bot 127 and high to bot 183 27 | bot 5 gives low to bot 177 and high to bot 16 28 | bot 13 gives low to bot 0 and high to bot 46 29 | bot 185 gives low to bot 141 and high to bot 94 30 | bot 174 gives low to bot 40 and high to bot 97 31 | bot 194 gives low to output 17 and high to output 13 32 | bot 146 gives low to bot 56 and high to bot 83 33 | bot 143 gives low to output 20 and high to bot 194 34 | bot 149 gives low to bot 60 and high to bot 179 35 | bot 68 gives low to bot 95 and high to bot 32 36 | bot 84 gives low to bot 45 and high to bot 165 37 | bot 58 gives low to output 5 and high to bot 172 38 | bot 115 gives low to output 14 and high to bot 148 39 | bot 74 gives low to bot 125 and high to bot 106 40 | bot 7 gives low to bot 87 and high to bot 176 41 | bot 104 gives low to bot 84 and high to bot 154 42 | bot 188 gives low to output 1 and high to bot 0 43 | bot 40 gives low to bot 83 and high to bot 79 44 | bot 73 gives low to bot 138 and high to bot 128 45 | value 67 goes to bot 17 46 | bot 195 gives low to bot 61 and high to bot 30 47 | bot 131 gives low to bot 142 and high to bot 43 48 | bot 53 gives low to bot 207 and high to bot 37 49 | bot 49 gives low to bot 18 and high to bot 205 50 | bot 112 gives low to bot 55 and high to bot 191 51 | bot 45 gives low to bot 157 and high to bot 92 52 | bot 80 gives low to bot 146 and high to bot 40 53 | bot 41 gives low to bot 182 and high to bot 195 54 | bot 11 gives low to bot 117 and high to bot 127 55 | bot 176 gives low to bot 82 and high to bot 48 56 | bot 15 gives low to bot 151 and high to bot 77 57 | bot 208 gives low to bot 167 and high to bot 42 58 | bot 180 gives low to bot 65 and high to bot 10 59 | bot 175 gives low to bot 111 and high to bot 44 60 | bot 92 gives low to bot 108 and high to bot 118 61 | bot 163 gives low to bot 44 and high to bot 5 62 | bot 51 gives low to bot 115 and high to bot 178 63 | bot 173 gives low to bot 12 and high to bot 73 64 | bot 202 gives low to bot 180 and high to bot 10 65 | bot 88 gives low to output 2 and high to bot 115 66 | bot 72 gives low to bot 201 and high to bot 125 67 | bot 50 gives low to bot 11 and high to bot 27 68 | bot 79 gives low to bot 100 and high to bot 39 69 | bot 129 gives low to bot 22 and high to bot 132 70 | bot 154 gives low to bot 165 and high to bot 182 71 | bot 93 gives low to bot 66 and high to bot 196 72 | bot 14 gives low to bot 110 and high to bot 21 73 | bot 136 gives low to output 15 and high to bot 189 74 | bot 204 gives low to bot 140 and high to bot 129 75 | bot 82 gives low to bot 64 and high to bot 28 76 | bot 153 gives low to bot 166 and high to bot 161 77 | bot 191 gives low to bot 78 and high to bot 52 78 | bot 26 gives low to bot 42 and high to bot 110 79 | bot 46 gives low to bot 58 and high to bot 98 80 | bot 105 gives low to bot 52 and high to bot 3 81 | value 29 goes to bot 209 82 | bot 111 gives low to output 3 and high to bot 119 83 | bot 64 gives low to bot 39 and high to bot 173 84 | value 2 goes to bot 84 85 | bot 205 gives low to bot 204 and high to bot 25 86 | bot 137 gives low to bot 102 and high to bot 192 87 | bot 179 gives low to bot 75 and high to bot 113 88 | bot 52 gives low to bot 162 and high to bot 158 89 | bot 158 gives low to bot 76 and high to bot 160 90 | bot 57 gives low to bot 196 and high to bot 85 91 | value 41 goes to bot 104 92 | bot 85 gives low to bot 152 and high to bot 193 93 | bot 20 gives low to bot 30 and high to bot 72 94 | bot 34 gives low to output 12 and high to bot 111 95 | bot 21 gives low to bot 163 and high to bot 140 96 | bot 43 gives low to bot 86 and high to bot 121 97 | bot 91 gives low to bot 137 and high to bot 151 98 | bot 31 gives low to bot 91 and high to bot 15 99 | bot 12 gives low to bot 15 and high to bot 138 100 | bot 61 gives low to bot 49 and high to bot 133 101 | bot 33 gives low to bot 159 and high to bot 89 102 | bot 59 gives low to bot 4 and high to bot 135 103 | bot 35 gives low to bot 43 and high to bot 155 104 | bot 124 gives low to bot 123 and high to bot 101 105 | bot 86 gives low to bot 88 and high to bot 51 106 | bot 77 gives low to bot 171 and high to bot 185 107 | bot 97 gives low to bot 79 and high to bot 64 108 | bot 99 gives low to bot 168 and high to bot 142 109 | bot 106 gives low to bot 50 and high to bot 166 110 | bot 170 gives low to bot 145 and high to bot 120 111 | bot 60 gives low to bot 122 and high to bot 75 112 | bot 128 gives low to bot 130 and high to bot 29 113 | bot 190 gives low to bot 37 and high to bot 134 114 | bot 132 gives low to bot 6 and high to bot 93 115 | bot 130 gives low to bot 185 and high to bot 29 116 | bot 18 gives low to bot 21 and high to bot 204 117 | bot 157 gives low to bot 209 and high to bot 108 118 | bot 29 gives low to bot 94 and high to bot 19 119 | bot 133 gives low to bot 205 and high to bot 96 120 | bot 107 gives low to bot 149 and high to bot 179 121 | bot 9 gives low to bot 193 and high to bot 4 122 | value 7 goes to bot 80 123 | bot 47 gives low to bot 143 and high to bot 194 124 | bot 3 gives low to bot 158 and high to bot 164 125 | bot 177 gives low to bot 136 and high to bot 199 126 | bot 127 gives low to bot 38 and high to bot 53 127 | bot 42 gives low to bot 34 and high to bot 175 128 | bot 48 gives low to bot 28 and high to bot 186 129 | value 31 goes to bot 167 130 | bot 142 gives low to bot 126 and high to bot 86 131 | bot 198 gives low to bot 93 and high to bot 57 132 | value 17 goes to bot 187 133 | bot 169 gives low to bot 63 and high to bot 11 134 | bot 139 gives low to bot 190 and high to bot 134 135 | bot 172 gives low to output 8 and high to bot 116 136 | bot 4 gives low to bot 170 and high to bot 2 137 | value 53 goes to bot 146 138 | bot 206 gives low to bot 154 and high to bot 41 139 | value 73 goes to bot 203 140 | bot 207 gives low to bot 85 and high to bot 9 141 | value 19 goes to bot 62 142 | bot 164 gives low to bot 160 and high to bot 202 143 | bot 162 gives low to bot 13 and high to bot 76 144 | bot 126 gives low to output 10 and high to bot 88 145 | bot 119 gives low to output 11 and high to bot 136 146 | bot 62 gives low to bot 203 and high to bot 60 147 | bot 25 gives low to bot 129 and high to bot 184 148 | bot 187 gives low to bot 80 and high to bot 174 149 | bot 186 gives low to bot 73 and high to bot 128 150 | bot 95 gives low to bot 105 and high to bot 32 151 | value 59 goes to bot 56 152 | bot 193 gives low to bot 70 and high to bot 170 153 | bot 197 gives low to bot 98 and high to bot 180 154 | bot 2 gives low to bot 120 and high to bot 68 155 | value 13 goes to bot 54 156 | value 11 goes to bot 159 157 | bot 181 gives low to bot 191 and high to bot 105 158 | value 3 goes to bot 45 159 | bot 83 gives low to bot 124 and high to bot 100 160 | bot 17 gives low to bot 54 and high to bot 107 161 | bot 81 gives low to bot 178 and high to bot 55 162 | bot 19 gives low to bot 153 and high to bot 161 163 | bot 108 gives low to bot 26 and high to bot 14 164 | bot 39 gives low to bot 31 and high to bot 12 165 | bot 189 gives low to output 16 and high to bot 168 166 | value 23 goes to bot 114 167 | bot 151 gives low to bot 192 and high to bot 171 168 | value 71 goes to bot 24 169 | bot 134 gives low to bot 59 and high to bot 135 170 | bot 201 gives low to bot 96 and high to bot 169 171 | bot 67 gives low to bot 72 and high to bot 74 172 | bot 123 gives low to bot 89 and high to bot 150 173 | bot 38 gives low to bot 57 and high to bot 207 174 | bot 117 gives low to bot 198 and high to bot 38 175 | bot 8 gives low to bot 183 and high to bot 139 176 | value 47 goes to bot 17 177 | bot 199 gives low to bot 189 and high to bot 99 178 | bot 87 gives low to bot 97 and high to bot 82 179 | bot 125 gives low to bot 169 and high to bot 50 180 | bot 120 gives low to bot 181 and high to bot 95 181 | bot 63 gives low to bot 184 and high to bot 117 182 | bot 110 gives low to bot 175 and high to bot 163 183 | bot 65 gives low to bot 116 and high to bot 71 184 | bot 28 gives low to bot 173 and high to bot 186 185 | bot 66 gives low to bot 131 and high to bot 35 186 | bot 114 gives low to bot 33 and high to bot 123 187 | bot 138 gives low to bot 77 and high to bot 130 188 | bot 203 gives low to bot 90 and high to bot 122 189 | bot 100 gives low to bot 101 and high to bot 31 190 | bot 36 gives low to output 9 and high to bot 143 191 | bot 101 gives low to bot 150 and high to bot 91 192 | bot 54 gives low to bot 24 and high to bot 107 193 | bot 16 gives low to bot 199 and high to bot 1 194 | bot 135 gives low to bot 2 and high to bot 68 195 | bot 140 gives low to bot 5 and high to bot 22 196 | bot 37 gives low to bot 9 and high to bot 59 197 | bot 150 gives low to bot 147 and high to bot 137 198 | bot 0 gives low to output 6 and high to bot 58 199 | bot 102 gives low to bot 195 and high to bot 20 200 | bot 141 gives low to bot 74 and high to bot 23 201 | bot 10 gives low to bot 71 and high to bot 47 202 | bot 113 gives low to bot 176 and high to bot 48 203 | bot 76 gives low to bot 46 and high to bot 197 204 | bot 78 gives low to bot 109 and high to bot 162 205 | bot 145 gives low to bot 112 and high to bot 181 206 | bot 156 gives low to output 18 and high to bot 188 207 | bot 147 gives low to bot 41 and high to bot 102 208 | bot 116 gives low to output 0 and high to bot 36 209 | bot 103 gives low to bot 156 and high to bot 109 210 | value 61 goes to bot 33 211 | bot 182 gives low to bot 144 and high to bot 61 212 | bot 178 gives low to bot 148 and high to bot 103 213 | bot 6 gives low to bot 1 and high to bot 66 214 | bot 144 gives low to bot 118 and high to bot 49 215 | bot 71 gives low to bot 36 and high to bot 47 216 | bot 183 gives low to bot 53 and high to bot 190 217 | bot 23 gives low to bot 106 and high to bot 153 218 | bot 69 gives low to bot 81 and high to bot 112 219 | bot 22 gives low to bot 16 and high to bot 6 220 | bot 209 gives low to bot 208 and high to bot 26 221 | value 37 goes to bot 208 222 | value 5 goes to bot 157 223 | bot 165 gives low to bot 92 and high to bot 144 224 | bot 70 gives low to bot 69 and high to bot 145 225 | bot 30 gives low to bot 133 and high to bot 201 226 | bot 55 gives low to bot 103 and high to bot 78 227 | bot 118 gives low to bot 14 and high to bot 18 228 | bot 121 gives low to bot 51 and high to bot 81 229 | bot 122 gives low to bot 200 and high to bot 7 230 | bot 96 gives low to bot 25 and high to bot 63 231 | bot 94 gives low to bot 23 and high to bot 19 232 | -------------------------------------------------------------------------------- /inputs/input11.txt: -------------------------------------------------------------------------------- 1 | The first floor contains a promethium generator and a promethium-compatible microchip. 2 | The second floor contains a cobalt generator, a curium generator, a ruthenium generator, and a plutonium generator. 3 | The third floor contains a cobalt-compatible microchip, a curium-compatible microchip, a ruthenium-compatible microchip, and a plutonium-compatible microchip. 4 | The fourth floor contains nothing relevant. 5 | -------------------------------------------------------------------------------- /inputs/input12.txt: -------------------------------------------------------------------------------- 1 | cpy 1 a 2 | cpy 1 b 3 | cpy 26 d 4 | jnz c 2 5 | jnz 1 5 6 | cpy 7 c 7 | inc d 8 | dec c 9 | jnz c -2 10 | cpy a c 11 | inc a 12 | dec b 13 | jnz b -2 14 | cpy c b 15 | dec d 16 | jnz d -6 17 | cpy 19 c 18 | cpy 14 d 19 | inc a 20 | dec d 21 | jnz d -2 22 | dec c 23 | jnz c -5 24 | -------------------------------------------------------------------------------- /inputs/input18.txt: -------------------------------------------------------------------------------- 1 | .^^..^...^..^^.^^^.^^^.^^^^^^.^.^^^^.^^.^^^^^^.^...^......^...^^^..^^^.....^^^^^^^^^....^^...^^^^..^ 2 | -------------------------------------------------------------------------------- /inputs/input2.txt: -------------------------------------------------------------------------------- 1 | LURLDDLDULRURDUDLRULRDLLRURDUDRLLRLRURDRULDLRLRRDDULUDULURULLURLURRRLLDURURLLUURDLLDUUDRRDLDLLRUUDURURRULURUURLDLLLUDDUUDRULLRUDURRLRLLDRRUDULLDUUUDLDLRLLRLULDLRLUDLRRULDDDURLUULRDLRULRDURDURUUUDDRRDRRUDULDUUULLLLURRDDUULDRDRLULRRRUUDUURDULDDRLDRDLLDDLRDLDULUDDLULUDRLULRRRRUUUDULULDLUDUUUUDURLUDRDLLDDRULUURDRRRDRLDLLURLULDULRUDRDDUDDLRLRRDUDDRULRULULRDDDDRDLLLRURDDDDRDRUDUDUUDRUDLDULRUULLRRLURRRRUUDRDLDUDDLUDRRURLRDDLUUDUDUUDRLUURURRURDRRRURULUUDUUDURUUURDDDURUDLRLLULRULRDURLLDDULLDULULDDDRUDDDUUDDUDDRRRURRUURRRRURUDRRDLRDUUULLRRRUDD 2 | DLDUDULDLRDLUDDLLRLUUULLDURRUDLLDUDDRDRLRDDUUUURDULDULLRDRURDLULRUURRDLULUDRURDULLDRURUULLDLLUDRLUDRUDRURURUULRDLLDDDLRUDUDLUDURLDDLRRUUURDDDRLUDDDUDDLDUDDUUUUUULLRDRRUDRUDDDLLLDRDUULRLDURLLDURUDDLLURDDLULLDDDRLUDRDDLDLDLRLURRDURRRUDRRDUUDDRLLUDLDRLRDUDLDLRDRUDUUULULUDRRULUDRDRRLLDDRDDDLULURUURULLRRRRRDDRDDRRRDLRDURURRRDDULLUULRULURURDRRUDURDDUURDUURUURUULURUUDULURRDLRRUUDRLLDLDRRRULDRLLRLDUDULRRLDUDDUUURDUDLDDDUDL 3 | RURDRUDUUUUULLLUULDULLLDRUULURLDULULRDDLRLLRURULLLLLLRULLURRDLULLUULRRDURRURLUDLULDLRRULRDLDULLDDRRDLLRURRDULULDRRDDULDURRRUUURUDDURULUUDURUULUDLUURRLDLRDDUUUUURULDRDUDDULULRDRUUURRRDRLURRLUUULRUDRRLUDRDLDUDDRDRRUULLLLDUUUULDULRRRLLRLRLRULDLRURRLRLDLRRDRDRLDRUDDDUUDRLLUUURLRLULURLDRRULRULUDRUUURRUDLDDRRDDURUUULLDDLLDDRUDDDUULUDRDDLULDDDDRULDDDDUUUURRLDUURULRDDRDLLLRRDDURUDRRLDUDULRULDDLDDLDUUUULDLLULUUDDULUUDLRDRUDLURDULUDDRDRDRDDURDLURLULRUURDUDULDDLDDRUULLRDRLRRUURRDDRDUDDLRRLLDRDLUUDRRDDDUUUDLRRLDDDUDRURRDDUULUDLLLRUDDRULRLLLRDLUDUUUUURLRRUDUDDDDLRLLULLUDRDURDDULULRDRDLUDDRLURRLRRULRL 4 | LDUURLLULRUURRDLDRUULRDRDDDRULDLURDDRURULLRUURRLRRLDRURRDRLUDRUUUULLDRLURDRLRUDDRDDDUURRDRRURULLLDRDRDLDUURLDRUULLDRDDRRDRDUUDLURUDDLLUUDDULDDULRDDUUDDDLRLLLULLDLUDRRLDUUDRUUDUDUURULDRRLRRDLRLURDRURURRDURDURRUDLRURURUUDURURUDRURULLLLLUDRUDUDULRLLLRDRLLRLRLRRDULRUUULURLRRLDRRRDRULRUDUURRRRULDDLRULDRRRDLDRLUDLLUDDRURLURURRLRUDLRLLRDLLDRDDLDUDRDLDDRULDDULUDDLLDURDULLDURRURRULLDRLUURURLLUDDRLRRUUDULRRLLRUDRDUURLDDLLURRDLRUURLLDRDLRUULUDURRDULUULDDLUUUDDLRRDRDUDLRUULDDDLDDRUDDD 5 | DRRDRRURURUDDDRULRUDLDLDULRLDURURUUURURLURURDDDDRULUDLDDRDDUDULRUUULRDUDULURLRULRDDLDUDLDLULRULDRRLUDLLLLURUDUDLLDLDRLRUUULRDDLUURDRRDLUDUDRULRRDDRRLDUDLLDLURLRDLRUUDLDULURDDUUDDLRDLUURLDLRLRDLLRUDRDUURDDLDDLURRDDRDRURULURRLRLDURLRRUUUDDUUDRDRULRDLURLDDDRURUDRULDURUUUUDULURUDDDDUURULULDRURRDRDURUUURURLLDRDLDLRDDULDRLLDUDUDDLRLLRLRUUDLUDDULRLDLLRLUUDLLLUUDULRDULDLRRLDDDDUDDRRRDDRDDUDRLLLDLLDLLRDLDRDLUDRRRLDDRLUDLRLDRUURUDURDLRDDULRLDUUUDRLLDRLDLLDLDRRRLLULLUDDDLRUDULDDDLDRRLLRDDLDUULRDLRRLRLLRUUULLRDUDLRURRRUULLULLLRRURLRDULLLRLDUUUDDRLRLUURRLUUUDURLRDURRDUDDUDDRDDRUD 6 | -------------------------------------------------------------------------------- /inputs/input20.txt: -------------------------------------------------------------------------------- 1 | 272152717-281364173 2 | 480675455-489214207 3 | 3562619188-3566180938 4 | 474796666-476679929 5 | 1859288016-1859426304 6 | 3500809029-3520779986 7 | 1711620671-1724624325 8 | 376497036-379822744 9 | 2334350029-2336872286 10 | 2880314906-2881510051 11 | 257912946-260566708 12 | 2964360275-2973540924 13 | 889696219-900080622 14 | 2727172832-2737372242 15 | 33674001-51133436 16 | 2718782366-2736816045 17 | 41293631-52546854 18 | 1064827080-1071610531 19 | 1373807967-1374769067 20 | 3261078460-3268114587 21 | 1583129312-1602482863 22 | 1605269651-1617971405 23 | 365345542-377782493 24 | 2858099254-2862714857 25 | 1147380159-1156709753 26 | 1087934555-1093750979 27 | 998603437-1001868893 28 | 234297440-245049936 29 | 427084952-449321291 30 | 3115490453-3126172818 31 | 0-166475 32 | 2859739533-2864404117 33 | 2879116214-2888999956 34 | 4166942312-4169074982 35 | 2693533587-2694200673 36 | 84162473-84534337 37 | 2164071501-2168305216 38 | 3745751095-3750043362 39 | 2647427848-2647977897 40 | 2028900925-2034847596 41 | 876886411-878398110 42 | 2589041333-2589873869 43 | 876959837-878627172 44 | 431139724-458304869 45 | 1877994382-1887344924 46 | 473575203-475773145 47 | 252091135-257535969 48 | 177110001-177143710 49 | 2722497928-2723521816 50 | 2208127-2536514 51 | 1748077674-1751224226 52 | 2362936907-2381045647 53 | 2020385448-2029519771 54 | 3108825744-3123438032 55 | 872292652-885764819 56 | 305053947-314709696 57 | 2717924562-2718755692 58 | 48149217-51160833 59 | 2149726170-2150134226 60 | 1729844094-1745733187 61 | 1375741284-1378782323 62 | 3744515388-3761146958 63 | 78523085-78634151 64 | 1634372345-1650424418 65 | 3199349237-3209140394 66 | 2011853949-2039316392 67 | 769580925-794759455 68 | 3841896290-3862358298 69 | 3360393034-3379747723 70 | 1120644472-1134516526 71 | 815948131-837832345 72 | 1590411139-1596337230 73 | 2894381219-2935549329 74 | 3688775236-3725245783 75 | 963257634-966114246 76 | 3566641344-3578334024 77 | 1402589368-1434296916 78 | 2742164387-2746045182 79 | 3336884060-3357139723 80 | 1529922302-1532912060 81 | 812048355-820600359 82 | 3535903629-3546917858 83 | 3793132304-3794479774 84 | 2441870431-2446591046 85 | 790688046-795287265 86 | 1094905232-1100177740 87 | 2745878705-2749992348 88 | 119256353-127273572 89 | 3046258846-3057351205 90 | 1754142948-1755600336 91 | 1439035504-1441512409 92 | 2099760008-2108426979 93 | 2336936249-2337901885 94 | 886155227-897744302 95 | 278389264-304413122 96 | 2261948686-2274345666 97 | 3650645303-3661861270 98 | 574462284-588550773 99 | 1759196520-1782105094 100 | 965026392-968307163 101 | 2946755906-2963417308 102 | 1766330775-1797112785 103 | 1200115116-1225710522 104 | 2080628180-2093783866 105 | 2259186780-2265576012 106 | 3422484974-3431403368 107 | 2617357126-2619542029 108 | 3535424340-3544236729 109 | 1159703397-1178419333 110 | 3695852451-3731387995 111 | 2624409231-2626475102 112 | 2462304649-2486546066 113 | 1991659530-1991878310 114 | 3675781139-3676295005 115 | 3077370804-3098240471 116 | 2410139047-2412323245 117 | 1441379095-1464833739 118 | 4254940654-4257828865 119 | 3134602505-3135787446 120 | 1531285367-1533939508 121 | 1982248547-1989219645 122 | 3717359312-3718050739 123 | 1149793223-1159703395 124 | 1718841131-1723739366 125 | 1338353885-1363179561 126 | 432322947-450369838 127 | 3592044590-3598404106 128 | 2783263665-2802135338 129 | 2743201911-2758731127 130 | 2940668500-2946140977 131 | 3588363275-3594330069 132 | 3675945049-3679197388 133 | 154488705-187446525 134 | 1653195306-1670854086 135 | 2771303647-2772439896 136 | 84146114-84264353 137 | 1593778990-1622000763 138 | 1580746474-1580917737 139 | 801556682-801983712 140 | 2268279290-2282899033 141 | 3429390560-3432646573 142 | 1355690206-1364432183 143 | 3364827834-3370027309 144 | 1343867080-1356033542 145 | 2769747098-2802096717 146 | 2451978746-2499145061 147 | 3181481071-3202130015 148 | 149287453-193454621 149 | 2907925124-2933668261 150 | 3525815495-3531996642 151 | 892781900-902374081 152 | 801983714-808209514 153 | 1205516416-1207518863 154 | 3475944050-3479276890 155 | 1680662691-1693249318 156 | 441188152-451875207 157 | 3866263742-3869203885 158 | 872306827-886155226 159 | 3641638239-3656867109 160 | 1292372277-1314188693 161 | 1062559245-1064950825 162 | 2334198700-2335529918 163 | 1122962410-1136372412 164 | 623323144-625918342 165 | 2425193847-2429793856 166 | 373315052-379611660 167 | 2418007458-2424289401 168 | 2149571480-2150070836 169 | 1991878311-1994706041 170 | 3043381174-3046887777 171 | 497434379-500148281 172 | 1825422529-1838184381 173 | 137450473-139095016 174 | 248808686-249748629 175 | 1989969134-1990676913 176 | 960553017-960915199 177 | 2336374612-2337150925 178 | 3369599561-3390928276 179 | 113852260-145672651 180 | 2986681144-2989530365 181 | 3856382204-3873203604 182 | 1657674792-1663548211 183 | 2650185850-2651060935 184 | 1647983099-1662799191 185 | 1082357088-1112329267 186 | 3793767754-3794336046 187 | 3705877748-3728561957 188 | 2769813898-2772369413 189 | 3794164058-3801441915 190 | 623200755-625407322 191 | 1241966895-1253020214 192 | 450369839-463131291 193 | 2717038617-2723107862 194 | 961267447-962353699 195 | 193454623-196340979 196 | 4253667440-4261704870 197 | 3269563154-3275293388 198 | 1505893371-1506880655 199 | 3873203606-3889412741 200 | 443548825-444733658 201 | 3045753812-3049382630 202 | 732764611-733035245 203 | 961034623-961300670 204 | 1373470559-1373526698 205 | 2860192109-2867276065 206 | 3312623058-3313008029 207 | 3942424007-3951811891 208 | 1197857710-1214225356 209 | 458105388-462489469 210 | 4259123154-4263336824 211 | 960863927-961733781 212 | 44819071-52470556 213 | 957158383-958041099 214 | 2543986743-2554322396 215 | 339721933-346413740 216 | 1010736956-1030771663 217 | 4288781458-4289261456 218 | 3687051286-3722932714 219 | 2420813443-2424860115 220 | 1989395087-1989698527 221 | 3473694511-3476125935 222 | 2408526816-2412196386 223 | 1989398215-1991201331 224 | 1526350090-1542206580 225 | 2394556084-2399639414 226 | 3510330656-3522250181 227 | 137874061-144376880 228 | 4167095310-4177987517 229 | 2785359721-2785427263 230 | 15024863-23531388 231 | 1625174667-1658679299 232 | 974122151-995631685 233 | 1540947566-1554930456 234 | 2424921025-2429636819 235 | 1993822183-1994839237 236 | 1094823818-1097108689 237 | 69796587-71291314 238 | 37126017-49427721 239 | 3793022166-3794100162 240 | 908189684-911496714 241 | 2911211968-2917349047 242 | 1227212686-1234159311 243 | 3776286544-3783635666 244 | 3531996644-3536250992 245 | 3396302214-3406687062 246 | 1476456536-1478818018 247 | 2443497737-2447228620 248 | 962292354-965288690 249 | 1833703443-1843811212 250 | 998277195-1000562480 251 | 883225973-896212798 252 | 2202815121-2215802598 253 | 3557733372-3563107357 254 | 2648035823-2649474134 255 | 2723831559-2734044916 256 | 1714279973-1738575730 257 | 110217-574651 258 | 1398965758-1409470798 259 | 2330603686-2335139291 260 | 1506286657-1511280423 261 | 3365567975-3371386015 262 | 466326205-480223737 263 | 1989219647-1989438488 264 | 3008188882-3010347685 265 | 1070925288-1071665482 266 | 2111554226-2123836945 267 | 2137226110-2138852181 268 | 1081261041-1091870264 269 | 1081552237-1090538414 270 | 2000657198-2037677988 271 | 2718009384-2720142472 272 | 925940762-939052067 273 | 4179143261-4191765704 274 | 3426378774-3430410036 275 | 3676393933-3680167774 276 | 3271833171-3277125583 277 | 274414401-283893852 278 | 3124560226-3128380638 279 | 1208163309-1215074110 280 | 2465798305-2494706753 281 | 3050317115-3058897888 282 | 1302678331-1315210828 283 | 1751224227-1758206846 284 | 931444766-948598982 285 | 151669773-180559543 286 | 255864690-255985990 287 | 1556987318-1563743144 288 | 16294070-23923782 289 | 1415762720-1421421169 290 | 3853344243-3864268114 291 | 1280237454-1286328218 292 | 2944350248-2976813361 293 | 2187770126-2203436268 294 | 3505239916-3517301515 295 | 3232015564-3235367871 296 | 2146211145-2166090499 297 | 910952647-911877073 298 | 1579658725-1581392690 299 | 1237242317-1258610777 300 | 2589766513-2598433041 301 | 3449310840-3449858133 302 | 745819525-755688297 303 | 3776094116-3783478049 304 | 2108426981-2124149170 305 | 3449389881-3462604413 306 | 2301503968-2324628965 307 | 1005263513-1027181473 308 | 1952664131-1969650551 309 | 1285113553-1288652959 310 | 3896408883-3908694324 311 | 1920600328-1921999554 312 | 1025403493-1031247416 313 | 3905769594-3930128244 314 | 1031247417-1047578444 315 | 3885007170-3895219247 316 | 3598377658-3599404192 317 | 1697890477-1697912613 318 | 954538505-957768997 319 | 2816494072-2842728200 320 | 492165035-498202012 321 | 3137181704-3152588209 322 | 1755735260-1759196518 323 | 1371495492-1371550991 324 | 2501923864-2514064340 325 | 305959083-311818120 326 | 4250019192-4275532230 327 | 114168261-116414851 328 | 2447228622-2451978745 329 | 766211517-801556681 330 | 3376445798-3394303381 331 | 3501155911-3526104374 332 | 2548986102-2564634962 333 | 3263667615-3270390046 334 | 1807095399-1824137700 335 | 856041972-859823687 336 | 3887315148-3892355947 337 | 1030764665-1045428052 338 | 638833662-640333593 339 | 2121184882-2129744090 340 | 2881011537-2885878144 341 | 3588560066-3597713320 342 | 3124980377-3134500989 343 | 489214209-512240639 344 | 3760702359-3764383643 345 | 1090166392-1096894006 346 | 917419134-922706929 347 | 1296067761-1309424658 348 | 689572986-696039127 349 | 2660085630-2660431880 350 | 680230992-716886780 351 | 1592087783-1598197492 352 | 1530767294-1575862739 353 | 2082087967-2085220519 354 | 2424541691-2426736024 355 | 113504564-116385542 356 | 1916132714-1932780572 357 | 503684477-512284558 358 | 2615977363-2622859043 359 | 4035141786-4047227590 360 | 1663548212-1680662689 361 | 3047614614-3051657189 362 | 2634680042-2641014306 363 | 2583260376-2591896929 364 | 2645275066-2647436256 365 | 64047546-86026817 366 | 1071039399-1072162085 367 | 2594771897-2599508024 368 | 83962861-84534191 369 | 902374083-941216585 370 | 2586806577-2599448524 371 | 1274245593-1274516893 372 | 4031038177-4040911753 373 | 983068813-998624841 374 | 534906133-573925401 375 | 3329216543-3336884059 376 | 4125892395-4138236492 377 | 3807924665-3812644495 378 | 1774911-2450996 379 | 446418646-455236779 380 | 2877486448-2884177700 381 | 1373832888-1373901196 382 | 370639181-384962937 383 | 12016954-19316517 384 | 3134500991-3134627688 385 | 1373501126-1373590483 386 | 1777703220-1777741597 387 | 3743473590-3769013947 388 | 2353521003-2362936906 389 | 2468617254-2477279185 390 | 78550601-78698869 391 | 1273031112-1274488766 392 | 968052409-969178069 393 | 3907082563-3913084150 394 | 3322437732-3338709909 395 | 970661335-978617986 396 | 2985507999-2990149897 397 | 1499815926-1518480568 398 | 2047086312-2056763544 399 | 3154050192-3178489168 400 | 1544927329-1559460655 401 | 614918489-621719308 402 | 3733606954-3743473589 403 | 1499734003-1505336823 404 | 1765493480-1780907733 405 | 1112329269-1144192156 406 | 1908189573-1916132712 407 | 2978158245-2980295974 408 | 854842773-855564041 409 | 3851762797-3856667050 410 | 2987912828-2988480807 411 | 3845355673-3864117699 412 | 2372563028-2379155071 413 | 4164107384-4175248779 414 | 206495443-209268583 415 | 2893360924-2906330615 416 | 1374122783-1374244946 417 | 1315210829-1323332739 418 | 2819221138-2820241142 419 | 2987725800-2988399994 420 | 3420480297-3426061444 421 | 1745733189-1750260936 422 | 2771579434-2772910814 423 | 1721651362-1731098010 424 | 1200223043-1222602885 425 | 3431337889-3434193062 426 | 2412323247-2441870430 427 | 3756861847-3771488683 428 | 853629069-857835277 429 | 3744664061-3763198907 430 | 1371491558-1371529465 431 | 1932780573-1939156498 432 | 3661861272-3662675926 433 | 2648267077-2650619730 434 | 3366486664-3371903512 435 | 1268371412-1276470615 436 | 2691106038-2691272785 437 | 3227264064-3240740070 438 | 1906133184-1910990608 439 | 3853470102-3865286420 440 | 2646285040-2646358000 441 | 2196926231-2206264598 442 | 4257710901-4257836607 443 | 242078367-255972629 444 | 4198987003-4201086361 445 | 1240990629-1248211769 446 | 2749992349-2760767131 447 | 2787866331-2806708160 448 | 809302575-853629067 449 | 3032053776-3036049062 450 | 2943717702-2946230991 451 | 4288724821-4289568650 452 | 3215397670-3224618461 453 | 1858955725-1859353621 454 | 2083864513-2101037055 455 | 694973182-718973623 456 | 4168983031-4174451494 457 | 2807055496-2816494071 458 | 1055347167-1064190974 459 | 3424907263-3427071583 460 | 859417782-872292650 461 | 1467661058-1474811610 462 | 2393002352-2403005964 463 | 4197417217-4208856131 464 | 3370246481-3375696999 465 | 1373468974-1373569404 466 | 2905152772-2910933373 467 | 1980855826-1983920990 468 | 732863279-733152241 469 | 4285742284-4286129026 470 | 1614476697-1614835826 471 | 2635427600-2644232203 472 | 1470741851-1479153638 473 | 2944130276-2951908714 474 | 4291064131-4293894991 475 | 1990921080-1991701381 476 | 4227850767-4244632336 477 | 1807565528-1814396331 478 | 2361860677-2376637038 479 | 2943119919-2945768965 480 | 2172859679-2221926662 481 | 249198701-250135569 482 | 2652844144-2657371637 483 | 1885639221-1900413603 484 | 1509729634-1512261818 485 | 3004310417-3011080364 486 | 1694482383-1697891607 487 | 4177987519-4212820708 488 | 4161048921-4161074968 489 | 476220543-480675454 490 | 2588894890-2592105515 491 | 2757311298-2758434349 492 | 4050934926-4082396822 493 | 2034604741-2043305856 494 | 2331464398-2333528059 495 | 1066956928-1067355622 496 | 2646313639-2648035821 497 | 2066636902-2067863299 498 | 2332503976-2334659414 499 | 3180110462-3204410296 500 | 577236362-586064251 501 | 256418607-258764997 502 | 2233705634-2248146735 503 | 3716569187-3719939659 504 | 1386717710-1439035502 505 | 1859175593-1859580659 506 | 3708021302-3722129580 507 | 3976120818-4005662251 508 | 304413124-306709976 509 | 1395309937-1427985546 510 | 4226665082-4232713677 511 | 4212820709-4214429692 512 | 1693249319-1711620669 513 | 2499145063-2503398930 514 | 3721989699-3733606952 515 | 1717757397-1721218576 516 | 1127769041-1132781724 517 | 3644972707-3646872069 518 | 2077152015-2084609524 519 | 1990599678-1991511335 520 | 2335139292-2353521001 521 | 4088569210-4091483373 522 | 1642017342-1657864055 523 | 2588719725-2589121881 524 | 2903005844-2913683635 525 | 194715771-196440167 526 | 3963719430-3974518407 527 | 4288320832-4289172749 528 | 3151726457-3165427383 529 | 23507982-23800784 530 | 2895160172-2940456225 531 | 1001177233-1005263511 532 | 43609109-48863103 533 | 1144192157-1157514424 534 | 734439882-765944362 535 | 695965351-719454865 536 | 856803507-869754401 537 | 1890217805-1904089509 538 | 3300131715-3305283163 539 | 1529237006-1529595328 540 | 2753090359-2757523819 541 | 828668586-831203389 542 | 3427619213-3428732628 543 | 2967859507-2976560941 544 | 2329569453-2332265395 545 | 2239885549-2252296728 546 | 1293808207-1320485733 547 | 2604175022-2624108715 548 | 2697882453-2723829703 549 | 2463205201-2470677980 550 | 3888353469-3890883045 551 | 400102191-427084950 552 | 4150245199-4164107383 553 | 1395492363-1406000929 554 | 3675122217-3676808853 555 | 116414852-148746047 556 | 787563761-789069064 557 | 3197100188-3202418404 558 | 1373782716-1373895006 559 | 2617111647-2617819575 560 | 2550216289-2557881293 561 | 1851804917-1852370216 562 | 2617793199-2618721355 563 | 1939113565-1942772474 564 | 1066259539-1066964651 565 | 2536515-2749485 566 | 3851513911-3872830251 567 | 3315330215-3350319238 568 | 1372313956-1373952939 569 | 270099979-278389263 570 | 2861061889-2874958905 571 | 2982764434-2982918860 572 | 1225710523-1232594859 573 | 3080849793-3087237669 574 | 2168507276-2172859677 575 | 2554045929-2558669015 576 | 2715737041-2742164385 577 | 2564405335-2570912208 578 | 3111405671-3131810967 579 | 1881537985-1906133183 580 | 2327518639-2329278606 581 | 1695964017-1700687554 582 | 2325334299-2328665915 583 | 2329084251-2329569451 584 | 2526389631-2574332443 585 | 2716903062-2718451591 586 | 177141073-177775415 587 | 177103338-177124151 588 | 1072162087-1081552236 589 | 3178535948-3199349236 590 | 2293206667-2314675667 591 | 1889288474-1903754822 592 | 4251848410-4278329656 593 | 697896245-706915923 594 | 1811201479-1827334058 595 | 102113146-112076690 596 | 2390223078-2399260655 597 | 829332527-848880205 598 | 3861878449-3866482364 599 | 1213011864-1220748067 600 | 3580711167-3587101215 601 | 1286680169-1311818230 602 | 3608853495-3610981230 603 | 1511277091-1513257838 604 | 3450147668-3459285977 605 | 2780989504-2803855679 606 | 3882846313-3888163900 607 | 941216586-953952178 608 | 2983401144-2988059936 609 | 2624108716-2624926759 610 | 3402309579-3420480295 611 | 3312749262-3314042171 612 | 3399699391-3418732708 613 | 4105670961-4129433645 614 | 4257493527-4284962279 615 | 23923784-47709067 616 | 953952180-957049748 617 | 2876724088-2878697891 618 | 2416003985-2423463911 619 | 740946393-742024905 620 | 1380318986-1386717709 621 | 2026496387-2041982393 622 | 3072950856-3095969673 623 | 196440168-234297438 624 | 3324520138-3350841770 625 | 1184551931-1197857708 626 | 3723507322-3732029196 627 | 1781641387-1785877866 628 | 2407131596-2409544298 629 | 5689429-5741644 630 | 1739110416-1741141505 631 | 2548794765-2558310137 632 | 808209515-836691306 633 | 2657455751-2663837619 634 | 790539346-793059170 635 | 568516293-569131984 636 | 3321930331-3346790026 637 | 472011317-479941460 638 | 857857646-863011064 639 | 4168502125-4170164107 640 | 588550774-597747807 641 | 1637815642-1662350209 642 | 2460793334-2466026338 643 | 958041100-970661333 644 | 2139217624-2146211143 645 | 2539598-2830629 646 | 1266192646-1268371411 647 | 1323332741-1335959162 648 | 1439736912-1446610546 649 | 4061001198-4065392221 650 | 2524105557-2526389630 651 | 2222452808-2225462596 652 | 1388815777-1397555491 653 | 3612936376-3650645302 654 | 3045926276-3065706826 655 | 3574212945-3575594696 656 | 2827277916-2836024368 657 | 1991475869-1991926125 658 | 3505806023-3528702608 659 | 2414724634-2430851599 660 | 3021588078-3028285988 661 | 2574332445-2592271496 662 | 2057264136-2059202053 663 | 3244432520-3248685694 664 | 1712738962-1729844093 665 | 56528833-64047545 666 | 2971719660-2977620581 667 | 3605787690-3611524810 668 | 3851574035-3854062441 669 | 1235784822-1266192644 670 | 3006793176-3021032700 671 | 3900016789-3922138525 672 | 1234159313-1235784821 673 | 455883118-466326203 674 | 1053312381-1063953379 675 | 2820222101-2821175967 676 | 2502044549-2506260381 677 | 568736374-569251939 678 | 1578664897-1579658724 679 | 344106424-350103368 680 | 1590175536-1595299212 681 | 2273779785-2277363906 682 | 3984562197-4010152611 683 | 45721618-54860968 684 | 3394303383-3402309578 685 | 1511624839-1512608254 686 | 3884829071-3890292172 687 | 2038966626-2047086310 688 | 4103290900-4119641469 689 | 3357139725-3360393033 690 | 2780813493-2807055494 691 | 2225462598-2252329658 692 | 2592271497-2604175020 693 | 1049541136-1055392314 694 | 1533973152-1578664895 695 | 3209140396-3244432519 696 | 3135787447-3178535946 697 | 1873694527-1911946735 698 | 3716488307-3717917511 699 | 1863079077-1868159650 700 | 1852620713-1869463034 701 | 2340761-6722844 702 | 4010806326-4011637774 703 | 2335714002-2344955062 704 | 2503398931-2516105578 705 | 4096488349-4097750835 706 | 495702052-499886980 707 | 2633949022-2643879390 708 | 2230563996-2248676097 709 | 1992368509-1995459736 710 | 725466259-734439880 711 | 3284564906-3289305182 712 | 3006621951-3015555807 713 | 2221926663-2224742001 714 | 1807424325-1816026389 715 | 1876686839-1880758503 716 | 2691158517-2691387740 717 | 3757816372-3758051212 718 | 2956964132-2972741344 719 | 2636000153-2638744402 720 | 678819639-679798433 721 | 250063049-250516719 722 | 3855876124-3866454360 723 | 3312438883-3313193146 724 | 82686086-84339480 725 | 1092916631-1107918456 726 | 1843811214-1852620712 727 | 3809172487-3830073502 728 | 2616993454-2620553751 729 | 2682855477-2715737040 730 | 3863648987-3866503080 731 | 1271724277-1275741880 732 | 2384026814-2393286163 733 | 2957501262-2965749150 734 | 4213745292-4214551645 735 | 2556715457-2565699508 736 | 2263615-2555032 737 | 2510926180-2524105555 738 | 2198333368-2201790504 739 | 983311745-991202543 740 | 326387197-344106423 741 | 3087807140-3088895982 742 | 86026819-109305037 743 | 2504533668-2507452669 744 | 1371550992-1377668791 745 | 1656901715-1676675657 746 | 130445224-140364961 747 | 875328099-885585914 748 | 2299489843-2306253705 749 | 3450835271-3481339653 750 | 4014358521-4031038176 751 | 2340311395-2351064022 752 | 2883149064-2887845481 753 | 2259592077-2278614136 754 | 3810542228-3827200634 755 | 3056035363-3068664010 756 | 722584522-723699159 757 | 1735688023-1740818227 758 | 3537763412-3542953759 759 | 2366293314-2375211143 760 | 1411814377-1424672790 761 | 3100999210-3102484531 762 | 4284962281-4294967295 763 | 1446610547-1465468961 764 | 2874958907-2877486447 765 | 1765556195-1793446949 766 | 4218980804-4226442852 767 | 494048500-497170493 768 | 360027343-374159699 769 | 2651399811-2665409613 770 | 1047578446-1052368079 771 | 2362920294-2374232484 772 | 2570748019-2571266639 773 | 3256410480-3277105765 774 | 3771488685-3794388011 775 | 722551086-722999678 776 | 741060508-762846249 777 | 1479919768-1481248209 778 | 614971153-617471673 779 | 2982621961-2982812184 780 | 2087732105-2106406062 781 | 2302394373-2326071906 782 | 886110869-893987869 783 | 864175670-867272025 784 | 2119076394-2126808897 785 | 1051546928-1062419089 786 | 678814708-679604844 787 | 2168305217-2172141567 788 | 2943803911-2945854166 789 | 321232218-329790306 790 | 391378250-412099930 791 | 539629846-568721146 792 | 3794388012-3806424827 793 | 2894304683-2915255653 794 | 856495621-857857645 795 | 2743551156-2751996369 796 | 1024955451-1026100964 797 | 177078688-177123406 798 | 4018256524-4039886263 799 | 3945209398-3956309725 800 | 2364930647-2378530823 801 | 1006976522-1021887240 802 | 3757741995-3757947507 803 | 1421470109-1432888460 804 | 3160832331-3169658872 805 | 177045468-177087638 806 | 1090463009-1104430857 807 | 1274373481-1274578120 808 | 2626475104-2640453818 809 | 3284290551-3288427229 810 | 1981618690-1984277097 811 | 1186456381-1195032668 812 | 5052363-7502553 813 | 1509795877-1512150519 814 | 3579924616-3582548171 815 | 4121363479-4137513284 816 | 1488580398-1503472581 817 | 2423275742-2439608584 818 | 2138662322-2138915998 819 | 1382223606-1410305514 820 | 3832391075-3853706505 821 | 1614422103-1614651523 822 | 3369142704-3373032779 823 | 719454867-725466258 824 | 2084732810-2095200322 825 | 1442897307-1457439380 826 | 2112887248-2129529980 827 | 4023595164-4025287662 828 | 611715160-617013605 829 | 778751841-791194910 830 | 3293566719-3305859750 831 | 1772772441-1797304174 832 | 1589764874-1592539287 833 | 1373791581-1374176540 834 | 1590792815-1594025491 835 | 1981551967-1982435626 836 | 1520347646-1542585100 837 | 3099494317-3115490452 838 | 3098240473-3103804691 839 | 3264851832-3269554326 840 | 766110784-766211515 841 | 2019539430-2044044979 842 | 3266317108-3273234008 843 | 1274283817-1274437178 844 | 2650371073-2672921107 845 | 2672921108-2679629874 846 | 2673449969-2682855475 847 | 765944363-766205817 848 | 3853706506-3859959741 849 | 1508362252-1513253382 850 | 876916046-879636492 851 | 3809955806-3810745183 852 | 1274121584-1274542630 853 | 3157351170-3166046719 854 | 1053524276-1064827079 855 | 3791652757-3800601148 856 | 2842728202-2853639142 857 | 3571512615-3579166854 858 | 679353613-679923926 859 | 3809191752-3810740480 860 | 2817388396-2819591739 861 | 2852317315-2861061888 862 | 4256942395-4260208971 863 | 3501898903-3512880687 864 | 3882475326-3886137014 865 | 1966578885-1968167855 866 | 410700018-415718837 867 | 3806424829-3821851233 868 | 1518480570-1533973151 869 | 3147464447-3158958125 870 | 197786374-207567591 871 | 3535028299-3539195436 872 | 4184714120-4186894005 873 | 448892515-456388417 874 | 671686622-678352726 875 | 1360272787-1363580702 876 | 2164873145-2165892440 877 | 3361616306-3375689123 878 | 3091164847-3093370647 879 | 3297273994-3311056250 880 | 398273343-404652855 881 | 1782105095-1803766701 882 | 1484145894-1503189992 883 | 2160023298-2160172849 884 | 2919583395-2932229908 885 | 2812705686-2830443941 886 | 2855216236-2865262494 887 | 148746049-149287452 888 | 589888575-595456264 889 | 314410823-316970816 890 | 2060986022-2063938184 891 | 1803766703-1825422528 892 | 2128237894-2139217623 893 | 4248957737-4257018408 894 | 3561933398-3574109426 895 | 1614389854-1614749576 896 | 468854062-476024564 897 | 436179755-463764255 898 | 589811734-589875676 899 | 673967863-678814706 900 | 979844884-993353080 901 | 1945908845-1980551520 902 | 1990017551-1992668548 903 | 1252508632-1256783095 904 | 2946230992-2982621959 905 | 3954810178-3972017471 906 | 3396778325-3399315311 907 | 3331661742-3344656790 908 | 3072306192-3077370803 909 | 4093061872-4094625093 910 | 2876543933-2878230248 911 | 2854310965-2859128779 912 | 4193316980-4200095285 913 | 730205666-732782756 914 | 3676211467-3676732582 915 | 666890880-674578243 916 | 1371568734-1380318984 917 | 4184744194-4187112660 918 | 1481248211-1499734002 919 | 3379867668-3385527932 920 | 1622428665-1625174665 921 | 3671900758-3678171048 922 | 3705951043-3716692751 923 | 1465468963-1479919767 924 | 1580610051-1583129310 925 | 350103370-365345541 926 | 3900102077-3919890024 927 | 2940456227-2945966226 928 | 3248685696-3284290550 929 | 544295457-564157394 930 | 4016705659-4021147057 931 | 791731732-797225629 932 | 1165689597-1184551930 933 | 3289305184-3312438882 934 | 4097750837-4102130426 935 | 4055841302-4077041304 936 | 3441155355-3450835270 937 | 3314042173-3333554945 938 | 597747809-623200754 939 | 356234097-366220597 940 | 2381045649-2408455595 941 | 4047227592-4049208360 942 | 4092327831-4093008849 943 | 3986217544-4010716485 944 | 3587101217-3589409982 945 | 3939796675-3976120816 946 | 1335959163-1365648715 947 | 3809562980-3810806981 948 | 1374160507-1375189297 949 | 1229723962-1229853859 950 | 2978027850-2978555872 951 | 1081232290-1096685438 952 | 3431403369-3441155353 953 | 3058481098-3072306190 954 | 3615995822-3647806423 955 | 626772256-671686621 956 | 1922970278-1932303880 957 | 687812741-696977728 958 | 3664395391-3676520369 959 | 2073554869-2099760007 960 | 512240640-534906131 961 | 47709068-56528831 962 | 255985991-270099977 963 | 3481339655-3501155910 964 | 2238475796-2249793376 965 | 3866035083-3867269474 966 | 4093117795-4094756619 967 | 4285929403-4287400825 968 | 702714634-707275982 969 | 3036049064-3058481097 970 | 1027080396-1032733050 971 | 113815262-115324511 972 | 2256577067-2275122653 973 | 1990217023-1991256560 974 | 109305038-113504562 975 | 978617987-1000518126 976 | 4057509129-4071389442 977 | 3739975721-3747173973 978 | 320182613-320260227 979 | 1770166-1994691 980 | 291087466-296873313 981 | 4086243810-4096488348 982 | 1276470617-1302918078 983 | 4009439486-4012738003 984 | 4229206868-4234285011 985 | 50143427-53071093 986 | 404422891-410359316 987 | 4161013486-4161053283 988 | 911138009-929609461 989 | 689609396-696731723 990 | 2252329659-2256577065 991 | 613133080-613942155 992 | 4795688-12016953 993 | 641672798-650081964 994 | 389776265-420161914 995 | 3625922134-3642274972 996 | 1846384495-1862435820 997 | 2275122654-2286941521 998 | 4005662252-4011759888 999 | 1579087992-1581111352 1000 | 574652-1770165 1001 | 1442180635-1450176908 1002 | 2760767133-2771395260 1003 | 1928232572-1932533591 1004 | 102995855-104909244 1005 | 4049179426-4050691624 1006 | 2830630-3651339 1007 | 3552827772-3568200782 1008 | 2149613227-2163021264 1009 | 1355394428-1371491556 1010 | 1697279405-1703102679 1011 | 2056763545-2073554867 1012 | 3935325191-3944187216 1013 | 3553082925-3579924615 1014 | 471239627-477134321 1015 | 3651340-4795687 1016 | 336457769-347991249 1017 | 93183635-111293337 1018 | 2192128388-2196145589 1019 | 2584811687-2598361179 1020 | 2772743660-2798530311 1021 | 966574237-968633571 1022 | 4234775226-4245296919 1023 | 3662498499-3663349534 1024 | 1373549652-1374239894 1025 | 58302860-63670232 1026 | 1942772476-1980855825 1027 | 3367790115-3376760130 1028 | 153092723-163571711 1029 | 729975675-730335988 1030 | 2192513622-2204700032 1031 | 809609217-841628900 1032 | 1180032684-1187000735 1033 | 1179227554-1195640753 1034 | 4232727143-4234293540 1035 | 1127122996-1154171178 1036 | 314709697-321232216 1037 | 324796849-347951368 1038 | 1095126621-1109642108 1039 | 384962939-400102190 1040 | 363929652-366175319 1041 | 3821851234-3832391073 1042 | 338713138-348077886 1043 | 817486506-837487497 1044 | 1051940232-1067333023 1045 | 19243172-19587047 1046 | 257512323-261464746 1047 | 1753791137-1753975241 1048 | 202493249-230688701 1049 | 1579363284-1580767164 1050 | 2763246325-2780813492 1051 | 2242297310-2249800231 1052 | 1995459738-2019539429 1053 | 573925402-574462282 1054 | 3673851405-3681451655 1055 | 3423327301-3428356692 1056 | 3681451657-3695852450 1057 | 3717161710-3718982299 1058 | 2043127586-2043244031 1059 | 2888999958-2894304682 1060 | 2061236903-2067109739 1061 | 2643879391-2646512593 1062 | 1139540259-1146292375 1063 | 3544236730-3552827770 1064 | 2287385837-2325334298 1065 | 3598404107-3612936374 1066 | 3623885184-3631095478 1067 | 1752497514-1756572770 1068 | 2817718245-2824409717 1069 | 679569338-680230991 1070 | 4102130427-4150245197 1071 | 1869463036-1881600179 1072 | 286732642-289325518 1073 | 2995454654-3032053775 1074 | 1274816430-1274830828 1075 | 4008677258-4014358519 1076 | 248491486-248842325 1077 | 1622000764-1625125474 1078 | 1165689487-1187305806 1079 | 3937241402-3968405869 1080 | 4050691625-4086243808 1081 | 3663349535-3676933438 1082 | 2982918861-2995454652 1083 | 1372603515-1379417540 1084 | 2408455596-2411739453 1085 | 201820937-227275418 1086 | 1753934804-1754073983 1087 | 2280075243-2287385835 1088 | 2905919817-2917493149 1089 | 2757562598-2759204124 1090 | 1444583282-1458937548 1091 | 1699259773-1707790200 1092 | 1579284365-1579540410 1093 | 624710045-626772254 1094 | 2971742099-2980188298 1095 | 3895219248-3896408881 1096 | 1637216769-1663878490 1097 | 1606776283-1612157133 1098 | 1527331165-1569579671 1099 | 1468822607-1477434547 1100 | 3930477156-3939796674 1101 | 4214551647-4234775225 1102 | 1469208064-1469259449 1103 | 4245296921-4257493526 1104 | 3930128245-3930477154 1105 | -------------------------------------------------------------------------------- /inputs/input21.txt: -------------------------------------------------------------------------------- 1 | rotate right 4 steps 2 | swap letter b with letter e 3 | swap position 1 with position 3 4 | reverse positions 0 through 4 5 | rotate left 5 steps 6 | swap position 6 with position 5 7 | move position 3 to position 2 8 | move position 6 to position 5 9 | reverse positions 1 through 4 10 | rotate based on position of letter e 11 | reverse positions 3 through 7 12 | reverse positions 4 through 7 13 | rotate left 1 step 14 | reverse positions 2 through 6 15 | swap position 7 with position 5 16 | swap letter e with letter c 17 | swap letter f with letter d 18 | swap letter a with letter e 19 | swap position 2 with position 7 20 | swap position 1 with position 7 21 | swap position 6 with position 3 22 | swap letter g with letter h 23 | reverse positions 2 through 5 24 | rotate based on position of letter f 25 | rotate left 1 step 26 | rotate right 2 steps 27 | reverse positions 2 through 7 28 | reverse positions 5 through 6 29 | rotate left 6 steps 30 | move position 2 to position 6 31 | rotate based on position of letter a 32 | rotate based on position of letter a 33 | swap letter f with letter a 34 | rotate right 5 steps 35 | reverse positions 0 through 4 36 | swap letter d with letter c 37 | swap position 4 with position 7 38 | swap letter f with letter h 39 | swap letter h with letter a 40 | rotate left 0 steps 41 | rotate based on position of letter e 42 | swap position 5 with position 4 43 | swap letter e with letter h 44 | swap letter h with letter d 45 | rotate right 2 steps 46 | rotate right 3 steps 47 | swap position 1 with position 7 48 | swap letter b with letter e 49 | swap letter b with letter e 50 | rotate based on position of letter e 51 | rotate based on position of letter h 52 | swap letter a with letter h 53 | move position 7 to position 2 54 | rotate left 2 steps 55 | move position 3 to position 2 56 | swap position 4 with position 6 57 | rotate right 7 steps 58 | reverse positions 1 through 4 59 | move position 7 to position 0 60 | move position 2 to position 0 61 | reverse positions 4 through 6 62 | rotate left 3 steps 63 | rotate left 7 steps 64 | move position 2 to position 3 65 | rotate left 6 steps 66 | swap letter a with letter h 67 | rotate based on position of letter f 68 | swap letter f with letter c 69 | swap position 3 with position 0 70 | reverse positions 1 through 3 71 | swap letter h with letter a 72 | swap letter b with letter a 73 | reverse positions 2 through 3 74 | rotate left 5 steps 75 | swap position 7 with position 5 76 | rotate based on position of letter g 77 | rotate based on position of letter h 78 | rotate right 6 steps 79 | swap letter a with letter e 80 | swap letter b with letter g 81 | move position 4 to position 6 82 | move position 6 to position 5 83 | rotate based on position of letter e 84 | reverse positions 2 through 6 85 | swap letter c with letter f 86 | swap letter h with letter g 87 | move position 7 to position 2 88 | reverse positions 1 through 7 89 | reverse positions 1 through 2 90 | rotate right 0 steps 91 | move position 5 to position 6 92 | swap letter f with letter a 93 | move position 3 to position 1 94 | move position 2 to position 4 95 | reverse positions 1 through 2 96 | swap letter g with letter c 97 | rotate based on position of letter f 98 | rotate left 7 steps 99 | rotate based on position of letter e 100 | swap position 6 with position 1 101 | -------------------------------------------------------------------------------- /inputs/input23.txt: -------------------------------------------------------------------------------- 1 | cpy a b 2 | dec b 3 | cpy a d 4 | cpy 0 a 5 | cpy b c 6 | inc a 7 | dec c 8 | jnz c -2 9 | dec d 10 | jnz d -5 11 | dec b 12 | cpy b c 13 | cpy c d 14 | dec d 15 | inc c 16 | jnz d -2 17 | tgl c 18 | cpy -16 c 19 | jnz 1 c 20 | cpy 89 c 21 | jnz 90 d 22 | inc a 23 | inc d 24 | jnz d -2 25 | inc c 26 | jnz c -5 27 | -------------------------------------------------------------------------------- /inputs/input24.txt: -------------------------------------------------------------------------------- 1 | ################################################################################################################################################################################### 2 | #...............#.........#...#...#.......#.......#.#...#.........#...........#...............#.#.#.......#.......#.....#...........#...#...#.......#.......#...#....2#...........# 3 | #.#.#.#.#.###.#.#####.#.#.#.###.#.#.#######.###.#.#.#.#.#.#.###.#.#.###.###.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#####.#.#.#.#.#.###.#.#.#.#####.###.#.#.#.#.#.#.#####.#.#.###.####### 4 | #....1#...#.#...#.......#.......#...#.......#.....#...#.#...#...#.......#.............#.....#...#.#.........#...#.....#.....#.........#...#...#.....#...#.#...#.#.#...#.........#.# 5 | #######.#.#.###.#.#######.#####.#.#.#.#.###.#.###.#.#####.#.#.#.#.#.#########.###.#.#.#.###.#.#.#.###.#.###.#.#.#.#.#.#######.#.###########.#.#.###.#.###.#.#.#.#.#.#.#.###.#.#.#.# 6 | #...#.....#.#...#.......#.#...#.....#.....#.......#.#...#...........#.........#.....#.........#.#.#...#.....#.....#.......#...#.............#...#.#.#.....#...#.#...#.#.....#.....# 7 | #.###.###.#.#.#.#####.#.#.#.#.#.#.#.#.###.###.#.#.#.#.#.###.#.###.#####.#.#####.###.#####.#.#.#.#.#.#.#####.#.###.#.###.#.###.#.#.###.#.#.#.#.#.#.###.###.#.###.#.###########.#.### 8 | #...........#.......#...........#.#...#...#.........#.......#.....#...............#.....#...#.........#...#.#...#.....#...#...............#.#.....#.........#.........#.........#3# 9 | #####.#####.#######.#.#######.#.#.###.#.#.#.#.#########.#####.#####.#######.#.###.#.#.#.#.###.#.#.#.#.#.#.###.#.#.#.#.#.#.###.#####.#######.###.###.#.#####.#.#.###.#.#.#######.#.# 10 | #...........#.........#.........#...........#...#.....#.....#...................#.......#.........#.#.#.#.#.#...#.#.........#.#...#.....#...#.#.#.#.....#.#.#...#.#.....#.#.......# 11 | #.###.#####.###.#.#.#.#.#.#.#####.###.#.#####.#.#.#.#####.###.###.###.#.#######.#.#.###.#.#.#######.#.#.#.#.#####.#.#.#.#.#.#.###.#######.###.###.#######.#.#.###.#####.#.###.###.# 12 | #.....#...............#.#...#.....#...............#.......#.........#.#.#.........#.......#.....#...#.#.....#.....#.#...#.......#.#.#.#...#.....#.......#.#.#.#.#.#.#.#.......#...# 13 | #.#.###.#.#.#.#.#####.#####.#.#.#.#.#.#####.#.#####.#.#.###.#####.#.#.#.#.###.#####.#.#.#.#.#.#.#.###.#####.#.#.###.#.#.###.#.#.#.#.#.#########.#######.#.#.###.#.#.#.#.#.#.###.#.# 14 | #.#...#...#...#.............#.#.#.........#...#.........#.#.#...#...#...#.........#.#.....#.....#...........#.....#.#.....#.#...#.......#.#.......#.....#.#.#...#...#...#.#.......# 15 | #.#.#.#.###.###.###.#####.#.#.#.#.#####.#.###.###.#.#.#.#.###.#.#.#.###.#.#.#####.#.#.#.###.#######.###.###.#.###.###.###.#.#.#.###.###.#.#.###.#.#.#.#.#.#.#####.#.###.#.#.#.##### 16 | #...........#.......#.....#...#...#.......#.......#.........#...........#.#...#...#.#...#.........#.#.#.....#.......#.#...#...#.........#.....#.#.#.....#.........#.#...#.#...#...# 17 | #.###.###.#.#.###.#.#.###.#####.#.#.###.#.###.###.#.###.###.#####.#.#.#.#.#.#.#.#.#.###.#.#######.#.#.###.#.#.###.#.#.#.#####.#.#.#####.#.#.#.#.#######.#.#.#.#.###.#.#.###.#.#.#.# 18 | #.#0......#.#...............#.....#.#.#...#...#...................#...#.#...#...#.....#...#...#.#...#...........#.....#...#.....#.#.....#...#...#.....#...#.....#.......#...#.....# 19 | #.###.#.#####.#####.#########.###.#.#.#######.#.#.#.#####.###.#.###.#.#.#.#.#.#.#.#.#.#.#.#.#.#.###.#.#.###.#.#.#######.#.#.###.#.#.#.#.#.#.#.#.#.###########.#.###.#.#.#.#.#.###.# 20 | #.....#.............#.......#.#.....#.....#.#...#...#.#.#.....#.......#...#...#.#.......#...#.....#.....#...#.#.#...#...#.#.#.....#.#...#.....#.#...#.#.....#.#...#.......#...#...# 21 | #.#.#.###.#.#.###.#.#.#.###.#.#.#####.#####.#.#.#####.#.#.#.#.###.#.#.###.#####.#.###.###.###.###.###.###.#.#.###.###.#.###.#.#.#.#####.#####.#.#.#.#.#.#.#.#.#.#.#.###.###.#.#.#.# 22 | #.....#.#...#...#...#...#...#.....#.........#.......#...#...#.#.#...#.#.....#.....#.....#.....#...#...#.......#.................#.....#...#.....#...#.........#.#...#...#...#...#.# 23 | ###.#.#.###.#.#.#####.#.###.#.#.#.#.#.###.###.###.#.#.#.#.#.#.#.###.###.###.#.#.#.#.#.#####.#####.#.#####.###.#####.###########.###.#.#.###.#.#.#.#.#######.#.#.#.###.#.#.#.#.##### 24 | #...#.#.......#.#.......#...#.....#.#.#...........#.#.#...#.........#...#...#.#...#.#.............#.............#...#.#...#...........#.#...#...#...#...#.#.#.....#.........#7#...# 25 | #.#.#.#.#######.#.#.#.#.###.#.###.#.#.#.#######.###.#.#.#.#.#.###########.###.#.###.#.#.#.###.#########.#.#######.###.#.#.#.#.###.#.#.#.#.#.#.###.#.#.###.#.#######.#.#####.###.#.# 26 | #...............#...#...#.....#...#.............#.#.#.#...#.#...#.#.......#.....#...#...#.#...#.#.........#.......#.#.....#...#.#.#.#...#.#.#.......#.#.#.....#.......#.#...#...#.# 27 | ###########.#.#.###.#####.#########.#####.#.###.#.#.#.#.#.#.###.#.#.#####.#####.#.#.###.###.###.#.#.#.#.#.#####.###.#####.#.###.#######.###.###.#.#.###.#.#.#.#.#.#.###.#.#.#.###.# 28 | #.#...#.........#.#.......#...#.....#.#...#...#.......#.........#...#.#.........#.#.#.........#.#.#...#.....#...#.........#.#...#...#...#...#.....#...#.#.#.....#...#...#...#.....# 29 | #.#.#.#.#.###.#.#.#######.#.#.#.###.#.#.#####.#######.#.#.#.#.#.###.#.###.#.#.#.#########.#.#.#.#.#.#.#.#.#.#.###.#.#.#.###.#.#.#.###.#.#.#.#.#.#.#.#.#.#.#####.###.#.#.#.#.#.###.# 30 | #...#.#...........#.......#...........#.......#.......#...#...#.#.#.....#.#...........#.#.#.....#.#.........#.....#.....#...#.............#...#...#.....#.....#.....#...#.#.#.#...# 31 | #.#.#####.#.#####.#.#####.#########.###.#.###.###.#.#.#.#.#.###.#.#.#.#.#.#######.#.#.#.###.###.#.#.#####.#####.###.###.#.#######.#########.#####.#####.###.#.#######.#.#.#.#####.# 32 | #.#.......#...#...#.....#.#6#.......#...#.#.......#.....#.....#...........#...#...#.#.....#.#.#...#.........#.........#.#.....#...#.........#...#.#.#...#.....#.#.....#.#.........# 33 | #.#.#.#.#.#.#.#.#######.#.#.###.#.#.#.#.#.#.#.#.#.#.#.#.#######.#.#.#.#.#.#.#.#.#.#.#.#####.#.###.#####.#####.#.#.###.#.###.#.#.#.#.#.#.#.###.#.#.#.###.#.###.#.#.#.###.###.#.#.#.# 34 | #.#.#.#...#.#.....#.#.#.....#.................#...#.#.#.#...#...........#.#...#.......#...........#...#.........#.#.#.......#...#.......#...#.#...#.#...#...#.#.....#.......#...#.# 35 | #.###.#.###.#.#.###.#.#.#.###.#########.#.#.#.#.#.#.#.#.#.#.#.#####.#.#.###.#.#.###.###.#.#.#.#.#.#.#####.#.#.#.###.#.#.#.#.#.#.#.#####.###.#.#.###.#####.###.#.#############.#.#.# 36 | #.....#...#.#.........#.......#.....#...#.....#.#.......#...........#.......#.#.#.......#.....#.#.#.......#.....#...#...#...#.....#...#.....#.......#.........#.......#5#.......#.# 37 | #.#####.#.#.#.###.###########.#.###.#.#####.#####.###.#####.#################.#.#.#.#.#.###.#####.###.###.###.#.###.###.#.#####.#.#.#.###.#.#####.#.###.#.###.#.###.#.#.#.#.#.###.# 38 | #.#.....#...#.........#.....#.#.......#...#...#4#...#...#.#.#...#.....#...#.#...#.........#...#.............#...#.#.#.....#.........#.#.....#...........#.....#.#...#...#.#.....#.# 39 | #.#.#.#.#.#.#########.#.#.#.#.#.#.#####.#.###.#.###.###.#.#.#.#.#.#.#.###.#.#######.#####.#.#.###.#.#.###.#.###.#.#.#.#####.#.###.#.#.###.###.#####.#.#.#.#####.#.#.#.###.#.###.#.# 40 | #.#...#.....#.......#.....#...#...#.............#.#.#.....#...#...#...#.....#.#.#...#.....#...#...#.#.#.#...#.#.........#.#.......#.......#...#...#.......#.....#.#.#.....#...#...# 41 | ################################################################################################################################################################################### 42 | -------------------------------------------------------------------------------- /inputs/input25.txt: -------------------------------------------------------------------------------- 1 | cpy a d 2 | cpy 9 c 3 | cpy 282 b 4 | inc d 5 | dec b 6 | jnz b -2 7 | dec c 8 | jnz c -5 9 | cpy d a 10 | jnz 0 0 11 | cpy a b 12 | cpy 0 a 13 | cpy 2 c 14 | jnz b 2 15 | jnz 1 6 16 | dec b 17 | dec c 18 | jnz c -4 19 | inc a 20 | jnz 1 -7 21 | cpy 2 b 22 | jnz c 2 23 | jnz 1 4 24 | dec b 25 | dec c 26 | jnz 1 -4 27 | jnz 0 0 28 | out b 29 | jnz a -19 30 | jnz 1 -21 31 | -------------------------------------------------------------------------------- /inputs/input3.txt: -------------------------------------------------------------------------------- 1 | 566 477 376 2 | 575 488 365 3 | 50 18 156 4 | 558 673 498 5 | 133 112 510 6 | 670 613 25 7 | 84 197 643 8 | 910 265 611 9 | 894 252 545 10 | 581 3 598 11 | 98 742 574 12 | 628 746 193 13 | 129 677 265 14 | 187 445 169 15 | 288 242 128 16 | 569 744 439 17 | 685 748 471 18 | 256 23 157 19 | 218 343 491 20 | 777 905 633 21 | 778 867 840 22 | 672 772 947 23 | 500 763 420 24 | 449 665 653 25 | 23 558 858 26 | 745 407 904 27 | 766 194 576 28 | 11 541 423 29 | 179 690 274 30 | 174 747 279 31 | 741 538 336 32 | 507 698 667 33 | 689 920 467 34 | 405 861 35 35 | 575 631 992 36 | 317 573 981 37 | 817 536 44 38 | 816 205 653 39 | 45 631 683 40 | 509 300 418 41 | 712 192 865 42 | 666 133 859 43 | 32 331 54 44 | 572 432 259 45 | 552 456 267 46 | 766 931 643 47 | 902 840 557 48 | 465 318 175 49 | 491 863 329 50 | 463 795 564 51 | 589 213 805 52 | 340 323 123 53 | 602 812 499 54 | 898 931 555 55 | 899 835 341 56 | 316 487 789 57 | 677 790 797 58 | 341 502 123 59 | 502 196 136 60 | 702 617 82 61 | 939 581 362 62 | 801 834 951 63 | 464 941 843 64 | 7 756 971 65 | 273 297 661 66 | 270 620 387 67 | 776 96 80 68 | 891 125 92 69 | 376 175 141 70 | 435 247 949 71 | 719 586 478 72 | 578 662 801 73 | 446 202 556 74 | 596 336 5 75 | 855 202 558 76 | 541 314 17 77 | 43 295 959 78 | 507 433 942 79 | 380 721 579 80 | 313 670 629 81 | 301 341 59 82 | 338 776 161 83 | 202 291 844 84 | 528 564 736 85 | 411 765 465 86 | 489 98 611 87 | 301 817 959 88 | 895 836 890 89 | 249 313 267 90 | 726 976 881 91 | 300 601 657 92 | 985 91 438 93 | 925 596 905 94 | 250 850 331 95 | 104 714 258 96 | 312 189 196 97 | 36 62 611 98 | 218 756 600 99 | 225 803 736 100 | 765 250 259 101 | 768 438 728 102 | 268 613 578 103 | 951 816 919 104 | 706 923 495 105 | 430 487 915 106 | 416 964 623 107 | 737 699 581 108 | 836 981 90 109 | 740 471 498 110 | 17 781 602 111 | 732 527 191 112 | 57 126 235 113 | 778 344 370 114 | 822 398 366 115 | 245 597 127 116 | 407 658 902 117 | 542 545 985 118 | 786 663 93 119 | 872 512 690 120 | 897 151 655 121 | 226 362 164 122 | 257 629 168 123 | 94 280 86 124 | 577 611 45 125 | 648 756 953 126 | 89 556 924 127 | 116 330 373 128 | 730 297 713 129 | 836 630 486 130 | 431 10 177 131 | 350 21 950 132 | 442 34 831 133 | 219 115 125 134 | 259 111 836 135 | 56 13 825 136 | 837 648 336 137 | 414 314 670 138 | 787 906 792 139 | 232 526 550 140 | 220 409 216 141 | 383 241 720 142 | 101 724 8 143 | 108 695 885 144 | 23 33 894 145 | 458 827 435 146 | 489 664 675 147 | 272 542 261 148 | 18 250 218 149 | 896 60 659 150 | 906 284 823 151 | 179 668 925 152 | 174 362 227 153 | 211 589 911 154 | 514 333 704 155 | 575 716 896 156 | 762 382 597 157 | 344 783 294 158 | 408 795 209 159 | 91 119 110 160 | 717 616 307 161 | 760 106 333 162 | 374 563 514 163 | 454 51 709 164 | 564 499 158 165 | 566 541 601 166 | 901 327 137 167 | 417 859 921 168 | 726 627 828 169 | 534 416 475 170 | 221 533 310 171 | 731 423 274 172 | 534 636 902 173 | 463 513 606 174 | 921 148 829 175 | 314 151 657 176 | 454 238 935 177 | 468 244 703 178 | 253 124 615 179 | 427 524 804 180 | 194 545 380 181 | 913 998 210 182 | 203 797 141 183 | 993 320 265 184 | 208 144 488 185 | 791 710 361 186 | 953 637 413 187 | 372 472 926 188 | 686 216 677 189 | 775 476 473 190 | 683 224 524 191 | 670 424 556 192 | 286 642 660 193 | 578 964 895 194 | 715 938 675 195 | 727 48 846 196 | 386 538 362 197 | 271 702 241 198 | 620 537 487 199 | 689 388 118 200 | 223 315 599 201 | 477 445 509 202 | 369 787 300 203 | 645 679 536 204 | 613 461 511 205 | 586 730 876 206 | 597 586 541 207 | 745 452 960 208 | 577 77 581 209 | 733 177 562 210 | 923 191 64 211 | 521 751 297 212 | 422 780 709 213 | 521 887 550 214 | 808 681 829 215 | 907 938 753 216 | 507 307 991 217 | 752 386 22 218 | 684 270 155 219 | 91 234 151 220 | 568 950 170 221 | 651 954 210 222 | 789 31 307 223 | 550 71 560 224 | 463 715 400 225 | 491 765 600 226 | 131 455 904 227 | 592 453 555 228 | 559 788 676 229 | 391 484 363 230 | 405 404 280 231 | 68 114 556 232 | 307 518 632 233 | 49 549 907 234 | 288 287 482 235 | 729 36 395 236 | 440 768 636 237 | 838 772 889 238 | 99 231 794 239 | 181 81 684 240 | 252 253 843 241 | 738 717 531 242 | 125 311 536 243 | 727 508 487 244 | 992 76 234 245 | 680 114 100 246 | 501 165 292 247 | 597 562 167 248 | 223 887 429 249 | 613 345 482 250 | 209 45 787 251 | 98 175 821 252 | 178 196 252 253 | 345 127 459 254 | 767 896 750 255 | 601 965 522 256 | 792 541 699 257 | 989 350 109 258 | 337 799 588 259 | 276 531 244 260 | 461 655 162 261 | 413 284 340 262 | 327 93 556 263 | 431 873 989 264 | 164 826 956 265 | 279 486 578 266 | 488 275 248 267 | 672 462 539 268 | 636 448 39 269 | 116 504 619 270 | 550 353 618 271 | 803 506 5 272 | 641 482 513 273 | 190 973 509 274 | 4 105 745 275 | 443 619 243 276 | 440 519 754 277 | 624 62 907 278 | 644 231 907 279 | 232 238 900 280 | 866 749 665 281 | 490 988 547 282 | 815 482 135 283 | 331 992 234 284 | 252 812 623 285 | 95 661 698 286 | 15 378 91 287 | 986 338 255 288 | 979 205 218 289 | 927 59 302 290 | 161 231 250 291 | 855 250 389 292 | 588 356 40 293 | 279 90 105 294 | 707 273 77 295 | 846 311 842 296 | 870 305 833 297 | 77 477 346 298 | 638 496 395 299 | 642 374 864 300 | 73 526 717 301 | 851 399 892 302 | 873 444 889 303 | 988 133 217 304 | 950 702 591 305 | 989 338 278 306 | 307 628 794 307 | 815 568 390 308 | 974 725 622 309 | 463 296 984 310 | 605 409 526 311 | 665 554 473 312 | 106 852 381 313 | 874 597 620 314 | 481 609 245 315 | 604 18 655 316 | 702 611 814 317 | 711 341 254 318 | 130 458 865 319 | 677 689 278 320 | 926 675 223 321 | 363 15 154 322 | 189 785 793 323 | 189 556 925 324 | 92 332 617 325 | 1 884 831 326 | 176 37 482 327 | 174 856 362 328 | 432 978 371 329 | 957 662 493 330 | 749 873 714 331 | 259 938 328 332 | 692 837 649 333 | 721 949 456 334 | 488 304 194 335 | 270 776 448 336 | 446 879 257 337 | 647 705 462 338 | 720 305 25 339 | 230 489 454 340 | 920 303 582 341 | 325 20 478 342 | 970 303 168 343 | 628 29 916 344 | 398 209 489 345 | 248 194 426 346 | 426 276 899 347 | 14 274 981 348 | 430 12 799 349 | 229 235 745 350 | 268 663 528 351 | 283 439 906 352 | 542 983 253 353 | 214 938 241 354 | 575 123 228 355 | 704 628 326 356 | 567 678 468 357 | 439 984 300 358 | 580 228 520 359 | 229 668 370 360 | 512 701 624 361 | 267 912 271 362 | 666 839 776 363 | 804 362 559 364 | 400 565 127 365 | 418 349 450 366 | 136 671 460 367 | 302 515 931 368 | 185 764 911 369 | 441 574 331 370 | 902 856 448 371 | 123 934 288 372 | 890 143 683 373 | 307 470 748 374 | 339 169 127 375 | 114 339 834 376 | 789 639 631 377 | 676 82 453 378 | 247 563 394 379 | 436 655 703 380 | 352 906 631 381 | 277 367 327 382 | 585 757 427 383 | 545 710 988 384 | 153 705 689 385 | 98 300 882 386 | 140 491 135 387 | 193 220 911 388 | 371 739 602 389 | 538 419 864 390 | 280 786 352 391 | 795 750 697 392 | 808 341 79 393 | 361 606 668 394 | 57 277 452 395 | 524 267 976 396 | 525 45 762 397 | 462 885 782 398 | 90 837 156 399 | 510 394 826 400 | 617 23 812 401 | 443 755 483 402 | 255 756 866 403 | 931 404 762 404 | 184 496 236 405 | 841 792 640 406 | 932 259 869 407 | 893 697 951 408 | 37 451 493 409 | 939 592 146 410 | 789 104 25 411 | 477 617 150 412 | 427 506 86 413 | 723 243 717 414 | 795 705 638 415 | 908 506 556 416 | 741 755 408 417 | 608 852 240 418 | 613 717 393 419 | 392 59 448 420 | 877 724 100 421 | 61 141 24 422 | 101 257 130 423 | 139 313 147 424 | 999 130 568 425 | 82 256 539 426 | 941 183 193 427 | 279 793 217 428 | 628 347 824 429 | 503 506 905 430 | 646 629 909 431 | 785 518 510 432 | 510 199 701 433 | 413 201 703 434 | 399 548 247 435 | 11 396 606 436 | 250 981 822 437 | 314 758 810 438 | 513 476 139 439 | 830 232 74 440 | 448 693 690 441 | 503 556 646 442 | 604 448 579 443 | 21 441 367 444 | 603 155 428 445 | 589 655 64 446 | 524 726 849 447 | 262 556 808 448 | 693 19 969 449 | 102 306 91 450 | 773 287 939 451 | 49 2 177 452 | 937 54 697 453 | 967 51 745 454 | 388 262 356 455 | 193 636 387 456 | 554 537 478 457 | 510 689 720 458 | 693 670 665 459 | 905 32 730 460 | 516 420 525 461 | 109 627 935 462 | 421 282 693 463 | 504 374 435 464 | 241 619 662 465 | 277 809 333 466 | 319 43 766 467 | 787 803 267 468 | 941 828 722 469 | 710 489 10 470 | 654 395 148 471 | 95 733 154 472 | 270 163 706 473 | 247 564 771 474 | 269 635 204 475 | 560 604 137 476 | 379 164 72 477 | 282 557 149 478 | 871 461 499 479 | 140 475 289 480 | 816 12 533 481 | 974 361 166 482 | 769 545 848 483 | 543 493 875 484 | 475 192 926 485 | 342 564 976 486 | 501 448 782 487 | 94 172 75 488 | 275 856 267 489 | 215 853 210 490 | 41 496 331 491 | 829 583 434 492 | 818 306 478 493 | 660 431 552 494 | 509 716 355 495 | 404 812 211 496 | 549 63 271 497 | 422 642 655 498 | 397 590 389 499 | 698 235 288 500 | 319 95 603 501 | 810 218 336 502 | 709 590 89 503 | 749 734 884 504 | 118 896 862 505 | 550 398 700 506 | 505 207 165 507 | 449 339 778 508 | 664 929 821 509 | 724 926 630 510 | 89 21 391 511 | 698 176 786 512 | 718 479 938 513 | 391 577 266 514 | 634 178 29 515 | 56 373 972 516 | 687 259 969 517 | 98 480 250 518 | 951 134 237 519 | 939 491 15 520 | 899 303 834 521 | 252 416 295 522 | 887 537 926 523 | 496 232 609 524 | 130 534 575 525 | 519 436 934 526 | 639 648 29 527 | 625 127 541 528 | 291 544 511 529 | 744 570 404 530 | 430 772 439 531 | 381 304 231 532 | 525 527 785 533 | 137 802 499 534 | 542 632 966 535 | 637 482 42 536 | 207 643 532 537 | 527 816 501 538 | 194 982 271 539 | 862 943 367 540 | 846 217 324 541 | 872 894 184 542 | 911 776 718 543 | 939 849 594 544 | 745 354 472 545 | 838 305 284 546 | 744 157 759 547 | 436 263 650 548 | 605 326 348 549 | 319 530 463 550 | 639 358 479 551 | 675 826 732 552 | 609 682 912 553 | 97 714 874 554 | 848 330 858 555 | 874 646 24 556 | 508 518 881 557 | 567 481 576 558 | 431 561 603 559 | 934 715 700 560 | 833 311 198 561 | 323 661 724 562 | 997 162 319 563 | 93 395 412 564 | 977 497 232 565 | 858 448 225 566 | 900 316 259 567 | 107 458 401 568 | 397 723 817 569 | 720 328 17 570 | 346 631 802 571 | 824 567 852 572 | 810 234 269 573 | 251 784 926 574 | 490 316 317 575 | 637 291 350 576 | 593 583 602 577 | 450 116 310 578 | 907 210 231 579 | 904 264 396 580 | 612 221 267 581 | 144 156 136 582 | 683 248 293 583 | 64 786 842 584 | 52 606 511 585 | 26 192 927 586 | 830 422 399 587 | 956 349 575 588 | 254 130 660 589 | 431 515 161 590 | 961 522 198 591 | 995 873 43 592 | 967 855 268 593 | 487 898 564 594 | 595 378 636 595 | 707 203 268 596 | 710 226 775 597 | 277 120 551 598 | 675 631 758 599 | 203 160 294 600 | 873 667 637 601 | 279 597 765 602 | 26 667 338 603 | 305 963 550 604 | 163 858 901 605 | 328 832 537 606 | 204 25 494 607 | 601 307 594 608 | 71 405 613 609 | 642 691 258 610 | 341 439 293 611 | 93 470 627 612 | 361 30 430 613 | 942 70 305 614 | 831 963 304 615 | 368 925 25 616 | 115 82 139 617 | 53 185 545 618 | 160 247 536 619 | 462 260 666 620 | 296 696 84 621 | 465 683 683 622 | 591 228 220 623 | 743 744 432 624 | 165 758 559 625 | 651 933 87 626 | 872 37 514 627 | 340 970 512 628 | 576 654 416 629 | 27 383 888 630 | 567 840 586 631 | 722 822 425 632 | 657 872 880 633 | 91 453 574 634 | 28 970 437 635 | 955 274 342 636 | 933 753 172 637 | 582 836 289 638 | 642 966 727 639 | 240 298 925 640 | 253 241 795 641 | 115 374 68 642 | 354 162 821 643 | 283 587 328 644 | 627 566 650 645 | 712 159 846 646 | 365 973 654 647 | 848 281 89 648 | 901 900 568 649 | 211 583 905 650 | 296 480 895 651 | 433 337 45 652 | 229 741 115 653 | 249 675 433 654 | 179 507 470 655 | 796 121 16 656 | 963 523 101 657 | 469 485 112 658 | 343 846 7 659 | 391 733 732 660 | 89 419 735 661 | 571 797 25 662 | 785 740 519 663 | 436 198 533 664 | 96 387 856 665 | 250 391 421 666 | 215 15 842 667 | 389 128 120 668 | 323 673 729 669 | 87 583 624 670 | 807 454 314 671 | 970 227 247 672 | 652 230 405 673 | 391 534 677 674 | 993 253 880 675 | 747 688 284 676 | 492 932 421 677 | 290 800 344 678 | 696 151 586 679 | 535 61 371 680 | 493 455 676 681 | 138 417 892 682 | 851 568 234 683 | 480 639 309 684 | 903 829 404 685 | 662 85 687 686 | 703 112 607 687 | 410 151 995 688 | 275 465 774 689 | 97 579 152 690 | 301 516 913 691 | 960 436 672 692 | 870 230 800 693 | 151 263 674 694 | 97 515 754 695 | 763 67 705 696 | 720 516 398 697 | 817 696 171 698 | 770 89 606 699 | 655 660 736 700 | 536 236 421 701 | 713 104 578 702 | 607 296 729 703 | 432 222 852 704 | 626 751 769 705 | 529 954 670 706 | 927 18 64 707 | 559 840 376 708 | 592 819 312 709 | 423 489 842 710 | 766 14 657 711 | 350 498 198 712 | 777 199 736 713 | 767 639 924 714 | 17 684 692 715 | 652 739 958 716 | 735 874 486 717 | 175 308 988 718 | 625 615 601 719 | 125 235 645 720 | 752 791 50 721 | 263 568 505 722 | 475 307 580 723 | 241 679 757 724 | 89 812 852 725 | 133 824 507 726 | 94 396 868 727 | 285 756 877 728 | 424 811 336 729 | 587 202 550 730 | 623 402 145 731 | 169 730 142 732 | 652 649 22 733 | 42 181 68 734 | 160 20 161 735 | 132 166 179 736 | 566 277 716 737 | 521 381 640 738 | 168 212 123 739 | 489 333 741 740 | 62 328 71 741 | 506 16 721 742 | 360 388 194 743 | 516 412 767 744 | 713 686 964 745 | 711 765 514 746 | 959 285 600 747 | 759 610 862 748 | 715 308 357 749 | 348 41 10 750 | 731 306 360 751 | 902 727 296 752 | 867 770 187 753 | 63 794 254 754 | 196 410 505 755 | 693 527 570 756 | 725 386 119 757 | 322 796 62 758 | 480 514 92 759 | 514 825 38 760 | 346 422 647 761 | 210 455 853 762 | 142 40 340 763 | 298 382 190 764 | 433 867 205 765 | 346 489 315 766 | 860 258 369 767 | 845 976 997 768 | 114 974 851 769 | 168 441 671 770 | 868 467 717 771 | 824 26 616 772 | 911 581 779 773 | 853 127 81 774 | 640 681 776 775 | 926 331 747 776 | 576 681 846 777 | 626 673 515 778 | 361 462 553 779 | 188 968 946 780 | 512 933 571 781 | 357 238 647 782 | 698 738 668 783 | 786 602 599 784 | 946 216 264 785 | 700 485 646 786 | 553 382 781 787 | 180 127 629 788 | 637 622 628 789 | 798 504 116 790 | 337 59 665 791 | 701 287 318 792 | 389 251 716 793 | 570 551 491 794 | 256 889 465 795 | 665 720 734 796 | 630 801 550 797 | 637 699 547 798 | 319 277 130 799 | 807 803 576 800 | 231 314 966 801 | 944 813 672 802 | 510 539 729 803 | 339 673 746 804 | 829 616 34 805 | 320 151 16 806 | 318 128 482 807 | 4 146 473 808 | 226 777 102 809 | 207 731 253 810 | 139 162 344 811 | 134 404 641 812 | 564 974 592 813 | 569 771 878 814 | 570 646 794 815 | 589 126 159 816 | 507 754 908 817 | 832 358 827 818 | 572 251 974 819 | 922 454 938 820 | 964 819 26 821 | 963 150 603 822 | 50 916 630 823 | 578 63 306 824 | 333 897 826 825 | 716 886 733 826 | 93 726 208 827 | 876 729 569 828 | 876 3 755 829 | 271 294 734 830 | 886 677 723 831 | 643 688 273 832 | 896 404 627 833 | 991 524 399 834 | 155 165 685 835 | 195 634 821 836 | 650 277 711 837 | 459 697 131 838 | 436 855 749 839 | 196 97 765 840 | 529 765 313 841 | 781 986 44 842 | 966 768 340 843 | 218 706 304 844 | 489 179 646 845 | 61 267 435 846 | 466 364 718 847 | 392 149 666 848 | 467 152 791 849 | 180 286 624 850 | 151 170 372 851 | 870 267 612 852 | 897 107 768 853 | 2 487 286 854 | 902 669 833 855 | 902 742 635 856 | 397 258 175 857 | 742 95 866 858 | 957 213 717 859 | 723 555 749 860 | 528 527 14 861 | 203 83 762 862 | 247 428 68 863 | 656 153 208 864 | 644 496 268 865 | 14 641 16 866 | 515 670 176 867 | 523 58 192 868 | 424 617 72 869 | 766 588 999 870 | 653 202 943 871 | 219 567 386 872 | 177 799 633 873 | 229 499 572 874 | 579 445 767 875 | 365 247 682 876 | 771 518 125 877 | 310 151 329 878 | 849 782 365 879 | 613 769 364 880 | 479 495 603 881 | 551 260 105 882 | 717 326 650 883 | 476 48 883 884 | 537 368 839 885 | 136 321 105 886 | 370 683 482 887 | 396 576 186 888 | 58 549 594 889 | 37 532 381 890 | 940 248 161 891 | 915 546 228 892 | 629 860 96 893 | 672 121 741 894 | 283 932 834 895 | 162 737 544 896 | 66 967 333 897 | 199 916 591 898 | 880 571 265 899 | 953 573 132 900 | 224 51 196 901 | 562 494 245 902 | 853 94 317 903 | 550 519 80 904 | 349 741 972 905 | 814 201 949 906 | 464 779 408 907 | 32 790 544 908 | 263 785 261 909 | 260 19 562 910 | 592 362 648 911 | 661 292 897 912 | 247 222 349 913 | 947 306 89 914 | 126 329 366 915 | 857 466 329 916 | 594 744 791 917 | 546 202 429 918 | 526 619 501 919 | 54 693 748 920 | 138 682 753 921 | 182 283 74 922 | 613 333 444 923 | 9 403 359 924 | 618 160 457 925 | 312 162 510 926 | 536 506 191 927 | 309 375 567 928 | 72 548 736 929 | 678 983 50 930 | 638 990 699 931 | 263 204 770 932 | 362 13 268 933 | 603 214 866 934 | 564 522 46 935 | 864 918 863 936 | 307 863 842 937 | 364 940 152 938 | 827 403 778 939 | 960 825 792 940 | 13 811 777 941 | 890 912 391 942 | 880 384 443 943 | 735 649 473 944 | 937 443 635 945 | 702 768 256 946 | 604 809 720 947 | 407 56 908 948 | 422 823 198 949 | 376 523 140 950 | 906 236 927 951 | 851 473 978 952 | 449 835 308 953 | 800 156 332 954 | 384 969 62 955 | 282 338 353 956 | 868 472 884 957 | 681 749 966 958 | 744 430 279 959 | 137 425 4 960 | 631 184 285 961 | 781 850 209 962 | 450 376 696 963 | 698 833 851 964 | 307 749 415 965 | 952 124 766 966 | 842 847 658 967 | 95 49 635 968 | 578 934 703 969 | 491 903 253 970 | 721 679 85 971 | 801 363 502 972 | 501 622 421 973 | 657 98 602 974 | 745 979 905 975 | 925 884 326 976 | 88 601 144 977 | 379 699 426 978 | 319 379 293 979 | 564 328 773 980 | 579 716 455 981 | 331 478 990 982 | 789 304 216 983 | 387 466 567 984 | 942 206 417 985 | 840 321 46 986 | 128 457 227 987 | 819 597 243 988 | 666 160 978 989 | 226 513 80 990 | 454 502 927 991 | 860 578 640 992 | 983 130 721 993 | 263 540 201 994 | 591 692 499 995 | 569 939 531 996 | 87 814 872 997 | 753 650 280 998 | 265 715 441 999 | 988 141 611 1000 | 746 238 590 1001 | 789 735 639 1002 | 147 552 139 1003 | 37 954 595 1004 | 342 411 696 1005 | 330 629 474 1006 | 314 736 149 1007 | 596 684 86 1008 | 772 248 136 1009 | 442 384 616 1010 | 563 153 418 1011 | 498 299 818 1012 | 408 375 746 1013 | 446 394 745 1014 | 177 17 534 1015 | 257 630 592 1016 | 619 878 657 1017 | 612 711 637 1018 | 594 980 637 1019 | 399 57 594 1020 | 829 952 547 1021 | 286 730 148 1022 | 828 225 934 1023 | 671 639 963 1024 | 249 393 818 1025 | 343 531 687 1026 | 229 775 270 1027 | 987 44 875 1028 | 896 666 346 1029 | 936 638 753 1030 | 299 838 549 1031 | 824 735 59 1032 | 766 277 572 1033 | 582 151 777 1034 | 610 144 505 1035 | 120 76 902 1036 | 300 882 441 1037 | 677 435 161 1038 | 631 843 567 1039 | 62 401 375 1040 | 263 744 375 1041 | 310 463 141 1042 | 108 479 719 1043 | 484 266 17 1044 | 382 247 712 1045 | 158 558 705 1046 | 48 479 686 1047 | 209 339 958 1048 | 20 212 453 1049 | 858 254 120 1050 | 872 430 344 1051 | 801 700 786 1052 | 991 700 911 1053 | 644 213 692 1054 | 911 149 433 1055 | 752 795 344 1056 | 762 862 332 1057 | 764 35 500 1058 | 391 639 489 1059 | 809 601 497 1060 | 148 874 83 1061 | 552 4 126 1062 | 524 880 195 1063 | 530 430 179 1064 | 497 345 219 1065 | 810 694 47 1066 | 995 128 999 1067 | 73 149 917 1068 | 978 234 146 1069 | 394 735 35 1070 | 483 478 236 1071 | 293 707 271 1072 | 614 458 753 1073 | 44 531 638 1074 | 599 893 188 1075 | 729 731 863 1076 | 693 915 859 1077 | 192 205 17 1078 | 999 119 541 1079 | 943 262 318 1080 | 123 305 514 1081 | 339 536 246 1082 | 585 228 300 1083 | 904 330 325 1084 | 127 806 45 1085 | 366 429 536 1086 | 480 801 555 1087 | 656 977 669 1088 | 611 969 5 1089 | 659 123 671 1090 | 644 292 524 1091 | 557 143 298 1092 | 383 202 824 1093 | 306 144 97 1094 | 427 541 20 1095 | 735 490 109 1096 | 14 379 582 1097 | 418 367 756 1098 | 406 740 823 1099 | 832 461 125 1100 | 36 692 764 1101 | 830 497 768 1102 | 632 572 31 1103 | 996 607 705 1104 | 400 451 712 1105 | 586 598 235 1106 | 806 364 406 1107 | 409 841 606 1108 | 971 282 437 1109 | 162 208 944 1110 | 957 174 591 1111 | 567 110 844 1112 | 412 211 378 1113 | 181 113 637 1114 | 145 600 443 1115 | 359 588 426 1116 | 335 707 255 1117 | 345 476 975 1118 | 864 521 972 1119 | 832 78 5 1120 | 556 541 905 1121 | 389 712 588 1122 | 848 412 813 1123 | 833 121 316 1124 | 744 743 472 1125 | 872 837 421 1126 | 185 793 219 1127 | 995 168 61 1128 | 901 837 158 1129 | 693 955 245 1130 | 232 634 550 1131 | 725 502 451 1132 | 526 966 477 1133 | 589 607 682 1134 | 901 366 247 1135 | 815 769 769 1136 | 828 627 947 1137 | 121 664 262 1138 | 708 863 3 1139 | 522 968 186 1140 | 429 808 186 1141 | 378 162 364 1142 | 398 361 86 1143 | 194 235 285 1144 | 657 176 376 1145 | 526 787 136 1146 | 170 696 290 1147 | 513 117 970 1148 | 617 797 235 1149 | 603 889 900 1150 | 706 142 594 1151 | 291 321 96 1152 | 746 388 668 1153 | 764 762 718 1154 | 567 821 703 1155 | 968 421 883 1156 | 926 456 320 1157 | 952 963 262 1158 | 489 785 540 1159 | 446 933 970 1160 | 361 607 136 1161 | 230 682 987 1162 | 27 153 528 1163 | 437 3 502 1164 | 430 153 51 1165 | 349 206 892 1166 | 162 683 862 1167 | 366 878 244 1168 | 976 258 195 1169 | 827 80 381 1170 | 476 246 569 1171 | 881 123 222 1172 | 724 342 409 1173 | 565 421 511 1174 | 703 402 344 1175 | 704 549 486 1176 | 16 311 414 1177 | 198 894 65 1178 | 904 475 93 1179 | 967 688 43 1180 | 246 96 527 1181 | 195 327 220 1182 | 134 355 395 1183 | 222 416 988 1184 | 541 343 90 1185 | 708 109 900 1186 | 245 574 287 1187 | 979 617 284 1188 | 804 889 130 1189 | 174 798 507 1190 | 66 623 519 1191 | 142 276 146 1192 | 308 772 509 1193 | 28 773 82 1194 | 319 8 524 1195 | 507 952 927 1196 | 471 867 924 1197 | 64 535 874 1198 | 959 165 236 1199 | 475 98 117 1200 | 961 201 293 1201 | 397 757 621 1202 | 311 287 215 1203 | 492 602 425 1204 | 111 56 243 1205 | 606 69 927 1206 | 692 41 875 1207 | 523 927 982 1208 | 410 810 947 1209 | 188 120 120 1210 | 543 569 92 1211 | 838 442 414 1212 | 595 789 505 1213 | 16 896 639 1214 | 642 843 845 1215 | 644 116 938 1216 | 26 347 466 1217 | 376 664 681 1218 | 404 946 571 1219 | 766 195 436 1220 | 427 134 509 1221 | 336 85 163 1222 | 575 689 670 1223 | 598 236 705 1224 | 53 498 76 1225 | 977 35 38 1226 | 674 41 911 1227 | 572 37 901 1228 | 118 714 700 1229 | 499 958 771 1230 | 477 841 86 1231 | 633 877 670 1232 | 776 873 625 1233 | 260 88 85 1234 | 281 816 296 1235 | 568 966 670 1236 | 653 267 684 1237 | 245 23 935 1238 | 316 235 462 1239 | 99 246 739 1240 | 278 652 240 1241 | 367 542 525 1242 | 150 246 563 1243 | 422 937 236 1244 | 57 994 430 1245 | 472 188 202 1246 | 636 778 684 1247 | 756 912 605 1248 | 461 769 534 1249 | 646 508 56 1250 | 963 305 767 1251 | 618 686 769 1252 | 684 750 1 1253 | 567 173 333 1254 | 896 805 330 1255 | 821 987 638 1256 | 805 127 644 1257 | 74 899 12 1258 | 444 434 269 1259 | 449 147 181 1260 | 35 542 321 1261 | 320 105 163 1262 | 815 289 546 1263 | 537 208 691 1264 | 754 345 54 1265 | 116 804 780 1266 | 694 512 744 1267 | 941 423 795 1268 | 936 147 702 1269 | 8 327 865 1270 | 42 141 761 1271 | 189 658 273 1272 | 214 545 668 1273 | 259 219 322 1274 | 455 782 551 1275 | 512 646 526 1276 | 127 710 932 1277 | 169 615 729 1278 | 55 482 381 1279 | 571 98 930 1280 | 362 721 296 1281 | 645 684 804 1282 | 701 257 529 1283 | 731 711 683 1284 | 225 575 423 1285 | 918 23 492 1286 | 917 271 217 1287 | 5 293 537 1288 | 733 595 105 1289 | 741 433 932 1290 | 31 259 920 1291 | 303 691 396 1292 | 363 580 863 1293 | 427 474 576 1294 | 703 175 246 1295 | 529 280 209 1296 | 641 412 319 1297 | 530 890 726 1298 | 382 779 433 1299 | 284 147 323 1300 | 860 703 766 1301 | 292 427 768 1302 | 606 666 736 1303 | 638 384 264 1304 | 97 398 574 1305 | 564 627 455 1306 | 678 442 618 1307 | 432 28 687 1308 | 343 466 101 1309 | 304 594 5 1310 | 402 43 474 1311 | 498 552 476 1312 | 243 113 538 1313 | 938 102 498 1314 | 829 44 470 1315 | 208 449 197 1316 | 352 286 425 1317 | 503 600 241 1318 | 531 209 490 1319 | 615 758 363 1320 | 518 783 258 1321 | 886 636 579 1322 | 386 960 821 1323 | 678 547 784 1324 | 481 843 238 1325 | 476 256 6 1326 | 2 973 233 1327 | 331 144 822 1328 | 410 545 872 1329 | 558 546 49 1330 | 1 388 106 1331 | 384 557 457 1332 | 387 699 460 1333 | 592 809 571 1334 | 388 942 111 1335 | 651 756 647 1336 | 860 518 794 1337 | 722 894 731 1338 | 324 881 256 1339 | 429 197 383 1340 | 226 239 685 1341 | 489 51 339 1342 | 746 402 745 1343 | 756 608 434 1344 | 220 452 629 1345 | 773 631 798 1346 | 296 137 537 1347 | 942 704 260 1348 | 820 565 673 1349 | 745 666 110 1350 | 411 406 721 1351 | 44 522 531 1352 | 777 394 494 1353 | 807 835 66 1354 | 36 362 38 1355 | 113 290 975 1356 | 141 124 953 1357 | 38 663 51 1358 | 507 677 316 1359 | 514 115 360 1360 | 956 194 865 1361 | 642 677 111 1362 | 682 868 889 1363 | 173 507 339 1364 | 270 546 318 1365 | 279 115 177 1366 | 803 915 913 1367 | 139 107 187 1368 | 925 995 943 1369 | 467 471 233 1370 | 433 321 977 1371 | 689 358 961 1372 | 544 479 788 1373 | 450 403 438 1374 | 868 155 740 1375 | 583 251 384 1376 | 163 220 215 1377 | 732 43 519 1378 | 253 323 234 1379 | 481 314 873 1380 | 298 284 975 1381 | 574 480 690 1382 | 357 181 86 1383 | 292 627 695 1384 | 817 908 950 1385 | 302 137 865 1386 | 553 991 507 1387 | 660 645 933 1388 | 752 819 831 1389 | 437 189 346 1390 | 144 283 738 1391 | 108 491 429 1392 | 91 209 688 1393 | 289 24 138 1394 | 676 604 82 1395 | 670 585 204 1396 | 78 439 403 1397 | 81 674 548 1398 | 65 476 475 1399 | 904 502 542 1400 | 873 723 506 1401 | 909 628 337 1402 | 918 227 277 1403 | 929 208 324 1404 | 255 125 477 1405 | 415 30 618 1406 | 981 24 546 1407 | 588 38 694 1408 | 876 102 663 1409 | 628 262 927 1410 | 419 277 964 1411 | 160 523 632 1412 | 424 250 582 1413 | 452 773 68 1414 | 466 162 225 1415 | 913 64 463 1416 | 486 95 612 1417 | 350 264 427 1418 | 723 184 872 1419 | 868 376 701 1420 | 441 318 509 1421 | 506 286 58 1422 | 528 448 513 1423 | 166 533 92 1424 | 169 552 414 1425 | 298 85 320 1426 | 663 883 192 1427 | 664 572 433 1428 | 12 738 538 1429 | 330 943 94 1430 | 398 814 754 1431 | 273 195 682 1432 | 980 461 544 1433 | 282 558 554 1434 | 788 117 660 1435 | 336 326 337 1436 | 465 184 829 1437 | 352 180 988 1438 | 130 707 122 1439 | 854 295 141 1440 | 943 444 176 1441 | 14 4 473 1442 | 514 11 603 1443 | 525 10 892 1444 | 22 700 427 1445 | 400 673 470 1446 | 411 288 583 1447 | 448 431 582 1448 | 466 752 501 1449 | 722 530 104 1450 | 509 673 464 1451 | 727 112 677 1452 | 567 614 716 1453 | 677 9 561 1454 | 620 976 603 1455 | 324 965 87 1456 | 215 738 844 1457 | 206 128 637 1458 | 91 727 427 1459 | 625 343 624 1460 | 639 770 757 1461 | 859 691 710 1462 | 278 140 634 1463 | 405 798 561 1464 | 356 903 78 1465 | 54 748 890 1466 | 858 870 310 1467 | 821 723 983 1468 | 385 489 431 1469 | 776 261 962 1470 | 834 527 752 1471 | 798 945 282 1472 | 802 788 288 1473 | 73 899 228 1474 | 689 667 74 1475 | 995 691 603 1476 | 656 320 652 1477 | 841 63 62 1478 | 176 797 83 1479 | 736 788 20 1480 | 558 775 454 1481 | 275 858 544 1482 | 792 353 95 1483 | 494 939 694 1484 | 126 964 408 1485 | 388 65 952 1486 | 229 368 992 1487 | 408 180 481 1488 | 618 347 793 1489 | 860 4 641 1490 | 49 296 895 1491 | 901 294 563 1492 | 24 434 159 1493 | 368 911 593 1494 | 380 864 492 1495 | 637 378 275 1496 | 614 383 295 1497 | 246 326 514 1498 | 373 617 382 1499 | 409 214 294 1500 | 263 802 419 1501 | 820 909 683 1502 | 136 452 290 1503 | 860 558 491 1504 | 789 235 334 1505 | 116 508 41 1506 | 721 691 303 1507 | 14 176 77 1508 | 217 281 289 1509 | 231 337 237 1510 | 348 400 206 1511 | 382 317 684 1512 | 33 187 667 1513 | 467 434 77 1514 | 534 588 846 1515 | 905 483 871 1516 | 810 422 10 1517 | 724 260 181 1518 | 155 259 189 1519 | 223 860 544 1520 | 271 706 576 1521 | 109 431 554 1522 | 904 486 465 1523 | 65 317 535 1524 | 837 365 126 1525 | 496 700 349 1526 | 642 252 496 1527 | 750 706 505 1528 | 956 978 875 1529 | 845 953 89 1530 | 138 259 805 1531 | 787 793 322 1532 | 59 739 128 1533 | 790 957 389 1534 | 126 232 160 1535 | 391 807 909 1536 | 454 814 762 1537 | 532 358 272 1538 | 81 718 554 1539 | 482 413 655 1540 | 185 141 894 1541 | 734 96 739 1542 | 583 204 372 1543 | 587 314 772 1544 | 402 496 292 1545 | 798 187 543 1546 | 516 824 922 1547 | 409 146 140 1548 | 408 922 840 1549 | 50 373 244 1550 | 355 476 321 1551 | 365 181 219 1552 | 601 842 642 1553 | 426 426 889 1554 | 482 828 584 1555 | 589 698 588 1556 | 835 97 287 1557 | 759 769 768 1558 | 858 520 481 1559 | 947 517 219 1560 | 266 101 400 1561 | 110 65 448 1562 | 920 310 431 1563 | 926 318 23 1564 | 388 698 374 1565 | 45 753 406 1566 | 421 68 374 1567 | 203 268 623 1568 | 345 586 611 1569 | 344 678 32 1570 | 542 830 187 1571 | 487 916 456 1572 | 211 905 567 1573 | 760 36 585 1574 | 327 380 425 1575 | 793 405 604 1576 | 432 630 267 1577 | 804 307 366 1578 | 678 716 108 1579 | 437 316 22 1580 | 441 214 160 1581 | 329 364 149 1582 | 726 82 76 1583 | 896 857 361 1584 | 298 796 294 1585 | 652 406 409 1586 | 855 123 704 1587 | 430 461 744 1588 | 909 130 88 1589 | 847 910 968 1590 | 499 898 952 1591 | 662 458 83 1592 | 335 589 395 1593 | 863 481 361 1594 | 829 217 305 1595 | 822 306 635 1596 | 664 212 610 1597 | 271 203 675 1598 | 95 409 236 1599 | 337 408 517 1600 | 749 357 294 1601 | 646 214 322 1602 | 457 181 157 1603 | 649 391 73 1604 | 756 258 84 1605 | 201 312 11 1606 | 660 14 560 1607 | 128 491 96 1608 | 676 507 570 1609 | 302 944 54 1610 | 25 48 296 1611 | 313 916 351 1612 | 932 496 355 1613 | 437 198 217 1614 | 826 627 370 1615 | 312 259 193 1616 | 293 718 654 1617 | 142 459 647 1618 | 233 336 90 1619 | 81 360 232 1620 | 168 23 144 1621 | 442 523 662 1622 | 151 952 260 1623 | 444 963 489 1624 | 302 934 249 1625 | 687 523 698 1626 | 672 494 462 1627 | 461 198 649 1628 | 540 410 269 1629 | 539 515 839 1630 | 76 494 81 1631 | 514 571 496 1632 | 438 216 557 1633 | 279 215 690 1634 | 581 362 667 1635 | 318 229 53 1636 | 427 590 52 1637 | 510 61 485 1638 | 168 596 451 1639 | 960 61 155 1640 | 475 32 291 1641 | 933 57 182 1642 | 458 702 818 1643 | 740 29 821 1644 | 896 716 738 1645 | 842 614 701 1646 | 398 466 502 1647 | 739 612 737 1648 | 297 349 887 1649 | 262 303 886 1650 | 404 302 428 1651 | 668 758 600 1652 | 674 815 379 1653 | 44 395 225 1654 | 673 341 476 1655 | 516 403 384 1656 | 392 168 134 1657 | 907 562 511 1658 | 555 406 413 1659 | 818 737 773 1660 | 745 588 545 1661 | 323 27 639 1662 | 555 571 802 1663 | 326 712 513 1664 | 729 310 664 1665 | 810 468 804 1666 | 509 79 438 1667 | 418 680 403 1668 | 314 600 470 1669 | 186 678 12 1670 | 302 381 921 1671 | 380 946 932 1672 | 104 725 596 1673 | 113 950 471 1674 | 11 478 291 1675 | 520 535 519 1676 | 574 113 668 1677 | 862 541 617 1678 | 606 173 314 1679 | 960 141 857 1680 | 837 154 926 1681 | 933 161 137 1682 | 255 86 277 1683 | 794 117 308 1684 | 664 305 588 1685 | 321 329 554 1686 | 961 22 181 1687 | 433 604 132 1688 | 655 546 431 1689 | 553 187 373 1690 | 797 526 674 1691 | 563 122 203 1692 | 352 613 626 1693 | 780 196 549 1694 | 253 191 547 1695 | 746 15 412 1696 | 193 523 391 1697 | 281 537 657 1698 | 90 99 658 1699 | 892 737 646 1700 | 503 717 663 1701 | 693 205 50 1702 | 700 409 662 1703 | 465 896 15 1704 | 865 901 661 1705 | 508 664 192 1706 | 770 36 898 1707 | 980 638 809 1708 | 301 307 626 1709 | 724 803 839 1710 | 851 514 256 1711 | 521 225 170 1712 | 678 217 789 1713 | 735 289 904 1714 | 501 745 719 1715 | 896 434 575 1716 | 819 850 977 1717 | 607 691 590 1718 | 28 840 476 1719 | 623 647 167 1720 | 890 740 708 1721 | 465 674 219 1722 | 753 127 674 1723 | 370 149 657 1724 | 189 802 476 1725 | 455 734 376 1726 | 37 988 149 1727 | 947 966 168 1728 | 921 20 311 1729 | 798 911 338 1730 | 768 467 681 1731 | 102 554 488 1732 | 747 178 608 1733 | 747 507 690 1734 | 372 490 197 1735 | 22 974 389 1736 | 717 173 396 1737 | 734 881 363 1738 | 560 889 821 1739 | 721 54 963 1740 | 164 836 833 1741 | 135 687 910 1742 | 204 995 188 1743 | 188 623 865 1744 | 877 495 264 1745 | 335 316 399 1746 | 593 234 300 1747 | 655 418 169 1748 | 471 551 86 1749 | 444 381 226 1750 | 820 461 304 1751 | 38 90 334 1752 | 845 471 47 1753 | 449 124 218 1754 | 694 134 547 1755 | 270 31 551 1756 | 434 195 750 1757 | 774 171 789 1758 | 877 92 222 1759 | 843 153 340 1760 | 758 184 326 1761 | 252 239 372 1762 | 651 915 540 1763 | 740 369 10 1764 | 828 998 547 1765 | 814 903 348 1766 | 491 364 548 1767 | 549 612 267 1768 | 429 170 705 1769 | 978 231 210 1770 | 917 339 866 1771 | 432 133 494 1772 | 983 409 450 1773 | 567 465 246 1774 | 744 885 684 1775 | 717 876 790 1776 | 183 11 138 1777 | 984 740 311 1778 | 686 528 843 1779 | 757 343 712 1780 | 31 752 940 1781 | 17 254 106 1782 | 11 956 974 1783 | 495 572 789 1784 | 440 496 763 1785 | 183 254 25 1786 | 152 559 980 1787 | 146 573 585 1788 | 200 456 938 1789 | 371 716 716 1790 | 228 742 679 1791 | 205 167 988 1792 | 81 223 806 1793 | 509 421 192 1794 | 544 485 828 1795 | 112 205 502 1796 | 45 133 555 1797 | 155 134 784 1798 | 179 196 625 1799 | 81 18 589 1800 | 165 187 754 1801 | 63 341 774 1802 | 197 266 913 1803 | 229 306 680 1804 | 509 317 787 1805 | 976 260 535 1806 | 661 228 518 1807 | 289 398 700 1808 | 173 398 645 1809 | 170 370 283 1810 | 574 346 446 1811 | 422 511 42 1812 | 275 305 482 1813 | 118 698 869 1814 | 338 616 897 1815 | 334 520 229 1816 | 461 570 136 1817 | 84 336 245 1818 | 531 242 157 1819 | 646 786 356 1820 | 372 841 124 1821 | 701 67 294 1822 | 481 880 626 1823 | 155 951 361 1824 | 365 273 946 1825 | 555 163 93 1826 | 163 11 515 1827 | 582 168 495 1828 | 128 732 752 1829 | 489 685 558 1830 | 529 788 341 1831 | 820 489 73 1832 | 941 118 684 1833 | 188 545 680 1834 | 64 923 188 1835 | 639 859 445 1836 | 656 985 606 1837 | 769 169 9 1838 | 931 310 472 1839 | 205 177 472 1840 | 702 72 27 1841 | 490 977 472 1842 | 914 972 495 1843 | 837 417 333 1844 | 437 505 440 1845 | 947 881 490 1846 | 379 998 906 1847 | 371 789 763 1848 | 604 804 200 1849 | 250 622 969 1850 | 778 445 924 1851 | 844 925 78 1852 | 346 843 440 1853 | 409 228 396 1854 | 73 902 717 1855 | 759 75 511 1856 | 720 172 435 1857 | 427 155 938 1858 | 75 920 213 1859 | 49 895 187 1860 | 122 33 211 1861 | 216 875 709 1862 | 169 644 534 1863 | 47 243 546 1864 | 942 591 200 1865 | 874 790 870 1866 | 667 478 797 1867 | 475 900 250 1868 | 92 442 709 1869 | 386 505 856 1870 | 70 747 595 1871 | 390 854 740 1872 | 333 267 730 1873 | 576 421 336 1874 | 872 428 352 1875 | 884 676 20 1876 | 119 686 6 1877 | 126 171 145 1878 | 6 548 140 1879 | 296 406 627 1880 | 276 546 653 1881 | 329 232 356 1882 | 811 203 648 1883 | 757 762 656 1884 | 117 717 71 1885 | 718 17 608 1886 | 965 859 794 1887 | 707 870 536 1888 | 251 549 245 1889 | 259 814 314 1890 | 498 510 247 1891 | 885 287 649 1892 | 339 312 690 1893 | 839 518 589 1894 | 691 875 327 1895 | 549 852 692 1896 | 421 764 399 1897 | 841 938 617 1898 | 683 73 682 1899 | 838 903 513 1900 | 155 700 266 1901 | 529 492 436 1902 | 501 209 572 1903 | 177 405 185 1904 | 70 407 98 1905 | 183 151 184 1906 | 144 4 719 1907 | 387 261 642 1908 | 391 259 283 1909 | 336 371 946 1910 | 902 810 751 1911 | 714 509 251 1912 | 124 194 440 1913 | 928 357 256 1914 | 921 241 599 1915 | 725 694 141 1916 | 219 281 864 1917 | 650 757 979 1918 | 515 678 735 1919 | 553 766 397 1920 | 771 749 360 1921 | 273 414 543 1922 | 92 185 692 1923 | 365 480 246 1924 | 153 416 246 1925 | 527 431 831 1926 | 387 385 991 1927 | 610 849 42 1928 | 761 473 507 1929 | 268 863 467 1930 | 797 777 614 1931 | 567 810 153 1932 | 384 43 459 1933 | 656 78 14 1934 | 884 328 89 1935 | 565 340 99 1936 | 315 431 403 1937 | 169 687 408 1938 | 451 365 7 1939 | 706 807 561 1940 | 324 769 821 1941 | 645 257 467 1942 | 90 654 617 1943 | 230 859 466 1944 | 309 363 691 1945 | 903 656 499 1946 | 165 880 548 1947 | 966 474 64 1948 | 640 851 817 1949 | 585 967 754 1950 | 340 699 880 1951 | 253 575 32 1952 | 783 349 971 1953 | 748 532 972 1954 | 132 312 789 1955 | 673 254 152 1956 | 769 90 643 1957 | 485 483 3 1958 | 228 254 423 1959 | 281 282 418 1960 | 279 536 891 1961 | 566 876 988 1962 | 753 959 569 1963 | 629 379 773 1964 | 194 468 866 1965 | 690 307 128 1966 | 813 568 374 1967 | 798 387 873 1968 | 980 363 555 1969 | 337 750 620 1970 | 565 783 190 1971 | 780 32 746 1972 | 716 222 594 1973 | 319 50 443 1974 | 498 212 408 1975 | 106 552 95 1976 | 96 465 866 1977 | 143 216 903 1978 | 570 209 371 1979 | 73 136 163 1980 | 579 290 400 1981 | 836 640 252 1982 | 190 81 864 1983 | 684 657 892 1984 | 405 876 982 1985 | 722 499 926 1986 | 567 764 62 1987 | 383 573 458 1988 | 111 337 947 1989 | 381 366 568 1990 | 883 323 560 1991 | 942 136 297 1992 | 103 324 576 1993 | -------------------------------------------------------------------------------- /inputs/input6.txt: -------------------------------------------------------------------------------- 1 | khcibocv 2 | jhwqzinl 3 | enikmoog 4 | ldcbkyqw 5 | viqbuskb 6 | fzvrmhfn 7 | ladvyzpt 8 | ypsoweag 9 | gstsspar 10 | ororoswe 11 | bmcygmuk 12 | ehrmjtrk 13 | tnarfydl 14 | jjhmrhhx 15 | aftnuczq 16 | vvghksah 17 | tcivmvhj 18 | ntywtask 19 | nlybjngg 20 | mxpooonw 21 | uaaahxvu 22 | skgabntf 23 | xotlxbrb 24 | rehuhrva 25 | dsllciwd 26 | gazdreai 27 | nfzmbrzq 28 | pzyqwlck 29 | kyeimxka 30 | poitbpcq 31 | enjfhkmf 32 | hmyalzgt 33 | urnjnjux 34 | plluucvj 35 | vmobfpox 36 | mlmoqxsl 37 | kzsjixnf 38 | edjjkqka 39 | pyrmobat 40 | jjbvqmnl 41 | ujbkjqif 42 | kwlchvqz 43 | yvrwysla 44 | pkpvcwky 45 | ajdsfxuo 46 | zchpkvvm 47 | dhshdjas 48 | fwqhcjhv 49 | lrtfpdzt 50 | mhwekkgf 51 | pbzwzgdf 52 | jxzubhsx 53 | rxqlpjfp 54 | jisyyuuz 55 | qorpztlr 56 | rbkbjbwb 57 | hkxikxgx 58 | qrkgpdsn 59 | fumuernz 60 | xdedjbbg 61 | zargtdeu 62 | smajsdkl 63 | yaolvlts 64 | msuvrjrw 65 | plkwvaoa 66 | pyhsxlki 67 | idvhxmwd 68 | rwzjwiau 69 | nkmqajlq 70 | swasqiqu 71 | zsvrurkz 72 | bshawkvh 73 | fxjosngk 74 | lftgizov 75 | royhlpvi 76 | ozfsdycq 77 | szfuhfyn 78 | bxrzzddr 79 | esgetyot 80 | vcuidsbs 81 | jxoatgap 82 | gjafaudp 83 | ikqinimx 84 | zecjrdzp 85 | hvjtaevq 86 | mllrlqig 87 | zqsvxuur 88 | rcnalxub 89 | qtlitclb 90 | pffqtwlk 91 | aamzfxdv 92 | dqzfjijm 93 | cbzbryea 94 | jyvghssp 95 | uptrvwfm 96 | xxuwjaue 97 | jxszzvqn 98 | qzfctzgz 99 | iqdeustp 100 | bwyqfitn 101 | esuncthz 102 | mbmvpmmb 103 | owykcniv 104 | xgoprofl 105 | njuogrwz 106 | oapyrnyo 107 | afipluwq 108 | oiqdgaxn 109 | rvxcgjjk 110 | irnmhtyi 111 | uywjvbcd 112 | bgkpbtwq 113 | rytrecry 114 | xscrucfv 115 | uzjgwpbu 116 | usxemsih 117 | toqenxtn 118 | ltnnffww 119 | fesjxbte 120 | toqprifs 121 | qjnddbgh 122 | szfbokll 123 | xjcaakhy 124 | kyoyuift 125 | xebjabbv 126 | qxjfpmxx 127 | gzmfittf 128 | rgcesvuf 129 | fihfwpcw 130 | hivyqkxx 131 | ettkcuju 132 | lepmnywk 133 | mxlyazsj 134 | tclpefti 135 | isddpomz 136 | vllngecg 137 | cnmlqqts 138 | ghzgmenj 139 | bsqtezbx 140 | weclcosh 141 | fnvlndqp 142 | ajwodezw 143 | fiwwwrqp 144 | doiqhfks 145 | uroivqkr 146 | nlhhoxgk 147 | vpzdijxy 148 | aqxrabtd 149 | qpsapogw 150 | nfevlpsy 151 | ucnbmlep 152 | ftvwwpmy 153 | pwxercon 154 | eerffxar 155 | ifwnunmr 156 | zqdxxnlg 157 | ccqzyzrs 158 | jkxpsptt 159 | hcwcfwxz 160 | ytqsdaru 161 | crvvlczm 162 | sjgbewuo 163 | rtekqqyw 164 | hifnzajs 165 | dzrbjrmk 166 | vvrsnabi 167 | yxhmsrve 168 | xqnjloiy 169 | vewkpfkl 170 | orgzjghz 171 | pruumqmk 172 | vkaqlfrc 173 | qpweltsz 174 | gskqnvgb 175 | iqsyhybo 176 | rdifquyg 177 | cinbrlhx 178 | nuhdwupe 179 | tanwxjxg 180 | tdvsnbxe 181 | lojzjfst 182 | lgavdhxp 183 | zvhqxcvi 184 | fctwuggi 185 | kyybansr 186 | ngbozhln 187 | oqfenkzr 188 | icsdfhja 189 | xpzehvzj 190 | uvtrnszo 191 | osvspebk 192 | ltcphnbb 193 | idqrtgnl 194 | daexnzud 195 | jhijuube 196 | svtzbxiy 197 | ttclvagz 198 | nuwmycor 199 | zqxkvwyz 200 | icjtqjyf 201 | xghgksmm 202 | xqcewwhu 203 | powxnedd 204 | jkmivqua 205 | wqgzmvma 206 | jbppcqsu 207 | ksiydveu 208 | yocbpyol 209 | rvhtmomj 210 | yyuzffas 211 | eddydubc 212 | ydkhqqyk 213 | cnxcfvdu 214 | oiordwav 215 | mmpbydxw 216 | qqsvoqbs 217 | wkmzqece 218 | nnmmhiat 219 | fngnjese 220 | sgxusxdl 221 | eolpfmfa 222 | sqxxblfc 223 | spdissrw 224 | nxbfvtph 225 | pnqyfpul 226 | cfkmmzdg 227 | gawnheoa 228 | mpjzbbet 229 | gmvdurol 230 | guhxkkgw 231 | hnyqcolp 232 | bdpehanj 233 | wfnefrhb 234 | mmiibcoo 235 | jlovegph 236 | lrmsqjcw 237 | wpstvfwy 238 | lpkhrgeq 239 | luntklzw 240 | tiumpbgb 241 | cvokibyc 242 | hctoulij 243 | eyftcljk 244 | exrluedr 245 | wdfqasbw 246 | vedplmwu 247 | ekilmgfv 248 | ypvfgryn 249 | ipcdamoh 250 | dfnokvhw 251 | bmozidav 252 | xbslddhp 253 | nycwbgru 254 | rvededdo 255 | hswdfgqx 256 | gpdzteci 257 | owousdhj 258 | tgyzmpth 259 | bkznquey 260 | jedrsywg 261 | nuugqlsn 262 | llbukwdi 263 | xdeubqth 264 | turyyenh 265 | nxpiiksp 266 | ykbgoipa 267 | abpoqvxl 268 | agdrgmln 269 | umitveuz 270 | zwloekza 271 | spkbbgzn 272 | zguzeqvm 273 | mgxkxide 274 | lwdysuzc 275 | tfpatjqm 276 | ubeutdgt 277 | ndjgiwon 278 | ahdgulyx 279 | maxenvqc 280 | qpqxktrw 281 | weypzerx 282 | rbwkpyuo 283 | irqpgynl 284 | mwlqjtuc 285 | avxmbbdg 286 | oirrkxpq 287 | zfkfafaw 288 | kvklomjj 289 | vluzeasr 290 | frzaapuz 291 | lsdqpcyp 292 | ueknwyhf 293 | wzsocbzl 294 | nzadmnii 295 | dgnjpnge 296 | sfkibbue 297 | acecuwoc 298 | clalamqd 299 | cobgspon 300 | hmfnykwc 301 | hqevztnf 302 | ryuuyhpu 303 | giyxlwrc 304 | nlhhmvjm 305 | rpmcbuky 306 | btsqkepi 307 | pauxvbpr 308 | vzykivly 309 | zuuriflr 310 | pmkrtyrj 311 | qxlawhkv 312 | bqvxmpav 313 | ouosojqo 314 | lndxqxfs 315 | mrqjrngc 316 | emooedpn 317 | ivflajhy 318 | xnbmahii 319 | gtwooutx 320 | uvzwttzm 321 | ejrzloec 322 | kctajqbz 323 | uenccclt 324 | aodirzov 325 | krsdjxqj 326 | vmejhntu 327 | odlayeci 328 | bdavpyed 329 | objgfkpo 330 | yzpnbnrr 331 | qlvejkpy 332 | unwoddgl 333 | qrtiuloq 334 | erotscja 335 | kpyenovk 336 | tzrrmzfo 337 | tliqgpye 338 | uhmyccwq 339 | cjdhqmcg 340 | jhtugcok 341 | jffgfowo 342 | holaphiq 343 | qekjkrcr 344 | pcnnoyjp 345 | zvaktygd 346 | guzduqfg 347 | wmfchihu 348 | qlhwnneb 349 | usaluaek 350 | cqcylrke 351 | udjhigre 352 | iyimvuxf 353 | evafupbe 354 | prntrzvd 355 | cmvftuxh 356 | llkoglec 357 | iyoickxi 358 | awqroppq 359 | krdytrns 360 | vkkedshc 361 | shpqzlnp 362 | ojuxtltf 363 | kbcnqrnm 364 | heiwqdqs 365 | dzehifny 366 | akgpeqkd 367 | gnfouufc 368 | vyxsztli 369 | rvgkdibl 370 | zojbkins 371 | jnstmkij 372 | afbtggpx 373 | mtmbecfg 374 | dnzvjrsm 375 | yajgnvmu 376 | dyqnqfmr 377 | sbahwpmh 378 | fgbkdjnh 379 | mnmvkhvf 380 | kbmdcuql 381 | gaohjaft 382 | qacakvcu 383 | mlehgmwe 384 | nrilzcfa 385 | bswyroxy 386 | vgakiwqe 387 | obinkfqn 388 | duyackwn 389 | hhpspxao 390 | qnvgyapl 391 | fuzxonju 392 | yvphteip 393 | qfsnymnc 394 | gayzkffc 395 | alakggqh 396 | pajdfyzs 397 | zhpkouem 398 | cwbqckrf 399 | bkgtozdv 400 | xaumkiwb 401 | rjstrrbx 402 | suaocaka 403 | extsqbny 404 | alcznjdp 405 | kcxxmbiq 406 | sodwraub 407 | docboheb 408 | cdxjzeya 409 | ftezsbxr 410 | twwcgfql 411 | rtltgsir 412 | itpiedtb 413 | ggaqsrhw 414 | kdteswtv 415 | pazbsvbv 416 | axjueucy 417 | edfxyrrg 418 | xkfuawjw 419 | itqavzvi 420 | hpdmicmx 421 | ruucdsmm 422 | wpriitbf 423 | tezkyhnb 424 | yfiaqvbn 425 | hjsmozvq 426 | vvsvphbg 427 | ohpjzecu 428 | eibyfmdd 429 | thvhoqnj 430 | yhgixopm 431 | xkglnhpd 432 | tbecxhjz 433 | fsjfyjwp 434 | mwzjcoxy 435 | pihrpjbg 436 | ojldbwrr 437 | ifrxhgcj 438 | xkxitmzy 439 | wnpohuab 440 | cyneijcx 441 | noctwmyx 442 | omawhzda 443 | wkkhemkj 444 | mfcabriz 445 | tjfacjik 446 | tzenywvk 447 | kwrsxnik 448 | gtqvpilj 449 | dkqsblst 450 | cxnybijm 451 | hilnakro 452 | vupnzfia 453 | dgkxtyiz 454 | agalxoro 455 | rmtowfjd 456 | vgqfrbhr 457 | seofdqhz 458 | hbeyives 459 | ulxunkmw 460 | lfugxmkt 461 | caibcuce 462 | iimsvqpo 463 | nfcozowh 464 | scvtejmt 465 | phmuwlmb 466 | scvcjxav 467 | fxuhxada 468 | dexysoxf 469 | xjwnzaah 470 | kkrydchm 471 | zrbcgyxn 472 | eofrefkq 473 | bqxxthyh 474 | bqyqwmlv 475 | xpxfxisl 476 | vhrcvpuj 477 | jyjqizcx 478 | hcfgwvas 479 | aitkfzot 480 | zipwvris 481 | sztcwguq 482 | jahcgtqi 483 | fjwgziey 484 | wtnjeqox 485 | hxhnvdlu 486 | kmbrqajt 487 | unibvhfi 488 | lmguidsf 489 | giezpahv 490 | aexdytdm 491 | tcoucgvd 492 | zukcsxtd 493 | qywerfti 494 | fnftvlxf 495 | ckllemmi 496 | zehxlsaz 497 | zhedjqiy 498 | wsfhnyuj 499 | ctkdsqei 500 | pdmwuaeg 501 | yzrzgleq 502 | khwfzkvg 503 | ubbwlnzc 504 | qdbxxijq 505 | mymfvzdm 506 | ffipwzgc 507 | dwipnitg 508 | biqopxyv 509 | yqdwdfeu 510 | yxlvllst 511 | muybllpo 512 | ddjwlnmd 513 | fobmohyk 514 | waocltef 515 | roumjxyn 516 | xulclsfd 517 | grjcxkrt 518 | dwbgddkm 519 | yznuwcmb 520 | tshunsyk 521 | oittkhwe 522 | lgejeyvr 523 | stjyynym 524 | fjbvovgp 525 | kpvtxwls 526 | iylihzks 527 | wbbsgnjc 528 | kizladxp 529 | dgduzzlo 530 | yggpskje 531 | irgsvgjp 532 | zuaefwzj 533 | wtupmoxh 534 | qxzmztiz 535 | wyaqfjkx 536 | bbgkuxkq 537 | xgjazutt 538 | owgsbndh 539 | wdzvosgf 540 | zmfirshf 541 | jwymywsn 542 | qqhgempm 543 | njmfupvb 544 | bnnfxtlj 545 | ehgdaopj 546 | hmrxxhzo 547 | bliahood 548 | vqkxxtyg 549 | yeyvyhoa 550 | gmvlocas 551 | gbeziglc 552 | duysrprv 553 | johqaajw 554 | stojgglb 555 | hjgwdsqo 556 | dznpwsqb 557 | ahtpdtea 558 | mpskyezf 559 | iuggygcw 560 | lsgimtud 561 | xcpkmpzd 562 | bbgchwfe 563 | lzeelacc 564 | vluhtffm 565 | yvyxjkns 566 | owlligxq 567 | bckjrbvt 568 | wvrpjlwh 569 | wuphirjh 570 | jwmmadpo 571 | wbowswqv 572 | cqbtacco 573 | -------------------------------------------------------------------------------- /inputs/input8.txt: -------------------------------------------------------------------------------- 1 | rect 1x1 2 | rotate row y=0 by 7 3 | rect 1x1 4 | rotate row y=0 by 5 5 | rect 1x1 6 | rotate row y=0 by 5 7 | rect 1x1 8 | rotate row y=0 by 2 9 | rect 1x1 10 | rotate row y=0 by 3 11 | rect 1x1 12 | rotate row y=0 by 5 13 | rect 1x1 14 | rotate row y=0 by 3 15 | rect 1x1 16 | rotate row y=0 by 2 17 | rect 1x1 18 | rotate row y=0 by 3 19 | rect 2x1 20 | rotate row y=0 by 7 21 | rect 6x1 22 | rotate row y=0 by 3 23 | rect 2x1 24 | rotate row y=0 by 2 25 | rect 1x2 26 | rotate row y=1 by 10 27 | rotate row y=0 by 3 28 | rotate column x=0 by 1 29 | rect 2x1 30 | rotate column x=20 by 1 31 | rotate column x=15 by 1 32 | rotate column x=5 by 1 33 | rotate row y=1 by 5 34 | rotate row y=0 by 2 35 | rect 1x2 36 | rotate row y=0 by 5 37 | rotate column x=0 by 1 38 | rect 4x1 39 | rotate row y=2 by 15 40 | rotate row y=0 by 5 41 | rotate column x=0 by 1 42 | rect 4x1 43 | rotate row y=2 by 5 44 | rotate row y=0 by 5 45 | rotate column x=0 by 1 46 | rect 4x1 47 | rotate row y=2 by 10 48 | rotate row y=0 by 10 49 | rotate column x=8 by 1 50 | rotate column x=5 by 1 51 | rotate column x=0 by 1 52 | rect 9x1 53 | rotate column x=27 by 1 54 | rotate row y=0 by 5 55 | rotate column x=0 by 1 56 | rect 4x1 57 | rotate column x=42 by 1 58 | rotate column x=40 by 1 59 | rotate column x=22 by 1 60 | rotate column x=17 by 1 61 | rotate column x=12 by 1 62 | rotate column x=7 by 1 63 | rotate column x=2 by 1 64 | rotate row y=3 by 10 65 | rotate row y=2 by 5 66 | rotate row y=1 by 3 67 | rotate row y=0 by 10 68 | rect 1x4 69 | rotate column x=37 by 2 70 | rotate row y=3 by 18 71 | rotate row y=2 by 30 72 | rotate row y=1 by 7 73 | rotate row y=0 by 2 74 | rotate column x=13 by 3 75 | rotate column x=12 by 1 76 | rotate column x=10 by 1 77 | rotate column x=7 by 1 78 | rotate column x=6 by 3 79 | rotate column x=5 by 1 80 | rotate column x=3 by 3 81 | rotate column x=2 by 1 82 | rotate column x=0 by 1 83 | rect 14x1 84 | rotate column x=38 by 3 85 | rotate row y=3 by 12 86 | rotate row y=2 by 10 87 | rotate row y=0 by 10 88 | rotate column x=7 by 1 89 | rotate column x=5 by 1 90 | rotate column x=2 by 1 91 | rotate column x=0 by 1 92 | rect 9x1 93 | rotate row y=4 by 20 94 | rotate row y=3 by 25 95 | rotate row y=2 by 10 96 | rotate row y=0 by 15 97 | rotate column x=12 by 1 98 | rotate column x=10 by 1 99 | rotate column x=8 by 3 100 | rotate column x=7 by 1 101 | rotate column x=5 by 1 102 | rotate column x=3 by 3 103 | rotate column x=2 by 1 104 | rotate column x=0 by 1 105 | rect 14x1 106 | rotate column x=34 by 1 107 | rotate row y=1 by 45 108 | rotate column x=47 by 1 109 | rotate column x=42 by 1 110 | rotate column x=19 by 1 111 | rotate column x=9 by 2 112 | rotate row y=4 by 7 113 | rotate row y=3 by 20 114 | rotate row y=0 by 7 115 | rotate column x=5 by 1 116 | rotate column x=3 by 1 117 | rotate column x=2 by 1 118 | rotate column x=0 by 1 119 | rect 6x1 120 | rotate row y=4 by 8 121 | rotate row y=3 by 5 122 | rotate row y=1 by 5 123 | rotate column x=5 by 1 124 | rotate column x=4 by 1 125 | rotate column x=3 by 2 126 | rotate column x=2 by 1 127 | rotate column x=1 by 3 128 | rotate column x=0 by 1 129 | rect 6x1 130 | rotate column x=36 by 3 131 | rotate column x=25 by 3 132 | rotate column x=18 by 3 133 | rotate column x=11 by 3 134 | rotate column x=3 by 4 135 | rotate row y=4 by 5 136 | rotate row y=3 by 5 137 | rotate row y=2 by 8 138 | rotate row y=1 by 8 139 | rotate row y=0 by 3 140 | rotate column x=3 by 4 141 | rotate column x=0 by 4 142 | rect 4x4 143 | rotate row y=4 by 10 144 | rotate row y=3 by 20 145 | rotate row y=1 by 10 146 | rotate row y=0 by 10 147 | rotate column x=8 by 1 148 | rotate column x=7 by 1 149 | rotate column x=6 by 1 150 | rotate column x=5 by 1 151 | rotate column x=3 by 1 152 | rotate column x=2 by 1 153 | rotate column x=1 by 1 154 | rotate column x=0 by 1 155 | rect 9x1 156 | rotate row y=0 by 40 157 | rotate column x=44 by 1 158 | rotate column x=35 by 5 159 | rotate column x=18 by 5 160 | rotate column x=15 by 3 161 | rotate column x=10 by 5 162 | rotate row y=5 by 15 163 | rotate row y=4 by 10 164 | rotate row y=3 by 40 165 | rotate row y=2 by 20 166 | rotate row y=1 by 45 167 | rotate row y=0 by 35 168 | rotate column x=48 by 1 169 | rotate column x=47 by 5 170 | rotate column x=46 by 5 171 | rotate column x=45 by 1 172 | rotate column x=43 by 1 173 | rotate column x=40 by 1 174 | rotate column x=38 by 2 175 | rotate column x=37 by 3 176 | rotate column x=36 by 2 177 | rotate column x=32 by 2 178 | rotate column x=31 by 2 179 | rotate column x=28 by 1 180 | rotate column x=23 by 3 181 | rotate column x=22 by 3 182 | rotate column x=21 by 5 183 | rotate column x=20 by 1 184 | rotate column x=18 by 1 185 | rotate column x=17 by 3 186 | rotate column x=13 by 1 187 | rotate column x=10 by 1 188 | rotate column x=8 by 1 189 | rotate column x=7 by 5 190 | rotate column x=6 by 5 191 | rotate column x=5 by 1 192 | rotate column x=3 by 5 193 | rotate column x=2 by 5 194 | rotate column x=1 by 5 195 | -------------------------------------------------------------------------------- /inputs/input9.txt: -------------------------------------------------------------------------------- 1 | (121x14)(7x7)UOBCTWD(24x1)KBBJJRCFNOTNFFCKJOFGWJZT(12x6)(7x3)CKJUMES(47x12)(2x3)IY(4x12)JSFP(12x13)FDTYFDWLHWXE(5x11)XLPGL(2x7)EK(113x4)(7x2)LTVKCEC(75x4)(22x8)XBUQNQXMZPOAACRFZACRVP(2x2)HV(33x10)HTJYEBCTFDFRIXRIUBWJJXFDNGBIVATET(14x6)(8x10)IGIWGAFX(102x2)(34x6)(6x14)AEVIDQ(8x10)BSMUYCJH(3x9)CQH(2x8)RC(33x4)(19x3)CPFEVGBWGTXAVXRBGPB(3x7)UDY(10x6)VMWBUOTFKL(349x6)(5x6)GZJZB(70x1)(3x11)JEL(13x6)TAKTWPYEOKXNW(2x1)JH(7x12)JGYKSGB(15x14)BBWIZVLZCTAVPQZ(56x4)(7x8)DITERGP(19x11)QHUEFNLLGAPSGBUERXM(11x10)XNAJVEWBNKK(67x10)(10x9)NLJNVBTKYM(13x9)CHUZLFTGZHHVQ(7x13)TQXJQNB(12x13)YTMWUHSNSVTZ(120x9)(10x3)GBAYFDGZQY(3x3)HLY(66x12)CZOGABFCFJVWGRBIRSUYRNZIBKYSAMKBMDDHMIFUKNQXXRZCPKTOSEEPIUOSNWASFL(11x1)FUJVJTMDHYF(1x6)Y(97x3)(91x5)(15x3)QIOHSIYFOFKMOVR(7x14)ZOJZFUL(9x2)SLKMEGOIT(9x8)WTSYWBDVB(22x15)VJOWEEJVZEDJZHXFMMFJGN(144x6)(18x15)YSOSIDNVRKTMWVTUIR(54x11)(30x7)WJMCXFQRIHVATBGUGBSNIBACCIZLDG(6x13)PGAEOU(1x4)M(52x1)(31x6)HYVTZLRQMOOTDMVNTHCWNKFZAYCSQDH(3x1)QQE(1x13)L(79x15)(3x15)IQI(8x4)(2x14)MJ(44x9)(1x13)V(9x15)JYDFLMSFM(8x7)DUSANCRL(3x15)DOI(2x5)GS(147x3)(8x9)MSJOZXRZ(41x10)(10x3)HBIUVPYOFY(8x9)UQEDFXWT(6x11)UIUAZE(11x8)CEBVPEYTVRL(63x2)(9x8)JUXYTSTDQ(7x1)KGXPMHC(7x1)BGCLZRI(12x8)UORTKYVYSXLA(2x1)AS(45x5)(38x13)(8x6)MFOJKOZQ(7x15)IJQIBPC(1x7)G(1x7)D(9x13)LFUYNWIXV(229x6)(6x15)QVZPFF(89x11)(29x11)XGWPJUJRATUJIUDSLVLEFIZGYPTRR(2x7)SF(5x6)YNESL(30x6)HUFRTOKJTJHJTDMPEPSSABHRXFVRIO(114x9)(3x11)VIX(12x4)STJTDQNVYIXT(14x8)TSOQFREGDHTUQQ(18x3)SJGFDEXKAJRYGQOMFH(36x13)JMVZCRLSAWLVQVCUYLOCRFJPZCSERWTFBXFP(3814x13)(38x6)KCXWJCALVQUEFCIKOALALSWMVFIESMMPSMNQAX(466x10)(459x7)(6x15)KKUJXQ(269x4)(140x3)(2x15)MZ(8x7)CSWFLUNG(74x12)(9x9)YJCQSVNOZ(4x13)XPBE(10x13)SMUGHEJULA(27x5)JVKTVTMERNTWSWWVTGGVLXJEROH(18x4)(12x3)KEYEMKAWQGVH(9x1)VZOQEDQIE(109x1)(33x13)TWTVQLOCYDQNNDWJFQEQGBXHWXRNQDCHA(3x8)TYE(40x15)(15x7)HSMPJHLPWLJXDER(13x5)NQPINIKIHMOKO(3x8)AOO(1x8)R(1x8)J(163x13)(7x11)PALPTMS(142x12)(90x5)(12x8)DEFZASIKPPFQ(5x5)BITJH(10x11)EMZCZAQLEP(1x13)X(31x15)JWCDSINOGRNKIBKIFHFZLRXGNSAAKDR(2x2)IP(17x7)BBADYLQPAIFUMEHQF(10x3)(4x13)UNPM(2547x14)(1582x6)(171x15)(5x7)QGBQE(15x5)BJBAVPZIREQQPQB(85x9)(8x11)BLPDYKFE(26x11)(3x11)ZJV(4x14)OWVX(2x6)SZ(32x4)(9x6)ISYMZALQX(12x4)LVSIEBNWGKXY(43x1)(12x7)MVESNOTEVGHU(6x13)(1x2)R(7x11)EJLJPEC(338x11)(111x3)(4x4)XOGF(13x15)(7x14)BOGERKD(76x2)(34x11)IBXWTZTGKHVIKHJLUKWRLBDDZMEMWGTBXM(18x10)LIOCEHZYYGEQCFVCTO(5x9)NUQES(83x14)(77x3)(4x10)IVPI(1x8)Q(15x15)EVBXNJWFADWAMPJ(15x14)NEJGHYLWAMYQFRZ(10x12)WSLXPORPOK(84x14)(2x15)UI(2x4)HJ(7x4)(2x8)PS(44x5)(8x3)NSSLXQCC(4x13)OKKT(14x13)NGFKAHTJPDKWIT(2x1)NV(14x7)MIVPVOYSJLQVVQ(13x2)(8x7)WZRWGDQB(289x7)(191x2)(33x4)(10x2)EMQXNCJNCO(10x11)FEFLAKJYDY(11x12)XJJJYHETAJG(1x4)S(121x8)(2x13)DX(1x8)P(68x8)XZSHJIRKVIUFYAXDMEFBWNLSKFWXGSVRPBZQSBETBRDAMXKBJYXUGUBLMTLYJSIFFALT(17x1)KDZERNMMSGTYHOSDG(5x3)ELXYV(13x7)DUJFZQVHTLGLX(5x5)BSSPA(45x13)(8x8)(2x15)IQ(26x7)(1x9)F(14x3)MIVVMBTQPFJIHR(5x8)AHCMX(345x9)(17x2)(10x10)ERNQLSNKFZ(193x5)(151x4)(4x8)IWVW(44x3)CMHSZBZXRRNJZMFPQQEDHKEFJUGCSFURIGSFBQRGKGWV(3x7)PLK(59x15)OKACOKQHSCRHLIHMJAIGWRXGHTKSJOBJDSRQXATSPQNGEFRMQCUJNFXRIEH(11x14)TJGIYWOKPQJ(29x1)LSZTUQPVMFIMUIAHOBGIHNNYAADTO(102x9)(14x14)JBNBEKQBJUJCUF(15x3)(1x1)L(3x14)NLZ(10x14)LWUIBZBSMP(11x15)(5x10)SMKOZ(18x12)BIXUYNRSKGCFCDUYMR(7x10)RQDUWBR(401x14)(156x13)(19x1)YIHAILDJTRIQRGOJLXG(50x3)(16x3)IUSNUKLYPRYVPQBS(12x9)YRWCMTSRLLHE(4x10)PGVI(22x5)TFRNDARBWQVDBNEAAFWFNC(11x12)CVTPWLLKOOL(22x13)(15x11)MZIXMUTZNSTCPGH(51x15)(11x5)YZCZIVXNDQB(28x4)(1x7)Y(15x14)FTWOCQZSLYVAUUO(151x14)(59x11)(1x5)V(29x9)PLRFQAYNGSFNPVYKBEROCOGAIWSIC(12x1)ILEJWRNOOBNG(13x14)BGUFJIUCSIHCW(6x4)(1x1)Z(48x6)(14x6)HVZAHRPHBXJWCR(8x14)FFKVJJOZ(9x7)DPYJRKZME(1x1)O(9x5)ITNZNTTRD(313x1)(306x9)(27x8)(21x1)NKKBLUJCWKWVBJYSRUKFF(192x11)(26x14)(9x3)OGJHUBJYO(6x13)YUFAFB(15x9)(2x15)CC(1x15)A(53x1)(9x12)APARACDIC(2x15)CZ(3x11)UMU(5x10)UAFTC(5x5)RWTLW(8x14)(2x14)NR(59x6)(16x14)WEODWYCZMJOZBTDL(12x9)YHFTSACYAOEZ(12x8)PXVAKYHBRBQN(15x1)VQBOISACGXREBRL(46x2)(2x5)HY(33x7)(3x8)WIR(19x7)RCQIINYDJENBXGQELIC(630x3)(171x10)(164x6)(59x12)(11x15)JLMMVVVNCEV(7x6)OWHQFSO(23x9)BCOOQXWVYIECJTMXJZDBYVM(17x15)YMSGKTAVHEZIRIUIZ(68x6)(22x14)HLRCOAKRFQYRSQZQFHMQJE(14x11)SNLYWNYADPBEHE(1x5)A(6x13)HHUHAP(358x5)(114x2)(91x12)(6x11)PSRMQZ(49x1)IAEDPAJTIZEINVKOSVQGFPTLAALSSLGZNNYMLBLNSVHTWJOZU(18x2)HKQONHCLXRZQNSGKBY(10x6)PPMSKUOJKW(48x10)(17x14)MUYLPPXTKGDUMVFAQ(8x1)FSSQAOFL(6x8)(1x6)P(175x5)(28x10)(21x10)TKLCLUIWXCDEUMKMNTNUF(86x12)(19x11)LVULVUBMPDFXUSHMBBM(29x11)XKAATTRQGQIKPXKSNFVNSCZETIQKK(7x3)ABUAEVK(7x7)MTGCIQU(8x7)FIXBWVLT(27x11)NLPMPPOXTURBQFEHXURMSOWUYRM(80x6)(11x5)QAQKMJTVYPN(41x7)YOEBXYTFSKHOSHGCDJEFQZCEASOMEEEKCSFBHZPOS(10x3)RZHMEXFUDN(733x9)(725x14)(298x14)(21x11)RTXLUCDMAULBHKRRRPOOM(245x13)(35x11)(28x11)MPRIHQXIHJDMNHUMDTCDKLZQOYCI(94x2)(9x8)UNVRXCHMX(12x13)CYZXSFSTPECP(2x4)MB(39x9)VVUSANHXSMBRJRBVTVWYQDTJYCLKGHJNPVWWLTX(3x15)AQJ(28x8)(8x4)XBGRPRSJ(3x15)EPG(1x4)H(62x14)(10x2)QPMGYINDSL(4x4)RVRF(12x15)SJAIITIEDXBQ(2x10)JN(4x10)UJRL(11x4)OWVZMZXQQKR(412x5)(31x5)QGENJZBCZZYLWLUKVBIXBTOVXBFLDDR(198x6)(55x7)(3x10)VLP(13x7)DASUKXFZYHYFD(12x15)DPKYAHHLAGQO(2x11)XE(1x10)U(64x2)(5x7)ZYZSI(5x6)QTOBX(16x7)TQQTBJAMYWCBHEJI(16x4)VKXZCOVHVNHIZZCR(37x8)(11x10)VPCGSDYKQDG(6x13)CJFBZL(2x4)MO(10x14)(5x5)OJSLW(17x7)FONWGSEWWFHTWSPVY(139x14)(67x2)(1x11)D(8x11)EICRPDWX(6x6)XEDJJO(22x11)LCQEXSQJXLJBFWUZNVIBJC(1x1)O(38x4)(1x2)Y(25x13)LLKSCNFMECFYSKHKVPEKPZYIB(1x13)O(1x13)G(2x10)QF(2562x14)(1571x3)(468x6)(96x6)(10x6)LUESGTHJJA(74x8)(21x3)PWXPCBEPXJYKMVKKEGPFD(6x5)TVOHPC(30x9)(9x9)AYHADEJXJ(2x14)AO(2x14)PN(35x14)(6x12)ZZFJQZ(5x12)OHAQQ(6x11)YKBISO(8x2)EIPJZHDG(304x5)(39x10)(10x13)(5x2)LQORD(15x15)XDEXORXICVWUGSN(7x15)SFXPZOM(53x4)(2x10)OC(1x10)F(19x1)(2x15)YQ(6x8)COLDMS(8x8)HXSEYMKO(6x1)DKDIPI(167x14)(26x15)OTWTPOFAZSGUVVSMPNJTMNFMOQ(26x14)(10x13)FKRRLIWOJG(4x4)EBSF(46x13)(1x4)H(3x4)CNI(15x5)KJOSTHMKVAGCVZN(6x8)WHTWXN(15x2)(1x6)B(4x1)JKZJ(20x14)CVQVWGGEQAPAVYUINYMT(992x13)(113x7)(1x12)A(10x14)YAQTSUWTBH(82x11)(16x5)(1x11)Q(3x15)YTI(5x7)QBGLP(2x1)SN(5x6)NZQFB(26x12)(12x8)KOLBSMJYLORF(3x2)ITA(45x14)QZYNVSNZKZAWNKYLBXVSYQOUGMKENYEWSJXEMNZTRKCYV(285x7)(180x3)(4x9)RMIS(60x6)(4x13)XPFG(6x6)SMNIRN(2x13)DG(8x2)SMPLMMPV(11x12)PIWPFDAPQFW(76x1)(7x12)OZWCKLU(15x9)BXDUCLPQJMJKFYI(26x7)BHYMOVJSDRFJGSVUERSSPIDYNZ(4x14)HXPC(7x6)NAUGDVY(6x6)(1x1)N(41x7)(35x1)(13x4)GIBSMRXLBHXMQ(4x8)HLGW(2x9)VL(44x12)(19x3)(13x6)HGDRDZTZWFCOM(12x10)VUMRKYBCCQKK(38x3)(32x7)EAJAVUFHHNTLJHQRYGFLBPQPTQOPGDHJ(477x6)(11x10)EASJUDGHGIQ(64x14)(1x14)P(17x15)MWZLZXQVTKEWJBKEG(26x10)(2x12)RH(11x15)LKTIDOFODPS(59x1)(25x4)(18x12)KPTXMQURPBJQXPHHQG(3x7)FJN(13x13)PIDKAQJGMVJSY(169x11)(40x1)(2x4)GU(27x4)BQWCHKUABSVXMYUCWOFXYTFFAIB(22x13)(3x5)YEW(9x2)GKDFZYWAN(1x6)U(11x15)XUKVKXAFHWG(63x10)(19x11)HOSZGVSACEQZADDKVUS(3x11)DCG(4x8)MJOD(6x12)ULSQDI(2x8)EJ(138x10)(61x2)(6x14)XVWQGD(2x10)VO(15x10)CPFENGQAVHQFWMX(5x2)ISJBM(4x3)FNKU(42x10)(16x1)SONQFTFROIPCEMRD(3x2)UYG(7x6)QKQRSBV(15x13)YAWXKSEOQJMEWFW(6x10)VMKSJU(78x8)(23x7)(16x11)YVPCEYZHBKEYQPBD(35x7)ITTJCWQYAAGZKSATUEXYBUHJUDBDFRGPRGH(3x5)QLB(976x4)(21x8)QRSXSFTJCFNYEHXPRGEZE(568x11)(160x12)(20x12)(14x6)CQRYPIHJJXQIKF(68x13)(5x10)ITMHR(50x10)(22x2)RRFAUCXOOWQLABCRBWTWMO(15x14)RGTLKSIJJCKQFJK(51x13)(45x6)(20x7)MMULQRJWTLHXLBVIDRUV(6x11)GPQXLE(2x2)OF(376x5)(48x9)(42x6)(1x4)H(11x3)WZXNMZYSPKI(13x1)AGLFYRNPCRRLS(145x15)(57x4)(6x12)QKUJTG(11x9)RVYVQSIMZFA(5x11)ZOIVD(3x2)ANM(3x14)SHF(64x6)(11x9)QOBUETQZPLZ(10x7)RBRLWYJKRR(10x10)USWNTUBEFI(9x2)DKQICFUFR(7x5)ZYBPAJN(2x11)PT(153x14)(106x2)(8x2)RIIEBGUC(2x1)LE(32x13)JLJJMUPIVWLUVKYMBWNTHPZEFEIYVHRD(11x2)DMMENSENTDV(24x6)VAOMHJKMQLFUALEHHBFKMXAC(33x11)(4x9)AUHC(3x14)QZY(3x2)ARD(1x14)E(1x5)J(6x1)(1x5)Z(366x3)(103x15)(7x9)SGVEJFH(21x9)(6x9)KYUVCR(5x5)SYERM(57x15)(1x5)Z(3x13)EZF(36x7)ASOOFSPGHJATZMKPRJHZXUQJNGIHLLVWYSNR(248x8)(48x4)(42x7)KWYCXJUEVOJSWCMQKFSNGTBUGZRXSVMSOPCUIQDXRP(187x3)(69x2)(13x9)HAVBOORXAKSYP(44x7)PZUUAUKZVUOBXFZXMFCEPIGATEOZSDPYHIESRFEHNGVY(4x15)UWPD(73x11)(5x2)HGADA(12x1)RHOAWENSZZTA(14x8)NTMXJWMIUOGDJL(19x1)VORKIUXSKQPJBELYMOD(1x10)G(9x11)(4x2)LLLX(8690x3)(2886x11)(12x4)OHNKGOWHPCJO(836x7)(492x8)(221x1)(1x1)J(80x3)(4x3)LOFS(34x3)CLJBMLOZCJUPPUKIJDTUCJPXYGHVUSKJEA(5x3)RKMOG(6x7)UAJBHS(4x14)MTLF(94x13)(34x10)SWCZCKOXDHTIXXKJBZKTPDYMPYYSYXHDCZ(1x15)F(11x1)NNZSBPKCQQF(22x14)PRAAJLKDQNOQYELVWTTOYI(21x15)YNXEYIUMNMLCOGSBFVJCZ(5x9)DBENV(23x12)(4x8)OJJW(9x4)VGLSNMVSK(88x4)(1x1)W(56x13)(4x9)RMAH(19x2)YNGLYVRHYKUOVPHPXWV(8x2)IRWPNUWD(4x1)MVYO(12x13)UUOYUSHMUNTJ(123x5)(2x9)CA(55x10)(9x7)GFLAEPFME(1x15)R(15x6)BPCLXTLMVPXZVBM(7x10)BEACYMN(25x10)VNSYEYWBFUXDAFPLQKQGRIEUP(16x3)(10x7)OGQTVNSCQJ(304x14)(2x8)OB(35x1)(29x4)(2x11)OA(4x6)NTGO(7x8)WBCFXBR(197x1)(43x15)(1x7)R(4x15)FCDL(4x7)ZEPG(2x14)ND(5x4)BHKPL(27x14)VWJALNSVFBOTREUGEDIAWDNQCXJ(10x13)ZNNYLXYQQC(60x13)(7x2)VVTLGHO(12x12)LZKPNQUKIDLA(2x6)KO(7x15)PHGFMZN(4x3)MUUZ(22x10)RALNVJOWBMSWALEZXYJODD(46x6)(40x2)(5x4)KMIGF(11x6)TNQNTBDKBOX(8x2)QWKUGGTV(12x3)IDUHNFBVRBKR(2x4)UA(1037x12)(248x8)(86x11)(9x6)BAVTZRNSG(1x10)Y(7x8)CKWDNZN(47x7)(2x15)FK(12x8)AJGUYSPEBESU(4x6)PKDK(6x13)ZSPAUY(24x9)CETFUQGOUTTGHYMPZVXIGAJV(4x15)OYYL(7x6)AJBLZJM(97x3)(29x2)(6x4)VZQWYD(11x14)VOYXUVOQWCD(9x13)YUBMBRTII(14x8)GHEXKOQOBJBRJT(1x7)K(14x11)XSHFTCTVFUCVJJ(53x8)(25x3)(19x3)(8x5)ASODNQQB(1x1)S(15x13)CVJVAXRMPCDJFHS(332x11)(261x13)(34x7)SCTKLXCLXTTLIXLFTZSTIRZCWIUPWBBALX(82x8)(76x7)MOEXJEMFFEYVTSOOMXOKBIDALNTSSUQMWSEOATKASDDIYHBYQACEYXQQPOQJGKJWPAZROYTROLFL(13x8)TCUAAWMDGQNFY(107x1)(14x5)ESCCCRHQRJULET(4x12)LMVV(11x1)IXEYAQBKILH(34x7)XWVQPGDGUDHMQPDSYONILRQBHDULUSOTAJ(14x3)KLULTDEEWHOBOG(8x9)KGFSCTFW(43x11)(11x8)JFJAVRPYXOQ(11x15)FYFLSUKGXMV(3x5)VAV(33x7)(27x4)HBSOBXKNNKOUPVXYJNPHZXIUUZD(337x7)(75x3)(49x4)(11x5)MQYCIGICRLC(6x13)PLUVDB(5x10)APMHV(4x3)VRRZ(13x13)TSFVLHEYQBHMX(5x14)HXMKC(113x6)(62x10)(12x13)QCKLNLPAIHCL(21x9)QQYWXUGWGTDTNQPRZPPSO(10x6)DLHJDDMKOC(38x8)(11x10)ZWQPIDBDYDA(13x14)CLUIPLTASJZUW(118x4)(99x3)(5x13)SPKAH(2x7)KJ(1x9)C(38x7)RJQEDASMKIHWFQGRISULMKWQATIWGMGEWIERZN(24x14)NQBOARVFHPINJKBNBZPUCMCA(8x2)RMACHLHP(971x10)(473x12)(185x10)(56x15)(2x12)XN(1x7)W(8x3)QLJLAHVT(5x8)SNLXB(13x5)JRNTZGDRRSTGS(85x1)(24x12)JCEQWAMTUKGEEUCIRNAUONZY(2x7)FB(6x2)JIAFDF(1x14)Y(22x15)SYQJBZWLULCZGXQBIXWEXU(14x15)LJIHVCTFYCVXZI(5x5)WKPTV(116x6)(88x3)(12x4)IGIJTXWVXVSY(7x1)RDXTUNO(27x1)YPCXJWIQODMQDELMWTTNWIMCINE(6x15)IBMPOO(7x15)HOBYALC(16x2)(10x8)UNLKLIAMGV(17x8)(11x7)PKTQZXQXBIE(127x5)(6x8)(1x1)O(108x13)(1x13)J(39x15)FONPLNOFZKVMKHZCHURDIKKONYANGHORUFSMDOR(13x6)PWOZVGVQKERQG(5x13)KGURZ(19x7)XSJBWWXDFSRZDKZPNLB(360x10)(20x2)(13x14)ZQJVRVVUYJCBZ(238x12)(37x10)(1x12)K(24x2)FHAFIMPOAZESIBYVAXPGBUTW(82x12)(33x8)QYXMEQVJMQXLQYWWPNHCOUJJEDUTNGYFI(3x15)BOR(2x1)QM(12x14)AQCSSRFWHBOF(3x3)GXE(3x13)ZVT(69x6)(35x14)TXXIPRDYVGPEWISZTNDLIKKUVCINQZZYBFW(12x13)CPQWTNVDXIYU(3x4)RTD(14x10)DIXIBEGCKXWITE(19x6)(13x2)(8x8)IYFONIBC(57x7)(7x3)OKZYROZ(29x9)(1x4)H(16x13)XAUDMPFOOHQQNFLQ(4x13)AOYY(4x2)AZIL(105x10)(11x2)(6x9)LVRPSK(82x2)(75x10)(5x15)TWXII(4x13)NBFA(23x8)WTIAZKNCMEDELQGVJTRTSIW(18x14)JYPHKJXMBMTKNVDIFY(1246x9)(296x12)(288x15)(1x11)X(85x6)(44x13)FIDKWHDICHUVUDMODAKOJSXLCMADLIOLGJMXWAMVGXET(2x2)UZ(9x14)GNMFAAUCK(6x14)LAJLUQ(175x5)(71x3)(22x4)TYBWJYBYQPWRAMHOWGCFYT(9x11)PMUMIMCTT(21x13)SERALXEDNWQQSIDHWAHTR(6x7)OADDZK(12x14)HSSYRJSSEJNM(26x11)DOITPGVHNQDUUVJALPKLABSRYD(29x1)(16x13)LVJVXDSUYSXCAUNN(1x5)O(3x1)EIV(935x3)(213x15)(205x14)(8x8)ZGWLVEBU(79x9)(1x8)G(6x15)ODCZBV(2x12)AE(26x12)FAFELTFITHRDSWIJNQZNEANNNI(14x2)KKFWBKASKPMZVE(47x2)(2x9)XM(33x12)QUZGKPWJGACFJOJOEBWDCOZZHGYXXINZB(33x8)(5x7)ZRLND(10x8)XKWYOQCKZJ(1x15)V(9x12)FIBMTMPPT(160x15)(4x13)YMWG(103x8)(3x11)KEI(54x10)(3x9)IXN(3x2)XJB(6x9)PGRCJA(20x14)BPKWKMEFTLVHDHSXXLYK(27x8)(21x8)ZHHNJXANHCBOEQFRLAKVD(34x8)(2x9)UK(5x11)OZPYC(3x6)FXS(3x8)MGU(261x4)(168x10)(49x12)(19x15)EWVPCLLSDLTYKSEGFQK(7x4)IJIVBBZ(6x8)GIXRLH(64x9)(7x8)SCLLWIL(30x9)CVHGTEYWLCRCBSEUSMFJSRJGHIVQAC(10x3)QCZQYXQVZD(36x6)(5x6)SYZKV(4x1)DWGK(4x10)QFJT(1x14)O(6x4)(1x5)X(68x9)(24x7)(18x3)YAUIGICZMOUKSIVCGC(32x8)(5x3)HTDQE(1x12)W(9x12)JAWQJCADZ(10x12)(4x11)UJTO(254x6)(63x10)(7x9)(2x3)GM(13x13)FVKLGYEOBUPOW(12x11)NSMLJLULKEGH(6x10)(1x9)H(33x4)(18x9)OHMWHAJABMZKULYOEK(3x15)BUX(16x8)PKYIAESTCHGSEWQM(110x4)(21x8)LRZUEPWJLGJYXBQZNNHPU(15x1)JTFTDQSQNQVOMIJ(9x11)DQIIJRNHA(41x9)NFEYJFFHOXACMVYCDLFJECVPMMPNXAJOFDVPXNKEC(1x4)X(2358x13)(272x13)(8x6)KAWCAEHF(252x4)(244x12)(5x1)OIKMW(49x4)(3x9)LYP(23x15)RNLNXMWYDAQPADKUKRVQGGG(6x9)MKMWZJ(71x5)(29x10)ZWQHLBGBXYGIBFGCWEOAZEKGHELGA(6x2)QJFAJQ(1x12)S(10x10)XIEXWQZUYZ(68x12)(1x14)C(7x5)OFSZHNK(2x3)MC(25x4)ZMOWIEJKUWMUITAUZFQQYFOLR(6x8)SJMPEW(21x4)(7x2)ANYNJSI(4x9)LPCS(171x12)(163x12)(96x6)(10x12)(5x2)JDTNM(8x10)(3x6)ADM(26x7)NFZFYOJAXPHUDPRFTLCODKNEOK(26x14)(20x6)WRKSJWUTPLLNNFQQXWVH(55x8)(6x10)NCCMOK(37x4)(9x13)VQQWGSQZA(15x10)CYVLMGVMBGUIANE(681x3)(674x8)(8x10)HRTGQPCC(133x6)(31x13)(15x8)NWUGLHRUNHGPAOV(5x6)TQRSZ(6x1)RDGSYT(77x11)(5x10)QTBHC(7x11)TZKXJMQ(7x15)UVAACKT(12x5)KRSRGCXTDZHK(16x4)HGYETSOYMLUVJYGY(202x6)(5x6)KLUPN(76x7)(3x9)VEA(1x1)H(30x11)LRZGAKKVSTTUDAHFPLTBBEJICAFFEO(2x1)HV(12x6)LFXQMIVZBMHF(102x11)(18x10)MQTKCXRJJXHPTQAPPI(5x3)QOUYU(23x1)BTXQMDXLDVMEKDRIYEYIBBF(23x10)BUGYWDRCNUJGXGBLTAUCALP(3x6)QZA(209x12)(6x6)OGZHQE(1x11)F(90x6)(20x8)RDVUIHWTSGTHNUJGYWWA(15x10)DXBAJLLRYLEPHOV(2x14)DL(17x14)TNPMAPPAANAGXYFWC(5x8)JMGEU(89x6)(2x6)JV(7x2)FRSANFT(32x7)MDWGSNIKZHSISGBZMWBLBBYXWKQXVPSX(9x13)YCIAZHCKY(11x5)LCEXGEUIEKF(87x14)(8x1)ZYQIUGHT(3x6)YDJ(32x4)(8x11)FQBHHWUT(2x4)NG(6x4)JXTVJA(10x8)VVCIUXRXHX(7x6)RGUAUAX(692x14)(685x3)(246x2)(6x8)TMNCSQ(72x5)(8x6)MIYYHQZX(15x14)HUZIJDZHEGYLMDU(31x3)WOWNQHYXJPXJBHVUSXQEXQPEGPROKNT(150x2)(22x3)ONCOUFKAWWGNBYEGGNCHAQ(42x9)JAQIEVGMLLNQYJSFAMYRHOIMBTFJETPWRSILRLZWMX(35x1)MYXVOMTYEEWNLBWABMQPDZFBWHDIMNROCBZ(7x1)UAKSLVG(14x12)VGFBJMZEBNHVWK(99x9)(71x13)(17x3)JKCYOLRUNSOVAVIBA(15x1)DUYZCYFWQOOVHBV(8x4)IZEYFWWX(8x15)UWCPFKIC(3x14)IOD(7x1)JRMPLMI(143x2)(15x13)HLQHFYKIBVLPXFX(56x11)(2x14)PC(41x11)BYRRFHJDICKJQFLOTDZOIIZZLMJDCJEBBDYKAAMHC(1x13)W(2x13)NV(36x13)(3x6)LZS(6x2)CFBDVS(11x5)PHLFEIYJEEV(170x6)(57x13)(1x12)G(8x8)AXLLSTXR(17x14)VCRBNKDPJTWTXFQDB(8x9)KBAHWEDY(99x12)(9x6)FSHOKCYTB(27x13)VHEROMAPXWHCAPUIHNSVZXMKZOH(25x12)YWVMMYVVONNLGNVJVVIEKASTL(12x10)ZSYMCPQTCMXJ(504x6)(400x3)(65x4)(33x13)(10x9)ADLIBLHAQK(11x9)FMZKUHXIKFO(18x12)(12x6)BLCMESDBDGDD(322x4)(55x12)(6x5)TMKASY(2x14)PR(29x13)BLMIBIQPOOLAVQMTWVZMAJBWROFLE(63x5)(7x2)SAFAIKV(12x15)MFISPDJSUYEA(26x1)BLOSXQWSDRTAOIDJUAGEXNIIML(112x4)(23x12)FUADKATPYIUTEJGPTYRFESH(24x5)ZIQIOFUMHEHJQRAPXPDWPJYH(8x6)WKFNUWSZ(32x14)AUYKXCXARLOPZGZPNKXRAOEYYWSMURHM(57x9)(26x1)QPTYYTSPPLZWOLPRWHVRDCRGFS(12x9)ZGXOFEKTLYPZ(1x14)V(3x13)LQD(90x10)(17x14)(11x5)WFOJVNTMHZL(19x15)PAAGJWZMJVSIEUEYNOA(5x11)XIAEV(23x4)WVQCIVERHVPBOGHUMQVCYJM(735x8)(483x9)(284x3)(234x8)(35x8)YEWFQJWTEXJYHWMPJIIUSGVIOPSSLTPCDLW(113x13)(16x8)ZNAWQIUYOBZCEPUM(31x10)QVFRMVCMYXMFKYMOPIEBHWBCUOBJVDC(9x8)EKCEILZNV(3x1)QMF(24x13)LJYZGSGBFZBEGARESLOTMTRS(66x4)(2x3)SA(29x12)QSJFSJZJCFBKONFRUUPHCGUDYCPHZ(17x7)MGKDSBWTEZGURJGMW(37x6)(14x12)(9x6)EIOPXGIZG(10x6)PUCSZAASUQ(21x2)(14x12)PHXVVACWZVPTIL(158x4)(1x9)V(144x10)(101x13)(40x10)CLBELLVQQILKUMTPOFIESWVYXWFQWTHJCKNTWLXP(2x5)BF(2x14)SW(14x10)EHPHIAMTYUFFJU(12x3)RKJBECVYTCVU(9x10)YHHLXJXKW(13x13)SJNGVLVCZZVED(237x15)(230x5)(157x6)(8x14)WZDXWFHT(78x2)(6x12)DUYUOX(5x15)SRAXP(6x9)YXRCEO(22x10)VOIEHZVVTDTRMQHIXTVDMK(9x14)YSSNMUPPI(39x8)(4x14)YDPZ(23x4)BTCCELKTTPSNXIYBIJASXXC(9x3)XBJGXGOMK(16x11)IPDBZSBXCKLQDAZP(19x5)(13x4)CNYVIXGKUXYTV(12x1)(6x10)(1x6)T(1424x9)(7x8)(2x8)KY(4x8)EZTY(524x5)(191x11)(102x2)(44x12)ORBEOWRRYMIAHYLIQDUNBVFLBHSARXZBTXVWRINMTVXE(27x15)(5x15)ETFEI(1x9)Y(5x3)WYLWN(11x9)LFAXPJYAJDW(76x6)(7x15)GGRPBNB(4x11)WKKQ(47x1)(2x1)VH(12x1)JUDDAINDQXNE(15x11)QBAOIZEUCDEYZTM(21x4)FNOCNAFBJGJSWBAVMYVWH(137x9)(1x14)E(123x3)(54x10)(7x11)UFLDCDM(16x1)SIGCUXXRDHQYKFJN(13x1)TZTFFIZNYPXRP(8x10)TQNUCSXN(7x9)(2x3)JF(11x12)KYFTDULQKUU(12x9)ZQJSUBUHVHGJ(13x14)HMHQSNJNEISIY(126x12)(66x10)(31x9)(9x1)MVABPLVCO(10x10)RTJPWBCIMH(3x3)HZL(1x12)H(9x4)SQKEWFAMR(47x3)(40x11)HRSJIGBPQITBKLGIFFKVXTENMPRYKFULYSGQLVBN(160x10)(126x6)(40x3)(15x3)(2x2)CD(2x10)FQ(13x4)CROEBXVKGSNHW(7x1)SQEPRZB(10x7)(5x4)XBVPH(46x6)(40x9)(9x3)WMCGCUDOE(19x10)FVLUAQBAXBJCQGGMEFE(8x4)(3x7)HBK(8x14)(2x13)EL(696x13)(439x10)(16x13)VROSJKEMQPZMYNXT(162x14)(68x5)(17x1)VOOKELBWVADZIVGPF(38x12)MCTKRBQUJBESBXTMUTRVTWCDKGDLVQHVHNVIQY(2x11)GX(3x13)ESQ(52x9)(14x2)NNNDEPJFZSJIZO(1x11)F(4x5)LFLH(2x11)HZ(3x1)ZXY(8x1)(2x10)HH(53x10)(19x8)HOXXPKRGYIBALYFNIEP(3x5)GGP(14x4)NGWFVQIRSWFOCY(165x15)(10x12)YCTAAUVNVF(7x15)(2x1)LT(7x11)FQQPYCC(39x3)FCDZABZAXAUQAFPDCJHAMRMIMXOHABIZAZHCMFS(71x6)(1x12)B(8x1)PTCODCVX(26x2)CJRGSDPMRCCILJURRDKEIMTFVK(13x6)SGMDPBEXKCOQN(8x4)(3x5)TJC(242x3)(229x4)(71x10)(17x6)HBOLREXQQYLXULRIZ(35x3)PPENPYEDAAOOFMWZJOFRKUPNKRCDMECCLFA(1x13)B(20x14)(8x5)ULYDIAHS(1x10)Z(97x9)(1x4)K(21x7)QAKCRIDADKTQEVCZEDDWM(13x9)BZANWBJAHBNBD(30x4)BNQKAHQQDURPKRYZSYEQPMRUXFJINA(3x13)PZJ(15x5)(1x6)D(4x2)NHPI(1x8)ESZ(223x1)(42x5)(6x5)ACPDPC(8x11)MBKNDKCD(10x13)JDHAIFXADH(47x1)(41x4)QDJLJWSRORPHUBHGTPUYBVFSSIEOYHUHZKASZTGCN(10x13)(4x10)LABA(92x8)(12x15)DJFIFECKWSST(20x7)YLXFIEMQMWPCWPMWRDRF(10x1)JEPPKBYGMD(12x7)MXAXOCOGEFOO(7x14)NIAQHAK(1x15)D(79x1)(17x2)(4x14)PVLT(2x5)LE(49x11)(16x9)TFPAVPXVGPGIPDFJ(2x4)WQ(14x7)IYVKVVHCOYGDVO 2 | -------------------------------------------------------------------------------- /lib/AsmProg.hs: -------------------------------------------------------------------------------- 1 | {-# Language BangPatterns, TemplateHaskell #-} 2 | module AsmProg where 3 | 4 | import Control.Lens 5 | import Control.Monad.State 6 | import Common 7 | import Text.Megaparsec 8 | import Text.Megaparsec.Char 9 | 10 | data Registers = Registers { _regA, _regB, _regC, _regD :: {-# UNPACK #-} !Int } 11 | deriving (Read, Show, Eq, Ord) 12 | 13 | makeLenses ''Registers 14 | 15 | zeroRegisters :: Registers 16 | zeroRegisters = Registers 0 0 0 0 17 | 18 | class HasRegisters a where 19 | reg :: Functor f => Register -> LensLike' f a Int 20 | 21 | data Register = A|B|C|D 22 | deriving (Show, Eq, Ord) 23 | 24 | instance HasRegisters Registers where 25 | reg A = regA 26 | reg B = regB 27 | reg C = regC 28 | reg D = regD 29 | {-# INLINE reg #-} 30 | 31 | data Value = Num !Int | Reg !Register 32 | deriving Show 33 | 34 | rval :: (MonadState r m, HasRegisters r) => Value -> m Int 35 | rval v = 36 | case v of 37 | Num i -> return i 38 | Reg r -> use (reg r) 39 | {-# INLINE rval #-} 40 | 41 | pValue :: Parser Value 42 | pValue = Num <$> number <|> Reg <$> pReg 43 | 44 | pReg :: Parser Register 45 | pReg = choice 46 | [ A <$ char 'a' 47 | , B <$ char 'b' 48 | , C <$ char 'c' 49 | , D <$ char 'd' ] 50 | -------------------------------------------------------------------------------- /lib/Common.hs: -------------------------------------------------------------------------------- 1 | {-# Language BangPatterns #-} 2 | module Common where 3 | 4 | import Control.Monad.State 5 | import System.Environment 6 | import Text.Megaparsec 7 | import Text.Megaparsec.Char 8 | import Text.Megaparsec.Char.Lexer (decimal) 9 | import Data.Void 10 | 11 | type Parser = Parsec Void String 12 | 13 | readInputFile :: Int -> IO String 14 | readInputFile n = 15 | do args <- getArgs 16 | name <- case args of 17 | [] -> return ("inputs/input" ++ show n ++ ".txt") 18 | [arg] -> return arg 19 | _ -> fail "Too many arguments" 20 | readFile name 21 | 22 | count :: (a -> Bool) -> [a] -> Int 23 | count p xs = length (filter p xs) 24 | 25 | parseOrDie :: Parser a -> String -> a 26 | parseOrDie p str = 27 | case parse p str str of 28 | Left e -> error (errorBundlePretty e) 29 | Right xs -> xs 30 | 31 | parseLines :: Parser a -> String -> [a] 32 | parseLines p = parseOrDie (many (p <* eol) <* eof) 33 | 34 | number :: Num a => Parser a 35 | number = 36 | char '-' *> (negate <$> number) <|> 37 | fromInteger <$> decimal 38 | {-# SPECIALIZE number :: Parser Int #-} 39 | {-# SPECIALIZE number :: Parser Integer #-} 40 | 41 | bracketed :: Parser a -> Parser a 42 | bracketed = between (char '[') (char ']') 43 | 44 | parenthesized :: Parser a -> Parser a 45 | parenthesized = between (char '(') (char ')') 46 | 47 | wholestring :: String -> Parser String 48 | wholestring = try . string 49 | 50 | strictState :: MonadState s m => m a -> m a 51 | strictState m = do !_ <- get; m 52 | {-# INLINE strictState #-} 53 | -------------------------------------------------------------------------------- /lib/GridCoord.hs: -------------------------------------------------------------------------------- 1 | module GridCoord where 2 | 3 | import GHC.Arr 4 | import Data.Foldable 5 | import Control.Monad 6 | import qualified Data.Array as Array 7 | import Data.Array as Array 8 | 9 | data Coord = Coord !Int !Int 10 | deriving (Read, Show, Ord, Eq) 11 | 12 | cardinalNeighbors :: Coord -> [Coord] 13 | cardinalNeighbors (Coord x y) = 14 | [ Coord (x+1) y 15 | , Coord (x-1) y 16 | , Coord x (y+1) 17 | , Coord x (y-1) 18 | ] 19 | 20 | origin :: Coord 21 | origin = Coord 0 0 22 | 23 | manhattanDistance :: Coord -> Coord -> Int 24 | manhattanDistance (Coord x y) (Coord u v) = abs (x-u) + abs (y-v) 25 | {-# INLINE manhattanDistance #-} 26 | 27 | instance Ix Coord where 28 | range (Coord loX loY, Coord hiX hiY) 29 | = [ Coord x y | x <- [loX..hiX], y <- [loY..hiY] ] 30 | inRange (Coord loX loY, Coord hiX hiY) (Coord x y) 31 | = loX <= x && x <= hiX && loY <= y && y <= hiY 32 | unsafeIndex (Coord loX loY, Coord hiX hiY) (Coord x y) 33 | = (x - loX) + (y - loY) * (hiX - loX + 1) 34 | 35 | coordArray :: a -> [(Coord, a)] -> Array Coord a 36 | coordArray def xs = 37 | accumArray (\_ new -> new) def (minB, maxB) xs 38 | where 39 | minB = foldl' (liftCoord2 min) (Coord 0 0) (map fst xs) 40 | maxB = foldl' (liftCoord2 max) (Coord (-1) (-1)) (map fst xs) 41 | 42 | indexArray :: (Ix i, MonadPlus m) => Array i a -> i -> m a 43 | indexArray a i 44 | | inRange (bounds a) i = return $! unsafeAt a (unsafeIndex (bounds a) i) 45 | | otherwise = mzero 46 | {-# INLINE indexArray #-} 47 | 48 | liftCoord2 :: (Int -> Int -> Int) -> Coord -> Coord -> Coord 49 | liftCoord2 f (Coord x y) (Coord u v) = Coord (f x u) (f y v) 50 | -------------------------------------------------------------------------------- /lib/Search.hs: -------------------------------------------------------------------------------- 1 | module Search where 2 | 3 | import Data.Foldable 4 | import Data.Set ( Set ) 5 | import Data.IntSet ( IntSet ) 6 | import Data.IntMap ( IntMap ) 7 | import qualified Data.Set as Set 8 | import qualified Data.IntSet as IntSet 9 | import qualified Data.IntMap as IntMap 10 | 11 | {-# INLINE dfs #-} 12 | dfs :: Ord a => (a -> [a]) -> a -> [a] 13 | dfs next start = aux start (const []) Set.empty 14 | where 15 | aux x rest seen 16 | | Set.member x seen = rest seen 17 | | otherwise = x : foldr aux rest (next x) (Set.insert x seen) 18 | 19 | {-# INLINE bfs #-} 20 | bfs :: Ord a => (a -> [a]) -> a -> [a] 21 | bfs = bfsOn id 22 | 23 | {-# INLINE [0] bfsOn #-} 24 | bfsOn :: Ord b => (a -> b) -> (a -> [a]) -> a -> [a] 25 | bfsOn rep next start = aux Set.empty [start] [] 26 | where 27 | aux _ [] [] = [] 28 | aux seen [] ys = aux seen (reverse ys) [] 29 | aux seen (x:xs) ys 30 | | Set.member r seen = aux seen xs ys 31 | | otherwise = x : aux (Set.insert r seen) xs (next x ++ ys) 32 | where r = rep x 33 | 34 | {-# RULES "bfsOn/Int" bfsOn = bfsOnInt #-} 35 | {-# INLINE bfsOnInt #-} 36 | bfsOnInt :: (a -> Int) -> (a -> [a]) -> a -> [a] 37 | bfsOnInt rep next start = aux IntSet.empty [start] [] 38 | where 39 | aux _ [] [] = [] 40 | aux seen [] ys = aux seen (reverse ys) [] 41 | aux seen (x:xs) ys 42 | | IntSet.member x' seen = aux seen xs ys 43 | | otherwise = x : aux (IntSet.insert x' seen) xs (next x ++ ys) 44 | where 45 | x' = rep x 46 | 47 | {-# INLINE astar #-} 48 | astar :: Ord a => (a -> [(a,Int,Int)]) -> a -> [(a,Int)] 49 | astar = astarOn id 50 | 51 | {-# INLINE astarOn #-} 52 | astarOn :: Ord b => (a -> b) -> (a -> [(a,Int,Int)]) -> a -> [(a,Int)] 53 | astarOn rep nexts start = go Set.empty (IntMap.singleton 0 [(0,start)]) 54 | where 55 | 56 | go seen work = 57 | case pqueueNext work of 58 | Nothing -> [] 59 | Just ((cost,x),work1) 60 | | Set.member r seen -> go seen work1 61 | | otherwise -> (x,cost) : go seen' work2 62 | where 63 | r = rep x 64 | seen' = Set.insert r seen 65 | work2 = foldl' addWork work1 (nexts x) 66 | addWork w (x',stepcost,heuristic) = 67 | let cost' = cost + stepcost 68 | in cost' `seq` 69 | pqueuePush (cost' + heuristic) (cost', x') w 70 | 71 | pqueuePush :: Int -> a -> IntMap [a] -> IntMap [a] 72 | pqueuePush k v = IntMap.alter aux k 73 | where 74 | aux Nothing = Just [v] 75 | aux (Just vs) = Just (v:vs) 76 | 77 | pqueueNext :: IntMap [a] -> Maybe (a,IntMap [a]) 78 | pqueueNext q = 79 | do ((k,xs),q1) <- IntMap.minViewWithKey q 80 | case xs of 81 | [] -> error "Malformed queue" 82 | [x] -> Just (x,q1) 83 | x:xs -> let q2 = IntMap.insert k xs q1 84 | in q2 `seq` Just (x,q2) 85 | -------------------------------------------------------------------------------- /lib/SmallBitSet.hs: -------------------------------------------------------------------------------- 1 | module SmallBitSet where 2 | 3 | import Prelude hiding (null) 4 | import Data.Foldable (foldl') 5 | import Data.Bits 6 | 7 | newtype SmallBitSet = SmallBitSet { setRep :: Int } 8 | deriving (Eq, Ord) 9 | 10 | instance Show SmallBitSet where 11 | showsPrec p x = showParen (11 >= p) 12 | $ showString "fromList " 13 | . shows (toList x) 14 | 15 | {-# INLINE null #-} 16 | null :: SmallBitSet -> Bool 17 | null (SmallBitSet x) = x == 0 18 | 19 | toList :: SmallBitSet -> [Int] 20 | toList (SmallBitSet x) = [ i | i <- [0..finiteBitSize x - 1 - countLeadingZeros x], testBit x i ] 21 | 22 | fromList :: [Int] -> SmallBitSet 23 | fromList xs = SmallBitSet (foldl' setBit 0 xs) 24 | 25 | {-# INLINE member #-} 26 | member :: Int -> SmallBitSet -> Bool 27 | member i (SmallBitSet x) = testBit x i 28 | 29 | {-# INLINE insert #-} 30 | insert :: Int -> SmallBitSet -> SmallBitSet 31 | insert i (SmallBitSet x) = SmallBitSet (setBit x i) 32 | 33 | {-# INLINE delete #-} 34 | delete :: Int -> SmallBitSet -> SmallBitSet 35 | delete i (SmallBitSet x) = SmallBitSet (clearBit x i) 36 | 37 | {-# INLINE difference #-} 38 | difference :: SmallBitSet -> SmallBitSet -> SmallBitSet 39 | difference (SmallBitSet x) (SmallBitSet y) = 40 | SmallBitSet (x .&. complement y) 41 | 42 | {-# INLINE (\\) #-} 43 | (\\) :: SmallBitSet -> SmallBitSet -> SmallBitSet 44 | (\\) = difference 45 | 46 | infix 5 \\ 47 | 48 | {-# INLINE intersection #-} 49 | intersection :: SmallBitSet -> SmallBitSet -> SmallBitSet 50 | intersection (SmallBitSet x) (SmallBitSet y) = SmallBitSet (x .&. y) 51 | 52 | {-# INLINE union #-} 53 | union :: SmallBitSet -> SmallBitSet -> SmallBitSet 54 | union (SmallBitSet x) (SmallBitSet y) = SmallBitSet (x .|. y) 55 | 56 | {-# INLINE singleton #-} 57 | singleton :: Int -> SmallBitSet 58 | singleton i = SmallBitSet (bit i) 59 | 60 | {-# INLINE empty #-} 61 | empty :: SmallBitSet 62 | empty = SmallBitSet 0 63 | -------------------------------------------------------------------------------- /lib/UnboxFunctions.hs: -------------------------------------------------------------------------------- 1 | 2 | {-# Language MagicHash, FunctionalDependencies, TypeInType #-} 3 | module UnboxFunctions where 4 | 5 | import GHC.Prim 6 | import GHC.Types 7 | 8 | class Unbox (b :: Type) (u :: TYPE k) | b -> u where 9 | unbox :: (b -> a) -> u -> a 10 | ($#) :: (u -> a) -> b -> a 11 | 12 | infixr 0 $# 13 | 14 | instance Unbox Int Int# where 15 | unbox = \f i -> f (I# i) 16 | ($#) = \f (I# i) -> f i 17 | {-# INLINE unbox #-} 18 | {-# INLINE ($#) #-} 19 | 20 | instance Unbox Word Word# where 21 | unbox = \f i -> f (W# i) 22 | ($#) = \f (W# i) -> f i 23 | {-# INLINE unbox #-} 24 | {-# INLINE ($#) #-} 25 | --------------------------------------------------------------------------------