T spends more days of a year in Scotland than in any other part of the UK if (and only if) the number of days in the year on which T is in Scotland at the end of the day exceeds each of the following—
the number of days in the year on which T is in England at the end of the day;
the number of days in the year on which T is in Wales at the end of the day;
the number of days in the year on which T is in Northern Ireland at the end of the day.
T is treated as not being in the UK at the end of a day if—
on that day T arrives in the UK as a passenger,
T departs from the UK on the next day, and
during the time between arrival and departure T does not engage in activities which are to a substantial extent unrelated to T's passage through the UK.