The US economy shrank by 3.5% in 2020 in the sharpest decline since the 1940s, the US Commerce Department said.