text:
Clark's Triangle
Ok I've been on a bit of a triangle kick recently so here's another one.
Clark's Triangle is a triangle where the leftmost entry of each row is 1 and the rightmost entries are made up of multiples of 6 which increase as the row number increases.  Here's a visualization
     1 6
    1 . 12
   1 . . 18
  1 . . . 24
 1 . . . . 30
1 . . . . . 36

Just like Pascal's Triangle all other entries are the sum of the numbers to their upper right and upper left.
Here are the first few rows filled in
          1   6
        1   7  12
      1   8  19  18
    1   9  27  37  24
  1  10  36  64  61  30
1  11  46  100 125 91  36

Task
Given a row number (starting from the top) and an column number (starting from the first non-zero item on that row) output the value at that particular cell. Both inputs may be either 1 or 0 indexed (you may mix and match if you desire).  Out of the bounds of the triangle is undefined and you may do whatever you wish when queried for these values.
This is code-golf, the goal is to minimize the number of bytes in your solution.
OEIS A046902

Can we build a solution with zero in the first row? like in the OEIS sequence

@JörgHülsermann Since that is out of bounds for the triangle defined here you may do whatever you want.

Pascal, 132 bytes
function f(n,k:integer):integer;begin if k=1 then f:=1 else if k>n then f:=6*n else if k<0 then f:=0 else f:=f(n-1,k-1)+f(n-1,k)end;

Try it online!
1-indexed.

Pascal's triangle!

MATL, 15 bytes
[lBB]i:"TTY+]i)

First input is 0-based row; second is 1-based column.
Try it online!
Explanation
[lBB]   % Push [1 6 6]
i       % Input: row number (0-based)
:"      % Repeat that many times
  TT    %   Push [1 1]
  Y+    %   Convolution, increasing size. This computes the sum of overlapping
        %   pairs, including the endpoints. So for example [1 6 6] becomes
        %   [1 7 12 6], which will later become [1 8 19 18 6], ...
]       % End
i       % Input: column number (1-based)
)       % Use as index. Implicit display

CJam, 22 18 bytes
-4 bytes thanks to Martin Ender
X6_]ri{0X$+.+}*ri=

Input is (0-based row) (0-based column)
Try it online!
Explanation
X6_]  e# Push the list [1 6 6]. This is the first row, but each row will have an extra 6 at
      e# the end, which is out of bounds.
ri    e# Push the first input as an integer.
{     e# The following block calculates the next row given a row on top of the stack:
 0X$+ e#  Copy the top list on the stack and prepend 0.
 .+   e#  Element-wise addition with the list before prepending 0. This adds each element of
      e#  with the one to its left, except the initial 1 gets added to 0 and the final number
      e#  gets added to the out-of-bounds 6. The out-of-bounds 6 is unchanged since one list
      e#  is longer.
}*    e# Run this block (row index) times.
ri=   e# Get the (column index)th item of the final list.

A different technique for getting pairwise sums is to shift one copy left and use .+. Normally that has the problem that it retains the trailing element without summing it (which costs bytes to remove), but in this case that actually saves bytes because then you don't need to add a 6 on every iteration. You can save even more bytes because shifting left is free if you only prepend the 0 to one copy: X6_]ri{0X$+.+}*ri=

_0\+ instead of 0X$+ is the same byte count if you prefer.

@MartinEnder Oh I see, you get an extra 6 at the end of each row that's out of bounds so it doesn't matter. Clever, thanks.

