GPA (especially those in the basic sci years) is fairly low on the criteria of what will get you a residency - this is not the factor that will carry the day. Forget what was important in undergrad -- those days are over. A decent step 1 score and good LORs and rotation evaluations will get you into many of these. As others have said, most schools have different formulations of P/F type grades, and some have no grades in the basic science years, so GPA is impossible to compare for schools anyhow. Class rank is thus more important but only marginally so. The point of doing well in the first two years is because that same material will appear on Step 1, and will be less to review.
Research can perhaps help too. IM (cardiology), EM and gen surgery are not usually described as as competitive as radiology, which is the only one in that list you would traditionally label as "competitive". (It is one of the "ROAD" specialties), although surgery has become more popular of late, perhaps related to the passage of the 80 hour limit.
Best to get into med school, do your best, whatever that is, and see what you enjoy. In third year, you need to decide -- do you want to do surgery or nonsurgery, adults or kids, hands on with patients or not. There are various decision trees, and they are not necessarilly as much stat driven as driven by what you are interested in. Most of the people who don't go into things like surgery do so because they don't want to do surgery, not because they don't have the numbers.