text:
Find the Cross Product
The cross product of two three-dimensional vectors \$\vec a\$ and \$\vec b\$ is the unique vector \$\vec c\$ such that:

\$\vec c\$ is orthogonal to both \$\vec a\$ and \$\vec b\$

The magnitude of \$\vec c\$ is equal to the area of the parallelogram formed by \$\vec a\$ and \$\vec b\$

The directions of \$\vec a\$, \$\vec b\$, and \$\vec c\$, in that order, follow the right-hand rule.

There are a few equivalent formulas for cross product, but one is as follows:
$$\vec a\times\vec b=\det\begin{bmatrix}\vec i&\vec j&\vec k\\a_1&a_2&a_3\\b_1&b_2&b_3\end{bmatrix}$$
where \$\vec i\$, \$\vec j\$, and \$\vec k\$ are the unit vectors in the first, second, and third dimensions.
Challenge
Given two 3D vectors, write a full program or function to find their cross product. Builtins that specifically calculate the cross product are disallowed.
Input
Two arrays of three real numbers each. If your language doesn't have arrays, the numbers still must be grouped into threes. Both vectors will have magnitude \$<2^{16}\$. Note that the cross product is noncommutative (\$\vec a\times\vec b=-\bigl(\vec b\times\vec a\bigr)\$), so you should have a way to specify order.
Output
Their cross product, in a reasonable format, with each component accurate to four significant figures or \$10^{-4}\$, whichever is looser. Scientific notation is optional.
Test cases
[3, 1, 4], [1, 5, 9]
[-11, -23, 14]

[5, 0, -3], [-3, -2, -8]
[-6, 49, -10]

[0.95972, 0.25833, 0.22140],[0.93507, -0.80917, -0.99177]
[-0.077054, 1.158846, -1.018133]

[1024.28, -2316.39, 2567.14], [-2290.77, 1941.87, 712.09]
[-6.6345e+06, -6.6101e+06, -3.3173e+06]

This is code-golf, so the shortest solution in bytes wins.
Maltysen posted a similar challenge, but the response was poor and the question wasn't edited.

Can the input be taken as a 2D array?

Yes, as long as 2 is the outer dimension.

Jelly, 14 13 12 bytes
;"s€2U×¥/ḅ-U

Try it online!
How it works
;"s€2U×¥/ḅ-U Main link. Input: [a1, a2, a3], [b1, b2, b3]

;"           Concatenate each [x1, x2, x3] with itself.
             Yields [a1, a2, a3, a1, a2, a3], [b1, b2, b3, b1, b2, b3].
  s€2        Split each array into pairs.
             Yields [[a1, a2], [a3, a1], [a2, a3]], [[b1, b2], [b3, b1], [b2, b3]].
       ¥     Define a dyadic chain:
     U         Reverse the order of all arrays in the left argument.
      ×        Multiply both arguments, element by element.
        /    Reduce the 2D array of pairs by this chain.
             Reversing yields [a2, a1], [a1, a3], [a3, a2].
             Reducing yields [a2b1, a1b2], [a1b3, a3b1], [a3b2, a2b3].
         ḅ-  Convert each pair from base -1 to integer.
             This yields [a1b2 - a2b1, a3b1 - a1b3, a2b3 - a3b2]
           U Reverse the array.
             This yields [a2b3 - a3b2, a3b1 - a1b3, a1b2 - a2b1] (cross product).

Non-competing version (10 bytes)
OK, this is embarrassing, but the array manipulation language Jelly did not have a built-in for array rotation until just now. With this new built-in, we can save two additional bytes.
ṙ-×
ç_ç@ṙ-

This uses the approach from @AlexA.'s J answer. Try it online!
How it works
ṙ-×     Helper link. Left input: x = [x1, x2, x3]. Right input: y = [y1, y2, y3].

ṙ-      Rotate x 1 unit to the right (actually, -1 units to the left).
        This yields [x3, x1, x2].
  ×     Multiply the result with y.
        This yields [x3y1, x1y2, x2y3].

ç_ç@ṙ-  Main link. Left input: a = [a1, a2, a3]. Right input: b = [b1, b2, b3].

ç       Call the helper link with arguments a and b.
        This yields [a3b1, a1b2, a2b3].
  ç@    Call the helper link with arguments b and a.
        This yields [b3a1, b1a2, b2a3].
_       Subtract the result to the right from the result to the left.
        This yields [a3b1 - a1b3, a1b2 - a2b1, a2b3 - a3b2].
    ṙ-  Rotate the result 1 unit to the right.
        This yields [a2b3 - a3b2, a3b1 - a1b3, a1b2 - a2b1] (cross product).

Convert each pair from base -1? That's just evil. +1

LISP, 128 122 bytes
Hi! This is my code:
(defmacro D(x y)`(list(*(cadr,x)(caddr,y))(*(caddr,x)(car,y))(*(car,x)(cadr,y))))(defun c(a b)(mapcar #'- (D a b)(D b a)))

I know that it isn't the shortest solution, but nobody has provided one in Lisp, until now :)
Copy and paste the following code here to try it!
(defmacro D(x y)`(list(*(cadr,x)(caddr,y))(*(caddr,x)(car,y))(*(car,x)(cadr,y))))(defun c(a b)(mapcar #'- (D a b)(D b a)))

(format T "Inputs: (3 1 4), (1 5 9)~%")
(format T "Result ~S~%~%" (c '(3 1 4) '(1 5 9)))

(format T "Inputs: (5 0 -3), (-3 -2 -8)~%")
(format T "Result ~S~%~%" (c '(5 0 -3) '(-3 -2 -8)))

(format T "Inputs: (0.95972 0.25833 0.22140), (0.93507 -0.80917 -0.99177)~%")
(format T "Result ~S~%" (c '(0.95972 0.25833 0.22140) '(0.93507 -0.80917 -0.99177)))

(format T "Inputs: (1024.28 -2316.39 2567.14), (-2290.77 1941.87 712.09)~%")
(format T "Result ~S~%" (c '(1024.28 -2316.39 2567.14) '(-2290.77 1941.87 712.09)))

Welcome to Programming Puzzles and Code Golf Stack Exchange. This is a great answer, +1. Well done for answering in a language that isn't going to win, but still golfing it down loads. Often [tag:code-golf] challenges are more about within languages than between them!

J, 27 14 bytes
2|.v~-v=.*2&|.

This is a dyadic verb that accepts arrays on the left and right and returns their cross product.
Explanation:
         *2&|.     NB. Dyadic verb: Left input * twice-rotated right input
      v=.          NB. Locally assign to v
   v~-             NB. Commute arguments, negate left
2|.                NB. Left rotate twice

Example:
    f =: 2|.v~-v=.*2&|.
    3 1 4 f 1 5 9
_11 _23 14

Try it here
Saved 13 bytes thanks to randomra!

@randomra That's awesome, thanks! I'm no J expert so I'm still figuring out how exactly it works but I have a general idea.

Some clarifications: *2&|. is a fork of two verbs: * and 2&|.. It multiplies the left input by a rotated by 2 right input. This fork is stored in v so when we write v~, it is equivalent to (*2&|.)~, where the ~ swaps the left and right input parameters for the parenthesized part.

@randomra Okay, that makes sense. Thanks again!

Dyalog APL, 12 bytes
2⌽p⍨-p←⊣×2⌽⊢

Based on @AlexA.'s J answer and (coincidentally) equivalent to @randomra's improvement in that answer's comment section.
Try it online on TryAPL.
How it works
2⌽p⍨-p←⊣×2⌽⊢  Dyadic function.
              Left argument: a = [a1, a2, a3]. Right argument: b = [b1, b2, b3].

         2⌽⊢  Rotate b 2 units to the left. Yields [b3, b1, b2].
       ⊣×     Multiply the result by a. Yields [a1b3, a2b1, a3b2].
     p←       Save the tacit function to the right (NOT the result) in p.
  p⍨          Apply p to b and a (reversed). Yields [b1a3, b2a1, b3a2].
    -         Subtract the right result (p) from the left one (p⍨).
              This yields [a3b1 - a1b3, a1b2 - a2b1, a2b3 - a3b2].
2⌽            Rotate the result 2 units to the left.
              This yields [a2b3 - a3b2, a3b1 - a1b3, a1b2 - a2b1].

C, 156 154 150 148 144 bytes
#include <stdio.h>
main(){float v[6];int i=7,j,k;for(;--i;)scanf("%f",v+6-i);for(i=1;i<4;)j=i%3,k=++i%3,printf("%f ",v[j]*v[k+3]-v[k]*v[j+3]);}

Not going to be winning any prizes for length, but thought I'd have a go anyway.

Input is a newline- or space-delimited list of components (i.e. a1 a2 a3 b1 b2 b3), output is space-delimited (i.e. c1 c2 c3).
Cyclically permutes the indices of the two input vectors to calculate the product - takes fewer characters than writing out the determinants!

Demo
Ungolfed:
#include <cstdio>
int main()
{
    float v[6];
    int i = 7, j, k;
    for (; --i; ) scanf("%f", v + 6 - 1);
    for (i = 1; i < 4; )
        j = i % 3,
        k = ++i % 3,
        printf("%f ", v[j] * v[k + 3] - v[k] * v[j + 3]);
}

Welcome to Programming Puzzles and Code Golf Stack Exchange. This is a great answer; well done for answering in a language that won't beat the golfing languages. +1.

Your first for doesn't need {}

cheers, updated.

You can replace &v[6-i] with v+6-i. Also, you can replace semicolon after j=i%3 and k=(i+1)%3 with commas, which makes everything after the for a single statement so you can omit the {}. Finally,  if you initialise i to 1 for the second for loop, you can move the increment into k=++i%3 saving a couple of brackets.  If you're not worried about warnings and use the right version of C, you can skip the include as well.

awesome, cheers! My compiler won't accept the omission of the header, so I've stuck with a version I'm able to build.

115 bytes

Haskell, 41 bytes
x(a,b,c)(d,e,f)=(b*f-c*e,c*d-a*f,a*e-b*d)

A straightforward solution.

Bash + coreutils, 51
eval set {$1}*{$2}
bc<<<"scale=4;$6-$8;$7-$3;$2-$4"

Line 1 constructs a brace expansion that gives the cartesian product of the two vectors and sets them into the positional parameters.
Line 2 subtracts the appropriate terms; bc does the arithmetic evaluation to the required precision.

Input is as two comma-separated lists on the command-line.  Output as newline-separated lines:
$ ./crossprod.sh 0.95972,0.25833,0.22140 0.93507,-0.80917,-0.99177
-.07705
1.15884
-1.01812
$

MATL, 17 bytes
!*[6,7,2;8,3,4])d

First input is a, second is b.
Try it online!
Explanation
!              % input b as a row array and transpose into a column array
*              % input a as a row array. Compute 3x3 matrix of pairwise products
[6,7,2;8,3,4]  % 2x3 matrix that picks elements from the former in column-major order
)              % apply index
d              % difference within each column

Pyth, 16 bytes
-VF*VM.<VLQ_BMS2

Try it online: Demonstration
Explanation:
-VF*VM.<VLQ_BMS2   Q = input, pair of vectors [u, v]
              S2   creates the list [1, 2]
           _BM     transforms it to [[1, -1], [2, -2]]
      .<VLQ        rotate of the input vectors accordingly to the left:
                   [[u by 1, v by -1], [u by 2, v by -2]]
   *VM             vectorized multiplication for each of the vector-pairs
-VF                vectorized subtraction of the resulting two vectors

Jelly, 5 bytes
Takes input in the form \$[[x_1,x_2],[y_1,y_2],[z_1,z_2]]\$. If you want them to be two lists of x-y-z coordinates, just prepend Z to the beginning of the program.
ṁ4ÆḊƝ

Try it online!
Here is a PDF explanation in case SE markdown can't handle it.