C#, 157 bytes
using System.Linq;(b,c)=>{var f=new[]{1,6};for(;c>0;c--){int s=f.Length;f=new int[s+1].Select((e,i)=>i<1?1:i==s?f[s-1]+6:f[i-1]+f[i]).ToArray();}return f[b];

Try it online

Haskell, 41 bytes
n#1=1
n#m|m>n=6*n
n#m=(n-1)#(m-1)+(n-1)#m

Try it online!
Call using n # m where n is the row number and m is the column number, both 1-indexed.

Python 2, 67 bytes
a,b=input()
x=[1,6]
exec"x=map(sum,zip([0]+x,x+[6]));"*a
print x[b]

Try it online!
Brute-force approach, calculate the ath row, and then print the bth number, both inputs are 0-based

Python 3, 64 60 52 bytes
f=lambda r,c:c<2or c>r and r*6or f(r-1,c-1)+f(r-1,c)

Try it online!
Recursive solution using 1-indexing. Outputs "True" instead of 1 for the sake of golfing.

Thanks to:

@totallyhuman for saving 4 bytes!
@Rod for saving 8 bytes!

60 bytes

52 bytes replacing the if/else with boolean operators and with a more flexible output

@Rod, this is a brilliant solution. I'm still trying to wrap my head around why it works. I am still fairly new here (this is only my second answer on the site), so I'm unsure on the protocol: should I include your revision in my answer even though you switched from Python 3 to 2?

@icosahedron the python version is irrelevent in that case, so you don't have to mind it. generally, switching between python versions to exploit features is considered OK.

@Uriel thank you for the clarification.

Husk, 15 12 bytes
!!¡S`JẊ+d166

Try it online!
-3 bytes from Dominic Van Essen.
Same method as the MATL answer, except it uses an infinite list of rows of Clark's triangle.

12 bytes using J and recycling the d166...

Mathematica, 32 bytes
b=Binomial;b[#,#2-1]6+b[#-1,#2]&

input

[row,column]
[1-indexed,0-indexed]

Desmos, 118 71 55 bytes
Saved a whopping 47 bytes thanks to @ovs!
\$f(r,c)=\sum_{k=c-2}^c(6-5*0^{c-k})/k!\prod_{n=r-k+1}^rn\$
f(r,c)=\sum_{k=c-2}^c(6-5*0^{c-k})/k!\prod_{n=r-k+1}^rn

Both the row and column are 0-indexed.

This can be expressed quite a bit shorter as a sum. I think this works: f(r,c)=\sum_{k=0}^2\frac{(6-5*0^k)\prod_{n=0}^{c-1-k}(r-n)}{(c-k)!}

@ovs Nice! I was struggling with getting the 1, 6, 6, and didn't think about 0^k

Haskell, 40 36 bytes
Thanks to Lynn for pointing out the obvious and saving me 4 bytes.
n#1=1
n#m|m>n=6*n|q<-n-1=q#(m-1)+q#m

Try it online!

Works like this answer but 1 byte 5 bytes shorter.

Hint: You can combine the last two lines into one with guards, and save some bytes.

@Lynn Gah!  That feels so obvious now.

K (oK), 28 18 bytes
{(x{+':x,6}/1 6)y}

Try it online!
Rows and columns are both 0-indexed. Out of bounds return null.

Scala, 75 bytes - Brute-force solution
n=>k=>2.to(n)./:(Seq(1,6))((s,i)=>1+:s.sliding(2).map(_.sum).toSeq:+6*i)(k)

Try it online!
Scala, 88 bytes - Recursive solution
n=>k=>{def g(m:Int,l:Int):Int=if(m==l)m*6 else if(l<1)1 else g(m-1,l-1)+g(m-1,l)
g(n,k)}

Try it online!

PHP, 64 bytes
recursive function
rows 1-indexing columns 0-indexing
Output for row=0 and column=0 is 0 like in the OEIS sequence

function f($r,$c){return$c-$r?$c?f($r-=1,$c-1)+f($r,$c):1:$r*6;}

Try it online!
PHP, 126 bytes
rows 1-indexing columns 0-indexing
Output for row=0 and column=0 is 0 like in the OEIS sequence

for(;$r<=$argv[1];$r++)for($z++,$c=~0;++$c<$z;)$t[+$r][$c]=$c<$r?$c?$t[$r-1][$c-1]+$t[$r-1][$c]:1:$r*6;echo$t[$r-1][$argv[2]];

Try it online!

R, 77 bytes
Reduce(function(x,y)zoo::rollsum(c(0,x,6),2),double(scan()-1),c(1,6))[scan()]

Requires the zoo library; reads from stdin (the inputs separated by two newlines) and returns the value, with NA for out of bounds selections.
Try it online!

I know this is >3 years old, but you could save 7 bytes by taking the first input value as 0-indexed instead of 1-indexed, and replacing double(scan()-1) with !1:scan().

JavaScript (ES6), 38 bytes
f=(r,c)=>c?r>c?f(--r,c)+f(r,--c):r*6:1

Crashes for negative columns, and returns multiples of six for negative rows or overlarge columns.

C# (.NET Core), 44 bytes
f=(c,r)=>c<=1?1:c>r?6*r:f(c-1,r-1)+f(c,r-1);

Takes column then row, both 1-indexed. Can take row then column by swapping the inputs: (r,c). Will return row * 6 for coordinates outside the bounds on the right (i.e. column > row + 1), and 1 for coordinates outside the bounds on the left (i.e. column < 1).

Jelly, 13 bytes
,"’U0¦c/x6,1S

A monadic link taking a list of [row, entry] (0-indexing for entries, 1-indexing for rows), returning the value.
Try it online!
How?
,"’U0¦c/x6,1S - Link: list of numbers, [row, entry]
  ’           - decrement     -> [row-1, entry-1]
 "            - zip with:
,             -   pair        -> [[row, row-1], [entry, entry-1]]
     ¦        - sparse application of:
   U          -   upend
    0         - for indexes: 0 -> [[row, row-1], [entry-1, entry]]
       /      - reduce by:
      c       -   choose       -> [(row choose entry-1), (row-1 choose entry)]
         6,1  - 6 paired with 1 = [6,1]
        x     - times        i.e. [a, a, a, a, a, a, a, b]
            S - sum            -> 6*(row choose entry-1) + (row-1 choose entry)


text:
Show me some fireworks!
Given, in any way and order,

dimensions (in whichever order you want)

a probability (in whatever format you want)

number of iterations (you may choose whether to count the initial state or not)

do one of the following:

animate, or

output each step of, or

return a list of states of

a spaces-filled sky of those dimensions.
For each iteration:

every sky character has the given probability of becoming a *

the eight characters that surround any * become
\ | /
-      -
/ | \, if they don't become stars, however,

if a character is within range of two *s, make it an X

Example
The 7×22 sky (frame for clarity only – don't output the frame)
┌──────────────────────┐
│                      │
│                      │
│                      │
│                      │
│                      │
│                      │
│                      │
└──────────────────────┘

could with 1% probability become
┌──────────────────────┐
│  *                   │
│                      │
│                      │
│                      │
│                      │
│           *          │
│                      │
└──────────────────────┘

and the next step
┌──────────────────────┐
│ - - *                │
│ /|\                  │
│          *           │
│                      │
│          \|/         │
│          - -         │
│          /|\         │
└──────────────────────┘

and then
┌──────────────────────┐
│    - -               │
│    /|\  \|/          │
│         - -          │
│         /|\          │
│                      │
│      * *             │
│                      │
└──────────────────────┘

and
┌──────────────────────┐
│                      │
│                      │
│                      │
│                      │
│     \|X|/            │
│     - X -            │
│     /|X|\          * │
└──────────────────────┘

and so on
┌──────────────────────┐
│                      │
│                      │
│                      │
│                   *  │
│                      │
│                   \|/│
│                   - -│
└──────────────────────┘

If someone viewing this is not familiar at all about the USA culture, they might be confused to why you are launching fireworks on 4th July.

@Okx to destroy all who oppose, of course!

Obligatory xkcd

ES6, 520 496 bytes
Clipping and everything else should work now.
(w,h,p,i,r=0,s=($=>{while(++r<i)for(j=0,_=$[r]=[],z=$[r-1]||[];j<w*h;){k=j+1,l='*',c=0
n=(j%w&&z[j-1]==l&&++c)|(k%w&&z[k]==l&&++c)?'-':' '
n=(z[j-w]==l&&++c)|(z[j+w]==l&&++c)?'|':n
n=(j%w&&z[j-w-1]==l&&++c)|(k%w&&z[k+w]==l&&++c)?'\\':n
n=(k%w&&z[k-w]==l&&++c)|(j%w&&z[j+w-1]==l&&++c)?'/':n
_[j++]=Math.random()<p?l:c>1?'X':n}})(x=[])||x)=>{c=document.body.children[0],r=0;while(++r<i)setTimeout((k=0)=>{for(r++,c.innerHTML='';k<h;)c.innerHTML+=s[r].slice(k*w,++k*w).join('')+'\n'},90*r);r=0}

View animation!
Saved 24 bytes thanks to Zacharý's tip.
Old solution, 478 bytes (with clipping bug)
I think I got all the rules correct, however the solution has a clipping problem where everything exiting right/left wraps around one line lower/higher on the opposite side.
(w,h,p,i,r=0,s=($=>{while(++r<i)for(j=0,_=$[r]=[],z=$[r-1]||[];j<w*h;){c=0
n=(z[j-1]=='*'&&++c)|(z[j+1]=='*'&&++c)?'-':' '
n=(z[j-w]=='*'&&++c)|(z[j+w]=='*'&&++c)?'|':n
n=(z[j-w-1]=='*'&&++c)|(z[j+w+1]=='*'&&++c)?'\\':n
n=(z[j-w+1]=='*'&&++c)|(z[j+w-1]=='*'&&++c)?'/':n
_[j++]=Math.random()<p?'*':c>1?'X':n}})(x=[])||x)=>{c=document.body.children[0],r=0;while(++r<i)setTimeout((k=0)=>{for(r++,c.innerHTML='';k<h;)c.innerHTML+=s[r].slice(k*w,++k*w).join('')+'\n'},90*r);r=0}

View old.

Nicely done. Can't you fix the clipping by appending blank columns on the sides, animate, and then chop?

Couldn't you define a variable to be '*' since you use it SO often?

@Zacharý Good tip, I will define variables for '*' and other commonly used things.

If only JS had macros.

APL (Dyalog), 65 chars or 71 bytes*
Prompts for dimensions (rows, columns), then for iterations (not counting initial state), then for probability (as n in ¹⁄ₙ).
⎕{1=?⍺⍺:'*'⋄2≤+/b←'*'=1↓4⌽,⍵:'X'⋄⊃b/'-/|\\|/-'}⌺3 3{⍺⍺⎕←⍵}⍣⎕⊢⎕⍴''

Try it online!
⎕⍴'' prompt for input and use that to reshape an empty string, padding with spaces as needed
⊢ yield that
…⍣⎕ prompt for input and apply the following function on the above (⍵) that many times:
 …{…} derive a function using the below function as operand (⍺⍺), as follows:
  ⎕←⍵ print the argument
  ⍺⍺ apply the following function:
   …⌺3 3 apply the following function on each element's 3×3 Moore neighborhood:
    ⎕{…} get input and use it as operand (⍺⍺) to derive a new function
     ?⍺⍺ random integer among the first ⍺⍺ integers
     1= Boolean if equal to one
     : if true:
      '*' return a star
     ⋄ else:
      ,⍵ ravel (flatten) the argument (the Moore neighborhood)
      4⌽ rotate it cyclically four steps to the left
      1↓ drop one element (the original center)
      '*'= Boolean list where equal to a star
      b← store that as b
      +/ sum that
      2≤ Boolean if two or higher
      : if true:
       'X' return an X
      ⋄ else:
       b/'-/|\\|/-' use the b to to filter the string
       ⊃ pick the first one, if there are none, pick the prototype (a space)

* To run in Dyalog Classic, simply replace ⌺ with ⎕U233A .

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Swap letter and digit runs
Given an input string containing only alphanumeric ASCII characters and starting with a letter, swap each letter run with the digit run which follows.
A run is a sequence of consecutive letters or digits. Note that in the case where the input string ends with a run of letters, this run is left untouched.
Walk-through example
For instance, given the input string uV5Pt3I0:

Separate runs of letters and runs of digits: uV 5 Pt 3 I 0
Identify pairs of runs: (uV 5) (Pt 3) (I 0)
Swap pairs of runs: (5 uV) (3 Pt) (0 I)
Concatenate: 5uV3Pt0I

Examples
uV5Pt3I0 -> 5uV3Pt0I
J0i0m8 -> 0J0i8m
abc256 -> 256abc
Hennebont56Fr -> 56HennebontFr
Em5sA55Ve777Rien -> 5Em55sA777VeRien
nOoP -> nOoP

This is code-golf so the shortest answer in bytes wins. Explanations are encouraged.

Jelly, 9 bytes
~ṠŒg⁸ṁṭ2/

Try it online!
How it works
~ṠŒg⁸ṁṭ2/  Main link. Argument: s (string)

~          Apply bitwise NOT.
           Bitwise operators attempt to cast to int, so if c is a digit, this
           yields ~int(c), a negative number.
           If c cannot be cast to int, ~ will yield 0.
 Ṡ         Take the sign.
           We've now mapped digits to -1, non-digits to 0.
  Œg       Group consecutive equal elements.
    ⁸ṁ     Mold s as the result, grouping run of digits and runs of non-digits.
       2/  Reduce all pairs of runs by...
      ṭ        tack, appending the first run of the pair to the second run.

Retina, 15 bytes
(\D+)(\d+)
$2$1

This replaces the regex (\D+)(\d+) with $2$1. Let's break that down if you don't know what that means.
The \D means 'match anything that isn't a number'. \d means 'match everything that is a number'. The + sign means 'match this at least once but try to match it as many times as possible'. The brackets define a group. The first group is (\D+) and the second is (\d+)
In the second line we say that we want to put whatever was matched by the second group, followed by whatever was matched by the first group. This effectively swaps the letter and digit runs.
Try it online!

JavaScript (ES6), 34 bytes
s=>s.replace(/(\D+)(\d+)/g,"$2$1")

Try it

o.innerText=(f=
s=>s.replace(/(\D+)(\d+)/g,"$2$1")
)(i.value="uV5Pt3I0");oninput=_=>o.innerText=f(i.value)
<input id=i><pre id=o>

Haskell, 58 56 bytes
Thanks to @Laikoni for shaving off 2 bytes
f""=""
f s|(a,(b,y))<-span(<':')<$>span(>'9')s=b++a++f y

Try it online!
Ungolfed:
f "" = ""
f string | (letters, afterLetters) <- span (> '9') string
         , (numbers, afterNumbers) <- span (< ':') afterLetters
         = numbers ++ letters ++ f afterNumbers

Save two bytes with (a,(b,y))<-span(<':')<$>span(>'9')s.

Save even more with (a,(b,y):_)<-lex<$>span(>'9')s: Try it online!

@Laikoni: Thanks for the tip! I'm not really clear on how lex works, so I'm gonna refrain from including that for now. In any case, good to know that there's something like that in Prelude

Pyth, 15 bytes
ss_Mc:z"(\d+)"3 2

Explanation
     :z"(\d+)"3      # Split the input z onto matches of numbers (\d+)
    c           2    # Split the resulting list in pieces of length 2
  _M                 # Reverse each pair
ss                   # Concatenate

Test suite.

Japt (v2.0a0), 16 bytes
q/(\d+/ ò mw c q

Test it online!
Note: this is an unstable alpha, so if this link breaks, you can use a slightly longer version in v1.4.4: Test it online!
Explanation
q/(\d+/ ò mw c q  : Implicit input              "uV5Pt3I0"
q                 : Split input on
 /(\d+/           :   runs of digits, keeping each run. (This compiles to the regex /(\d+)/g)
                  : This gives                  ["uV","5","Pt","3","I","0",""]
        ò         : Take every pair of items.   [["uV","5"],["Pt","3"],["I","0"],[""]]
          m       : Map each pair by
           w      :   reversing.                [["5","uV"],["3","Pt"],["0","I"],[""]]
             c    : Flatten into one array.     ["5","uV","3","Pt","0","I",""]
               q  : Join into a single string.  "5uV3Pt0I"
                  : Implicit: output result of last expression

Was trying to figure out if there was a way to do it with ò.

Python 2, 49 bytes
Every non-regex solution I tried was longer. :P
lambda s:re.sub('(\D+)(\d+)',r'\2\1',s)
import re

Try it online!

CJam, 32 30 28 bytes
q{i_64>X\:X^{])[}&c}/]]2/Wf%

CJam has no regex and no "split into digits and letters" or whatnot, so this was kind of painful.
Try it online!
Explanation
q      e# Read the input.
{      e# Do the following for every char c:
 i     e#  Get c's codepoint.
 64>   e#  Check if it's greater than 64 (i.e. if it's a letter), pushing 1 or 0.
 X     e#  Push X (variable predefined to 1).
 \:X   e#  Store whether c was a letter or digit into X.
 ^{    e#  If (old X) XOR (new X) is 1:
  ]    e#   Close the current array.
  )    e#   Pull out its last character.
  [    e#   Open a new array.
 }&    e#  (end if)
 c     e#  Turn the codepoint back into a character. This also shoves it into the new array,
       e#  in case one was opened.
}/     e# (end for)
]      e# Close the final array, since it hasn't been closed yet.
]      e# Wrap the whole stack into an array.
2/     e# Split elements into groups of 2.
Wf%    e# Reverse each group.
       e# Implicitly flatten and print.

Gema, 11 characters
<L><D>=$2$1

Sample run:
bash-4.4$ gema '<L><D>=$2$1' <<< 'Em5sA55Ve777Rien'
5Em55sA777VeRien

So...short. I mean, it's not a golfing language and just 11? Wow.

Yeah, but only for tasks which not require touching the same input twice. Then it becomes nightmare. ☹

Found Gema through one of your other posts... cool language.  Just how obscure would you say Gema is?

@Jonah, I would say its only obscure part is the domain. Though that is partially because the feature is underdocumented. Otherwise the language is a collection of great but painfully limited features. (For example the recognizers rocks, but they would be much powerful if could be combined like the regular expression character classes.)

how popular was gema in the 90s?  and does it have any modern counterparts / competitors?  do you use it for work or just found it for fun?

Only for fun and only since golfing. (Already met it ~1 decade earlier when looking for a macro processor, but that time I chosen m4. No earlier memories.)

Java 8, 38 bytes
s->s.replaceAll("(\\D+)(\\d+)","$2$1")

Not much to explain. Uses the same method as @Okx's Retina answer, which can't be any shorter in Java.
Try it here.

Jelly, 12 bytes
e€ØDŒg⁸ṁs2Ṛ€

Try it online!
Explanation:
e€ØDŒg⁸ṁs2Ṛ€ Accepts a string
e€ØD         Check if each char is in ['0'..'9']
    Œg       Split runs of 0s and 1s (respectively letter and digit runs)
      ⁸ṁ     Replace with input, keeping the split
        s2   Get pairs of runs, last left alone if letter run
          Ṛ€ Swap each pair

Can you add the explanation?

@Jim Added explanaion.

Japt, 18 14 bytes
r"(%D+)"pv ÏiZ

Try it
r"(%D+)"pv ÏiZ     :Implicit input of string
r                  :Replace
 "(%D+)"           :Literal string
        p          :Append
         v         :  Lowercase resulting in the Regex /(\D+)(\d+)/g
           Ï       :Pass each match through a function
            i      :  To the first matched group prepend
             Z     :  The second matched group

Can you add the explanation?

@Jim, it's just a port of my JS solution (Japt transpiles to JS), which should be pretty self-explanatory. If not, see the explanation in Okx's Retina solution; both of mine do the exact same thing.

??? @Downvoter: please provide feedback.

@Shaggy you said it yourself, it's basically copy paste of Okx's solution and then you took it one step further to a language which compiles to the exact same code as your other answer. So I downvoted because this wasn't a unique solution, which doesn't use any interesting golfing techniques or ingenuity; rather a translation of another answer

@Downgoat, thanks for commenting. However, I did not say I copied Okx's solution, I simply directed Jim there for the explanation. If you check the timestamps, you'll see that I posted my JS solution at almost the same time as Okx (I may even have been first, but I can't see exact timestamps on mobile). I then ported my own solution to another language, which happens all the time here so, unless you're downvoting all ports, I don't understand why you've singled this one out.

Sed, 29 bytes
s/([^0-9]+)([0-9]+)/\2\1/g

Run with -r.
Uses capture groups and replaces them in the opposite order.

You can shorten [A-Za-z] to [^0-9]. However, you have to count the flag as part of your code.

How much does the flag count as?

The difference between sed <command> and sed -r <command>, so three bytes.

@Dennis, it's the difference between sed -f filename and sed -rf filename (or between sed -e 'command' and sed -re 'command'): a single byte.

I missed the key phrase ("starting with a letter") in the question, so had s/([a-z]+)([0-9]+)|([0-9]+)([a-z]+)/\2\1\4\3/gi at 48 bytes.  Otherwise, much the same.

@TobySpeight Right, it's only one byte when taking the code from a file. However, we measure the the shortest equivalent invocation, so sed -re doesn't count.

PHP, no regex, 73 bytes
for(;a&$c=$argn[$i++];$p=$c)$c<A?print$c:$s=($p<A?!print$s:$s).$c;echo$s;

Run as pipe with -nR or test it online.
breakdown
for(;a&$c=$argn[$i++];  # loop through input
    $p=$c)                  # 2. remember character
    $c<A                    # 1. if digit
        ?print$c            # then print it
        :$s=($p<A           # else if previous character was digit
            ?!print$s           # then print and reset string
            :$s                 # else do nothing
        ).$c;                   # append current character to string
echo$s;                 # print remaining string

I mean you can use ~ instead of a&

Clojure, 104 88 bytes
Oh regex is really handy... anyway (TIO):
#(apply str(flatten(map reverse(partition-all 2(partition-by(fn[i](< 47(int i)58))%)))))

partition-by splits into consecutive runs based on the return value of that function, partition-all splits into partitions of 2 (the pairs we'll be swapping), map reverse reverses them, flatten gets rid of nested list structure and finally we'll output a string. If partition was used instead of partition-all and we had odd number of chunks then the last one would be discarded.
Original used verbose but fun (juxt second first) and (set"0123456789") instead of reverse and ASCII integer ranges.
#(apply str(flatten(map(juxt second first)(partition-all 2(partition-by(comp not(set"0123456789"))%)))))

Can you add a link to TIO and an explanation?

PHP, 45 bytes
<?=preg_replace("#(\D+)(\d+)#","$2$1",$argn);

Try it online!

C#, 71 bytes
s=>System.Text.RegularExpressions.Regex.Replace(s,@"(\D+)(\d+)","$2$1")

Just a shame regular expressions are so long in C#.
Try it online!
Full/Formatted version:
using System;

class P
{
    static void Main()
    {
        Func<string, string> f = s => System.Text.RegularExpressions.Regex.Replace(s, @"(\D+)(\d+)", "$2$1");

        Console.WriteLine(f("uV5Pt3I0"));
        Console.WriteLine(f("J0i0m8"));
        Console.WriteLine(f("abc256"));
        Console.WriteLine(f("Hennebont56Fr"));
        Console.WriteLine(f("Em5sA55Ve777Rien"));
        Console.WriteLine(f("nOoP"));

        Console.ReadLine();
    }
}

Can you add a link to TIO?

@Jim Done. I'm usually too lazy to add it initially, especially whilst I'm still looking for any improvements.

QuadR, 15 bytes
(\D+)(\d+)
\2\1

Try it online!
Explanation blatantly stolen from Okx:
This replaces the regex (\D+)(\d+) with \2\1. Let's break that down if you don't know what that means.
The \D means 'match anything that isn't a number'. \d means 'match everything that is a number'. The + sign means 'match this at least once but try to match it as many times as possible'. The brackets define a group. The first group is (\D+) and the second is (\d+)
In the second line we say that we want to put whatever was matched by the second group, followed by whatever was matched by the first group. This effectively swaps the letter and digit runs.

PowerShell, 40 bytes
$args|%{$_ -replace '(\D+)(\d+)','$2$1'}

Try it online!

PowerShell is pretty ideal for this, seeing that it supports regex search-and-replace out of box.  Props go to @Okx for the regex solution.

Pip, 17 bytes
aR-C+XL.C+XD{c.b}

Takes input as a command-line argument. Try it online!
Explanation
This uses the standard regex-replacement strategy, somewhat golfed.
The regex is -C+XL.C+XD, which evaluates to `(?i)([a-z]+)(\d+)`:
   XL       Preset regex variable for lowercase letter: `[a-z]`
  +         Apply + to the regex: `[a-z]+`
 C          Wrap the regex in a capturing group: `([a-z]+)`
-           Apply the case-insensitive flag: `(?i)([a-z]+)`
        XD  Preset regex variable for digit: `\d`
       +    Apply + to the regex: `\d+`
      C     Wrap the regex in a capturing group: `(\d+)`
     .      Concatenate the two regexes: `(?i)([a-z]+)(\d+)`

The replacement is {c.b}, a callback function that concatenates the second group (c) and the first group (b). (The first argument to the function, a, contains the whole match.)
This is three bytes shorter than the naive aR`(\D+)(\d+)``\2\1`.

brainfuck, 98 bytes
,[>>----[---->+<<<-[>]>]>>[.[[-]<]<<[-]+>>]<[[-<<<+>>>]<<<<[-<[<]>[.[-]>]]>[-<+>]>],]<[-]<[<]>[.>]

Try it online!
Explanation
This program maintains a queue of letters than haven't been output yet, and outputs them when appropriate.
The key to this program is >>----[---->+<<<-[>]>].  The three cells right of the input cell start out at zero.  If the input is a code point between 1 and 63 inclusive, this moves the pointer one space right and places the input two spaces right of this new position.  Otherwise, the pointer moves two spaces right, the cell one space right of the new position becomes 63, and the same 63 is subtracted from the input cell.  This neatly divides the input into letters (65-122) and digits (48-57).
,[                       Take first input byte and start main loop
  >>                     Move two cells to the right
  ----[---->+<<<-[>]>]   (See above)
  >>                     Move two cells to the right
                         This cell contains the input if it was a digit, and 0 if input was a letter
  [                      If input was a digit:
   .                     Output digit immediately
   [[-]<]                Zero out digit and working cell
   <<[-]+>>              Set flag so we know later that we've output a digit
  ]
  <                      Move one cell left
                         This cell contains 63 if input was a letter, and 0 if input was a digit
  [                      If input was a letter:
   [-<<<+>>>]            Add 63 back to input letter
   <<<<                  Move to flag
   [                     If a digit has been output since the last letter read:
    -                    Clear flag
    <[<]>                Move to start of queue
    [.[-]>]              Output and clear all queued letters
   ]
   >[-<+>]>              Move input to end of queue
  ]
,]                       Repeat until no input remains
<[-]                     Clear flag if present
<[<]>                    Move to start of queue
[.>]                     Output all queued letters

Congratulation for having a brainfuck answer which is not the longest of the answers!

Ruby, 31 bytes
->x{x.gsub /(\D+)(\d+)/,'\2\1'}

Try it online!

Vyxal, 40 bitsv2, 5 bytes
⁽±Ḋ2ẇvṘ

Try it Online!
Bitstring:
1111001101110011001010001110010110010110

Mathematica, 129 bytes
(n=NumberString;l=Length;s=Riffle[a=StringCases[#,n],b=StringSplit[#,n]];If[l@a==0,s=#,If[l@a<l@b,AppendTo[s,b[[-2;;]]]]];""<>s)&

Can you add an explanation / ungolfed version?

nothing much to explain...detects NumberString divides into 2 sets and riffles.Plus some "If" conditions in order to work perfectly

Scala, 89 bytes
A port of @Julian Wolf's Haskell answer in Scala.

Golfed version. Try it online!
s=>s match{case""=>"";case s=>{val(l,a)=s.span(_>'9');val(n,a2)=a.span(_<':');n+l+f(a2)}}

Ungolfed version. Try it online!
object Main extends App {

  def f(string: String): String = {
    string match {
      case "" => ""
      case str =>
        val (letters, afterLetters) = str.span(_ > '9')
        val (numbers, afterNumbers) = afterLetters.span(_ < ':')
        numbers + letters + f(afterNumbers)
    }
  }

  println(s"uV5Pt3I0         -> ${f("uV5Pt3I0")}")
  println(s"J0i0m8           -> ${f("J0i0m8")}")
  println(s"abc256           -> ${f("abc256")}")
  println(s"Hennebont56Fr    -> ${f("Hennebont56Fr")}")
  println(s"Em5sA55Ve777Rien -> ${f("Em5sA55Ve777Rien")}")
  println(s"nOoP             -> ${f("nOoP")}")

}

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Cyclic Polyglot Challenge (Robbers)
Cyclic Polyglot Challenge
This is the robbers thread. You can find the cops thread here.
Cyclic Polyglot
A N-element cyclic polyglot is a complete program that can be run in N different languages. In each language, when the program is run with no input (possibly subject to this exception), it should print the name of a language to STDOUT. Specifically, if the program is run in the Kth language, it should print the name of the (K+1)th language. If the program is run in the Nth language (that is, the final language in an N-element cycle), it should print the name of the first language.
An example might be useful.
a = [[ v = 7, puts('Befunge') ]]
__END__
= print("Ruby")
-->*+:292*++,,@
--3    9
--7    *
--^,:-5<

Running this program with Lua prints the string "Ruby". Running this program in Ruby prints the string "Befunge". Running this program in Befunge prints the string "Lua", completing the cycle. This program constitutes a 3-cycle consisting of Lua, Ruby, and Befunge.
The same language cannot appear twice in a cycle, and different versions of the same language (such as Python 2 and Python 3) cannot appear in the same cycle as one another.
Cops
Your challenge is to write an N-cyclic polyglot, where N is at least 2. Then, you must add, replace, and delete some number of characters to the program to produce an M-cyclic polyglot, where M is strictly greater than N. You should then post the shorter, N-cyclic polyglot (and the languages it runs in), as well as the number of characters you changed to produce the longer polyglot. Your score is N, the number of languages in your shorter cycle.
The robbers will try to identify your longer cycle. If, after seven days, no one has successfully cracked your solution, you should edit your answer declaring that it is safe. You should also post your longer M-cyclic polyglot at this time.
Robbers
Given a cop's N-cyclic polyglot and the number of characters they added to produce a larger polyglot cycle, your goal is to produce that larger cycle. If you can produce a longer cycle by adding, deleting, or replacing as many characters as the cop did or fewer characters, you have cracked the cop's polyglot. Your score is the length of the new cycle you've created. Your new polyglot need not be the same as or even similar to the cop's secret polyglot; it only needs to be larger than their existing one.
Your solution may also be cracked. If another robber comes along and produces a cycle strictly longer than yours, starting from the same cop's polyglot, they have stolen your points.
Valid Programming Languages
Since this challenge indirectly involves guessing programming languages used by other participant's, the definition of a programming language for the purposes of this challenge will be a little more strict than the usual definition. A programming language used in this challenge must satisfy all of the following conditions.

The language must satisfy the usual PPCG requires for a programming language.
The language must have either a Wikipedia article, an Esolangs article, or a Rosetta Code article at the time this challenge was posted.
The language must have a freely available interpreter or compiler.

Final Notes

The code you write should be a standalone program in every language that it is intended to run in. Functions or code snippets are not allowed.
Your program will be given no input through STDIN. Likewise, your program should print nothing to STDERR.
A cop's score is the number of languages in the cycle of the polyglot they posted. The cop should post the languages that the posted polyglot runs correctly in, as well as the number of characters they added to produce a longer polyglot. They are not responsible for posting the languages the longer, hidden polyglot runs in until their answer is safe.
A robber's score is the number of languages the modified polyglot runs in. As with the cop, the robber should post the list of languages the polyglot runs correctly in.
The number of characters changed should be computed in Levenshtein distance.

mdahmoune, added Ruby, Levenshtein = 10
#include<stdio.h>
#define print(a) main(){int z[1];if(sizeof(0,z)==4)printf("C(gcc)");else printf("Perl5");}
print($=?"Ruby":"C++(gcc)")

Cycle is C -> Perl5 -> Ruby -> C++ -> C
I don't really know what I did (and I really don't know why it's valid in C and C++), I just ripped it off this answer.
C (gcc): Try it online!
Perl5: Try it online!
Ruby: Try it online!
C++ (gcc): Try it online!


text:
Cyclic Polyglot Challenge (Cops)
Cyclic Polyglot Challenge
This is the cops thread. You can find the robbers thread here.
Cyclic Polyglot
A N-element cyclic polyglot is a complete program that can be run in N different languages. In each language, when the program is run with no input (possibly subject to this exception), it should print the name of a language to STDOUT. Specifically, if the program is run in the Kth language, it should print the name of the (K+1)th language. If the program is run in the Nth language (that is, the final language in an N-element cycle), it should print the name of the first language.
An example might be useful.
a = [[ v = 7, puts('Befunge') ]]
__END__
= print("Ruby")
-->*+:292*++,,@
--3    9
--7    *
--^,:-5<

Running this program with Lua prints the string "Ruby". Running this program in Ruby prints the string "Befunge". Running this program in Befunge prints the string "Lua", completing the cycle. This program constitutes a 3-cycle consisting of Lua, Ruby, and Befunge.
The same language cannot appear twice in a cycle, and different versions of the same language (such as Python 2 and Python 3) cannot appear in the same cycle as one another.
Cops
Your challenge is to write an N-cyclic polyglot, where N is at least 2. Then, you must add, replace, and delete some number of characters to the program to produce an M-cyclic polyglot, where M is strictly greater than N. You should then post the shorter, N-cyclic polyglot (and the languages it runs in), as well as the number of characters you changed to produce the longer polyglot. Your score is N, the number of languages in your shorter cycle.
The robbers will try to identify your longer cycle. If, after seven days, no one has successfully cracked your solution, you should edit your answer declaring that it is safe. You should also post your longer M-cyclic polyglot at this time.
Robbers
Given a cop's N-cyclic polyglot and the number of characters they added to produce a larger polyglot cycle, your goal is to produce that larger cycle. If you can produce a longer cycle by adding, deleting, or replacing as many characters as the cop did or fewer characters, you have cracked the cop's polyglot. Your score is the length of the new cycle you've created. Your new polyglot need not be the same as or even similar to the cop's secret polyglot; it only needs to be larger than their existing one.
Your solution may also be cracked. If another robber comes along and produces a cycle strictly longer than yours, starting from the same cop's polyglot, they have stolen your points.
Valid Programming Languages
Since this challenge indirectly involves guessing programming languages used by other participant's, the definition of a programming language for the purposes of this challenge will be a little more strict than the usual definition. A programming language used in this challenge must satisfy all of the following conditions.

The language must satisfy the usual PPCG requires for a programming language.
The language must have either a Wikipedia article, an Esolangs article, or a Rosetta Code article at the time this challenge was posted.
The language must have a freely available interpreter or compiler.

Final Notes

The code you write should be a standalone program in every language that it is intended to run in. Functions or code snippets are not allowed.
Your program will be given no input through STDIN. Likewise, your program should print nothing to STDERR.
A cop's score is the number of languages in the cycle of the polyglot they posted. The cop should post the languages that the posted polyglot runs correctly in, as well as the number of characters they added to produce a longer polyglot. They are not responsible for posting the languages the longer, hidden polyglot runs in until their answer is safe.
A robber's score is the number of languages the modified polyglot runs in. As with the cop, the robber should post the list of languages the polyglot runs correctly in.
The number of characters changed should be computed in Levenshtein distance.

"The language must have a freely available interpreter or compiler. Sorry, Mathematica fans, but the robbers need to be able to verify your solution." Whats wrong with the Wolfram Open Cloud? https://sandbox.open.wolframcloud.com/

I was unaware of such a thing, as I have a local copy of Mathematica on my computer. Comment removed.

Is it ok for N=2 and M=3?

Yes, that's fine. Your score will simply be 2 then, but that's perfectly acceptable.

C (gcc), 126 bytes
M=N+1
Levenshtein(polyglot(M),polyglot(N)) is 36 bytes
#include<stdio.h>
#define print(a) main(){int z[1];if(sizeof(0,z)==4)printf("C(gcc)");else printf("Perl5");}
print("C++(gcc)")

Try it online!

Cracked (with Levenshtein of 10)


text:
"Hello, World", Even before it runs

Warning: This challenge is only valid for languages with a compiler.

Make a program (which is perfectly valid code) that outputs Hello, World, even before runtime.
How? Let me explain.
Many languages have a compiler. Some operations are made in the compile-time, and others, in runtime. You trick the compiler to output the text Hello, World in compile-time. The text can be anywhere, like the build log.(Not errors. sorry for invalidating all those answers. at least theres pragma tho)

You can use C, C++ or C#, but I wouldn't encourage you to. It's simply a game breaker.

p.s. I wrote this challenge because the tag compile-time is both unused, and used wrong.

Wouldn't the simple source code Hello, World! be optimal in almost any compiled language where that line is not valid code and the offending line gets printed in an error message?

"which is perfectly valid code" ... "The text can be anywhere, like the build log, an error, anywhere" ... what's "perfectly valid code" then?

I would say, better ask the “Hello, World!” to appear both when compiling and when running. That would make clear what is valid code.

@manatwork Or use two different strings so that you can't just get the line output during compiling that has the string for the actual running.

I have to agree with @MartinEnder. Almost all programming languages with a compiler will output the incorrect source code with an error class/function/something is missing. Just take my posted Java answer for example. This would be a valid answer in almost all programming languages with a compiler.. So although I barely do this, I give this a -1 vote for being boring, straight-to-the-point in more than 90% of the the compiler languages, and kinda pointless challenge. Sorry..

Are custom file names allowed?

Does the code have to compile to an executable or is an object file enough?

This would've been cool, but you didn't spend much time on the question :(.

C#, 51 bytes
Try it online
#warning Hello, World
class P{static void Main(){}}

Prints the following to the Error List (but still compiles):
warning CS1030: #warning: `Hello, World'

OP has updated that errors are not allowed. Just use #warning instead.

FreePascal, 29 characters
begin{$INFO Hello, World}end.

Maybe other Pascal variants too, not sure whether the $INFO directive is FreePascal only or not.
Sample run:
bash-4.4$ fpc compile-time-message.pas
Free Pascal Compiler version 3.0.2+dfsg-2 [2017/04/09] for x86_64
Copyright (c) 1993-2017 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling compile-time-message.pas
User defined: Hello, World
Linking compile-time-message
/usr/bin/ld.bfd: warning: link.res contains output sections; did you forget -T?
0 lines compiled, 0.0 sec

C (gcc), 22 18 bytes
Hello, World;main;

This compiles just fine with gcc (and clang), although the program it produces crashes immediately.
Try it online!
Compiler output
gcc 6.3.1 produces the following debugging information.
.code.tio.c:1:1: warning: data definition has no type or storage class
 Hello, World;main;
 ^~~~~
.code.tio.c:1:1: warning: type defaults to ‘int’ in declaration of ‘Hello’ [-Wimplicit-int]
.code.tio.c:1:8: warning: type defaults to ‘int’ in declaration of ‘World’ [-Wimplicit-int]
 Hello, World;main;
        ^~~~~
.code.tio.c:1:14: warning: data definition has no type or storage class
 Hello, World;main;
              ^~~~
.code.tio.c:1:14: warning: type defaults to ‘int’ in declaration of ‘main’ [-Wimplicit-int]

C (gcc), 15 bytes
Hello, World;

If compiling to an object file is allowed, this works just as well. The resulting file simply declares two global variables.
The byte count includes +3 bytes for the compiler flag -c.
Try it online!
Compiler output
hw.c:1:1: warning: data definition has no type or storage class
 Hello, World;
 ^~~~~
hw.c:1:1: warning: type defaults to ‘int’ in declaration of ‘Hello’ [-Wimplicit-int]
hw.c:1:8: warning: type defaults to ‘int’ in declaration of ‘World’ [-Wimplicit-int]
 Hello, World;
        ^~~~~

C (gcc), 20 bytes
main(Hello, World){}

This compiles to a program that exits cleanly.
Try it online!
Compiler output
.code.tio.c:1:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
 main(Hello, World){}
 ^~~~
.code.tio.c: In function ‘main’:
.code.tio.c:1:1: warning: type of ‘Hello’ defaults to ‘int’ [-Wimplicit-int]
.code.tio.c:1:1: warning: type of ‘World’ defaults to ‘int’ [-Wimplicit-int]

Weird, I swear I tried this and it didn't work for me. Have an upvote

Haskell, 25 24 bytes
m@main=m

8 bytes from the code plus 16 bytes for the compiler flag -W'Hello, World'.
Gives the warning unrecognised warning flag: -WHello, World and compiles the program.
Depending on the shell (or the absence of a shell) you can omit the single quotes in the flag for two bytes less. TIO works this way.
Haskell, TIO environment, 22 bytes
Try it online!
Edit: @Dennis saved a byte. Thanks!

Perl, 15 bytes
14 bytes of code + -w flag.
"Hello, World"

When ran with -w flag, it produces the compile-time warnings:
$ perl -we '"Hello, World"'
Useless use of a constant ("Hello, World") in void context at -e line 1.

And if you wonder if it really happens at compile time, you can add -c flag, which causes the program to be compiled but not ran, and the warning is still here.

GNU C, 31 bytes
Nothing clever here. I'm mostly posting it for reference.
main(){printf("Hello, World");}

GCC will throw the following warning at compilation time:
hello.c: In function ‘main’:
hello.c:1:8: warning: incompatible implicit declaration of built-in function ‘printf’ [enabled by default]
 main(){printf("Hello, World");}
        ^

Can't you use puts for -2?

@EriktheOutgolfer With my version of GCC at least, puts() would compile  without a warning.

Can you use f instead of main?

@musicman523 Would a C program without a main() compile at all?

@Arnauld You could use the -c flag to compile without linking, it would just be unexecutable.

C (gcc), 23 bytes
main(){"Hello, World";}

Try it online!
Gives the warning:
warning: return type defaults to ‘int’ [-Wimplicit-int]
main(){"Hello, World";}
^~~~

C (gcc), 38 bytes
#pragma message"Hello, World"
main(){}

Try it online!
Rather than using compiler warnings, this answer uses a built-in pragma directive that allows printing notes to stdout. Works in C and C++ (as I think all the rest of these do).

C (gcc), 23 + 1 = 24 bytes
#define f"Hello, World"

Try it online!
Prints "Hello, World!" as part of an error message, which says:
warning: ISO C99 requires whitespace after the macro name
 #define f"Hello, World!"
          ^~~~~~~~~~~~~~~

This is a default warning in GCC; no flags need to be added to achieve this.
The extra byte comes from the -c flag, which successfully compiles the program without linking, which means it accepts not having a main function. However, the resulting output file cannot be executed. If this is unacceptable, then:
C (gcc), 31 bytes
#define f"Hello, World"
main=0;

Try it online!
This will run, but will segfault every time. If that's not acceptable, then:
C (gcc), 32 bytes
#define f"Hello, World"
main(){}

Try it online!

-c counts as three bytes (one for the space). main=0; is the same as main;. #define Hello, World is shorter than #define f"Hello, World".

Scala, 36 bytes
object F extends App{"Hello, World"}

Try it online!
Gives the warning:
warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
object F{"Hello, World"}


text:
Compress a sparse matrix
Compress a sparse matrix using Compressed sparse row (CSR, CRS or Yale format).
These are all the same form of compression (ignore new Yale).
Input may be any 2d data structure (list of lists, etc): e.g
[[0 0 0 0],
 [5 8 0 0],
 [0 0 3 0],
 [0 6 0 0]]

And the output should be three 1d data structures (list etc), that denote the outputs A, IA and JA, for example
[5, 8, 3, 6]
[0, 0, 2, 3, 4]
[0, 1, 2, 1,]

The process is described by wikipedia:

The array A is of length NNZ and holds all the nonzero entries of M in
left-to-right top-to-bottom ("row-major") order.

The array IA is of length m + 1. It is defined by this recursive
definition:

IA[0] = 0
IA[i] = IA[i − 1] + (number of nonzero elements on the (i − 1)-th row in the original matrix)

Thus, the first m elements of IA store the index into A of the first
nonzero element in each row of M, and the last element IA[m] stores
NNZ, the number of elements in A, which can be also thought of as the
index in A of first element of a phantom row just beyond the end of
the matrix M. The values of the i-th row of the original matrix is
read from the elements A[IA[i]] to A[IA[i + 1] − 1] (inclusive on both
ends), i.e. from the start of one row to the last index just before
the start of the next.[5]

The third array, JA, contains the column index in M of each element of
A and hence is of length NNZ as well.

If your language doesn't support actual data structures, input and output may be text.
Test cases
Input 1:
[[0 0 0 0],
 [5 8 0 0],
 [0 0 3 0],
 [0 6 0 0]]

Output 1:
[ 5, 8, 3, 6 ]
[ 0, 0, 2, 3, 4 ]
[ 0, 1, 2, 1, ]

Input 2
[[10 20 0 0 0 0],
 [0 30 0 40 0 0],
 [0 0 50 60 70 0],
 [0 0 0 0 0 80]]

Output 2:
[ 10 20 30 40 50 60 70 80 ]
[  0  2  4  7  8 ]
[  0  1  1  3  2  3  4  5 ]

Input 3:
[[0 0 0],
 [0 0 0],
 [0 0 0]]

Output 3:
[ ]
[ 0 0 0 0 ]
[ ]

Input 4:
[[1 1 1],
 [1 1 1],
 [1 1 1]]

Output 4:
[ 1 1 1 1 1 1 1 1 1 ]
[ 0 3 6 9 ]
[ 0 1 2 0 1 2 0 1 2 ]

Input 5:
[[0 0 0 0],
 [5 -9 0 0],
 [0 0 0.3 0],
 [0 -400 0 0]]

Output 5:
[ 5, -9, 0.3, -400 ]
[ 0, 0, 2, 3, 4 ]
[ 0, 1, 2, 1, ]

Assume inputs may contain any real number, you need not consider mathematical symbols or exponential representation (e.g. 5,000 will never be entered as 5e3). You will not need to handle inf, -inf, NaN or any other 'pseudo-numbers'. You may output a different representation of the number (5,000 may be output as 5e3 if you so choose).
Scoring
This is a code-golf, fewest bytes wins.

Could 1-based indices be used for the last row?

@Leo for JA? No.

Isn't IA[0] = 0 completely unnecessary? It's only needed to define IA[i] = IA[i − 1]..., yet we could simply state that if i-1 < 0 to use 0. That is, IA[0] is always equal to 0, therefor it can be compressed out (yes, I realize that this is a critique of the algorithm, not this challenge).

Will we have the inverse challenge too?

@Draco18s I beleive that's what distinguishes Yale and new Yale formats.

@Adám I would like to think so

Neat! Hadn't run into either format before, but I'm glad to see someone else did see that before (I shouldn't be the kind of person who spots trivial optimizations in algorithms this old).

Is this going to get the inverse challenge 3 years later?

@Giuseppe I still haven't gotten round to it, sorry 'bout that

@Adám someone has made a sandbox post  for the reverse challenge

MATL, 19 bytes
!3#f!Dx0Gg!XsYshDq!

Input uses ; as row separator.
Try it online! Or verify all test cases: 1, 2, 3, 4, 5.
Explanation
!     % Implicit input. Transpose
3#f   % 3-output version of find: it takes all nonzero values and pushes
      % their column indices, row indices, and values, as column vectors
!     % Transpose into a row vector
D     % Display (and pop) vector of values
x     % Delete vector of row values
0     % Push 0
G     % Push input
g     % Convert to logical: nonzeros become 1
!     % Transpose
Xs    % Sum of columns. Gives a row vector
Ys    % Cumulative sum
h     % Prepend the 0 that's below on the stack
D     % Display (and pop) that vector
q     % Subtract 1 from the vector of row indices
!     % Transpose into a row vector. Implicitly display

Mathematica, 78 bytes
{a=SparseArray@#;a@"NonzeroValues",a@"RowPointers",Join@@a@"ColumnIndices"-1}&

See this answer on mathematica.stackexchange.com.

APL (Dyalog), 31 28 chars or 36 33 bytes*
Requires ⎕IO←0 for zero based indexing. I/O is list of lists.
{(∊d)(0,+\≢¨d←⍵~¨0)(∊⍸¨⍵≠0)}

Try it online!
{…} anonymous function where the argument is represented by ⍵
 (…)(…)(…) return a list of three things:
  ⍵≠0 Boolean where the argument differs from 0
  ⍸¨ ɩndices of those for each sub-list
  ∊ ϵnlist (flatten) to combine into single list
  ⍵~¨0 remove zeros from each sub-list of the argument
  d← store that as d
  ≢¨ tally each
  +\ cumulative sum
  0, prepend a zero
  ∊d ϵnlist (flatten) d to combine into single list

* To run in Dyalog Classic, simply replace ⍸ with ⎕U2378.

Nice, I don't understand the input format though? f 4 4⍴ and then the values?

@Pureferret the Code defines the function f. The Input is really a REPL, which calls f on the result of 4 4⍴… which reshapes the data into a 4×4 matrix.

Rho for reshapes. I get it!

@Pureferret I've updated the Try it online! link to better show test cases.

Jelly, 24 bytes
n0S€0;;\S€,T€Ẏ$’$
Ẏḟ0W;Ç

Try it online!

Haskell, 87 bytes
f s|a<-filter(/=0)<$>s=(id=<<a,scanl(+)0$length<$>a,s>>= \t->[i|(i,e)<-zip[0..]t,e/=0])

Try it online!
How it works:
a<-filter(/=0)<$>s           -- let a be the list of lists with all 0 removed]
                             -- e.g. [[1,0,0],[0,3,4]] -> [[1],[3,4]]

                             -- return a triple of

id=< A

scanl(+)0$length<$>a         -- partial sums of the length of the sublists of a
                             -- strating with an additional 0 -> IA

s>>=                         -- map the lambda over the sublists of s and concatenate
                             -- into a single list
   \t->[i|(i,e)<-zip[0..]t,e/=0]  -- the indices of the non-zero elements -> JA

Python+SciPy, 79 bytes
i guess built-ins were not forbidden
from scipy.sparse import*
A=csr_matrix(input())
print A.data,A.indptr,A.indices

Accepts input in the format [[0, 0, 0, 0],[5, 8, 0, 0],[0, 0, 3, 0],[0, 6, 0, 0]]

R, 70 bytes
function(m,M=t(m))list(M[x<-!!M],diffinv(colSums(x)),which(x,T)[,1]-1)

Try it online!
This is an old, matrix challenge that didn't get an R answer for 3 years! Having to do this in row-major rather than column-major order costs 8 bytes (,M=t(m))).

Python 3, 96 bytes
lambda m:list(map(list,zip(*[[e,i,j] for i,r in enumerate(m) for j,e in enumerate(r) if e!=0])))

Try it online!

Japt, 31 27 17 bytes
Hopefully this output format is OK.
cf pUmè iT å+ Ucð

Try it
cf pUmè iT å+ Ucð     :Implicit input of 2D array U
c                     :Flat map
 f                    :  Filter
   p                  :Push the following two elements
    Um                :  First element: Map U
      è               :    Count the truthy elements in each
        i             :  Prepend
         T            :    Zero
           å+         :  Cumulatively reduce by addition
              Uc      :  Second element: Flat map U
                ð     :    0-based indices of truthy elements

I just ran the other examples though and it works

PHP, 107 bytes
<?for($y=[$c=0];$r=$_GET[+$l++];)foreach($r as$k=>$v)!$v?:[$x[]=$v,$z[]=$k,$y[$l]=++$c];var_dump($x,$y,$z);

Try it online!
PHP, 109 bytes
<?$y=[$c=0];foreach($_GET as$r){foreach($r as$k=>$v)if($v){$x[]=$v;$z[]=$k;$c++;}$y[]=$c;}var_dump($x,$y,$z);

Try it online!

Does this need the numbers to be strings?

@Pureferret Any Input in PHP is a string or an array of strings. I have not casted the input so if you wish that the output is purely int  replace $x[]=$v  with $x[]=+$v

JavaScript (ES6), 117 bytes
a=>[a.map((b,i)=>(b=b.filter((x,c)=>x&&o.push(c)),m[i+1]=m[i]+b.length,b),m=[0],o=[]).reduce((x,y)=>x.concat(y)),m,o]

Input is a 2D array of numbers and output is an array of [A, IA, JA].
Explained
a=>[
    a.map((b,i) => (                                // map each matrix row
            b = b.filter((x,c) => x                 // filter to only non-zero elements
                && o.push(c)                        // and add this index to JA
            )
            m[i+1] = m[i] + b.length,               // set next value of IA
            b                                       // and return filtered row
        ),
        m=[0],o=[]                          // initialize IA (m) and JA (o)
    ).reduce((x,y) => x.concat(y)),                 // flatten the non-zero matrix
m,o]                                                // append IA and JA

Tests

let f=
a=>[a.map((b,i)=>(b=b.filter((x,c)=>x&&o.push(c)),m[i+1]=m[i]+b.length,b),m=[0],o=[]).reduce((x,y)=>x.concat(y)),m,o]

let run=x=>O.innerHTML+=f(x).map(s=>`[${s.join`, `}]`).join`\n`+"\n\n"
run([[0,0,0,0],[5,8,0,0],[0,0,3,0],[0,6,0,0]])
run([[10,20,0,0,0,0],[0,30,0,40,0,0],[0,0,50,60,70,0],[0,0,0,0,0,80]])
run([[0,0,0],[0,0,0],[0,0,0]])
run([[1,1,1],[1,1,1],[1,1,1]])
run([[0,0,0,0],[5,-9,0,0],[0,0,0.3,0],[0,-400,0,0]])

Python 2, 115 bytes
lambda m:zip(*[[v,i]for k in m for i,v in enumerate(k)if v])+[reduce(lambda a,b:a+[len(b)-b.count(0)+a[-1]],m,[0])]

Try it online!
Output is [A, JA, IA]

Perl 6, 84 bytes
{.flatmap(*.grep(+*)),(0,|[\+] .map(+*.grep(+*))),.flat.kv.flatmap:{$^a%.[0]xx?$^b}}

Try it online!
The single matrix argument is in $_.

.flatmap(*.grep(+*)) selects the nonzero elements of the entire matrix.
[\+] .map(+*.grep(+*)) is the triangular reduction of the number of elements in each row (which some languages call scan).  (0,|...) prepends a zero to that list.
.flat.kv produces an indexed list of all elements of the matrix.  .flatmap: { $^a % .[0] xx ?$^b } flat-maps over the modulus of each index by the number of columns in the array (.[0], the number of elements in the first row), replicated by the element itself, interpreted as a boolean.  That is, nonzero elements are replicated once, and zero elements are replicated zero times (ie, removed).

Julia, 66 63 bytes
using SparseArrays
n*a=getfield(sparse(a'),n)
!a=5a,3a.-1,4a.-1

SparseArrays is a standard library that stores with CSC instead of CSR (column instead of row or something), that's why we need to transpose (a').
-6 bytes if 1-indexing was allowed
overloads * with getfield to save a few bytes
Try it online!

Scala, 82 bytes
x=>x.flatMap(_.zipWithIndex).filter(_._1!=0).unzip->x.scanLeft(0)(_+_.count(_!=0))

Try it in Scastie!
Returns ((A, JA), IA)
Explanation:
x =>     //The sparse matrix to be smooshed
x.flatMap(      //Do the following operation to each row, then flatten the result
  _.zipWithIndex //Zip each element with its column (makes tuples)
).filter(      //Keep the tuples where
  _._1!=0      //the first element isn't 0
).unzip        //Unzip into a tuple of two lists, A and JA
->             //Make that the first element of another 2-tuple with IA:
x.scanLeft(0)(  //Starting with 0
  _+_.count(_!=0)  //Add the number of nonzero elements in each row
)               //Keep the intermediate results, giving us IA

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
It was just an input-bug
Continuing my It was just a bug challenge:
Input:
A string consisting of printable ASCII characters without white-spaces nor new-lines.
Output:
First turn the input into a palindrome by reverting the input, and adding it before itself, excluding the middle character (i.e. with an input 1234567890, it will becomes 0987654321234567890).
And then output this text:
0        9        8        7        6        5        4        3        2        1        2        3        4        5        6        7        8        9        0
         0       9       8       7       6       5       4       3       2       1       2       3       4       5       6       7       8       9       0
                  0      9      8      7      6      5      4      3      2      1      2      3      4      5      6      7      8      9      0
                           0     9     8     7     6     5     4     3     2     1     2     3     4     5     6     7     8     9     0
                                    0    9    8    7    6    5    4    3    2    1    2    3    4    5    6    7    8    9    0
                                             0   9   8   7   6   5   4   3   2   1   2   3   4   5   6   7   8   9   0
                                                      0  9  8  7  6  5  4  3  2  1  2  3  4  5  6  7  8  9  0
                                                               0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
                                                                        0987654321234567890
                                                               0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
                                                      0  9  8  7  6  5  4  3  2  1  2  3  4  5  6  7  8  9  0
                                             0   9   8   7   6   5   4   3   2   1   2   3   4   5   6   7   8   9   0
                                    0    9    8    7    6    5    4    3    2    1    2    3    4    5    6    7    8    9    0
                           0     9     8     7     6     5     4     3     2     1     2     3     4     5     6     7     8     9     0
                  0      9      8      7      6      5      4      3      2      1      2      3      4      5      6      7      8      9      0
         0       9       8       7       6       5       4       3       2       1       2       3       4       5       6       7       8       9       0
0        9        8        7        6        5        4        3        2        1        2        3        4        5        6        7        8        9        0

(From the middle outward in both directions, each character is separated by one more space than the previous line.)
Challenge rules:

You need to print twice the length of the input, minus 3 lines. So with the input 1234567890, the output displayed above is 17 lines (length 10 * 2 - 3).
The input will only contain printable ASCII (excluding space, tab and new-line).
Trailing spaces are optional.
A single trailing new-line is optional.
(Additional) leading spaces or leading new-lines are not allowed.
You can assume the input will always be at least four characters long.
Unlike my It was just a bug challenge, both the input and output formats are flexible. So you are allowed to output the result as a String-array, String-list, etc.

General rules:

This is code-golf, so shortest answer in bytes wins.
Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.
Standard rules apply for your answer, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.
Default Loopholes are forbidden.
If possible, please add a link with a test for your code.
Also, please add an explanation if necessary.

Test cases:
Input: 1234567890
Output:
0        9        8        7        6        5        4        3        2        1        2        3        4        5        6        7        8        9        0
         0       9       8       7       6       5       4       3       2       1       2       3       4       5       6       7       8       9       0
                  0      9      8      7      6      5      4      3      2      1      2      3      4      5      6      7      8      9      0
                           0     9     8     7     6     5     4     3     2     1     2     3     4     5     6     7     8     9     0
                                    0    9    8    7    6    5    4    3    2    1    2    3    4    5    6    7    8    9    0
                                             0   9   8   7   6   5   4   3   2   1   2   3   4   5   6   7   8   9   0
                                                      0  9  8  7  6  5  4  3  2  1  2  3  4  5  6  7  8  9  0
                                                               0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
                                                                        0987654321234567890
                                                               0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
                                                      0  9  8  7  6  5  4  3  2  1  2  3  4  5  6  7  8  9  0
                                             0   9   8   7   6   5   4   3   2   1   2   3   4   5   6   7   8   9   0
                                    0    9    8    7    6    5    4    3    2    1    2    3    4    5    6    7    8    9    0
                           0     9     8     7     6     5     4     3     2     1     2     3     4     5     6     7     8     9     0
                  0      9      8      7      6      5      4      3      2      1      2      3      4      5      6      7      8      9      0
         0       9       8       7       6       5       4       3       2       1       2       3       4       5       6       7       8       9       0
0        9        8        7        6        5        4        3        2        1        2        3        4        5        6        7        8        9        0

Input: ABCD
Output:
D  C  B  A  B  C  D
   D C B A B C D
      DCBABCD
   D C B A B C D
D  C  B  A  B  C  D

Input: =>)}]
Output:
]   }   )   >   =   >   )   }   ]
    ]  }  )  >  =  >  )  }  ]
        ] } ) > = > ) } ]
            ]})>=>)}]
        ] } ) > = > ) } ]
    ]  }  )  >  =  >  )  }  ]
]   }   )   >   =   >   )   }   ]

