text:
A spiral sequence
Background
OEIS sequence A272573 describes a spiral on a hexagonal grid as follows:

Start a spiral of numbers on a hexagonal tiling, with the initial hexagon as a(1) = 1. a(n) is the smallest positive integer not equal to or previously adjacent to its neighbors.

The sequence begins
1, 2, 3, 4, 5, 6, 7, 4, 6, 8, 5, 9, 8, 10, 2, 11, ...

Here's an illustration of the spiral pattern:

a(11) != 1 because then 3 and 1 would be adjacent in two places.
a(11) != 2 because then 3 and 2 would be adjacent in two places.
a(11) != 3 because then 3 would be adjacent to itself.
a(11) != 4 because then 3 and 4 would be adjacent in two places.
Therefore a(11) = 5.

Challenge
The challenge is to write a program that computes A272573. This is code-golf, so shortest code wins.

I can't see the image as it's blocked here, so maybe I'm missing something, but your example shows a(11)=4, but in your sequence list a(11) is 5.

Just a mistake—thanks for catching it.

This OEIS sequence was submitted by yourself, apparently. Nice. :)

what is the limit for n ? is there a time limit ?

@Setop, you just have to write a program which computes the sequence correctly, and could determine an arbitrary value in the sequence given enough time/memory/etc.

Awaiting Hexagony answer...

JavaScript (ES6),  267 .. 206  199 bytes
Returns an array containing the \$N\$ first terms of the sequence.
n=>(F=v=>++i<n?F([...v,(A=N[i]=[1,!j++||d+1,j%L?d:(j%=L*6)?++d:L++&&d++].map(k=>N[k=i-k].push(i)&&k),g=k=>v[E='every']((V,x)=>V-k|N[x][E](y=>A[E](z=>v[y]-v[z])))?k:g(-~k))()]):v)([L=1],N=[[i=j=d=0]])

Try it online!
How?
Definitions
By convention, we will call corner-cell a cell that has only one edge in common with the previous layer of the spiral and side-cell a cell that has two edges in common with the previous layer. As suggested by Ourous, we can also think of them as order-1 cells and order-2 cells, respectively.
Corner-cells are shown in yellow below. All other cells are side-cells (except the center cell which is a special case).

About cell neighbors
We don't really need to keep track of the coordinates of the cells on the grid. The only thing that we need to know is the list of neighbor cells for each cell in the spiral at any given time.
In the following diagrams, neighbors in the previous layer are shown in light shade and additional neighbors in the current layer in darker shade.
A cell has 2 neighbors among the previous cells if:

it's the first side-cell of a new layer (like 8)
or it's a corner-cell, but not the last one of the layer (like 9)

A cell has 3 neighbors among the previous cells if:

it's a side-cell, but not the first one of the layer (like 10)
or it's the last corner-cell of the current layer (like 19)

Implementation of cell neighbors
The index of the current cell (starting at \$1\$) is stored in \$i\$. The list of neighbors of a cell \$n\$ is stored in \$A[n]\$.
For obscure golfing reasons, we first compute the opposite offsets of the neighbors. For instance, \$1\$ means \$-1\$, which means the previous cell.
[                    //
  1,                 // the previous cell is always a neighbor of the current cell
  !j++ || d + 1,     // if this is not the first cell of the layer, the cell at -(d + 1)
                     // is a neighbor (otherwise, we insert 1 twice; doing it that way
                     // saves bytes and having duplicate neighbors is not a problem)
  j % L ?            // if this is a side-cell:
    d                //   the cell at -d is a neighbor
  :                  // else (corner-cell):
    (j %= L * 6) ?   //   if this is not the last cell:
      ++d            //     insert the dummy duplicate neighbor at -(d + 1); increment d
    :                //   else (last cell):
      L++ && d++     //     the cell at -d is a neighbor; increment L; increment d
]                    //

In the above code:

\$L\$ is the index of the current layer, starting at \$1\$ (and not counting the center cell).
\$j\$ is the index of the current cell within the current layer, going from \$1\$ to \$6\times L\$.
\$d\$ is the distance of the current cell to those of the previous layer. It is incremented each time we go through a corner cell.

We then process a map() loop which converts the offsets \$k\$ into indices (\$i-k\$) and push the current cell as a new neighbor for all neighbor cells, to enforce neighborhood symmetry.
.map(k =>
  N[k = i - k].push(i) && k
)

Finding the next term of the sequence
Now that we have an up-to-date list of neighbors for all cells, we can finally compute the next term \$k\$ of the sequence, using another recursive helper function.
The value of a cell \$n\$ is stored in \$v[n]\$.
( g =                 // g = recursive function taking
  k =>                // the candidate value k
    v.every((V, x) => // for each previous cell of value V at position x, make sure that:
      V - k           //   V is not equal to k
      |               //   OR
      N[x].every(y => //   for each neighbor y of x:
        A.every(z =>  //     for each neighbor z of the current cell:
          v[y] - v[z] //       the value of y is not equal to the value of z
        )             //     end
      )               //   end
    )                 // end
    ?                 // if the above conditions are fulfilled:
      k               //   stop recursion and return k
    :                 // else:
      g(-~k)          //   try again with k + 1
)()                   // initial call to g with k undefined (this will cause V - k to be
                      // evaluated as NaN and force the 1st iteration to fail)

Great explanation. One possible improvement: making the explanations in the code blocks fully visible without the need for horizontal scrolling (doesn't matter for the golfed code). Viewing in Firefox, there are 5 hidden columns in the first explanation code block, and 6 hidden columns in the second.

@trichoplax Thank you for your comment and suggestion. Could you specify which version of Firefox you're using and on which platform? I always try to format explanation blocks so that no horizontal scrolling is needed. I'm on Firefox 65 / Win10 right now and I don't have any hidden column.

Will check the version of Firefox when I get home, but it might be because I'm on Fedora. Will check on another OS and let you know

It does seem to vary by OS. Will raise this on MSE when I've had a chance to gather some evidence (if it hasn't been already)

I've raised this on MSE. Feel free to edit if anyone sees other OS/browser combinations that show horizontal scroll bars.

@trichoplax Just for reference: on my PC, the selected font for code blocks is Consolas and I still have a margin of 6 blank columns on the longest line.

Clean, 284 279 272 262 bytes
import StdEnv
l=[0,-1,-1,0,1,1]
c(u,v)(p,q)=(u-p)^2+(v-q)^2<2||(u-p)*(q-v)==1
$[h:t]m=hd[[e: $t[(h,e):m]]\\e<-[1..]|and[e<>j\\(u,v)<-m|c h u,(p,q)<-m|q==v,(i,j)<-m|c p i]]

$(scan(\(a,b)(u,v)=(a-u,b-v))(0,0)[(i,j)\\n<-[1..],i<-[1,1:l]&j<-l,_<-[max(~j<<i)1..n]])[]

Try it online!
Generates the sequence forever.
Hexagon Mapping
Most of the code goes into mapping hexagons uniquely to (x,y) coordinates so that there's a single, simple function to determine adjacency which holds for all point mappings.
The mapped points look like this:
              ---
        --- < 2,-2> ---       x-axis ___.X'
  --- < 1,-2> === < 2,-1> ---  /__.X'
< 0,-2> === < 1,-1> === < 2, 0>'
  === < 0,-1> === < 1, 0> ===
<-1,-1> === < 0, 0> === < 1, 1>
  === <-1, 0> === < 0, 1> ===
<-2, 0> === <-1, 1> === < 0, 2>.__
  --- <-2, 1> === <-1, 2> ---  \  'Y.___
        --- <-2, 2> ---       y-axis    'Y.
              ---

From there, determining adjacency is trivial, and occurs when one of:

x1 == x2 and abs(y1-y2) == 1
y1 == y2 and abs(x1-x2) == 1
y1 == y2 - 1 and x2 == x1 - 1
y1 == y2 + 1 and x2 == x1 + 1
x1 == x2 and y1 == y2

Point Generation
Notice that when traversing the hexagon in a spiral the differences recur for each layer n:

n steps of (1,0)
n-1 steps of (1,-1)
n steps of (0,-1)
n steps of (-1,0)
n steps of (-1,1)
n steps of (0,1)

This generates the points in the right order by taking sums of prefixes of this sequence:
scan(\(a,b)(u,v)=(a-u,b-v))(0,0)[(i,j)\\n<-[1..],i<-[1,1:l]&j<-l,_<-[max(~j<<i)1..n]]

Bringing it Together
The code that actually finds the sequence from the question is just:
$[h:t]m=hd[[e: $t[(h,e):m]]\\e<-[1..]|and[e<>j\\(u,v)<-m|c h u,(p,q)<-m|q==v,(i,j)<-m|c p i]]

Which in turn is mostly filtering by and[r<>j\\(u,v)<-m|c h u,(p,q)<-m|q==v,(i,j)<-m|c p i]
This filter takes points from m (the list of already-mapped points) by:

Ignoring natural numbers that are equal to any j
For every (i,j) where i is adjacent to p
For every (p,q) where the value q is equal to v
For every (u,v) where u is adjacent to the current point


text:
How much candy can you eat?
Credit to Geobits in TNB for the idea
A post without sufficient detail recently posited an interesting game:
2 children sit in front of an array of candy. Each piece of candy is numbered 1 to x, with x being the total amount of candy present. There is exactly 1 occurrence of each number.
The goal of the game is for the children to eat candy and multiply the values of the candy they have eaten to arrive at a final score, with the higher score winning.
However the original post missed key information, such as how candy is selected, so the kids in our story decided that the older kid gets to go first, and can eat up to half the candy, however once he announces the end of his turn, he can't change his mind.
One of the kids in this game doesn't like candy, so he wants to eat as little as possible, and he once watched his dad write some code once, and figures he can use the skills gained from that to work out how much candy he needs to eat to ensure victory, whilst still eating as little as possible.
The Challenge
Given the total number of candy x, your program or function should output the smallest amount of candy he has to eat to ensure victory, n, even if his opponent eats all the remaining candy.
Naturally bigger numbers make bigger numbers, so whatever amount you'll give him, he'll eat the n largest numbers.
The Rules

x will always be a positive integer in the range 0 < x! <= l where l is the upper limit of your language's number handling capabilities
It is guaranteed that the kid will always eat the n largest numbers, for example for x = 5 and n = 2, he will eat 4 and 5

Test cases
x = 1
n = 1
(1 > 0)

x = 2
n = 1
(2 > 1)

x = 4
n = 2
(3 * 4 == 12 > 1 * 2 == 2)

x = 5
n = 2
(4 * 5 == 20 > 1 * 2 * 3 == 6)

x = 100
n = 42
(product([59..100]) > product([1..58]))

x = 500
n = 220
(product([281..500]) > product([1..280]))

Scoring
Unfortunately, our brave contestant has nothing to write his code with, so he has to arrange the pieces of candy into the characters of the code, as a result, your code needs to be as small as possible, smallest code in bytes wins!

How much candy can I eat? All of it. All of the candy.

New title: "How much candy need you eat?"

@Skidsdev Should x = 0 also be handled, since 0! = 1?  (Perhaps x should also be specified as a Positive Integer?)

@Chronocidal added "positive" integer

I threw 10k pieces of candy on the ground. A little figure dug a hole into the ground and found a giant candy cavern because of me. ):

Is "all" an answer to the question?

Python 3, 76 bytes
F=lambda x:x<2or x*F(x-1)
f=lambda x,n=1:x<2or n*(F(x)>F(x-n)**2)or f(x,n+1)

Try it online!
Relies on the fact that for eating \$n\$ candies to still win and the total number of candies being \$x\$, \$\frac{x!}{(x-n)!}>(x-n)!\$ must be true, which means \$x!>((x-n)!)^2\$.
-1 from Skidsdev
-3 -6 from BMO
-3 from Sparr
+6 to fix x = 1

oh shit. I knew of the former formula, but that refactor is nice!

You can save 1 byte by replacing the top function with from math import factorial as F

you can also remove the space in **2 else to save another byte

You can rewrite these recursion using short-circuiting behaviour, eg. for the second one: n*(F(x)>F(x-n)**2)or f(x,n+1). Similarly x<2or x*F(x-1) for the first one which is shorter than the import.

All three of those are nice suggestions, thanks. (And added)

-3 bytes with import math;F=math.factorial which I should probably go find the python tips meta to mention...

@Sparr: But F=lambda x:x<2or x*F(x-1) is three bytes less?

@BMO That is very clever. Reading any code you write must be a nightmare. :)

JavaScript (ES6), 53 bytes
n=>(g=p=>x<n?g(p*++x):q<p&&1+g(p/n,q*=n--))(q=x=1)||n

Try it online!
Working range
Interestingly, the differences between the kids' products are always big enough that the loss of precision inherent to IEEE 754 encoding is not an issue.
As a result, it works for \$0 \le n \le 170\$. Beyond that, both the mantissa and the exponent overflow (yielding +Infinity) and we'd need BigInts (+1 byte).
How?
Let \$p\$ be the candy product of the other kid and let \$q\$ be our own candy product.

