Ayacucho to/from Andahuaylas = 10 hours and 25 soles no paved roads at all. Bus company is Los Chankas. Take warm clothes and a good book (and your camera at the ready because the scenery is very beautiful)
Ayacucho to/from Lima = in 2005 you could do most of the distance on the Lima-Cusco bus. You'll have to get off the bus in the middle of nowhere and take a cab/collectivo for the rest of the trip. I think I have read somewhere that there is now a bus lima-Ayacucho so check other tips and search the web/guide books!
Ayacucho used to be somewhat off-the-beaten-path due to the poor road conditions and long travel time. However, via the fully-paved "Via Libertadores" the trip now can be done in about 8 hours by car & a bit more by bus.
By bus, there are numerous lines covering the route daily, but most people travel overnight. You don't see much, but you don't feel you've wasted a day. The buses do sometimes get stopped by highwaymen, but the risk actually is quite small on any trip. As for bus cos., ask around, and go with the more expensive ones, as you get what you pay for --- stuck windows and uncomfortable seats or reclining seats and onboard attendants.
There are also a few-times-a-week flights from Lima and Cusco, but they're usu. not deemed worth the $$ and less reliable as the stops do get cancelled in favor of Cusco passengers.
If you do go by car, there are a few stops that are worth making:
- Leave Lima early and breakfast in Lurin or Pachacama on a chicharron sanwdwich --a local specialty-- or in Chincha with Afro-Peruvian dishes.
- shortly after you start up the mountains, you will find Tambo Colorado, an Inca-period archeological site.
- further up, stop for lunch at Huaytara. Then walk up the hill from the plaza and visit the church which is built atop a rather nicely-preserved Inca temple.
-- you can also stop at Apacheta pass, the highest point on the route and add a stone at the cairn made by travellers over the years. But at over 4700 m above sea level don't go bounding out of the car as if you were still at sea level!
In the other direction, not far outside of Ayacucho there is a trout farm, and nearby restaurants serve freshly-caught trout (at one you can even scoop it out yourself) broiled over a eucalyptus fire. Simply delicious and a great way to start the trip.