Let's say Alice and Bob quarrelled and decided to split up their field. Now Alice can run her machine only in the upper part of the field and can never go below the main diagonal. See example on the picture. In how many ways could she make the one trip from the top-left square to her home?

In other words, what is the number of paths on NxN grid, which go strictly to the right or down, start from the top-left, end to the bottom-right square and never cross the diagonal?

P.S. I'm replacing 20x20 by NxN in order to avoid numerical solutions, which are quite straight forward of course.

$\begingroup$This puzzle is really awesome. I originally heard a slightly different version with a slightly different story: In an election where Alice receives $a$ votes and Bob receives $b$ votes($a > b$), what is the probability, as the votes are counted, that Alice is always strictly ahead?$\endgroup$
– Tyler SeacrestApr 6 '16 at 21:17

$\begingroup$@TylerSeacrest, originally I met it in a formulation of a queue in a shop. Shop have no money, men buy something for 50c each, half of them have 1$ bill and half - 2 quarters. The question is probability that all men will get change. The puzzle was really fun to solve by combining men in groups of size N+1.$\endgroup$
– klm123Apr 6 '16 at 21:30

$\begingroup$It is a pity that you posted this before somebody, who knows nothing about Catalan numbers, would find a solution. But still this is eligible answer and I accept it. The interesting question here is why coefficient is 1/n exactly and how to see quickly that diagonal limitation lowers the combinations by factor of n.$\endgroup$
– klm123Apr 6 '16 at 18:08

(where each number represents the number of ways to get to that square)

From any square (eg. F4), the number of ways you can get to it is the sum of the squares above (F3) and to the left (E4), because either of them can represent a path to the square (F4). Here are all of the sums (< 9) in their positions in the grid.

$\begingroup$Sorry, your result is correct of course, but the process of achieving it is not what is the puzzle about at all. I fixed this flow by asking for a general formula for NxN sized grid.$\endgroup$
– klm123Apr 6 '16 at 17:24

$\begingroup$@klm123 Ah, ok. I was a little surprised when I saw this, precisely because this algorithm makes it so much easier than the original problem.$\endgroup$
– LacklubApr 6 '16 at 17:26