Just for reference, all this stuff:
> arr = x in pairs;
> if (arr is null) {
> pairs[x] = new int[0];
> arr = x in pairs;
> }
> *arr ~= y;
Can be replaced with just:
pairs[x] ~= y;
Because arrays in D are structs, not referenced objects.
Bye,
bearophile