We start with \$p=n!\$ (all the candy for the other kid) and \$q=1\$ (nothing for us).

We repeat the following operations until \$q\ge p\$:

divide \$p\$ by \$n\$
multiply \$q\$ by \$n\$
decrement \$n\$

The result is the number of required iterations. (At each iteration, we 'take the next highest candy from the other kid'.)
Commented
This is implemented as a single recursive function which first compute \$n!\$ and then enters the loop described above.
n => (           // main function taking n
  g = p =>       // g = recursive function taking p
    x < n ?      //   if x is less than n:
      g(         //     this is the first part of the recursion:
        p * ++x  //     we're computing p = n! by multiplying p
      )          //     by x = 1 .. n
    :            //   else (second part):
      q < p &&   //     while q is less than p:
      1 + g(     //       add 1 to the final result
        p / n,   //       divide p by n
        q *= n-- //       multiply q by n; decrement n
      )          //
)(q = x = 1)     // initial call to g with p = q = x = 1
|| n             // edge cases: return n for n < 2

Jelly, 9 bytes
ḊPÐƤ<!€TL

Try it online! Or see the test-suite.
How?
ḊPÐƤ<!€TL - Link: integer, x                   e.g. 7
Ḋ         - dequeue (implicit range of x)           [   2,   3,   4,   5,   6,   7]
  ÐƤ      - for postfixes [all, allButFirst, ...]:
 P        -   product                               [5040,2520, 840, 210,  42,   7]
      €   - for each (in implicit range of x):
     !    -   factorial                             [   1,   2,   6,  24, 120, 720, 5040]
    <     - (left) less than (right)?               [   0,   0,   0,   0,   1,   1, 5040]
          -   -- note right always 1 longer than left giving trailing x! like the 5040 ^
       T  - truthy indices                          [                       5,   6, 7   ]
        L - length                                  3

that's impressive but would be more educative if explained

It will be... :)

@Setop - added.

like it ! and it must be fast compare to all solutions with tons of factorials

Nah, still calculates all those products and factorials (more than some other solutions).

APL (Dyalog Unicode), 10 bytes
+/!≤2*⍨!∘⍳

Try it online!
Port of Dennis' answer. Thanks to, well, Dennis for it.
How:
+/!≤2*⍨!∘⍳ ⍝ Tacit function, takes 1 argument (E.g. 5)
         ⍳ ⍝ Range 1 2 3 4 5
       !∘  ⍝ Factorials. Yields 1 2 6 24 120
    2*⍨    ⍝ Squared. Yields 1 4 36 576 14400
  !        ⍝ Factorial of the argument. Yields 120.
   ≤       ⍝ Less than or equal to. Yields 0 0 0 1 1
+/         ⍝ Sum the results, yielding 2.

Since this answer wasn't strictly made by me, I'll keep my original answer below.

APL (Dyalog Unicode), 14 12 11 bytes
(+/!>×\)⌽∘⍳

Try it online!
Prefix tacit function. Basically a Dyalog port of Jonathan's answer.
Thanks to ngn and H.PWiz for the help in chat. Thanks to ngn also for saving me a byte.
Thanks to Dennis for pointing out that my original code was wrong. Turns out it saved me 2 bytes.
Uses ⎕IO←0.
How:
+/(!>×\)∘⌽∘⍳ ⍝ Tacit function, taking 1 argument (E.g. 5).
           ⍳ ⍝ Range 0 1 2 3 4
         ⌽∘  ⍝ Then reverse, yielding 4 3 2 1 0
  (    )∘    ⍝ Compose with (or: "use as argument for")
   !         ⍝ Factorial (of each element in the vector), yielding 24 6 2 1 1
     ×\      ⍝ Multiply scan. Yields 4 12 24 24 0
    >        ⍝ Is greater than. Yields 1 0 0 0 1
+/           ⍝ Finally, sum the result, yielding 2.

if +/ goes inside the parentheses, one the compositions can be omitted: (+/!>×\)⌽∘⍳

R, 70 41 38 bytes
-29 because Dennis knows all the internal functions
-3 switching to scan() input
sum(prod(x<-scan():1)<=cumprod(1:x)^2)

Try it online!
Pretty simple R implementation of nedla2004's Python3 answer.
I feel like there's a cleaner implementation of the 1-handling, and I'd like to lose the curly-braces.
I'm mad I didn't go back to using a which approach, madder that I used a strict less-than, but even madder still that I didn't know there's a cumprod() function. Great optimisation by Dennis.

Haskell, 52 51 bytes
Using the straightforward approach: We check whether the product of the last \$n\$ numbers, which is \$\frac{x!}{(x-n)!}\$ is less than the product of the first \$n\$ numbers, namely \$(x-n)!\$ and takes the least \$n\$ for which this is true.
g b=product[1..b]
f x=[n|n<-[1..],g(x-n)^2<=g x]!!0

Try it online!

Python 3, 183 176 149 bytes
R=reversed
def M(I,r=1):
 for i in I:r*=i;yield r
def f(x):S=[*range(1,x+1)];return([n for n,a,b in zip([0]+S,R([*M(S)]),[0,*M(R(S))])if b>a]+[x])[0]

Try it online!
It's is a lot faster than some other solutions - 0(N) multiplications instead of O(N²) - but I can't manage to reduce code size.
-27 from Jo King

Jelly, 7 bytes
R!²<!ċ0

Try it online!
How it works
R!²<!ċ0  Main link. Argument: n

R        Range; yield [1, ..., n].
 !       Map factorial over the range.
  ²      Take the squares of the factorials.
    !    Compute the factorial of n.
   <     Compare the squares with the factorial of n.
     ċ0  Count the number of zeroes.

05AB1E, 15 11 bytes
E!IN-!n›iNq

Try it online!
E!IN-!n›iNq

E                For loop with N from [1 ... input]
 !               Push factorial of input
  IN-            Push input - N (x - n)
     !           Factorial
      n          Square
       ›         Push input! > (input - N)^2 or x! > (x - n)^2
        i        If, run code after if top of stack is 1 (found minimum number of candies)
         N       Push N
          q      Quit, and as nothing has been printed, N is implicitly printed

Uses the same approach as my Python submission. Very new to 05AB1E so any tips on code or explaination greatly appreciated.
-4 bytes thanks to Kevin Cruijssen

Nice answer! You can golf 3 bytes like this without breaking input 1. If the if-statement is truthy, it will push index N to the stack and exit the program (outputting that index implicitly). For input 1 the if-statement will be falsey, but it will output its input 1 implicitly after that single-iteration loop.

Actually, 4 bytes can be saved instead of 3: Try it online 11 bytes. The input will be used implicitly for the first factorial !, now that the stack is empty since we no longer duplicate/triplicate the if-result.

Thanks for these ideas. Although I didn't get to this idea of printing at the end, I did think of ending the for loop early. After looking for break, end, quit and escape, I just thought I wasn't understanding the way loops work correctly. Somehow terminate never occured to me.

Your answer was already pretty good. It's usually easier to golf an existing answer further, then to golf it yourself from nothing. If I would have done this challenge myself I probably would have ended up at 15 or 14 bytes as well. I used your idea of breaking and replaced it with a terminate and implicit output instead, after that I tried a few things, and in the end I saw I didn't need the duplicate anymore, which would also fix test case 1 outputting the input implicitly when the stack is empty. :)

FYI: I've posted a 7 bytes alternative by porting Dennis♦' Jelly answer. As always, Dennis♦ is able to perform magic in terms of Jelly code-golfing.. ;p

Clean, 57 bytes
import StdEnv
$x=while(\e=prod[1..x-e]^2>prod[1..x])inc 1

Try it online!
A straight-forward solution.

Jelly, 14 bytes
ạ‘rP>ạ!¥
1ç1#«

Try it online!
Handles 1 correctly.

Charcoal, 20 bytes
ＮθＩ⊕ΣＥθ‹Π⊕…ιθ∨Π…¹⊕ι¹

Try it online! Link is to verbose version of code. Explanation:
Ｎθ                      Input `n`
    Σ                   Sum of
      θ                 `n`
     Ｅ                  Mapped over implicit range
        Π               Product of
           ι            Current value
          …             Range to
            θ           `n`
         ⊕              Incremented
       ‹                Less than
              Π         Product of
                ¹       Literal 1
               …        Range to
                  ι     Current value
                 ⊕      Incremented
             ∨          Logical Or
                   ¹    Literal 1
   ⊕                    Incremented
  Ｉ                     Cast to string
                        Implicitly print

Product on an empty list in Charcoal returns None rather than 1, so I have to logically Or it.

Are you sure these characters are 8 bit each?

@RosLuP Charcoal is one of many languages you might find here that uses a custom code page instead of, say, ASCII. This means that each eight-bit value is mapped to a custom symbol; these symbols are designed to help the programmer remember what each byte does a little easier than if they were just randomly dispersed among one of the standardized code pages. Feel free to ask for more details in the PPCG chat.

C (gcc), 68 bytes
n;f(x){int i=2,j=x,b=1,g=x;while(i<j)b*i>g?g*=--j:(b*=i++);n=x-j+1;}

Try it online!
Edit: trading bytes against mults, no doing 2*x mults instead of x+n
Edit: moving back to int instead of long through macro. Would fail at 34 with long.
Well I have this in C. Fails at 21.
There is a possible ambiguity as to whether the good kid wants to always win or never lose... what do you think?

Typically we don't allow the way you've defined T to be any type. You can get 72 bytes by removing all references to T, but you have to forward declare i/j/b/g still. Try it online!

OK I put back the version with int, which is still 68 bytes. So I was not actually cheating ;)

I'd leave the T version in there as well as an alternative. It's interesting to try out larger/smaller types. Good submission though!

PHP, 107 bytes
<?php $x=fgets(STDIN);function f($i){return $i==0?:$i*f($i-1);}$n=1;while(f($x)<f($x-$n)**2){$n++;}echo $n;

Try it online!
Uses the same \$x^2>((x-1)!)^2\$ method as others have used.
Uses the factorial function from the PHP submission for this challenge (thanks to @donutdan4114)

