Equal, sum or difference! Write shortest possible code that will return true if the two given integer values are equal or their sum or absolute difference is 5.

Example test cases:

4 1 =&gt; True
10 10 =&gt; True
1 3 =&gt; False
6 2 =&gt; False
1 6 =&gt; True
-256 -251 =&gt; True
6 1 =&gt; True
-5 5 =&gt; False


The shortest I could come up with in python2 is 56 characters long:

x=input();y=input();print all([x-y,x+y-5,abs(x-y)-5])&lt;1


-9, thanks @ElPedro. It takes input in format x,y:

x,y=input();print all([x-y,x+y-5,abs(x-y)-5])&lt;1
Python 2, 30 bytes



lambda a,b:a in(b,5-b,b-5,b+5)


Try it online!

One byte saved by Arnauld

Three bytes saved by alephalpha