For the MSCA mobility rule, it is the actual location of residence that is taken into account, i.e. the country where you used to live.

So, in the “Declaration on place of activity / residence in the last three years” you must mention Country A (place of main activity) and not Country B (legal residence).