[Question]
  [
## Introduction
Suppose you have a list of lists of integers (or any objects really, but let's stick to integers for simplicity).
The lists may be of different lengths, and some of them may be empty.
Let's write the lists in a tabular format:
```
[[ 1,   2,   3,   4,   5],
 [ 6,   7],
 [ 8,   9,  10,  11],
 [],
 [12,  13,  14],
 [15,  16,  17,  18]]
```
This table has 5 vertical columns, containing the numbers `1, 6, 8, 12, 15`, `2, 7, 9, 13, 16`, `3, 10, 14, 17`, `4, 11, 18`, and `5`.
If we reverse each column, we obtain the lists `15, 12, 8, 6, 1`, `16, 13, 9, 7, 2`, `17, 14, 10, 3`, `18, 11, 4`, and `5`.
Let's plug those numbers back into the columns of the table while keeping the lengths of the rows the same as before:
```
[[15,  16,  17,  18,   5],
 [12,  13],
 [ 8,   9,  14,  11],
 [],
 [ 6,   7,  10],
 [ 1,   2,   3,   4]]
```
Your task is to implement this operation.
## Input and output
Your input is a list of lists of nonnegative integers, representing the rows.
The rows may have different lengths, and some of them may be empty.
There will always be at least one row.
Your output is the result of reversing each column, as detailed above.
Input and output may be in any reasonable format.
The lowest byte count in each language wins.
Standard [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") rules apply.
## Test cases
```
[[]] -> [[]]
[[],[]] -> [[],[]]
[[8,5,1]] -> [[8,5,1]]
[[1,200],[0,3]] -> [[0,3],[1,200]]
[[],[3,9],[1],[]] -> [[],[1,9],[3],[]]
[[],[5,8,7],[0,6,5,7,1]] -> [[],[0,6,5],[5,8,7,7,1]]
[[1,8,5],[7,5,4],[],[1]] -> [[1,5,4],[7,8,5],[],[1]]
[[],[],[2],[],[31],[],[5],[],[],[],[7]] -> [[],[],[7],[],[5],[],[31],[],[],[],[2]]
[[1,10,100,1000],[2,20,200],[3,30],[4],[5,50,500],[6,60],[7]] -> [[7,60,500,1000],[6,50,200],[5,30],[4],[3,20,100],[2,10],[1]]
[[8,4],[3,0,4,8,1],[8],[0,8],[9,7,1,6],[3,8,1,9,5]] -> [[3,8],[9,7,1,9,5],[0],[8,8],[3,0,1,6],[8,4,4,8,1]]
[[3,9,3],[5],[1],[3,5],[9,0,6,2],[1,3],[4,9,2],[6,6,7,8,7]] -> [[6,6,7],[4],[1],[9,9],[3,3,2,8],[1,0],[5,5,6],[3,9,3,2,7]]
[[8,5,6],[3,5,2,4,9],[4,3,8,3,7],[6,1,1],[1,8,9,9],[9,1,2],[8,7]] -> [[8,7,2],[9,1,9,9,7],[1,8,1,3,9],[6,1,8],[4,3,2,4],[3,5,6],[8,5]]
[[2,4],[1,4],[0,8,7,3],[4,9,2,5],[2,8,0],[0,8,3],[7,3,1],[],[3,3,7,8]] -> [[3,3],[7,3],[0,8,7,8],[2,8,1,5],[4,9,3],[0,8,0],[1,4,2],[],[2,4,7,3]]
```
  
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 16 bytes
```
ḟṚṁṣj
z-ç€-ZFḟ-ṁ
```
[Try it online!](https://tio.run/##y0rNyan8///hjvkPd856uLPx4c7FWVxVuoeXP2paoxvlBhTXBYr@P9zu/v9/dLSCoY6CgoIRiDAGESYgwjRWh0shWsEMxDaHsC1AbEsgYWgAIgzBomDCEKTZEKTZ0AQiYApigzQbmoMIi9hYAA "Jelly – Try It Online") or [verify all test cases](https://tio.run/##VVI9TxtBEO39K/YHjMnu7e3tbpMyXdpIYLlwnIswskjEQSSogIYeOpQoRRSloYwULKhA/JDzHznm63yOdXfrfTPzZt/bOaiXy9Oua@9/tqvbdnXRrn4djM7Gz3/Wl3fjvXeIjxHtXm4wsD7/bsZvzfr8x8v1h@er9cXj0@83pr3/RwFnFoefFvPZcd2Y5mQ@r5sGjDWfZ4vlyVG9Q1Wj9uEvll3e7Zrhp@XvZ1/N8X5tZh@/fKsNvke8XS4O62YH07C86yaT6ZROQOsIPzDsQaAEAVwP6gZhB4W1mGPB90H6CxpQMg@ZoP9pHYO@b4BrgASRySpsEId@PdbnSIzbJ0Yj5pfERF20yCkWNUdiqg4mhSzeyaoZ8sRt9bTdTukreho5h7P48Et2FKhenfHgaSn57MHiQ9sKKrvdKOKeQj1BRalCEAYCT7ROOzi7UZRAohZKFEvnS2wZfTOZBRXHMQYZzdCmfishs0dEmRglMilDcqWlVniVfL9BL9RzXQa6n4JvlaIlZhUiEyLfqrZkQNU4LsziERTc1oFIDnrizJG4GUFBA2IlV5ZAqjxzVnhgxxwJhDcjUrCEOIxuZCiz5syFjo2RISWSpMSF2hrUh8DHENTx1/I0bhSzFygErMY8z58HHRnSiXYM/mt8w5S03jFTqV5bZcSeoGNL@qlw@go "Jelly – Try It Online").
### How it works
```
z-ç€-ZFḟ-ṁ  Main link. Argument: M (matrix / 2D array)
z-          Zip the rows of M, using -1 as filler.
  ç€-       Map the helper link over the result, with right argument -1.
     Z      Zip the rows of the result.
      F     Flatten the resulting matrix.
       ḟ-   Filterfalse -1; remove all occurrences of -1.
         ṁ  Mold; shape the result like M.
ḟṚṁṣj       Helper link.
            Left argument: A (row / 1D array). Right argument: -1
ḟ           Filterfalse; remove all occurrences of -1.
 Ṛ          Reverse the resulting vector.
   ṣ        Split A at occurrences of -1.
  ṁ         Mold; shape the vector to the left like the 2D array to the right.
    j       Join the resulting 2D array, separating by -1.
```
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), ~~20~~ ~~19~~ 16 [bytes](https://codegolf.meta.stackexchange.com/a/9429/43319 "When can APL characters be counted as 1 byte each?")[SBCS](https://github.com/abrudz/SBCS ".dyalog files using a single byte charater set")
[-4 thanks to ngn.](https://codegolf.stackexchange.com/posts/154251/revisions)
Full program. Prompts for input from STDIN.
```
⍟0~¨⍨↓⍉⌽@×⍤1⍉↑*⎕
```
[Try it online!](https://tio.run/##fVG7TsNAEOzzFe4O0Ca688WvIhIoQIF4SBgKFKVwhENjJQhSQEOFzNNREEKUFFCkyC/QwJ/cj5jddSSaXKzznfZmb3ZmNznP6qfXSTY8K834bfvQ5BPlhoF5ul3BeD82xWy1YYqxwKh9IsRlko2EQBjjeKtx3N7bxDCf9IZXznDg1Pst2ket0UWaIvD4mQ6SXpbGG7tH9KiYiZq5v@uXpviQNz9TU0xN/mqKB/P8vf77boovRUH@sob8JWaWDn/9GsY78cG@IzqdblfUFl2DDQnBA2XBFLhS4lMJ2s6rIcJd2Ssg4kEIARP5WC5YUhDlYF6AWU1iJGK7I@i41aFVdXrVUa3AWkRJXPyTOxddzo1q0HQ0WbIncVHogy@X8IUsVYOEJsonJSFbpT0is@AzjhhEaG8xC7YRu1xZUJzv8XtqGblUjDYxy60kITM11T7VqqoHLuqK@C1p0DwIH7UoZg2RMeJKipntnC77VLxLqv2viLW6eCfnmOYhapjPRVNZbEhX/AE "APL (Dyalog Unicode) – Try It Online")
**Explanation with example walk-through**
`⎕` prompt for evaluated input  
 `[[1,8,5],[7,5,4],[],[1]]`
`*` raise *e* to the power of that (*e*n which ensures that there will be no zeros)  
 `[[2.7,2981,148.4],[1096.6,148.4,54.6],[],[2.7]]`
`↑` mix the lists into a single matrix, padding with zeros:  
 `┌ ┐`  
 `│2.7E0 3.0E3 1.5E2│`  
 `│1.1E3 1.5E2 5.5E1│`  
 `│0.0E0 0.0E0 0.0E0│`  
 `│2.7E0 0.0E0 0.0E0│`  
 `└ ┘`
`⍉` transpose  
 `┌ ┐`  
 `│2.7E0 1.1E3 0.0E0 2.7E0│`  
 `│3.0E3 1.5E2 0.0E0 0.0E0│`  
 `│1.5E2 5.5E1 0.0E0 0.0E0│`  
 `└ ┘`
`⌽@×⍤1` reverse the positive elements of each row  
 `┌ ┐`  
 `│2.7E0 1.1E3 0.0E0 2.7E0│`  
 `│1.5E2 3.0E3 0.0E0 0.0E0│`  
 `│5.5E1 1.5E2 0.0E0 0.0E0│`  
 `└ ┘`
`⍉` transpose  
 `┌ ┐`  
 `│2.7E0 1.5E2 5.5E1│`  
 `│1.1E3 3.0E3 1.5E2│`  
 `│0.0E0 0.0E0 0.0E0│`  
 `│2.7E0 0.0E0 0.0E0│`  
 `└ ┘`
`↓` split the matrix into a list of lists  
 `[[2.7,148.4,54.6],[1096.6,2981,148.4],[0,0,0],[2.7,0,0]]`
`0~¨⍨` remove zeros from each list  
 `[[2.7,148.4,54.6],[1096.6,2981,148.4],[],[2.7]]`
`⍟` natural logarithm  
 `[[1,5,4],[7,8,5],[],[1]]`
[Answer]
# [Japt](https://github.com/ETHproductions/japt), ~~15~~ 13 bytes
*saved 2 bytes thanks to @Shaggy*
```
y@=XfÊX£o
®fÄ
```
[Test it online!](https://ethproductions.github.io/japt/?v=1.4.5&code=eUA9WGbKWKNvCq5mxA==&input=W1sgMSwgICAyLCAgIDMsICAgNCwgICA1XSwKIFsgNiwgICA3XSwKIFsgOCwgICA5LCAgMTAsICAxMV0sCiBbXSwKIFsxMiwgIDEzLCAgMTRdLAogWzE1LCAgMTYsICAxNywgIDE4XV0KLVE=)
The second line can be removed if we are allowed to pad the rows with null values, saving 4 bytes.
### Explanation
```
 y@  =XfÊ X£  o      Implicit: U = input array
UyX{U=Xfl Xm{Uo}}    (Ungolfed)
UyX{            }    Map each column X in the input by this function:
    U=Xfl              Set U to X filtered to only items whose factorial is truthy;
                       this just gets rid of the empty slots in the column.
          Xm{  }       Map each item in X to
             Uo          the last item in U, popping this item from the list.
                       Due to the way .map works in JS, this is only called on real items
                       and not empty slots, so this preserves empty slots.
                     Newline: set U to the resulting column-reversed array
 ®   fÄ              Due to the way y works, there will now be `undefined` in some rows.
UmZ{Zf+1}            (Ungolfed)
 mZ{    }            Map each row Z in U to
    Zf+1               Z filtered to only items where the item + 1 is truthy.
                     undefined + 1 is NaN, which is falsy, and thus eliminated.
                     Implicit: output result of last expression
```
[Answer]
# [K4](http://kx.com/download/), 36 bytes
**Solution:**
```
+{x[w]:|x w:&~^x;x}'x'[::;]@!|/#:'x:
```
**Examples:**
```
q)k)+{x[w]:|x w:&~^x;x}'x'[::;]@!|/#:'x:(1 2 3 4 5;6 7;8 9 10 11;0#0N;12 13 14;15 16 17 18)
15 16 17 18 5
12 13        
8  9  14 11  
6  7  10     
1  2  3  4
q)k)+{x[w]:|x w:&~^x;x}'x'[::;]@!|/#:'x:(0#0N;5 8 7; 0 6 5 7 1)
0 6 5    
5 8 7 7 1
```
**Explanation:**
This one has been a pain, and I'm still working to simplify the elided indexing.
Instead of indexing in at, for example, `x[0]` which would return the first *row*, we want to take the first *column*, which can be done using `x[;0]`.
However passing variable `y` into `x[;]` treats it as doing `x[y]` not `x[;y]` hence shoving the `::` in there: `x[::;]`.
This is equivalent to flipping the list of lists, but flip requires all lists to be equal length!
```
+{x[w]:|x w:&~^x;x}'x'[::;]@!|/#:'x: / the solution
                                  x: / save input as variable x
                               #:'   / count (#:) each (') 
                             |/      / take the max of these lengths
                            !        / til, range 0..max-1
                           @         / apply (index into)
                      [::;]          / :: is a kind of null, 
                    x'               / index into x at each of these    
 {              ; }'                 / two statement lambda on each (')
              ^x                     / null x (returns true if entry is null)
             ~                       / not, so flip true/false
            &                        / where, indexes where true
          w:                         / save as variable w  
        x                            / index into w at these indexes
       |                             / reverse
  x[w]:                              / store this back in variable x at indexes w
                 x                   / return x from function
+                                    / flip the result
```
[Answer]
# [Haskell](https://www.haskell.org/), 174 bytes
```
f x=map g.h.map(g.reverse>>=(!)).h$take(maximum$length<$>x).(++z).map pure<$>x
g=concat
h x|g x==[]=x|4>2=foldr(zipWith(:))z x
x!(c:d)|c==[]=c:x!d|a:b<-x=[a]:b!d
_!y=y
z=[]:z
```
[Try it online!](https://tio.run/##dVNNb5tAEL37V6wjH0CeID7Nh4KlqqdKlXrooQeCKmI2YMXGFiYNsfzf3ZnZxXYUYmGWnXnz5u1jqIvDi9xszudn0afbYi8qq7ZwNSqrlf9ke5DLZWpMTdOqZ13xIo1t0a@3r9vZRjZVVz/Mlr1pGfP50aQqsX9tJcUmVbraNauim9SiP1XInWZ52p/8pZs@7zZlaxzX@z/rrjYS0zyKftJPjVVSmqcVA1dJPy1PRfL0cN@nWZEnT9Ny8nf6nr5PjphPjudtsW5EKsodtux@d@3PRszE3bfNRnTy0B3EvjgcZJmIOzGfi0O9exNGgUnj0eihNcX9UuCBRZoK3HCFORGXn6IUd4/Nr9cON0hzk61k933XdLLBNmiO2LfrphMWElrCaGVRiiQRWL9uKuqTZT8QXMk2z6nHWy1bqUWmN6yZMLIszwXgY6agww84BdcsjAEiCMAZIHrzCeSAa9tYb4M3QOkRdGK0rQcxAT4KcDjojUvBaAARhNxogVLCq7IhNmBUbkRoxJgQq33qQgo0haNjocao3KhjkLlq8Ry1ary6wltHaXsLGSoGmjGNjo0X/8lUFz3U/nrg0eLzKQMbL9ouYGHftg1xT6mBYEFQRRBcCTyidXQHx/7itBEorA0@2kLaI7aa7jGZDAvOYw5itE1L8G4AMbtJDSKOEpkqQ3JN@7kxjgdPUKCHxGOWGOgtuzwplPUR5SoLIOTZ0AI4oE/qcGGs/AOXRTig7Ai0/pgz4RcfgMIEiPCZxwc6sccdFngYhxkjUF1ijLh8vPD64YQcitmPmAsdNk19BkQSaWJXWx5oj4IRUQrj8N3meb@4wT7hIcHWOY9n2gM9eOQBWnV9Uzp/YYp0vcNMvn4PtmbEnqCHn9ygwg/y8jNNcKxMVhKUOy729fP8Pw "Haskell – Try It Online")
### Ungolfed/Explanation
The idea is to wrap all elements in `[]` and pad the rows with `[]` (turned out to be shorter than padding with a negative integer, this allows negative inputs as well which is nice), then transpose, reverse all rows and transpose again and flatten each row:
```
map concat                                   -- flatten each row
  . transpose'                               -- transpose (*)
  . map (\row-> reverse (concat row) ! row)  -- reverse each row (see below)
  . transpose'                               -- tranpose (*)
  $ take (maximum $ length <$> x)            -- only keep up as many as longest row
      . (++ z)                               -- pad row with [],[],..
      . map (\e-> [e])                       -- wrap elements in []
 <$> x
```
\* This transpose function (`h`) simply returns the list if there are no elements at all. 
The reverse function has to ignore `[]` elements (eg. `[[],[1],[],[3],[4]]` -> `[[],[4],[],[3],[1]]`), it does so by receiving two arguments: The first one are the elements in reverse order (eg. `[4,3,1]`) and the second one the original row.
```
x@(a:b) ! (c:d)
 | c == []   = c:x ! d    -- if current element is []: skip it
 | otherwise = [a]:b ! d  -- else: replace with new one (a) and continue
_ ! y = y                 -- base case (if no new elements are left): done
```
[Answer]
# [Python 2](https://docs.python.org/2/), ~~111~~ ~~105~~ 92 bytes
```
def f(l):x=map(lambda*n:[v for v in n if-1<v],*l);return[map(list.pop,x[:len(k)])for k in l]
```
[Try it online!](https://tio.run/##VVTRjqMwDHzvV@QRVr5TQghJetcvQTz0tKCrlqWIstXe1/dsxylUokA8nnE8cZn/rX@vU/V4vPeDGoqxPH6fPs9zMZ4//7yf36Zje1fDdVF3dZnUpC7DD/P73sHbWP5a@vVrmVrOvtzWn/N1hu/2OPZT8VF2JbE@iDV2j7W/rTd1Uu1BqaJtuw4U3UuQNeQQ7KIBHJgUl9eMGKi0xlwNNuH0AhLeq1qIFN/rGw7Zl0q4cBDAs2SDtXwunCM5IyHbPgJDHik1KVIt5hmJeMlIyL5faKv0sCY9JS1dfvODFvuEnJ9FdrsxGi/@kTsV2iFGWbD0qLkNp/GiZQON3mp5XBGQ6Q0lJrrb6JZEjegb/dpXgJSioca@aZ@BDaR7JOugYRwxiOgL17U7OLJZpBo4SlKJhNIi@qyGh8vH7uSILZMj0IFVfNKE1phVpWbB8yFzVV5KT4ZpMfkEFVc2kBp3suXIiH@dzgQ5BGqm10C9WRZucOOGhQIk8YiRilvxeao9ByJ3Hplm2Jw0tyQRRLYSa5244badJMjwXfOQPvtmR7Ah0IJZnkkLMkPUL5qSD0LQp04QtmGdWvzWoocVQWaYDCBiVx66w2FeLtOqzuNYDAX980t1Oqmlv32NK39LKAY5gB8I/jqUj/8 "Python 2 – Try It Online")
[Answer]
## JavaScript (ES6), ~~79~~ 76 bytes
```
(a,d=[],g=s=>a.map(b=>b.map((c,i)=>(d[i]=d[i]||[])[s](c))))=>g`push`&&g`pop`
```
Edit: Saved 3 bytes thanks to @ETHproductions.
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 27 bytes[SBCS](https://github.com/abrudz/SBCS)
```
≢¨⍴¨∘↓∘⍉⍉∘↑{⍵\⌽⍵/⍺}⍤1∘⍉∘↑=⍨
```
[Try it online!](https://tio.run/##RVJNixQxEL33r6jbdKDFpNPpjwX/iZcBGVkcGFn6ssheZFl2V3tZEcGzeNiDR70IXvwp@SPje1VpB9Lp5L2ql3qpbN/un7263O4Pr4/54cv5Id88@uMOc7779vcpLz8x3X7NN585L3cc3H56l5dfL/PHP/g9z8vvq7x8DyVE@Rd5eToeZwgxEmIXWO4QebbZbc/3G6yAX@QP15vDm81VVTf5/n1efri5LCp8GLP9jB8lSbAIXVZ1kNZ7V3uJbta5IMyuo0yuboIrMqC4j66o10lGGZjcQ2ygMlHdOiMV5SkjoQFhHbMpOgPlFijJgpaq66Y1JAb7a8DKDW4@LU/0Gn2S4MnBY@gHny3MmeMoEXPTsdDkMbDrpScGeRTVK1jyesZoXvqfF6kVTDV4vaiqHkUZLx1cBYAj7wfTxKuQniQImWB55nplCNQNZEZiVNBo6BWpiu1gg5qkZ2GbmMzrbtk2UB0iWvUhg/ZmtrUVzKSJLYR3aXlMEHWUrK5J4UFdFCgB6JjSCeuOlOpRWXDaU1WbsG9ZKY9jz1vDQDI8qF99SswcTau1e0rmMeFMRQInry9ntUOXKFa8EZEPJoo9CxqBUb1JI9bs0ZICszu7N28iOELscdEaU6p/ "APL (Dyalog Unicode) – Try It Online")
[Answer]
## Clojure, 123 bytes
```
#(map(fn[i R](map(fn[j _](let[V(for[Q %](get Q j))F filter](nth(reverse(F + V))(count(F +(take i V))))))(range)R))(range)%)
```
I was expecting `(+ nil)` to throw an exception, but it evaluates to `nil` :o
This operates without padding, instead it counts how many of the previous rows are at least as long as the current row `R`.
]