Modify code based on updated requirements.
Implement apply_updates(records, updates) to apply ordered upsert and delete operations. Each record is [identifier, value]; each update is a dictionary with op, id, and, for upserts, value. Existing records keep their position when updated, new records are appended, and deleting a missing identifier has no effect. Return a new list without mutating the input records.
Signature: def apply_updates(records, updates):
def apply_updates(records, updates):