#ifndef STACK_H #define STACK_H #define STACK_CAPACITY 61 typedef struct { long long items[STACK_CAPACITY]; int count; } Stack; static inline void stack_init(Stack *stack) { stack->count = 0; } static inline int stack_empty(const Stack *stack) { return stack->count == 0; } static inline int stack_size(const Stack *stack) { return stack->count; } static inline int stack_push(Stack *stack, long long value) { if (stack->count == STACK_CAPACITY) return 0; stack->items[stack->count++] = value; return 1; } static inline void stack_pop(Stack *stack) { if (stack_empty(stack)) return; stack->count--; } static inline long long stack_top(const Stack *stack) { return stack->items[stack->count - 1]; } #endif