[Question]
  [
The mean of a population \$(x\_1,\dots,x\_n)\$ is defined as \$\bar x=\frac1n\sum\_{i=1}^n x\_i\$. The (uncorrected) [standard deviation](https://en.wikipedia.org/wiki/Standard_deviation#Uncorrected_sample_standard_deviation) of the population is defined as \$\sqrt{\frac1n\sum (x\_i-\bar x)^2}\$. It measures how dispersed the population is: a large standard deviation indicates that the values are far apart; a low standard deviation indicates that they are close. If all values are identical, the standard deviation is 0.
Write a program or function which takes as input a (non-empty) list of non-negative integers, and outputs its standard deviation. But check the scoring rule, as **this is not code golf**!
## Input/Output
Input/Output is flexible. Your answer must be accurate to at least 2 decimal places (either rounding or truncating). The input is guaranteed to contain only integers between 0 and 255, and to not be empty.
## Scoring
To compute your score, convert your code to integer code points (using ASCII or whatever code page is standard for your language) and compute the standard deviation. Your score is the number of bytes in your code multiplied by the standard deviation. Lower score is better. You should therefore aim for code which at the same time (a) is short and (b) uses characters with close codepoints.
Here is an [online calculator](https://tio.run/##TY2xDsIwDET3fIXVyUaiAxMLH8DOwoJUpQ5liCPsRGqF@PaQdGK7906601rjNtoMFwhFfH4lwZU@DiA2FXnq2Mga2Vsz7grXY6THiXqjnIsKGrmvc@F/xwjEL5P2cID9BksO51u6Sm6SasDhnoqCTzPDM7HBwsrjQPUH "R – Try It Online") to compute your score (assuming you use ASCII).
## Test cases
```
Input              | Output
77 67 77 67        | 5
82                 | 0
73 73 73           | 0
83 116  97 116 115 | 13.336
```
A word of caution about built-ins: if your language has a built-in, that's fine (and good for you if it only uses one character!). But make sure that it uses \$n\$ and [not](https://en.wikipedia.org/wiki/Bessel%27s_correction) \$n-1\$ as the denominator in the formula, or else your answer won't be valid.
  
[Answer]
# [MATL](https://github.com/lmendo/MATL), score 65.30697
```
tYmhZs
```
[Try it online!](https://tio.run/##y00syfn/vyQyNyOq@P//aHNzBTNzBTAZCwA) Or [verify all test cases](https://tio.run/##y00syfmf8L8kMjcjqvi/S8j/aHNzBTNzBTAZyxVtYQQkzI0VwAjEN1YwNDRTULA0B9OGhqaxAA).
### How it works
The built-in function `Zs` with its default arity (1 input, 1 output) computes the *corrected* standard deviation:
\$\sqrt{\frac 1 {n-1}\sum (x\_i-\bar x)^2}\$
The uncorrected standard deviation can be obtained with the 2-input version of `Zs`: `1&Zs`, where `1` as second input means uncorrected. `l` or `T` could be used instead of `1` to reduce the score, but `&` is very far from the other characters. `2$` or `H$` could be used instead of `&`, but `$` is even farther.
So it is better to use the default version of `Zs` (corrected standard deviation) on the input *with its mean appended*. This increases the input length by `1` and contributes `0` in the numerator, which causes the corrected standard deviation to become uncorrected.
```
t     % Implicit input: numeric vector. Duplicate
Ym    % Mean
h     % Concatenate the input vector with its mean
Zs    % Corrected standard deviation
```
[Answer]
# [J](http://jsoftware.com/), 19 bytes, [Score 119.8249](https://tio.run/##TY3BCsJADETv@xWhakkqreBJCn6Ad89CqV30sCluslARv33N9uRt3huYiTmHdyd3OINPPOpzZlzo4wCCqTANBY3ESF5RcVW4tIFuRypNnDRFRiH3dc7/7wgBj48hltDAeoNJ/ek6X1hNUvZY4f6w21Ld9U1fY2uwoYryDw)
*-~1 thanks to Bubbler*
Tries to have most characters between 0x23 and 0x2F `#$%&'()*+,-./`, with `:` being a bit further away.
```
(+/%$)&.:*:&(-+/%#)
```
[Try it online!](https://tio.run/##bY49DsIwFIP3nuIThSYpbSBE9JUndUJiYuIQGVgrzh8ilAWE5R/Zk595401iUQwDR7Ro9Fwf91u2@8Nu6zqvvXZ2LKV12eWECJNUr2gSw3ziF2WWWPm1zpEQJi7yiRDONLZdHT2JyEtZWbz5c8C8AQ "J – Try It Online")
### How it works
```
(+/%$)&.:*:&(-+/%#)
            (-+/%#) x - sum divided by length
         *:&        and squared
(+/%$)&.:           mean of that
      &.:*:         reverse square -> square root
```
[Answer]
## Google Sheets, Score 142.6885
```
=STDEVP(F:F
```
Google Sheets automatically closes parentheses, and using `F` as the input column minimizes the standard deviation. This saves one byte over Excel's uncorrected standard deviation, since Excel uses `STDEV.P` instead of `STDEVP`
[Answer]
# [R](https://www.r-project.org/), ~~34 bytes~~ 24 bytes, [score](https://tio.run/##TY2xDsIwDAX3fIXVyQ9RBiYW2OncGakKjWBIKuJEalXx7cHJxOa7J51jKX47yZOu5HKw6b0EXrEbIq/Kz1NFJVGST0zcFK@9x@OMusQ55RhYYL7GuP@OgIJ9TbEeB2pvOCd3GZd7SCpRHHfqLIvVKPrbcGz5AUCH8gM) ~~789.5923~~ ~~723.4687~~ 722.6112
```
sd(c(scan()->J,mean(J)))
```
[Try it online!](https://tio.run/##K/r/vzhFI1mjODkxT0NT185LJzcVyPLS1NT8b2bOZW7OBSH/AwA "R – Try It Online")
*Edit: switched to a shorter formula to calculate the population sd (which I found [here](https://codegolf.stackexchange.com/questions/60901/calculate-standard-deviation/60908#60908)), which now only benefits from selecting the best variable name among the golfs outlined below for the previous version.*
*Edit2: score reduced by 0.8575 thanks to Robin Ryder*
The (previous) ungolfed code ~~is~~ was: `x=scan();sqrt(mean((x-mean(x))^2))` (which would have a score of 1104.484)
From this, sequential score-improving golfs are:
* `x=scan();`?`=mean;sqrt(?(x-?x)^2)` = re-define `mean()` as a single character unary operator (score 983.8933)
* `x=scan();`?`=mean;(?(x-?x)^2)^.5` = exchange `sqrt()` for `()^.5` (score 918.6686)
* `H=scan();`?`=mean;(?(H-?H)^2)^.5` = exchange `x` for `H` which is the closest codepoint value to the mean of the program, thereby reducing the standard deviation (score 801.4687)
* `I=scan();`?`=mean;I=I-?I;(?I^2)^.5` = first calculate `x-mean(x)` separately, to reduce number of parentheses (which are at the far end of the ASCII range, and so increase the standard deviation), and re-adjust the variable name to `I`. Although this increases the code length by 2 characters, it reduces the score to 789.5923.
---
# [R](https://www.r-project.org/) + multicon, 15 bytes, [score](https://tio.run/##TY3BCsIwEETv@Yqlp11BD56k4Ad49yyUtMGC2dTdDbSI3x6TnrzNewMzUkrcTjrCFUJmb3NiXOnjAGJVcRoaVtJK@hbDXeF6jPQ4U2tksiyMSu7rXPjfUQL2z0FaOMB@g9nC5Z5ubFVSCdjF/LLZJ@77JS06dlR@) 273.5032
```
multicon::popsd
```
Trivial solution using built-in `popsd` function from `multicon` library.  
Not installed at TIO, but you can try it at [rdrr.io](https://rdrr.io/snippets/) by copy-pasting this code:
```
x=c(67,77,67,77)  # data
multicon::popsd(x)
```
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), Score 537.0884
```
A@((#-A@#)^2)^.5&;A=Mean
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE78n27739FBQ0NZ19FBWTPOSDNOz1TN2tHWNzUx739AUWZeiYKDn0N6dLW5uY6ZuQ6YrI3lQpaxMEITMDfWASN0dcY6CoaGZjoKluZQhqGhaW3s//8A "Wolfram Language (Mathematica) – Try It Online")
@att saved 17.6142 points
[Answer]
# Python 3, Score 680.5175
Where the golfiest solution is not the best. I doubt any non-builtin could be better but I might be wrong.
```
import statistics;statistics.pstdev
```
[Try it online!](https://tio.run/##K6gsycjPM/7/PzO3IL@oRKG4JLEks7gkM7nYGsHUKyguSUkt@/8fAA "Python 3 – Try It Online")
### Python 3, Score 733.6818
```
from statistics import*;pstdev
```
### Python 3, Score 798.5587
```
__import__('statistics').pstdev
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), Score: ~~[531.168](https://tio.run/##yy9OTMpM/f9fyTk/JbUgPzOvpNhKQcn@6L4jbZ7B2S62XErBpUnFJYl5KYlFKQopqWWZiSWZ@XkgNZ56YUDpgKL89KLEXIWc1Lz0kgyweDpQ2C0zLzFHoTg5vygVJKal8///4VbHvOI8XSClUQIA)~~ ~~[431.516](https://tio.run/##yy9OTMpM/f9fyTk/JbUgPzOvpNhKQcn@6L4jbZ7B2S62XErBpUnFJYl5KYlFKQopqWWZiSWZ@XkgNYdbHfOK83SBlEYJUF1AUX56UWKuQk5qXnpJBkiBZzpQ2C0zLzFHoTg5vygVJKal8/@/f3G6PkinC4ihUQIA)~~ [360.278](https://tio.run/##yy9OTMpM/f9fyTk/JbUgPzOvpNhKQcn@6L4jbZ7B2S62XErBpUnFJYl5KYlFKQopqWWZiSWZ@XkgNYdbHfOK83SBlEYJUF1AUX56UWKuQk5qXnpJBkiBZzpQ2C0zLzFHoTg5vygVJKal8/@/v2e6fp5nni6I1igBAA) (~~10~~ ~~15~~ 14 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage))
```
Osg/nsn-Osg/(t
```
Uses the [05AB1E coding page](https://github.com/Adriandmen/05AB1E/wiki/Codepage). The characters used have the codepoints `[79,73,103,47,110,73,110,45,68,79,73,103,47,40,116]`.
[Try it online](https://tio.run/##yy9OTMpM/f/f3zNdP88zTxdEa5T8/x9tYaxjaGimY2kOpgwNTWMB) or [verify all test cases](https://tio.run/##yy9OTMpM/V9Waa@k8KhtkoKSfeWhlf/9D61L1887tC5PF8zSKPmv8z862txcx8xcB0zG6kRbGAEJc2MdMALxjXUMDc10LM3BlKGhaWwsAA).
**Explanation:**
```
                # Get the arithmetic mean of the (implicit) input-list by:
O               #  Summing the (implicit) input-list
 I              #  Push input-list again
  g             #  Pop and push its length
   /            #  Divide the sum by this length
                #  (which gives a better score than the builtin `ÅA`)
    n           # Square it
     I          # Push the input again (better score than `s` or `¹`)
      n         # Square each value in the input as well
       -        # Subtract each from the squared mean
                # Take the arithmetic mean of that list again by:
        O       #  Summing it
         Ig     #  Push the input-list again, and pop and push its length
           /    #  Divide the sum by this length
            (   # Negate it
             t  # And take its square-root
                # (after which the result is output implicitly)
```
[Answer]
# JavaScript (ES7), Score ~~1359 1228~~ 1156.077
*Saved 72 points thanks to @edc65*
```
D=>D[F='map'](C=>B-=(C+E/A)**2/A,D[F](C=>E+=--A?C:9,A=B=E=0))&&B**.5
```
[Try it online!](https://tio.run/##hVHLbsIwELzzFT5UYIfEvASUIlMFCNceOEIkXMe8caLEVG0h/XW6DqgEKrWWrLV2Z3Z3xmv@xhMRryLtqDCQpzk7DVlvOBmx0o5HJR8PWK/vMDwoexWXWFa94tpQzfJemTmO@zx46tgu6zOPVQkpFvuWRZsnEaok3Eq6DRd4jiftto1acM/RJ1SHo9W7DHCDkMId9rH@d73dgD7Z/acPYGq1lo067cujVmveUYATSMTQHLJjHa/UApNuIfmElKnQrVQLvewWAoPBE0qpSfsUvMECsR4SVCx5PICkqzEhQN4B9AqMZbAXEuPIRoIYQoTKdyQbVYGWX342VWMRxmaxh0PymSILYvCzeJOkWQXDnhYK8orSGbS66VWaKmSmUXTMJGVhr/RUOedTvglOyejXXMOEQ9rNKUnCGJa9KjegifAB53xd3kB9eV1LoelGfiTYZAmdh7HHxRJvMrvyKhECEZsUwtE8bkzJ/QeNeDDWHKaDPoM1tGzixge9v73bSa7OBu1QJf@PV6fqmVOnbw "JavaScript (Node.js) – Try It Online")
### Character breakdown
```
 char. | code | count
-------+------+-------
   0   |  48  |   1
   2   |  50  |   1
   5   |  53  |   1
   9   |  57  |   1
   &   |  38  |   2
   '   |  39  |   2
   (   |  40  |   3
   )   |  41  |   3
   *   |  42  |   4
   +   |  43  |   2
   ,   |  44  |   2
   -   |  45  |   3
   .   |  46  |   1
   /   |  47  |   2
   :   |  58  |   1   <-- mean ≈ 59.43
   =   |  61  |   9
   >   |  62  |   3
   ?   |  63  |   1
   A   |  65  |   4
   B   |  66  |   3
   C   |  67  |   4
   D   |  68  |   3
   E   |  69  |   3
   F   |  70  |   2
   [   |  91  |   2
   ]   |  93  |   2
   a   |  97  |   1
   m   | 109  |   1
   p   | 112  |   1
```
[Answer]
# [Arn](https://github.com/ZippyMagician/Arn), score = ~~925.3172~~ ~~655.6836~~ ~~602.7985~~ 123.2274
```
sdev:s
```
Uses the builtin standard deviation function. Go to the old answer for a more interesting one
# Old Answer
I don't compress it because Standard Deviation would be way higher.
I have updated this answer, since I found a much shorter method (sitting at 14 bytes). Link [here](https://codegolf.stackexchange.com/questions/60901/calculate-standard-deviation/210065#210065) (this is the program the score refers to). I will leave the original program for posterity's sake
```
:/(+v{:*v-(:s.mean}\)/((:s)#
```
[Try it!](https://zippymagician.github.io/Arn?code=Oi8oK3Z7Oip2LSg6cy5tZWFufVwpLygoOnMpIw==&input=NjAgNzAgNjAgNzA=)
# Explained
$$\large\sqrt {\frac1n \sum(x\_i-\bar x)^2}$$
Just made use of the formula. `:/` is the sqrt prefix, `:*` is the square prefix, `+v{:*v-(:s.mean}\` Folds with `+` (addition) after mapping with the block `v{:*v-(:s.mean}`. `v` is current entry, `:s` splits on space (no variable is provided, so it assumes the variable `_`, which is STDIN). Then it just divides by the length (`#` suffix).
[Answer]
# [Io](http://iolanguage.org/), score = 1454.7164672196433912
-19.58295474318379 thanks to @ManishKundu
```
method(:,:map(Z,(Z- :average)squared)average sqrt)
```
[Try it online!](https://tio.run/##lU5BCsIwELznFaGnXVnBWGw04A98QfESbKqBtmmT6MHPRxt6EPQiLLvszszOWJdaro78nHoTb64BRarXI9QE9Zor/TBeXw2G6a69aXDZeZh8xNRCZ0MEKamSlDsiH70dYjewBdxvv2@ypFw/2CUJUdFB5iHE7oPCLq4xc9bi/6gFY9BCfqDD6e3EZ6Uly3WEDSKuMhbs0@Dil14 "Io – Try It Online")
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), (14 [bytes](https://github.com/DennisMitchell/jelly)), score 218.314
(218.31399405443526)
```
+/÷LN+*2+/÷L*.
```
**[Try it online!](https://tio.run/##y0rNyan8/19b//B2Hz9tLSMwQ0vv////0YY6CuY6CpY6CoamsQA "Jelly – Try It Online")** Or see a [self-evaluation](https://tio.run/##y0rNyan8/19b//B2Hz9tLSMwQ0vv/@EZXpmPNq47tPXopIc7Z@gcbrc@3H54us@xrkNbHzXMSc5PSS3Iz8wrKbZSAHKLSxLzUhKLUhRSUssyE0sy8/Mgwsn5Rakg1tyje9wx7QAA "Jelly – Try It Online").
Bytecode: `2b 2f 1c 4c 4e 2b 2a 32 2b 2f 1c 4c 2a 2e`
### How?
A naive program would be `_Æm²Æm½`for 348.47 (subtract the mean from each, square each, take the mean of that and then square root it).
We know that to get rid of the two byte monad `Æm` whose code-points are quite far apart (`0x0d` and `0x6d`) we need to either:
* divide using `÷` (`0x1c`), or
* multiply, `×` (`0x11`), and invert, `İ` (`0xc6`)
But the latter bytes are also fairly far apart, so this answer attempts to use bytes close to `÷` (`0x1c`).
```
+/÷LN+*2+/÷L*. - Link: list of numbers, A
 /             - reduce (A) by:
+              -   addition             -> sum(A)
   L           - length (A)
  ÷            - divide                 -> mean(A)
    N          - negate
     +         - add (to A, vectorised) -> [mean(A)-v for v in A]
       2       - two
      *        - exponentiate           -> [(mean(A)-v)² for v in A]
         /     - reduce by:
        +      -   addition             -> sum((mean(A)-v)² for v in A)
           L   - length (A)
          ÷    - divide                 -> sum((mean(A)-v)² for v in A)/n
             . - a half
            *  - exponentiate           -> √(sum((mean(A)-v)² for v in A)/n)
```
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 31 bytes, score [478.3451](https://tio.run/##TY0xDsIwEAR7v@KUyocUCiqaPICCBtJZBp1CLChsK@ezFIR4u7FT0e3MSrtcin/v0wMGcDlM8opBr/hRAL4qP1PDSqlSWlj0pvTae7wdsDU8S@agE6qvUu5/JyGE6Uncwg62G53FHcd4ClIlFqc7MnS3wyVGOdfl65KJZ0N9A0PWdlh@)
```
a[a_]=RootMeanSquare[a-Mean[a]]
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE78/z8xOjE@1jYoP7/ENzUxL7iwNLEoNTpRF8SJToyN/R9QlJlXEq2sa@fnkOigHKtWF5ycmFdXzVVtbq5jZq4DJmt1uKotjECkubEOGIFFjHUMDc10LM3BlKGhaS1X7X8A "Wolfram Language (Mathematica) – Try It Online")
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 15 bytes, stddev 46.741654, score 701.12481
```
Ｉ₂∕ΣＸ⁻θ∕ΣθＬθ²Ｌθ
```
[Try it online!](https://tio.run/##VcoxD8IgEIbhv8J4JJgAwVrjqKMmjR2bDqQSS9JCoFB/Pp6D0W7Pe98No46D11MpTbQuwVkvCdqQdTR37xNc7GofBto8Q@NfJsLNurxAYORvCZSRq3HPNCIphqTbC6WnUrpOcsGIqCQ@SI5Se5SoUPURpcRm@KTg6qtD/cu@L7t1egM "Charcoal – Try It Online") Link is to verbose version of code. Link test case is the byte values in the Charcoal code page of the code. Explanation:
```
         θ      Input `x`
        Σ       Summed
       ∕  Ｌθ    Divided by `n`
     ⁻θ         Vectorised subtracted from `x`
    Ｘ       ²   Squared
   Σ            Summed
  ∕          Ｌθ Divided by `n`
 ₂              Square rooted
Ｉ               Cast to string
                Implicitly printed
```
Note that the alternative formula for the standard deviation, \$ \sqrt{\bar{x^2}-\bar x^2} \$, while having a slightly smaller standard deviation, takes 17 bytes, and therefore results in a higher score of 755.6.
[Answer]
## [Setanta](https://try-setanta.ie/), score: 2728.508
```
gniomh(g){f:=0h:=0e:=fad@g le i idir(0,e){d:=g[i]f+=d h+=d*d}toradh freamh@mata((h-f*f/e)/e)}
```
[Try it here!](https://try-setanta.ie/editor/EhEKBlNjcmlwdBCAgICgh9CGCg)
[Answer]
# [C (gcc)](https://gcc.gnu.org/), ~~107~~ ~~104~~ 99 bytes, stddev ~~25.25~~ \$\cdots\$~~25.32~~ 25.00, score ~~2702.01~~ \$\cdots\$ ~~2634.27~~ 2475.426270
Saved 3 bytes and 46.95288 points thanks to [ceilingcat](https://codegolf.stackexchange.com/users/52904/ceilingcat)!!!  
Saved 5 bytes and 158.848632 points thanks to [att](https://codegolf.stackexchange.com/users/81203/att)!!!
```
E;float D,G,H;float F(F,C)int*C;{E=F;for(H=G=0;E>-F;0>E?G+=D*D:(H+=*C++))D=H/F-C[--E];G=sqrt(G/F);}
```
[Try it online!](https://tio.run/##VVDRjqJAEHyGr@gjMZmBQQc49XZncR8Q8B/UXIwLGwiLnsyDOcOvH9szAyZHbOypqqku@ux/ns/DkIqyuZwkbFnOdmOfkYwltGqlm4hHGmeivNzILs5jLtKNnwm@Sd9zL96621ey82I38TxKt/FukfnJ3vfTo8jj7s9NknyRUdEP6ARfp6ol1H7YeLAk3x8hhsd6zWCFZf57ZlsyMMyvUJ/CURehRpdGo1GDSBCsgMHLWnfqteyFGuGCLDrZGaHkDGSAFWJFRqD5360R/MSbDNBO3TY7gOJ@NeSSAde/IJpH0WpSWFBcO@T5nPNA2DbuCIgyrnBNUMEbdNXf4lISNKKLsXfVQYDnVRQetqWDNmhiwlZHoTGAdsQwoAanTAirXAabBtZqYI0DW@VcK2cwj2Vdb6goiQOzD8f7UTNo9vWRCluT/WSsviMjLbL0OeyjaOQJ8Q58KFSuEojB3oDTJ@3rBvnnJH8Ds3lYwqw7tA6DjsF0TS3sHZzDPQ0P95cEK3Lg9T9g6WCC3u6Hf@eyOX12g998fQM "C (gcc) – Try It Online")
[Answer]
# MATLAB/Octave, 12 bytes, score 336.32
*(changed according to guidance by Giuseppe to conform with rules)*
```
@(A)std(A,1)
```
Argument with name `A` provides the lowest deviation for score, output to standard output variable `Ans` and actually written to command window.  
[Try it online!](https://tio.run/##y08uSSxL/f/fQcNRs7gkRcNRx1Dzf2JesUa0hbGCoaGZgoKlOZg2NDSN1fwPAA "Octave – Try It Online")
`std` is a built-in function. By default it uses \$N-1\$ as demoninator but by passing `1` as second argument it's changed to \$N\$.
]