Question
Count the number of surjective (onto) functions from a set of n distinct elements to a set of k distinct labels — i.e., colorings of n items with exactly k colors where every color is used at least once. Return the count as an exact integer (Python big ints). Constraints: 0 <= n <= 200, 0 <= k <= 200. Use inclusion-exclusion: sum over i of (-1)^i * C(k,i) * (k-i)^n.
count_surjections(n: int, k: int) → int[3,2]out6State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.