First, this depends on your school/your intelligence/the course you're in. There will be some courses a monkey could pass and some where a significant number of students are worried about not repeating. There will be that guy in your class who can watch TV all day, drink every night, and still get an 80 minimum on every test while others while work 60 hr weeks to pull 70s. Some schools (mine) have essentially a 0% fail out rate while others fail 5% or on rare occasion even 10% of their matriculants over a 4 year period. So any estimates are necessarily going to be an average. That being said...
On average: Maybe 30 hrs/week, including those hours cramming towards the end.
With a reasonable margin of safety: 40-50 hrs/ week. Just barely passing on average means failing a significant percentage of your courses, and your goal is not to fail any. If you're determined to do the very least possible I'd say your best bet would be to study reasonably hard for the first test or two in a course, and then dial down the effort after you've goten a couple of 80s and only need a 55 average on everything that's left. Of course, some schools have started to realize students are doing this and have changed to a 1 test per course system whenever feasible. Basically the fewer tests per course the more you're going to need to study to maintan a reasonable margin of safety.
But remember: Your first two years are basically a big long prep course for your step one. It's perfectly possibly to pass all your classes, but then to fail the test because you didn't retain enough. Now most schools (maybe all in the US) will let you retake a failed step 1, but that just basically means that you're going to make up all that studying you didn't do in a very condensed period of incredible misery. And at the end of it you're still going to have a score/match that no one envies.
Finally: rather than P = MD, it might be more accurate to think
P = FP. Which is fine if you end up wanting to be an FP but you're really not going to know what you're going to want to do at the start of your first year
Good summary as to how screwing around can affect you down the line:
http://www.studentdoctor.net/pandabearmd/2006/03/17/the-residency-match-part-1/