text:
Mozilla/1.0 Mozilla/2.0 Mozilla/3.0 Mozilla/4.0 Mozilla/5.0

In the beginning there was NCSA Mosaic, and Mosaic called itself NCSA_Mosaic/2.0 (Windows 3.1), and Mosaic displayed pictures along with text, and there was much rejoicing.

15 years later...

And then Google built Chrome, and Chrome used Webkit, and it was like Safari, and wanted pages built for Safari, and so pretended to be Safari. And thus Chrome used WebKit, and pretended to be Safari, and WebKit pretended to be KHTML, and KHTML pretended to be Gecko, and all browsers pretended to be Mozilla, and Chrome called itself Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13, and the user agent string was a complete mess, and near useless, and everyone pretended to be everyone else, and confusion abounded.

Read full story here...
Given a User Agent string, return the browser that it corresponds to.
You must support:

Chrome/Chromium*
Opera
Firefox
IE
Edge
Safari

Your code only needs satisfy all of these test cases.
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36
Chrome

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36
Chrome

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/603.2.4 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.4
Safari

Mozilla/5.0 (Windows NT 10.0; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0
Firefox

Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0
Firefox

Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36
Chrome

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36
Chrome

Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36
Chrome

Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0
Firefox

Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36
Chrome

Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
IE

Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:54.0) Gecko/20100101 Firefox/54.0
Firefox

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36
Chrome

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36
Chrome

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8
Safari

Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0
Firefox

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36
Chrome

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393
Edge

Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36
Chrome

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36 Edge/15.15063
Edge

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36
Chrome

Mozilla/5.0 (Windows NT 6.3; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0
Firefox

Mozilla/5.0 (Windows NT 6.1; rv:54.0) Gecko/20100101 Firefox/54.0
Firefox

Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko
IE

Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:54.0) Gecko/20100101 Firefox/54.0
Firefox

Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36
Chrome

Mozilla/5.0 (X11; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0
Firefox

Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0
Firefox

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36
Chrome

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.2.5 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.5
Safari

Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/59.0.3071.109 Chrome/59.0.3071.109 Safari/537.36
Chromium

Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36
Chrome

Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0
Firefox

Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko
IE

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.78 Safari/537.36
Chrome

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36
Chrome

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.1 Safari/603.1.30
Safari

Mozilla/5.0 (Windows NT 5.1; rv:52.0) Gecko/20100101 Firefox/52.0
Firefox

Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0
Firefox

Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0
Firefox

Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36
Chrome

Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36
Chrome

Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36
Chrome

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/603.2.5 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.5
Safari

Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36
Chrome

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36 OPR/46.0.2597.57
Opera

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36 OPR/46.0.2597.32
Opera

Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36
Chrome

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36
Chrome

Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko
IE

Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.104 Safari/537.36
Chrome

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36
Chrome

Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.109 Safari/537.36
Chrome

Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; Trident/5.0;  Trident/5.0)
IE

Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0;  Trident/5.0)
IE

Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:54.0) Gecko/20100101 Firefox/54.0
Firefox

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8
Safari

Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0
Firefox

Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.78 Safari/537.36
Chrome

Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/58.0.3029.110 Chrome/58.0.3029.110 Safari/537.36
Chromium

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36 OPR/46.0.2597.39
Opera

Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko
IE

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36
Chrome

Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36
Chrome

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36
Chrome

