Task: Text to Code
Input (English): Step 1: For each row in Lives_in table, find corresponding rows in Student table and in Dorm table.
Step 2: find the number of rows in the results of step 1 whose gender equals M and Sex equals F
Output (English): SELECT Count ( * ) FROM Student AS T1 JOIN Dorm AS T2 JOIN Lives_in AS T3 ON T1.StuID = T3.stuid AND T3.dormid = T2.dormid WHERE T2.gender = "M" AND T1.Sex = "F"