[Question]
  [
The look-say sequence is a sequence of lists of numbers where each element is the previous element with run length encoding. Run length encoding is the process of grouping together like elements and then giving the element and the size of the group for each group. So for example:
```
1 1 1 2 2 1
```
To run length encode this we group like elements together
```
1 1 1 | 2 2 | 1
```
And then replace each group with its size and the element:
```
3 1 | 2 2 | 1 1
```
Then we concatenate these back together:
```
3 1 2 2 1 1
```
The look-say sequence starting from just `1` goes:
```
1
1 1
2 1
1 2 1 1
1 1 1 2 2 1
3 1 2 2 1 1
1 3 1 1 2 2 2 1
1 1 1 3 2 1 3 2 1 1
3 1 1 3 1 2 1 1 1 3 1 2 2 1
1 3 2 1 1 3 1 1 1 2 3 1 1 3 1 1 2 2 1 1
...
```
But we can start with different values. For example we could start with `2`
```
2
1 2
1 1 1 2
3 1 1 2
1 3 2 1 1 2
1 1 1 3 1 2 2 1 1 2
3 1 1 3 1 1 2 2 2 1 1 2
1 3 2 1 1 3 2 1 3 2 2 1 1 2
1 1 1 3 1 2 2 1 1 3 1 2 1 1 1 3 2 2 2 1 1 2
```
Or we could even start it with `3 3 3`:
```
3 3 3
3 3
2 3
1 2 1 3
1 1 1 2 1 1 1 3
3 1 1 2 3 1 1 3
1 3 2 1 1 2 1 3 2 1 1 3
1 1 1 3 1 2 2 1 1 2 1 1 1 3 1 2 2 1 1 3
```
In this task you are going to be given a sequence and your job will be to trace it back as far as you can to get a starting point. That is you are going to undo operations until you get a list of numbers that could not have been produced by run length encoding another list.
As some examples:
* `3 3 3` is not a possible run length encoding since it has an odd number of terms.
* `1 2 2 2` is not a possible run length encoding since expanding it out gives `2 2 2` which would be encoded as `3 2` instead.
As input you will receive a list of positive integers less than 4. You should output all the terms of the look-say sequence up to and including the input. Your output may be in forwards or backwards order.
There is one case where the input can be traced back indefinitely `2 2`. What your program does on this input is undefined behavior.
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") the goal is to minimize the size of your source code as measured in bytes.
## Test cases
```
1:
1
1 1 1 2 1 1 1 3:
3 3 3
3 3
2 3
1 2 1 3
1 1 1 2 1 1 1 3
1 2 2 1 1 3 1 1 1 2:
1 2 2 2
1 1 3 2
2 1 1 3 1 2
1 2 2 1 1 3 1 1 1 2
1 2 1 3 1 2 1 1:
3 3 3 1 1 1
3 3 3 1
3 3 1 1
2 3 2 1
1 2 1 3 1 2 1 1
```
  
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), ~~19~~ 16 bytes
-3 bytes thanks to Mukundan314
```
W.A.+%2t
Q=r9cQ2
```
[Try it online!](https://tio.run/##K6gsyfj/P1DZU19PW9WoJDDKicu2yDI50Oj//2hDHQUjHQUgaQwmIWzDWAA "Pyth – Try It Online")
Prints in reverse order.
### Explanation
```
W                   while:
 .A                    zero is not in
   .+                  the deltas of
     %2tQ              every second element of implicitly printed Q
          =r9cQ2    set Q to the length decoding of itself
```
[Answer]
# Excel (ms365), 374 bytes
[![enter image description here](https://i.stack.imgur.com/4VYDf.png)](https://i.stack.imgur.com/4VYDf.png)
[![enter image description here](https://i.stack.imgur.com/kEMJd.png)](https://i.stack.imgur.com/kEMJd.png)
[![enter image description here](https://i.stack.imgur.com/yFw70.png)](https://i.stack.imgur.com/yFw70.png)
Formula in `A3`:
```
=LET(x,CONCAT(1:1),y,TOCOL(SCAN(x,SEQUENCE(1048575),LAMBDA(a,b,LET(c,SEQUENCE(LEN(a)/2,,,2),IF(ISODD(LEN(a)),NA(),CONCAT(REPT(MID(a,c+1,1),MID(a,c,1))))))),3),z,MAP(y,LAMBDA(d,LET(e,SEQUENCE(LEN(d)),f,MID(d,e,1),g,TEXTSPLIT(CONCAT(f&IF(f<>MID(d,e+1,1),"|","")),"|",,1),CONCAT(LEN(g)&LEFT(g))))),MID(FILTER(VSTACK(x,y),VSTACK(1,z=VSTACK(x,DROP(y,-1)))),SEQUENCE(1,LEN(x)),1))
```
All one has to do is change the input in 1st row.
* 'x-varibale' - `CONCAT(1:1)` - Concatenate all values from row 1 into a string;
* 'y-variable' - `TOCOL(SCAN(x,SEQUENCE(1048575),LAMBDA(a,b,LET(c,SEQUENCE(LEN(a)/2,,,2),IF(ISODD(LEN(a)),NA(),CONCAT(REPT(MID(a,c+1,1),MID(a,c,1))))))),3)` - Will go over 1048575 possibilities (max rows in ms365 if one include the input at the end) and will get each number from every even position and repeat it n-times where n == its neighboring digit on the left;
* 'z-variable' - `MAP(y,LAMBDA(d,LET(e,SEQUENCE(LEN(d)),f,MID(d,e,1),g,TEXTSPLIT(CONCAT(f&IF(f<>MID(d,e+1,1),"|","")),"|",,1),CONCAT(LEN(g)&LEFT(g)))))` - Loop over elements from y and reverse it's value into it's logical predecessor;
* `MID(FILTER(VSTACK(x,y),VSTACK(1,z=VSTACK(x,DROP(y,-1)))),SEQUENCE(1,LEN(x)),1)` - Finally we can check each value against the elements in y and filter what is not a possible run length encoding string. All strings are then cut into seperate integers again.
No doubt other Excel-fanatics can beat this, but my brain is fried! I'm not even sure an answer like this length belongs on CG...
[Answer]
# [Pip](https://github.com/dloscutoff/pip) `-p`, 33 bytes
```
T$|_=BMPDQUWg|%#gg:_@1RL@_MF<>Pgg
```
Takes the initial sequence as separate command-line arguments; prints the sequences from there on back as far as possible to stdout as lists. [Try It Online!](https://dso.surge.sh/#@WyJwaXAiLCIiLCJUJHxfPUJNUERRVVdnfCUjZ2c6X0AxUkxAX01GPD5QZ2ciLCIiLCIiLCItcCAxIDIgMSAzIDEgMiAxIDEiXQ==)
### Explanation
The basic structure of the program is
```
T <cond> <body> g
```
that is, loop until `<cond>` becomes true, executing `<body>` each time, and at the end of the loop, output the final value of `g`. (The original value of `g` is a list of the command-line arguments.)
The condition is:
```
$|_=BMPDQUWg|%#g
         UWg      Unweave g into two lists, each containing every other value
       DQ         Get the latter of the two (the values at odd indices)
     MP           Map this function to each adjacent pair of values in that list:
  _=B               The first equals the second
$|                Fold on logical OR: true if any of the equality checks are true
            |     OR:
              #g  The length of g
             %    Is odd
```
The loop body is:
```
g:_@1RL@_MF<>Pg
             Pg  Print the current value of g
           <>    Group into chunks of length 2
         MF      Map this function to each chunk and flatten the resulting list:
       @_          The first number in the chunk
     RL            Create a list containing that many copies of
  _@1              The second number in the chunk
g:               Assign the resulting list back to g
```
[Answer]
# [MATL](https://github.com/lmendo/MATL), ~~18~~ 17 bytes
*This uses [CursorCoercer](https://codegolf.stackexchange.com/users/73054/cursorcoercer)'s [idea](https://codegolf.stackexchange.com/a/253834/36398) of testing if increments are zero.*
The output is in backwards order.
```
`t0h2L&)Y"6Mdyh]x
```
Verify test cases: [1](https://tio.run/##y00syfn/P6HEIMPIR00zUsnMN6UyI7bi//9ow1gA), [2](https://tio.run/##y00syfn/P6HEIMPIR00zUsnMN6UyI7bi//9oQwUQNFKA0MaxAA), [3](https://tio.run/##y00syfn/P6HEIMPIR00zUsnMN6UyI7bi//9oQwUjIDQEQmMwCeTHAgA), [4](https://tio.run/##y00syfn/P6HEIMPIR00zUsnMN6UyI7bi//9oQwUjBUMFYwUIbRgLAA).
### Explanation
```
`         % Do... while
  t       %   Duplicate current list of numbers (*). This takes input implicitly in
          %   the first iteration
  0h      %   Append a 0
  2L&)    %   Push the subarray of entries at (1-based) even positions (**), then
          %   the subarray of entries at odd positions (***)
  Y"      %   Run-length decoding using those two subarrays as inputs, cyclically
          %   reusing the shorter of the two if needed. The result will contain
          %   zeros if and only if (*) had odd length
  6M      %   Push (**) again
  d       %   Consecutive differences
  y       %   Duplicate from below: pushes again the result of run-length decoding 
  h       %   Concatenate horizontally
]         % End. A new iteration is run of the top of the stack contains no zeros
x         % Delete. This removes the last array, which is not valid. Implicit display
```
[Answer]
# JavaScript (ES10), 91 bytes
Inspired by [CursorCoercer's answer](https://codegolf.stackexchange.com/a/253834/58563).
```
f=a=>[...a.every((v,i)=>a[i%2-~i]^i%2*v)?f(a.flatMap((v,i)=>Array(i&1&&p).fill(p=v))):[],a]
```
[Try it online!](https://tio.run/##dctBCsIwEAXQvadwY5mRNtB0J6TiATxBiDDURCKhCWkJdOPVY0ErRRQ@zGd4/06Jhi7aMFa9v@qcjSDRSsYYMZ10nABSaVG0JO2OVw@rLvPdJzwaIGYcjWcKiznFSBPYoi6KgMxY5yCIhIgHqUpSufP94J1mzt/AgKwV4ub7V25f4UuZ0/yGfKWaFed/@Qe@dzPMTw "JavaScript (Node.js) – Try It Online")
### Commented
Testing if `a[]` is still valid:
```
a.every((v, i) =>   // for each value v at position i in a[]:
  a[i % 2 - ~i]     //   get a[i + 1] if i is even, or a[i + 2] if i is odd
  ^                 //   and make sure it's different from
  i % 2 * v         //   0 (or undefined) if i is even, or v if i is odd
)                   // end of every()
```
Run-length decoding of `a[]`:
```
a.flatMap((v, i) => // for each value v at position i in a[]:
  Array(i & 1 && p) //   build an array of p entries if i is odd,
                    //   or an empty array if i is even
  .fill(p = v)      //   fill it with v and copy v to p
)                   // end of flatMap()
```
---
# JavaScript (ES6), 91 bytes
A version without `.flatMap()`.
```
f=a=>[...a.every((v,i)=>a[j=i%2,b.push(...Array(j&&p).fill(p=v)),j-~i]^j*v,b=[])?f(b):[],a]
```
[Try it online!](https://tio.run/##dcvfCsIgGAXw@56im8b3hROyu8BFzyEGbmkpMsWVsJte3Qb9YUTBuTgcfseprIYu2Xit@3DSpRiueCMopYrqrNMIkIlF3ijhuF0x0tJ4Gy4wgUNKagRXVRGpsd5D5BmRuPpu5dGtM2m5kLg30OJOSKJk6UI/BK@pD2cwIDYScfG9keUz7F2mbH9DNlPbGWd/@Qe@fhMsDw "JavaScript (Node.js) – Try It Online")
[Answer]
# [R](https://www.r-project.org/), ~~70~~ 69 bytes
*Edit: -1 byte thanks to pajonk*
```
f=function(v)if(all(w<-c(print(v),0)[!1:0],diff(w)))f(rep(w,v[!0:1]))
```
[Try it online!](https://tio.run/##hYxBCoMwEEX33kJXM5BCEne2OYl1IWkHQkMiaUzs6dNWha6KzOLD/@9NKNb7x3N8GZdUIUWz09F4BwkNwWgt5MtJwxSMi5@Ocexr0fGB3QwRZEQkCPcJMkt9zTsxIJZFaRBY/R7Dgmc9RmiursFqndn3JNuyPYLljra7II@FDV61/3B5Aw "R – Try It Online")
```
f=function(v,                       # f is recursive function with arg vector v;
                 print(v)           #   first print v
             w=c(          )[!1:0]) #   and set w to every second element of v,
                         ,0         #   followed by a zero if length is odd.
if(              )                  # now, check if v is valid:
   all(w,       )                   #   there shouldn't be a final zero
         diff(w)                    #   and every second element should be different to its neighbour
                  f(              ) # if so, recurse
                    rep(w,v[!0:1])  #   with even numbered elemnts of v
                                    #   repeated odd numbered elements of v times
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~17~~ 15 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
[=ιÂ`ÅΓ©Åγ‚RÊ#®
```
Outputs in 'reversed' order compared to the challenge description.
[Try it online](https://tio.run/##yy9OTMpM/f8/2vbczsNNCYdbz00@tBJIbn7UMCvocJfyoXVAOUMdEDTSgdDGsQA) or [verify all test cases](https://tio.run/##yy9OTMpM/V@m5JlXUFpipaBkX6nDpeRfWgLkFQO5OpX/o23P7TzclHC49dzkQyuB5OZHDbOCDncpH1r3v/bQNvv/0dGGsTrRhjogaKQDoY3BIkZQvjFU1AgqChEBy8XGAgA).
**Explanation:**
I basically run-length decode and then encode it again, and see if it's unchanged.
```
[         # Start an infinite loop:
 =        #  Print the current list with trailing newline (without popping)
          #  (which will be the implicit input-list in the first iteration)
  ι       #  Uninterleave the copy into 2 parts: [lengths,values]
   Â      #  Bifurcate (short for Duplicate & Reverse copy) this pair of lists
    `     #  Pop and push the reversed pair of lists to the stack
     ÅΓ   #  Pop both the values & length lists, and run-length decode them
       ©  #  Store this list in variable `®` (without popping)
   Åγ     #  Run-length encode it again, pushing the list of values and lengths
          #  separated to the stack
     ‚R   #  Pair them together in reversed order: [lengths,values]
   Ê      #  If the two pairs of lists are NOT the same:
    #     #   Stop the infinite loop
 ®        #  (else) Push the list of variable `®` for the next iteration
    
```
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 13 bytes
```
Wq
Qsr8=r9cQ2
```
[Try it online!](https://tio.run/##K6gsyfj/P7yQK7C4yMK2yDI50Oj//2hDHQUjHQUgaQwmIWzD2H/5BSWZ@XnF/3VTAA "Pyth – Try It Online")
### Explanation
```
Q is initialized to input
Wq\nQsr8=r9cQ2
W              # while
  \nQ          #   print(Q)
 q             #     ==
     sr8=r9cQ2 #   run_length_encode(Q = run_length_decode(Q)):
               #  pass
```
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 28 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
```
OpU;Êv ©Uó Ìän e ©ßUò crÈo{Y
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=T3BVO8p2IKlV8yDM5G4gZSCp31XyIGNyyG97WQ&input=WzEgMSAxIDIgMSAxIDEgM10)
I imagine there's room for improvement. Outputs in "reverse" order.
Explanation:
```
OpU;Êv ©Uó Ìän e ©ßUò crÈo{Y
OpU;                         # Print the input followed by a newline
    Ê                        # The length of the input
     v                       # Is divisible by 2
       ©                     # Break if false
        Uó                   # Separate the input into "sizes" and "elements"
           Ì                 # Take just the array of elements
            än               # Calculate the consecutive differences
               e             # Check that they are all non-zero
                 ©           # Break if false
                  ß          # Otherwise repeat the program with new input:
                   Uò        #  Split the current input into size,element pairs
                      cr     #  Run the following on each pair, then flatten:
                        Èo   #   An array with length equal to the first number
                          {Y #   Where each element is the second number
```
I've made an [alternative](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=ynYgqVXzIMzkbiBlIKnfTnBV8iBjcshve1l9fSnMCk4&input=WzEgMSAxIDIgMSAxIDEgM10tUg) which builds an array instead of printing in each loop, but it's currently longer.
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 42 bytes
```
Ｗ∧⊞Ｏυθ¬∨﹪Ｌθ²⊙✂θ³Ｌθ²⁼κ§θ⊕⊗λ≔ΣＥ⪪θ²⁺⊟κＥ⊟κ⁰θＩυ
```
[Attempt This Online!](https://ato.pxeger.com/run?1=XU-xTsMwEN35CqvTRXKlhi5InSLKUKmlkTJGGVzHbaxe7cT2FfgWlg4g-Ab-hIVvwQbagZNO907vvdO753fZCSetwNPplcJ2fPP59dBpVAwK00JJvlv3yolgHRBnQ8bZvQ2wdrCyLaGFpTK70EEirmMX5gkq1FLBwNmUs3_03UACPeyjMCxMqx6TbGGkUwdlgmphbmmDcWJ2LlZ4r3cGKjrASvRQ9ahDsqV7JZKH0vawj0tiz3iSrCnv7Kp02gS4FT4AZdnsxW-k__v1rR6NjzhqPuo6jwc5y39CX3DeNL_Cbw) Link is to verbose version of code. Outputs the lists in reverse order; each element is printed on its own line and lists are double-spaced from each other. Explanation:
```
Ｗ∧⊞Ｏυθ¬∨
```
Push the current list to the predefined empty list, and while neither...
```
﹪Ｌθ²
```
... the length of the list is odd, nor...
```
⊙✂θ³Ｌθ²⁼κ§θ⊕⊗λ
```
... any of the third, fifth, seventh etc. entries equals the entry two previous, then...
```
≔ΣＥ⪪θ²⁺⊟κＥ⊟κ⁰θ
```
... run-length decode the list.
```
Ｉυ
```
Output all of the collected lists.
[Answer]
# [Haskell](https://www.haskell.org/), 86 bytes
```
r!(a:b:t)|r==b=[0]|k<-b<$[1..a]=k++b!t
r![]=[]
r!x=[0]
g l|0`elem`0!l=[l]|1>0=l:g(0!l)
```
[Try it online!](https://tio.run/##fY7PCsIwDMbveYpMPCj@YU1vxfoE3jyWghuOKeum1Aoe9u6ztR2iiIQ2yff9kvZU3JrKmGGw2awQpXDz3kpZSpXrvtmsys1UsfW60LJZLMrMgc2Ulkr7/AgM1Gj6/FCZqj3kmZHK6J5tc2lEPfP9fGiLc4cSjxcEvNpz53CKtWLad3e3d3bX4WTyYS1D0DJm/g@khPEE0384gq8RPTABDIBhCMKYuQCOPsIN5E@0@DcGLyO2PIkkkkgQZYI3QL8GYFw/rk6vR3@sISnhPwH7HoIn "Haskell – Try It Online")
r!list compares *r* with element to replicate, if they are equal inserts a 0 in the resulting list, same does if it matches an odd list.
Function *g* repeatedly apply *0!* and stops if there is a *0* in the result.
[Answer]
# [Ruby](https://www.ruby-lang.org/), 73 bytes
-15 bytes thanks to [AZTECCO](https://codegolf.stackexchange.com/users/84844/aztecco)
```
F=->a,y=0{a.all?&&(p a)&&F[a.each_slice(2).flat_map{y!=_2&&[y=_2]*_1},y]}
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m72kqDSpcsGCpaUlaboWNz3dbHXtEnUqbQ2qE_USc3Ls1dQ0ChQSNdXU3KIT9VITkzPii3Myk1M1jDT10nISS-JzEwuqKxVt443U1KIrgVSsVrxhrU5lbC3UQCO36GhDHRA00oHQxrGxXAWlJcVcYBkjqLgxVNYoNhaiE-YkAA)
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 14 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
Ṅṭ2/Ḋm2IẠƲ¡Œṙß
```
A full program that accepts a list of integers from \$[1,4]\$ and prints the results in Jelly's list format separated by newlines.
**[Try it online!](https://tio.run/##y0rNyan8///hzpaHO9ca6T/c0ZVr5Plw14Jjmw4tPDrp4c6Zh@f////fUEfBSEcBSBqDSQjbEAA "Jelly – Try It Online")**
### How?
Inspired by [CursorCoercer](https://codegolf.stackexchange.com/users/73054/cursorcoercer)'s [Pyth answer](https://codegolf.stackexchange.com/a/253834/53748).
`Œṙ`, run-length decode, will error if given a list of integers or a list containing a singleton list. The code ensures that if the current list identifies the same value to be repeated twice in a row then the former will be true and, otherwise, if the current list is of odd length when the latter will be true.
```
Ṅṭ2/Ḋm2IẠƲ¡Œṙß - Main Link: list of integers, S
Ṅ              - print S
          ¡    - repeat...
         Ʋ     - ...number of times: last four links as a monad:
    Ḋ          -                       dequeue
     m2        -                       modulo-two slice
       I       -                       deltas
        Ạ      -                       all non-zero?
  2/           - ...action: pairwise reduce by:
 ṭ             -              tack
           Œṙ  - run-length decode
             ß - call this link again with that as S
```
[Answer]
# [Python](https://www.python.org), ~~126~~ ~~124~~ ~~120~~ ~~113~~ 110 bytes
```
i=lambda t,x,a,b,*c:b and i(t&(b!=c[1]),x+(b,)*a,*c)or(x,a*t)
j=lambda l,t=1:t*[0]and j(*i(1,(),*l,1,0,0))+[l]
```
[Attempt This Online!](https://ato.pxeger.com/run?1=ZZA7jsJADIb7nMKbAtmDs8qjWUXKSUKKGR7aicIkCl4JzkJDA-eh5TY7EIKCsP7C0v_5ebx0B_lt3el0_pNN9HNztmj01qw0CO9Zs2G1zA1otwKLMkPzVSzLpCLez9EwKe19anv0rBIK6rG6YSmSXFQZV_faGpXFhJFYNZxwzDHRvGyq59SrrHcCBZQB-PAgEL_SQemYeGUTN51Y2YRJ35mX-4Q_-g9ARkEVbNoeBKyD-1b5g-t66wTDhQu_69Y63OoOd9JzjUI-pkwURSENd41f_Qc)
The recursive function `i` simultaneously undoes the look-and-say sequence and also determines whether it's a valid sequence -- the last element of the return value is `1` if the sequence is valid and `0` if it's not.
This is then used in the main function `j` to undo the calculation until hitting a stopping point.
[Answer]
# [Raku](https://raku.org/), 60 bytes
```
{$_,*.flatmap(*Rxx*)...{$_%2|{any $_ Z==.skip}(.[1,3...*])}}
```
[Try it online!](https://tio.run/##NcxNCsIwEIbhq3yUKEkIA03BhTU9hEtFQhcGxLaGWqGl5uyxfzKLGZ4Xxt/b6hDrAXsHE0dmlSRXlV1dei7PfS8FEU2809@xbAYwi4sx9H4@fOB0TVU2dXkTIUT3asFTJRROKebRWHdWLKQ3yDbWf15piQVG@E@HhNljkoPme/7rOLMiX1OCEH8 "Perl 6 – Try It Online")
This is a lazily generated sequence of the form `first-element, generator ... termination-condition`.
* The first element is `$_`, the list argument to the function.
* `*.flatmap(* Rxx *)` takes the previous element and `flatmap`s over it two elements at a time using the anonymous function `* Rxx *`. `Rxx` is the `R`eversed version of the replication operator `xx`; it produces a number of copies of its right-hand side given by its left-hand side.
* The termination condition is an anonymous function that returns true if `$_ % 2`--that is, if the number of elements in the last list is odd--or if `.[1, 3 ... *]`, the odd-indexed elements of the last list, satisfies the condition `any $_ Z== .skip`--that is, if any two adjacent elements are equal.
[Answer]
# Rust, 146 bytes
```
|a|while dbg!(&a).len()%2<1{let(c,mut r,mut p)=(a.chunks_exact(2),vec![],9);for
t in c{if p==t[1]{return}p=t[1];r.extend([p].repeat(t[0]));}*a=r;}
```
[Playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=b6756f974d65fb5fb8840ac7bc2146c0)
This is a `fn(&mut Vec<usize>)`.
[Answer]
# [Python](https://www.python.org), 93 bytes
```
f=lambda a:(a,*(eval("0"+(l:=len(b:=a[1::2]))*"!=%d"%b)*a[~l:l]and f(eval(l*"+%d*(%d,)"%a))))
```
[Attempt This Online!](https://ato.pxeger.com/run?1=VY5BCsIwEEX3PcUYCExiBdtuJJCT1C6mpMFCTEWj4MZLuHRTEL2Tt7FaW-rnwwz8N_y5PXfnsGl8e7d6_TgGu1i9CqsdbUtDQAopllidyCFbsjk6pV3lsVSa8kSptBBCspnmhvFSSMovTrmCvAHbHznJ5txI5CYWjJPo9Cu5huoQQEMeQSdMYhDxuPZOh6VzNknTSZRNmPSfGdMfLKIiss0eaqg9fNrVl97tax_QYj281rb9fAM)
Returns the history newest to oldest.
# [Python](https://www.python.org), 80 bytes
```
def f(a):print(a);f(eval(eval((l:=len(b:=a[1::2]))*".0!=%d"%b)*l*"+%d*(%d,)"%a))
```
[Attempt This Online!](https://ato.pxeger.com/run?1=VVBLCsIwEN33FGMgkIlVbLuRSO7gvnSR2gQLJS01ij2Lm4LonbyNtT_q8Bje8B7ze7yrxp1L27avqzOb_eeYaQOGKRRVnVvXkYNh-qaKIbFCyEJblgqp4kCIMEHkZLtbSZoRmiIvOFnTjDOa-UioQhz7Pp2-OJAQe9AFC3xAf6YDwol0iBZquJCihSf898zqaEYv8UxZQw65hd900btd3QjDcuwLfT_pyo2njqtOr_gC)
Prints the history line-by-line newest to oldest. Exits with an error.
#### How?
Nothing clever here. Using `eval` because control structures in general and in particular concatenation of a list of strings or pairwise iteration over a list or chained comparisons are all rather verbose when done "the proper way" in Python.
The second, semi-legal version does away with a few stop conditions (like odd number of terms) because the function crashes at the right time anyway when any of these conditions are met.
]