A) as the crow flies
B) the whole 12 months, though the importance is on the 12 months, not the category, so for example: if you lived outside the parish you could stand under the 3 mile rule (say for 20 years), and then move into the parish (6 months ago) under the elector rule, AND all this period would be consecutive.
It would be a perverse rule to disqualify on the basis of moving into the parish if they had stayed out, they would be qualified.
But this should be disclosed on the nomination paperwork to avoid falsely claiming from just one category. In my case I enclosed a map to show <3 miles from a Google Map.
For students, who want to represent in their family home parish: if they have a FORMAL tenancy they can stand, or if they remain an elector for the area they can stand or if they work they can stand otherwise they can't. (And the 12 month rule applies across the categories)
For student who want to stand in their new residence, the 12 month rule applies as normal.