Minimizing the number of parent rows for a distinct column in a child table
I think i found the solution. On the delete step I put the these two order by clauses in

delete #myResultSet where id &lt;&gt; 
    (
    select top 1 id 
    from #myResultSet t1 
    where #myResultSet.c_enum = t1.c_enum
    order by count(aKey) over(partition by aKey), 
             count(bKey) over(partition by aKey, bKey)
    )


This gives me 10,13,87 which I think is the optimal solution I can get with my data set. 

If I am wrong or there is a better way to do this I am welcome to more answers.