  print $ part1 (read timestamp) buses
  print $ part2 buses

splitBy :: Char -> String -> [String]
splitBy _ "" = []
splitBy c (',' : s) = splitBy c s
splitBy c s = let (a, b) = span (/= c) s in a : splitBy c b

part1 :: Int -> [String] -> Int
part1 timestamp buses' = uncurry (*) $ minimum $ zip (map (\b -> b - mod timestamp b) buses) buses
  where
    buses = map read $ filter (/= "x") buses'