What factors affect the academic performance of undergraduate medical students? The impact of attendance and gender