#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â mÊeÉ Ñ+!Jõ kVmgKi¹Ê [Try it](https://ethproductions.github.io/japt/?v=1.4.6&code=eeIgbcplySDRKyFK9SBrVm1nS2m5yg==&input=W1s1LDcsMl0sWzUsMyw4XSxbLTYsMyw4XSxbNSw3LDJdXQpbMjAzOSwyMDE5LDIwMTgsMjAzOSwyMjIyXQ==) :Implicit input of 2D-array U=space and array V=time y :Transpose U â :Deduplicate columns m :Map Ê : Lengths e :All truthy (not 0) when É : 1 is subtracted Ñ :Multiply by 2 J :-1 õ :Range [-1,1] k :Remove all the elements present in Vm : Map V g : Signs of difference with Ki : The current year ¹ :End removal Ê :Length +! :Negate and add first result