a.
1) If Ai+1=Ai, then the quantity of numbers from the first row smaller than Ai and situated to the left of Ai is the same as the quantity of numbers from the first row smaller than Ai+1 and situated to the left of Ai+1. As number Ai can't increase this quantity, that's why Bi+1=Bi.
2) If Ai+1>Ai=Ai−1=⋯=Ai−k+1, then the quantity of numbers from the first row smaller than Ai and situated to the left of Ai is k less than the quantity of numbers from the first row smaller than Ai+1 and situated to the left of Ai+1, as this quantity is increased by k numbers Ai−k+1,…,Ai. That's why Bi+1=Bi+k and Bi+1>Bi=Bi−1=⋯=Bi−k+1.
3) If Ai+1>Ai>Ai−1, then the quantity of numbers from the first row smaller than Ai and situated to the left of Ai is one less than the quantity of numbers from the first row smaller than Ai+1 and situated to the left of Ai+1, as this quantity is increased by the number Ai. That's why Bi+1=Bi+1 and Bi+1=Bi>Bi−1.
As we can see, numbers Ci are built the same way. Before finishing, we should note that B1=C1=0.
b.
Let's denote the first and second row of the table as A1,…,A2008 and B1,…,B2008. As we know B1,…,Bi, Bi+1 depends on Ai and Ai+1. Let's look at some variants.
1) If Ai+1=Ai, then the quantity of numbers from the first row smaller than Ai and situated to the left of Ai is the same as the quantity of numbers from the first row smaller than Ai+1 and situated to the left of Ai+1. As number Ai can't increase this quantity, that's why Bi+1=Bi.
2) If Ai+1>Ai=Ai−1=⋯=Ai−k+1, then the quantity of numbers from the first row smaller than Ai and situated to the left of Ai is k less than the quantity of numbers from the first row smaller than Ai+1 and situated to the left of Ai+1, as this quantity is increased by k numbers Ai−k+1,…,Ai. That's why Bi+1=Bi+k and Bi+1>Bi=Bi−1=⋯=Bi−k+1.
| Ai | Ai+1 |
|-------|-----------|
| Bi | Bi+1 |
| Ci | Ci+1 |
Fig. 19
That's why at each step there exist two different possibilities for the next element, which means that there are exactly 22007 such tables.