text:
N-dimensional identity "matrix"
Given a positive integer n, output the N-dimensional identity "matrix", which is the N^N array with 1 where all the components of the indices are equal and 0 otherwise. N^N means N-by-N-by-N-by-...
1 -> [1]

2 -> [[1,0],[0,1]]

3 -> [[[1,0,0],[0,0,0],[0,0,0]],[[0,0,0],[0,1,0],[0,0,0]],[[0,0,0],[0,0,0],[0,0,1]]]

4 -> [[[[1,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]]],[[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],[[0,0,0,0],[0,1,0,0],[0,0,0,0],[0,0,0,0]],[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]]],[[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],[[0,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]]],[[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,1]]]]

For example, if a is the 4-dimensional identity "matrix", then the only entries with 1 would be a[0][0][0][0], a[1][1][1][1], a[2][2][2][2], and a[3][3][3][3].
This is code-golf. Shortest answer in bytes wins. Standard loopholes apply.

Related, related.

Here comes the MATL answer with a builtin doing it for you...

Octave, 29 bytes
@(n)accumarray((x=1:n)'+!x,1)

Try it online!

Jelly, 8 bytes
×=¥þ’¡`Ṡ

Try it online!
Ooh, looks like I get to outgolf @Dennis in his own language again :-)
This is a 1-argument function (because Jelly's default output format for nested lists is a little ambiguous, meaning that it arguably doesn't fulfil the spec as a full program).
Explanation
×=¥þ’¡`Ṡ
     ¡    Repeatedly apply the following operation,
    ’     {input-1} times in total:
   þ        For each element of the current value {perhaps made into a range}
      `     and of {the range from 1 to the} {input}:
 =            Compare corresponding elements, giving 0 for equal or 1 for unequal
× ¥           then multiply by one of the elements
       Ṡ  then replace each element with its sign

In order to understand this, it helps to look at the intermediate steps. For an input of 3, we get the following intermediate steps:

[1,2,3] (input, made into a range implicitly by the þ)
[[1,0,0],[0,2,0],[0,0,3]] (make a table with [1,2,3], compare for equality to get [[1,0,0],[0,1,0],[0,0,1]], then multiply by one of the values we compared)
[[[1,0,0],[0,0,0],[0,0,0]],[[0,0,0],[0,2,0],[0,0,0]],[[0,0,0],[0,0,0],[0,0,3]]] (the same idea again)
[[[1,0,0],[0,0,0],[0,0,0]],[[0,0,0],[0,1,0],[0,0,0]],[[0,0,0],[0,0,0],[0,0,1]]] (replace each element with its sign using Ṡ)

Note the fact that the input starts out 1-dimensional means that we have to loop (input-1) times in order to add (input-1) dimensions, producing an input-dimensional list.
Fun fact: this program contains five quicks in a row, ¥þ’¡`. (A quick is a modifier to a "link", or builtin, used to modify its behaviour or combine it with another link.)

+!, just because you beat Dennis in Jelly.

Mathematica, 30 bytes
Array[Boole@*Equal,#~Table~#]&

@FryAmTheEggman an integer parameter as the second argument to Table is a recent addition. Mathics still needs a singleton list there: https://tio.run/##y00sychMLv7/P83WsagosTLaKT8/J9VBy7WwNDFHR7kuJDEpJ7WuWrk2Vo0roCgzryQ6Ldo4Nvb/fwA

@FryAmTheEggman Looks like you need to change it to Array[Boole@*Equal,#~Table~{#}]& to work on Mathics. Older versions of Mathematica don't support an integer as the second argument to Table, and I guess Mathics is based off that.

@MartinEnder Pinch, poke, you owe me a Coke :)

APL (Dyalog), 10 bytes
1=≢∘∪¨⍳⍴⍨⎕

Try it online!
1= [is] 1 equal to
≢ the number
∘ of
∪ unique elements
¨ in each of
⍳ the indices in an array with the dimensions of
⍴⍨ the self-reshape (N copies of N) of
⎕ the input (N) [?]

Jelly, 9 bytes
ðṗE€ṁ+þ’¡

Try it online!
How it works
Achieving the task directly seems to be difficult (I haven't found a way), but contructing arrays of the same numbers and arrays of the same shape is quite easy.
ð makes the chain dyadic, and the integer input n serves as both left and right argument for the chain. It's possible to use a monadic chain instead, but the parsing rules for dyadic ones save three bytes here (two after accouting for ð).
The Cartesian power atom ṗ, with left and right argument equal to n, constructs the array of all vectors of length n that consist of elements of [1, ..., n], sorted lexicographically.
When n = 3, this yields
[[1, 1, 1], [1, 1, 2], [1, 1, 3], [1, 2, 1], [1, 2, 2], [1, 2, 3], [1, 3, 1], [1, 3, 2], [1, 3, 3], [2, 1, 1], [2, 1, 2], [2, 1, 3], [2, 2, 1], [2, 2, 2], [2, 2, 3], [2, 3, 1], [2, 3, 2], [2, 3, 3], [3, 1, 1], [3, 1, 2], [3, 1, 3], [3, 2, 1], [3, 2, 2], [3, 2, 3], [3, 3, 1], [3, 3, 2], [3, 3, 3]]

The equal each quicklink E€ tests the elements of all constructed vectors for equality.
When n = 3, we get
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]

which are the elements of the 3-dimensional identity matrix, in a flat array.
The dyadic quicklink +þ’¡ is called with left argument and right argument n. The quick ¡ calls the decrement atom ’, which yields n-1, then calls the add table quicklink +þ n-1 times.
Initially, the arguments of +þ are both n. After each call, the right argument is replaced by the left one, and the left one is replaced by the return value of the call.
The table quick calls the add atom + for each elements of its left argument and each element of its right argument, constructing a table/matrix of the return value. The initial integer arguments n are promoted to the ranges [1, ... n].
When n = 3, after promotion but before the first iteration, both arguments are
[1, 2, 3]

Adding each integer in this array to each integer in this array yields
[[2, 3, 4], [3, 4, 5], [4, 5, 6]]

In the next invocation, we add each of these arrays to the integers in [1, 2, 3]. Addition vectorizes (adding an integer to an array adds it to each element), so we get
[[[3, 4, 5], [4, 5, 6], [5, 6, 7]],
 [[4, 5, 6], [5, 6, 7], [6, 7, 8]],
 [[5, 6, 7], [6, 7, 8], [7, 8, 9]]]

This array has the same shape as the 3-dimensional identity matrix, but not the correct elements.
Finally, the mold atom ṁ discards the integer entries of the result to the right and replaces them in order with the elements in the result to the left.

Python, 70 bytes
f=lambda n,l=[]:[f(n,l+[i])for i in(len(l)<n)*range(n)]or+(l==l[:1]*n)

Try it online!
A recursive solution. Thinking of the matrix as a list of matrices one dimension smaller, it iterates over that list to go down the tree. It remembers the indices picked in l, and when n indices have been picked, we assign a 1 or 0 depending on whether they are all the same.

Python 2, 73 bytes
n=input();r=0
exec'r=eval(`[r]*n`);'*n+('n-=1;r'+'[n]'*n+'=1;')*n
print r

Try it online!
An improvement on totallyhuman's method of making a matrix of zeroes and then assigning ones to the diagonal.

Python 2, 88 bytes
n=input()
t=tuple(range(n))
print eval('['*n+'+(i0'+'==i%d'*n%t+')'+'for i%d in t]'*n%t)

Try it online!
Some nonsense with eval, generating a nested list, and string-format substitution. The string to be evaluated looks like:
[[[+(i0==i0==i1==i2)for i0 in t]for i1 in t]for i2 in t]

Python 2 + NumPy, 80 72 70 bytes
Now tied with the top Python answer!
from numpy import*
n=input()
a=zeros((n,)*n)
a[[range(n)]*n]=1
print a

Try it online
Saved 8 bytes thanks to Andras Deak, and 2 by officialaimm

Make use of fancy indexing: a[[range(n)]*n]=1 instead of your exec.

(There's actually fill_diagonal(a,1) for this purpose, but that's one byte longer)

+1 for the pretty output. And, I don't see the use of the variable i, that should save 2 bytes.

Python 2, 99 93 90 bytes
Thanks to Rod for some even more help that got it working and also shaved 6 bytes off! -3 bytes thanks to xnor.
n=input()
r=eval(`eval('['*n+'0'+']*n'*n)`)
for i in range(n):exec'r'+`[i]`*n+'=1'
print r

Try it online!

def/return is never better than input/print (in the best scenario it's equal), you can also drop the () in ('[%d]'%i) reducing to 93 bytes

'[%d]'%i happens to be the string rep of [i].

Brainfuck, 61 bytes
>,[->+>+<<]>[-<<+>>]>-[->+.-<<<<[->+>+<<]>[-<+>]>[->>.<<]>]+.

Ungolfed
The numbers after the angle brackets indicate the cell the head is over.
>,                   read n to 1
[->+>+<<]            move 1 to 2 and 3
>2[-<<+>>]>3         move 2 to 0
                     (tape: n 0 0 n 0)
-[                   while cell 3 {
    -                  dec 3
    >4+.-<3            print \x1
    <<<0[->+>+<<]      move 0 to 1 and 2
    >1[-<+>]>2         move 1 to 0
                       (tape: 0 0 n rows_left 0)
    [                  while cell 2 {
        -                dec 2
        >>4.<<           print \x0
    ]>3                }
]                    }
+.                   print \x1

Try it online!
Input is a binary number.  Output is a matrix stored in row-major order.

There are a few different output formats in the answers already, so I'm assuming that the only requirement is "some standard matrix representation".  If it needs to be in a particular format, I'll modify the code accordingly.

i guess row-major in this particular case would look exactly like column-major

@Octopus Actually, the program determines whether it should be in row-major or column-major order based on the language the Brainfuck interpreter is written in.  Mine is written in C, so it naturally outputs the matrix in row-major order.  However, if you used an interpreter written in Fortran or MATLAB, it would detect that and automatically switch to column major order.  (If you used an interpreter written in Brainfuck itself, it resolves the ambiguity based on the language your text editor is written in.) :-)

JavaScript (ES6), 67 bytes
f=(n,d=n-1,i)=>[...Array(n)].map((_,j)=>d?f(n,d-1,j-i?n:j):j-i?0:1)

Explanation: i is used to keep track of whether the cell is on the main diagonal or not. Initially it's undefined, so on the first recursive call we always pass the first dimension, while on subsequent recursive calls we only pass it on if the current dimension index is equal to all previous dimensions, otherwise we pass an index of n which indicates that all of the recursive cells should be zero.

R, 64 49 bytes
-15 bytes thanks to Jarko Dubbeldam
x=array(0,rep(n<-scan(),n));x[seq(1,n^n,l=n)]=1;x

Reads from stdin and returns an array, printing as matrices. seq generates a sequence evenly spaced from 1 to n^n with length l=n, which does the trick quite nicely to index where the 1s go.
Try it online!
old version:
n=scan();x=rep(0,n^n);x=array(x,rep(n,n));x[matrix(1:n,n,n)]=1;x

Reads n from stdin; returns an array, printing the results as matrices. I struggled with this for a while until I read the docs for [, which indicate that a matrix can be used to index an array, where each row of the matrix represents the set of indices. Neat!
Try it online!

array(0, rep(n,n) works, so you dont have to do rep. You can then also take n through array(0, rep(n<-scan(),n)).

Also, x[seq(1,n^n,l=n)]=1 is 1 byte shorter.

@JarkoDubbeldam thank you! Nice one.

Python 3 + numpy, 81 77 bytes
from numpy import*
f=lambda n:all([a==range(n)for a in indices((n,)*n)],0)+0

I'm not entirely sure that the above fits all guidelines: it returns an ndarray with the given properties. I know anonymous functions are usually fine, but an interactive shell will actually print
>>> f(2)
array([[1, 0],
       [0, 1]])

If the array fluff makes the above invalid, I have to throw in a print() for something like 7 additional bytes.
Try it online!

Pyth, 14 bytes
ucGQtQms!t{d^U

Test suite
Explanation: ^U, which is implicitly ^UQQ, where Q is the input, calculates all possible Q element lists of the range 0 ... n-1. ms!t{d maps the ones with all elements equal to 1, and the rest to 0. This gives the flattened output
ucGQtQ executes the following, Q - 1 times: Chop the input into lists of size Q.

C# (.NET Core), 166 bytes
n=>{var c=new int[n];int i=0,d;for(;i<n;c[i++]=n);var m=System.Array.CreateInstance(typeof(int),c);for(i=0;i<n;i++){for(d=0;d<n;c[d++]=i);m.SetValue(1,c);};return m;}

Try it online!
At first I thought it could not be done with a lambda expression in C#... ^__^U

J, 16 15 bytes
i.@#~=i.*]#.#&1

Try it online!

Common Lisp, 147 133 bytes
(defun i(n)(flet((m(x)(fill(make-list n)x)))(let((a(make-array(m n):initial-element 0)))(dotimes(i n)(incf(apply #'aref a(m i))))a)))

Try it online!
The usual super-lengthy lisp. Reduced 12 bytes thank to @ceilingcat!
Explanation:
(defun i (n)
  (flet ((m (x) (fill (make-list n) x)))            ; function to build a list of n values x
    (let ((a (make-array (m n) :initial-element 0))); build the array with all 0
      (dotimes (i n)                                ; for i from 0 to n-1
        (incf (apply #'aref a (m i))))              ; add 1 to a[i]..[i]
      a)))                                          ; return the array

@ceilingcat, ops, there was a stupid error in the golfed version. Corrected, thanks!

Vyxal, 6 bytes
ẋÞm⁽≈€

Try it Online!
My first submission, thanks to emanresu for help with the lambda.

Clojure, 92 bytes
#(reduce(fn[v i](assoc-in v(repeat % i)1))(nth(iterate(fn[v](vec(repeat % v)))0)%)(range %))

Nice that assoc-in works also with vectors, not only with hash-maps.

SOGL V0.12, 22 bytes
.^κ.H/ 0* 1.H≤Οčr.H{.n

Try it Here!
Leaves the output on the stack, viewable in the console. If the numbers in the output were allowed to be strings, then the r could be removed.
Just as a fun test of how SOGL does in challenges it was completely not made for :p
input: x
.^                      push  x^x
  κ                     subtract x    (x^x)-x
   .H/                  divide by x   ((x^x) - x)/x
       0*               get that many zeroes
          1             push "1"
           .H           push x-1
             ≤          pull the first item from the stack to the top
              Ο         encase (x-1 times the zeroes, separated, started and ended with 1s)
               č        chop to a char-array
                r       convert each character to a number
                 .H{    repeat x-1 times:
                    .n    in the top array, for each group of x contents, encase that in an array


text:
Gif - Jif, Jif - Gif
Stolen from @Downgoat with permission
The point of this challenge is to (not) settle the  debate on the pronunciation of "gif".
"

The pronunciation of gif is debated and while it's supposed to be (and should be) pronounced jif, it's still commonly disputed.
In this challenge you will be given a set of words that have a g or j, representing the sound that the word is pronounced with. You'll also get some text in which you have to fix the incorrect spellings of gif.
Because this is the internet and everyone always wrong. It's (not) common courtesy to correct them.
An example of a wrong pronunciation would be:
There was a gif of a mouse eating a burrito
The wrong spelling of gif? Unacceptable! This must be corrected immediately:
There was a jif (as in jar) of a mouse eating a burrito

Are we done? Nope, you're still wrong.
You're always wrong
This must work the other way:
In the jif the cat wore a hat of a cat
This obvious misspelling must be fixed, we shall correct this to:
In the gif (as in graphic) the cat wore a hat of a cat

Rules

Input is a string (the sentence) and an array of strings (or any reasonable alternative, such as a comma separated string) in any order
You may take the g and j words in any order. They may be taken separately.
Every instance of gif (any case) in the sentence must be replaced with jif (as in ___) where ___ is a uniformly random selected word beginning with j  from the array of strings, and vice versa for jif with words beginning with g.
ONLY the words gif and jif should be replaced (i.e "jiffy" should not be changed). Those words have done no wrong.
You are guaranteed that at least one word in the array begins with g and at least one begins with j.
Case must be preserved (e.g. GiF -> JiF).
You may write a program or a function
Standard loopholes apply
We need to (not) settle the debate quickly; shortest code in bytes wins

Examples
Input and output separated by a single line:
graphic, jar, jam, gram
I saw a jif of how to pronounce gif that showed gif is pronounced jif

I saw a gif (as in graphic) of how to pronounce jif (as in jar) that showed jif (as in jam) is pronounced gif (as in gram)

gravy, jeff
G is for gIf, h is for JiF, i is for gIF, j is for JIf

G is for jIf (as in jeff), h is for GiF (as in gravy), i is for jIF (as in jeff), j is for JIf (as in gravy)

joke, june, gorilla, great
Jiffy should not be treated as a GIF or JIF, like gifted.

Jiffy should not be treated as a JIF (as in june) or GIF (as in great), like gifted.

Must the J and G words be together in the array, or can two arrays (one with the J words and one with the G words) be used as input?

The pronunciation of gif is debated and while it's supposed to be (and should be) pronounced **gif,** it's still commonly disputed. FTFY ;)

@ngenisis and ValueInk: Yes

Giraffical Interchange Format :)

What about words like "jiffy"?

@Zaid: Since that is not gif or jif, it should not be replaced

(The G is silent.)

Perhaps add a test case regarding "jiffy", if it shouldn't be replaced?

It's obviously jif as in Johan. Like the sound furries make.

There is a typo in your second example, but I can't say where without making it sound complicated.

We all know that is is correctly pronounced zhaif.

Why is j if replaced by j is? Or if is a typo?

How to differentiate jif/gif from jiffy-like words? Can we assume they are always followed by a space or comma; or all jiffy-like words will have an adjacent letter?

Are we allowed to add a trailing space to the output?

What about the 6% of developers who pronounce it Gee-Eye-Eff?

Annoying animation!

I pronounce it adblock fodder

Tempted to downvote because it’s pronounced with a g and NOT A J

Mathematica, 164 165 bytes
This is an abomination, but I want someone to share my pain.
StringReplace[f[f@"g"="j"]="g";f[f@"G"="J"]="G";z=IgnoreCase->1>0;#,x:"g"|"j"~~y:"if ":>{f@x,y,"(as in ",RandomChoice@StringCases[#2,f@x~~Except[","]..,z]}<>") ",z]&

Function which expects the first argument # to be the sentence to be (in)corrected and the second argument #2 to a be comma separated string of words.
f[f@"g"="j"]="g";f[f@"G"="J"]="G" defines a function f which takes the letters g, G, j, and J to their appropriate replacements. This is ever so slightly shorter than f@"g"="j";f@"j"="g";f@"G"="J";f@"J"="G".
I also set z equal to IgnoreCase->True since I'll be using it twice.
x:"g"|"j"~~y:"if " is a StringExpression which matches "gif " or "jif ", naming the first letter x and the last three characters y. Since the option z (also known as IgnoreCase->True) is passed to StringReplace, these letters can be in any combination of upper and lower case.
I then replace every such match with
{f@x,y,"(as in ",RandomChoice@StringCases[#2,f@x~~Except[","]..,z]}<>") "

RandomChoice@StringCases[#2,f@x~~Except[","]..,z] randomly selects a word out of the second argument #2 which begins with f[x], again ignoring case because the option z is given.

Why would you use Mathematica for this? Wow.

IgnoreCase->True => IgnoreCase->1<2

@CalculatorFeline I actually already abbreviated True to 1>0, just not in my explanation :)

You use fully golfed code sinppets everywhere else. Why not there?

@CalculatorFeline I guess because in that case I wasn't quoting the code, I was describing what it did, which was to set the variable z equal to IgnoreCase->True. I did the same thing later: "which begins with f[x]" . ¯\_(ツ)_/¯

I think you need a space before the opening parenthesis of (as in to match the examples.

@MichaelBoger Thanks, I actually needed a space after the closing parenthesis.

Ruby, 88 87 91 bytes
-1 byte from ETHproductions. +4 bytes because words containing "gif" or "jif" shouldn't be replaced. -2 bytes because replacement word lists can be taken separately now.
->s,g,j{s.gsub(/\b(g|j)if\b/i){$&.tr("GgJj","JjGg")+" (as in #{($1[/g/i]?j:g).sample})"}}

Try it online!

Could you change ([gj]) to (g|j)? (idk much Ruby but I do know regex)

CJam, 78 bytes
l',%:A;lS%{_ela"gifjif"3/&{_V=_el:B'g=1W?Z*+V\t" (as in "A{V=elB=!},mR')}O?S}%

Try it online!
Requires the list of replacement characters to be separated by nothing but commas.

Explanation:
l',%                        e# read line of input and split at commas
    :A;                     e# store in var A and pop off the stack
       lS%{...}%            e# for each word in the next line of input so:

_ela"gifjif"3/&             e#   intersection of ["gif" "jif"] and [lowercase(word)]
               {...}O?      e#   if set it non-empty, run block below, otherwise do nothing (push empty string)
                      S     e#   push space

_V=                         e#     extract first char
   _el:B                    e#     duplicate to lowercase and store in var B
        'g=1W?Z*+           e#     convert g/G <=> j/J
                 V\t        e#     store back to word
" (as in "                  e#     push string
           A{V=elB=!},      e#     filter replacements by words starting with the same char (case insensitive)
                      mR    e#     select random element
                        ')  e#     push ')' char

Doesn't work on the example where gif/jif is followed by a comma.

Python 3, 237 bytes
lambda s,g,j:' '.join([(w if False in(w[0]in q,w[1:2]in['i','I'],w[2:3]in['f','F'],w[3:]in",;!?.")else q[w[0]]+w[1:3]+" (as in "+choice(g if w[0]in 'jJ'else j)+')'+w[3:])for w in s.split()])
from random import*
q=dict(zip("gGjJ","jJgG"))

Try it online!
This is the best I can do -- might be some way to do it quicker (probably with regexes) but my brain hurts now.
Explanation:
q is a simple dictionary mapping, I hope that's clear.
s,g,j are the input string, the list of g-words, and the list of j-words.
' '.join joins together the list comprehension done across for w in s.split() is therefore for the list of words in s.
The middle bit is black magic, which I'll break down piecewise.  First, the condition: False in(w[0]in q,w[1:2]in['i','I'],w[2:3]in['f','F'],w[3:]in",;!.").
w[0]in q checks the first character is in the keys of q which are 'g','G','j','J'.  The reason for separating out q as a variable is we also use it as a dict/map later.
w[1:2]in ['i','I'] checks that the second character is either i or I.  The :2 is necessary because just putting w[1] would result in a crash on 1-letter words, but slices don't do that for some reason (I thought they did, whatever!)
w[2:3]in ['f','F'] is analogous.  I briefly had this as just 2: before I realized I needed to account for gif, or jif, followed by punctuation!
w[3:]in",;!?." checks that the subsequent character(s) are punctuation.  I admit my code doesn't work if someone puts 'gif?!' but I can't be perfect.  Someone else can take up the challenge of opening quotes before gif or jif, too.
False in(,,,) is basically a big NAND.  It's actually the same bytecount as separating four items with and and swapping the arguments, but this looks cooler and works better if you have to extend it to a fifth anded thing.
w if means that if False is in the conditional-list, we just return the word unchanged -- it doesn't meet our criteria.  else, we change it to:
q[w[0]]+w[1:3]+" (as in "+choice(g if w[0]in 'jJ'else j)+')'+w[3:]
OK.  q[w[0]] substitutes the first letter correctly.  w[1:3] tacks on the i or I and f or F, w[3:] tacks on any trailing punctuation.  That leaves the as in clause.
" (as in "+choice(g if w[0]in 'jJ'else j)+')' puts in the obvious string literal at the start and the trailing parenthesis, the interesting bit here is choice(g if w[0]in 'jJ'else j) which randomly chooses from g or j, depending on if w[0] is in 'jJ'. and I just realized I had this bit backwards so fixing that throughout, done.
It's been a long day.  choice is in the random module hence the import.  I think that's everything.

JavaScript (ES6), 142 bytes
(s,g,j,r=l=>l[Math.random()*l.length|0])=>s.replace(/\b[gj]if\b/gi,w=>`GJgj`[l=`JGjg`.search(w[0])]+w.slice(1)+` (as in ${r([g,j,g,j][l])})`)

Takes separate g and j word lists.

Javascript(ES6), 151 bytes
f=(s,g,j)=>s.replace(/\b(g|j)(if)\b/ig,(m,p,c)=>`${a=g,p=="j"?"g":p=="J"?"G":(a=j,p=="g"?"j":"J")}${c}(as in ${a[Math.floor(Math.random()*a.length)]})`)

I probably can golf down the ternary part more, but I can't think of how right now. Also, it takes the g and j words separately.

source: Stack Exchange

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

sort: votes


text:
Am I an Automorphic Number?
An Automorphic number is a number which is a suffix of its square in base 10.  This is sequence A003226 in the OEIS.
Your Task:
Write a program or function to determine whether an input is an Automorphic number.
Input:
An integer between 0 and 10^12 (inclusive), that may or may not be an Automorphic number.
Output:
A truthy/falsy value indicating whether or not the input is an Automorphic number.
Examples:
0           -> truthy
1           -> truthy
2           -> falsy
9376        -> truthy
8212890625  -> truthy

Scoring:
This is code-golf, lowest score in bytes wins.

Btw the limit of 1e12 means submissions will need to handle numbers up to 1e24, which is an 80-bit number. If handling numbers that large is a hard requirement, many of the exiting answers are invalid.

Need we handle numbers that would lead to precision issues in our chosen language?

Provided that you don't abuse the standard loophole about that, then that would be fine.

Specifically, this loophole

It's been a loooong day and I am very, very tired but your comments read to me as validating my JS solution. Could you confirm that? (No issue deleting if not)

Consider that confirmed.  10^9 (which is what I'm pretty sure your program stops working after) is good enough.  I just don't want things that only work on numbers up to, say 1,000.

Brachylog, 5 bytes
~√a₁?

Try it online!
How it works
~√a₁?
~√      the input is the square root of a number
  a₁    whose suffix is
    ?   the input

No, it says if x is a suffix of its square.

√a₁? Why not?

Python 2, 24 bytes
lambda n:`n*1L`in`n**2L`

Try it online!
For the first time in history, Python 2's appending an L to the repr of longs is a feature rather than a bug.
The idea is to check if say, 76^2=5776 ends in 76 by checking if 76L is a substring of 5776L. To make the L appear for non-huge numbers, we multiply by 1L or have 2L as the exponent, since an arithmetic operation with a long with produces a long.

Python 2, 31 bytes
Out-golfed by xnor... (this happens every single time) >< But hey, it's surprisingly Pythonic for code-golf.
People don't tend to remember Python has str.endswith()...
lambda n:str(n*n).endswith(`n`)

Try it online!

Can't you use \n*n`` to convert number into string?

@Downgoat That tacks an 'L' on to longer numbers.

@totallyhuman Good point, I missed its use.

05AB1E, 5 bytes
n.s¹å

Try it online!

I'd upvote If I knew how it worked.

I suppose, n is square, .s is suffixes, ¹ is the input, and å tests for membership @isaacg

@isaacg What Conor said...didn't have time to add explanation.

Retina, 44 bytes
$
;918212890625;81787109376;0;1;
^(\d+;).*\1

Try it online!
There are exactly 4 solutions to the 10-adic equation x*x = x.

Uh? Aren't all these numbers valid solutions?

@Leo No, they aren't. Obviously 5*5 != 5. However, you can notice some pattern in the numbers you linked to. The 4 solutions are: 0, 1, ...59918212890625, ...40081787109376 (p-adic numbers go infinitely to the left). The numbers you linked to are suffixes of the 4 numbers.

Oh ok, thank you, I didn't know about p-adic numbers

Python 2, 37 33 30 29 bytes
lambda n:n*~-n%10**len(`n`)<1

Saved 4 bytes thanks to @LeakyNun.
Saved 3 bytes by noticing that the input is lower than 10^12 so n doesn't end with an "L".
Saved 1 byte thanks to @Dennis because I miscounted in the first place.
Try it online! (TIO link courtesy of @Dennis).

Alice, 17 bytes
/o.z/#Q/
@in.*.L\

Try it online!
Outputs nothing (which is falsy in Ordinal mode) or Jabberwocky (which is non-empty and therefore truthy in Ordinal mode; it's also the canonical truthy string value).
Explanation
/.../#./
....*..\

This is a slight modification of the general framework for linear Ordinal mode programs. The / in the middle is used to have a single operator in Cardinal mode in between (the *) and then we need the # to skip it in Ordinal mode on the way back. The linear program is then:
i..*.QLzno@

Let's go through that:
i    Read all input as a string and push it to the stack.
..   Make two copies.
*    This is run in Cardinal mode, so it implicitly converts the top two
     copies to their integer value and multiplies them to compute the square.
.    Implicitly convert the square back to a string and make a copy of it.
Q    Reverse the stack to bring the input on top of the two copies of its square.
L    Shortest common supersequence. This pops the input and the square from
     the top of the stack and pushes the shortest string which begins with
     the square and ends with the input. Iff the square already ends with the
     input, this gives us the square, otherwise it gives us some longer string.
z    Drop. Pop the SCS and the square. If the square contains the SCS (which
     would mean they're equal), this removes everything up to the SCS from
     the square. In other words, if the SCS computation left the square
     unchanged, this gives us an empty string. Otherwise, it gives us back
     the square.
n    Logical not. Turns the empty string into "Jabberwocky" and everything
     else into an empty string.
o    Print the result.
@    Terminate the program.

Mathematica, 31 bytes
Mod[#^2,10^IntegerLength@#]==#&

Try it online! Mathics prints an extra message but the answer is correct

Ruby, 22 bytes
->n{"#{n*n}"=~/#{n}$/}

Try it online!

C# (.NET Core), 47 bytes
n=>$"{BigInteger.Multiply(n,n)}".EndsWith(n+"")

Try it online!

Isn't is possible to change $"{n}" to n+""? Also, could you perhaps add a TryItOnline-link? Oh, and this is a snippet, not a function/program. So you should add n=> in front of it.

@KevinCruijssen Done! Is it possible to simplify even further? TIL you can convert an int to string using n+"". Thanks!

You don't need the bool f(long n) or trailing semi-colon for lambda answers in C#, Java, etc. Just n=>$"{BigInteger.Multiply(n,n)}".EndsWith(n+"") is enough. :) And I almost forgot: Welcome to PPCG!

@KevinCruijssen Thank you!

You're welcome! :) Oh, and here is your TIO-link converter to use just n=>, by using a System.Func.

@KevinCruijssen Edited. Thank you!

R, 28 bytes
pryr::f(x^2%%10^nchar(x)==x)

Creates a function:
function (x)
x^2%%10^nchar(x) == x

Takes the modulus of x^2 such that we keep the last digits, which we compare to x.

C (gcc), 57 bytes
f(__int128 n){n=n*n%(long)pow(10,printf("%u",n))==n;}

Based on @betseg's answer, this is a function that returns 1 or 0. It produces garbage output to STDOUT, which is allowed by default.
The score contains +4 bytes for the compiler flag -lm.
Try it online!

Charcoal, 12 11 bytes
Ｉ¬⌕⮌ＩＸＩθ²⮌θ

Try it online!
Returns False as falsey and True as truthy.

1 byte saved thanks to ASCII-only! (How could I miss the Power function?)

This returns 0 for 10, 100, ... 1 for 50, 60... 2 for 760, 3792...

@Neil fixed now, thanks!

I thought Charcoal was only good for ASCII art. ಠ_ಠ

11 bytes

@totallyhuman It still is, look at all the normal golflangs with <6 byte solutions

JavaScript (ES6), 23 bytes
n=>`${n*n}`.endsWith(n)

Try it
Wrote this Snippet up on my phone, so please edit if it's not working correctly.

f=
n=>`${n*n}`.endsWith(n)
oninput=_=>o.innerText=f(+i.value);o.innerText=f(i.value=1)
<input id=i type=number><pre id=o>

This fails for 212890625 due to precision issues.

Thanks for pointing that out, @Dennis; this was a quicky while on a smoke break so I (stupidly) only checked the test cases. Will ask for clarification on precision errors and delete when I get back to a computer, if necessary.

Jelly, 6 bytes
²ṚwṚ⁼1

Try it online!

Nice job outgolfing me.

@LeakyNun And I would've even tied Brachylog if I could've used Ị...

Kotlin, 36 bytes
fun a(i:Int)="${i*i}".endsWith("$i")

C, 77 + 4 (-lm) = 81 bytes
#import<tgmath.h>
i;f(long double n){i=fmod(n*n,pow(10,(int)log10(n)+1))==n;}

Try it online!

Can use n*n for pow(n,2) and save 5 bytes.

Perl 5, 15 + 1 (-p) = 16 bytes
$_=$_**2=~/$_$/

Try it online!

Rexx (Regina), 48 bytes
numeric digits 25
arg n
say right(n*n,length(n))=n

Try it online!

Jelly, 7 bytes
²_ọæċ⁵$

Try it online!
Positive number for yes, 0 for no.

PHP, 41 bytes
<?=preg_match("#$argn$#",bcpow($argn,2));

PHP Sandbox Online
PHP, 42 bytes
without Regex
<?=strtr(bcpow($argn,2),[$argn=>X])[-1]>A;

PHP, 44 bytes
Use the levenshtein distance
<?=!levenshtein($argn,bcpow($argn,2),0,1,1);

Retina, 47 33 bytes
14 bytes thanks to Martin Ender.
.+
$*
$
¶$`
\G1
$%_
M%`1
(.+)¶\1$

Try it online!

I need to learn $%...

Dyvil, 26 bytes
x=>"\(x*x)".endsWith"\(x)"

Usage:
let f: int->boolean = x=>"\(x*x)".endsWith"\(x)"
print(f 20) // false

Batch, 122 bytes
@set/an=%1,t=f=1
:l
@set/at+=t,f*=5,n/=10
@if %n% gtr 0 goto l
@cmd/cset/a"(!(%1%%t)|!(~-%1%%t))&(!(%1%%f)|!(~-%1%%f))

Algorithm is limited only by the integer type used for variables. In the case of Batch, this is 32-bit signed integers, so the maximum is 2147483647. Works by testing both n and n-1 for necessary powers of 2 and 5 as factors. (Except when n is 0 or 1, n and n-1 will have one factor each.)

Pyth, 10 9 bytes
-1 byte thanks to isaacg.
x_`^vz2_z

Returns 0 when the number is automorphic, anything else if it is not.
Test it online!
Explanations
x_`^vz2_z

   ^vz2      # Evaluate the input to a number, compute the square
  `          # Convert the squared number to a string
 _           # Reverse it
x      _z    # Find the index of the first occurrence of the reversed input in the reversed square. That's basically equivalent of doing an endswith() in Python
             # Implicit input of the index. If 0, then the reversed square starts with the reversed input

``` is convert to string.

><>, 30 bytes
1&0}\{n;
:&(?\:::*&a*:&%={+}:&

Try it online, or watch it at the fish playground!
Assumes the input number x is already on the stack.
Explanation: The fish takes the quotient of x2 by increasing powers of 10, and counts how many times this equals x. When the power of 10 gets larger than x, it prints the count and halts. The count will be 1 if x is automorphic, and 0 if it isn't.

Pari/GP, 23 bytes
n->n^2%10^#digits(n)==n

Try it online!

Haskell, 45 bytes
f=reverse.show
g a=and$zipWith(==)(f a)$f$a^2

Try it online!
Haskell + Data.Function, 42 bytes
g a=and$on(zipWith(==))(reverse.show)a$a^2

Try it online!
and.(on(zipWith(==))(reverse.show)<*>(^2))

Try it online!
Haskell + Data.Function + Control.Monad, 40 bytes
and.ap(on(zipWith(==))$reverse.show)(^2)

Try it online!

PowerShell Core, 36 34 bytes
param([bigint]$a)""+$a*$a|% En* $a

Try it online!
Could be 8 bytes shorted if passing a bigint as parameter was allowed
-2 bytes thanks to Zaelin Goodman!

suffix n with PS7 only

34 bytes!

Vyxal r, 3 bytes
²øf

Try it Online!
First time using the r flag.

Java 8, 36 bytes
n->(n.multiply(n)+"").endsWith(n+"")

Input is a java.math.BigInteger, output a boolean.
Explanation:
Try it here.
n->                   // Method with BigInteger parameter and boolean return-type
  (n.multiply(n)+"")  //  Return if the String representation of n*n
   .endsWith(n+"")    //  ends with the String representation of n
                      // End of method (implicit / single-line body)

Python 3, 40 35 bytes
-@Nick A saved 5 bytes: use of endswith()
lambda x:str(x*x).endswith(str(x))

Try it online!
Python 2, 31 bytes (Does not work for large numbers)
lambda x:`x*x`[-len(`x`):]==`x`

Try it online!

Doesn't work on 8212890625  because x*x will end with "L". You can however save two bytes by removing the f= I think.

It would work in python 3 though, right?

You must use f=\ not f=/...

@officialaimm no, the `` syntax doesn't work in Python 3.

I meant after replacing `` with str()

Yes that will work then.

Would using endswith and removing s=str not be shorter for python3?: lambda x:str(x*x).endswith(str(x))

Perl 6, 15 bytes
{$^x²~~/$^x$/}

Try it online!
Returns a truthy Match object for automorphic inputs, and a falsy Nil value for other numbers.

Clojure, 59 bytes
#(apply = true(map =(reverse(str %))(reverse(str(* % %)))))

This seems overly verbose.

Why not just go with #(.endsWith(str(* % %))(str %)) ?

Oh true, it is so easy to forget about Java built-ins.

MATL, 10 bytes
UUVG36hXXn

This works for numbers up to floor(sqrt(2^53)), as per double precision limitations.
Output is a positive number (which is truthy) if automorphic, or empty (which is falsy) if not.
Try it online!
Explanation
Funny that this answer uses the two overloaded versions of U: with string input it evaluates as a number, and with number input it computes the square.
U      % Implicitly input a string. Evaluate as a number
U      % Square of number
V      % Convert number to string representation
G      % Push input string again
36h    % Post-pend '$'
XX     % Regexp match. Gives cell array of matching substrings.
n      % Number of elements. Implicitly display

Factor, 37 bytes
[ [ sq ] keep [ present ] bi@ tail? ]

Try it online!

[ sq ] keep Square the input, but also retain a copy of the input on top of the stack. (Identical length to dup sq swap.)
[ present ] bi@ Convert both numbers to strings.
tail? Is top-of-stack a suffix of next-on-stack?

Husk, 7 bytes
§€d(ṫd□

Try it online!
§        # fork:
 €       # index of arg1 in arg2, or zero if absent:
  d      # arg1: digits of input
   (     # arg2:
    ṫ    # tails = all suffixes of
     d   # digits of
      □  # square of input
```

ARM Thumb machine code, 20 bytes
01 22 0a 23 5a 43 81 1a fc d2 40 43 80 1a fd d2
08 1a 70 47

Since ARM uses 32-bit arithmetic, this can only handle up to \$2^{16}-1\$. This is OK according to the OP's comment, and the calculations would still be correct with larger integers (which is confirmed with equivalent AArch64 code)...although it would be pretty slow due to the subtraction loop.
    .syntax unified
    .arch armv7-a
    .thumb
    .globl  automorphic
    .thumb_func
    // input: r0, output: r0 (zero for true)
    // C calling convention
automorphic:
    // Calculate power of 10 larger than the digits
    // by repeatedly multiplying by 10.
    movs    r2, #1                                         @ pow10 = 1;
    movs    r3, #10                                        @ TEN = 10;
.Llog10:                                                   @ do {
    // Multiply by 10.
    muls    r2, r3                                         @     pow10 *= TEN;
    // Multiple purpose:
    //   - The SUBS sets the flags as if we were doing
    //        do { pow10 *= TEN; } while (x >= pow10);
    //   - This saves x to another register so we can square
    //     with narrow MULS which overwrites the source.
    //   - This pre-subtracts pow10 to compensate for the
    //     below modulo loop which runs an extra iteration.
    subs    r1, r0, r2                                     @    tmp = x - pow10;
    bhs     .Llog10                                        @ } while (x >= pow10);
.Llog10_end:
    // Square x.
    muls    r0, r0                                         @ x2 = x * x;
    // Naive modulo loop by repeated subtraction, which is
    // always shorter than udiv+mul+sub. As stated before,
    // this actually calculates x2 % pow10 - pow10.        @ mod = x2;
.Lmodulo:                                                  @ do {
    subs    r0, r2                                         @     x2 = mod; mod = x2 - pow10;
    bhs     .Lmodulo                                       @ } while (x2 >= pow10);
    // Subtract to get a 3-way comparison, with 0 being true
    subs    r0, r1, r0                                     @ result = tmp - mod;
    // Return
    bx      lr                                             @ return result;

This function uses the AAPCS calling convention, and can be called from C.
It returns zero for true and non-zero for false.
int32_t automorphic(uint32_t x);

Prolog (SWI), 83 bytes
\N:-S is N*N,N+D,S+P,prefix(D,P).
N+[H|D]:-N>9,H is N mod 10,R is N//10,R+D.
N+[N].

Try it online!
For whatever reason the last test case (8212890625) doesn't work on TIO, but it does work everywhere else I've tried.

Thunno 2, 4 bytes
²$ø>

Try it online!
Explanation
²$ø>  # Implicit input
²     # The input squared...
  ø>  # ...ends with...
 $    # ...the input?
      # Implicit output

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:
How many cardboard digits do I need?
I need to prepare digits made of cardboard to display some number (example). I don't know beforehand which number I should display - the only thing I know is that it's not greater than n.
How many cardboard digits should I prepare?
Example: n = 50
To display any number in the range 0...50, I need the following digits:

A zero, for displaying the number 0, or any other round number
Two copies of digits 1, 2, 3 and 4, for displaying the corresponding numbers
One copy of digits 5, 6, 7 and 8, for the case they appear as least significant digit in the number
The digit 9 is never needed, because I can use the inverted digit 6 instead

Total: 13 digits
Test cases (each line is a test case in the format "input; output")

0 1
1 2
9 9
11 10
50 13
99 17
100 18
135 19
531 22
1000 27
8192 34
32767 38

Can any other digit be rotated besides 6/9?

No (see example)

So two 1's can't be overlaid to make a 7 then

... and two zeros cannot make a 8. That would be ugly.

Probably an awkward question, but as these are 'cardboard' digits, can they be double-sided printed to save on the total required? In the example, you would never need 6 and 0 together, for instance.

@Weckar He probably wants to cut them out of cardboard, not print them.

Jelly, 9 bytes
‘ḶDœ|/ḟ9L

Try it online!
How it works
‘ḶDœ|/ḟ9L
‘Ḷ         [0,1,...,n]
  D        convert each to list of its digits
   œ|/     fold by multiset union
      ḟ9   remove 9
        L  length

Too fast >.< I swear, you have a Jelly answer for every known challenge in the universe and you just have a bot to post them right after the challenge. :P Nice answer.

@HyperNeutrino I think the bot extracts testcases from the challenge and tries every possible jelly program using a supercomputer.

@HyperNeutrino You know the feeling...especially if your solution is 0rDŒr€ẎQṪÞẎḟ9ĠẎL.

I doubted the validity of ḟ9 part for a moment, then I realised 6 < 9 so number of 6s can't be less than the total possible number of 6s and 9s combined in each combination.

Python 2, 49 bytes
lambda n:9*len(`n`)-9+(n*9+8)/10**len(`n`)+(n<10)

Try it online!
A clumsy arithmetical formula. Assume that n fits within an int so that an L isn't appended.
Thanks to Neil for saving 5 bytes by pointing out that 9's being unused could be handled by doing n*9+8 instead of n*9+9, so that, say, 999*9+8=8999 doesn't roll over to 9000.

@ovs That doesn't quite work, it's not enough to know the first digit. For example 33333 requires five 3's but 22222 requires only four. n*9[0]
is tempting, but fails for numbers starting with 1 and less that 111...

By my calculations (see my Batch answer) you can probably use (n*9+8)/10**len(`n`) to avoid using min.

Haskell, 117 114 108 95 89 88 87 84 82 63 bytes
6 bytes saved thanks to Laikoni
1 4 6 bytes saved thanks to nimi
g x=sum[maximum[sum[1|u<-show y,d==u]|y<-[0..x]]|d<-['0'..'8']]

Try it online!

1.) maximum[a,b] is the same as max a b. 2.) List comprehensions are often shorter than filter: max d$sum[1|x<-show a,x==b]

You can replace g with a pointfree function literal: sum.(#[-9..]).

@nimi I don't know what a pointfree function literal is, but I think I see what you are suggesting.  Tell me if I'm wrong.

... and length[x|x<-...] is sum[1|x<-...].

Functions can be unnamed, so no need for the g= (but maybe you want to include it in the TIO version).

Mathematica, 49 bytes
Tr@Delete[Max~MapThread~DigitCount@Range[0,#],9]&

nice! Is this based on my answer?

Batch, 67 bytes
@if %1 geq 10%2 %0 %1 0%2 -~%3
@cmd/cset/a(%1*9+8)/10%2+9*%30+!%30

In the standard formulation of this problem, you need separate 6 and 9 digits, but you're not required to display 0. As the maximum value n required increases, the number of required numerals increases every time you reach a repdigit (because you don't quite have enough of that numeral) and every time you reach a power of 10 (when you need an extra zero). In total each power of 10 needs 10 more numerals than the previous one, which can be caluclated as floor(log10(n))*10. For values of n between powers of 10, the number of intermediate repdigits can then be calculated as floor(n/((10**floor(log10(n))*10-1)/9)) or alternatively floor(n*9/(10**floor(log10(n))*10-1)).
I calculate floor(log10(n)) by means of the loop on the first line. Each time, %2 gains an extra 0 and %3 gains an extra -~. This means that 10%2 is 10*10**floor(log10(n)) and %30 is floor(log10(n)).
The duplication of 6 and 9 has two effects: firstly, there are only 9 numerals required for each power of 10, and secondly the repdigit detection needs to ignore the 9 repdigits. Fortunately as they are one less than a power of 10 this can be achieved by tweaking the formula to result in floor((n*9+8)/(10**floor(log10(n))*10)).
Dealing with the zero is reasonably simple: this just requires an extra numeral when n<10, i.e. floor(log10(n))==0.

JavaScript (ES6), 60 53 bytes
f=(n,i=9)=>n>(i%9+1+"e"+(i/9|0))/9-1?1+f(n,-~i):n>9^1

A sort of hacky recursive solution. This generates the numbers which require adding a digit:
1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 22, 33, 44, 55, 66, 77, 88, 100, 111, 222, ...

and then counts how many are less than the input. By a happy miracle, removing the digit 9 actually removes several bytes from the function, because the sequence can then be generated like so (assuming integer division):
1e1 / 9 = 1, 2e1 / 9 = 2, ..., 8e1 / 9 = 8, 9e1 / 9 = 10, 1e2 / 9 = 11, 2e2 / 9 = 22, ...

We do have to take into account the fact that numbers under 10 still require the zero, but this is as simple as adding n > 9 ? 0 : 1 to the result.
Test cases

let f=(n,i=9)=>n>(i%9+1+"e"+(i/9|0))/9-1?1+f(n,i+1):n>9^1;

[0, 1, 9, 11, 50, 99, 100, 135, 531, 1000, 8192, 32767].map(n => console.log(f(n)));

n>9^1 can probably be n<10

@CalculatorFeline Well, that gives true for input 0, so I'm a little hesitant to do that.

0>9 is false, false^1 is 1...?

@CalculatorFeline Yes, I'm saying I'm hesitant to output the boolean true in place of the number 1.

Mathematica, 83 bytes
v=DigitCount;s=v@0;(Table[s[[i]]=v[j][[i]]~Max~s[[i]],{i,10},{j,#}];s[[9]]=0;Tr@s)&

Python 3, 75 bytes
lambda n:sum(max(str(j).count(str(i))for j in range(n+1))for i in range(9))

Try it online!

PHP, 60 bytes
<?=count(preg_grep('#^100+$|^([0-8])\1*$#',range(0,$argn)));

Try it online!


text:
Does it match the digit pattern?
Recently I had a Maths test and noticed that a certain number on the test matched an interesting pattern. The number (28384) matched a generic digit sequence that looks like this
(n)(x)(n+1)(x)(n+2)(x)(n+3) etc...

where n and x are single digit integers. The sequence can begin with either x or n and end with either x or n+y.
Your task is, given a multi digit positive integer, output a truthy or falsey value, depending on whether the input matches the pattern. The input will be between 4 and 18 digits long. You may take input as a string representation of the integer. The input will not begin with a 0 but can contain or end with 0s.
n+y will always be a single digit number (hence why the length limit is 18).
Test Cases
These should output a truthy value
182838485868788898
4344
85868
12223242526

And these should be falsey
12345
6724013635
36842478324836
1222232425
5859510511

As with all code golfs, shortest code wins! Good luck and may the odds, be ever in your favour!

Can we take input as a string?

@KritixiLithos "You may take input as a string representation of the integer."

Are both x and n non-zero for numbers that fit the rule?

@Mr.Xcoder the number cannot begin with a 0 but can contain or end with 0s

Python 2, 84 81 80 79 bytes
-1 byte thanks to ovs
lambda x:g(x,1)|g(x,0)
g=lambda x,a:len(set(x[a::2]))==(x[a<1::2]in"123456789")

Try it online!

Python 3, 82 79 78 77 bytes
lambda x:g(x,1)|g(x,0)
g=lambda x,a:len({*x[a::2]})==(x[a<1::2]in"123456789")

Try it online!
Slightly shorter in Python 3, but I didn't think it deserved its own answer.

Explanation
We set up a function g that takes string and an index (either 1 or 0).  g then returns whether or not len(set(x[a::2])), that is the number of unique digits in every other position, is equal to (x[a==0::2]in"123456789"), whether or not the other digits are in ascending order.  If the digits are in ascending order this returns whether or not they are all the same, if not it will ask if the set is empty, which it cannot be, thus always returning false.

As usual, I have been outgolfed >.<

x[a<1::2]in"123456789" can be "0"<x[a<1::2]<":" (comparing chars compares charcodes)

@CalculatorFeline I do not think that is true.  That just checks that the string begins with a number.

Oh right, however that works for single characters.

But do you actually need a<1? Seems like that can be just a.

@CalculatorFeline a<1 returns 0 if a = 1 and 1 if a = 0. Otherwise the only numbers that would pass would be 1-9.

Oh. If you used a in the second slice, you'd have to use a<1 in the first :( However, you can also use a^1 or 1-a for no bytesaves.

Jelly, 13 11 bytes
Ds2ZI’M¦Ẏ¬Ạ

Try it online!
Explanation:
Ds2ZI’M¦Ẏ¬Ạ Accepts an integer
D           Get individual digits
  2         2
 s          Split into chunks of specific length
   Z        Zip
    I       Take deltas
     ’      Decrement
      M     Take maximal indices
       ¦    Apply at specific indices
        Ẏ   Reduce dimensionality
         ¬  Vectorized NOT
          Ạ Check if all are truthy

05AB1E, 15 bytes
TG9LNýN.øŒ})˜Iå

Try it online!
Explanation
TG9LNýN.øŒ})˜Iå
TG        }     # For 1 to 9...
  9L             # Push [1 .. 9]
    Ný           # Join with current value
      N.ø        # surround with current value
         Œ       # Push substrings
           )    # Wrap stack to array
            ˜   # Deep flatten the array
             I  # Push input
              å # Is the input in the array?
                # Implicit print

It should work (test cases did) but if you find any flaws please let me know.
14 Bytes if no output counts as falsy:
TG9LNýN.øŒIåi1

D, 117 bytes
int f(string n){int o=n[0]!=n[2],x=n[o];foreach(i,c;n){if(i%2!=o&&i>1&&c!=n[i-2]+1||i%2==o&&c!=x)return 0;}return 1;}

Definitely suboptimal, but it works fine
Try It Online!

Haskell, 108 113 97 95 bytes
d(x:_:r)=x:d r
d r=r
c(x:n:r)=and$all(==x)(d r):zipWith(==)(d$n:r)[n..]
f s@(_:n:_)=c s||c(n:s)

Sample call: f "182838485868788898" yields True
Ungolfed version with explanations:
-- Take every other element from the string, starting with the first
d (x:_:r) = x : d r
d r       = r
c (x:n:r) = and $ all (== x) (d r)              -- Every other char is equal to the first
                : zipWith (==) (d $ n:r) [n..]  -- The remaining chars are a prefix of n(n+1)(n+2)...
f s@(_:n:_) = c s      -- The case where s already starts with x
           || c (n:s)  -- If not, prepend a dummy x and try again

Welcome to PPCG and Haskell golfing in particular! isPrefixOf is not in Prelude, so you have to include import Data.List in your code or use an alternative, e.g. and(zipWith(==)(n:r)[n..]).

@Laikoni: Thanks for the hint! I replaced the function accordingly.

I think x/=y can just be 1>0 because if not x/=y then x==y and the first case catches it.

You also don't need the where, defining c and d as auxiliary functions outside of f is fine. f can then be shortened to f s@(_:n:_)=c s||c(n:s).

Applied. I really appreciate your comments as I'm still a bit uncertain what counts as legal and what as cheating.

Then you might be interested in the guide to golfing rules in Haskell. Even though it's not a rule, you could use newlines instead of ;. It's the same byte count but improves the readability of the code.

c can be slightly shortened to c(x:n:r)=and$all(==x)(d r):zipWith(==)(d$n:r)[n..].

PHP, 68 bytes
for(;$v<10;)$s.=strstr(+$v.join(+$v,range(1,9)).+$v++,$argn);echo$s;

Try it online!
Output part of search string starting from and including the first occurrence of input to the end of search string as truthy value and nothing for falsy
for 2 Bytes more you can replace echo$s; with !!echo$s; to get 1 as truthy value
Find the occurrence of the input in one of the following strings in the array
Array
(
    [0] => 0102030405060708090
    [1] => 1112131415161718191
    [2] => 2122232425262728292
    [3] => 3132333435363738393
    [4] => 4142434445464748494
    [5] => 5152535455565758595
    [6] => 6162636465666768696
    [7] => 7172737475767778797
    [8] => 8182838485868788898
    [9] => 9192939495969798999
)

JavaScript (ES6), 54 bytes

f=
s=>[...s].every((e,i)=>i<2|e-s[i-2]==(s[2]!=s[0]^i%2))
<input oninput=o.textContent=this.value[3]?f(this.value):``><pre id=o>

Takes input as a string.

@CzylabsonAsa Thanks for pointing it out, it seems as if a ) got put in the wrong place for some reason.

MATL, 15 bytes
2L&),duw]hSFTX=

Try it online!
With some help of @LuisMendo in chat. Note that, if empty output + error is also considered 'falsy', the X can be left out, bringing the score to 14 bytes.
2L&)     % Split the input into odd and even-indexed elements
    ,   ] % Do twice (new feature since MATL v20.0), i.e., on both halves of the input
     d     % Pairwise differences of the array. Results in [0,0,...] for the 'constant' part,
            %  and [1,1,...] for the 'increasing' part.
      u      % Get unique elements. Results in [0] for the constant part, [1] for the increasing part.
       w      % Swap the stack to do the same for the other half of the input.
         hS    % Horizontal concatenation followed by sort. Results in [0,1] for the desired string.
           FTX= % Check if the result is indeed [0,1]. Implicit display.

JavaScript (ES6), 66 63 60 bytes
Takes input as a string.
s=>[...s].every((d,i)=>d-s[j^(k=i+j&1)]==k*i>>1,j=s[2]-s[0])

Test cases

let f =

s=>[...s].every((d,i)=>d-s[j^(k=i+j&1)]==k*i>>1,j=s[2]-s[0])

console.log('[Truthy]');
console.log(f("182838485868788898"))
console.log(f("4344"))
console.log(f("85868"))
console.log(f("12223242526"))

console.log('[Falsy]');
console.log(f("12345"))
console.log(f("6724013635"))
console.log(f("36842478324836"))
console.log(f("1222232425"))

Python 3, 99 96 89 bytes

Saved 3 bytes: use of all() function
@WheatWizard saved 7 bytes:shorthanding & | and replace extra variable by k<1

lambda x,g=lambda x,k:(x[k<1::2]in'123456789')&all(j==x[k]for j in x[k::2]):g(x,0)|g(x,1)

Try it online!
Explanation:
First split the string into two lists: one with odd-indexed and other with even-indexed elements. The two lists A and B are supposed be such that either:

A contains same number and B contains consecutive numbers in ascending order.

OR just the opposite

B contains same number and A contains consecutive numbers in ascending order.

The consecutive condition is checked by: a in '123456789'
The same-number condition is checked by: all(i=a[x] for i in a)

you can replace instances of i with k<1 and drop the i argument all together.

You can also surround the first predicate in parens and use & instead of and.  Your or can be replaced with | as well.

I see this eventually converging towards your answer.. :D

C (gcc), 123 bytes
#define X*s&&*s++-++n&&(r=0)
t,n,x,r;f(char*s){t=*s==s[2];for(r=1,n=s[t],x=s[!t],s+=2;*s;)t||X,*s&&*s++-x&&(r=0),t&&X;n=r;}

Try it online!

Julia, 57 56 bytes
~s=(!x=occursin(s,join(x*k for k='0':'9')x);!s[1]|!s[2])

replace || by | by @MarcMush

Attempt This Online!

input: the number as decimal string

you can use | instead of ||

Retina, 47 bytes
.
$*11;
(1+)(?<=\1;1+;\1)

^1+;1+

^;?(;1;)+;?$

Try it online!
Outputs 1 if it matches the pattern, 0 if it does not
Explanation
.
$*11;

Convert each digit n to n+1 in unary, separated by semicolons
(1+)(?<=\1;1+;\1)

(Trailing newline) converts each digit to the difference between itself and the one 2 spots before it
^1+;1+

(Trailing newline)  removes the first 2 digits
^;?(;1;)+;?$

Counts the number of matches of this pattern, which checks for alternating 0s and 1s

Pyth, 20 bytes
ASm.+sMd.Tcz2&-GZ-H1

Output [] when the number matches the digit pattern, anything else otherwise.
Try it online!
Explanations (example with input 85868)
ASm.+sMd.Tcz2&-GZ-H1

          cz2           # Chop the input in pairs: ['85', '86', '8']
        .T              # Transpose, ignore absences: ['888', '56']
     sM                 # Convert to integers: [[8, 8, 8], [5, 6]]
  m.+  d                # Compute deltas: [[0, 0], [1]]
 S                      # Sort: [[0, 0], [1]]
A                       # Assign first list to G and second list to H
              -GZ       # Filter 0 on G (on absence): [0, 0] -> []
                 -H1    # Filter 1 on H (on absence): [1] -> []
             &          # Check both lists are empty (logical and): [] & [] -> []

Pyth, 17 bytes
qU2Ssm{.+d.TcjQT2

Try it here
Same algorithm as my Jelly answer.
Explanation:
qU2Ssm{.+d.TcjQT2 Accepts an integer
             jQT  Take digits of input
            c   2 Split in pairs
          .T      Transpose
     m            Map the following on each of the two resulting lists:
       .+d          Take deltas
      {             Deduplicate
    s             The list is now in [[a, b, ...], [A, B, ...]] format, convert it to [a, b, ..., A, B, ...]
   S              Sort
qU2               Check if equal to [0, 1]

Java (OpenJDK 8), 128 119 118 108 107 104 bytes
s->{int i=3,a=s[2]-s[0],b=s[3]-s[1];for(;++i<s.length;)a+=b-(b=s[i]-s[i-2]==a?a:2);return(a|b)==1&a!=b;}

Try it online!
Explanation:
s->{                             // lambda
  int i=3,                       //  iterating index
      a=s[2]-s[0],               //  diff of even-indexed characters
      b=s[3]-s[1];               //  diff of odd-indexed characters
  for(;++i<s.length;)            //  iterate
    a+=b-(b=                     //   swap a and b
        s[i]-s[i-2]==a?a:2       //    or set b to 2 if the diffs don't match
      ));                        //
  return (a|b)==1                //  return true if both a and b are in (0,1)
        &a!=b;                   //         but different
}

Python 3, 167 161 157 131 106 bytes
-55 bytes thanks to @WheatWizard's suggestions
def g(t):k,c,f,j=t[::2],t[1::2],'123456789',''.join;return(len({*k})and j(c)in f)or(len({*c})and j(k)in f)

Try it online!

Can be golfed further. I already edit.

You might have seen this trick in my answer but set(c) is the same as {*c}. (at least in python 3)

@WheatWizard thanks. Editing

[t[z]for z in range(0,len(t),2)] is also just a list splice.  You can do this simply with t[::2]. If you are not familiar with this syntax, I suggest giving a look over the docs, because it is pretty useful.

@WheatWizard Wow, that is really useful. Sadly, I cannot edit the answer right now. I will do so as soon as I can. Thaks a lot for the advice...

Mathematica, 121 bytes
(m[x_]:=Take[s=IntegerDigits@#,{x,Length@s,2}];w[b_,n_]:=Union@Differences@m@b=={1}&&Length@Union@m@n==1;w[1,2]||w[2,1])&

Husk, 19 bytes
S¤|o←Ẋ~&Λȯ¬→-E↔TC2d

Try it online!

Vyxal, 11 bytes
y"v¯vUfsk≈⁼

Try it Online!


text:
Make it explode!
Take a matrix of positive integers as input, and make it explode!

The way you explode a matrix is by simply adding zeros around every element, including the outside borders.
Input/output formats are optional as always!
Test cases:
1
-----
0 0 0
0 1 0
0 0 0
--------------

1 4
5 2
-----
0 0 0 0 0
0 1 0 4 0
0 0 0 0 0
0 5 0 2 0
0 0 0 0 0
--------------

1 4 7
-----
0 0 0 0 0 0 0
0 1 0 4 0 7 0
0 0 0 0 0 0 0
--------------

6
4
2
-----
0 0 0
0 6 0
0 0 0
0 4 0
0 0 0
0 2 0
0 0 0

Operation Flashpoint scripting language, 182 bytes
f={t=_this;c=count(t select 0);e=[0];i=0;while{i<c*2}do{e=e+[0];i=i+1};m=[e];i=0;while{i<count t}do{r=+e;j=0;while{j<c}do{r set[j*2+1,(t select i)select j];j=j+1};m=m+[r,e];i=i+1};m}

Ungolfed:
f=
{
  // _this is the input matrix. Let's give it a shorter name to save bytes.
  t = _this;
  c = count (t select 0);

  // Create a row of c*2+1 zeros, where c is the number of columns in the
  // original matrix.
  e = [0];
  i = 0;
  while {i < c*2} do
  {
    e = e + [0];
    i = i + 1
  };

  m = [e]; // The exploded matrix, which starts with a row of zeros.
  i = 0;
  while {i < count t} do
  {
    // Make a copy of the row of zeros, and add to its every other column
    // the values from the corresponding row of the original matrix.
    r = +e;
    j = 0;
    while {j < c} do
    {
      r set [j*2+1, (t select i) select j];
      j = j + 1
    };

    // Add the new row and a row of zeroes to the exploded matrix.
    m = m + [r, e];
    i = i + 1
  };

  // The last expression is returned.
  m
}

Call with:
hint format["%1\n\n%2\n\n%3\n\n%4",
    [[1]] call f,
    [[1, 4], [5, 2]] call f,
    [[1, 4, 7]] call f,
    [[6],[4],[2]] call f];

Output:

In the spirit of the challenge:

Unknown; man; one thousand.

Now I'm confused

@MrGrj The command literally makes something blow up

+1 for the second gif "In the spirit of the challenge"! :)

Jelly,  12  11 bytes
-1 byte thanks to Erik the Outgolfer (no need to use swapped arguments for a join)
j00,0jµ€Z$⁺

Try it online! Or see a test suite.
A monadic link accepting and returning lists of lists.
How?
j00,0jµ€Z$⁺ - Link: list of lists, m
          ⁺ - perform the link to the left twice in succession:
         $  -   last two links as a monad
      µ€    -     perform the chain to the left for €ach row in the current matrix:
j0          -       join with zeros                [a,b,...,z] -> [a,0,b,0,...,0,z]
  0,0       -       zero paired with zero = [0,0]
     j      -       join                     [a,0,b,0,...,0,z] -> [0,a,0,b,0,...,0,z,0]
        Z   -     and then transpose the resulting matrix

You can save a byte: j00,0jµ€Z$⁺

Oh, of course, thanks!

Haskell, 38 bytes
a%l=a:(=<<)(:[a])l
f l=(0%)<$>(0<$l)%l

Try it online!

MATL, 12 bytes
FTXdX*0JQt&(

Input is a matrix with ; as row separator.
Try it online!
Explanation
FT     % Push [0 1]
Xd     % Matrix with that diagonal: gives [0 0; 0 1]
X*     % Implicit input. Kronecker product
0      % Push 0
JQt    % Push 1+j (interpreted as "end+1" index) twice
&(     % Write a 0 at (end+1, end+1), extending the matrix. Implicit display

Japt, 18 bytes
Ov"y ®î íZ c p0Ã"²

Test it online! (Uses the -Q flag so the output is easier to understand.)
Similar to the Jelly answer, but a whole lot longer...
Explanation
The outer part of the code is just a workaround to simulate Jelly's ⁺:
  "             "²   Repeat this string twice.
Ov                   Evaluate it as Japt.

The code itself is:
y ®   î íZ c p0Ã
y mZ{Zî íZ c p0}   Ungolfed
y                  Transpose rows and columns.
  mZ{          }   Map each row Z by this function:
     Zî              Fill Z with (no argument = zeroes).
        íZ           Pair each item in the result with the corresponding item in Z.
           c         Flatten into a single array.
             p0      Append another 0.

Repeated twice, this process gives the desired output. The result is implicitly printed.

Husk, 12 bytes
₁₁
Tm»o:0:;0

Takes and returns a 2D integer array. Try it online!
Explanation
Same idea as in many other answers: add zeroes to each row and transpose, twice.
The row operation is implemented with a fold.
₁₁         Main function: apply first helper function twice
Tm»o:0:;0  First helper function.
 m         Map over rows:
  »         Fold over row:
   o         Composition of
      :       prepend new value and
    :0        prepend zero,
       ;0    starting from [0].
            This inserts 0s between and around elements.
T          Then transpose.

Mathematica, 39 bytes
r=Riffle[#,0,{1,-1,2}]&/@Thread@#&;r@*r

Try it at the Wolfram sandbox! Call it like "r=Riffle[#,0,{1,-1,2}]&/@Thread@#&;r@*r@{{1,2},{3,4}}".
Like many other answers, this works by transposing and riffling zeros in each row then doing the same thing again. Inspired by Jonathan Allan's Jelly answer specifically, but only because I happened to see that answer first.

Dyalog APL, 24 bytes
4 bytes saved thanks to @ZacharyT
5 bytes saved thanks to @KritixiLithos
{{⍵↑⍨-1+⍴⍵}⊃⍪/,/2 2∘↑¨⍵}

Try it online!

You don't need parens around the 1,1,⍴⍵, do you?

I get this: {{⍵↑⍨-1 1+⍴⍵}⊃⍪/,/2 2∘↑¨⍵} at 26

@KritixiLithos nice use of 1 1+!

APL's array oriented, so would 1+ work?

@ZacharyT I just realised that after seeing your answer...

Why did you rollback the edit?

@KritixiLithos cos he posted an answer resembling it (with ¯1- instead of -1+)

I'm fine if you want to use the 24 byte solution you had.

@ZacharyT I think any train would make a lot longer than the dfn, because of the ⍪/,/.

Yeah, kept running into that.

You can just use 0⍪0,

Python 3, 118 bytes
def a(b):
    z='00'*len(b[0])+'0'
    r=z+'\n'
    for c in b:
        e='0'
        for d in c:e+=str(d)+'0'
        r+=e+'\n'+z+'\n'
    return r

First time golfing! Not the best, but I'm quite proud if I can say so myself!

-17 bytes from Wheat comments
-4 bytes from inlining the second for loop

Hello and welcome to the site.  You seem to have a good deal of whitespace here.  For instance some of your += and = are surrounded by spaces, which can be removed.  In addition doing += twice in a row could be simplified into a single statement, for example e+=str(d)+'0'

@WheatWizard: Thanks and thanks. Saved 17 bytes :)

I'm now noticing that you can collapse your inner for loop onto a single line for d in c:e+=str(d)+'0', but you might want to go with a join map(str,d))+'0', in which case it becomes pointless to define e` at all.

Since my last comment may have been a bit all over the place Here is the golf I had in mind

Ah, just thought of that myself! Hmm, I'll have to learn what .join and map() is first I guess. I'll be back!

join is a very useful tool to know for python golfing, map is a little less useful because it can often be replaced with a list comprehension in less bytes.

You can put the definitions of z and r on the same line (with a ; between them), saving a byte of indentation.

R, 65 bytes
Thanks to Jarko Dubbeldam and Giuseppe for very valuable comments!
Code
f=function(x){a=dim(x);y=array(0,2*a+1);y[2*1:a[1],2*1:a[2]]=x;y}

Input for the function must be a matrix or two dimensional array.
Test
f(matrix(1))
f(matrix(c(1,5,4,2),2))
f(matrix(c(1,4,7),1))
f(matrix(c(6,4,2)))

Output
> f(matrix(1))
     [,1] [,2] [,3]
[1,]    0    0    0
[2,]    0    1    0
[3,]    0    0    0
> f(matrix(c(1,5,4,2),2))
     [,1] [,2] [,3] [,4] [,5]
[1,]    0    0    0    0    0
[2,]    0    1    0    4    0
[3,]    0    0    0    0    0
[4,]    0    5    0    2    0
[5,]    0    0    0    0    0
> f(matrix(c(1,4,7),1))
     [,1] [,2] [,3] [,4] [,5] [,6] [,7]
[1,]    0    0    0    0    0    0    0
[2,]    0    1    0    4    0    7    0
[3,]    0    0    0    0    0    0    0
> f(matrix(c(6,4,2)))
     [,1] [,2] [,3]
[1,]    0    0    0
[2,]    0    6    0
[3,]    0    0    0
[4,]    0    4    0
[5,]    0    0    0
[6,]    0    2    0
[7,]    0    0    0

At a glance I think using a=dim(x)*2+1 instead of nrow and ncol would be better. You could then do y=matrix(0);dim(y)=a and 2*1:a[1],2*1:a[2].

Actually y=array(0,a) would be even shorter.

I believe you can remove the parentheses around the indices, i.e., 2*1:a[1] because : has higher precedence than *

Python 2, 64 bytes
lambda l:map(g,*map(g,*l))
g=lambda*l:sum([[x,0]for x in l],[0])

Try it online!
The function g intersperses the input between zeroes. The main function transposes the input while applying g, then does so again. Maybe there's a way to avoid the repetition in the main function.

Python 3, 104 101 97 93 86 bytes

@Zachary T saved 3 bytes: unused variable w removed and one unwanted space
@Zachary T saved yet another 4 bytes: [a,b] as just a,b while appending to a list
@nore saved 4 bytes: use of slicing
@Zachary T and @ovs helped saving 7 bytes: squeezing the statements in for loop

def f(a):
 m=[(2*len(a[0])+1)*[0]]
 for i in a:r=m[0][:];r[1::2]=i;m+=r,m[0]
 return m

Try it online!

You can remove w and save 2 bytes: https://repl.it/JBPE

Oh, you have an unneeded space after the line m+=[r,w]

Also, can you save 4 bytes by changing [j,0] to j,0 and [r,m[0] to r,m[0]?

You can save a 4 other bytes using array slices.

You can save three bytes by converting to python2 and changing the for loop indentation to a single tab.

I was just about to do that. :)

Listen to ovs's suggestion!

I suggest switching to Python 2 and using print m instead of return m to save 1 byte.

Octave, 41 bytes
@(M)resize(kron(M,[0 0;0 1]),2*size(M)+1)

Try it online!

C#, 146 bytes

Data

Input Int32[,] m The matrix to be exploded
Output Int32[,] The exploded matrix

Golfed
(int[,] m)=>{int X=m.GetLength(0),Y=m.GetLength(1),x,y;var n=new int[X*2+1,Y*2+1];for(x=0;x<X;x++)for(y=0;y<Y;y++)n[x*2+1,y*2+1]=m[x,y];return n;}

Ungolfed
( int[,] m ) => {
    int
        X = m.GetLength( 0 ),
        Y = m.GetLength( 1 ),
        x, y;

    var
        n = new int[ X * 2 + 1, Y * 2 + 1 ];

    for( x = 0; x < X; x++ )
        for( y = 0; y < Y; y++ )
            n[ x * 2 + 1, y * 2 + 1 ] = m[ x, y ];

    return n;
}

Ungolfed readable
// Takes an matrix of Int32 objects
( int[,] m ) => {
    // To lessen the byte count, store the matrix size
    int
        X = m.GetLength( 0 ),
        Y = m.GetLength( 1 ),
        x, y;

    // Create the new matrix, with the new size
    var
        n = new int[ X * 2 + 1, Y * 2 + 1 ];

    // Cycle through the matrix, and fill the spots
    for( x = 0; x < X; x++ )
        for( y = 0; y < Y; y++ )
            n[ x * 2 + 1, y * 2 + 1 ] = m[ x, y ];

    // Return the exploded matrix
    return n;
}

Full code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TestBench {
    public static class Program {
        private static Func<Int32[,], Int32[,]> f = ( int[,] m ) => {
            int
                X = m.GetLength( 0 ),
                Y = m.GetLength( 1 ),
                x, y,

                a = X * 2 + 1,
                b = Y * 2 + 1;

            var
                n = new int[ a, b ];

            for( x = 0; x < X; x++ )
                for( y = 0; y < Y; y++ )
                    n[ a, b ] = m[ x, y ];

            return n;
        };

        public static Int32[,] Run( Int32[,] matrix ) {
            Int32[,]
                result = f( matrix );

            Console.WriteLine( "Input" );
            PrintMatrix( matrix );

            Console.WriteLine( "Output" );
            PrintMatrix( result );

            Console.WriteLine("\n\n");

            return result;
        }

        public static void RunTests() {
            Run( new int[,] { { 1 } } );
            Run( new int[,] { { 1, 3, 5 } } );
            Run( new int[,] { { 1 }, { 3 }, { 5 } } );
            Run( new int[,] { { 1, 3, 5 }, { 1, 3, 5 }, { 1, 3, 5 } } );
        }

        static void Main( string[] args ) {
            RunTests();

            Console.ReadLine();
        }

        public static void PrintMatrix<TSource>( TSource[,] array ) {
            PrintMatrix( array, o => o.ToString() );
        }
        public static void PrintMatrix<TSource>( TSource[,] array, Func<TSource, String> valueFetcher ) {
            List<String>
                output = new List<String>();

            for( Int32 xIndex = 0; xIndex < array.GetLength( 0 ); xIndex++ ) {
                List<String>
                    inner = new List<String>();

                for( Int32 yIndex = 0; yIndex < array.GetLength( 1 ); yIndex++ ) {
                    inner.Add( valueFetcher( array[ xIndex, yIndex ] ) );
                }

                output.Add( $"[ {String.Join( ", ", inner )} ]" );
            }

            Console.WriteLine( $"[\n   {String.Join( ",\n   ", output )}\n]" );
        }
    }
}

Releases

v1.0 - 146 bytes - Initial solution.

Notes

None

You won't need the (int[,] m)=>, just m=> is enough if you state m is a 2D int-array int your answer. Also, you can change ,x, to ,x=0, and get rid of the x=0 in the for-loop initialization for -1 byte. And you can remove y++ from the inner loop by changing =m[x,y]; to =m[x,y++]; for an additional -1 byte. But +1 from me, and if I create a port of your answer it's also shorter than my current Java answer. :)

Clojure, 91 bytes
#(for[h[(/ 2)]i(range(- h)(count %)h)](for[j(range(- h)(count(% 0))h)](get(get % i[])j 0)))

Iterates over ranges in half-steps.

Perl 6, 33 bytes
{map {0,|$_,0},0 xx$_,|$_,0 xx$_}

Try it online!

JavaScript (ES6), 73 72 bytes
a=>(g=a=>(r=[b],a.map(v=>r.push(v,b)),b=0,r))(a,b=a[0].map(_=>0)).map(g)

Formatted and commented
Inserting zeros horizontally and vertically are very similar operations. The idea here is to use the same function g() for both steps.
a =>                            // a = input array
  (g = a =>                     // g = function that takes an array 'a',
    (                           //     builds a new array 'r' where
      r = [b],                  //     'b' is inserted at the beginning
      a.map(v => r.push(v, b)), //     and every two positions,
      b = 0,                    //     sets b = 0 for the next calls
      r                         //     and returns this new array
  ))(a, b = a[0].map(_ => 0))   // we first call 'g' on 'a' with b = row of zeros
  .map(g)                       // we then call 'g' on each row of the new array with b = 0

Test cases

let f =

a=>(g=a=>(r=[b],a.map(v=>r.push(v,b)),b=0,r))(a,b=a[0].map(_=>0)).map(g)

console.log(JSON.stringify(f([
  [1]
])))

console.log(JSON.stringify(f([
  [1, 4],
  [5, 2]
])))

console.log(JSON.stringify(f([
  [1, 4, 7]
])))

console.log(JSON.stringify(f([
  [6],
  [4],
  [2]
])))

Java 8, 183 166 162 129 119 bytes
m->{int a=m.length,b=m[0].length,i=a*b,r[][]=new int[a-~a][b-~b];for(;i-->0;)r[i/b*2+1][i%b*2+1]=m[i/b][i%b];return r;}

Input and output as a int[][].
-33 bytes by creating a port of @auhmaan's C# answer.
-10 bytes thanks to @ceilingcat.
Explanation:
Try it here.
m->{                             // Method with integer-matrix as both parameter & return
  int a=m.length,                //  Set `a` to the input-height
      b=m[0].length,             //  Set `b` to the input-width
      i=a*b,                     //  Index integer, starting at `a*b`
      r[][]=new int[a-~a][b-~b]; //  Result integer-matrix with dimensions a*a+1 by b*b+1
  for(;i-->0;)                   //  Loop `i` in the range (a*b, 0] (so over each cell):
    r[i/b*2+1][i%b*2+1]=         //   Fill the current cell of the result-matrix:
      m[i/b][i%b];               //    With the correct input-integers
  return r;}                     //  Return result integer-matrix

Charcoal, 49 bytes
Ａ⪪θ;αＡ””βＦ⁺¹×²Ｌ§α⁰Ａ⁺β⁰βＡ⁺β¶βＦα«βＡ0δＦιＡ⁺δ⁺κ⁰δ⁺δ¶»β

Try it online!
The input is a single string separating the rows with a semicolon.

Modern Charcoal can do this in 24 bytes: ≔Ｅ⪪θ;⪫00⪫ι0θＦθ⟦⭆ι0ι⟧⭆⊟θ0 but even avoiding StringMap I still think this can be done in 27 bytes.

Oh, and a couple of general tips: there's a predefined variable for the empty string, and you can create a string of zeros of a given length using Times or Mold.

C++17 + Modules, 192 bytes
Input as rows of strings from cin, Output to cout
import std.core;int main(){using namespace std;int i;auto&x=cout;string s;while(getline(cin,s)){for(int j=i=s.length()*2+1;j--;)x<<0;x<<'\n';for(auto c:s)x<<'0'<<c;x<<"0\n";}for(;i--;)x<<'0';}

Mathematica, 55 bytes
(a=ArrayFlatten)@{o={0,0},{0,a@Map[{{#,0},o}&,#,{2}]}}&

o={0,0} can be reduced to o=0{,}

PHP, 98 bytes
Input as 2D array, Output as string

<?foreach($_GET as$v)echo$r=str_pad(0,(count($v)*2+1)*2-1," 0"),"
0 ".join(" 0 ",$v)." 0
";echo$r;

Try it online!
PHP, 116 bytes
Input and Output as 2D array

<?foreach($_GET as$v){$r[]=array_fill(0,count($v)*2+1,0);$r[]=str_split("0".join(0,$v)."0");}$r[]=$r[0];print_r($r);

Try it online!

APL (Dyalog), 22 bytes
Prompts for matrix, returns enclosed matrix.
{⍺⍀⍵\a}/⍴∘0 1¨1+2×⍴a←⎕

Try it online!
a←⎕ prompt for matrix and assign to a
⍴ the dimensions of a (rows, columns)
2× multiply by two
1+ add one
⍴∘0 1¨ use each to reshape (cyclically) the numbers zero and one
{…}/ reduce by inserting the following anonymous function between the two numbers:
 ⍵\a expand* the columns of a according to the right argument
 ⍺⍀a expand* the rows of that according to the left argument
* 0 inserts a column/row of zeros, 1 inserts an original data column/row

Python 2, 92 bytes
n=input()
a=[[0]*(2*len(n[0])+1)for i in[0]+2*n]
for l,v in zip(a[1::2],n):l[1::2]=v
print a

Try it online!

JavaScript (ES6), 80 78 bytes
a=>[...a,...a,a[0]].map((b,i)=>[...b,...b,0].map((_,j)=>i&j&1&&a[i>>1][j>>1]))

Python 3 + Numpy, 87 bytes
from numpy import*
def f(a):b=zeros((2*len(a)+1,2*len(a[0])+1));b[1::2,1::2]=a;return b

Try it online!

Pyth, 13 bytes
uCm+0s,R0dG2Q

Demonstration
Another 13:
uC.iL+0m0dG2Q

Dyalog APL, 24 bytes
{{⍵↑⍨¯1-⍴⍵}⊃⍪/,/2 2∘↑¨⍵}

Any improvements are welcome and wanted!

05AB1E, 22 bytes
"vy0ý0.ø})"©.V€Sø®.Vø»

Try it online!

Actually uses the same piece of code 2x, so I can store it as a string and use Eval for -10 bytes.

You can save some bytes by using a 2F list instead of your string with .V: 14 bytes (or 17 bytes matching your current pretty-printed output). Although I did just post an alternative 8-byter approach. :)

J, 24 bytes
0,.0,[:,./^:2(0,.~,&0)"0

Try it online!

Python 2, 92 bytes
def n(a):
	l,g='0 ',len(a[0])*2+1;print l*g
	for i in a:print l+' 0 '.join(i)+' 0';print l*g

Try it online!

05AB1E, 11 8 bytes
2Fε€0Ć}ø

Try it online or verify all test cases.
Explanation:
2F      # Loop 2 times:
  ε     #  Map each row of the matrix to:
        #  (which uses the (implicit) input-matrix in the first iteration)
   €0   #   Add a leading 0 before each item in the list
     Ć  #   Enclose the list, appending its own first item (to add a trailing 0 as well)
  }ø    #  After the map: zip/transpose; swapping rows/column
        # (after the loop, the result is output implicitly)


text:
HyperNeutrino is back!
Today, @HyperNeutrino succeeded merging his two accounts, and finally got the reputation he lost back. Now, it's time to celebrate! Your task is to output this exact text:

                /\
               /  \
              /    \
             /      \
            /        \
           /          \
          /            \
         /              \
        /                \
       /                  \
      /                    \
     /                      \
    /                        \
   /                          \
  /                            \
 /                              \
/                                \
|                                |
|                                |
|  @HyperNeutrino Welcome back!  |
|                                |
|                                |
\                                /
 \                              /
  \                            /
   \                          /
    \                        /
     \                      /
      \                    /
       \                  /
        \                /
         \              /
          \            /
           \          /
            \        /
             \      /
              \    /
               \  /
                \/

Rules:

Your program must not take input.
The output must be exactly as shown above.
Trailing and leading spaces / newlines are allowed.
Defaults Loopholes apply.
You can provide output by any standard method.
This is a code-golf celebration, hence the shortest code in each language wins! Have fun!

I would really like to hear some feedback from the downvoters.

Are trailing new lines and/or spaces allowed?

There was a "display a welcome" challenge that was just a few days ago, and this is pretty similar which might be why downvotes?  This one is way bigger though

I didn't downvote, but anyone who doesn't know HyperNeutrino might view this as too "inside baseball" or even perhaps self-serving (if they thought you were talking about your own alt account or something).

@BradC Well, they should visit his profile :P

I think this doesn't add much to existing ASCII art challenges. Lines of slashes, mirror symmetry, and inserting text are all overdone. And the image feels pretty arbitrary. Why is it a diamond with the dull points cut off? Something like HyperNeutrino's profile icon would have been more thematic.

I did not downvote this, but personally I think that this isn't particularly an interesting challenge (sorry if I sound very unappreciative; I do appreciate your welcoming me back :D). I agree with @xnor that drawing ASCII-art of my profile might a) be more symbolic of me, b) be more interesting, and c) add more to other ASCII-art challenges.

@xnor ironically I think the pointy diamond was an attempt at the 6-sided profile icon, ASCII simply doesn't have shallow slants.

I'd post an ASCII art hexagon, but Markdown is insults

@BradC That's funny, I totally missed it because of the proportions. I posted my own question to draw HyperNeutrino's icon.

@BradC Ironically, you were right.

How does this shape have anything to do with merging two accounts?!

V, 64 bytes
i/\
\/16ñH>GMÙXppjÄXppñ5O|³² |M3lR@HyperNeutrino Welcome back!

Try it online!
Hexdump:
00000000: 692f 5c0a 5c2f 1b31 36f1 483e 474d d958  i/\.\/.16.H>GM.X
00000010: 7070 6ac4 5870 70f1 354f 7cb3 b220 7c1b  ppj.Xpp.5O|.. |.
00000020: 4d33 6c52 4048 7970 6572 4e65 7574 7269  M3lR@HyperNeutri
00000030: 6e6f 2057 656c 636f 6d65 2062 6163 6b21  no Welcome back!

Explanation:
i                             " Insert:
 /\<cr>\/                     "   '/\<newline>\/'
         <esc>                " Return to normal mode
16ñ             ñ             " 16 times:
   H                          "   Move to the beginning of the buffer
    >G                        "   Indent every line
      M                       "   Move to the middle of the buffer (the last downward facing part)
       Ù                      "   Duplicate this line downwards
        X                     "   Delete one of the leading spaces
         pp                   "   And paste it between the slashes twice
           j                  "   Move down a line (the first upward facing part)
            Ä                 "   Duplicate this line upwards
             X                "   Delete one of the leading spaces
              pp              "   And paste it between the slashes twice
5O                            " On the five lines above us, insert:
  |³² |                       "   A bar followed by 32 spaces, followed by a bar
       <esc>                  " Return to normal mode
            M                 " Move to the middle line of the buffer
             3l               " Move 3 characters to the right
               R              " And write the following over the existing text:
@HyperNeutrino Welcome back!  "   Welcome back!

You may be able to use reverse instead of expanding the slashes on both ends?  Something like (psuedo) i/\^[ recursively - expand, copy down, reverse, move back up

@nmjcman101 Hmmm... I'll give it a shot. I also think it might make sense to start with the middle, and use a recursive command instead of 16 times command.

05AB1E, 87 78 81 79 bytes
-9 bytes because of dictionary compression
+2 bytes because "back" isn't capitalized
-2 bytes because of "mirroring"
17F'/16N-úðN×«∞}'|D32ú«D”|  @HyperNeutrino‡Ý back!  |”'|D32ú«D17F'\Núð16N-×«∞}»

Try it online!

Explanation (split into parts)
Produces the "triangle" at the top
17F            # for N in 0 .. 16
   '/          # push a forward slash
     16N-      # 16 - N
         ú     # put 16 - N spaces in front of the forward slash
          ð    # space character
           N×  # repeated n times
             } # end of for loop

Produces the two lines with vertical bars at the end.
'|       # push a vertical bar
  D      # duplicate
   32ú   # put 32 spaces before the vertical bar
      «  # concatenate, i.e. one line complete
       D # duplicate

Produces the "Welcome back" string; ”|  @HyperNeutrino‡Ý back!  |”.
Most of it is interpreted as the literal characters, except for ‡Ý, which is interpreted as Welcome.
Exact copy of second section: '|D32ú«D produces second set of vertical bar lines
Produces the "triangle" at the bottom, similar to first part
17F              # for N in 0 .. 16
   '\            # push backslash
     Nú          # put N spaces before backslash
       ð         # space character
        16N-     # 16 - N
            ×    # 16 - N spaces
             «   # concatenate the two strings
              ∞  # mirror
               } # end for

The » at the end joins everything by newlines and implicitly prints.

@Mr.Xcoder: I have a LOT of golfing to do

Why the down votes?

That's what I am trying to figure out as well, but regarding the challenge itself.

Can you use string compression?

@ComradeSparklePony: I haven't tried that yet; feel free to try that yourself!

@DJMcMayhem:Ah, thought it was capitalized, I'll fix that

Charcoal, 40 bytes
↑³↗¹⁷‖Ｍ‖Ｂ↓Ｊ³¦⁰“]‹baiE_ν﹪↓➙ZＫξη¢:Ａgλ⁸%I”

Try it online! Link is to verbose version of code.

Explanation please.

@CalculatorFeline: This is very readable: ↑³ draws a line up 3, then ↗¹⁷ draws a diagonal line. ‖Ｍ reflects horizontally while ‖Ｂ↓ reflects vertically (and doesn't copy the axis). Ｊ³¦⁰ jumps to the start of the text and the rest is a compressed string which is implicitly printed.

T-SQL, 222 bytes
DECLARE @ INT=1T:PRINT SPACE(17-@)+'/'+SPACE(2*(@-1))+'\'SET @+=1IF @<18GOTO T
PRINT REPLACE('|S|
|S|
|  @HyperNeutrino Welcome back!  |
|S|
|S|','S',SPACE(32))B:SET @-=1PRINT SPACE(17-@)+'\'+SPACE(2*(@-1))+'/'IF @>0GOTO B

Pretty straightforward procedural approach. Formatted:
DECLARE @ INT=1
T:  --count up for top cone
    PRINT SPACE(17-@) + '/' + SPACE(2*(@-1)) + '\'
    SET @+=1
IF @<18 GOTO T

--middle section, string literal with line breaks and a single replace
PRINT REPLACE('|S|
|S|
|  @HyperNeutrino Welcome back!  |
|S|
|S|','S',SPACE(32))

B:  --count back down for bottom cone
    SET @-=1
    PRINT SPACE(17-@) + '\' + SPACE(2*(@-1)) + '/'
IF @>0 GOTO B

Only thing probably worth explaining is that strings in T-SQL can contain line breaks inside the quotes, I take advantage of that here, instead of adding CHAR(13).

Python 2, 187 bytes
f,s=lambda s,n=1:'\n'.join((s%(' '*i)).center(34)for i in range(0,34,2)[::n]),'|%s|\n'
print f('/%s\\')+'\n'+s%(' '*32)*2+s%('  @HyperNeutrino Welcome back!  ')+s%(' '*32)*2+f('\\%s/',-1)

Try it online!

you can use double spaces to simplify the range (0,34,2) to (0,17)

@Rod You do not need the 0 in range(0,17)

you can also replace the (..).center(34) for ' '*(16-i)+..

for 177 try this

Mathematica, 165 bytes
T=Table;c=Column;c[{s=c[T[""<>{"/",T[" ",2i],"\\"},{i,0,16}],Alignment->Center],g=c@T[""<>{"|",T[" ",32],"|"},2],"|  @HyperNeutrino Welcome back!  |",g,s~Rotate~Pi}]

Retina, 107 bytes

17#¶#¶|2@HyperNeutrino Welcome back!2|¶#¶#17
#
|32|
\d+
$*
\G (?=( *))
$1/$`$`\¶
r`(?<=( *)) \G
¶$1\$'$'/

Try it online! Explanation: The first stage inserts the text and starts outlining the surrounding characters, which are further expanded by the next two stages. The fourth and fifth stages then generate the top and bottom diagonal lines respectively.

PHP, 174 bytes
for(;$i<39;)echo($p=str_pad)($p($i>16?$i!=19?$i>21?"\\":"|":"|  @HyperNeutrino Welcome back!  ":"/",$i>16?$i>21?77-$i*2:33:$i*2+1).($i++>16?$i>22?"/":"|":"\\"),34," ",2),"
";

Try it online!

///, 306 bytes
/6/"\\//5/\/\///4/"#53/  52/\\%51/\/%50/\\'5-/\/'5,-|%%"3|/-/
5&/3#/1/""5#/3\\5"/3331&/\0% #/#0%#/&0% \/60%\/40" &/"&0"&1\0" #1#041&0" \1606140 &1"&0&1%\0 #1%#0#1%&0 \1%60\1%4\,,'|3@HyperNeutrino Welcome back!3|,,'\2%4- \2%6-#2%&- #2%#-&2%\- &2"&-624-" \26-42&-" #2#-"&2\-" &\"&-%\\4-% \\6-%#\&-% #\#-%&\\/

Try it online!

SOGL V0.12, 54 50 bytes
ā'²∫0; /ž}j"ν_‘3∙+╬³"Ξ█a⁄I⅜ģī\↕═<ν▲ΩhΕR$C¹‘4L«žj╬Æ

Try it Here!
Explanation:
ā                                push an empty array
 '²∫     }                       17 times repeat
    0;                             push 0 below the iteration
       /ž                          at [0, iteration] (1-indexed position) insert the slash (so every time it moves  everything one char right)
          j                      remove last blank line (idk why it's there)
           "ν_‘                  push "|                "
               3∙                get an array of 3 of those
                 +               append that to the diagonals mirrored
                  ╬³             mirror horizontally with 0 overlap and swapping chars
                    "..‘         push "@HyperNeutrino Welcome back!"
                        4L«ž     at [4;20] insert that in
                            j    remove last blank line (2nd byte wasted now)
                             ╬Æ  mirror vertically

05AB1E, 57 bytes
žvƒ'/'\N·ú«}'|žvúÂìD”|  @HyperNeutrino‡Ý back!  |”)Â¦í«.c

Try it online!

Canvas, 55 bytes
⁷╵＼║：↕|“ ”⁷×＋║２＊：“×∔］＊YV≠²↖:tvｘZ｝@ｌ Ｊ｛ ５ｎ＼┌⟳sｃ⤢7‟；∔∔┘∔∔

Try it here!

Vyxal C, 47 bytes
\/16꘍¦øṀ÷\|16꘍m:`|  @Hy∧‛NeꜝṘ⋏⇩ ÷… λǐ!  |`WḂḢRJ

Try it Online!

Canvas, 40 bytes
⁷╵／|３＊∔╫@HyperNeutrino Welcome back!４Ａ«╋

Try it here!
There's already a Canvas answer here but I'd say this uses a fairly different approach.

Deadfish~, 2245 bytes
{iii}ii{c}cccccc{i}iiiiic{iiii}iiiiic{{d}ii}ddc{ii}ii{c}ccccc{i}iiiiic{d}dddddcc{iiiiii}c{{d}ii}ddc{ii}ii{c}cccc{i}iiiiic{d}dddddcccc{iiiiii}c{{d}ii}ddc{ii}ii{c}ccc{i}iiiiic{d}dddddcccccc{iiiiii}c{{d}ii}ddc{ii}ii{c}cc{i}iiiiic{d}dddddcccccccc{iiiiii}c{{d}ii}ddc{ii}ii{c}c{i}iiiiic{d}ddddd{c}{iiiiii}c{{d}ii}ddc{ii}ii{c}{i}iiiiic{d}ddddd{c}cc{iiiiii}c{{d}ii}ddc{ii}iiccccccccc{i}iiiiic{d}ddddd{c}cccc{iiiiii}c{{d}ii}ddc{ii}iicccccccc{i}iiiiic{d}ddddd{c}cccccc{iiiiii}c{{d}ii}ddc{ii}iiccccccc{i}iiiiic{d}ddddd{c}cccccccc{iiiiii}c{{d}ii}ddc{ii}iicccccc{i}iiiiic{d}ddddd{cc}{iiiiii}c{{d}ii}ddc{ii}iiccccc{i}iiiiic{d}ddddd{cc}cc{iiiiii}c{{d}ii}ddc{ii}iicccc{i}iiiiic{d}ddddd{cc}cccc{iiiiii}c{{d}ii}ddc{ii}iiccc{i}iiiiic{d}ddddd{cc}cccccc{iiiiii}c{{d}ii}ddc{ii}iicc{i}iiiiic{d}ddddd{cc}cccccccc{iiiiii}c{{d}ii}ddc{ii}iic{i}iiiiic{d}ddddd{cc}{c}{iiiiii}c{{d}ii}ddc{iiii}dddc{d}ddddd{cc}{c}cc{iiiiii}c{{d}ii}ddc{{i}}{i}iiiic{{d}i}dd{cc}{c}cc{{i}d}iic{{d}}{d}ddddc{{i}}{i}iiiic{{d}i}dd{cc}{c}cc{{i}d}iic{{d}}{d}ddddc{{i}}{i}iiiic{{d}i}ddcc{iii}iic{i}ddc{iiiii}dc{d}ic{d}dc{i}iiic{ddd}ddddddc{ii}iiic{i}iiiiiicdcddc{d}iciiiiicic{{d}ii}ic{iiiii}iiiiic{i}iiiic{i}dddc{d}ic{i}iicddc{d}iic{{d}iii}ic{iiiiii}iiiiiicdciic{i}ddc{{d}iii}ddddcdcc{{i}d}iic{{d}}{d}ddddc{{i}}{i}iiiic{{d}i}dd{cc}{c}cc{{i}d}iic{{d}}{d}ddddc{{i}}{i}iiiic{{d}i}dd{cc}{c}cc{{i}d}iic{{d}}{d}ddddc{{i}dd}iic{dddddd}{cc}{c}cc{i}iiiiic{dddd}iiic{ii}iic{iiiiii}c{dddddd}{cc}{c}{i}iiiiic{dddd}iiic{ii}iicc{iiiiii}c{dddddd}{cc}cccccccc{i}iiiiic{dddd}iiic{ii}iiccc{iiiiii}c{dddddd}{cc}cccccc{i}iiiiic{dddd}iiic{ii}iicccc{iiiiii}c{dddddd}{cc}cccc{i}iiiiic{dddd}iiic{ii}iiccccc{iiiiii}c{dddddd}{cc}cc{i}iiiiic{dddd}iiic{ii}iicccccc{iiiiii}c{dddddd}{cc}{i}iiiiic{dddd}iiic{ii}iiccccccc{iiiiii}c{dddddd}{c}cccccccc{i}iiiiic{dddd}iiic{ii}iicccccccc{iiiiii}c{dddddd}{c}cccccc{i}iiiiic{dddd}iiic{ii}iiccccccccc{iiiiii}c{dddddd}{c}cccc{i}iiiiic{dddd}iiic{ii}ii{c}{iiiiii}c{dddddd}{c}cc{i}iiiiic{dddd}iiic{ii}ii{c}c{iiiiii}c{dddddd}{c}{i}iiiiic{dddd}iiic{ii}ii{c}cc{iiiiii}c{dddddd}cccccccc{i}iiiiic{dddd}iiic{ii}ii{c}ccc{iiiiii}c{dddddd}cccccc{i}iiiiic{dddd}iiic{ii}ii{c}cccc{iiiiii}c{dddddd}cccc{i}iiiiic{dddd}iiic{ii}ii{c}ccccc{iiiiii}c{dddddd}cc{i}iiiiic{dddd}iiic{ii}ii{c}cccccc{iiiiii}c{dddd}dddddc

Try it online!
Tio runs 3/4 of it.