data Player = Player Char Int instance Show Player where show (Player name _) = show [name] --Modify the line below if you want to players = cutinto2 $ zipWith Player ['A'..'R'] [76, 122, 90, 105, 117, 78, 84, 111, 124, 71, 77, 118, 117, 78, 106, 89, 114, 81] choose :: [b] -> Int -> [[b]] _ `choose` 0 = [[]] [] `choose` _ = [] (x:xs) `choose` k = (x:) `fmap` (xs `choose` (k-1)) ++ xs `choose` k cutinto2 :: [b] -> [[b]] cutinto2 [x,y] = [[x,y]] cutinto2 (x:y:xs) = [[x,y]] ++ cutinto2 xs value (Player _ x) = x combies = foldr (++) [] (sequence `map` choose players 5) main = do print $ length $ results print results --Modify the line below if you need it where results = filter (\p -> (sum(map value p) <= 500) && (sum(map value p) >= 495) ) combies