Mozilla/5.0 (Windows NT 10.0; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0
Firefox

Mozilla/5.0 (Windows NT 6.1; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0
Firefox

Remember, this is code-golf, so the code with the least bytes wins.

* Chromium and Chrome can be interchanged.

Why don't we need to detect any Mozilla 1-4, as the title suggests?

Retina, 53 51 bytes
.+Tr.+
IE
.+E.+
Edge
.+P.+
Opera
.+?([CFS]\w+).+
$1

Try it online! Explanation: Opera can be identified by its (O)P(R/) platform and IE by its Tr(ident) engine. The other browsers include their full name in their user agent, but Edge puts theirs last so it has to be processed separately from the others. Edit: Saved 1 byte by detecting Edge after Trident and 1 byte by detecting Opera using just the P both thanks to @ThePirateBay.

Thanks to we do not need to support UA like Opera/10.0 ...

Jelly, 27 bytes
-7ịO%25ị“ðh³`Ẹ|Ḥ©®jḋƝ,Ṁ⁵»Ḳ¤

A monadic link accepting and returning lists of characters.
Try it online! or see a test suite (shows expected output -> output; tests sorted by browser).
How?
-7ịO%25ị“ðh³`Ẹ|Ḥ©®jḋƝ,Ṁ⁵»Ḳ¤ - Link: list of character, userAgentString
-7ị                         - -7 index into userAgentString (last character is 0)
   O                        - cast to ordinal
    %25                     - modulo by 25
                          ¤ - nilad followed by link(s) as a nilad:
        “ðh³`Ẹ|Ḥ©®jḋƝ,Ṁ⁵»   - compression of dictionary words:
                            -   = "IE Firefox Opera Safari Chrome Edge"
                         Ḳ  - split at spaces
       ị                    - index into (1-indexed and modular)

Perl 5, 64 + 1 (-p) = 65 bytes
$_=/P/&&Opera||/Edge|Firefox/&&$&||/C/&&Chrome||/Tr/&&IE||Safari

Try it online!
The header and the -l in the TIO link are just to make the output easier to read when feeding the entire list of User-Agents.  Without those, this meets the challenge, taking one string and returning the browser name.

JavaScript, 113 83 82 bytes
Same approach as the Retina answer by Neil.
f=_=>_[x=`includes`]`P`?`Opera`:_[x]`Tr`?`IE`:_[x]`E`?`Edge`:_.match(/[CFS]\w+/)[0]

Previous attempts:
// With String.prototype.test, 83 bytes
f=_=>/P/.test(_)?`Opera`:/Tr/.test(_)?`IE`:/E/.test(_)?`Edge`:_.match(/[CFS]\w+/)[0]

// With array filtering, 113 bytes
f=_=>_[o=`Opera`,i=`includes`]`P`?o:[o,`Edge`,`Firefox`,`Chromium`,`Chrome`,`Safari`].filter(b=>_[i](b))[0]||`IE`

Try it:

const f=_=>_[x=`includes`]`P`?`Opera`:_[x]`Tr`?`IE`:_[x]`E`?`Edge`:_.match(/[CFS]\w+/)[0]

const testData = {
  'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36': 'Chrome',
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36': 'Chrome',
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/603.2.4 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.4': 'Safari',
  'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0': 'Firefox',
  'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0': 'Firefox',
  'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36': 'Chrome',
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36': 'Chrome',
  'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36': 'Chrome',
  'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0': 'Firefox',
  'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36': 'Chrome',
  'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko': 'IE',
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:54.0) Gecko/20100101 Firefox/54.0': 'Firefox',
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36': 'Chrome',
  'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36': 'Chrome',
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8': 'Safari',
  'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0': 'Firefox',
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36': 'Chrome',
  'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393': 'Edge',
  'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36': 'Chrome',
  'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36 Edge/15.15063': 'Edge',
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36': 'Chrome',
  'Mozilla/5.0 (Windows NT 6.3; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0': 'Firefox',
  'Mozilla/5.0 (Windows NT 6.1; rv:54.0) Gecko/20100101 Firefox/54.0': 'Firefox',
  'Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko': 'IE',
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:54.0) Gecko/20100101 Firefox/54.0': 'Firefox',
  'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36': 'Chrome',
  'Mozilla/5.0 (X11; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0': 'Firefox',
  'Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0': 'Firefox',
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36': 'Chrome',
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.2.5 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.5': 'Safari',
  'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/59.0.3071.109 Chrome/59.0.3071.109 Safari/537.36': 'Chromium',
  'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36': 'Chrome',
  'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0': 'Firefox',
  'Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko': 'IE',
  'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.78 Safari/537.36': 'Chrome',
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36': 'Chrome',
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.1 Safari/603.1.30': 'Safari',
  'Mozilla/5.0 (Windows NT 5.1; rv:52.0) Gecko/20100101 Firefox/52.0': 'Firefox',
  'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0': 'Firefox',
  'Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0': 'Firefox',
  'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36': 'Chrome',
  'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36': 'Chrome',
  'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36': 'Chrome',
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/603.2.5 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.5': 'Safari',
  'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36': 'Chrome',
  'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36 OPR/46.0.2597.57': 'Opera',
  'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36 OPR/46.0.2597.32': 'Opera',
  'Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36': 'Chrome',
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36': 'Chrome',
  'Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko': 'IE',
  'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.104 Safari/537.36': 'Chrome',
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36': 'Chrome',
  'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.109 Safari/537.36': 'Chrome',
  'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; Trident/5.0;  Trident/5.0)': 'IE',
  'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0;  Trident/5.0)': 'IE',
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:54.0) Gecko/20100101 Firefox/54.0': 'Firefox',
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8': 'Safari',
  'Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0': 'Firefox',
  'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.78 Safari/537.36': 'Chrome',
  'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/58.0.3029.110 Chrome/58.0.3029.110 Safari/537.36': 'Chromium',
  'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36 OPR/46.0.2597.39': 'Opera',
  'Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko': 'IE',
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36': 'Chrome',
  'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36': 'Chrome',
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36': 'Chrome',
  'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0': 'Firefox',
  'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0': 'Firefox'
}

Object.keys(testData).forEach(ua => {
  console.log('Expected: %s; actual: %s (input: %s)', testData[ua], f(ua), ua)
})

Kotlin, 133 130 128 bytes
"Tr|IE_E|Edge_P|Opera_mi|Chromium_C|Chrome_A|Safari".split("_").map{it.split("|")}.firstOrNull{it[0] in this}?.get(1)?:"Firefox"

Beautified
    "Tr|IE_E|Edge_P|Opera_mi|Chromium_C|Chrome_A|Safari"
        .split("_")
        .map { it.split("|") }
        .firstOrNull {
            it[0] in this
        }?.get(1) ?: "Firefox"

Test
fun String.f(): String =
"Tr|IE_E|Edge_P|Opera_mi|Chromium_C|Chrome_A|Safari".split("_").map{it.split("|")}.firstOrNull{it[0] in this}?.get(1)?:"Firefox"

data class Test(val input: String, val output: String)

val tests = listOf(
        Test(
                "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36",
                "Chrome"
        ),
        Test(
                "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36",
                "Chrome"
        ),
        Test(
                "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/603.2.4 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.4",
                "Safari"
        ),
        Test(
                "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0",
                "Firefox"
        ),
        Test(
                "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0",
                "Firefox"
        ),
        Test(
                "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36",
                "Chrome"
        ),
        Test(
                "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36",
                "Chrome"
        ),
        Test(
                "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36",
                "Chrome"
        ),
        Test(
                "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0",
                "Firefox"
        ),
        Test(
                "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36",
                "Chrome"
        ),
        Test(
                "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko",
                "IE"
        ),
        Test(
                "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:54.0) Gecko/20100101 Firefox/54.0",
                "Firefox"
        ),
        Test(
                "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36",
                "Chrome"
        ),
        Test(
                "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36",
                "Chrome"
        ),
        Test(
                "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8",
                "Safari"
        ),
        Test(
                "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0",
                "Firefox"
        ),
        Test(
                "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36",
                "Chrome"
        ),
        Test(
                "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393",
                "Edge"
        ),
        Test(
                "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
                "Chrome"
        ),
        Test(
                "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36 Edge/15.15063",
                "Edge"
        ),
        Test(
                "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36",
                "Chrome"
        ),
        Test(
                "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0",
                "Firefox"
        ),
        Test(
                "Mozilla/5.0 (Windows NT 6.1; rv:54.0) Gecko/20100101 Firefox/54.0",
                "Firefox"
        ),
        Test(
                "Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko",
                "IE"
        ),
        Test(
                "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:54.0) Gecko/20100101 Firefox/54.0",
                "Firefox"
        ),
        Test(
                "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36",
                "Chrome"
        ),
        Test(
                "Mozilla/5.0 (X11; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0",
                "Firefox"
        ),
        Test(
                "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0",
                "Firefox"
        ),
        Test(
                "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36",
                "Chrome"
        ),
        Test(
                "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.2.5 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.5",
                "Safari"
        ),
        Test(
                "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/59.0.3071.109 Chrome/59.0.3071.109 Safari/537.36",
                "Chromium"
        ),
        Test(
                "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36",
                "Chrome"
        ),
        Test(
                "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0",
                "Firefox"
        ),
        Test(
                "Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko",
                "IE"
        ),
        Test(
                "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.78 Safari/537.36",
                "Chrome"
        ),
        Test(
                "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36",
                "Chrome"
        ),
        Test(
                "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.1 Safari/603.1.30",
                "Safari"
        ),
        Test(
                "Mozilla/5.0 (Windows NT 5.1; rv:52.0) Gecko/20100101 Firefox/52.0",
                "Firefox"
        ),
        Test(
                "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0",
                "Firefox"
        ),
        Test(
                "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0",
                "Firefox"
        ),
        Test(
                "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36",
                "Chrome"
        ),
        Test(
                "Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36",
                "Chrome"
        ),
        Test(
                "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36",
                "Chrome"
        ),
        Test(
                "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/603.2.5 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.5",
                "Safari"
        ),
        Test(
                "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36",
                "Chrome"
        ),
        Test(
                "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36 OPR/46.0.2597.57",
                "Opera"
        ),
        Test(
                "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36 OPR/46.0.2597.32",
                "Opera"
        ),
        Test(
                "Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36",
                "Chrome"
        ),
        Test(
                "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36",
                "Chrome"
        ),
        Test(
                "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko",
                "IE"
        ),
        Test(
                "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.104 Safari/537.36",
                "Chrome"
        ),
        Test(
                "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36",
                "Chrome"
        ),
        Test(
                "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.109 Safari/537.36",
                "Chrome"
        ),
        Test(
                "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; Trident/5.0;  Trident/5.0)",
                "IE"
        ),
        Test(
                "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0;  Trident/5.0)",
                "IE"
        ),
        Test(
                "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:54.0) Gecko/20100101 Firefox/54.0",
                "Firefox"
        ),
        Test(
                "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8",
                "Safari"
        ),
        Test(
                "Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0",
                "Firefox"
        ),
        Test(
                "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.78 Safari/537.36",
                "Chrome"
        ),
        Test(
                "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/58.0.3029.110 Chrome/58.0.3029.110 Safari/537.36",
                "Chromium"
        ),
        Test(
                "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36 OPR/46.0.2597.39",
                "Opera"
        ),
        Test(
                "Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko",
                "IE"
        ),
        Test(
                "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36",
                "Chrome"
        ),
        Test(
                "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36",
                "Chrome"
        ),
        Test(
                "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36",
                "Chrome"
        ),
        Test(
                "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0",
                "Firefox"
        ),
        Test(
                "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0",
                "Firefox"
        ))

fun main(args: Array<String>) {
    val answers = tests
        .map { (i, o) -> Triple(i, o, i.f()) }
    val t = answers
        .groupBy { it.second }
        .mapValues { it.value.groupBy { it.second == it.third }.mapValues { it.value.size } }
    for (f in t) {
        println(f)
    }
    println(answers.groupBy { it.second == it.third }.mapValues { it.value.size })
}

TIO
TryItOnline
Edits

-3 jrtapsell - Swapped destructuring for array access
-2 jrtapsell - Replaced contains with in


text:
Triangle a number!
We are used to the term "squaring" n to mean calculating n2. We are also used to the term "cubing" n to mean n3. That being said, why couldn't we also triangle a number?
How to triangle a number?

First off, let's pick a number, 53716.
Position it in a parallelogram, whose side length equals the number of digits of the number, and has two sides positioned diagonally, as shown below.

    53716
   53716
  53716
 53716
53716

Now, we want to ∆ it, right? To do so, crop the sides that do not fit into a right-angled triangle:

    5
   53
  537
 5371
53716

Take the sums of each row, for this example resulting in [5, 8, 15, 16, 22]:

    5  -> 5
   53  -> 8
  537  -> 15
 5371  -> 16
53716  -> 22

Sum the list [5, 8, 15, 16, 22], resulting in 66. This is the triangle of this number!

Specs & Rules

The input will be a non-negative integer n (n ≥ 0, n ∈ Z).
You may take input and provide output by any allowed mean.
Input may be formatted as an integer, a string representation of the integer, or a list of digits.
Default loopholes disallowed.
This is code-golf, so the shortest code in bytes wins!

More Test Cases

Input -> Output

0 -> 0
1 -> 1
12 -> 4
123 -> 10
999 -> 54
100000 -> 6
654321 -> 91

Inspiration. Explanations are encouraged!

are you sure that 645321 -> 91 ?

@Rod Sorry, you are right. I wrote 645321 instead of 654321.

Can I take input as a list of digits?

@totallyhuman Yes, see the second spec.

Interesting challenge.  Glad you were inspired by mine!

Haskell, 13 bytes
sum.scanl1(+)

Try it online!
Takes input as list of digits. Calculates the cumulative sums then sums them.

Brain-Flak, 65, 50, 36 bytes
([])({<{}>{<({}[()])>[]}{}<([])>}{})

Try it online!
After lots of revising, I'm now very proud of this answer. I like the algorithm, and how nicely it can be expressed in brain-flak.
Most of the byte count comes from handling 0's in the input. In fact, if we could assume there were no 0's in the input, it would be a beautifully short 20-byte answer:
({{<({}[()])>[]}{}})

Try it online!
But unfortunately, brain-flak is notorious for bad handling of edge cases.
Explanation
First, an observation of mine:
If the input is n digits long, the first digit will appear in the triangle n times, the second digit will appear n-1 times, and so on onto the last digit, which will appear once. We can take advantage of this, since it's really easy to calculate how many digits of input are left in brain-flak, namely
[]

So here's how the code works.
# Push the size of the input (to account for 0's)
([])

# Push...
(

    # While True
    {

        # Pop the stack height (evaluates to 0)
        <{}>

        # For each digit *D*...

        # While true
        {

            # Decrement the counter (the current digit we're evaluating),
            # but evaluate to 0
            <({}[()])>

            # Evaluate the number of digits left in the input
            []

        # Endwhile
        }

        # This whole block evaluates to D * len(remaining_digits), but
        # without affecting the stack

        # Since we looped D times, D is now 0 and there is one less digit.
        # Pop D (now 0)
        {}

        # Push the stack height (again, evaluating it as 0)
        <([])>

    # End while
    }

    # Pop a 0 off (handles edge case of 0)
    {}

# end push
)

My tip here can save you two bytes

Husk, 4̷ 2 bytes
Thanks @H.PWiz for -2 bytes!
Σ∫

Try it online!
"Ungolfed"/Explained
Σ    -- sum all
 ∫   -- prefix sums

Pyth - 6 4 bytes
ss._

Try it online here.
Nice 6 byte one that doesn't use prefix builtin:
s*V_Sl

Nice!  The best I could come up with is twice as long: s.e*bhk_

MATL, 3 bytes
Yss

Try it online!
Takes the input as a list of digits.

Haskell, 25 bytes
Takes input as list of digits
f[]=0
f x=sum x+f(init x)

Try it online!
Haskell, 41 bytes
Takes input as string representation
f[]=0
f x=sum(map(read.(:[]))x)+f(init x)

Try it online!

Jelly, 3 bytes
+\S

Try it online! Uses the same technique as my Japt answer: cumulative addition, then sum.

Oh, of course! :)

Japt, 7 6 4 bytes
å+ x

Try it online!
Explanation
å+ x    Implicit: input = digit list
å+      Cumulative reduce by addition. Gives the sum of each prefix.
   x    Sum.

Old solution:
å+ ¬¬x

Try it online!
Explanation
å+ ¬¬x   Implicit: input = string
å+       Cumulative reduce by concatenation. Gives the list of prefixes.
   ¬     Join into a single string of digits.
    ¬    Split back into digits.
     x   Sum.
         Implicit: output result of last expression

Uh sandbox much? Or you read the question, wrote code and posted it all within one minute?!

@JonathanAllan This was not sandboxed. It is much easier than you might think.

Uh, well I cant even read the question in the time it took

@JonathanAllan No sandbox reading, just happened to catch the question just after it was posted and come up with an algorithm almost immediately.

Welp it took me ~4min to read the question, so +1 for speed-reading/speed-understanding :)

It's really not as hard as it looks: I just looked at the example and noticed that he was just summing of the digits of each prefix

Yeah - exactly what I did in my answer.

Brain-Flak, 28 bytes
(([]){[{}]({}<>{})<>([])}{})

Try it online!
14 bytes if we don't need to support zeros (which we do)
({({}<>{})<>})

Try it online!
DJMcMayhem has a cool answer here you should check out.  Unfortunately for him I wasn't about to let him win at his own language :P
How does it work?
Lets start with the simple version.
({({}<>{})<>})

The main action here is ({}<>{})<>, that takes the top of the left stack and adds to to the top of the right stack.  By looping this operation we sum up the current stack (until it hits a zero) placing the sum on the off stack.  That's pretty mundane, the interesting part is that we sum up the results of all these runs as our result.  This will calculate the desired value.  Why?  Well lets take a look at an example, 123.  On the first grab we just get 1 so our value is 1
1

On the next grab we return 1 plus the 2
1
1+2

On the last run we have all three together
1
1+2
1+2+3

Do you see the triangle?  The sum of all the runs is the "triangle" of the list.

Ok but now we need it to work for zeros, here I used the same trick as DJMcMayhem, plus some fancy footwork.  Instead of looping until we hit a zero we loop until the stack is empty.
([])({<{}>({}<>{})<><([])>}{})

I then used this tip, written by none other than yours truly, to golf off another 2 bytes.
(([]){[{}]({}<>{})<>([])}{})

And there we have it.  I would be surprised if there was a shorter solution,  but then again stranger things have happened.

Unfortunately for him I wasn't about to let him win at his own language :P I expect nothing less from you. :D

JavaScript (ES6), 28 bytes
a=>a.map(d=>t+=c+=d,t=c=0)|t

Takes input as a list of digits.

Python 3, 37 bytes
f=lambda n:len(n)and sum(n)+f(n[:-1])

Try it online!

...Why the downvote?

I think you could change len to sum as well, though I don't believe that helps anything.

@ETHproductions Yeah. I was hoping I could make use of the fact that sum([]) is 0, but nothing was quite coming together... there might be a way though

Didn't see this otherwise I'd have given you my improvement.

@JonathanAllan No worries :P

Funny that I ended up with a similar one only that it takes string and is longer.. :D

C# (.NET Core), 59 bytes
using System.Linq;N=>N.Reverse().Select((d,i)=>i*d+d).Sum()

Try it online!
Substantially different from the other C# answers. Input is a list of digits. All test cases included in the TIO link.
Could save a bunch of bytes if allowed to take input as a backwards list of digits with leading 0.

Nice idea! Some fierce codegolfing in C#.

Nice solution! But isn't the input specified to be a non-negative number, not a list of digits?

@IanH. Rule 2: You may take input and provide output by any allowed mean. When it comes to the format, you can take the input as an integer, as a String representation of the integer or as a list of digits.

Python 3, 35 bytes
I just noticed that this is only really a slight golf of Business Cat's answer in the end though!
f=lambda a:a>[]and sum(a)+f(a[:-1])

Try it online!

Funny that I ended up with a similar one only that it takes string and is longer.. :D

J, 7 6 bytes
1#.+/\

Try it online! Takes a list of digits, such as f 6 5 4 3 2 1.
Explanation
The current explanation is same as the old, but noting that 1#.x ⇔ +/x (both compute sum).
Old:
[:+/+/\    (for explanation, input = 6 5 4 3 2 1)
      \    over the prefixes of the input:
     /         reduce:
    +              addition (summation)
           this gives is the cumulative sum of the input:  6 11 15 18 20 21
[:         apply to the result:
  +/           summation
           this gives the desired result:   90

A little more true to the original problem would be [:+/@,]/, which is "sum" (+/) the flattened (,) prefixes of the input (]\).

6 bytes

@south excellent spot

Vim, 60 59 32 keystrokes
Thanks a lot @CowsQuack for the tip with the recursive macro and the h trick, this saved me 27 bytes!
qqYp$xh@qq@qVHJ:s/./&+/g⏎
C<C-r>=<C-r>"0⏎

Try it online!
Ungolfed/Explained
This will build the triangle like described (only that it keeps it left-aligned):
qq       q    " record the macro q:
  Yp          "   duplicate the line
    $x        "   remove last character
      h       "   move to the left (this is solely that the recursive macro calls stop)
       @q     "   run the macro recursively
          @q  " run the macro

The buffer looks now like this:
53716
5371
537
53
5

Join all lines into one and build an evaluatable expression from it:
VH             " mark everything
  J            " join into one line
   :s/./&+/g⏎  " insert a + between all the characters

The " register now contains the following string (note missing 0):
5+3+7+1+6+ +5+3+7+1+ +5+3+7+ +5+3+ +5+ +

So all we need to do is append a zero and evaluate it:
 C                " delete line and store in " register
  <C-r>=       ⏎  " insert the evaluated expression from
        <C-r>"    " register "
              0   " append the missing 0

You can use & (the whole match) instead of \1 in the substitute command

qqYp$xq:exe"norm".col('.')."@q"⏎ can become qqYp$xh@qq@q. This recursive macro will encounter a breaking error when there is one character on the line, after which it will stop.

So the substitution can just become :s/./&+/g. Also :%j⏎ can become V{J. And, Di can become C (I've already commented about this in another one of your Vim answers). Try it online!

Perl 5, 19 + 1 (-p) = 20 bytes
s/./$\+=$p+=$&/ge}{

Try it online!
How?
$\ holds the cumulative total, $p holds the total of the digits on the current line.  Each line of the parallelogram is simply the previous line with the next digit of the number appended.  Therefore, it is the sum of the previous line plus the new digit.  This iterates over all of the digits, calculating the sums as it goes.  The actual substitution is irrelevant; it's just a means to iterate over the digits without creating an actual loop.  At the end, $\ is printed implicitly by the -p option.

Python 2, 49 45 bytes
-4 bytes thanks to Mr. Xcoder.
lambda n:sum(-~i*n[~i]for i in range(len(n)))

Try it online!
Takes input as a list of digits.

Bash + GNU utilities, 32 24
tac|nl -s*|paste -sd+|bc

Input read from STDIN.
Update: I see the input may be given as a list of digits.  My input list is newline-delimited.
Try it online.
Explanation
tac                       # reverse digit list
   |nl -s*                # prefix line numbers; separate with "*" operator
          |paste -sd+     # join lines onto one line, separated with "+" operator
                     |bc  # arithmetically evaluate

APL, 4 bytes
+/+\

This takes the input as a list of digits, e.g.:
      (+/+\) 5 3 7 1 6
66

Explanation
+/    sum of
  +\  partial sums of input

Pari/GP, 20 bytes
Takes the input as a list of digits.
a->a*Colrev([1..#a])

Try it online!

Pari/GP, 15 bytes
Takes the input as a polynomial. For example, 5*x^4 + 3*x^3 + 7*x^2 + x + 6 means 53716.
a->(a+a')%(x-1)

Try it online!

Taxi, 1478 bytes
Go to Post Office:w 1 l 1 r 1 l.Pickup a passenger going to Chop Suey.Go to Chop Suey:n 1 r 1 l 4 r 1 l.[a]Switch to plan "b" if no one is waiting.Pickup a passenger going to The Babelfishery.Go to Zoom Zoom:n 1 l 3 r.1 is waiting at Starchild Numerology.Go to Starchild Numerology:w 4 l 2 r.Pickup a passenger going to Addition Alley.Go to Addition Alley:w 1 r 3 r 1 r 1 r.Pickup a passenger going to Addition Alley.Go to The Babelfishery:n 1 r 1 r.Go to Chop Suey:n 6 r 1 l.Switch to plan "a".[b]Go to Addition Alley:n 1 l 2 l.Pickup a passenger going to Cyclone.[c]Go to Zoom Zoom:n 1 l 1 r.Go to Cyclone:w.Pickup a passenger going to The Underground.Pickup a passenger going to Multiplication Station.Go to The Babelfishery:s 1 l 2 r 1 r.Pickup a passenger going to Multiplication Station.Go to Multiplication Station:n 1 r 2 l.Pickup a passenger going to Addition Alley.Go to The Underground:n 2 l 1 r.Switch to plan "d" if no one is waiting.Pickup a passenger going to Cyclone.Go to Addition Alley:n 3 l 1 l.Switch to plan "c".[d]Go to Addition Alley:n 3 l 1 l.[e]Pickup a passenger going to Addition Alley.Go to Zoom Zoom:n 1 l 1 r.Go to Addition Alley:w 1 l 1 r.Pickup a passenger going to Addition Alley.Switch to plan "f" if no one is waiting.Switch to plan "e".[f]Go to Zoom Zoom:n 1 l 1 r.Go to Addition Alley:w 1 l 1 r.Pickup a passenger going to The Babelfishery.Go to The Babelfishery:n 1 r 1 r.Pickup a passenger going to Post Office.Go to Post Office:n 1 l 1 r.

Try it online!
Un-golfed:
[ Pickup stdin and split into digits ]
Go to Post Office: west 1st left 1st right 1st left.
Pickup a passenger going to Chop Suey.
Go to Chop Suey: north 1st right 1st left 4th right 1st left.
[a]
[ Count the digits ]
Switch to plan "b" if no one is waiting.
Pickup a passenger going to The Babelfishery.
Go to Zoom Zoom: north 1st left 3rd right.
1 is waiting at Starchild Numerology.
Go to Starchild Numerology: west 4th left 2nd right.
Pickup a passenger going to Addition Alley.
Go to Addition Alley: west 1st right 3rd right 1st right 1st right.
Pickup a passenger going to Addition Alley.
Go to The Babelfishery: north 1st right 1st right.
Go to Chop Suey: north 6th right 1st left.
Switch to plan "a".
[b]
Go to Addition Alley: north 1st left 2nd left.
Pickup a passenger going to Cyclone.
[c]
[ Multiply each digits by Len(stdin)-Position(digit) ]
Go to Zoom Zoom: north 1st left 1st right.
Go to Cyclone: west.
Pickup a passenger going to The Underground.
Pickup a passenger going to Multiplication Station.
Go to The Babelfishery: south 1st left 2nd right 1st right.
Pickup a passenger going to Multiplication Station.
Go to Multiplication Station: north 1st right 2nd left.
Pickup a passenger going to Addition Alley.
Go to The Underground: north 2nd left 1st right.
Switch to plan "d" if no one is waiting.
Pickup a passenger going to Cyclone.
Go to Addition Alley: north 3rd left 1st left.
Switch to plan "c".
[d]
Go to Addition Alley: north 3rd left 1st left.
[e]
[ Sum all the products ]
Pickup a passenger going to Addition Alley.
Go to Zoom Zoom: north 1st left 1st right.
Go to Addition Alley: west 1st left 1st right.
Pickup a passenger going to Addition Alley.
Switch to plan "f" if no one is waiting.
Switch to plan "e".
[f]
[ Output the results ]
Go to Zoom Zoom: north 1st left 1st right.
Go to Addition Alley: west 1st left 1st right.
Pickup a passenger going to The Babelfishery.
Go to The Babelfishery: north 1st right 1st right.
Pickup a passenger going to Post Office.
Go to Post Office: north 1st left 1st right.

SNOBOL4 (CSNOBOL4), 79 bytes
	N =INPUT
D	N LEN(1) . D REM . N	:F(O)
	X =X + D
	Y =Y + X	:(D)
O	OUTPUT =Y
END

Try it online!
Input from stdin, output to stdout.

Python 2, 56 bytes
lambda x:sum(i*int(`x`[-i])for i in range(1,1+len(`x`)))

Try it online!

54 bytes or 45 bytes with input as lists oft digits.

Jelly,  5  4 bytes
Ṛæ.J

A monadic link taking a list of decimal digits and returning the triangle of the number that list represents.
Try it online!
How?
Ṛæ.J - Link: list of numbers (the decimal digits), d   e.g. [9,4,5,0]
Ṛ    - reverse d                                            [0,5,4,9]
   J - range(length(d))                                     [1,2,3,4]
 æ.  - dot-product            (0*1 + 5*2 + 4*3 + 9*4 = 58)  58

I had thought removing € would still work. Pity...

@ETHproductions ...and yet there's a built-in to help!

...okay, wow...

@ETHproductions ooops had to reverse it >_<

Java 8, 53 bytes
I implemented a lambda for each acceptable input type. They each iterate through the number's digits, adding the proper multiple of each to an accumulator.
Integer as input (53 bytes)
Lambda from Integer to Integer:
n->{int s=0,i=1;for(;n>0;n/=10)s+=n%10*i++;return s;}

String representation as input (72 bytes)
Lambda from String to Integer:
s->{int l=s.length(),n=0;for(int b:s.getBytes())n+=(b-48)*l--;return n;}

Digit array as input (54 bytes)
Lambda from int[] (of digits, largest place value first) to Integer:
a->{int l=a.length,s=0;for(int n:a)s+=n*l--;return s;}

-7 bytes thanks to Olivier Grégoire

a->{int l=a.length,s=0;for(int n:a)s+=n*l--;return s;} 54 bytes for the array version.

Retina, 13 bytes
.
$`$&
.
$*
1

Try it online! Link includes test cases. Explanation: The first stage generates all the prefixes of the original number, the second stage converts each digit to unary, and the third stage takes the total.

Mathematica, 49 bytes
Tr@Array[Tr@s[[;;#]]&,Length[s=IntegerDigits@#]]&

You can take the input as a list of digits. #.Range[Length@#,1,-1]&

Improving @alephalpha 's solution: #.Range[Tr[1^#],1,-1]&

Tr@*Accumulate

Neim, 3 bytes

Explanation:
        Get prefixes of input, including itself
        Implicitly join elements together, and create an array with all the digits
        Sum

Try it online!
Alternative answer:

Explanation:
       Get prefixes of input, including itself
        Join
        Implicitly convert to a digit array, and sum

Try it online!

Pyt, 9 6 bytes
ąĐŁř↔·

Explanation:
                 Implicit input
ą                Convert to array of digits
 Đ               Duplicate digit array
   Łř↔           Create a new array [len(array),len(array)-1,...,1]
      ·          Dot product with digit array
                 Implicit output

Common Lisp, 53 52 bytes
(loop as(x . y)on(reverse(read))sum(+(reduce'+ y)x))

Input as list of digits.
Try it online!
-1 byte thanks to @ceilingcat.

@ceilingcat, some Common Lisp compilers will actually fail when apply is applied against very long lists because of the call-arguments-limit.

Python 3,  94  58   54 bytes
Thanks to Mr. Xcoder for helping me save quite some bytes!
lambda n:sum(int(v)*(len(n)-i)for i,v in enumerate(n))

Try It Online!
Takes input as a string. It simply multiplies each digit by the number of times it needs to be added and returns their sum.

Nice first answer, but please make your submission a serious contender by removing unnecessary whitespace, and making all variable / function names 1 byte long. 69 bytes

58 bytes.

@Mr.Xcoder Thanks. I will keep that in mind.

You may not assume that it will always be called with 0. If p must always be 0, you should replace the p with p=0 in the lambda declaration. However, you can just remove p entirely to get 54 bytes

Perl 6, 13 bytes
Takes a list of digits

{[+] [\+] @_}

Try it online!
Perl 6 has a produce routine, which can be more tersely invoked using the 'triangle reduce' meta operator: [\ ]. Seems like it was made for this task.

Vyxal, 2 bytes
¦∑

Try it Online!
Explained
¦∑
¦  # cumulative sum
 ∑ # sum

PowerShell, 54 48 40 bytes
param($a)$a|%{$o+=$_*($a.count-$i++)};$o

Try it online!
Takes input as a list of digits.
Note that the output is just the input digit multiplied by its corresponding negative index in the string and then cumulatively summed. So, that's what we do here.
We loop over each element in the input list, each iteration perform a multiplication, and then sum the results together into the total $o+=. That's left on the pipeline, output is implicit.

05AB1E, 3 bytes
Code
ηSO

Try it online!
Explanation
η      # Take the prefixes of the number
 S     # Split into single numbers
  O    # Sum all the numbers

JavaScript (ES6), 34 bytes
f=(n,i=1)=>n&&n%10*i+f(n/10|0,i+1)

Test cases

f=(n,i=1)=>n&&n%10*i+f(n/10|0,i+1)

console.log(f(0)) // -> 0
console.log(f(1)) // -> 1
console.log(f(12)) // -> 4
console.log(f(123)) // -> 10
console.log(f(999)) // -> 54
console.log(f(100000)) // -> 6
console.log(f(654321)) // -> 91

Literally exactly what I had. However I do also have a 1-byte-shorter solution taking input as a string...

@ETHproductions Ah, I first tried with a string but ended up with something longer.

Gaia, 4 3 bytes
…_Σ

Function accepting a list of digits and leaving the result on the stack.
Try it online!
Explanation
…    Prefixes
 _   Flatten
  Σ  Sum

Crossed out 4 is still 4 :(

What's the footer for?

@Okx Each line in Gaia is a function (like Jelly), so the footer  is just calling it.

So, why doesn't it work without the footer?

@Okx Because I haven't yet made it detect a list from the input format, so I have to eval it (e) first

C# (.NET Core), 80 bytes
n=>{int v=0,i=0;for(;i<n.Length;)v+=int.Parse(n[i]+"")*(n.Length-i++);return v;}

Try it online!
Takes a string as input and outputs the triangled number.

Explanation:
For each character in the input string, convert the char to an int and multiply it by the length of the string minus the index of the char.

Python 3, 58 bytes
lambda n:sum(-~i*int(c)for i,c in enumerate(str(n)[::-1]))

Try it online!

C# (.NET Core), 84 68 bytes
a=>a.Select((x,i)=>a.Take(i+1).Sum(c=>c-48)).Sum()

Byte count also includes
using System.Linq;

Try it online!
Explanation:
a=>                     // Take a string
    a                   // Take the string as collection of chars
    .Select((x,i)=>     // Replace the collection with
        a.Take(i+1)     // Substrings increasing in size
        .Sum(c=>c-48))  // Sum each substring's digits (as ints) together
    .Sum()              // Sum the new collection of sums

I know it's a little bigger than there's already posted C# answer, but mine is coming from a different approach so I thought I will post it anyway.

TXR Lisp, 67 40 bytes
(opip digits reverse conses flatten sum)

Run:
1> (opip digits reverse conses flatten sum)
#<intrinsic fun: 0 param + variadic>
2> [*1 53716]
66

Note that if we take advantage of the input being a list of integers representing digits, this reduces to:
(opip reverse conses flatten sum)

and if the digits may be in reverse order already, then just
(opip conses flatten sum)

Note also that this is a "useless use of opip"; all the terms are function names, and so [chain digits reverse conses flatten sum] could be used, and that would be the recommended way to code this; it's just one character longer.

PHP, 51 55 bytes
+4 bytes—original version failed on all inputs with 0 as a digit.
<?php while($x!=$d=array_pop($argv))$t+=++$p*$d;echo$t;

Try it online!
EXPLANATION:
<?php

The programme takes separate digits as CLI parameter arguments, which arrive in the code as an array, $argv.
Each character at a time is popped from the end of the array. When the array is empty array_pop returns null. Null is detected by comparing the result to an undeclared variable $x, a saving of 2 code bytes over using null itself. (Without this comparison any 0 digit evaluates to false and the loop ends early.)
while ($x != $d = array_pop($argv))

$p is the position from the end i.e. the last digit (the first one popped) is in position 1. $p is
undeclared and so equals 0, but is incremented before it is used each time, so starts off as 1.
The position is multiplied by the digit and added to the total $t.
    $t += ++$p * $d;

The final result is printed.
echo $t;

Python 2, 46 bytes

Takes in string, returns integer

f=lambda a:a and sum(map(int,a))+f(a[:-1])or 0

Try it online!

Ruby, 32 bytes
->a{b=a.pop;a[0]?b+a.sum+f[a]:b}

Try it online!

Python 2, 56 bytes
lambda a:sum((i+1)*int(a[-i-1])for i in range(0,len(a)))

Try it online!
Some edit as suggested by @Mr.Xcoder
Python 2, 50 bytes
lambda a:sum(-~i*int(a[~i])for i in range(len(a)))

Try it online!

50 bytes (-6 bytes). (i+1) means bitwise -~i, thus requiring no brackets and -i-1 is just ~i, again bitwise. range(0,len(a)) is equivalent to the unary range range(len(a)).

Excel VBA Immediate Window, 60 bytes
a=StrReverse([A1]):For i=1 ToLen(a):b=b+i*Mid(a,i,1):Next:?b

Input is in cell A1 of the active sheet. Output is to the VBA immediate window.

Clojure, 26 bytes
#(apply +(reductions + %))

There's a built-in, but in standard Clojure fashion, it's a long-ass word. Takes input as a list of digits.

Can you add a testing link or instructions on how to run it?

Röda, 31 21 bytes
{i=0{[i]if i+=_}|sum}

Try it online!
Takes the input as a stream of digits.
31 bytes
{addHead 0|reduceSteps _+_|sum}

Try it online!
Takes the input as a stream of digits.
Explanation:
{addHead 0|reduceSteps _+_|sum} /* An anonymous function */
 addHead 0                      /* Append 0 to the beginning of the stream */
          |reduceSteps _+_      /* Create a cumulative sum */
                          |sum  /* Sum all numbers in the stream */

The reduceSteps function does not return the first item in the stream, so it is necessary to add a zero at the head of the stream.

TI-BASIC, 4 bytes
sum(cumSum(Ans

Takes a list of digits as input, and calculates the sum of the cumulative sum (i.e. prefix sum) of the list.
The cumSum( token is 2 bytes large.

Math++, 56 bytes
?>n
n>g
o+g%10>o
_(g/10)>g
3+3*!g>$
_(n/10)>n
2+6*!n>$
o

Excel VBA, 57 Bytes
Anonymous VBE immediate window function that takes input from the range [A1], and outputs the triangle sum described above to the VBE immediate window
l=[Len(A1)]:For i=1To l:s=s+Mid([A1],i,1)*(l+1-i):Next:?s

Scala, 64 bytes
def f(s:String)=s.indices.flatMap(i=>s.take(i+1).map(_-'0')).sum

Python 3, 106 bytes
a=input()
c=[]
d=0
b=[int(g) for g in a]
for i in range(1,len(a)+1):
    c+=b[0:i]
for t in c:
    d+=t
print(d)

Try It Online!
My original code was:
a,c,d=input(),[],0
b=[int(g) for g in a]
for i in range(1,len(a)+1):
    c+=b[0:i]
for t in c:
    d+=t
print(d)

But then I realized that by initializing all of my variables on one line, I gained two characters. :P

Ah Ah Ah! I am not the loser!

Add++, 11 6 bytes
L~,¬+s

Try it online!

Ruby 29 bytes
f=->n{*a,b=n;b ?n.sum+f[a]:0}

Try it online!

R, 75 bytes
function(x,b=nchar(x))sum(sapply(x%/%10^(0:b),function(y)y%/%10^(0:b)%%10))

Try it online!

I did not see an R solution yet, so here goes..

49 bytes -- I had actually solved this but it was a snippet rather than a full program/function so yours is better.

@Giuseppe 51 bytes: sum(cumsum(as.numeric(el(strsplit(scan(,""),""))))), but your version is 2 bytes shorter...

@AndreïKostyrka we can join forces and get to 47 bytes!

Fig, \$2\log_{256}(96)\approx\$ 1.646 bytes
Sk

Try it online!
Sk # Takes a list of digits as input
 k # Prefixes
S  # Sum of the automagically flattened list

K (ngn/k), 10 8 bytes
+/+\.'$:

Try it online!
-2 bytes thanks to ngn
Pretty basic train.
Explanation:
+/+\.'$:    Main function. Takes implicit input with Right (:)
      $     Convert input to string
     '      For each of the characters
    .       Eval them, converting them into a number
  +\        Cumulative sum
+/          Sum

for converting to digits, .' works too

Vyxal 3 s, 1 byte
@

Try it Online!
yay

C (gcc), 51 50 bytes
-1 byte thanks to @ceilingcat
i,r;f(t,l)int*t;{for(;l;)for(i=--l;~i;)r+=t[i--];}

Try it online!

Tcl, 97 bytes
proc T n {time {incr s [expr [regsub -all (.) $n +\\1]]
regsub .$ $n "" n} [string len $n]
set s}

Try it online!

Tcl, 105 bytes
proc T n {time {incr s [expr [join $L +]]
set L [lreplace $L e e]} [llength [set L [split $n ""]]]
set s}

Try it online!

Failed outgolf: 108 bytes: https://tio.run/##PU1LCsIwFNy/U8zChSJKX2sr9RzdpV3UGkohjSFJQSg5e0wQHGY1Xz@pGI19T@igsftlldgXPVk4CPkxFsLK2W1PXEalcLyecNA49z0PAznpU0k4bxc9w47ZKiD168JD@OtK6mT80i5EtY4mX1Fd3bmhgpi4TKyobVsQFxnU1LeqZArYzeZd6j9El1dC/AI

Gol><>, 8 bytes
IEh@+:@+

Try it online!
Input format is space-separated digits.
How it works
IEh@+:@+

I         Take next input as number
 E        If last input was EOF...
  h       Print the top as number and halt
          Otherwise...
          The stack looks like [sum_of_digits triangle digit]
   @      Move 3rd from top (sum_of_digits) to the top
    +     Add top two (update `sum_of_digits`)
     :    Duplicate top
      @+  Add `sum_of_digits` to `triangle`
          Repeat from the beginning

EXCEL, 55 bytes
Using Immediate Window.
[A65:A89]="=MID(REPT(CHAR(ROW())&CHAR(ROW()+1),2),1,3)"

Zsh, 60 bytes
f(){echo $((${(j:+:)${(@f)$(for i in $@;echo $((x+=i)))}}))}

Try it online!
Takes input as individual parameters

Factor + math.unicode, 14 bytes
[ cum-sum Σ ]

Try it online!

Thunno 2 S, 2 bytes
ƒʂ

Attempt This Online!
Explanation
ƒʂ  # implicit input  ->  654321
ƒ   # preƒixes        ->  [[6], [6,5], [6,5,4], [6,5,4,3], [6,5,4,3,2], [6,5,4,3,2,1]]
 ʂ  # ʂum each list   ->  [6, 11, 15, 18, 20, 21]
    # sum this list   ->  91
    # implicit output

source: Stack Exchange

license: 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/

sort: votes


text:
tail: troll: file truncated
Background
When you run tail -f file in bash, the file is outputted and then any subsequent appends.
However, when you remove something that has already been displayed, tail outputs:
tail: nameoffile: file truncated

Your Challenge
When given an input f, append tail: [value of f]: file truncated (with trailing & leading newline) to the file f. You can assume that file f exists, the device is not full, f is not empty, and that you have permissions to write to f.
Test Cases
Input: something
File before:
Some
thing

File after:
Some
thing
tail: something: file truncated

Input relative/path/to/file
File before:
tail: relative/path/to/file: file truncated

File after:
tail: relative/path/to/file: file truncated
tail: relative/path/to/file: file truncated

Reference Implementation (Node.js)
x=>require("fs").appendFileSync(x,`
tail: ${x}: file truncated
`)

I didn't downvote but it doesn't seem too complicated to me.

I'm not sure your "Reference Implementation" would count as a valid answer. You need to require fs.

Bash, 4̴0̴ 4̴6̴ 33 bytes
echo tail: $1: file truncated>>$1

Try it online!
Thanks @DigitalTrauma for -7 bytes!

Pyth - 33 bytes
.w%"\ntail: %s: file truncated"QQ

Can't you remove "QQ?

@EriktheOutgolfer no, because then .w would write to o.txt

Python 3, 61 bytes
f=input();open(f,"a").write("\ntail: %s: file truncated\n"%f)

Can't really try it online... Try it online!

Edit Request: Change TIO link <-- This version makes the input work with the header/footer example code.

Seems like you don't need the first \n, that would make your solution shorter and correct.

with python2: -2 bytes

Batch, 47 bytes
@echo(>>%1
@echo tail: %~1: file truncated>>%1

Assuming DOS newlines are acceptable on Windows...

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


text:
Can you count the number of rectangles?
One of my favorite mathematical pastimes is to draw a rectangular grid, then to find all of the rectangles that are visible in that grid.  Here, take this question, and venture for yourself!
Can you count the number of rectangles?
+-----+-----+-----+-----+
|     |     |     |     |
|     |     |     |     |
+-----+-----+-----+-----+
|     |     |     |     |
|     |     |     |     |
+-----+-----+-----+-----+
|     |     |     |     |
|     |     |     |     |
+-----+-----+-----+-----+
|     |     |     |     |
|     |     |     |     |
+-----+-----+-----+-----+

The total number of rectangles for this 4 x 4 minichess board is exactly

 100

Were you correct?
Related math: How many rectangles are there on an 8×8 checkerboard?
The Challenge
Write the shortest function/program that counts the total number of visible rectangles on a non-toroidal grid/image.
Related challenges: Count the Unique Rectangles!, Find number of rectangles in a 2D byte array.
Input Format
Your function or program can choose to work with either text-based input or graphical input.
Text-based Input
The grid will be an m-by-n (m rows, n columns) ASCII grid consisting of the following characters:

spaces,
- for parts of a horizontal line segment,
| for parts of a vertical line segment, and
+ for corners.

You can introduce this ASCII grid as the input/argument to your program/function in the form of

a single string delimited by line-breaks,
a string without newlines but with one or two integers encoding the dimensions of the grid, or
an array of strings.

Note:  The text-based input contains at least 1 row and at least 1 column.
Graphical Input
Alternatively, the grids are encoded as black-and-white PNG images of 5*n pixels wide and 5*m pixels high.  Each image consists of 5 px * 5 px blocks that correspond to the ASCII input by:

Spaces are converted to white blocks.  These blocks are called the whitespace blocks.
Line segments and corners are converted to non-whitespace blocks.  The center pixel of such blocks are black.
Edit: If two corners (in the ASCII input) are connected by a line segment, the corresponding block centers (in the graphical input) should be connected by a black line, too.

This means that each block could only be chosen from  (Click here for larger image).
Note:  The blue boundaries are only for illustration purposes.  Graphical input is at least 5 px wide and 5 px high.  You can convert the graphical input to any monochrome image, potentially of other image file formats).  If you choose to convert, please specify in the answer.  There is no penalty to conversion.
Output Format
If you are writing a program, it must display a non-negative number indicating the total number of rectangles in the input.
If you are writing a function, it should also return a non-negative number indicating the total number of rectangles in the input.
Example Cases
Case 1, Graphic:  (30 px * 30 px), ASCII: (6 rows, 6 cols)
+--+
|  |
| ++-+
+-++ |
  |  |
  +--+

Expected output: 3
Case 2, Graphic:  (20 px * 20 px), ASCII: (4 rows, 4 cols)
++-+
|+++
+++|
+-++

Expected output: 6
Case 3, Graphic:  (55 px * 40 px), ASCII: (8 rows, 11 cols)
  +++--+
+-+++  |
|  |  ++--+
+--+--++ ++
      |  ||
      |  ||
++    +--++
++

Expected output: 9
Case 4, Graphic:  (120 px * 65 px), ASCII: (13 rows, 24 cols)
+--+--+ +--+  +--+  +--+
|  |  | |  |  |  |  |  |
+--+--+ |  |  |  |  |  |
|  |  | +--+--+--+--+--+
+--+--+    |  |  |  |
           |  |  |  | ++
+-+-+-+-+  +--+  +--+ ++
| | | | |
+-+-+-+-+-+-+-+-+-+-+-+
| | | | | | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+
| | | | | | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+

Expected output: 243
Case 5, Graphic:  (5 px * 5 px. Yes, it is there!), ASCII: Just a single space.
Expected output: 0
Case 6, Graphic:  (35 px * 20 px), ASCII: (4 rows, 7 cols)
+--+--+
|++|++|
|++|++|
+--+--+

Expected output: 5
Assumptions
To make life easier, you are guaranteed that:

By being non-toroidal, the grid does not wrap either horizontally or vertically.
There are no loose ends, e.g. +--- or +-  -+.  All line segments have two ends.
Two lines that meet at + must intersect each other at that point.
You do not have to worry about invalid inputs.

Rules against standard loopholes apply.  Please treat squares as rectangles.  Optionally, you could remove the trailing spaces on each row of the grid.
This is code-golf, so make your entry as short as possible.  Text-based and graphical solutions will compete together.
Leaderboard

var QUESTION_ID=137707,OVERRIDE_USER=11933;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/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

Is monochrome bitmap allowed?

@user202729 Yes.  If you choose to work with non-PNG images, please specify that in the answer.

Is this a valid input? (Rectangle corner touches border of larger rectangle.) If so, consider adding it as a test case.

@Zgarb It is valid input.  I'll edit the post, too.

Is there a reason you put the expected outputs in spoilers? It seems like it just makes verifying your code slightly more annoying.

@FryAmTheEggman This issue wasn't raised during sandbox stage.  It makes a good spoiler for people who want to try to count.  I'll fix it anyway.

Grime, 31 28 bytes
T=\+[+\-]*\+/[+|]/+$
n`T&To2

Try it online!
Takes input in ASCII format.
Explanation
Grime's syntax is very close to regular expressions.
Each line defines a pattern that may or may not match a rectangle of characters.
T matches a rectangle whose top row and left column look valid.
T=\+[+\-]*\+/[+|]/+$
T=                    Define T as
  \+[+\-]*\+          a row that matches this regex
            /         and below that
             [+|]/+   a column of + or |
                   $  with anything to its right.

The second row is the "main program".
n`T&To2
n`       Print number of rectangles that match
  T      the pattern T
   &     and
    To2  T rotated 180 degrees.

JavaScript (ES6), 176 171 bytes

g=a=>Math.max(...b=a.map(a=>a.length))-Math.min(...b)?``:f(a);f=
a=>a.map((b,i)=>[...b].map((_,j)=>n+=a.join`
`.split(eval(`/\\+(?=[-+]{${j}}\\+[^]{${l=b.length+~j}}([|+].{${j}}[|+][^]{${l}}){${i}}\\+[-+]{${j}}\\+)/`)).length>>1),n=0)|n
<textarea rows=8 cols=8 oninput=o.textContent=g(this.value.split`\n`)></textarea>

Takes input as an array of strings of equal length. Explanation: Creates a series of regular expressions that match rectangles of all possible widths and heights (and some impossible widths and heights, but that's code golf for you) and counts how many matches they all produce. Because there's a capturing group in the regexp, split returns 2n+1 for n matches, so I right shift by 1 to get the number of matches, as that saves a byte over making the group non-capturing.

Hmm, the code snippet is not working for me [Firefox 54.0.1 (32bit) or Chrome 60.0.3112.90 (64bit) both on Windows (64bit)].

The snippet It doesn't work on Safari either [Mac (64bit)].

It seems that we have to paste stuff into the text area.  Same number of characters per line is required.

Ah I see, good spot @FrenzyLi!

J, 103 95 86 80 76 70 bytes
[:+/@,]*/@('-|++'*/@(e.,&'+')~&>]({.,{:)&.>@;|:;{.;{:);._3"$~2+$#:i.@$

Try it online!
Takes input as an array of strings with trailing spaces (so that each string is the same size). Uses the full subarray operator ;._3 to iterate over every possible subarray size larger than 2 x 2, and counts the subarrays that are valid rectangles. Completes all test cases almost instantly.

@FrenzyLi Thanks. The function is receiving the input as an array of strings, but I encoded each each array as a flat string reshaped into an array before I stored them in each variable to be used as an argument for the function.

Ahh...  Thank you for your explanation.

@miles nice.  when you say input as array of strings, is each line of the input 1 sting?

@Jonah Strings in J are just arrays of chars, so the input is actually a 2d array of chars.

Mathematica, 136 134 132 bytes
S=Tr@*Flatten;S@Table[1-Sign@S@{d[[{i,j},k;;l]],d[[i;;j,{k,l}]]},{i,($=Length)[d=ImageData@#]},{j,i+1,$@d},{k,w=$@#&@@d},{l,k+1,w}]&

Usage: (for old 136-byte version, but the new version is basically identical)

Note:

This runs in time O(m2 n2 max(m, n)), so only use small inputs.
Although this is supposed to work with binary images, apparently it can work with non-binary images. (but black must be identically zero)
The graphics doesn't necessarily be constructed with 5x5 blocks, the blocks can be smaller.
@* is new in version 10. In older versions, use Tr~Composition~Flatten instead of Tr@*Flatten.

Which version of MMA is this in?  In 9.0, it responds with "Tr@" cannot be followed by "*Flatten".

@FrenzyLi 10.0. Yes, @* (shorthand for Composition)is new in version 10.

Why don't you just use RectangleCount[]?

@MCMastery Mathematica is famous for having a lot of built-in, but not this one.

@user202729 lol yep, im jk

Jelly,  60 53 52 51  50 bytes
ÑFQe⁹ṚẆ;W¤
Ḣ,Ṫ
=”+ÇÇ€Ạȧ1ŀ
Zç⁾+-ȧç⁾+|$
Ẇ;"/€Ẇ€Ç€€FS

A full program accepting a list of strings (equal length rows) and printing the count.
Try it online!
...or for ease of copy & pasting input use this full program (with an extra byte to split lines)
- do note the lines are required to contain trailing spaces for the program to function correctly though.
How?
ÑFQe⁹ṚẆ;W¤   - Link 1, sidesAreValid?: list of lists, area; list allowedSideCharacters
Ñ            - call the next link (2) as a monad (get the sides in question
             -   note: these sides do not include the corners since the area was modified
             -   to not include the other sides by the first call to link 2 inside link 3.
 F           - flatten into a single list
  Q          - de-duplicate (unique characters)
         ¤   - nilad followed by link(s) as a nilad:
    ⁹        -   right argument (either "+-"                or "+|"               )
     Ṛ       -   reverse        (either "-+"                or "|+"               )
      Ẇ      -   all sublists   (either ["-","+","-+"]      or ["|","+","|+"]     )
        W    -   wrap           (either ["+-"]              or ["+|"]             )
       ;     -   concatenate    (either ["-","+","-+","+-"] or ["|","+","|+","+|"])
   e         - exists in?

Ḣ,Ṫ          - Link 2, topAndTail helper: list
Ḣ            - head (get the first element and modify the list)
  Ṫ          - tail (get the last element and modify the list)
 ,           - pair (the elements together)

=”+ÇÇ€Ạȧ1ŀ   - Link 3, isPartlyValid?: list of lists, area; list allowedSideCharacters
=”+          - equal to '+'? (vectorises across the whole area, 1 if so, 0 otherwise)
   Ç         - call the last link (2) as a monad (gets the values for two edges)
    Ç€       - call the last link (2) as a monad for €ach (...values for the four corners)
      Ạ      - all? (all corners are '+' 1 if so, 0 if not)
        1ŀ   - call link number 1 as a dyad with sideCharacters as the right argument
             -    ...and the modified area on the left
       ȧ     - logical and (both all corners are '+' and the sides in question look right)

Zç⁾+-ȧç⁾+|$  - Link 4, isValidSquare?: list of lists, area
Z            - transpose
 ç⁾+-        - call the last link (3) as a dyad with right argument "+-"
          $  - last two links as a monad:
      ç⁾+|   -   call the last link (3) as a dyad with right argument "+|"
     ȧ       - logical and (1 if so 0 otherwise)

Ẇ;"/€Ẇ€Ç€€FS - Main Link: list of lists of characters, rows
Ẇ            - all sublists (= all non-zero length runs of rows)
   /€        - reduce €ach by:
  "          -   zip with:
 ;           -     concatenation (= all non-zero length vertical edges)
     Ẇ€      - all sublists for €ach (= all possible areas)
       Ç€€   - call the last link (4) as a monad for €ach for €ach (for each area)
          F  - flatten
           S - sum

Haskell, 180 167 166 bytes
l=length
a%b=[a..b-1]
h c a g b=all(`elem`c)$g<$>[a..b]
f s|(#)<-(!!).(s!!)=sum[1|y<-1%l s,x<-1%l(s!!0),i<-0%y,j<-0%x,h"+|"i(#x)y,h"+-"j(y#)x,h"+|"i(#j)y,h"+-"j(i#)x]

Try it online!
Go through all possible corner positions with four nested loops and check if all the chars on the lines between them consist of +- (horizontal) or +| (vertical).

Slip, 32 29 bytes
$a([+`-]*`+>[+`|]*`+>){2}$A

Try it online!
27 bytes of code + 2 bytes for the n and o flags. Takes input in the same format provided in the question (i.e. newline-delimited block of lines).

Jelly, 41 39 34 33 bytes
,Z;.ị$⁺€ḟ€"⁾-|Fḟ”+
ẆḊÐfZ€µ⁺€ẎÇÐḟL

Try it online! or View all cases.
Based on my answer in J.
Explanation
,Z;.ị$⁺€ḟ€"⁾-|Fḟ”+  Helper. Input: 2d array of characters
 Z                  Transpose
,                   Pair
  ;                   Concatenate with
     $                The tail and head
   .ị                   Select at index 0.5 -> Select at index 0 and 1
                        Jelly uses 1-based modular indexing, so
                        0 means to select the tail
      ⁺€              Repeat on each - This selects the last and first rows,
                      last and first columns, and the 4 corners
           ⁾-|       The string array ['-', '|']
          "          Vectorize
        ḟ€             Filter each
              F      Flatten
                ”+   The character '+'
               ḟ

ẆḊÐfZ€µ⁺€ẎÇÐḟL  Main. Input: 2d array of characters
      µ         Combine into a monad
Ẇ                 Generate all sublists
  Ðf              Filter for the values that are truthy (non-empty)
 Ḋ                  Dequeue
    Z€            Transpose each
       ⁺€       Repeat on each
         Ẏ      Tighten, join all lists on the next depth
          ÇÐḟ   Discard the values where executing the helper returns truthy
             L  Length

Now it's finally starting to feel competitively short at 34 bytes.