text:
Three polyglots, two period-two quines, and one code-golf challenge
Produce a program A such that running it in language A produces Program B, and running program A in language B produces program C.
Program B, when run in language B produces Program A, and running program B in language A produces program C.
Program C, when run in language A or language B, prints "Wrong language!".
Program | Language | Result
--------|----------|----------
A       | A        | Program B
B       | B        | Program A
A       | B        | Program C
B       | A        | Program C
C       | A        | "Wrong language!"
C       | B        | "Wrong language!"

Your answer should use this template:

Language A/Language B, {a bytes} + {b bytes} = {total bytes} bytes
Program A:
a code

Program B:
b code

Program C:
c code

Source:
# Language A/Language B,  +  = <total bytes> bytes

Program A:

    a code
Program B:

    b code
Program C:

    c code

None of these programs should take input.
Different versions of the same language do count as different languages. (although this is discouraged because it leads to boring solutions)
Languages A and B must be distinct.
You must not read your own source code from a file. Programs may not be empty
Standard loopholes apply.

Hints

C++ and [Python/Bash/other # commented languages] are good combos because you can define macros that one language can ignore

This is code-golf, so the smallest sum of the byte counts Program A and B wins.

I'm working on this...

@Oliver :D :D :D

Are the programs allowed to exit via crashing? (That is, running an invalid command and thus ending, with errors spewed to STDERR.) Polyglots are typically much easier if this is allowed.

@CrazyPython Don't do penalties or percentages. Simply allow it, or don't. Percentages make scoring no longer [code-golf]. http://meta.codegolf.stackexchange.com/a/8106/34718

@ais523n I removed it, it makes the challenge too easy.

Note: The accept goes to the shortest answer, but the bounty may go to an answer I believe is more creative.

Can program A and program B be the same?

@Oliver Sure, why not?

I'm working on a Python/Retina solution, and it's taking me to hell and back. I've already spent more than 12 hours on it. If I should succeed, I can guarantee it won't be readable by the average PPCG user.

@mbomb007 You have invested a lot of time.

@mbomb007 Bounty has ended; accept is still up for grabs

@CrazyPython There's no way it'd be that short. Program A is at least 1300-1400 bytes right now, and B is longer. I've been working on it off and on, but I take big breaks for sanity now.

@CrazyPython Finished. I started over from scratch yesterday with a different strategy. It ended up being a LOT shorter and easier.

Can Wrong language! be output in any form (i.e. all caps, all lowercase, etc.)?

Befunge-98 (PyFunge)/><>, 123 + 123 = 266 250 246 bytes

Program A:

"81!#.#vp00g>:#,_j+4<.=1l5v!o#!g00
g00<<<<<>0!#[f8+1!#.48*k'Wrong language!<o>[f@,kep.#!0a'00g!#o# \!gff+k,@,k*8ba$$ #o#!a"

Try it in Befunge-98!,
Try it in ><>!

Program B:

"00g!#o!v5l1=.<4+j_,#:>g00pv#.#!18
g00<<<<<>0!#[f8+1!#.48*k'Wrong language!<o>[f@,kep.#!0a'00g!#o# \!gff+k,@,k*8ba$$ #o#!a"

Try it in ><>!,
Try it in Befunge-98!

Program C:

"a0!#.pek,@f[>o<!egaugnal gnorW

Try it in Befunge-98! Try it in ><>!
How it Works:
The second line in both programs is identical and serves the same function for both language. When entered leftwards from the <<<<, it prints the entire second line. When entering to the right of those, print program C.
When the first line is run in the wrong language, it enters through the program C producing section. Otherwise, it prints the top line backwards with the " at the front and enters the second line producing section.
First line

Program A:

"81!#.#vp00g>:#,_j+4<.=1l5v!o#!g00

><>:
" Wrapping string literal over the first line
 81!#.  Jumps the pointer to the Program C producer

Befunge-98:
" Wrapping string literal
 81!#.  Pushes 8,0 (! inverts number, # skips over .)
      #v Skip over the exit
        p00g Pops the excess 8,0 and space and gets the " from 0,0
            >:#,_ Classic print until stack is empty
       v         j+4< Skips back to the exit and goes to the second line

Program B:

"00g!#o!v5l1=.<4+j_,#:>g00pv#.#!18

><>:
" Wrapping string literal
 00g!# Gets the " from 0,0
      o!v5l1=. Print until the stack is empty and jump to the second line

Befunge-98:

" Wrapping string literal
 00g Gets the " from 0,0
    !#o!v Skip the instruction o and go to Program C producer

Second Line:
g00<<<<<>0!#[f8+1!#.48*k'Wrong language!<o>[f@,kep.#!0a'00g!#o# $$00gff+k,@,k*9aa$$ #o#!a"

><>: Second line producer
g00<<<<< Get the " from cell 0,0
        ......      " Wrapping string literal over the stack
               #o#!a  Print newline and the stack and exit
Program C producer:
       >0!#[        Clear stack
            f8+1!#. Jump to cell 22,1
                   .....'...'   Push program C to the stack
                             00g Get " from cell 0,0
                                !#o# Print stack until empty

Befunge-98: Second line producer

g00<<<<< Get the " from cell 0,0
        ......              " Wrapping string literal
                       #o#!a  Skip over instruction o
                     $$       Pop the excess characters
                  90a Push a newline and 90
               @,k      Execute , instruction (print) 90+1 times, printing second line

Program C producer:
        >0!#[ Push 1 and skip [
             f8+1!#. Push 22, 0 and skip .
                    48*k'...' Execute ' instruction 32 times, pushing program C
                         ...'00g!#o# Push 0 and skip the instruction o
                                     \! Convert excess values to two 0s
                                       g Get " from cell 0,0
                                          ff+ Push 30
                                             k, Execute , 30+1 times, printing program C
                                               @ Exit program

Program C
"a0!#.pek,@f[>o<!egaugnal gnorW

><>:
" Wrapping string literal
 a0!#. Jump to cell 10,0
           f[ Create a new stack with only the top 15 elements
             >o< Print stack

Befunge-98:
" Wrapping string literal
 a0!#. Push 10,1
      p Pop 10,1 and excess space
       ek,@ Push 14 and execute , 14+1 times and exit the program

Save 1 byte and you get a 400 bounty lol.

@MagicOctopusUrn I think the OP forgot to say "otherwise Jo King gets it"

@JoKing Not necessarily. If the bounty is not awarded, it is automatically given to the highest-voted answer with half the rep.

@MagicOctopusUrn Okay, there. Happy? :P

4x over-joyed ;P.

JavaScript (ES6) / Python 3, 264 + 258 = 522 bytes
Program A:
a="a=%r;b=%r;c=%r;1//2;print(c);'''\nconsole.log(b,...[a,b,c].map(uneval))//'''";b="a=%s;b=%s;c=%s;1//2;'''\nprint=_=>console.log(c)//'''\nprint(a%(a,b,c))";c="1//2;alert=print\nalert('Wrong language!')";1//2;print(c);'''
console.log(b,...[a,b,c].map(uneval))//'''

Program B:
a="a=%r;b=%r;c=%r;1//2;print(c);'''\nconsole.log(b,...[a,b,c].map(uneval))//'''";b="a=%s;b=%s;c=%s;1//2;'''\nprint=_=>console.log(c)//'''\nprint(a%(a,b,c))";c="1//2;alert=print\nalert('Wrong language!')";1//2;'''
print=_=>console.log(c)//'''
print(a%(a,b,c))

Program C:
1//2;alert=print
alert('Wrong language!')

Probably golfable...
JavaScript explanation
Program A:
// Set a, b, and c to these strings:
a="a=%r;b=%r;c=%r;1//2;print(c);'''\nconsole.log(b,...[a,b,c].map(uneval))//'''";
b="a=%s;b=%s;c=%s;1//2;'''\nprint=_=>console.log(c)//'''\nprint(a%(a,b,c))";
c="1//2;alert=print\nalert('Wrong language!')";

// Ignore this line:
1//2;print(c);'''

// Print the Python program (b), replacing the "%s"s with the raw forms of a, b, and c:
console.log(b,...[a,b,c].map(uneval))//'''

Program B:
// Set a, b, and c to these strings:
a="a=%r;b=%r;c=%r;1//2;print(c);'''\nconsole.log(b,...[a,b,c].map(uneval))//'''";
b="a=%s;b=%s;c=%s;1//2;'''\nprint=_=>console.log(c)//'''\nprint(a%(a,b,c))";
c="1//2;alert=print\nalert('Wrong language!')";

// Ignore this line:
1//2;'''

// Define a function `print` which prints `c` (the "Wrong language!" program):
print=_=>console.log(c)//'''

// Call `print`, ignoring the argument (which is NaN):
print(a%(a,b,c))

Program C:
// Ignore this line:
1//2;alert=print

// Alert "Wrong language!":
alert('Wrong language!')

Python explanation
Program A:
# Set a, b, and c to these strings:
a="a=%r;b=%r;c=%r;1//2;print(c);'''\nconsole.log(b,...[a,b,c].map(uneval))//'''";
b="a=%s;b=%s;c=%s;1//2;'''\nprint=_=>console.log(c)//'''\nprint(a%(a,b,c))";
c="1//2;alert=print\nalert('Wrong language!')";

# Print `c` (the "Wrong language!" program):
1//2;print(c);

# Ignore this part:
'''
console.log(b,...[a,b,c].map(uneval))//'''

Program B:
# Set a, b, and c to these strings:
a="a=%r;b=%r;c=%r;1//2;print(c);'''\nconsole.log(b,...[a,b,c].map(uneval))//'''";
b="a=%s;b=%s;c=%s;1//2;'''\nprint=_=>console.log(c)//'''\nprint(a%(a,b,c))";
c="1//2;alert=print\nalert('Wrong language!')";

# Ignore this part:
1//2;'''
print=_=>console.log(c)//'''

# Print the JS program (a), replacing the "%r"s with the raw forms of a, b, and c:
print(a%(a,b,c))

Program C:
# Set `alert` to the function `print`:
1//2;alert=print

# Call this function on "Wrong language!":
alert('Wrong language!')

Care to add an explanation of how it works?

@CrazyPython Done :-)

Very creative, well done.

Python 3 + JavaScript (Rhino), 171 + 171 = 342 bytes
Program A (outputs program B in Python 3, program C in JavaScript; note trailing newline):
s="'";d='"';r=['print("s="+d+s+d+";d="+s+d+s+";r=["+s+r[1]+s+","+s+r[0]+s+"];eval(r[([11]+[0])[1]])")','print("print("+d+"Wrong language!"+d+")")'];eval(r[([11]+[0])[1]])

Program B (outputs program A in JavaScript, program C in Python; note trailing newline):
s="'";d='"';r=['print("print("+d+"Wrong language!"+d+")")','print("s="+d+s+d+";d="+s+d+s+";r=["+s+r[1]+s+","+s+r[0]+s+"];eval(r[([11]+[0])[1]])")'];eval(r[([11]+[0])[1]])

Program C (outputs "Wrong language!" in either language; also has a trailing newline, which doesn't count in the score):
print("Wrong language!")

Note that I'm using an unusual dialect of JavaScript here. People normally use browser implementations, but those have issues with output, doing it in a weird way (using alert). I'm using the Ubuntu package rhino which is an "offline" JavaScript implementation with a different set of libraries implemented to a typical browser (it's intended as an embeddable scripting language); this is notable in that it provides a print statement in the same style as, for example, Python 3.
This is a "true polyglot" in the sense that both languages are running the same calculations, in the same order, giving them the same meaning. They both have the same AST (and it's fairly trivial to create a Python 3 + JavaScript polyglot quine via reducing this program). There's no code that's specific to one language, which helps me bring the length way down. Incidentally, you have to use Python 3 so that you can use semicolons to separate statements (if you used newlines you'd have to escape the newlines).
The program starts by defining strings s and d which hold a single quote and double quote respectively. This makes it possible to output quotes without having to mention them later in the source code, avoiding issues with escaping (which frequently seem to be a problem with quines; the main reason I answer so many quine problems in Underload is that its strings nest).
The heart of the program is the array r which holds the main body of the two programs used by the challenge; one of the programs (the one that comes first in program A, and second in program B) is an almost-quine that simply outputs the original program via concatenating together pieces (taken mostly from r itself, with a few string literals), and the other prints program C. In order to make the program not a true quine (which would make it impossible to detect that we were running in the wrong language), the elements of r are printed in reverse order; r[0] in program A is r[1] in program B, and vice versa.
Finally, all that's necessary is to evaluate the correct element of r.  This is accomplished using the expression ([11]+[0])[1] that produces a different value in Python 3 and in JavaScript. Both languages parse it identically, but they have different ideas of what addition does to lists:

When Python 3 adds [11] to [0], it gets [11, 0] (concatenating the lists), and then taking the second element of the list ([1]) gives us the integer 0.

When JavaScript adds [11] to [0], it gets "110" (concatenating the string representations of the lists), and then taking the second character of the string ([1]) gives us the string "1", which JavaScript is quite happy to use as an index into a list.

Therefore, Python 3 runs the first element of r in both programs (producing the almost-a-quine when running program A, and printing program C when running program B); JavaScript runs the second element, and thus treats program A and program B the opposite way around.
Incidentally, if you run program A in Ruby, it will print program B except without a trailing newline. If you run program B in Ruby, it will print program C except without a trailing newline. In other words, this solution very nearly works with a different set of languages, swapping Python 3 for Ruby (the only reason I don't just delete the newline from program B to get a score of 341 is that the newline inconsistency in program C would disqualify the submission).
(I was working on a "true polyglot" like this for a different reason, which I've now posted as a challenge, and realised that the techniques could be adapted to this one as well.)

Should be 170 each, not 171...

It's 171, you have to count the newline too. (Normally you never leave on newlines in [tag:code-golf] questions, but in quines, often having a newline at the end makes things easier.)

I added the trailing newlines for you. You have to use
...
 for them to show up.

You can literally use anything to index into a list; JS actually converts whatever it is into a string first. "a"[0], "a"["0"], and "a"[[[[[[[["0"]]]]]]]] all accomplish the same thing.

C/Python, 733 bytes + 733 bytes = 1466 bytes
Program A:
#define int char*
int
a1="#define print(X) main(){printf(d,13,13,34,a1,34,13,13,34,a2,34,13,13,34,b1,34,13,13,34,b2,34,13,13,34,c,34,13,13,34,d,34,13,b1,13,b2);}";
int
a2="print(c%(13,34,34))";
int
b1="#define print(X) main(){printf(c,13,34,34);};";
int
b2="print(d%(13,13,34,a1,34,13,13,34,a2,34,13,13,34,b1,34,13,13,34,b2,34,13,13,34,c,34,13,13,34,d,34,13,a1,13,a2))";
int
c="#define print(a) main(){puts(a);}%cprint(%cWrong language!%c)";
int
d="#define int char*%cint%ca1=%c%s%c;%cint%ca2=%c%s%c;%cint%cb1=%c%s%c;%cint%cb2=%c%s%c;%cint%cc=%c%s%c;%cint%cd=%c%s%c;%c%s%c%s";
#define print(X) main(){printf(d,13,13,34,a1,34,13,13,34,a2,34,13,13,34,b1,34,13,13,34,b2,34,13,13,34,c,34,13,13,34,d,34,13,b1,13,b2);}
print(c%(13,34,34))

Program B:
#define int char*
int
a1="#define print(X) main(){printf(d,13,13,34,a1,34,13,13,34,a2,34,13,13,34,b1,34,13,13,34,b2,34,13,13,34,c,34,13,13,34,d,34,13,b1,13,b2);}";
int
a2="print(c%(13,34,34))";
int
b1="#define print(X) main(){printf(c,13,34,34);};";
int
b2="print(d%(13,13,34,a1,34,13,13,34,a2,34,13,13,34,b1,34,13,13,34,b2,34,13,13,34,c,34,13,13,34,d,34,13,a1,13,a2))";
int
c="#define print(a) main(){puts(a);}%cprint(%cWrong language!%c)";
int
d="#define int char*%cint%ca1=%c%s%c;%cint%ca2=%c%s%c;%cint%cb1=%c%s%c;%cint%cb2=%c%s%c;%cint%cc=%c%s%c;%cint%cd=%c%s%c;%c%s%c%s";
#define print(X) main(){printf(c,13,34,34);};
print(d%(13,13,34,a1,34,13,13,34,a2,34,13,13,34,b1,34,13,13,34,b2,34,13,13,34,c,34,13,13,34,d,34,13,a1,13,a2))

Program C:
#define print(a) main(){puts(a);}
print("Wrong language!")

I used your hint of using C/C++ with Python.
Not very concise, but still qualifying I suppose.

Why did you delete your account!? Why not stay here?

Explanation, please?

@CrazyPython If s?he deleted his/her account, how would they explain the code?

Python 2 / Retina, 550 + 645 = 1373 1254 1221 1195 bytes
I'm not quite sure if the unichr and replace parts can be golfed more. I tried using Python 3, but a lot is lost by having to add parentheses and handle them. I tried setting R=unicode.replace and using that, but the output gets messed up.
Note that Retina has a trailing newline in its output by default, and this is not included in the programs. If someone says I need to remove it, that can be done trivially. Also, the Python code works in repl.it, but is not guaranteed to work on Ideone.com.
Also note that leading and trailing newlines are significant in the code below.
Program A (Python 2): 638 587 566 550 bytes (UTF-8)
Python 2, Retina
U=unichr;s=U(39)*3;_=u'''\n#U=unichr;s=U(39)*3;_=u%s.replace(U(9),U(96));print _%%(s+_+s).replace(U(10),U(92)+'n').replace(U(96),U(9)).replace(U(178),U(179)).replace(U(183),U(184)).replace(U(182),U(183))#|¶#·print"Wrong language!"·#?.*t|"·¶#{2}|^.¶\n#1 #\n\n#T ²-¹ _o  [^¹]\nn=chr(10);print n+n.join(['print"Wrong language!"','#?.*t|"'])+n\n'''.replace(U(9),U(96));print _%(s+_+s).replace(U(10),U(92)+'n').replace(U(96),U(9)).replace(U(178),U(179)).replace(U(183),U(184)).replace(U(182),U(183))#|
#¶print"Wrong language!"¶#?.*t|"¶
#{2}|^.

Program B (Retina): 735 667 655 645 bytes (ISO 8859-1)
Retina, Python 2

#U=unichr;s=U(39)*3;_=u'''\n#U=unichr;s=U(39)*3;_=u%s.replace(U(9),U(96));print _%%(s+_+s).replace(U(10),U(92)+'n').replace(U(96),U(9)).replace(U(178),U(179)).replace(U(183),U(184)).replace(U(182),U(183))#|·#¸print"Wrong language!"¸#?.*t|"¸·#{2}|^.·\n#1   #\n\n#T ³-¹ _o  [^¹]\nn=chr(10);print n+n.join(['print"Wrong language!"','#?.*t|"'])+n\n'''.replace(U(9),U(96));print _%(s+_+s).replace(U(10),U(92)+'n').replace(U(96),U(9)).replace(U(178),U(179)).replace(U(183),U(184)).replace(U(182),U(183))#|¶#·print"Wrong language!"·#?.*t|"·¶#{2}|^.¶
#1`#

#T`²-¹`_o`[^¹]
n=chr(10);print n+n.join(['print"Wrong language!"','#?.*t|"'])+n

Program C:
Python 2, Retina
This can actually be made shorter using #!`W.*! instead of the last two lines, but this makes A and B longer, because having ` in a line where there wasn't one means I need to handle it differently (because the first backtick in a line in Retina is a configuration delimiter).

print"Wrong language!"
#?.*t|"

Explanation:
Program C:
                        # Retina: replace nothing with the Python code string
print"Wrong language!"  # >> code is executed if run in Python
#?.*t|"                 # Comment w/ '?' for Retina to skip, then replace up to the 't',
                        #    as well as any quotation marks, with nothing

I wrote Program C first during my first attempt and kept it mostly the same. In Python, it prints the string and ignores the comment. In Retina, it replaces nothing with print"Wrong language!" and then removes the parts around Wrong language!.
To better understand the complex programs, let's look at simplified versions:
Program A (simplified):
print"\n#PYTHON\n#1`#\n\n#T`²-¹`_o`[^¹]\nn=chr(10);print n+n.join(['print"Wrong language!"','#?.*t|"'])+n\n"#|
#¶print"Wrong language!"¶#?.*t|"¶
#{2}|^.

When I started over from scratch, I used the PYTHON bit as a placeholder for the code that should print Program A. This simpler version made it easier to explain how both Program B and Program C would be printed.
The print and everything inside is what prints Program B, but first, lets see how Program C is printed, because that's simple. After the print"..." is #|. This trick saved LOADS of difficulty that I experienced in my first attempt. This allows Retina to replace nothing with the 2nd line, which will be Program C, except there's a # in front. The last 2 lines remove that first #. I used #{2} to prevent the stage from removing all occurrences of #. I cannot use #1`# like I used in Program B, because it causes problems to have that backtick in the first line of Program A.
Which brings me to my next task, printing Program B. You may have noticed another difference from the actual code. There aren't backticks in the actual code, since I replaced them with tabs. I had to substitute a character, because any backtick would make the earlier code a configuration string in Retina, causing the syntax to be invalid. I chose tabs because they're visible and the code point is a single digit (9). The code prints Program B as shown in the simplified version below.
Program B:

#PYTHON
#1`#

#T`²-¹`_o`[^¹]
n=chr(10);print n+n.join(['print"Wrong language!"','#?.*t|"'])+n

The first two lines will replace nothing with the Python code, but with a # in front and some characters slightly different. This part is omitted for clarity. The next stage removes that first #. Then, I use a Transliteration (T) stage #T`²-¹`_o`[^¹] to undo some of the replace operations seen in the complete Program A. Using this stage is a way to output a literal pilcrow ¶ in Retina, which might otherwise be impossible.¹ It replaces · with ¶, and ³ with ². Occurrences of ¹ will stay the same due to them being ignored with [^¹].
Program A:
Newlines and tabs have been added for readability.
U=unichr;s=U(39)*3;

_=u'''
    \n#U=unichr;s=U(39)*3;

    _=u%s.replace(U(9),U(96));

    print _%%(s+_+s)
    .replace(U(10),U(92)+'n').replace(U(96),U(9)).replace(U(178),U(179))
    .replace(U(183),U(184)).replace(U(182),U(183))#|

    ¶#·print"Wrong language!"·#?.*t|"·
    ¶#{2}|^.
    ¶

    \n#1    #\n\n#T ²-¹ _o  [^¹]\nn=chr(10);print n+n.join(['print"Wrong language!"','#?.*t|"'])+n\n'''

.replace(U(9),U(96));

print _%(s+_+s)
.replace(U(10),U(92)+'n').replace(U(96),U(9)).replace(U(178),U(179))
.replace(U(183),U(184)).replace(U(182),U(183))#|

#¶print"Wrong language!"¶#?.*t|"¶
#{2}|^.

This follows the general structure of the following Python quine:
_='_=%r;print _%%_';print _%_

When you add things before or after, you have to put them in the string, too.
U=unichr;_='U=unichr;_=%r;print(_%%_).replace('','')';print(_%_).replace('','')

I wanted to use a triple-quoted string to make it easy to include quotation marks (avoiding the use of backslashes). s=U(39)*3; is the string '''. I also used %s instead of %r, in order to avoid some problems with newlines or other characters being escaped with backslashes.
U=unichr;s=U(39)*3;_='''U=unichr;s=U(39)*3;_=%s;print(s+_%%_+s).replace('','')''';print(s+_%_+s).replace('','')

So now, the replacements. The first replacement .replace(U(9),U(96)); is there to replace tabs with the backticks that we see in Program B. This replacement is done before string formatting, because the tabs need to remain tabs in Program A. The other replacements are simply to avoid using certain characters in the 2nd line of Program B:
.replace(U(10),U(92)+'n')   # Replace newlines with a backslash and 'n', for B to print A.
.replace(U(96),U(9))        # Replace backticks with tabs for the first part of B.
.replace(U(178),U(179))     # Replace '²' with '³', which will be undone with B's T stage
.replace(U(183),U(184))     # Replace '·' with '¸', which will be undone with B's T stage
.replace(U(182),U(183))     # Replace '¶' with '·', which will be undone with B's T stage

These last three replacements anticipate the Transliteration stage in Program B, in order to prevent those characters from being either removed or transliterated when they shouldn't be.
The only other part of the code is the code from Program B that is essentially copied character-for-character, except for the changes due to the replacements.

¹ Thanks to Martin for his tip on how to output a literal ¶ in Retina. It made everything so much easier.

Befunge/Python, 381+485 259+345 229+304 = 533 bytes
Program A:
Try in Befunge
| Try in Python
#>21g::35*:*::":"%\>:#$":"%#\ \#%":"/#::$#-g#1\_#+\#5:#5_v
#v"50g"g12"'<:#>!#,_@<'tnirp"g12">:#,_@"+55"print "::g12$<
#>21g"Wrong language!"21g"g05"21g"[+5+5:]"21g"+55>#">:#,_@
print'''print'<@_,#!>#:<'"Wrong language!"[+5+5:]'''

Program B:
Try in Python | Try in Befunge
#>55+"]:5+5+["50g"!egaugnal gnorW"50g"'<:#>!#,_@<'tnirp">:#,_@
print """#>21g::35*:*::":"%\>:#$":"%#\ \#%":"/#::$#-g#1\_#+\#5:#5_v
#v"50g"g12"'<:#>!#,_@<'tnirp"g12">:#,_@"+55"print "::g12$<
#>21g"Wrong language!"21g"g05"21g"[+5+5:]"21g"+55>#">:#,_@
print'''print'<@_,#!>#:<'"Wrong language!"[+5+5:]'''"""

Program C:
Try in Befunge
| Try in Python
print'<@_,#!>#:<'"Wrong language!"[+5+5:]

Explanation
Program C: This relies on the fact that Befunge-93 ignores unsupported instructions, so while the p harmlessly write a zero at 0;0, the rest of the print is ignored up until the < instruction which reverse the direction. Then flowing from right to left, the +5+5 pushes a 10 (linefeed) on to the stack followed by the message string, and then a standard output sequence is executed to write out the string. In Python it's just printing two string literals that are concatenated together, but the first one (containing the Befunge code) is sliced off by the array reference at the end ([+5+5:]).
Program B: The first line is a fairly basic Befunge sequence to print out Program C. The only interesting thing is the way it generates quote characters using 50g (i.e. reading the character from memory) which is more efficient than calculating the ASCII code. The #> (a bridge over the direction instruction) is essentially a nop that prevents the code being seen by Python since # is the Python comment character. The Python interpretation starts on line two and is simply printing a multiline string containing the source code of Program A.
Program A: In Python the first three lines are again ignored because they start with #, while the last line simply prints out Program C. The Befunge code snakes back and forth across the first three lines, building up the source for Program B on the stack in reverse order. It starts with three quotes, then a sequence that makes a copy of Program A's source, and finally what is essentially a hard coded string with the opening print """ and the first line of Befunge code. It's then just a matter of writing it out with a standard output sequence.
Some points of contention:

I've been told that a quine using the g command is not considered a proper quine as far as this community is concerned. I'm not sure if that rule would apply to this challenge as well, but if so, this answer might not be considered a proper solution either.
While I've said that Befunge-93 ignores unsupported instructions, that's not technically defined in the specification, and you'll need to use the -q (quiet) command line option in the reference interpreter to avoid warnings in Program C. Most other interpreters will be fine, though, but some of the flakier ones could potentially crash. Also note that Befunge-98 reflects on unsupported instructions, so a 98 interpreter will just loop indefinitely.

Explanation, please?

Is the -q flag actually "quite", or did you mean "quiet"? Mm-yes, this flag is quite useful.

@mbomb007 Yes, that was a typo. Thanks for spotting that.

Funnily enough, -98 isn't bouncing off an unknown instruction. It's bouncing off the reflect instruction and the 0 that was put in the first cell

Perl/JavaScript, 176 bytes + 176 bytes = 352 bytes
Don't think I can share 52 bytes off the underlying mechanism for the bounty, but I enjoyed building this. I think what I've produced meets the criteria...
Program A:
$P=1;$_='$L=eval("printf=console.log;J=``;q=_=>_+J;2")||1;$P?printf(q`$P=%s;$_=%s%s%s;eval($_)`,$P=$P==$L?J?2:1:0,$q=J?h^O:atob("Jw"),$_,$q):printf("Wrong language!")';eval($_)

Program B:
$P=2;$_='$L=eval("printf=console.log;J=``;q=_=>_+J;2")||1;$P?printf(q`$P=%s;$_=%s%s%s;eval($_)`,$P=$P==$L?J?2:1:0,$q=J?h^O:atob("Jw"),$_,$q):printf("Wrong language!")';eval($_)

Program C:
$P=0;$_='$L=eval("printf=console.log;J=``;q=_=>_+J;2")||1;$P?printf(q`$P=%s;$_=%s%s%s;eval($_)`,$P=$P==$L?J?2:1:0,$q=J?h^O:atob("Jw"),$_,$q):printf("Wrong language!")';eval($_)

Explanation
Uses my Perl/JavaScript polyquine as a basis but sets an additional variable $P which controls which program to generate. Uses the check that +[] is truthy in Perl, but falsy in JavaScript.


text:
The logical quine
The challenge
Simply write a program that outputs its own source code.
Nothing more than a regular quine.
The problem
We don't have a computer so we have to run the program on a programmable logic device (such as an FPGA, a CPLD, a gate array ...).
The rules

Any device available on the market (such as a printer connected via Centronics port, an LED display, an RS232 terminal ...) connected to the logic device can be used to output the program.
If you use any kind of programmable device as output device you are not allowed to put any program logic there!
Example: If you use RS232 to send data to a computer the computer must do nothing but displaying the data received from the RS232. However you are allowed to switch on RS232 options like echoing data back to the logic device if any existing terminal program has this feature.
Any (recent or historic) "standard" coding (ASCII, UNICODE, EBCDIC, Morse code ...) can be used.
The program needs only to output its own source code. The file only containing the mapping between VHDL/Verilog/... "wires" and the actual I/O pins, the file containing the compiler settings and similar files are not considered as "source code" and need not to be written.
You have one clock input pin with the frequency of your choice (if you need that).
On-chip units (like on-chip SRAM or on-chip multipliers) must not be used.
For testing the code you can simulate the output device using additional code; of course you may simulate the logic device, too (if you don't have a real one).
Standard loopholes apply.

The winner

For calculating the size of the program it is assumed that the real output device (e.g. the printer) is connected to some I/O pins of the logic device.
The code that requires the fewest "LE" cells on my FPGA (Altera EP2C20F484C7) wins.
If my FPGA is too small (= not large enough for the smallest solution) we compile for the largest one having "LE"-type cells (EP4CGX150DF31I7).
If that one is still not enough we try the largest one supported by the free-of-charge compiler (EP2AGX260FF35I5).
If that device is still too small the size of the source code counts.

Note
Searching for "quine VHDL" in Google I found at least three quines written in VHDL on the first page!
Unfortunately none of them will work on a real logic device but only in the emulator because the standard output (of the emulator) is used.
Good luck!

Verilog, optimized for area, 130 LE gates
The quine itself (the actual file is encoded in DEC SIXBIT):
module q(s,d);inout s,d;wire[0:1023]v=1024'b0110111100101001011001111110110110010110100100001111011010010111010101110101010110010110111100101001011001111110110100100110100100001111011010100111010101110110111000011100111100111010011001111011100000001001000111011010100111000101100111111010100111010111010100100110101101101110111010011111010110111000011011001101111000011110011100111000000010001100001011111100111001011001001001111001010000001100110010011010011001100010001010100111100101010010011000101001011001111010011011100000001010010111011010010010110100010110111010100111011010100001100100011111100000011010010111110101110110100100010110111001011011101001000000001001011011001100111001010000001010100111011010100010110100010110111001011011101001001011011011111001001101011011001001010000000000000000101101101111100100110101101100100101000000110001001000110011001100100100001001011011101001101110101111110101110100000000110011001100100100011011110111101001110010100101111011010000011010010001010000010010010011111101110110011101010001010000010010010100000111100010;reg[9:0]i=759;reg[2:0]j=7;assign d=j<6?j==2:v[i];always@(posedge s)if(j>5)begin i=i+1;j=j&1^!i?7:1;end else j=j+1;endmodule

Readable version with comments and a testbench:
module q(s,d);
   // Declare the ports. Making them both "inout" is shortest.
   inout s,d;
   // Data storage for the program.
   wire[0:1023]v=1024'b{DATA GOES HERE};
   // i is the current bit number within the program.
   // This is relative to the /end of the data storage/ (not to the start
   // of the program), so it starts at a nonzero value so that the output
   // starts at the start of the program.
   reg[9:0]i=759;
   // When expanding bits to (6-bit) bytes, j is the bit number within
   // the expansion, from 1 for the first bit up to 6 for the last.
   // When not expanding, j is always 7.
   // DEC SIXBIT encoding for 0 is (from MSB to LSB) 010 000.
   // DEC SIXBIT encoding for 1 is (from MSB to LSB) 010 001.
   // We use SSI encoding for the output, so the MSB is sent first.
   reg[2:0]j=7;
   assign d=j<6?j==2:v[i];
   // When we get a strobe:
   always@(posedge s)
     // If we just output a bit, move onto the next bit.
     // We may also need to reset j.
     if(j>5)
       begin
          i=i+1;
          j=j&1^!i?7:1;
       end
     else
       // If we're inside a bit, continue to output that bit.
       j=j+1;
endmodule
// {TESTBENCH BELOW HERE}

`timescale 10ns / 1ns
module testbench();
   reg clock = 0;
   wire data, strobe;

   always
     #1 clock <= !clock;
   initial
     #14304 $finish;

   assign strobe = clock;
   q testquine(.s(strobe),.d(data));

   always @(negedge strobe)
      $display("%d", data);

endmodule // testbench

The use of Verilog gives me considerably more control over the low-level details than I'd have with Verity. In particular, it lets me control the clock and reset rules myself. This program's intended for a synchronous serial connection with strobe input s and data output d. Although each is only used in one direction, I declared them both as bidirectional to save a few bytes; I had to golf the non-data parts of the program down to 1024 bits to be able to use 10-bit logic gates internally (extra bits would be more expensive in area), and it only just scrapes under at 1008, so savings like this are important. In order to save a substantial amount of code, I rely on the FPGA's hardware reset circuitry rather than adding my own, and I merge the strobe and clock inputs (which is an old trick that's kind-of frowned upon nowadays because it makes it hard to keep the clock tree balanced at high clock speeds, but it's useful for golfing.) I hope that's synthesizable; I don't know how well Verilog synthesizers cope with using a bidirectional port as a clock.
The source is encoded in DEC SIXBIT (I'm assuming here that we interpret its single alphabet of letters as lowercase; a Verilog synthesizer would have no reason to use an uppercase interpretation). I used a six-bit character set internally in my other solution, then wasted bytes converting it; it's better to use a character set that's "naturally" six bits wide so that no conversion is necessary. I picked this particular six-bit character set because 0 and 1 differ only in their least significant bit, and only have one other bit set, meaning that the circuitry for converting a binary digit to DEC SIXBIT (i.e. "escaping" a string) can be very simple. Interestingly, the character set in question is missing a newline character; the original program's all on one line not just to make it easier to generate, but to make it possible to encode! It's a good thing that Verilog mostly doesn't care about whitespace.
The protocol for sending data to the host is based on Synchronous Serial Interface. I picked it because it's clocked (allowing me to use the clock/strobe trick, and also allowing me to write a portable program that doesn't rely on on-chip timing devices), and because it's very simple (thus I don't have to waste much code implementing it). This protocol doesn't specify a method of specifying where the message ends (the host is supposed to know); in this particular case, I padded the output up to a multiple of 1024 bits with zero bits (a total of 16 padding bits), after which (as required by SSI) the message restarts. (I don't implement an idle mode timer; its purpose is to determine whether to send a new message or whether to repeat the previous message, and as this program always sends its own source code as the message, the distinction isn't visible. You can consider it to be length 0, or infinitely long, depending on your point of view.)
In terms of the actual logic, the most interesting thing is the way that I split up the variables to reduce the amount of area needed on the chip. i, the larger register, holds the current "address" within the program's data, and is only ever changed via incrementing it; this means that its logic can be synthesized using the half-adder construction (which, as the name suggests, uses only half the resources that an adder does; this mostly only matters on the smallest FPGAs, larger ones will use 3-input or even 4-input LUTs which are powerful enough that they'll have lots of wasted capacity synthesizing a half-adder). The smaller register, j, is basically a state machine state and thus handles most of the program's complex logic. It's small enough that it can be handled entirely via lookup table on a larger FPGA (making the logic basically disappear); in case the program is synthesized for a small FPGA, I chose its encoding in such a way that few parts of the code care about all three of its bits at once.
It's also worth noting that I cyclically permuted the data storage. We can start i pointing anywhere inside it, not necessarily at the start. With the arrangement seen here, we can print from the initial value of i to the end directly, then print the entire array escaped, then print from the start to the initial value of i, in order to print the all the parts of the data in the right places without needing to save and restore the value of i. (This trick might be useful for quines in other languages too.)
The source is 1192 6-bit bytes long, the equivalent of 894 8-bit bytes. It's kind-of embarrassing that this contains fewer source bytes than my Verity submission, despite being optimized for something entirely different; this is mostly because Verilog has strings and Verity doesn't, meaning that even though I've encoded the program in binary rather than octal (which is substantially less efficient in terms of source code size), I can encode each byte of the program using six six-bit characters (one for each bit) rather than eight eight-bit characters (four for each octal digit). A Verilog submission that encoded the program in octal would probably be smaller in terms of source code size, but would almost certainly be larger in area.
I don't know how much area this program will end up using; it depends a lot on how powerful the optimizer is in your Verilog synthesizer (because the minimization problem of converting the stored data into a set of logic gates is something that's done in the synthesizer itself; throwing the work onto the synthesizer makes the source code itself much shorter, and thus reduces the area needed to store it). It should have a complexity of O(n log n), though, and thus be much smaller than the O(n²) of the other program. I'd be interested to see the OP try to run it on their FPGA. (It may take quite some time to synthesize, though; there are various steps you can take to optimize a program for compile time but I didn't take any here as it'd cause a larger program = larger area.)

The first compiler run says that only 130 LE gates are used. Because an LE gate can only store 2 bits of data and you use a ~750 bit data stream this may mean that the compiler compressed the data or that something went wrong while compiling. Tomorrow in the morning I'll verify if the compiler result is correct.

With this construction, much of the data is stored in the pattern of connections between the gates rather than the gates themselves, so I can believe that 130 LE gates is correct. (The synthesizer is basically brute-forcing a formula that maps a 10-bit index to a 1-bit value; I specified the formula in the Verilog program using a lookup table with 1024 entries, but the synthesizer is very likely to use a more efficient representation based on something like a K-map minimization.)

Oh, you should probably also check to make sure that the compiler hasn't optimized part of the code into a block RAM or block ROM (disallowed by the question). I didn't request one, and haven't written the code in a form that would imply one (I was careful to make the lookup table combinatorial), but sometimes compiler optimizations do weird things. If there is an optimization interfering with that, you'd have to turn the optimization off.

I tried to get that running on my FPGA for half a day (OK. 3 hours wasted because I searched for some CD-ROM I obviously lost): The data stream returned by the FPGA seems not to be correct. Unfortunately I havn't found out why...

Ok. I managed the problems with the pins now. The code seems to work well. Outstanding. Only 130 LE-type cells! RAM, ROM etc. is not used. I think the compiler does some optimization similar to KV diagrams to "compress" the data.

You win! Congratulations.

Verity 0.10, optimized for source code size (1944 bytes)
I originally misread the question and interpreted it as a code-golf. That was probably for the best, as it's much easier to write a quine with short source code than short object code under the restrictions in the question; that made the question easy enough that I felt I could reasonably produce an answer, and might work as a stepping stone on the way to a better answer. It also prompted me to use a higher-level language for the input, meaning that I'd need to express less in the program itself. I didn't create Verity as a golfing language for hardware (I was actually hired to create it a while ago in an entirely different context), but there's quite a reminiscence there (e.g. it's substantially higher level than a typical HDL is, and it has much less boilerplate; it's also much more portable than the typical HDL).
I'm pretty sure that the correct solution for short object code involves storing the data in some kind of tree structure, given that the question disallows the use of block ROM, which is where you'd normally store it in a practical program; I might have a go at writing a program that uses this principle (not sure what language, maybe Verity, maybe Verilog; VHDL has too much boilerplate to likely be optimal for this sort of problem) at some point. That would mean that you wouldn't need to pass every bit of the source code to every bit of your "manually created ROM". However, the Verity compiler currently synthesizes the structure of the output based on the precedence and associativity of the input, meaning that it's effectively representing the instruction pointer (thus the index to the lookup table) in unary, and a unary index multiplied by the length of the lookup table gives this O(n²) space performance.
The program itself:
import <print>new x:=0$1296in(\p.\z.\a.new y:=(-a 5-a 1-a 1-a 2-a 4-a 2-a 3-a 2-a 6-a 2-a 0-a 3-a 0-a 4-a 4-a 7-a 4-a 2-a 6-a 2-a 5-a 1-a 2-a 2-a 0-a 3-a 6-a 7-a 2-a 2-a 1-a 1-a 3-a 3-a 0-a 4-a 4-a 3-a 2-a 7-a 5-a 7-a 0-a 6-a 4-a 4-a 1-a 6-a 2-a 6-a 1-a 7-a 6-a 6-a 5-a 1-a 2-a 2-a 0-a 5-a 0-a 0-a 4-a 2-a 6-a 5-a 0-a 0-a 6-a 3-a 6-a 5-a 0-a 0-a 5-a 0-a 6-a 5-a 2-a 2-a 1-a 1-a 3-a 3-a 0-a 4-a 5-a 3-a 2-a 7-a 5-a 7-a 0-a 5-a 5-a 5-a 1-a 4-a 4-a 3-a 1-a 5-a 5-a 1-a 2-a 2-a 0-a 4-a 3-a 3-a 4-a 1-a 5-a 1-a 0-a 2-a 1-a 1-a 1-a 4-a 4-a 3-a 6-a 7-a 0-a 6-a 0-a 1-a 3-a 2-a 0-a 5-a 4-a 2-a 0-a 5-a 5-a 1-a 2-a 1-a 0-a 4-a 6-a 3-a 4-a 7-a 3-a 6-a 2-a 6-a 0-a 3-a 4-a 1-a 1-a 1-a 2-a 2-a 0-a 4-a 6-a 3-a 3-a 5-a 1-a 7-a 2-a 6-a 1-a 1-a 0-a 2-a 7-a 2-a 1-a 1-a 0-a 4-a 6-a 3-a 1-a 5-a 3-a 7-a 5-a 1-a 2-a 1-a 0-a 4-a 6-a 3-a 5-a 7-a 5-a 7-a 4-a 6-a 5-a 6-a 0-a 3-a 4-a 1-a 1-a 1-a 2-a 2-a 0-a 4-a 3-a 3-a 4-a 1-a 5-a 1-a 0-a 2-a 1-a 1-a 1-a 4-a 5-a 3-a 6-a 7-a 0-a 6-a 0-a 1-a 3-a 2-a 0-a 5-a 4-a 2-a 0-a 4-a 1-a 7-a 7-a 6-a 3-a 7-a 4-a 2-a 0-a 4-a 3-a 6-a 2-a 6-a 3-a 7-a 4-a 2-a 0-a 5-a 4-a 6-a 0-a 7-a 2-a 0-a 1-a 4-a 5-a 3-a 4-a 4-a 4-a 4-a 3-a 6-a 4-a 4-a 4-a 4-a 3-a 6-a 2-a 6-a 1-a 5-a 3-a 7-a 4-a 2-a 0-a 4-a 4-a 6-a 5-a 6-a 3-a 7-a 5-a 3-a 2-a 7-a 5-a 7-a 1-a 4-a 5-a 3-a 6-a 7-a 6-a 7-a 3-a 6-a 1-a 5-a 1-a 1-a 0-a 2-a 7-a 2-a 1-a 1-a 0-a 4-a 7-a 2-a 7-a 1-a 5-a 1-a 4-a 2-a 3-a 7-a 4-a 3-a 2-a 7-a 5-a 7-a 1-a 4-a 4-a 3-a 6-a 7-a 6-a 7-a 6-a 6-a 1-a 5-a 1-a 5-a 4-a 2-a 6-a 2-a 5-a 1-a 2-a 2-a 0-a 3-a 0-a 5-a 1-a 4-a 4-a 3-a 4-a 4-a 4-a 4-a 6-a 6-a 4-a 4-a 4-a 4-a 3-a 6-a 2-a 6-a 1-a 5-a 0-a 5-a 0-a 0-a 0-a 1-a 6-a 5-a 4-a 3-a 2-a 7-a 5-a 7-a 1-a 4-a 4-a 3-a 6-a 7-a 6-a 7-a 3-a 6-a 2-a 0-a 0-a 1-a 4-a 7-a 4-a 7-a 1-a 6-a 2-a 6-a 1-a 7-a 3-a 6-a 3-a 7-a 0-a 6-a 1-a 5-!x)in while!x>0do(p(if z<32then z+92else z);if z==45then while!y>0do(p 97;p 32;p(48^!y$$3$$32);p 45;y:=!y>>3)else skip;x:=!x>>6))print(!x$$6$$32)(\d.x:=!x>>3^d<<1293;0)

More readable:
import <print>
new x := 0$1296 in
(\p.\z.\a.
  new y := (-a 5-a 1-
            # a ton of calls to a() omitted...
            -a 1-a 5-!x) in
  while !x>0 do (
    p(if z<32 then z+92 else z);
    if z==45
    then while !y>0 do (
      p 97;
      p 32;
      p(48^!y$$3$$32);
      p 45;
      y:=!y>>3 )
    else skip;
    x:=!x>>6
  )
)(print)(!x$$6$$32)(\d.x:=!x>>3^d<<1293;0)

The basic idea is that we store the entire data in the variable x. (As usual for a quine, we have a code section and a data section; the data encodes the text of the code, and can also be used to regenerate the text of the data.) Unfortunately, Verity doesn't currently allow very large constants to be written in the source code (it uses OCaml integers during compilation to represent integers in the source, which clearly isn't correct in a language that supports arbitrarily wide integer types) – and besides, it doesn't allow constants to be specified in octal – so we generate the value of x at runtime via repeated calls to a function a. We could create a void function and call it repeatedly as separate statements, but that would make it hard to identify where to start outputting the text of the data section. So instead, I made a return an integer, and use arithmetic to store the data (Verity guarantees that arithmetic evaluates left to right). The data section is encoded in x using a single - sign; when this is encountered at run time, it's expanded to the full -a 5-a 1-, etc., via the use of y.
Initializing y as a copy of x is fairly subtle here. Because a returns zero specifically, most of the sum is just zero minus zero minus… and cancels itself out. We end with !x (i.e. "the value of x"; in Verity, as in OCaml, a variable's name works more like a pointer than anything else, and you have to dereference it explicitly to get at the variable's value). Verity's rules for unary minus are a little complex – the unary minus of v is written as (-v) – thus (-0-0-0-!x) parses as (-(0-0-0-!x)), which is equal to !x, and we end up initializing y as a copy of x. (It's also worth noting that Verity is not call-by-value, but rather allows functions and operators to choose the order they evaluate things; - will evaluate the left argument before the right argument, and in particular, if the left argument has side effects, those will be visible when the right argument is evaluated.)
Each character of the source code is represented using two octal digits. This means that the source code is limited to 64 different characters, so I had to create my own codepage for internal use. The output is in ASCII, so I needed to convert internally; this is what the (if z<32 then z+92 else z) is for. Here's the character set I used in the internal representation, in numerical order (i.e. \ has codepoint 0, ? has codepoint 63):
\]^_`abcdefghijklmnopqrstuvwxyz{ !"#$%&'()*+,-./0123456789:;<=>?

This character set gives us most of the characters important for Verity. Notable characters missing are } (meaning that we can't create a block using {}, but luckily all statements are expressions so we can use () instead); and | (this is why I had to use an exclusive rather than inclusive OR when creating the value of x, meaning I need to initialize it to 0; however, I needed to specify how large it was anyway). Some of the critical characters that I wanted to ensure were in the character set were <> (for imports, also shifts), () (very hard to write a program that can be parsed without these), $ (for everything to do with bitwidth), and \ (for lambdas; theoretically we could work around this with let…in but it would be much more verbose).
In order to make the program a bit shorter, I constructed abbreviations for print and for !x$$6$$32 (i.e. "the bottom 6 bits of !x, cast to be usable to the print library) via temporarily binding them to lambda arguments.
Finally, there's the issue of output. Verity provides a print library that's intended for debug output. On a simulator, it prints the ASCII codes to standard output, which is perfectly usable for testing the program. On a physical circuit board, it depends on a print library having been written for the particular chip and board surrounding it; there's a print library in the Verity distribution for an evaluation board I had access to that prints the output on seven-segment displays. Given that the library will end up taking space on the resulting circuit board, it may be worth using a different language for an optimized solution to this problem so that we can output the bits of the output directly on wires.
By the way, this program is O(n²) on hardware, meaning that it's much worse on a simulator (I suspect O(n⁴); not sure, though, but it was hard enough to simulate that it seems unlikely to be even cubic, and based on how the time reacted to my changes as I was writing the program, the function seems to grow very quickly indeed). The Verity compiler needed 436 optimization passes (which is much, much more than it'd typically use) to optimize the program, and even after that, simulating it was very hard for my laptop. The complete compile-and-simulate run took the following time:
real  112m6.096s
user  105m25.136s
sys   0m14.080s

and peaked at 2740232 kibibytes of memory. The program takes a total of 213646 clock cycles to run. It does work, though!
Anyway, this answer doesn't really fulfil the question as I was optimizing for the wrong thing, but seeing as there are no other answers yet, this is the best by default (and it's nice to see what a golfed quine would look like in a hardware language). I'm not currently sure whether or not I'll work on a program that aims to produce more optimized ouptut on the chip. (It would likely be a lot larger in terms of source, as an O(n) data encoding would be rather more complex than the one seen here.)

What's the score for the primary criterion (LE gates used on the specified FPGA)?

No, I mean, what score does this solution achieve?

@Mego I'm just trying to get the compiler from veritygos.org to check...

@Mego: No idea; Verity itself is a portable language, but the Verity implementation probably doesn't have a toplevel already implemented for the specific chip specified, and anyway I don't have an FPGA synthesizer to hand at the moment. My simulator says there are 6328084 driven signals; that should have an approximately linear relationship to the number of LE gates needed, but I don't know what the constant factor is. (In general, having a criterion specified in terms of something that could be objectively checked on a simulator would make things easier here.)

@MartinRosenau: You might want to try seeing if the de2 or de3 backends work (-m de2, -m de3). Those were both written for Altera chips; they might or might not be the same as yours, and they might or might not happen to work anyway even if they aren't. (If you don't happen to be using the same evaluation boards I was, you can probably compile as far as the VHDL but will have to do the rest of the compilation by hand.)

The synthesis runs out of memory - which does not neccessarily mean that it wouldn't work. However the intermediate VHDL file generated by the Verity compiler has a size of > 1MB while your Verilog solution has only 2KB in size so I doubt the Verity solution requires less logic cells than the Verity solution.

source: Stack Exchange

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

sort: votes


text:
Draw diagonal lines of text
Given an input of a list of words, output the words with their letters arranged
diagonally:
p
 r
  o
p  g
 u  r
  z  a
a  z  m
 n  l  m
  d  e  i
c     s  n
 o        g
  d
g  e
 o
  l
   f

(The above should be the output for the input programming puzzles and code golf.)
To be precise, each word starts on the first column and three rows below the
previous word, and each successive letter moves one column to the right and one
row down.
The input may be provided as either a single string of words, separated by
exactly one space, or a list/array of words. The words will only be composed of
lowercase letters, a-z, and will always be at least one character long.
The output may be a single string, an array of lines, or an array of arrays of
characters. Leading or trailing whitespace is not allowed, except for a single
trailing newline.
Further test cases:
a bcd efgh i j
a

b
 c
  d
e
 f
  g
i  h

j

x
x

verylongword short
v
 e
  r
s  y
 h  l
  o  o
   r  n
    t  g
        w
         o
          r
           d

Since this is code-golf, the shortest code in bytes will win!

I feel like I should be able to make a Python program for this in 5 minutes, but it always seems to be failing... ;_;

Wow, it seems like there are a lot of challenges seemingly designed for Turtlèd

Are terminal escape codes allowed? :)

Vim, 85, 76, 66, 52 keystrokes/bytes
When I first looked at this challenge, I thought "This is perfect for vim!" And then when I tried it everything went wrong. Here it is, in all of it's messy hacky glory:
:se ve=all|s/ /\r\r\r/g
qqGo<esc>?\<.\S
lDjP@qq@qG?.
jdG

Try it online, thanks to the (mostly) backwards compatible V interpreter.
Explanation:
At first I thought I could do this beautifully simple 37 byte version:
:se ve=all
qq:g/\S\S/norm ^lDjP
@qq@q

Unfortunately, it's not that simple. Let's take it line by line:
:se ve=all

This enables a feature called 'virtual editing'. It allows the cursor to move to columns that don't exist yet. This answer would be basically impossible without it.
Now we need to separate out the words onto different lines. So we'll replace each space with 3 newlines. Since this is an ex command we can run it simultaneously with our last ex command :se ve=all by seperating the two with a bar.
|s/ /\r\r\r/g

Now the buffer looks like this:
Programming

Puzzles

and

code-golf

Here's where the fun begins. We set up the traditional recursive macro with: qq, and then call this:
G               " Move to the last line
 o<esc>         " Append an extra newline

?               " Search backwards for
 \<.            " Any character at the beginning of a word
    \S          " Followed by a non-space character
l               " Move one character to the right
 D              " Delete eveything until the end of this line
  j             " Move down one line
   P            " Paste what we just deleted

Then we finish the recursive macro with @qq@q. At this point, we have all of the diagonals, we just need to do a little clean up.
G                   " Move to the last line
 ?.                 " Search backwards for any character
j                   " Move down one line
 dG                 " Delete until the end of the buffer

Wow, JavaScript is (currently) shorter than Vim. That's quite a rare occurence these days...

@ETHproductions Not any more. :)

Turtlèd, 28 26 bytes
Oh my, I appear to be beating a language specifically designed for golfing. this is a great day.
!_4[*.[ rd+.]ul[ ul]r;_+]_

Try it online!
Explanation
(write means writing to the cell on the grid, pointed char means char in input the string pointer points to)
!                         Take string input into variable
 _                        Normally conditional, with >1 input (there will be), write ' '
  4                       set register to 4
   [*                   ] until the current cell is *
     .                    Write pointed char, initially first char
      [     ]             Until space is written on cell
        rd+.              move right, down, string pointer++, write pointed char
             ul[ ul]      Move back up to the top of the word
                    r;    Move right, down 4 (because this is register value)
                      _+  write * if end of input, else ' ', increment string pointer
                        _ will always write ' ', since it will always point at start char

note trailing space.
Input also needs trailing space. seeing as python can take a list, this is a lot like taking a list in Turtlèd

MATL, 28 bytes
c!t&n:q3_*ts_b+5M4$XdZ!cZ{Zv

Input is a cell array of strings, with commas as optional separators:
{'programming' 'puzzles' 'and' 'code' 'golf'}

or
{'programming', 'puzzles', 'and', 'code', 'golf'}

Try it online! Or verify all test cases: 1, 2, 3, 4.
Explanation
Consider the following input as an example:
{'aaaa' 'bb' 'ccc'}

You can view the partial results (stack contents) inserting the comment symbol % at any point in the code. For example, view the stack contents after the fourth function (&n).
c        % Input cell array of strings implicitly. Convert to 2D char array,
         % right-padding with spaces
         % STACK: ['aaaa'; 'bb  '; 'ccc']
!        % Transpose
         % STACK: ['abc'
                   'abc'
                   'a c'
                   'a  ']
t        % Duplicate
         % STACK: ['abc'
                   'abc'
                   'a c'
                   'a  '],
                  ['abc'
                   'abc'
                   'a c'
                   'a  '],
&n       % Number of rows and of columns
         % STACK: ['abc'
                   'abc'
                   'a c'
                   'a  '], 4, 3
:q       % Range, subtract 1
         % STACK: ['abc'
                   'abc'
                   'a c'
                   'a  '], 4, [0 1 2]
3_*      % Multiply by -3
         % STACK: ['abc'
                   'abc'
                   'a c'
                   'a  '], 4, [0 -3 -6]
ts_      % Duplicate, sum, negate
         % STACK: ['abc'
                   'abc'
                   'a c'
                   'a  '], 4, [0 -3 -6], 9
b        % Bubble up in stack
         % STACK: ['abc'
                   'abc'
                   'a c'
                   'a  '], [0 -3 -6], 9, 4
+        % Add
         % STACK: ['abc'
                   'abc'
                   'a c'
                   'a  '], [0 -3 -6], 13
5M       % Push second input of last function again
         % STACK: ['abc'
                   'abc'
                   'a c'
                   'a  '], [0 -3 -6], 13, 4
4$Xd     % Buld numerical sparse matrix from the above four arguments. The
         % columns of the first input argument will be the diagonals of the
         % result, with indices given bu the second input (negative is below
         % main diagonal). The matrix size is the third and fourth arguments
         % STACK: [97  0  0  0
                    0 97  0  0
                    0  0 97  0
                   98  0  0 97
                    0 98  0  0
                    0  0 32  0
                   99  0  0 32
                    0 99  0  0
                    0  0 99  0
                    0  0  0 32
                    0  0  0  0
                    0  0  0  0
                    0  0  0  0]
Z!c      % Convert from sparse to full, and then to char. Character 0 is
         % displayed as space
         % STACK: ['a   '
                   ' a  '
                   '  a '
                   'b  a'
                   ' b  '
                   '    '
                   'c   '
                   ' c  '
                   '  c '
                   '    '
                   '    '
                   '    '
                   '    ']
Z{       % Split into cell array, with each row in a cell
         % STACK: {'a   ', ' a  ', '  a ', 'b  a', ' b  ', '    ', 'c   ', ' c  ', '  c ', '   ', '   ', '   ', '   '}
Zv       % Deblank: remove trailing space from each string. Implicitly display,
         % each string on a different line. Empty strings do not generate
         % a newline
         % STACK: {'a   ', ' a', '  a', 'b  a', ' b', '', 'c', ' c', '  c', '', '', '', ''}

JavaScript (ES6), 118 109 84 bytes
Takes input as an array of words. Returns an array of arrays of characters.
s=>s.map((w,y)=>[...w].map((c,x)=>(a[p=y*3+x]=a[p]||Array(x).fill(' '))[x]=c),a=[])&&a

Alternative version, 109 bytes
Returns a string.

let f =

s=>s.map((w,y)=>[...w].map((c,x)=>(a[p=y*3+x]=a[p]||Array(x).fill` `)[x]=c),a=[])&&a.map(s=>s.join``).join`
`

console.log(f(["programming", "puzzles", "and", "code", "golf"]))

Japt -Rx, 17 16 13 bytes
Takes input as an array of words. If trailing whitespace on each line were allowed then the last 4 characters could be removed to tie with the Charcoal solution.
yÈmú3)iYçÃmx1

Try it or run all test cases

Explanation
y                 :Transpose
 È                :Map each word at 0-based index Y
  m               :  Map each character
   ú3             :    Right pad with spaces to length 3
     )            :  End mapping
      i           :  Prepend
       Yç         :   Space repeated Y times
         Ã        :End mapping and transpose
          m       :Map
           x1     :  Trim right
                  :Implicitly join with newlines, trim and output

Common Lisp, 673 668 597 bytes
Terrible solution, I know. I'll probably edit this more after some sleep.
(defun f(&rest z)(let((l)(a 0)(s)(o)(b)(c 0))(loop(setf b(length l))(setf l"")(loop for w in z for i from 0 do(if(>(+(length w)(* i 3))c)(setf c(+(length w)(* i 3))))(setf s(+(* i -3)a))(when(and(>= s 0)(< s(length w)))(setf o(format nil"~v@{~a~:*~}"s" "))(if(and(>=(- s 3)0)(not(equal i(-(length z)1))))(setf o(subseq o(- s 2))))(setf l(concatenate'string o(string(char w s))l)))(when(>= s(length w))(setf l(concatenate'string"   "l))))(if(<=(length l)b)(setf l(concatenate'string(format nil"~v@{~a~:*~}"(- b(length l)-1)" ")l)))(print(string-right-trim" "l))(if(>= b c)(return))(setf a(1+ a)))))

Usage:
* (f "ppcg" "is" "pretty" "ok")

"p"
" p"
"  c"
"i  g"
" s"
""
"p"
" r"
"  e"
"o  t"
" k  t"
"     y"
""
NIL

This loops over every word in the provided list and adds appropriate characters to the current line. Appropriate padding is provided by my subpar usage of format.
Note: I'm new to Common Lisp, but I know enough to realize that this could use a lot of improvement.

:( "ppcg ... ok"!?

Python 2, 146 bytes
s=input()
k=max(map(len,s))
a=[k*[' ']for x in range(k+len(s)*3+3)]
for x in range(len(s)):
 for y in range(len(s[x])):a[x*3+y][y]=s[x][y]
print a

Note: the indentations for the last two lines are <space> and <tab>, which saves one byte since I don't need to double-indent.
Input is to be entered as an array of strings like so: ["hello", "world"] or ['hello', 'world']. Output is an array of arrays of characters.
There's probably a better way to do this...
EDIT Thanks to Doorknob for pointing out a missing close square bracket. I placed it before the *k... in the third line.

There's a syntax error in your code on the third line; there's two open brackets but only one close bracket. However I fix it (either by adding an extra closing bracket or removing the extra opening bracket), the program gives an error when run.

This now appears to output trailing whitespace at the ends of lines and at the end of the output, which is not allowed by the challenge specification.

trivial golfs

@LeakyNun Thanks. Are you just going through and golfing all of my answers? :P

C#, 336 Bytes:
Golfed:
string D(string[]s){int x=0,y=0,r=0,q=2*(s.Max().Length+s.Length)+1;var a=new char[q, q];for(int i=0;i<s.Length;i++){y=r;for(int j=0;j<s[i].Length;j++){a[y,x]=s[i][j];x+=1;y+=1;}x=0;r+=3;}var o="";for(x=0;x<q;x++){var t="";for(y=0;y<q;y++)t+=a[x,y];o+=t==string.Join("",Enumerable.Repeat('\0',q))?"":(t.TrimEnd('\0')+"\r\n");}return o;}

Ungolfed:
public string D(string[] s)
{
  int x = 0, y = 0, r = 0, q = 2 * (s.Max().Length + s.Length) + 1;
  var a = new char[q, q];
  for (int i = 0; i < s.Length; i++)
  {
    y = r;
    for (int j = 0; j < s[i].Length; j++)
    {
      a[y, x] = s[i][j];
      x += 1;
      y += 1;
    }
    x = 0;
    r +=3;
  }
  var o = "";
  for (x = 0; x < q; x++)
  {
    var t = "";
    for (y = 0; y < q; y++)
      t += a[x, y];
    o += t == string.Join("", Enumerable.Repeat('\0', q)) ? "" : (t.TrimEnd('\0') + "\r\n");
  }
  return o;
}

Testing:
  var codeGolf = new DrawDiagonalLinesOfText();
  Console.WriteLine(codeGolf.E(new string[] { "programming", "puzzles", "and", "code", "golf" }));
  Console.WriteLine(codeGolf.E(new string[] { "a", "bcd", "efgh", "i", "j" }));
  Console.WriteLine(codeGolf.E(new string[] { "verylongword", "short" }));

p
 r
  o
p  g
 u  r
  z  a
a  z  m
 n  l  m
  d  e  i
c     s  n
 o        g
  d
g  e
 o
  l
   f

a
b
 c
  d
e
 f
  g
i  h
j

v
 e
  r
s  y
 h  l
  o  o
   r  n
    t  g
        w
         o
          r
           d

This appears to output trailing whitespace at the ends of lines, which is not allowed by the challenge specification. Also, requiring strings of spaces to separate the words in the input array is not an allowed input format.

@Doorknob Oops, sorry... Fixed, only cost me 2 Bytes :)

Compile to a Func<string[], string> and make various other changes for 297 bytes s=>{int i=0,x=0,y=0,r=0,l=s.Length,q=2*(s.Max().Length+l)+1,j;var a=new char[q,q];for(;i<l;i++){y=r;for(j=0;j<s[i].Length;)a[y++,x++]=s[i][j++];x=0;r+=3;}var o="";for(;x<q;x++){var t="";for(y=0;y<q;)t+=a[x,y++];o+=t==string.Join("",Enumerable.Repeat('\0',q))?"":(t.TrimEnd('\0')+"\n");}return o;}; however you need to add 18 bytes for using System.Linq;

@TheLethalCoder Thanks, but I don't really want to take your entire solution :)

It's not mine its yours I just golfed some of the stuff away i.e. moving thwe i and j to the int declaration at the top and moving some of the ++ so they are used on the last use of the variable

Charcoal, 18 11 bytes
16 9 bytes if trailing whitespaces were allowed: try it online.
ＵＴＷＳ«Ｐ↘ιＭ³↓

My first Charcoal answer. Thanks to @DLosc for suggestion Ｐ and Ｍ instead of using Ｓ and Ｊ (Jump) to go back to the start of the line (and three down).
Try it online (verbose) or Try it online (pure).
Explanation:
Disable trailing spaces in the output:
ToggleTrim();
ＵＴ

Loop while there is still a next input-string:
While(InputString()){ ... }
ＷＳ« ...

Print this string without moving the cursor in a down-right direction:
Multiprint(:DownRight, i);
Ｐ↘ι

And then move three positions down for the next iteration:
Move(3, :Down);
Ｍ³↓

When the challenge needs a single input consisting of an array, Charcoal fails as it splits the input string taking every single word as a separate input. But in Charcoal the θ variable represents the first input, so I just assign the test input to that variable in the header and then write the rest of the code, so you can get rid of the α variable and iterate over the splitted items of θ. Try it online! (Non-competing due to leading spaces.)

At least, nobody complained when I used that trick here. :-)

@CarlosAlejo I indeed came across your answer when I was looking for inspiration on existing Charcoal answers. :)

IDK, the method I usually use is just strings + empty string at the end, if any are multiline then input as a python array

@CarlosAlejo It's been a while, but I've just used multiple lines now with an empty line to break the while (and golfed 7 bytes at the same time). Saw it being used in one of Neil's answers, and I now see ASCII-only suggested the same thing (somehow missed that comment).

Vyxal, 21 bytes
ʁ2꘍∑374f?vLz4jø^↵vøR⁋

Try it Online!
              ø^      # Using the canvas, draw...
ʁ                     # Text: Palindromise each
 2꘍                   # Append two spaces to each
   ∑                  # Concatenate into a single string
    374f              # Directions: [3, 7, 4] - down-left, up-right, down
        ?vL           # Lengths: Lengths of each word in input
           z          # Zip with self
            4j        # Join with 4s
                ↵vøR⁋ # Strip trailing whitespace (ugh)

"Leading or trailing whitespace is not allowed, except for a single trailing newline."

q/kdb+, 130 109 94 90 86 84 bytes
Solution:
f:{-1(+)a rtrim(til(#)E){raze(x#" "),y,\:"  "}'E:(+)(a:{(max(#:)each x)$x})" "vs x;}

Examples:
q)f "programming puzzles and code golf"
p
 r
  o
p  g
 u  r
  z  a
a  z  m
 n  l  m
  d  e  i
c     s  n
 o        g
  d
g  e
 o
  l
   f
q)f "a bcd efgh i j"
a

b
 c
  d
e
 f
  g
i  h

j
q)f (),"x"
x
q)f "verylongword short"
v
 e
  r
s  y
 h  l
  o  o
   r  n
    t  g
        w
         o
          r
           d

Explanation (ungolfed):
The basic gist is to create a bunch of equal length strings from the input string, flip (rotate) them, then add appropriate whitespace to get something that looks like this:
"p  p  a  c  g   "
" r  u  n  o  o  "
"  o  z  d  d  l "
"   g  z     e  f"
"    r  l        "
"     a  e       "
"      m  s      "
"       m        "
"        i       "
"         n      "
"          g     "

which is flipped again, and printed to stdout.
Here's a line-by-line breakdown of the concept:
A:"programming puzzles and code golf"; // original input
B:" " vs A;                            // split on " "
C:max count each B;                    // find length of the longest string
D:C$B;                                 // pad each string to this length
E:flip D;                              // flip (rotate) string
F:{raze(x#" "),y,\:"  "};              // appends each char with "  " and prepends an increasing number of " "
G:(til count E)F'E;                    // execute function F with each pair of 0..n and item in list E
H:max count each rtrim G;              // find longest string (ignoring right whitespace)
I:H$G;                                 // pad each of the strings to this length
J:flip I;                              // flip to get result
-1 J;                                  // print to stdout, swallow return value

Notes:
A few ways to shave off some (11) easy bytes if we really wanted to:

Could save 2 bytes by dropping the f: and leaving as an anonymous function
Could save 3 bytes by dropping the -1 and ; and returning a list of strings rather than printing to stdout
Could save 6 bytes if we passed in a list of strings rather than space-separated string

Edits:

-11 bytes, use rtrim to find max length to pad, removed need for storing C variable
-15 bytes, switching out the max count each for a lambda function a which is created once and used twice
-4 bytes, moving the raze into the lambda function to save a raze each
-4 bytes, simplified the core lambda function that adds the whitespace
-2 bytes, use (+) as shorthand for flip

Mathematica, 146 bytes
P=PadRight;T=Transpose;R=Riffle;Select[Rest@T@P@MapIndexed[""~Table~#2~Join~#1&,T@P@R[Characters/@#~R~{},{},3]]//.{0->"",{x__,""}->{x}},#!={""}&]&

I'm disappointed by this bytecount, but oh well.
Defines an anonymous function that takes a list of words (e.g. {"this","that","these"}) and returns a two-dimensional array of characters. To view in grid form, add a //Grid at the end.
Converts the strings to an array, adds extra lines, transposes the array, prepends the necessary shifts, then transposes again.
Example result (formatted as grid):

Jelly, 24 bytes
z⁶j€⁾  µJ’⁶ẋ;"z⁶œr€⁶Yœr⁷

Try it online!
How?
z⁶j€⁾  µJ’⁶ẋ;"z⁶œr€⁶Yœr⁷ - Main link: a list of strings
z                        - transpose with filler...
 ⁶                       -     space character
  j€                     - join €ach with
    ⁾                    -     two spaces
       µ                 - monadic chain separation, call the result x
        J                - range(length(x)) [1,2,...,x]
         ’               - decrement (vectorises) [0,1,...x-1]
           ẋ             - repeat (vectorises)
          ⁶              - a space ['', ' ',...,'x spaces']
             "           - zip with
            ;            - concatenation (prefixes with the space strings)
              z          - transpose with filler...
               ⁶         -     space character
                œr€⁶     - trim spaces from the right of €ach
                    Y    - join with line feeds
                     œr⁷ - trim line feeds from the right
                         - implicit print

Python 2, 182 bytes
def f(s):
 M=max(map(len,s));p=' '*M;L=[p]+s+M*[p];r='';k=0
 while k/M<len(s)*3+M:
  i=k%M;w=k/M-i+1;r+=(L[(w/3+1)*(w%3==1)]+p)[i];k+=1
  if i==M-1:r=r.rstrip()+'\n'
 return r.strip()

A bit long, but on the positive side, it returns a string with no trailing white space on each line, and no trailing white space or returns at the end; constraints that some other entries don't obey.
A list of words is passed into the function; some 'blanks' are aded to this list and then the algorithm maps a row,column pair to a wordNumber, characterNumber in the expanded list. (This is a bit of the inverse of the usual strategy seen in other solutions).
If we allow trailing white space on all lines except the last, we can do a bit better (163 bytes):
def f(s):
 M=max(map(len,s));p=' '*M;L=[p]+s+M*[p];r='';k=0
 while k/M<len(s)*3+M:i=k%M;w=k/M-i+1;r+=(L[(w/3+1)*(w%3==1)]+p)[i]+'\n'*(i==M-1);k+=1
 return r.strip()

K4, 58 bytes
Solution:
+(|/{0+/|\|~^x}@'x)$x:(2-(!c)+3*#x)$"  "/:'$+(c:|/#:'x)$x:

Examples:
q)k)+(|/{0+/|\|~^x}@'x)$x:(2-(!c)+3*#x)$"  "/:'$+(c:|/#:'x)$x:("programming";"puzzles";"and";"code";"golf")
"p          "
" r         "
"  o        "
"p  g       "
" u  r      "
"  z  a     "
"a  z  m    "
" n  l  m   "
"  d  e  i  "
"c     s  n "
" o        g"
"  d        "
"g  e       "
" o         "
"  l        "
"   f       "
q)k)+(|/{0+/|\|~^x}@'x)$x:(2-(!c)+3*#x)$"  "/:'$+(c:|/#:'x)$x:(,"a";"bcd";"efgh";,"i";,"j")
"a   "
"    "
"    "
"b   "
" c  "
"  d "
"e   "
" f  "
"  g "
"i  h"
"    "
"    "
"j   "
q)k)+(|/{0+/|\|~^x}@'x)$x:(2-(!c)+3*#x)$"  "/:'$+(c:|/#:'x)$x:("verylongword";"short")
"v           "
" e          "
"  r         "
"s  y        "
" h  l       "
"  o  o      "
"   r  n     "
"    t  g    "
"        w   "
"         o  "
"          r "
"           d"

Explanation:
Right-pad strings so they are the same length, transpose, join with "  ", left-pad to generate diagonals, then right-pad to correct lengths and transpose back. Takes a list of strings and returns a list of strings. Probably golfable but still shorter than my q/kdb+ solution.
+(|/{0+/|\|~^x}@'x)$x:(2-(!c)+3*#x)$"  "/:'$+(c:|/#:'x)$x:
                                                        x:      / save as variable x
                                                       $        / pad
                                             (        )         / do this together
                                                  #:'x          / count (#:) each (') x
                                                |/              / max
                                              c:                / save as variable c
                                            +                   / flip / transpose
                                           $                    / string ($)
                                    "  "/:'                     / join each with "  "
                                   $                            / pad
                      (           )                             / do this together
                                #x                              / count (#) x
                              3*                                / multiply by 3
                             +                                  / add to
                         (  )                                   / do this together
                          !c                                    / range 0..c
                       2-                                       / subtract from 2
                    x:                                          / save as x:
                   $                                            / pad
 (                )                                             / do all this together
    {         }@'x                                              / apply (@) lambda {} to each x
            ^x                                                  / null (^) x (" " is considered null)
           ~                                                    / not
          |                                                     / reverse
        |\                                                      / max (|) scan (\), maxs
     0+/                                                        / sum (+) over (/) starting with 0
  |/                                                            / max (|) over (/), max
+                                                               / transpose

05AB1E, 17 bytes
12 bytes if trailing whitespaces were allowed: try it online.
ζε2úíJNúS}ζJðδÜõÜ

Port of @Shaggy's Japt answer.
Input as a list of list of characters; output as a list of lines.
Try it online.
More interesting answer using the Canvas builtin (27 25 bytes):
20 19 bytes if trailing whitespaces were allowed: try it online.
€gDø4.ý˜I€ûðºý374S.Λ¶¡ðδÜ

-2 bytes thanks to @emanresuA.
Input as a list of words; output as a list of lines.
Try it online.
Explanation:
ζ         # Zip/transpose; swapping rows/columns of the (implicit) input-list of lists
          # of characters, with a space " " as filler for shorter lists
 ε        # Map over each inner lists of characters:
  2ú      #  Pad each inner character with 2 leading spaces
    í     #  Reverse each inner string, so the spaces are trailing
     J    #  Join this list together to a single string
      Nú  #  Pad the 0-based map-index amount of leading spaces
        S #  Convert the string back to a list of characters
 }ζ       # After the map: Zip/transpose back again with " " filler
   J      # Join each inner list together to a single string
     δ    # Map over each inner line:
    ð Ü   #  Trim trailing spaces
       õÜ # Trim trailing empty strings from the list
          # (after which the list of lines is output implicitly)

€gDø4.ý˜I€ûðºý374S.Λ¶¡ðδÜ

€g        # Get the length of each word of the (implicit) input-list
  Dø      # Convert each value to a pair of this value with a Duplicate + Zip/transpose
    4.ý   # Intersperse this list of pairs with 4 as delimiter
       ˜  # Flatten it to a single list
I         # Push the input-list of words again
 €û       # Palindromize each word
   ðºý    # Join this list with "  " (2 spaces) delimiter
ŽDā       # Push 374
   S      # Convert it to a list of digits: [3,7,4]
.Λ        # Use the modifiable Canvas builtin with these three arguments
  ¶¡      # Split it on newlines
     δ    # Map over each inner line:
    ð Ü   #  Trim trailing spaces
          # (after which the list of lines is output implicitly)

Additional information about the Canvas builtin Λ/.Λ:
It takes 3 arguments to draw an ASCII shape:

Length of the lines we want to draw
Character/string to draw
The direction to draw in, where each digit represents a certain direction:

7   0   1
  ↖ ↑ ↗
6 ← X → 2
  ↙ ↓ ↘
5   4   3

€gDø4.ý˜I€ûðºý374S creates the following Canvas arguments:

Lengths (€gDø4.ý˜): e.g. [11,11,4,7,7,4,3,3,4,4,4,4,4,4] for input ["programming","puzzles","and","code","golf"]
Characters (I€ûðºý): e.g. "programmingnimmargorp  puzzleselzzup  andna  codedoc  golflog" for input ["programming","puzzles","and","code","golf"]
Directions (374S): [3,7,4], which translates to \$[↘,↖,↓]\$

Because we have a list of lengths, those are leading here.
Step 1: Draw 11 characters ("programming") in direction 3 (\$↘\$):
p
 r
  o
   g
    r
     a
      m
       m
        i
         n
          g

Step 2: Draw 11-1 characters ("nimmargorp") in direction 7 (\$↖\$):
p
 r
  o
   g
    r
     a
      m
       m
        i
         n
          g

Step 3: Draw 4-1 characters ("  p") in direction 4 (\$↓\$):
p
 r
p o
   g
    r
     a
      m
       m
        i
         n
          g

Step 4: Draw 7-1 characters ("uzzles") in direction 3 (\$↘\$):
p
 r
p o
 u g
  z r
   z a
    l m
     e m
      s i
         n
          g

etc.
See this 05AB1E tip of mine for an in-depth explanation of the Canvas builtin.
€gDø4.ý˜ could alternatively be εgD4)}˜¨ or €gDø€4¦˜, but I've been unable to find anything shorter.

Porting my vyxal answer for the canvas one might help (I use [3, 7, 4], palindromise every word and join by double spaces)

@emanresuA Thanks, that indeed saves 2 bytes for the Canvas program. :) (PS: You might be able to save some bytes yourself by also porting Shaggy's Japt answer.)

Perl 6, 73 bytes
{my@t;for .kv ->\i,\w{for w.comb.kv {@t[3*i+$^a][$^a]=$^b}};@t »||»" "}

Try it online!
The input argument is a list of words.  The output is an array of array of characters.

PHP, 100 bytes
<?foreach($_GET as$k=>$v)for($x=0;$y=$v[$x];$t[$x++]=$y)($t=&$s[$k*3+$x])?:$t=" ";echo join("
",$s);

Try it online!

J, 54 bytes
[:+/@,:&.(_32+3&u:)&.>/]({.-@#\<@{."0])&>~#&>-@+3*i.@#

Try it online!
This was a surprisingly good challenge -- deceptively simple but with a lot of depth, and many paths to a solution.  Normally I dislike "no trailing whitespace" constraints, but here it was key to the problem's complexity.
After many different approaches, I finally found one which feels like it works with J rather than against it.  I will add a detailed explanation another time.
Note: This returns a boxed list of lines, but in the TIO I open and echo each box so that correctness is easier to see.

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:
Polygonal Numbers!
Introduction

In mathematics, a polygonal number is a number represented as dots or pebbles arranged in the shape of a regular polygon. The dots are thought of as alphas (units). These are one type of 2-dimensional figurate numbers.
The number 10, for example, can be arranged as a triangle:
*
**
***
****

But 10 cannot be arranged as a square. The number 9, on the other hand, can be:
***
***
***

Some numbers, like 36, can be arranged both as a square and as a triangle:
******  *
******  **
******  ***
******  ****
******  *****
******  ******

By convention, 1 is the first polygonal number for any number of sides. The rule for enlarging the polygon to the next size is to extend two adjacent arms by one point and to then add the required extra sides between those points. In the following diagrams, each extra layer is shown as in red.
Triangular Numbers:

Square Numbers:

Polygons with higher numbers of sides, such as pentagons and hexagons, can also be constructed according to this rule, although the dots will no longer form a perfectly regular lattice like above.
Pentagonal Numbers:

Hexagonal Numbers:

Source: Wikipedia
Your task
Given a positive integer N (1 <= N <= 1000), print every type of Polygonal Number N is starting from Triangular Numbers up to and including Icosagonal (20-gon) Numbers.
For example, the number 10 is a triangular number and a decagonal number, so the output should be something like (you can choose your own output format, but it should look somewhat like this):
3 10

Test cases
1 -> 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
2 -> (None)
3 -> 3
6 -> 3 6
36 -> 3 4 13

For reference, the n-th k-gonal number is:

Credit: xnor
Remember, this is code-golf, so the code with the fewest bytes wins.

For reference, the nth k-gonal number is (k-2)*n*(n-1)/2 + n.

The point of the sandbox is to improve questions. If you post a question in the sandbox and discover that it's not clear what you're asking, the correct response is not to add a comment in the sandbox, wait two hours, and then post the question to main unmodified and delete the sandbox question, hiding the explicatory comment from people with less than a couple of thousand rep. The correct response is to rephrase or ask for suggestions for rephrasing, and give it another day or two to see whether the rephrased question still has problems.

Python 3, 68 bytes
lambda R:[s+2for s in range(1,19)if(s-2+(4+s*(s-4+8*R))**.5)/2%s==0]

For each potential number of sides s+2, solves the quadratic formula R=s*n*(n-1)/2 + n for n to see if the result is a whole number.
Compare (73 bytes):
lambda R:[s+2for s in range(1,19)if R in[n+s*n*~-n/2for n in range(R+1)]]

An alternative approach of solving for s gives 62 bytes in Python 3, but fails on R=1.
lambda R:{(R-n)*2/n/~-n+2for n in range(2,R+1)}&{*range(3,21)}

JavaScript (ES6), 90 bytes
n=>[...Array(21).keys(n--)].slice(3).filter(i=>(Math.sqrt(i*i+8*i*n-16*n)+i-4)%(i+i-4)==0)

Solves the quadratic equation. 73 bytes on new enough versions of Firefox:
n=>[for(i of Array(18).keys())if(((~-i**2+8*n*-~i)**.5+~-i)/2%-~i==0)i+3]

Axiom 203 bytes
 l(x)==(local q,m,a;v:List INT:=[];for i in 3..20 repeat(q:=solve((i-2)*n*(n-1)+2*n-2*x=0,n);if #q>1 then(m:=rhs q.1;a:=rhs q.2;if(m>0 and denom(m)=1)or(a>0 and denom(a)=1)then v:=cons(i,v)));v:=sort v;v)

here is less golfed and routine that show numbers
 l(x)==
  local q,m,a
  v:List INT:=[]
  for i in 3..20 repeat
     q:=solve((i-2)*n*(n-1)+2*n-2*x=0,n)  -- this would find only rational solutions as r/s with r,s INT
     if #q>1 then -- if exist rational solution and denominator =1=> add to list of result
        m:=rhs q.1;a:=rhs q.2;
        if(m>0 and denom(m)=1)or(a>0 and denom(a)=1)then v:=cons(i,v)
  v:=sort v
  v

 (2) ->  [[i,l(i)]  for i in 1..45]
    Compiling function l with type PositiveInteger -> List Integer

    (2)
    [[1,[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]], [2,[]], [3,[3]],
     [4,[4]], [5,[5]], [6,[3,6]], [7,[7]], [8,[8]], [9,[4,9]], [10,[3,10]],
     [11,[11]], [12,[5,12]], [13,[13]], [14,[14]], [15,[3,6,15]], [16,[4,16]],
     [17,[17]], [18,[7,18]], [19,[19]], [20,[20]], [21,[3,8]], [22,[5]],
     [23,[]], [24,[9]], [25,[4]], [26,[]], [27,[10]], [28,[3,6]], [29,[]],
     [30,[11]], [31,[]], [32,[]], [33,[12]], [34,[7]], [35,[5]], [36,[3,4,13]],
     [37,[]], [38,[]], [39,[14]], [40,[8]], [41,[]], [42,[15]], [43,[]],
     [44,[]], [45,[3,6,16]]]
                                                           Type: List List Any

><>, 62 + 3 = 65 bytes
&1v
v0<;?)+8a:+1~~<
1.292:{<>+n}ao^
>:&:&=?^:&:&)?^:@:@$-{:}++

Expects the input at the top of the stack, so +3 bytes for the -v flag.
This is my first time programming in ><>, so I may be missing some obvious tricks to shorten the code.
Explanation:
Initialization
&1v
v0<
1

Moves N to the register, pushes the counter to the stack (starting at 1, which corresponds to triangular numbers), and starts the sequence with the values 0 and 1.
Main Loop
 :&:&=?^:&:&)?^:@:@$-{:}++

Compares the top of the stack with the register. If it is equal, go to the print routine. If it is greater, go to the reset routine. Otherwise take the difference between the top two stack items, add the counter, and add to the previous top stack item. This calculates the next polygonal number.
Print
 .292:{<>+n}ao^
       ^

Prints the counter + 2, followed by a newline, then moves to the reset routine.
Reset
v0<;?)+8a:+1~~<
1             ^

Removes the top two stack items and increments the counter. Ends the program if the counter is greater than 18, otherwise pushes the starting numbers 0 and 1 to the stack and returns to the main loop.

Jelly, 22 bytes
18pȷµḢ×’×H+µ€_³¬FT:ȷ+3

Try it online!
Explanation
18pȷµḢ×’×H+µ€_³¬FT:ȷ+3
18pȷ                   - All possible (k-2,n) pairs
    µ      µ€          - to each pair compute the corresponding polygonal number:
     Ḣ                 -   retrieve k-2
      ×’               -   multiply by n-1
        ×H             -   multiply by half of n
          +            -   add n
             _³        - subtract the input. There will now be 0's at (k-2,n) pairs which produce the input
               ¬FT     - retrieve all indices of 0's. The indices are now (k-2)*1000+n
                  :ȷ   - floor division by 1000, returning k-3
                    +3 - add 3 to get all possible k.

AWK, 67 bytes
{for(k=2;++k<21;)for(n=0;++n<=$1;)if((k/2-1)*(n*n-n)+n==$1)print k}

Try it online!
I tried actually solving the quadratic, but checking each value to see if it works is shorter (and less error-prone for me)

R, 68 66 bytes
N=scan();m=expand.grid(k=1:18,1:N);n=m$V;m$k[m$k*n*(n-1)/2+n==N]+2

Reads N from stdin. Computes the first N k-gonal numbers and gets the k where they equal N, using xnor's formula; however, saves bytes on parentheses by using 1:18 instead of 3:20 and adding 2 at the end.
expand.grid by default names the columns Var1, Var2, ..., if a name is not given. $ indexes by partial matching, so m$V corresponds to m$Var2, the second column.
old version:
N=scan();m=expand.grid(k=3:20,1:N);n=m$V;m$k[(m$k-2)*n*(n-1)/2+n==N]

Try it online!

Pari/GP, 34 bytes
Pari/GP has a built-in to test whether a number is a polygonal number.
x->[s|s<-[3..20],ispolygonal(x,s)]

Try it online!

Jelly, 20 bytes
I just started writing an effective dupe of this challenge (albeit covering all k>1 not just [1,20]) ...so instead I'll answer it!
Ṫð’××H+⁸
18pÇċ¥Ðf⁸+2

A full program printing a Jelly list representation of the results*
Try it online!
* No results prints nothing;
  a single result prints just that number;
  multiple results prints a [] enclosed, ,  separated list of the numbers
How?
Ṫð’××H+⁸ - Link 1, ith (x+2)-gonal number: list [x,i]   e.g. [3,4] (for 4th Pentagonal)
Ṫ        - tail & modify (i.e. yield i & make input [x])     4
 ð       - new dyadic chain, i.e. left = i, right = [x]
  ’      - decrement i                                       3
   ×     - multiply by [x]                                   [9]
     H   - halve [x]                                         [2]
    ×    - multiply                                          [18]
       ⁸ - chain's left argument, i                          4
      +  - add                                               [22]

18pÇċ¥Ðf⁸+2 - Main link: number, n                      e.g. 36
18p         - Cartesian product of range [1,18] with n       [[1,1],[1,2],...,[1,36],[2,1],...,[18,1],[18,2],[18,36]]
            -   (all pairs of [(k-2),i] which could result in the ith k-gonal number being n)
      Ðf    - filter keep if this is truthy:
        ⁸   -   chain's left argument, n                     36
     ¥      -   last two links as a dyad:
   Ç        -     call the last link as a monad (note this removes the tail of each)
    ċ       -     count (this is 1 if the result is [n] and 0 otherwise)
            -                            filter keep result: [[1],[2],[11]]
         +2 - add two                                        [[3],[4],[13]]
            - implicit print ...due to Jelly representation: [3, 4, 13]