Dancer Pairs
A Jane Street puzzle: fifteen dancers stand in an equilateral-triangle formation, each unit-distant from their nearest neighbours. Each dancer pairs up with one neighbour; all but one are part of a pair. How many distinct sets of seven pairs are possible?
A graph-theoretic backtracking algorithm enumerates all valid pairings; using frozensets to deduplicate, we find there are exactly 240 ways to pair the dancers. The PDF contains the adjacency-graph construction, the backtracking function, and sample visualisations of six pairings.