Input: XXxxXX
Output:
X    X    x    x    X    X    X    x    x    X    X
     X   X   x   x   X   X   X   x   x   X   X
          X  X  x  x  X  X  X  x  x  X  X
               X X x x X X X x x X X
                    XXxxXXXxxXX
               X X x x X X X x x X X
          X  X  x  x  X  X  X  x  x  X  X
     X   X   x   x   X   X   X   x   x   X   X
X    X    x    x    X    X    X    x    x    X   X

Are an equal amount of leading spaces on every line OK?

@Adám Sorry but no. Any number of trailing spaces are fine, but leading spaces not. I'll specify this rule in the challenge.

"You need to print the length of the input minus 3 lines." then "(length 10 * 2 - 3)". The first sentence says "no double", the second one says "double". So which is it?

@OlivierGrégoire Oops, first line should have contained 2x the length minus 3. Fixed

Vyxal C, 11 bytes
ṪẏṘ∞ƛ?Ṙ∞$Ij

Try it Online!
Explanation
ṪẏṘ∞ƛ?Ṙ∞$Ij
Ṫ           # Remove the last element (removing the first element would be fine too)
 ẏ          # Make a range [0, length)
  Ṙ         # Reverse
   ∞        # Palindromize, a + a[::-1][1:]
    ƛ       # Map, and for each:
     ?Ṙ     #  Push the input reversed
       ∞    #  Palindromize that (call this X)
        $   #  Swap so the current item is at the top
         I  #  Push that many spaces
          j #  Join the characters of X by that
            # C flag centers and joins on newlines

