Please read below carefully, attending school in US is NOT considered as an exception.
You must accumulate two years of physical presence in Canada in every five-year period. You can also count Canadian residency days if you are outside Canada for an extended period of time for one of the following reasons:
You are accompanying your Canadian-citizen spouse or common-law partner.
You are a child accompanying a Canadian-citizen parent.
You are employed on a full-time basis by a Canadian business, the Public Service of Canada or the public service of a Canadian province.
You are accompanying your permanent resident spouse or common-law partner who is also outside Canada and who is employed on a full-time basis by a Canadian business, the Public Service of Canada or the public service of a Canadian province.
You are a child accompanying a permanent resident parent who is outside Canada and employed on a full-time basis by a Canadian business, the Public Service of Canada or the public service of a Canadian province.