[Question]
  [
# Roll for Initiative!
# Introduction
In tabletop games like Dungeons and Dragons, when you begin a battle, all involved parties *roll for initiative*. In DnD 5e, this is `1d20 + DEX + Other bonuses`, where `DEX` is the bonus given by your Dexterity stat. The characters that roll higher numbers go first. We'll use a similar, deterministic system in this challenge.
# The Challenge
Write a program or function that, when given a list of characters, will output a list of characters in order of initiative.
A character is defined as this:
```
character = {
    name: "name" // a string
    statblock: [SPD, DEX, WHT] // a list of numbers
                               // DEX = dexterity, SPD = speed, WHT = weight
}
```
The formula for initiative is the following:
$$\text{Initiative} = \left\lfloor{ \frac{\text{SPD}^2}{\sqrt{\lvert\text{DEX}\rvert}} }\right\rfloor - \text{WHT}$$
# Input
A list of characters, unsorted. This can be a JSON object, a list of lists, a list of dictionaries, a series of strings etc.
It is guaranteed that all names will be unique.
# Output
A list of characters, or character names, sorted by initiative order from highest to lowest, based on the above formula.
# Rules
* IO can be used with [any convenient method](https://codegolf.meta.stackexchange.com/questions/2447/default-for-code-golf-input-output-methods).
* [Standard loopholes](https://codegolf.meta.stackexchange.com/questions/1061/loopholes-that-are-forbidden-by-default) are forbidden.
* This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so smallest program wins!
# Sample IO
```
Input --> Output
[[Name, SPD, DEX, WHT], ...]
    --> [[Name, SPD, DEX, WHT], ...] (or [Name, Name, ...])
---------
[[Alice,1,2,3],[Bob,10,5,0],[Charlie,3,2,1]]
    --> [Bob, Charlie, Alice]
// Alice = -3, Bob = 44, Charlie = 5
[[Z,1,1,1],[B,1,1,1],[XY,5,1,1]]
    --> [XY, Z, B]
// Retain the order of characters from the input if they have the same initiative.
// Z = 0, B = 0, XY = 24
[[Neg,-3,-3,-1],[SomeNeg,5,-2,-4],[NoNeg,4,6,8]]
    --> [SomeNeg, Neg, NoNeg]
// Negative values are valid.
// Neg = 6, SomeNeg = 21, NoNeg = -2
[[Flo,1.5,2.5,3.5],[MoreFlo,2,2.5,3.5]]
    --> [[MoreFlo,2,2.5,3.5], [Flo,1.5,2.5,3.5]]
// Floats are also valid.
// Flo = -2.5, MoreFlo = -1.5
[[Lonely,1,2,3]]
    --> [[Lonely,1,2,3]]
// Input with 1 item.
[]
    --> []
// Empty input leads to empty output.
[[Foo,2,1,4], [Baz,5,5,4], [Bar,5,1,4]]
    --> [Bar, Baz, Foo]
// Foo = 0, Bar = 21, Baz = 7
[['Adam', 2, 4, 1], ['Eve', 2, 3, 1]]
--> [Adam, Eve]
// Adam = 2, Eve = 2
// If you do not floor, you'll end up with [Eve, Adam] (Adam = 2, Eve ~= 2.3)
```
[Sandbox link](https://codegolf.meta.stackexchange.com/a/18320/77309)
  
[Answer]
# JavaScript (ES7), ~~73~~ 60 bytes
*-13 bytes by just sorting the input without isolating the names, as suggested by @asgallant*
Expects a list of `[SPD, DEX, WHT, Name]`.
```
a=>a.sort((a,b)=>(g=([s,d,w])=>~(s*s/(d*d)**.25)+w)(a)-g(b))
```
[Try it online!](https://tio.run/##RZBBT4MwFMfvfApubfFRBwxjYiBxRk/qxYva9FCgMEzHW@ji4sWvjl0ZM@07/H/9vbR9X@pb2Xrs94d4wEZPbTGpolTc4nigVEHFipJ2BRUWGjhKl36pjew1baKGRRFPc3Z1ZFSxuKMVY9OdCMJQiARSyIDcm77WREIokhXksAKywcrnzAkJkIetGk3vFAnnvtMin3PPHDY@5HN4/7i4cQan7eCr7s5OnEK8BvKGO73ANdzArXPQg@UenkPqKnNFngx6M/1HLzhqjy/v8v95xkGbn4XKQAa8xfFR1VuqwqIMaxwsGs0NdrR1Q@E7tZ9PlMgkc/P5Aw "JavaScript (Node.js) – Try It Online")
### How?
To save a few bytes:
* we compute \$-\text{Initiative}-1\$ instead and sort the list the other way around
* we compute \$\sqrt{|\text{DEX}|}\$ as \$(\text{DEX}^2)^{\frac{1}{4}}\$
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~10~~ 8 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
Σ`nsÄt÷-
```
Input in the format and order `["name", WHT, DEX, SPD]`, and output are the same inner lists sorted from highest to lowest `initiative`.
-2 bytes thanks to *@Grimmy*.
[Try it online](https://tio.run/##yy9OTMpM/f//3OKEvOLDLSWHt@v@/x8dreSXmq6ko2uoo2sMRLE60UrB@bmpEEETHV0jHVOQmF8@WMRCx0zHJDYWAA) or [verify all test cases](https://tio.run/##yy9OTMpM/V@m5JlXUFpipaCkU6nDpeRfWgLj/T@3OCGv@HBLyeHtuv9rdQ5ts/8fHR2t5JiTmZyqpGOsY6RjGKsTreSUn6SkY6BjqmNoAOI6ZyQW5WQCFRgCFRjHxuooAPVEgbiGUPVI7IhICMcUqs4vNV1JR9dQR9cYiEAKgvNzUyGCJjq6RkB1QDG/fLCIhY6ZjglUn1tOPtBFeqY6RkBsqAdW5ptflIoibgRV7JOfl5pTCfMBSCw2FgA).
**Explanation:**
The sort builtin `Σ` sorts from lowest to highest by default, so I'm using the following modified formula to not only save bytes, but sort from highest to lowest at the same time with this builtin (thanks *@Grimmy*):  
$$Initiative = WHT - \left\lfloor\frac{SPD^2}{\sqrt{\lvert DEX\rvert}}\right\rfloor$$
```
Σ         # Sort the (implicit) input-list by:
 `        #  Pop and push all values of the inner list separated to the stack
  n       #  Square the SPD at the top of the stack
   s      #  Swap so the DEX is now at the top of the stack
    Ä     #  Take its absolute value
     t    #  Then its square-root
      ÷   #  And integer-divide the squared SPD by this
       -  #  Subtract this from the WHT (to sort in descending instead of ascending order)
          #  (after which the result is output implicitly)
```
[Answer]
# [Japt](https://github.com/ETHproductions/japt), ~~20~~ 18 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
```
ñÈÌ-(Xg1 ²/Xg2a ¬f
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=8cjMLShYZzEgsi9YZzJhIKxm&input=LVEgW1siWiIsMSwxLDFdLFsiQiIsMSwxLDFdLFsiWFkiLDUsMSwxXV0)
Simply calculates the formula for each character and sorts. Negates the formula to sort in the correct order.
Takes input as a list of lists `[Name, SPD, DEX, WHT]`. (I could save a byte taking input as `[SPD, Name, DEX, WHT]` but that feels cheaty.)
[Answer]
# [Python 3](https://docs.python.org/3/), ~~63~~ 59 bytes
```
lambda c:sorted(c,key=lambda x:x[3]-x[1]**2//abs(x[2]**.5))
```
[Try it online!](https://tio.run/##TZBBT4MwFMfv@xQvu5QtDzZaMIZkJtPoSXfxMq09FCiOCHQBYuDTYylClrZp3y@/f5u@a99edMWG7PA1FLKMUwlJ1Oi6VamT4I/qD/@0izrOhNtxX2y3dLeTceN0nJrCCzebIdM1tKppE9koyCvgKwDOybHIE0XQR4pMICePOjbVHkPcj@XTRdZFbgRmBF8InFKfY8IMm7g5nz@ISfo35kl9E3SZnVZ516WyMESXohuM7KQtCfAO75fkS6HNzV6I1CzmhaP4pmtlOV3orL/qShX9/JOZHlNZEgSKECCY94GT5181ETaSSRQrEZkdrnVetc7cJoQ1uA@wRsgWZjr5Bw "Python 3 – Try It Online")
Pretty straigtforward. Sorts by `- initiative` to get the right output order.
# [Python 2](https://docs.python.org/2/), ~~60~~ 56 bytes
```
lambda c:sorted(c,key=lambda(a,b,c,d):d-b*b//abs(c)**.5)
```
[Try it online!](https://tio.run/##TZBBa4MwFMfv/RSPXqLytDWaUoQOurGdtl522eY8JDGuMjVFZeCndzGilCS8vB@/f0JyG/qrbuhYnL7Hitci5yCTTre9yh2Jv2o4zdThKFBi7ia5Lzyx23HROdL1vIC5Y6Fb6FXXS94pKBtINwBpSs5VKRXBEClGGabkUQvT7ZHhfmqfrrytSiNERgizDOfU15Qwwybu9h@fxCTDO/Oifgj6kZ1Wede1spChT9GPJ3bRlsR4wOOafKm0OTlgSM2KAjaJb7pVltOVLvqrblQ1LC9Z6DnnNUGgCDGCuR9S8vynZhJNZBazTZaYCre2bPr1mxC24D/AFqFwFuaO/w "Python 2 – Try It Online")
*thanks to @Chas Brown*
[Answer]
# [K (oK)](https://github.com/JohnEarnest/ok), 28 bytes
```
f:{(!x)@>{-z-(x*x)%%y|-y}.'.x}
```
[Try it online!](https://tio.run/##y9bNz/7/P82qWkOxQtPBrlq3SlejQqtCU1W1ska3slZPXa@i9n@aQkJiTmZyakJSflJCckZiUU5mqqKGoYKRgrG1oYGCqYKBtTGQY6j5HwA "K (oK) – Try It Online")
-10 thanks to ngn :-)
[Answer]
# [Ruby](https://www.ruby-lang.org/en/), 44 bytes
```
->d{d.sort_by{|_,x,y,z|-x*x/y.abs()**1/2+z}}
```
[Try it online!](https://tio.run/##bcxLC4JAFIbhvb9icKV2xrxGm4IKWrppKSIzXkqwJkYFr7/dRrEoCM7q4Tsvr2gzprsR7@Mu1gvGy5A2XR9CDQ20Pa61et3ohBaKqmnm2lq1wzAStEO@hJAvH/IsSmQwwQI7gJmOjAowwAVjkdON8DwTM1vMzEAKJPoJeMlVBmzPZy77C7sns7uALcDOwh6b0YENbKdI9ImcGZOnNLynR8Kn729oJ3AFiM8nzx4lSvWI5LlCVOlZlcUv0n8YqeML)
-3 bytes thanks to @79037662
[Answer]
# [Add++](https://github.com/cairdcoinheringaahing/AddPlusPlus), 24 bytes
```
D,g,@#~,p2^$|.5^/i_
L,§g
```
[Try it online!](https://tio.run/##XZBNTsMwEIX3PsXIdDkJtd0gpEoVFMSqlAWbtpaLUmKFSC6OukNCXId7cLEwdp1SIv/I896bz5bLqmrbrrvHGm8uvrCV29FnXmwvmxe2wJ/vuhu5cr@rShAzrfmta14tBwESlAHN535H1RgKGIfy7q08uIYCigLCGPbEpqAphJAshIgwjP3jbgKTRmSenVdrTmzxx1qtETYI8yFgaWsOmYozdj77vY1iAZmEbBK0pY/KBK7gugemHMJxC4kh@8F5elJegKSl8iKgHv3BRl2e1ATUyUKJ5GBwEHQQCHGShncs/Lt1H/3P9qijioJYatCSIqb7BQ "Add++ – Try It Online")
Inputs and outputs a list of lists representing the characters, in the same order given in the challenge (`[Name SPD DEX WHT]`)
## How it works
On the second line, we define an anonymous function that takes in an argument and sorts it on the result of **g**, defined on the first list.
**g** starts by reversing its argument and splatting the elements to its stack: `#~`. It then removes the name and squares the first stat, Speed, (`p2^`) before square rooting the absolute value of the second stat, Dexterity, (`$|.5^`). Finally, we integer divide the two (`/i`) and subtract from Weight (`_`). This is the opposite to the formula (where Weight is subtracted from the division), as it will cause the sort function in the second line to sort in the order we want. As Add++ uses a stable sort, order is retained if two characters have the same initiative.
[Answer]
# APL+WIN, 41 bytes
Prompts for a n x 4 matrix where n is the number of rows 1 per character and the columns are Name, SPD, DEX, WHT. The output is a 1 column matrix of character names
```
m←⎕⋄⊃m[⍒⌊((m[;2]*2)÷(|m[;3])*.5)-m[;4];1]
```
[Try it online!Courtesy of Dyalog Classic](https://tio.run/##TY/BSsNAFEX3@Yq3e0khJTOTiNBVW@iq7caNWrKIcdoGJh1pVwV3ikq1IoLf4UboXv9kfiTeJrXI48Kd8@4deNmNCa/XmbGzMDfZalXklXv9GA3dw5vy3NPjtCphgdzzvdvclRO3fXcvG98vJx2ZtmTws/Nv4VUatNpJEMLGaUekFbrV1FMUu@0Xd02RayZBkhRxz17BR5RQRNyfZ0tTYKmwFN6xcrmP74d7R3d@wSiJ/7GxnjF9f6qDEDqzpa5pgreEYuKxrUlMJ3SKrmy6A2PxdTshCSmIR3apayr/GNKiSQ/tQpv14QjgqMHs/QI "APL (Dyalog Classic) – Try It Online")
[Answer]
# [Red](http://www.red-lang.org), ~~108~~ 107 bytes
-1 byte thanks to raznagul
```
func[b][extract next sort/skip collect[foreach e
b[keep 0 -(e/2 ** 2 /(e/3 ** 2 ** .25)- e/4)keep e/1]]2 2]
```
[Try it online!](https://tio.run/##XY/NTsMwEITveYo50kr5sR0jxI0icYIe4AJYPiTupo1q4sgNEjx9WBdUClqvNTs732EjbeZH2hibdddz9z4401pDH1Ns3ISBBQ4hTuVh349wwXtyk@lCpMbtQFlr9kQjKuQXVEosl5AoWapvyV8h9SIHlfXimKRSWCsh7TzG0BI6GHPje0cQnFcWZhVaiAoaFQ@3uyb6nqB4yWD2C70ywJWAk3p@YUz8C65pi1wdX8o8hTdKlkYukdfsrEOaa1zi6g945wNEoSG5VaE5@cB3J1eevPP8fRjIf/7ccbaw8xc "Red – Try It Online")
[Answer]
# Google Sheets, ~~49~~ 37 bytes
-12 bytes thanks to Black Owl Kai
```
=Sort(A:A,D:D-B:B^2/Sqrt(Abs(C:C)),1)
```
Input is in the range `A1:D` with the four columns being player, speed, dexterity, and weight.
Explanation:  
`D:D-B:B^2/Sqrt(Abs(C:C))` do the math bit. The values are actually `Initiaive * -1` so we can sort them ascending and get the order we want. Otherwise, all the blank rows would be sorted before the player names.  
`=Sort(A:A,~,1)` sorts the player list based on the math bit output.
Test cases:  
[![Test Cases](https://i.stack.imgur.com/pbdSX.png)](https://i.stack.imgur.com/pbdSX.png)
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 20 bytes
```
ḊA2¦U*Ø½j.¤UŒH:/€IµÞ
```
[Try it online!](https://tio.run/##y0rNyan8///hji5Ho0PLQrUOzzi0N0vv0JLQo5M8rPQfNa3xPLT18Lz/h9uBzIc7FgFJIHL//z@aizM6WskxJzM5VUnHUMdIxzhWJ1rJKT8JyDPQMdUxAHGdMxKLcjKBCoyBCgxjY3XAmqJAGoAQrAGJHRGpBNRoiFDol5qupKNrDEZgFcH5ualgQVMdXSMdXROQmF8@WMREx0zHAqbRLScfaK6eqY4REBvrmYLU@eYXpYLFjeCiUNU@@XmpOZUwX4AFY7liAQ "Jelly – Try It Online")
Well, this is horribly hacked together but it works. The Footer in the TIO link simply runs the code over each list then returns just the names. The code itself returns the names and all stats in the same format as the input, namely `[Name, SPD, DEX, WHT]`
Will post an explanation after any more golfing
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 36 bytes
```
ＦＡ⊞υ⟦⁻⌊∕Ｘ⊟ι²₂↔⊟ι⊟ι⊟ι⟧Ｗ⌈υ«≔Φυ¬⁼ικυ⟦⊟ι
```
[Try it online!](https://tio.run/##RY1PawJBDMXP@imGPWUhe6i1IngSqtCDy1KPwxxWnbrB2Y2d2dFC6Wefxn8YkvB4Ib@3bWq/5dql9MVewUd3jD3kuapiaCCi0ivqYoClY/bwTifaWaj4bL3sI1COaiSz/o61t5/MPcw34X66FKq7fgiTz4bnhpxVsKp/qI0tRIn7HQ7mIdC@gyW5XugSXQptIWAXgFAdrrQo74PKU9eDfgL/UtJaZ6XdZ1i8YPEqbVBna27tzRxjMcK3i1fy1ZniBMfGmFSc3D8 "Charcoal – Try It Online") Takes quadruples in the order name, weight, speed, dexterity. Explanation:
```
ＦＡ
```
Loop over the quadruples.
```
⊞υ⟦⁻⌊∕Ｘ⊟ι²₂↔⊟ι⊟ι⊟ι⟧
```
Square the dexterity, floor divide by the square rooted absolute speed and subtract the weight, then create a tuple with the result and the name and push that to the predefined list.
```
Ｗ⌈υ«
```
While there are still tuples in the list, take the maximum.
```
≔Φυ¬⁼ικυ
```
Remove the tuple from the list.
```
⟦⊟ι
```
Output the name on its own line.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~15~~ 14 bytes
```
ṛ²:A½$}ɗ_@3ƭ/Þ
```
[Try it online!](https://tio.run/##y0rNyan8///hztmHNlk5HtqrUntyeryD8bG1@ofn/dc53K6t/6hpjeGhZUDy6KSHO2eoABlZjxrmKOjaKTxqmMt1uB0oEPn/f3R0tLpjTmZyqrqOgqGOgpGOgnGsjkK0ulN@EkjEQEfBVEfBACzknJFYlJMJUmgMVmgYCxKOVo@CaAUhiFY0fkSkOtgUQ4QWv9R0oJiuMRRD1AXn56ZCJICKdYEW6JqAxf3yIaImOgpmOgoWUCPccvJB9ugB1RqBCGM9U7Bq3/yiVIicEZIMRI9Pfl5qTiWST0HCsbEA "Jelly – Try It Online")
A monadic link that takes a list of characters as its argument. Each list is structured as `[Name, SPD, DEX, WHT]`. Returns a list of characters in the desired order.
[Answer]
# [Python 3.8](https://docs.python.org/3.8/), 81 bytes
This solution uses the formula as described in the question.
As input a dictionary is expected in the following form: `{"name":[SPD, DEX, WHT],...}`
```
lambda d:sorted(n:={_:(i:=-a*a/abs(b)**.5+c)for _,(a,b,c)in d.items()},key=n.get)
```
[Try it online!](https://tio.run/##XU9NT4MwGL77K3qjxRfkY9WFhIOa7KS7eHG6ZSlQtkZoSeGCy347tmCmI22T9/l687Tpu6OS8bLRQ5luh4rVWcFQkbRKd7zAMklP@wSLJPWYy@5Y1uKMuK5Pb3NSKo32gBlkkBMhUeGLjtctJmf44n0q/QPvyNBoITtc4pOzUspJPiMIYbED54lpg@gFfY@IGnQm5OYv9ViJnBstBBQBiq1XZRYHgCigwBDPR6YrYU3xaApnKz7GuDk2/G9@3/w2mAfW/GAULwZ7rfNN1XwiKXgReLbyWk3MAu5hOVuwquxXQ59CZF7sU@N/VZpPfHRhr1MvSvKqN4bAdHq4Fg0YfgA)
[Answer]
# APL(NARS), chars 40, bytes 80
```
{⍵≡⍬:⍬⋄↑¨⍵[⍒{(4⊃⍵)-⍨⌊(2*⍨2⊃⍵)÷√∣3⊃⍵}¨⍵]}
```
test:
```
  f←{⍵≡⍬:⍬⋄↑¨⍵[⍒{(4⊃⍵)-⍨⌊(2*⍨2⊃⍵)÷√∣3⊃⍵}¨⍵]}
  ⎕fmt ,⊂(('Lonely') 1 2 3)
┌1────────────────┐
│┌4──────────────┐│
││┌6──────┐      ││
│││ Lonely│ 1 2 3││
││└───────┘ ~ ~ ~2│
│└∊──────────────┘3
└∊────────────────┘
  ⎕fmt f,⊂(('Lonely') 1 2 3)
┌1────────┐
│┌6──────┐│
││ Lonely││
│└───────┘2
└∊────────┘
  ⎕fmt (('Alice') 1 2 3)(('Bob') 10 5 0)(('Charlie') 3 2 1)
┌3──────────────────────────────────────────────────┐
│┌4─────────────┐ ┌4────────────┐ ┌4───────────────┐│
││┌5─────┐      │ │┌3───┐       │ │┌7───────┐      ││
│││ Alice│ 1 2 3│ ││ Bob│ 10 5 0│ ││ Charlie│ 3 2 1││
││└──────┘ ~ ~ ~2 │└────┘ ~~ ~ ~2 │└────────┘ ~ ~ ~2│
│└∊─────────────┘ └∊────────────┘ └∊───────────────┘3
└∊──────────────────────────────────────────────────┘
  ⎕fmt f (('Alice') 1 2 3)(('Bob') 10 5 0)(('Charlie') 3 2 1)
┌3─────────────────────────┐
│┌3───┐ ┌7───────┐ ┌5─────┐│
││ Bob│ │ Charlie│ │ Alice││
│└────┘ └────────┘ └──────┘2
└∊─────────────────────────┘
  ⎕fmt f ('Z' 1 1 1)('B' 1 1 1)(('XY') 5 1 1)
┌3────────┐
│┌2──┐    │
││ XY│ Z B│
│└───┘ ¯ ¯2
└∊────────┘
  ⎕fmt f (('Neg') ¯3 ¯3 ¯1)(('SomeNeg') 5 ¯2 ¯4)(('NoNeg') 4 6 8)
┌3─────────────────────────┐
│┌7───────┐ ┌3───┐ ┌5─────┐│
││ SomeNeg│ │ Neg│ │ NoNeg││
│└────────┘ └────┘ └──────┘2
└∊─────────────────────────┘
  ⎕fmt f ⍬
┌0─┐
│ 0│
└~─┘
  ⎕fmt f (('Flo') 1.5 2.5 3.5)(('MoreFlo') 2 2.5 3.5)
┌2────────────────┐
│┌7───────┐ ┌3───┐│
││ MoreFlo│ │ Flo││
│└────────┘ └────┘2
└∊────────────────┘
  ⎕fmt f (('Foo') 2 1 4)(('Baz') 5 5 4)(('Bar') 5 1 4)
┌3───────────────────┐
│┌3───┐ ┌3───┐ ┌3───┐│
││ Bar│ │ Baz│ │ Foo││
│└────┘ └────┘ └────┘2
└∊───────────────────┘
  ⎕fmt f (('Adam') 2 4 1)(('Eve') 2 3 1)
┌2─────────────┐
│┌4────┐ ┌3───┐│
││ Adam│ │ Eve││
│└─────┘ └────┘2
└∊─────────────┘
```
[Answer]
# [Perl 5](https://www.perl.org/) `-n`, 72 bytes
```
sub i{int($_[1]**2/sqrt abs$_[2])-pop}say$$_[0]for sort{i(@$b)-i@$a}eval
```
[Try it online!](https://tio.run/##PYzBasMwEETv/YqFGmSHlWvJ1SmXpKW95QuEKHKqUgXFUiU5UEJ@vapMoQN7mDczG0x0opS0TGCvds5t8yaZ2mz4Q/qKGfSUKuCqo8GHW9LfTbWD@vARko/5attdM3XU7hp9MxftyrZ2CK0i23s4LSlD9pBM0FFnA37JYcmwzrOp2VEnk0or984eDTLkOCqUT35CNqDAoZrnTx2dNTjWkKnurpVk/67PBIEjPCIwhSDJy8X8kXEla@vVeWS9QF5v7EX9dPDRrJT/s@7Hh2z9nAo9iH5gQ6HzLw "Perl 5 – Try It Online")
[Answer]
# [C++ (clang)](http://clang.llvm.org/), ~~324~~ \$\cdots\$ ~~232~~ 204 bytes
Saved ~~18~~ 46 bytes thanks to [cielingcat](https://codegolf.stackexchange.com/users/52904/ceilingcat)!!!
```
#import<regex>
#import<cmath>
#define i(s)int(*s**s/sqrt(abs(s[1])))-s[2]
struct C{std::string n;float s[3];};void f(std::vector<C>&v){std::stable_sort(&v[0],&*end(v),[](C a,C b){return i(a.s)>i(b.s);});}
```
[Try it online!](https://tio.run/##fZBRb5swFIXf8yssJkV2ZLIATVUBRVqR9rT1ZS/bKJoMuaSWwM5sgzZZ/PbUQJuoL7VsofP5XO65rk8nv26ZOJ7Pn3h3ksqkCo7wL1u9ybpj5tnJAzRcAOJYEy4M3ujNRn/Wf5XBrNJYF0FJCPF1EZYrbVRfG5RbbQ5x7BQXRySSppXMIF1EZTImg@QH1ODZMUBtpErzbD2QtxpWtfBHuwB4PRS7kq43IA54ILQocY4YzVFFrALTK@Eysa0mGceV@ySj25dhuHTtgXXZqtdzCtaBPrEakOuTuEFQx7jAxL5muETJBn1vrfW@tLwGj9qAhjQaR2q9B1lNekf3dDeD/Jmplk@myJmCcYLWe4SjI35Epx3Mxh@ygwXvqR9S/2amj3JhN/SW3r0W/547BnSpe3infv6afxBcOn1t5WTY7mnoTrTdz7bvUsFyE1757P8mBbT/rzM5OI5JIxVmvZFoiAdNbOPe@sogHkgte5OmsBVp6sXIS1OOwb23U0/CS5Zbz/9wTcZxPL8A "C++ (clang) – Try It Online")
# Ungolfed:
```
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;
struct C {
    string n;
    float s[3];
};
float i(C c) {
    return floor(c.s[0]*c.s[0] / sqrt(abs(c.s[1]))) - c.s[2];
}
void f(vector<C>&v) {
    stable_sort(begin(v), end(v),
        [](C a,C b) {
            return i(a) > i(b);
        });
}
```
]