Would you mind adding an explanation? Then I'll accept it as the new shortest answer.

@KevinCruijssen Sure, added.

Japt, 22 21 bytes
¬Å£¬qYîÃy w ê y w ê ·

Test it online!
Explanation
The first 8 bytes generate the bottom-right quadrant of the pattern:
 ¬ Å  £    ¬ qYîÃ
Uq s1 mXY{Uq qYî}

Uq                 : Split the input into characters.
   s1              : Slice off the first.
      mXY{      }  : Map each item X and index Y to
          Uq       :   the input split into chars,
             q     :   joined with
              Yî   :     Y spaces.

At this point we have an array of e.g. ["ABCD", "A B C D", "A  B  C  D"]. Unfortunately, it takes 13 bytes to square this:
y w ê y w ê ·
y w ê y w ê qR
y                : Pad each line to the same length with spaces and transpose.
  w              : Reverse the array, and
    ê            : palindromize. Now we have the bottom half of the output transposed.
      y          : Transpose back.
        w ê      : Reverse and palindromize again, giving the full output.
            qR   : Join with newlines.
                 : Implicit: output result of last expression

Wish I'd thought to use transpose - nicely done :)

Can I ask a question I'm scared to know the answer to?  Are you and the rest here actually coding this out in its minified version?

If you dare. Probably not.

