[Question]
  [
Create all arrays of non-negative integers of length N where the array sum is equal to T. The output order of arrays does not matter.
Possible solutions are e.g.
```
N = 5, T = 2:  
1 1 0 0 0  
1 0 1 0 0  
1 0 0 1 0
1 0 0 0 1
0 1 1 0 0
0 1 0 1 0
0 1 0 0 1
0 0 1 1 0
0 0 1 0 1
0 0 0 1 1
2 0 0 0 0  
0 2 0 0 0  
0 0 2 0 0  
0 0 0 2 0  
0 0 0 0 2
```
```
N = 4, T = 5  
0 4 1 0  
1 1 2 1  
2 0 3 0  
0 3 1 1  
... 
```
Erroneous outputs would be:
```
N = 3, T = 1  
1 1 1  
3 0 0  
N = 4, T = 2  
0 1 1
0 2 0 0 0 0
```
Edit: I sadly do not understand most of these very short code golf languages (but admire the creativity of them). To understand what you mean, main stream languages or explanations are encouraged. (How about Java, C# or C++?)
  
[Answer]
# [Jelly (fork)](https://github.com/cairdcoinheringaahing/jellylanguage), 5 bytes
```
ŻṗSƘ⁸
```
Can't Try it online! as this is a fork of Jelly with some newly added commands. `Ƙ` was added [3 days ago](https://github.com/cairdcoinheringaahing/jellylanguage/commit/6167f95e9aa29b15dd31a848022cd9909ef8c8bd).
Essentially a shortened version of my [other answer](https://codegolf.stackexchange.com/a/220723/66833)
## How it works
```
ŻṗSƘ⁸ - Main link. Takes T on the left and N on the right
Ż     - Yield [0, 1, ..., T]
 ṗ    - N'th Cartesian power
    ⁸ - Yield T
   Ƙ  - Keep those for which the result of the following equals T:
  S   -   Sum
```
[Answer]
# [JavaScript (V8)](https://v8.dev/), ~~71 69~~ 67 bytes
*Saved 1 byte thanks to @l4m2*
Expects `(n, t)` and prints all possible arrays.
```
f=(n,t,a=[],v=0)=>n?f(n-1,t,[...a,v])|t&&f(n,t-1,a,v+1):t||print(a)
```
[Try it online!](https://tio.run/##FcoxCoAwDADA3Vd0kgRjUVEQofoQ6RCEgA5FNHTq32tdj7s48ns8561tnHMWB4GU2O2eouvQrWETCG1fcLfWMkWPSeta/le4QNPjoindzxkUGLPARGbASmAkM2H@AA "JavaScript (V8) – Try It Online")
### Commented
```
f = (             // f is a recursive function taking:
  n,              //   n   = expected number of entries
  t,              //   t   = expected sum
  a = [],         //   a[] = current output array
  v = 0           //   v   = current value to be added to a[]
) =>              //
  n ?             // if there's at least one more entry to add:
    f(            //   do a first recursive call:
      n - 1,      //     decrement n
      t,          //     pass t unchanged
      [...a, v]   //     append v to a[]
    ) | t         //   end of recursive call; yield t
    &&            //   if the above is truthy ...
    f(            //   ... do a 2nd recursive call:
      n,          //     pass n unchanged
      t - 1,      //     decrement t
      a,          //     pass a[] unchanged
      v + 1       //     increment v
    )             //   end of recursive call
  :               // else:
    t || print(a) //   print a[] if t = 0
```
[Answer]
# [Haskell](https://www.haskell.org/), ~~44~~ 42 bytes
```
1#t=[[t]]
n#t=[t-x:y|x<-[0..t],y<-(n-1)#x]
```
[Try it online!](https://tio.run/##PcxBCsIwEEbhfU/xQzYJZIoVu5H0CJ4gDBIkYLEdiplFCr171I27x7d4z1ReeVlaG4xOMSpzJ79Sqtf9qIHiqe@V/R7ICg3OVG6aiz5SyQUToh09zs7DXjxGx92aZvn6mrbbHdt7FkUUGCgOWPFQh0D4L7h9AA "Haskell – Try It Online")
* Saved 2 bytes thanks to [Wheat Wizard](https://codegolf.stackexchange.com/users/56656/wheat-wizard).
Takes `n` and `t` as input, returns the list of all the arrays of non-negative integers of length `n` that sum to `t`.
The implementation relies on the following recursive idea: such an array can always be obtained as the concatenation of the first element \$\texttt{x}\in\{0,1,\ldots,\texttt{t}\}\$ and an array `y` of length \$\texttt{n}-1\$ with sum equal to \$\texttt{t}-\texttt{x}\$.
**EDIT:** because of syntactic restrictions, it's actually more efficient (in terms of bytes) to pick \$\texttt{t}-\texttt{x}\$ as the first element, and recurse on \$(\texttt{n}-1,\texttt{x})\$.
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 28 bytes
```
1~Table~#~FrobeniusSolve~#2&
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE78n2b737AuJDEpJ7VOuc6tKD8pNS@ztDg4P6cMKGCk9j@gKDOvRN8hzcHBNTkj30FZrS44OTGvrpqr2lTHqFaHq9pExxREGesYQnhGtVy1//8DAA "Wolfram Language (Mathematica) – Try It Online")
```
FrobeniusSolve[     (* find all nonnegative integer vectors x s.t.: *)
 1~Table~#,         (*  {1,...(N 1s)...,1}.x *)
 #2]                (*  =T *)
```
[Answer]
# [Ruby](https://www.ruby-lang.org/), ~~56~~ 53 bytes
```
->n,t{(a=*0..t).product(*[a]*~-n){|a|a.sum==t&&p(a)}}
```
[Try it online!](https://tio.run/##KypNqvyfZvtf1y5Pp6RaI9FWy0BPr0RTr6AoP6U0uURDKzoxVqtON0@zuiaxJlGvuDTX1rZETa1AI1GztvZ/WrSpjlHsfwA "Ruby – Try It Online")
Ironically, this is shorter than directly using a built-in method - that's the result of long names:
### [Ruby](https://www.ruby-lang.org/), ~~58~~ 57 bytes
```
->n,t{[*0..t].repeated_permutation(n){|a|a.sum==t&&p(a)}}
```
[Try it online!](https://tio.run/##KypNqvyfZvtf1y5Pp6Q6WstAT68kVq8otSA1sSQ1Jb4gtSi3tCSxJDM/TyNPs7omsSZRr7g019a2RE2tQCNRs7b2f1q0qY5R7H8A "Ruby – Try It Online")
Thanks to Dingus for -3 and -1 bytes, respectively.
[Answer]
# [J](http://jsoftware.com/), 26 bytes
```
((=1&#.)#])]>@,@{@#<@i.@>:
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/NTRsDdWU9TSVYzVj7Rx0HKodlG0cMvUc7Kz@a3KlJmfkKxgqpCkYQ5jqurq66hCmMVZRI6CoKYaoKVDU5D8A "J – Try It Online")
Similar to the other answers, this just generates all possible Cartesian products and filters them.
[Answer]
# [Haskell](https://www.haskell.org/), ~~46~~ 42 bytes
```
n#t=[x|x<-mapM(\u->[0..t])[1..n],sum x==t]
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P0@5xDa6oqbCRjc3scBXI6ZU1y7aQE@vJFYz2lBPLy9Wp7g0V6HC1rYk9n9uYmaebUFRZl6JioKxstF/AA "Haskell – Try It Online")
* saved 4 thanks to @Delfad0r
[Answer]
# [C++ (gcc)](https://gcc.gnu.org/), ~~164~~ \$\cdots\$ ~~153~~ 151 bytes
Saved 3 bytes thanks to [ceilingcat](https://codegolf.stackexchange.com/users/52904/ceilingcat)!!!  
Added 7 bytes to fix a bug kindly pointed out by [Neil](https://codegolf.stackexchange.com/users/17602/neil).  
Saved 2 bytes thanks to [Neil](https://codegolf.stackexchange.com/users/17602/neil)!!!
```
#import<bits/stdc++.h>
auto f(int n, int t){std::vector<int>r;for(int i=pow(++t,n),v,j;i--;v||(r.push_back(i),0))for(v=t-1,j=i;j;j/=t)v-=j%t;return r;}
```
[Try it online!](https://tio.run/##hVJdU8IwEHzvr7ip40wzTQC/XkiLP0QdpoQAqZB20mt1xPrTxSRFsDhoXi693b3sJhVlyZZC7HYXalMWBpOZwmpY4VzE8WA1CbIaC1hESiNoCq4g2Vp4PG6kwMIktjUxfFEYz1FpWbxEcYxUE9rQnCvGePP@HplBWVer6SwTz5EidESIkzQpsiuap4rnPB@mSBqW5pfIjcTaaDC8tb60WNdzmaiiQiOzzSRwB20ypSMSbAOw69QPoKxwqiGF7R2FWwo3Lf@DiI54TcFx7/ZM6w66RBYccVuS/dRBpd5kRIBDHCsCnQO3/B1Zdkd7UE@8B@E3hD3IWxJFjZAkEDp96Hbaf1Kv8o0OBzZ51OFR7Z/HTbW0RWRfCMkRPGSQa7mBsef9NNzPqefy1WftdtYCd7phyj6Q2qiue6r@FSDqxPfWaWhPDEPium7OpR3De@I2ODsm7IVsz1wW@28dprSBL/vfasSDdvcpFutsWe3Yyxc "C++ (gcc) – Try It Online")
You asked for a C++ answer so here's one! :D
Inputs positive integers \$n\$ and \$t\$ and returns a `std::vector` holding all of the \$n\$-digit base\$\_{t+1}\$ integers who's \$n\$ base\$\_{t+1}\$ digits all sum to \$t\$.
[Answer]
# [APL (Dyalog Extended)](https://github.com/abrudz/dyalog-apl-extended), 10 bytes
```
∪↑¯⍸¨,⍳⎕⍴⎕
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT9dNrShJzUtJTfn/qKM9DUisetQ28dD6R707Dq3QedS7@VHf1Ee9W4AkSP5/GpcplxGXrq4uF4hlDAA "APL (Dyalog Extended) – Try It Online")
Filtering is not so convenient in APL, so here is a solution that uses each input only once. A full program, which takes N then K from stdin, and prints a matrix. The final `∪` can be omitted if duplicate rows are allowed.
### How it works
```
∪↑¯⍸¨,⍳⎕⍴⎕  ⍝ First input (right): N, Second input (left): T
       ⎕⍴⎕  ⍝ T copies of N
     ,⍳     ⍝ Cartesian product of T copies of 1..N
  ¯⍸¨       ⍝ For each vector V from above,
            ⍝ creates another vector W where each index i appears W[i] times in V
            ⍝ e.g. [3 3 4] → [0 0 2 1]
 ↑          ⍝ Mix (promote a vector of vectors to a matrix), padding with zeros
∪           ⍝ Take unique rows
```
[Answer]
# [Zsh](https://www.zsh.org), ~~86~~ 57 bytes
```
for p (`eval echo ${(l:$2*8::+{0..$1}:)}`)<<<$p>>$[$p-$1]
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m724qjhjwYKlpSVpuhY3LdPyixQKFDQSUssScxRSkzPyFVSqNXKsVIy0LKystKsN9PRUDGutNGsTNG1sbFQK7OxUolUKdFUMYyEGLLIxgDCWRRvpKJjEQs0FAA)
Outputs to a file called `0`.
* `${(l:$2*8::{0..$1},:)}`: repeat the string `"{0..$1}"`, \$ n \$ (`$2`) times
* `eval`: expand the string `+{0..$1}+{0..$1}+{0..$1}`, which produces the \$ n\$-permutations of the range \$ 0, 1, 2, ... T \$, separated by `+`
* ``echo``: print those permutations, space-separated
* `for p ()`: for each permutation, `$p`:
	+ `<<<$p`: print `$p`
	+ `$[$p-$1]`: evaluate `$p` as a numeric string, which sums the elements of the permutation (because each element was separated by `+`), and subtract the first input from it
	+ `>>` append to the file `$[$p-$1]`; if they're equal, this difference will be zero, and it will be written to the file `0`.
[Answer]
# [R](https://www.r-project.org/), 62 bytes
```
function(n,t)(m=expand.grid(rep(list(0:t),n)))[rowSums(m)==t,]
```
[Try it online!](https://tio.run/##BcHBCoAgDADQX/G4wYoIukR@RcfoEKkh5JS5qL@396QFs3SmhYdPjZmBSRGS9V852PWXRAfiC9yxKgyzIjEibpLf9UkVElqrtLcAE43Yfg "R – Try It Online")
Slightly shorter (and more efficient) to use `expand.grid` rather than `combn`.
Generates the cartesian product of `[0..t]` with itself `n` times, then filters for those with row sums equal to `t`.
# [R](https://www.r-project.org/), 63 bytes
```
function(n,t)(m=unique(t(combn(rep(0:t,n),n))))[rowSums(m)==t,]
```
[Try it online!](https://tio.run/##DcIxCoAwDADArzgmEEEEF7GvcBQXSwsdkmpN8PmxxzXPwzYOnk2iliogpAgcTMpjCRRi5UugpRumVUmw745Wv934BcYQlE7PsNCM/gM "R – Try It Online")
[Answer]
# [K (ngn/k)](https://bitbucket.org/ngn/k), 16 bytes
```
{(y=+/)#+!x#1+y}
```
[Try it online!](https://tio.run/##y9bNS8/7/z/Nqlqj0lZbX1NZW7FC2VC7svZ/WrSptVEsV1q0ibVp7H8A "K (ngn/k) – Try It Online")
```
{(y=+/)#+!x#1+y} / a function with arguments x (N) and y (T)
           #     / create a list
          x      / of x copies
            1+y  / of 1+y 
         !       / make an odometer from this list (ranged permutations)
        +        / transpose the result
       #         / keep only those lists
 (  +/)          / that have sum which
  y=             / equals y 
```
[Answer]
# [Python 3](https://docs.python.org/3/), 87 bytes
```
lambda n,t:[k for k in product(range(t+1),repeat=n)if sum(k)==t]
from itertools import*
```
[Try it online!](https://tio.run/##HcexDsIgEAbg3af40wmUDmpcTPBFtANaUEK5I9fr4NNj4rd97asfpnNP/tGXUJ9zADm93gsSCwoyoQnP20uNBHpHo4ejdRJbDOrJ5oR1q6ZY73XaJeGKrFGUeVmRa2PRfW@SSc3F4eQwjLfBIf1nbf8B "Python 3 – Try It Online")
# Explanation
First use `range` to get all integers between `0`and `t` and use `itertools.product` to find the array of cartesian product of itself repeated `n` times (so that would include all arrays of length n where each element is between 0 and t). Among all such arrays, we only pick the ones with sum equal to `t`.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 7 bytes
```
ŻṗS=¥Ƈ⁸
```
[Try it online!](https://tio.run/##AR4A4f9qZWxsef//xbvhuZdTPcKlxofigbj/w6dH//8y/zU "Jelly – Try It Online")
## How it works
```
ŻṗS=¥Ƈ⁸ - Main link. Takes T on the left and N on the right
Ż       - Yield [0, 1, ..., T]
 ṗ      - N'th Cartesian power
    ¥Ƈ  - Keep those for while the following is true:
  S     -   Sum
   =  ⁸ -   Equals T
```
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 20 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
```
pVÄ osU ù'0 m¬f_x ¥V
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=cFbEIG9zVSD5JzAgbaxmX3ggpVY&input=MwoyCi1R)
```
Input : U = n , V = t
    o    - numbers from 0 to..
pVÄ      - (n raised to t+1)excluded
     sU  - to base n
ù'0      - pad to left with '0' to max length element
m¬       - split each 
f_       - keep
  x ¥V   - sum == t
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 36 bytes
```
Ｎθ⊞υ⟦Ｎ⟧Ｆυ¿⁼Ｌιθ⟦⪫ι,⟧«≔⊟ιηＦ⊕η⊞υ⁺ι⟦κ⁻ηκ
```
[Try it online!](https://tio.run/##Tc4/D4IwEIfhGT7Fhema1MXEycnBAaOmO3FALLSxXKF/XIyfvRbi4Hj55X1ynWpdZ1uTUk1TDNc43qXDme1LEb3CyKH5H9gtL711gJGB7gGPc2yNx7OkISjUjMPMGAinKWBzsppQc6h4tYQgjZfwLouD93ogFHZaC5XNYkVr6pwcJQX5QLU4vx@EiX6BmieHi6Z8KA7PbObyk9Ku3KbNy3wB "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
Ｎθ
```
Input `N`.
```
⊞υ⟦Ｎ⟧Ｆυ
```
Start a breadth first search with an array `[T]`.
```
¿⁼Ｌιθ
```
If the current array has the correct number of entries, ...
```
⟦⪫ι,⟧
```
... then join it with commas and print it on its own line, ...
```
«
```
... otherwise:
```
≔⊟ιη
```
Remove the last entry from the array.
```
Ｆ⊕η
```
For all values from `0` to that entry inclusive...
```
⊞υ⁺ι⟦κ⁻ηκ
```
... concatenate the value and the difference from the original last entry to the remainder of the array, and save that for a future search pass.
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 40 bytes
```
Select[Range[0,s=#2]~Tuples~#,Tr@#==s&]&
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE78n277Pzg1JzW5JDooMS89NdpAp9hW2Si2LqS0ICe1uE5ZJ6TIQdnWtlgtVu1/QFFmXomCvkN6tKmOUSwXmBsNpcHCJjqmsf//AwA "Wolfram Language (Mathematica) – Try It Online")
-2 bytes from @att
[Answer]
# [Retina](https://github.com/m-ender/retina/wiki/The-Language), 50 bytes
```
G`$
.+
*
"$+"+%Lv$`_*$
$`,$&
(_*),
$.1,
Lm$`,$
$%`
```
[Try it online!](https://tio.run/##K0otycxLNPz/3z1BhUtPm0uLS0lFW0lb1adMJSFeS4VLJUFHRY1LI15LU4dLRc9Qh8snFyTEpaKa8P@/KZcRAA "Retina – Try It Online") No test suite because this program uses history. Explanation:
```
G`$
```
Delete `N`. (Don't worry, we can get it back later via `$+`.)
```
.+
*
```
Convert `T` to unary.
```
"$+"+`
```
Repeat `N` times...
```
%`
```
... for each line...
```
Lv$`_*$
```
... for all the suffixes of the last entry, i.e. the numbers from it down to zero...
```
$`,$&
```
... split the last entry into two values that sum to it.
```
(_*),
$.1,
```
Convert all the values to decimal, except for the last value on each line.
```
Lm$`,$
$%`
```
List only those lines that end with a zero entry, keeping only the prefix of the line. This is required because we split `T` `N` times, resulting in a list of length `N+1`, so to fix this we only keep those entries that end with zero, dropping that zero from the final output.
[Answer]
# MATL, 13 bytes
```
Q:qZ^t!s1G=Y)
```
First input is `T` and second input is `N`
[Try it out at MATL Online](https://matl.io/?code=Q%3AqZ%5Et%21s1G%3DY%29&inputs=2%0A5&version=22.4.0)
**Explanation**
```
        % Implicitly grab the first input, T
Q:q     % Add 1 to T, create array from 1...(T+1), subtract 1 to yield 0...T
Z^      % Perform the Cartesian product with the second input
t       % Duplicate the result
!s      % Sum across the rows
1G      % Explicitly grab the first input again, T
=       % Compare the sum of each row to T
Y)      % Use this a logical index to grab only those rows where the sum == T
        % Implicitly display the result
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 6 bytes
```
Ý¹ãʒOQ
```
[Try it online!](https://tio.run/##yy9OTMpM/f//8NxDOw8vPjXJP/D/f1MuIwA "05AB1E – Try It Online")
```
Ý¹ãʒOQ  # full program
   ʒ    # all elements of...
  ã     # all combinations of...
Ý       # [0, 1, 2, ...,
        # ..., implicit input...
Ý       # ]...
  ã     # repeated...
 ¹      # first input...
  ã     # times...
   ʒ    # where...
    O   # sum of all elements in...
        # (implicit) current element in list...
     Q  # is equal to...
        # implicit input
        # implicit output
```
[Answer]
# [Functional Bash](https://www.gnu.org/software/bash/)\*, 160 bytes
\* This is bash with the additional constraint that you can't mutate variables. 
```
d=$(eval echo $(printf "{0..$1}%.0s+" $(seq $1))|tr \  \\n)
paste <(sed s/$/0/<<<$d|bc|awk "{print match(\$0,/^$2$/)?1:0}") <(sed s/+/\ /g<<<$d)|grep ^1|cut -f2
```
[Try it online!](https://tio.run/##PY5BDoIwFAX3nOKHfAMNlrYYNwbjRRqSUgoYFZFWXVDOjg0Lt/Myk1cr269tSua1OWNqPuoORvdPwHScroNrIZ55nqNYdjm3WRy4NS9AQYh3E0gAKQcSjco6A2XYGrAMGWdlWWLja@3V9xYaWwweyuk@lcj3rMICGbmIE19i8jczJoF1m0t8N5kRKuH12wFti3WJWjhCEW3/EkppEsABxPoD "Bash – Try It Online")
Could be golfed more, but sort of a fun idea.
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 17 bytes
```
ÆVòÃc àU f_x ¥VÃâ
```
[Try it online!](https://tio.run/##ASYA2f9qYXB0///DhlbDssODYyDDoFUgZl94IMKlVsODw6L//zUsMiAtUQ "Japt – Try It Online")
Uses a significantly different strategy from the [other Japt answer](https://codegolf.stackexchange.com/a/220737/71434). The order of the outputs is weird, but all of them seem to be there.
Explanation:
```
ÆVòÃc àU f_x ¥VÃâ    
 Vò                  # Create the array [0...T]
Æ  Ã                 # Create N copies of that array
    c                # Flatten them all into a single array
      àU             # Create all combinations of elements of that array that have length N
         f_    Ã     # Keep only the ones where:
           x         #  The sum of the numbers
             ¥V      #  Is equal to T
                â    # Remove any duplicates
```
[Answer]
# [JavaScript (V8)](https://v8.dev/), 60 bytes
```
f=(n,t,a,g=i=>f(n,t-i,[a,i])|i&&g(i-1))=>--n?g(t):print(t+a)
```
[Try it online!](https://tio.run/##JcgxCoAwDEDR3VM4SYLJoCiI0HoQcQhCSxyKaHDy7lUR/vL@Jpec66G78TXk4N4gkZFQdOp8@MBKs5AueGtVRVBuEJ1nTlMEw3E/NBlYLZgD9FS2WPwLiwAdlT3mBw "JavaScript (V8) – Try It Online")
```
f=(n,t,
  a, // previous numbers, initialed as undefined (empty)
  g= // helper function to loop current number from t to 0
    i=> // `i` is current number
      f(n,t-i,[a,i])| // try to use current number and `t-i` remined
      i&&g(i-1) // loop until i = 0
)=>
  --n? // Is more than 1 number required?
    g(t): // Try current number, loop from `t`
    print(t+a) // We found an partition with t and previous numbers
```
[Answer]
# [C (clang)](http://clang.llvm.org/), ~~133 124~~ 112 bytes
```
p,i,j,r;f(n,t){for(p=pow(++t,n);i=j=--p;){for(r=t-1;j;j/=t)r-=j%t;for(j=n;j--;i/=t)r||printf("%d%c",i%t,9+!j);}}
```
[Try it online!](https://tio.run/##JcxBCsIwEEDRs1gIJHQGUVcyzGFCJCVDmoY44KLt1Y1Vt@/DDxiyL1PvFRIINIq2gLo1Ls1WrsvLjqNCcZRYGLHSPzVWvJCQnFldQxaj9HXhQoJI6efbVlsqGu1gHiYMkIzCfTyJo33vs0/FHjd7g@sB/R1i9tOzY54/ "C (clang) – Try It Online")
* Saved 12 thanks to @ceilingcat
* iterates over all numbers up to (t+1)^n , convert to base t+1 then prints only if digits sums to t.
* prints elements separated by tab.
[Answer]
# [Python 3](https://docs.python.org/3/), 74 bytes
```
f=lambda N,T:N and[j+[i]for i in range(T+1)for j in f(N-1,T-i)]or[[]]*-~-T
```
[Try it online!](https://tio.run/##K6gsycjPM/7/P802JzE3KSVRwU8nxMpPITEvJTpLOzozNi2/SCFTITNPoSgxLz1VI0TbUBMklAUSStPw0zXUCdHN1IzNL4qOjo3V0q3TDflfUJSZV6JhqqNgpKOgpGunpANUCOJpav4HAA "Python 3 – Try It Online")
Shortened version of this
```
def f(N,T):
  if N == 0:
    if T == 0: return [[]]
    else: return []
  else:
    l = []
    for i in range(T+1):   # possible last elements
      for j in f(N-1,T-i): # solutions for rest of elements
        l.append(j+[i])
    return l
```
[Answer]
# [JavaScript (V8)](https://v8.dev/), ~~76~~ 74 bytes
```
f=(n,t,z=t)=>n<2?[[t]]:f(n-1,t-z).map(a=>[z,...a]).concat(z?f(n,t,z-1):[])
```
[Try it online!](https://tio.run/##lcyxCsIwFIXh3afIeC8kgRYLUkw7uTjo4BgyXEJTKzUpbSiYl4@CCK6dz/@dB6202HmYolgPOTsFnkeeVETV@GPZah2NqR14UfAoEsonTUCq0YlLKcmgtMFbipBa96WiwFobzA4qzkqULswnsncgphr2iZcwdnIMPZxv14tc4jz4fnAvIETcOSg4qzaj/Xb0v/8Oxs738Y75DQ "JavaScript (V8) – Try It Online")
[Answer]
# [Haskell](https://www.haskell.org) 73 (88) bytes
This solution is longer than both existing Haskell solutions. But it's fun, and that's what code golf is about.
```
1#t=[[t]]
n#1=(n-1)#1>>=(\p->[0:p,1:(0<$p)])
n#t=zipWith(+)<$>n#1<*>n#(t-1)
```
Here's how it works:
* Bottom case: If, given any particular *N*, you could solve the problem for *T=1* and any other *Ta*, you could solve it for *Ta+1* as well. You would only have to find every possible pairing of a *Ta* array and a *T=1* array and add up both arrays element-wise. So by induction if you could solve the problem for *T=1*, you could solve it for any *T*.
* Middle case: Now you only have an infinite number of problems remaining: solving the task for any *N*, given *T=1*. But if you *had* a solution for *T=1* and any *Na*, you could get a solution for *T=1* and *Na+1* by simply putting a zero in front of every existing array and adding one more trivial array (in this case, many times). So actually you only have to solve the task for *T=1* and *N=1*.
* Top case: Now that's trivial.
To get down to this enormous reduction of being almost longer than all existing Haskell solutions combined, this solution not only uses almost every trick in my book, but it also exploits two holes of the task description:
1. The task doesn't state that an array can only appear once
2. No restrictions are given for *N* and *T*, so I didn't make it work for non-trivial *T=0*.
To get rid of both exploits, more bytes are necessary. But yet another level of beauty emerges, both because the solution is now actually longer than all existing Haskell solutions combined, and because the middle case gains some symmetry.
```
1#t=[[t]]
n#0=[0<$[1..n]]
(n+1)#1=[1:p|p<-n#0]++[0:p|p<-n#1]
n#(t+1)=zipWith(+)<$>n#1<*>n#t
```
[Answer]
# [Macaulay2](https://faculty.math.illinois.edu/Macaulay2/), 36 bytes
```
n->t->exponents(sum gens(ZZ[n:x]))^t
```
[Try it online!](https://sagecell.sagemath.org/?z=eJzL07Ur0bVLrSjIz0vNKynWKC7NVUhPzSvWiIqKzrOqiNXUjCvh4uLS1VUoSS0uUUhOLE614tLIz1cw1VQwAgB6jhLt&lang=macaulay2&interacts=eJyLjgUAARUAuQ==)
This is based on the fact that, by the [multinomial theorem](https://en.wikipedia.org/wiki/Multinomial_theorem), the multivariate polynomial
$$(x\_1 + \cdots + x\_n)^t = \sum\_{t\_1+\cdots+t\_n=t} \binom{t}{t\_1,\dots,t\_n} x\_1^{t\_1} \cdots x\_n^{t\_n} \in ℤ[x\_1,\dots,x\_n]$$
involves all the monomials of degree *t* in *n* variables when fully expanded. As the exponents of each monomial sum to *t*, taking all the exponent vectors of this polynomial gives the solution.
For example, with *n*=2, *t*=4, the polynomial
$$(x\_1 + x\_2)^4 = x\_1^4 + 4 x\_1^3 x\_2 + 6 x\_1^2 x\_2^2 + 4 x\_1 x\_2^3 + x\_2^4$$
has exponents (4,0), (3,1), (2,2), (1,3), (0,4).
---
Edit: As a side note, there is even a builtin for this: `compositions` (12 bytes). [Try it online!](https://sagecell.sagemath.org/?z=eJxLzs8tyC_OLMnMzyvWMNVRMNIEAEPEBiw=&lang=macaulay2&interacts=eJyLjgUAARUAuQ==)
[Answer]
# TI-Basic, ~~56~~ 52 bytes
```
Prompt N,T
T+1→U
For(I,1,U^N
seq(UfPart(int(I/U^J)/U),J,0,N-1
If T=sum(Ans
Disp Ans
End
```
-4 bytes thanks to [MarcMush](https://codegolf.stackexchange.com/users/98541/marcmush).
Output is displayed as lists separated by newlines.
[Answer]
# [Ruby](https://www.ruby-lang.org/), ~~54~~ 53 bytes
```
f=->n,t,*a{n>1?0.upto(t){|x|f[n-1,t-x,*a,x]}:p(a<<t)}
```
[Try it online!](https://tio.run/##KypNqvz/P81W1y5Pp0RHK7E6z87Q3kCvtKAkX6NEs7qmoiYtOk/XUKdEtwIoq1MRW2tVoJFoY1OiWfs/LdpUxyiWKy3aRMc09j8A "Ruby – Try It Online")
I don't know if the initial "f=" is considered part of the function. If I could move that to the header, this would be 51 bytes. I've always considered it a part of the function (because of recursion), but I think I've seen answers where it was removed.
]