text:
Chunky palindromes
Palindromes are fun, but some of the other strings are starting to feel left out. We can turn those strings into chunky palindromes by splitting them up into palindromic arrays of chunks.
For example, the string "abcabca" isn't a palindrome if we read it character by character, but we have three different ways of making it a chunky palindrome:
["abcabca"]
["a" "bcabc" "a"]
["a" "bc" "a" "bc" "a"]

As you can see, chunky palindromicness is a very inclusive concept; every string can be turned into a chunky palindrome in at least one way.
Task
Write a program or a function that receives a string as input and returns its palindromic chunkiness, i.e., the number of its partitions that are palindromic arrays.
Test cases
 OUTPUT | INPUT
--------+---------------------------------------------
      1 | ""
      1 | "a"
      1 | "ab"
      2 | "aa"
      2 | "aaa"
      3 | "abcabca"
      4 | "abababab"
     28 | "abcabcaabababababcabca"
      1 | "bbbbabababbbbababbbaaaaa"
     20 | "ababbaaaabababbbaaabbbaa"
      5 | "baaabaabababaababaaabbaab"
     62 | "bbaaababbabbabbbabaabaabb"
      2 | "a man a plan a canal panama"
     25 | "ama nap lan aca nal pan ama"
     93 | "SATOR   AREPO   TENET   OPERA   ROTAS"
    976 | "abcabcaabcabcaabcabcaabcabcaabcabcaabcabca"
  28657 | "ababababababababababaababababababababababa"
2097152 | "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"

Additional rules

You may assume that the input will consist of 42 or less printable ASCII characters, optionally surrounded by your language's string delimiters and/or followed by a newline.
For each valid input string, your code must finish in less than one minute on my machine (Intel Core i7-3770, 16 GiB RAM, Fedora 21).
With an adequate algorithm, it should be easy to comply with this time limit. However, you will most likely not be able to iterate over all partitions of the input string.
If you choose to print the output to STDOUT, it may be followed by a single newline.
Standard code-golf rules apply.

Pyth, 40 34 27 22 bytes
Lhsmy:bd_df!xb>TbS/lb2

Try it in the online interpreter.
Heavily golfed down from initial 40 byte version. Thanks to FryAmTheEggman for pointing out a couple of useful operators (docs are hard to search!) that have saved me 6 bytes total. Thanks to Dennis for a clever single byte saving by interpreting the result of x as a truthy/falsy value rather than an index - !xb>Tb rather than q<bT>Tb.

How it works:
We define a function y which determines the chunkiness of a string b by recursively calling itself on substrings of b. Functions are automatically memoized in Pyth, so recursion has very little overhead in terms of time.
L                              def y(b): return ___
                 S/lb2         The range [1,2,...,len(b)/2]
          f!xb>Tb              Filter n for which b[:n] == b[-n:]
   m                           Map each n in the list to...
    y:bd_d                     y(b[d:-d])
 hs                            Take the sum and add one (implicit return)

Yeah, most of learning Pyth is communal / trial and error / reading the lexer, good work with golfing it much more! :)

You can save two bytes by submitting the function. There's no need to call it with yz. 2. Instead of two maps and a filter, you could use a single map and a conditional (link), which saves three bytes.

