3 weeks to make the journey, stopping off along the way? It's pretty rushed but certainly possible. Doing it in one trip would be nightmarish and involve multiple connections.
Most logical route would be through Bolivia. First take for a flight to Corumba, Brazil. Flights can be competitively priced to buses in Brazil, so worth it to save time. Cross the boarder into Bolivia and take the train or bus to Santa Cruz. From there you should consider visiting Sucre, Potosi, Salar de Uyuni (doing the 4 day tour starting in Tupiza if you have time, otherwise start in Uyuni), La Paz and Lake Titicaca (Copacabana, Isla del Sol). From Copacabana there are several onward connections to Cusco via Puno.
Online bus reservations are almost non existent in Bolivia. Best method is to either book at a travel agency for an undisclosed fee, or go to the bus station and book yourself in person. Try to get a look at your bus if possible as standards vary enormously. Bus cama (bigger seats) can be worth it for longer haul trips. Most importantly of all, bring plenty of warm clothes for overnight trips through the Bolivian altiplano. It will be well bellow freezing and the buses don't have heating.
Buses are generally pretty terrible in Bolivia. If your budget permits it's worth considering domestic flights which can be reasonably priced.