[Question]
  [
Given a positive integer `n`, do the following (and output every stage):
1. start with a list containing `n` copies of `n`.
2. do the following `n` times:
3. at the `i`th step, gradually decrement the `i`th entry of the list until it reaches `i`
So, for example, if the given `n` is `4`, then you start with `[4,4,4,4]`, and then at the first step you have `[3,4,4,4]`, `[2,4,4,4]`, `[1,4,4,4]`. At the second step, you have `[1,3,4,4]`, `[1,2,4,4]`. At the third step you have `[1,2,3,4]`. Nothing is done on the fourth step.
So your output is `[[4,4,4,4],[3,4,4,4],[2,4,4,4],[1,4,4,4],[1,3,4,4],[1,2,4,4],[1,2,3,4]]`.
---
Any reasonable input/output format is permitted.
---
[Standard loopholes](https://codegolf.meta.stackexchange.com/questions/1061/loopholes-that-are-forbidden-by-default) apply. This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"): the answer with the smallest byte-count wins.
---
[Python implementation for checking purposes](https://tio.run/##XY3BCsIwEETP6VestwRRKHoS8iUhSKEbu2C3IY1Yvz7uigfxOPOGN/lVp4VPrY2YIFl2l87MOIOHwJCWAlcghjLwDQXGzhRcFYbtQzelso9CNNPvWlTmOdEddREows4D7Xutzbc5eOg1ivU45Iw82n@z08/6KOLFteVCXG2yZ@faGw).
  
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 9 [bytes](https://github.com/DennisMitchell/jelly)
```
r€⁸Œp»\QṚ
```
**[Try it online!](https://tio.run/##ARwA4/9qZWxsef//cuKCrOKBuMWScMK7XFHhuZr///81 "Jelly – Try It Online")**
### How?
```
r€⁸Œp»\QṚ - Link: integer, N    e.g. 4
 €        - for €ach of implicit range of N (i.e. for i in [1,2,3,...N])
  ⁸       -   with the chain's left argument, N on the right:
r         -     inclusive range (for i<=N this yields [i, i+1, ..., N]
          - ...leaving us with a list of lists like the post-fixes of [1,2,3,....,N]
          -                     e.g. [[1,2,3,4],[2,3,4],[3,4],[4]]
   Œp     - Cartesian product* of these N lists
          -                     e.g. [[1,2,3,4],[1,2,4,4],[1,3,3,4],[1,3,4,4],[1,4,3,4],[1,4,4,4],[2,2,3,4],[2,2,4,4],[2,3,3,4],[2,3,4,4],[2,4,3,4],[2,4,4,4],[3,2,3,4],[3,2,4,4],[3,3,3,4],[3,3,4,4],[3,4,3,4],[3,4,4,4],[4,2,3,4],[4,2,4,4],[4,3,3,4],[4,3,4,4],[4,4,3,4],[4,4,4,4]]
      \   - cumulative reduce with:
     »    -   maximum (vectorises)
          -                     e.g. [[1,2,3,4],[1,2,4,4],[1,3,4,4],[1,3,4,4],[1,4,4,4],[1,4,4,4],[2,4,4,4],[2,4,4,4],[2,4,4,4],[2,4,4,4],[2,4,4,4],[2,4,4,4],[3,4,4,4],[3,4,4,4],[3,4,4,4],[3,4,4,4],[3,4,4,4],[3,4,4,4],[4,4,4,4],[4,4,4,4],[4,4,4,4],[4,4,4,4],[4,4,4,4],[4,4,4,4]]
       Q  - de-duplicate        e.g. [[1,2,3,4],[1,2,4,4],[1,3,4,4],[1,4,4,4],[2,4,4,4],[3,4,4,4],[4,4,4,4]]
        Ṛ - reverse             e.g. [[4,4,4,4],[3,4,4,4],[2,4,4,4],[1,4,4,4],[1,3,4,4],[1,2,4,4],[1,2,3,4]]
```
\* It may be easier to see what's going on with the Cartesian product used above with a different input:
```
the Cartesian product of [[0,1,2],[3,4],[5]]
is [[0,3,5],[0,4,5],[1,3,5],[1,4,5],[2,3,5],[2,4,5]]
```
[Answer]
# [R](https://www.r-project.org/), ~~83~~ ~~82~~ 74 bytes
```
N=rep(n<-scan(),n);while({print(N);any(K<-N>1:n)})N[x]=N[x<-which(K)[1]]-1
```
[Try it online!](https://tio.run/##K/r/38@2KLVAI89Gtzg5MU9DUydP07o8IzMnVaO6oCgzr0TDT9M6Ma9Sw9tG18/O0CpPs1bTL7oi1hZI2OgCFSZnaHhrRhvGxuoa/jf9DwA "R – Try It Online")
Instead of a double for-loop, a `while` loop is sufficient here: we find the first index where the list is greater than the index, and decrement there.
`K` has `TRUE` wherever `N[i]>i`, `which(K)` returns the true indices, and we take the first with `[1]`. 
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 12 bytes
```
R‘®¦<³S©$Ð¿Ṛ
```
[Try it online!](https://tio.run/##ASEA3v9qZWxsef//UuKAmMKuwqY8wrNTwqkkw5DCv@G5mv///zQ "Jelly – Try It Online")
[Answer]
# JavaScript (ES6), 75 bytes
```
f=(n,a=Array(n).fill(n))=>[[...a],...a.some(v=>v>++j,j=0)?f(a[j-1]--,a):[]]
```
[Try it online!](https://tio.run/##FcVRCsMgDADQ6yRUwwb9GsSxc4gfodVRcWZoEXZ6t/28l2VI39rxPm3VPc6ZGKoRfrQmH6hI6SjlN7LznogkmL/U9RVhsBtuWbLJfMF7AvHZXoO1RvDmQ5ib1q4lUtEnJFgR5xc "JavaScript (Node.js) – Try It Online")
[Answer]
# APL+WIN, 54 bytes
Prompts for screen input of integer
```
((⍴m)⍴n)-+⍀m←0⍪(-0,+\⌽⍳n-1)⊖((+/+/m),n)↑m←⊖(⍳n)∘.>⍳n←⎕
```
Outputs a matrix with each row representing the result of each step e.g. for 4:
```
4 4 4 4
3 4 4 4
2 4 4 4
1 4 4 4
1 3 4 4
1 2 4 4
1 2 3 4
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 11 bytes
```
x`’Jḟḣ1Ʋ¦ÐĿ
```
[Try it online!](https://tio.run/##ASAA3/9qZWxsef//eGDigJlK4bif4bijMcaywqbDkMS/////NA "Jelly – Try It Online")
### How it works
```
x`’Jḟḣ1Ʋ¦ÐĿ  Main link. Argument: n
x`           Repeat self; yield an array of n copies of n.
         ÐĿ  While the results are unique, repeatedly call the link to the left.
             Return the array of all unique results, including the initial value.
  ’     ¦      Decrement the return value at all indices specified by the chain
               in between.
       Ʋ         Combine the four links to the left into a monadic chain.
   J               Indices; yield [1, ..., n].
    ḟ              Filterfalse; remove all indices that belong to the return value.
     ḣ1            Head 1; truncate the result to length 1.
```
[Answer]
# [Python 3](https://docs.python.org/3/), 91 bytes
```
n=int(input())
x=[n]*n;print(x)
for i in range(n):
    for j in[0]*(n-i-1):x[i]-=1;print(x)
```
[Try it online!](https://tio.run/##Pcu9CoAgFIbh3atw9AhC0WZ4JeLQ0M9p@BQxsKs3XXrHB970litiaQ2OURQjPUURieo8gsaa8uBK4ohZsmTIvOHcFcgK2Rt8d/ZT0AqGzUy2eg7Gzf/b2gc "Python 3 – Try It Online")
[Answer]
# [Java (OpenJDK 8)](http://openjdk.java.net/), 135 bytes
```
a->{int r[]=new int[a],i=0;java.util.Arrays x=null;x.fill(r,a);for(r[0]++;i<a;r[i++]++)for(;--r[i]>i;System.out.print(x.toString(r)));}
```
[Try it online!](https://tio.run/##jY8xbsMwDEX3nIKjBMdChqYdVAfoAZolo6CBdexCriIblJw4MHx2l3Yzdcr2yf9JPjZ4xbztqtCcf@bSY4zwiS6MGwAXUkU1lhUcx2vrzkCCW4BST@zGhMmVcIQABcyYH8bFJGOLUN2WWYN264qdbviC6pPz6oMI7xGGIvTe60HVzntBW15YtyTI7GyWafeOmozLMi7k0td5zrU9OH26x1RdVNsn1RFfEINK7Smx/BYkJXPNmsm6/ssz2QNwJb/wS@IvaSzK5TuAoEi8SL3q/6t9EA9nSe2fSr0@lXpb9bSZ5l8 "Java (OpenJDK 8) – Try It Online")
**Explanation:**
```
int r[]=new int[a],i=0;    //Initialize array and loop counter
java.util.Arrays x=null;    //reduces the number of of “Arrays” needed from 3 to 1
x.fill(r,a);    //Sets each value in array length n to int n
for(r[0]++;i<a;r[i++]++)    //Increment everything!
  for(;--r[i]>i;    //If decremented array element is larger than element number:
     System.out.print(x.toString(r)));}    //Print the array
```
**Credit:**
-8 bytes thanks to [Jonathan Frech](https://codegolf.stackexchange.com/users/73111/jonathan-frech)!
-16 bytes thanks to [Kevin Cruijssen](https://codegolf.stackexchange.com/users/52210/kevin-cruijssen)!
-1 byte thanks to [Okx](https://codegolf.stackexchange.com/users/26600/okx)!
[Answer]
# Haskell, ~~69 67 65~~ 63 bytes
Recursive definition:
```
f 0=[[]]
f a=map(:(a<$[2..a]))[a,a-1..2]++[1:map(+1)x|x<-f$a-1]
```
Thanks to Laikoni for 2 bytes!
[Answer]
## PHP, 153 Bytes
[Try it online!](https://tio.run/##bczBCgIhEAbge09RyxyUbZft0MmVHqRiEVM0ZBzcImLx2U3vwfDD/Px85KjMF6pp36hfPuLeMkC@gZIqJfVdrA@BTUfAelxAks814mJQx4dhoPjY3bATQHISH@dD7WhugK@OugLdDxKoPzWxfcNQjfE/kk1YzVbXvcjZaBchibwrlp25KD8)
**Code** 
```
function f($n){
$a=array_fill(0,$n,$n);$r=json_encode($a)."\n";$p=0;while($p<$n)
{if($a[$p]!=$p+1){$a[$p]--;$r.=json_encode($a)."\n";}else{$p++;}}echo$r;}
```
*Gonna try to lower the bytes, or finish the recursive function*
**Explanation**
```
function f($n){
  $a=array_fill(0,$n,$n);          #start with $nlength array filled with $n
  $r=json_encode($a)."\n";         #pushed to the string to output
  $p=0;                            #first position
  while($p<$n){                    #on position $n ($n-1) we do nothing
    if($a[$p]!=$p+1){              #comparing the position+1 to the value
     $a[$p]--;                     #it gets decreased by 1
     $r.= json_encode($a)."\n";    #and pushed
   } else {
     $p++;                       #when position+1 = the value,
   }                               #position is changed ++
  }
   echo $r;
  }
```
[Answer]
# [Python 2](https://docs.python.org/2/), ~~80~~ 76 bytes
```
i=input();l=[i]*i;print l
for x in range(i):
 while l[x]>x+1:l[x]-=1;print l
```
[Try it online!](https://tio.run/##K6gsycjPM/r/P9M2M6@gtERD0zrHNjozVivTuqAoM69EIYcrLb9IoUIhM0@hKDEvPVUjU9OKS6E8IzMnVSEnuiLWrkLb0ArE0LU1hGn5/98EAA "Python 2 – Try It Online")
Bit wasteful having two `print` statements but I can't think of a better way at the moment.
[Answer]
# [Python 2](https://docs.python.org/2/), 70 bytes
-2 bytes thanks to @LeakyNun  
-2 bytes thanks to @JonathanFrech
```
i=I=input()
l=[I]*I
exec"exec'print l;l[-i]-=1;'*max(~-i,2);i-=1;"*~-I
```
[Try it online!](https://tio.run/##K6gsycjPM/r/P9PW0zYzr6C0REOTK8c22jNWy5MrtSI1WQlEqBcUZeaVKORY50TrZsbq2hpaq2vlJlZo1Olm6hhpWmeCRJS06nQ9//83AwA "Python 2 – Try It Online")
[Answer]
# [Java (JDK 10)](http://jdk.java.net/), 112 bytes
```
n->{var s="";for(int i=1,k=n,j;i<=n;k=--k>i?k:n-++i+i)for(j=0;j++<n;)s+=(j<i?j:j>i?n:k)+(j<n?",":";");return s;}
```
[Try it online!](https://tio.run/##dc7BaoQwEAbgu08x5GQaDS0UCsbordBDT3tse0hdLRN1lCQKy@Kz22zXaw/DMMw/zGfNanJ77ncc58kFsHGWS8BBdgs1ASeSDyppBuM9vBukawLggwnYwBuF1yNTnoJD@qmgAw075dV1NQ68Zkx1k0uRAqB@ynpNmVVYalK9zvO@wrovKBcCBfJb0OpHZYUoSXEvdGpLrG1hY4yKnos4U80yVjDFuHJtWByBV9uuImpevoeIOmzrhGcYoze9yz6@DL/RAeIb@ANRpD6r2EoNL7ELweEeAThdfGhHOS1BzvE8DJR20szzcEmJS9fOg2naNDIy9kmMc/X/3bHbkltt@y8 "Java (JDK 10) – Try It Online")
[Answer]
# [J](http://jsoftware.com/), ~~17~~ 15 bytes
```
+/\@,(#=)@i.&.-
```
[Try it online!](https://tio.run/##y/qfVqxga6VgoADE/7X1Yxx0NJRtNR0y9dT0dP9rcinpKaingRSoK@go1FoppBVzcaUmZ@QrpCmY/AcA "J – Try It Online")
## Explanation
```
+/\@,(#=)@i.&.-  Input: n
              -  Negate n
          i.     Reverse of range [0, n)
       =           Identity matrix of order n
      #            Copy each row by the reverse range
              -  Negate
    ,            Prepend n
+/\              Cumulative sum of rows
```
[Answer]
# [Retina](https://github.com/m-ender/retina/wiki/The-Language), 49 bytes
```
.+
*
_
$`_,$= 
.{*\`_+,(_+)
$.1
0`(\b(_+),\2)_
$1
```
[Try it online!](https://tio.run/##K0otycxLNPz/X0@bS4srnkslIV5HxVaBS69aKyYhXltHI15bk0tFz5DLIEEjJgnE04kx0gSqA2ox/Q8A "Retina – Try It Online") Explanation:
```
.+
*
```
Convert the input to unary.
```
_
$`_,$= 
```
Create a list of n copies of `i,n` where `i` is the index of the copy.
```
.
```
Don't print anything (when the loop finishes).
```
{
```
Loop until the pattern does not change.
```
*\`_+,(_+)
$.1
```
Temporarily delete the `i`s and convert the `n`s to decimal and output.
```
0`(\b(_+),\2)_
$1
```
Take the first list entry whose value exceeds its index and decrement it.
[Answer]
# [Python 3](https://docs.python.org/3/), ~~70~~ ~~67~~ 65 bytes
```
def f(n):
 k=0;a=[n]*n
 while k<n-1:print(a);k+=a[k]==k+1;a[k]-=1
```
[Try it online!](https://tio.run/##K6gsycjPM/7/PyU1TSFNI0/Tiksh29bAOtE2Oi9WK49LoTwjMydVIdsmT9fQqqAoM69EI1HTOlvbNjE6O9bWNlvb0BrE0rU1/J@mYaL5HwA "Python 3 – Try It Online")
* (67) Converting to function: -3 bytes
* (65) Removing unneeded parentheses: -2 bytes
**Ungolfed version:**
```
def f(n):
    k = 0
    a = [n] * n             # create n-item list with all n's
    while k < n - 1:        # iterate through columns 0..n-1
        print(a)            # print whole list
        if a[k] == k + 1:   # move to the next column when current item reaches k+1
            k += 1
        a[k] -= 1           # decrement current item
```
[Answer]
# [C (clang)](http://clang.llvm.org/), ~~131~~ 141 bytes
```
i,j,k,m[99];p(){for(k=0;m[k];printf("%d ",m[k++]));puts("");}f(n){for(j=k=m[n]=0;k<n;m[k++]=n);p();for(;j<n;j++)for(i=1;i++<n-j;m[j]--,p());}
```
[Try it online!](https://tio.run/##TY7BboMwEETP9VesqCrZMTSkt8i4P4I4UDCJ7bAgbNRIEd9O141UdU@7ozcz2xXdrcXL/mqxu629gSrE3k7v10/2X1osXkjbbe5yn4/1@dyomYvHMC3c61KNtSeBqDjw7K2HjBgvZSOEmtcYeJYJtQ0cnw6nvR5rbMjoK1RPVKNIkSoBypHspBTpsPqkrJQVFo5Q1xRFThzl7VQHY2uRC3iwdNxBQ6kYS7a0n0pFWqXhIy2URxwM/C4Ug7@/XmiOB/j9HoKZ26WNdkL4MvHbGIRoQoSuDSbA4cg2xhYT1wVT0bb/AA "C (clang) – Try It Online")
This will work for all `n` upto 99. TIO truncates output. It can support arbitrarily larger `n` by changing size of array `m` as memory permits.
---
Following is limited to n=1..9 but is significantly shorter
# [C (clang)](http://clang.llvm.org/), ~~89~~ 92 bytes
```
i,j;char m[12];f(n){j=!puts(memset(m,n+48,n));for(;j<n;j++)for(i=1;i++<n-j;m[j]--,puts(m));}
```
[Try it online!](https://tio.run/##TY2xbsMwDETn6iuYdJEiu6mLDilo90eCDKpDJxIi2pBkNEDgb3eldikX8h7ujn3d3wxf1mfL/W0@E7Qxne34cv0U/1GwfMlstZXD/moC@GPzdsJBsnq4bjPNKUpPPlKSvmL9fqhYKRzGING1jE5rVYTtGrRat1w79Ed3quvqL5rNy2o5gTeWpYKHKOIOHbyiECVa7gYzajv4yDs3ZhcM8q5QwG/LdqvwKc9@B1Mo@UiTCSbZkeGL0jcRQ6KYoDeRIuz2YhEiUJoDlzfL@gM "C (clang) – Try It Online")
Updated: Modified to avoid dependence on static initialization
[Answer]
## Clojure, 132 bytes
```
#(loop[R[(vec(repeat % %))]j(- % 2)i 0](if(> i j)R(recur(conj R(update(last R)i dec))(if(= i j)(- % 2)(dec j))(if(= i j)(inc i)i))))
```
I was hoping this to be shorter...
Less stateful but longer at **141** bytes:
```
#(apply map list(for[i(range %)](concat(repeat(nth(cons 0(reductions +(reverse(range %))))i)%)(range % i -1)(if(>(dec %)i)(repeat(inc i))))))
```
[Answer]
# Python 3, 101 bytes
```
def f(n):
 p=print;m=[n for_ in range(n)];p(m)
 for i in range(n):
    while m[i]>1+i:m[i]-=1;p(m)
```
I could probably golf more with the print, but I'm away from my computer and am not entirely sure of python 2's rules on setting a variable to print. I'll update later when I get to a computer or if someone clarifies in the comments.
[Answer]
# [K (ngn/k)](https://gitlab.com/n9n/k), ~~34~~ 32 bytes
```
{{x[y]-:1;x}\(,x#x),,/(|!x)#'!x}
```
[Try it online!](https://tio.run/##y9bNS8/7/z/Nqrq6IroyVtfK0LqiNkZDp0K5QlNHR1@jRrFCU1ldsaL2f5qCyX8A "K (ngn/k) – Try It Online")
]