text:
Draw HyperNeutrino's benzene hegaxon icon in ASCII
In celebration of HyperNeutrino getting back his account and rep, following Mr. Xcoder.

Apologies for rotating the picture for drawability.

Print or output this ASCII art exactly. You may have trailing spaces and/or a trailing newline.
      _______________
     /               \
    /  /           \  \
   /  /             \  \
  /  /               \  \
 /  /                 \  \
/  /                   \  \
\                         /
 \                       /
  \                     /
   \                   /
    \  _____________  /
     \_______________/

This depicts one of the two resonance structures of the molecule benzene

Related: Concentric hexagons, asterisk-filled hexagons
Leaderboard:

var QUESTION_ID=128104,OVERRIDE_USER=20260;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/128104/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

I see @HyperNeutrino has since rotated his icon to match this question!

@Neil Yes :P It bothered me so much that I just changed it to make it consistent. Now you need to update the resonance structures, xnor :P

Darn, the flair won't update even though I added random unused parameters to the end, changed it to StackOverflow, changed it back, and edited another like 10 times :I

But the horizontal version looks ugly when rendered on my profile in my opinion; could just be that I'm not used to it. So, I changed it back. :P

:( I wanted to see!

Charcoal, 23 bytes
×_⁷↙←×_⁸↖⁶→↗⁶Ｐ×_⁸↘↓↙⁵‖Ｂ

Try it online! Explanation: Prints the lines in the following order, then reflects everything horizontally:
      5_______
     /
    /  6
   /  ↙
  /  /
 ↗  /
4  /
\
 \
  \
   \
    ↖  1→_____
     3______←2

‖Ｂ stands for "Reflect Butterfly"

JavaScript (ES6),  144  143 140 138 134 bytes
A recursive function drawing the output character by character with a purely conditional expression.
f=(p=363)=>(m=p%28-14,x=m<0?-m:m,y=p/28|0,p--)?`\\/ _
`[m+14?x<8-y&y<2|x<8&y>11?3:x==y+8|x==19-y|x==16-y&y>5&x>5?m<0^y>5:2:4]+f(p):''

How?
For each position 0 < p ≤ 363, we define:

m = (p MOD 28) - 14
x = | m |
y = ⌊ p / 28    ⌋

Below is a breakdown of the formula which picks the appropriate character from [ '\', '/', ' ', '_', '\n' ].
m + 14 ?                            // if this is not an end of line:
  x < 8 - y & y < 2 |               //   if this is either part D
  x < 8 & y > 11 ?                  //   or part E:
    3                               //     output '_'
  :                                 //   else:
    x == y + 8 |                    //     if this is either part A
    x == 19 - y |                   //     or part B
    x == 16 - y & y > 5 & x > 5 ?   //     or part C:
      m < 0 ^ y > 5                 //       output '/' or '\' depending on the quadrant
    :                               //     else:
      2                             //       output a space
:                                   // else:
  4                                 //   output a Line-Feed

And below are the different parts in the coordinate system defined above:
   | 13 12 11 10 09 08 07 06 05 04 03 02 01 00 01 02 03 04 05 06 07 08 09 10 11 12 13
---+---------------------------------------------------------------------------------
12 | .  .  .  .  .  .  E  E  E  E  E  E  E  E  E  E  E  E  E  E  E  .  .  .  .  .  .
11 | .  .  .  .  .  B  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  B  .  .  .  .  .
10 | .  .  .  .  B  .  .  C  .  .  .  .  .  .  .  .  .  .  .  C  .  .  B  .  .  .  .
09 | .  .  .  B  .  .  C  .  .  .  .  .  .  .  .  .  .  .  .  .  C  .  .  B  .  .  .
08 | .  .  B  .  .  C  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  C  .  .  B  .  .
07 | .  B  .  .  C  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  C  .  .  B  .
06 | B  .  .  C  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  C  .  .  B
05 | A  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  A
04 | .  A  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  A  .
03 | .  .  A  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  A  .  .
02 | .  .  .  A  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  A  .  .  .
01 | .  .  .  .  A  .  .  D  D  D  D  D  D  D  D  D  D  D  D  D  .  .  A  .  .  .  .
00 | .  .  .  .  .  A  D  D  D  D  D  D  D  D  D  D  D  D  D  D  D  A  .  .  .  .  .

Demo

f=(p=363)=>(m=p%28-14,x=m<0?-m:m,y=p/28|0,p--)?`\\/ _
`[m+14?x<8-y&y<2|x<8&y>11?3:x==y+8|x==19-y|x==16-y&y>5&x>5?m<0^y>5:2:4]+f(p):''

o.innerHTML = f()

05AB1E, 50 bytes
•ι¡≠ït]4uƵŽΣ”9g½ùöèri|)á,ćè’∍é•5B3ÝJ"/ _\"‡4¡.B».∞

Try it online!

The compression:
The strategy here was to build half the object, then mirror the image across the halfway mark. To do this, I first built the left half, with front padding:
11111122222222
111110
11110110
1110110
110110
10110
0110
3
13
113
1113
1111311222222
11111322222222

But no right padding, this is because the .B function in 05AB1E can be used to make every element equal in length using spaces. This allows for me to omit the extraneous spaces to the right and just delimit by newlines. I then, took this pattern, and removed all newlines replacing them with 4 to get:
1111112222222241111104111101104111011041101104101104011043413411341113411113112222222411111322222222

Compressing this with base-255 results in:
•ι¡≠ït]4uƵŽΣ”9g½ùöèri|)á,ćè’∍é•5B

Where the two • is denoting a base-255 compressed string and 5B is converting it to base-5.

The second part, after the compressing:
3ÝJ                # Push '0123'.
   "/ _\"          # Push '/ _\'.
         ‡         # Replace each in b with a on c.
          4¡       # Split on 4's (the newlines I replaced).
            .B     # Boxify for the mirror (adds padding to longest element).
              »    # Join by newlines.
               .∞  # Mirror image.

You could save 3 bytes like this

@emigna è, of course!

V, 61 bytes
i/  /±¹ \  \
\²µ /6ñGÙlxxhPHÄãxx>ñv$r_jwr w.Gkkl13r_jviwr_jd

Try it online!
Hexdump:
00000000: 692f 2020 2fb1 b920 5c20 205c 0a5c b2b5  i/  /.. \  \.\..
00000010: 202f 1b36 f147 d96c 7878 6850 48c4 e378   /.6.G.lxxhPH..x
00000020: 783e f176 2472 5f6a 7772 2077 2e47 6b6b  x>.v$r_jwr w.Gkk
00000030: 6c31 3372 5f6a 7669 7772 5f6a 64         l13r_jviwr_jd

Python 2, 226 213 bytes 179 bytes
My first golf!

b,f,s,u='\/ _'
print'\n'.join([s*6+u*15,s*5+f+s*15+b]+[s*(4-n)+'/ /'+s*(13+2*n)+'\ \\'for n in range(5)]+[s*n+b+s*(25-2*n)+f for n in 0,1,2,3]+[s*4+b+s*2+u*13+s*2+f,s*5+b+u*15+f])

Try it online!
I tried looping the bits that I could find a pattern on, and hardcoded the rest. Setting the different characters to a variable helped save quite a lot of bytes.
Edit: Decided to append to the same array instead of joining multiple times. Saved 13 bytes.
Edit 2: Thanks to @ValueInk, @jacoblaw, @WheatWizard, @CalculatorFeline, and @Challenger5, saved 34 bytes

You can do p=print if you want to do this in python 3, saves 2 byte

Looks like you commented while I was making an edit :). No need for multiple print statements now

b,f,s,u='\/ _';o,a='/  /','\  \\' saves 11 bytes over your current variable initialization! See here

using @ValueInk's tip and not making a list over 4 lines, you have 195 byte like this

@jacoblaw You don't need all the spaces in that. Here it is without them.

o and a are only used once in the code. Here it is with them inlined.

You can use 0,1,2,3 instead of range(4) to save a byte.

Retina, 129 114 102 bytes
Thanks to ovs for -12 bytes!

6eea¶5/15\¶4c1b3c3b2c5b1c7bc9b\25d1\23d2\21d3\19d4\2ee_2d5\eea/
e
aa
d
/¶
c
/2/1
b
\2\¶
a
___
\d+
$*

Try it online!

101 bytes

Charcoal, 47 43 41 bytes
↗⁶Ｆ¹⁵_↓↘⁶←↙⁶↷⁴↑Ｆ¹⁵_↖⁶Ｍ⁴→↗⁵Ｍ¹¹→↓↘⁵Ｍ⁵↙↑Ｆ¹³_

Try it online!
I did not know a thing about Charcoal until right now, I felt like "I have no idea of what I'm doing" while trying to figure out this answer... I'm quite sure this can be golfed a lot.
Updates:

I managed to save 4 bytes learning to use cursor directions and movements!
2 more bytes saved after realizing the drawing was not exactly as asked. ^__^U

Lmao, trust me, you're not the only one to be in the latter state when using charcoal. The first time I used it was trying to make a cube. I used the "square" built-in then manually drew the back of the cuboid, turns out you can do it in 20 bytes compared to my 57.

@carusocomputing I cannot believe that O5AB1E or Jelly still have longer answers... :-D

Charcoal is an extremely competitive ASCII-oriented language, the optimized answer is likely around 40 bytes which may even obliterate bubblegum.

@carusocomputing cough did you say 40?

@Neil I did try to use ‖Ｂ but I could not figure out how... nice answer!

;) I knew itd be you too haha.

J, 155 bytes
('_ /\',LF){~5#.inv 95x#.32-~3 u:'0_C5NcBe''e2kA/jhk>5y~l<Z:AN<QG)V7m>l"x!@A-jp8E%XEh&"$''j(sP8Z!b#e7})]_,L"LCUu)kqsBQ5_5bt}`bq ":1cv(gU;|{I~n5q@(ISCK `'[<

Try it online!
This is a function that expects no input. E.g., f =:  then f ''.
Explanation
I encoded this using the following steps. Assume that the desired compression string is contained in the variable h.
   k=:'_ /\',LF                    NB. the dictionary used to encode the string
   k i. h                          NB. numbers corresponding to indices in `k`
1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 4 1 1 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 3 1 1 3 4 1 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 3 4 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 3 4 1 2 1 1 2 1 1 1 ...
   5x#.k i. h                      NB. base 5 to decimal
4571656960356964266407389291886526966074643634545109498506871241033015964671946641835339522170115810676380078148856766959449166714046433431522704650346045752930168245684048485736756807881102718244115576453623363843561553955078139
   95#.inv 5x#.k i. h              NB. decimal to base 95
16 63 35 21 46 67 34 69 7 69 18 75 33 15 74 72 75 30 21 89 94 76 28 58 26 33 46 28 49 39 9 54 23 77 30 76 2 88 1 32 33 13 74 80 24 37 5 56 37 72 6 2 4 7 74 8 83 48 24 58 1 66 3 69 23 93 9 61 63 12 44 2 44 35 53 85 9 75 81 83 34 49 21 63 21 66 84 93 64 66 8...
   quote u:32+95#.inv 5x#.k i. h   NB. base 95 to ASCII repr of string
'0_C5NcBe''e2kA/jhk>5y~ll"x!@A-jp8E%XEh&"$''j(sP8Z!b#e7})]_,L"LCUu)kqsBQ5_5bt}`bq ":1cv(gU;|{I~n5q@(ISCK `'

Then, we just need to decode this. 5#.inv 95x#.32-~3 u: performs the inverse of what I just described, giving us the list of indices. Then, ('_ /\',LF){~ applies the appropriate characters to each index.

Mathematica, 227 bytes
t=Table;T[x_,y_,z_,v_]:=""<>{x,y~t~v,z};Column[Join[b={""<>"_"~t~15},{T["/"," ","\\",15]},t[T["/  /"," ","\\  \\",i],{i,11,19,2}],t[T["\\"," ","/",i],{i,25,19,-2}],{T["\\  ","_","  /",13]},{""<>{"\\",b,"/"}}],Alignment->Center]

Ruby, 117 bytes
13.times{|i|s=[?_*(15--i%12*1.3),"/%#{i*2+8}s"%?\\,''][(i%12%11+3)/5].center(27)
i>0&&(s[i-=7]=?\\)&&s[~i]=?/
puts s}

05AB1E, 92 86 80 bytes
'_15×6ú'/5úð8×«.∞5F'/4N-ú'/2ú«ð6N+×«.∞}4F'\Núð13N-×«.∞}'\4ú'_7×2ú«.∞'\5ú'_8×«.∞»

Try it online!

Explanation in parts
The bar at the top
'_      # underscore
  15×   # repeated 15 times
     6ú # with 6 spaces in front

