Implement a custom data structure or algorithm to solve a specific resource-allocation problem under tight memory constraints.
Use a single bitset-style representation to manage capacity contiguous resource slots. Implement allocation using first-fit placement and support releasing previously allocated ranges.
Implement def allocate_resources(capacity, operations):. Each operation is ['allocate', size] or ['release', start, size]. Return the starting index for every allocation, or -1 when no contiguous block is available. Release operations produce no output.
def allocate_resources(capacity, operations):