text:
Golf English – using contractions
I have not laughed as much from Stack Exchange content as I have from this. I think you all will enjoy this challenge, as it is inspired by what is over there.
You will write a function or program that is code-golf, i.e. it would have to be as short as you can make it.
Given a text, return (both by any means) the text where you will have contracted as many words as possible according this table.
You shall not pull information from the table, rather you must have all necessary information included in your code.
All default rules ought not to be broken as we will not have any unfair competition.
You need not consider text if it is not capitalized as in the table, so you must not convert you all WOULD not have or You all would not have to y'all'dn't've.
You may match just the good old apostrophe (U+0027) or any nice ones; whatever you want to.
Example input above ↑ and corresponding output below ↓
I'ven't laughed as much from StackExchange content as I've from this. I think y'all'll enjoy this challenge, as 'tis inspired by what's over there.
You'll write a function or program that's code-golf, i.e. it'd've to be as short as you can make it.
Given a text, return (both by any means) the text where you'll have contracted as many words as possible according this table.
You shan't pull information from the table, rather you must've all necessary information included in your code.
All default rules oughtn't to be broken as we'lln't've any unfair competition.
You needn't consider text if it'sn't capitalized as in the table, so you mustn't convert you all WOULD not have or You all would not have to y'all'dn't've.
You may match just the good ol’ apostrophe (U+0027) or any nice ones; whatever you wanna.

Your example is wrong, right?

@N^BZ yes, that's the one!

Perl, 3429 1095 bytes
Compressed the text.
uuencoded version of script
@a=split('!',uncompress(<DATA>.<DATA>));while(<>){chomp;$l=$_;for$d(@a){chomp $d;($x,$y)=split(/,/,$d);if($l=~m/$y/){$l=~s/$y/$x/g}}print "$l\n"}
__DATA__
x<9c>uVK<b2><a3>0^L<dc><e7>^Tdņ<8b>p^Lϋ'<b8>^FpUL<e2><e2><f6><a3><af>-<9b><bc>^Mv<b7>d<a9>%<c4><c7>m<fb>xLn^[<f6>x<dc><ee><ee><e5>      <be><<e3>^_<87>^P<ae>^B<e3>{}<8c>^_?<d1>fX<dc><c7>^K    n<95>^G<df><ce>V^M<b7><fb>#^P^C<8b><e0><e8>^S^Q<b0>*Ø<d1>3<9e>1<ec><cf>ሷ<fb><e2>4^[<ec>L.<e6><95>D<9c>^X'<c5>^_<cf><c4>G<aa>[<fc><f8><98>^V^O<e7>^_^L(<a8>^_<b2><a9>N}<88>#<b8><ae><88><d3><e2><d6><d5><e0>^\^DrR^L<9a>J<96>$D<e3>^P:{@s̘.<e6>^A<da>c<a1><a6>^G^B<f3>!<c3>      <81>H<84>9|<81><a1>A<d8><db><db>}<86>`3W;s<b1>sS+<db>%Ռ<89>f<ad>S^P'<9d><c7>^M<f6>n<c3>^]<f7>t^^jWg^N<cc>!^CU<ab><a5><86>^C2<84><83>% @W<c0>V<84><fa><88>^L<80><90>^Y<b0>^H)<98><a5>^@<e4>^LGm8rB4^N<aa>b<f5><e8>^@<d7><e1>^M^N<9b>^[
6m<ee><81><f5>l<e1><b9>^\2]<b4>7<f3><a5><b6>j^P<ae>:<8b><e3>;<b1>^_<ac><e2>^F;<f2>B<86><9d>v<ef>i\qe<a7>8<fe><ac><f1><e7><df>^T<ff>^N^G<8c>^C^A`<d7>q<8a>؈<f8><96><f4><b4><e1>#<d0>^Sd<a8>5<ca><e0><bc>&^]<ea><a4>S<9d><ba><b1><ae>~<d2><e7>ē<9c><ea>h^[<86>{<9d>tx<93>^]ob<95><ea><9c><c2><c5>'<90><8b><be>FxW$<99>^W<89>Xj<f7><8b>՘<80><8d><9b><ff>^S^_'<d6>"[)<bc>^X(<9a>ښ^V|9<ab><cd>(&<95><d3>^F0<b2><d4>^S;<a5>N<da><c0>o6i<a5><9a><92>՝<be>^[<82><f0>q<f7><a2>^Uv<b5>L<a2>U$Z<fa>"<db>s<a6>D4<88>6<b4><18><a5><8a>FC2^Z<d2>7Z^E^_^K<bc><b3>%5<ed><ab>h1<a9>l<b6><f6>¯<e7><8d>x6<8a>H<b6><9a>^B<be>Xk^QlL<8d><ae><f4><9b>        <8b>9^VG<af>^]\%^NQ<89>^Y:m     ><e3>_<d8>wZ<b9>p<a1><b0>hfmm<bf>^T<ca><e4>K<fd>Ử\*<81>SOI▒%w^]g<a2><fb>Q.^^<9d>Y-
A{<c8><f0>ƻ^KU<bf>^P<e4>A<ed><f4><e5>a^Q<ae>^Q^X<f8><ad>fS<ad>k^S^X=~<89><ab><b7> <a8><97>^D<d4><f6><9d>6Fw\<93>s<ce><f1>^H<89>?^]<b8>ώ@Ɩg<87>^?%p=<e8><a7>$<f3><cf>Fַb<c6>[<99><e5><be>#<90>²<bf><f4>=<cb>H<e4>v^^4<82>t5<fb>ڝ<ec><fb>ސUy<82>/r<a3><8a>^A<f1>!<f5><e5><9f><\E<ac><8c>7<ae>z?^ZN<a2>"<85>q<91><e2><c8><<f3><b9><^D<96>^H^]<e6>^?^Pb>^ϐ<a0>^E<f4><a0><93><df>5J%8?^Z<b4><f2><9f>Q<96><89><cf><f5>!h<a9>pa4?r$<80>O<b2><82>H<e1><a3><dc>/<84><ec>^S<db>{R<fc><f4><ae>^@AM<8a><b5>o<85>ѮEnZԞE<92>^TU<b5><c2> H<f2>jƓÝ%<dc><c9><e1>N^Mw<d2><f9>S<c3>)<a4>pQ'<a6>^[^W<fa><c1>V^R<b1>|<90><9b>b<cd><e7><f8>2<b3><fa>16o<89>s<84>^FLg|^O<d4>^H<82>e^L<bf>x]]<ac><99>^F<bf>ڋl<b5>6<a7><f5><95>И/<e7><eb>S<af>^<8d>^]<e8><f8><86>[<8d>^\<8d>^DA<cd><d3>(,~2^RHH4^Y      <c3><d4><d8>/<91><fc><f2><8a><8b>F},<91><ae>ҍb<e2>^K    <ff><92><91>z\<ba><fa>^_<bf><fc><b5><8f>

perl -MCompress::Zlib script.pl <sample.txt
You will write a function or program that's code-golf, i.e. it'd've to be as short as you can make it.
Given a text, return (both by any means) the text where you'll have contracted as many words as possible according this table.
You shan't pull information from the table, rather you must've all necessary information included in your code.
All default rules oughtn't to be broken as we'lln't've any unfair competition.
You needn't consider text if 'tisn't capitalized as in the table, so you mustn't convert y'all WOULD not've or You all wouldn't've to y'all'dn't've.
You may match just the good ol' apostrophe (U+0027) or any nice ones; whatever you wanna.

I guess you can use perl -p0 s1-golfed.pl to get rid of the wrapped while loop: $/="\n";for$d(<DATA>){($x)=$d=~/(.*),(.*)\b/;s/$2/$x/g}

And remove the need for $x: for$d(<DATA>){$d=~s~(.*),(.*)\b~"s/$2/$1/g"~eeg}


text:
Make some noise-cancelling headphones
I am in desperate need of some ear defenders, so I can program in peace. Unfortunately, I don't have ear defenders. But I do have a pair of headphones, a microphone and a microcontroller, so I thought I'd make some noise-cancelling headphones.
However, there is one tiny problem. I can't program in noisy environments! So you'll need to write the code for me.
Task
Given a constant noisy input, output the input's "complement"; a value that will completely cancel out the input value (0x00 cancels 0xff, 0x7f cancels 0x80). Because the headphones block some noise, also take a value as input that you will divide the "complement" by, using the following algorithm: if (c < 0x80) ceil ( 0x7f - ( (0x7f - c) / n ) ) else floor ( ( (c - 0x80) / n ) + 0x80 ) where c is the "complement" and n is the value to divide by. (If the value exceeds the byte range, it should be clipped to 0 or 255.)
The input will always be a sequence of bytes, via stdin or function parameter (see bonuses) but the modifier can be given via any input method. The output sequence should be output via stdout or as a return value (see bonuses). The output should be a series of bytes (e.g. $.d<±3Ç/ó¢), or a set of numbers representing those bytes (e.g. 217 135 21 43 126 219).
Oh, and your code will have to be short, because there isn't much flash memory on the microcontroller (4096 bytes; and I need to fit on drivers too!).
Examples
In these examples, I have used hexadecimal codes to represent bytes, because DEL and NULL are somewhat hard to read. The actual input and output should be done as a string of bytes or as a byte-stream.
Modifier: 2
Input: 0x00 0x10 0xe0 ...
Output: 0xbf 0xb7 0x4f ...
Modifier: 128
Input: 0x00 0x10 0xe0 ...
Output: 0x80 0x80 0x7f ...
Modifier: 0.5
Input: 0x00 0x10 0xe0 ...
Output: 0xff 0xff 0x00 ...
Your code should cope with much longer inputs than this; these are just examples.
Bonuses
To add a bonus to a score, use the following formula: s * (100% - b) where s is the current score and b is the bonus as a percentage.

1% If you output as raw bytes.
5% If there's no stdin pipe (or byte input), get the bytes straight from the microphone, such as with parec.
5% If you output to the speakers as well as returning / outputting to stdout.

Why require STDIN/STDOUT? I don't see a reason why we shouldn't be allowed to use function arguments/returns values instead.

Although, there is a good reason you shouldn't be allowed to; it would be a bit of a rubbish noise-canceller if there wasn't any cancelling until all the bytes had been received through the microphone!

What's a compliment? Is it like a complement?

Does the output have to be given in hex?

@xnor It has to not be given in Hex. I just didn't think it would be easy to read NULL and DEL characters. You need to output as a byte stream. (I'll update the question.)

@wizzwizz4 What's a byte stream? Some languages have different data types and names. Will a number do?

@xnor An arbitrary-sized number or a string of bytes is an acceptable replacement for a byte-stream.

I'm assuming we can use an algorithm equivalent to the provided one if it's shorter?

@CatsAreFluffy Of course; this wouldn't be code-golf if you were just golfing my code!

Bonuses are generally discouraged in [tag:code-golf].

@lirtosiast That's why I didn't add bonuses for bonuses' sake. I only added bonuses that I thought would add to the challenge.

"An arbitrary-sized number or a string of bytes is an acceptable replacement for a byte-stream." By "string of bytes", do you mean my language's native String type, or a bunch of bytes strung together in an array?

@tac The string type is what I had in mind, but there's a problem with NULL and "end of string" in some languages.

@wizzwizz4 can you clarify in the question how the output format should be? the current spec is quite vague

Pyth, 54 51 bytes
J128m.MZ,0h.mb,255?<dJ.E-tJc-tJdQs+c-dJQJm-255id16E

Try it here!
Explanation

J128m.MZ,0h.mb,255?<dJ.E-tJc-tJdQs+c-dJQJm-255id16E   # Q = modifier, E = input list

J128                                                  # set J to 128
                                         m        E   # map each input d
                                              id16    # convert to decimal
                                          -255        # get the complement
    m                                                 # map each complement d
                  ?<dj                                # if d < 128
                      .E-tJc-tJdQ                     # use the ceil-formula
                                 s+c-dJQJ             # otherwise use the floor-formular
          .mb,255                                     # minimum of the result and 255
    .MZ,0h                                            # maximum of the result and 0

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Zigzagify a Matrix
As part of its compression algorithm, the JPEG standard unrolls a matrix into a vector along antidiagonals of alternating direction:

Your task is to take a matrix (not necessarily square) and return it in unrolled form. As an example:
[1 2 3 4
 5 6 7 8
 9 1 2 3]

should yield
[1, 2, 5, 9, 6, 3, 4, 7, 1, 2, 8, 3]

Rules
You may assume that the matrix elements are positive integers less than 10.
You may write a program or function, taking input via STDIN (or closest alternative), command-line argument or function argument and outputting the result via STDOUT (or closest alternative), function return value or function (out) parameter.
The input matrix may be given in any convenient, unambiguous, nested list or string format, or as a flat list along with both matrix dimensions. (Or, of course, as a matrix type if your language has those.)
The output vector may be in any convenient, unambiguous, flat list or string format.
Standard code-golf rules apply.
Test Cases
[[1]]                                               => [1]
[[1 2] [3 1]]                                       => [1 2 3 1]
[[1 2 3 1]]                                         => [1 2 3 1]
[[1 2 3] [5 6 4] [9 7 8] [1 2 3]]                   => [1 2 5 9 6 3 4 7 1 2 8 3]
[[1 2 3 4] [5 6 7 8] [9 1 2 3]]                     => [1 2 5 9 6 3 4 7 1 2 8 3]
[[1 2 6 3 1 2] [5 9 4 7 8 3]]                       => [1 2 5 9 6 3 4 7 1 2 8 3]
[[1 2 5 9 6 3 4 7 1 2 8 3]]                         => [1 2 5 9 6 3 4 7 1 2 8 3]
[[1] [2] [5] [9] [6] [3] [4] [7] [1] [2] [8] [3]]   => [1 2 5 9 6 3 4 7 1 2 8 3]

Related Challenges

Reconstruct a zigzagified matrix (the somewhat trickier inverse transformation)
Rotate the anti-diagonals

Can the input be an actual matrix in J? Or would it need to be turned from nested lists into a matrix as part of the function?

If we take the matrix as a 2D array, may we still take the dimensions as inputs?

@Gareth yes you can take a matrix type as input.

@xnor Hmmm, that one's a bit trickier. I feel like taking that amount of redundant information goes a bit into preprocessing the input.

Can the flat list be in column-major order if that's the language's native order?

@DonMuesli sure.

This link to a question I posted on StackOverflow in the past may also be fruitful: http://stackoverflow.com/questions/28369142/what-is-the-most-efficient-way-to-implement-zig-zag-ordering-in-matlab.  It was unfortunately linked to another duplicate, but both the question and the duplicate may provide fruitful information on why the zigzag order is important in JPEG compression.

This challenge is related too

Are elements strictly positive or can we have some zero ?

@Erwan strictly positive

Shouldn't this be "unzigzagify a matrix"? This is making the input less complex then the output...

J, 31 30 14 12 11 bytes
[:;<@|.`</.

