I think there is plenty of good advice above. I have been to Huaraz twice and was pretty paranoid about what I ate and drank- I still had gastrointestinal illness both times. First, I would definitely get a hepatitis A and typhoid vaccine. I believe my second illness was typhoid which is quite a bit worse than typical traveler's diarrhea. I almost always ordered bottled water "con gas"- carbonated just in case someone was tempted to put tap water into bottles. The ceviche is quite good there but keep in mind it has raw fish "cooked" with lime juice- I waited until I was done with my climbs until I ate ceviche. I bring cipro with me but I would also recommend against taking it prophylactically as it can cause side effects (the tendonitis is quite rare but it can cause diarrhea- in the states it is a frequent cause of clostridium difficile diarrhea which can be quite severe and even life threatening). For minor diarrhea I would take imodium but if I had a fever I would not hesitate to take cipro. I think it is a good idea to avoid raw foods/ fruits. I think it would be very hard to guess which restaurants are "safer" than others- keep in mind that locals are immune to the bugs such as e. coli that cause most traveler's diarrhea so eating with the locals is probably not any safer or more dangerous than eating at a gringo place like Cafe Andino. As someone echoed above, the corn from the street vendors is really good but save it for the end of the trip.
I think that gastrointestinal illness and altitude are the biggest issues that can ruin a trip there. We did some medical clinics in the Huayhuash and in some villages they literally crap right into the streams (the outhouses are built right over the streams) so you can imagine that the water quality downstream is not very good.