The cross-product in analytic form
Let \$(x_1,y_1,z_1)\$ be the coordinates of \$\vec{v_1}\$ and \$(x_2,y_2,z_2)\$ be the coordinates of \$\vec{v_2}\$. Their analytic expressions are as follows:
$$\boldsymbol{\vec{v_1}}=x_1\cdot \boldsymbol{\vec{i}}+y_1\cdot \boldsymbol{\vec{j}}+z_1\cdot\boldsymbol{\vec{k}}$$
$$\boldsymbol{\vec{v_2}}=x_2\cdot \boldsymbol{\vec{i}}+y_2\cdot \boldsymbol{\vec{j}}+z_2\cdot\boldsymbol{\vec{k}}$$
The only thing left to do now is to also write their cross-product in terms of its coordinates in the \$Oxyz\$ space.
$$\boldsymbol{\vec{v_1}}\times \boldsymbol{\vec{v_2}}=\left(x_1\cdot \boldsymbol{\vec{i}}+y_1\cdot \boldsymbol{\vec{j}}+z_1\cdot\boldsymbol{\vec{k}}\right)\times\left(x_2\cdot \boldsymbol{\vec{i}}+y_2\cdot \boldsymbol{\vec{j}}+z_2\cdot\boldsymbol{\vec{k}}\right)$$
Keeping in mind that: $$\boldsymbol{\vec{i}}\times \boldsymbol{\vec{j}}=\boldsymbol{\vec{k}}, \:\: \boldsymbol{\vec{i}}\times \boldsymbol{\vec{k}}=-\boldsymbol{\vec{j}},  \:\: \boldsymbol{\vec{j}}\times \boldsymbol{\vec{i}}=-\boldsymbol{\vec{k}}, \:\: \boldsymbol{\vec{j}}\times \boldsymbol{\vec{k}}=\boldsymbol{\vec{i}}, \:\: \boldsymbol{\vec{k}}\times \boldsymbol{\vec{i}}=\boldsymbol{\vec{j}}, \:\:  \boldsymbol{\vec{k}}\times \boldsymbol{\vec{j}}=-\boldsymbol{\vec{i}}$$
After the necessary rearrangements and calculations:
$$\boldsymbol{\vec{v_1}}\times \boldsymbol{\vec{v_2}}=(y_1z_2-z_1y_2)\cdot \boldsymbol{\vec{i}}+(z_1x_2-x_1z_2)\cdot \boldsymbol{\vec{j}}+(x_1y_2-y_1x_2)\cdot \boldsymbol{\vec{k}}$$
The close relationship with matrix determinants
There's an interesting thing to note here:
$$x_1y_2-y_1x_2=\left|\begin{matrix}x_1 & y_1 \\\ x_2 & y_2\end{matrix}\right|$$
$$z_1x_2-x_1z_2=\left|\begin{matrix}z_1 & x_1 \\\ z_2 & x_2\end{matrix}\right|$$
$$y_1z_2-z_1y_2=\left|\begin{matrix}y_1 & z_1 \\\ y_2 & z_2\end{matrix}\right|$$
Where we use the notation \$\left|\cdot\right|\$ for matrix determinant. Notice the beautiful rotational symmetry?
Jelly code explanation
Well... not much to explain here. It just generates the matrix:
$$\left(\begin{matrix}x_1 & y_1 & z_1 & x_1 \\\ x_2 & y_2 & z_2 & x_2\end{matrix}\right)$$
And for each pair of neighbouring matrices, it computes the determinant of the matrix formed by joining the two.
ṁ4ÆḊƝ – Monadic Link. Takes input as [[x1,x2],[y1,y2],[z1,z2]].
ṁ4    – Mold 4. Cycle the list up to length 4, reusing the elements if necessary.
        Generates [[x1,x2],[y1,y2],[z1,z2],[x1,x2]].
    Ɲ – For each pair of neighbours: [[x1,x2],[y1,y2]], [[y1,y2],[z1,z2]], [[z1,z2],[x1,x2]].
  ÆḊ  – Compute the determinant of those 2 paired together into a single matrix.

neater form in the equations here :P

Python, 73 48 bytes
Thanks @FryAmTheEggman
lambda (a,b,c),(d,e,f):[b*f-c*e,c*d-a*f,a*e-b*d]

This is based on the component definition of the vector cross product.
Try it here

lambda (a,b,c),(d,e,f):... should save a lot.

@FryAmTheEggman You are right. I forgot that lambda can specify how the argument should be.

