Disclosed are Pyrido [2, 3-B] pyrazine and [1, 8] -naphthyridine derivatives represented by formula (I), or pharmaceutically acceptable salts thereof. Also disclosed is the use of the said compounds for treating ALK or c-Met mediated disorders or conditions.