Wolfram Language (Mathematica), 43 bytes
Min[n/.Solve[#!>(#-n)!^2, Integers]]/.n->1&

Try it online!

05AB1E, 7 bytes
L!ns!@O

Port of Dennis♦' Jelly answer, so make sure to upvote him if you like this answer!
Try it online or verify all test cases.
Explanation:
L          # List in the range [1, (implicit) input]
 !         # Take the factorial of each
  n        # Then square each
   s!      # Take the factorial of the input
     @     # Check for each value in the list if they are larger than or equal to the
           # input-faculty (1 if truthy; 0 if falsey)
      O    # Sum, so determine the amount of truthy checks (and output implicitly)

Japt -x, 7 bytes
Port of Dennis' Jelly solution.
Only works in practice up to n=4 as we get into scientific notation above that.
õÊ®²¨U²

Try it
õ           :Range [1,input]
 Ê          :Factorial of each
  ®         :Map
   ²        :  Square
    ¨       :  Greater than or equal to
     U²     :  Input squared
            :Implicitly reduce by addition

C# (.NET Core), 93 bytes
n=>{int d(int k)=>k<2?1:k*d(k-1);int a=1,b=d(n),c=n;for(;;){a*=n;b/=n--;if(a>=b)return c-n;}}

Try it online!
Based off of @Arnauld's javascript answer.

Python 3, 75 bytes
f=lambda n:n<1or f(n-1)*n
n=lambda x:x-sum(f(n)**2<f(x)for n in range(1,x))

Try it online!
74 bytes version
f=lambda n:n<1or f(n-1)*n
n=lambda x:1+sum(f(n)>f(x)**.5for n in range(x))

but this version overflowed for 500...

source: Stack Exchange

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

sort: votes


text:
Convert to Suzhou numerals
Suzhou numerals (蘇州碼子; also 花碼) are Chinese decimal numerals:
0 〇
1 〡 一
2 〢 二
3 〣 三
4 〤
5 〥
6 〦
7 〧
8 〨
9 〩

They pretty much work like Arabic numerals, except that when there are consecutive digits belonging to the set {1, 2, 3}, the digits alternate between vertical stroke notation {〡,〢,〣} and horizontal stroke notation {一,二,三} to avoid ambiguity. The first digit of such a consecutive group is always written with vertical stroke notation.
The task is to convert a positive integer into Suzhou numerals.
Test cases
1          〡
11         〡一
25         〢〥
50         〥〇
99         〩〩
111        〡一〡
511        〥〡一
2018       〢〇〡〨
123321     〡二〣三〢一
1234321    〡二〣〤〣二〡
9876543210 〩〨〧〦〥〤〣二〡〇

Shortest code in bytes wins.

I've been in Suzhou 3 times for longer period of time (quite a nice city) but didn't know about Suzhou numerals. You have my +1

@ThomasWeller For me it's the opposite: before writing this task I knew what the numerals were, but not that they were named "Suzhou numerals". In fact I've never heard them called this name (or any name at all). I've seen them in markets and on handwritten Chinese medicine prescriptions.

Can you take input in the form of a char array?

@EmbodimentofIgnorance Yes. Well, enough people are taking string input anyway.

Jelly, 35 bytes
9Ḷ;-26ż“/Ẉ8‘+⁽ȷc¤ṃ@ɓD_2ỊŒgÄFị"+⁽-FỌ

Try it online!

JavaScript, 81 bytes
s=>s.replace(/./g,c=>(p=14>>c&!p)|c>3?eval(`"\\u302${c}"`):'〇一二三'[c],p=0)

Try it online!
Using 14>>c saves 3 bytes. Thanks to Arnauld.

R, 138 bytes
I'll bet there's an easier way to do this. Use gsub to get the alternating numeric positions.
function(x,r=-48+~x)Reduce(paste0,ifelse(58<~gsub("[123]{2}","0a",x),"123"["一二三",r],'0-9'["〇〡-〩",r]))
"~"=utf8ToInt
"["=chartr

Try it online!

Retina, 46 bytes
/[1-3]{2}|./_T`d`〇〡-〩`^.
T`123`一二三

Try it online! Link includes test cases. Explanation:
/[1-3]{2}|./

Match either two digits 1-3 or any other digit.
_T`d`〇〡-〩`^.

Replace the first character of each match with its Suzhou.
T`123`一二三

Replace any remaining digits with horizontal Suzhou.
51 bytes in Retina 0.8.2:
M!`[1-3]{2}|.
mT`d`〇〡-〩`^.
T`¶123`_一二三

Try it online! Link includes test cases. Explanation:
M!`[1-3]{2}|.

Split the input into individual digits or pairs of digits if they are both 1-3.
mT`d`〇〡-〩`^.

Replace the first character of each line with its Suzhou.
T`¶123`_一二三

Join the lines back together and replace any remaining digits with horizontal Suzhou.

Perl 5 -pl -Mutf8, 53 46 bytes
-7 bytes thanks to Grimy
s/[123]{2}|./OS&$&/ge;y//〇〡-〰一二三/c

Try it online!
Explanation
# Binary AND two consecutive digits 1-3 (ASCII 0x31-0x33)
# or any other single digit (ASCII 0x30-0x39) with string "OS"
# (ASCII 0x4F 0x53). This converts the first digit to 0x00-0x09
# and the second digit, if present, to 0x11-0x13.
s/[123]{2}|./OS&$&/ge;
# Translate empty complemented searchlist (0x00-0x13) to
# respective Unicode characters.
y//〇〡-〰一二三/c

-3 bytes with s/[123]\K[123]/$&^$;/ge;y/--</一二三〇〡-〩/ (TIO)

49: s/[123]{2}/$&^v0.28/ge;y/--</一二三〇〡-〩/ (TIO).
48: s/[123]{2}/$&^"\0\34"/ge;y/--</一二三〇〡-〩/ (requires using literal control characters instead of \0\34, idk how to do this on TIO)

46: s/[123]{2}|./OS&$&/ge;y//〇〡-〰一二三/c (TIO)

Java (JDK), 120 bytes
s->{for(int i=0,p=0,c;i<s.length;)s[i]+=(p>0&p<4&(c=s[i++]-48)>0&c<4)?"A䷏乚䷖".charAt(c+(p=0)):(p=c)<1?12247:12272;}

Try it online!
Credits

-3 bytes thanks to Kevin Cruijssen

c=s[i]-48;if(p>0&p<4&c>0&c<4) can be if(p>0&p<4&(c=s[i]-48)>0&c<4), and then you can also drop the brackets around the loop. Also, else{p=c;s[i]+=c<1?12247:12272;} can be else s[i]+=(p=c)<1?12247:12272;

@KevinCruijssen Thank you! I was still golfing this answer, but it helped me nonetheless ^^ Now I think I'm done golfing it.

JavaScript (ES6),  95 89  88 bytes
Saved 6 bytes thanks to @ShieruAsakoto
Takes input as a string.
s=>s.replace(i=/./g,c=>'三二一〇〡〢〣〤〥〦〧〨〩'[i=112>>i&c<4?3-c:+c+3])

Try it online!

89 bytes

@ShieruAsakoto That's much better! Thanks a lot!

Python 3, 102 bytes
f=0
for i in input():f=i in'123'and 9-f;print(end='〇一二三〤〥〦〧〨〩〡〢〣'[int(i)+f])

Try it online!
mypetlion reminded me of a trivial golf. -4 bytes.

Clean, 181 165 bytes
All octal escapes can be replaced by the equivalent single-byte characters (and are counted as one byte each), but used for readability and because otherwise it breaks TIO and SE with invalid UTF-8.
import StdEnv
u=map\c={'\343','\200',c}
?s=((!!)["〇":s++u['\244\245\246\247\250']])o digitToInt
$[]=[]
$[h:t]=[?(u['\241\242\243'])h:if(h-'1'<'\003')f$t]
f[]=[]
f[h:t]=[?["一","二","三"]h: $t]

Try it online!
An encoding-unaware compiler is both a blessing and a curse.

Red, 198 171 bytes
func[n][s: charset"〡〢〣"forall n[n/1: either n/1 >#"0"[to-char 12272 + n/1][#"〇"]]parse
n[any[[s change copy t s(pick"一二三"do(to-char t)- 12320)fail]| skip]]n]

Try it online!

Jelly, 38 bytes
9Rż“øƓ“œ%“øƈ’;-25+⁽-EỌœị@DżD<4«Ɗ‘×¥\ƊƊ

Try it online!

C, 131 bytes
f(char*n){char*s="〇〡〢〣〤〥〦〧〨〩一二三",i=0,f=0,c,d;do{c=n[i++]-48;d=n[i]-48;printf("%.3s",s+c*3+f);f=c*d&&(c|d)<4&&!f?27:0;}while(n[i]);}

Try it online!
Explanation:
First of all - I'm using char for all variables to make it short.
Array s holds all needed Suzhou characters.
The rest is pretty much iterating over the provided number, which is expressed as a string.
When writing to the terminal, I'm using the input number value (so the character - 48 in ASCII), multiplied by 3, because all these characters are 3 bytes long in UTF-8.
The 'string' being printed is always 3 bytes long - so one real character.
Variables c and d are just 'shortcuts' to current and next input character(number).
Variable f holds 0 or 27 - it says if the next 1/2/3 character should be shifted to alternative one - 27 is the offset between regular and alternative character in the array.
f=c*d&&(c|d)<4&&!f?27:0 - write 27 to f if c*d != 0 and if they are both < 4 and if f isn't 0, otherwise write 0.
Could be rewritten as:
if( c && d && c < 4 && d < 4 && f == 0)
f = 27
else
f = 0

Maybe there are some bytes to shave off, but I'm no longer able to find anything obvious.

120 bytes.

Perl 6 -p, 85 61 bytes
-13 bytes thanks to Jo King
s:g[(1|2|3)<((1|2|3)]=chr $/+57;tr/0..</〇〡..〩一二三/

Try it online!

Ruby -p, 71 bytes
$_=gsub(/[1-3]\K[1-3]/){|x|(x.ord+9).chr}.tr"0-<","〇〡-〩一二三"

Try it online!

K (ngn/k), 67 bytes
{,/(0N 3#"〇一二三〤〥〦〧〨〩〡〢〣")x+9*<\x&x<4}@10\

Try it online!
10\ get list of decimal digits
{ }@ apply the following function
x&x<4 boolean (0/1) list of where the argument is less than 4 and non-zero
<\ scan with less-than. this turns runs of consecutive 1s into alternating 1s and 0s
x+9* multiply by 9 and add x
juxtaposition is indexing, so use this as indices in...
0N 3#"〇一二三〤〥〦〧〨〩〡〢〣" the given string, split into a list of 3-byte strings. k is not unicode aware, so it sees only bytes
,/ concatenate

Wolfram Language (Mathematica), 117 bytes
FromCharacterCode[12320+(IntegerDigits@#/. 0->-25//.MapIndexed[{a___,c=#2[[1]],c,b___}->{a,c,#,b}&,{0,140,9}+7648])]&

Try it online!
Note that on TIO this outputs the result in escaped form.  In the normal Wolfram front end, it will look like this:

Can you implement horizontal stroke notation for twos and threes? E.g. f[123] should return 〡二〣.

C# (.NET Core), 107 bytes, 81 chars
n=>{var t="〇一二三〤〥〦〧〨〩〡〢〣";var b=0;return n.Select(k=>t[k+(b+=k>0&k<4?1:b)%2*9]);}

Try it online!
Saved 17 bytes thanks to @Jo King
Old Answer
C# (.NET Core), 124 bytes, 98 chars
n=>{var t="〇一二三〤〥〦〧〨〩〡〢〣";var b=0<1;return n.Select(k=>{b=k>0&k<4?!b:0<1;return b?t[k]:t[k+9];});}

Try it online!
Takes input in the form of a List, and returns an IEnumerable. I don't know if this input/output is ok, so just let me know if it isn't.
Explanation
How this works is that it transforms all the integers to their respective Suzhou numeral form, but only if variable b is true. b is inverted whenever we meet an integer that is one, two, or three, and set to true otherwise. If b is false, we turn the integer to one of the vertical numerals.

C#, 153 bytes
n=>Regex.Replace(n+"",@"[4-90]|[1-3]{1,2}",x=>"〇〡〢〣〤〥〦〧〨〩"[x.Value[0]-'0']+""+(x.Value.Length>1?"一二三"[x.Value[1]-'0'-1]+"":""))

Try it online!

This is 153 bytes, by the way, characters don't always mean bytes. Some characters are worth multiple bytes.

Oh well, I edited my answer. Thanks for the information :)

Japt, 55 bytes
s"〇〡〢〣〤〥〦〧〨〩"
ð"[〡〢〣]" óÈ¥YÉÃ®ë2,1Ãc
£VøY ?Xd"〡一〢二〣三":X

Try it online!
It's worth noting that TIO gives a different byte count than my preferred interpreter, but I see no reason not to trust the one that gives me a lower score.
Explanation:
    Step 1:
s"〇〡〢〣〤〥〦〧〨〩"        Convert the input number to a string using these characters for digits

    Step 2:
ð                            Find all indexes which match this regex:
 "[〡〢〣]"                    A 1, 2, or 3 character
           ó    Ã            Split the list between:
            È¥YÉ              Non-consecutive numbers
                  ®    Ã     For each group of consecutive [1,2,3] characters:
                   ë2,1      Get every-other one starting with the second
                        c    Flatten

    Step 3:
£                              For each character from step 1:
 VøY                           Check if its index is in the list from step 2
     ?                         If it is:
      Xd"〡一〢二〣三"            Replace it with the horizontal version
                     :X        Otherwise leave it as-is

R, 104 bytes
function(x,`[`=chartr)"a-jBCD"["〇〡-〩一二三",gsub("[bcd]\\K([bcd])","\\U\\1","0-9"["a-j",x],,T)]

Try it online!
An alternative approach in R. Makes use of some Perl-style Regex features (the last T param in substitution function stands for perl=TRUE).
First, we translate numerals to alphabetic characters a-j, then use Regex substitution to convert duplicate occurrences of bcd (formerly 123) to uppercase, and finally translate characters to Suzhou numerals with different handling of lowercase and uppercase letters.
Credit to J.Doe for the preparation of test cases, as these were taken from his answer.

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


text:
Sino-Korean numerals
The Korean language has two sets of numerals, a native Korean numerals and Sino-Korean numerals.
The native Korean numerals are mostly used for numbers under 100, such as age and time.
The Sino-Korean numeral system, which is based on the Chinese numeral system as its name says, is used in most of the time.
It uses 4-digit group system rather than western 3-digit group system. For example, 123456789 can be grouped into 1, 2345, 6789 in Sino-Korean system.
All 4 digits in group have their own place names.

Thousands: 천
Hundreds: 백
Tens: 십
Ones: 일, but not used.

Also, for every 4 digits, suffixes are coming along with numbers.

10^0: none, obviously.
10^4: 만
10^8: 억
10^12: 조
10^16: 경
10^20: 해
...

So, the number '123456789' in Sino-Korean is "일억 이천삼백사십사만 육천칠백팔십구".
Goal and Rules
Your goal is to convert given integer to Sino-Korean numeral.

Numbers are grouped into 4 digits from behind.
Whitespaces are inserted every 4 digits (from behind).

4321 -> 사천삼백이십일
  30723231 -> 삼천칠십이만 삼천이백삼십일

'일'(1) is omitted except if it is last digit of its group.

1111 -> 천백십일 (not 일천일백일십일)
  137161293 -> 일억 삼천칠백십육만 천이백구십삼

There is only one exception, 10000 is not "일만", but "만".

18210 -> 1 8210 -> 만 팔천이백십 (not 일만 팔천이백십)

Standard code-golf rules are applied.

Table of Sino-Korean Digits
+-------+-------------+
| Digit | Sino-Korean |
+-------+-------------+
|     0 |          영 |
|     1 |          일 |
|     2 |          이 |
|     3 |          삼 |
|     4 |          사 |
|     5 |          오 |
|     6 |          육 |
|     7 |          칠 |
|     8 |          팔 |
|     9 |          구 |
+-------+-------------+

Input and Output
Input is integer \$N, 0 \leq N < 10^{24}\$
Output is UTF-8 formatted Sino-Korean numeral.
Examples

(Input) -> (Output)
0 -> 영
1 -> 일
10 -> 십
101 -> 백일
301821 -> 삼십만 천팔백이십일
10282714472 -> 백이억 팔천이백칠십일만 사천사백칠십이
999999999999999999999999 -> 구천구백구십구해 구천구백구십구경 구천구백구십구조 구천구백구십구억 구천구백구십구만 구천구백구십구

This is code-golf, so shortest code in bytes wins.

1111 -> 천백십일 (not 일천일백일십일) but Firefox show the second one for 1111 codepen

@tsh Forms like "일천일백일십일" can be used but only in special areas like finance for prevent counterfeit. It is omitted in daily life usage.


text:
How many syllables in that number?
I'd love to take a number and know how many syllables are in it, when spoken in English.
Let's limit this to positive integers which are less than one thousand.
I'm British, so we're going to follow the hundreds column with an 'and' when there are any non-zero digits after it.
The Challenge

Write some code which will accept a positive integer lower than 1000 and output the number of syllables in the words which represent that number in British English.
It DOES NOT need to generate the words to represent the numbers, only the number of syllables they contain.
It's code golf, attempt to achieve this in the fewest bytes.
Use any language you like.
The standard loopholes are forbidden.

Test Cases
|  N  | In words                             | Syllables |
|   1 | one                                  |         1 |
|   2 | two                                  |         1 |
|   3 | three                                |         1 |
|   4 | four                                 |         1 |
|   5 | five                                 |         1 |
|   6 | six                                  |         1 |
|   7 | sev-en                               |         2 |
|   8 | eight                                |         1 |
|   9 | nine                                 |         1 |
|  10 | ten                                  |         1 |
|  11 | el-ev-en                             |         3 |
|  12 | twelve                               |         1 |
|  13 | thir-teen                            |         2 |
|  14 | four-teen                            |         2 |
|  17 | se-ven-teen                          |         3 |
|  20 | twen-ty                              |         2 |
|  21 | twen-ty one                          |         3 |
|  42 | four-ty two                          |         3 |
|  73 | sev-en-ty three                      |         4 |
|  77 | sev-en-ty sev-en                     |         5 |
| 100 | one hund-red                         |         3 |
| 110 | one hund-red and ten                 |         5 |
| 111 | one hund-red and el-ev-en            |         7 |
| 555 | five hund-red and fif-ty five        |         7 |
| 700 | sev-en hund-red                      |         4 |
| 770 | sev-en hund-red and sev-en-ty        |         8 |
| 777 | sev-en hund-red and sev-en-ty sev-en |        10 |
| 999 | nine hund-red and nine-ty nine       |         7 |

Can we take input as a string or an array of digits?

Python 2, 84 83 74 67 bytes
lambda n:4*(n>99)+2-n%~9/9-0x55561aaaab/4**(n%100)%4+`n`.count('7')

Thanks to @xnor for golfing off 9 16 bytes!
Try it online!

Python 2, 79 bytes
lambda n:4*(n>99)+([-1]+10*[1]+[3,1]+7*[2]+8*([2]+9*[3]))[n%100]+`n`.count('7')

Straightforward, but longer.
Try it online!

For your 83-byte solution, you can cut 3 bytes by changing -10 to ~9 and switching around the last bit to +(0<n%100!=12)-(n%100!=11), but that's still longer than your new solution.

Here we go: lambda n:4*(n>99)+`n`.count('7')+cmp(n/10%10,1)-n%~9/9-min(n%100,13)%12/~9

@xnor That's really clever! min(n%100,13)%12/~9 might actually help with an approach I was trying for my Jelly answer as well.

Actually, just shoving things into a hardcoded constant turns out shorter.

@xnor Thanks again!

Perl 5 -p, 53 51 bytes
$_=4*/.../+2*/[^0].$/+!/0$/+y/7//-/1[^1]$/-/00|12$/

Try it online!
How
-p commandline flag reads input into $_

$_=4*/.../     # Hundreds place has minimum of 4 sylables (__ HUN-DRED AND),
               # match fails on number <100, and would add 0 here
  +2*/[^0].$/  # Tens place has two syllables if not 0 (__-TY or __TEEN),
               # match fails on numbers <10, and would add 0
  +!/0$/       # Ones place has one syllable if not 0 (__)
               # -- Now adjust for special cases --
  +y/7//       # add a syllable for every 7 present
  -/1[^1]$/    # remove a syllable for 10-19, except 11
  -/00|12$/    # remove the syllable for AND if it's an even hundred
               # OR remove another syllable for 12

-p commandline flag outputs contents of $_

Python 2, 112 108 bytes
f=lambda n:n>99and f(n/100)+3+f(n%100)-(n%100<1)or n>19and f(n/10)-~f(n%10)or int("01111112111312222322"[n])

Try it online!
-4 bytes, thanks to Shaggy

Also, your [2]*7 part will fail for 17, since that should be 3 instead of 2 (sev-en-teen).

-4 bytes, including a fix for 17.

@KevinCruijssen Fixed now (thanks to Shaggy)

JavaScript (ES6), 89 bytes
n=>(s='01111112111312222322',n>99&&+s[n/100|0]+3-!(n%=100))+~~(s[n]||+s[n/10|0]-~s[n%10])

Try it online!

JavaScript, 86 84 bytes
A tweaked port of TFeld's Python solution.
f=n=>n>99?f(n/100)+3+f(n%=100)-!n:n>19?f(n/10)-~f(n%10):+"01111112111312222322"[n|0]

Try it online
2 bytes saved thanks to Arnauld

Java 11, 105 102 bytes
n->(""+"".repeat(8)).charAt(n%100)+(n+"").split("7",9).length-(n>99?2:6)
Contains loads of unprintable characters.
-3 bytes thanks @OlivierGrégoire.
Try it online.
Explanation:

n->               // Method with integer as both parameter and return-type
  (""
                  //  Push string with ASCII-value digits 46666666666867777777
 +"".repeat(8))
                  //  Appended with 8 times a string with ASCII-value digits 7888888888
   .charAt(n%100) //  Take the (input modulo-100)'th character of this string (as integer)
  +(n+"").split("7",9).length
                  //  Count the amount of 7s in the input + 1
  -(n>99?         //  And if the input is larger than 99:
     2            //   Subtract 2 (-1 for the 7s+1 count; -5 to map the ASCII-digits to:
                  //               4 → -1; 6 → 1; 7 → 2; 8 → 3;
                  //               and +4 for the inputs above 99)
    :             //  Else:
     6)           //   Subtract 6 (-1 for the 7s+1 count and -5 to map the ASCII-digits to:
                  //               4 → -1; 6 → 1; 7 → 2; 8 → 3)

102 bytes by changing .split("7",-1) to .split("7",9), and -6+(n>99?4:0) to -(n>99?2:6).

@OlivierGrégoire Thanks. Completely missed -(n>99?2:6), but it's so obvious now that you've pointed it out. And -1 to 9 due to the limited input-size I wouldn't have thought of, so thanks!

Wolfram Language 101 115 Bytes
s=StringSplit;Length[Join@@(WordData[#,"Hyphenation"]&/@Join@@s/@
s[IntegerName@#,"-"])]+Boole[#>100&&#~Mod~100!=0]&

Explanation
(substituting StringSplit for s)
Length[Join@@(WordData[#,"Hyphenation"]&/@Join@@
StringSplit/@ StringSplit[IntegerName@#,"-"])]+Boole[#>100&&#~Mod~100!=0]&

IntegerName renders the number in American English (i.e. without "and" included in numbers greater than 100.) E.g. 777-> "seven hundred seventy-seven.
StringSplit[IntegerName@#,"-"] removes any hyphens in the rendering.
StringSplit/@ splits the rendering into words.
Join@@ leaves a simple list of words, without embedded list (in the case that a hyphen appeared).
WordData[#,"Hyphenation"] breaks up a single word into its syllables.
Join@@ leaves a simple list of syllables in all of the words.
Length counts the syllables
+Boole[#>100&&#~Mod~100!=0] adds 1 to the syllable count for those numbers greater than 100 (because of the additional "and" employed in the British English rendering), excluding integral multiples of 100.

05AB1E, 34 31 bytes
т%U7¢I€Ā`Iт@3*X_(X20@X12Q(X11QO

Try it online or verify all [1,999] test cases.
Explanation:
With all checks mentioned it will result in 1 for truthy and 0 for falsey.
т%         # Take modulo-100 of the (implicit) input
           #  i.e. 710 → 10
  U        # Pop and store it in variable `X`
7¢         # Count the amount of 7s in the (implicit) input
           #  i.e. 710 → 1
I€Ā        # Trutify each digit in the input (0 if 0; 1 otherwise)
   `       # And push all of the mapped values to the stack
           #  i.e. 710 → [1,1,0]
Iт@        # Check if the input is larger than or equal to 100
           #  i.e. 710 → 1 (truthy)
   3*      # Multiply that result by 3 (for 'hund-red and')
           #  i.e. 1 → 3
X_         # Check if variable `X` is 0
           #  i.e. 10 → 0 (falsey)
  (        # And negate that (to remove 'and' when #00)
           #  i.e. 0 → 0
X20@       # Check if variable `X` is larger than or equal to 20 (for '-ty')
           #  i.e. 10 → 0 (falsey)
X12Q       # Check if variable `X` is exactly 12
           #  i.e. 10 → 0 (falsey)
    (      # And negate that (to remove 'teen')
           #  i.e. 0 → 0
X11Q       # Check if variable `X` is exactly 11 (for 'el-ev-en' minus 'one one')
           #  i.e. 10 → 0 (falsey)
O          # Sum everything on the stack (and output implicitly)
           #  i.e. [1,1,1,0,3,0,0,0,0] → 6

This fails the 700 test case. 'Seven Hundred' has 4 syllables, this returns 5.

@AJFaraday Should be fixed now. Accidentally had I (input) instead of X (input mod 100) when checking if it's larger than 20 for the +1 of ty.

I'm so sorry, it returns 0 for 'one hundred'

@AJFaraday Fixed again.. > (check if input is larger than 100) has been replaced with @ (check if input is larger than or equal to 100). Maybe I should have checked some more test cases myself more carefully before posting.. Sorry about that..

That works, Sorry. I feel so unkind finding those issues.

@AJFaraday No no, I'm glad you found them. I would feel bad for posting a solution which contained errors and someone finds out a couple of weeks later.. I'm glad you're testing everything so carefully! Should have done so myself some more.. Thanks! Will add an explanation soon.

By the way, loving the top hat on a rubix cube!

Jelly, 28 25 23 bytes
9ḊŻ;2+⁵Żċ%ȷ2$ạDṠḄƊ+Dċ7Ɗ

Try it online!
How it works
9ḊŻ;2+⁵Żċ%ȷ2$ạDṠḄƊ+Dċ7Ɗ  Main link. Argument: n (integer in [1, ..., 999])

9                        Set the return value to 9.
 Ḋ                       Dequeue; yield [2, 3, 4, 5, 6, 7, 8, 9].
  Ż                      Zero; yield [0, 2, 3, 4, 5, 6, 7, 8, 9].
   ;2                    Concat 2, yield [0, 2, 3, 4, 5, 6, 7, 8, 9, 2].
     +⁵                  Add 10; yield [10, 12, 13, 14, 15, 16, 17, 18, 19, 12].
       Ż                 Zero; yield [0, 10, 12, 13, 14, 15, 16, 17, 18, 19, 12].
         %ȷ2$            Yield n % 1e2.
        ċ                Count the occurrences of the modulus in the array.
                 Ɗ       Combine the three links to the left into a monadic chain.
              D            Decimal; convert n to its array of digits in base 10.
               Ṡ             Take the sign of each decimal digit (0 or 1).
                Ḅ            Convert the array of signs from base 2 to integer.
             ạ           Compute the abs. difference of the results to both sides.
                      Ɗ  Combine the three links to the left into a monadic chain.
                   D       Decimal; convert n to its array of digits in base 10.
                    ċ7     Count the number of 7's.

Charcoal, 39 31 bytes
Ｉ⁻⁺↨Ｅθ¬¬Ｉι²№θ7Ｉ§⁺”)∨∧⌈a¡↶”×0⁸⁰Ｎ

Try it online! Link is to verbose version of code. Explanation:
Ｉ⁻⁺

Calculate adjustments to the number of syllables and output the result as a string.
↨Ｅθ¬¬Ｉι²

Start by changing each non-zero digit to 1 and then decoding as base 2. This gives the correct answer for most inputs.
№θ7

Add 1 for each 7.
Ｉ§⁺”)∨∧⌈a¡↶”×0⁸⁰Ｎ

Take the literal string 10000000001021111111 and append 80 zeros, then cyclically index by the input, and subtract that digit.

PHP, 190 158 145 141 137 bytes
<?for($j=$p=0;$p<strlen($i=$argv[1]);)$j+=str_split($i)[$p++]>0;echo$j+substr_count($i,7)+3*($i>99)-!($i%=100)+($i>19)-($i==12)+($i==11);

Try it online!
A port of Kevin Cruijssen's solution (unfortunately it doesn't have the same brevity in PHP :) )
-32 45 thanks to Shaggy!
-3 thanks to Kevin Crujissen!

So many savings to be made here! Here's just a few very quick ones

145 bytes. You can save a few more bytes using short tags but I can't remember how to use them on TIO. (Note: I'm on my phone so haven't tested all inputs.)

@Shaggy 2 more bytes can be changed when using >99 and >19 instead of >=100 and >=20.

@KevinCruijssen actually that saves 3 bytes because it it going from 100 to 99 :)

I also managed to save another byte by placing the variable at the start of the echo.

I found that to use short tags add the command line option -d short_open_tag=On for -4 bytes

05AB1E, 24 bytes
Port of Dennis' jelly answer
8L>Ć¾šT+¾šsт%¢sSĀJCαs7¢+

Try it online!
or as a Test suite
Explanation
8L>                       # push range [2 ... 9]
   Ć                      # enclose, append head
    ¾š                    # prepend 0
      T+                  # add 10 to each
        ¾š                # prepend 0
          sт%¢            # count occurrences of input % 100 in this list
              sS          # push input split into a list of digits
                Ā         # truthify, check each if greater than 0
                 JC       # convert from base-2 to base-10
                   α      # absolute difference
                    s7¢+  # add the amount of 7's in the input

05AB1E, 26 bytes
€ĀJCI7¢•Ž¢Γ}Þ±6u•¾80×«Iè(O

Port of @Neil's Charcoal answer, so make sure to upvote him as well if you like this answer!
Try it online or verify all test cases.
Compressed integer •Ž¢Γ}Þ±6u• can alternatively be •8JA•b2TÌǝ for the same byte-count.
Explanation:
€Ā                   # Trutify every digit in the (implicit) input
                     # (0 remains 0; everything else becomes 1)
  J                  # Join it together to a single string
   C                 # Convert from binary to integer
I7¢                  # Count the amount of 7s in the input
•Ž¢Γ}Þ±6u•           # Push compressed integer 10000000001021111111
          ¾80×«      # Append 80 "0"s
               Iè    # Index the integer (with automatic wraparound) into it
                 (   # Negate the result
O                    # Sum all values on the stack (and output implicitly)

See this 05AB1E answer of mine (section How to compress large integers?) to understand why •Ž¢Γ}Þ±6u• is 10000000001021111111.


text:
Standardize the Samples (Compute the z-Score)
Given a list of floating point numbers, standardize it.
Details

A list \$x_1,x_2,\ldots,x_n\$ is standardized if the mean of all values is 0, and the standard deviation is 1. One way to compute this is by first computing the mean \$\mu\$ and the standard deviation \$\sigma\$ as
$$ \mu = \frac1n\sum_{i=1}^n x_i \qquad \sigma = \sqrt{\frac{1}{n}\sum_{i=1}^n (x_i -\mu)^2} ,$$
and then computing the standardization by replacing every \$x_i\$ with \$\frac{x_i-\mu}{\sigma}\$.
You can assume that the input contains at least two distinct entries (which implies \$\sigma \neq 0\$).
Note that some implementations use the sample standard deviation, which is not equal to the population standard deviation \$\sigma\$ we are using here.
There is a CW answer for all trivial solutions.

Examples
[1,2,3] -> [-1.224744871391589,0.0,1.224744871391589]
[1,2] -> [-1,1]
[-3,1,4,1,5] -> [-1.6428571428571428,-0.21428571428571433,0.8571428571428572,-0.21428571428571433,1.2142857142857144]

(These examples have been generated with this script.)

R, 51 45 38 37 bytes
Thanks to Giuseppe and J.Doe!

function(x)scale(x)/(1-1/sum(x|1))^.5

Try it online!

Beat me by 2 bytes and 1 minute

CW for all trivial entries

Python 3 + scipy, 31 bytes
from scipy.stats import*
zscore

Try it online!
Octave / MATLAB, 15 bytes
@(x)zscore(x,1)

Try it online!

APL (Dyalog Classic), 21 20 19 bytes
(-÷.5*⍨⊢÷⌹×≢)+/-⊢×≢

Try it online!
⊢÷⌹ is sum of squares
⊢÷⌹×≢ is sum of squares divided by length

Wow. I shouldn't be surprised anymore, but I am every time

APL+WIN, 41,32 30 bytes
9 bytes saved thanks to Erik + 2 more thanks to ngn
x←v-(+/v)÷⍴v←⎕⋄x÷(+/x×x÷⍴v)*.5

Prompts for vector of numbers and calculates mean standard deviation and standardised elements of input vector

Can't you assign x←v-(+/v)÷⍴v←⎕ and then do x÷((+/x*2)÷⍴v)*.5?

I can indeed. Thanks.

does apl+win do singleton extension (1 2 3+,4 ←→ 1 2 3+4)? if yes, you could rewrite (+/x*2)÷⍴v as +/x×x÷⍴v

@ngn That works for another 2 bytes. Thanks.

MATL, 10 bytes
tYm-t&1Zs/

Try it online!
Explanation
t       % Implicit input
        % Duplicate
Ym      % Mean
-       % Subtract, element-wise
t       % Duplicate
&1Zs    % Standard deviation using normalization by n
/       % Divide, element-wise
        % Implicit display

R + pryr, 53 52 bytes
-1 byte using sum(x|1) instead of length(x) as seen in @Robert S.'s solution
pryr::f((x-(y<-mean(x)))/(sum((x-y)^2)/sum(x|1))^.5)

For being a language built for statisticians, I'm amazed that this doesn't have a built-in function. At least not one that I could find. Even the function mosaic::zscore doesn't yield the expected results. This is likely due to using the population standard deviation instead of sample standard deviation.
Try it online!

You can change the <- into a = to save 1 byte.

@J.Doe nope, I used the method I commented on Robert S.'s solution. scale is neat!

@J.Doe since you only use n once you can use it directly for 38 bytes

@Giuseppe Wouldn't you be able to use pryr::f, it would implicitly guess your x, saving 2 bytes? Also, if I include the R + pryr, do we really need to use pryr::?

@Sumner18 the pryr:: is part of the code, the "+ pryr" is just to indicate that you are using an R package instead of base R for your answer. It's more of a Code Golf rules thing.

@J.Doe Is the extra output created from the scale function allowed? Or would that be up to the creator of the challenge?

@RobertS. here on PPCG we tend to encourage allowing flexible input and output, including outputting more than is required, with the exception of challenges where the precise layout of the output is the whole point of the challenge.

Of course R built-ins wouldn't use "population variance". Only confused engineers would use such a thing (hencethe Python and Matlab answers ;))

Tcl, 126 bytes
proc S L {lmap c $L {expr ($c-[set m ([join $L +])/[set n [llength $L]].])/sqrt(([join [lmap c $L {expr ($c-$m)**2}] +])/$n)}}

Try it online!

APL (Dyalog Unicode), 33 29 bytes
{d÷.5*⍨l÷⍨+/×⍨d←⍵-(+/⍵)÷l←≢⍵}

-4 bytes thanks to @ngn
Try it online!

you could assign ⍵-m to a variable and remove m← like this: {d÷.5*⍨l÷⍨+/×⍨d←⍵-(+/⍵)÷l←≢⍵}

@ngn Ah, nice, thanks, I didn't see that duplication somehow

Jelly, 10 bytes
_ÆmµL½÷ÆḊ×

Try it online!
It's not any shorter, but Jelly's determinant function ÆḊ also calculates vector norm.
_Æm             x - mean(x)
   µ            then:
    L½          Square root of the Length
      ÷ÆḊ       divided by the norm
         ×      Multiply by that value

Hey, nice alternative! Unfortunately, I can't see a way to shorten it.

Mathematica, 25 bytes
Mean[(a=#-Mean@#)a]^-.5a&

Pure function. Takes a list of numbers as input and returns a list of machine-precision numbers as output. Note that the built-in Standardize function uses the sample variance by default.

J, 22 bytes
-1 byte thanks to Cows quack!
(-%[:%:1#.-*-%#@[)+/%#

Try it online!
J, 31 23 bytes
(-%[:%:#@[%~1#.-*-)+/%#

Try it online!
                   +/%# - mean (sum (+/) divided (%) by the number of samples (#))
(                 )     - the list is a left argument here (we have a hook)
                 -      - the difference between each sample and the mean
                *       - multiplied by
               -        - the difference between each sample and the mean
            1#.         - sum by base-1 conversion
          %~            - divided by
       #@[              - the length of the samples list
     %:                 - square root
   [:                   - convert to a fork (function composition)
 -                      - subtract the mean from each sample
  %                     - and divide it by sigma

Rearranging it gives 22 [:(%[:%:1#.*:%#)]-+/%# https://tio.run/##y/qfVmyrp2CgYKVg8D/aSkM12krVylBZT8tKVVkzVldbX1X5vyaXkp6CepqtnrqCjkKtlUJaMRdXanJGvkKagqGCkYIxEgfGjDcG8kyA2PQ/AA, I think one of those caps could be removed, but haven't had any luck so far, EDIT: a more direct byteshaving is (-%[:%:1#.-*-%#@[)+/%# also at 22

@Cows quack Thanks!

Haskell, 80 75 68 bytes
t x=k(/sqrt(f$sum$k(^2)))where k g=g.(-f(sum x)+)<$>x;f=(/sum(1<$x))

Thanks to @flawr for the suggestions to use sum(1<$x) instead of sum[1|_<-x] and to inline the mean, @xnor for inlining the standard deviation and other reductions.
Expanded:
-- Standardize a list of values of any floating-point type.
standardize :: Floating a => [a] -> [a]
standardize input = eachLessMean (/ sqrt (overLength (sum (eachLessMean (^2)))))
  where

    -- Map a function over each element of the input, less the mean.
    eachLessMean f = map (f . subtract (overLength (sum input))) input

    -- Divide a value by the length of the input.
    overLength n = n / sum (map (const 1) input)

You can replace [1|_<-x] with (1<$x) to save a few bytes. That is a great trick for avoiding the fromIntegral, that I haven't seen so far!

By the way: I like using tryitonline, you can run your code there and then copy the preformatted aswer for posting here!

And you do not have to define m.

You can write (-x+) for (+(-x)) to avoid parens. Also it looks like f can be pointfree: f=(/sum(1<$x)), and s can be replaced with its definition.

@xnor Ooh, (-x+) is handy, I’m sure I’ll be using that in the future

MathGolf, 7 bytes
▓-_²▓√/

Try it online!
Explanation
This is literally a byte-for-byte recreation of Kevin Cruijssen's 05AB1E answer, but I save some bytes from MathGolf having 1-byters for everything needed for this challenge. Also the answer looks quite good in my opinion!
▓         get average of list
 -        pop a, b : push(a-b)
  _       duplicate TOS
   ²      pop a : push(a*a)
    ▓     get average of list
     √    pop a : push(sqrt(a)), split string to list
      /   pop a, b : push(a/b), split strings

Jelly, 10 bytes
_Æm÷²Æm½Ɗ$

Try it online!

JavaScript (ES7),  80  79 bytes
a=>a.map(x=>(x-g(a))/g(a.map(x=>(x-m)**2))**.5,g=a=>m=eval(a.join`+`)/a.length)

Try it online!
Commented
a =>                      // given the input array a[]
  a.map(x =>              // for each value x in a[]:
    (x - g(a)) /          //   compute (x - mean(a)) divided by
    g(                    //   the standard deviation:
      a.map(x =>          //     for each value x in a[]:
        (x - m) ** 2      //       compute (x - mean(a))²
      )                   //     compute the mean of this array
    ) ** .5,              //   and take the square root
    g = a =>              //   g = helper function taking an array a[],
      m = eval(a.join`+`) //     computing the mean
          / a.length      //     and storing the result in m
  )                       // end of outer map()

Charcoal, 25 19 bytes
≧⁻∕ΣθＬθθＩ∕θ₂∕ΣＸθ²Ｌθ

Try it online! Link is to verbose version of code. Explanation:
       θ    Input array
≧           Update each element
 ⁻          Subtract
   Σ        Sum of
    θ       Input array
  ∕         Divided by
     Ｌ      Length of
      θ     Input array

Calculate \$\mu\$ and vectorised subtract it from each \$x_i\$.
  θ         Updated array
 ∕          Vectorised divided by
   ₂        Square root of
     Σ      Sum of
       θ    Updated array
      Ｘ     Vectorised to power
        ²   Literal 2
    ∕       Divided by
         Ｌ  Length of
          θ Array
Ｉ           Cast to string
            Implicitly print each element on its own line.

Calculate \$\sigma\$, vectorised divide each \$x_i\$ by it, and output the result.
Edit: Saved 6 bytes thanks to @ASCII-only for a) using SquareRoot() instead of Power(0.5) b) fixing vectorised Divide() (it was doing IntDivide() instead) c) making Power() vectorise.

crossed out 25 = no bytes? :P (Also, you haven't updated the TIO link yet)

@ASCII-only Oops, thanks!

Julia 0.7, 37 bytes
a->(a-mean(a))/std(a,corrected=false)

Try it online!

K (oK), 33 23 bytes
-10 bytes thanks to ngn!
{t%%(+/t*t:x-/x%#x)%#x}

Try it online!
First attempt at coding (I don't dare to name it "golfing") in K. I'm pretty sure it can be done much better (too many variable names here...)

nice! you can replace the initial (x-m) with t (tio)

the inner { } is unnecessary - its implicit parameter name is x and it has been passed an x as argument (tio)

another -1 byte by replacing x-+/x with x-/x. the left argument to -/ serves as initial value for the reduction (tio)

@ngn Thank you! Now I see that the first 2 golfs are obvious; the last one is beyond my current level :)

Python 3 + numpy, 46 bytes
lambda a:(a-mean(a))/std(a)
from numpy import*

Try it online!

Haskell, 59 bytes
(%)i=sum.map(^i)
f l=[(0%l*y-1%l)/sqrt(2%l*0%l-1%l^2)|y<-l]

Try it online!
Doesn't use libraries.
The helper function % computes the sum of ith powers of a list, which lets us get three useful values.

0%l is the length of l (call this n)
1%l is the sum of l (call this s)
2%l is the sum of squares of l (call this m)

We can express the z-score of an element y as
(n*y-s)/sqrt(n*v-s^2)

(This is the expression (y-s/n)/sqrt(v/n-(s/n)^2) simplified a bit by multiplying the top and bottom by n.)
We can insert the expressions 0%l, 1%l, 2%l without parens because the % we define has higher precedence than the arithmetic operators.
(%)i=sum.map(^i) is the same length as i%l=sum.map(^i)l. Making it more point-free doesn't help. Defining it like g i=... loses bytes when we call it. Although % works for any list but we only call it with the problem input list, there's no byte loss in calling it with argument l every time because a two-argument call i%l is no longer than a one-argument one g i.

We do have $\LaTeX$ here:)

I really like the % idea! It looks just like the discrete version of the statistical moments.

Pyth, 21 19 bytes
mc-dJ.OQ@.Om^-Jk2Q2

Try it online here.
mc-dJ.OQ@.Om^-Jk2Q2Q   Implicit: Q=eval(input())
                       Trailing Q inferred
    J.OQ               Take the average of Q, store the result in J
           m     Q     Map the elements of Q, as k, using:
             -Jk         Difference between J and k
            ^   2        Square it
         .O            Find the average of the result of the map
        @         2    Square root it
                       - this is the standard deviation of Q
m                  Q   Map elements of Q, as d, using:
  -dJ                    d - J
 c                       Float division by the standard deviation
                       Implicit print result of map

Edit: after seeing Kevin's answer, changed to use the average builtin for the inner results. Previous answer: mc-dJ.OQ@csm^-Jk2QlQ2

MATLAB, 26 bytes
Trivial-ish, std(,1) for using population standard deviation
f=@(x)(x-mean(x))/std(x,1)

TI-Basic (83 series), 14 11 bytes
Ans-mean(Ans
Ans/√(mean(Ans²

Takes input in Ans. For example, if you type the above into prgmSTANDARD, then {1,2,3}:prgmSTANDARD will return {-1.224744871,0.0,1.224744871}.
Previously, I tried using the 1-Var Stats command, which stores the population standard deviation in σx, but it's less trouble to compute it manually.

05AB1E, 9 bytes
ÅA-DnÅAt/

Port of @Arnauld's JavaScript answer, so make sure to upvote him!
Try it online or verify all test cases.
Explanation:
ÅA          # Calculate the mean of the (implicit) input
            #  i.e. [-3,1,4,1,5] → 1.6
  -         # Subtract it from each value in the (implicit) input
            #  i.e. [-3,1,4,1,5] and 1.6 → [-4.6,-0.6,2.4,-0.6,3.4]
   D        # Duplicate that list
    n       # Take the square of each
            #  i.e. [-4.6,-0.6,2.4,-0.6,3.4] → [21.16,0.36,5.76,0.36,11.56]
     ÅA     # Pop and calculate the mean of that list
            #  i.e. [21.16,0.36,5.76,0.36,11.56] → 7.84
       t    # Take the square-root of that
            #  i.e. 7.84 → 2.8
        /   # And divide each value in the duplicated list with it (and output implicitly)
            #  i.e. [-4.6,-0.6,2.4,-0.6,3.4] and 2.8 → [-1.6428571428571428,
            #   -0.21428571428571433,0.8571428571428572,-0.21428571428571433,1.2142857142857144]

SNOBOL4 (CSNOBOL4), 229 bytes
	DEFINE('Z(A)')
Z	X =X + 1
	M =M + A<X>	:S(Z)
	N =X - 1.
	M =M / N
D	X =GT(X) X - 1	:F(S)
	A<X> =A<X> - M	:(D)
S	X =LT(X,N) X + 1	:F(Y)
	S =S + A<X> ^ 2 / N	:(S)
Y	S =S ^ 0.5
N	A<X> =A<X> / S
	X =GT(X) X - 1	:S(N)
	Z =A	:(RETURN)

Try it online!
Link is to a functional version of the code which constructs an array from STDIN given its length and then its elements, then runs the function Z on that, and finally prints out the values.
Defines a function Z which returns an array.
The 1. on line 4 is necessary to do the floating point arithmetic properly.

Factor, 34 bytes
[ dup demean swap 0 std-ddof v/n ]

Try it online!
Sadly, while Factor has the z-score word, it uses the sample standard deviation instead of the population standard deviation.


text:
Rotation invariant fingerprinting
Imagine we have some polyomino and would like to uniquely identify them, however the polyominos can be rotated, so blindly hashing them won't give us the same fingerprint for a piece and a rotation thereof (in general).
For example if we have the L-tetromino
x
x
xx

we would like it to have the same fingerprint as any of these:
         xx
  x       x      xxx
xxx  ,    x  or  x

Note: We only allow rotations on the plane (ie. they are one-sided polyominos) and therefore the following polyomino would be a different one:
 x
 x
xx

Challenge
The task for this challenge is to implement a fingerprinting-function/program which takes an \$m\times n\$ Boolean/\$0,1\$-valued matrix/list of lists/string/.. encoding a polyomino and returns a string - the fingerprint of a polyomino. The fingerprint must be equal for all of the possible rotations (in general 4).
Input / Output

\$m \geq 1\$ and \$n \geq 1\$ (ie. no empty polyomino)
you're guaranteed that \$m,n\$ are as small as possible (ie. all \$0\$ are trimmed to fit \$m\$ and \$n\$
you're guaranteed that the input is

simply connected
has no holes

output must be a string which is the same for each possible rotation of a polyomino

Examples
Here are some equivalence classes, for each class the fingerprint must be the same & for any two polyominos from two distinct classes they must differ.
The rotations of the L-tetromino from the example:
[[1,0],[1,0],[1,1]]
[[0,0,1],[1,1,1]]
[[1,1],[0,1],[0,1]]
[[1,1,1],[1,0,0]]

The J-tetromino:
[[0,1],[0,1],[1,1]]
[[1,1,1],[0,0,1]]
[[1,1],[1,0],[1,0]]
[[1,0,0],[1,1,1]]

The unit polyomino:
[[1]]

A \$5\times 1\$ bar:
[[1,1,1,1,1]]
[[1],[1],[1],[1],[1]]

A \$2\times 2\$ corner:
[[1,1],[1,0]]
[[1,0],[1,1]]
[[0,1],[1,1]]
[[1,1],[0,1]]

W-pentomino:
[[1,0,0],[1,1,0],[0,1,1]]
[[0,0,1],[0,1,1],[1,1,0]]
[[1,1,0],[0,1,1],[0,0,1]]
[[0,1,1],[1,1,0],[1,0,0]]

Related.

If I always output "" (the empty string), have I satisfied all the requirements?

@DanielWagner: "[..] for any two polyominos from two distinct classes [the fingerprints] must differ" - so no, that would be invalid.

Is outputting all possible rotations of an array, consistently sorted valid? Example

@Shaggy: Yes, that would meet all the criteria.

Python 2, 48 bytes
f=lambda l,z=5:z and max(l,f(zip(*l)[::-1],z-1))

Try it online!
Takes the largest of the four rotations in terms of list comparison. Based on FlipTack's solution.
The code uses Python 2's ability to compare objects of different types. The base case value of 0 is harmless for max because it's smaller than any list. Also, zip produces a list of tuples while the input is a list of lists, but tuples are bigger than lists so the input list-of-lists is never a contender. This is why we rotate 5 times rather than 4, so that we get back to a tuplified version of the initial list. (Taking a list of tuples would also work, if that's an allowed form of input.)

Python 3, 63 bytes
def f(m):M=[];exec("m=[*zip(*m[::-1])];M+=m,;"*4);return min(M)

Try it online!
Finds the rotation with the lexographical minimum, and prints that.
A lambda form comes in at the same byte count:
lambda m,M=[]:exec("m=[*zip(*m[::-1])];M+=m,;"*4)or min(M[-4:])

Try it online!

Rewriting as a lambda can get you to 58. lambda m,M=[]:exec("m=[*zip(*m[::-1])];M+=m,;"*4)or min(M). Works because exec always returns None.

@nedla2004 That can only be run once, and then gets dodgy as M is already populated...

@nedla2004 ... but accounting for the problem with M[-4:] can get you to the same byte count.

I see, the test I was using was just checking inputs with the same "hash", so I never ran into that. That makes sense.

Jelly, 5 bytes
ZU$ƬṂ

Try it online!
Full program.
Simply generates all possible rotations and picks the lexicographical minimum.
Note that singleton lists aren't wrapped in [] in the output. That doesn't matter, since the only case where singleton lists would exist in the input would be a vertical line (including the unit polyomino), which is the same as a horizontal line with the same size (where the ones aren't wrapped). The only case where the outer [] will not exist either is the unit polyomino.

when i read the challenge i knew this would happen :)

K (ngn/k), 16 bytes
{a@*<a:3{+|x}\x}

Try it online!
min of rotations
{ } function with argument x
{+|x} rotate, i.e. reverse (|) and transpose (+)
3{ }\ apply 3 times preserving intermediate results; this returns a list of the 4 rotations
a: assign to a
< ascend (compute the sort-ascending permutation)
* first
a@ index a with that

Clean, 136 bytes
import StdEnv,Data.List
r=reverse;t=transpose;f=flatten
$l=[if((a==b)==(c==d))'x''X'\\a<-f l&b<-f(r(map r l))&c<-f(r(t l))&d<-f(t(r l))]

Try it online!
Includes test verifier.

Japt -g, 6 bytes
4Æ=zÃñ

Try it
           :Implicit input of 2d-array U
4Æ         :Map the range [0,4)
   z       :  Rotate U 90 degrees
  =        :  Reassign to U
    Ã      :End map
     ñ     :Sort
           :Implicit output of first element

Is the -g flag necessary? Sort should mean that all initial rotations end up with the same list so that full list should work fine as the fingerprint unless I'm missing something.

@KamilDrakari, you could well be right - like I said, I'm not sure I fully understood the challenge. No harm leaving it in, though, it's not costing any bytes.

@KamilDrakari: It is not necessary, but it's no harm either as it's not counted towards the bytecount.

J, 16 bytes
-2 bytes thanks to Shaggy
[:/:~|.@|:^:(<4)

Try it online!
J, 18 bytes
0{[:/:~|.@|:^:(<4)

Try it online!
Returns the first item in the list of the lexicograpically sorted rotations of the polyomino.
Explanation:
            ^:(<4)  - do the verb on the left 4 times, storing all the steps
       |.@|:        - tranpose and reverse
    /:~             - sort up the 4 matrices
  [:                - cap the fork
0{                  - take the first matrix

05AB1E, 10 8 bytes
3FÂø})Σ˜

-2 bytes thanks to @Shaggy.
Try it online or verify all test cases.
Explanation:
3F  }       # Loop 3 times
  Â         #  Bifurcate (short for Duplicate & Reverse) the top of the stack
            #  (which is the input-matrix implicitly the first iteration)
   ø        #  Transpose: swap rows/columns
     )      # After the loop, wrap everything on the stack in a list
      Σ˜    # Sort this list of matrices by their flattened array (and output implicitly)

NOTE: Taking the minimum with ß or W will implicitly flatten, so will output 0. And sorting with { doesn't seem to work for a list of matrices, which is why I use Σ˜ instead.

@Shaggy Thanks! :) In that case the last two bytes can be removed, since the } is done implicitly if nothing comes after it.

Today I learned something about 05AB1E! :) It's the same in Japt.


text:
Approximate the proportion of integers with neighboring factors
If 1 is not counted as a factor, then

40 has two neighboring factors (4 and 5)
1092 has two neighboring factors (13 and 14)
350 does not have two neighboring factors
(out of its factors 2, 5, 7, 10, 14, 25, 35, 50, 70, and 175,
no two are consecutive)

The proportion of positive integers that have this property
is the proportion divisible by any of
6 (2 × 3), 12 (3 × 4), 20 (4 × 5), 30, 56, ….
If we only calculate the proportion divisible by the first n of these,
we get an approximation that gets more accurate as n increases.
For example,
for n=1,
we find the proportion of integers divisible by 2 × 3 = 6,
which is 1/6.
For n=2,
all integers divisible by 3 × 4 = 12 are also divisible by 6,
so the approximation is still 1/6.
For n=3,
the proportion of integers divisible by 6 or 20 is 1/5,
and so on.
Here are the first few values:
1  1/6                0.16666666666666666
3  1/5                0.20000000000000000
6  22/105             0.20952380952380953
9  491/2310           0.21255411255411255
12 2153/10010         0.21508491508491510
15 36887/170170       0.21676558735382265
21 65563/301070       0.21776663234463747
24 853883/3913910     0.21816623274423785
27 24796879/113503390 0.21846817967287144

For values of n between the provided values,
the output should be the same as the output for the value above
(e.g. n=5 → 1/5).
Your program should take n and output either a fraction or decimal answer.
You may take n at any offset
(e.g. 0-indexing or 2-indexing into this sequence, instead of 1-indexing).
For decimal output,
your program must be accurate to at least 5 digits
for all the test cases given.
Scoring is code-golf, with the shortest code winning.
Inspired by What proportion of positive integers have two factors that differ by 1? by marty cohen -- specifically, by Dan's answer.

How accurate does a decimal answer have to be? A natural strategy seems to be to count the integers with a valid divisor in some enormous range and divide by the length of the range, which gets better as an approximation as the range gets bigger.

@xnor I've now addressed that in the post.

Jelly,  14 13  10 bytes
-1 using Erik the Outgolfer's idea to take the mean of a list of zeros and ones.
-3 by using 3-indexing (as allowed in the question) - thanks to Dennis for pointing this out.
ḊPƝḍⱮ!Ẹ€Æm

A monadic Link accepting an integer, n+2, which yields a float.
Try it online! (very inefficient since it tests divisibility over the range \$[2, (n+2)!]\$)
(Started out as +2µḊPƝḍⱮ!§T,$Ẉ, taking n and yielding [numerator, denominator], unreduced)
How?
ḊPƝḍⱮ!Ẹ€Æm - Link: integer, x=n+2
Ḋ          - dequeue (implicit range of) x  - i.e. [2,3,4,...,n+2]
  Ɲ        - apply to neighbours:
 P         -   product                             [2×3,3×4,...,(n+1)×(n+2)]
     !     - factorial of x                        x!
    Ɱ      - map across (implicit range of) x! with:
   ḍ       -   divides?                            [[2×3ḍ1,3×4ḍ1,...,(n+1)×(n+2)ḍ1],[2×3ḍ2,3×4ḍ2,...,(n+1)×(n+2)ḍ2],...,[2×3ḍ(x!),3×4ḍ(x!),...,(n+1)×(n+2)ḍ(x!)]]
       €   - for each:
      Ẹ    -   any?  (1 if divisible by any of the neighbour products else 0)
        Æm - mean

Hm... I suspect what makes this shorter than mine is the use of ! instead of æl/... Ah, the joys of rules changing while sleeping.

@EriktheOutgolfer yeah, very similar methods when I look closer! can you use P to get down to 13?

Instead of Ẹ€? I'm afraid P is the same as ×ƒ1$, so it won't work. (And that would be 14 anyway...) If instead of æl/, maybe (P is LCM*k after all).

@EriktheOutgolfer instead of æl/

Yeah, I think I can do that, and the result would theoretically be as precise as with æl/ I guess. (Night-owl golfing does have issues...) EDIT: Yeah, although I'll have to reduce the argument over TIO to 4... :P

No need for +2; the challenge allows 3-indexing.

@Dennis, oh and it always has - odd that I didn't notice since I had thought it would be nice if we could start at another n. Thanks!

Jelly, 12 bytes
Ḋ×‘$ḍẸ¥ⱮP$Æm

Try it online!
-2 thanks to Jonathan Allan's suggestion to replace the LCM with the product (i.e. the LCM multiplied by an integer).
Dennis noticed I can 2-index as well.

05AB1E, 15 bytes
Ì©!Lε®LüP¦Öà}ÅA

Port of @JonathanAllan's Jelly answer, so also extremely slow.
Try it online or verify the first three test cases.
Explanation:
Ì                 # Add 2 to the (implicit) input
                  #  i.e. 3 → 5
 ©                # Store this in the register (without popping)
  !               # Take the factorial of it
                  #  i.e. 5 → 120
   L              # Create a list in the range [1, (input+2)!]
                  #   i.e. 120 → [1,2,3,...,118,119,120]
    ε       }     #  Map over each value in this list
     ®            #  Push the input+2 from the register
      L           #  Create a list in the range [1, input+2]
                  #   i.e. 5 → [1,2,3,4,5]
       ü          #  Take each pair
                  #    i.e. [1,2,3,4,5] → [[1,2],[2,3],[3,4],[4,5]]
        P         #   And take the product of that pair
                  #    i.e. [[1,2],[2,3],[3,4],[4,5]] → [2,6,12,20]
         ¦        #  Then remove the first value from this product-pair list
                  #   i.e. [2,6,12,20] → [6,12,20]
          Ö       #  Check for each product-pair if it divides the current map-value
                  #  (1 if truthy; 0 if falsey)
                  #   i.e. [1,2,3,...,118,119,120] and [6,12,20]
                  #    → [[0,0,0],[0,0,0],[0,0,0],...,[0,0,0],[0,0,0],[1,1,1]]
           à      #  And check if it's truthy for any by taking the maximum
                  #   i.e. [[0,0,0],[0,0,0],[0,0,0],...,[0,0,0],[0,0,0],[1,1,1]]
                  #    → [0,0,0,...,0,0,1]
             ÅA   # After the map, take the mean (and output implicitly)
                  #  i.e. [0,0,0,...,0,0,1] → 0.2

JavaScript (ES6),  94 92  90 bytes
Saved 2 bytes thanks to @Shaggy + 2 more bytes from there
Returns a decimal approximation.
n=>(x=2,g=a=>n--?g([...a,x*++x]):[...Array(1e6)].map((_,k)=>n+=a.some(d=>k%d<1))&&n/1e6)``

Try it online!

JavaScript (ES6), 131 bytes
A much longer solution that returns an exact result as a pair \$[numerator, denominator]\$.
f=(n,a=[],p=x=1)=>n?f(n-1,[...a,q=++x*-~x],p*q/(g=(a,b)=>a?g(b%a,a):b)(p,q)):[...Array(p)].map((_,k)=>n+=a.some(d=>-~k%d<1))&&[n,p]

Try it online!

-2 bytes

This should work, in theory for 82 bytes.

@Shaggy I don't really know what the consensus is for answers like that. While it does work in theory, it doesn't work in practice for any input. (I personally dislike this kind of answers. This is why I usually include a rule such as "your code should at least work up to a given limit" in my own challenges when I suspect that I'll get answers such as "works only for n=1 on TIO" ... or doesn't work at all in the present case.)

Personally, I'm a big fan of the infinite time & memory consensus ;)

Oh I like it too. :) My only reservation is that I think it should be possible to test any answer for at least a couple of distinct inputs.

@Shaggy I think Arnauld means that he doesn't like it if the answer can only be tested for one input because it could as well be hardcoding (testers aren't supposed to know every programming language in the world).

Charcoal, 26 bytes
ＦＮ⊞υ×⁺²ι⁺³ιＩ∕ＬΦΠυ¬⌊Ｅυ﹪ιλΠυ

Try it online! Link is to verbose version of code. Hopelessly inefficient (O(n!²)) so only works up to n=4 on TIO. Explanation:
ＦＮ⊞υ×⁺²ι⁺³ι

Input n and calculate the first n products of neighbouring factors.
Ｉ∕ＬΦΠυ¬⌊Ｅυ﹪ιλΠυ

Take the product of all of those factors and use that to calculate the proportion of numbers having at least one of those factors.
30-byte less slow version is only O(n!) so can do up to n=6 on TIO:
Ｆ⊕Ｎ⊞υ⁺²ιＩ∕ＬΦΠυΣＥυ∧μ¬﹪ι×λ§υ⊖μΠυ

Try it online! Link is to verbose version of code.
46-byte faster version is only O(lcm(1..n+2)) so can do up to n=10 on TIO:
ＦＮ⊞υ×⁺²ι⁺³ι≔⁰η≔⁰ζＷ∨¬η⌈Ｅυ﹪ηκ«≦⊕η≧⁺⌈Ｅυ¬﹪ηκζ»Ｉ∕ζη

Try it online! Link is to verbose version of code.
45-byte faster version is only O(2ⁿ) so can do up to n=13 on TIO:
⊞υ±¹ＦＥＮ×⁺²ι⁺³ιＦ⮌υ⊞υ±÷×ικ⌈Φ⊕ι∧λ¬∨﹪ιλ﹪κλＩΣ∕¹✂υ¹

Try it online! Link is to verbose version of code.
54-byte fastest version uses more efficient LCM so can do up to n=18 on TIO:
⊞υ±¹ＦＥＮ×⁺²ι⁺³ιＦＥυ⟦κι⟧«Ｗ⊟κ⊞⊞Ｏκλ﹪§κ±²λ⊞υ±÷Π…κ²⊟κ»ＩΣ∕¹✂υ¹

Try it online! Link is to verbose version of code.

Wolfram Language (Mathematica), 69 68 61 52 bytes
Count[Range[#!],b_/;Or@@(# #-#&@Range[3,#]∣b)]/#!&

Try it online!
3-indexed. At first I was going to use LCM@@ but realized that #! would be shorter... but now it a lot of memory for Range[#!]...
Managed to golf down the condition by 2 bytes, which was nice.

Older numerical solution (56 bytes):
N@Count[Range[5^8],b_/;Or@@Array[(# #-#)∣b&,#,3]]/5^8&

Try it online!
2-indexed. More efficient when #!>5^8 (#>9, assuming # is an integer).

Python 2, 78 bytes
lambda n:sum(any(-~i%(j*-~j)<1for j in range(2,n+2))for i in range(10**7))/1e7

Try it online!
Returns the approximate decimal to +5 digits; uses the naive brute force approach xnor suggests in comments on the question.


text:
Non-overlapping Matrix Sum
Given \$k\$ arrays of length \$n\$, output the maximum sum possible using one element from each array such that no two elements are from the same index. It is guaranteed that \$k\le n\$.
Input
A nonempty list of nonempty arrays of integers.
Output
An integer that represents the maximum sum.
Examples
Input -> Output
[[1]] -> 1
[[1, 3], [1, 3]] -> 4
[[1, 4, 2], [5, 6, 1]] -> 9
[[-2, -21],[18, 2]] -> 0
[[1, 2, 3], [4, 5, 6], [7, 8, 9]] -> 15
[[1, 2, 3, 4], [5, 4, 3, 2], [6, 2, 7, 1]] -> 16
[[-2, -1], [-1, -2]] -> -2

Math fun fact: For square arrays, this is the matrix permanent over the tropical semiring which uses the operations (max, +) in place of (+, *).

Jelly, 10 6 bytes
ZŒ!ÆṭṀ

Try it online!
(4 bytes saved by @Dennis, who pointed out that Jelly had a "sum of main diagonal" builtin. I was not expecting it to have one of those; the previous solution implemented the operation without using the builtin. The operation in question, Æṭ, is defined as "trace", but the trace is only defined for square matrices; Jelly implements a generalisation to rectangular matrices too.)
The improvement over the other answers is mostly from a simpler (thus terser to express) algorithm; this program was originally written in Brachylog v2 ({\p\iᶠ∋₎ᵐ+}ᶠot), but Jelly has some builtins for parts of the program that have to be spelled out in Brachylog, so this came out shorter.
Explanation
ZŒ!ÆṭṀ
Z            Swap rows and columns
 Œ!          Find all permutations of rows (thus columns of the original)
   Æṭ        {For each permutation}, take the sum of the main diagonal
     Ṁ       Take the maximum

It should be clear that for any solution to the problem, we can permute the columns of the original matrix to put that solution onto the main diagonal. So this solution simply reverses that, finding all possible main diagonals of permutations.
Note that the "permute the columns" operation is done as "transpose, permute the rows" without bothering to transpose back; the rest of the algorithm happens to be symmetrical about the main diagonal, so we don't need to undo the transpose and thus can save a byte.

ZŒ!ÆṭṀ saves four bytes. Try it online!

Well it looks like Dennis got the last word in :P

I wonder if that builtin's ever come up before?

Not sure, but probably not. I actually suggested ZŒ!ŒD§ṀḢ before remembering that Æṭ was a thing.

J, 28 bytes
>./@({.+1$:@|:\.|:@}.)@[^:]#

Try it online!
 >./ @  (   {.   +         1 $:@|:\. |:@}.       )       @[^:] #
(max of (1st row + recursive call on each "minor")) or count of arg if 0

Here the recursive call is done by $: which represents the largest anonymous function containing it. We are lucky in J to have the primitive x u\. y, which applies u to successive "outfixes" of y obtained by suppressing successive infixes of length x of the items in y; here we want to surpress successive columns to get "minors", so we transpose |: the lower rows (or tail }.) of y, and then recurse on the transpose of their outfixes.

Hi and welcome to PPCG! I added a Try it online link for your solution, so that others can verify it.

Python 3, 94 90 89 84 80 bytes
-4 bytes thanks to xnor (using sets instead of lists)!
f=lambda x,y={-1}:x>[]and max(e+f(x[1:],y|{i})for(i,e)in enumerate(x[0])if{i}-y)

Try it online!

Nice method! You can make y a set to shorten the membership check: f=lambda x,y={-1}:x>[]and max(e+f(x[1:],y|{i})for(i,e)in enumerate(x[0])if{i}-y).

@xnor: That -1 trick is really clever :) Thanks a lot!

Husk, 12 11 9 bytes
▲mȯΣ►L∂PT

Try it online!
Thanks to BMO for suggesting a port of ais523's  answer and a 2-byte save, which I managed to improve on further, and in turn BMO shaved off 2 more bytes.

Previous solution (14 bytes)
▲moΣz!¹fS=uΠmŀ

Try it online!
I wasn't able to make a test suite because this answer uses the first command line argument command explicitly. But Husk doesn't use STDIN at all so I included all the test cases there, so you can just copy paste in the argument field to check it out. Also note that arrays in Husk may not contain spaces between elements while being inputted.
How it works?
Code breakdown
▲moΣz!¹fS=uΠmŀ     Full program. Takes a 2D list from CLA 1 and outputs to STDOUT.
            mŀ     Length range of each list.
           Π       Cartesian product.
       fS=u        Discard those combinations which have at least 1 non-unique element.
 mo                Map over the combinations with the following predicate:
    z!¹            Zip the 2D list input with the current combination and index accordingly.
   Σ               Sum the resulting elements.
▲                  Finally, pick the maximum.

Example
Let's pick an example: $$\left(\begin{matrix}1&4&2\\5&6&1\end{matrix}\right)$$
One must pick exactly one index from each such that no two indices correspond. So, we generate the length ranges of the rows and only keep those without duplicates, yielding the following combinations (each combination is a column instead of a row to save space):
$$\left(\begin{matrix}\color{red}{1}&\color{blue}{2}&\color{green}{1}&\color{orange}{3}&2&\color{pink}{3}\\\color{red}{2}&\color{blue}{1}&\color{green}{3}&\color{orange}{1}&3&\color{pink}{2}\end{matrix}\right)$$
Then, the program indexes in the input lists with each element of the combination, returning:
$$\left(\begin{matrix}
\color{red}{1}&\color{blue}{4}&\color{green}{1}&\color{orange}{2}&4&\color{pink}{2}\\
\color{red}{6}&\color{blue}{5}&\color{green}{1}&\color{orange}{5}&1&\color{pink}{6}
\end{matrix}\right)$$
Summing all those results (here, each column, for the aforementioned reason), one obtains all possible valid sums according to the criteria, in this case \$9\$.

Jelly, 13 12 bytes
ẈŒpQƑƇị"€¹§Ṁ

Try it online!
Alternate version, 11 bytes
ZLœ!Lị"€¹§Ṁ

This uses the newly added œ! built-in, which generates all permutations of a given length.
Try it online!
How it works
ẈŒpQƑƇị"€¹§Ṁ  Main link. Argument: M (matrix)

Ẉ             Widths; compute the length of each row.
              For an n×m matrix, this yields an array m copies of n.
 Œp           Cartesian product; promote each n to [1, ..., n], then form all arrays
              that pick one k out of all m copies of [1, ..., n].
   QƑƇ        Comb by fixed unique; keep only arrays that do not change by
              deduplicating their entries.
         ¹    Identity; yield M.
      ị"€     For each of the arrays of unique elements, use its m entries to index
              into the m rows of M.
          §   Take the sums of all resulting vectors.
           Ṁ  Take the maximum.

Ah... I almost posted this same answer with XLṗL instead of J€Œp.

JavaScript (ES6),  74  71 bytes
Thanks to @tsh for identifying 2 useless bytes that were used to fix a bug
Saved 3 bytes thanks to @tsh
f=([a,...r],k,i=1)=>a?Math.max(...a.map(n=>k&(i+=i)?-1/0:n+f(r,k|i))):0

Try it online!

@Shaggy but it is impossible to compose 0 from input array, -1+(-1) is -2 and it is correct answer.

f=([a,...r],k,i=1)=>a?Math.max(...a.map(c=>k&(i+=i)?-1/0:c+f(r,k|i))):0 It's strange, but Math.max saves bytes...

Haskell, 65 bytes
f(u:v)=maximum[e+f(take i<>drop(i+1)<$>v)|(i,e)<-zip[0..]u]
f _=0

Try it online!
Explanation & Ungolfed
The function take i<>drop(i+1) takes a list and removes the element at position i.
The function f gets each possible element e at position i, removes the elements at position i from the remaining elements and adds e to the recursively computed optimum:
f(u:v)=maximum[e+f(removeElementAt i<$>v)|(i,e)<-zip[0..]u]

And the base case for the empty list is just 0:
f _=0

Brachylog, 18 bytes
{hl⟦kp;?z₀∋₍ᵐ+}ᶠot

Try it online!
Explanation
                ot      The output is the biggest result of…
{             }ᶠ        …finding all outputs to the following predicate:
 hl⟦k                     Construct the range [0, …, n-1]
     p                    Take a permutation of that range
      ;?z₀                Zip that permutation with the Input, stopping when all elements of
                            the input are used (important because the range is possibly
                            bigger than the length of the input)
          ∋₍ᵐ             In each element of the zip, take the head'th element of the tail
             +            Sum the result

Haskell, 65 bytes
([]%)
p%(h:t)=maximum[x+(i:p)%t|(i,x)<-zip[0..]h,all(/=i)p]
p%_=0

Try it online!

71 bytes
f m=maximum[sum b|(a,b)<-unzip<$>mapM(zip[0..])m,[x|x<-a,y<-a,x==y]==a]

Try it online!
The [x|x<-a,y<-a,x==y]==a checks that the elements of a are distinct. This uses up a surprising number of characters, but I didn't see a shorter way.

K (oK), 40, 32, 28, 19 bytes
-13 bytes thanks to ngn!
{|/+/(prm'x)@''!#x}

Try it online!
Initial solution:
{|/+/'x./:/:(*t),'/:t:{x~?x}#+!(#x)##*x}

Try it online!
Note: Doesn't work for the first test case [[1]]
Explanation:
{ } - function with argument x
                                   #     - creata a list
                               (#x)      - with length number of rows of x
                                    #*x  - of the length of the first row
                              !          - odometer (ranged permutations)
                             +           - transpose
                            #            - filter out the rows
                      {x~?x}             - that have duplicates
                    t:                   - save it to t
                ,'/:                     - pair up each number in each row with
            (*t)                         - a number from the first row
      x./:/:                             - index x with each of the above
   +/'                                   - find the sum of each row
 |/                                      - reduce by max

hint: prm can be applied directly to a list to generate its permutations

@ngn Thanks! I wanted to use the main diagonal with =, but the result was longer. Is there flatten in oK?

flatten in what sense?

@ngn (1 2 3; 4 5 6; 7 8 9) -> (1 2 3 4 5 6 7 8 9)

that's just ,/ or if you want it to go into deeper structures: ,//

@ngn Thanks! Should I read it "reduce by enlist"?

continued in chat

J, 14 bytes
{:@$>./ .+@{.]

Try it online!
When I saw xnor's comment

For square arrays, this is the matrix permanent over the tropical semiring which uses the operations (max, +) in place of (+, *).

I immediately realized that it must be a job for J's generalized determinant/permanent built-in f . g. The permanent is +/ .*, so the modified permanent is >./ .+ (6 bytes). Unfortunately this only works with square arrays (horizontally longer arrays give negative infinity __ for some reason), so I needed to pad the input with zeros to make it square.
{:@$>./ .+@{.]    NB. Tacit function, input: a matrix
{:@$              NB. The horizontal length of the matrix
           {.]    NB. Pad the matrix with zeros at the bottom to make it square
    >./ .+@       NB. Compute the modified permanent over the square matrix

Pyth, 15 12 bytes
eSms@VQd.plh

Try it online here.
eSms@VQd.plhQ   Implicit: Q=eval(input())
                Trailing Q inferred
          lhQ   Length of first element of Q
        .p      Generate all permutaions of 0 to the above
  m             Map the elements of the above, as d, using:
    @VQd          Vectorised index into Q using d
                    For i in [0-length(Q)), yield Q[i][d[i]]
   s              Take the sum of the above
 S              Sort the result of the map
e               Take the last element of the above, implicit print

Edit: saved 3 bytes courtesy of issacg

.PUlhQl can be replaced by .plh. V implicitly ignores any extra entries.

05AB1E, 18 13 bytes
нgLœε‚øε`è]OZ

I have the feeling it's overly long, but I'm not sure how to do vectorized indexing byte-efficiently in 05AB1E.. And I was indeed right that it was too long.. -5 bytes thanks to @Emigna.
Try it online or verify all test cases.
Explanation:
н                # Take the first inner list (of the implicit input list of lists)
 g               # Pop and take its length
  L              # Create a list in the range [1, inner-length]
   œ             # Create each possible permutation of this range-list
    ε            # Map each permutation to:
     ‚           #  Pair it with the (implicit) input
      ø          #  Transpose; swap rows/columns
       ε         #  Map each to:
        `        #   Push both to the stack
         è       #   Index the permutation-nr into the inner list of the input
    ]            # Close both maps
     O           # Take the sum of each inner list
      à          # Pop and push the maximum (and output implicitly)

Example run:

Input: [[1,4,2],[5,6,1]]
After step 1 (нgL): [1,2,3]
After step 2 (œ): [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
After step 3 (ε‚): [[[[1,4,2],[5,6,1]],[1,2,3]],[[[1,4,2],[5,6,1]],[1,3,2]],[[[1,4,2],[5,6,1]],[2,1,3]],[[[1,4,2],[5,6,1]],[2,3,1]],[[[1,4,2],[5,6,1]],[3,1,2]],[[[1,4,2],[5,6,1]],[3,2,1]]]
After step 4 (ø): [[[[1,4,2],1],[[5,6,1],2]],[[[1,4,2],1],[[5,6,1],3]],[[[1,4,2],2],[[5,6,1],1]],[[[1,4,2],2],[[5,6,1],3]],[[[1,4,2],3],[[5,6,1],1]],[[[1,4,2],3],[[5,6,1],2]]]
After step 5 (ε`è]): [[4,1],[4,5],[2,6],[2,5],[1,6],[1,1]] (NOTE: 05AB1E is 0-indexed (with automatic wraparound), so indexing 3 into [5,6,1] results in 5.)
After step 6 (O): [5,9,8,7,7,2]
Output / after step 7 (à): 9

I had нgLœε‚øεè]OZ` for 13.

@Emigna Thanks! It's surprisingly similar to what I had I see, except that I added a bunch of crap that was unnecessary. ;p

Perl 6, 50 49 bytes
{max map *.map({.[$++]}).sum,permutations [Z] $_}

Try it online!
Decently short, even despite the long permutations call. This is an anonymous code block that takes a list of lists and returns a number.
Explanation:
{                                               } # Anonymous code block
 max                                              # Finds the maximum
                             permutations         # Of all permutations
                                          [Z] $_  # Of the transposed input
     map                                          # When mapped to
                        .sum # The sum of
         *.map({.[$++]})     # The diagonal of the matrix

05AB1E, 7 bytes
øœ€Å\Oà

Port of @ais523's Jelly CW answer, so make sure to upvote it as well!
Try it online or verify all test cases.
Explanation:
ø          # Transpose the (implicit) input; swapping row/columns
 œ         # Get all permutations
  €Å\      # Take the main diagonal of each
     O     # Sum each
      à    # Pop and push the maximum (which is output implicitly)

Haskell, 84 bytes
import Data.List
h l=maximum[sum$snd<$>r|r<-mapM id$zip[1..]<$>l,(==)=<<nub$fst<$>r]

Try it online!

Ruby, 74 72 69 bytes
->a{[*0...a[0].size].permutation.map{|x|a.zip(x).sum{|y,z|y[z]}}.max}

Try it online!

66 bytes