[Question]
  [
You are given a list of at least two positive integers as input. The challenge is to find such a position of a cut that minimizes the absolute difference between the sums of the two parts (to the left and to the right of it). The position should be given as the index of the first element after the cut.
This is tagged [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest answer wins!
## Test cases
These are 0-indexed.
```
[1, 2, 3] -> 2
[3, 2, 1] -> 1
[1, 5, 3, 2, 4] -> 2 or 3
[1, 2, 4, 8, 16] -> 4
[1, 1, 1, 1, 1] -> 2 or 3
[1, 2, 4, 8, 14] -> 4
```
For example, for the first test case, if the cut is placed before the second element, the sums of the parts will be 1 and 5 and the absolute difference will be 4, and if the cut is placed before the third element, the sums will be equal and the absolute difference will be 0. Therefore, the correct output is 2 (assuming 0-indexing). If multiple correct outputs exist, you must output one of them.
## Explained examples
Input: `[1, 2, 3]`
```
Cut at 0: [] vs [1, 2, 3] -> 0 vs 1+2+3=6, difference is 6
Cut at 1: [1] vs [2, 3] -> 1 vs 2+3=5, difference is 4
Cut at 2: [1, 2] vs [3] -> 1+2=3 vs 3, difference is 0 (minimum)
Cut at 3: [1, 2, 3] vs [] -> 1+2+3=6 vs 0, difference is 6
```
Input: `[1, 2, 4, 8, 14]`
```
Cut at 0: [] vs [1, 2, 4, 8, 14] -> 0 vs 1+2+4+8+14=29, difference is 29
Cut at 1: [1] vs [2, 4, 8, 14] -> 1 vs 2+4+8+14=28, difference is 27
Cut at 2: [1, 2] vs [4, 8, 14] -> 1+2=3 vs 4+8+14=26, difference is 23
Cut at 3: [1, 2, 4] vs [8, 14] -> 1+2+4=7 vs 8+14=22, difference is 15
Cut at 4: [1, 2, 4, 8] vs [14] -> 1+2+4+8=15 vs 14, difference is 1 (minimum)
Cut at 5: [1, 2, 4, 8, 14] vs [] -> 1+2+4+8+14=29 vs 0, difference is 29
```
Input: `[1, 1, 1, 1, 1]`
```
Cut at 0: [] vs [1, 1, 1, 1, 1] -> 0 vs 1+1+1+1+1=5, difference is 5
Cut at 1: [1] vs [1, 1, 1, 1] -> 1 vs 1+1+1+1=4, difference is 3
Cut at 2: [1, 1] vs [1, 1, 1] -> 1+1=2 vs 1+1+1=3, difference is 1 (minimum)
Cut at 3: [1, 1, 1] vs [1, 1] -> 1+1+1=3 vs 1+1=2, difference is 1 (minimum)
Cut at 4: [1, 1, 1, 1] vs [1] -> 1+1+1+1=4 vs 1, difference is 3
Cut at 5: [1, 1, 1, 1, 1] vs [] -> 1+1+1+1+1=5 vs 0, difference is 5
```
  
[Answer]
# [Python 3](https://docs.python.org/3/), ~~50~~ 35 bytes
```
f=lambda a,*l:sum(l)>0and-~f(*l,-a)
```
[Try it online!](https://tio.run/##XZDNCoMwEITveYq9aSSC1h9aQV9EPKTYUCFGMemhiH11u1GIrRAI38zssMn4Ns9BJesqSsn7e8uBs0AW@tX7klYRV234EX4gWcjpah7aaCihJgB1zODCIGmYhWSDeAd0MnQ2KXWSBQZXTOVOO46riaPfHltypKNT/Bj/G8rdUHpqQCfbARe8ITekIUQME9inQae2WxeYGKdOGV94s1UWCCuY8R8s0MWj6xc "Python 3 – Try It Online")
### Explanation
*If the sum of elements on the left of `a` is smaller than the sum of elements right of `a`, then the cut must be after `a`* - explanation by [Surculose Sputum](https://codegolf.stackexchange.com/users/92237/surculose-sputum).
How I arrived here:
In each recursive call we compare `abs(sum(x[:i]) - sum(x[i:]))` to `abs(sum(x[:i+1]) - sum(x[i+1:]))`. If the first distance is larger, we continue with the next recursive call, if not the program is stopped:
```
f=lambda x,i=0:abs(sum(x[:i])-sum(x[i:]))>abs(sum(x[:i+1])-sum(x[i+1:]))and f(x,i+1)
```
This can be shortened by modifying the list to make the distance calculation simpler:
```
f=lambda x:abs(sum(x))>abs(sum(x[1:])-x[0])and 1+f(x[1:]+[-x[0]])
```
Even shorter if we take the input as single arguments:
```
f=lambda a,*l:abs(sum(x)+a)>abs(sum(x)-a)and 1+f(*x,-a)
```
By rearranging the formula ...
$$ |(\sum\_{k \in x}k) + a| > |(\sum\_{k \in x}k) - a| \\
\iff ((\sum\_{k \in x}k) + a)^2 > ((\sum\_{k \in x}k) - a)^2 \\
\iff ((\sum\_{k \in x}k) + a)^2 - ((\sum\_{k \in x}k) - a)^2 > 0 \\
\iff 4 \cdot (\sum\_{k \in x}k) \cdot a > 0 \\
\overset{a>0}\iff \sum\_{k \in x}k > 0 $$
... we arrive at the final solution:
```
f=lambda a,*x:sum(x)>0and-~f(*x,-a)
```
[Answer]
# [K4](https://www.kx.com/download/) / [K (oK)](https://github.com/JohnEarnest/ok), ~~22~~ ~~18~~ 14 bytes
**Solution:**
```
*&(+\x)>|+\|x:
```
[Try it online!](https://tio.run/##y9bNz/7/X0tNQzumQtOuRjumpsLKUMFIwUTBQsHQ5P9/AA "K (oK) – Try It Online")
**Explanation:**
Compare cumulative sum against reverse of the reverse cumulative sum.
```
*&(+\x)>|+\|x: / the solution
            x: / save input as x
           |x  / reverse
         +\    / cumulative sum 
        |      / reverse
       >       / greater than?
  (+\x)        / cumulative sum x
 &             / indices where true
*              / take first
```
[Answer]
# [MATL](https://github.com/lmendo/MATL), 13 bytes
```
t&+gREqY*|&X<
```
The output is 0-indexed. [Try it online!](https://tio.run/##y00syfn/v0RNOz3ItTBSq0Ytwub//2hDBSMFEwULBUOzWAUA) Or [verify all test cases](https://tio.run/##y00syfmf8L9ETTs9yLUwUqtGLcLmv0vI/2hDHQUjHQXjWK5oYzDLEMgCipkCxcB8EwgfxNJRsADKm0EEECgWAA).
### Explanation
Consider input `[1 2 4 8 16]` as an example.
```
t    % Implicit input. Duplicate
     % STACK: [1 2 4 8 16], [1 2 4 8 16]
&+g  % All pair-wise additions, then convert to logical. Gives square matrix of ones
     % STACK: [1 2 4 8 16], [1 1 1 1 1;
                             1 1 1 1 1;
                             1 1 1 1 1;
                             1 1 1 1 1;
                             1 1 1 1 1]
R    % Upper triangular matrix. Sets elements below the diagonal to zero
     % STACK: [1 2 4 8 16], [1 1 1 1 1;
                             0 1 1 1 1;
                             0 0 1 1 1;
                             0 0 0 1 1;
                             0 0 0 0 1]
Eq   % Times 2, minus 1, element-wise
     % STACK: [1 2 4 8 16], [ 1  1  1  1  1;
                             -1  1  1  1  1;
                             -1 -1  1  1  1;
                             -1 -1 -1  1  1;
                             -1 -1 -1 -1  1]
Y*   % Matrix multiplication
     % STACK: [-29 -25 -17  -1  31]
|    % Absolute value, element-wise
     % STACK: [29 25 17 1 31]
&X<  % Index of minimum entry
     % STACK: 4
     % Implicit display
```
[Answer]
# [Haskell](https://www.haskell.org/), ~~65~~ 36 bytes
```
(0%)
a%(b:c)|a<sum c=1+(a+b)%c
a%_=0
```
[Try it online!](https://tio.run/##y0gszk7NyfmfZhvzX8NAVZMrUVUjySpZsybRprg0VyHZ1lBbI1E7SVM1GSgTb2vwPzcxM0/BViE3scA3XkGjoCgzr0RBTyFNk0tBQSFaIdpQx0jHOBbE0VGINgZyDGEcQx1THZCACaqAIbqAMbIAULmOhY6hGUIECsECsf//JaflJKYX/9eNcA4IAAA "Haskell – Try It Online")
This answer really just uses one trick. Instead of caluclating
$$
\left|a-b\right|
$$
and taking the minimum, go until the left hand side is greater than the right hand side.
To see why this works we will show that:
$$
 \left|a-(b+c)\right| < \left|(a+b)-c\right| \implies a > c
$$
Here is the proof:
$$
\begin{matrix}
\left|(a-c)-b \right| < \left|(a-c)+b \right| &\implies \\
a - c > 0 &\implies \\
a > c
\end{matrix}
$$
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), ~~14~~ ~~12~~ 11 bytes
-1 byte thanks to @isaacg
```
lhoaysNsQ._
```
[Try it online!](https://tio.run/##K6gsyfj/PycjP7Gy2K84UC/@//9oQx0FIx0FEx0FCx0FQ5NYAA "Pyth – Try It Online")
```
lhoaysNsQ._
         ._  All prefixes of input list
  o           Sort, using the following function as the key:
   a          Absolute difference of
     sN        - the sum of the prefix
    y              times 2
       sQ      - the sum of the input list
 h            First such prefix
l             Take its length 
(which gives the index of the element immediately after the prefix)
```
This is based on the following identity:
\$ \left|\sum\_{b \in R} b - (\sum\_{q \in Q} q - \sum\_{b \in R} b) \right| = \left|2\sum\_{b \in R} b - \sum\_{q \in Q} q \right|\$
where \$R\$ is the current prefix and \$Q\$ is the input list.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 6 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
ÄḤạSỤḢ
```
A monadic Link accepting a list which yields the first available cut index.
**[Try it online!](https://tio.run/##ASQA2/9qZWxsef//w4ThuKThuqFT4buk4bii////WzcsOCw0LDIsMV0 "Jelly – Try It Online")**
### How?
```
ÄḤạSỤḢ - Link: list, X         e.g.  [ 7,  1,  1,  1,  1,  1,  1,  6]
Ä      - cumulative sums (X)         [ 7,  8,  9, 10, 11, 12, 13, 19]
 Ḥ     - double                      [14, 16, 18, 20, 22, 24, 26, 38]
   S   - sum (X)                     19
  ạ    - difference (vectorises)     [ 5,  3,  1,  1,  3,  5,  7, 19]
    Ụ  - grade                       [3, 4, 2, 5, 1, 6, 7, 8]
     Ḣ - head                        3
```
[Answer]
# [Python 3](https://docs.python.org/3/), 67 bytes
```
lambda l:min([abs(sum(l)-2*sum(l[:i])),i]for i in range(len(l)))[1]
```
[Try it online!](https://tio.run/##RYzdasQgEEbvfYohV1rMQn5aSiD7ItYLl03aAZ2I2sIS8uypupTCXMx3vjPjH@lro@Fc54/TGne7G7CTQ@LK3CKP345b0fYvdVETaiEk6nULgIAEwdDnwu1C2RJCdfpE57eQID4iY0WzSEsxM7jEdEeaGFgJhiLM4Izny4/JuWiX6C0m3rTXRggGIQtr/svAB6TE12a3B7RX2MMBag/znJ8cuhGn6iT0EgZd2p6pocauxo6V9jW3FY5/zvNklPCezbdKx0r/56n@Ag "Python 3 – Try It Online")
Straightforward implementation, can probably be golfed more. Output the 0-indexed cut.
[Answer]
# [J](http://jsoftware.com/), ~~16~~ 13 bytes
-3 bytes thanks to Jonah
```
1 i.~+/\>+/\.
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/DRUy9eq09WPsgFjvvyaXAldqcka@QpqCoYKRgjGMYwzkGCJkTMECJshKTRQsFAzNECJQ@B8A "J – Try It Online")
[Answer]
# JavaScript (ES6), ~~64~~ 48 bytes
Now very similar to [ovs' answer](https://codegolf.stackexchange.com/a/204215/58563), but we keep track of the left sum in \$s\$ rather than re-injecting the opposite values in the list.
```
f=([v,...a],s=0)=>s<=eval(a.join`+`)&&1+f(a,s+v)
```
[Try it online!](https://tio.run/##bc3RCoIwFMbx@z3FuZKNrdnUoovWi8jAYRrK2AkXe/0lSoTl4bv88T@jjTa00/B8HTzeu5R6TesopJTWiKCPTN/CVXfROmrliINveMOyTPGeWhF4ZKlFH9B10uGD9rRWAgoBpYH1GIM8h4L8qHJRaqsU@W@d5tZiK/NpAU5Qkt23lYDLnD2blVY76rttML0B "JavaScript (Node.js) – Try It Online")
NB: `eval(a.join('+'))` is *undefined* if \$a[\:]\$ is empty, so `s<=eval(a.join('+'))` is always *false* in that case.
[Answer]
# [Husk](https://github.com/barbuz/Husk), 8 bytes
```
η◄Ṁ≠½Σ¹∫
```
[Try it online!](https://tio.run/##yygtzv6fq1H8qKmxSPPQtv/ntj@a3vJwZ8OjzgWH9p5bfGjno47V////jzbUMdIxjuWKNgbShkDaUMdUB8Q2AbOBtI6FjqEZmAOFyBImsQA "Husk – Try It Online")
## Explanation
```
η◄Ṁ≠½Σ¹∫  Implicit input, say x = [5,2,2,3,6,2,6]
       ∫  Prefix sums: p = [5,7,9,12,18,20,26]
     Σ¹   Sum of x: 26
    ½     Halve: 13
  Ṁ≠      Absolute differences with elements of p: [8,6,4,1,5,7,13]
η◄        1-based index of minimal element: 4
```
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 20 [SBCS](https://en.wikipedia.org/wiki/SBCS) bytes
```
(⊃∘⍸((+\⌽)≥(⌽+\))∘⌽)
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///X@NRV/OjjhmPendoaGjHPOrZq/moc6kGkNaO0dQESQBF/qcpPGqboECMUi6uR31TQYrTFAwVjBSMEVxjINcQWdYULGSCqsFEwULB0AxZDAr/AwA "APL (Dyalog Unicode) – Try It Online") Port of [streetster's answer](https://codegolf.stackexchange.com/a/204219/75323) so be sure to upvote that one as well. This one is 1-indexed and returns the first option available.
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 29 [SBCS](https://en.wikipedia.org/wiki/SBCS) bytes
```
{0>+/1↓⍵:0⋄1+∇((-1∘↑),⍨1∘↓)⍵}
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///v9rATlvf8FHb5Ee9W60MHnW3GGo/6mjX0NA1fNQx41HbRE2dR70rIOzJmkA1tf/TFB61TVAgWR8X16O@qSCdaQqGCkYKxgiuMZBriCxrChYyQdVgomChYGiGLAaF/wE "APL (Dyalog Unicode) – Try It Online") This is 0-indexed and returns the second option, when available. Fairly direct port of [ovs's answer](https://codegolf.stackexchange.com/a/204215/75323) so be sure to upvote that answer as well!
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 14 bytes
```
ＩΣＥθ‹Σ…θ⊕κΣ✂θκ
```
[Try it online!](https://tio.run/##S85ILErOT8z5/z@gKDOvRMM5sbhEI7g0V8M3sUCjUEfBJ7W4GMx3rkzOSXXOyAeLeuYlF6XmpuaVpKZoZGtqauoogJQE52Qmp4KkQUIgYP3/f3S0oY6CqY6CsY6CkY6CSWzsf92yHAA "Charcoal – Try It Online") Link is to verbose version of code. 0-indexed. Port of @ovs's solution, except that I include the current element in each sum as the sum of an empty list is `None`. Explanation:
```
   θ            Input aray
  Ｅ             Map over elements
         κ      Current index
        ⊕       Incremented
       θ        Input array
      …         Sliced to that index
     Σ          Take the sum
    ‹           Is less than
             κ  Current index
            θ   Input array
           ✂    Sliced starting at that index
          Σ     Take the sum
 Σ              Take the sum
Ｉ               Cast to string
                Implicitly print
```
[Answer]
# [APL (Dyalog)](https://www.dyalog.com/), ~~25~~ 24 bytes
```
{(⊢⍳⌊/)|⍵+.×∘.(≤->)⍨⍳⍴⍵}
```
or
```
(|⍳⌊/∘|)∘.(≤->)⍨∘⍳∘⍴+.×⊢
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///P@1R24RqjUddix71bn7U06WvWfOod6u23uHpjzpm6Gk86lyia6f5qHcFSLZ3C1CqFqhFwVDBSMGYK03BGEgbcoH4pmC2CRdEzkTBQsHQDMyBQgA "APL (Dyalog Unicode) – Try It Online")
Using a variation on [*@LuisMendo*'s method](https://codegolf.stackexchange.com/a/204224/65326).
**How?**
`⍳⍴⍵` gives the range `1 .. n` where `n` is the array size.
`∘.(≤->)⍨⎕` performs an outer product with `x≤y - x>y` (`1` for upper triangular, `-1` for lower)
`⍵+.×⎕` matrix-multiplies with the array
`|⎕` does absolute value, and
`⎕⍳⌊/⎕` searches the minimum index of the result
[Answer]
# [Racket](https://racket-lang.org/), 71 bytes
```
(define(f a[s 0][n 0])(if(<(apply + a)s)n(f(cdr a)(+(car a)s)(+ n 1))))
```
[Try it online!](https://tio.run/##bc6xCgIxDAbg3af4wcGULtZTcfBNDofQa6VYQmld7uk1d@ckTSAk@SCksn@F92efWZ6o20BTiEkCRfDYcHyMosVQinQnLiXPsGDTjFAkP1XtyZLnui7JQuCMht5JrWSes0BvHcjhhEFh9w@DguuBwwULnvuogBvcta@/XD75Ag "Racket – Try It Online")
1-indexed
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 10 bytes
```
ḣJ§ạSH$iṂ$
```
[Try it online!](https://tio.run/##ASsA1P9qZWxsef//4bijSsKn4bqhU0gkaeG5giT///9bMSwgMiwgNCwgOCwgMTZd "Jelly – Try It Online")
### How?
```
ḣJ§ạSH$iṂ$ - Main link (with input l, e.g. l = [1, 2, 4, 8, 16])
       iṂ$ - Get the index of the smallest element of
   ạ         - the absolute difference between
    SH$        - sum of elements in l divided by 2 and
ḣJ§            - for n in range(1, len(l)), get sum of the first n elements of l, e.g. [1, 3, 7, 15, 31]
```
[Answer]
# [05AB1E (legacy)](https://github.com/Adriandmen/05AB1E/tree/fb4a2ce2bce6660e1a680a74dd61b72c945e6c3b), 8 bytes
Port of Zgarb's Husk answer. The index is 0-based.
```
ηOsO;αWk
```
[Try it online!](https://tio.run/##MzBNTDJM/f//3Hb/Yn/rcxvDs///jzbVMQJCYx0zIGkWCwA "05AB1E (legacy) – Try It Online")
# [05AB1E (legacy)](https://github.com/Adriandmen/05AB1E/tree/fb4a2ce2bce6660e1a680a74dd61b72c945e6c3b), 12 bytes
```
āΣôćs˜OsOα}¬
```
[Try it online!](https://tio.run/##ASkA1v8wNWFiMWX//8SBzqPDtMSHc8ucT3NPzrF9wqz//1szLCAxLCAyLCAzXQ "05AB1E (legacy) – Try It Online")
# Explanation
```
ā            Length-range with the input.
 Σ           Sort by this:
  ô          Split input into chunks of current item.
   ć         Head extract,
    s        Put head in the back,
     ˜       Flatten.
      OsO    Sum head & tail.
         α}  Absolute difference between these parts.
           ¬ Take the first item of this sorting.
```
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 55 bytes
```
Abs@ReplaceList[#,{x__,y__}:>Plus@x-Plus@y]~Ordering~1&
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE78n2773zGp2CEotSAnMTnVJ7O4JFpZp7oiPl6nMj6@1souIKe02KFCF0xVxtb5F6WkFmXmpdcZqv0PADJKFBzSo6sNdRSMdBSMa2O5EGLGYDFDFDGgOlOgOrCMCboMSExHwQKoxwxdCoFqY///BwA "Wolfram Language (Mathematica) – Try It Online")
24 bytes saved @Kyle Miller  
2 byte from my @pronoun is monicareinstate
[Answer]
# [Red](http://www.red-lang.org), 60 bytes
```
func[a][s: 0 i: 1
while[(s: s + take a)<= sum a][i: i + 1]i]
```
[Try it online!](https://tio.run/##RYzLCsIwEEX3@YpLV4oIxlaRoH6E22EWoU1osC@aFj8/jtbHzObcw@WOrko3VxErb5D83JVkmaLBDsFAq0cdGkcrEREbTPbuYNfnC@LcQorSCeI1B06@H50ta0wuTiAFOdLYI@eFc2HNX3/AKxf87xU4QR9/4vOsmIYxdDLZ9k21rGfba@bfyIz0BA "Red – Try It Online")
1-indexed
[Answer]
# [Perl 5](https://www.perl.org/) -aple, 39 bytes
```
my$i;@F=map{(++$i)x$_}@F;$_=$F[$#F/2-1]
```
[Try it online!](https://tio.run/##K0gtyjH9/z@3UiXT2sHNNjexoFpDW1slU7NCJb7Wwc1aJd5WxS1aRdlN30jXMPb/f0MFIwVjLmMgachlqGCqAGKZcIFETRQsFAzNgEwo/JdfUJKZn1f8XzexIAcA "Perl 5 – Try It Online")
...or 42 bytes:
```
sub f{my$i;@_=map{(++$i)x$_}@_;$_[@_/2-1]}
```
[Try it online!](https://tio.run/##RYzNCoMwEITvPsVScogYKf6Voih5gd56kxBaiCVQqxgFRXx2u41iQ0hmv5nZVnXvZF3N8IRqrieiMy7z@tHO1POIdkciFy4zIksuz6EfiGUdjIK7Mn2a3ppOQY/S5EWSOVXTUQfwlCGDMmCAXyQE2xjOZWRZcLBoyyWYs058OPGxAdUVO5fD2pf/rxCOO1uvnihRY8uI/rRuzonMdgzk1fR5Rbl1NqoN/VFmG3BCmdoYWkhQ44vaVsAv7HzC7rJ@AQ "Perl 5 – Try It Online")
[Answer]
# [Haskell](https://www.haskell.org/), ~~101~~ 85 bytes
```
f x=snd$minimum$(`zip`[0..])$(\(a,b)->abs$sum a-sum b).(`splitAt`x)<$>[0..length x-1]
```
[Try it online!](https://tio.run/##Xc9NCsIwEAXgvaeYRRYJpMVYFRe2IK57gjbYlFYN5qckKRQvX1N1ozMwi48Hj7kL/@iVmqUerAtwtiY4q9LSGtEBvlpXXsh8hSn3pkNaGqlHjXDzlENTrdOUE4RrLGhLkkK0HvlRg0iW25IUN35QMpxCM5EjKpa86s0t3GFKGJ@1kAZy6OwK4F0EVcXohmacRvlOlUVhP8Loji66/dMo9EDZ/o@/yzkgqCcPSfGpBBicNCFqfM9HcH0YnQFM5hc "Haskell – Try It Online")
Less golfed:
```
minIndex f=snd.minimum.(`zip`[0..]).map f
f x = minIndex inner [0..length x-1]
  where 
    inner = (\(a, b)->abs$ sum a - sum b) . (`splitAt` x)
```
[Answer]
# [C# (Visual C# Interactive Compiler)](http://www.mono-project.com/docs/about-mono/releases/5.0.0/#csc), ~~58~~ 49 bytes
Uses a variable declaration via `is` to avoid declaring a proper body and having to type the excessively long word `return`.
For some reason List has the method `FindIndex`, but other `IEnumerable`s don't seem to.
```
a=>0is var s?a.FindIndex(e=>(s+=e)>a.Sum()-s+e):0
```
[Try it online!](https://tio.run/##Sy7WTS7O/O9Wmpds45NZXGKTmVdip6MAIhXcFGz/J9raGWQWK5QlFikU2yfquWXmpXjmpaRWaKTa2mkUa9umatol6gWX5mpo6hZrp2paGfy35uIKKALq13DTyEstj46tNtRRMNJRMK7VC8kH2aChqalpjabEGKzEEJ8SoCmmQFPACk0IKAQp0VGwAJpoRkAlAhFtJPGWm6Oo/A8A "C# (Visual C# Interactive Compiler) – Try It Online")
[Answer]
# [C (gcc)](https://gcc.gnu.org/), 112 bytes
```
l;r;f(int n,char**m){char*i=*(m+1),*j=i;while(*j++);for(j-=2,r=l=0;i<=j;)l<r?l+=*i++:(r+=*j--);return i-*(m+1);}
```
[Try it online!](https://tio.run/##JY7LDoIwFET3fEWjMenTCO68VH@EDRaQ25RirhBJjN9eUXcnk8mZcebmXEoBCDqOcWJRu74mKQfx@gFayQeVCy29RXj2GFouvVICupG4N7bQZIM9AJbWgwglXYKyEpU6cVrBGyOA2mmmyND8XfBOW4wuzE3LysfU4Ljvz9lQY/xdqDX7TjMpr@KVMXanNe34ZtdUcaNZx9fCVQjI3ilVS14tRbUcPw "C (gcc) – Try It Online")
Unfortunately I did not figure out how to input hex characters as arguments into the program with the online view.  
Basically the input consists of a single "argument" which is the array of numbers.
[Answer]
# [Desmos](https://desmos.com/calculator), ~~69~~ 66 bytes
```
f(l)=L[∑_{n=1}^Ll[n]>=∑_{k=L}^{L.max}l[k]][1]
L=[1...l.length]
```
Returns 1-based indices. Uses the same strategy as ovs's [Python answer](https://codegolf.stackexchange.com/a/204215/96039)
[Try It On Desmos!](https://www.desmos.com/calculator/f3rgr4ssrl)
[Try It On Desmos! - Prettified](https://www.desmos.com/calculator/lcdrfv9u9a)
[Answer]
# Scala, 117 bytes
```
def g(l:List[Int],s:Int,i:Int):Int={val h::t=l;if(t==Nil)i else if(s+h>t.sum)if(s<l.sum)i+1 else i else g(t,s+h,i+1)}
```
[Answer]
This question deserved a lengthy suboptimal PHP answer, that has to cope with the fact that the arguments array starts with the script name, forcing me to add the `$i>1` test that leads to extra brackets, and such oddities..
# [PHP](https://php.net/), 124 bytes
```
$f=array_sum;$g=array_slice;for($a=$argv;$a[++$i];$s=$r)if(($s<$r=abs($f($g($a,$i))-$f($g($a,0,$i))))&$i>1)break;echo($i-2);
```
[Try it online!](https://tio.run/##PcpRCsIwEEXRzTwkQy2Y0g8hTV2IiExLkgaVhgkKrn4sgv5cOHDLUnQ4la2InkX4fa3Ph0P64Z7n4OIqBuzBkl4OfG4a5ItD9RDK0RjUAeJ5qgbRIG3vHpmo/evwNdEOebQ0SeCbC/OyGuS2I6eqVjvt9ai2/wA "PHP – Try It Online")
[Answer]
# [Java (JDK)](http://jdk.java.net/), 84 bytes
```
a->{int i=0,j=a.length-1,l=0,r=0,t;for(;i<j;)t=l<r?l+=a[i++]:(r+=a[j--]);return-~i;}
```
[Try it online!](https://tio.run/##bZAxa8MwEIX3/IojYLAbWTRthhLFKVkKHTqlW/BwTWxXriwZ6RwIwf3rrmynLaQFHdK9d@J7XIlHjMvDRyer2liC0ve8Ian4jZj80fJG70ka/a/pyGZY9dZeoXPwglLDeQJQN29K7sERkr@ORh6g8l64JSt1sUsBbeGiYRTg1TxrerpwVlLTLl1DnnQYr8@@A5ncsjJBrjJd0Hs8Z8oL1heJ3NhQyFUpIkrUyj6qWYI7OZuly9D2zzKO00jYjBqr408p2k4MyAHiY1DmyEFyCQJwhjmDOwb30LIracHggcF8ceX8nm@jHRF9tCPaAbEcQdEPZ3tylFXcNMRrvxHKw2nglhAcAj1lsLEWT46TGdcV9p8jBjnHulanjfPrGrVoRLWTvtruCw "Java (JDK) – Try It Online")
## Credits
* -1 byte thanks to [ceilingcat](https://codegolf.stackexchange.com/users/52904/ceilingcat)
]