K5, 44 40 37 32 bytes
Wrote this one quite a while ago and dusted it off again recently.
{{x[y]-x[|y]}[*/x@']'3 3\'5 6 1}

In action:
 cross: {{x[y]-x[|y]}[*/x@']'3 3\'5 6 1};

 cross (3 1 4;1 5 9)
-11 -23 14
 cross (0.95972 0.25833 0.22140;0.93507 -0.80917 -0.99177)
-7.705371e-2 1.158846 -1.018133

Edit 1:
Saved 4 bytes by taking input as a list of lists instead of two separate arguments:
old: {m:{*/x@'y}(x;y);{m[x]-m[|x]}'(1 2;2 0;0 1)}
new: {m:{*/x@'y}x    ;{m[x]-m[|x]}'(1 2;2 0;0 1)}

Edit 2:
Saved 3 bytes by computing a lookup table with base-decode:
old: {m:{*/x@'y}x;{m[x]-m[|x]}'(1 2;2 0;0 1)}
new: {m:{*/x@'y}x;{m[x]-m[|x]}'3 3\'5 6 1}

Edit 3:
Save 5 bytes by rearranging application to permit using a tacit definition instead of a local lambda. Unfortunately, this solution no longer works in oK, and requires the official k5 interpreter. Gonna have to take my word for this one until I fix the bug in oK:
old: {m:{*/x@'y}x;{m[x]-m[|x]}'3 3\'5 6 1}
new: {{x[y]-x[|y]}[*/x@']     '3 3\'5 6 1}

Ruby, 49 bytes
->u,v{(0..2).map{|a|u[a-2]*v[a-1]-u[a-1]*v[a-2]}}

Try it online!
Returning after 2 years, I shaved off 12 bytes by using how Ruby treats negative array indices. -1 is the last element of the array, -2 the second last etc.
Ruby, 57
->u,v{(0..2).map{|a|u[b=(a+1)%3]*v[c=(a+2)%3]-u[c]*v[b]}}

In test program
f=->u,v{(0..2).map{|a|u[b=(a+1)%3]*v[c=(a+2)%3]-u[c]*v[b]}}

p f[[3, 1, 4], [1, 5, 9]]

p f[[5, 0, -3], [-3, -2, -8]]

p f[[0.95972, 0.25833, 0.22140],[0.93507, -0.80917, -0.99177]]

p f[[1024.28, -2316.39, 2567.14], [-2290.77, 1941.87, 712.09]]

Wolfram Language (Mathematica), 38 33 25 24 bytes
-1 byte thanks to @att.
Det@{a={i,j,},##}~D~{a}&

Try it online!

Surprised there be no builtin in Mathematica for this

@Seggan The builtin is Cross. But this challenge says that builtins that specifically calculate the cross product are disallowed.

-1 with Null as one of the units

ES6, 40 bytes
(a,b,c,d,e,f)=>[b*f-c*e,c*d-a*f,a*e-b*d]

44 bytes if the input needs to be two arrays:
([a,b,c],[d,e,f])=>[b*f-c*e,c*d-a*f,a*e-b*d]

52 bytes for a more interesting version:
(a,b)=>a.map((_,i)=>a[x=++i%3]*b[y=++i%3]-a[y]*b[x])

Julia 0.7, 45 39 bytes
f(a,b)=1:3 .|>i->det([eye(3)[i,:] a b])

Try it online!
Uses the determinant-based formula given in the task description.
Thanks to H.PWiz for -6 bytes.

39 bytes with two tricks: f(a,b)=1:3 .|>i->det([eye(3)[i,:] a b])

Pari/GP, 41 bytes
(a,b)->Vec(matdet(Mat([[x^2,x,1],a,b]~)))

Try it online!

TI-BASIC, 75 73 71 62 bytes
-4 bytes thanks to @MarcMush
-9 bytes using Ans instead of Prompt  and Disp
Not 62 characters -- TI-BASIC is tokenized.
:Prompt A
:{Ans(2)ʟA(3)-Ans(3)ʟA(2),Ans(3)ʟA(1)-Ans(1)ʟA(3),Ans(1)ʟA(2)-Ans(2)ʟA(1

Usage example, computing \$\langle 1,2,3\rangle\times\langle 0,1,0\rangle\$:
{1,2,3}:pgrmXPROD
A=?{0,1,0}
                  {⁻3 0 1}

you don't need to close parentheses, you can remove the last 2 characters

I think you can golf two more bytes by using ʟA and ʟB link

@MarcMush I didn't know about that! I didn't use named lists when I first wrote it because I wanted to use a list I could guarantee actually existed, but I'll have to test that and update this if it is shorter.

CSASM v2.5.0.2, 306 bytes
func a:
dup
dup
ldelem 0
pop $3
ldelem 1
pop $4
ldelem 2
pop $5
dup
dup
ldelem 0
pop $a
ldelem 1
pop $1
ldelem 2
pop $2
push $1
push $5
mul
push $2
push $4
mul
sub
push $2
push $3
mul
push $a
push $5
mul
sub
push $a
push $4
mul
push $1
push $3
mul
sub
push 3
newarr f32
pop $a
push $a
swap
stelem 2
push $a
swap
stelem 1
push $a
swap
stelem 0
push $a
ret
end

The function a expects two ~arr:f32 arrays representing the two 3D vectors on the stack before calling it.
\$\vec a\$ should be pushed to the stack first, then \$\vec b\$ should be pushed.
This function leaves an ~arr:f32 array on the stack which corresponds to \$\vec c\$.
Explanation:
; Input: two ~arr:f32 representing the two vectors
func a:
    ; stack: [ a, b, c ], [ d, e, f ]
    ; These numbers represent the coordinates of the two vectors for an easier explanation

    ; Duplicate the second vector twice
    dup
    dup

    ; stack: [ a, b, c ], [ d, e, f ], [ d, e, f ], [ d, e, f ]
    ; Store the elements in the array to the pre-defined registers $3, $4 and $5
    ldelem 0
    pop $3
    ldelem 1
    pop $4
    ldelem 2
    pop $5

    ; Duplicate the first vector twice
    dup
    dup

    ; stack: [ a, b, c ], [ a, b, c ], [ a, b, c ]
    ; Store the elements in the array to the pre-defined registers $a, $1 and $2
    ldelem 0
    pop $a
    ldelem 1
    pop $1
    ldelem 2
    pop $2

    ; Perform the algorithm: [ bf - ce, cd - af, ae - bd ]
    ; $a = a, $1 = b, $2 = c
    ; $3 = d, $4 = e, $5 = f

    ; bf - ce
    push $1
    push $5
    mul
    push $2
    push $4
    mul
    sub

    ; cd - af
    push $2
    push $3
    mul
    push $a
    push $5
    mul
    sub

    ; ae - bd
    push $a
    push $4
    mul
    push $1
    push $3
    mul
    sub

    ; Create the result array and store it in $a
    push 3
    newarr f32
    pop $a

    ; Store the resulting values from earlier into this new array
    ; "swap" swaps the top two values on the stack
    push $a
    swap
    stelem 2

    push $a
    swap
    stelem 1

    push $a
    swap
    stelem 0

    push $a
    ret
end

MATLAB/Octave, 61 bytes.
Try it online!
f=@(a,b)[det([1,0,0;a;b]),det([0,1,0;a;b]),det([0,0,1;a;b])];

Wolfram Language (Mathematica), 24 21 bytes
D/@HodgeDual[1##]&

Try it online!
 is \[TensorWedge] (U+F3DB).

APL(NARS), 23 chars, 46 bytes
{((1⌽⍺)×5⌽⍵)-(5⌽⍺)×1⌽⍵}

test:
  f←{((1⌽⍺)×5⌽⍵)-(5⌽⍺)×1⌽⍵}
  (3 1 4) f (1 5 9)
¯11 ¯23 14
  (5 0 ¯3) f (¯3 ¯2 ¯8)
¯6 49 ¯10
  (0.95972 0.25833 0.22140) f (0.93507 ¯0.80917 ¯0.99177)
¯0.0770537061 1.158846002 ¯1.018133265
  (1024.28 ¯2316.39 2567.14) f (¯2290.77 1941.87 712.09)
¯6634530.307 ¯6610106.843 ¯3317298.117

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


text:
Distance between two points in n-dimensional space
Here is another simple one:
The Challenge
Given two points in an n-dimensional space, output the distance between them, also called the Euclidean distance.

The coordinates will be rational numbers; the only limits are the restrictions of your language.
Lowest dimension is 1, highest is whatever your language can handle
You may assume that the two points are of the same dimension and that there will be no empty input.
The distance has to be correct to at least 3 decimal places. If your language does not support floating point numbers, output the nearest whole number.

Rules

As usual, function or full program allowed.
Input may be taken from STDIN, command line- or function arguments.
Input format is up to you, specify which one you used in your answer.
Output may be provided by printing to stdout or return value.
This is code-golf so lowest byte-count wins! In case of a tie, the earlier answer wins.

Test cases
Each point is represented by a list of length n.
[1], [3] -> 2
[1,1], [1,1] -> 0
[1,2], [3,4] -> 2.82842712475
[1,2,3,4], [5,6,7,8] -> 8
[1.5,2,-5], [-3.45,-13,145] -> 150.829382085
[13.37,2,6,-7], [1.2,3.4,-5.6,7.89] -> 22.5020221314

Happy Coding!

I'll give brainfuck a shot. Let's see what horrible monster comes out.

I assume you mean the Euclidean distance?

@flawr Yep, exactly. Just wanted to keep the title simple, since not everyone might know what that is at first glance. Could definetly write that in the challange tho :)

@DenkerAffe is it OK to return the distance squared if "your programming language does not support floating points"? This would make my brainfuck program a lot more accurate (Otherwise I'll have to implement some sort of estimation algorithm).

@YoYoYonnY Go for it then. Brainfuck won't win this one anyway, but I really wanna see your solution :) Just make it clear in your answer that you output the distance squared.

@DenkerAffe I think it's safe to say that brainfuck will never win a code golf. But it's just for fun anyways :)

I propose adding a non-floating point clause (See my edit)

Can we assume the input is all in floating-point (no ints) if our language supports it/is strongly-typed?

MATL, 2 bytes
ZP

Try it online!
The ZP function (corresponding to MATLAB's pdist2) computes all pairwise distances between two sets of points, using Euclidean distance by default. Each set of points is a matrix, and each point is a row. In this case it produces a single result, which is the distance between the two points.

No way this is real

I'm patiently waiting for the inevitable single-byte MATL answer;)

Ever heard those languages whereas the main point of the language is to solve obscure Code Golf problems? This sounds exactly like it. Makes me wonder if esoteric languages exist exactly for this.

This definitely puts the money where the mouth is. Nice job Luis!

The pdist2 function literally changed my life when I found it...

MATL, 4.0 3 bytes
Thanks for -1 by @AndrasDeak!
-Zn

Reads two vectors (via implicit input that is requested by -) then substracts those and calculates the norm of their difference with Zn.
Try it Online!

Please start upvoting tomorrow, I already motorboated today.

Too late...You gotta motorboat again :P

Save some upvotes for me :-P

@LuisMendo dat shameless advertising :O

@DenkerAffe never trust a bounty hunter.

Bounty hunters... we don't need that scum

@LuisMendo I'm not sure yet whether I should flag your self promotion as  rude or offensive, not constructive or too chatty :D

PS: You can start to upvote now!

@flawr way ahead of you;)

@flawr How could you forget about pdist2? :-P

@LuisMendo Because I only knew about pdist but not about pdist2. Only a noob would make a second function with the same name again with an appended 2... Staring at you MATLAB.

quietly leaves and posts a challenge that's solved with two-dimensional convolution

Where is that challenge?

Pyth, 2 bytes
.a

.a - L2 norm of vector difference of A[0] and A[1].

Literally a function that does this problem
Try it here.

Jelly, 4 bytes
_²S½

Try it online!
How it works
_²S½    Main link. Left input: A (list). Right input: B (list).

_       Subtract B from A, element by element.
 ²      Square all differences.
  S     Add all squares.
   ½    Take the square root of the sum.

Yikes. Just 4 bytes with Jelly. I cannot see how anyone can do better than that.

@CarpetPython Apparently MATL can...

@CarpetPython And Pyth

@CarpetPython and Vyxal too

Mathematica, 11 bytes
Norm[#-#2]&

Input as two lists, output as a number. If the input is exact (integers, rationals, etc.) the output will be exact as well. If the input contains a floating-point number, the output will be a float as well.

EuclideanDistance would work nicely too... if the name weren't so darn long!  If only there were "MATL for Mathematica" this would be a single byte =)

I'm working on a golfy Mathematica-based language >:)

CJam, 11 8 bytes
Thanks to Dennis for saving 3 bytes.
q~.-:mhz

Run all test cases.
Explanation
q~   e# Read and evaluate input.
.-   e# Vectorised difference.
:mh  e# Reduce √(x²+y²) over the list.
z    e# Take abs() to handle 1D input.

See this tip for why :mh works.

That trick with :mh is very nice indeed

Haskell, 46 bytes
d :: Floating c => [c] -> [c] -> c
d a=sqrt.sum.map((^2).uncurry(flip(-))).zip a

Haskell, 35 bytes (By @nimi)
d :: Float c => [c] -> [c] -> c
d a=sqrt.sum.zipWith(((^2).).(-))a

Haskell, 31 bytes

Like this Scala answer, takes input as a sequence of tuples

<hack>
d :: Float c => [(c,c)] -> c
d=sqrt.sum.map$(^2).uncurry(-)

</hack>
Examples:
Prelude> d [1] [3]
2.0
Prelude> d [1,1] [1,1]
0.0
Prelude> d [1,2,3,4] [5,6,7,8]
8.0
Prelude> d [1.5,2,-5] [-3.45,-13,145]
150.82938208452623
Prelude> d [13.37,2,6,-7] [1.2,3.4,-5.6,7.89]
22.50202213135522

uncurry ಠ_ಠ When cooking I sometimes wish to have an unsalt function.

@flawr https://en.wikipedia.org/wiki/Salt_(cryptography)?

map + uncurry + zip rarely pays off, use zipWith: d a=sqrt.sum.zipWith(((^2).).(-))a.

can't you save another couple of bytes by eta reduction?

@jk. Not sure... I don't think so, since (.) always returns a function that takes only one argument... I think you can do something like (.).(.), but that isn't really worth it.

Octave, 15 bytes
@(x,y)norm(x-y)

Example:
octave:1> d=@(x,y)norm(x-y);
octave:2> d([13.37,2,6,-7], [1.2,3.4,-5.6,7.89])
ans =  22.502

APL, 14 11 bytes
.5*⍨(+/-×-)

This is dyadic function train that takes the vectors on the left and right and returns the Euclidean norm of their difference.
Explanation:
       -×-)  ⍝ Squared differences
    (+/      ⍝ Sum them
.5*⍨         ⍝ Take the square root

Try it here
Saved 3 bytes thanks to Dennis!

.5*⍨(+/-×-) saves a few bytes.

Can this really be the first time I've seen commented APL code? That symbol! I've always found the APL character set weird, but I never realized a dismembered zombie finger was the comment marker. ;-)

@steveverrill I comment put zombie fingers in just about all of my APL submissions here. ¯\(ツ)/¯

@AlexA. The poor alignment (due to the non-monospaced APL characters) happened to give it a particularly hand-like appearance this time. You've golfed it down from 4 lines to 3, and ruined the effect :-S This answer of yours has 4 lines, but doesn't have the hand-like appearance  http://codegolf.stackexchange.com/a/70595/15599 Anyway, I like that you still have a single character smiley in your code.

Julia, 16 bytes
N(x,y)=norm(x-y)

This is a function that accepts two arrays and returns the Euclidean norm of their difference as a float.
You can verify all test cases at once online here.

You can save 3 bytes by using an operator as the function name : Try it online!

Java, 130 117 114 107 105 bytes
This is the obvious solution. I don't usually golf in Java, but I was curious to see if Java could beat the Brainfuck version. Doesn't seem like I did a good job then.. Maybe one could use the new Map/Reduce from Java 8 to save some bytes.
Thanks to @flawr (13 bytes), @KevinCruijssen (9 bytes) and @DarrelHoffman (3 bytes)!
Golfed:
double d(float[]a,float[]b){float x=0,s;for(int i=0;i<a.length;x+=s*s)s=a[i]-b[i++];return Math.sqrt(x);}

Ungolfed:
double d(float[] a, float[] b) {
  float x=0,s;

  for(int i=0; i<a.length; x+=s*s)
    s = a[i] - b[i++];

  return Math.sqrt(x);
}

You can certainly shorten the function name to one character. The for loop be compressed to double x=0,s;for(int i=0;++i<a.length;s=a[i]-b[i],x+=s*s);

You can use int instead of double to save characters too, and declare i next to x.

This is way oversized. See flawr's suggestion for the loop. Using Java 8 lambda, this can be reduced to: double[]a,b->{double x=0,s;for(int i=0;++i<a.length;s=a[i]-b[i],x+=s*s);return Math.sqrt(x);} for a total of 93 bytes.

I totally forgot to shorten the function name.. @flawr thanks a lot for those tips, I didn't know you could do that.

If you don't care too much about precision, you can replace three of the doubles with floats and save 3 bytes.  (You can't change the return type, because Math.sqrt() returns a double, and you'd have to add a cast.)  It's not much of a savings, but 3 bytes is enough to beat the BF solution right now...  Also, it's not necessary to initialize x to 0, Java variables start at 0 automatically, so -2 more bytes there.

@DarrelHoffman thanks for saving me 3 bytes! I don't get it to work when I don't initialize x to zero. This might be relevant, I'm using javac version 1.8.0_66.

@Bruce_Forte: Ah, my bad.  I forgot that Java class member variables are initialized to 0, but local variables are not.  Oh well.  (My last few jobs have all been C++ or C#, been a while since I put on the Java-hat.)

However, if this were a full program, complete with class declaration and main function et al, you could use that trick.  Of course then it wouldn't be close to competing with even BF, but that's Java for you...

You can remove the public  in front of the method to save 7 bytes, and you can also place the x+=s*s outside the for-loop so you don't need the comma (i.e. for(int i=-1;++i<a.length;s=a[i]-b[i])x+=s*s;) for -1 byte.

@KevinCruijssen: Cheers for the 7 bytes! But about the s, I can't get this to work. This is the same as with Darrel's suggestion, the variable s wouldn't get initialized that way.

@Bruce_Forte Ah, I see.. In that case you could use this: for(int i=0;i<a.length;x+=s*s)s=a[i]-b[i++]; (and I also changed the -1 to 0 for an additional byte)

@KevinCruijssen True. I like the change to 0 by using the operator precedence rules! Thanks for saving me a whole lot of bytes.

J, 9 bytes
+&.*:/-/>

This is a function that takes one set of coordinates from the other (-/>), and then performs a sum + under &. square *:.
The input should be in the format x y z;a b c where x y z is your first set of co-ordinates and a b c is the other.

Since the inputs are always the same length, you can drop the > and specify that input should be given as x y z,:a b c.

Python 2, 47 bytes
A straight forward solution. The function expects 2 points as sequences of numbers, and returns the distance between them.
lambda a,b:sum((d-e)**2for d,e in zip(a,b))**.5

Example:
>>> f([13.37, 2, 6, -7], [1.2, 3.4, -5.6, 7.89])
22.50202213135522

Works in Python3.6, but might not be optimal.

golflua, 43 chars
\d(x,y)s=0~@i,v i(x)s=s+(v-y[i])^2$~M.q(s)$

Works by calling it as
> w(d({1,1},{1,1}))
0
> w(d({1,2},{3,4}))
2.82842712475
> w (d({1,2,3,4},{5,6,7,8}))
8

A Lua equivalent would be
function dist(x, y)
    s = 0
    for index,value in ipairs(x)
       s = s + (value - y[index])^2
    end
    return math.sqrt(s)
end

Seriously, 12 bytes
,iZ`i-ª`MΣ√A

Try it online!
Explanation:
,iZ`i-ª`MΣ√A
,iZ           get input, flatten, zip
   `   `M     map:
    i-ª         flatten, subtract, square
         Σ√A  sum, sqrt, abs

Perl 6, 30 29 26 24 bytes
{sqrt [+] ([Z-] $_)»²}

(Thanks @b2gills for 2 more bytes lost)
usage
my &f = {sqrt [+] (@^a Z-@^b)»²};

say f([1], [3]); # 2
say f([1,1], [1,1]); # 0
say f([1,2], [3,4]); # 2.82842712474619
say f([1,2,3,4], [5,6,7,8]); # 8
say f([1.5,2,-5], [-3.45,-13,145]); # 150.829382084526
say f([13.37,2,6,-7], [1.2,3.4,-5.6,7.89]); # 22.5020221313552

{sqrt [+] ([Z-] $_)»²}

JavaScript ES7, 45 ES6, 37 bytes
a=>Math.hypot(...a.map(([b,c])=>b-c))

Expects an array of pairs of coordinates, one from each vector, e.g. [[1, 5], [2, 6], [3, 7], [4, 8]]. If that is unacceptable, then for 42 bytes:
(a,b)=>Math.hypot(...a.map((e,i)=>e-b[i]))

Expects two arrays of equal length corresponding to the two N-dimensional vectors, e.g. [1, 2, 3, 4], [5, 6, 7, 8]. Edit: Saved 3 bytes thanks to @l4m2. (Also, did nobody notice my typo?)

Please add an example on how to invoke this function including a specification of the input format, since this is not obvious on the first glance.

@DenkerAffe Sorry, having overlooked that clause, I had just used the same format as the examples and indeed everyone previous to me at the time.

a=>b=>Math.hypot(...a.map((t,i)=>t-b[i]))

Ruby, 52
->p,q{t=0;p.size.times{|i|t+=(p[i]-q[i])**2}
t**0.5}

In test program
f=->p,q{t=0;p.size.times{|i|t+=(p[i]-q[i])**2}
t**0.5}

p f[[1], [3]] # 2
p f[[1,1], [1,1]] # 0
p f[[1,2], [3,4]] # 2.82842712475
p f[[1,2,3,4], [5,6,7,8]] # 8
p f[[1.5,2,-5], [-3.45,-13,145]] # 150.829382085
p f[[13.37,2,6,-7], [1.2,3.4,-5.6,7.89]] # 22.5020221314

AppleScript, 241 239 bytes
This is golfed code, but I've put comments in in the form --.
on a()    -- Calling for getting input
set v to{1}          -- Arbitrary placeholder
repeat until v's item-1=""       -- Repeat until no input is gathered
set v to v&(display dialog""default answer"")'s text returned   -- Add input to list
end      -- End the repeat
end      -- End the method
set x to a()   -- Set the array inputs
set y to a()
set z to 0     -- Sum placeholder
set r to 2     -- 2 is the first significant array index
repeat(count of items in x)-2     -- Loop through all but first and last of the array
set z to z+(x's item r-y's item r)^2    -- Add the square of the difference
end   -- End the repeat
z^.5  -- Return the square root of the sum
This uses the same algorithm as most of the other programs here.

Haskell, 32 bytes
((sqrt.sum.map(^2)).).zipWith(-)

λ> let d = ((sqrt.sum.map(^2)).).zipWith(-)
λ> d [1] [3]
2.0
λ> d [1,1] [1,1]
0.0
λ> d [1,2] [3,4]
2.8284271247461903
λ> d [1..4] [5..8]
8.0
λ> d [1.5,2,-5] [-3.45,-13,145]
150.82938208452623
λ> d [13.37,2,6,-7] [1.2,3.4,-5.6,7.89]
22.50202213135522

32 bytes

@Angs Thanks for the improvement. After some tinkering, I found a way to remove 6 more bytes (by removing map and parentheses).

I'm sorry to intervene again, but sqrt$sum$(^2)<$>zipWith(-) is not a valid anonymous function. The underlying rule is actually quite simple: If you can write f = <mycode> and f afterwards performs the required task, then <mycode> is a valid anonymous function. In your case you need to add f p q = <mycode> p q, so <mycode> on it's own is not valid.

@Laikoni You're right. I edited my answer and used Angs's suggestion. If you find a way to shorten it, please let me know.

C (gcc), 79 77 bytes
-2 bytes thanks to ceilingcat.
TIO requires compiler flag -lm. GCC of MinGW (that I use) does not.
f(p,q,d,s)float*p,*q,s;{for(s=0;d--;)s+=*p++*=*p-=*q++;printf("%f",sqrt(s));}

Try it online!

@ceilingcat Cheers!

Vyxal, 2 bytes
∆d

Try it Online!
Laughs in built-in. Generalised euclidian distance do be like that sometimes.

R, 38 bytes and 25 bytes
Sure, it is impossible to compete with the shortest 4 bytes answer, but I wanted to share anyway a hopefully interesting solution (38 bytes):
f=\(x,y)sd(c(x-y,y-x))*(nrow(x)-.5)^.5

How does it work? Standard deviation of a sample is calculated as a square root of the sum of squares of deviation scores divided by sample size minus one.

The trick is to add to the sample a second set of the same numbers with the opposite sign (like c(1,2,-1,-2)). This way we get rid of mean (=0) out of the formula, but also we are getting each number twice. To obtain the sum of squares we only need to "neutralize" the term sqrt(2/(N-1)), whereby the sample size N is 2*N_dimensions.
...but unfortunately this bright =) solution sucks to the old good straightforward formula (25 bytes):
g=\(x,y)(sum((x-y)^2))^.5

Here is the result:
> list.x <- list(matrix(1),
+                matrix(c(1,1),2),
+                matrix(c(1,2),2),
+                matrix(c(1,2,3,4), 4),
+                matrix(c(1.5,2,-5), 3),
+                matrix(c(13.37,2,6,-7),4))
>
> list.y <- list(matrix(3),
+                matrix(c(1,1), 2),
+                matrix(c(3,4),2),
+                matrix(c(5,6,7,8),4),
+                matrix(c(-3.45,-13,145),3),
+                matrix(c(1.2,3.4,-5.6,7.89),4))
>
> correct = list(2,0,2.82842712475,8,150.829382085,22.5020221314)
>
> do.call(rbind, Map(\(x,y,z)c(f(x,y),g(x,y),z),list.x,list.y,correct))
           [,1]       [,2]       [,3]
[1,]   2.000000   2.000000   2.000000
[2,]   0.000000   0.000000   0.000000
[3,]   2.828427   2.828427   2.828427
[4,]   8.000000   8.000000   8.000000
[5,] 150.829382 150.829382 150.829382
[6,]  22.502022  22.502022  22.502022

Scala, 67 62 bytes
def e(a:(Int,Int)*)=math.sqrt(a map(x=>x._2-x._1)map(x=>x*x)sum)

Requires input as a sequence/vector of var-arg tuples
Example:
scala> e((1, 5), (2, 6), (3, 7), (4, 8))
res1: Double = 8.0

, 6 chars / 13 bytes
МŰМŷ…ï

Try it here (Firefox only).
Calculates norm of difference of input arrays.

C#, 72 bytes
(float[]i,float[]n)=>System.Math.Sqrt(i.Zip(n,(x,y)=>(x-y)*(x-y)).Sum())

A simple solution using Linq.

Sage, 35 bytes
lambda a,b,v=vector:norm(v(a)-v(b))

This function takes 2 lists as input and returns a symbolic expression. The distance is calculated by performing vector subtraction on the lists and computing the Euclidean norm of the resultant vector.
Try it online

Clojure, 48 bytes
#(Math/sqrt(apply +(for[d(map - % %2)](* d d))))

05AB1E, 4 bytes
-nOt

Try it online!
Negative not y'all!
-    # a-b
 n   # (a-b)**2
  O  # sum((a-b)**2) for all a,b
   t # sqrt(sum((a-b)**2) for all a,b)

R, 4 bytes
dist

This is a built-in function to calculate the distance matrix of any input matrix. Defaults to euclidean distance.
Example usage:
> x=matrix(c(1.5,-3.45,2,-13,-5,145),2)
> x
      [,1] [,2] [,3]
[1,]  1.50    2   -5
[2,] -3.45  -13  145
> dist(x)
         1
2 150.8294

If you're feeling disappointed because it's a built-in, then here's a non-built-in (or at least, it's less built-in...) version for 22 bytes (with thanks to Giuseppe):
pryr::f(norm(x-y,"F"))

This is an anonymous function that takes two vectors as input.

function(x,y)norm(x-y,"F") is shorter than your second version.

Elixir, 74 bytes
:math.sqrt Enum.reduce Enum.zip(p,q),0,fn({a,b},c)->:math.pow(a-b,2)+c end

You can try it online

Welcome to PPCG! Nice first post!

TI-Basic (TI-84 Plus CE), 15 bytes
Prompt A,B
√(sum((LA-LB)2
TI-Basic is a tokenized language.
Prompts for input as two lists, and returns the Euclidian distance betwrrn them in Ans
Explanation:
Prompt A,B    # 5 bytes, Prompts for two inputs; if the user inputs lists:
           # they are stored in LA and LB
√(sum((LA-LB)2 # 10 bytes, Euclidian distance between points
           #(square root of (sum of (squares of (differences of coordinates))))

Python 3, 44 bytes
lambda*a:sum((x-y)**2for x,y in zip(*a))**.5

Try it online!
Ungolfed version:
      ₙ
sqrt( ∑(xᵢ - yᵢ)² )
     ⁱ⁼¹

def d(a, b):                    # two points (lists or tuples)
    return sum(                 # sum of...
        (x - y) ** 2            # (xᵢ - yᵢ)²
        for x,y in zip(a, b)    #
    ) ** 0.5                    # square root of sum

Stax, 8 bytes
äÖ╙í▼=╬b

Run and debug it
Unpacked, ungolfed, and commented, it looks like this.
\       zip the coordinates into pairs
{       for each pair,
  :s    compute the absolute span
  J+    square and add to total
F
|Q      square root result

Run this one

Desmos, 26 bytes
f(a,b)=total((a-b)^2)^{.5}

The function \$f(a,b)\$ takes in two lists, \$a\$ and \$b\$, representing the two points, and returns the distance between them.
I think the code is pretty self explanatory, even for someone unfamiliar with Desmos.
Try It On Desmos!
Try It On Desmos! - Prettified

Husk, 6 bytes
√Σzo□-

Try it online!
Explanation
√Σzo□-
  z     zip input arguments
   o    with composed function
     -  difference
    □   squared
 Σ      sum
√       sqrt

Python 3, 70 Chars
Loops through, finding the square of the difference and then the root of the sum:
a=input()
b=input()
x=sum([(a[i]-b[i])**2 for i in range(len(a))])**.5

Drop a few more: sum([(x-y)**2 for x,y in zip(a,b)])**.5

Mathcad,  bytes

Uses the built-in vector magnitude (absolute value) operator to calculate the size of the difference between the two points (expressed as vectors).

Mathcad golf size on hold until I get (or somebody else gets) round to opening up the discussion on meta.  However, the shortest way (assuming that input of the point vectors doesn't contribute to the score) is 3 "bytes" , with 14 bytes for the functional version.

Pyke, 7 bytes
,A-MXs,

Try it here!
Transpose, apply subtract, map square, sum, sqrt.

Ruby, 50 bytes
Zip, then map/reduce. Barely edges out the other Ruby answer from @LevelRiverSt by 2 bytes...
->p,q{p.zip(q).map{|a,b|(a-b)**2}.reduce(:+)**0.5}

Try it online

C 276 bytes
f(){*a,*b,d=0;l=1;a=malloc(sizeof(float)*50);b=malloc(sizeof(float)*50);scanf("%f",&a[0]);while(getchar()!='\n'){scanf("%f",&a[l]);l++;}l=1;scanf("%f",&b[0]);while(getchar()!='\n'){scanf("%f",&b[l]);l++;}for(int i=0;i<l;i++){d+=pow((a[i]-b[i]),2);}printf("%.5f",pow(d,0.5));}

Ungolfed version:
void f()
{

  float *a,*b,d=0;
  int l=1;

   a=malloc(sizeof(float)*50);
   b=malloc(sizeof(float)*50);

   //Accept p1,p2,p3.....pn
   scanf("%f",&a[0]);

   while(getchar()!='\n')
   {
     scanf("%f",&a[l]);
     l++;
   }
   l=1;

   //Accept q1,q2,q3.....qn
   scanf("%f",&b[0]);
   while(getchar()!='\n')
  {
    scanf("%f",&b[l]);
    l++;
  }

  for(int i=0;i<l;i++)
  {
    d+=pow((a[i]-b[i]),2);
  }

  printf("\n%.5f",pow(d,0.5));
}

Pretty straightforward. This solution lets you measure distance between 2 points in upto 50 dimensions (can be increased).
In Cartesian coordinates, input the position of first point of n dimensions. (p1 p2 p3 ...pn) and press Enter.
Next, input the position of second point of n dimensions. (q1 q2 q3 ...qn) and press Enter to get the Euclidean Distance.

Excel VBA, 36 Bytes
Anonymous VBE immediate window function that takes input as two vectors, which are projected unto the range 1:2, and outputs to the VBE immediate window
[3:3]="=(A1-A2)^2":?[Sqrt(Sum(3:3))]

Factor + math.distances, 18 bytes
euclidian-distance

Try it online!
Built-in.

J-uby, 35 bytes
+:zip|:*&(+:-|~:**&2)|:sum|~:**&0.5

Attempt This Online!
+:zip | :* & (+:- | ~:** & 2) | :sum | ~:** & 0.5

+:zip |                                            # Zip input arrays, then
        :* & (              )                      # map with
              +:- | ~:** & 2                       #   Difference, then square
                              | :sum |             # then sum, then
                                       ~:** & 0.5  # square root

Fortran (GFortran), 85 80 bytes
function d(A,n);real A(n,2);s=0;do5 i=1,n;s=s+(A(i,1)-A(i,2))**2
5 d=sqrt(s);end

Try it online!
  85 bytes
Instead of two vectors, I read all the data into two rows of array A. But Fortran 'helpfully' stores matrices by column so when I call the procedure A is transposed.
Using line number 5 instead of enddo saves 2 bytes :)
Saved 5 bytes using function instead of subroutine

If only the IMSL library was installed on TIO. I could have used the DISL2 function.

Thunno 2, 4 bytes
-²Sƭ

Try it online!
Explanation
-²Sƭ  # Implicit input
-     # Subtract
 ²    # Square
  S   # Sum
   ƭ  # Square root
      # Implicit output

Swift 5.9, 86 bytes
import Foundation
let f={(p:[(Double,_)])in
sqrt(p.map{pow($0.1-$0.0,2)}.reduce(0,+))}

Don't Try It Online, because TIO is too old. Here's a JDoodle link instead.
f is of type ([(Double, Double)]) -> Double -- it takes an array of pairs of coordinates, one per vector.
I just used the subtract-square-sum-squareRoot trick borrowed from other answers.

source: Stack Exchange

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

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

sort: votes


text:
Golf a string twister
How strings are twisted
The twisting algorithm is very simple. Each column is shifted down by its index (col 0 moves down 0, col 1 moves 1, ...). The column shift wraps to the top. It works like this:
aaaa
bbbb
cccc

Becomes:
a
ba
cba
----
 cba
  cb
   c

With everything under the line wrapping to the top. Real example:
Original:
\\\\\\\\\\\\
............
............
............

Twisted:
\...\...\...
.\...\...\..
..\...\...\.
...\...\...\

Input
Input is either an array of strings, or a multi-line string. All lines have the same length.
Output
The twisted string, multi-line output to std-out (or closest alternative).
Examples:
(> denotes input, trailing space is important)
>Hello, world!
>I am another
>string to be
>twisted!

Hwrmoe oo br!
Ieii ,dttr e
s lsna !ohl
ttaltgnw  ed

>\\\\\\\\\\\\
>............
>............
>............

\...\...\...
.\...\...\..
..\...\...\.
...\...\...\

>abcdefg
>.......

a.c.e.g
.b.d.f.

>abcdefghij
>..........
>..........

a..d..g..j
.b..e..h..
..c..f..i.

>\\\\.....././
>...../.......
>........././.
>..../.^\\....

\.........../
.\....^..../.
..\../.\../..
...\/...\/...

>cdeab
>deabc
>eabcd
>abcde

cbbbb
ddccc
eeedd
aaaae

>aeimquy37
>bfjnrvz48
>cgkosw159
>dhlptx260

ahknqx147
beloru258
cfipsvy69
dgjmtwz30

>abcdefghi
>jklmnopqr
>stuvwxyz1
>234567890

a3ume7yqi
jb4vnf8zr
skc5wog91
2tld6xph0

There better not be a Mathematica builtin for this.

Can we assume that the input will only contain ASCII? Or only printable ASCII + linefeeds or something?

Yes, just ASCII and newline (unless you take input as an array).

Japt, 4 bytes
yÈéY

Try it here

Pyth, 11
jC.>R~hZC.z

Try it here
jC.>R~hZC.z    ##  implicit: .z = list of input split by lines
        C.z    ##  transpose .z to get columns
  .>R~hZ       ##  shift each column by it's index
               ##  equivalent to .e.>bk
jC             ##  transpose back and join by newlines

APL (Dyalog), 7 bytes
⊖⊖⊖⍨⍬⍋⍉

Requires ⎕io←0
Try it online!
⍬⍋⍉ gets the range from 0 to the number of columns
⊖ reverses vertically
⊖⊖⍨⍬⍋⍉ rotate (vertically) the (vertically) reversed input by 0,1..
⊖ reverse that, and return it.

Retina, 111 101 92 87 bytes
Byte count assumes ISO 8859-1 encoding.
(?<=((.))*)(?=(?<1>.*¶)*.*(?<=(?=(?<-2>.)*(.))(?<-1>.+¶)*.*(.(?<=^(?<-1>¶?.+)*))*)).
$3

Woo, solved it in a single regex substitution. :) (Chances are, there's a shorter solution by using several, but where's the fun in that...)
Try it online!
Explanation
This requires some basic knowledge of balancing groups. In short, .NET's regex flavour allows you to capture multiple times with a single group, pushing all captures onto a stack. That stack can also be popped from, which allows us to use it for counting things inside the regex.
(?<=((.))*)

This pushes one capture onto both groups 1 and 2 for each character in front of the match (in the current line). That is, it counts the horizontal position of the match.
The rest is in a lookahead:
(?=(?<1>.*¶)*.* [...] )

We match each line and also push it onto group 1, such that group 1 is now the sum of the horizontal and vertical position (where the latter is counted from the bottom). This essentially labels the diagonals of the grid with increasing values starting from the bottom left corner. That .* then just moves the engine's cursor to the end of the string.
We now switch into a lookbehind, which is matched from right to left in .NET:
(?<= [...] (.(?<=^(?<-1>¶?.+)*))*)

This will repeatedly pop exactly H captures from group 1 (where H is the height of the input). The purpose of that is to take the group modulo H. Afterwards, group 1 contains the row (counted from the bottom) from which to pick the new character in the current column.
(?=(?<-2>.)*(.))(?<-1>.+¶)*.*

Another lookbehind, again starting from the right. (?<-1>.+¶)*.+ now uses group 1 to find the row from which to pick the new character and then the lookahead finds the correct column using group 2.
The desired character is captured into group 3 and written back by the substitution.

Ah, reading Retina's source was nice and clear :) $+ looks useful... especially if you only want to do one substitution :^)

@FryAmTheEggman $+ is actually pretty useless... it's description on MSDN sounds a lot more useful than it is because it implies that (a)|(b) --> $+$+ would double all as and bs but instead it removes all as, because it just refers to the syntactically last group. That means it's just a way to avoid counting all groups if you're too lazy (like I was). For golfing it only saves bytes when you have more than 9 groups, which is probably quite rare to begin with.

That is unfortunate... Perhaps retina could have a new replacement group type that would return the last non-empty match group? Anyway, thanks for the explanation! :)

@FryAmTheEggman It will (it's one of the things I had in mind when rewriting Regex.Replace for Retina, but I didn't get around to implementing it yet).

CJam, 13 bytes
qN/zee::m>zN*

Test it here.
Explanation
q    e# Read all input.
N/   e# Split into lines.
z    e# Transpose to get an array of columns.
ee   e# Enumerate, pairing each column with its index.
::m> e# Map: fold: rotate (cyclically shifting each column by its index).
z    e# Transpose again.
N*   e# Join with linefeeds.

You can almost pronounce that source code.

TeaScript, 10 bytes
xHl@C(r╢tD

Thanks to TeaScript 3's extremely concise syntax, this is really short :D
Would be 1-byte shorter if Sigma loop weren't buggy
Try it online
Explanation
      // Implicit, x = input
xH    // Transpose input
l@    // Loop
 C(r╢   // Cycle column by index
        // `╢` exits loop
t    // Transpose
D    // Join on \n

Python 3, 164 bytes
Not the best answer by a long shot, but the first in Python...
s=list(zip(*open(0).readlines()))[:-1]
r=[[s[i][(j-i)%len(s[i])] for j in range(len(s[i]))] for i in range(len(s))]
print('\n'.join([''.join(l) for l in zip(*r)]))

You can save a handful of bytes by taking out the space which follows a ) or ] in most cases, for example ''.join(l)for l in.... is perfectly valid

MATLAB, 92 36 bytes
s=bsxfun(@circshift,s,0:size(s,2)-1)

Assuming that the input string s is already in the form of a 2D char array/ matrix, e.g.
s = ['abcdefg';'.......'];
s = ['\\\\.....././';'...../.......';'........././.';'..../.^\\....'];

Explanation: iterate through the columns of the matrix. For each column perform a circular shift of its elements by the number of characters that equals the column index (-1 because of MATLAB indexing).

Brachylog, 5 bytes
iᵇ↻₎ᵐ

Try it online!
Gets input as an array of columns (which seems to be within the question's specifications).
iᵇ - For each element in the array, pair it with its (0-based) index
ᵐ  - map this predicate to each element of the result:
↻₎ - permute (the column) circularly by the amount specified as the last element (the index)
Easily extended to a version that accepts a single multiline string:
13 bytes
ṇẹ\iᵇ↻₎ᵐ\cᵐ~ṇ

Try it online!

This is amazing information compression.

Brachylog, 96 bytes
$\:0{h_.|[M:I]hh:I{bh0,?h.|[C:I]h$)D,I-1=:Dr:2&.}C,I+1=J,Mb:J:1&:[C]rc.}$\{hA,[A]:"~s
"w,?b:3&;}

This expects a list of character codes strings as input and no output, e.g. brachylog_main([`aaaa`,`bbbb`,`cccc`],_).
That's one ridiculously long answer, and there's probably a much shorter way to do it.
Explanation
§ Main Predicate

$\:0{}$\{}                            § Create a list containing the transposed input and 0
                                      § Call sub-predicate 1 with this list as input
                                      § Transpose its output and pass it as input to
                                      § sub-predicate 3

§ Sub-predicate 1

h_.                                   § If the matrix is empty, output is empty list
   |                                  § Else
    [M:I]hh:I{}C,                     § Input is [M,I], call sub-predicate 2 with the first
                                      § line of M and I as input. Its output is C.
                 I+1=J,Mb:J:1&        § Call sub-predicate 1 with M minus the first line
                                      § and I+1 as input
                              :[C]rc. § Its output is appended after C, which is then
                                      § unified with the output of sub-predicate 1.

§ Sub-predicate 2

bh0,?h.                               § If the second element of the input list is 0,
                                      § output is the first element of the input
       |                              § Else
        [C:I]                         § Input is [C,I]
             h$)D,                    § Perform a circular permutation of C from left to
                                      § right (e.g. [a,b,c] => [c,a,b]) and unify it with D
                  I-1=:Dr:2&.         § Call sub-predicate 2 with D and I-1 as input, unify
                                      § its output with sub-predicate 2's output

§ Sub-predicate 3

hA,[A]:"~s\n"w,                       § Write the first line of the input as a char codes
                                      § string followed by a new line

               ?b:3&;                 § Call sub-predicate 3 with input minus the first
                                      § line. If it fails (empty input), terminate

MATL, 18 21 bytes
Zy2):"G@Z)@qYS]N$h

Input is of the form
['Hello, world!'; 'I am another '; 'string to be '; 'twisted!']

Try it online!
How it works:
Zy       % implicitly take input: 2D char array. Get its size
2)       % second element from size vector: number of columns, say n
:        % create vector [1,2,...,n]
"        % for each element k in that vector
  G      %   push input
  @      %   push k
  Z)     %   k-th column from input
  @qYS   %   circularly shift k-1 positions
]        % end for loop
N$h      % concatenate all stack contents horizontally
         % implicitly display

JavaScript, 92 89 bytes
3 bytes off thanks @Neil.
s=>(z=s.split`
`).map((m,i)=>m.replace(/./g,(n,j)=>z[((l=z.length)*j+i-j)%l][j])).join`
`

f=s=>
    (z=s.split`\n`).map((m,i)=>
        m.replace(/./g,(n,j)=>
            z[((l=z.length)*j+i-j)%l][j]
        )
    ).join`\n`

Input.value = `abcdefghij
..........
..........`
textarea{display:block;width:250px;height:75px;}
<textarea id='Input'></textarea>
<button id='Run' onClick='Output.value=f(Input.value);'>Run</button>
<textarea id='Output'></textarea>

You can save 3 bytes using replace: m.replace(/./g,(n,j)=>z[((l=z.length)*j+i-j)%l][j]).

Indeed, the [...m].map( all the way to and including the first .join.

Python 2, 115 bytes
lambda s:'\n'.join("".join(s)for s in zip(*[k[-i%len(k):]+k[:-i%len(k)]for i,k in enumerate(zip(*s.split('\n')))]))

Thanks to the wonder of zip managed to get this down to one line.  See it in action here.

Japt, 29 bytes
Uy £XsV=(Y*Xl -Y %Xl)+X¯V}R y

Test it online!
How it works
Uy        // Transpose rows and columns in the input string.
£     }R  // Map each item X and index Y in the result, split at newlines, to:
Y*Xl -Y   //  Take Y times X.length and subtract Y.
%Xl)      //  Modulate the result by X.length.
XsV=      //  Set V to the result of this, and slice off the first V chars of X.
+X¯V      //  Concatenate this with the first V chars of X.
y         // Transpose the result again.
          // Implicit: output last expression

F#, 105 bytes
My first stab at it (only a \n character is required):
let m x y=(x%y+y)%y
let f(a:string[])=Array.mapi(fun i x->String.mapi(fun j _->a.[m(i-j)a.Length].[j])x)a

Usage:
f [| @"\\\\\\\\\\\\"
     "............"
     "............"
     "............" |]

I don't think I have seen F# before on PPCG.

JavaScript (ES6), 73 bytes
t=>t.replace(/./g,(_,i)=>t[(i+s*l-i%l*l)%s],l=t.search`
`+1,s=t.length+1)

Explanation
t=>
  t.replace(/./g,(_,i)=> // replace each character at index i
    t[                   // get the character at index:
      (i                 // start at i
        +s*l             // add s*l to ensure the result is always positive for %s
        -i%l*l           // move the index upwards the num of chars from start of the line
      )%s                // shift the index into the the range of s
    ],
    l=t.search`
`+1,                     // l = line length
    s=t.length+1         // s = input grid length (+1 for the missing newline at the end)
  )

Test

var solution = t=>t.replace(/./g,(_,i)=>t[(i+s*l-i%l*l)%s],l=t.search`
`+1,s=t.length+1)
<textarea id="input" rows="5" cols="40">\\\\.....././
...../.......
........././.
..../.^\\....</textarea>

<button onclick="result.textContent=solution(input.value)">Go</button>

Haskell, 81 bytes
let t=transpose in t.snd.mapAccumR(\c l -> 1+c,take(length l)(drop c$cycle l))0.t

reimplementation of the CJam example, though the reverse, map and enumerate is part of the mapAccumR, the snd removes the accumulator since we don't need it anymore, the reversal is just a side effect of the right fold.

Haskell, 65 bytes
g l@("":_)=l;g l|t<-tail<$>l=zipWith(:)(head<$>l)$g$last t:init t

Usage example: g ["1111","2222","3333"] -> ["1321","2132","3213"].

MATL, 9 bytes
"@X@qYS&h

Try it online!
Pretty similar in core to Luis Mendo's existing MATL answer, but shorter by using features that were probably not in the language at that point: 1. " iterates through a matrix's columns automatically now, so no costly business of constructing column indices and indexing into them (this is the biggie), 2. &h as a shorthand way of saying N$h, and 3. implicit loop end if ] is not specified.
Alternately, for the same bytecount:
tsn:ql&YS

Try it on MATL Online
      &YS   % circularly shift the matrix
     l      % across rows (i.e. shift each column) by the amounts
            %  given by this array:
tsn         % duplicate input, get the sum of each column, get the
            %  number of elements in that (which is the number of columns)
   :q       % construct range 1 to ncols, then decrement to start at 0
            % (implicit output)

Husk, 10 bytes
Tzṙm→İ-T'

Try it online!
(there's a space at the end.)
Explanation
Tzṙm→İ-T'
       T'  transpose, padding with spaces
 zṙ        zip and rotate each column by
     İ-    negative integers
   m→      each incremented
T          transposed back

C (clang), 114 bytes
Works in GCC under MinGW. TIO's GCC gets confused by using strlen in the init expression of the first for loop.
f(L,n)char**L;{for(int l=strlen(*L),i=0,j,c;i<n;i++)for(j=c=0;j<=l;j++,c=c?c-1:n-1)putchar(l^j?L[(c+i)%n][j]:10);}

Try it online!

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


text:
Indexable quine
The goal of this challenge is to make a program that outputs the nth letter of its source code where n is given as input to the program. Like most quine challenges, you are not allowed to read your source code as a file or use any builtin quine functions.
Input
An integer 0 <= n < len(program).
Output
The nth character (not byte) of your program.
Winning
Like most codegolf questions, you win the challenge by using the lowest number of bytes to solve the challenge.
Bonuses
-5% If your program supports negative indices python style (e.g. -1 would be the last character of your program). If used with the below bonus, your ranges must support negative indices.
-20% If your program supports ranges as input (any format) in addition to the above requirements.
-25% If your program complete both bonuses.
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=70727,OVERRIDE_USER=32700;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?([\d\.]+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

Are quine builtins forbidden?

@Mego yes, they are.

Do bonuses stack (100% - 20% - 5% = 75%) or multiply (100% * 80% * 95% = 76%)?

Do programs that don't actually read their input count?

@ETHproductions Stack.

@Neil Yes, it is already too late in my opinion to change that.

Is Piet throwing an error applicable?

Do you have to support mixed positive and negative ranges, e.g. 0..-1 (entire program), -1..0 (last character followed by first character)?

@ThisSuitIsBlackNot If you want to go for both bonuses, you do have to support mixed positive and negative ranges. How you interpret that is up to you.

For the 20% bonus, must we be able to accept both integers and arrays as input, or only arrays?

@Shaggy both integers and ranges.

Pyth, 0.75 bytes
(Also happens to be a CJam polyglot, and probably many other languages.)
0

Expects input on STDIN:
llama@llama:~$ echo 0..0 | pyth -c '0'
0

Any single digit works, of course. Not exactly the most interesting challenge in Pyth.

It happens to be a polyglot in many other languages, too.

works in PlatyPar too

and Japt, and Jolf, and almost every language with implicit output

And PHP, which is clearly the best language for golfing.

Javascript ES6, 31 bytes
$=_=>`$=${$};$()`[prompt()];$()

Explanation
The standard quine framework:
$=_=>`$=${$};$()`;$()

[prompt()], which is the addon, gets the value at the input index of the resulting quine string.

, 9 chars / 19 bytes
⟮ɕṡ+ᶈ0)⎖ï

Try it here (Firefox only).
Ay, 19th byte!
0 works too (and is much better), but it's way too trivial for my liking.
In addition, ℹ ï,⧺ï would also work, but quine functions aren't allowed.
Explanation
The standard quine framework is ⟮ɕṡ+ᶈ0.
)⎖ï takes the resulting quine string and gets the character at the input index.

Bonus solution, 11.4 chars / 25.65 bytes
⟮ᵖ…ɕṡ+ᶈ0;ôᵍï

Try it here (Firefox only).
This one qualifies for the 5% bonus, but still does not beat my original submission.
Explanation
This one uses the stack. ᵖ…ɕṡ+ᶈ0; just pushes the quine string's individual characters to the stack, and ôᵍï directly outputs the character at the input index (positive or negative) in the stack.

Why haven't you made an encoding for this yet?

Updates are coming too fast! Can't keep up!

CJam, 12.35 bytes
{s"_~"+ri=}_~

The program is 13 bytes long and qualifies for the × 0.95 bonus. Try it online!
How it works
{         }      Define a code block.
           _~    Push a copy and execute the copy.
 s               Cast the original code block to string.
  "_~"+          Append "_~".
       ri        Read an integer from STDIN.
         =       Retrieve the character at that index.

Of course, 0 would have been slightly shorter...

Polyglot, 0 bytes

Try It Online! (you'll have to select a language yourself)
The challenge specifies taking an integer \$ 0 \le n \lt \text{len}(\text{program}) \$, but with a 0-byte program there is no integer that is both ≥ 0 and < 0. This means the program can do whatever it wants.
When I say polyglot, I mean that it works in any language whatsoever.

This feels like abuse of a loophole to me.

Empty quine is improper

It isn't a program that outputs itself by virtue of being empty and doing nothing, it's a program that never has to output anything :P

When I say polyglot, I mean that it works in any language whatsoever. There are in fact many programming languages that consider an empty source code file as a syntax error.

@KaiBurghardt It doesn't matter. The program can output whatever it wants, because there are no requirements on what it has to output.

The problem is, you claim this is was e. g. a proper program in Pascal, but it is syntactically not. @Shaggy The loophole is non-trivial output.

Yeah, I would consider this a loophole through triviality. It is funny though, since it is technically correct.

Ruby, 53 * 0.75 = 39.75
$><<(<<2*2+?2)[eval gets]
$><<(<<2*2+?2)[eval gets]
2

Generates a HEREDOC string delimited by a 2 on its own line, concatenates it (*2) and then adds in the final 2 via a character literal. Slices into it using Ruby's built in String#[], which supports positive integers, negative integers, and ranges (input in the form m..n). $><< is output. (puts would require an extra space here).

I think gets.to_i would do the same thing as eval gets, and be clearer. It wouldn't handle non-integer input, but that's not necessary anyway

That's normally what I'd do, but this gets the bonus for handling Ranges. (Also the non-existent bonus for being turing complete).

Ah, I missed that. My bad.

Ruby, 38.25 bytes
a="a=%p;$><<(a%%a)[eval gets]";$><<(a%a)[eval gets]

Support negative indices and ranges. I blatantly picked up both $><< and the eval trick from histocrat, and the quine trick was someone else's to begin with, so I'll make this CW.

Japt, 11 2 bytes
All of the following use 0-based, modular indexing and support negative indexing.
gg

Try it
gg     :Implicit input of integer
g      :Index into
 g     :Literal "g"

Original, 11 bytes
Based on one of ETH's standard Japt quines.
gBîQi"gBîQi

Try it (Includes full test suite)
gBîQi"gBîQi     :Implicit input of integer
g               :Index into
 B              :  11
  î             :  Repeat to length B
   Q            :    Quotation mark
    i           :    Prepend
     "gBîQi     :      String literal

Array input, 13 bytes
Same as above with the m at the start being map and the D being 13, in place of 11.
mgDîQi"mgDîQi

Try it

You can multiply by $ 0.95 $ if you support negative inputs

I don't like bonuses, @TheThonnu; I don't think they should be allowed.

RProgN 2, 6 bytes
«•.\ü

Includes a trailing space.
Explaination
«•.\ü
«      # Push the remainer of the code as a function and continue execution
 •.    # Append a space to the end of the function as a string
   \   # Swap the string under the input value
    ü  # Get the character at that index
       # A trailing space is included to ensure quine validity.

Try it online!

Python 2, 46.55 bytes
a="a=%r;print(a%%a)[input()]";print(a%a)[input()]

Supports negative indices.

Yes, this supports negative indicies.

Haskell, 122 bytes
main=getLine>>= \i->putChar$(!!(read i))$p++show p where p="main=getLine>>= \\i->putChar$(!!(read i))$p++show p where p="

Ungolfed:
main=getLine>>= \i->putChar$(!!(read i))$p++show p
 where p="main=getLine>>= \\i->putChar$(!!(read i))$p++show p\n where p="

Befunge 93, 5 bytes
This is pretty (very) late but I'll post it anyway:
&0g,@

This is on the edge of being legal IMO. It doesn't read its own source code as a file, but it does read its own source code.

Thunno, \$ 32 \log_{256}(96) \approx \$ 26.34 * 0.75 \$ \approx \$ 19.75 bytes
"D34CXx+xs+s+sAI"D34CXx+xs+s+sAI

Attempt This Online!
Based on @lyxal's Thunno quine. Supports negative indices and ranges.


text:
Label dead ends
Given an input of an ASCII art "road," output the road with all dead ends
labelled.
This is a road:
########.....######..#..###
#......#######....#..#..#.#
#.##......#...#####..#..###
#..#####..#....#..#######.#
#......#...#####.....##...#
#..###.#...#...###...#..###
##########.#..#..##..#.##.#
..#......#.######.#..#.#.#.
..#......#.#..#.#.#..#.#.#.
..######.###..##..#########

This is the road with dead ends labelled with the letter X:
########.....######..X..###
#......#######....#..X..#.#
#.XX......X...X####..X..###
#..XXXXX..X....#..#######.#
#......X...#####.....##...#
#..###.X...#...###...#..###
##########.#..X..##..#.##.X
..X......#.#XXXXX.#..#.#.X.
..X......#.#..X.X.#..#.#.X.
..XXXXXX.###..XX..######XXX

A dead end is defined as any road tile that borders n other road tiles, at
least n-1 of which are considered dead ends already by this rule.
"Bordering" is in the four cardinal directions, so tiles bordering diagonally
don't count.
This rule is applied repeatedly, as newly created dead ends can, themselves,
create more dead ends. Also note that any road tile that borders only one
other road tile is considered a dead end the first time the rule is applied.
Input and output may be either a single string (with lines separated by any
character that is not # or .) or an array/list/etc. If your language
supports it, you may also take input with each line being a function argument.
You may assume the following about the input:

There will always be at least one "loop"—that is, a group of # characters
that can be followed infinitely. (Otherwise every single tile would become a
dead end.)
This implies that the input will always be 2×2 or larger, since the smallest
loop is:
##
##

(Which, incidentally, should be output with no change.)
All # characters will be connected. That is, if you were to perform a flood
fill on any #, all of them would be affected.

Since this is code-golf, the shortest code in bytes will win.
The example above and the tiny 2×2 grid can be used as test cases (there aren't
a lot of edge cases to cover in this challenge).

CJam, 61 bytes
q_N/{{0f+zW%}4*3ew:z3few::z{e__4=_@1>2%'#e=*"#"='X@?}f%}@,*N*

Try it here.
Explanation
Outline:

    q_N/               Read input lines
        {   }@,*       Perform some operation as many times as there are bytes
                N*     Join lines

Operation:

    {0f+zW%}4*         Box the maze with zeroes
    3ew:z3few::z       Mystical 4D array neighborhood magic.
                       (Think: a 2D array of little 3x3 neighborhood arrays.)

    {                        }f%    For each neighborhood, make a new char:
     e_                                 Flatten the neighborhood
       _4=_                             Get the center tile, C
           @1>2%                        Get the surrounding tiles
                '#e=                    Count surrounding roads, n
                    *                   Repeat char C n times
                     "#"=               Is it "#"? (i.e., C = '# and n = 1)
                         'X@?           Then this becomes an 'X, else keep C.

(Martin saved two bytes, thanks!)

That's one of longest cjam answers I have ever seen. =)

@DJMcGoathem Ummm...

Are '# and "#" different in CJam?

Yep, they are. "#" is equal to ['#].

JavaScript (ES6), 110 109 bytes
r=>[...r].map(_=>r=r.replace(g=/#/g,(_,i)=>(r[i+1]+r[i-1]+r[i+l]+r[i-l]).match(g)[1]||"X"),l=~r.search`
`)&&r

1 byte saved thanks to @edc65!
Explanation
Very simple approach to the problem. Searches for each #, and if there are less than 2 #s around it, replaces it with an X. Repeats this process many times until it's guaranteed all the dead-ends have been replaced with Xs.

var solution =

r=>
  [...r].map(_=>                    // repeat r.length times to guarantee completeness
    r=r.replace(g=/#/g,(_,i)=>      // search for each # at index i, update r once done
      (r[i+1]+r[i-1]+r[i+l]+r[i-l]) // create a string of each character adjacent to i
      .match(g)                     // get an array of all # matches in the string
        [1]                         // if element 1 is set, return # (the match is a #)
        ||"X"                       // else if element 1 is undefined, return X
    ),
    l=~r.search`
`                                   // l = line length
  )
  &&r                               // return the updated r
<textarea id="input" rows="10" cols="40">########.....######..#..###
#......#######....#..#..#.#
#.##......#...#####..#..###
#..#####..#....#..#######.#
#......#...#####.....##...#
#..###.#...#...###...#..###
##########.#..#..##..#.##.#
..#......#.######.#..#.#.#.
..#......#.#..#.#.#..#.#.#.
..######.###..##..#########</textarea>

<button onclick="result.textContent=solution(input.value)">Go</button>

Common trick that I use always for this type of task. As you use both l and -l in the same way, you can compute l=~r.search instead of l=1+r.search. (Just 1 byte saved)

@edc65 Clever. Thanks!

Python (3.5) 362 331 329 314 bytes
thanks to @Alissa. she helps me to win ~33 bytes
d='.'
r=range
def f(s):
 t=[list(d+i+d)for i in s.split()]
 c=len(t[0])
 u=[[d]*c]
 t=u+t+u
 l=len(t)
 g=lambda h,x:t[h][x]=='#'
 for k in r(l*c):
  for h in r(1,l):
   for x in r(1,c):
    if g(h,x) and g(h+1,x)+g(h-1,x)+g(h,x+1)+g(h,x-1)<2:
     t[h][x]='X'
 print('\n'.join([''.join(i[1:-1])for i in t][1:-1]))

Explanations
d='.'
r=range

Function definition
def f(s):

Add a border of '.' on right and left of the board
 t=[list(d+i+d)for i in s.split()]
 c=len(t[0])
 u=[[d]*c]

Add a border of '.' on top and bottom
 t=u+t+u
 l=len(t)

Lambda function to test '#'
 g=lambda h,x:t[h][x]=='#'

Loop on the input length to be sure we don't forget dead ends
 for k in r(l*c):

Loop on columns and lines
  for h in r(1,l):
   for x in r(1,c):

Test if we have '#' around and on the position
    if g(h,x) and g(h+1,x)+g(h-1,x)+g(h,x+1)+g(h,x-1)<2:

Replace '#' by 'X'
     t[h][x]='X'

Crop the border filled with '.' and join in string
 print('\n'.join([''.join(i[1:-1])for i in t][1:-1]))

Usage
f("########.....######..#..###\n#......#######....#..#..#.#\n#.##......#...#####..#..###\n#..#####..#....#..#######.#\n#......#...#####.....##...#\n#..###.#...#...###...#..###\n##########.#..#..##..#.##.#\n..#......#.######.#..#.#.#.\n..#......#.#..#.#.#..#.#.#.\n..######.###..##..#########")

########.....######..X..###
#......#######....#..X..#.#
#.XX......X...X####..X..###
#..XXXXX..X....#..#######.#
#......X...#####.....##...#
#..###.X...#...###...#..###
##########.#..X..##..#.##.X
..X......#.#XXXXX.#..#.#.X.
..X......#.#..X.X.#..#.#.X.
..XXXXXX.###..XX..######XXX

use split() instead of splitlines(). 2) t=['.'*(c+2)]+['.'+i+'.'for i in s]+['.'*(c+2)] is shorter. And it can be shortened even more: d='.';t=[d*c]+t+[d*c];t=[d+i+d for i in t] 3) you don't need all the list(zip(....)) thing, use print('\n'.join([''.join(i[1:-1])for i in t])

@Alissa thanks for your help i use your tips for point 1) and 3)
but for the 2) i can't remove all bracket, we need a list of list of char and not a list of string because 'str' object does not support item assignment. the list of list allows me to use t[h][x]='X'

sorry, I missed the thing about string immutability. You can also move all constants (r, g and d) out of your function (saves you some tabulation). Maybe some playing around split() might help: t=[d+list(i)+d for i in s.split()], then calculate lengths, then add dot-lines to the end an to the beginning, and then alter your cycles to work with these extended lengths. Not sure if it will shorten the code, but it might

@Alissa i can't move the g out of the function because it use t
i'll test your other comment


text:
Remove specified non-numeric rows
In case there's any doubt: Nan = Non-numeric datatype for the purposes of this challenge.

Write a program or function that takes a matrix / array as input, as well as a list of column indices.
The challenge is to remove the rows where all elements in the specified columns are Nan. It doesn't matter if other elements in the row are numeric or not. The following examples will hopefully make this more clear (it's one-indexed):
Input array:
    16   NaN     3    13
     5    11   NaN     8
   NaN     7   NaN    12
     4    14   -15     1

Input column index: [1 3]

Output array:
16   NaN     3    13
 5    11   NaN     8
 4    14   -15     1

----

Input array:
    16   NaN     3    13
     5    11   NaN     8
   NaN     7   NaN    12
     4    14   -15     1

Input column index: 3

Output array =
    16   NaN     3    13
     4    14   -15     1

----

Input array:
   NaN   NaN   NaN   NaN
   NaN   NaN   NaN   NaN
   NaN   NaN   NaN   NaN
   NaN   NaN   NaN   NaN

Input column index: 1 2 4

Output array:
 []

Rules and clarifications:

The matrix will always be non-empty
The numeric values will be finite, but not necessarily integers or positive values
The column index vector can be empty (in which case no rows will be removed)
The column index will never have values exceeding the matrix dimensions
You can assume there won't be duplicates in the column index list
You can choose if you want to use zero- or one-indexed values (please specify)
You can take the input on any convenient format

Array as list of lists is OK. The column indices can be separate arguments

ans = and similar is accepted in output
You are free to choose what type of non-numeric datatype you want to use

It should be impossible to perform arithmetic operations with this datatype, or convert it to a finite number using functions such as float(x).

This is code golf, so shortest code in bytes win.

Pyth, 16 19 10 9 7 10 Bytes
Column indices start at zero. Input is a list of lists. Uses an empty string as non-numeric value. Takes list of column indices on the first line and the Matrix with the values on the second line.
?Qf-QxkTEE

Try it online!
Explanation
?Qf-QxkTEE       # Implicit: Q=column indices, E=Matrix

?Q       E       # If column list is empty no rows get removed
  f     E        # filter the given matrix by each row T
     xkT         # Get the indices of all occurences of an emtpy string (k)
   -Q            # If the indices match with the given column indices, remove the row

Update: My first solution handled an empty list of column indices wrong. Fixed it (pretty ugly) at the cost of 3 Bytes. Gonna try to do it better after work...
Update 2: Golfed it down to 10 9 7 bytes, with some help from @FryAmTheEggman an by improving the algorithm significantly.
Update3: Fixed a bug @ThomasKwa discovered. His proposed 7-byte solution did not handle empty column indices right, so I just catch that case with a ternary here. I don't see how I can shorten this atm.

You can replace J with vz and K with Q. z is initialized to input, Q to evaluated input.

@Pietu1998 Thanks a lot! :) I knew I was missing something in that regard. Sadly I found a bug when I looked at it again to implement your suggestion which overall increases my byte count until I find a nicer solution.

?KEfnmklKm@TdKQQ empty lists are falsy in Pyth, and assignment statements return the value that was assigned, which saves some bytes. I hope you enjoy golfing Pyth! :)

@FryAmTheEggman Thanks for the suggestions. Is not really relevant anymore since I improved the algorithm a lot, but I really appreciate the help! :)

Very nice :) you can save another byte using L -> fnks@LTQE

@FryAmTheEggman I knew about M but did not about L. Thanks for the hint! :)

Oh, actually you can use x to save some bytes by getting the indices of the empty string and comparing it to the input: fnQxkTE. Also, there are a bunch more things like L, just FYI: #BFRI at least (I'm probably forgetting some) all have different functional modes! :)

@FryAmTheEggman Awesome, thanks! :) Gotta get used to all the shortcuts, but its just so many ^^

Doesn't this fail here? You should be using f-QxkTE.

@ThomasKwa You are right, thank you! :)

e.Q -> E saves 2 bytes.

@isaacg Thanks! :) Don't know how I missed that...

JavaScript (ES6), 48 46 bytes
(a,l)=>a.filter(r=>l.some(c=>r[a=0,c]<1/0)||a)

Explanation
Expects an array of rows as arrays, and an array of 0-indexed numbers for the columns to check. Returns an array of arrays.
Straight-forward filter and some. Checks for NaN by using n < Infinity (true for finite numbers, false for NaNs).

var solution =

(a,l)=>
  a.filter(r=>     // for each row r
    l.some(c=>     // for each column to check c
      r[a=0,       // set a to false so we know the some was executed
        c]<1/0     // if any are not NaN, do not remove the row
    )
    ||a            // default to a because if l is of length 0, some returns false but
  )                //     we must return true
<textarea id="matrix" rows="5" cols="40">16 NaN 3 13
5 11 NaN 8
NaN 7 NaN 12
4 14 -15 1</textarea>

<input type="text" id="columns" value="0 2" />
<button onclick="result.textContent=solution(matrix.value.split('\n').map(l=>l.split(' ').map(n=>+n)),(columns.value.match(/\d+/g)||[]).map(n=>+n)).join('\n')">Go</button>

Nice handling of that edge case!

CJam, 18 bytes
{{1$\f=_!\se|},\;}

An unnamed block (function) expecting the matrix and the zero-based column indices on the stack (the matrix on top), which leaves the filtered matrix on the stack. I'm using the empty array "" as the non-numeric value.
Test it here.
Explanation
{     e# Filter the matrix rows based on the result of this block...
  1$  e#   Copy the column indices.
  \f= e#   Map them to the corresponding cell in the current row.
  _!  e#   Duplicate, logical NOT. Gives 1 for empty column list, 0 otherwise.
  \s  e#   Convert other copy to string. If the array contained only empty arrays, this
      e#   will be an empty string which is falsy. Otherwise it will contain the numbers
      e#   that were left after filtering, so it's non-empty and truthy.
  e|  e#   Logical OR.
},
\;    e# Discard the column indices.

Am I testing it wrong or does this violate the rule about no given column indices? The column index vector can be empty (in which case no rows will be removed)

@DenkerAffe Damn, fixed at the cost of 5 bytes...

I was there too...You still one byte ahead of me tho, so my plan did not work out yet :P

"the empty array """ Did you mean "the empty string"?

@ETHproductions There is no difference in CJam. Strings are just arrays of characters, so [] and "" are identical and the canonical representation is "" (e.g. it's what you get when you stringify an empty array).

Oh, I understand now. Thanks!

@ETHproductions demo: http://cjam.aditsu.net/#code=%5B1%5Dp%0A%221%22p%0A%5B%5Dp%0A%22%22p

APL, 19 bytes
{⍵⌿⍨∨/⍬∘≡¨0↑¨⍵[;⍺]}

The left argument should be a list of indices (and it must be a list, not a scalar), the right argument is the matrix. APL has two datatypes, numbers and characters, so this filters out the character types.
Tests:
      m1 m2
   16  NaN    3  13   NaN  NaN  NaN  NaN
    5   11  NaN   8   NaN  NaN  NaN  NaN
  NaN    7  NaN  12   NaN  NaN  NaN  NaN
    4   14  ¯15   1   NaN  NaN  NaN  NaN
      1 3 {⍵⌿⍨∨/⍬∘≡¨0↑¨⍵[;⍺]} m1
16  NaN    3  13
 5   11  NaN   8
 4   14  ¯15   1
      (,3) {⍵⌿⍨∨/⍬∘≡¨0↑¨⍵[;⍺]} m1
16  NaN    3 13
 4   14  ¯15  1
      1 2 4 {⍵⌿⍨∨/⍬∘≡¨0↑¨⍵[;⍺]} m2 ⍝ this shows nothing
      ⍴1 2 4 {⍵⌿⍨∨/⍬∘≡¨0↑¨⍵[;⍺]} m2 ⍝ the nothing is in fact a 0-by-4 matrix
0 4

Explanation:

⍵[;⍺]: select the given columns from the matrix
0↑¨: take the first 0 elements from the start of each item
⍬∘≡¨: compare to the numerical empty list
∨/: see in which of the rows at least one item matches
⍵⌿⍨: select those rows from the matrix

R, 49 bytes
function(m,j)m[!!rowSums(!is.nan(m[,j,drop=F])),]

Input is 1-based. The function takes a matrix (m) and a vector of column indices (j) which may be missing.
Two test cases:
> f <- function(m,j)m[!!rowSums(!is.nan(m[,j,drop=F])),]
> f(m)
      V1  V2  V3 V4
[1,]  16 NaN   3 13
[2,]   5  11 NaN  8
[3,] NaN   7 NaN 12
[4,]   4  14 -15  1

> f(m, c(1,3))
     V1  V2  V3 V4
[1,] 16 NaN   3 13
[2,]  5  11 NaN  8
[3,]  4  14 -15  1

MATLAB, 32 28 bytes
I'll answer my own question for once. The best I can do in MATLAB is 28 bytes. I was hoping to avoid using both all and isnan somehow, but haven't found a way yet.
@(A,c)A(any(A(:,c)<inf,2),:)

Test:
A =
    35     1   NaN   NaN   NaN    24
     3    32   NaN    21    23    25
    31   NaN   NaN   NaN    27    20
   NaN    28   NaN    17   NaN    15
    30     5   NaN    12    14   NaN
     4    36   NaN    13    18    11

f(A,[3,5])
ans =
     3    32   NaN    21    23    25
    31   NaN   NaN   NaN    27    20
    30     5   NaN    12    14   NaN
     4    36   NaN    13    18    11

This is an unnamed anonymous function that takes the input matrix as the first input variable, and a list of column indices as the second.
In MATLAB, NaN < Inf evaluates to false. It can be assumed that all values are finite, thus checking if values are less than inf is equivalent to checking if they are non-numeric. any(...,2) checks if there are any true values along the second dimension (rows). If that's the case, then those rows will be returned.
Old version:
@(A,c)A(~all(isnan(A(:,c)),2),:)

isnan(A(:,c)) returns an array with booleans for the specified columns. ~all(isnan(A(:,c)),2) checks if all values along the second dimension (rows) are non-numeric, and negates it. This results in a boolean vector with ones in the positions we want to keep. A(~all(isnan(A(:,c)),2),:) uses logical indexing to extract the entire rows for A.

The following 24 byte solution would work if the values were guaranteed to be non-zero:
@(A,c)A(any(A(:,c),2),:)

Ruby, 48 bytes
->a,c{a.select{|r|c.map{|i|Fixnum===r[i]}.any?}}

Input is 0-based indices1.
Fairly self-explanatory, actually. select elements from the array where any? of the indices mapped over the row are Fixnums.
Sample run:
irb(main):010:0> (->a,c{a.select{|r|c.map{|i|Fixnum===r[i]}.any?}})[[[16,'',3,13],[5,11,'',8],['',7,'',12],[4,14,-15,1]],[0,2]]
=> [[16, "", 3, 13], [5, 11, "", 8], [4, 14, -15, 1]]

1: I finally spelled this word correctly on the first try! \o/

MATL, 15 16 bytes
tiZ)tn?ZN!XA~Y)

NaN is represented in the input as N. Indexing is 1-based. For example, in the first test case the input is
[16 N 3 13; 5 11 N 8; N 7 N 12; 4 14 -15 1]
[1 3]

Try it online!
Explanation
t       % implicitly input matrix, M. Duplicate
i       % input vector specifying columns
Z)      % matrix N containing those columns of M
tn?     % duplicate matrix N. If non-empty ...
  ZN    %   true for NaN values in matrix N
  !     %   transpose
  XA    %   "all" within each column: gives true for rows of N that contained all NaN's
  ~     %   logical negate
  Y)    %   apply this logical index as a row index into the copy of M that was left
        %   at the bottom of the stack
        % ... implicitly end if
        % implictly display stack contents. If the input vector was empty, the stack
        % contains the original matrix M and an empty matrix. The latter produces no
        % displayed output. If the input vector was non-empty, the stack contains the
        % resulting matrix N

K5, 15 bytes
This uses 0-indexed columns and K's natural list-of-lists matrix representation:
{x@&~&/'^x[;y]}

Index into the matrix (x@) the rows where (&) not all of each (~&/') is null (^).
In action:
  m: (16 0N 3 13;5 11 0N 8;0N 7 0N 12;4 14 -15 1);
  f: {x@&~&/'^x[;y]};

  f[m;0 2]
(16 0N 3 13
 5 11 0N 8
 4 14 -15 1)

  f[m;2]
(16 0N 3 13
 4 14 -15 1)

Haskell, 39 bytes
m#[]=m
m#r=[l|l<-m,any(<1/0)$map(l!!)r]

This uses 0-based indices. Usage example (I'm using sqrt(-1) to create NaNs):
*Main> [[16,sqrt(-1),3,13], [5,11,sqrt(-1),8], [sqrt(-1),7,sqrt(-1),12], [4,14,-15,1]] # [0,2]
[[16.0,NaN,3.0,13.0],[5.0,11.0,NaN,8.0],[4.0,14.0,-15.0,1.0]]

It's just a simple filter as seen in other answers via list comprehension. The special case of an empty index list is caught separately.

Lua, 148 Bytes
A function that takes a matrix and an array as input, and output a matrix with the corresponding rows at nil. As arrays are quite the same as C's arrays, nihilating is like free()ing it as the garbage collector isn't far away.
Arrays are 1-indexed in Lua, and I use the string "NaN" as a non-nomber element.
function f(m,l)c=1 while(c<#m)do x=0 for j=1,#l do x=x+((type(m[c][l[j]])=="number")and 0 or 1)end m[c]=(x<#l and m[c] or nil)c=c+1 end return m end

You can try Lua online, and copy/paste the following code sample to try this submission:
-- The function that does the stuff
function f(m,l)
  c=1
  while(c<#m)
  do
    x=0
    for j=1,#l
    do
      x=x+((type(m[c][l[j]])=="number")and 0 or 1)
    end
    m[c]=(x<#l and m[c] or nil)
    c=c+1
   end
   return m
end
-- A function to format matrixes into "readable" strings
function printMatrix(matrix,len)
  s="{"
  for v=1,len
  do
    if matrix[v]~=nil
    then
      s=s.."{"..table.concat(matrix[v],",").."}"..(v<len and",\n "or"")
    end
  end
  s=s.."}"
  print(s)
end

nan="NaN"
-- Datas in, indexed as matrices[testCase][row][column]
matrices={{{7,nan,5,3},{5,4,nan,4},{nan,4,nan,9},{5,7,9,8}},
{{16,nan,3,13},{5,11,nan,8},{nan,7,nan,12},{4,14,-15,1}},
{{nan,nan,nan,nan},{nan,nan,nan,nan},{nan,nan,nan,nan},{nan,nan,nan,nan}}}
indexes={{1,3},{3},{1,2,4}}

-- looping so we can test lots of things at once :)
for i=1,#matrices
do
  print("\ninput: "..table.concat(indexes[i]," "))
  printMatrix(matrices[i],4)
  print("output:")
  printMatrix(f(matrices[i],indexes[i]),4)
end

Mathematica, 52 51 49 46 bytes
Delete[#,Extract[#,{;;,#2}]~Position~{NaN..}]&

Input is [matrix as list of lists,vector of columns]

Welcome to Programming Puzzles & Code Golf! :) Please correct your formatting and specify your input format including the indexing of the columns as asked in the challenge.


text:
The powerful connection
Introduction
There is a plantation defined by one big square-board like this one:

The numbers inside each small square represents its area's value/cash/...
The farmer needs help to find the N squares that connected (it means all N squares should have at least one shared border) give him the greatest value.
For example:
If N=1, then the output must be 140.
If N=6, then..

..the output must be 315.
Challenge
Your program/function must take the the matrix's values and the number N as input/arguments and must output the powerful connection's value.
Since this is code-golf, the shortest answer in bytes wins!
Examples
Input:
10 -7 11 7 3 31
33 31 2 5 121 15
22 -8 12 10 -19 43
12 -4 54 77 -7 -21
2 8 6 -70 109 1
140 3 -98 6 13 20
6

Output: 315

Input:
35 -7
-8 36
2

Output: 29

Some brute force algorithms for this could be very slow. Are there any restrictions on time for cases like the first test case?

@steveverrill. For this challenge, no time complexity will count, but if you answer this and prove that your method is efficiently better than brute force I will gladly upvote your answer.

JavaScript (ES6), 190 bytes
(m,n)=>m.map((a,r)=>a.map((_,c)=>f(r,c,[0],0)),o=f=(x,y,s,t)=>s[n]?o>t?0:o=t:s.indexOf(w=x+","+y)<0&&m[y]&&(v=m[y][x])<1/0&&f(x+1,y,s=[...s,w],t+=v)+f(x,y+1,s,t)+f(x-1,y,s,t)+f(x,y-1,s,t))|o

Explanation
Takes the matrix as an array of arrays.
Starts from each square then uses a recursive function to test every possible combination. This is a brute-force approach, but it finishes almost instantly for the first test case on my machine.
(m,n)=>
  m.map((a,r)=>                 // for each row
    a.map((_,c)=>               // for each column
      f(r,c,[0],0)              // start checking paths from the coordinate of the square
    ),
    o=                          // o = output number (max total)
    f=(x,y,s,t)=>               // recursive function f, x & y = current square, t = total
                                // s = array of used squares (starts as [0] so length = +1)
      s[n]?                     // if we have used n squares
        o>t?0:o=t               // set o to max of o and t
      :s.indexOf(w=x+","+y)<0&& // if the square has not been used yet
      m[y]&&(v=m[y][x])<1/0&&   // and the square is not out of bounds
                                // ( if value of square is less than Infinity )

        // Check each adjacent square
        f(x+1,y,
          s=[...s,w],           // clone and add this square to s
          t+=v                  // add the value of this square to the total
        )
        +f(x,y+1,s,t)
        +f(x-1,y,s,t)
        +f(x,y-1,s,t)
  )
  |o                            // return output

Test

var solution = (m,n)=>m.map((a,r)=>a.map((_,c)=>f(r,c,[0],0)),o=f=(x,y,s,t)=>s[n]?o>t?0:o=t:s.indexOf(w=x+","+y)<0&&m[y]&&(v=m[y][x])<1/0&&f(x+1,y,s=[...s,w],t+=v)+f(x,y+1,s,t)+f(x-1,y,s,t)+f(x,y-1,s,t))|o
<textarea rows="7" cols="40" id="Matrix">10 -7 11 7 3 31
33 31 2 5 121 15
22 -8 12 10 -19 43
12 -4 54 77 -7 -21
2 8 6 -70 109 1
140 3 -98 6 13 20</textarea>

N = <input type="number" id="N" value="6" />

<button onclick="result.textContent=solution(Matrix.value.split('\n').map(x=>x.split(' ').map(z=>+z)),N.value)">Go</button>


text:
Easy as ABC Solver
Easy As ABC, also known as "End View", is a puzzle where you are given an empty grid with letters around it; you must partially fill in the grid so that exactly one of each letter is in every row and column; in addition, letters at the end of a row (or column) must be the first letter visible in that row (or column) from that direction. Your goal in this code golf will be to solve an Easy As ABC puzzle.
For example, here is an Easy As ABC puzzle from this year's MIT Mystery Hunt using the letters MIC:

The solution is:

(Sorry about the artifacts on the Cs; I tried to edit out the irrelevant information from the rest of the puzzle.)
I/O
Input will be an array of strings or a string possibly with delimiters. It will start in the top left corner and go clockwise. For instance, the above puzzle could be input like this:
".CMM.M|....IM|.....I|C.ICI."

Output should be the solved grid, with or without the border. It can be as an array of chars, array of strings, or any other convenient format. The same "blank" character must be accepted as input and displayed as output, but that blank character may be anything. If they are single strings, both input and output must have the same separator (between sides for input and rows for output) or no separator at all.
For unsolvable puzzles, you must output something that is not mistakable for a solution. You may assume that no puzzle has more than one solution.
You must allow any number of letters and any size grid; all used letters will appear in the border of the grid.
This is code-golf: as usual, shortest code wins!
Test Cases
"T.AA..|.T.TSS|..TST.|A...SS"
"R.RU..|B.B..B|.UR.UB|UR..B."
"N...NK|E.NK.K|..KK..|....EK"
"CA..DBD|.B..CC.|.D.DEB.|DB.A..A"
"...DDEBE|DC..EBBD|BA..ABF.|E..FECDE"

to be clear: the entire alphabet is given on the border? (i.e. no letter will appear that is not on the border?)

@quintopia: Yes. The border will contain every used letter.

Similar yet quite different puzzle

PHP, 1111 Bytes
minus the Bytes removing newlines
The Online version works only with the Testcases with a length of 6
short workaround
make all permutations
fill 2 arrays with the permutations $x $y
change between two functions so long till only 1 solution in the x array foreach line exists
function i:find intersections in the grid and drop permutations
function c:check the colums in each array of unique charcters and remove permutations in the other lines for array $x and $y
$p=[];p(array_pad(($s="str_split")(substr(count_chars($a=$argn,3),1,-1)),$l=(strlen($a)-3)/4," "));
$e=explode("|",$a);$e[3]=strrev($e[3]);$e[2]=strrev($e[2]);
$x=$y=array_fill(0,$l,$p);$g="preg_grep";$c="array_column";$o="join";
foreach($q=range(0,$l-1)as$i){
$e[0][$i]=="."?:$y[$i]=$g("#^\s*{$e[0][$i]}#",$y[$i]);
$e[2][$i]=="."?:$y[$i]=$g("#{$e[2][$i]}\s*$#",$y[$i]);
$e[3][$i]=="."?:$x[$i]=$g("#^\s*{$e[3][$i]}#",$x[$i]);
$e[1][$i]=="."?:$x[$i]=$g("#{$e[1][$i]}\s*$#",$x[$i]);}
for(;array_sum(($m="array_map")("count",$x))>$l;){
foreach($q as$i)foreach($q as$j){
$k=array_intersect($c($m($s,$x[$i]),$j),$c($m($s,$y[$j]),$i));
$y[$j]=$g("#^.{{$i}}(".$o("|",$k).")#",$y[$j]);
$x[$i]=$g("#^.{{$j}}(".$o("|",$k).")#",$x[$i]);
foreach(["x","y"]as$z){
$u=array_unique($c($m($s,${"$z"}[$i]),$j));
if(count($u)==1&&end($u)!=" "){$w=end($u);
foreach($q as$h){
if($i!=$h)${"$z"}[$h]=$g("#^.{{$j}}{$w}#",${"$z"}[$h],1);}}
}}}
echo$o("\n",$m($o,$x));
function p($c,$b=[]){global$p;
if(($c)){$n=[];while($c){
$e=array_pop($c);
p(($m="array_merge")($c,$n),$m($b,[$e]));
$n[]=$e;
}}else in_array($b=join($b),$p)?:$p[]=$b;}