[Question]
  [
*This challenge is related to some of the MATL language's features, as part of the [May 2018 Language of the Month](https://codegolf.meta.stackexchange.com/questions/16337/language-of-the-month-for-may-2018-matl) event.*
---
## Introduction
In MATL, many two-input functions work **element-wise** with **broadcast**. This means the following:
* **Element-wise** (or **vectorized**): the function takes as inputs two arrays with matching sizes. The operation defined by the function is applied to each pair of corresponding entries. For example, using post-fix notation:
```
[2 4 6] [10 20 30] +
```
[gives](https://tio.run/##y00syfn/P9pIwUTBLFYh2tBAwchAwdggVkH7/38A) the ouput
```
[12 24 36]
```
This also works with multi-dimensional arrays. The notation `[1 2 3; 4 5 6]` represents the `2`×`3` array (matrix)
```
1 2 3
4 5 6
```
which has size `2` along the first dimension (vertical) and `3` along the second (horizontal). So for example
```
[2 4 6; 3 5 7] [10 20 30; 40 60 80] *
```
[gives](https://tio.run/##BcE7EgAQEETBq7xYNH5LlaMogZzM/Vf33e@4z0TBBplKW8woksgaFGGiaxHcPw)
```
[20 80 180; 120 300 560]
```
* **Broadcasting** or (**singleton expansion**): the two input arrays do not have matching sizes, but in each non-matching dimension one of the arrays has size `1`. This array is implicitly replicated along the other dimensions to make sizes match; and then the operation is applied element-wise as above. For example, consider two input arrays with sizes `1`×`2` and `3`×`1`:
```
[10 20] [1; 2; 5] /
```
Thanks to broadcasting, this is equivalent to
```
[10 20; 10 20; 10 20] [1 1; 2 2; 5 5] /
```
and so it [gives](https://tio.run/##y00syfn/P9rQQMHIIFYh2tBawchawTRWQf//fwA)
```
[10 20; 5 10; 2 4]
```
Similarly, with sizes `3`×`2` and `3`×`1` (broadcasting now acts along the second dimension only),
```
[9 8; 7 6; 5 4] [10; 20; 30] +
```
[gives](https://tio.run/##y00syfn/P9pSwcJawVzBzFrBVMEkViHa0MBawQiIjQ1iFbT//wcA)
```
[19 18; 27 26; 35 34]
```
The number of dimensions may even be different. For example, inputs with sizes 3×2 and 3×1×5 are compatible, and give a 3×2×5 result. In fact, size 3×2 is the same as 3×2×1 (there are arbitrarily many implicit trailing singleton dimensions).
On the other hand, a pair of `2`×`2` and `3`×`1` arrays would give an error, because the sizes along the first dimension are `2` and `3`: they are not equal and none of them is `1`.
## Definition of modular broadcasting
Modular broadcasting is a generalization of broadcasting that works even if none of the non-matching sizes are `1`. Consider for example the following `2`×`2` and `3`×`1` arrays as inputs of the function `+`:
```
[2 4; 6 8] [10; 20; 30] +
```
The rule is as follows: for each dimension, **the array that is smaller along that dimension is replicated modularly (cyclically)** to match the size of the other array. This would make the above equivalent to
```
[2 4; 6 8; 2 4] [10 10; 20 20; 30 30] +
```
with the result
```
[12 14; 26 28; 32 34]
```
As a second example, 
```
[5 10; 15 20] [0 0 0 0; 1 2 3 4; 0 0 0 0; 5 6 7 8; 0 0 0 0] +
```
would produce
```
[5 10 5 10; 16 22 18 24; 5 10 5 10; 20 26 22 28; 5 10 5 10]
```
In general, inputs with sizes `a`×`b` and `c`×`d` give a result of size `max(a,b)`×`max(c,d)`.
## The challenge
Implement **addition** for **two-dimensional** arrays with **modular broadcasting** as defined above.
The arrays will be **rectangular** (not ragged), will only contain **non-negative integers**, and will have **size at least `1`** in each dimension.
Aditional rules:
* Input and output can be taken by [any reasonable means](https://codegolf.meta.stackexchange.com/questions/2447/default-for-code-golf-input-output-methods). Their format is flexible as usual.
* Programs or functions are allowed, in any [programming language](https://codegolf.meta.stackexchange.com/questions/2028/what-are-programming-languages/2073#2073). [Standard loopholes are forbidden](https://codegolf.meta.stackexchange.com/questions/1061/loopholes-that-are-forbidden-by-default).
* Shortest code in bytes wins.
## Test cases
The following uses `;` as row separator (as in the examples above). Each test case shows the two inputs and then the output.
```
[2 4; 6 8]
[10; 20; 30]
[12 14; 26 28; 32 34]
[5 10; 15 20]
[0 0 0 0; 1 2 3 4; 0 0 0 0; 5 6 7 8; 0 0 0 0]
[5 10 5 10; 16 22 18 24; 5 10 5 10; 20 26 22 28; 5 10 5 10]
[1]
[2]
[3]
[1; 2]
[10]
[11; 12]
[1 2 3 4 5]
[10 20 30]
[11 22 33 14 25]
[9 12 5; 5 4 2]
[4 2; 7 3; 15 6; 4 0; 3 3]
[13 14 9;12 7 9;24 18 20;9 4 6;12 15 8]
[9 12 5; 5 4 2]
[4 2 6 7; 7 3 7 3; 15 6 0 1; 4 0 1 16; 3 3 3 8]
[13 14 11 16; 12 7 9 8; 24 18 5 10; 9 4 3 21; 12 15 8 17]
[6 7 9]
[4 2 5]
[10 9 14]
```
  
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), ~~25~~ 23 bytes
```
~~Ａθ~~ＩＥ⌈ＥθＬιＥ⌈ＥθＬ§λ⁰ΣＥθ§§νιλ
```
[Try it online!](https://tio.run/##dYzNCsIwEITvfYo9JrBC/9IqnsSToCB4DDmEWmwgjVqj9O3jpqV4Mkw2M3yzaTo9NHdtQzgPxnm21y/PTvpBdzT9u5/8E@HYupvvmOEc4T/e@YO7tiOzCCnnsXv5dRa4vA7BUMPy@WxDkDKRcoOQ5QhCIUiBUCLkSiVIJFqECqGOrEYoyNKMKRMTSWk5xnK2pCrGYuqS1vSVUmH1sV8 "Charcoal – Try It Online") Link is to verbose version of code. Takes input as a 3-dimensional array. Explanation:
```
Ａθ
```
Input everything.
```
    θ                   Input
   Ｅ                    Map over arrays
      ι                 Current array
     Ｌ                  Length
  ⌈                     Maximum
 Ｅ                      Map over implicit range
          θ             Input
         Ｅ              Map over arrays
             λ          Current array
            § ⁰         First element
           Ｌ            Length
        ⌈               Maximum
       Ｅ                Map over implicit range
                 θ      Input
                Ｅ       Map over arrays
                    ν   Current array
                   § ι  Cyclically index using outer loop index
                  §   λ Cyclically index using inner loop index
               Σ        Sum
Ｉ                       Cast to string
                        Implicitly print on separate lines and paragraphs
```
[Answer]
# [MATL](https://github.com/lmendo/MATL), ~~25~~ 24 bytes
```
,iZy]vX>XKx,@GK:KP:3$)]+
```
[Try it online!](https://tio.run/##y00syfn/XyczqjK2LMIuwrtCx8Hd28o7wMpYRTNW@///aEsFQyMFU2sFUwUTBaNYrmggqWCmYG6tYK5gDMLWCoamQAEDBUNroAogpWBoZg2UAkGLWAA "MATL – Try It Online")
Finally! It only took a week for the Language of the Month-inspired challenge to be answered by the [Language of the Month!](https://codegolf.meta.stackexchange.com/questions/16337/language-of-the-month-for-may-2018-matl)
My guess is that it's not quite as short as possible, but I'm happy enough because my initial version was over 40 bytes. *edit: I was right, Luis found another byte to squeeze out!*
```
,iZy]	# do twice: read input and find the size of each dimension
vX>	# find the maximum along each dimension
XKx	# save this into clipboard K and delete from stack. Stack is now empty.
,	# do twice:
 @G	# push the input at index i where i=0,1.
	# MATL indexes modularly, so 0 corresponds to the second input
 K:	# push the range 1...K[1]
 KP:	# push the range 1...K[2]
 3$)	# use 3-input ) function, which uses modular indexing
	# to expand the rows and columns to the appropriate broadcasted size
]	# end of loop
+	# sum the now appropriately-sized matrices and implicitly display
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 10 bytes
```
ṁ€ZL$Z€Ɗ⁺S
```
Takes a matrix pair (two arrays of rows) as input and returns a matrix.
[Try it online!](https://tio.run/##fU8rEsIwFPQ9BQK5Ip8mba@ARdFMJIapQyGLYQaJ4hBcoFgG7tFeJLzklcYxmcl7u3m7b3PYd90phHHop/Oj3axbKp/r1D@34aheF0Lv2zjcqe5CcMXKOYXSw1nU3oOgFIRUvLQgJk4YJFIaKMFDAulEEgo6OWTOwKIiv8yxj2SxWiBSz0tnju1gfjytxBKkgVT0FDeUmKWxgaugOaGlUqYUmqi/spiSpchyiivZAhLSsg@devaKP2uyRcxZ@C8 "Jelly – Try It Online")
### How it works
```
ṁ€ZL$Z€Ɗ⁺S  Main link. Argument: [M, N] (matrix pair)
  Z $       Zip M with N (i.e., transpose the matrix of arrays [M, N], ...
   L            then take the length (number of rows) of the result.
ṁ€          Mold M and N like the indices, cyclically repeating their rows as many
            times as needed to reach the length to the right.
     Z€     Zip each; transpose both M and N.
       Ɗ⁺   Combine the three links to the left into a chain and duplicate it.
            The first run enlarges the columns, the second run the rows.
         S  Take the sum of the modified matrices.
```
[Answer]
# [Python 3](https://docs.python.org/3/), 127 126 125 bytes
*golfed a byte by changing `sum(m)` to `m+n`*
*One more byte thanks to @Jonathan Frech*
```
lambda y:[[m+n for n,m,j in Z(l)]for*l,i in Z(y)]
from itertools import*
Z=lambda y:zip(*map(cycle,y),range(max(map(len,y))))
```
Takes input as a list of two 2-dimensional arrays.
* The `Z` lambda takes two arrays as input and returns an iterator yielding an index and merged values from both arrays, until the index reaches the largest array's length. The index variable isn't useful to me and costs me bytes, but I don't know how to do without it... ([related](https://stackoverflow.com/questions/818828/is-it-possible-to-implement-a-python-for-range-loop-without-an-iterator-variable))
* The main lambda just takes the input arrays and calls `Z` on the outer and inner arrays. The innermost values are added together.
[Try it online!](https://tio.run/##fVLNboMwDL7zFD4G5gN/pWslXqQsB9bBlikJKOQw9vLMCbSCtmuEHGN/9mc77kf71elsasu3Sdbq/aOG8VhV6kVD2xnQqPAbhIYTkyEnSyRRzP9jyIPWdAqEbYztOjmAUH1nbBScymuqX9GzSNU9O49n2eAYoqn1Z8NU/cOcWTaajHQm2wx2gBKqAOjM0mtVipBzhKpAeOUcV54kdvbUyyy@@JZrnWKHMGMT0tJ4myVGWD6PIABCtnBufRRMReypDrxx/k@dbMnSZ1CivmvwOXyuFGF3G@faJOez@AMNJXWhc2f5HXvuCVzHDrL3XE5eBln45hM/i3zRISn8a3hwtnqxBwXMszw8Ir32wwMeBG4V3X64zfN7cvS@3ghtWcuciTboDw "Python 3 – Try It Online")
Using `itertools.cycle` feels a bit like cheating but I think I've been punished enough by the sheer import statement length :)
I'm sure this could be golfed some more, especially the iteration method that leaves these useless `i` and `j` variables. I would be grateful on any tips on how to golf that, I'm probably missing something obvious.
[Answer]
# JavaScript (ES6), 131 bytes
Not the right tool for the job, and probably not the right approach either. Oh well... ¯\\_(ツ)\_/¯
```
a=>b=>(g=(a,b,c)=>[...Array((a[b[L='length']]?a:b)[L])].map(c))(a,b,(_,y)=>g(a[0],b[0],(_,x)=>(h=a=>a[y%a[L]][x%a[0][L]])(a)+h(b)))
```
[Try it online!](https://tio.run/##lU/dSsMwGL33KXIzlg9jaTvXbUIq3u8NQpCkdq1S29ENWZ@@ni@zMmS7EPJzcr7zQz7clzsU/fv@@NB2b@W406PTude5rLR0yquCdG6iKHrpezdI6Yw3Wz1vyrY61nNrn92TJ7O1ZKNPt5cFUXDJVzXAWEEfW@X5AHUCJWuNAmeGmYPNmtOMJQzhpPtaeiIai649dE0ZNV0ld9KYVIlHq4TJlFiz0pgk5ncazkUMju7@mpKzMr0xZPtv1lWJEuhdoFqJ5aQEh32jcaNEkrIY2cvg@2kICOQKVr4TTDMGGJy/wIN/RyJEidUUDHgZj2R4pxJArGzqCmt9tTELOZvLFv49jd8 "JavaScript (Node.js) – Try It Online")
### How?
The helper function **g()** creates an array which is as large as the largest input array (**a** or **b**) and invokes the callback function **c** over it:
```
g = (a, b, c) =>
  [...Array(
    (a[b[L = 'length']] ? a : b)[L]
  )].map(c)
```
The helper function **h()** reads the 2D-array **a** at **(x, y)** with modular broadcasting:
```
h = a => a[y % a[L]][x % a[0][L]]
```
The main code now simply reads as:
```
a => b =>
  g(a, b, (_, y) =>
    g(a[0], b[0], (_, x) =>
      h(a) + h(b)
    )
  )
```
---
# Recursive version, 134 bytes
```
a=>b=>(R=[],g=x=>a[y]||b[y]?a[0][x]+1|b[0][x]+1?g(x+1,(R[y]=R[y]||[])[x]=(h=a=>a[y%a.length][x%a[0].length])(a)+h(b)):g(+!++y):R)(y=0)
```
[Try it online!](https://tio.run/##lU/daoMwGL3fU2QXhYRkxdjV/sBn38HbkIvYWd0QHWsZCn13d5I2o4z2YhDj@b7zRz7ctzvuv94/Ty9d/1ZNB5oc5SXlvCBjVU0D5c6M9nwuce@cSawZrNQYr2hX80FqxQvwVASpsQIU8YZccM/cvK26@tTAMfMRcRTcCdnwUohtzeWzlKPYFoKPlIhp33fHvq3mbV/zAzcmVezVKmYyxdYWTmN04uc03IsEO/H016QvyvQB6e2/WXcliqF3gWrFllGJHb4HjRvFdOrFyF4G37UhICxXsPq/Bpt5AOLyBE/8OxIhiq1iMOBtPJLhjSWAOFnsCmd9tzELOZvbFv96Mf0A "JavaScript (Node.js) – Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 15 bytes
```
2FεIζg∍ø]øεø¨}O
```
[Try it online!](https://tio.run/##MzBNTDJM/f/fyO3cVs9z29IfdfQe3hF7eMe5rYd3HFpR6///f3R0tKmOgqFBrI5CtCGQZWQQC2JGG@goQBFYBiiho2Cso2AC4qHKATWZ6SiY6yhYoMnFxgIA "05AB1E – Try It Online")
---
### Old version, 25 bytes
```
é`DŠg∍)Σнg}`DŠнgδ∍€˜)ø€øO
```
[Try it online!](https://tio.run/##MzBNTDJM/f//8MoEl6ML0h919GqeW3xhb3otiAukz20BCj1qWnN6jubhHUD68A7///@jo6NNdRQMDWJ1FKINgSwjg1gQM9pARwGKwDJACR0FYx0FExAPVQ6oyUxHwVxHwQJNLjYWAA "05AB1E – Try It Online")
### Explanation
15-byter:
```
2FεIζg∍ø]øεø¨}O – Full program. Takes input as a 3D [A, B] list from STDIN.
2F              – Apply twice:
  ε             – For each in [A, B]:
   Iζ             – Transpose the input (filling gaps with spaces).
     g            – Length (retrieve the number of rows).
      ∍           – Extend the current item (A or B) to the necessary length.
       ø          – Transpose.
        ]       – Close all loops.
         ø      – Transpose again.
          ε     – For each row in ^ (column of the loops result):
           ø    – Transpose the column.
            ¨}  – Remove the last element and close the map-loop.
              O – Sum.
```
25-byter:
```
é`DŠg∍)Σнg}`DŠнgδ∍€˜)ø€øO – Full program. Takes input as a 3D list from STDIN.
é                         – Sort the list by length.
 `D                       – Dump contents separately onto the stack, duplicate the ToS.
   Š                      – Perform a triple swap. a, b, c -> c, a, b.
    g                     – Get the length of the ToS.
     ∍                    – Extend the shorter list (in height) accordingly.
      )Σ  }               – Wrap the whole stack into a list and sort it by:
        нg                – The length of its first item.
           `DŠ            – Same as above.
              нg          – The length of the first element.
                δ∍€˜      – Extend the shorter list (in width) accordingly. 
                    )ø    – Wrap the stack into a list and transpose (zip) it.
                      €ø  - Then zip each list.
                        O – Apply vectorised summation.
```
[Answer]
# [R](https://www.r-project.org/), ~~136 104 103 95~~ 93 bytes
Golfed down a whopping ~~33~~ 35 bytes following Giuseppe's advice. Managed to get under 100 bytes by using an operator as a function name.
See history for more legible code.
```
function(x,y,d=pmax(dim(x),dim(y)))y/d[2]/d[1]+x/d[2]/d[1]
"/"=function(x,j)apply(x,1,rep,,j)
```
[Try it online!](https://tio.run/##bZHJbsIwEIbveYoRXOL2R3iJAxRy7AtU7anikCYtCiKLIqraT5/aiMURSJY9mpnvn8X9sNvMhp/fpjhWbRMbWJRZV@cmLqs6Ngz@sYwxOy8/5dZdYvtsbnY0mU@yAN@zvOsO1lkC/XcH5xgMbWZU58e@MnERS6RIsGRoivaQSRbZICz4E4kXhaZv/zLFoumY1RAcQkPyC44v61Pf3z5eXbYdZXPQ9QiQBClQEjjd0aAUtAAtQ/9ZPRmp@1au2isnKU@4PmnKM6JGiA2RBBILKN@/3wB3pno8Rji0YGsKx5J3S0md6upS/m4Jvqq@Rc3aRjv/zWz4Bw "R – Try It Online")
[Answer]
# [K (ngn/k)](https://github.com/ngn/k), 23 bytes
```
{+/2{+:'(|/#:'x)#'x}/x}
```
[Try it online!](https://tio.run/##dVDbasMwDH3fVwg6aEw8YsmXXPQppdC9dIyODkofUrru17Njp1nZwzDYSD4X6Rxejm/HadoP17qRaz2sq69mNaxHs1qPt2a8Tefh@ry5fJ@GPY26@zxotdu/vn/oqBc9me3t6bypKqGgiTqjtWVH4sg7oxULcVBJJJ16IR/MtqAjsVOOwAHkqBxlAgIySx0pUUvdUhtAM49mMjQh3pEEfXThK@UDfr/d2dNaVmvF4PJzA34o8K@WmVhKt7b3MSj@WaXOGAh7j41I4rxHDxqAEXAoV7i1JZ83Sxqwgiefx@ZC6hXgFo@EMrjTHryUuyB05j/JHEOWpUUaaXCWJ0ydsgdO9/Dh0p69EN/sVuLJfp6EF0vi9h5OKoPZ7BZzHg5UDtvpBw "K (ngn/k) – Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 18 bytes
```
éR`UvXNèy‚é`©g∍®+ˆ
```
[Try it online!](https://tio.run/##MzBNTDJM/f//8MqghNCyCL/DKyofNcw6vDLh0Mr0Rx29h9Zpn277/z86OtpUR8HQIFZHIdoQyDIyiAUxow10FKAILAOU0FEw1lEwAfFQ5YCazHQUzHUULNDkYmMB "05AB1E – Try It Online")
**Explanation**
```
éR                  # sort by length, descending
  `U                # store the shorter list in X
    v               # for each list y, index N in the longer list
     XNè            # get the nth element of the shorter list
        y‚é         # pair with y and sort by length
           `©g∍     # repeat the shorter list to the same length as the longer
               ®+   # elementwise addition of the lists
                 ˆ  # add to global list
                    # implicitly print global list
```
[Answer]
# Pyth, 24 bytes
```
KeSmlhdQmm+Fm@@bdkQKeSlM
```
[Try it here](https://pyth.herokuapp.com/?code=KeSmlhdQmm%2BFm%40%40bdkQKeSlM&input=%5B%5B9%2C%2012%2C%205%5D%2C%20%5B5%2C%204%2C%202%5D%5D%2C%20%5B%5B4%2C%202%5D%2C%20%5B7%2C%203%5D%2C%20%5B15%2C%206%5D%2C%20%5B4%2C%200%5D%2C%20%5B3%2C%203%5D%5D&debug=0)
### Explanation
```
KeSmlhdQmm+Fm@@bdkQKeSlM
                    eSlMQ  Get the maximum length of (implicit) input...
KeSmlhdQ           K       ... and the maximum row length.
        mm                 For each 2d index ...
          +Fm@@bdkQ        ... get the sum of the appropriate elements.
```
[Answer]
# Java 8, 172 bytes
```
A->B->{int m=A.length,o=A[0].length,d=B.length,u=B[0].length,l=m>d?m:d,a=o>u?o:u,r[][]=new int[l][a],$;for(;l-->0;)for($=a;$-->0;)r[l][$]=A[l%m][$%o]+B[l%d][$%u];return r;}
```
[Try it online.](https://tio.run/##xVJNb6MwEL33V/iQSqAdEJCQflBTJYe97al7Qz64gXTJGhuB3SpC/PbsGJJND6XaQ6qVETzPDH7Pb2bHX7m3y38fNoK3LfnBS9ldEdJqrssN2WHWN7oU/tbIjS6V9L8fwUMpdcYyBv9WdARpSraEHlZeuvbSDoOkoitfFPJF/wJFV1nATrucrk/Q0PW7hKBVmj9W9zlwqlLzqO4NNPZwKou3gUiwjDOYJVvVOInwvDRIXItnlCezcdvYohlDRnFdIbpW7NsacW6xYUlTaNNI0iT9IUE/8KnNs0BLjs68qjInFbrlPOmmlC8ZI9y1zhHytG91UfnKaL/GlBbSOVu0ahq@b/28KOqfavzV2fq8rsXeOcnHq3RdBIseuiXc9r37UT4MMB3Z1zzAEtdNLkgew3B8GEMUTPAHMCxbBRHMB7XnWAxLuEHt59ilJYYTuqIvYILh1IkuXJxutBPiSUpsCnxB0@8gjJDVNm8BUxe2GehuYD6OxxI/i6Hjcwz9L0V22EZVcFaGUxeO6iCEcDlKxHV7cZl21O8@URf/Zeyv@sMf)
**Explanation:**
```
A->B->{                   // Method with integer-matrix as both parameters and return-type
  int m=A.length,         //  Rows of `A`                        (we got an     M)
      o=A[0].length,      //  Columns of `A`                     (we got an     O)
      d=B.length,         //  Rows of `B`                        (we got a      D)
      u=B[0].length,      //  Columns of `B`                     (we got a      U)
      l=m>d?m:d,          //  Maximum of both rows               (we got an     L)
      a=o>u?o:u,          //  Maximum of both columns            (we got an     A)
      r[][]=new int[l][a],//  Result-matrix of size `l` by `a`   (and we got an R)
      $;                  //  Temp integer                       (which $pells? ;P)
  for(;l-->0;)            //  Loop over the rows
    for($=a;$-->0;)       //   Inner loop over the columns
      r[l][$]=            //    Set the current cell in the result-matrix to:
        A[l%m][$%o]       //     The value at {`l` modulo-`m`, `$` modulo-`o`} in `A`
        +B[l%d][$%u];     //     Plus the value at {`l` modulo-`d`, `$` modulo-`u`} in `B`
  return r;}              //  Return the result matrix
```
[Answer]
# [APL (Dyalog Classic)](https://www.dyalog.com/), ~~23~~ 21 bytes
```
↑{+⌿⍺[⍵|[0]⍳⍴⍺]}2,¨⍴¨
```
[Try it online!](https://tio.run/##fVDLSgNBELznK/q2O2hgpmdf8VdCDkskElyIJLlIzE0CQVf04Ad4C7mqFy9CPmV@ZK2e2Wz0IgO7M1XdVdVd3lT9y9uyml31x1W5WEzHjXt6nc7c5lk3E3zd5mV15h6/Xf01dPXn3VCPXP3u6g8AozWfH3a4H3ZNs0TxChVu@zbHdQL@IppdR@7hPpqU0yoCAHq@7sXQjJkSFWdUKBW7em80sSar1VI4w2TAckZcqNgy2USFrpSMVrFJUS2NQDT5A5BQJ6IdklJGORw6JKiLBrVCcIBXQZyo3ziysKfE/4T3fFQfmKFV721AiNshPGgMGRZiGzhJRak6AqdJw9uIj7WYmDgNUw4gIB0pGrmdU25xTtZPnym8kdPi3a7MCwyU7C6XPyd@LhQNoJJ5Ap2F@tdCNuZtqLPC5oy3I8yVeU@c4o@vCVTwlo0H97BM8bfEpotAJlfH/WQhbXhIgLRbjIaUSX4A "APL (Dyalog Classic) – Try It Online")
this could be the only time ever I get a chance to use `|[0]`
[Answer]
# [Python 2](https://docs.python.org/2/), ~~124~~ 116 bytes
```
l=len
A,B=sorted(input(),key=l)
A*=l(B)
for i in eval(`zip(A,B)`):a,b=sorted(i,key=l);a*=l(b);print map(sum,zip(*i))
```
[Try it online!](https://tio.run/##nY/LbsIwEEXX@CusbLCjqZQ4hKe8gN@wrGLAbS2ME4VQlf586kehiGVlyZbv3HNnpr32H41jw745aMxxlmWD5VY7tIYNPzddrw/EuPbSEwpHfeWWonXOLdlQ9NZ02GDjsP5Ulmy/TUs8RLd0qWB3Z3@plQrUjq7azrgen1RLzpcTBCg3lA6@MYqJryGxU@5dkxldopH@0nscpkOjhI5fxvm8GIQQDCYSsJjCXIZXlEV4WLyrQkqJvKmGJJc1@Er0FRBPVIFBlWIe1BqmMPOpD2oK@xcZWj5NEcPKVGK3bwqE@raMd0L1Zw6r3fdMYui1SNrE056UPw "Python 2 – Try It Online")
Explanation:
Takes list of two 2-d lists as input.
```
l=len
A,B=sorted(input(),key=l)         # Sort inputed lists by length
A*=l(B)                           # Extend shorter list
for i in eval(`zip(A,B)`):        # Zip and remove copied references
  a,b=sorted(i,key=l)             # Sort lists in each pair (keep references)
  a*=l(b)                         # Extend shorter list
  print map(sum,zip(*i))          # Zip and sum
```
[Answer]
# [Python 2](https://docs.python.org/2/), 101 97 105 bytes
*Edit: Thanks (again !) to Dead Possum for saving 4 bytes*
*Edit 2: lost 8 bytes, some tests cases weren't passing*
A mix between [Dead Possum's earlier solution](https://codegolf.stackexchange.com/a/164104/79471) (thanks to him !), and [my own Python 3 solution](https://codegolf.stackexchange.com/a/164077/79471).
```
lambda y:[map(sum,P(i))for i in P(y)]
def P(y):y=sorted(y,key=len);y[0]*=len(y[1]);return eval(`zip(*y)`)
```
[Try it online!](https://tio.run/##fVLLboMwELzzFXu0Ix@wIaQh4h9ydy2FCqOi8hI4ldyfp/ZCKkjSIGSvPLOenfX21nx2rZjK7H2q8@ajyMGmssl7Ml4bdiYVpWU3QAVVC2diqQoKXWKU2mzsBqMLYtmXtlmtW3qyMlQ7HxIruaKnQZvr0IL@zmty@al6srP0QiejRzNCBjIA980rRlIwiBUDmTB4U4qtEB76c4FrFN6wZVtfsWcwc7mLRLi9JWSw/MhwBAbRornFXLIr4uDqYHfg/9J8KyZeUZ30g8HX9LlSBvv7PG/Tga/yj64pwqfOzuIH9RgFvGNPOaCWX2@NTNA8x17ESww8wddAcrR6sScFzL08PhP986MCFQR@3Px8@InDOUkR64eqNaQk/ojS6Rc "Python 2 – Try It Online")
Same input as my Python 3 solution (a pair of 2 dimensional lists).
Commented code:
```
# Iterate over the nested lists, resized & joined by P(),
# and sum the inner joined items
lambda y:[map(sum,P(i))for i in P(y)]
def P(y):
 y=sorted(y,key=len)  # Sort the two input lists by length
 y[0]*=len(y[1])      # Multiply the smallest one by the biggest one's length
                      # (The smallest list is now the previously largest one)
 return eval(`zip(*y)`)  # Return paired list elements up to the smallest list's length
```
[Answer]
# [Julia 0.6](http://julialang.org/), 85 83 bytes
```
M\N=(((r,c),(s,d))=size.((M,N));repmat(M,s,d)+repmat(N,r,c))[1:max(r,s),1:max(c,d)]
```
[Try it online!](https://tio.run/##PY7BasMwEETv/oo57tJtseRYdSLSP4hPvik6iNRQlzgYO4XSn3dXbgnLstrRzJM@v65Dcut6OrdHIprlwkKLvDMfl@GnfyE6Scvs534a012XfPf0v7WS/RzMYUzfml1Y/o4XNcV1TBN1z2/TPNzu1xt1wcRzF2xkQUEFhRqm9DA1bBkFocRWqsCiws7jodRweEXzUBSheZs9Do2G5375SFNPIROtdqXISgxvxj2MRZ0xO9j8lI5M9Aqtcm@/cEo2Xi06YJwytmoiF8zrLw "Julia 0.6 – Try It Online")
*(Replace `⧻` with `\` thanks to [Jo King](https://codegolf.stackexchange.com/questions/167872/2d-array-middle-point/167902#comment405656_167902))*
Works by repeating each matrix horizontally and vertically so they both have the same size (product of row sizes x product of column sizes), adding those up and extracting out the correct region from that. (Row vector inputs or column vector inputs need a `reshape` call to be cast as 2-dimensional arrays, which I'm assuming is fine since the question specifies "Implement addition for two-dimensional arrays" and "Input and output can be taken by any reasonable means. Their format is flexible as usual.")
]