Implement an in-memory key/value store that could support lightweight state for a Substack publishing workflow. Build the store without using Python's built-in dictionary for storing entries.
Your implementation must use a fixed-size bucket array and separate chaining to resolve hash collisions.
Create a KeyValueStore class with these methods:
put(key, value): Insert or replace the integer value associated with a non-empty string key.get(key): Return the associated value, or None if the key does not exist.delete(key): Remove the key and return True if it existed, otherwise return False.contains(key): Return whether the key exists.For automated testing, implement run_operations(operations, capacity) that creates a store and executes operations. Each operation is an array such as ["put", "draft-1", 42], ["get", "draft-1"], ["delete", "draft-1"], or ["contains", "draft-1"]. Return results only for get, delete, and contains, in execution order.
def run_operations(operations, capacity):