@gdbj I usually do... is that a bad sign? :P

@ETHproductions Was just telling a buddy that this is similar to real golf: frustrating to learn, strangely addicting, and demonstrating skill in it commands respect.

Python 3, 149 141 95 bytes
def f(s):l=len(s)-1;[print((' '*abs(i)).join(s[:0:-1]+s).center(2*l*l+1))for i in range(1-l,l)]

Try it online!
Thanks to @KevinCruijssen and @ETHproductions for saving some bytes
Special thanks to @notjagan for saving 46 bytes!

Changing l=len(s); to l=len(s)-1; and then changing all the values involving l (i.e. l-1 -> l; -l+2 -> -l+1; etc.) is 8 bytes shorter. Try it here.

-l+2 -> 2-l :)

Thanks @KevinCruijssen, unfortunately I cannot edit right now, can you please edit in?

@KevinCruijssen Thanks a lot!

6 bytes shorter by changing the for loop to a list comp and changing i[::-1][:-1] to i[:0:-1].

Down to 95 bytes using center instead of the for loop!

05AB1E, 17 bytes
g<F¹RSðN×ýû})Rû.c

Try it online!
-1 thanks to kalsowerus.

You can save one byte by replacing .c.∊ with û.c

@kalsowerus And I knew there would be some way to use û...thanks!

