Add cache table for team totals for efficiently computing team rank. This is not used anywhere yet.
Use smart rank computation for displaying team row. This can highly improve efficiency in contests with many teams, but the behavior is not completely unchanged. There are two changes:

* The first correct submission per problem is not computed, so the dark-green cells in the table for first-correct per problem are not shown on the team page.
* When a problem for which there are correct submissions is disabled during a contest, the cache is out-of-sync and should be rebuild.