[Question]
  [
Given a list of 2 or more strictly positive integers, sum the first and last half of the list, with the middle element being counted only in the right half if the list has an odd number of elements
Some examples of the middle element being counted in the right half:
```
[1, 2, 3, 4]       -> Left: [1, 2];    Right: [3, 4]
[1, 2, 3]          -> Left: [1];       Right: [2, 3]
[1, 2, 3, 4, 5]    -> Left: [1, 2];    Right: [3, 4, 5]
[1, 2, 3, 4, 5, 6] -> Left: [1, 2, 3]; Right: [4, 5, 6]
```
## Test Cases
### Input
```
[1, 9]
[9, 5, 5, 7]
[6, 7, 5, 1, 3, 9, 7, 1, 6]
[2, 8, 10, 9, 9, 3, 7, 8, 9, 8, 6, 1, 2, 9, 8, 3, 8, 9, 5]
[2, 3, 1, 8, 6, 2, 10, 6, 7, 6]
```
### Output
```
[1, 9]
[14, 12]
[19, 26]
[65, 59]
[20, 31]
```
[Reference Program With Two Output Methods](https://tio.run/##lZHLasMwEEX38xWDs7Go7Dy6M7SbtsuSLpJVMMGJx7HAlowsQ/z1riXl0bpQWoEQ3DtXc4ZpelMq@TgMom6UNlh08miUqlq4CDqTuaoBcirwIGSm@72mvDtSKKShE@mW@5BQkiWA46moMBy1OJUGn/BatksqkrcQw/kcVym/2z/dJHXfaTKdlri7ocUXgGtb7joyjr9UOBqWAhhqTTti7VIolEY5AtgZTxQuFws/gLS2nzu2z0gVLjlaHyeZSdWK42rBmON2jeKsaUjmoWQAM3wpbQhNSag603QGa5UTlqQphtl6u/nYbvbv69e3ESBQkqLxBjDRhRyDkc8HAKLAbwVfkn4bltiyWGjH5GV7Gm2hrcgxiKLngE9W7K0qqw95hmeOfYJnfMCeMaCqpX80YE6Du8j@lv0zj40Mwyc "Python 3 – Try It Online")
## Rules
* Input/Output can be Taken/Given in any convenient and reasonable format.
* Functions and full programs are both acceptable.
  
[Answer]
# [Python 2](https://docs.python.org/2/), 40 bytes
Takes as input a list \$ l \$, and outputs the two sums in reverse order (`[right, left]`).
```
lambda l:[sum(l.pop()for x in l),sum(l)]
```
## Explanation
In `sum(l.pop()for x in l)`, we pop the last element, in each iteration, and sum the popped elements. Surprisingly, the loop only runs \$ \lceil{\frac{|l|}{2}}\rceil \$ times, since for every element we iterate from the left, we are removing an element from the right, resulting in the loop terminating somewhere in the middle. Therefore it gives us the sum of the right portion of the list. The sum of the remaining elements make up the left portion.
[Try it online!](https://tio.run/##NY3dCsMgDEbv@xS5VJCxWmpnYU/SleFYSwWr0p91e3oXIgXRnO8kMf62KXiZxvsjOTO/3gZc2637zNwlhsj4GBb4gvXguKCY9@mYrBugbAuIi/UbjGz4GMcWczytj/vGOOepKwXovui0gJpOg6DwIUBZoSfEWqGTAm4IV4o1@YYiTbeiRnlidao6j1akc5/Ma/Jnqv8D "Python 2 – Try It Online")
[Answer]
# [Python 3.8](https://docs.python.org/3.8/), 41 bytes
```
lambda l:[t:=sum(l[:len(l)//2]),sum(l)-t]
```
[Try it online!](https://tio.run/##NY3RCoMgFIbvfYpzqdDWpmQZ9CTOi0bFBDMpN@jpmx0JRM/3f@ccwx4/ixdNWI@pex2un99DD67Vse2270ydbt3oqWNlyQ0rMGK3aA47h2WNsO0bIdOygrN@BOvP4L7FwfqWgIMOxl/v6CkZgbBaH@mUNrBDPwtQhmhVQIWnTiDTg5CkSB4x1TI5XkCT4IGxQl9jpPCW2MgvFJeq8qhAnft4XpM/k@YP "Python 3.8 (pre-release) – Try It Online")
Straightforward solution. Takes in a list, and returns the list of left and right sum.
---
Interesting idea that didn't go anywhere :(
### [Python 3](https://docs.python.org/3/), 45 bytes
```
lambda l,t=1j:l>[]and l[-1]+t*f(l[-2::-1],-t)
```
[Try it online!](https://tio.run/##NY3RDoMgDEXf@Yo@6obLxKiTxP0I84FFzVgQjZIlfj2rJSYEeu5py7L7z@yKMLavYPX07jVY7tv8K@1Tddr1YFWWd1d/GROshJRIPPNpMNMyrx62fWNsnFewxg1g3BHcNt8bJxlYaGH4aZscMmWwrMb5BDelaVA5h6ZjquFQ0qkRKnwIUBboCbGu0AkOD4Q7xQ35mqKG7ooaxYnFqco4WpCOfSKuiZ9V3R8 "Python 3 – Try It Online")
Returns `a+bj` where `a, b` is the right and left sum respectively.
[Answer]
# [Haskell](https://www.haskell.org/), ~~44~~ 43 bytes
```
f x=[sum$y(div(length x)2)x|y<-[take,drop]]
```
[Try it online!](https://tio.run/##PUzdCoIwFL7vKc5FFwqnaBvOBvkIPcEYMVBTdGuohULvvo4icTjw/Td27Kq@j7GGudDj2x2XpGw/SV/559TAnPJ0/i63k55sV2E5vIIx0dnWQwHOhvsDkjC0foIz1OkBQINmqAwhBK0wo8t3JjEnxlCgIsRQ7jrHK7ILiYqsnIiilxTgGxKbkv3DgpzV52tp3dx2TPwB "Haskell – Try It Online")
Based on [Steven Fontanella's answer](https://codegolf.stackexchange.com/a/204244/56656) with some non-trivial modification.
[Answer]
# [K (ngn/k)](https://bitbucket.org/ngn/k) / [oK](https://github.com/JohnEarnest/ok) / K4, 8 bytes
```
+/'2 0N#
```
[Try it online!](https://tio.run/##HYxRCoAwDEOvEvBjiohbxzbr7uAx5oew@//VbJTS5CX0O/rbzdq9n07gn8WaWwO0QpE4pSKjUAREosKbKwQXgqdX0kKj3MxMpoqTpNGLhCOS0R@f8mY/ "K (ngn/k) – Try It Online")
[Answer]
# [J](http://jsoftware.com/), 14 bytes
```
-@>.@-:@#+/\|.
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/dR3s9Bx0rRyUtfVjavT@a3KlJmfkK6QpGCoYKRijcBRM/gMA "J – Try It Online")
Output is in reverse.
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 3 bytes
```
ḍ+ᵐ
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/pfXa6koGunoFRu/6htw6Ompoe7Omsfbp3w/@GOXm0Q/T862lBHwTJWRyHaUkfBFIzMQTwzIA3mAaWNgSrAXCDbDCRppKNgAeQZgMUtwQrMwUKWYNIMrNIIxjWGSZlC9RqD5SEKjSDmQKwzi40FAA "Brachylog – Try It Online")
Brachylog's cut-a-list-in-half predicate just so happens to already make the right half larger.
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), ~~6~~ 5 bytes
Outputs the two sums in reverse order (right sum, then left sum)
```
sMc2_
```
[Try it online!](https://tio.run/##K6gsyfj/v9g32Sj@//9oIx0FYx0FQx0FCx0FMx0FINfQAMwyB5KxAA "Pyth – Try It Online")
```
 sMc2_
     _  Reverse the input
   c2   Chop into 2 equal-sized chunks, with the first chunk 
         one element longer if necessary
 sM     Sum each chunk
```
[Answer]
# Rust, 71 bytes
```
|x:&[u8]|{let s=x[..x.len()/2].iter().sum();(s,x.iter().sum::<u8>()-s)}
```
A closure that takes a reference to a slice of 8-bit unsigned numbers and returns a tuple of two 8-bit unsigned numbers.
[try it online](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&code=%0Afn%20main()%20%7B%0A%20%20%20%20let%20f%3D%7Cx%3A%26%5Bu8%5D%7C%7Blet%20s%3Dx%5B..x.len()%2F2%5D.iter().sum()%3B(s%2Cx.iter().sum%3A%3A%3Cu8%3E()-s)%7D%3B%0A%20%20%20%20assert_eq!((1%2C%209)%2C%20f(%26%5B1%2C%209%5D))%3B%0A%20%20%20%20assert_eq!((14%2C%2012)%2C%20f(%26%5B9%2C%205%2C%205%2C%207%5D))%3B%0A%20%20%20%20assert_eq!((19%2C%2026)%2C%20f(%26%5B6%2C%207%2C%205%2C%201%2C%203%2C%209%2C%207%2C%201%2C%206%5D))%3B%0A%20%20%20%20assert_eq!((65%2C%2059)%2C%20f(%26%5B2%2C%208%2C%2010%2C%209%2C%209%2C%203%2C%207%2C%208%2C%209%2C%208%2C%206%2C%201%2C%202%2C%209%2C%208%2C%203%2C%208%2C%209%2C%205%5D))%3B%0A%20%20%20%20assert_eq!((20%2C%2031)%2C%20f(%26%5B2%2C%203%2C%201%2C%208%2C%206%2C%202%2C%2010%2C%206%2C%207%2C%206%5D))%3B%0A%7D) on the rust playground.
[Answer]
# [Haskell](https://www.haskell.org/), 50 bytes
```
f x=(\(a,b)->sum<$>[a,b])$splitAt(length x`div`2)x
```
[Try it online!](https://tio.run/##RU/NCoMwDL7vKXLwoBDHVNQVpjB29glUpkOdZbUV2w3f3kWHLCHw/SWQvtavVoiFD6OaDNyUNJMSx0zJugG7U1N2d5YO5sQu7Bofjpvq93Cx0pxI6Vh6FNxcjS1a@TQ9zFXDP5XvzMtQcwkJbAcgPwBV7iEr8QcZhtTxTiOMiXoYICPkYbQbPp7RO5HKyIuJMJqIEv6Ggk0J/@mArDXgr1vr1agswYJi1uCm0KgtN05cGlLpLb18AQ "Haskell – Try It Online")
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 4 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
ŻŒH§
```
A monadic Link accepting a list which yields the pair: first-half-sum, last-half-sum.
**[Try it online!](https://tio.run/##y0rNyan8///o7qOTPA4t////f7SZjoK5joKpjoKhjoKxjoIlmAtkm8UCAA "Jelly – Try It Online")**
### How?
```
ŻŒH§ - Link: list, A
Ż    - prepend a zero to A
 ŒH  - split that in half (if the length is odd the first half gets the extra element)
   § - sums
```
[Answer]
# Rust macro, 480 bytes
```
macro_rules!f{($($r:expr)*)=>{f!(@I;[$($r),*];[];)};(@$($d:ident)*;[];[$($a:tt)*];$($b:tt)*)=>{f!(%($)0;0;[$($a)*]$($b)*)};(@$($d:ident)*;[$x:expr$(,$r:tt)*];[$($a:tt)*];$($b:tt)*)=>{f!(@I$($d)*;[$($r),*];[$($a)*;($($d)*,$x)];($($d)*,$x);$($b)*)};(%($m:tt)$s:expr;$t:expr;[;($($d:ident)+,$x:expr)$($a:tt)*]$(;)*($($e:ident)*,$y:expr)$($b:tt)*)=>{{macro_rules!i{($($d)*$m(I)+)=>{f!(%($m)$s+$x;$t+$y;[$($a)*];$($b)*)};($($d)*)=>{($s,$t+$y)};($m(I)*)=>{($s,$t)}}i!($($e)*)}};}
```
[try it online](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&code=%23!%5Bfeature(trace_macros)%5D%0A%0Atrace_macros!(true)%3B%0A%0A%2F%2F%20Define%20a%20macro%20called%20f%0Amacro_rules!%20f%20%7B%0A%0A%20%20%20%20%2F%2F%20This%20rule%20is%20the%20starting%20point%0A%20%20%20%20%2F%2F%20It%20matches%20any%20number%20of%20expressions%0A%20%20%20%20(%24(%24r%3Aexpr)*)%20%3D%3E%20%7B%0A%20%20%20%20%20%20%20%20%2F%2F%20Use%20the%20internal%20rules%20with%20an%20at%20sign.%0A%20%20%20%20%20%20%20%20%2F%2F%20Provide%20the%20I%20as%20the%20first%20index.%0A%20%20%20%20%20%20%20%20f!(%40%20I%3B%20%5B%24(%24r)%2C*%5D%3B%20%5B%5D%3B)%0A%20%20%20%20%7D%3B%0A%0A%20%20%20%20%2F%2F%20The%20rules%20starting%20with%20an%20at%20sign%20are%20responsible%20for%20producing%20a%20reversed%20version%0A%20%20%20%20%2F%2F%20of%20the%20input%20and%20counting%20with%20tallys.%0A%20%20%20%20%2F%2F%20This%20pattern%20is%20known%20as%20tt-muncher%20because%20it%20consumes%20a%20token%20tree%20recursively.%0A%0A%20%20%20%20%2F%2F%20This%20is%20the%20base%20case.%20It%20matches%20when%20the%20input%20is%20an%20empty%20set%20of%20brackets.%0A%20%20%20%20(%40%20%24(%24d%3Aident)*%3B%20%5B%5D%3B%20%5B%24(%24a%3Att)*%5D%3B%20%24(%24b%3Att)*)%20%3D%3E%20%7B%0A%20%20%20%20%20%20%20%20%2F%2F%20Call%20the%20second%20set%20of%20internal%20macros%20(the%20ones%20starting%20with%20a%20percent%20sign).%0A%20%20%20%20%20%20%20%20%2F%2F%20We%20use%20zeros%20as%20the%20accumulators%0A%20%20%20%20%20%20%20%20f!(%25%20(%24)%200%3B%200%3B%20%5B%24(%24a)*%5D%20%24(%24b)*)%0A%20%20%20%20%7D%3B%0A%20%20%20%20%2F%2F%20This%20is%20the%20recursive%20case.%0A%20%20%20%20%2F%2F%20It%20extracts%20one%20expression%20(called%20x)%20from%20the%20input.%0A%20%20%20%20(%40%20%24(%24d%3Aident)*%3B%20%5B%24x%3Aexpr%20%24(%2C%24r%3Att)*%5D%3B%20%5B%24(%24a%3Att)*%5D%3B%20%24(%24b%3Att)*)%20%3D%3E%20%7B%0A%20%20%20%20%20%20%20%20%2F%2F%20Call%20the%20at-macro%20recursively.%0A%20%20%20%20%20%20%20%20%2F%2F%20Add%20one%20I%20to%20the%20current%20tally%20list.%0A%20%20%20%20%20%20%20%20%2F%2F%20append%20(tallys%2C%20%24x)%20to%20the%20first%20%22array%22.%0A%20%20%20%20%20%20%20%20%2F%2F%20prepend%20(tallys%2C%20%24x)%20to%20the%20second%20%22array%22.%0A%20%20%20%20%20%20%20%20f!(%40%20I%20%24(%24d)*%3B%20%5B%24(%24r)%2C*%5D%3B%20%5B%24(%24a)*%3B%20(%24(%24d)*%2C%20%24x)%5D%3B%20(%24(%24d)*%2C%24x)%3B%20%24(%24b)*)%0A%20%20%20%20%7D%3B%0A%0A%20%20%20%20%2F%2F%20This%20part%20of%20the%20macro%20is%20called%20with%20the%20original%20and%20the%20reversed%20version.%0A%20%20%20%20%2F%2F%20The%20first%20argument%20is%20a%20dollar%20sign%20because%20that%20it%20needed%20later.%0A%20%20%20%20%2F%2F%20It%20extracts%20the%20count%20%24d%20and%20value%20%24x%20of%20the%20forwards%20array%2C%0A%20%20%20%20%2F%2F%20and%20count%20%24e%20and%20value%20%24y%20of%20the%20backwards%20array.%0A%20%20%20%20(%25%20(%24m%3Att)%20%24s%3Aexpr%3B%20%24t%3Aexpr%3B%20%5B%3B%20(%24(%24d%3Aident)%2B%2C%20%24x%3Aexpr)%20%24(%24a%3Att)*%5D%20%24(%3B)*%20(%24(%24e%3Aident)*%2C%20%24y%3Aexpr)%20%24(%24b%3Att)*)%20%3D%3E%20%7B%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20To%20compare%20the%20two%20tally%20counters%20at%20compile%20time%2C%20we%20use%20an%20internal%20macro.%0A%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20It%20defined%20rules%20based%20on%20%24d.%0A%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20The%20argument%20of%20this%20macro%20will%20be%20%24e.%20%0A%20%20%20%20%20%20%20%20%20%20%20%20macro_rules!%20i%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20This%20case%20matches%20when%20%24e%20is%20larger%20than%20%24d.%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20That%20means%20we%20haven%27t%20found%20the%20end%20yet.%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20(%24(%24d)*%20%24m(I)%2B)%20%3D%3E%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20call%20this%20part%20recursively%2C%20adding%20%24x%20and%20%24y%20to%20their%20accumulators%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20f!(%25%20(%24m)%20%24s%2B%24x%3B%20%24t%2B%24y%3B%20%5B%24(%24a)*%5D%3B%20%24(%24b)*)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20%24e%20and%20%24d%20are%20equal.%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20This%20case%20is%20reached%20when%20there%20is%20an%20odd%20number%20of%20element%20in%20the%20input.%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20(%24(%24d)*)%20%3D%3E%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20Add%20the%20value%20to%20the%20right%20accumulator%20and%20expand%20to%20a%20tuple%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20(%24s%2C%20%24t%2B%24y)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20%24e%20is%20less%20than%20%24d.%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20We%20have%20moved%20past%20the%20midpoint.%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20(%24m(I)*)%20%3D%3E%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20Expand%20to%20a%20tuple%20containing%20the%20accumulators%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20(%24s%2C%20%24t)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20call%20the%20internal%20macro%20with%20%24e%0A%20%20%20%20%20%20%20%20%20%20%20%20i!(%24(%24e)*)%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%3B%0A%7D%0Afn%20main()%20%7B%0A%20%20%20%20assert_eq!((1%2C%209)%2C%20f!(1%209))%3B%0A%20%20%20%20assert_eq!((1%2C%205)%2C%20f!(1%202%203))%3B%0A%20%20%20%20assert_eq!((14%2C%2012)%2C%20f!(9%205%205%207))%3B%0A%20%20%20%20assert_eq!((19%2C%2026)%2C%20f!(6%207%205%201%203%209%207%201%206))%3B%0A%20%20%20%20assert_eq!((65%2C%2059)%2C%20f!(2%208%2010%209%209%203%207%208%209%208%206%201%202%209%208%203%208%209%205))%3B%0A%20%20%20%20assert_eq!((20%2C%2031)%2C%20f!(2%203%201%208%206%202%2010%206%207%206))%3B%0A%20%20%20%20println!(%22tests%20passed%22)%3B%0A%7D)
This is kind of insane and I kind of hate myself now. The code defines a macro that takes a sequence of whitespace-seperated numbers and expands to a tuple of 2 integers. Everything is calculated at compile-time, so the code runs in \$O(1)\$, but compile times may vary.
For an introduction to Rust macros, I recommend [the Rust book](https://doc.rust-lang.org/book/ch19-06-macros.html), [the Rust refeence](https://doc.rust-lang.org/reference/macros-by-example.html) and [The Little Book of Rust Macros](https://danielkeep.github.io/tlborm/book/README.html).
## Explanation
So rust macros operate on token streams that are matched against patterns. For our case, the main difficulty is that you basically have to consume the token stream front-to-back.
To defeat this, I first replace the list of numbers with two numbers, where one of them is reversed. Also, to be able to find the middle, I put an index next to each number. Since yout can't evaluate integer expression like `0+1`, I use a tally counter made up of `I` identifier tokens. That way, I can detect the midpoint by comparing the length of the tally counter. Each part is replaced with ad addition of all its components, which can be evaluated at compile time.
### Example
Let's use `1 2 3` as an example. This shows the basic idea, but is still simplified a bit.
```
1 2 3
[1 2 3] [] []  // input forward backward
[2 3] [(I, 1)] [(I, 1)]
[3] [(I, 1); (I I, 2)] [(I I, 2); (I, 1)]
[] [(I, 1); (I I, 2); (I I I, 3)] [(I I I, 3); (I I, 2); (I, 1)]
0; 0; [(I, 1); (I I, 2); (I I I, 3)] [(I I I, 3); (I I, 2); (I, 1)]  // two accumulators
0 + 1; 0 + 3; [(I I, 2); (I I I, 3)] [(I I, 2); (I, 1)]
(0 + 1; 0 + 3 + 2)
```
Refer to the compiler output in the rust playground for the complete expansion.
```
// Define a macro called f
macro_rules! f {
    // This rule is the starting point
    // It matches any number of expressions
    ($($r:expr)*) => {
        // Use the internal rules with an at sign.
        // Provide the I as the first index.
        f!(@ I; [$($r),*]; [];)
    };
    // The rules starting with an at sign are responsible for producing a reversed version
    // of the input and counting with tallys.
    // This pattern is known as tt-muncher because it consumes a token tree recursively.
    // This is the base case. It matches when the input is an empty set of brackets.
    (@ $($d:ident)*; []; [$($a:tt)*]; $($b:tt)*) => {
        // Call the second set of internal macros (the ones starting with a percent sign).
        // We use zeros as the accumulators
        f!(% ($) 0; 0; [$($a)*] $($b)*)
    };
    // This is the recursive case.
    // It extracts one expression (called x) from the input.
    (@ $($d:ident)*; [$x:expr $(,$r:tt)*]; [$($a:tt)*]; $($b:tt)*) => {
        // Call the at-macro recursively.
        // Add one I to the current tally list.
        // append (tallys, $x) to the first "array".
        // prepend (tallys, $x) to the second "array".
        f!(@ I $($d)*; [$($r),*]; [$($a)*; ($($d)*, $x)]; ($($d)*,$x); $($b)*)
    };
    // This part of the macro is called with the original and the reversed version.
    // The first argument is a dollar sign because that it needed later.
    // It extracts the count $d and value $x of the forwards array,
    // and count $e and value $y of the backwards array.
    (% ($m:tt) $s:expr; $t:expr; [; ($($d:ident)+, $x:expr) $($a:tt)*] $(;)* ($($e:ident)*, $y:expr) $($b:tt)*) => {
        {
            // To compare the two tally counters at compile time, we use an internal macro.
            // It defined rules based on $d.
            // The argument of this macro will be $e.
            macro_rules! i {
                // This case matches when $e is larger than $d.
                // That means we haven't found the end yet.
                ($($d)* $m(I)+) => {
                    // call this part recursively, adding $x and $y to their accumulators
                    f!(% ($m) $s+$x; $t+$y; [$($a)*]; $($b)*)
                };
                // $e and $d are equal.
                // This case is reached when there is an odd number of element in the input.
                ($($d)*) => {
                    // Add the value to the right accumulator and expand to a tuple
                    ($s, $t+$y)
                };
                // $e is less than $d.
                // We have moved past the midpoint.
                ($m(I)*) => {
                    // Expand to a tuple containing the accumulators
                    ($s, $t)
                }
            }
            // call the internal macro with $e
            i!($($e)*)
        }
    };
}
```
[Answer]
# [Octave](https://www.gnu.org/software/octave/), 33 bytes
```
@(x)x*[u=(t=find(x))<mean(t);~u]'
```
[**Try it online!**](https://tio.run/##y08uSSxL/Z9mq6en999Bo0KzQiu61FajxDYtMy8FyNW0yU1NzNMo0bSuK41V/5@mEW2oYBmryQVkWCqYAqE5hGOmYA7kGCoYK1gCWYYKZhBhIwULBUMDoJglUMYcyLEEYjOgvBGYZQwWMYWpNQZKgKSNQHpAJgJN@Q8A "Octave – Try It Online")
### How it works
```
@(x)x*[u=(t=find(x))<mean(t);~u]'
@(x)                               % Define an anonynous function with input x
            find(x)                % Indices of nonzero entries of x. Gives [1 2 ... n]
                                   % where n is the length of x
         (t=       )               % Assign that to variable t
                    <mean(t)       % Test if each entry of t is less than the mean of t.
                                   % This gives [1 ... 1 0 ... 0], with floor(n/2) ones
                                   % and n-floor(n/2) zeros
       u=                          % Assign that to variable u
      [                     ;~u]   % Build a 2×n matrix containing u in the first row
                                   % and u negated in the second row
                                '  % Conjugate transpose. Gives an n×2 matrix
    x*                             % Matrix-multiply x (size 1×n) times the above n×2
                                   % matrix. Gives a 1×2 vector containing the result
```
[Answer]
# [brainfuck](https://github.com/TryItOnline/brainfuck), 180 bytes
```
++>>>>>+>,[[<]>+[>],]<[<]>[<+>-]<[<<<<[>>+<+<-]>[<+>-]>[<+>>>-[<<<[-]>>+>-]<[>+<-]<<[>-[>>>-<<<[-]]+<-]>-]>>>+<]>[<<+>+>-]<<[>>+<<-]>[>-<[-]]>[[>]<[<+>-]<[<]>-]>>>[<<[->+<]>>>]<.<.
```
[Try it online!](https://tio.run/##PY1dCsJADISxRU16lXR7gjAXCftgBUEEHwTPv2Z21bzkZ76Z7K/L/Xl7Xx@tmYFlWCO8wgJ1rc4x3FA4ZkUSbl5@196AQjFyxUBBhHQJqkOs3UcoZTrT2vGR2kOTJYnI9/5//HUFY7oXqW6@tTbJojqfReV0mFRm0eMH "brainfuck – Try It Online") (testcase [2, 8, 10, 9, 9, 3, 7, 8, 9, 8, 6, 1, 2, 9, 8, 3, 8, 9, 5])
Takes input as bytes on stdin.
Outputs the two sums as bytes on stdout in reverse order.
Compiled from this [VBF 1.0](https://github.com/zachs18/vbf/tree/1.0) code with mapping requirement `x:5` :
```
# set y to 2
y++
# Input is to the right of x; which is the length and the divdend
# Ensure that x is the rightmost variable
# x is the length of a length-prefixed array of numbers
x+>,[[<]>+[>],]
<[<]>
#cursor is at x
# x = x / y
# from user Calamari from esolangs wiki at https://esolangs.org/wiki/Brainfuck_algorithms
x[A+x-]
A[
 y[B+C+y-]
 C[y+C-]
 B[
  C+
  A-[C[-]D+A-]
  D[A+D-]
  C[
   B-
   [x-B[-]]+
  C-]
 B-]
 x+
A]
# After this, x = x / 2, A,B,C,D = 0, y = y
# If x, x = x - 1
# from https://esolangs.org/wiki/Brainfuck_algorithms#if_.28x.29_.7B_code_.7D
x[D+A+x-]D[x+D-]
A[
  x-
  A[-]
]
# Add up first half, cursor starts at x
# Requires that the cell to the left of x is 0
x[
  [>]<   # last input
  [<+>-] # add into left neighbor
  <[<]>- # back to x, decrement x
]
>>>
[
  <<[->+<]>>>
]<.<.
```
[Answer]
# [asm2bf](https://esolangs.org/wiki/Asm2bf), 157 bytes
A rather long submission. Let's take a look at the golfed code first:
```
@l
in r1
cner1,0
cadr2,1
cpsr1
cjn%l
movr3,r2
modr3,2
divr2,2
movr4,r2
addr2,r3
@x
popr1
addr5,r1
decr2
jnzr2,%x
@y
popr1
addr6,r1
decr4
jnzr4,%y
outr6
outr5
```
[**Try it online!**](https://tio.run/##5VTLagMxDPyWtrlNnS8Q@hHhQ1sIlEIOhX7/VpLttezdbE4lh5pA1rIeo9HY799vn9fLz8fXsoAhzAwi/elXsk9KWW2iH9D/lEncbI7JHPVY9Mi8hBJLyurSvc2sf@QRWBOKO1is2PaV@6rudbVUYSEcu68iKtY8OgrFNWZZi1QnbSraJVSynm8CsOo5r8gxlXb4rfZubp5aB1s5UAMoq4sMtEykzKgqbEwVSiLmDMem/PtOMfquTmoHBnY5VfMNWhvOQ4yundJib7OX6Mn7tKZEJTJPysl35FZcxY9RsovnrCDg96AUqYe25WQkkTRech@gNJKK7MseHbpJA01t0T72jDsqNIjCnSwEJrfsTeSJx9qtdc3anS1xniUHDUpnZI8gaZJOlejKs@bAAx4P2UjcBWWytpxUlQ43VcwufaKDB2Kr5VHMmGLDdfPnKEwb47jxp9LXyv9mBvN7MkzB2wdo/2q1RHj0SxTWmc5jP8fREa@9Rsvy9Pxy@gU "brainfuck – Try It Online")
# I/O format
The program takes input in form of so-called ASCII characters, and produces the output analogically. It's recommended to test the program on a 16-bit brainfuck interpreter (so that the addition doesn't overflow quickly).
**asm2bf** is a separate language to brainfuck, therefore the Brainfuck restrictions theoretically don't apply to it (because for instance, asm2bf specification says that registers for programmer's convience are at least 16 bits long), but as there is no asm2bf interpreter on TIO, I have to somehow cope with these limitations.
That being said, let's look at some I/O examples:
```
!"#$% => [33, 34, 35, 36, 37] => [33 + 34, 35 + 36 + 37] => [67, 108] => Cl
!"#$ => [33, 34, 35, 36] => [33 + 34, 35 + 36] = [67, 71] => CG
```
# Explanation
Let's take a look at the ungolfed representation of the code.
## Golfing 101
```
@inloop
    in r1
    cne r1, 0
    cadd r2, 1
    cpush r1
    cjn %inloop
    mov r3, r2
    mod r3, 2
    div r2, 2
    mov r4, r2
    add r2, r3
@right
    pop r1
    add r5, r1
    dec r2
    jnz r2, %right
@left
    pop r1
    add r6, r1
    dec r4
    jnz r4, %left
    out r6
    out r5
```
Let's answer two questions first:
`=>` Why does the code compile without spaces between operand and the operation?
The answer is quite simple: the assembler is a very primitive tool. It assumes instruction length of three, therefore after reading instruction name, all spaces are then consumed (but obviously there can be no spaces inbetween).
`=>` Why is there a space between `in` and `r1`?
`in` is a special instruction, because it has two character length. Under the hood, it's padded to three characters using the floor character (\_). Therefore, if the space was ommited, then the assembler would interpret `r` as the instruction name.
`=>` Instructions changed. `cpo` took place of `cpush`, `cad` of `cadd`. Why?
It is perfectly legal, because if every instruction has to have a three byte name, then there must be some alias that magically swaps long instruction names into short instruction names, right?
That's the full list of aliases, as of *v1.3.9* (taken from the `lib-bfm.lua` file):
```
; Don't ask questions, this is beyond explaining
?band=x00
?bor=x01
?bxor=x02
?bneg=x03
?cflip=x04
; Some common defines
?push=psh
?xchg=swp
; Conditional instructions
?cadd=cad
?csub=csu
?cmul=cmu
?cdiv=cdi
?cmod=cmd
?casl=csl
?casr=csr
?cpow=cpw
?cpush=cps
?cpsh=cps
?cpop=cpo
?cxchg=csw
?cswp=csw
?csrv=crv
?cmov=cmo
?crcl=crc
?csto=cst
?cout=cou
```
That being said, let's dive into the algorithm.
## Algorithm
Let's dissect the code step by step for better understanding:
```
@inloop
    in r1
    cne r1, 0
    cadd r2, 1
    cpush r1
    cjn %inloop
```
Some parts are obvious (label declarations for example), some are less. A new feature introduced around v1.3.5 named *conditional instructions* helps us greatly to solve this task.
The conditional pipeline of this fragment follows:
```
; if r1 is not zero, set the flag, otherwise clear it
    cne r1, 0
; if flag is set, add 1 to r2 (we accumulate the list length)
    cadd r2, 1
; push the number on the stack if the flag is set.
    cpush r1
; jump to @inloop if the flag is set.
    cjn %inloop
```
As you can see, it's quite simple to notice, that this tiny block of code will is responsible for:
* reading the list
* accumulating it's elements on the stack
* keeping track of the amount of elements read (in `r2`)
* looping until hit EOF
*Note: Yes, it's true that you have to set the stack before accessing it, otherwise stack overflow error occurs. In this case, I simply don't make memory accesses, so it's not required to set the stack (because it has nowhere to overflow to)*
Between these two loops, there is a tiny block of setup code:
```
; r3 = r2
    mov r3, r2
; r3 = r2 mod 2
    mod r3, 2
; r2 = r2 / 2
    div r2, 2
; r4 = r2
    mov r4, r2
; r2 = r2 + r3
    add r2, r3
```
This means, the register values are now:
```
r4 = r2 / 2
r3 = r2 mod 2
r2 = (r2 / 2) + r3
```
r3 is used as a flag to indicate whenever the middle element is present and it has to be merged to the list on the right (if count mod 2 is 1, then the count is odd, therefore we have a middle element obviously). The flag is added to the r2 register so the following loop will slurp it from the stack.
Next, there are two *very simillar* loops. Let's dissect these:
```
@right
    pop r1
    add r5, r1
    dec r2
    jnz r2, %right
@left
    pop r1
    add r6, r1
    dec r4
    jnz r4, %left
```
`@right` will execute until `r2` is not zero (id est, the amount of elements left to extract from the stack to make the *right* list). Everytime an element is popped, the pointer (`r2`) decreases and the popped value is added to `r5`.
This being said, `@right` will simply extract `r2` elements from the stack and sum them up to `r5`.
`@left` works pretty much the same (it will build the list on the left) returning the result in r6.
And finally, we output both values (sum for the left and the right):
```
    out r6
    out r5
```
# Appendix A
Generated brainfuck code (around 1.9 kilobyte):
```
+>+[>>>+<<+<<[>>->+<<<-]>>>[<<<+>>>-]<[->+<<[>>>-<<+<-]>[<+>-]>>[<->[-]]<[<<<+>>>-]<]>>[-]<<<<[>>+>+<<<-]>>[<<+>>-]>[[-]>>,>>>>>>>>>>>[-]<<<<<<<<<<<[<<<+>>>>>>>>>>>>>>+<<<<<<<<<<<-]<<<[->>>+<<<]>>>>>>>>>>>>>>[<<<<<<<<<<<<<+>>>>>>>>>>>>>-]<<<<<<<[<<<<<<->+>>>>>-]<<<<<[>>>>>+<<<<<-]<[>>>>>>>>>>>>>+<<<<<<<<<<<<<[-]]>>>>>>[-]+>>>>>>>[<<<<<<<[<<<+<<+>>>>>-]<<<<<[>>>>>+<<<<<-]>>>>>>>>>>>>[-]<+>]<[>+<-]<<<<<<[-]>>>>>>>[<<<<<<<<<<<[<+>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<-]<[>+<-]>>>>>>>>>>>>>>>>>[>>]+<<[<<]>[>[>>]<+<[<<]>-]<<<<[-]<+>]<[>+<-]<<<<<<+>>>>>>>[<<<<<<<<<<<<<<+>+>>>>>>>>>>>>>-]<<<<<<<<<<<<<<[>>>>>>>>>>>>>>+<<<<<<<<<<<<<<-]>[<<<[-]>[-]>>>>>>>>[<<<<<<<<+>+>>>>>>>-]<<<<<<<[>>>>>>>+<<<<<<<-]>[-]]>>>>>>[-]<<<<<<]<<<[>>+>+<<<-]>>[<<+>>-]>[[-]>>>>[-]<[>+<<<+>>-]<<[>>+<<-]>>>>>++[>>>>+<<<<-]<<[>>>>>+>-[<<]<[[>+<-]<<]<<<-]>>>>>[<<<<<+>>+>>>-]>[<<<<+>>>>-]<<<<[-]++<<<[<<<<+>>>>-]<<<<[>>>>>>>[<<<<<<+>+>>>>>-]<<<<<[>>>>>+<<<<<-]<[>+<<-[>>[-]>>>>>>+<<<<<<<<-]>>>>>>>>[<<<<<<<<+>>>>>>>>-]<<<<<<[<-[>>>-<<<[-]]+>-]<-]>>>+<<<<]>>>>>>>[-]<[-]<<[>>+<<<<+>>-]<<[>>+<<-]>>>[<+<<+>>>-]<<<[>>>+<<<-]<]>++<<+<<[>>->+<<<-]>>>[<<<+>>>-]<[->+<<[>>>-<<+<-]>[<+>-]>>[<->[-]]<[<<<+>>>-]<]>>[-]<<<<[>>+>+<<<-]>>[<<+>>-]>[[-]>>[-]>>>>>>>>>>>>>>>[-]>[>>]<<->[<<<[<<]>+>[>>]>-]<<<[<<]>[<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>-]<<<<<<<<<<<<<<<[>>>>>>>>>>>>+<<<<<<<<<<<<<+>-]<[>+<-]>>->>>++<<<[<<<<+>+>>>-]<<<<[>>>>+<<<<-]>[<<<[-]>[-]>>>>>>>>[<<<<<<<<+>+>>>>>>>-]<<<<<<<[>>>>>>>+<<<<<<<-]>[-]]>>>>>>[-]<<<<<<]>+++<<+<<[>>->+<<<-]>>>[<<<+>>>-]<[->+<<[>>>-<<+<-]>[<+>-]>>[<->[-]]<[<<<+>>>-]<]>>[-]<<<<[>>+>+<<<-]>>[<<+>>-]>[[-]>>[-]>>>>>>>>>>>>>>>[-]>[>>]<<->[<<<[<<]>+>[>>]>-]<<<[<<]>[<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>-]<<<<<<<<<<<<<<<[>>>>>>>>>>>>>+<<<<<<<<<<<<<<+>-]<[>+<-]>>>>->+++<[<<<<<<+>+>>>>>-]<<<<<<[>>>>>>+<<<<<<-]>[<<<[-]>[-]>>>>>>>>[<<<<<<<<+>+>>>>>>>-]<<<<<<<[>>>>>>>+<<<<<<<-]>[-]]>>>>>>[-]<<<<<<]<<<[>>+>+<<<-]>>[<<+>>-]>[[-]>>>>>>>>>>>>>>>.<.<<<<<<<<<<<<<<]<<<[>>+>+<<<-]>>[<<+>>-]>[[-]<<<[-]>[-]>>]<<]
```
# Appendix B
The code possibly can be golfed down using `constpp` - the tool used to set macros on certain `[A-Za-z]+` strings and alias them into other, preferably longer strings. Syntax: `?find=replace`
There is a tiny chance that one could golf the code down using Lua preprocessor. If you'd like to start a multiline Lua block, use `${...)` syntax; single line Lua statements can be prepended with `#`.
Example on both methods: [lib-bfm.lua](https://github.com/KrzysztofSzewczyk/asmbf/blob/master/lib-bfm.lua).
lib-bfm is a file included everytime an assembly program is built using `bfmake` tool (the one to assemble your code into a ready-to-use Brainfuck program). It's overall recommended to take advantage of it, because it contains some predefined macros (like a memory allocator or quite basic code-preprocessing capabilities).
PS: If anything is unclear, please let me know down in the comments. I'll try to clarify it when I'll have some time on my hands.
[Answer]
# brainfuck, 45 43 bytes
```
>>>,[>,[[<]>[<+>-]>[>]],]<[[>[<+>-]<<]>.<<]
```
Shorter, but assumes ',' continues to return 0 after EOF, not just the first time after EOF.
Earlier version:
```
>>>>>,[>+[<<]+>>->>[>>]+>,]<[[<[<<+>>-]<]<.<]
```
Reads numbers as characters, outputs right sum first.
[Answer]
# [APL (Dyalog Extended)](https://github.com/abrudz/dyalog-apl-extended), 12 bytes
Anonymous tacit prefix function
```
+/2 ¯.5⍴⌽,0⍨
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT9dNrShJzUtJTfn/X1vfSOHQej3TR71bHvXs1TF41Lvif9qjtgmPevsedTU/6l0DlDi03vhR28RHfVODg5yBZIiHZ/D/NAVDBUuuNAVLBVMgNAeyzBTMgSxDBWOgmDmQNgOKGSlYKBgaAAUsgcLmQI4lEJsBJY3ALGOwiClYoTFQFCRnBNIAMsuMCwA "APL (Dyalog Extended) – Try It Online")
`0⍨` zero
`⌽,` appended to the reverse of the argument
`2 ¯.5⍴` **r**eshape to 2 rows and as many columns as needed, chopping trailing elements if uneven
`+/` sum the rows
[Answer]
# JavaScript (ES6), ~~47~~ 45 bytes
Outputs in reverse order.
```
a=>[a.reduce(s=>s+a.pop(),0),eval(a.join`+`)]
```
[Try it online!](https://tio.run/##nc/dCoMgGAbg812Fh0rOypbNg7qRCJKyUURGbt1@sy86WYP9iIh/3/Nqp2Zlq6kd7@fB1Hpp0kWlWa7YpOtHpbFNM@spNpoRExoQqmfVY8U60w6lV5JiqcxgTa9Zb264wXlIkSwIQf8030db/ekFlRTF0JPfaUAvFIX8wAoHAutCI5cLSzcXX6QA6yq4OLCcoqtzAhAl0AlsSRgFZPB9Ge1H8Zq6smL9q3zHRlC6GXyL2P7w6cUry93tKCyWJw "JavaScript (Node.js) – Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 4 bytes
```
R2äO
```
[Try it online!](https://tio.run/##yy9OTMpM/f8/yOjwEv///6PNdBTMdRRMdRQMdRSMdRQswVwg2ywWAA "05AB1E – Try It Online")
[Answer]
# [Clojure](https://clojure.org/), 47 bytes
```
#(for[x(split-at(quot(count %)2)%)](apply + x))
```
[Try it online!](https://tio.run/##NY7bCsMgDEDf/YrAKETWwWZpO79FfChthQ6pvVjovt5lkYJoTk4u9j58jm1MOIwOXLqhC5s5cV/8FB9dxPUIEftwzBEKqWQhLXbL4r9wh1PKJAUOYR9XMCcYYV4laCuMLqHm0xI09DCQrMgzUtyQUyW8CZ6c1uxbTmm@Gy5UF1aXqnNrxTrXqTwmL6PR1gpctmmOfgZ0/7/K9AM "Clojure – Try It Online")
[Answer]
# [R](https://www.r-project.org/), ~~46~~ 45 bytes
```
sum((v=scan())[l<-1:(sum(v|1)/2)]);sum(v[-l])
```
[Try it online!](https://tio.run/##K/r/v7g0V0OjzLY4OTFPQ1MzOsdG19BKAyRYVmOoqW@kGatpDeZF6@bEav434zLnMuUy5DLmsgSyDLnMuLj@AwA "R – Try It Online")
*Edit: thanks to Giuseppe: -1 byte*
[Answer]
# [Risky](https://github.com/Radvylf/risky), 12 bytes
```
_?+_0\!?/_2_+?+_0+_0+_0
```
[Try it online!](https://radvylf.github.io/risky?p=WyJfPytfMFxcIT8vXzJcbl9cbis_K18wK18wK18wIiwiW1s2LCA3LCA1LCAxLCAzLCA5LCA3LCAxLCA2XV0iLDBd)
[Answer]
# [Thunno 2](https://github.com/Thunno/Thunno2), 4 [bytes](https://github.com/Thunno/Thunno2/blob/main/docs/codepage.md)
```
r2Ẇʂ
```
[Try it online!](https://Not-Thonnu.github.io/run#aGVhZGVyPSZjb2RlPXIyJUUxJUJBJTg2JUNBJTgyJmZvb3Rlcj0maW5wdXQ9JTVCMSUyQyUyMDklNUQlMEElNUI5JTJDJTIwNSUyQyUyMDUlMkMlMjA3JTVEJTBBJTVCNiUyQyUyMDclMkMlMjA1JTJDJTIwMSUyQyUyMDMlMkMlMjA5JTJDJTIwNyUyQyUyMDElMkMlMjA2JTVEJTBBJTVCMiUyQyUyMDglMkMlMjAxMCUyQyUyMDklMkMlMjA5JTJDJTIwMyUyQyUyMDclMkMlMjA4JTJDJTIwOSUyQyUyMDglMkMlMjA2JTJDJTIwMSUyQyUyMDIlMkMlMjA5JTJDJTIwOCUyQyUyMDMlMkMlMjA4JTJDJTIwOSUyQyUyMDUlNUQlMEElNUIyJTJDJTIwMyUyQyUyMDElMkMlMjA4JTJDJTIwNiUyQyUyMDIlMkMlMjAxMCUyQyUyMDYlMkMlMjA3JTJDJTIwNiU1RCZmbGFncz1W)
#### Explanation
```
r2Ẇʂ  # Implicit input
r     # Reverse the list
 2Ẇ   # Split it in two pieces
      # (with a left-bias)
   ʂ  # Sum each inner list
      # Implicit output
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 12 bytes
```
Ｆθ⊞υ⊟θＩ⟦ΣθΣυ
```
[Try it online!](https://tio.run/##S85ILErOT8z5/9@xuDgzPU8juDRXw7kyOSfVOSO/QKNQR8EjMacsNUXDJzUvvSRDo1BTU1NHIUPTmiugKDOvRMM5sbhEIzpDR8E3M6@0GKy7EKwgVlPT@v//6GgjHQULHQVDAx0FSzAy1lEwBwtZgkkzoJyOghGMawyTMo2N/a9blgMA "Charcoal – Try It Online") Link is to verbose version of code. Port of @dingledooper's answer. Explanation:
```
Ｆθ
```
Loop over the list.
```
⊞υ⊟θ
```
Move the last element of the list to the empty list.
```
Ｉ⟦ΣθΣυ
```
Output the sums of the lists.
[Answer]
# [C (gcc)](https://gcc.gnu.org/), 77 bytes
```
i,l;f(a,n)int*a;{l=0;for(n-=i=n/2;i--;!i?i=n,n=l=!printf("%u ",l):0)l+=*a++;}
```
Takes as input an array and its size.
[Try it online!](https://tio.run/##NYrNCoMwEITvPsU2UEh0Q63SH7uEPkjpIVhSAmkUq72Iz54ugsMwMPNNq99tm5LHQE5ajMrHMbc0B1OS6wYZtfEmHiryWtPO37lgNMHs@oGfTor9BAKDupUqFCa3RUFLYgIf66P8df6lsjkDlpOS98dTzRXCFeFYIjSra4TLOjVrnpkhVFutN3RaGDSKoJ/GrxRCUbakPw "C (gcc) – Try It Online")
[Answer]
# APL+WIN, 18 bytes
Prompts for vector of integers:
```
+/(2,⌈.5×⍴s)⍴s←0,⎕
```
[Try it online! Coutesy of Dyalog Classic](https://tio.run/##SyzI0U2pTMzJT9dNzkksLs5M/v@ob6qvz6O2CcZcjzra0/5r62sY6Tzq6dAzPTz9Ue@WYk0QAZQ20AEq/A9U8j@Ny1DBkitNgctSwRQIzbnSuMwUzIEsQwVjBUsgy1DBDChmpGChYGgAFLAECpsDOZZAbAaUNAKzjMEipmCFxkBRkJwRSAPILDMuAA "APL (Dyalog Classic) – Try It Online")
[Answer]
# [Red](http://www.red-lang.org), 52 bytes
```
func[a][reduce[sum take/part a(length? a)/ 2 sum a]]
```
[Try it online!](https://tio.run/##PU47DoMwDN05xRNTO1Q0QUDTob1D1yhDREypyk8hnJ86gGrL0vvY1vPk1hc5bZLmvjbLUGtrtCe31KTnpUewX8om6wPsqaPhHdon7DmDRHStMWszerJ1i0BzgE7ApQWU2ZFCwV0drETFTCCHYiRQHrrEDeLKomKrYqJ4Sl6QG8o3pfgv5@xEX8aj@JP/GD35z8AJ@rFze5j08kjR7JiD/gA "Red – Try It Online")
[Answer]
# [Husk](https://github.com/barbuz/Husk), 4 bytes
```
mΣ½↔
```
[Try it online!](https://tio.run/##yygtzv7/P/fc4kN7H7VN@f//f7SRjrGOoY6FjpmOkY6hAZAy1zGLBQA "Husk – Try It Online")
# Explanation
```
   ↔ Reverse the input
  ½  Split the input into about-equal parts of 2
m    For every item in the list:
 Σ       Sum this list
```
[Answer]
# [dc](https://www.gnu.org/software/bc/manual/dc-1.05/html_mono/dc.html), 35 bytes
```
?[zRla+salFx]sU[lb+sbz0<U]dsFxlblaf
```
[Try it online!](https://tio.run/##S0n@/98@uiooJ1G7ODHHrSK2ODQ6J0m7OKnKwCY0NqXYrSInKScx7f9/IwULBUMDBUsgNFYwB3IsgdhMwVDBCMwyBouYAgA "dc – Try It Online")
[Verify the test cases online.](https://tio.run/##TY5dC4IwFIbv9yteJAiKwA/UFlJXCV0FgVfRxdSZwlJxShH9dzszoja2nfO8D4elQpdjJnps0XbNtRM3RJG1P8bWuDs/T0ostVDx46KTs0qXOn3aUXLJdfxQqRLFSCJj97JSEp0UOVRVSwbkDV2AzMoG1qFuh36DmcmsHz8OveF/4sfAC3mGVfH9z0@YL8yaT/NrOTrgjMOnHbIAIb0OPHCqHATMxRqOTS0nGFLD6QQUuVPlTcQnzSNmEtfoZk7A3g)
Input is a space-separated list of numbers on stdin.
Output is on stdout, on two lines: the sum of the left part, then the sum of the right part.
**How it works:**
```
?        Read the input and push it on the stack.
            (The last number in the list is at the top of the stack.)
[        Start a macro.
 zR        Move the bottom item on the stack to the top, 
              moving the rest of the stack down one item.
 la+sa     Pop the top item on the stack and add it to register a.
              This number comes from the left part.
 lFx       Execute F recursively.
]sU      End the macro and name it U.
[        Start a macro.
 lb+sb     Pop the top item on the stack and add it to register b.
              This number comes from the right part.
              (Note that if the stack is empty so that there's
              nothing to pop, then b is left unchanged.
              This will happen the last time through when the
              original list had an even number of items.)
 z0<     If there's anything still on the stack,
 U         then execute macro U (which adds the bottom item on the
           stack to register a and then executes F recursively).
]dsFx    End the macro, name it F, and execute it.
lblaf    Print a, then print b.
```
[Answer]
# [C (gcc)](https://gcc.gnu.org/), 67 bytes
```
f(x,y,a,b)int*x,*y,*a,*b;{for(*a=*b=0;x<y--;*a+=x<y?*x++:0)*b+=*y;}
```
[Try the test cases online!](https://tio.run/##jY9da4MwFIbv8ytCoSUfR7C62maZDL9@RbeLRHF4UTvKGIr4210Sl91OCOGcJ897ktTBR10vS0sGGEGBpl3/xQZgIzAFTMupvT8IUynTaSiHlzEIJFM8NdUrGzh/DinTPGWjnBeTxDfV9eT73jUUTQhbkl3f0@kIWMxyBbkFAvDJrbPHhcWJAQ6bQGwyrjV14q3SWhHgi8GhE4Qzzw4JtycuEvk29kcnP6T6HRI7cU1E68D1AX/XKcBaIoRbkkHGIzgoOGgqPx/msCW7fYP3zVu/AydSacUccv60RSyg4GKLWELJj5vMCipufvGfOaPlBw "C (gcc) – Try It Online")
This is a function with two "in" parameters (`x` and `y`) and two "out" parameters (`a` and `b`).
Input is taken as an array of ints, and is passed as a [pointer `x` to the beginning of the array and a pointer `y` to (the location immediately after) the end of the array](https://codegolf.meta.stackexchange.com/a/14972/59825).
The function returns the left and right sums in `*a` and `*b`, respectively.
[Answer]
# Julia, 41 bytes
```
a->[sum(a[1:(e=end÷2)]),sum(a[e+1:end])]
```
]