Charcoal, 14 bytes
Ｅ⁻Ｌθ¹⪫θ× ι‖Ｏ←↑

Try it online!
AST:
Program
├Print
│└Ｅ: Map
│ ├⁻: Difference
│ │├Ｌ: Length
│ ││└θ: Identifier θ
│ │└1: Number 1
│ └⪫: Join
│  ├θ: Identifier θ
│  └×: Product
│   ├' ': String ' '
│   └ι: Identifier ι
└‖Ｏ: Reflect overlap
 └Multidirectional
  ├←: Left
  └↑: Up

Might be 16 codepoints, but as UTF-8 Python 3 reports that it is 41 bytes. Which charset do you use to make it 16 bytes?

@JanusTroelsen It's a custom charset.

Huh, ⪫ works on strings? Must remember that for next time...

@Neil Yeah it makes sense doesn't it?

Technically your edit is noncompeting because the relevant commit postdates the challenge.

There's new consensus about that, and right now it has lots of upvotes so I follow it. ;)

Sometimes I'm curious what the backend source code for Charcoal looks like.. It's cool that you print the input string and add one more space every line, and with a 'simply' ‖Ｏ←↑ you reflect it left, up and diagonal left+up, like it's nothing. I really need to learn this language. :)

@KevinCruijssen You seem to like ascii-art, so I'd recommend to...it's not really difficult btw.

