Write a function to optimize resource allocation in an embedded system.
Given a list of tasks, where each task has a resource cost and benefit, and a fixed resource budget, select each task at most once to maximize total benefit. Return the selected task indices in ascending order. If multiple allocations have the same benefit, any optimal allocation is valid.
Signature: def optimize_allocation(tasks, budget):
tasks is a list of [cost, benefit] pairs. Return a list of indices. Costs are positive integers, benefits are non-negative integers, and the budget is non-negative.
Examples: tasks = [[2, 6], [3, 7], [4, 9]], budget = 5 returns [0, 1]. tasks = [[3, 8], [2, 5], [2, 5]], budget = 4 returns [1, 2].
Constraints: 1 <= len(tasks) <= 500, 0 <= budget <= 10,000, and 1 <= cost <= budget.
def optimize_allocation(tasks, budget):