The line immediately below the bar
'/         # forward slash
  5ú       # with 5 spaces in front
    ð      # space
     8×    # repeated 8 times
       «   # concatenated with the earlier string
        .∞ # intersected mirror (i.e middle space not affected)
           # mirroring: "  /  " => "  /    \  "

The remainder of the upper portion of the hexagon
5F                     # for N in 0..4
  '/                   # forward slash
    4N-                # 4 - N
       ú               # spaces in front of the slash
        '/             # another forward slash
          2ú           # with 2 spaces in front
            «          # concatenated with the other string
             ð         # a space character
              6N+      # N + 6
                 ×     # times
                  «    # concatenated with the other string
                   .∞  # intersected mirror
                     } # end for

The remainder except for the last 2 lines
4F               # for N in 0 .. 3
  '\             # backslash
    Nú           # with N spaces in front
      ð          # a space
       13N-      # 13 - N
           ×     # repeated
            «    # concatenated with other string
             .∞  # intersected mirror
               } # end for

The second to last line
'\ # backslash
  4ú # with 4 spaces in front
    '_ # underscore
      7× # repeated 7 times
        2ú # with 2 spaces in front
          « # concatenated with earlier string
           .∞ # intersected mirror

The last line
'\ # backslash
  5ú # with 5 spaces in front
    '_ # underscore
      8× # repeated 8 times
        « # concatenated with other string
         .∞ # intersected mirror

The » at the end joins everything on newlines.

@carusocomputing: hmm, I didn't think of "mirroring" it.