@KevinCruijssen If you're curious then look at it :P remember you can click on the language name on TIO

@ASCII-only Or directly on the header of my post!

:O what amazing

JavaScript (ES6), 159 136 129 127 bytes
f=(i,x=1-(l=i.length-1),y=x<0?-x:x,[,...b]=i)=>l>x?''.padEnd(l*(l+~y))+[...b.reverse(),...i].join(''.padEnd(y))+`
`+f(i,x+1):''

Try it online! Explanation below
// This is a recursive function
// First, inputs and various variable initializations
// by using defaults
let func = (
  // Text input, will not be modified through recursion
  input,

  // Current line, for the first function call we start from -lines to +lines
  // It's roughly equivalent to lines*2 but this helps us computing the spacing
  // Also computing the total amount of lines
  currentLine = 1 - (totalLines = input.length - 1),

  // Getting the absolute value of the current line (like Math.floor)
  absCurrentLine = currentLine < 0 ? -currentLine : currentLine,

  // Getting the input without it's first letter, useful for the palidrome of the input
  [,...slicedInput] = input

// Base case, stopping the recursion if the current line
// is still below the total amount of lines
) => totalLines > currentLine

  // Leading spacing
  ? ''.padEnd(totalLines * (totalLines + ~absCurrentLine)) +

  // Putting together the palindrome version and adding spaces between the chars
    [...slicedInput.reverse(), ...input].join(''.padEnd(absCurrentLine)) + `

  // Line return + recursion call
` + f(input, currentLine + 1)
  : ''

First entry to codegolf, I apologise in advance for any obvious mistakes.
Thanks to Justin Mariner for saving 23 bytes!
Thanks to Craig Ayre for saving 11 bytes and for the bug report.

Nice first answer, +1 from me and welcome to PPCG. I'm not too familiar with Js, but is it possible to start x at -2 instead of -1, and change x<=l to ++x<=l so you can remove the x++ and save a byte?

I tried but didn't manage to because lines is entangled with the spacing as well so it ends up costing more bytes to make it all work again. But I'm fairly certain that there is both a better way to organise the code and add your suggestion.

Welcome to PPCG, nice first post and explanation! Golfed down to 133 bytes here. Includes explanation of what was changed.

Unfortunately your output doesn't seem to quite match the expected output: see here

Thank you for noticing, should be fixed now - had to add 3 bytes but at least it works!

Good job on fixing the bug with so few bytes! Here is a recursive version of your solution - I'm sure it can be golfed further still!

This is great, I added your new function and updated the explanation

Sadly, the output is not the same

Let us continue this discussion in chat.

SOGL V0.12, 22 18 bytes
ā,⁄H{,čFH@*∑Κ}▓±╬-

Try it Here!
Explanation:
ā                   push an empty array - canvas
 ,⁄H{        }      input length-1 times do
     ,                push the input
      č               chop it into chars
       FH@*           get the current iteration-1 amount of spaces
           ∑          join the chopped input with the spaces
            Κ         prepend it to the array
              ▓     space to a square
               ±    reverse each string in that list
                ╬-  quad-palindromize with 1 X and 1 Y overlap and without swapping characters

Is ╬- the four-way palindromize command? I was just over here wishing Japt had something like that... :P

@ETHproductions FWIW, ╬ is many things

I know, hence why I specified ╬-. But thanks, I couldn't find that page for some reason

@ETHproductions Oh. It only exists in the SOGLOnline copy of the interpreter :/ At some point I need to join the two together :|

Hmm...you should implement automatic F for ∑ if it's needed.

