The object of the present invention is to provide a compound or a physiologically acceptable salt thereof which has a MGAT inhibitory effect and is useful as a medicament, and a pharmaceutical composition comprising the same. A bicyclic pyrimidine compound of formula (I): wherein R1 is optionally substituted lower alkyl, etc., R2 is hydrogen atom, etc., R3 is hydrogen atom, etc., R4 and R5 are each independently hydrogen atom, etc., X is oxygen atom, etc., Y is -N(R9)C(=Z)- in which R9 is hydrogen atom, etc., Z is oxygen atom, etc., etc., m is 1, n is 2, or a physiologically acceptable salt thereof.