Mirror is like palindromize, except with palindromize {_ becomes {_{, where with mirror it becomes {_}. Palendromize is û, while mirror is ∞. There is also an intersected mirror, which is .∞.

@downvoter stoppit. He said he's still golfing it.

C#, 210 199 bytes
Encodes the length of space runs and underscore runs:
var h=@"5KL4/>\L3/1/:\1\L2/1/<\1\L1/1/>\1\L0/1/@\1\L/1/B\1\L\H/L0\F/L1\D/L2\B/L3\1I1/L4\K/L";for(var i='M';--i>'/';)h=h.Replace(""+i,i>75?"\n":"".PadLeft(i>72?i-60:i-47," _"[i/73]));Console.Write(h);

Ungolfed:
var h = @"5KL4/>\L3/1/:\1\L2/1/<\1\L1/1/>\1\L0/1/@\1\L/1/B\1\L\H/L0\F/L1\D/L2\B/L3\1I1/L4\K/L";
for (var i = 'M'; --i > '/'; )
    h = h.Replace("" + i, i > 75 ? "\n" : "".PadLeft(i > 72 ? i - 60 : i - 47, " _"[i / 73]));
Console.Write(h);

Try It Online!

Retina, 129 bytes

5$* ¶
\G (?=( *))
¶$1/  /$`11$* $`\  \
r`(?<=( *)) \G
$1\$'19$* $'/¶
^
6$* 15$*_¶5$* /15$* \
¶$
¶    \  13$*_  /¶5$* \15$*_/

Try it online! Completely different approach, yet coincidentally the same length!

Paintbrush, 43 bytes, non-competing
13→'_8×←↓s/5{↙s/3→s/3←}↓'\6×↘↑'_8×→↖'_7×←▕┣

Explanation
13→'_8×←↓s/5{↙s/3→s/3←}↓'\6×↘↑'_8×→↖'_7×←▕┣  Program
13→                                          Move the pointer 13 spaces right
   '_                                        Push '_' onto the stack
     8×                                      Multiply it 8 times
       ←                                     Draw out '________' moving to the left
        ↓                                    Move down
         s/                                  Set that cell to a slash
           5{         }                      Execute function 5 times
             ↙                               Move the pointer one spot down and one spot to the left
              s/                             Set that cell to a slash
                3→                           Move 3 spaces right
                  s/                         Set that cell to a slash
                    3←                       Move 3 spaces left
                      ↓                      Move down
                       '\                    Push r'\'
                         6×                  Multiply it 6 times
                           ↘                 Draw out r'\\\\\\' moving down-right
                            ↑                Move up
                             '_              Push '_'
                               8×            Multiply it 8 times
                                 →           Draw out '________' moving to the right
                                   ↖         Move the pointer one spot up and one spot to the right
                                    '_       Push '_'
                                      7×     Multiply it 7 times
                                        ←▕┣  Draw out '_______' moving to the left
                                         ▕   Remove the rightmost column
                                          ┣  Mirror the entire grid to the right, overlapping the inner column, flipping some characters that have backwards variants

Beta Testing in the Real World:
Charcoal: 1
Paintbrush: 0

Gotta make a lot of improvements, huh. :P

And user themself posts a solution!

@ValueInk It's about time, huh? :P

PHP, 122 bytes
<?=gzinflate(base64_decode("ddDBDQAgCEPRO1N0AxYicf8tFK2JIPT4HycA34iTHRVxJqwvGLvme8LXrxRAKoVmBZypoMNFjbmUtMEl/OV2WHqYTg"));

Try it online!
PHP, 158 bytes
for(;~$c='f000
e/o1d/b/k\b1c/b/m\b1b/b/o\b1a/b/q\b1/b/s\b1\y/
a\w/
b\u/
c\s/
d\b00___b/
e\000/'[$i++];)echo$c>_?str_pad("",ord($c)^96):strtr($c,[_____,"\
"]);

Try it online!
PHP, 165 bytes
<?=strtr("5566666
57/3334
5 13552513352713332 13355 213335 2433335 0 433355 0743333054333505 476666_ 057466666/",[" /
","/  /","\  \
","     ","\\","   ",___,"  "]);

Try it online!

///, 152 bytes
/,/  //'/\\!!!//&/\\"\\
//%/\/"\/!!//#/_____//"/,\\//!/,, /! ###
!\/!!!\\
,"% \& "% "&"%!\& \%!"&\%!,"&\'!!\/
 \'! "/
"'! \/
 "',"/
,"\,##___"/
!\\###\/

Try it online!

MATL, 58 55 bytes
'/__\ '7XyP9BY+3l7:14&(6Xy_3TF_5M&(&v0'Zj'(t2&P_h)[]9Z(

Try it online!

Pyth, 111 bytes
J\/K\\+*6d*15\_+++*5dJ*15dKV5+++*-5hNd"/  /"*+yN11d+++KddK)V4+++*NdK*-25yNdJ)+++++*4dK*2d*13\_*2dJ+++*5dK*15\_J

This code basically prints the lines one after another (in the naive way of doing it). Yeah it sucks, but right now I'm in no state of doing better, and I too still wanted to pay tribute to HyperNeutrino.
Try it online!

Python 2, 154 138 bytes
print'eNp10MEJAEEIA8C/VaSDNBTY/rtYlByci+aZER8BMqcnqiR6FG7/IPd87w0c/pQMYBrFJmxhQDstljJSQUrb5euhZzBe6PI3aQ=='.decode('base64').decode('zip')

Try it online!

C# (.NET Core), 169 bytes
var d=new char[364];for(int i=10;i-->0;)for(int j="ppnggffggn"[i]-97;j-->0;)d[28*"amlhbccbha"[i]+"ggh{fguva|"[i]-2813+j*("b|~}"[i/3]-97)]="_/\\\n"[i/3];Console.Write(d);

Ungolfed:
var d = new char[364];
for (int i = 10; i-- > 0; )
    for (int j = "ppnggffggn"[i] - 97; j-- > 0; )
        d[28 * "amlhbccbha"[i] + "ggh{fguva|"[i] - 2813 + j * ("b|~}"[i / 3] - 97)] = "_/\\\n"[i / 3];
Console.Write(d);

For each stroke I encoded the start position, length, character used, and direction within various strings. I saved a few bytes by grouping up similar strokes.
Sadly, this prints a little weird in tio. This is because I'm not printing out real spaces. Looks fine in my console, though. So probably this submission doesn't count. Here's the link anyways.
Try it online! (fake spaces 169 bytes)
Try it online! (real spaces 191 bytes)

Bubblegum, 67 54 bytes
00000000: 55c9 310d 0040 0804 c1fe 55e0 0043 24f8  U.1..@....U..C$.
00000010: 77f1 c955 cc96 3b95 d65e 6697 4d76 0b93  w..U..;..^f.Mv..
00000020: cf06 f847 0448 d1e6 0ceb 5722 8421 1010  ...G.H....W".!..
00000030: d95b 7e60 ad3f                           .[~`.?

Try it online!

SOGL V0.12, 53 52 bytes
/↕Υ¦‛¾}`¼Pσ↕ΗΦ▒∙⌠N►4┼ΥjΠ⌡jOT?»m,┌∆Χ⁶↑┌≠Γ‽‼║%Ν□‘7«n╬⁷

Try it Here!

Python 2, 187 bytes
a=`int("7YSUQZDJS0I3J2QJ40G9WNPIRBTBC1KF0F3X5WDMBW8CG5BVDHBJQ71V3UHCSY3TR8LC4IIEE5SZ",36)`[:-1]
for i in"0666666_!6__!5/!3\\!9\n!844!422!211!1 ".split("!"):a=a.replace(i[0],i[1:])
print a

Try it online!

C (gcc), 200 bytes
char o[28];i,j,k,p;f(){for(k=0;k<39;puts(o))for(memset(o,k&&k<32?32:95,27),i=3;i--;k++)for(j=3;j--;o[24-i*3+j]=" _\\/"[p])o[i*3+2-j]=" _/\\"[p="U@@@B@HH@``@@BB@HH@``@@p@@L@@C@p@EL@UC@"[k]-64>>j*2&3];}

Try it online!

Deadfish~, 872 bytes
{iii}iicccccc{iiiiii}iii{c}ccccc{{d}ii}dddddc{ii}iiccccc{i}iiiiic{d}ddddd{c}ccccc{iiiiii}c{{d}ii}ddc{ii}iicccc{i}iiiiic{d}dddddcc{i}iiiiic{d}ddddd{c}c{iiiiii}c{dddddd}cc{iiiiii}c{{d}ii}ddc{ii}iiccc{i}iiiiic{d}dddddcc{i}iiiiic{d}ddddd{c}ccc{iiiiii}c{dddddd}cc{iiiiii}c{{d}ii}ddc{ii}iicc{i}iiiiic{d}dddddcc{i}iiiiic{d}ddddd{c}ccccc{iiiiii}c{dddddd}cc{iiiiii}c{{d}ii}ddc{ii}iic{i}iiiiic{d}dddddcc{i}iiiiic{d}ddddd{c}ccccccc{iiiiii}c{dddddd}cc{iiiiii}c{{d}ii}ddc{iiii}dddc{d}dddddcc{i}iiiiic{d}ddddd{c}ccccccccc{iiiiii}c{dddddd}cc{iiiiii}c{{d}ii}ddc{{i}dd}iic{dddddd}{c}{c}ccccc{i}iiiiic{dddd}iiic{ii}iic{iiiiii}c{dddddd}{c}{c}ccc{i}iiiiic{dddd}iiic{ii}iicc{iiiiii}c{dddddd}{c}{c}c{i}iiiiic{dddd}iiic{ii}iiccc{iiiiii}c{dddddd}{c}ccccccccc{i}iiiiic{dddd}iiic{ii}iicccc{iiiiii}c{dddddd}cc{iiiiii}iii{c}ccc{dddddd}dddcc{i}iiiiic{dddd}iiic{ii}iiccccc{iiiiii}ciii{c}ccccc{ddddd}iic

Try it online!

Vyxal, 45 bytes
»R√UǏ8x⟑9↓ḋSŀ«+Ġ↵‡⊍6-}h≥kẇ⊍ḣW£»`/ _\,`τ⌐øŀ⁋øM

Try it Online!


text:
Who owes who money?
The Dank Memes Casino is one of the best casinos of the world. They have a rule that if you win or lose money, you will be paid at the beginning of the next month.
But, catastrophe struck and there was an earthquake, which demolished the casino.
Now, all the poker players have gathered and realised that the casino is not the person that owes them money or they do not owe the casino money, but as a matter of fact, they owe each other!
Your mission, should you choose to accept, will be to find out who owes who money.
Also, do keep in mind that the shortest code wins.
Input
The first line contains the names of the people separated by spaces (Let there be n names).
The second line contains n integers, the ith of which denotes the ith person's winnings or losings at poker. A positive number means that he is owed money from someone, whereas a negative number entails that he owes someone money.
Flexible input methods are accepted.
Output
Print out as many lines as required.
Each line should contain the name of the person who owes the money, the name of the person who is owed money, the amount of money that is owed separated by a space.
Input Constraints
2 <= n <= 6
-100000 <= amount of money <= 100000
Guaranteed Constraints
Sum of all integers in the array = 0
Sample Test Cases
Test Case 1
Sample Input
Messi Ronaldo Hazard Ibrahimovich
1000 1000 -2000 0

Sample Output
Hazard Messi 1000
Hazard Ronaldo 1000

Test Case 2
Sample Input
Maradona Pele
20000 -20000

Sample Output
Pele Maradona 20000

Test Case 3
Sample Input
A B C D E
1 1 1 1 -4

Sample Output
E A 1
E B 1
E C 1
E D 1

Test Case 4
Sample Input
A B C D E F
3 3 1 2 -4 -5

Sample Output
F D 2
F C 1
F B 2
E B 3
E B 1
E A 3

Clarification
There may be multiple answers, anyone of them will be accepted.
For example:
A B C
1 1 -2

can yield both of the following:
C A 1
C B 1

or
C B 1
C A 1

both are correct.

What if multiple people have debts? Do the payments need to be equally distributed?

The sum of all debts is equal to 0, so if multiple people have debts, they will owe someone else in the group of people

What if it's A: 2, B: 2, C: 2, D: -3, E: -3? Also, does input have to be that strict?

@HyperNeutrino- look at test case 4. I just added it. also, how else do you want to take input?

Typiclly, we allow for much more relaxed input; in this case, normally we would allow to take input as key-value pairs in the language's implementation; normally, functions are allowed in place of programs. Ultimately it's the challenger's decision but that's typically what happens.

Your fourth test case does not clarify the exact algorithm used. Is it attributing debt to the most in-debt person first and filling in some particular order?

I see no issues with making the input flexible.
And coming to your test case,
A B C D E
2 2 2 -3 -3
will yield
E C 2
E B 1
D B 1
D A 2

Let us continue this discussion in chat.

No negotiation on the output format. -1, most competitive entries will want to return a list of strings from a function

@StephenS you can read HyperNeutrino's comment above. The input output is upto the challenger. It's not about what most people want. I made the input flexible, but doing that to the output will in some cases ruin the basic readability. So if you have to give a -1, that's totally on you. Don't pin this on most competitive entries.

"readability" ...This is Code Golf. "Readability" is meaningless here.

I hope the strictness in outputs are just discouraged not completely boycotted, otherwise there would be no meaning of specifiying output requirements.

@officialaimm for code-golf, a good challenge will specify what the data is (truthy/falsey, an number, a string, a list), not the format ("true" or "false", "must have 0 before . even if your language doesn't", "must be strings separated by newlines, cannot return a list")

Oh, I see. that makes sense. Thanks @StephenS

There's some notion of "standard forms of output" and an array of strings (as opposed to displayed characters) tends to be an accepted format. I can't find the meta post on it at the moment.

I removed the strictness on the output format. Feel free to output in any format as long as it is understandable

Some meta posts about string output. https://codegolf.meta.stackexchange.com/a/7371/47990 https://codegolf.meta.stackexchange.com/a/2456/47990 https://codegolf.meta.stackexchange.com/a/2453/47990 (those second two are the same question and there's some other useful answers there too).

Python 2, 146 bytes
def f(p,b):
	a=sorted(zip(b,p))
	while a:
		d,D,c,C=a[0]+a[-1];t=d+c;a[0]=(t,D);a[-1]=(t,C);a=a[t>=0:[len(a),-1][t<=0]]
		if d:print D,C,min(-d,c)

Try it online!

Python 3, 173 bytes
a=lambda:input().split()
m={x:int(y)for x,y in zip(a(),a())}
l=lambda k:m[k]
while any(map(l,m)):d=min(m,key=l);s=max(m,key=l);t=min(m[s],-m[d]);m[d]+=t;m[s]-=t;print(d,s,t)

Try it online!
-6 bytes thanks to ppperry using dictcomps instead of dict of a listcomp

You can save five bytes by converting the second line to a dictcomp: m={x:int(y)for x,y in zip(a(),a()))}

@ppperry I did not know that works :o thanks!

@HyperNeutrino has anyone ever told you how awesome you are?

@KoishoreRoy hm?

source: Stack Exchange

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

sort: votes


text:
Proper Divisor mash-up
A proper divisor is a divisor of a number n, which is not n itself. For example, the proper divisors of 12 are 1, 2, 3, 4 and 6.
You will be given an integer x, x ≥ 2, x ≤ 1000. Your task is to sum all the highest proper divisors of the integers from 2 to x (inclusive) (OEIS A280050).
Example (with x = 6):

Find all the integers between 2 and 6 (inclusive): 2,3,4,5,6.

Get the proper divisors of all of them, and pick the highest ones from each number:

2 -> 1
3 -> 1
4 -> 1, 2
5 -> 1
6 -> 1, 2, 3.

Sum the highest proper divisors: 1 + 1 + 2 + 1 + 3 = 8.

The final result is 8.

Test Cases

Input  |  Output
-------+---------
       |
 2     | 1
 4     | 4
 6     | 8
 8     | 13
 15    | 41
 37    | 229
 100   | 1690
 1000  | 165279

Rules

Default Loopholes apply.

You can take input and provide output by any standard method.

This is code-golf, the shortest valid submission in each language wins! Have Fun!

Sandbox.

If you're going to sandbox something, leave it in there for more than two hours.

@PeterTaylor I sandboxed the post only to receive feedback, because this is a very simple challenge which I would usually not post in the sandbox at all. BTW thanks for the edit.

Oasis, 4 bytes
Code:
nj+U

Try it online!
Explanation:
Extended version:
nj+00

    0   = a(0)
   0    = a(1)

a(n) =

n       # Push n
 j      # Get the largest divisor under n
  +     # Add to a(n - 1)

Brachylog, 10 bytes
⟦bb{fkt}ᵐ+

Try it online!

You have clearly won this in all languages so far :))

-2

Pyth, 13 9 8 bytes
1 byte thanks to jacoblaw.
tsm*FtPh

Test suite.
How it works
The largest proper divisor is the product of the prime factors except the smallest one.

8 bytes

Python 2, 50 bytes
f=lambda n,k=2:n/k and(f(n,k+1),n/k+f(n-1))[n%k<1]

This is slow and can't even cope with input 15 on TIO.
Try it online!
However, memoization (thanks @musicman523) can be used to verify all test cases.
Try it online!
Alternate version, 52 bytes
At the cost of 2 bytes, we can choose whether to compute f(n,k+1) or n/k+f(n-1).
f=lambda n,k=2:n>1and(n%k and f(n,k+1)or n/k+f(n-1))

With some trickery, this works for all test cases, even on TIO.
Try it online!

Since f is a pure function, you can memoize it to run the larger cases on TIO

Right, not being able to use a decorator threw me off. Thanks!

Husk, 7 bytes
ṁȯΠtptḣ

Try it online!
Explanation
Husk has no built-in for computing the divisors directly (yet), so I'm using prime factorization instead.
The largest proper divisor of a number is the product of its prime factors except the smallest one.
I map this function over the range from 2 to the input, and sum the results.
ṁȯΠtptḣ  Define a function:
      ḣ  Range from 1 to input.
     t   Remove the first element (range from 2).
ṁ        Map over the list and take sum:
 ȯ        The composition of
    p     prime factorization,
   t      tail (remove smallest prime) and
  Π       product.

Jelly, 6 bytes
ÆḌ€Ṫ€S

Try it online!
How it works
ÆḌ€Ṫ€S
ÆḌ€    map proper divisor (1 would become empty array)
           implicitly turns argument into 1-indexed range
   Ṫ€  map last element
     S sum

Haskell, 48 46 43 bytes
f 2=1
f n=until((<1).mod n)pred(n-1)+f(n-1)

Try it online!
Edit: @rogaos saved two bytes. Thanks!
Edit II: ... and @xnor another 3 bytes.

-2 bytes: f 2=1 f n=last[d|d<-[1..n-1],mod n d<1]+f(n-1)

@rogaos: Thanks! I've tried the explicit recursion myself, but didn't remove sum, so I thought it isn't shorter.

until saves some more: until((<1).mod n)pred(n-1)+f(n-1)

JavaScript (ES6), 40 bytes

f=(n,i=2)=>n<2?0:n%i?f(n,i+1):n/i+f(n-1)
<input type=number oninput=o.textContent=f(this.value)><pre id=o>

A number equals the product of its highest proper divisor and its smallest prime factor.

stack overflows for n>352(at least in this snippet, dont know if it is my browser/machine dependency) while you are supposed to support at least upto n=1000.

@officialaimm It works for n=1000 if you use e.g. node --stack_size=8000.

MATL, 12 bytes
q:Q"@Z\l_)vs

Try it at MATL Online
Explanation
        % Implicitly grab input (N)
q       % Subtract one
:       % Create an array [1...(N-1)]
Q       % Add one to create [2...N]
"       % For each element
  @Z\   % Compute the divisors of this element (including itself)
  l_)   % Grab the next to last element (the largest that isn't itself)
  v     % Vertically concatenate the entire stack so far
  s     % Sum the result

Japt, 8+2=10 8 6 bytes
òâ1 xo

Test it

1 byte saved thanks to ETHproductions.

Explanation
    :Implicit input of integer U.
ò   :Generate an array of integers from 1 to U, inclusive
â   :Get the divisors of each number,
1   :  excluding itself.
x   :Sum the main array
o   :by popping the last element from each sub-array.
    :Implicit output of result

Note that -x counts as two bytes according to this post. However, I think you can save a byte with ò2_â1 o (â excludes the original number when given an argument)

Thanks, @ETHproductions; I'd missed both those things. I wonder does that apply retroactively to all solutions where we counted flags as 1 byte? I was working up an alternative solution that didn't use a flag anyway; pointing out â's argument got me the saving I was looking for.

I would assume so, since we weren't really following a consensus before. BTW, I had been playing with õ Å before and found a couple 8- and 9-byters: õ Åx_/k g, õ Åx_k Å×, õ Åx_â¬o. And by combining õ and Å with your genius xo trick I found a 7-byte solution :-)

@ETHproductions note that this is not the consensus anymore. Flags do not count towards the byte count.

Retina, 31 24 bytes
7 bytes thanks to Martin Ender.
.+
$*
M!&`(1+)(?=\1+$)
1

Try it online!
How it works
The regex /^(1+)\1+$/ captures the largest proper divisor of a certain number represented in unary. In the code, the \1+ is turned to a lookahead syntax.

05AB1E, 9 8 bytes
-1 Byte thanks to Leaky Nun's prime factor trick in his Pyth answer
L¦vyÒ¦PO

Try it online!
Explanation
L¦vyÒ¦PO
L¦       # Range [2 .. input]
  vy     # For each...
    Ò¦    # All prime factors except the first one
      P   # Product
       O  # Sum with previous results
         # Implicit print

Alternative 8 Byte solution (That doesnt work on TIO)
L¦vyÑ¨θO

and ofc alternative 9 Byte solution (That works on TIO)
L¦vyÑ¨®èO

Python 2 (PyPy), 73 71 70 bytes
n=input();r=[0]*n;d=1
while n:n-=1;r[d+d::d]=n/d*[d];d+=1
print sum(r)

Not the shortest Python answer, but this just breezes through the test cases. TIO handles inputs up to 30,000,000 without breaking a sweat; my desktop computer handles 300,000,000 in a minute.
At the cost of 2 bytes, the condition n>d could be used for a ~10% speed-up.
Thanks to @xnor for the r=[0]*n idea, which saved 3 bytes!
Try it online!

Funny, I just wrote basically the same code.

l=[0]*n should allow you to get rid of -2. exec kinda kills the speed, but even a while loop would be shorter than my approach.

This seems to be marginally faster than my approach. Mind if I edit that into my answer?

Please, go for it.

@Dennis This would have totally won a [tag:fastest-code] challege

@Mr.Xcoder Not in PyPy, but yes, sieves do fine for this kind of problem.

@Mr.Xcoder Challenge accepted!

Mathematica, 30 bytes
Divisors[i][[-2]]~Sum~{i,2,#}&

PHP, 56 bytes
for($i=1;$v||$argn>=$v=++$i;)$i%--$v?:$v=!$s+=$v;echo$s;

Try it online!

Prolog (SWI), 72 bytes
f(A,B):-A=2,B=1;C is A-1,f(C,D),between(2,A,E),divmod(A,E,S,0),B is D+S.

Try it online!

C# (.NET Core), 74 72 bytes
n=>{int r=0,j;for(;n>1;n--)for(j=n;--j>0;)if(n%j<1){r+=j;j=0;}return r;}

Try it online!

2 bytes shaved thanks to Kevin Cruijssen.

I know it's been about a year, but you can golf break to j=0.

@KevinCruijssen a very simple but effective trick. Nice idea!

Cubix, 27 39 bytes
?%\(W!:.U0IU(;u;p+qu.@Op\;;

Try it online!
Cubified
      ? % \
      ( W !
      : . U
0 I U ( ; u ; p + q u .
@ O p \ ; ; . . . . . .
. . . . . . . . . . . .
      . . .
      . . .
      . . .

Watch It Run

0IU Set up the stack with an accumulator, and the starting integer.  U-turn into the outer loop
:(? duplicate the current top of stack, decrement and test
\pO@ if zero loop around the cube to a mirror, grab the bottom of stack, output and halt
%\! if positive, mod, relect and test.

u;.W if truthy, u-turn, remove mod result and lane change back into inner loop
U;p+qu;;\( if falsey, u-turn, remove mod result, bring accumulator to top, add current integer (top) divisor push to bottom and u-turn. Clean up the stack to have just accumulator and current integer, decrement the integer and enter the outer loop again.

Python 3, 69 63 59 bytes
4 bytes thanks to Dennis.
f=lambda n:n-1and max(j for j in range(1,n)if n%j<1)+f(n-1)

Try it online!
I set the recursion limit to 2000 for this to work for 1000.

+1 You have my brownie points! That's the solution I was talking about when saying "shorter than 70 bytes"...

Also, this works in Python 2 as well

Actually, 12 bytes
u2x⌠÷R1@E⌡MΣ

Try it online!

Python 3, 78 75 73 71 bytes
Not even close to Leaky nun's python answer in byte count.
f=lambda z:sum(max(i for i in range(1,y)if 1>y%i)for y in range(2,z+1))

Try it online!

You're getting close to the first revision of my answer... you can check my editing history.

Oh, haha... I swear I did not steal it... :)

NewStack, 5 bytes
Luckily, there's actually a built in.
Nᵢ;qΣ

The breakdown:
Nᵢ       Add the first (user's input) natural numbers to the stack.
  ;      Perform the highest factor operator on whole stack.
   q     Pop bottom of stack.
    Σ    Sum stack.

In actual English:
Let's run an example for an input of 8.
Nᵢ: Make list of natural numbers from 1 though 8: 1, 2, 3, 4, 5, 6, 7, 8
;: Compute the greatest factors: 1, 1, 1, 2, 1, 3, 1, 4
q. Remove the first element: 1, 1, 2, 1, 3, 1, 4
Σ And take the sum: 1+1+2+1+3+1+4 = 13

1+1+2+1+3+1+4 = 13 not 8. Apart from that: great answer so +1.

@KevinCruijssen Whoops, thanks for catching that!

Java 8, 78 74 72 bytes
n->{int r=0,j;for(;n>1;n--)for(j=n;j-->1;)if(n%j<1){r+=j;j=0;}return r;}

Port of @CarlosAlejo's C# answer.
Try it here.
Old answer (78 bytes):
n->{int r=0,i=1,j,k;for(;++i<=n;r+=k)for(j=1,k=1;++j<i;k=i%j<1?j:k);return r;}

Try it here.
Explanation (of old answer):
n->{                    // Method with integer parameter and integer return-type
  int r=0,              //  Result-integers
      i=1,j,k;          //  Some temp integers
  for(;++i<=n;          //  Loop (1) from 2 to `n` (inclusive)
      r+=k)             //    And add `k` to the result after every iteration
    for(j=1,k=1;++j<i;  //   Inner loop (2) from `2` to `i` (exclusive)
      k=i%j<1?j:k       //    If `i` is dividable by `j`, replace `k` with `j`
    );                  //   End of inner loop (2)
                        //  End of loop (2) (implicit / single-line body)
  return r;             //  Return result-integer
}                       // End of method

Pari/GP, 36 30 bytes
n->sum(i=2,n,i/divisors(i)[2])

Try it online!

Charcoal, 37 bytes
Ａ⁰βＦ…·²Ｎ«Ａ⟦⟧δＦ⮌…¹ι«¿¬﹪ικ⊞δκ»Ａ⁺β⌈δβ»Ｉβ

Try it online!
Link is to the verbose version. It took me almost all day to figure out how could I solve a non-ASCII-art-related question in Charcoal, but finally I got it and I am very proud of me. :-D
Yes, I am sure this can be golfed a lot. I just translated my C# answer and I am sure things can be done differently in Charcoal. At least it solves the 1000 case in a couple of seconds...

Python 2 (PyPy), 145 bytes
Because turning code-golf competitions into fastest-code competitions is fun, here is an O(n) algorithm that, on TIO, solves n = 5,000,000,000 in 30 seconds.  (Dennis’s sieve is O(n log n).)
import sympy
n=input()
def g(i,p,k,s):
 while p*max(p,k)<=n:l=k*p;i+=1;p=sympy.sieve[i];s-=g(i,p,l,n/l*(n/l*k+k-2)/2)
 return s
print~g(1,2,1,-n)

Try it online!
How it works
We count the size of the set
S = {(a, b) | 2 ≤ a ≤ n, 2 ≤ b ≤ largest-proper-divisor(a)},
by rewriting it as the union, over all primes p ≤ √n, of
Sp = {(p⋅d, b) | 2 ≤ d ≤ n/p, 2 ≤ b ≤ d},
and using the inclusion–exclusion principle:
|S| = ∑ (−1)m − 1 |Sp1 ∩ ⋯ ∩ Spm| over m ≥ 1 and primes p1 < ⋯ < pm ≤ √n,
where
Sp1 ∩ ⋯ ∩ Spm = {(p1⋯pm⋅e, b) | 1 ≤ e ≤ n/(p1⋯pm), 2 ≤ b ≤ p1⋯pm − 1e},
|Sp1 ∩ ⋯ ∩ Spm| = ⌊n/(p1⋯pm)⌋⋅(p1⋯pm − 1⋅(⌊n/(p1⋯pm)⌋ + 1) − 2)/2.
The sum has C⋅n nonzero terms, where C converges to some constant that’s probably 6⋅(1 − ln 2)/π2 ≈ 0.186544.  The final result is then |S| + n − 1.

Oooh, that's fast...

Thunno 2 -S, 5 bytes
ı⁺FṫG

Try it online!
Explanation
ı⁺FṫG  # Implicit input
       # Decrement the input
ı      # Map over [1..input-1]:
 ⁺     #  Increment the number
  Fṫ   #  Push the proper divisors
    G  #  Maximum of this list
       # Sum the list
       # Implicit output

Arturo, 32 bytes
$=>[∑map..2&=>[x:do factors&]]

Try it!

Lua, 74 bytes
c=0 for i=2,...do for j=1,i-1 do t=i%j<1 and j or t end c=c+t end print(c)

Try it online!

J, 18 bytes
[:+/1}.&.q:@+}.@i.

Try it online!

Stacked, 31 bytes
[2\|>[divisors:pop\MAX]map sum]

Try it online! (All testcases except for 1000, which exceeds the 60 second online time limit.)
Explanation
[2\|>[divisors:pop\MAX]map sum]
 2\|>                               range from 2 to the input inclusive
     [                ]map          map this function over the range
      divisors                      get the divisors of the number (including the number)
              :pop\                 pop a number off the array and swap it with the array
                   MAX              gets the maximum value from the array
                           sum      sum's all the max's

C (gcc), 53 bytes
x;s;f(n){for(s=0;n>1;--n){for(x=n;n%--x;);s+=x;}n=s;}

Try it online!
Comfortably an quickly passes all test cases.

51 bytes

Perl 6, 36 bytes
{sum map {max grep $_%%*,^$_},2..$_}

Test it
Expanded:
{
  sum
    map
    {
      max
        grep
        $_ %% *, # is the input to this block divisible by
        ^$_      # Range of possible divisors
    },
    2 .. $_
}

Alice, 17 bytes
/o
\i@/&w!qB;?+]k

Try it online!
Explanation
This is a standard format for a program which takes input as an integer, outputs an integer, and does everything else in cardinal mode.
The program tries to add up the highest proper divisor of every number from 0 to n.  In the case of 0 and 1, the number added comes from the implicit zeros on the stack, so we don't have to bother skipping these cases.
i    Take input string (in ordinal mode)
&w   Implicitly convert into an integer, and push a return address n times.
     This starts the main loop, which will run a total of n+1 times.
!    Store the accumulator on the current tape cell.
q    Get the tape position. (initially zero)
B    Compute all divisors.
;    Remove the top of the stack (the number itself).
?    Copy accumulator back from tape.
+    Add to greatest proper divisor.
]    Move tape right.
k    Return to pushed return address.  The (n+1)st time through this loop,
     there is nowhere to return to, and the program continues.
o    Output the integer (as a string in ordinal mode).
@    Terminate.

Neim, 7 bytes
Γ)

Explanation:
Example input: 6
        Inclusive range [1 .. input]
         stack: [1 2 3 4 5 6]
 Γ       For each...
          Get factors
           stack: [[1] [1 2] [1 3] [1 2 4] [1 5] [1 2 3 6]]
          Remove last element
           stack: [[] [1] [1] [1 2] [1] [1 2 3]]
          Get greatest element
           stack: [0 1 1 2 1 3]
      )  End for each
        Sum.
         stack: [8]
Implicit output: 8

Try it!

APL (Dyalog Unicode), 25 bytes
Lack of builtins is sad.
+/((⌈/∘⍸0=g|⊢)¨1+g←⍳1-⍨⊢)

Alternative dfn version: {+/{⌈/⍸0=⍵|⍨⍳1-⍨⍵}¨1+⍳1-⍨⍵}
Explanation:
+/((⌈/∘⍸0=g|⊢)¨1+g←⍳1-⍨⊢)
                 g←⍳1-⍨⊢   ⍝ numbers from 1 to ⍵-1 - define as `g`
               1+          ⍝ increment: numbers from 2 to ⍵.
              ¨            ⍝ for each of these...
        0=g|⊢              ⍝ mark evenly divisible indexes with 1
    ⌈/∘⍸                   ⍝ pick largest of proper divisors
+/                         ⍝ sum all

Try it online!

K (ngn/k), 21 20 bytes
+/{|/&~1!x%!x}'2_!1+

Try it online!

2_!1+ generate integers in range 2..x
{|/&~1!x%!x}' get largest divisor for each value in generated range
+/ take the sum

Perl 5 -MList::Util=max -p, 42 bytes
//,$\+=max grep$'%$_==0,1..$_-1for 2..$_}{

Try it online!

Vyxal s, 27 bitsv2, 3.375 bytes
ƛKṪt

Try it Online!
Explained
ƛKṪt
ƛ     # To each number 1..n
 KṪ   # Push the divisors of each number with that number removed
   t  # And get the last divisor remaining. Returns 0 on an empty list

Created with the help of Luminespire.

Charcoal, 22 bytes
ＩＬ⪫Ｅ…·²Ｎ×⌈Ｅ…¹ι⎇﹪ιλ⁰λ1ω

Try it online! Link is to verbose version of code. Explanation:
      ²                 Literal 2
       Ｎ                Input number
    …·                  Inclusive range
   Ｅ                    Map with variable `i`
            ¹           Literal 1
             ι          Variable `i`
           …            Exclusive range
          Ｅ             Map with variable `l`
                ι       Variable `i`
                 λ      Variable `l`
               ﹪        Modulo
              ⎇         Ternary
                  ⁰     If nonzero then zero
                   λ    If zero then variable `l`
         ⌈              Take the maximum
                    1   Arbitrary character
        ×               Repeat it
  ⪫                  ω  Join the strings together
 Ｌ                      Take the length
Ｉ                       Cast to string
                        Implicitly print

The Sum function has been added since the question was asked, reducing the code to 18 bytes:
ＩΣＥ…·²Ｎ⌈Ｅ…¹ι⎇﹪ιλ⁰λ

R, 53 bytes
function(n){for(i in 2:n)F=F+(y=(i-1):1)[!i%%y][1]
F}

Try it online!
For each integer i in 2...n, computes the divisors of i in decreasing order with (y=(i-1):1)[!i%%y] and then selects the first, as that will be the largest, adding it to F, which is by default initialized to FALSE or 0.

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:
Plant trees on a golf course!
This challenge is inspired by this app.

This is a much easier version of this challenge. This challenge is code-golf, while the other one is fastest-code.

You'll be given a square input grid, of dimensions 6-by-6 which is divided into 6 areas, where the cells of each area have a unique identifier (I'll use lower case letters from a-f in the the text here, but you may choose whatever you like, for instance integers 1-6).
The input may look like this (optional input format):
aabbbb
aabbbb
aaccbb
acccdb
ecccdb
eeefff

Or, easier to visualize:

Challenge:
You are to place 6 trees in this park, according to the following rules:

There shall be exactly 1 tree per column, and 1 tree per row
All areas shall have exactly 1 tree.
No trees can be adjacent to another tree, vertically, horizontally or diagonally

The solution to the layout above is:

Note: There is only one solution to each puzzle
Additional rules:

The input and output formats are optional

The output might for instance be a list of indices, a grid with 1/0 indicating if there's a tree in that position, or a modified version of the input where the trees are indicated

The execution time must be deterministic
The program must finish within 1 minute on a reasonable modern laptop
Brownie points if you don't brute force!

Test cases:
aabbbb
aabbbb
aaccbb
acccdb
ecccdb
eeefff
---
aAbbbb
aabbbB
aaCcbb
acccDb
Ecccdb
eeeFff
----------
aabccc
aacccc
aaddce
aeeeee
aeeefe
eeeeee
---
aaBccc
aacccC
aadDce
Aeeeee
aeeeFe
eEeeee
----------
aaaabb
aacbbb
aadddb
addeef
ddddee
dddeee
---
aaaaBb
aaCbbb
Aadddb
addeeF
dDddee
dddEee
----------
abbbcd
abebcd
addddd
dddddd
effdff
eeffff
---
abBbcd
abebCd
Addddd
dddDdd
effdfF
eEffff

Same test cases on a format that's a bit easier to parse:
Test case 1:
[1,1,2,2,2,2;1,1,2,2,2,2;1,1,3,3,2,2;1,3,3,3,4,2;5,3,3,3,4,2;5,5,5,6,6,6]
Test case 2:
[1,1,2,3,3,3;1,1,3,3,3,3;1,1,4,4,3,5;1,5,5,5,5,5;1,5,5,5,6,5;5,5,5,5,5,5]
Test case 3:
[1,1,1,1,2,2;1,1,3,2,2,2;1,1,4,4,4,2;1,4,4,5,5,6;4,4,4,4,5,5;4,4,4,5,5,5]
Test case 4:
[1,2,2,2,3,4;1,2,5,2,3,4;1,4,4,4,4,4;4,4,4,4,4,4;5,6,6,4,6,6;5,5,6,6,6,6]

Sounds like a sudoku solver but different.

C, 223 182 bytes
O[15],U;main(y,v)char**v;{if(y>7)for(;y-->2;printf("%06o\n",O[y]));else for(int*r,x=1,X=8;X<14;U&x|*r|O[10-y]*9&x*9?0:(U^=O[9-y]=*r=x,*r=main(y+1,v),U^=x),x*=8)r=O+v[1][y*7-++X]-88;}

Takes input as an argument in the format given in the question. Writes output to stdout as a grid of 0s with 1s where the trees go.
./TreesMin 'aabbbb
aabbbb
aaccbb
acccdb
ecccdb
eeefff'

Sample output:
010000
000001
001000
000010
100000
000100

Breakdown
O[15],                                  // Tree positions & region usage
U;                                      // Column usage (bitmask)
main(y,v)char**v;{                      // Recursive main function
  if(y>7)                               // Finished grid?
    for(;y-->2;printf("%06o\n",O[y]));  //  Print it (rows are padded octal)
  else                                  // Not finished:
    for(int*r,x=1,X=8;X<14;             //  Loop over columns
      U&x|*r|O[10-y]*9&x*9              //   Current cell violates rules?
        ?0                              //    Do nothing
        :(U^=O[9-y]=*r=x,               //   Else: mark cell
          *r=main(y+1,v),               //    Recurse
          U^=x)                         //    Unmark cell
      ,x*=8)                            //   Advance to next column
      r=O+v[1][y*7-++X]-88;             //   Region pointer for current iteration
}

It's an adaptation of my answer to the fastest-code version of this question. Doesn't have as much short-circuiting, but it's plenty fast enough for 6x6 grids.

Clingo, 66 bytes
1{t(X,Y):c(X,Y,Z)}:-Z=1..n.:-t(X,Y),2{t(X,J;I,Y;X-1..X+1,Y..Y+1)}.

Run with clingo plant.lp - -c n=<n> where <n> is the grid size.  The input format is a list of c(X,Y,Z). statements for each cell (X, Y) colored Z, with 1 ≤ X, Y, Z ≤ n, separated by optional whitespace.  The output includes t(X,Y) for each tree at (X, Y).
Demo
$ clingo plant.lp - -c n=6 <<EOF
> c(1,1,1). c(2,1,1). c(3,1,2). c(4,1,2). c(5,1,2). c(6,1,2).
> c(1,2,1). c(2,2,1). c(3,2,2). c(4,2,2). c(5,2,2). c(6,2,2).
> c(1,3,1). c(2,3,1). c(3,3,3). c(4,3,3). c(5,3,2). c(6,3,2).
> c(1,4,1). c(2,4,3). c(3,4,3). c(4,4,3). c(5,4,4). c(6,4,2).
> c(1,5,5). c(2,5,3). c(3,5,3). c(4,5,3). c(5,5,4). c(6,5,2).
> c(1,6,5). c(2,6,5). c(3,6,5). c(4,6,6). c(5,6,6). c(6,6,6).
> EOF
clingo version 5.1.0
Reading from plant.lp ...
Solving...
Answer: 1
c(1,1,1) c(2,1,1) c(3,1,2) c(4,1,2) c(5,1,2) c(6,1,2) c(1,2,1) c(2,2,1) c(3,2,2) c(4,2,2) c(5,2,2) c(6,2,2) c(1,3,1) c(2,3,1) c(3,3,3) c(4,3,3) c(5,3,2) c(6,3,2) c(1,4,1) c(2,4,3) c(3,4,3) c(4,4,3) c(5,4,4) c(6,4,2) c(1,5,5) c(2,5,3) c(3,5,3) c(4,5,3) c(5,5,4) c(6,5,2) c(1,6,5) c(2,6,5) c(3,6,5) c(4,6,6) c(5,6,6) c(6,6,6) t(1,5) t(2,1) t(6,2) t(3,3) t(5,4) t(4,6)
SATISFIABLE

Models       : 1+
Calls        : 1
Time         : 0.045s (Solving: 0.00s 1st Model: 0.00s Unsat: 0.00s)
CPU Time     : 0.000s

To make the input/output format easier to deal with, here are Python programs to convert from and to the format given in the challenge.
Input
import sys
print(' '.join("c({},{},{}).".format(x + 1, y + 1, ord(cell) - ord('a') + 1) for y, row in enumerate(sys.stdin.read().splitlines()) for x, cell in enumerate(row)))

Output
import re
import sys
for line in sys.stdin:
    c = {(int(x), int(y)): int(z) for x, y, z in re.findall(r'\bc\((\d+),(\d+),(\d+)\)', line)}
    if c:
        t = {(int(x), int(y)) for x, y in re.findall(r'\bt\((\d+),(\d+)\)', line)}
        n, n = max(c)
        for y in range(1, n + 1):
            print(''.join(chr(ord('aA'[(x, y) in t]) + c[x, y] - 1) for x in range(1, n + 1)))
        print()


text:
Knight-fill a grid
A knight fill is a flood fill using the connectivity of the knight chess piece. Specifically:
 1 1
1   1
  0
1   1
 1 1

(0 is the initial point, 1s show the connected cells)
Challenge
Given a 2D grid of spaces and walls, and an initial location, perform a knight-fill on the grid. Shortest code wins.
Rules

You may take input and produce output in any format you like (image, string, array, whatever). You may take the initial location as part of the input grid or as a separate coordinate. For the purpose of this explanation, the following format will be used:
########    # = wall
########    x = initial location
## x  ##
##    ##
########
##    ##
########
########

Output is a copy of the input grid with the knight-fill result added
Your fill must not be in the same "colour" as the space or walls, but can be the same as the initial location marker. For example given the image above, a valid output would be:
########    # = wall
########    @ = fill (could also have been x)
## @ @##
## @ @##
########
##@ @ ##
########
########

You may assume that the input grid will always contain a 2-cell wall on all sides
You may assume that the initial location will never be inside a wall
You may assume that the grid will never be larger than 1000x1000
Builtins are fine
Shortest code (in bytes) wins

Test Cases
In all test cases, # denotes a wall,  denotes empty space, and x denotes the initial location of the fill. @ denotes the output fill.
Input 1:

########
########
## x  ##
##    ##
########
##    ##
########
########

Output 1:

########
########
## @ @##
## @ @##
########
##@ @ ##
########
########

Input 2:

############
############
## ##    x##
## ##     ##
#####     ##
##        ##
############
############

Output 2:

############
############
## ##@@@@@##
##@##@@@@@##
#####@@@@@##
## @@@@@@@##
############
############

Input 3:

####################
####################
##  ##            ##
##  ##            ##
##  ##  ########  ##
##  ##  ########  ##
##  ##  ##    ##  ##
##  ##  ##    ##  ##
##  ##  ##    ##  ##
##  ##  ##    ##  ##
##  ##  ########  ##
##  ##  ########  ##
##  ##        ##  ##
##  ##       x##  ##
##  ############  ##
##  ############  ##
##                ##
##                ##
####################
####################

Output 3:

####################
####################
##@@##@@@@@@@@@@@@##
##@@##@@@@@@@@@@@@##
##@@##@@########@@##
##@@##@@########@@##
##@@##@@##    ##@@##
##@@##@@##    ##@@##
##@@##@@##    ##@@##
##@@##@@##    ##@@##
##@@##@@########@@##
##@@##@@########@@##
##@@##@@@@@@@@##@@##
##@@##@@@@@@@@##@@##
##@@############@@##
##@@############@@##
##@@@@@@@@@@@@@@@@##
##@@@@@@@@@@@@@@@@##
####################
####################

Input 4:

################
################
##           ###
##     x     ###
##  #######  ###
##  #######  ###
##  ##   ##  ###
##  ##   ##  ###
##  ##   ##  ###
##  ########  ##
##  ########  ##
##        ##  ##
##        ##  ##
################
################

Output 4:

################
################
##   @   @   ###
## @   @   @ ###
##  #######  ###
##@ ####### @###
##  ##   ##  ###
## @##   ##@ ###
##  ##   ##  ###
##@ ########@ ##
##  ########  ##
## @   @  ## @##
##   @   @##  ##
################
################

Input 5:

##############
##############
##         ###
##         ###
##         ###
##   ###   ###
##   #x#   ###
##   ###   ###
##         ###
##         ###
##         ###
##############
##############

Output 5:

##############
##############
##@@@@@@@@@###
##@@@@@@@@@###
##@@@@@@@@@###
##@@@###@@@###
##@@@#@#@@@###
##@@@###@@@###
##@@@@@@@@@###
##@@@@@@@@@###
##@@@@@@@@@###
##############
##############

Somewhat related.

Octave, 73 bytes
function a=F(s,a)do;b=a;until(a=~s&imdilate(a,de2bi(")0#0)"-31)))==b;a+=s

Online Demo!
*Some changes applied to run in rextester.
A function that takes a 2d array of 0 & 2 as wall and an array of 0 & 1 as initial location  and outputs an array of 0 & 1 & 2.

Looks good, but doesn't this need pkg load ... when run outside the test framework? If imdilate & de2bi are available without explicit imports then that's fine.

@Dave In previous versions of octave ,including the version installed in tio, it was possible to install a package so that it could load automatically but now I noticed that  this feature is removed from octave! please see this.

Fair enough. As long as you're targeting a version before -auto was removed it's no problem, and I'm guessing this answer doesn't use any new features.

JavaScript (ES6), 116 bytes

f=(s,l=s.search`
`,t=s.replace(eval(`/(x| )([^]{${l-2}}(....)?|[^]{${l+l}}(..)?)(?!\\1)[x ]/`),'x$2x'))=>s==t?s:f(t)

v=(s,l=s.search`
`)=>!/^(#+)\n\1\n[^]*x[^]*\n\1\n\1$/.test(s)|s.split`
`.some(s=>s.length-l|!/^##.+##$/.test(s))&&`Invalid Input`
textarea{font-family:monospace}
<textarea rows=11 cols=33 oninput=o.value=v(this.value)||f(this.value)></textarea><textarea rows=11 cols=33 id=o reaodnly></textarea>

Based on my answer to Detect Failing Castles. Fills using xs.

Can you add a test snippet/link?

Python 3, 394 387 381 356 352 347 319 313 154139 bytes

154 bytes after only counting the core function and not the function concerning I/O formatting
saved 7 bytes: thanks to @Jacoblaw and @Mr.Xcoder: except:0
saved 28 bytes!!!: Thanks to @ovs: got rid of try: except block and several other golf
Thanks to @Dave for the beautiful test module.
saved 6 bytes: g[(a,b)] as just g[a,b]
@nore saved 15 bytes!!!:

def x(g,a,b,m):
 if(a,b)in g and"!">g[a,b]or m:
  g[a,b]="@"
  for i in 1,2,-1,-2:
   for j in 3-abs(i),abs(i)-3:g=x(g,a+i,b+j,0)
 return g

Try it online!

can you do except:pass instead?

I am pretty sure that this can be heavily golfed

@jacoblaw even better: except:0

319 bytes

Here's a slightly easier-to-test version of the TiO: Try it online!

@Dave Thank you for the nice test module.

Thanks @ovs, it works, but I didn't understand if"!">g[a,b] and enumerate parts though.

All characters used except space have a higher code point than ! and therefore "!">g[a,b] will only evaluate to True if g[a,b] is a space. You can lookup the codepoints by calling ord on a single-character string or you can search for ascii table to have a list.

enumerate is a generator which yields the index of an element and the value itself in each iteration. See the docs

139 bytes

Thanks a lot @nore You have been saving a lot of bytes on almost all of my answers. :)

Mathematica, 117 bytes
The usual story: powerful built-ins but long names…
HighlightGraph[g,ConnectedComponents[h=Subgraph[g=KnightTourGraph@@Dimensions@#,Flatten@#~Position~1],#2]~Prepend~h]&

Try it at the Wolfram sandbox!
It takes two inputs: first is the input grid as an array of 0s (for the walls) and 1s (for spaces), then a single integer for the starting position, found by numbering the grid along the rows from top to bottom, e.g.
1  2  3  4  5
6  7  8  9  10
11 12 13 14 ...

You can call the function like HighlightGraph[...~Prepend~h]&[{{0,0,...,0}, {0,0,...,0}, ..., {0,0,...,0}}, 20].
The KnightTourGraph function constructs a graph with vertices corresponding to positions in the grid and edges corresponding to valid knight moves, then we take the Subgraph of the vertices that aren't walls, and find the ConnectedComponents of the starting vertex. The output is a graph (shown rotated 90º anticlockwise) with the non-wall vertices highlighted red, and the filled vertices highlighted yellow. For example, for the first test case, the output looks like:

Well this certainly looks like the hardest to test! Could you add an example of how to invoke it in the sandbox, for those of us who haven't touched Mathematica since our university days? My attempts of f=... f[{0,...,0;0,...,0}, 19] and similar have failed miserably.

@Dave, you can invoke the function with HighlightGraph[g,ConnectedComponents[h=Subgraph[g=KnightTourGraph@@Dimensions@#,Flatten@#~Position~1],#2]~Prepend~h]&[{{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0},{0,0,1,1,1,1,0,0},{0,0,1,1,1,1,0,0},{0,0,0,0,0,0,0,0},{0,0,1,1,1,1,0,0},{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0}},20] (for the first test case). I've edited that into the question — sorry it wasn't there to begin with!


text:
Fire propagation simulator
Suppose we have a matrix like this:
11111
12221
12321
12221
11111

This matrix represents a terrain, and each cell represents a portion of terrain. The number in each cell represents the time the portion of terrain needs to be completely burnt (in minutes, if a measurement unit is needed), according to its combustibility. If a fire starts at any given position (cell), that cell needs to be completely burnt before the fire propagates to the adjacent cells (horizontal and vertical only, not diagonal). So, if a fire is started at the center position, the fire needs:
11111        11111        11111        11011        10001        00000
12221  3 m.  12221  2 m.  12021  1 m.  11011  1 m.  00000  1 m.  00000
12321 -----> 12021 -----> 10001 -----> 00000 -----> 00000 -----> 00000
12221        12221        12021        11011        00000        00000
11111        11111        11111        11011        10001        00000

Explanation:

Fire starts at [2,2] (0-based), which has a burn time of 3.
After 3 minutes, [1,2],[2,1],[2,3],[3,2] start to burn.
After 2 minutes, those cells end burning and fire propagates to all adjacent cells, but [0,2],[2,0],[2,4],[0,4] need only 1 more minute to burn, so
After 1 minute, those cells are burnt and the cell propagates to their adjacent cells.
After 1 more minute, the rest of cells from step 3 end burning and fire propagates to their adjacent cells (that are already burnt, so nothing happens).
After 1 last minute, fire ends burning the whole terrain.

So the solution to that case is 8 minutes. If the fire starts in the top leftmost cell [0,0]:
11111     01111     00111     00011     00001     00000
12221  1  12221  1  02221  1  01221  1  00121  1  00011   1
12321 --> 12321 --> 12321 --> 02321 --> 01321 --> 00321  -->
12221     12221     12221     12221     02221     01221
11111     11111     11111     11111     11111     01111

00000     00000     00000     00000     00000
00000  1  00000  1  00000  1  00000  1  00000
00221 --> 00110 --> 00000 --> 00000 --> 00000
00221     00121     00020     00010     00000
00111     00011     00001     00000     00000

So now the total time is 10 minutes.
The challenge
Given a NxM matrix (N>0, M>0) of integer values that represent the time every cell needs to be completely consumed, write the shortest program/function that takes that matrix and a pair of integers with the position the fire starts in, and returns/prints the time needed for the fire to completely consume the whole terrain.

Every cell will have a positive (non-zero) burn time. You cannot assume a maximum value for the cells.
The matrix does not need to be square nor symmetric.
The matrix can be 0-indexed or 1-indexed, as you like.
The position can be given as a single parameter with a tuple of integers, two separate parameters of whatever other reasonable format.
The dimensions of the matrix cannot be specified as input parameters.
You do not need to output every intermediate step, just the amount of time asked. But I won't complain if the steps are visualized in any way.

Another example:
Fire starts at [1,1] (a '>' represents a minute):

4253   4253   4253   4153   4043   3033   2023    0001   0000
2213 > 2113 > 2013 > 1003 > 0002 > 0001 > 0000 >> 0000 > 0000
1211   1211   1211   1111   1001   0000   0000    0000   0000

Output: 9

This is code-golf, so may the shortest program for each language win!

@LeanderMoesinger it has to work with any matrix. What I mean is that your program or function cannot accept the dimensions of the matrix as input parameters, but of course you can calculate those dimensions inside your code.

Can the input be taken as a single number in column-major order? That is, matrix entries are numbered down, then across

@LuisMendo yes, of course. But note that the burning time of every cell can be greater than 9, if that matters for the "single number" part.

Thanks. No, it doesn't matter. I meant a single number but possibly with several digits. The number will range from 1 to M*N

Matlab, 235 257 190 182 178 bytes
Input: Matrix A, 1x2 vector p containing the starting coordinates.
function t=F(A,p)
[n,m]=size(A);x=2:n*m;x(mod(x,n)==1)=0;B=diag(x,1)+diag(n+1:n*m,n);k=sub2ind([n m],p(1),p(2));t=max(distances(digraph(bsxfun(@times,((B+B')~=0),A(:))'),k))+A(k)

Explanation:
Instead of simulating the the fire propagation, we can also understand this as a "find the longest shortest path" problem. The matrix is converted into a weighted directed graph. The weights of the paths to a single node correspond to the time to burn said node. E.g. for a matrix
5   7   7   10
5   2   2   10
4   5   2   6

we get the connected graph:

Where node 1 is the upper left matrix element and node 12 the lower right element. Given starting coordinates p, the shortest path to all other nodes is calculated. Then the length of the longest path of those shortest paths + the time to burn the initial node equals to the time to burn the whole matrix.
Ungolfed and commented version with sample starting values:
% some starting point
p = [3 2];
% some random 5x6 starting map, integers between 1:10
A = randi(10,5,6);

function t=F(A,p)
% dimensions of A
[n,m] = size(A);
% create adjacency matrix
x=2:n*m;
x(mod(x,n)==1)=0;
B = diag(x,1)+diag(n+1:n*m,n);
B = B+B';
B = bsxfun(@times,(B~=0),A(:))';
% make graph object with it
G = digraph(B);
% starting node
k = sub2ind([n m], p(1), p(2));
% calculate the shortest distance to all nodes from starting point
d = distances(G,k);
% the largest smallest distance will burn down last. Add burntime of initial point
t = max(d)+A(k);

Welcome to PPCG!

Very nice approach and very well explained!

Hey, since this is my first golf,  i have to ask whether it is ok that i omitted the ; after each line. In Matlab these prevent that the results of each command is displayed in the console. Currently the code is VERY chatty and spams the console. But since that is not a strict failure state i kept it that way. But it does not matter a lot, it's just 4 bytes

@LeanderMoesinger does the spam go into the same output area as your program output? If the spam, for example, goes into STDERR or equivalent and the output goes into STDOUT or equivalent, you should be fine removing them. If they both output in the same spot, I wouldn't know.

@ It is a different output area, but I can avoid it altogether by putting everything one one line. Thx for the clarification!

Had to increase length because i read the task sloppily and only provided a script, but not a function.

@LeanderMoesinger This is an impressive first answer!

@LuisMendo Thx, means a lot coming from you :D

@LeanderMoesinger It says "write the shortest program/function"  I would say the script is a program and you don't need to make a function.

@JerryJeremiah I feel inclined to agree, but since everyone else as fas as I can tell wrote a function it seemed appropriate to follow suit.

JavaScript (ES6), 156 152 146 144 143 bytes
Saved 1 byte thanks to Kevin Cruijssen
A rather naive implementation. Takes input in currying syntax (a)(s), where a is a 2D-array and s is an array of two integers [x, y] representing the 0-based coordinates of the starting position.
a=>s=>(g=t=>(a=a.map((r,y)=>r.map((c,x)=>(z=(h,v)=>(a[y+~~v]||[])[x+h]<1)(-1)|z(1)|z(0,-1)|z(0,1)|x+','+y==s&&c?u=c-1:c),u=-1),~u?g(t+1):t))(0)

Formatted and commented
a => s => (                                // given a and s
  g = t => (                               // g = recursive function with t = time counter
    a = a.map((r, y) =>                    // for each row r of the input array:
      r.map((c, x) =>                      //   for each cell c in this row:
        (                                  //     z = function that takes
          z = (h, v) =>                    //         2 signed offsets h and v and checks
            (a[y + ~~v] || [])[x + h] < 1  //         whether the corresponding cell is 0
        )(-1) | z(1) |                     //     test left/right neighbors
        z(0, -1) | z(0, 1) |               //     test top/bottom neighbors
        x + ',' + y == s                   //     test whether c is the starting cell
        && c ?                             //     if at least one test passes and c != 0:
          u = c - 1                        //       decrement the current cell / update u
        :                                  //     else:
          c                                //       let the current cell unchanged
      ),                                   //   end of r.map()
      u = -1                               //   start with u = -1
    ),                                     // end of a.map() --> assign result to a
    ~u ?                                   // if at least one cell was updated:
      g(t + 1)                             //   increment t and do a recursive call
    :                                      // else:
      t                                    //   stop recursion and return t
  )                                        // end of g() definition
)(0)                                       // initial call to g() with t = 0

Test cases

let f =

a=>s=>(g=t=>(a=a.map((r,y)=>r.map((c,x)=>(z=(h,v)=>(a[y+~~v]||[])[x+h]<1)(-1)|z(1)|z(0,-1)|z(0,1)|x+','+y==s&&c?u=c-1:c),u=-1),~u?g(t+1):t))(0)

console.log(f([
  [1,1,1,1,1],
  [1,2,2,2,1],
  [1,2,3,2,1],
  [1,2,2,2,1],
  [1,1,1,1,1]
])([2, 2]))

console.log(f([
  [1,1,1,1,1],
  [1,2,2,2,1],
  [1,2,3,2,1],
  [1,2,2,2,1],
  [1,1,1,1,1]
])([0, 0]))

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

==0 can be golfed to <1 if I'm not mistaken.

@KevinCruijssen This is safe indeed as undefined<1 is falsy. Thanks!

Octave, 67 bytes
function n=F(s,a)n=0;do++n;until~(s-=a|=imdilate(~s,~(z=-1:1)|~z')

Try it online!
To visualize intermediate results you can Try this!
A function that take as input matrix of terrain a and initial coordinate as a matrix of 0&1 with the same size as terrain.
Actually there is no need to endfunction however to run the example in tio it should be added.
Explanation:
Repeatedly apply morphological image dilation on the terrain and subtract the burned areas from it.
Ungolfed answer:
function n = Fire(terrain,burned)
    n = 0;
    mask = [...
            0  1  0
            1  1  1
            0  1  0];
    while true
        n = n + 1;
        propagation = imdilate(~terrain, mask);
        burned = burned | propagation;
        terrain = terrain - burned;
        if all(terrain(:) == 0)
            break;
        end
    end
end

This is a nice answer, but maybe the algorithm is counting the initial state as a step, and returning 11 instead of 10 in your example. If I change the initial cell to be [3 3] the result is 9 instead of 8.

@CarlosAlejo OH, my bad. Answer updated changed n=1 to n=0.

MATL, 26 25 bytes

I really wanted to see some more answers using the golfiest languages around here

`yy)qw(8My~1Y6Z+fhy0>z}@&

Input format is:

First input is a matrix using ; as row separator.
Second input is a single number which addresses an entry of the matrix in 1-based column-major order (allowed by the challenge). For example, the column-major coordinate of each entry in a 3×4 matrix is given by
1  4  7 10
2  5  8 11
3  6  9 12

So for instance 1-based coordinates (2,2) correspond to 5.

Try it online! Or verify all test cases.
Explanation
The code maintains a list of entries that are burning. At each iteration, all entries of that list are decremented. When an entry reaches zero, its neighbouring entries are added to the list. To save bytes, entries that reach zero are not removed from the list; instead, they keep "burning" with negative values. The loop is exited when none of the entries have positive values.
See the program running step by step with slightly modified code.
Commented code:
`      % Do...while
  yy   %   Duplicate top two arrays (matrix and array of positions to be decremented)
       %   In the first iteration this implicitly takes the two inputs
  )    %   Reference indexing. This gives the values that need to be decremented
  q    %   Decrement
  w    %   Swap. This brings the array of positions that have been decremented to top
  (    %   Assignment indexing. This writes the decremented values back into their
       %   positions
  8M   %   Push array of positions again
  y    %   Duplicate decremented matrix
  ~    %   Negate. This replaces zeros by 1, and nonzeros by 0
  1Y6  %   Push predefined literal [0 1 0; 1 0 1; 0 1 0] (4-neighbourhood)
  Z+   %   2D convolution, maintaining size
  f    %   Find: gives column-major indices of neighbours of totally burnt entries
  h    %   Concatenate. This updates the array of positions to be decremented
  y    %   Duplicate decremented matrix
  0>   %   This gives 1 for positive entries, and 0 for the rest
  z    %   Number of nonzeros. This is the loop condition (*)
}      % Finally (execute before exiting loop)
  @    %   Push iteration number. This is the output
  &    %   Specify that the final implicit display function will display only the top
       %   of the stack
       % Implicit end. If the top of the stack (*) is not 0 (i.e. there are entries
       % that have not been totally burnt) the loop proceeds with the next iteration.
       % Else the "finally" branch is executed and the loop is exited
       % Implicit display (only top of the stack)

Now that's what I call a short code! :-)

Python 3, 277 266 bytes
def f(m,s):
 p={s};w=len(m);t=0
 while sum(sum(m,[])):
  t+=1;i=0
  for x,y in p:
   try:m[x][y]=max(0,m[x][y]-1)
   except:0
  for v in sum(m,[]):
   if v<1:
    for l in[(1,0),(-1,0),(0,1),(0,-1)]:a,b=max(0,i%w+l[0]),max(0,i//w+l[1]);p.add((a,b))
   i+=1
 print(t)

Try it online!
Defines a function f that takes a 2D matrix and a tuple of points. The first thing the function does is define a set of tuples containing the initial tuple value passed in: p={s}. The function then goes through every tuple of points in p and subtracts one from the matrix m at that point, unless the value is already zero. It then loops through m again finding all points with the value zero and adding the four neighbors of that point to the set p. This is why I chose to use a set, because sets in Python don't allow duplicate values (which would screw up the subtraction a lot). Unfortunately, due to list index wrapping (e.g: list[-1] == list[len(list)-1]) the indices need to be constrained so they do not go negative and add the wrong coordinates to p.
Nothing special, still getting used to golfing. Definitely room for improvement here, I'm going to keep cracking at it.

Could you write an execution example at Try it online so we all can test your code?

@CarlosAlejo Of course, added it to the post.

Python 2, 170 bytes
s,m=input()
t={s}
r=0
while max(sum(m,[]))>0:
 r+=1
 for a,b in t|t:
	try:a<0<x;b<0<x;m[a][b]-=1;t|=m[a][b]==0and{(a+1,b),(a-1,b),(a,b+1),(a,b-1)}or t^t
	except:0
print r

Try it online!

APL (Dyalog), 93 66 57 bytes
{⍵{^/,0≥⍺:0⋄1+x∇⍵∨{∨/,⍵∧⍲/¨2|⍳3 3}⌺3 3⊢0=x←⍺-⍵}(⊂⍺)≡¨⍳⍴⍵}

Try it online! or Visualize it online!

This function takes the terrain matrix as right argument and the coordinates (1-based) of first fire as left argument. Returns the number of minutes needed to burn everything.

Updates
Finally found a way to golf down the spread function.
*Sigh* it would be so much easier if the world was toroidal.

TIO just upgraded to Dyalog 16.0, which means now we have the shiny new stencil operator

Very nice answer! The intermediate output helps visualizing the progress!

Python 2, 268 bytes
def f(m,y,x):t,m[y][x]=m[y][x],0;g(m,t)
def g(m,t):
	n,h,w=map(lambda r:r[:],m),len(m),len(m[0])
	for l in range(h*w):r,c=l/h,l%h;n[r][c]-=m[r][c]and not all(m[r][max(c-1,0):min(c+2,w+1)]+[m[max(r-1,0)][c],m[min(r+1,h-1)][c]])
	if sum(sum(m,[])):g(n,t+1)
	else:print t

Try it online!
Recursively iterate over time steps in which every tile's number is reduced if it is cardinally adjacent to a 0. Very straightforward algorithm that, I believe, can still be golfed for boolean efficiency...
*note: my 'Try it online!' code includes bonus debug logging in the footer. I like to watch the algorithm progress.

Haskell, 138 133 bytes
u#g|all((<=0).snd)g=0|2>1=1+(u:[[(x+1,y),(x-1,y),(x,y-1),(x,y+1)]|((x,y),0)<-n]>>=id)#n where n=d<$>g;d p|elem(fst p)u=pred<$>p|2>1=p

Try it online!
Assumes input is a list of ((x,y),cell). Ungolfed:
type Pos = (Int, Int)

ungolfed :: [Pos] -> [(Pos, Int)] -> Int
ungolfed burning grid
  | all ((<=0).snd) grid = 0
  | otherwise = 1 + ungolfed (burning ++ newburning) newgrid
 where
  newgrid = map burn grid
  burn (pos,cell) | pos `elem` burning = (pos, cell - 1)
                  | otherwise = (pos, cell)
  newburning = do
    ((x,y),cell) <- newgrid
    guard (cell <= 0)
    [(x+1,y),(x-1,y),(x,y-1),(x,y+1)]


text:
Parse a list of lists into a Sad-List
In this challenge, you must parse a list of lists, into a simpler list format.
This challenge is based on my sadflak parser. In my sadflak parser, it has all the () removed, replaced with the sum of the ()s at the start of the list, to make the program run faster.
To parse into a Sad-List, you have to do this (python implementation thing, uses a tuple of tuples):
def sadlistfunc(list):
    new-sadlist = [0]
    for i in list:
        if i == ():
            new-sadlist[0]+=1
        else:
            new-sadlist.append(sadlistfunc(i))

This is a recursive function. For a list, start a new list, starting with the number of () from the list input, then the rest of this list is sad-list versions of every list that was not a () from the list input, in order. return the list.
Input:
you may take input in a few different formats:

you may take it as a list
you may take it as a tuple
you may take it as a string

if you take it as a string, you should use some set of brackets, as appear in brain-flak. you may not use characters 1 and 2
just be reasonable
Input will always be inside one list, but your program may assume an implicit list layer outside of the input, i.e. ()()() = (()()()), or it may choose not to. Examples will be with explicit outside list
output:
may be list or tuple or string, or whatever. you may use whatever reasonable output format, as is the meta consensus.
Example:
(()()()) = [3]
(((()))) = [0,[0,[1]]]
((())()(())) = [1, [1], [1]]
() = invalid input, if the outside bracket is explicit.
((((())())())(())()) = [1, [1, [1, [1]]], [1]]

note that input is not strict. these inputs could be:
[[],[],[]]
[[[[]]]]
[[[]],[],[[]]]
[]
[[[[[]],[]],[]],[[]],[]]

or some other reasonable format
explained test case:
(()()((())())())

to "sadify" this, first we count the number of ()
 ()()        ()
(    ((())())  )

3. then we remove these, and add a 3 at the start
(3,((())()))

there is one list in this list. we sadify this
((())())

how many ()?
     ()
((())  )

1. we remove and add a 1 at the start
(1,(()))

this has one list in it
(())

count
 ()
(  )

remove and add count
(1)

then we put this back into its list
(1,(1))

then we put this back into its list
(3,(1,(1)))

done
This is code-golf, so shorter is better

Note that in the actual sad-flak parser, the number of () is actually the second item of the list, and the first item is the index of the command

Good ol' JavaScript for... in, making me remember why you never use it: Fiddle

I suppose ((((())())())(())()) = [1, [1, [1, [1]], [1]] should be ((((())())())(())()) = [1, [1, [1, [1]]], [1]].

Pyth, 13 bytes
L+]/bYyM-b]Yy

Test suite.
How it works
L+]/bYyM-b]Yy
L               define a function y with argument b:
   /bY              list 1: count how many [] can be found in b
  ]                         wrap into singleton
        -b]Y        list 2: filter out [] from b
      yM                    apply y (this function) to each
 +                  concatenate the two lists above
            y   apply y to the input

You can remove first ].

CommonLisp, 49 bytes
(defun s(l)(cons(count()l)(mapcar's(remove()l))))

take input as list of lists.
Try it online!

Actually, 12 bytes
;[]@c@;░Q£Mo

Try it online!
Takes input as a comma-separated square-bracket list with explicit outer brackers.
Explanation:
;[]@c@;░Q£Mo
;[]@c         count the number of empty lists
     @;░      filter out empty lists
        Q£Mo  recurse with filtered list and append result

Brachylog, 21 bytes
;[[]]x{↰₀}ᵐA&{∋∅}ᶜg,A

Try it online!

Bytes and characters are not equivalent. Using UTF-8, that would take up 33 bytes, despite being only 21 characters.

@Samadi Brachylog uses its own code page, which is allowed per this meta answer.

Ah, I see. I was slightly confused. Thanks for clarifying!

@Samadi No problem, this question gets asked all the time.

Python 2, 69 46 45 bytes
f=lambda l:[l.count([])]+map(f,filter(len,l))

Try it online!

I think you need to add f= to your bytecount, since you're using the function f, and naming it otherwise would break your solution

@Leo You are right.

Mathematica, 42 bytes
{#~Count~{0},##&@@#~DeleteCases~{0}}&//@#&

Avoids explicit recursion by using //@ (MapAll) which maps a function over every node in a tree. This also means that the functions are executed from the leaves upwards. However, it will also be applied to {} which get turned into {0} in the process. That's why we count and remove {0} instead {}.

Retina, 42 bytes
+`(({()|}(?<-3>))*)(?!\3){}
1$1
{(1*)
{$.1

Try it online!

Clojure, 59 bytes
(fn f[i](conj(map f(remove #{[]}i))(count(filter #{[]}i))))

Not much different from the CommonLisp answer. Its count and remove seem to accept a bit nicer construct, here I had to use sets.

Javascript (ES6), 77 bytes
Golfed:
let m=a=>!a.length||a.map(m).reduce((b,c)=>(c.length?b.push(c):b[0]++,b),[0])

Ungolfed:
const traverse = arr => !arr.length || arr
    .map(traverse)
    .reduce(
        (accum, val) => (val.length ? accum.push(val) : accum[0]++, accum),
        [0]
    );

Demo

let m=a=>!a.length||a.map(m).reduce((b,c)=>(c.length?b.push(c):b[0]++,b),[0])

o.innerHTML = [
    JSON.stringify(m([[],[],[]])),
    JSON.stringify(m([[[[]]]])),
    JSON.stringify(m([[[]],[],[[]]])),
    JSON.stringify(m([])),
    JSON.stringify(m([[[[[]],[]],[]],[[]],[]]))
].join('\n')

Jelly, 10 bytes
Tịß€;@ċ“”$

Try it online!
Takes input as list of lists of lists...
Of course it uses the algorithm the other answers use. ;)

That's not 10 bytes. It's 10 characters. The number of bytes will depend on what encoding you use.

@Samadi No, Jelly has a dedicated character set which is its default, and it can represent those characters as one byte each. See here.

I see. Thanks for the clarification!

Haskell, 102 bytes
data L=I Int|T[L]deriving Show
(I n:r)#m=r#(n+m)
(x:r)#m=x:r#m
_#m=[I m]
f(T[])=I 1
f(T t)=T$map f t#0

Try it online!
Because Haskell is strictly typed, there are no arbitrarily nested lists. As a remedy data L=I Int|T[L]deriving Show declares tree-like nested lists with either Ints or empty lists as leafs.
Input is like in the second example format, with an additional constructor T before each opening brace: T[T[T[]],T[],T[T[]]]. The same goes for the output, with each number being preceded by a constructor I. Function f performs the saddening.
Outputs for the test cases:
T [I 3]
T [T [T [I 1],I 0],I 0]
T [T [I 1],T [I 1],I 1]
T [T [T [T [I 1],I 1],I 1],T [I 1],I 1]


text:
Draw an ASCII contour plot
Consider the following 3x3 blocks which the marching squares algorithm would identify for every cell (with 0-based labeled ID):
0:
...
...
...

1:
...
...
\..

2:
...
...
../

3:
...
---
...

4:
..\
...
...

5:
/..
...
../

6:
.|.
.|.
.|.

7:
/..
...
...

8:
/..
...
...

9:
.|.
.|.
.|.

10:
..\
...
\..

11:
..\
...
...

12:
...
---
...

13:
...
...
../

14:
...
...
\..

15:
...
...
...

The goal of this challenge is given a 2D matrix of block ID's, draw the full contour plot by tiling these smaller cells together. Note that there are some repeated cases (ex.: 0 and 15 visually are the same)
Input
Your program/function should take as input a 2D rectangular matrix of integers in the range [0+a,15+a] (where a is an arbitrary integer shift of your choice; this allows you to use zero-based indexing or 1-based indexing for the blocks). This may be from any source desired (stdin, function parameter, etc.).
Output
Your program/function should output a single string representing the full contour plot. There should be no extra leading/trailing whitespace, but a single trailing newline is allowed. There should be no separation between adjacent blocks vertically or horizontally.
Note that you do not have to do any kind of special treatment for blocks which map to a "saddle"; just draw the block with the given ID as-is.
The output may be to any sink desired (stdout, return value, etc.)
Examples
All examples below use 0-based block ID's.
case 1:

2 1
4 8

......
......
../\..
..\/..
......
......

case 2:

15 13 12 14 15
13 8 0 4 14
11 1 0 2 7
15 11 3 7 15

...............
......---......
...../...\.....
.../.......\...
...............
../.........\..
..\........./..
...............
...\......./...
.....\.../.....
......---......
...............

case 3:

12 12 12 8 4
0 0 0 0 2
0 0 0 2 7
0 2 3 7 15

........./....\
---------......
...............
...............
...............
............../
............/..
...............
.........../...
........./.....
......---......
...../.........

case 4:

0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15

............
.........---
...\..../...
..\/...|./..
.......|....
...../.|....
/...|...\..\
....|.......
....|.\.....
............
---.........
...../\.....

case 5:

0 0 0 0 6 15 15
0 0 0 0 6 15 15
0 0 0 0 6 15 15
0 0 0 2 7 15 15
0 0 2 5 14 15 15
0 2 5 8 4 12 14
0 4 8 0 0 0 6
0 0 0 0 0 0 4

.............|.......
.............|.......
.............|.......
.............|.......
.............|.......
.............|.......
.............|.......
.............|.......
.............|.......
............/........
.....................
.........../.........
........./...........
.....................
......../../\........
....../../....\......
...............---...
...../../.........\..
.....\/............|.
...................|.
...................|.
....................\
.....................
.....................

Scoring
This is code golf; shortest code in bytes wins. Standard loopholes apply.

Related.

Shouldn't the last test case have 3 more leading lines of the vertical bars?

yes, fixed. Thanks!

Should've used hexidecimal input.

Cries internally.

Retina, 165 bytes
T`d`L`1\d
 |\bB\B

.+
X$&¶Y$&¶Z$&
%{`[XYZ]$

([XYZ])[69]
.|.$1
X[^4-B]
...X
X[4AB]
..\X
X[578]
/..X
Y[^369C]
...Y
Y[3C]
---Y
Z[03478BCF]
...Z
Z[1AE]
\..Z
Z[25D]
../Z

Try it online! Link includes second example. Explanation: The first two stages convert from decimal to hexadecimal, allowing the spaces to be deleted. The third stage then triplicates each line, giving each new line a separate marker. These markers then traverse the hex digits, converting them into the contour plot as they go, until they reach the end of the line, at which point they are deleted.

Mathematica, 353 326 bytes
s=Table[".",3,3];z=Reverse;l@0=l@15=s;y=s;y[[3,1]]="\\";l@1=l@14=y;y=s;y[[3,3]]="/";l@2=l@13=y;y=s;y[[2,All]]="-";l@3=l@12=y;y=l@4=l@11=z/@z@l@1;y[[3,1]]="\\";l@10=y;y=s;y[[All,2]]="|";l@6=l@9=y;y=l@7=l@8=z/@z@l@2;y[[3,3]]="/";l@5=y;StringReplace[ToString@Grid@Map[Column,Map[StringJoin,Map[l,#,{2}],{3}],{2}],{"\n\n"->"\n"}]&

input

[{{15, 13, 12, 14, 15}, {13, 8, 0, 4, 14}, {11, 1, 0, 2, 7}, {15, 11,
     3, 7, 15}}]

Impressive, hard to do this in Mathematica.

Mathematica, 173 bytes
StringRiffle[ArrayFlatten[ReplacePart[Table[".",16,3,3],{{2|11|15,3,1}|{5|11|12,1,3}->"\\",{3|6|14,3,3}|{6|8|9,1,1}->"/",{4|13,2,_}->"-",{7|10,_,2}->"|"}][[#]]&/@#],"\n",""]&

Try it at the Wolfram sandbox!
The "\n" should be replaced by an actual newline. The input is 1-indexed — for example, the third test case becomes {{13,13,13,9,5},{1,1,1,1,3},{1,1,1,3,8},{1,3,4,8,16}}. The output is a string.
The idea is basically the same as Jenny_mathy's answer — make the sixteen squares by taking a 3x3 grid of "."s and replacing some of the characters, then stitch the squares together — but using slightly shorter functions to do it. (Thanks to alephalpha for reminding me that ArrayFlatten exists!)
It's possible that this can be done in fewer bytes by making the squares cleverly instead of basically hardcoding them, but that would require much more effort…

@Jenny_mathy: Edited — is that what you wanted?

@Jenny_mathy, it seems to be working for me. I'm using 1-indexing, so you need to add 1 to every number; the test case becomes {{16,14,13,15,16},{14,9,1,5,15},{12,2,1,3,8},{16,12,4,8,16}}. If you tried that and it's still not working, could you tell me what problem you're getting?

JavaScript (ES6), 195 bytes
a=>a.map((r,y)=>r.map((i,x)=>[...s='76843210_'].map((_,j)=>(o[Y=y*3+j/3|0]=o[Y]||[])[x*3+j%3]='.\\/-\\/|/\\'[[0,64,256,56,4,257,146,1,68][k=s[i-8]||i]>>j&1&&k])),o=[])&&o.map(r=>r.join``).join`
`

Test cases

let f =

a=>a.map((r,y)=>r.map((i,x)=>[...s='76843210_'].map((_,j)=>(o[Y=y*3+j/3|0]=o[Y]||[])[x*3+j%3]='.\\/-\\/|/\\'[[0,64,256,56,4,257,146,1,68][k=s[i-8]||i]>>j&1&&k])),o=[])&&o.map(r=>r.join``).join`
`

console.log(f([
  [ 2, 1 ],
  [ 4, 8 ]
]));

console.log(f([
  [ 15, 13, 12, 14, 15 ],
  [ 13,  8,  0,  4, 14 ],
  [ 11,  1,  0,  2,  7 ],
  [ 15, 11,  3,  7, 15 ]
]));

console.log(f([
  [ 12, 12, 12,  8,  4 ],
  [  0,  0,  0,  0,  2 ],
  [  0,  0,  0,  2,  7 ],
  [  0,  2,  3,  7, 15 ]
]));

console.log(f([
  [  0,  1,  2,  3 ],
  [  4,  5,  6,  7 ],
  [  8,  9, 10, 11 ],
  [ 12, 13, 14, 15 ]
]));

console.log(f([
  [  0,  0,  0,  0,  6, 15, 15 ],
  [  0,  0,  0,  0,  6, 15, 15 ],
  [  0,  0,  0,  0,  6, 15, 15 ],
  [  0,  0,  0,  2,  7, 15, 15 ],
  [  0,  0,  2,  5, 14, 15, 15 ],
  [  0,  2,  5,  8,  4, 12, 14 ],
  [  0,  4,  8,  0,  0,  0,  6 ],
  [  0,  0,  0,  0,  0,  0,  4 ]
]));

SOGL V0.12, 106 89 bytes
žj}² ³
ē0=?²
{ā;{"⁰9═‼pnk№Ο|╚φ;“2─6nwEX .9*3n²Xƨ.ƨ-¹╬-}²X"č7_#‘3n}² /33³\13³\31³/11žj}┼}O

Try it Here! (that has an extra byte → for ease of input. This otherwise would expect the array already on stack)

Please make SOGL interpreter use monospace font >.<

10 slashes are wider than 10 periods.

Python 2, 196 191 181 176 bytes
Try it online!
A function which takes an array of arrays of ints and returns a string:
J=''.join;N='\n'.join
f=lambda I:N(N(J(J('\/|-.'[C/16-2]*(C%16)for C in map(ord,'o!j1cSe!f1g1aAbAbAa1h1iAbAbAc!c!d!iSk1f!k'))[c*9+3*j:][:3]for c in r)for j in[0,1,2])for r in I)

EDIT: saved 5 bytes by assigning J,N; another 10 bytes because I forgot the input is already assumed to be an array of arrays of ints; and then another 5 bytes saved by smarter slicing...
The concatenated string of all 16 3x3 cells (144 bytes, omitting linebreaks) is run-length-encoded to the 41 byte string:
o!j1cSe!f1g1aAbAbAa1h1iAbAbAc!c!d!iSk1f!k
where each RLE element (cellType, length) is encoded to the character chr(32+16*cellType+length) (it is handy that the maximum run is 15; and that ord(' ')==32 is divisble by 16). When decoding, we take '\/|-.'[cellType] as the printable character.
Nothing particularly clever after that...

Python 2, 247 bytes
J='...'
print'\n'.join(map(''.join,sum([[sum([f[i*3:][:3]for i in j],[])for f in map(list,[J*4+'..\\/...|./../...|...\\..\\'+J*4,J*3+'---.......|........|.......---'+J*3,'...\\..../......../.|........|.\\'+J*3+'./\\.....'])]for j in input()],[])))

Try it online!
-1 byte thanks to LeakyNun

Please note that 10 and 5 are different.

@LeakyNun sigh I knew I had to have messed something up. Deleting until I fix it, maybe by tomorrow.

@LeakyNun I've fixed the code, though now it's become extremely ugly and ungolfed.

05AB1E, 61 bytes
v•2mßklJFΘõÿ|åU‚ιØØ•6B5¡∊¶¡110bTǝ.BJ3ô3ôyèøJ»}»4ÝJð«"\./-|."‡

Try it online!

The first half of the pattern can be compressed as:
5
11111105
1111111125
1113335
1105
2111111125
141141145
25

The second half would need to be:
25
141141145
11011105
1105
1113335
1111111125
11111105
5

We can just vertically mirror the first half, and insert binary 110 (1101110) in for the 2111111125.

Next we take this pattern and split on fives, then pad it with ones:
1 = 111111111
2 = 111111011
3 = 111111112
4 = 111333111
5 = 110111111
6 = 211111112
7 = 141141141
8 = 211111111
9 = 141141141
A = 110111011
B = 110111111
C = 111333111
D = 111111112
E = 111111111

Now we have our building blocks, the last parts just replace the matrix entries with the appropriate building blocks, zip together the rows and print to the user with replaced symbols:
0 = .........
1 = ......\..
2 = ......../
3 = ...---...
4 = ..\......
5 = /......./
6 = .|..|..|.
7 = /........
8 = /........
9 = .|..|..|.
A = ..\...\..
B = ..\......
C = ...---...
D = ......../
E = .........

Can post formal operation explanation if anyone wants it, thanks.

Jelly, 64 bytes
“¡_ḟ5⁸ṫ⁺Y"⁷ƘzƬɼ¥@TR/ṖQ½3yİ>ẎḄT¥⁹iḟQ¬Ɠl¹µŒ’ṃ“/-\|.”s3s3ṙ9ị@³ZY$€Y

Try it online!
This uses a naive compression and could probably save many bytes with run-length encoding.
How it Works
“¡_ḟ5⁸ṫ⁺Y"⁷ƘzƬɼ¥@TR/ṖQ½3yİ>ẎḄT¥⁹iḟQ¬Ɠl¹µŒ’ṃ“/-\|.”s3s3ṙ9ị@³ZY$€Y
“¡_ḟ5⁸ṫ⁺Y"⁷ƘzƬɼ¥@TR/ṖQ½3yİ>ẎḄT¥⁹iḟQ¬Ɠl¹µŒ’ encodes the integer 4591777158889232952973696500124538798606476761349931038636020730336909822188496590423586252520
ṃ“/-\|.”                   - convert to base 5 and index into the string to get "/......../.........|..|..|...\...\....\.........---.........../......\.................\........../...---.....\....../......./.|..|..|."
        s3s3               - split every 9 characters into a 3x3 square submatrix
            ṙ9             - rotate left by 9 to line up the submatrix for 1 with index 1
              ị@³          - index the input into this
                 ZY$€Y     - format