2 of 3 added 93 characters in body

Haskell, 35 bytes

x#y=floor$sqrt$min(x+y)$1+2*min x y

Try it online!


This answer calculates the following formula:


Why does this formula work? Well lets start by noting the following:

Every square of even side length can be tiled by \$2\times 1\$ tiles.


Every square of odd length can be tiled, spare a single \$1\times 1\$ square, by \$2\times 1\$ tiles.

Now we note that if we put these \$2\times 1\$ tiles on a chessboard each would lay on top of one black square and on white square. So if we make an even chessboard every tile needs to have a pair of the other color, and if we make an odd chessboard every tile but one needs a pair of the other color. This tells us that the answer is never more than \$\left\lfloor\sqrt{2\min(a,b)+1}\right\rfloor\$. \$2\min(a,b)\$ is the maximum number of pairs we can make and the \$+1\$ is for the last square that doesnt' need a pair. The problem with this is that if \$a=b\$ we will not have the extra square for the odd case. So we add another condition: Our result cannot be more than \$\left\lfloor\sqrt{a+b}\right\rfloor\$. That is we can't make a square which has more tiles than we have available.

So we just take the lesser of the two options.