Transposes and Diagonals For this challenge, you should write a program or function which outputs the diagonals of a given square matrix. However, if you transpose the rows and columns of your solution's source code, it should instead become a program or function which returns the matrix's antidiagonals. Read on for specifics...

Rules


The source code of your solution is considered as a 2D grid of characters, separated by a standard newline of your choice (linefeed, carriage return, or a combination of both).
No line in your source code may be longer than the previous one. Here are some examples of valid layouts:

###
###
###




########
#######
###
###
#


And here is an example of an invalid layout (as the third line is longer than the second):

######
####
#####
###

Your two solutions should be each others' transpose, that is you should obtain one from the other by swapping rows and columns. Here are two valid pairs:

abc
def
ghi




adg
beh
cfi


And

print 10
(~^_^)~
foo
bar
!




p(fb!
r~oa
i^or
n_
t^
 )
1~
0


Note that spaces are treated like any other characters. In particular, trailing spaces are significant as they might not be trailing spaces in the transpose.
Each solution should be a program or function which takes a non-empty square matrix of single-digit integers as input. One solution should output a list of all diagonals of the matrix and the other should output a list of all antidiagonals. You may use any reasonable, unambiguous input and output formats, but they must be identical between the two solutions (this also means they either have to be both functions or both programs).
Each diagonal runs from the top left to the bottom right, and they should be ordered from top to bottom.
Each antidiagonal runs from the bottom left to the top right, and they should be ordered from top to bottom.


Scoring

To encourage solutions that are as "square" as possible, the primary score is the number of rows or the number of columns of your solution, whichever is larger. Less is better. Ties are broken by the number of characters in the solution, not counting the newlines. Again, less is better. Example:

abcd
efg
h


This and its transpose would have a primary score of 4 (as there are 4 columns) and a tie-breaking score of 8 (as there are 8 non-newline characters). Please cite both values in the header of your answer.

Test Cases

The actual task performed by the two solutions shouldn't be the primary challenge here, but here are two examples to help you test your solutions:

Input:
1 2 3
4 5 6
7 8 9
Diagonals:
3
2 6
1 5 9
4 8
7
Antidiagonals:
1
4 2
7 5 3
8 6
9

Input:
1 0 1 0
0 1 0 1
1 0 1 0
0 1 0 1
Diagonals:
0
1 1
0 0 0 
1 1 1 1
0 0 0
1 1
0
Antidiagonals:
1
0 0
1 1 1
0 0 0 0
1 1 1
0 0
1
Javascript, score 20 14, (258 176 non-newline characters)



///mmm()mu[=+r
///=.av=a,pr"=
///&gt; p,&gt;px=[ [
m=&gt;//(yv()xp"]
m. ////.(=+]+)
map((////&gt;y?u&amp;
v,y)=&gt;v//r]r:&amp;
.map((u,x//[ur
)=&gt;r[p=m.//p)
length-1-//],
x+y]=r[p]////
?r[p]+" "+u//
:u),r=[])&amp;&amp;r


and

///mmmv.)lx?:
///=.a,m=e+ru
///&gt; pya&gt;ny[)
m=&gt;//()prg]p,
m. //(=([t=]r
map(//&gt;(phr+=
(v,y//vu=-["[
)=&gt;v.//,m1p ]
map((//x.-]")
u,x)=&gt;r////+&amp;
[p=x+y]////u&amp;
=r[p]?r[p]//r
+" "+u:u),//
r=[])&amp;&amp;r


Example code snippet:



f=

///mmm()mu[=+r
///=.av=a,pr"=
///&gt; p,&gt;px=[ [
m=&gt;//(yv()xp"]
m. ////.(=+]+)
map((////&gt;y?u&amp;
v,y)=&gt;v//r]r:&amp;
.map((u,x//[ur
)=&gt;r[p=m.//p)
length-1-//],
x+y]=r[p]////
?r[p]+" "+u//
:u),r=[])&amp;&amp;r

console.log(f([
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
]))




and



f=

///mmmv.)lx?:
///=.a,m=e+ru
///&gt; pya&gt;ny[)
m=&gt;//()prg]p,
m. //(=([t=]r
map(//&gt;(phr+=
(v,y//vu=-["[
)=&gt;v.//,m1p ]
map((//x.-]")
u,x)=&gt;r////+&amp;
[p=x+y]////u&amp;
=r[p]?r[p]//r
+" "+u:u),//
r=[])&amp;&amp;r

console.log(f([
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
]))