Your best bet at modeling this in anydice is to define the rolled dice from C as variables and then write a function to remove those variables from the A and B sets to find your end result. To find the non-eliminated dice from Pool B use the defined variables from C and store any non-removed dice based on that information to output when the function ends. —
Sandwich 18 mins ago