Ych. Too big.
Takes a matrix as input.
Explanation
J has an advantage here. There's a command called oblique (/.) which takes the oblique lines in turn and applies a verb to them. In this case I'm using a gerund to apply two verbs alternately: < (box) and <@|. (reverse and box). Then it's just a matter of unboxing everything using ; (raze).

J is the only language that makes me feel like I need an advanced degree in English to understand it.

@AlexA. btw, the word "command" should have been "adverb".

Jelly, 24 19 15 13 11 bytes
pS€żị"¥pỤị⁵

Takes number of rows, number of columns and a flat list as separate command-line arguments.
Try it online!
How it works
pS€żị"¥pỤị⁵  Main link. Argument: m (rows), n (columns), A (list, flat)

p            Compute the Cartesian product [1, ..., m] × [1, ..., n]. This yields
             the indices of the matrix M, i.e., [[1, 1], [1, 2], ..., [m, n]].
 S€          Compute the sums of all index pairs.
       p     Yield the Cartesian product.
      ¥      Dyadic chain. Arguments: Sums, Cartesian product.
    ị"       For each index pair in the Cartesian product, retrieve the coordinate
             at the index of its sum, i.e., map [i, j] to i if i + j is odd and to
             j if i + j is even.
   ż         Zip the sums with the retrieved indices.
       Ụ     Sort [1, ..., mn] by the corresponding item in the resulting list.
        ị⁵   Retrieve the corresponding items from A.

Tsk. I'm not sure if I can make mine any shorter now. :-S

That's not to say I won't try though...

Why hasn't Jelly inherited Oblique yet? May I suggest the APL glyphs ⍁ and ⍂? Or maybe Scandinavian ø and ǿ?

Pyth, 24 23 21 20 19 18 17 bytes
ssm_W=!Td.T+LaYkQ

Alternate 17-byte version: ssuL_G=!T.T+LaYkQ
                Q  input
           +L      prepend to each subarray...
             aYk   (Y += ''). Y is initialized to [], so this prepends [''] to
                     the first subarray, ['', ''] to the second, etc.
                   ['' 1  2  3  4
                    '' '' 5  6  7  8
                    '' '' '' 9  1  2  3]
         .T        transpose, giving us
                   ['' '' ''
                    1  '' ''
                    2  5  ''
                    3  6  9
                    4  7  1
                    8  2
                    3]
  m_W=!Td          black magic
 s                 join subarrays together
s                  join *everything* on empty string (which means ''s used for
                     padding disappear)

Thanks to @FryAmTheEggman for a byte, @Jakube for 2 bytes, and @isaacg for a byte!
Explanation of "black magic" alluded to above: m_W=!Td essentially reverses every other subarray. It does this by mapping _W=!T over each subarray; W is conditional application, so it _s (reverses) all subarrays where =!T is true. T is a variable preinitialized to ten (truthy), and =!T means (T = !T). So it toggles the value of a variable that starts out truthy and returns the new value, which means that it will alternate between returning falsy, truthy, falsy, truthy... (credit to Jakube for this idea)
Test suite here.

