Count number of different possible $3 \times 3$ grids. Consider a square $3 \times 3$ grid of non-negative integers.  For each row $i$ the sum of the integers is set to be $r_i$.  Similarly for each column $j$ the sum of integers in that column is set to be $c_j$.  
I would like to know how many different possible assignments of integers to the grid there are.  Is it possible to give an exact number?
 A: I don't know for $3\times 3$-grids, here is what I found for $2\times 2$:

We need to have $\sum_j c_j=\sum_i r_i$ else there is no solution.
Rem: here we work in $\mathbb N$, with zero included, all numbers invoked are non-negative.


*

*For $1\times 1$-grids there is obviously $1$ possible grid.

*For $2\times 2$-grids there are $Part(\min(c_1,c_2,r_1,r_2),2)$ possible grids.
where $Part(x,n)$ is the number of partitions of $x$ into $n$ integers.
For instance let examine the following matrix
$\begin{array}{|c|c|c}\hline
. & . & 7\\
. & ? & 5\\\hline
9 & 3 & \end{array}$
$3$ is the minimum entry here, it can be partitioned $4$ different ways $[0+3],\ [1+2],\ [2+1],\ [3+0]$ 
If we select $0,1,2$ or $3$ for the value of the cell marked "$?$" then this value is free to set because it is smaller than $5$ the next minimum entry.
From the choice of the value in this cell, all other values are decided (I let you experiment with that, to convince yourself it is the case).
$\begin{array}{|c|c|c}\hline 4 & 3 & 7\\ 5 & \color{blue}0 & 5\\\hline 9 & 3 & \end{array}
\qquad\begin{array}{|c|c|c}\hline 5 & 2 & 7\\ 4 & \color{blue}1 & 5\\\hline 9 & 3 & \end{array}
\qquad\begin{array}{|c|c|c}\hline 6 & 1 & 7\\ 3 & \color{blue}2 & 5\\\hline 9 & 3 & \end{array}
\qquad\begin{array}{|c|c|c}\hline 7 & 0 & 7\\ 2 & \color{blue}3 & 5\\\hline 9 & 3 & \end{array}$
So the number of possible grids is equal to the number of ways of partitioning $3$ into two numbers.
I suspect that for $3\times 3$-grids, $Part(x,3)$ should be involved.

From code golf:
https://codegolf.stackexchange.com/questions/150012/enumerate-all-possible-grids-of-integers-with-constraints
After some tries, the python one at the end is fastest:
-> Simulate grids here 
Modifiy the Input field $[ c_1 c_2 c_3 r_1 r_2 r_3 ]$ and then hit the $\blacktriangleright$ button.
