Add subfactorial() function to more itertools
Add subfactorial() function to more itertools: a task in repo2rlenv-swe-next (Harbor dataset). The more itertools library provides derangements() for generating all permutations of a sequence where no element appears in its original position. However, there's no direct way to compute the count of…
The task
The `more_itertools` library provides `derangements()` for generating all permutations of a sequence where no element appears in its original position. However, there's no direct way to compute the *count* of such derangements without actually iterating through them all.
Part of FineEnvs/repo2rlenv-swe-next.