I've just found the following problem:
$\quad\quad$ $\quad\quad$ $\quad\,$
And I believe that it could be done with something in combinatorics, my feeling is that generating functions would work for this, although I don't know precisely how. I just happened to think also that linear algebra could be used, but still not sure how. I'm trying to make a system of equations on Mathematica and make it find solutions.

The spaces in red can be filled arbitrarily and it is still possible, I recommend you fill them with zeros.(I assume we use PEMDAS).
At the end I ended up having to use some of the red spots to fix stuff, the top left corner was really usefull because the 332 becomes a zero for that row.