[Question]
  [
Your challenge today is to take an array, split it into chunks, and add those chunks.
Here's how this works: Your program or function will be given an array of integers `a` and a chunk size `L`. The array should be split into arrays of size `L`, if the array length is not divisible by `L` then the array should have 0's appended to it so that it is evenly divisible. Once the array is chunked, all chunks are to be added together element-wise. The resulting array is then output.
You can assume `L` is greater than 0, and that `a` is nonempty. You cannot make the assumption that `a`'s contents are positive.
Here's an example:
```
[1,2,3,4,5,6,7,8], 3 => [1,2,3]+[4,5,6]+[7,8,0] =>  [1+4+7,2+5+8,3+6+0] => [12,15,9]
```
Test cases:
```
Array                           Length   Output
[1]                             1        [1]
[1]                             3        [1,0,0]
[0]                             3        [0,0,0]
[1,2]                           3        [1,2,0]
[1,2]                           1        [3]
[-1,1]                          2        [-1,1]
[-7,4,-12,1,5,-3,12,0,14,-2]    4        [12,-1,0,1]
[1,2,3,4,5,6,7,8,9]             3        [12,15,18]
```
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), fewest bytes wins!
  
[Answer]
# [Python 3](https://docs.python.org/3/), 67 65 42 bytes
Uses the fact that the sum of an empty array is 0
```
lambda x,y:[sum(x[i::y])for i in range(y)]
```
[Try it online!](https://tio.run/##TU/bDoIwFHuWr1h8YklJtoE3kvkjczETQUkUDWAiX49nw9vL0nZtT3of@vOtScdK78aLux6Ojj0x5KZ7XOOnqfN8sLy6taxmdcNa15zKeOB27Muu3xeuKzummTFGWkjQaxFwShgCInARuPhyCfV2qH@F8mlgiQRVKEwgKCtkSKQizwJJCkICkiSKZVSk6NMrnzJqz8i5xAprbKZjFF5Arq21UeQHORxQ@FG/KXk0u7d108f8A7xprrdzVB7yrz5RrQs@vgA)
[Answer]
# [MATL](https://github.com/lmendo/MATL), 4 bytes
```
e!Xs
```
[Try it online!](https://tio.run/##y00syfn/P1Uxovj//2hdcx0THV1DIx1DHVMdXWMdIMtAxxAoZBTLZQIA "MATL ‚Äì Try It Online")
First bit of MATL code I've written! Takes two inputs, `a` as a row vector (comma-separated) and `l` as a number. Works out to be
```
e          # reshape `a` into `l` rows (auto pads with 0)
 !         # transpose
  Xs       # sum down the columns
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~7~~ 6 bytes
1 byte thanks to Dennis.
```
;0$¬°sS
```
[Try it online!](https://tio.run/##y0rNyan8/9/aQOXQwuLg////RxvG/jcGAA "Jelly ‚Äì Try It Online")
[Answer]
# Mathematica, 27 bytes
~~*Mathematica almost had a builtin for this*~~
```
Total@Partition[##,#2,1,0]&
```
[Try it on Wolfram Sandbox](https://sandbox.open.wolframcloud.com)
### Usage
```
Total@Partition[##,#2,1,0]&[{-7, 4, -12, 1, 5, -3, 12, 0, 14, -2}, 4]
```
> 
> `{12, -1, 0, 1}`
> 
> 
> 
### Explanation
```
Total@Partition[##,#2,1,0]&
      
      Partition[##,#2,1,0]   (* Partition the first input into sublists of length
                                second input, using offset second input, and
                                right-pad zeroes for incomplete partitions *)
Total@                       (* Add all *)
```
[Answer]
# [Python 2](https://docs.python.org/2/), 49 bytes
```
lambda x,n:map(sum,zip(*zip(*[iter(x+n*[0])]*n)))
```
[Try it online!](https://tio.run/##TU9dj4IwEHyWX9H4RLkhaQueH0n9I7W5VIRIIpVATdQ/z@0VvbuXzczszGy2f4Tz1aup0Yfp4rrjybE7/K5zfTreOjzbPs3iMG2oh/T@4TMjLLeZ55xPoR7DV@XGemSaGWOkhQRNi4gLwhAQkYvIxS@XUC@H@q9Qvogsl6AKhRlEZY0SuVTkWSEvQEhAkkSxkooULX@Udxm1l@T8xBobbOdjFF5Bbqy1SdJcB@ZwRMVaz/5e2SWLfmh9iLul3i/RpAT5W56Z1hWbvgE "Python 2 ‚Äì Try It Online")
[Answer]
# JavaScript (ES6), 51 bytes
```
a=>n=>a.map((v,i)=>o[i%n]+=v,o=Array(n).fill(0))&&o
```
Takes input in currying syntax: `f([1,2])(3)`.
## Test Cases
```
let f=
a=>n=>a.map((v,i)=>o[i%n]+=v,o=Array(n).fill(0))&&o
;[[[1], 1], [[1], 3], [[0], 3], [[1,2], 3], [[1,2], 1], [[-1,1], 2], [[-7,4,-12,1,5,-3,12,0,14,-2], 4], [[1,2,3,4,5,6,7,8,9], 3]]
.forEach(([A,N])=>console.log(`${JSON.stringify(A)}, ${N} -> ${f(A)(N)}`))
```
```
.as-console-wrapper{max-height:100%!important}
```
[Answer]
# Mathematica, 58 bytes
```
Total@Partition[PadRight[#,(s=Length@#)+Mod[-s,#2]],{#2}]&
```
**Input**
> 
> [{1},3]
> 
> 
> 
**Output**
> 
> {1,0,0}
> 
> 
> 
[Answer]
## Java 7, 86 bytes
No fancy folds or matrices, just a good ol' fashioned `for` loop :)
```
int[]o(int[]a,int l){int i=0,o[]=new int[l];for(;i<a.length;)o[i%l]+=a[i++];return o;}
```
[Try it on Ideone](https://ideone.com/j3MjBh)
Lined:
```
int[]o(int[]a,int l){
    int i=0,
        o[]=new int[l];
    for(;i<a.length;)
        o[i%l]+=a[i++];
    return o;
}
```
[Answer]
# [Husk](https://github.com/barbuz/Husk), 9 bytes
```
S‚Üë»Ø¬°¬¨F≈º+C
```
[Try it online!](https://tio.run/##yygtzv7/P/hR28QT6w8tPLTG7egebef///@b/I/WNdcx0dE1NNIx1DHV0TXWAbIMdAyBQkaxAA "Husk ‚Äì Try It Online")
### Explanation
```
        C    Cut into lists of length n
     F≈º+     Sum them element-wise
  »Ø¬°¬¨        Append infinitely many 0s
S‚Üë           Take the first n elements
```
[Answer]
# [Perl¬†6](https://perl6.org), 36 bytes
```
{[Z+] flat(@^a,0 xx$^b*2).rotor($b)}
```
[Test it](https://tio.run/##jZFPb4JAEMXv@ynmoAV0WFkQtRINPfTmoYemhxJNUNeWBIGwa0Nj/Ox0EWMhTY172Oyf38ubeZPxPB6VB8Hha0Q3HnnJ030kOI0S3TWo/OTJ9MiLSJ7I/hseNumWw6w8Bu/9JeziUOr@KkQLiqKzWvdsg@apTHO9szZOpeJ9yYWEGcRRwoVu0H2YTaFHn9@eFh6pPF/Vv0eyOEygf4Y9skvzi86cg@6H2InR50XGN5JvDTgSgEiYW86z@BuqemrGoItISIQrWt8VLbI8SuQONB26jiVQ7QIMAJjNoctcoVUQgB/STGVBxWEtpD7QQBugpuH0w6j/VRk1dzX4B/fIqQwY2ujgEF0c4RgnS4T2cq4PAbORufi4JAH7g7UXa4juwJseaKGlJNb9EusiUZ3cFLVc7LskjT4chZsMb7Zi/@JnVCnGKlqzCk4FbDqoThYy9XTxHbbSNavuWV1Xcygqc7w9FDZZ/gA "Perl 6 ‚Äì Try It Online")
## Expanded:
```
{  # bare block lambda with 2 placeholder parameters ÔΩ¢@aÔΩ£, ÔΩ¢$bÔΩ£
  [Z+]
    flat(
      @^a,         # declare and use the first parameter
      0 xx $^b * 2 # 0 list repeated 2 * the second parameter
    )
    .rotor($b)     # split into chunks that are the size of the second param
}
```
```
[1,2], 3
( [1,2], (0,0,0,0,0,0) ) # @^a,0 xx$^b*2
(1,2,0,0,0,0,0,0)        # flat(‚Ä¶)
( (1,2,0), (0,0,0) )     # .rotor($b) # (drops partial lists)
(1,2,0)                  # [Z+]
```
[Answer]
# [BQN](https://mlochbaum.github.io/BQN/), 8 bytes[SBCS](https://github.com/mlochbaum/BQN/blob/master/commentary/sbcs.bqn)
```
+Àù‚ÜëÀô‚ä∏‚ãà‚ä∏‚•ä
```
[Run online!](https://mlochbaum.github.io/BQN/try.html#code=RiDihpAgICvLneKGkcuZ4oq44ouI4oq44qWKIAojRiDihpAgeyvLneKGkeKAv/CdlanipYrwnZWofQoK4oCiU2hvdyAxIEYg4p+oMeKfqQrigKJTaG93IDMgRiDin6gx4p+pCuKAolNob3cgMyBGIOKfqDDin6kK4oCiU2hvdyAzIEYg4p+oMSwy4p+pCuKAolNob3cgMSBGIOKfqDEsMuKfqQrigKJTaG93IDIgRiDin6gtMSwx4p+pCuKAolNob3cgNCBGIOKfqC03LDQsLTEyLDEsNSwtMywxMiwwLDE0LC0y4p+pCuKAolNob3cgMyBGIOKfqDEsMiwzLDQsNSw2LDcsOCw54p+p)
`{+Àù‚Üë‚Äøùï©‚•äùï®}` is 1 longer. BQN's reshape is very good.
[Answer]
# [APL (Dyalog)](https://www.dyalog.com/), 22 bytes
Takes `l` as left argument and `a` a right argument.
```
{+‚åøs‚ç¥‚çµ‚Üë‚ç®√ó/s‚Üê‚ç∫,‚ç®‚åà‚ç∫√∑‚ç®‚â¢‚çµ}
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///3zEl5VHbhGrtRz37ix/1bnnUu/VR28RHvSsOT9cvBko86t2lA@Q96ukAsg5vBzE7FwEV1f7//6hvqlewv5@CoQLQDAUoTz3aMFadCyZlTLSUAR5dOkZIkob4JI1QJXUNdZCtNEGTNdcx0dE1NNIx1DHV0TXWAbIMdAyBQkZ43aJjDNRmqmOmY65joWMZqw4A "APL (Dyalog Unicode) ‚Äì Try It Online")
`{`‚Ä¶`}`‚ÄÉanonymous function where `‚ç∫` is the left argument (`l`) and `‚çµ` the right argument (`a`).
‚ÄÉ`‚â¢‚çµ`‚ÄÉtally (length) of `a`
‚ÄÉ`‚ç∫√∑‚ç®`‚ÄÉdivide by `l`
‚ÄÉ`‚åà`‚ÄÉceiling (round up)
‚ÄÉ`‚ç∫,‚ç®`‚ÄÉappend `l`
‚ÄÉ`s‚Üê`‚ÄÉstore in `s` (for **s**hape)
‚ÄÉ`√ó/`‚ÄÉproduct of that (i.e. how many integers are needed)
‚ÄÉ`‚çµ‚Üë‚ç®`‚ÄÉtake that many integers from `a` (padding with zeros)
‚ÄÉ`s‚ç¥`‚ÄÉ**r**eshape to shape `s` (rows, columns)
‚ÄÉ`+‚åø`‚ÄÉcolumnar sums
[Answer]
# [Haskell](https://www.haskell.org/), ~~59~~ 49 bytes
```
a%l=[sum$map((0:a)!!)[i,l+i..length a]|i<-[1..l]]
```
[Try it online!](https://tio.run/##rZHBTsMwDIbveQpPWqVNOFOctGwgduCOxANUOURiYhFpqbr2gIBnL2YD2nFIN2k5Wcn3x7/9b93uZRNC17kkrPNdW0wLV81m6tbNJ5N57jFc@cUibMrnZgvOfvg7mRNfWNsVzpewhqdXAVXtywamkJOFyEmAzmDNgFVnsITaXood@pWEEcsJ6CG7xBQlaSTMUBrkSiHx1b5dAumxBzSMZ3iNS1zhjf3vV7xLcV/X7i2yg4dDRACPbVO1jRhZL9BvweAobHqY51AsUKcK1I8gvumjDvoUQe/fMBzPBvQfvAfFSD6Q9m40Y99vB0eRoIYj8L8Z0soK@dl9AQ "Haskell ‚Äì Try It Online")
[Answer]
# [Perl 6](https://perl6.org), 40 bytes
```
{[Z+] (|@^a,|(0 xx*)).rotor($^l)[0..@a]}
```
[Try it online!](https://tio.run/##ZY3NDoIwEITvPEUTObQ6kG7LnyEmPIcEEg56wmDQA0Z89rqIgRizl535Znavp75N3OUh/LM4CPcsj7tKyLGoG4xSi2HYKhX23b3rpV@3qtRhWDTVy@Wed2umlpQaCsKqXGwE7zxqQQSzMhb/jGZmsYKAQEzMTD5qZSkiBGRAiBFY8KZBbPGt6PvGcGByf17BcjFGghQZ9gp2CVMMypR7Aw "Perl 6 ‚Äì Try It Online")
If you like the number 42, you can swap the `*` for an `‚àû`. That will make it 42 bytes :‚Äî).
**Explanation**: 
```
{[Z+] (|@^a,|(0 xx*)).rotor($^l)[0..@a]} The whole function
{                                      } Anonymous block
      (    ,        )                    List with 2 elements
        @^a                              The first argument (it is a list)
             (0 xx*)                     Infinite list of zeroes
       |    |                            Flatten both of the lists into the larger list.
                    .rotor($^l)          Split the list into a list of lists, each (the second argument) long.
                               [0..@a]   Only the first (1 + length of the first argument) of them.
 [Z+]                                    Add the corresponding elements up.
```
The magic behind the last "add up" is that the operator is a "reduce with zip with +". By the way, this would break down if we used it only on a list with 1 list inside, but that never happens if the original list was non-empty (due to the second-to-last row). Also note that we end up taking not only `@a`, but `@a * $l` items. Fortunately we added only zeroes which won't affect the final result.
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 8 bytes
```
m+F%Q>vz
```
**[Try it here!](https://pyth.herokuapp.com/?code=m%2BF%25Q%3Evz&test_suite=1&test_suite_input=1%0A%5B%5D%0A%0A1%0A%5B1%5D%0A%0A3%0A%5B1%5D%0A%0A3%0A%5B0%5D%0A%0A3%0A%5B1%2C2%5D%0A%0A1%0A%5B1%2C2%5D%0A%0A2%0A%5B-1%2C1%5D%0A%0A4%0A%5B-7%2C4%2C-12%2C1%2C5%2C-3%2C12%2C0%2C14%2C-2%5D%0A%0A3%0A%5B1%2C2%2C3%2C4%2C5%2C6%2C7%2C8%2C9%5D%0A&debug=0&input_size=3)**
# [Pyth](https://github.com/isaacg1/pyth), 10 bytes
```
sMCc.[EZQQ
```
**[Try it here!](https://pyth.herokuapp.com/?code=sMCc.%5BEZQQ&input=3%0A%5B1%2C2%2C3%2C4%2C5%2C6%2C7%2C8%2C9%2C10%5D&test_suite=1&test_suite_input=1%0A%5B%5D%0A%0A1%0A%5B1%5D%0A%0A3%0A%5B1%5D%0A%0A3%0A%5B0%5D%0A%0A3%0A%5B1%2C2%5D%0A%0A1%0A%5B1%2C2%5D%0A%0A2%0A%5B-1%2C1%5D%0A%0A4%0A%5B-7%2C4%2C-12%2C1%2C5%2C-3%2C12%2C0%2C14%2C-2%5D%0A%0A3%0A%5B1%2C2%2C3%2C4%2C5%2C6%2C7%2C8%2C9%5D%0A&debug=0&input_size=3)**
# Explanation
### Explanation #1
```
m+F%Q>vz   Full program. Q means input.
m          Map over the implicit range [0, input_1), with a variable d.
     >vz  All the elements of input_2 after d; input_2[d:] in Python.
   %Q     Every Qth element of ^.
 +F       Sum. Implicitly output the result.
```
### Explanation #2
```
sMCc.[EZQQ   Full program.
    .[E      Pad the second input to the right, with repeated copies of...
       Z     ... Zero (0), up to the nearest multiple of...
        Q    ... The first input.
   c     Q   Chop into chunks of length equal to the first input.
  C          Matrix transpose. Get all the columns of the nested list.
sM           Sum each.
             Output (implicitly). 
```
[Answer]
# [J](http://jsoftware.com/), ~~15~~ 12 bytes
```
]{.+/@(]\~-)
```
[Try it online!](https://tio.run/##y/qfVqxga6VgoADE/2Or9bT1HTRiY@p0Nf9rcinpKain2VqpK@go1FoppBVzcaUmZ@QrGCpoRFvHWqdpKhiiCxhDBAzQBQwVjPAJQc2JN0QyyggqZq5gApQwAsqYKsQbKwBZBgqGQCGEbhOEgcZAxaYKZgrmChYKlggb/wMA "J ‚Äì Try It Online")
## Explanation
```
]{.+/@(]\~-)  Input: array A (LHS), chunk size L (RHS)
          -   Negate L
       ]\~    Take each non-overlapping sublist of size L in A
   +/@        Reduce the columns by addition
]             Get L
 {.           Take that many, filling with 0's
```
[Answer]
# [R](https://www.r-project.org/), ~~62~~ 57 bytes
*-5 bytes thanks to user2390246*
```
function(a,l)rowSums(matrix(c(a,rep(0,l-sum(a|1)%%l)),l))
```
[Try it online!](https://tio.run/##HcpBCsIwEEbhvadwOSN/wGkrYmlP4QEkFCOFToJJgy68e0y7e3y8WNxxMMVlP61z8GSxcAyfe9ZEpKPaNc7fXflE6fl@2CX4FykPY8pK9ifMXBxJf0PLB0cTmSs6GGkguMC0qHWGVGoY3bZIPcsf "R ‚Äì Try It Online")
Updated since it no longer has to handle the empty case.
pads `a` with zeros, constructs a matrix of `l` rows, and computes and returns the row sums.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 8 bytes
```
√¥0Œ∂O¬≤√Ö0+
```
[Try it online!](https://tio.run/##MzBNTDJM/f//8BaDc9v8D2063Gqg/f9/tKGOglEslzEA "05AB1E ‚Äì Try It Online")
```
√¥0Œ∂O¬≤√Ö0+   Full program
√¥          Push <1st input> split into a list of <2nd input> pieces
 0Œ∂        Zip sublists with 0 as a filler
   O       Sum each sublist
           --- from here, the program handles outputs shorter 
               than the required length
    ¬≤√Ö0    Push a list of zeros of length <2nd input>
       +   Sum the result with that list
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 8 bytes
```
√Ö0+¬π√¥0Œ∂O
```
[Try it online!](https://tio.run/##MzBNTDJM/f//cKuB9qGdh7cYnNvm//@/MVe0oY6RjrGOiY6pjpmOuY6FjmUsAA "05AB1E ‚Äì Try It Online")
```
√Ö0       # Push an arrary of all 0s with length l
  +      # Add that to the array
   ¬π√¥    # Split into chunks of length l
     0Œ∂  # Zip, padding with 0s
       O # Sum each chunk
```
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 7 bytes
```
·∫áR‚àÜZR‚à©·π†
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyIiLCIiLCLhuodS4oiGWlLiiKnhuaAiLCIiLCI0XG5bLTcsNCwtMTIsMSw1LC0zLDEyLDAsMTQsLTJdIl0=)
[Answer]
# [SOGL V0.12](https://github.com/dzaima/SOGL), 14 [bytes](https://github.com/dzaima/SOGL/blob/master/chartable.md)
```
l‚Åµ%‚ÅµŒ∫{0+}nI‚å°‚àë¬π
```
[Try it Here!](https://dzaima.github.io/SOGLOnline/?code=bCV1MjA3NSUyNSV1MjA3NSV1MDNCQSU3QjArJTdEbkkldTIzMjEldTIyMTElQjlGJTBBLiUyQyV1MjE5MkY_,inputs=NCUwQSU1Qi03JTJDNCUyQy0xMiUyQzElMkM1JTJDLTMlMkMxMiUyQzAlMkMxNCUyQy0yJTVE) or [Try all the test-cases.](https://dzaima.github.io/SOGLOnline/?code=bCV1MjA3NSUyNSV1MjA3NSV1MDNCQSU3QjArJTdEbkkldTIzMjEldTIyMTElQjlGJTBBaW5wdXRzLnZhbHVlJXUyMDFEJXUyMTkyJUI2JXUwMzk4JTdCJXUwM0I4X3IlM0IldTIxOTJGQCV1MjIxMVA_,inputs=JTVCMSU1RCUyMDElMEElNUIxJTVEJTIwMyUwQSU1QjAlNUQlMjAzJTBBJTVCMSUyQzIlNUQlMjAzJTBBJTVCMSUyQzIlNUQlMjAxJTBBJTVCLTElMkMxJTVEJTIwMiUwQSU1Qi03JTJDNCUyQy0xMiUyQzElMkM1JTJDLTMlMkMxMiUyQzAlMkMxNCUyQy0yJTVEJTIwNCUwQSU1QjElMkMyJTJDMyUyQzQlMkM1JTJDNiUyQzclMkM4JTJDOSU1RCUyMDM_) this is written as an unnamed function and expects `chunk length; array` on the stack.
Explanation:
```
padding zeroes
l          get the array's length
 ‚Åµ%        modulo the chunk length
   ‚ÅµŒ∫      chunk length - result of above
     {  }  that many times
      0+     append a 0 to the array
adding the array together
n      split into the chunks
 I     rotate clockwise
  ‚å°    for each
   ‚àë     sum
    ¬π  wrap the results in an array
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 12 bytes
```
gs√∑*+√Ö0¬π+√¥√∏O
```
[Try it online!](https://tio.run/##MzBNTDJM/f8/vfjwdi3tw60Gh3ZqH95yeIf////RuuY6Jjq6hkY6hjqmOrrGOkCWgY4hUMgolssEAA "05AB1E ‚Äì Try It Online")
### Explanation
```
gs√∑*+√Ö0¬π+√¥√∏O
g            # Get the length of the first input (the array)
 s           # Push the second input on top of the result
  √∑          # integer divide the two values
   *         # Multiply with the second input (the length)...
    +        # and add the second input to the result
     √Ö0      # Create a list of zeros with that length
       ¬π+    # Add it to the first input
         √¥   # And finally split it into chunks of the input length...
          √∏  # ...transpose it...
           O # and sum each resulting subarray
             # Implicit print
   
```
[Answer]
## Mathematica, 43 bytes
```
Plus@@#~ArrayReshape~{‚åàTr[1^#]/#2‚åâ,#2}&
```
[Answer]
# [Husk](https://github.com/barbuz/Husk), 10 bytes
```
F≈º+So:`R0C
```
[Try it online!](https://tio.run/##yygtzv7/3@3oHu3gfKuEIAPn////G/@PNtQx0jHWMdEx1THTMdex0LGMBQA "Husk ‚Äì Try It Online")
### Ungolfed/Explanation
```
             -- implicit inputs n & xs                   | 3  [1,2,3,4]
   S      C  -- cut xs into sublists of length n & ...   | [[1,2,3], [4]]
    (:`R0)   -- ... prepend [0,...,0] (length n)         | [[0,0,0], [1,2,3], [4]]
F            -- accumulate the sublists with             |
 ≈º+          -- element-wise addition                    | [0+1+4, 0+2, 0+3]
```
[Answer]
# [Clojure](https://clojure.org/), 42 bytes
```
#(apply map +(partition %2 %2(repeat 0)%))
```
[Try it online!](https://tio.run/##VYxBCsMgFET3OcVACfxPEaImTe8SspBWwWLNR8yipzduC7N4PB7zSsfnLL7R2weEdiMnkn74OsGdxJUaazwyRtNHxYt3FROPzI2HgaTEXFMGBWxqxQylDTQWKItOE3RXZsfM/B9rGNjeL3hgxXOH7Y8X "Clojure ‚Äì Try It Online")
[Answer]
# [Jq 1.5](https://stedolan.github.io/jq/), 31 bytes
```
[_nwise($n)]|transpose|map(add)
```
Sample Run
```
$ jq -Mc --argjson n 3 '[_nwise($n)]|transpose|map(add)' <<< "[1,2,3,4,5,6,7,8]"
[12,15,9]
```
Takes advantage of builtins: [\_nwise](https://github.com/stedolan/jq/blob/master/src/builtin.jq#L100), [transpose](https://github.com/stedolan/jq/blob/master/src/builtin.jq#L190), [add](https://github.com/stedolan/jq/blob/master/src/builtin.jq#L11) and [map](https://github.com/stedolan/jq/blob/master/src/builtin.jq#L3)
[Answer]
# [Stacked](https://github.com/ConorOBrien-Foxx/stacked), 24 bytes
```
[:@z#<[0 z rpad]map sum]
```
[Try it online!](https://tio.run/##bY7BDoIwEETv/YpJagIkSmiLokgM/4EEG4GLITYFLvx83aImHjzN29nJ7I6Tvj@61rkqLxdeVAkWWKPbetAG4zzUrsx7FjIgFJBQSLHHARmOEdTqfjT5zpC/JDw1AhSTK2bU0AgJQT2NAlECQRZl0z9XcPJtEZO8YKzKEccxetjOWFyxWdV/GpwRgN/I41ui3eU9Puep9nv3Ag "Stacked ‚Äì Try It Online")
## Explanation
```
[:@z#<[0 z rpad]map sum]
[                      ]   anonymous function
 :@z                       stores TOS as `z` (the length)
    #<                     cut STOS in TOS slices
      [        ]map        for each slice
       0 z rpad               pad the slice with `z` zeroes
                    sum]   summate all inner slices
```
[Answer]
# [Java (OpenJDK 8)](http://openjdk.java.net/), 64 bytes
```
n->a->{int k=0,r[]=new int[n];for(int i:a)r[k++%n]+=i;return r;}
```
[Try it online!](https://tio.run/##vVE9b4MwEN3zK26pBMJYQNJPClKXSh2aJSNicAlEJuRAxqSKIn47PQhplmwNveXOfnfvvbNzsRd2WaWYr7dd1XwVMoGkEHUNn0IiHGczoKi10ARkEkUBOY3wRsuCZw0mWpbIP1C/j/XrFfgXk6ijmMGQwhCWEHRoh8IOj3QF28BhKooDTL@HFoz9rFRGD8kXYapoa1l3GFuB9FWqG4Wg/Lbr/fknm6P/0e2@lGvY0RbGSiuJmygGoTa1SUvBGKtDrdMdLxvNK2rRBRoX@29KiUPNdXkaN5ZcVFVxMFxzLM4@Yzi6rWma/t945//I60zll4F3A2p3OmrvCrVN3Ld46cU17kcGCwa265EGg3sq51TRyaHUI96Ef8FgPsiT7AMDsvLE4Pmi187a7gc "Java (OpenJDK 8) ‚Äì Try It Online")
[Answer]
# [Japt](https://github.com/ETHproductions/japt/), 7 bytes
Man, I fought with the wrong Japt method for far too long trying to get it to work for the `[1], 3` test case in a reasonable amount of bytes!
```
V√Ü√´VX x
```
[Try it](https://ethproductions.github.io/japt/?v=1.4.5&code=VsbrVlggeA==&input=Wy03LDQsLTEyLDEsNSwtMywxMiwwLDE0LC0yXQo0Ci1R)
---
## Explanation
Implicit input of array `U` and integer `V`.
```
V√Ü
```
Generate an array of integers from `0` to `V-1` and pass each through a function with `X` being the current element.
```
√´VX
```
Grab every `V`th element of `U`, beginning at index `X`.
```
x
```
Reduce that array by addition.
[Answer]
# C, (GCC) 101 86 Bytes
[Try it online!](https://tio.run/##PY7LasMwEEXX9VcMhgQ9RtDWaWtQ/CXGC@HGyYBkFysQiNG3O2Ol7eYgHc0d3d6c@35dB0HjVTlkgs@MG1WQCw0iMllR4@3tQv4kaL9nF1pvyJhON8ppbaMxNg3CoceIQdqU1i0VHI1CwlIAQF4PDVT27@baumOxvOE7VnjAD/zEL6zT/4AK/CzySQbn/dSLSPfTlBtLUOBlnt0@5upQI4RfM83PIDWvFuhYMbTemrz8zOwHUe6@EUoMLXXPSCrS@gA)
```
f(int*a,int l,int s,int*m){if(s){int i=l;while(i&&s){m[l-i--]+=*a++;s--;}f(a,l,s,m);}}
```
## Usage
```
int main() {
   int l = 3;
   int a[8] = {1,2,3,4,5,6,7,8};
   int *m = (int *)malloc(sizeof(int) * l);
   f(a, l, 8, m);
   for (int i=0; i<3; i++) {
    printf("%d, ",m[i]);
   }
}
```
Note that you have to pass in the length of the array (s) and a new dynamic array on the heap (m).
]