Implement a stack or a queue (It can be done using an array or a linked list).
Choose a stack implementation and process a sequence of operations, ensuring push, pop, peek, and size each run in O(1) time. The input is an array of operation arrays, and the output contains results for every non-push operation, with null returned for pop or peek on an empty stack. For example, [["push", 4], ["push", 9], ["pop"], ["size"]] returns [9, 1]; 1 <= operations.length <= 10^5, and pushed values are integers.
def process_stack(operations):