Pip, 98 66 bytes
-32 thanks to @DLosc!
k:{[[z:a]]AL$AL({b:zc:b@<aAL_M(kb@>a)z:bc}M@>(,#a))}#(_QRV_FI(ka))

My first Pip answer!

CJam (41 39 bytes)
qM{_,2/,\f{\~_2$>@2$<@~)/(@=\M*j*}1b)}j

Online demo
This is "eager" in the sense that it finds the number of chunky palindromes for each "central" string (i.e. the result of removing the same number of characters from both ends of the original string), but because it uses the auto-memoising j operator each is calculated once only, giving a very fast program (and saving a few characters over a non-memoised implementation).
Thanks to Dennis for a one byte saving.

Mathematica, 77 72 57 bytes
1+Tr[#0/@ReplaceList[#,{a__,b___,a__}:>{b}]]&@*Characters

Perl, 86 bytes
84 bytes code + 2 switches
There HAS to be a shorter method, but here goes:
perl -lpe 'sub c{my($x,$i)=@_;$x=~/^(.{$i})(.*)\1$/&&c($2,0*++$s)while++$i<length$x}c$_;$_=++$s'

Takes input from STDIN, one string per line.
Explanation: For values 1<=$i<length(input string), uses the regex /^(.{$i})(.*)\1$/ to get the left and right chunks and increments the count. Then recursively does the same for the center part of the string.


text:
Can I Slide Apart The Puzzle?
Write a program or function that takes in a rectangular grid of text where every cell is either an A or a B. All the A cells will form a simply-connected shape, i.e. they will all be orthogonally connected with no holes (diagonally neighboring letters do not count as connected). Likewise, all the B cells will form another simply-connected shape. The grid will always contain at least one A and at least one B.
Imagine the grid is actually two blocky-shaped pieces of thin plastic, represented by the A and B portions. If it were placed flat on a table, could the two pieces be slid apart while keeping both completely flat on the table?
Print or return a truthy value if the two A and B shapes could be separated like this by simply pulling them apart. If not, print or return a falsy value.
For example, the input
AAA
ABB
AAA

is truthy because the BB section can be slid to the right, separating it from the A's:
AAA
A    BB
AAA

However, the input
AAAA
ABBA
ABAA

is falsy because there's no way to slide the A and B portions apart without having them overlap.
The shortest code in bytes wins. If desired, you may use any two distict printable ASCII characters in place of A and B.
Truthy Examples (separated by empty lines)
BBB
BAA
BBB

BA

A
B

AB
AB

AAA
BBB

AAAAB
ABBBB

ABBA
ABBA
AAAA

AAAAAABBBBBBBBB
AABBBBBBBBBBBBB
AAAAAAAAAABBBBB
AABBBBBBBBBBBBB
AAAAAAAAAAAAAAB

AAAAAAAAAAAA
ABABABABABAB
BBBBBBBBBBBB

BAAAAABB
BBAAABBB
BBBABBBB
BBBABBBB
BBBABBBB
BBBBBBBB
BBBBBBBB

AAA
BAA
AAA

Falsy Examples
BBBB
BAAB
BABB

BBBB
BAAB
AABB

BBBBBBB
BBBBBAB
AAAAAAB
BBBBBBB

BAAA
BABA
BBBA
AABA
AAAA

AAAAAAA
ABBBBBA
AAAAABA
BBBBBBA

BAAAAABB
BBAAABBB
BBBABBBB
BBBABBBB
BBBAABBB
BBBBBBBB
BBBBBBBB

AAA
ABA
BBA
ABA
AAA

Snails, 14
o(t\B+~)+!(t\B

If the puzzle can be slid apart, it prints the area of the input. Otherwise, it prints 0.
It's a bit slow for the larger examples, as it takes time factorial in the area of the grid.
         ,, the program will print the number of starting cells matching this pattern
o        ,, pick a cardinal direction
(
    t    ,, teleport to any cell on the grid
    \B+  ,, match "B" 1 or more times, moving in the direction set by 'o'.
         ,, when a cell is matched, it gets slimed and can't be matched again.
    ~    ,, match an out-of-bounds cell
)+       ,, do parenthesized instructions 1 or more times
!(       ,, the following must not match:
    t\B  ,, teleport to some cell and match 'B'

"It's a bit slow ..". Not sure what you expected from a language called Snails...

@Bas Now now, no reason to rub salt in the wounds.

CJam, 33 32 20 19 17 bytes
Revised version, with massive support from @Sp3000 and @MartinBüttner:
qN/_z]{:e`z,3<}/|

Try it online
Contributions

@Sp3000 suggested a critical simplification to my original algorithm.
@MartinBüttner applied his mad golfing skills to the revised approach, which almost certainly resulted in shorter code than I would have come up with even after considering the simplification.

Algorithm and Proof
The following explains the criteria for the puzzle sliding apart horizontally. The vertical case can be determined by looking at columns instead of rows, or transposing the character matrix and looking at the rows again.
I'll use the term "stretch" for a maximum sequence of the same letters. For example, the following rows have 1, 2, and 3 stretches respectively:
AAAAAAAA
BBBAAAAA
AABBBAAA

I'll also use the term "interlocked" for a row/puzzle that cannot slide apart.
The key observation is that the puzzle can slide apart if and only if all rows have at most 2 stretches. Or reversed, it is interlocked if and only if there is any row with more than 2 stretches.
The following might not qualify as a strict mathematical proof, but I believe that it makes for a convincing explanation why this has to be the case.
It is easy to see that the puzzle is interlocked if it has rows of more than 2 stretches. Looking at a row with 3 stretches:
BBBAAB

it is clear that it prevents the puzzle from sliding apart because the A stretch is locked between the B stretches. This means that the row is interlocked, which in turn makes the whole puzzle interlocked.
The opposite direction of the proof is not quite as obvious. We need to show that there are no interlocked puzzles where all rows have only 1 or 2 stretches. Starting with a couple of observations:

Rows with only 1 stretch do not contribute to a puzzle being interlocked, since they can slide in either direction without any collisions.
If all rows with 2 stretches have the same order of A and B, the puzzle is clearly not interlocked. In this case, all A cells are left of all B cells, or vice versa, and there are no collisions when sliding the two pieces apart.

The only tricky case would be puzzles where we have rows with 2 stretches of different order. I'm going to show that such puzzles do not exist under the given specifications. To show this, let's look at a partial puzzle that does have this configuration, where . are wildcards:
.......
AAABBBB
.......
BBAAAAA
.......

Now, the specification says that both the A and B cells are simply connected in all valid puzzles. To make the A cells connected in the partial puzzle above, we have two options:

We loop around one of the stretches of B, for example:
..AAAAAA
AAABBBBA
.......A
BBAAAAAA
........

To do this, we unavoidably extend one of the rows to have 3 stretches, so this will never give us a valid puzzle where all rows have at most 2 stretches.
We connect them on a direct path:
.......
AAABBBB
..A....
BBAAAAA
.......

The A cells are now simply connected, and there are still no rows with more than 2 stretches. However, the B cells also need to be simply connected. The direct path is now blocked by the connected A cells, and the only way to connect the B cells is to loop around one of the stretches of A cells. This leads back to case 1, where we can't do that without creating rows of 3 stretches.

To count the stretches, the implementation uses the CJam RLE operator.
Explanation of Code
qN/     Get input and split at newlines.
_z      Make a transposed copy.
]       Wrap the original and transposed puzzle in an array so that we can
        loop over the two.
{       Start of loop over original and transposed puzzle.
  :e`     Apply RLE to all rows.
  z,      Transpose the matrix with the RLE rows, and take the element count of the
          result. Or in other words, take the column count. This will be the length
          of the longest row after RLE.
  3<      Check the length for less than 3.
}/      End of loop over original and transposed puzzle.
|       Or the results of the two.

JavaScript (ES6), 108 107 98 91 82 bytes
a=>!(T=[],R=/AB+A|BA+B/).test([...a].map((c,i)=>T[i%-~a.search`
`]+=c))|!R.test(a)

Live demo. Tested in Firefox. Takes input as a newline-delimited string.
Edits:

Saved 1 byte by changing \n to a literal newline.
Saved 9 bytes by doing the RegExp test directly on the multi-line string instead of converting to an array.
Eliminated another 9 bytes by using array comprehensions to split string, moving ! into g function and calling RegExp directly on array instead of using find.
Continued the arthmetic sequence by saving another 9 bytes. Did a modulus on the index instead of splitting the array by newlines before taking the transpose.

How it works
Previous version:
a=>(T=[],a.split`
`.map(s=>s.split``.map((c,i)=>T[i]+=c)),!T.find(g=s=>/AB+A|BA+B/.test(s)))|!g(a)

Take the input a and split it by newlines into an array of strings.
Transpose a and store it in T. Use map to iterate over each element of a, split the string into a character array, and use map again to append the ith character in the line to the ith line of  T. Since each element of T is uninitialized, it will end up looking something like "undefinedAAABBA", but this won't matter.
Create a RegExp based testing function g that matches the pattern /AB+A|BA+B/. If it matches, the pieces are locked in the given direction because then there are a set of Bs sandwiched between two or more As or vice-versa.
Use the testing function g to test all elements of the block a and its transpose T for a match using find. If both match, then the pieces are locked in both directions, so output a falsy value, otherwise a truthy one.

Javascript (ES6), 118

slidey=
// code
a=>!a.match(R=/AB+A|BA+B/)||!(a=a.split`
`.map(b=>b.split``))[0].map((_,c)=>a.map(d=>d[c])).some(e=>e.join``.match(R))

// IO
var S =document.getElementById('S');
S.onkeyup = _=> document.getElementById('P').innerText = slidey(S.value);

document.getElementById('P').innerText = slidey(S.value);
<textarea id='S'>BAAAAABB
BBAAABBB
BBBABBBB
BBBABBBB
BBBABBBB
BBBBBBBB
BBBBBBBB</textarea>

Explanation:
a=> !/* check string horizontally */ || !/* check string vertically by transposing it and
                                            running the same horizontal check */

a=> !a.match(R=/AB+A|BA+B/) || !/* ... */
// check for lines containing something like BAAAAAB or ABBBBBBBA
// this is the only way something can get blocked horizontally
// eg AAAAAAA
//    AAABAAA <<< note the B in the middle of As here
//    AAABBBB <<< blocked from being pulled out horizontally
//    AAAAAAA

a=> /* ... */ ||!( a = a.split('\n').map(b=> b.split('')) ) // split a into 2D array
    [0].map((_,c)=>a.map(d=>d[c])) // transpose it
    .some(e=>e.join``.match(R)) // run the check again using `some` to go line by line
                                // which is shorter than .join().match() outside

a=> !/* returns null if no horizontal obstacles and an array if there are */
    || !/* same thing */
// negate both to cast to a boolean (false if obstacles, true if not)
// an input can only be unslidable if both directions are blocked
// so (no obstacles vertically? || no obstacles horizontally?) gives the answer

Rats! Beat me to it.

JavaScript (ES6) 72 74
Edit 2 bytes saved thx @NotthatCharles
I have the intuitive understanding that if one piece can slide just a fraction of step, then it's free. The current test cases confirm this.
So I check just one step in each direction.
Characters used: 1 and 0
2 bytes more to use any 2 printable characters like A and B
Test running the snippet below in an EcmaScript 6 compliant browser (supporting the spread operator - IE Firefox)

f=s=>[w=~s.search`
`,-w,-1,1].some(o=>![...s].some((x,p)=>x+s[p+o]==10))

// 4 bytes more- for any symbol, not just 1 and 0 (for instance A and B):
g=s=>[w=~s.search`
`,-w,-1,1].some(o=>![...s].some((x,p)=>x+s[p+o]=='AB'))

//TEST
console.log=x=>O.innerHTML+=x+'\n'

testOk = [
 '111\n100\n111',
 '10',
 '0\n1',
 '01\n01',
 '000\n111',
 '00001\n01111',
 '0110\n0110\n0000',
 '000000111111111\n001111111111111\n000000000011111\n001111111111111\n000000000000001',
 '000000000000\n010101010101\n111111111111',
 '10000011\n11000111\n11101111\n11101111\n11101111\n11111111\n11111111',
 '000\n100\n000'
]

testKo = [
 '1111\n1001\n1011',
 '1111\n1001\n0011',
 '1111111\n1111101\n0000001\n1111111',
 '1000\n1010\n1110\n0010\n0000',
 '0000000\n0111110\n0000010\n1111110',
 '10000011\n11000111\n11101111\n11101111\n11100111\n11111111\n11111111',
 '000\n010\n110\n010\n000'
]

console.log('Expecting true')
testOk.forEach(t=>console.log(t+'\n'+f(t)+'\n'))
console.log('Expecting false')
testKo.forEach(t=>console.log(t+'\n'+f(t)+'\n'))

Well, that's just genius. Beaten again by a pro. :-)

s[p+o]=='0' seems a little long. Could it be replaced with 1-s[p+o], or at least s[p+o]==0?

@ETHproductions yes,it's long, it's worth some more thinking. It must give false for '\n' (vertical border, converts to 0) and for undefined (upper and lower border, converts to NaN)

=='A' can be replaced by <'B'.  Same for =='B'

Also, can't you just do x+s[p+o]=='AB'?

@NotthatCharles I have to deal with char 1 (A), char 2 (B), newline and out of bounds (that gives 'undefined'), so replacing '==' with '<' is not so obvious. Your last suggestion is interesting instead

Mathematica 100 69 bytes
With a massive 31 bytes saved, thanks to @Martin Buttner,
g=Max[Length/@Split/@#]<3&;g[c=Characters@StringSplit@#]||g@Thread@c&

Formats the input as a matrix of characters; it also makes a transpose of the matrix.   If either the matrix or its transpose has no more than 2 runs per row then the puzzle is can slide.
{a,a,b,b,b} has 2 runs of letters.
{a,a,b,a,a} has 3 runs of letters.
{a,a,b,a,a,a,b,b,b,b,b,b,b,b} has 4 runs of letters.

Dyalog APL, 22 bytes
(∨/{∧/2>+/2≠/⍵}¨)⊂∘⍉,⊂

Try it here.
This is a function that takes in a 2D array of characters, and returns 1 for sliding instances and 0 for non-sliding ones.
The algorithm is similar to most other answers: check for the matrix and its transpose that no row contains more than one adjacent pair of different letters.
For the 4x3 input matrix
AAAA
ABBB
AAAB

the function can be invoked as
f ← (∨/{∧/2>+/2≠/⍵}¨)⊂∘⍉,⊂
f 4 3 ⍴ 'AAAAABBBAAAB'

which results in 1.
Explanation
⊂∘⍉,⊂   The matrix and its transpose.
{...}¨   For each of them:
  2≠/⍵   On each row, replace each adjacent pair with 1 if they differ, with 0 otherwise
  2>+/    Take the sum on each row and check that it's less than 2
  ∧/     AND over all rows
∨/      OR over the resulting two values

JavaScript (ES6), 94 bytes
x=>!(y=/AB+A|BA+B/).test(x)|(z=[],x.split`
`.map(b=>b.split``.map((c,i)=>z[i]+=c)),!y.test(z))

Same-size alternate method:
x=>(t=s=>!/AB+A|BA+B/.test(s),z=[],x.split`
`.map(b=>b.split``.map((c,i)=>z[i]+=c)),t(x)|t(z))

This returns 1 for a truthy input and 0 for falsy. I started work on this before any other answers had been posted. I also originally tried using ES7's array comprehensions, but that ended up about 10 chars longer than this method.
Try it out:

a=x=>!(y=/AB+A|BA+B/).test(x)|(z=[],x.split`
`.map(b=>b.split``.map((c,i)=>z[i]+=c)),!y.test(z))

P.onclick=_=>Q.innerHTML='Result: '+a(O.value)
<textarea id=O cols="20" rows="8">AAAAAABBBBBBBBB
AABBBBBBBBBBBBB
AAAAAAAAAABBBBB
AABBBBBBBBBBBBB
AAAAAAAAAAAAAAB</textarea>
<button id=P>Test</button>

Result:

Suggestions welcome!

Using [...b] instead of b.split`` saves 3 bytes, but only works in some browsers.

source: Stack Exchange

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

sort: votes


text:
Monday Mini-Golf #4: JARVIS (Just Another Rather Vast set of Integer Sequences)
Monday Mini-Golf: A series of short code-golf questions, posted (hopefully!) every Monday.
(Sorry I'm late again; I was away from my computer  basically all of yesterday and today.)
Us programmers (especially the code-golfers) sure love arbitrary integer sequences. We even have an entire site dedicated to these sequences that currently has around 200,000 entries. In this challenge, we'll be implementing yet another set of these sequences.
Challenge
Your challenge is to write a program or function that takes in an integer N, and outputs a sequence of base 10 integers, where each next integer is determined in this way:

Start at 1.
For each digit D in the previous integer's base 10 representation:

If D is 0, add one to the current integer.
Otherwise, multiply the current integer by D.

Details

You may assume that 0 < N < 231.
You must output each integer in the sequence, starting with the input number, until a number less than 10 is reached.
The output may be an array, or a string separated by spaces, commas, newlines, or a combination of these.
A trailing space and/or newline is allowed, but not a trailing comma.
There should never be any leading zeroes.

Examples
Example 1: 77
This example is fairly straightforward:
77 = 1*7*7 = 49
49 = 1*4*9 = 36
36 = 1*3*6 = 18
18 = 1*1*8 = 8

Thus, the proper output is 77 49 36 18 8.
Example 2: 90
Here we have:
90 = 1*9+1 = 10
10 = 1*1+1 = 2

So the output would be 90 10 2.
Example 3: 806
Read the equations left-to-right:
806 = 1*8+1*6 = 54 (((1*8)+1)*6)
 54 = 1*5*4   = 20
 20 = 1*2+1   = 3

Output should be 806 54 20 3.
Test-cases
The first number in each line is the input, and the full line is the expected output.
77 49 36 18 8
90 10 2
249 72 14 4
806 54 20 3
1337 63 18 8
9999 6561 180 9
10000 5
8675309 45369 3240 25 10 2
9999999 4782969 217728 1568 240 9
1234567890 362881 2304 28 16 6

As a reference, here's the proper next integers from 10 to 100:
Current | Next
--------+-----
     10 |  2
     11 |  1
     12 |  2
     13 |  3
     14 |  4
     15 |  5
     16 |  6
     17 |  7
     18 |  8
     19 |  9
     20 |  3
     21 |  2
     22 |  4
     23 |  6
     24 |  8
     25 | 10
     26 | 12
     27 | 14
     28 | 16
     29 | 18
     30 |  4
     31 |  3
     32 |  6
     33 |  9
     34 | 12
     35 | 15
     36 | 18
     37 | 21
     38 | 24
     39 | 27
     40 |  5
     41 |  4
     42 |  8
     43 | 12
     44 | 16
     45 | 20
     46 | 24
     47 | 28
     48 | 32
     49 | 36
     50 |  6
     51 |  5
     52 | 10
     53 | 15
     54 | 20
     55 | 25
     56 | 30
     57 | 35
     58 | 40
     59 | 45
     60 |  7
     61 |  6
     62 | 12
     63 | 18
     64 | 24
     65 | 30
     66 | 36
     67 | 42
     68 | 48
     69 | 54
     70 |  8
     71 |  7
     72 | 14
     73 | 21
     74 | 28
     75 | 35
     76 | 42
     77 | 49
     78 | 56
     79 | 63
     80 |  9
     81 |  8
     82 | 16
     83 | 24
     84 | 32
     85 | 40
     86 | 48
     87 | 56
     88 | 64
     89 | 72
     90 | 10
     91 |  9
     92 | 18
     93 | 27
     94 | 36
     95 | 45
     96 | 54
     97 | 63
     98 | 72
     99 | 81
    100 |  3

You can find this list expanded to 10000 here.
Scoring
This is code-golf, so shortest valid code in bytes wins. Tiebreaker goes to submission that reached its final byte count first. The winner will be chosen next Monday, Oct 19. Good luck!
Edit: Congrats to your winner, @isaacg, using Pyth yet again for 14 bytes!

Pyth, 15 14 bytes
.uu|*GHhGjNT1Q

1 byte thanks to Dennis
Test Suite
This challenge feels like it was made for Pyth's reduce functions. One reduce over the digits, one reduce until the value stops changing, and we're good.

|*GHhG saves a byte over ?H*GHhG.

PowerShell, 92 91 90 88 87 bytes
($n=$args);while($n-gt9){$x=1;[char[]]"$n"|%{$x=if($y=$_-48){$x*$y}else{$x+1}};($n=$x)}

That's pretty slick, using (...) to leverage automatic output ... I'm going to need to remember that in the future.

CJam, 26 25 24 22 bytes
riA,{_pAb{_2$*@)?}*j}j

or
ri{_pAb{_2$*@)?}*_9>}g

Try it online.
How it works
Both program essentially do the same; the first is a recursive approach, the second an iterative one. I'll explain the first, which I consider more interesting.
ri                     Read an integer from STDIN and push it on the stack.
  A,{               }j Initialize a memoized, recursive function j with the array
                       [0 ... 9] as "base cases". If j is called on an integer
                       below 10, it returns the element at that index of the base
                       cases (which is same integer) and does not execute the code
                       block. The base case array is filled with new values as j is
                       called again and again, but we do not use this feature.
     _p                Copy and print the integer on the stack.
       Ab              Convert it into its base-10 digits.
         {       }*    Fold; push the first digit, for each remaining digit:
          _2$*         Multiply copies of the accumulator and the current digit.
              @)       Increment the original accumulator.
                ?      Select the product if the digit is non-zero, else the sum.
                   j   Call j on the result.
                       If the result was less than 10, it is retrieved from the
                       base cases and pushed on the stack. CJam prints it before
                       exiting the program.

Pip, 28 25 23 bytes
Tt>Pa{Y1FdaYy*d|y+1a:y}

Takes a number as command-line argument and outputs the sequence on successive lines.
Explanation:
                         a is cmdline arg; t is 10 (implicit)
Tt>Pa{                }  Loop till a<10, printing it each time the test is made:
      Y1                   Yank 1 into variable y
        Fda                For each digit d in a:
           Yy*d|y+1          If y*d is truthy (nonzero), yank it; otherwise, yank y+1
                   a:y     Assign value of y back to a

Now I'm glad I changed P from a statement to an operator several revisions ago. Pa is an expression that evaluates to a's value but also outputs it, so I can print a and simultaneously test whether it's less than ten using t>Pa.

Minkolang 0.7, 52 46 bytes
ndN((d25*%1R25*:)r11(x2~gd4&x1+!*I1-)dNd9`,?).

Woohoo nested loops!
Explanation
ndN     Takes integer input and outputs it
(       Starts overall loop

 (        Starts loop that separates top of stack into digits
  d25*%   Modulus by 10
  1R      Rotates stack 1 unit to the right
  25*:    Divides by 10
 )

 r11   Reverses stack and pushes two 1s; 1 for the dump and 1 for the multiply
 (     Starts the multiply/add loop
  x    Dumps top value

      -This top-of-stack dump is because
       while loops end when the stack is
       empty or the top of stack is 0. The
       top of stack is *not* popped for
       this conditional check, so if the loop
       continues, I need to dump the left-over
       from the previous iteration.

  2~gd    Gets next-to-last stack value and duplicates for the conditional
  4&      Jumps 4 spaces if top of stack is positive
   x1+!   Dumps the 0 leftover, adds 1 to top of stack, and jumps the multiply
   *      Multiplies the top two elements of stack
  I1-     Pushes length of stack - 1
 )        Exits the loop if top of stack is 0 (i.e., len(stack)=1)
 dN       Outputs as integer
 d9`,?    Jumps out of the loop if top of stack <=9
)
.    Stop.

Python, 85 80 bytes
def g(n):y=reduce(lambda i,x:i*int(x)or i+1,`n`,1);return[n]+(g(y)if n>9else[])

This now properly prints out the entire list, instead of just the first value.

You can save two bytes by using an unnamed lambda, i.e. omitting g=.

Mathematica, 66 bytes
Most@FixedPointList[Fold[If[#2<1,#+1,1##]&,1,IntegerDigits@#]&,#]&

Python 3, 74, 76 bytes
There was already a Python answer here with reduce, so I wanted to do one without it. It should be called with an int.
def j(n,m=1):
 print(n)
 if n>9:
  for d in str(n):m=m*int(d)or m+1
  j(m)

Julia, 93 89 88 86 83 77 bytes
f(n)=(println(n);if(d=n>9)for i=reverse(digits(n)) i<1?d+=1:d*=i end;f(d)end)

This creates a recursive function f that prints the sequence elements on separate lines.
Ungolfed:
function f(n::Int)
    println(n)
    if (d = n > 9)
        for i in reverse(digits(n))
            i < 1 ? d += 1 : d *= i
        end
        f(d)
    end
end

Try it online
Saved 6 bytes thanks to Dennis!

It should be n>9 to comply with the second example. Also, f(n)=(println(n);if(d=n>9)for i=reverse(digits(n)) i<1?d+=1:d*=i end;f(d)end) is a bit shorter.

@Dennis Excellent ideas, thanks!

K5, 24 bytes
(1{(x*y;x+1)@~y}/.:'$:)\

Gathering a list of items while iterating to a fixed point is precisely what the scan operator \ does. On each iteration I first cast the number to a string and then evaluate each character (.:'$:), exploding the number into its digits. Then I perform a reduction (/) starting with 1 and using the lambda {(x*y;x+1)@~y}. In this case x is the reducing value and y is each successive term of the sequence.
In action:
  f: (1{(x*y;x+1)@~y}/.:'$:)\

  f'77 90 249 806 1337 9999 10000 8685309 9999999 1234567890
(77 49 36 18 8
 90 10 2
 249 72 14 4
 806 54 20 3
 1337 63 18 8
 9999 6561 180 9
 10000 5
 8685309 51849 1440 17 7
 9999999 4782969 217728 1568 240 9
 1234567890 362881 2304 28 16 6)

Ruby 83, 72 bytes
Original declared as a function:
def f(d)loop{p d;break if d<10;d=d.to_s.bytes.inject(1){|r,i|i>48?r*(i-48):r+1}}end

I tried to use Enumerator.new but it uses so many bytes :-(
Improved using recursion:
def f(d)p d;f(d.to_s.bytes.inject(1){|r,i|i>48?r*(i-48):r+1})if d>10 end

C# & LINQ, 165 146 bytes
void j(int a){r.Add(a);var l=a.ToString().Select(d=>int.Parse(d.ToString()));int n=1;foreach(int i in l)n=i==0?n+1:n*i;if(n>9)j(n);else r.Add(n);}

j (for jarvis) is the recursive function. r is the List of int of the result.
tested in LINQPAD:
void Main()
{
    j(806);
    r.Dump();
}
List<int> r = new List<int>();

void j(int a){r.Add(a);var l=a.ToString().Select(d=>int.Parse(d.ToString()));int n=1;foreach(int i in l)n=i==0?n+1:n*i;if(n>9)j(n);else r.Add(n);}

You can save some bytes by removing the spaces surrounding operators, e.g. int n = 1 can be int n=1, etc.

Good catch @AlexA. reduced to 146.

You can also save a bit by doing a+"" instead of a.tostring () :)

Haskell, 71 bytes
x!'0'=x+1
x!c=x*read[c]
g x|h>9=x:g h|1<2=[x,h]where h=foldl(!)1$show x

Usage: g 8675309 -> [8675309,45369,3240,25,10,2].

Matlab, 108
N=input('');disp(N)
k=1;while k
x=1;for n=num2str(N)-48
if n
x=x*n;else
x=x+1;end
end
disp(x)
N=x;k=x>9;
end

Java 8, 148 Bytes
String f(int j){String s="";Function r=i->(""+i).chars().map(x->x-48).reduce(1,(x,y)->y>0?x*y:x+1);while((j=(int)r.apply(j))>9)s+=j+" ";return s+j;}

formatted
String f(int j) {
    String s = "";
    Function r = i -> ("" + i).chars().map(x -> x - 48).reduce(1, (x, y) -> y>0 ? x*y : x+1);
    while ((j = (int)r.apply(j)) > 9) s += j+" ";
    return s+j;
}

Jelly, 9 bytes
D×‘ṛ?ƒ1ƊƬ

Try it online!

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:
I Saw That Coming
Write a program or function that takes in an integer greater than 1 or less than -1. That is, the input won't be 0, 1, or -1.
If the input is 2, the output should be:
|\_/|
|___|

If the input is 3, the output should be:
|\_/\_/|
|______|

If the input is 4, the output should be:
|\_/\_/\_/|
|_________|

The pattern continues in the same exact manner for larger inputs. For example, if the input is 10, the output should be:
|\_/\_/\_/\_/\_/\_/\_/\_/\_/|
|___________________________|

If the input is -2, the output should be:
 ____
|    |
|_/\_|

If the input is -3, the output should be:
 _______
|       |
|_/\_/\_|

If the input is -4, the output should be:
 __________
|          |
|_/\_/\_/\_|

The pattern continues in the same exact manner for smaller inputs. For example, if the input is -10, the output should be:
 ____________________________
|                            |
|_/\_/\_/\_/\_/\_/\_/\_/\_/\_|

The output can be printed or returned as a string with an optional trailing newline. The top right "empty" corner of the output for negative inputs may be a space or it may remain empty.
The shortest code in bytes wins.

I saw what you did there.

Pyth, 45 bytes
jtW!J<Q0.b+.[YN+h*3t.aQJY.>[d.<"\_/"J\_)J" ||

Try it online: Demonstration or Test Suite
Explanation:
jtW!J<Q0.b+.[YN+h*3t.aQJY.>[d.<"\_/"J\_)J" ||  implicit: Q = input number
    J<Q0                                       assign Q < 0 to J
                           [           )       create a list with
                            d                    * the string " "
                             .<"\_/"J            * the string "\_/" rotated to
                                                   the left by J
                                     \_          * the string "_"
                         .>             J      rotate to the right by J
                                         " ||  the string " ||"
        .b                                     binary mapping, N iterates
                                               over list, Y over string:
           .[YN+h*3t.aQJ                         pad Y with N to reach a string
                                                 of length 3*(abs(Q)-1)+1-J
          +             Y                        and append Y
 tW!J                                           remove the first line if Q > 0
j                                               print each on separate line

CJam, 56 50 49 bytes
ri_(z"\_/"*'_@0>{\4>W<_,@*SooNoS}|1$,*]${'|\'|N}/

Try it online in the CJam interpreter.
How it works
ri     e# Read an integer from STDIN and push it on the stack.
_(z    e# Push a copy, decrement it and apply absolute value.
       e# For positive n, (n -> n-1) and (-n -> n+1).
"\_/"* e# Repeat the string that many times.
'_     e# Push an underscore.
@0>    e# Check if the original integer is positive.
{      e# If it isn't:
  \    e#   Swap the generated string with the underscore.
  4>W< e#   Discard the string's first 4 and last character.
       e#   This makes the pattern of the bottom row start and end with an
       e#   underscore, truncating it to the correct length in the process.
  _,   e#   Push the length of a copy.
  @*   e#   Repeat the underscore that many times.
  So   e#   Print a space.
  oNo  e#   Print the underscores, then a linefeed.
  S    e#   Push a space.
}|     e#
1$,    e# Retrieve the strings length.
*      e# Repeat the underscore or space that many times.
]$     e# Wrap the two generated strings in an array and sort it.
{      e# For each string:
  '|\  e#   Push a vertical bar and swap the string on top of it.
  '|N  e#   Push a vertical bar and a linefeed.
}/     e#

Pyth, 56 54 bytes
I'm golfing Pyth on a phone with the online interpreter. That's a totally great idea.
Update 2015-10-15: I rewrote the thing (still on my phone, lol) and saved 2 bytes, of which one could've been done with the original too.
J<Q0Ljb"||"jPW!J_WJ[y<>*K+J*3t.aQ"\_/"JKy*K?Jd\_+d*K\_

Try it online.

Minkolang 0.8, 100 bytes
"|"nd0`u!vbd3*["_"]"|"25*"|"1g["\_/"]"|"(O).
"[d~g1"_"<.)O(" "D*3R~1"_"*52"|"D*3R1dg2"| "*52"|"]"\/_

Just builds up the stack and then prints it all out at once. I'm sure this could be golfed but I've already spent a lot of time on this...

JavaScript (ES6), 111 98 bytes
Optimal technique discovered! Turns out removing all those interpolators from the template strings saves a lot of bytes. Perhaps it could still be made shorter, perhaps not. In any case, ES6 template strings (and arrow functions) are awesome. :)
x=>(x>0?`|\\_/A|
|___A|`:` ___A_
|   A |
|_/\\A_|`).replace(/(...)A/g,(_,y)=>y.repeat(x>0?x-1:~x))

Vyxal, 67 bytes
ȧ=[‹`\_/`*\|:„+p,‹3*\_*\|:„+p,|N3*⇩:\_*ðp,ð*\|:„+p,ȧ`\_/`*ḢṪ\|:„+p,

Try it Online!
Oof.

Python 2.7, 144 bytes
This took more bytes than expected. Here's the code.
c=int(input())
p,w,n,u=list('| \n_')
a=abs(c)-1
d=3*a
if c>0:
 s=p+"\\_/"*a+p+n+p+u*d+p
else:
 d=d+1
 s=w+u*d+n+p+w*d+p+n+p+"_/\\"*a+u+p
print s

Java, 272 Bytes
String f(int i) {
String p = i>0?"\\_/":"_/\\_",x = "|"+new String(new char[(i<0?-i:i)-1]).replace("\0",p)+"|",
l=new String(new char[x.length()-2]).replace("\0","_");
return i>0?x+"\n|"+l+"|":" "+l+" \n|"+new String(new char[x.length()-2]).replace("\0"," ")+"|\n"+x;
}

SpecBAS - 167 bytes
1 INPUT n: DIM s$="\_/","_/\": LET t$=s$(2-(n>0))*(ABS n-1)+("_"*(n<0)),u$="_"*LEN t$
2 TEXT IIF$(n>0,"|"+t$+"|"#13"|"+u$+"|"," "+u$+#13"|"+" "*LEN t$+"|"#13"|"+t$+"|")

IIF$ is an inline IF statement, #13 is a way of embedding newlines into a string (and doesn't always need a "+" if it's between hardcoded strings).
Since a few releases ago, SpecBAS lets you have multiple assignments to one LET statement, which helps save some characters.

Ruby - 113 bytes
Seems too long. I'll try to golf this down a bit more.
n=gets.to_i;p,h=n.abs-1,?|;n>0 ? (puts h+'\\_/'*p+h,h+'___'*p+h):(k=p*3+1;puts' '+?_*k,h+' '*k+h,'|_'+'/\\_'*p+h)

Python 2.7, 118 bytes
n=input()*3-3
a=-n-6
s=' %s_\n| %s|\n|%s_|'%(a*'_',a*' ',a/3*'_/\\')
if n>0:s='|%s|\n|%s|'%(n/3*'\\_/',n*'_')
print s

Getting down from 120 to 118 was fun!

C#, 185 bytes
C# struggles with golfing repeating strings.
Completely golfed:
string S(int n){int m=n>0?n:-n;return string.Format(n>0?"|{0}\n|{1}|":" {1}\n|{2}|\n|_{0}","|".PadLeft(m).Replace(" ",n>0?@"\_/":@"/\_"),"".PadLeft(m=m*3-(n>0?3:2),'_'),"".PadLeft(m));}

Indentation and new lines added for clarity:
string S(int n){
    int m=n>0?n:-n;
    return string.Format(n>0?"|{0}\n|{1}|":" {1}\n|{2}|\n|_{0}",
        "|".PadLeft(m).Replace(" ",n>0?@"\_/":@"/\_"),
        "".PadLeft(m=m*3-(n>0?3:2),'_'),
        "".PadLeft(m)
    );
}

Powershell - 200 190 186 168 154
Golfed out the equation (4-(($n-2)3)) to (3$n-6) along with some extraneous parens and semicolons.
Found that `n is the equivalent of [Environment]::NewLine and that $s -f [args] is the equivalent of [String]::Format:
$n=$args;if($n-gt0){$s="|{1}|{0}|{2}|";$a=$n;$b=$n*3}else{$n*=-1;$s=" {2}{0}|{3}|{0}|_/{1}\_|";$a=$n-2;$b=$c=3*$n-2};$s-f"`n",("\_/"*$a),("_"*$b),(" "*$c)

Explanation retains clarifying parentheses:
$n=$args;

// Basically a way of coming up with a string to format and the
// necessary counts of repeated characters
if($n-gt0){
  // Placeholder format
  $s="|{1}|{0}|{2}|{3}";
  // Number of repeated "\_/" instances
  $a=$n;
  // Number of repeated "_" instances
  $b=$n*3
} else {
  $n*=-1;
  $s=" {2}{0}|{3}|{0}|_/{1}\_|";
  $a=($n-2);
  $b=(4+(($n-2)*3));
  // Number of repeated " " instances .. not needed for "positive" saw
  $c=$b;
};
[String]::Format($s,[Environment]::NewLine,"\_/"*$a,"_"*$b," "*$c)


text:
Count the bytes of a program
Note 2: I accepted @DigitalTrauma's 6-byte long answer. If anyone can beat that I will change the accepted answer. Thanks for playing!
Note: I will be accepting an answer at 6:00pm MST on 10/14/15. Thanks to all that participated!
I am very surprised that this has not been asked yet (or I didn't search hard enough). Either way, this challenge is very simple:
Input: A program in the form of a string. Additionally, the input may or may not contain:

Leading and trailing spaces
Trailing newlines
Non-ASCII characters

Output: Two integers, one representing UTF-8 character count and one representing byte count, you may choose which order. Trailing newlines are allowed. Output can be to STDOUT or returned from a function. IT can be in any format as long as the two numbers are distinguishable from each other (2327 is not valid output).
Notes:

You may consider newline as \n or \r\n.
Here is a nice byte & character counter for your tests. Also, here is a meta post with the same thing (Thanks to @Zereges).

Sample I/O:  (All outputs are in the form {characters} {bytes})
Input:
void p(int n){System.out.print(n+5);}
Output: 37 37
Input: (~R∊R∘.×R)/R←1↓ιR
Output: 17 27
Input:

friends = ['john', 'pat', 'gary', 'michael']
for i, name in enumerate(friends):
    print "iteration {iteration} is {name}".format(iteration=i, name=name)

Output: 156 156
This is code golf - shortest code in bytes wins!
Leaderboards
Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.
To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:
# Language Name, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:
# Ruby, <s>104</s> <s>101</s> 96 bytes

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:
# Perl, 43 + 2 (-p flag) = 45 bytes

You can also make the language name a link which will then show up in the leaderboard snippet:
# [><>](http://esolangs.org/wiki/Fish), 121 bytes

var QUESTION_ID=60733,OVERRIDE_USER=36670;function answersUrl(e){return"http://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"http://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

does the output have to be space-separated?

no, it can be in any format as long as the numbers are distinguishable from each other (2327 is not valid output)

Aren't there some UTF-8 characters that depending on the interpretation can be split into two other characters that generate the same byte values? How do we count those then?

Honestly, I do not know what you mean. Therefore, count as you wish.

@GamrCorps UTF-8 characters include non-ASCII characters, which are basically characters that cannot be represented by one byte but must be represented by two or even four bytes. Depending on how the characters are read in by a program, it is up to the program to choose how to interpret the stream of bytes. For example, a 2 byte UTF-8 can be interpreted as 2 sequential ASCII characters each of which are represented by the two bytes making up the originally intended character.

@PatrickRoberts I would say to use the higher value. But my final judgement would have to go to whatever https://mothereff.in/byte-counter says. Just put a questionable charatcer in there and see what it reads as, and use that as the foundation.

http://meta.codegolf.stackexchange.com/questions/4944/byte-counter-snippet

Some of the answers count the character `` as two characters due (presumably) to the use of UTF-16 and its surrogate pairs rather than UTF-8. (Note that the byte count will be the same either way.) To confirm, since you've specified UTF-8 specifically, that makes such answers invalid, correct?

@AlexA. Yes. If answers count characters based on a non-UTF-8 encoding, the answer would be invalid.

Nitpick: There's no such thing as a UTF-8 character. UTF-8 is an encoding that permits us to store Unicode characters as byte sequences. You are asking for the character and byte count of a UTF-8 data stream.

Shell + coreutils, 6
This answer becomes invalid if an encoding other than UTF-8 is used.
wc -mc

Test output:
$ printf '%s' "(~R∊R∘.×R)/R←1↓ιR" | ./count.sh
     17      27
$

In case the output format is strictly enforced (just one space separating the the two integers), then we can do this:
Shell + coreutils, 12
echo`wc -mc`

Thanks to @immibis for suggesting to remove the space after the echo.  It took me a while to figure that out - the shell will expand this to echo<tab>n<tab>m, and tabs by default are in $IFS, so are perfectly legal token separators in the resulting command.

Definitely the right tool for the job.

Can you remove the space after "echo"?

GolfScript, 14 12 bytes
.,p{64/2^},,

Try it online on Web GolfScript.
Idea
GolfScript doesn't have a clue what Unicode is; all strings (input, output, internal) are composed of bytes. While that can be pretty annoying, it's perfect for this challenge.
UTF-8 encodes ASCII and non-ASCII characters differently:

All code points below 128 are encoded as 0xxxxxxx.
All other code points are encoded as 11xxxxxx 10xxxxxx ... 10xxxxxx.

This means that the encoding of each Unicode character contains either a single 0xxxxxxx byte or a single 11xxxxxx byte (and 0 to 5 10xxxxxx bytes).
By dividing all bytes of the input by 64, we turn 0xxxxxxx into 0 or 1, 11xxxxxx into 3, and 10xxxxxx into 2. All that's left is to count the bytes whose quotient is not 2.
Code
                (implicit) Read all input and push it on the stack.
.               Push a copy of the input.
 ,              Compute its length (in bytes).
  p             Print the length.
   {     },     Filter; for each byte in the original input:
    64/           Divide the byte by 64.
       2^         XOR the quotient with 2.
                If the return is non-zero, keep the byte.
           ,    Count the kept bytes.
                (implicit) Print the integer on the stack.

Python, 42 40 bytes
lambda i:[len(i),len(i.encode('utf-8'))]

Thanks to Alex A. for the two bytes off.
Straightforward, does what it says. With argument i, prints the length of i, then the length of i in UTF-8. Note that in order to accept multiline input, the function argument should be surrounded by triple quotes: '''.
EDIT: It didn't work for multiline input, so I just made it a function instead.
Some test cases (separated by blank newlines):
f("Hello, World!")
13 13

f('''
friends = ['john', 'pat', 'gary', 'michael']
for i, name in enumerate(friends):
    print "iteration {iteration} is {name}".format(iteration=i, name=name)
''')
156 156

f("(~R∊R∘.×R)/R←1↓ιR")
17 27

And here all this time I've been using just len() like a sucker. This is clearly superior.

Since output can be returned from a function, you could save a few bytes by making this lambda i:[len(i),len(i.encode('utf-8'))].

@AlexA. Alright, changing. Never touched lambda before.

Your lambda isn't formed quite correctly. If you give it a definition, it would be f=lambda i:[len(i),len(i.encode('utf-8'))], but since you're using an anonymous lambda function, it should just be lambda i:[len(i),len(i.encode('utf-8'))].

You can save a few bytes with U8 instead of utf-8.

Julia, 24 bytes
s->(length(s),sizeof(s))

This creates a lambda function that returns a tuple of integers. The length function, when called on a string, returns the number of characters. The sizeof function returns the number of bytes in the input.
Try it online

you can use : to avoid using parenthesis like this

Rust, 42 bytes
let c=|a:&str|(a.chars().count(),a.len());

Java, 241 90 89 bytes
int[]b(String s)throws Exception{return new int[]{s.length(),s.getBytes("utf8").length};}

Love that you got Java to under 100 bytes.

Well, it is just a method...

You could change getBytes("UTF-8") to getBytes("utf8"). And why throws Exception?

Because getBytes throws an UnsupportedEncodingException when you give it an invalid encoding name.

Pyth - 12 9 bytes
Will try to get shorter.
lQh/l.BQ8

Test Suite.

This gives a byte too much for the UTF-8 byte count. It's currently floor(… / 8) + 1, should be ceil(… / 8)

This helped me catch a bug in .B. Also, lQlc.BQ8 fixes the bug @Pietu1998 mentions while saving 1 byte, I think.

PowerShell, 57 bytes
$args|%{$_.Length;[Text.Encoding]::UTF8.GetByteCount($_)}

R, 47 bytes
a<-commandArgs(TRUE);nchar(a,"c");nchar(a,"b")

Input: (~R∊R∘.×R)/R←1↓ιR
Output:
[1] 17
[2] 27

If printing line numbers alongside output isn't allowable under the "any format" then cat can fix the issue:
R, 52 bytes
a<-commandArgs(TRUE);cat(nchar(a,"c"),nchar(a,"b"))

Input: (~R∊R∘.×R)/R←1↓ιR
Output: 17 27

As a function, 39 bytes: function(s)c(nchar(s,"c"),nchar(s,"b"))

Also just some general R golfing tips: You can use T in place of TRUE, = in place of <-, and input can come from scan, readline, or function, all of which are shorter than commandArgs.

C, 68 67 bytes
b,c;main(t){for(;t=~getchar();b++)c+=2!=~t/64;printf("%d %d",c,b);}

This uses the same idea as my other answer.
Try it online on Ideone.

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

With linebreaks for readability:
,[>+<,]>
[>>+>+<<<-]>>>[<<<+>>>-]<<+>[<->[
>++++++++++<[->-[>+>>]>[+[-<+>]>.
+>>]<<<<<]>[-]++++++++[<++++++>-
]>[<<+>>-]>[<<+>>-]<<]>]<[->>+++++
+++[<++++++>-]]<[.[-]<]<

The most important part is the first line. This counts the number of characters inputted. The rest is just the long junk required to print a number greater than 9.
EDIT: Since BF cannot input/output anything but ASCII numbers from 1-255, there would be no way to measure the UTF-8 chars.

This looks like it could be golfed more. But it probably can't. +1.

Scala, 30 26 bytes
s=>s.size->s.getBytes.size

Try it online!
My first Scala answer! Thanks to user for making it work.
-4 bytes from user.

Nice! Try a tuple: https://tio.run/##K05OzEn8n5@UlZpcouCbmJmnkFpRkpqXUqzgWFCgUM1VlpijkGalEFxSlJmXrmBrp6DhmVeiA8SaCrb/i23tivWKM6tSdYF0emqJU2VJKkTgfwFQfUlOnkaahpKhguGj3i0mSpqaXLX/AQ. I’ll start a bounty soon.

Milky Way 1.6.2, 7 bytes
':y!^P!

Explanation
'        ` read input from the command line
 :       ` duplicate the TOS
  y      ` push the length of the TOS
   !  !  ` output the TOS
    ^    ` pop the TOS
     P   ` push the length of the TOS in bytes

Usage
./mw <path-to-code> -i <input>

Stax, 6 bytes
á!╜¡tº

Run and debug it
Explanation
%Px|k%P
%       get length
 P      pop and print with newline
  x     push input again
   |k   get byte array
     %  get length
      P pop and print with newline

Perl 6, 33 bytes
$x=get;say $x.chars," ",$x.codes;

Based on this blog post at Perl6Advent.

beeswax, 99 87 bytes
A more compact version, 12 bytes shorter than the first:
p~5~q")~4~p")~7~g?<
>)'qq>@PPq>@Pp>Ag'd@{
     >@PPPq  @dNp"?{gAV_
     >@PPPP>@>?b>N{;

The same, as easier to follow hexagonal layout:
 p ~ 5 ~ q " ) ~ 4 ~ p " ) ~ 7 ~ g ? <
> ) ' q q > @ P P q > @ P p > A g ' d @ {
         > @ P P P q     @ d N p " ? { g A V _
        > @ P P P P > @ > ? b > N { ;

Output as characters, then bytecount, separated by a newline.
Example:
the small letter s at the beginning of the line just tells the user that the program wants a string as input.
julia> beeswax("utf8bytecount.bswx")
s(~R∊R∘.×R)/R←1↓ιR
17
27
Program finished!

Empty string example:
julia> beeswax("utf8bytecount.bswx")
s
0
0
Program finished!

Beeswax pushes the characters of a string that’s entered at STDIN onto the global stack, coded as the values of their Unicode code points.
For easier understanding, here is the unwrapped version of the program above:
             >@{;    >@P@p >@PP@p>@P p
_VAg{?"pN>Ag"d?g~7~)"d~4~)"d~5~)"d@PPp
    ;{N< d?              <      < @PP<

For this example, the character α is entered at STDIN (code point U+03B1, decimal:945)
                                        gstack     lstack

_VA                                     [945,1]•   [0,0,0]•    enter string, push stack length on top of gstack
   g                                               [0,0,1]•    push gstack top value on top of local stack (lstack)
    {                                                          lstack 1st value to STDOUT (num. of characters)
     ?                                  [945]•                 pop gstack top value
      "                                                        skip next if lstack 1st >0
        N>                                                     print newline, redirect to right
          Ag                            [945,1]•   [0,0,1]•    push gstack length on top of gstack, push that value on lstack.
            "                                                  skip if lstack 1st > 0
              ?                         [945]•                 pop gstack top value
               g                                   [0,0,945]•  push gstack top value on lstack
                ~                                  [0,945,0]•  flip lstack 1st and 2nd
                 7                                 [0,945,7]•  lstack 1st=7
                  ~                                [0,7,945]•  flip lstack 1st and 2nd
                   )                               [0,7,7]•    lstack 1st = lstack 1st >>> 2nd  (LSR by 7)
                    "                                          skip next if top >0
                      ~4~)                         [0,0,0]•            flip,1st=4,flip,LSR by 4
                          "d                                   skip next if top >0... redirect to upper right
                           >@                                  redirect to right, flip lstack 1st and 3rd
                             PP@                   [2,0,0]•    increment lstack 1st twice, flip 1st and 3rd
                                p                              redirect to lower left
                                "                              (ignored instruction, not relevant)
         d?              <      <       []•                       redirect to left... pop gstack, redirect to upper right

         >Ag"d                          [0]•       [2,0,0]•    redir. right, push gstack length on gstack
                                                               push gstack top on lstack, skip next if lstack 1st > 0
                                                               redir. to upper right.
         >@                                        [0,0,2]•    redir right, flip lstack 1st/3rd
           {;                                                  output lstack 1st to STDOUT, terminate program

Basically, this program checks each codepoint value for the 1-byte, 2-byte, 3-byte and 4-byte codepoint limits.
If n is the codepoint value, then these limits for proper UTF-8 strings are:
codepoint 0...127         1-byte: n>>>7 = 0
          128...2047      2-byte: n>>>11= 0  → n>>>7>>>4
          2048...65535    3-byte: n>>>16= 0  → n>>>7>>>4>>>5
          65535...1114111 4-byte: the 3 byte check result is >0

You can find the numbers 7,4 and 5 for the shift instructions in the code above.
If a check results in 0, the lstack counter is incremented appropriately to tally the number of bytes of the entered string. The @PP...@ constructs increment the byte counter. After each tally, the topmost Unicode point is popped from the gstack until it is empty. Then the byte count is output to STDOUT and the program terminated.
There are no checks for improper encoding like overlong ASCII encoding and illegal code points beyond 0x10FFFF, but I think that’s fine ;)

Swift 3, 37
{($0.characters.count,$0.utf8.count)} // where $0 is String
Usage
Test
{($0.characters.count,$0.utf8.count)}("Hello, world")

Julia, 22 bytes
Improvement of Alex A.'s answer
s->length(s):sizeof(s)

Try it online!


text:
Convert ciphered Roman numerals to Arabic decimals
Write an algorithm to interpret a sequence of letters as a Roman numeral. (see roman numeral rules below)
Each distinct letter has a matching Arabic decimal value, no maximum.  But you don't have the key beforehand, so {A=10, I=1, X=5, ... Z=1000000} is decided by your interpretation.
Challenge

Read input via STDIN or equivalent and write output via STDOUT or equivalent
Valid inputs are combinations of uppercase and lowercase letters i.e. matching \[a-zA-Z]+\
Input should be validated to see if the letter sequence can be interpreted as valid Roman numeral
If the input passes validation, valid output should be the lowest Arabic decimal interpretation and the key used i.e. Aa is interpreted as 4 {a=5, A=1} not 6 {A=5, a=1} or 9 {a=10, a=1}

Roman Numeral Rules

Only letters representing powers of ten can be repeated, maximum of three times successively and four times in total e.g. II III XXXIX
If one or more letters are placed after another letter of greater value, add that amount
AAaa   => 22 {A=10, a=1}          (20 + 2 = 22)
bbAAaa => 222 {b=100, A=10, a=1}  (200 + 20 + 2 = 222)

If a letter is placed before another letter of greater value, subtract that amount
Aa    => 4 {a=5, A=1}                 (5 – 1 = 4)
AaA   => 19 {A=10, a=1}               (10 + 10 – 1 = 19)
BbBaA => 194 {B=100, b=10, A=5, a=1}  (100 + 100 - 10 + 5 - 1 = 194)

Several rules apply for subtracting amounts from Roman numerals:

Only subtract powers of ten i.e. 1, 10, 100... not 5, 50, 500...
No double subtraction therefore 18 is written as XVIII not IIXX (10 + 10 - 1 - 1)
Do not subtract a number from one that is more than ten times greater.
You can subtract 1 from 5 or 10 but not from 50, 100, 500...

Example
Input:
Aa
BAa
CCCXLVII
MMMCDVII
ABADDF
XVVX
FAASGSH
DXCCDA
AaBbcDEf

Output:
4 {a=5, A=1}
14 {B=10, a=5, A=1}
347 {C=100, L=50, X=10, V=5, I=1}
347 {M=100, D=50, C=10, V=5, I=1}
1921 {A=1000, B=100, D=10, F=1}
'XVVX' failed Roman numeral test
7191 {F=5000, A=1000, S=100, G=10, H=1}
'DXCCDA' failed Roman numeral test
4444 {a=5000, A=1000, b=500, B=100, D=50, c=10, f=5, E=1}

@IamOgbz this has turned into a great question but attracted a lot of questions in comments along the way. Now that you have enough reputation, I recommend the sandbox. I find it very useful for getting questions just right before posting.

Wouldn't CCCLXVII be interpreted as CCCXLVII, giving 347?

@Skyler you're absolutely right, will update now! thanks.

I don't see any restriction on what values the individual letters can have (and indeed you mention 20, which is not the value of a standard Roman numeral). Do you mean to say that any positive integer can be represented by a Roman numeral? In that case, Aa has a value of 1 (A=1, a=2).

@msh210 as the letters can only be interpreted as Roman Numerals, it follows that individual letter values can only be powers of 10 or 5 times powers of 10. 20 was only mentioned in relation to combining two roman numerals (and to stress that IXX = 19 is not a valid subtraction). Hope that clears it up for you.

Python 2, 415 444 440 419 416 bytes
There aren't all that many Roman numerals, after all. This script creates all of them and checks all permutations of the input, then returns the smallest match.
a=raw_input()
g=range
b=list(set(a))+[' ']*9
from itertools import*
c=[]
s={}
u=1000
for i in g(10*u):
 t,f=(10*u,9*u,5*u,4*u,u,900,500,400,100,90,50,40,10,9,5,4,1),i;r=""
 for j in g(17):k=i/t[j];r+=('W MW Q MQ M CM D CD C XC L XL X IX V IV I').split()[j]*k;i-=t[j]*k
 s[r]=f
for i in permutations(b[:9]):
 r=''
 for j in a:r+='IVXLCMQWE'[i.index(j)]
 if r in s:c+=[s[r]]
print c and min(c)or'%s failed Roman numeral test'%a

That's a good answer to the challenge as it is now. But in the comment conversation that was wiped out early, it was hinted that this (not real) system goes on after M=1000, having symbols for 5k, 10k and so on. Look at the first example at top: {A=10, I=1, X=5, ... Z=1000000} is decided by your interpretation

.., and the last example, a=5000 ...

I updated it to handle all of the given test cases. I doubt this approach can be extended past 10,000 as it takes O(n!) time on the number of Roman digits.

@Skyler the test cases aren't exhaustive. The program should handle all possible permutations of the valid inputs that can be interpreted as per the roman numeral rules, with preference given to lower numbers in ambiguous cases. Also your code couldn't handle the last test case link

Isn't import itertools as i and then i.permutations shorter?

No, it's longer because import itertools as i is only one byte shorter than from itertools import* and i.permutations is two bytes longer than permutations.

Instead of r+=('W^MW^Q^MQ^M^CM^D^CD^C^XC^L^XL^X^IX^V^IV^I').split('^')[j]*k; why not r+=('W MW Q MQ M CM D CD C XC L XL X IX V IV I').split()[j]*k;?

D'oh! Thanks for pointing that out.

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


text:
Harmonious "Convergence"
The Alternating Harmonic Series is a well known convergent series.

"Clearly", it is obvious that it converges to the natural log of 2. Or does it?
Since the series is not absolutely convergent, by simply rearranging the terms, I can make it approach anything I want. Suppose I want the series to converge to e. All I'd have to do is this:

If you didn't catch the pattern, there isn't an obvious one. Here's how it works:

Consider the terms of the alternating harmonic series in terms of positive and negative terms.
Add together just enough positive terms to exceed our target (e). (aka sum > target)
Subtract the next negative term.
Go back to 2.

Note that at step 2, if our sum == target, you should add another positive term.
From this we can define a sequence associated with each number as follows:

Follow the algorithm above
For each positive term, output 1.
For each negative term, output 0.

Let's call this sequence the "Harmonious Bit Pattern" of a number. For example, the HBP of e begins as:
1, 1, 1, 1, <32 times>, 0, 1, 1, <54 times>, 0, 1, 1, ...

Your challenge:
You will be given:

a rational input target in the range [-10, 10] (note: even reaching 10 via the harmonic series takes many millions of terms). This may be a decimal (aka 1.1) or you may take a rational directly (aka 12/100)
a positive int n input, specifying the number of terms of the Harmonious Bit Pattern to output.

You are expected to output the exact Harmonious Bit Pattern of the target to the specified number of terms. You may output space separated values, comma separated, no separation, etc; just as long as the pattern of 0s and 1s is clearly visible and is read left to right with consistent separation.
Test Cases
>>> 0, 1
1
>>> 0, 2
10
>>> 0, 7
1000010
>>> 1, 10
1101011011
>>> 1.01, 3
110
>>> 1.01, 24
110101101101101101101101
>>> 2.71, 32
11111111111111111111111111111111
>>> 2.71, 144
111111111111111111111111111111110111111111111111111111111111111111111111111111111111111101111111111111111111111111111111111111111111111111111111
>>> -9.8, 100
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

Note that since -9.8 is so large, the first 1 that would be output is somewhere around the 149496620th term (that was computed via floats, so the value might not be exact).

Perl, 69 bytes
use bigrat;$s+=.5/($s>$ARGV[$_=0]?-++$n:++$p-++$_/2),print for 1..pop

Takes inputs as command line arguments.
Explanation: bigrat enables fractions everywhere for accurate calculations. $s is the current sum of terms, $ARGV[0] is the target value, pop (same as $ARGV[1]) represents the number of terms, $p and $n represent the positive and negative term counts. $_ is either 1 or 0 depending on whether a positive or negative term was added.

Haskell, 92 91 90 bytes
import Data.Ratio
f=(.h 0 1 2).take
h a p q z|a>z=0:h(a-1%q)p(q+2)z|1<2=1:h(a+1%p)(p+2)q z

Usage example: f 24 1.01 -> [1,1,0,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1].
h builds the infinite bit pattern by carrying four parameters around: a is the current sum. p is the denominator of the next positive term, q for negative terms. z is the target number. f starts everything up and truncates the result to length n.
Edit: @Zgarb found a byte to save. Thanks!

Defining h a p q instead of h p q a saves a byte.

Should be noted that 7 bytes are spent on just trimming the infinite result list to one of length n. It would actually be much nicer to just give the infinite list as the result.

Python 3, 128 124 bytes
from fractions import*
F=Fraction
*c,s=2,1,0
t=F(input())
for i in'x'*int(input()):w=s<=t;s+=F(w*2-1,c[w]);c[w]+=2;print(+w)

This makes use of Python's Fraction class.
from fractions import*
F=Fraction
*c,s=2,1,0                # c = [2, 1]. s = 0
                          # c is my positive/negative term counter, s is the sum
t=F(input())              # input a fraction
for i in'x'*int(input()): # Do this for for the chosen number of terms, as per the spec
  w=s<=t;                 # "w" or which one do we choose? Positive or negative?
  s+=F(w*2-1,c[w]);       # w*2-1 gives 1 if w else -1. Gives 1 if we need to add, else -1
  c[w]+=2;                # Increment the coefficient we chose
  print(+w)               # Output that. The +w coerces the bool to an int.

'x'*int(input())?


text:
Area of the triangle
Another easy challenge for you.
Your task
Write a program or function that takes the input, which contains 3 pairs of x- and y-coordinates and calculates the area of the triangle formed inside them. For those who can't remember how to calculate it, you can find it here.
Example:
1,2,4,2,3,7       # input as x1,y1,x2,y2,x3,y3
7.5               # output

See it at Wolfram Alpha
Some considerations:

The input will be six base 10 positive integers.
You may assume the input is in any reasonable format.
The points will always form a valid triangle.
You can assume the input is already stored in a variable such as t.
The shortest code in bytes wins!

Edit: To avoid any confusion I've simplificated how the input should be dealt without jeopardizing any of the current codes.
Remember that the your program/function must output a valid area, so it can't give a negative number as output

You say the input is 3 pairs, but then you also say it's vectors with six numbers. Do you mean these terms mathematically, or is this restricting how the data can be taken as input? Some answers are functions that take six numbers, rather than a list of six numbers -- is that OK?

Re: your edit. Does that mean that I can have an actual array of pairs (e.g., [[1, 2], [4, 2], [3, 7]]) in T?

I'm still confused. The post still says both "3 pairs" and "six ... integers". Note that removing either one would invalidate some answers.

I don't like seeing a question change after posting and answer. But this time I can save 2 more bytes, so it's all right

If we can take them in as three pairs, can we take them in as a multidimensional array? That is, [1 2;4 2;3 7] (using Julia syntax)?

Re: "points will always form a valid triangle" - can we assume the points are always ordered clockwise or withershins?

@YiminRong I didn't understood, by that it means the the points will not form a line. I seems to be unable to see how the order would matter, can you explain to me?

@AndréMuta - If the points are ordered clockwise, the area will be negative unless absolute value is used. Just saves a few bytes if you don't need to handle both clockwise and withershins.

@YiminRong The area of a triangle cannot be negative by definition. It does not matter what order the points are in.

@YiminRong There are two notions of area, signed (oriented) area and unsigned (positive) area. This problem is using unsigned area.

CJam, 18 16 bytes
T(f.-~(+.*:-z.5*

Try it online in the CJam interpreter.
Idea
As mentioned on Wikipedia, the area of the triangle [[0 0] [x y] [z w]] can be calculated as |det([[x y] [z w]])| / 2 = |xw-yz| / 2.
For a generic triangle [[a b] [c d] [e f]], we can translate its first vertex to the origin, thus obtaining the triangle [[0 0] [c-a d-b] [e-a f-b]], whose area can be calculated by the above formula.
Code
T                  e# Push T.
                   e# [[a b] [c d] [e f]]
   (               e# Shift out the first pair.
                   e# [[c d] [e f]] [a b]
    f.-            e# For [c d] and [e f], perform vectorized
                   e# subtraction with [a b].
                   e# [[c-a d-b] [e-a f-b]]
       ~           e# Dump the array on the stack.
                   e# [c-a d-b] [e-a f-b]
        (+         e# Shift and append. Rotates the second array.
                   e# [c-a d-b] [f-b e-a]
          .*       e# Vectorized product.
                   e# [(c-a)(f-b) (d-b)(e-a)]
            :-     e# Reduce by subtraction.
                   e# (c-a)(f-b) - (d-b)(e-a)
              z    e# Apply absolute value.
                   e# |(c-a)(f-b) - (d-b)(e-a)|
               .5* e# Multiply by 0.5.
                   e# |(c-a)(f-b) - (d-b)(e-a)| / 2

JavaScript (ES6) 42 .44.
Edit Input format changed, I can save 2 bytes
An anonymous function that take the array as a parameter and returns the calculated value.
(a,b,c,d,e,f)=>(a*(d-f)+c*(f-b)+e*(b-d))/2

Test running the snippet below in an EcmaScript 6 compliant browser.

f=(a,b,c,d,e,f)=>(a*(d-f)+c*(f-b)+e*(b-d))/2

function test()
{
  var v=I.value.match(/\d+/g)
  I.value = v
  R.innerHTML=f(...v)
}
<input id=I onchange="test()"><button onclick="test()">-></button>

Couldn't you just take the values as standard parameters and save yourself 2 characters on creating the array?

@Mwr247  the challenge says The input will be a vector with six base 10 positive integers.

Aha. I had initially interpreted that as meaning each pair makes up a coordinate vector (such as the Wolfram example), as opposed to the input itself being limited to an array, and as such could use other formats. Makes more sense now.

@Mwr247 now you're right

Mathematica, 27 bytes
Area@Polygon@Partition[t,2]

I love how this uses a Built-in and is still longer than the cjam answer.

@Carcigenicate the real problem is the Partition[t,2], which corresponds to the 2/ in CJam. ;)

Julia, 32 bytes
abs(det(t[1:2].-t[[3 5;4 6]]))/2

Constructs a matrix of the appropriate terms of a cross product, uses det to get the resulting value, takes absolute value to deal with negatives, and then divides by 2 because it's a triangle and not a parallelogram.

Matlab/Octave, 26 bytes
I did not know about this built in so far=)
polyarea(t(1:2:5),t(2:2:6))

Java, 79 88 bytes
float f(int[]a){return Math.abs(a[0]*(a[3]-a[5])+a[2]*(a[5]-a[1])+a[4]*(a[1]-a[3]))/2f;}

Just uses the basic formula, nothing special.
Edit: Forgot to take the absolute value :(

you dont need to make it runnable?

The example just shows a function call, and that's a relatively normal default here.

Per the question, •You can assume the input is already stored in a variable such as 't'. So, return(t[0]*(t[3]... should suffice, no?

@TimmyD Feels shady doing it, but it would bring it down to 62 bytes. Hmmm.... I'm going to leave it as is, for now at least.

Minkolang 0.8, 34 bytes
ndndn0g-n1g-n0g-n0g-1R*1R*-$~2$:N.

Anyone want some egg-n0g?
Explanation
Very straightforward. Uses the formula |(x2-x1)(y3-y1) - (x3-x1)(y2-y1)|/2.
nd      x1, x1
nd      x1, x1, y1, y1
n0g-    x1, y1, y1, x2-x1
n1g-    x1, y1, x2-x1, y2-y1
n0g-    y1, x2-x1, y2-y1, x3-x1
n0g-    x2-x1, y2-y1, x3-x1, y3-y1
1R*     y3-y1, x2-x1, (y2-y1)(x3-x1)
1R*     (y2-y1)(x3-x1), (y3-y1)(x2-x1)
-       (y2-y1)(x3-x1) - (y3-y1)(x2-x1)
$~      |(y2-y1)(x3-x1) - (y3-y1)(x2-x1)|
2$:     |(y2-y1)(x3-x1) - (y3-y1)(x2-x1)|/2 (float division)
N.      Output as integer and quit.

PHP – 68 88 89 bytes
Thanks to Martjin for some great pointers!
<?=.5*abs(($t[1]-$t[5])*($t[4]-$t[2])-($t[1]-$t[3])*($t[6]-$t[2]))?>

To use it, create a file area.php with this content, the extra line meets the assume the data is saved in a variable t part of the specs, and the ␍ at the end adds a carriage return so the output is nice and separated:
<?php $t = $argv; ?>
<?=.5*abs(($t[1]-$t[5])*($t[4]-$t[2])-($t[1]-$t[3])*($t[6]-$t[2]))?>
␍

Then provide the coordinates on the command line as x₁ y₁ x₂ y₂ x₃ y₃, e.g.
$ php area.php 1 2 4 2 3 7
7.5

"You can assume the input is already stored in a variable such as t." $a -> $t, remove $a=$argv; saving 9 bytes

After that, you can replace <?php echo with <?=, saving another 7 bytes

You can say that this is PHP4.1, with register_globals=On in your php.ini file (default). Read more at http://php.net/manual/en/security.globals.php

JayScript, 58 bytes
Declares an anonymous function:
function(a,b,c,d,e,f){return (a*(d-f)+c*(f-b)+e*(b-d))/2};

Example:
var nFunct = function(a,b,c,d,e,f){return (a*(d-f)+c*(f-b)+e*(b-d))/2};
print(nFunct(1,2,4,2,3,7));

what does g do?

@steveverrill Nothing, I'm just an idiot. Fixing...

Ruby, 45
->a,b,p,q,x,y{((a-x)*(q-y)-(p-x)*(b-y)).abs/2}

Pyth, 34 30 bytes
KCcQ2c.asm*@hKd-@eKhd@eKtdU3 2

Try it online.
Works by calculating abs(a*(d-f) + c*(f-b) + e*(b-d))/2 from input a,b,c,d,e,f.

AWK – 51 42 bytes
AWK has no built-in abs so using sqrt(x^2) to substitute.
{print sqrt((($1-$5)*($4-$2)-($1-$3)*($6-$2))^2)/2}

Save as area.awk and use as echo x₁ y₁ x₂ y₂ x₃ y₃ | awk -f area.awk, e.g.
$ echo 1 2 4 2 3 7 | awk -f area.awk
7.5

Python 2, 48 47 50 bytes
Very simple; follows the standard equation:
lambda a,b,c,d,e,f:abs(a*(d-f)+c*(f-b)+e*(b-d))/2.

The other, similarly simple approaches are longer:
def a(a,b,c,d,e,f):return abs(a*(d-f)+c*(f-b)+e*(b-d))/2. # 57
lambda t:abs(t[0]*(t[3]-t[5])+t[2]*(t[5]-t[1])+t[4]*(t[1]-t[3]))/2. # 67
def a(t):return abs(t[0]*(t[3]-t[5])+t[2]*(t[5]-t[1])+t[4]*(t[1]-t[3]))/2. # 74

Python's access to a determinate function is through numpy.
Thanks to muddyfish for 1 byte and xnor for catching an error.

you can remove the 0 from 2.0 to leave 2.

Quite true, @muddyfish, thanks!

Is this Python 2 or 3? Division works differently depending on the version...

Clarified, @mbomb007.

You need an abs to make the answer positive.

PHP, 77
Based on @Yimin Rong's answer, I felt I could improve upon it by a few bytes by using list() rather than straight $argv to abbreviate some variables. Also echo doesn't need a space if there is delimiter between echo and the thing being echoed.
echo$variable;, echo(4+2);, and echo'some string'; are equally valid whereas echofunction($variable) confuses PHP.
On the other hand, I also added abs() to be mathematically accurate, since some combinations of vertices yielded "negative area"
list($t,$a,$b,$c,$d,$e,$f)=$argv;echo.5*abs(($a-$e)*($d-$b)-($a-$c)*($f-$b));

You can run it via CLI
php -r "list($t,$a,$b,$c,$d,$e,$f)=$argv;echo.5*abs(($a-$e)*($d-$b)-($a-$c)*($f-$b));" 1 2 4 2 3 7
7.5

R, 37 bytes
cat(abs(det(rbind(matrix(t,2),1))/2))

Converts the vector of coordinates into a matrix and tacks on a row of 1's.
Calculates the determinant and divides by 2.
Returns the absolute result.  If the order was always clockwise the abs would not be required.
> t = c(1,2,4,2,3,7)
> cat(det(rbind(matrix(t,2),1))/2)
7.5

PowerShell, 70 Bytes
[math]::Abs(($t[0]-$t[4])*($t[3]-$t[1])-($t[0]-$t[2])*($t[5]-$t[1]))/2

Uses the same standard formula as other solutions. Per the question, assumes the array is pre-populated, e.g. $t=(1,2,4,2,3,7). But ooof, does the $ and [] syntax kill this one...

Your comment about the penalty from using $ and [] inspired me to try an AWK solution which, by length, is not uncompetitive!

dc, 52 bytes
Assumes the input is in register t  as: x1 y1 x2 y2 x3 y3 with x1 at the top of t's stack.
1kLtLtsaLtsbLtdscLtltrlalclbltla-*sd-*se-*leld++2/p

1 2 4 2 3 7stStStStStSt #puts coordinates into register t (closest thing dc has to variables)
1kLtLtsaLtsbLtdscLtltrlalclbltla-*sd-*se-*leld++2/p
7.5

This uses the following formula for area:
(x1(y2-y3) + x2(y3-y1) + x3(y1 - y2))/2
And for a quick breakdown of the process:

1k Lt Lt sa Lt sb Lt d sc Lt lt r: set decimal precision to 1 place, move parts of the stack in t to the main stack and move various parts of the main stack to other registers for storage (d duplicates the top of main stack, r reverses the top two elements of main stack, L/l move/copy from the given register to main, s moves top of main stack to the given register)
Main: y3 x3 y2 x1
a: y1, b: x2, c: y2, t: y3
la lc lb lt la: copy the top of the stacks in registers a, c, b, t, and a to the main stack in that order
Main: y1 y3 x2 y2 y1 y3 x3 y2 x1
a: y1, b: x2, c: y2, t: y3
- * sd: calculate ((y3-y1)*x2) and put result in d (registers a, b, c, and t are no longer used so I'll drop them from the list of stacks now)
Main: y2 y1 y3 x3 y2 x1
d:((y3-y1)*x2)
- * se - *: compute ((y1-y2)*y3) and ((y2-x3)*x1); store the former in e and leave the latter on the main stack
Main: ((y2-x3)*x1)
d:((y3-y1)*x2), e:((y1-y2)*y3)
le ld + +: copy top of register e and d to the main stack, calculate sum of top 2 stack values (pushing result back to main stack) twice
Main: (((y3-y1)*x2)+((y1-y2)*y3)+((y2-x3)*x1))
d:((y3-y1)*x2), e:((y1-y2)*y3)
2 /: push 2 onto main stack, divide 2nd values on stack by the 1st (d and e are no longer used, dropping them from list of stacks)
Main: (((y3-y1)*x2)+((y1-y2)*y3)+((y2-x3)*x1))/2

Rearranging the value on the stack we can see it's equivalent to the formula at the top of this explanation: (x1(y2-y3) + x2(y3-y1) + x3(y1 - y2))/2

p: Print top of main stack to output.

Jelly, 6 bytes
_ḢÆḊHA

Try it online!
Takes input as 3 pairs [a,b],[c,d],[e,f] as Jelly has no concept of variables
How it works
This implements the method outlined on Wikipedia that Dennis' answer uses, in that, the area of a triangle \$(0,0), (x,y), (v,w)\$ is
$$\frac12\left|\det\left[\begin{matrix}
x & y \\
v & w
\end{matrix}\right]\right|$$
and that, for an arbitrary triple of points \$(a,b),(c,d),(e,f)\$, we can translate them to form a triangle with a corner on the origin: \$(0,0),(c-a,d-b),(e-a,f-b)\$, so the area is
$$\frac12\left|\det\left[\begin{matrix}
c-a & d-b \\
e-a & f-b
\end{matrix}\right]\right|$$
_ḢÆḊHA - Main link. Takes [[a, b], [c, d], [e, f]] on the left
 Ḣ     - Remove [a,b] and yield it
_      - Vectorised subtraction from each of [[c, d], [e, f]] which yields
         [[c-a, d-b], [e-a, f-b]]
  ÆḊ   - Determinant
    H  - Halve
     A - Absolute value


text:
Print a Symbolic Negative of your Code
(This is a variation on Print a Negative of your Code, which I enjoyed a lot! Thanks to Martin Büttner♦ - almost all of this text is his.)
Let's consider the symbols to be the following printable ASCII characters (note that space is included):
 !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~

And the alphanumerics to be these:
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz

Consider a square of printable ASCII characters for side length N, like the following:
ONE,
{two}
&3,+=
!four
f|ve.

We also require each row and each column to contain at least one symbol and one alphanumeric. (The above example satisfies this.)
We define the symbolic negative of such a square to be a square of the same size where each symbol is replaced with an alphanumeric and vice versa. For example, the following would be a valid symbolic negative of the above example:
[&]OK
a...b
1/100
i@#$%
(R) z

The choice of specific characters is irrelevant as long as they are in the categories above.
The Challenge
Your task is to write a program with square source code with side length N > 1, which prints a symbolic negative of its source code to STDOUT. Trailing spaces must be printed. You may or may not print a single trailing newline.
The usual quine rules also apply, so you must not read your own source code, directly or indirectly. Likewise, you must not assume a REPL environment which automatically prints the value of each entered expression.
The winner is the program with the lowest side length N. In the event of a tie, the submission with the fewest symbols in the source code wins. If there's still a tie, the earliest answer wins.

Is this really a "quine" type challenge since the output doesn't need to be source code of any type?

Good point, I don't think it actually is.

@LiamNoronha I'd consider it a generalised quine in that the output is a function of the source code, and the standard quine rules apply.

Define "reading your own source code"; if there is a command that, say, copies characters to the output, would this be an instance of said "reading"?

GolfScript, 3 × 3 (4 symbols)
4,m
`3/
n*o

Try it online on Web GolfScript.
Output
[0
1 2
 3]

How it works
4,  # Push the array [0 1 2 3].
  m # Undefined token. Does nothing.
`   # Push the string representation of the array. Pushes "[0 1 2 3]".
 3/ # Split into chunks of length 3. Pushes ["[0 " " 1 " "2 3]"].
n*  # Join the chunks, separated by linefeeds. Pushes the output.
  o # Undefined token. Does nothing.

CJam, 3 × 3 (5 symbols)
[5,
S*3
/N*

Try it online in the CJam interpreter.
How it works
[   e# Unmatched [. Does nothing.
 5, e# Push [0 1 2 3 4].
S*  e# Join the integers, separating by spaces. Pushes "0 1 2 3 4".
  3 e#
/   e# Split into chunks of length 3. Pushes ["0 1" " 2 " "3 4"].
 N* e# Join the chunks, separated by linefeeds. Pushes the output.

Output
0 1
 2
3 4

Pyth, 3x3, 4 Symbols
S]1
.5;
S]1

Output:
[1]
0.5
[1]

Explanation:

S sorts the one element list ]1
The numeric literal .5 gets printed as 0.5, ; terminates the statement (does nothing in this case)

I though long and hard about how I could get <alphanum><symbol><alphanum> in Pyth or CJam. It never occurred to me to use floats... Nice work!

C++, 18 x 18
"Always choose the worst tool for the job."
#include<cstdio>
int main(){ for  (
int line =  0lu;
1lu*line <  18l;
1lu*line++){pri\
ntf(line == 0lu *
123*line? "\x41.\\
x2e\x02e...\x2e\\
x42\x02e...\x2e.\
CDE\x00a":  14l!=
1lu*line?".\x2e.\\
x46\x02e...\x47""\
HIJ\x02e..""KLM"
 /*O*/"\n":  /*The
bad code:*/"NOP.\
QRS\x054." "UVW\
XYZ\x02e" "\x2e\\
x2e\x00a"); 0lu;}}

Output:
A.......B......CDE
...F....GHIJ...KLM
...F....GHIJ...KLM
...F....GHIJ...KLM
...F....GHIJ...KLM
...F....GHIJ...KLM
...F....GHIJ...KLM
...F....GHIJ...KLM
...F....GHIJ...KLM
...F....GHIJ...KLM
...F....GHIJ...KLM
...F....GHIJ...KLM
...F....GHIJ...KLM
...F....GHIJ...KLM
NOP.QRST.UVWXYZ...
...F....GHIJ...KLM
...F....GHIJ...KLM
...F....GHIJ...KLM


text:
Restaurant Shorthand
Goal
Sometimes dinner menus can have long winded names.  It's much easier for the waiter to write an abbreviation that unambiguously identifies the dish.
For example, given this list:
beef burger
chicken burger
chicken nuggets

The abbreviation c n matches chicken nuggets.
The abbreviation bur matches beef burger and chicken burger.
Write a program of function that identifies one or more items that match an abbreviation.
Input

The abbreviated string to find.
A list of items to search.

You may change this order and use any suitable data types.
Output

If the abbreviation does not match any items: Not found
If the abbreviation unambiguously matches an item: output the unabbreviated item.
If the abbreviation ambiguously matches several items: output a comma separated list of words that would make the selection unambiguous, followed by a question mark.  The order is not important.  Extra spaces are permitted.

Matching rules
Each word in the abbreviation and the items is considered separately.  If an abbreviated word matches the start of an item word, the item is a potential match.  If none of an item's words start with any if the abbreviated words, that item is not a match.
Abbreviated words can be in any order.
An abbreviated word cannot be used to match multiple item words and visa-versa.
Abbreviations only match the start of words.
Assume no item will contain all of the words of another item.  For example, you will never have beef burger and beef cheese burger.
Test Cases
Given this list:
beef burger
crispy chicken burger
grilled chicken burger
chicken nuggets
chocolate cone
strawberry cone
vanilla cone

These abbreviation give the specified output:
fish           Not found
cones          Not found
chicken cone   Not found
nilla          Not found
v              vanilla cone
be             beef burger
c n            chicken nuggets
b b            beef burger
c b c          crispy chicken burger
c b            crispy,grilled?
bu             beef,crispy,grilled?
            or beef,crispy chicken,grilled chicken?
ch             crispy,grilled,nuggets,cone?
            or crispy chicken,grilled chicken,nuggets,cone?

Scoring
This is code golf.  The shortest answer in bytes in 12 days wins acceptance.  (I would have made it one week, but I won't be around for that.)

I'm not certain why An abbreviated word cannot be used to match multiple item words would be important if v matches vanilla cone.

Related

@Dennis, if an abbreviated word matched multiple item words, c b would match crispy chicken burger instead of being ambiguous.  When I say "word" I mean a string of characters delimited by a space, so g c b is three words.

If the abbreviation ambiguously matches several items: output a comma separated list of words that would make the selection unambiguous. Does that refer to a word that, by itself, would allow to choose from the matching options, or in addition to the abbreviations? With the first interpretation, crispy,grilled,nuggets,chocolate should be valid for the ch test case? With the second interpretation, chicken,grilled should be valid for the c b test case. What am I missing?

Given input b b beef burger battered bacon what would be acceptable output?

@Dennis, I'd expect a word that isn't matched.  While chocolate would make it unambiguous, it was matched by ch so I'd expect cone instead.  As for c b, I think your solution of chicken,grilled is an ingenious interpretation!  However, what does that mean for c c?  Damn it.  I should have sandboxed this.

@PeterTaylor, good point.  Any one word from either would fulfil the criteria.  I considered "output all items that match", but that seemed too simple.

Python 2 - 181 bytes
It turns the abbreviated string into a regex and attempts to match groups from the search list.
The ternary operation if and elses are 14 bytes. I've tried to cut it down into a list and then accessing one of the items based on the state of r, but don't have anything shorter that this yet.
import re
def s(a,l):
 r=[m.group(1)for e in l for m in[re.compile('^('+a.replace(' ','\w+ ')+'\w+)$').search(e)]if m]
 print','.join(r)+'?'if len(r)>1 else r[0]if r else'Not found'

Call with s(str, list):
s('c n', ['chicken burger', 'chicken nuggets', 'cheeseburger'])
>>> chicken nuggets
s('c n', ['chicken burger', 'chicken nuggets', 'cheeseburger', 'chicken nuggets with sauce', 'foobar'])
>>> chicken nuggets
s('c n', ['chicken burger', 'chicken nuggets', 'cheeseburger', 'chicken nuggets with sauce', 'foobar', 'cfoo nbar'])
>>> chicken nuggets,cfoo nbar?


text:
Naming non-cyclic carbon chains
(I'm not a chemist! I might be wrong at some stuff, I'm writing what I've learned in high-school)
Carbon atoms have a special attribute: They can bind to 4 other atoms (which is not that special) and they stay stable even in long chains, which is very unique. Because they can be chained and combined in a lot of different ways, we need some kind of naming convention to name them.
This is the smallest molecule we can make:
CH4

It's called methane. It consists of only one carbon and 4 hydrogen atoms. The next one is:
CH3 - CH3

This is called ethane. It's made up of 2 carbon and 6 hydrogen atoms.
The next 2 are:
CH3 - CH2 - CH3
CH3 - CH2 - CH2 - CH3

They are propane and butane. The problems start with the chains with 4 carbon atoms, as it can be built in 2 different ways. One is shown above and the other is:
CH3 - CH - CH3
       |
      CH3

This is obviously not the same as the other. The number of atoms and the bindings are different. Of course just folding bindings and rotating the molecule won't make it a different one! So this:
CH3 - CH2 - CH2 - CH3

And this:
CH3 - CH2
       |
CH3 - CH2

Are the same (If you are into graph theory, you may say that if there is isomorphism between 2 molecules; they are the same). From now on I won't write out hydrogen atoms as they are not essential for this challenge.
As you hate organic chemistry and you have a lot of different carbon atoms to name, you decide to write a program that does this for you. You don't have too much space on your hard-drive tho, so the program must be as small as possible.
The challenge
Write a program that takes in a multi-line text as input (a carbon chain) and outputs the name of the carbon chain. The input will only contain spaces, uppercase 'c' characters and '|' and '-' which represents a binding. The input chain will never contain cycles! Example:
Input:
C-C-C-C-C-C
  |   |
  C   C-C

Output:

4-ethyl-2-methylhexane

Any output is acceptable as long as it's human-readable and essentially the same (so you can use different separators for example if you wish).
The naming convention:
(See: IUPAC rules)

Identify the longest carbon chain. This chain is called the parent chain.
Identify all of the substituents (groups appending from the parent chain).
Number the carbons of the parent chain from the end that gives the substituents the lowest numbers. When comparing a series of numbers, the series that is the "lowest" is the one which contains the lowest number at the occasion of the first difference. If two or more side chains are in equivalent positions, assign the lowest number to the one which will come first in the name.
If the same substituent occurs more than once, the location of each point on which the substituent occurs is given. In addition, the number of times the substituent group occurs is indicated by a prefix (di, tri, tetra, etc.).
If there are two or more different substituents they are listed in alphabetical order using the base name (ignore the prefixes). The only prefix which is used when putting the substituents in alphabetical order is iso as in isopropyl or isobutyl. The prefixes sec- and tert- are not used in determining alphabetical order except when compared with each other.
If chains of equal length are competing for selection as the parent chain, then the choice goes in series to:

the chain which has the greatest number of side chains.
the chain whose substituents have the lowest- numbers.
the chain having the greatest number of carbon atoms in the smallest side chain.
the chain having the least branched side chains (a graph having the least number of leaves).

For the parent chain, the naming is:
Number of carbons   Name
1                  methane
2                  ethane
3                  propane
4                  butane
5                  pentane
6                  hexane
7                  heptane
8                  octane
9                  nonane
10                 decane
11                 undecane
12                 dodecane

No chains will be longer than 12, so this will be enough. For the sub-chains it's the same but instead of 'ane' at the end we have 'yl'.
You can assume that the Cs are in the odd columns and the bindings (| and - characters) are 1 long between carbon atoms.
Test cases:
Input:
C-C-C-C

Output:

butane

Input:
C-C-C
  |
  C

Output:

2-methylpropane

Input:
C-C-C-C
  |
  C
  |
  C-C

Output:

3-methylhexane

Input:
C-C-C-C-C
  |
  C
  |
  C

Output:

3-methylhexane

Input:
    C
    |
    C
    |
C-C-C-C
  |
  C-C-C
  |
  C-C

Output:

3,4-dimethyl-5-ethylheptane

Edit: Sorry for the wrong examples. I wasn't a good student :( . They should be fixed now.

Comments are not for extended discussion; this conversation has been moved to chat.

According to this rule, If the same substituent occurs more than once, the location of each point on which the substituent occurs is given. In addition, the number of times the substituent group occurs is indicated by a prefix (di, tri, tetra, etc.)., shouldn't the last example be called 3,4-dimethyl-5-ethylheptane? (we're just starting organic chemistry, I might be wrong :P)

@NieDzejkob I would agree, as there are two methyl chains.

@NieDzejkob Indeed, fixed.

Python 2, 1876 1871 1870 1859 1846 1830 1826 1900 1932 1913 1847 1833 1635 1613 1596 bytes
s=input().split('\n')
W=enumerate
J=len
Y=sorted
l=J(s[0])
s=''.join(s)
S=set
M=max
A=min
p=map
f=lambda k:[(x/l,x%l)for x,V in W(s)if V==k]
g=lambda x,i,h=lambda x,i,j:x[:i]+(x[i]+j,)+x[i+1:]:[(h(q,i,-1),h(q,i,1))for q in x]
v=f('C');e=g(f('-'),1)+g(f('|'),0)
E=[V for V in v if sum(e,()).count(V)==1]
o=lambda v:[E[~E.index(v)]for E in e if v in E]
T=lambda a:lambda b:z((a,b))
Z=lambda a:p(T(a[0]),a[1])
n=lambda R:'mepbphhondudetrueeeco nothotnxptn ddh p t t'[R-1::12].strip()+(R>9)*'ec'
G=lambda K:[H[i]for i,V in W(K)if V==A(K)]
q=lambda x:[`k[0]`for k in H if k[1]==x]
B='-'.join
def z(n,c=[]):k=[x for x in S(o(n[0]))-S(c)];p=[z((j,n[1]),c+k)for j in k];return 1-~-(n[0]==n[1])*(p and A(p)or J(v))
C=[(a,b)for a in E for b in E]
a=p(z,C)
s=[(k,[E for E in v if~-z((k[0],E))+z((k[1],E))==z((k[0],k[1]))])for k in[C[x]for x,V in W(a)if V==M(a)]]
H=[]
R=0
for k,_ in s:R=M(J(_),R);_.sort(key=T(k[0]));a=sum([list(S(o(k))-S(_))for k in _],[]);H+=zip(p(lambda a:Z((a,_)).index(2),a),p(Z,[(O,[x for x in S(v)-S(_)if z((x,O),_)<J(v)])for O in a])),
X=n(R)
U=any(H)
if U:H=G([[h[0]for h in Q]for Q in H if J(Q)==M(p(J,H))]);K=[[J(Q[1])for Q in j]for j in H];H=[H[i]for i,V in W(K)if A(V)==A(sum(K,[]))];K=[J([Q[1]for Q in j if J(S(Q[1]))-J(Q[1])])for j in H];H=[[p[0]+1,n(M(p[1]))+[['isopropyl','butyl-tert','butyl-sec','isobutyl'][J(p[1])+p[1].count(3)-3],'yl'][Y(p[1])==range(1,1+M(p[1]))]]for p in G(K)[0]]
print(U and B([','.join(q(x))+'-'+'dttphhondireeeecoe itnxptnc  rtataaa  aa a '[J(q(x))-2::9].strip()+B(x.split('-')[::-1])for x in Y(list(S(zip(*H)[1])))])+X or[X,'meth']['t'==X])+'ane'

Try it online!
Well there you go. Certainly not the golfiest but it works (I hope) :D
Took me about 10 hours, maybe? Probably my longest golf in both size and time, and that's saying something considering I used to use Java D:
Logic:

Convert from the ASCII representation to graph representation with each carbon atom as a node and each bond as an edge represented in adjacency form.
Find all leaves; that is, nodes with only one bond. The longest chain is guaranteed to be from one of these to another.
Find the dyadic product of the leaves; that is, all pairs of edge nodes. Then, take the length of all of these chains.
For each chain, find its subchains.
Do stuff to pick the right chain. If there are ties, then it doesn't really matter. Fun fact: There will always be a tie because each chain is counted twice, once in reverse.
Print it properly.

EDIT: Fixed bug where it used to cause errors if there were no side chains.
EDIT: Thanks to MD XF for noticing a few extra spaces (indentation for the for loop).
EDIT: I completely forgot about the prefix for having the same substituent.
NOTE: Each line needs to be the same width for this to work. That is, trailing spaces are required.
Fun fact: most cyclic hydrocarbons will be determined as "methane"
Fun fact: If you do C-C-...-C-C with 13 Cs, it will give ethane, then thane for 14, ropane for 15, etc.
-79 bytes thanks to Jonathan Frech
-119 bytes thanks to NieDzejkob
-17 bytes thanks to ovs

This appears to fail with tert-butyl and sec-butyl as substituents: Try it online!