#Japt, 22 bytes Takes input as a 2D-array of integers for the space dimensions and a 1D-array of integers for the years. Outputs `2` for space only, `1` for time only, `3` for both and `0` for neither. yâ e_ÊÉÃÑ+!Jõ kVmgKi¹Ê [Try it](https://ethproductions.github.io/japt/?v=1.4.6&code=eeIgZV/KycPRKyFK9SBrVm1nS2m5yg==&input=W1s1LDcsMl0sWzUsMyw4XSxbLTYsMyw4XSxbNSw3LDJdXQpbMjAzOSwyMDE5LDIwMTgsMjAzOSwyMjIyXQ==)