MATL, 28 27 bytes
tZyZ}:w:!+-1y^7MGn/*-X:K#S)

Adapted from my answer here. The general idea is to create a 2D array of the same size as the input, filled with values that increase in the same order as the zig-zag path. Then the linearized (flattened) version of that array is sorted, and the indices of that sorting are kept. Those are the indices that need to be applied to the input in order to produce the zig-zag path.
Input is in the form
[1 2 3; 5 6 4; 9 7 8; 1 2 3]

Explanation
Try it online!
t       % input 2D array. Duplicate
ZyZ}    % get size as length-2 vector. Split into two numbers: r, c
:       % range [1,2,...,c] as a row vector
w:!     % swap, range [1;2;...;r] as a column vector
+       % add with broadcast. Gives a 2D array
-1      % push -1
y^      % duplicate previous 2D array. Compute -1 raised to that
7M      % push [1;2;...;r] again
Gn/     % divide by input matrix size, that is, r*c
*       % multiply
-       % subtract
X:      % linearize 2D array into column array
K#S     % sort and push the indices of the sorting. Gives a column vector
)       % index input matrix with that column vector

Matlab, 134 bytes
I just tried my best to shorten my code in Matlab, like telegraphing it.
function V=z(M)
[m,n]=size(M);
a=(1:m)'*ones(1,n);
b=ones(m,1)*(1:n);
A=a+b-1;
B=a-b;
C=(A.^2+(-1).^A.*B+1);
[~,I]=sort(C(:));
V=M(:);
V=V(I)';

Notes:

M is an m×n matrix.
a and b are both matrices same size of M, each row of a consists of numbers equal to its row number, while each column of b is equal to its column number. Thus, a+b is a matrix whose element equals to sum of its row and column number, i.e., matrix(p,q)=p+q.
Thus, A(p,q)=p+q-1; and B(p,q)=p-q.
C is mathematically stated as equation below.

with the equation, a zigzagifiedly increasing matrix can be made like shown below.

C =
     1     2     6     7
     3     5     8    14
     4     9    13    18
    10    12    19    25

C indicates the order of elements of M in zigzagified results. Then, [~,I]=sort(C(:));returns the order, i.e., I, thus, V=V(I)' is the result.

Yes, I just found it, now I update it.

@AlexA. Thank you, Alex. For I am new to this and I wanna shorten it as short as possible but make it a snippet. Now I have fixed my code yet.

Looks good. Nice first post! :)

JavaScript (SpiderMonkey 30+), 99 bytes
x=>[for(y of[...x,...x[0]].keys())for(z of Array(y+1).keys())if(a=x[y%2?z:y-z])if(b=a[y%2?y-z:z])b]

Tested in Firefox 44. Takes input as a 2D array.

Python 2, 84 bytes
lambda N,w,h:[N[i*w+s-i]for s in range(w+h+1)for i in range(h)[::s%2*2-1]if-1<s-i<w]

Porting nimi's answer. Takes a flat array with given width and height. xsot saved a byte.

88 bytes:
lambda M,w,h:[M[i]for i in sorted(range(w*h),key=lambda i:(i/w+i%w,-i*(-1)**(i/w+i%w)))]

Takes a flat array with given width and height. Sorts the corresponding 2D coordinates (i/w,i%w) in zigzag order of increasing sum to get diagonals, tiebroken by either increasing or decreasing row value, based on whether the row plus column is odd or even.

That if condition can be further shortened.

@xsot Nice catch.

Haskell, 79 78 73 bytes
(m#h)w=[m!!(y*w+x-y)|x<-[0..h+w],y<-g!!x$[0..x],y<h,x-y<w]
g=reverse:id:g

The input is a flat list with the number of rows and columns, e.g. ( [1,2,6,3,1,2,5,9,4,7,8,3] # 2) 6 -> [1,2,5,9,6,3,4,7,1,2,8,3].
How it works: walk through the x and y coordinates of the matrix (h rows, w columns) in two nested loops:
  | 0 1 2 3 4 5 6 7 8    outer loop               Index is y*w+x-y, i.e.
--+------------------    x from 0 to h+w          the elements are accessed
0 | 1 2 6 3 1 2                                   in the following order:
1 | 5 9 4 7 8 3
2 |                                               1 2 4 6  8 10
3 |                                               3 5 7 9 11 12
4 |
5 |
6 |
7 | inner loop:
8 | y from 0 to x

i.e. from top/right to down/left, skipping out of bound indices (y and x must satisfy y<h and x-y<w). When x is even, the order of the inner loop is reversed: y goes from x to 0. I do this by picking a modifying function for the y-range [0..x] which is the xth element of [reverse,id,reverse,id,...].
Edit: @xnor re-arranged the loops and saved 5 bytes. Thanks!

I think you can do g=id:reverse:g.

The parens on the multication (y-x)*w can be cut by transposing the problem: (m#h)w=[m!!(x*w+y-x)|y<-[0..h+w],x<-g!!y$[0..y],x<h,y-x<w] g=reverse:id:g. Translating into Python saves 3 chars over what I had.

Husk, 6 bytes
Σz*İ_∂

Try it online!
Same idea as Zgarb's Boustrophedonize solution.

K (ngn/k), 50 41 bytes
-9 Can use odometer directly
{(,/x)@,/((#c)#(|:;::))@'c:.=+/!#'(x;*x)}

Try it online!

I just worked out that this is the same as @Razetime’s Husk solution but with fewer built-ins available.

Julia 0.7, 114 85 bytes
^ =size
~A=[[i%2<1?reverse(x):x for(i,x)=pairs(-A^2:A^1.|>x->diag(rotl90(A),x))]...;]

Try it online!
Takes the antidiagonals (rotates and takes the main diagonals), reverses every other one, and flattens the list.
-29 bytes thanks to MarcMush:

replace A[end:-1:1,1:end] with rotl90(A) to rotate the matrix
rewrite with pairs instead of eachindex
to flatten a vector of vectors Q, use [Q...;] instead of vcat[Q...]

88 bytes. It might look like a new answer but it's yours optimized

Vyxal, 6 bytes
Þ`⁽ṘẆf

Try it Online!
Þ`     # Antidiagonals
  ⁽ Ẇ  # To every other item
   Ṙ   # Reverse
     f # Flatten

Python 2 + NumPy, 122 bytes
I admit it. I worked ahead. Unfortunately, this same method cannot be easily modified to solve the other 2 related challenges...
import numpy
def f(m):w=len(m);print sum([list(m[::-1,:].diagonal(i)[::(i+w+1)%2*-2+1])for i in range(-w,w+len(m[0]))],[])

Takes a numpy array as input. Outputs a list.
Try it online
Explanation:
def f(m):
    w=len(m)    # the height of the matrix, (at one point I thought it was the width)
    # get the anti-diagonals of the matrix. Reverse them if odd by mapping odd to -1
    d=[list(m[::-1,:].diagonal(i)[::(i+w+1)%2*-2+1])for i in range(-w,w+len(m[0]))]
            # w+len(m[0]) accounts for the width of the matrix. Works if it's too large.
    print sum(d,[]) # join the lists

A lambda is the same length:
import numpy
lambda m:sum([list(m[::-1,:].diagonal(i)[::(i+len(m)+1)%2*-2+1])for i in range(-len(m),len(m)+len(m[0]))],[])

Python 3, 131 118 115 107 bytes
Based on the same principe as my answer of Deusovi's challenge
I assume we can't have zero in the input matrice
e=enumerate
lambda s:[k for j,i in e(zip(*[([0]*n+i+[0]*len(s))for n,i in e(s)]))for k in i[::j%2*2-1]if k]

Explanation
how it works :
            pad with 0      transpose    remove 0    reverse line           concatenate
                                                     with even index
1 2 3       1 2 3 0 0        1 0 0        1            1
4 5 6   --> 0 4 5 6 0    --> 2 4 0    --> 2 4     -->  2 4              -->  1 2 4 7 5 3 6 8 9
7 8 9       0 0 7 8 9        3 5 7        3 5 7        7 5 3
                             0 6 8        6 8          6 8
                             0 0 9        9            9

Results
>>> [print([i,f(i)]) for i in [[[1]], [[1, 2], [3, 1]], [[1, 2, 3, 1]], [[1, 2, 3], [5, 6, 4], [9, 7, 8], [1, 2, 3]], [[1, 2, 3, 4], [5, 6, 7, 8], [9, 1, 2, 3]], [[1, 2, 6, 3, 1, 2], [5, 9, 4, 7, 8, 3]], [[1, 2, 5, 9, 6, 3, 4, 7, 1, 2, 8, 3]], [[1], [2], [5], [9], [6], [3], [4], [7], [1], [2], [8], [3]]]]
# [input,                                                          output]
[[[1]],                                                            [1]]
[[[1, 2], [3, 1]],                                                 [1, 2, 3, 1]]
[[[1, 2, 3, 1]],                                                   [1, 2, 3, 1]]
[[[1, 2, 3], [5, 6, 4], [9, 7, 8], [1, 2, 3]],                     [1, 2, 5, 9, 6, 3, 4, 7, 1, 2, 8, 3]]
[[[1, 2, 3, 4], [5, 6, 7, 8], [9, 1, 2, 3]],                       [1, 2, 5, 9, 6, 3, 4, 7, 1, 2, 8, 3]]
[[[1, 2, 6, 3, 1, 2], [5, 9, 4, 7, 8, 3]],                         [1, 2, 5, 9, 6, 3, 4, 7, 1, 2, 8, 3]]
[[[1, 2, 5, 9, 6, 3, 4, 7, 1, 2, 8, 3]],                           [1, 2, 5, 9, 6, 3, 4, 7, 1, 2, 8, 3]]
[[[1], [2], [5], [9], [6], [3], [4], [7], [1], [2], [8], [3]],     [1, 2, 5, 9, 6, 3, 4, 7, 1, 2, 8, 3]]

Should reverse even line be reverse odd lines instead?

@nwp index begin at 0 ^^

Ah, you are talking about the line numbers, not the length of the line. I confused those, sorry.

@nwp np, btw I changed it to avoid confusion

05AB1E, 11 bytes
ΣN²‰ÐOŠO<è‚

Inputs as flattened_list, width, height (even though I ignore the height input).
Try it online or verify all test cases.
Explanation:
The actual sorting algorithm is a direct port of my 05AB1E answer for the Traverse a rectangle's antidiagonals challenge. Even though the actual path over the matrix is different for both challenges, that linked challenge uses \$y,x\$ as coordinates, whereas I use \$x,y\$ here, so the actual sorting implementation is basically the exact same.
Σ            # Sort the first (implicit) input-list by:
 N           #  Push the 0-based sort-index
  ²‰         #  Divmod it by the second input-width
    Ð        #  Triplicate this coordinate
     O       #  Sum the top pair together
      Š      #  Tripleswap from pair,pair,sum to sum,pair,pair
       O     #  Sum the top pair together again
        <    #  Decrease it by 1
         è   #  Modular 0-based index this sum-1 into the pair
          ‚  #  Pair it together with the other sum
             # (after which the sorted list is output implicitly)

Just like in my linked answer, there are a few equal-bytes alternatives for ÐOŠO<è‚ (not as many as in the linked answer, since we don't have access to the pair as variable y here, since we've just created the pair manually with N²‰):
RDODŠè‚
ÐO<è‚€O
...

JavaScript (Node.js), 89 bytes
a=>a.flatMap((b,i)=>b.map((c,j)=>({c,k:++i-j/(-2)**i}))).sort((p,q)=>p.k-q.k).map(x=>x.c)

Try it online!

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Reconstruct a zigzagified matrix
As part of its compression algorithm, the JPEG standard unrolls a matrix into a vector along antidiagonals of alternating direction:

Your task is to take the unrolled vector along with the matrix dimensions and reconstruct the corresponding matrix. As an example:
[1, 2, 5, 9, 6, 3, 4, 7, 1, 2, 8, 3], 4, 3

should yield
[1 2 3 4
 5 6 7 8
 9 1 2 3]

whereas dimensions 6, 2 would give
[1 2 6 3 1 2
 5 9 4 7 8 3]

Rules
You may choose to take only one of the dimensions as input. The individual inputs can be taken in any order. You may assume that the width and height are positive and valid for the given vector length.
You may assume that the vector elements are positive integers less than 10.
You may write a program or function, taking input via STDIN (or closest alternative), command-line argument or function argument and outputting the result via STDOUT (or closest alternative), function return value or function (out) parameter.
The input vector may be given in any convenient, unambiguous, flat list or string format.
The output matrix may be in any convenient, unambiguous, nested list or string format, or as a flat list along with both matrix dimensions. (Or, of course, as a matrix type if your language has those.)
Standard code-golf rules apply.
Test Cases
Each test case is of the form vector width height => matrix.
[1] 1 1                        => [[1]]
[1 2 3 1] 2 2                  => [[1 2] [3 1]]
[1 2 3 1] 4 1                  => [[1 2 3 1]]
[1 2 5 9 6 3 4 7 1 2 8 3] 3 4  => [[1 2 3] [5 6 4] [9 7 8] [1 2 3]]
[1 2 5 9 6 3 4 7 1 2 8 3] 4 3  => [[1 2 3 4] [5 6 7 8] [9 1 2 3]]
[1 2 5 9 6 3 4 7 1 2 8 3] 6 2  => [[1 2 6 3 1 2] [5 9 4 7 8 3]]
[1 2 5 9 6 3 4 7 1 2 8 3] 12 1 => [[1 2 5 9 6 3 4 7 1 2 8 3]]
[1 2 5 9 6 3 4 7 1 2 8 3] 1 12 => [[1] [2] [5] [9] [6] [3] [4] [7] [1] [2] [8] [3]]

Related Challenges

Zigzagify a Matrix (the somewhat simpler inverse transformation)
Rotate the anti-diagonals

Jelly, 18 13 bytes
pS€żị"¥pỤỤị⁵s

Takes number of rows, number of columns and a flat list as separate command-line arguments.
My code is almost identical to the one in the twin challenge. The only differences are an additional Ụ (which inverts the permutation of the indices) and an s (to split the output into a 2D array).
Try it online!

MATL, 29 bytes
:!i:+-1y^8MtsQ/*-X:4#S2$S1GZC

Input is height, width, vector separated by newlines.
This reuses part of the code in my answer to the related challenge.
Try it online!
Explanation
:!      % take number of rows, r, as input. Generate column vector [1;2;...;r]
i:      % take number of columns, c, as input. Generate row vector [1,2,...,c]
+       % add with broadcast. Gives 2D array
-1      % push -1
y^      % duplicate previous 2D array. Compute -1 raised to that
8M      % push [1;2;...;r] again
tsQ/    % divide by its sum plus 1
*       % multiply
-       % subtract
X:      % linearize 2D array into column array
4#S     % sort and push the indices of the sorting. Gives a column vector
2$S     % take vector as input. Sort it according to previous column vector
1G      % push r
ZC      % reshape into columns of r elements

J, 24 bytes
]$({~[:/:@;[:<@|.`</.i.)

Also uses the oblique adverb /. to perform zigzagify as in the J answer from that challenge.
Usage
Input is with the array on the LHS and the dimensions [height, width] on the RHS.
   f =: ]$({~[:/:@;[:<@|.`</.i.)
   1 f 1 1
1
   1 2 3 1 f 2 2
1 2
3 1
   1 2 5 9 6 3 4 7 1 2 8 3 f 4 3
1 2 3
5 6 4
9 7 8
1 2 3
   1 2 5 9 6 3 4 7 1 2 8 3 f 3 4
1 2 3 4
5 6 7 8
9 1 2 3
   1 2 5 9 6 3 4 7 1 2 8 3 f 2 6
1 2 6 3 1 2
5 9 4 7 8 3
   1 2 5 9 6 3 4 7 1 2 8 3 f 1 12
1 2 5 9 6 3 4 7 1 2 8 3
   1 2 5 9 6 3 4 7 1 2 8 3 f 12 1
1
2
5
9
6
3
4
7
1
2
8
3

Explanation
]$({~[:/:@;[:<@|.`</.i.)  Input: list A (LHS), dimensions D (RHS)
                     i.   Range shaped to D
           [:<@|.`</.     Zigzagify that matrix
     [:   ;               Raze the boxes to get a zigzagify permutation
       /:@                Invert that permutation to get an unzigzagify permutation
   {~                     Apply that permutation to A
]                         Get D
 $                        Shape that permutation to D and return

K (ngn/k), 36 bytes
{y#x@<,/((#c)#(|:;::))@'c:.=+/!y:|y}

Try it online!
Basically the same as Zagify a matrix but with a grade.


text:
Roman-style date formatting
Today (March 15) is the Ides of March, best known for being the date that Julius Caesar was assassinated.
What's “Ides”?  Well, the ancient Romans didn't simply number the days of month from 1 to 31 like we do.  Instead, they had a more complex system of counting backwards to the Kalends, Nones, or Ides.
Challenge
Write, in as few bytes as possible, a program that will display the current date (on the Gregorian calendar, in the local timezone) using the abbreviated Roman-style convention described below.  Your program should work until at least the end of 2037.
Roman dates
Months of the year
These should look familiar to you: Ianuarius, Februarius, Martius, Aprilis, Maius, Iunius, Iulius (Quintilis), Augustus (Sextilis), September, October, November, December.
Your program is to abbreviate all months to three letters, using the classical Latin alphabet (all caps, with J=I and U=V).  That is, IAN, FEB, MAR, APR, MAI, IVN, IVL, AVG, SEP, OCT, NOV, DEC.
Special dates of the month

Kalendis, or the Kalends (abbr. KAL) is the first day of each month.
Idibus, or the Ides (abbr. ID) is the 15th day of March, May, July, or October; but the 13th day of the other eight months.
Nonas, or the Nones (abbr. NON) is 8 days before the Ides (5th or 7th of the month)

Other days of the month
Other days of the month are numbered by counting backwards and inclusively to the next reference date (Kalends, Ides, or Nones).  Notation is AD (abbreviation for ante diem, no relation to Jesus of Nazareth) followed by the appropriate Roman numeral.
Exception: Write PR (for pridie) instead of AD II for the day before Kalends, Nones, or Ides.
The leap day
In leap years, two days (February 24 and 25 in modern reckoning) are given the date AD VI KAL MAR.  (You do not need to distinguish the two days in your program.)  February 14-23 are AD XVI KAL MAR through AD VII KAL MAR as in non-leap years.  Feb 26 = AD V KAL MAR, Feb 27 = AD IV KAL MAR, Feb 28 = AD III KAL MAR, and Feb 29 = PR KAL MAR, offset by one from the corresponding dates in non-leap years.
Example
In March, the output of your program should be:

On March 1: KAL MAR
On March 2: AD VI NON MAR
On March 3: AD V NON MAR
On March 4: AD IV NON MAR
On March 5: AD III NON MAR
On March 6: PR NON MAR
On March 7: NON MAR
On March 8: AD VIII ID MAR
...
On March 13: AD III ID MAR
On March 14: PR ID MAR
On March 15: ID MAR
On March 16: AD XVII KAL APR
...
On March 30: AD III KAL APR
On March 31: PR KAL APR

Tcl/Tk, 675 bytes
Well, I suppose I could crunch it more, but this is it for now...
set a {y m d}
rename proc p
p r {n {s ""}} {foreach {v d} {10 X 5 V 1 I} {while {$n>=$v} {set s $s$d;incr n -$v}};string map {VIIII IX IIII IV} $s}
p y y {expr !($y%100?$y%4:$y%400)}
p i $a {expr {($m in {3 5 7 10})?15:13}}
p n $a {expr [i $y $m $d]-8}
p k $a {expr $m==2?29+($d>24&&[y $y]):$m<8?31+$m%2:32-$m%2}
p N {} {clock f [clock se] -f {%Y %N %e}}
p M m {lindex {IAN FEB MAR APR MAI IVN IVL AVG SEP OCT NOV DEC IAN} $m-1}
p d $a {foreach f {n i k} n {NON ID KAL} mo {0 0 1} {if {$d<=[$f $y $m $d]} break}
string map {{AD I } {} {AD II } {PR }} "AD [r [expr [$f $y $m $d]+1-$d]] $n [M [expr $m+$mo]]"}
p p $a {if {$d==1} {puts "KAL [M $m]"} {puts [d $y $m $d]}}
p {*}[N]

How it works
The first thing is to collect today's date as a list: year, month, day. Everything works over that. The first of the month is a simple special case; we handle that separately.
All remaining cases work like this:

Find the future reference day's date in (5,7,13,15,days-in-month)
Get the abbreviation corresponding to that reference (NON, ID, KAL)
For Kalends we increment the month by one
Assemble the date string as:
"AD <days-in-roman-numerals> <abbreviated-reference-day> <abbreviated-month-name>"
Apply a text replace to correct AD I and AD II.

The first step is done with a function lookup table for each of the Nones, Ides, and Kalends. Nones and Ides are straight-forward subtraction and lookup, respectively. Computing the Kalends is only a little more complicated (notice the trick with leap-February's day number.):

February → 28 days + (it's a leap year AND day > 24)
January..July → 30 days + (it's January, March, May or July)
August..December → 31 days - (it's September or November)

The days is a simple difference: (reference_day - todays_day + 1)
Computing the leap year is done with a somewhat unusual arrangement of the standard formula so that it could be crunched better (removing braces and parentheses from the expr command).
Converting decimal to Roman numerals is a simple table-driven approach, stripped to use only ones, fives, and tens since we don't need to print the year in Roman numerals (domain is [1,39]).
Almost everything else is application of lookup tables.
A note on Tcl and reducing bytes
The first two lines of the script eat bytes by simply being shorter than spelling out proc f {y m d} for all instances.
Single-letter proc names and variables, of course:
    r := decimal→roman(n)    i := ides(y,m,d)        M := month-abbreviation(month)
    y := is-leap(year)       n := nones(y,m,d)       d := date→roman(y,m,d) [d ≠ 1]
    N := today → (y,m,d)     k := kalends(y,m,d)     p := date→roman(y,m,d) [∀d]

Testing for dates other than today
Change the very last line from p {*}[N] to
p {*}$argv

and run the program with the date desired:
% tclsh roman.tcl 2016 2 25
AD VI KAL MAR

Enjoy!

(I will not give myself the checkmark, even though I have the shortest submission so far.)
Python 3: 390 bytes
import time
y,m,d=time.localtime()[:3]
d-=(y%4==0)*(m==2)*(d>24)
i=13+2*(m in (3,5,7,10))
n=i-8
k=29+(0,3,0,3,2,3,2,3,3,2,3,2,3)[m]
a,R={1:(0,'KAL'),d>1:(n-d,'NON'),d>n:(i-d,'ID'),d>i:(k-d,'KAL')}[1]
a+=1
A={1:'',2:'PR '}.get(a,'AD '+a//10*'X'+('','I','II','III','IV','V','VI','VII','VIII','IX')[a%10]+' ')
if d>i:m=m%12+1
M='IFMAMIIASONDAEAPAVVVECOENBRRINLGPTVC'[m-1::12]
print(A+R+' '+M)

Explanation
y,m,d=time.localtime()[:3]

Gets the current date: y=year, m=month, and d=day.
To test the program with dates other than the current date, simply replace this line with something else.
d-=(y%4==0)*(m==2)*(d>24)

If this is February 25-29 of a leap year, subtract 1 from the date.  From this point on, we can treat February as if it's a non-leap year.
Note that, because the challenge rules don't require correct behavior in the year 2100, I used the simple 4-year Julian leap-year rule instead of the Gregorian 400-year cycle.
i=13+2*(m in (3,5,7,10))

Ides of the current month.
n=i-8

Nones of the current month.
k=29+(0,3,0,3,2,3,2,3,3,2,3,2,3)[m]

One more than the number of days in the current month, equivalent to the Kalends of the next month.
a,R={1:(0,'KAL'),d>1:(n-d,'NON'),d>n:(i-d,'ID'),d>i:(k-d,'KAL')}[1]

a is the number of days until the next reference date and R is its abbreviation.  This expression takes advantage of the fact that if the same key is specified multiple times in the same dict literal, only the last one counts.
a+=1

Adjustment for inclusive counting.
A={1:'',2:'PR '}.get(a,'AD '+a//10*'X'+('','I','II','III','IV','V','VI','VII','VIII','IX')[a%10]+' ')

Stringify the count a to the next reference date.

If 1, use no prefix
If 2, use the prefix PR
If 3 or higher, use the prefix AD + Roman numeral + space

There's probably a shorter way to do the Roman numerals, but I'm too lazy to find it.
if d>i:m=m%12+1

If after the Ides, increment the month for display.
M='IFMAMIIASONDAEAPAVVVECOENBRRINLGPTVC'[m-1::12]

Get the month name.
print(A+R+' '+M)

Finally, print the date.


text:
Tips for golfing in Factor
What general tips do you have for golfing in Factor? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Factor (e.g. "remove comments" is not an answer).

math.unicode
this thing is a golfing jewel. http://docs.factorcode.org/content/vocab-math.unicode.html
Here, I should let it speak for itself.
Word    Stack effect    Equivalent   (Byte  Char) Savings (best case)
¬       ( obj -- ? )    not           1     2
²       ( m -- n )      2 ^ , 2^      1     2
³       ( m -- n )      3 ^           1     2
¹       ( m -- n )      1 ^           1     2
¼       ( -- value )    1/4 , 1 4 /   1     2
½       ( -- value )    1/2           1     2
¾       ( -- value )    3/4           1     2
×       ( x y -- z )    *             -1    0
÷       ( x y -- z )    /             -1    0
Π       ( seq -- n )    product       5     6
Σ       ( seq -- n )    sum           1     2
π       ( -- pi )       pi            0     0
φ       ( -- n )        phi           1     2
‰       ( m -- n )      1000 /        4     5
‱       ( m -- n )      10000 /       5     6
ⁿ       ( x y -- z )    ^             -1    0
⅓       ( -- value )    1/3           1     2
⅔       ( -- value )    2/3           1     2
⅕       ( -- value )    1/5           1     2
⅖       ( -- value )    2/5           1     2
⅗       ( -- value )    3/5           1     2
⅘       ( -- value )    4/5           1     2
⅙       ( -- value )    1/6           1     2
⅚       ( -- value )    5/6           1     2
⅛       ( -- value )    1/8           1     2
⅜       ( -- value )    3/8           1     2
⅝       ( -- value )    5/8           1     2
⅞       ( -- value )    7/8           1     2

Those are the simple constants. Now for the functions:
Word    Stack effect        Equivalent  (Byte  Char) Savings (best case)
∀       ( seq quot -- ? )   all?         1    3
∃       ( seq quot -- ? )   any?         1    3
∄       ( seq quot -- ? )   none?        2    4
∈       ( elt seq -- ? )    member?      4    6
∉       ( elt seq -- y )    ∈ ¬          3    2
∋       ( seq elt -- ? )    swap member? 9    11
∌       ( seq elt -- y )    ∋ ¬          3    2
−       ( x y -- z )        -            -1   0
∕       ( x y -- z )        /            -1   0
∖       ( s1 s2 -- set )    diff         1    3
√       ( x -- y )          sqrt         1    3
∛       ( x -- y )          ⅓ ^          2    2
∜       ( x -- y )          ¼ ^          2    2
∞       ( -- value )        1/0.         1    3
∧       ( o1 o2 -- ? )      and          0    2
∨       ( o1 o2 -- ? )      or           -1   1
∩       ( s1 s2 -- set )    intersect    6    8
∪       ( s1 s2 -- set )    union        2    4
≠       ( o1 o2 -- ? )      = ¬          1    2
≤       ( x y -- ? )        <=           -1   1
≥       ( x y -- ? )        >=           -1   1
⊂       ( s1 s2 -- ? )      subset?      4    6
⊃       ( s1 s2 -- ? )      superset?    6    8
⊄       ( s1 s2 -- ? )      ⊂ ¬          3    2
⊅       ( s1 s2 -- ? )      ⊃ ¬          3    2
⊼       ( o1 o2 -- ? )      ∧ ¬          3    2
⊽       ( o1 o2 -- ? )      or ¬         2    3
⌈       ( x -- y )          floor        2    4
⌊       ( x -- y )          ceiling      4    6

Yes, I did make that table by hand, and yes, I did the math in my head, so there might be some, er, wrong numbers. I'll go write a program to do it for me, now :P

Treasure trove vocabularies
During my time golfing with Factor, these are the non- auto-use vocabularies that have been the most indispensable to me.

grouping.extras - Group sequences in various ways.
math.unicode - Shorter names for math functions, set operations, and useful combinators.
math.combinatorics - Any time you need to get all the combinations or permutations of something, this is your vocab. Comes with tons of great combinators like filter-permutations for even more brevity. nCk and inverse-permutation come in handy sometimes too.
math.primes - Useful for prime number questions.
math.primes.factors - Get the divisors and prime factors of a number.
math.matrices - Matrix arithmetic, combinators and other operations.
lists.lazy - Working with infinite lists is sometimes terser than the alternative.
sequences.merged - Mostly for 2merge, which interleaves two sequences. Use vmerge in math.vectors instead, since it's an auto-use vocabulary.
math.text.utils - Shortest way to get a sequence of digits from a number. This is no longer true since >dec was added to the language. Now >dec 48 v-n is the shortest way.
math.extras - Lots of specialized math words. You may not need them often, but when the task calls for it, there might be a built-in for it in here.
spelling - For the ALPHABET word, which is the shortest way to get the alphabet on the stack.
english - Words for natural language processing.
qw - Shorten literal sequences of strings.
pair-rocket - Shorten literal pairs and by extension literal assocs.
project-euler.common - Words commonly needed to solve Project Euler problems. Don't sleep on the individual problem vocabularies either! I've recently used project-euler.014 and project-euler.026 for the collatz and period-length words.

Some useful auto-use vocabularies you may have overlooked

math.vectors - A gem of a vocabulary. This lets you do arithmetic with a number and a sequence or two sequences. Plenty of other good stuff in here too. If you find yourself reaching for 2map, look in here first.
math.statistics - Statistics comes up a lot in golf. histogram, cum-sum, differences, mean, and std are some of my most oft-used words. There's plenty of other great stuff in there too.
combinators - Mostly for to-fixed-point, which applies a quotation to something until it stops changing. Avoid case and cond, as they are far too verbose.
combinators.random - Conditional words based on probability instead of booleans. Extremely useful when called for.
generalizations - Allows you to shuffle the stack in a general way. dupn and repeat have been especially helpful in golf.
sequences.generalizations - Words that can apply to any number of sequences. narray is also very useful for golf at times.
sequences.extras - Words here can shorten your code compared to composing sequence words.
sequences.deep - Traverse and flatten nested sequences.
assocs.extras - Excellent words for working with assocs.
interpolate - This can sometimes be shorter than formatting words like printf.

And for those just getting started

kernel - Stack shuffling, loops, conditionals, data flow combinators, and other critical functionality. This is the core of the language. Start here.
math - Arithmetic.
sequences - Collections. Factor takes the approach of having different implementations all fall under the same sequence type, hence the words in this vocabulary will work on most types of collections.
formatting - String interpolation.
assocs - Associative arrays (dictionaries).

With just these five vocabs, you'll get a starting point similar to what most other languages give you.

Self-plug for math.matrices that I fully rewrote and documented a year or so ago :) I was frustrated with its shortfalls from using it for math homework in high school, haha.

@cat Nice work on that! It's been one of the highlights of 0.99 for me.

Factor is impossible to golf. If you're set on winning, don't use it.

I don't just mean it's verbose, like Java or C# or Scala. I mean, because of its functional style, there's a small number of ways to write a given program, and words are long and whitespace     is        not     your     friend, so it's a bad target, worse than LISP.
Factor's power is in its object model, which is highly verbose. I golf in it because I think it's a cool language, and I enjoy learning it.

The :: and M:: words replace the normal compile word :, so that a function has access to lexical variables.
The docs on lexical vars.
Why use these over :? Because often, referring to variables by name will be shorter than stack-shuffling with dup swap rot drop over nip etc.

Ahem. Scala user here. I don't appreciate you grouping Scala with Java and C#
. (although you're right, all of those are nothing when compared to golfing languages)

@user Well, when I wrote this answer in 2016, I was under the impression Scala had verbosity comparable to Java and C#. I don't know if that's true anymore

I was mostly kidding. Scala's got a lot less boilerplate than Java (and probably C#), but it's still somewhat verbose compared to, say, Python, in a lot of cases. I don't think it's gotten significantly more concise, though.

You are free to trash stdout and stack under the top...
... as long as your submission is a function and the result is returned on the top of the stack.
Simple example
. is shorter than drop, and . . is shorter than 2drop. (Almost) any object that you will encounter while golfing is printable via ., and it has the effect of removing the top item of the stack.
A real-golfing example
(a solution for Is this number a factorial?, found by golfing user's answer)
[ 1 0 [ 1 + 3dup * 3dup > ] loop . = ]

Try it online!
This is an extreme use of 3dups. It stuffs up a lot of stack items every time it is called, but it is valid (because the desired result is at the top of the stack) and correct (because it keeps the loop invariant for top three items).
Loop invariant:
( x prod idx )
1 +
( x prod idx+1 )
3dup *
( x prod idx+1 x prod' )  ! prod' = prod * (idx + 1)
3dup >
( x prod idx+1 x prod' idx+1 x>prod' )

Since loop consumes the boolean at the top on each iteration, the top three items at the start of the next iteration are ( x prod' idx+1 ).

When converting between numbers and strings, the
string>number
number>string

words can be shortened to:
dec>
>dec

respectively (thanks, chunes, again!).
There are also:

bin> and >bin for binary
oct> and >oct for octal
hex> and >hex for hexadecimal

that are all shorter than n base>, if they happen to suit your needs!
And if you need integers, use 1 /i instead of >integer:
5 3 /i
5 3 / >integer   = .
=> t
5.77 1 /i
5.77 >integer    = .
=> t

EDIT:
If it's about printing, keep an eye on these too:
.b ! prints a number in binary
.o ! prints a number in octal
.h ! prints a number in hexadecimal

(psst!)

present is shorter than 10 >base and dec> is shorter than 10 base>.

Well, it finally happened ladies and gentlemen. We no longer need present and can use >dec instead. https://github.com/factor/factor/commit/1945b8f54cd62c7d6dd811586ee21bf43d6794a6

Inline whatever you can.
All words need correct stack effect declarations in order to compile.
: hello ( -- ) "Hello, World!" print ;

These are long, even if you use single-char identifiers.
: m ( a b c d -- e f ) dup [ asd? ] bi swap = ;

Unless you use something so often that the benefits outwiegh the costs, inlining is often shorter, and : p ( a -- ) print ; aliasing doesn't save bytes.

That's true for all languages

@proudhaskeller in most modern languages (e.g. Python, JS, what have you), if you use print or whatever more than a certain number of times, you'll want to do p=print;p(...). In Factor, the cost for the equivalent of p=print is prohibitively high.

Not being able to use a common golfing tip is not a golfing tip in itself.

Also, a general golfing tip is to inline the methods you wrote, mostly when you used the method only once (but not always), hence a general tip.

@proudhaskeller if it really bothers you, feel free to DV / flag this as NAA.

string literals are special
I never realised this before, but "strings" are rather special to the parser.
"asd""abc"

is equivalent to:
"asd" "abc"

and
URL" a"split

is the same as
URL" a" split

This is perhaps the only time whitespace isn't necessary in Factor, and also works for URL" ", DLL" ", P" ", SBUF" " and the others handled by parse-string, as pointed out by @fedes. in the comments.
Note well that the opening quote-like marker must be preceded by whitespace.
The following are considered one word:
filter"asdasd"map
filter"asdasd"

And you will get a No word <blah> found in current vocabulary search path error.

This should work for the closing " of URL", DLL", P" and SBUF" too, as they all use parse-string. Good find!

@fedes. Updated, I forgot about those!

Note this no longer works in 0.99.

Because they finally fixed it? It's probably for the better.

Get used to multiple ways to write things
Usually this means to write something using high-level combinators vs. low-level combinators and/or stack shuffle words. In some cases the former wins, in others the latter wins. Therefore, in order to push Factor golf to the limits, it is good to know both and pick the one that turns out shorter.
(Re-)Using values in the stack
For reusing single value, shuffle words usually win (because Factor has a large variety of them):
( n -- np nq) [ p ] [ q ] bi
( n -- np nq) dup p swap q

( n -- np nq nr ) [ p ] [ q ] [ r ] tri
( n -- np nq nr ) dup p over q rot r

( n -- np nq nr ns ) { [ p ] [ q ] [ r ] [ s ] } cleave
( n -- np nq nr ns ) [ p ] [ q ] [ [ r ] [ s ] bi ] tri
( n -- np nq nr ns ) dup p over q pick r roll s

But the situation is somewhat different for two or more values, because spread and apply combinators can save a copy or shuffle:
( m n -- mp nq ) [ p ] [ q ] bi*
( m n -- mp nq ) [ p ] dip q
( m n -- mp nq ) q swap p swap

( m n -- mnp mnq ) [ p ] [ q ] 2bi
( m n -- mnp mnq ) [ p ] 2keep q
( m n -- mnp mnq ) 2dup p -rot q

I can't list all possible combinations here, and one or two shuffle words can be optimized out depending on context. The lesson here is to find out multiple expressions that do the same thing stack-effect-wise.
Conditionals and loops
Factor has many ways to express some variation of if, while, and boolean logic. But it also has higher-level combinators to express various common patterns: sequences has map, map-index, reduce, filter, partition (I believe these are self-explanatory), accumulate (cumulative reduce), replicate (run n times and collect intermediate values), and produce (run until false and collect intermediate results). combinators.to-fixed-point runs until fixed point is reached. math.times repeats a lambda for the given number of times.
Check if some of these high-level combinators work for the task given. If so, try to use them. Otherwise, use the simplest construct: ? or one-branch variations of if for a conditional, loop for an unbounded loop, times for simple repetition (not involving a sequence or range).
Bonus: Minimize stack item duplications and reorders
When using shuffle words, every time a shuffle word is used, you get +4~6 bytes. Try to minimize their use by duplicating multiple items at once (2dup, 3dup) and reordering inputs and intermediate states. Sometimes multiple library words do the same job but with different input order (e.g. each vs. reduce); exploit them when possible.

split doesn't need a string sequence as an argument
Or, more accurately / generally:
Factor strings are really just sequences of character values
Meaning string operations work on sequences of chars too
... which is important because, for instance, " " split will split a char-array on the number 32.
More directly, this:
>string " " split

is exactly equivalent to
" " split

While being 8 chars longer.

Sometimes "" map-as for map >string and family could be handy, I guess.

@fedes. Ooh, that's a good one

quotations are lambdas, abuse them
Most challenges can be solved with one word definition because of Factor's functional, applicative nature.
I just had the sudden realisation that [ quoting ] code is the equivalent of a lambda definition in other languages.
I don't know why I didn't think of this before...
A normal word definition:
: f ( a c -- b ) asd asd ;

Lamba'd:
[ asd asd ]

You can do everything inside a [ quotation ] that you can inside a : word.

The infix vocabulary is pretty cool.
It allows for infix notation math, which sounds lame since Factor's RPN, but:
IN: scratchpad USE: infix
IN: scratchpad [infix 5-40/10*2 infix] .
-3

For longer expressions it's much shorter than RPN because of whitespace, but you'll need to overcome the [infix syntax's length.
It also allows Python-style slicing:

USING: arrays locals infix ;
[let "foobar" :> s [infix s[0:3] infix] ] .
"foo"

Additionally, you can step through sequences with seq[from:to:step]
  notation.
USING: arrays locals infix ;
[let "reverse" :> s [infix s[::-1] infix] ] .
"esrever"

USING: arrays locals infix ;
[let "0123456789" :> s [infix s[::2] infix] ] .
"02468"

Take advantage of auto-use
Some people were already implicitly using this to discount imports. Now it is official (unless the consensus changes). No more USING: kernel math math.functions sequences ; -- you can exclude most commonly used library imports from byte count.
Caveats:

Actually check that the code does work with auto-use enabled. It can't load obscure libraries (e.g. xxx.private), and it cannot load if the word is found in multiple libraries.
If you don't have Factor installed on your machine, you can still check by entering your submission in the code section on this TIO. (Make sure the entire code has no stack effect, i.e. ( -- ).) If it runs without error, your submission is valid.

Use linked lists when appropriate
Using linked lists is shorter than using arrays when the code involves a lot of dissection at the start (and you don't need sophisticated sequence operations):
first (5)              > car (3)
rest (4)               > cdr (3)
second (6) > 1 nth (5) > cadr (4)
prefix (6)             > cons (4)
swap prefix (11)       > swons (5)
unclip (6)             = uncons (6)
unclip swap (11)       > unswons (7)

Note that you don't need USE: lists because it is auto-used by default.
If you see a good Haskell answer which uses pattern matching on a list, there is a good chance that a linked-list based solution is shorter in Factor too.

Use fried quotations to build sequence literals
Occasionally, you may need to build sequences with a mix of arguments and constants. It's shorter to do this
'[ 1 _ 1 ]
than this:
1 1 swapd 3array.
quotation is an instance of immutable-sequence. All sequence words work on them as long as they do not mutate. For instance, you can do the following, no problem:
4 '[ 1 _ 1 ] { 3 4 5 } v+
Keep in mind many words use the type of the first argument (as is the case with v+) as an exemplar for what type the result should be. This is usually unimportant but may occasionally be useful to know.
Here is a real-world example of when this was useful in a golf: https://codegolf.stackexchange.com/a/226034/97916

4 '{ 1 _ 1 } would probably be more clear ;)

Dip > Swap... so make a call
Idiomatic code uses quotations and dip, but short code uses swap. Look, you can have an extra swap per two dips.
[ dip ] [ dip ] [ dip ] [ dip ] [ dip ]
swap swap swap swap swap swap swap swap

However, sometimes trading swap for dip makes the code longer in other places, so it's a bit of a reFactoring job.

"reFactoring job" hahahahahahahahaha why is this funny

@QPaysTaxes I spend too much time laughing at that sort of thing, don't worry :P

find all the higher-order functions and use them, often
Factor is full of higher-order functions that take [ quotations ]  or other-words and work on sequences / other data.
For example, to take an IP address as a string and sum its fields, you could do:
"." split [ 10 >base ] [ + ] map-reduce 10 base>
"." split [ 10 >base ] map 0 + reduce 10 base>
"." split [ 10 >base ] map sum 10 base>

Notice that fancy map-reduce is actually longest here because of [ quotation ] syntax, but there's already a sum word for that anyways, which is far shorter.
Here's a place map-reduce is shorter:
[ "." split [ 10 base> ] [ [ 256 * ] dip + ] map-reduce ] bi@ - abs 1 + ]
[ "." split [ 10 base> ] map 0 [ [ 256 * ] dip + ] reduce ] bi@ - abs 1 + ]

Can't use sum there.

The following are equivalent
[ 1 2 3 ] [ 1 + ] map V{ } clone-like
[ 1 2 3 ] [ 1 + ] V{ } map-as

It's just map-as and the other -as words (zip-as, map-as, accumulate-as, etc) are usually shorter than an obj clone-like if you're going to use them anyways.

Perhaps also worth noting that { } map-as is equivalent to f map-as.

The following are equivalent:
1 '[ _ blah ]
1 [ blah ] curry

It's just that the top one is shorter by three bytes.


text:
The Bridge and Torch Problem
The inspiration for this code golf puzzle is the Bridge and Torch problem, in which d people at the start of a bridge must all cross it in the least amount of time.
The catch is that at most two people can cross at once, otherwise the bridge will crush under their weight, and the group only has access to one torch, which must be carried to cross the bridge.
Each person in the whole puzzle has a specified time that they take to walk across the bridge. If two people cross together, the pair goes as slow as the slowest person.
There is no set number of people that must cross the bridge; your solution MUST work for any value of d.
You needn't use standard input for this problem, but for the sake of explaining the problem, I will be using the following input and output format for the explanation. The first number, d, is the number of people at the start of the bridge. Then, the code will scan for d numbers, each representing the speed of a person.
The code output will be the LEAST amount of time required to cross everyone from the start of the bridge to the end of the bridge, while meeting the criteria explained earlier.
Here are some input cases and output cases and the explanation for the first input case. It is up to you to derive an algorithm from this information to solve the problem in the fewest bytes of code possible.
input
4
1 2 5 8

output
15

To reach this output, the people must cross in the following way.
A and B cross forward (2 minutes)
A returns (1 minute)
C and D cross forward (8 minutes)
B returns (2 minutes)
A and B cross forward (2 minutes)

Here's another test case to guide you along your way.
input
5
3 1 6 8 12

output
29

Rules:

Assume that the input will not be sorted, and you must do so on your own (if you need to)
The number of people in the puzzle is not fixed at 4 (N >= 1)
Every group and individual crossing must have a torch. There is only one torch.
Each group must consist of a maximum of only 2 people!
No, you may not jump off the bridge and swim to the other side. No other tricks like this ;).

As found by xnor below, be sure to test cases like 1 3 4 5, which should return 14 not 15.

1 4 5 6 7 has a similar problem. 25 vs. 26

This seems like an odd question, but what are the minimum and maximum number of people in the puzzle? While working on my solutions, I noticed that they only handle N >= 2 people (meaning, oddly enough that it's extra work to handle the trivial case of "1 person needs to cross"), so some clarification on this point would be great. Thanks in advance.

@Sherlock9 Assume your solution must work for N >= 1

The test cases show that we can use the length as a parameter, but can you make that more clear in the rules? Is the input allowed to be the array of times and the number of people, or are just the times allowed?

Python 3, 100 99 bytes
a recursive solution
f=lambda s:s[0]+s[-1]+min(2*s[1],s[0]+s[-2])+f(s[:-2])if s.sort()or 3<len(s)else sum(s[len(s)==2:])

Thanks to @xnor for this paper
Thanks to @lirtosiast save 2 bytes,  @movatica save 1 bytes and to @gladed pointing at that my previous solution doesn't work
use the following trick to evaluate something in lambda function s.sort() or s  here we compute sort and return the result of the test s.sort()or len(s)>3
Ungolfed
def f(s):
    s.sort()                                   # sort input in place
    if len(s)>3:                               # loop until len(s) < 3
        a = s[0]+s[-1]+min(2*s[1],s[0]+s[-2])  # minimum time according to xnor paper
        return  a + f(s[:-2])                  # recursion on remaining people
    else:
        return sum(s[len(s)==2:])              # add last times when len(s) < 3

Results
>>> f([3, 1, 6, 8, 12])
29
>>> f([1, 2, 5, 8])
15
>>> f([5])
5
>>> f([1])
1
>>> f([1, 3, 4, 5])
14

You can save 1 byte and change len(s)==2 to len(s)<3

@MrPublic you find a bug, I changed the solution it's s[0]*(len(s)==2) not (s[0]*len(s)==2)   with the bug f([1]) -> 0 that why we can't replace by <3 thanks

This paper has an expression for the optimal time that's the min of multiple possibilities. Are you sure your solution is optimal in all cases?

@xnor wow it seems that I have the optimal solution I use the expression in Lemma 3 A5:22

f([1,3,4,5]) returns 15 but 5 (1 & 4 cross, 1 returns) +
6 (1 & 5 cross, 1 returns) + 3 (1 & 3 cross) = 14.

@gladed Fixed !

or len(s)>3 else can be or 3<len(s)else to get rid of a space and save a byte

@movatica update with you suggestion

Python 2, 119 114 112 119 110 100 95 bytes
I have been advised to separate my answers out.
A solution using Theorem 1, A2:09 of this paper xnor linked. To quote the paper (changing it to zero-indexing): The difference between C_{k-1} and C_k is 2*t_1 - t_0 - t_{N-2k}.
lambda n,t:t.sort()or(n-3)*t[0]*(n>1)+sum(t)+sum(min(0,2*t[1]-t[0]-t[~k*2])for k in range(n/2))

Ungolfing:
def b(n, t): # using length as an argument
    t.sort()
    z = sum(t) + (n-3) * t[0] * (n>1) # just sum(t) == t[0] if len(t) == 1
    for k in range(n/2):
        z += min(0, 2*t[1] - t[0] - t[-(k+1)*2]) # ~k == -(k+1)
    return z

are you sure we can assume that length can be an argument ?

@Erwan The example test cases seem to allow it. I'll ask

APL (Dyalog Extended), 39 bytes
{2≥≢⍵:⊃⍵⋄(⊃∘⌽+⊃+(∇1↓⊢)⌊(∇2↓⊢)+2×2⊃⌽)⍵}∨

Try it online!
A tacit function which includes a recursive dfn.
How it works: the idea
My solution is based on subproblem analysis. Given the crossing times \$ t_1, t_2, \cdots, t_n \$ sorted in ascending order, there are two possibly optimal ways to help the worst person cross the bridge:

\$ (t_1, t_n) \rightarrow t_1 \$: net effect is \$ t_n \$ crossing, and the cost is \$ t_n + t_1 \$.
\$ (t_1, t_2) \rightarrow t_2 \rightarrow (t_{n-1}, t_n) \rightarrow t_1 \$: net effect is \$ t_{n-1} \$ and \$ t_n \$ crossing, and the cost is \$ t_1 + 2t_2 + t_n \$.

Let's say \$ T_k \$ be the optimal time to cross the first \$k\$ people. Then, for the first \$k\$ people crossing, we can choose between "use (1) and let \$ k-1 \$ remaining people cross" and "use (2) and let \$ k-2 \$ remaining people cross", which becomes
$$
\begin{aligned}
T_k &= \min(T_{k-1} + t_n + t_1, T_{k-2} + t_1 + 2t_2 + t_n) \\
&= t_1 + t_n + \min(T_{k-1}, T_{k-2} + 2t_2)
\end{aligned}
$$
How it works: the code
{2≥≢⍵:⊃⍵⋄(⊃∘⌽+⊃+(∇1↓⊢)⌊(∇2↓⊢)+2×2⊃⌽)⍵}∨
                                      ∨  ⍝ Descending sort to get [t_n .. t_1]
{                                    }   ⍝ Pass on to recursive function

 2≥≢⍵:⊃⍵  ⍝ Base case: If input length ≤ 2, return the first element
          ⍝   [t_1] → t_1, [t_2 t_1] → t_2

 (⊃∘⌽+⊃+(∇1↓⊢)⌊(∇2↓⊢)+2×2⊃⌽)⍵  ⍝ Recursive case
        ( 1↓⊢)                 ⍝ Choice 1: Drop 1 to get [t_{n-1} .. t_1]
         ∇                     ⍝           Recursive call to get T_{n-1}
               (∇2↓⊢)          ⍝ Choice 2: Drop 2 and recurse to get T_{n-2}
                     +2×2⊃⌽    ⍝           and add 2×t_2
              ⌊                ⍝ Minimum of two choices
  ⊃∘⌽+⊃+                       ⍝ Add common terms t_1 and t_n

Using DP to solve the recursive problem costs a few more bytes:
APL (Dyalog Extended), 44 bytes
⊃⊃(+∘(⊃∘⌽+⊃⌊2∘⊃+2×2⊃⌽),⊢)/(¯2∘↓,∘⊂0~⍨¯2∘↑)∨⎕

Try it online!
A full program.
How it works: the code
∨⎕  ⍝ Descending sort the given array

(¯2∘↓,∘⊂0~⍨¯2∘↑)  ⍝ Set up the initial element for reduce
                  ⍝ e.g. [12 8 6 3 1] → [12 8 6 (3 1)]
           ¯2∘↑   ⍝ Take the last two elements
                  ⍝   If input length is 1, ↑ becomes "overtake" and yields [0 n]
        0~⍨       ⍝ Remove zeros to undo "overtake"
       ⊂          ⍝ Enclose to make it the initial item
 ¯2∘↓,∘           ⍝ Append to the original array with last two elements dropped

(+∘(⊃∘⌽+⊃⌊2∘⊃+2×2⊃⌽),⊢)/  ⍝ Reduce by the logic, right to left
          2∘⊃+2×2⊃⌽       ⍝ Choice (2):
          2∘⊃+            ⍝   T_{k-2} +
              2×2⊃⌽       ⍝   2*t_2
        ⊃                 ⍝ Choice (1): T_{k-1}
   (⊃∘⌽+           )      ⍝ Common term: + t_1
 +∘                       ⍝              + t_n
                    ,⊢    ⍝ Prepend the resuting value T_k to the DP array
(                     )/  ⍝ Reduce by the function above

⊃⊃  ⍝ Remove the layering and take the first element (which is T_n)

Nice answer.  "there are two possibly optimal ways to help the worst person cross the bridge:".  How do we know those are only two possibilities?

@Jonah It is just an observation, not a mathematically rigorous argument, but it coincides with the result on the paper linked by xnor.

Ruby, 94 133 97 96 101 96 99 bytes
I have been advised to separate my answers out.
This is a solution based on the algorithm described in A6:06-10 of this paper on the Bridge and Torch Problem.
Edit: Fixing a bug where a=s[0] is not yet defined when a is called at the end if s.size <= 3.
->s{r=0;(a,b,*c,d,e=s;r+=a+e+[b*2,a+d].min;*s,y,z=s)while s.sort![3];r+s.reduce(:+)-~s.size%2*s[0]}

Ungolfing:
def g(s)
  r = 0
  while s.sort![3]      # while s.size > 3
    a, b, *c, d, e = s  # lots of array unpacking here
    r += a + e + [b*2, a+d].min
    *s, y, z = s        # same as s=s[:-2] in Python, but using array unpacking
  end
  # returns the correct result if s.size is in [1,2,3]
  return r + s.reduce(:+) - (s.size+1)%2 * s[0]
end

Python 2, 89 bytes
lambda t:t.sort()or reduce(lambda x,c:x+[min(x[-2]+x[1]*2,x[-1])+c+x[0]],t[2:],t[:2])[-1]

Try it online!
Uses the same formulation as my APL answer, except that direct reduction turns out shorter in this case. Incidentally, this wins against all the previous entries (except APL).

Scala, 113 135 (darnit)
def f(a:Seq[Int]):Int={val(s,b)=a.size->a.sorted;if(s<4)a.sum-(s+1)%2*b(0)else b(0)+Math.min(2*b(1),b(0)+b(s-2))+b(s-1)+f(b.take(s-2))}

Ungolfed somewhat:
def f(a:Seq[Int]):Int = {
    val(s,b)=a.size->a.sorted      // Sort and size
    if (s<4) a.sum-(s+1)%2*b(0)    // Send the rest for cases 1-3
    else Math.min(b(0)+2*b(1)+b(s-1),2*b(0)+b(s-2)+b(s-1)) + // Yeah.
        f(b.take(s-2))             // Repeat w/o 2 worst
}

Tester:
val tests = Seq(Seq(9)->9, Seq(1,2,5,8)->15, Seq(1,3,4,5)->14, Seq(3,1,6,8,12)->29, Seq(1,5,1,1)->9, Seq(1,2,3,4,5,6)->22, Seq(1,2,3)->6, Seq(1,2,3,4,5,6,7)->28)
println("Failures: " + tests.filterNot(t=>f(t._1)==t._2).map(t=>t._1.toString + " returns " + f(t._1) + " not " + t._2).mkString(", "))

Not great in general, but maybe not bad for a strongly-typed language.
And begrudging thanks to xnor for spotting a case I didn't catch.

This paper has an expression for the optimal time that's the min of multiple possibilities. Are you sure your solution is optimal in all cases?

Ruby, 104 95 93 bytes
I have been advised to separate my answers out.
This is a solution based on my Python 2 solution and Theorem 1, A2:09 of this paper on the Bridge and Torch Problem.
->n,t{z=t.sort!.reduce(:+)+t[0]*(n>1?n-3:0);(n/2).times{|k|z+=[0,2*t[1]-t[0]-t[~k*2]].min};z}

Ungolfing:
def b(n, t) # using length as an argument
  z = t.sort!.reduce(:+) + t[0] * (n>1 ? n-3 : 0)
  (n/2).times do each |k|
    a = t[1]*2 - t[0] - t[-(k+1)*2] # ~k == -(k+1)
    z += [0, a].min
  end
  return z
end

Pyth, 34 bytes
W>l=SQ3=+Zs[hQ.)QhS[y@Q1+hQ.)Q;+Zs

There's probably some way to write it as a reduce or some other functional magic, but I've spent enough time doing high school programming coursework today that actually writing anything resembling good code is a nice change of pace.
Try it online!


text:
Repdigit Base Finding
A repdigit is a natural number that can be written solely by repeating the same digit. For example, 777 is a repdigit, since it's solely composed of the digit 7 repeated three times.
This isn't limited to simply decimal (base 10) numbers, however:

Every Mersenne number (of the form Mn = 2n-1) is a repdigit when written in binary (base 2).
Every number is trivially a repdigit when written in unary (base 1).
Every number n can also trivially be written as the repdigit 11 in base n-1 (for example, 17 when written in hexadecimal (base 16) is 11, and 3 when written in binary (base 2) is also 11).

The challenge here is to find other bases where the input number may be a repdigit.
Input
A positive integer x > 3, in any convenient format.
Output
A positive integer b with (x-1) > b > 1 where the representation of x in base b is a repdigit.

If no such b exists, output 0 or some falsey value.
If multiple such b exist, you can output any or all of them.

Rules

The (x-1) > b > 1 restriction is to prevent the trivial conversions to unary or the "subtract one" base. The output number can be written in unary or any convenient base, but the base itself must not be one of the trivial conversions.
Input/output can be via any suitable method.
Standard loophole restrictions apply.

Examples
In --> Out
11 --> 0            (or other falsey value)
23 --> 0            (or other falsey value)
55 --> 10           (since 55 is 55 in base 10)
90 --> 14           (since 90 is 66 in base 14 ... 17, 29, 44 also allowed)
91 --> 9            (since 91 is 111 in base 9 ... 12 also allowed)

Can we assume b ≤ 36 (many languages' built-in base conversion functions don't go higher)?

@Doorknob Assuming b ≤ 36 severely limits the scope of this problem, and all of the existing answers correctly handle larger bases, so I'm going to say no, you cannot assume an upper bound on b beyond what's given.

Most numbers are repdigits in some base. For instance, 91 = 13 * 7 so it's 77 in base 12.

@Neil ... It's almost like you're on to something, there ...

Jelly, 11 9 bytes
bRI¬P€TḊṖ

Returns a list of bases, which is empty (falsy) if there is none. Try it online!
How it works
bRI¬P€TḊṖ  Main link. Argument: x (number)

 R         Range; yield [1, ..., x].
b          Base; convert x to base n, for each n in the range.
  I        Compute the increment (differences of successive values) of each array
           of base-n digits. This yields only 0's for a repdigit.
   ¬       Apply logical NOT to each increment.
    P€     Compute the product of all lists of increments.
      T    Get the indices of all truthy products.
       Ḋ   Discard the first index (1).
        Ṗ  Discard the last index (x - 1).

Pyth, 11 10
fqjQT)r2tQ

Apparently Pyth's unary q checks for a list that has all unique values as of about 10 days ago. Apparently investigating Pyth bugs improves golf scores.
Filters the list [2..input-1) on if the unique set of digits of the input in that base is length 1.
Test Suite
Explanation:
r2tQ     ##  generate the python range from 2 to the input (Q) - 1
         ##  python range meaning inclusive lower and exclusive upper bounds
f        ##  filter that list with lambda T:
  jQT    ##  convert the input to base T
 q    )  ##  true if the resulting list digits has all equal elements

Ruby, 87 69 63 bytes
->x{(2..x-2).find{|b|y=x;a=y%b;a=0if a!=y%b while(y/=b)>0;a>0}}

I had to implement base conversion by hand, since Ruby's builtins only go up to base 36...
Returns nil for not found.
->x{      # anonymous lambda that takes one argument
(2..x-2)  # range of the possible bases to search over
.find{    # return the first element that satisfies the block, or nil if none
|b|       # b represents the base currently being tested
y=x;      # a temporary value to avoid mutating the original value of x
a=y%b;    # the first (well, last) digit in base b, which will be compared to

                   y/=b      # divide the number by the base
   if a!=y%b                 # if this digit does not match (is different)...
a=0                          # set a to a value representing "failure"
             while(    )>0;  # keep doing this until we get zero (no digits left)

a>0       # return whether a has maintained its original value (no digit change)
}}        # find then returns the first element for which this is true (or nil)

Python, 71 72 78 bytes
lambda x:{b for b in range(2,x-1)for d in range(x)if x*~-b==x%b*~-b**d}

No recursion, just tries all bases and outputs a set of those that work.
It's tempting to encode b and d in a single number, but it takes too many parenthesized expressions to extract them. 77 bytes:
lambda x:{k/x for k in range(2*x,x*x-x))if x*~-(k/x)==x%(k/x)*~-(k/x)**(k%x)}

72 bytes:
f=lambda x,b=2:b*any(x*~-b==x%b*~-b**d for d in range(x))or f(x,b+1)%~-x

Outputs the first b that works, or 0 if none do.
A rep-unit x of d digits of c in base b has value x==c*(b**d-1)/(b-1). Equivalently, x*(b-1)==c*(b**d-1).
The value c must be x%b, the last digit. I don't see a way though to determine d arithmetically, so the code tries all possibilities to see if any of them work.
Saved 5 bytes by copying Dennis's trick of giving a falsey output when b reaches x-1 by taking the output modulo x-1. Another byte saved from Dennis reminding me that exponentiation inexplicably has higher precedence that ~.
An equal-length solution with in instead of any.
f=lambda x,b=2:b*(x*~-b in[x%b*~-b**d for d in range(x)])or f(x,b+1)%~-x

Ruby, 50 bytes
->n{(2..n-2).find{|b,i=n|i%b==(i/=b)%b ?redo:i<1}}

I would really like to remove that annoying space but as a newcomer to ruby, I'm still quite unfamiliar with its syntactic quirks.

The offending quirk in this case is that b? would be a valid method name, so you can’t get rid of the space.

Python 2, 79 bytes
f=lambda x,b=2:~-b*x in[i%b*~-b**(i/b)for i in range(b*x)]and b or f(x,-~b)%~-x

Try it on Ideone.
Idea
Any repdigit x of base b > 1 and digit d < b satisfies the following.

Since d < b, the map (b, d) ↦ cb + d is injective.
Also, since b, x > 1, we have c < x, so cb + d < cb + b = (c + 1)b ≤ xb.
This means that, to find suitable values for c and d for a given base b, we can iterate through all i in [0, …, bx) and check whether (b - 1)x == (i % b)(bi / b - 1).
Code
The named lambda f test whether (b - 1)x is in the set {(i % b)(bi / b - 1) | 0 ≤ i < bx}, beginning with the value b = 2.

If the test was successful, we return b.
Else, we call f again, with the same x and b incremented by 1.

Since b may eventually reach x - 1, we take the final result modulo x - 1 to return 0 in this case. Note that this will not happen if b = 2 satisfies the condition, since it is returned without recursing. However, the question guarantees that b = 2 < x - 1 in this case.

Emojicode, 214 bytes
(77 characters):
➡bi 2n 0◀i➖b 1vb i▶vv 0 1vn iin 90

Prints results in base 9.
I've been meaning to do a code golf with emojicode for a couple weeks now, but the language has only recently become stable enough to actually work with . As a bonus, this question makes use of the one piece of functionality emojicode is actually really good at: representing integers in other bases.
Ungolfed ( is a line comment in emojicode)
          define main class ""
  ➡   define main method

     read an integer from stdin, store it in frozen variable "b"
     b

     i 2   i = 2
     n 0   n = 0

    ◀i➖b 1      while i < b - 1
       v b i   v = the string representation of b in base i

       Split v on every instance of the first character of v.
       If the length of that list is greater than the actual length of v,
       n = i
      ▶vv 0 1v
         n i

       i   increment i

      n 9   represent n in base 9 instead of 10, to save a byte
     0           return error code 0

Dyalog APL, 28 bytes
 {b/⍨⍵{1=≢∪⍵⊥⍣¯1⊢⍺}¨b←1+⍳⍵-3}

{…⍵…} anonymous function to be applied to x (represented by ⍵)
b←1+⍳⍵-3 integers from 2 – ⍵-2 stored as b
⍵{…}¨ for each element in b (⍵), apply the function {…} with x as left argument ⍺
⍵⊥⍣¯1⊢⍺ convert x to that base
1=≢∪ is 1 equal to the tally of unique digit?
b/⍨ elements of b where true (that there is only one unique digit).
Example cases
If no base exists, the output is empty (which is falsey), as can be demonstrated by this program:
 WhatIsEmpty
 →''/TRUE ⍝ goto (→) TRUE: if (/) emptystring ('')
 'False'
 →END
TRUE:
 'True'
END:

This prints 'False'

Perl 6, 45 43 42 bytes
{grep 2..$^x-2: {[==] $x.polymod($_ xx*)}}

Explained (sort of)
For reference, a variable $^x in { ... } is the same as doing -> $x { ... }
{grep 2..$^x-2: {[==] $x.polymod($_ xx*)}}
{                                          # Anonymous function taking $x
 grep                                      # Return the all values in
      2..$^x-2: {                          # Range from 2 to $x - 2 satisfying:
                 [==]                      #     Reduce with ==:
                      $x.polymod(          #         (See below for polymod)
                                 $_ xx*    #         An infinite list containing
                                           #         the current value
                                       )}}

Polymod (TL;DR): $n.polymod($b xx *) gives you a reversed list of digits/'digits' for $n in base $b
Polymod (For real): The polymod method is almost like a more powerful version of python's divmod function. $n.polymod(*@args) divides $n by each value in *@args, adding the remainder ($n mod $x) to the list it returns, and using the quotient for the next division. I feel I explained it poorly so here's some examples (written in perl 6, but clean enough to be understood by most I hope):
12.polymod(7)    # returns (5, 1)
# Roughly equivalent to:
(12 mod 7, 12 div 7)

86400.polymod(60,60,24) # returns (0, 0, 0, 1)
# Roughly equivalent to (this will give you an array rather than a list):
my $n = 86400;
my @remainders; # Here lies the end result
for (60, 60, 24) -> $divisor {
    @remainders.push( $n mod $divisor );
    $n div= $divisor;
}
@remainders.push($n)

# This is essentially the base conversion algorithm everyone
# knows and loves rolled into a method.
# Given an infinite list of divisors, polymod keeps going until
# the remainder given is 0.
0xDEADBEEF.polymod(16 xx *) # returns (15 14 14 11 13 10 14 13)
# Roughly equivalent to (but gives an array rather than a list):
my $n = 0xDEADBEEF;
my @remainders; # Here lies the end result
while $n > 0 {
    @remainders.push( $n mod 16 );
    $n div= 16;
}

Actually since you are allowed to output "any or all" of the valid values, you can use the grep method instead of the first method.

Oh good catch, I missed that

MATL, 15 14 bytes
3-:Q"G@:YAd~?@

This works with current version (14.0.0) of the language/compiler.
If no base exists, the output is empty (which is falsey).
Try it online!
3-:Q    % take input x implicitly. Generate range of possible bases: [2,3,...,x-2]
"       % for each base b
  G     %   push input again
  @:    %   generate vector of (1-based) digits in base b: [1,2,...,b]
  YA    %   convert to that base
  d~    %   differences between consecutive digits; negate
  ?     %   if all values are true (that is, if all digits were equal)
    @   %     push that base
        %   end if implicitly
        % end for each implicitly
        % display implicitly

Pyth, 26 19 bytes
hMfql{eT1m,djQdr2tQ

Try it here!
Will add an explanation after I golfed this. Look at this answer for a shorter implementation and explanation.

Thanks for reminding me that I forgot the additional bases for 90 and 91 in my examples!

Mathematica, 55 bytes
Cases[4~Range~#-2,a_/;Equal@@#~IntegerDigits~a]/.{}->0&

Anonymous function, not too complicated. Just filters out bases based on repdigit-ness.

Python 2, 75 bytes
n=input()
b=1
while b<n-2:
 i=n;b+=1
 while i%b==i/b%b:i/=b
 if i<b:print b

A port of my ruby answer. Prints all valid bases if any exists.

Julia, 45 bytes
n->filter(b->endof(∪(digits(n,b)))<2,2:n-2)

This is an anonymous function that accepts an integer and returns an integer array. To call it, assign it to a variable. It will return all applicable bases or an empty array. There are no issues with large bases.
First we generate the inclusive range [2, n - 2], where n is the input. We then filter the list to only integers b for which n in base b has fewer than 2 unique digits. To do this, for each integer b in the range, we get the digits of n in base b as an array using digits, get unique items using ∪, and get the index of the last element (i.e. the length) using endof.

Brachylog, 12 bytes
>>.ℕ₂≜&ḃ↙.=∧

Try it online! (as a generator!)
Takes input through the input variable and outputs a base through the output variable in the case that this is possible, failing otherwise. At the same time, it also works as a generator which outputs a list of all bases, where that list can be empty.
Ideally this could look something like ḃ↙.=&>>, possibly sacrificing generator functionality in that form or a similar one (since it would eventually hit unary), but as of now 12 bytes is the shortest I know how to get it.
     ≜          Assign an integer value to
  .             the output variable
   ℕ₂           which is greater than or equal to 2
 >              and less than a number
>               which is less than the input.
      &         The input
       ḃ↙.      in base-(the output)
          =     is a repdigit.
           ∧    (which is not necessarily the output)

Ruby, 46 43 bytes
Uses the Integer#digits function introduced in Ruby 2.4 to avoid needing to manually divide.
-3 bytes thanks to @Jordan.
->n{(2..n-2).find{|i|!n.digits(i).uniq[1]}}

Try it online!

@Jordan ah yes I keep forgetting that trick haha

05AB1E, 7 bytes
ÍL¦ʒвÙg

Outputs all possible values, or an empty list as falsey value (although technically valid outputs are falsey as well, since only 1 is truthy in 05AB1E, and everything else is falsey).
Try it online or verify all test cases.
Explanation:
Í        # Decrease the (implicit) input-integer by 2
 L       # Create a list in the range [1, input-2]
  ¦      # Remove the first value to make the range [2, input-2]
   ʒ     # Filter this list by:
    в    #  Convert the (implicit) input to the base of the number we're filtering
     Ù   #  Uniquify it, leaving only distinct digits
      g  #  Get the length of this, which is truthy (1) if all digits were the same
         # (and then output the filtered list implicitly as result)

Perl 5 -Minteger -na, 63 bytes
map{$r=$,=($c="@F")%$_;$r*=$c%$_==$,while$c/=$_;$r&&say}2..$_-2

Try it online!
Outputs all possible answers or nothing if no solution exists.

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Build a simple room in ASCII-art
A room can be made up of connected rectangles, for instance an L-shaped room. Such a room can be described by a list of dimensions describing the size of each rectangle.
Assume you have two input lists. The first contains the width of rectangles stacked vertically over each other. The second contains the height of the rectangles.
As an example, the input [4 6][3 2] will be a 4-by-3 rectangle on top of a 6-by-2 rectangle. The figure below shows this shape. Note that the walls are considered "thin", thus it's the spaces between the wall that's determined by the input.
[4 6][3 2]
 ____
|    |
|    |
|    |_
|      |
|______|

The challenge is: Take a list of dimensions as input, and output the shape of the room as ASCII-art. The format must be as in the sample figures:

All horizontal walls are shown using underscores
All vertical walls are shown using bars
There shall be no walls where the rectangles are connected
The left wall is straight
For more details, have a look at the test cases

Assumptions you can make:

All dimensions are in the range [1 ... 20]

All horizonal dimensions are even numbers

The number of rectangles will be in the range [1 ... 10]
Only valid input is given
Optional input format (you can decide the order of the input dimensions, please specify in the answer).

Test cases:
[2][1]
 __
|__|

---

[4][2]
 ____
|    |
|____|

---

[2 6 2 4][2 2 1 3]
 __
|  |
|  |___
|      |
|   ___|
|  |_
|    |
|    |
|____|

---

[2 14 6 8 4 18 2 10 4 2][1 2 3 1 2 1 1 1 2 1]
 __
|  |___________
|              |
|       _______|
|      |
|      |
|      |_
|     ___|
|    |
|    |_____________
|   _______________|
|  |______
|     ____|
|    |
|   _|
|__|

You can decide the order of the input dimensions, does that mean we can swap rows and columns, and reverse them? Like this: your example input format: [2 14 6 8 4 18 2 10 4 2][1 2 3 1 2 1 1 1 2 1] -> (swap and reverse) -> my input format: [1 2 1 1 1 2 1 3 2 1][2 4 10 2 18 4 8 6 14 2]

Yes, that's ok.:-)

Thanks. Turned out I probably don't need to reverse them, just swap.

Retina, 169 150 113 bytes
Byte count assumes ISO 8859-1 encoding.
\d+
$*
{+r`1(1*¶[^|]*(1+))
$1¶|$2|
}` (¶.*) 1+
$1
1
_
(\|_+)\|(?=¶\1_(_+))
$1|$2
T`w` `(\|_+)_?(?=_*\|.*¶\1)
^¶

The code contains a trailing space on a trailing newline.
Input format:

Height (separated by spaces)
Width (also separated by spaces)
For example:
1 2 3 1 2 1 1 1 2 1
2 14 6 8 4 18 2 10 4 2
Try it online!

Python 3, 230 223 222 217 bytes
def f(a):b=a[0]+[0];m=' _';print('\n'.join([' '+'_'*b[0]+' ']+['|'+' '*min(b[l],b[l+1])+m[b[l+1]<1]*(b[l]>b[l+1])+m[k]*(b[l]-b[l+1]-1)+'|'+m[k]*(b[l+1]-b[l]-1)for l,i in enumerate(zip(*a))for k in[0]*(i[1]-1)+[1]]))

Thanks to @StewieGriffin  @KevinLau for their help
Results
>>> f([[2, 14, 6, 8, 4, 18, 2, 10, 4, 2],[1, 2, 3, 1, 2, 1, 1, 1, 2, 1]])
 __
|  |___________
|              |
|       _______|
|      |
|      |
|      |_
|     ___|
|    |
|    |_____________
|   _______________|
|  |_______
|     _____|
|    |
|   _|
|__|

Semicolons! They separate your assignments and save you from unwanted indentation! (a=1;b=2)

"solutoin" > solution

String indexing! m=' _' instead of m=[' ','_'] saves like 5 bytes.

JavaScript (ES6) 174
The only critical part is the horizontal row joining 2 parts of different widths, with the vertical bar on right side that can be in the middle or at the right end.
(p,h,q=-1,R=(n,s=' ')=>s.repeat(n))=>[...p,0].map((x,i)=>(x>q?p=x:(p=q,q=x),(~q?`
|`+R(q+(x<p)-!x)+R(x>q,'|'):' ')+R(p+~q+!x,'_')+R(x<p,'|')+R(h[i]-1,`
|${R(q=x)}|`))).join``

TEST

f=(p,h,q=-1,R=(n,s=' ')=>s.repeat(n))=>[...p,0].map((x,i)=>(x>q?p=x:(p=q,q=x),(~q?`
|`+R(q+(x<p)-!x)+R(x>q,'|'):' ')+R(p+~q+!x,'_')+R(x<p,'|')+R(h[i]-1,`
|${R(q=x)}|`))).join``

// Less golfed

F=(p,h, q=-1,
   R=(n,s=' ')=>s.repeat(n)
  )=>
  [...p, 0].map((x,i)=> (
    x>q? p=x : (p=q,q=x),
    (q>=0?`\n|`+R(q+(x
q,'|'):' ')
    + R(p+~q+!x,'_') + R(x<p,'|')
    + R(h[i]-1,`\n|${R(q=x)}|`)
  )).join``

console.log=x=>O.textContent+=x+'\n'

;[
  [[2],[1]],
  [[4],[2]],
  [[2, 6, 2, 4],[2, 2, 1, 3]],
  [[2, 14, 6, 8, 4, 18, 2, 10, 4, 2],[1, 2, 3, 1, 2, 1, 1, 1, 2, 1]]
].forEach(t=>{
  var w=t[0],h=t[1]
  console.log('['+w+'] ['+h+']\n'+f(w,h)+'\n')
})

Ruby 191
First time golfing, also it's my first day with Ruby, so it's probably not the most elegant thing in the world, but it'll do?
def f(x)
a=x[0]+[0]
puts" #{'_'*a[0]} "
for i in 0..x[1].length-1
n,m=a[i,2].sort
puts"|#{' '*a[i]}|\n"*(x[1][i]-1)+'|'+' '*n+(a[i+1]<1?'_':m>a[i]?'|':' ')+'_'*(m-n-1)+(n<a[i]?'|':'')
end
end


text:
On the edges of the hypercube
Your job will be to write a function or a program, that will take an integer n>0 as input and output a list of the edges of the n-dimensional hypercube. In graph theory an edge is defined as a 2-tuple of vertices (or corners, if you prefer), that are connected.
Example 1
A 1-dimensional hypercube is a line and features two vertices, which we will call a and b.

Therefore, the output will be:
[[a, b]]

Example 2
The 4-dimensional hypercube (or tesseract) consists of 32 edges and its graph looks like this

and the output could look like this
[[a, b], [a, c], [a, e], [a, i], [b, d], [b, f], [b, j], [c, d], [c, g], [c, k], [d, h], [d, l], [e, f], [e, g], [e, m], [f, h], [f, n], [g, h], [g, o], [h, p], [i, j], [i, k], [i, m], [j, l], [j, n], [k, l], [k, o], [l, p], [m, n], [m, o], [n, p], [o, p]]

Rules

You may name the vertices any way you like, as long as the name is unique.
The edges are undirected, i.e. [a, b] and [b, a] are considered the same edge.
Your output must not contain duplicate edges.
The output may be in any sensible format.
Standard loopholes are forbidden.

Scoring
Shortest code wins.

Related. Related.

So [1,2], [2,3] etc. is okay?

@EasterlyIrk Yep.

Edges can be output in any order, right?

@DonMuesli Right.

Jelly, 13 bytes
ạ/S’
2ṗœc2ÇÐḟ

Try it here. For input 3, the output is:
[[[1, 1, 1], [1, 1, 2]],
 [[1, 1, 1], [1, 2, 1]],
 [[1, 1, 1], [2, 1, 1]],
 [[1, 1, 2], [1, 2, 2]],
 [[1, 1, 2], [2, 1, 2]],
 [[1, 2, 1], [1, 2, 2]],
 [[1, 2, 1], [2, 2, 1]],
 [[1, 2, 2], [2, 2, 2]],
 [[2, 1, 1], [2, 1, 2]],
 [[2, 1, 1], [2, 2, 1]],
 [[2, 1, 2], [2, 2, 2]],
 [[2, 2, 1], [2, 2, 2]]]

I hope [1, 1, 1] etc. is an okay “name”.
Explanation
The first line is a “predicate” on a pair of edges: [A, B] ạ/S’ is equal to sum(abs(A - B)) - 1, which is zero (false-y) iff A and B differ in exactly one coordinate.
The second line is the main program:

Generate all edges with 2ṗ (Cartesian power of [1, 2]).
Get all possible pairs using œc2 (combinations of size two without replacement).
Keep only elements satisfying the predicate defined earlier (ÐḟÇ).

ạ/S’ and 2ṗœc2ÇÐḟ save a couple of bytes.

c/P=2, 2ṗṗ2ÇÐf works too.

Smart "naming" scheme! Certainly within the rules.

Python 2, 54 56 62 bytes
lambda n:{tuple({k/n,k/n^1<<k%n})for k in range(n<<n)}

Duplicate edges are removed by making a set of sets, except Python requires that set elements are hashable, so they are converted to a tuples. Note that the sets {a,b} and {b,a} are equal and convert to the same tuple. xsot saved 2 bytes with n<<n.
This can be cut down to 49 bytes if strings of sets are an OK output format
lambda n:{`{k/n,k/n^1<<k%n}`for k in range(n<<n)}

which gives output like
set(['set([1, 3])', 'set([2, 3])', 'set([0, 2])', 'set([0, 1])'])

lambda n:[(k/n,k/n^1<<k%n)for k in range(n*2**n)if k/n&1<<k%n]

First, let's look at an older version of the solution.
lambda n:[(i,i^2**j)for i in range(2**n)for j in range(n)if i&2**j]

Each a number in the interval [0,2^n) corresponds to a vertex with coordinates given by its n-bit binary strings. To vertices are adjacent if they differ in a single bit, i.e. if one is obtained from the other by xor-ing a power of 2.
This anonymous function generates all possible edges by taking every vertex and every bit position to flip. To avoid duplicating an edge in both directions, only 1's are flipped to 0's.
In the more golfed solution, k is used to encode both i and j via k=n*i+j, from which (i,j) can be extracted as (k/n,k%n). This saves a loop in the comprehension. The powers of 2 are done as 1<< to have the right operator precedence.
An alternative approach of generating each pair of vertices and checking if they are a bit flip apart seems longer (70 bytes):
lambda n:[(i,x)for i in range(2**n)for x in range(i)if(i^x)&(i^x)-1<1]

n*2**n is just n<<n

Switching to Python 3.5, lambda n:{(*{k//n,k//n^1<<k%n},)for k in range(n<<n)} saves a byte. (The starred expression saves three, but the division syntax loses two.) However, I'm pretty sure the 49-byte solution you have is fine.

Mathematica, 48 24 bytes
EdgeList@*HypercubeGraph

Just an anonymous function that uses built-ins.

Ah, the built-in! As you don't have to name the vertices alphabetically, you can omit the FromLetterNumber. I even think EdgeList@*HypercubeGraph is a valid answer.

JavaScript (SpiderMonkey 30+), 69 64 bytes
n=>[for(i of Array(n<<n).keys())if(i/n&(j=1<<i%n))[i/n^j,i/n^0]]

This started out as a port of @xnor's Python 2 solution but I was able to save 9 bytes by rewriting the code to use a single loop. Edit: Saved a further 5 bytes by splitting i up the other way around, as per @xnor's updated solution, which now also uses a single loop.

MATL, 20 bytes
2i^:qt!Z~Zltk=XR2#fh

This works with current version (14.0.0) of the language/compiler.
Try it online!
Explanation
This uses more or less the same idea as @xnor's answer.
2i^    % take input n and compute 2^n
:q     % range [0,1,...,2^n-1] (row vector)
t!     % duplicate, transpose into a column vector
Z~     % bitwise XOR with broadcast
Zl     % binary logarithm
tk     % duplicate and round down
=      % true if equal, i.e. for powers of 2
XR     % upper triangular part, above diagonal
2#f    % row and index columns of nonzero values
h      % concatenate vertically

Pyth, 13 bytes
fq1.aT.c^U2Q2

Output on input 3:
[[[0, 0, 0], [0, 0, 1]], [[0, 0, 0], [0, 1, 0]], [[0, 0, 0], [1, 0, 0]], [[0, 0, 1], [0, 1, 1]], [[0, 0, 1], [1, 0, 1]], [[0, 1, 0], [0, 1, 1]], [[0, 1, 0], [1, 1, 0]], [[0, 1, 1], [1, 1, 1]], [[1, 0, 0], [1, 0, 1]], [[1, 0, 0], [1, 1, 0]], [[1, 0, 1], [1, 1, 1]], [[1, 1, 0], [1, 1, 1]]]

Explanation:
fq1.aT.c^U2Q2
                  Implicit: input = Q
        ^U2Q      All Q entry lists made from [0, 1].
      .c    2     All 2 element combinations of them.
f                 Filter them on
   .aT            The length of the vector
 q1               Equaling 1.

Python 2: 59 bytes
lambda n:[(a,a|1<<l)for a in range(2**n)for l in range(n)if~a&1<<l]