sclass DynamicTopTen {
new LPair list;
int n = 10;
void add(A a, double score) {
put(a, score);
}
void put(A a, double score) {
int i = l(list);
while (i > 0 && list.get(i-1).b < score)
--i;
if (i >= n) ret;
if (l(list) == n) removeLast(list);
list.add(i, pair(a, score));
}
L get() {
ret pairsA(list);
}
LPair withScores() { ret list; }
}