Use a different format for ContestExporter/Importer

The new format isn't "tree-like" anymore but, instead, it's a dictionary
whose values are all exported objects and whose keys are the associated
ID. The ID isn't the one they had in the DB before exportation nor the
one they will have after importation. It's an ID whose scope is just the
one of the exported data, and it's a global ID (unique among all
classes). This allows us to export complex relationships, and not only
trees. Moreover we are able to write a general method that does this for
all classes and all relationships, avoiding the hacks we used, for
example, when exporting submissions.

With this commit ContestExporter doesn't use .export_to_dict() methods
anymore and ContestImporter doesn't use .import_from_dict(). They could
theoretically be removed, it there weren't YamlImporter, ES and Worker
using them (inappropriately).
Fixups for new ContestExporter/Importer format.
More hacky ContestImporter/Exporter fixes.
Fixed potential divide-by-zero that may occur during initialisation of ResourceService
Fixed issue with RunTest where users would not be created because they weren't given an email address
Fixed silly bug that causes infinite loops when divide-by-zeros would otherwise occur
Fixed YamlImporter working with datasets
Merge remote-tracking branch 'origin/taskversions2-importer'
Merge remote-tracking branch 'origin/minor_bug_fixes'