The size of the economy shrank by 9.9% in 2020 as coronavirus restrictions hit output, figures show.