Spec
Implement KVStore in store/kv.py. Contract in the docstring.
This is a well-known take-home and onsite problem. The elegant solution keeps an undo log per open transaction: before the first write to a key inside a transaction, remember its previous value. Rollback replays the top undo log. Keep count O(1) with a value → count map.