Implement Stack using Arrays.
Asked in the Round 1 stage. Implement a fixed-capacity stack backed by an array. The function receives a capacity and a sequence of operations, then returns one result for each operation.
operations contains ("push", value), ("pop",), ("peek",), and ("is_empty",) commands. A successful push returns true; a push on a full stack returns false. pop and peek return the relevant integer, or null when the stack is empty. is_empty returns a boolean.
def stack_operations(capacity, operations):