@EriktheOutgolfer The explanation is a bit off (it's č that chops). I thought I already implemented it, but forgot to  push. Thanks for the reminder!

PHP, 145 131 bytes
It took some thinking to golf that additional byte; but it was worth it.
while($y<=2*$e=strlen($a=$argn)-1)echo($p=str_pad)("
",$e*($e-$d=abs($y++-$e))+1),chunk_split($a.substr(strrev($a),1),1,$p("",$d));

prints a leading newline. Run as pipe with -nR or try it online.
breakdown
while($y<=2*$e=strlen($a=$argn)-1)  # $e=length-1, loop through rows
                                        # 1. print linebreak and left padding
    echo($p=str_pad)("\n",$e*($e-$d=abs($y++-$e))+1),
        chunk_split(
            $a.substr(strrev($a),1)     # 2. palindromize input
            ,1,$p("",$d));              # 3. insert $e..0..$e spaces between characters

alternative solution, same length:
for($d=-$e=strlen($a=$argn)-1;$d<$e;)echo($p=str_pad)("
",$e*($e-$b=abs($d++))+1),chunk_split($a.substr(strrev($a),1),1,$p("",$b));

You can save 13 Bytes with Try it online!

APL (Dyalog), 37 bytes
Requires ⎕IO←0 which is default on many systems.
{⍉m(2-d)↓⍉(m←⊖⍪1↓⊢)↑∊¨(1↓⍳d←≢⍵)↑¨¨⊂⍵}

{…} anonymous function where the argument is represented by ⍵
 (…)↑¨¨⊂⍵ for each (¨) of the following numbers take (↑) that many characters from each (¨) of the entire (⊂) argument, padding with spaces as necessary:
  ≢w the number of characters in the argument
  d← store that in d
  ⍳ that many ɩndices (0 … d − 1)
  1↓ drop one (the zero)
 ∊¨ ϵnlist (flatten) each
 ↑ raise the rank (convert the list of lists into a matrix)
 (m←…) apply the following tacit function m, defined as:
  ⊖ the upside-down argument
  ⍪ on top of
  1 one [row]
  ↓ dropped from
  ⊢ the argument
 ⍉ transpose
 (…)↓ drop:
  2-d = −(d − 2), i.e. d − 2 rows from the bottom
 m apply m
 ⍉ transpose
Try it online!

Java (OpenJDK 8), 201 196 bytes
s->{for(int l=s.length()-1,i=-l,x=0;++i<l;x+=i<0?l:-l)System.out.printf("%1$"+(x<1?"":x)+"s"+s.join("%1$"+(i<0?-i:i>0?i:"")+"s",(new StringBuffer(s.substring(1)).reverse()+s).split(""))+"%n","");}

Try it online!
It's the same idea as the one I used for the previous challenge, except that the generator string is now a tad longer and with more hard to handle cases.
%1$Ns0%1$Ns9%1$Ns8%1$Ns7%1$Ns6%1$Ns5%1$Ns4%1$Ns3%1$Ns2%1$Ns1%1$Ns2%1$Ns3%1$Ns4%1$Ns5%1$Ns6%1$Ns7%1$Ns8%1$Ns9%1$Ns0%n

Python 3, 134 124 bytes
f=lambda s:'\n'.join([' '*(len(s)-1)*abs(len(s)-abs(i)-2)+(' '*abs(i)).join(s[::-1]+s[1:]) for i in range(2-len(s),len(s)-1)])

Try it online!
First post to PPCG after lurking for a while. Looking for any suggestions/advice!

Thanks to @LyricLy and @Łukasz Rogalski for improvements!

You don't have to print the output inside the function, output can be given in a return value. Also, you don't have to count the f= in the bytecount, simply providing an anonymous function is fine.

Also, -len(s)+2 is just 2-len(s), one less byte.

Thank you @Łukasz Rogalski and @LyricLy; you have saved me 10 bytes!

Haskell, 177 163 bytes
import Data.List
k n=[1..n]>>" "
f s=let n=length s in map(\x->(k(((n-1)*(n-(abs x)))))++(intercalate (k(abs x))$map(\z->[z])$((++)=<<reverse.tail) s))[n,n-1.. -n]

The function f is the challenge function and returns a list of strings ([String]), using unlines on it should provide the same visual output as the test cases (main = putStr $ unlines $ f "test string" to compile it).
Try it online!
-14 bytes thanks to @nimi

k can be defined as k n=[1..n]>>" " and p as p=(++)=<<reverse.tail (you can even inline this definition).

Thunno 2 N, 14 bytes
ḣı$ṅṣj;ðƬrⱮṬrⱮ

Try it online!
I have absolutely no idea why this works, but it does.
Explanation
ḣı$ṅṣj;ðƬrⱮṬrⱮ  # Implicit input
ḣı    ;         # len(input) - 1 times:
  $  j          #   Join the input by...
   ṅṣ           #   ...loop index spaces
       ðƬ       # Transpose with filler space
         rⱮ     # Reverse and palindromise
           Ṭ    # Tranpose it
            rⱮ  # Reverse and palindromise
                # Implicit output, joined on newlines

I did quite a bit of experimenting, producing a lot of buggy outputs. Here's my favourite:
                                                                        0987654321234567890
                                                               0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
                                                      0  9  8  7  6  5  4  3  2  1  2  3  4  5  6  7  8  9  0
                                             0   9   8   7   6   5   4   3   2   1   2   3   4   5   6   7   8   9   0
                                    0    9    8    7    6    5    4    3    2    1    2    3    4    5    6    7    8    9    0
                           0     9     8     7     6     5     4     3     2     1     2     3     4     5     6     7     8     9     0
                  0      9      8      7      6      5      4      3      2      1      2      3      4      5      6      7      8      9      0
         0       9       8       7       6       5       4       3       2       1       2       3       4       5       6       7       8       9       0
0        9        8        7        6        5        4        3        2        1        2        3        4        5        6        7        8        9        0
         0       9       8       7       6       5       4       3       2       1       2       3       4       5       6       7       8       9       0
                  0      9      8      7      6      5      4      3      2      1      2      3      4      5      6      7      8      9      0
                           0     9     8     7     6     5     4     3     2     1     2     3     4     5     6     7     8     9     0
                                    0    9    8    7    6    5    4    3    2    1    2    3    4    5    6    7    8    9    0
                                             0   9   8   7   6   5   4   3   2   1   2   3   4   5   6   7   8   9   0
                                                      0  9  8  7  6  5  4  3  2  1  2  3  4  5  6  7  8  9  0
                                                               0 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9 0
                                                                        0987654321234567890

Mathematica, 141 bytes
Column[Join[Reverse@(s=Row/@Table[Riffle[Reverse@Rest@b~Join~b,""<>Table[" ",i]],{i,0,Length[b=Characters@#]-1}]),Rest@s],Alignment->Center]&

Japt -R, 15 bytes
ÊÆÔ¬qXç)êÃÔÅê û

Try it
ÊÆÔ¬qXç)êÃÔÅê û     :Implicit input of string
Ê                   :Length
 Æ                  :Map each X in the range [0,length)
  Ô                 :  Reverse U
   ¬                :  Split
    q               :  Join with
     Xç             :    X spaces
       )            :  End join
        ê           :  Palindromise
         Ã          :End map
          Ô         :Reverse
           Å        :Slice off first element
            ê       :Palindromise
              û     :Centre pad each element with spaces to the length of the longest
                    :Implicit output joined with newlines

Julia 1.0, 100 90 bytes
s->(l=length(s)-2;[' '^(-~l*(l-j))*prod(s[abs(i)+1]*' '^j for i=~l:l+1) for j=abs.(-l:l)])

Try it online!
-10 bytes thanks to @KevinCruijssen

Nice answer! Some small things to golf: (l+1) can be -~l and in -l-1 can be in~l for -5 bytes. (Here is the relevant tip. And if you haven't seen it yet, tips for golfing in Julia might be interesting to read through as well.)

You've now accidently used ~-l (l-1) instead of -~l (l+1) in your latest edit, so the output is incorrect.. :)

true, thanks for checking ;)

Canvas, 14 bytes
Ｌ╷ｒＨ ×⁸；＊∔｝↔↕┼

Try it here!
Explanation
L|rH ×⁸;*∔}↔↕┼
L              length of input
 |r            decrement, make range [0..n-1]
   H           create an empty art object, start a loop with i
     ×         repeat space i times
      ⁸;       swap with the input
        *      join input with i spaces
         ∔     add to the bottom of the previous iteration
          }    close the loop
           ↔↕  mirror horizontally and vertically
             ┼ quad palindromize with 1 character overlap

Yep, looks great now. I'll remove my comments. +1 from me. Would you mind adding an explanation?

05AB1E, 14 bytes
¦ε\RðN×ýû}Rû.c

Input as a list of characters.
Try it online or verify all test cases.
14 bytes alternative:
ā¨RjJíðδÜ€ûû.c

Also takes a list of characters as input.
Try it online or verify all test cases.
Explanation:
¦              # Remove the first item of the (implicit) input-list
               # (could have removed the last as alternative as well)
 ε             # Map over each character:
  \            #  Discard the character
   R           #  Reverse the (implicit) input-list
     N         #  Push the 0-based map-index
    ð ×        #  Repeat a space character that many times as string
       ý       #  Join the reversed input-list with this spaces-string as delimiter
        û      #  Palindromize the entire string
 }R            # After the map: reverse the resulting list
   û           # Palindromize this entire list
    .c         # And centralize it, which also implicitly joins by newlines
               # (after which the result is output implicitly)

ā              # Push a list in the range [1, (implicit) input-length]
 ¨             # Remove the last item to make the range [1, input-length)
  R            # Reverse the list to (input-length, 1]
   j           # Pad each character in the (implicit) input-list with leading spaces so
               # the string lengths become equal to the current integer
    J          # Join each inner list of strings together to a single string
     í         # Reverse each string
       δ       # Map over each string:
      ð Ü      #  And remove all trailing spaces
         €û    # Palindromize each string
           û   # Palindromize the entire list
            .c # And centralize it, which also implicitly joins by newlines
               # (after which the result is output implicitly)

Zsh, 117 113 109 112 bytes
b=`rev<<<$1`${1:1};j=$#1
for c ({$j..1} {2..$j}){printf %$[(j-1)*(j-c)]s
for x (${(s::)b})printf %-$c\s $x;echo}

Try it online!
 109b invalid
 113b
 117b
b is the palindrome; j is the length of input string $1. Iterate c over the range {j..1..j}. For each c, print a prefixed number of spaces. For every character x in b, print x with c spaces between each.

Your output has a leading newline, making it invalid I'm afraid due to rule "(Additional) leading spaces or leading new-lines are not allowed.". (If I would have posted this challenge now, I would have done it differently and allowed any amount of leading/trailing spaces/newlines. But since the amount of answers already on this six year old challenge, it's too late to change it now unfortunately.)

Hah, I didn't think anyone would notice that :). OK, adjusted per spec. At least the code is slightly more readable now.