text:
A Quine on Every Line
Your goal is to create a program that prints itself indefinitely, with a new line after each one. Thus, if your program is a one-liner, it would be repeated on every line of the output.
Example
Program:
A

Output:
A
A
A
...

Rules

It must be a complete program, not a snippet or function.
The program should loop forever without stack-overflow or recursion limit errors.
Output is to stdout or closest alternative.
No program input is accepted.
Standard loopholes are disallowed, such as opening the program's file or accessing an external resource. Empty programs are disallowed as a standard loophole.
If your program code ends with a trailing newline, this does not count as the necessary newline between quines, and you must print another.
codegolf - Shortest code wins!

The title looks like only one-line programs qualify?

@PaŭloEbermann Then read the problem description. It's a witty title because it rhymes. Here's an example of a valid multi-line program: http://codegolf.stackexchange.com/a/57985/34718 . You can't expect to know everything about a challenge by only reading the title.

@PaŭloEbermann It's just while(1)println(your_code);

Fission, 7 bytes
'!+!NR"

A rather simple modification of the shortest Fission quine I have found so far: I'm simply using the non-destructive ! instead of O and added an N for newline.
So all in all, here is how it works: control flow starts at the R with a right-going atom. " toggles string mode, which means everything until the next " is printed: in this case '!+!NR. That leaves the " and the newline to be printed. '! sets the atom's mass to 33, + increments it to 34 (the character code of ") and ! prints the quote. N prints a newline, and R is now a no-op in this case, so the loop starts over.
The following 7-byte solution also works:
"NR'!+!

><>, 16 bytes
'ard3*o50l2)?.~~

The traditional ><> quine uses too many os, so we use a loop for printing. Before each jump we push 5 and 0 (the coordinates of where to jump to), after which we either jump with . if there's still something to print, or pops the top two values with ~~.
(Reverted to the 16 version since I forgot about the stack overflow rule.)

An alternative is "ar00go50l2)?.[, right?

@mbomb007 I guess, but I prefer d3* since g reads your own source code

CJam, 13 bytes
{_o"_g
"o1}_g

The online interpreter doesn't print anything before the program terminates, so you'll have to test this in the Java interpreter.
Explanation
Finally a generalised CJam quine which doesn't end in _~.
{_o"_g
"o1}

This simply pushes a block. _g duplicates the block and executes it repeatedly while the top of the stack is truthy (discarding the condition).
Now inside the block, the other copy of the block is still on the stack. We duplicate and print it with _o and then we print _g followed by a newline (the required extra newline between quines) with "_g\n"o. Finally we push a 1 onto the stack for the loop to repeat, because unfortunately, blocks aren't truthy (or falsy) in CJam.

Python 2, 39
Not a very interesting task in Python as it's trivial to add the while loop to a normal quine.
c='while 2:print"c=%r;exec c"%c';exec c

Doesn't this blow the stack?

@JesanFafon No, if you tried it you would see that it doesn't. There is no recursion.

Perl 5.10+, 40 37 bytes
$_=q{say"\$_=q{$_};eval"while 1};eval

or (also 37 bytes)
$_=q{{say"\$_=q{$_};eval";redo}};eval

Invoke with the -M5.010 or -E command line flag, e.g.
$ perl -E '$_=q{say"\$_=q{$_};eval"while 1};eval'
$_=q{say"\$_=q{$_};eval"while 1};eval
$_=q{say"\$_=q{$_};eval"while 1};eval
$_=q{say"\$_=q{$_};eval"while 1};eval
...

Thanks to Ilmari Karonen for shaving off 3 bytes from my original solution, which was:
eval while$_=q{say"eval while\$_=q{$_}"}

This, as well as the shorter 37-byte solutions above, are all simple variations of the following quine, which I first saw in one of Ilmari's other posts:
$_=q{say"\$_=q{$_};eval"};eval

Since all I added in my original solution was a while loop, he really deserves most of the credit. :-)

Nice, and thanks for the credit. :-) The original quine is my own design, although someone else may well have independently discovered it earlier. BTW, $_=q{say"\$_=q{$_};eval"while 1};eval or $_=q{{say"\$_=q{$_};eval";redo}};eval would be a few bytes shorter. ($_=q{say"\$_=q{$_};eval";eval};eval would be even shorter yet, but I suspect it will eventually run out of stack.)

I was hoping you would show up! Thank you for the shorter solutions, I figured you would come up with something better; but I was so blown away by this when I saw it in the answer I linked to, I just had to try it myself. :) To be honest, I still haven't quite wrapped my head around quines, but the additional answers give me more to look at. I wasn't sure if you originated this because I saw you credited with the shortest non-cheating Perl quine ever(?!) on this page, but there's no attribution for this quine (using print instead of say).

btw, the last one does indeed segfault after running for a while. Thanks again, @Ilmari!

Actually, I take that somewhat back -- I'm definitely not the first to invent that quine, and since I'd definitely seen it before (I posted the one I do claim some credit for in the same thread), it's quite likely that I subconsciously remembered it from that thread, or from somewhere else.

Alright, I've left the origin unspecified. Regardless, thank you for the 3 bytes and thank you for the original inspiration.

Self-modifying Brainf*** (SMBF), 14 bytes
The trailing newline \n needs to be a literal, Unix, newline (ASCII code 10).
[<[<]>[.>]<.]\n

Explanation:
The code moves the pointer to the far left of its source code, then prints it all, including the newline (twice b/c of the rule). The loop continues.

You mean, it has to be \r?

@IsmaelMiguel No. \n is a new line, and is ASCII code 10, so a hex-dump of the source code would have the value 0A for that byte. http://code.cside.com/3rdpage/us/newLine.html

Then that is redundant because ALL newlines are assumed to be \n, unless specified otherwise.

@IsmaelMiguel Not true. When you type code, you actually hit the enter key for a newline. \n generally counts as 2 characters, and 2 bytes in your code. I typed it this way for readability, since the formatting doesn't work well for showing a blank line at the end of my source code. And so I had to specify that it was ONE byte, not two.

\n is always a single character, called a linefeed. A newline, however, is a platform-dependent sequence of bytes.

@Dennis Maybe so, but I don't care. I don't call / a "Solidus", and I don't know anybody who does. "Newline" starts with an n, and that's the escape character, so that's what I call it. It's closer to "line feed" than it is to "carriage return".

PowerShell, 143 Bytes
$d='$d={0}{1}{0}{2}while(1){3}Write($d -f [char]39,$d,"`n",[char]123,[char]125){4}'
while(1){Write($d -f [char]39,$d,"`n",[char]123,[char]125)}

Based off the Rosetta Code PowerShell quine, I'm pretty confident this isn't the shortest possible. String replacement formatting in PowerShell is icky for this, because the same delimiters for where to put the replacements {} also delimit code blocks while{}, so we have to use [char] casting, which bloats the code a bunch.

Underload, 25 bytes
First time I've tried something like this and I'm not sure if follows all the rules as it is a couple of lines.  The newline was a bit of a pain.
(::a~*S:a~*^
)::a~*S:a~*^

@mbomb007 The output per iteration is the two lines of the program.  I tested it here

Befunge, 30 20 bytes
<,+55,*2+98_ #!,#:<"

A variation of a popular befunge quine that prints out a newline and pops -1 on the stack if it finishes the line.
Unfortunately, Befunge gets verbose when doing things in one line.  I tried to remove all of the launchpads (#) that i could, but some had to be left in to skip certain commands (like ,).
Changes:
30-20 -> changed the base quine to a custom one I made that uses string input.  This way, the branching is a lot easier.
Old:
:0g,:93*`>0-10 #,+$#: #5 _1+>

I don't think this is optimal, but it's acceptable for now.

You can use a get instruction to grab a space, and add 2 to it for one byte shorter than 98+2/: <,+55,+2g1_ #!,#:<"

And push the quote and newline first and reverse the printer, -1g0:+5<>:#,_1"

K, 30 bytes
{f:$_f;{x}{`0:f,"[]\n";1}/1}[]

R, 34 bytes
repeat{write(commandArgs()[5],'')}

to invoke from the command line as follows:
Rscript -e "repeat{write(commandArgs()[5],'')}"

><>, 31 29 bytes
A simple modification of the traditional ><> quine.
"ar00gc0.0+efooooooooooooooo|

To run, paste it here, click 'Submit', then 'Start' (running without animation doesn't work). Feel free to increase the execution speed.

"ar00gc0.0+feooooooooooooooo| is two bytes shorter.

@Cole Thanks. I had thought about the mirror, but forgot to change it after getting side-tracked on a different challenge.

20 bytes

@JoKing There's already a shorter ><> solution.

Python 2, 48 bytes
c='c=\'%s\';while 1:print c%c';while 1:print c%c

GolfScript, 16 bytes
{.".do
":n\p}.do

This ended up looking a lot like Martin Büttner's CJam entry.  An interesting feature is that, as it turns out, the shortest way to append ".do" to the block when it's printed is to assign it to the line terminator n.  (Of course, we also need to include an actual newline in the string, to replace the one n normally contains.)  The same string (being truthy in GolfScript) is also left on the stack for the do loop to pop off, ensuring that the loop runs forever.

Brachylog, 16 bytes
∋"∋~kgjẉ₁⊥"gjẉ₁⊥

You can't quite try it online, but I have verified that it works on my installation.
Brachylog, 18 bytes
∋"∋~kgjw₁⊥~n"gjw₁⊥

Try it online!
Adapted from the alternate version of this quine, with a backtracking hack I had initially devised for bogosort of all things. Spends two bytes on ~n because ẉ (the usual means for printing with a trailing newline) hits some odd issues with character encoding on TIO, and an actual newline inserted into the string literal gets printed through ~k as \n.
               w      Print
 "∋~kgjw₁⊥~n"         "∋~kgjw₁⊥~n"
∋                     which is an element of
                      the (unused and unconstrained) input
                ₁     formatted
          ~n          (so that the ~n is replaced with a newline)
             gj       with itself
   ~k                 (so that the ~k is replaced with the string in quotes),
                 ⊥    then try again.

Since w₁ takes input as a list [string to be formatted, formatting arguments], wrapping a string in a list with g then concatenating it to itself with j allows it to be formatted with itself. And since no input is given to the program, the input variable which is implicitly present at the beginning of the program can take on any value, so it can be constrained to one of the infinitely many lists which contain "∋~kgjw₁⊥~n" as an element, creating a single choice point to be backtracked to when after printing its source the program hits ⊥.

Python 3.6, 48 43 bytes.
-5 bytes thanks to @Jo King
x='while 1:print("x=%r;exec(x)"%x)';exec(x)

You can use %r to save on escaping those 's. 43 bytes

which gives 41 for python 3.8 :P

Gol><>, 10 bytes
"r2sslRoao

Try it online!
This can probably be golfed down more

BASH, 76 bytes
Just couldn't resist, especially with PowerShell here :)
while true;do
a ()
{
    echo while true\;do
    declare -f a
    echo a\;done
}
a;done

The whitespace is important for an EXACT copy.

Batch, 10 (+ 4 for filename length)
Not sure if this qualifies for two reasons:

Technically, there may or may not be textual side effects from the Windows command shell, as that depends on how it is configured.
This program invokes itself by name, and I am not sure whether that's prohibited by the rules (specifically the "no opening of program file" rule). It is not opening itself for the purposes of reading and printing out the text; it is simply re-running itself. Further, the file system structure is an integral part of old-school batch scripts (oftentimes even being used to store program state, etc). As such, I am not sure whether this violates the 5th rule or not.

The code (for a program named q.bat):
echo on&&q

Hmm, I'm not sure. Does it print it forever to the same output stream?

@mbomb007 Yup...

I get I'll allow it since it's not the shortest, and it's creative and unique. And it wasn't reading the source code, but rather executing itself.

Since the file name is not arbitrary, at the very least you should add the file name to the byte count.

I believe you could use echo on&&%0 although I'm afraid to try it.

Update: echo on&&%0 does not work. %0 is displayed as expanded in the output, and windows (7, 32 bit, running in a VM) terminates the entire thing pretty quickly.

@DankMemes Haha yes, that was the first thing I tried :)

I think you can omit the .bat part

@SuperJedi224 Right! Thanks for that

Javascript (ES6), 64
for(;;(_=>console.log(`for(;;(_=>${arguments.callee})());`))());

Alternatively (also 64)
a="for(;;)console.log(`a=${JSON.stringify(a)};eval(a)`)";eval(a)

Wouldn't the alternative cause a stack overflow?

No. There is no recursion so nothing should be adding up on the stack.

Okay, well I just tested both of them, you are correct about the alternative solution, but your first solution fails and I figured out why. According the MDN documentation on arrow functions, "Arrow functions do not expose an arguments object to their code" so your arguments.callee does not exist and throws an error.

Interesting. For me in Firefox Developer Edition 42.0a2 (2015-09-13), both work. I guess once the standard is fully adopted the first one will stop working.

I tested them on latest chrome since I was trying to golf your first solution with ! instead of enclosing parentheses and putting the function execution after the for loop to avoid the need for the for loop semicolon body which would save (I think) 4 bytes

Microscript, 22 bytes
"f1{CqxCanx"f1{CqxCanx

Based on the quine from the Esolangs article: "fCqxah"fCqxah. Exploits the fact that the language autoappends closing braces as needed, without which this would be two bytes longer.

Ceylon, 210 208 bytes
Of course this won't win anything...
shared void u(){value q="\"\"\"";value t="""shared void u(){value q="\"\"\"";value t=""";value b="""while(1<2){print(t+q+t+q+";value b="+q+b+q+";"+b);}}""";while(1<2){print(t+q+t+q+";value b="+q+b+q+";"+b);}}

Original:
shared void u(){value q="\"\"\"";value t="""shared void u(){value q="\"\"\"";value t=""";value b="""while(true){print(t+q+t+q+";value b="+q+b+q+";"+b);}}""";while(true){print(t+q+t+q+";value b="+q+b+q+";"+b);}}
I modified my Quine from two days ago by adding the while(true){...} loop, so I come from the 185 bytes of the plain Quine to 210 (I don't need the trailing new line character anymore). But then I found that a while(1<2){...} loop is even two bytes shorter:
shared void u(){value q="\"\"\"";value t="""shared void u(){value q="\"\"\"";value t=""";value b="""while(1<2){print(t+q+t+q+";value b="+q+b+q+";"+b);}}""";while(1<2){print(t+q+t+q+";value b="+q+b+q+";"+b);}}
(Ceylon has no for(;;) loop like Java, and the braces are also needed for this loop.)

PowerShell, 132 107 Bytes
$a='$a={0}{1}{0};for(){2}$a-f[char]39,$a,[char]123,[char]125{3}';for(){$a-f[char]39,$a,[char]123,[char]125}

Based off of the Rosetta Quine (Same as @AdmBorkBork) although doesn't use formatting for string replacement... maybe switching to a for loop and using formatting would be best?
I'm sure if AdmBorkBork came back they would beat this by a lot :P
EDIT Figured out the for loop and replacements, all thanks to my predecessor :)
Old attempt:
$a='$a=;for(){$a.substring(0,3)+[char]39+$a+[char]39+$a.substring(3)}';for(){$a.substring(0,3)+[char]39+$a+[char]39+$a.substring(3)}

Ruby, 41 39 bytes
A modification of one of the Ruby quines found here.
_="_=%p;loop{puts _%%_}";loop{puts _%_}

Java 10, 194 bytes
interface M{static void main(String[]a){for(var s="interface M{static void main(String[]a){for(var s=%c%s%1$c;;)System.out.println(s.format(s,34,s));}}";;)System.out.println(s.format(s,34,s));}}

Explanation:
Try it online (times out after 60 sec).
interface M{                    // Class
  static void main(String[]a){  //  Mandatory main-method
    for(var s="interface M{static void main(String[]a){for(var s=%c%s%1$c;;)System.out.println(s.format(s,34,s));}}";
                                //   Unformatted source code
        ;)                      //   Loop indefinitely
       System.out.println(      //    Print with trailing new-line:
         s.format(s,34,s));}}   //     The formatted source code

quine-part:

The String s contains the unformatted source code.
%s is used to input this String into itself with the s.format(...).
%c, %1$c and the 34 are used to format the double-quotes.
s.format(s,34,s) puts it all together

Challenge part:

for(;;) is used to loop indefinitely.
System.out.println(...) is used to print with trailing new-line

Funky, 29 bytes
f=@print`f=[f]for)f()`for)f()

Try it online!

RProgN 2, 7 bytes
«]³]]p:

Try it online!

Jelly, 14 bytes
“;@ṾṄṛ¢”;@ṾṄṛ¢

Try it online!

Pyth, 11 bytes
#jN B"#jN B

Try it here!

It works well enough. Just pause execution shortly after running.

Huh, nice! I'll edit that link in.

Keg, 16 bytes
`{④⑩9⑨,}`{④⑩9⑨,}

Try it online!
Ties with most other golfing languages, so I'm happy with that.
Pushes the string {④⑩9⑨,}, which is then infinitely printed rawly, then nicely followed by a newline infinitely.

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


text:
Draw an SQL Output Table
I'm sure most of us have seen SQL results in a terminal, all neatly formatted into rows and columns. If you haven't, here's an example:
+----------+-----------+----------------+
| column 1 | column 2  | column 3       |
+----------+-----------+----------------+
| data     | more data | even more data |
| etc      | just goes | on and on      |
+----------+-----------+----------------+

Your goal for this challenge is, given the columns and row data for a table, draw the table in this style. There should be a horizontal line at the top and bottom of the table, and one right below the header row. There should be vertical lines between every column, and one on both sides of the table. You should use pipes for vertical lines, hyphens for horizontal lines, and plusses for where they intersect.
Specifics:

The data can be entered via stdin, or as the argument to a function, but it must be in some form of string
The data should be split by the string delimiter ;
The data will consist of only ASCII characters, is not quoted, and will not contain the delimiter.
The first row of the data will be used for column headers
The data will always have the same number of columns
The input will always contain at least two rows (one header, one data). You do not have to handle empty sets.
A trailing or preceding newline is permitted
Each column should be as wide as the widest element, padding shorter elements on the right (bonus -5% if you pad numbers on the left)
There should be 1 space of padding before and after the headers and data, except when the column is wider
You are not allowed to use the actual mysql program to generate the table
Standard loopholes apply

Sample Input:
column 1;column 2;column 3
hello;world;test
longer data;foo;bar

Output
+-------------+----------+----------+
| column 1    | column 2 | column 3 |
+-------------+----------+----------+
| hello       | world    | test     |
| longer data | foo      | bar      |
+-------------+----------+----------+

Scoring:
Lowest number of bytes wins, of course. -5% bonus for padding numbers on the left (see specifics).

Are they any time limits on the program run time?

Nope; take as long as you want, as long as it actually finishes.

What should the output be if there's only one row of input?

You can assume that there will always be at least two rows of input. MySQL doesn't even display a table for an empty set; you don't have to either.

CJam, 67 58 bytes
' qN/';f/ff+z_.{[z,):TS*'|+f.e|T'-*'++:T\(T@~T]}z{s_W=\N}/

Try it online in the CJam interpreter.

JavaScript (ES6), 262 bytes
f=x=>{w=[],o=z=>y(`| ${z[m]((c,i)=>(c+' '.repeat(w[i]-c.length))).join` | `} |`),(d=x.split`
`[m='map'](r=>r.split`;`))[m](r=>r[m]((c,i)=>w[i]=Math.max(c.length,w[i]||0)));(y=console.log)(s=`+${w[m](c=>'-'.repeat(c+2)).join`+`}+`);o(d.shift());y(s);d[m](o);y(s)}

Demo
Since it is ES6, this demo works in Firefox and Edge at this time. For some reason it does not work in Chrome/Opera even with experimental JavaScript features enabled.

// Snippet stuff
console.log = x => document.getElementsByTagName('output')[0].innerHTML += x + '\n';
document.getElementsByTagName('button')[0].addEventListener('click', () => {
  f(document.getElementById('I').value);
});

// Actual code
f = x => {
  w = [], o = z => y(`| ${z[m]((c,i)=>(c+' '.repeat(w[i]-c.length))).join` | `} |`), (d = x.split `
` [m = 'map'](r => r.split `;`))[m](r => r[m]((c, i) => w[i] = Math.max(c.length, w[i] || 0)));
  (y = console.log)(s = `+${w[m](c=>'-'.repeat(c+2)).join`+`}+`);
  o(d.shift());
  y(s);
  d[m](o);
  y(s)
}

  <textarea id=I cols=80 rows=15>column 1;column 2;column 3
hello;world;test
longer data;foo;bar</textarea>

<button type=button>Go</button>

<output></output>

source: Stack Exchange

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

sort: votes


text:
Emoticon facial expression recognition
Write a program that accepts as input an emoticon and ouputs if the emoticon is happy or sad.
The program accepts a string as input or parameter, and should display the string "happy" if the input is in the happy emoticon list, or "sad" if the input is in the sad emoticon list.
You can assume the input is always a valid (happy or sad) emoticon, with no space or tabs around.
Here is a space separated list of happy emoticons:
:-) :) :D :o) :] :3 :c) :> =] 8) =) :} :^) :-D 8-D 8D x-D xD X-D XD =-D =D =-3 =3 B^D (-: (: (o: [: <: [= (8 (= {: (^:

Here is a space separated list of sad emoticons:
>:[ :-( :( :-c :c :-< :< :-[ :[ :{ 8( 8-( ]:< )-: ): >-: >: ]-: ]: }: )8 )-8

This is code-golf, so the shortest program wins.

You forgot about :'D, :') (happy) and :@ (angry)

Python, 86 bytes
I should be sent to prison.
x=lambda c: ["happy","sad"][c[0]+c[-1:]in open(__file__).read(88)[::-1]]#<][><:>{:}(:)

The shortest I could come up with was equivalent to Martin's CJam answer, so I decided I'd hide all the sad emojis (minus the middle character if any) in the reverse of my code and use Python's __file__ quine cheat.
Muahahaha.

Very well thought

Actually, now that I look at your code, will removing the space after the colon help anything, or will it just break the program?

I love that the program contains its own emoticon: c:

@BetaDecay it'll break it heheh

@AlexA. it also has these, if you look carefully: 8) (8 :] [:

CJam, 33 32 bytes
Thanks to Dennis for saving 1 byte.
q)"[(c<{"&\"])>}"&|"sad""happy"?

Looks like it's shorter to do the same thing without a regex...
Test it here.
Explanation
This based on the same observation as the Retina answer, but this time matching happy faces doesn't have any benefit, so we'll match sad faces instead (because there's one less mouth to take into account). The solution is otherwise exactly the same, except that it's not implemented via regex substitution:
q)             e# Read input and split off last character.
"[(c<{"&       e# Set intersection with the sad right-hand mouths.
\              e# Pull up remaining emoticon.
"])>}"&        e# Set intersection with the sad left-hand mouths.
|              e# Set union, which amounts to a logical OR in this case.
"sad""happy"?  e# Pick the correct string.

Woah, give the rest of us a chance Martin :D

Retina, 38 36 bytes
.+[])D3>}]|[<[({].+
happy
^...?$
sad

We can recognise all emoticons by their mouths, because none of the mouths is used as a hat or eyes in the other set (only in the same set). The happy ones have one more mouth to take into account, but they have the benefit that the mouths don't appear in the other set at all, not even as noses (the opposite is not true: c is both a sad mouth and a happy nose). This means we can avoid using anchors but instead just ensure that there are more characters on the other side of the mouth.
So the valid mouths for happy faces are ] ) D 3 > } on the right or < [ ( { on the left. We match those with .+[])D3>}]|[<[({].+ and replace them with happy. If we didn't match there will be two or three characters in the string (the emoticon), but if we did there will be five (happy). So in a second step we replace two or three characters with sad.

We can recognise all emoticons by their mouths, because none of the mouths is used as a hat. Well, the ]:< emoticon uses a mouth as a hat, just saying.

@Loovjo except there is no . after "hat" in my answer. ;) "... as a hat or eyes in the other set (only in the same set)."

JavaScript (ES6), 46
Using a regexp to find sad emoticons, that are those beginning with >)]} or ending with <([{c. Side note: other regexps here may be shorter but I'm not sure to understand them.
Usual note: test running the snippet on any EcmaScript 6 compliant browser (notably not newest Chrome but not MSIE. I tested on Firefox, Safari 9 could go)
Big news It seems arrow functions finally arrived to Chrome land! Rel 45, august 2015

F=s=>/^[\])}>]|[[({<c]$/.test(s)?'sad':'happy'

//Same length
X=s=>/[\])}>].|.[[({<c]/.test(s)?'sad':'happy'

Y=s=>s.match`].|[)}>].|.[[({<c]`?'sad':'happy'

//TEST
out=x=>O.innerHTML+=x+'\n';

sad='>:[ :-( :( :-c :c :-< :< :-[ :[ :{ 8( 8-( ]:< )-: ): >-: >: ]-: ]: }: )8 )-8'.split` `
happy=':-) :) :D :o) :] :3 :c) :> =] 8) =) :} :^) :-D 8-D 8D x-D xD X-D XD =-D =D =-3 =3 B^D (-: (: (o: [: <: [= (8 (= {: (^:'.split` `

out('The sad faces')
sad.forEach(x=>out(x + ' is ' + F(x)))
out('\nThe happy faces')
happy.forEach(x=>out(x + ' is ' + F(x)))

works great on chrome

@Glycerine so now Chrome recognize => ? I missed that news

Julia, 87 69 bytes - saved 18 bytes thanks to Alex A.
s=readline();print(s[end-1] in")D]3>}"||s[1] in"([<{"?"happy":"sad")

You can save a bunch by using a ternary instead of the if/else and putting the ternary inside of print to avoid having to assign t.

Python 3, 77 75 74 72 61 55 bytes
lambda e:('happy','sad')[e[-1]in'[(c<{'or e[0]in'])>}']

Try it online!
How does it work
If a face string starts with ])>} or ends with [(c<{, it is sad, otherwise it is happy. Tuple indexing is used as if.

Welcome to Programming Puzzles & Code Golf!

Using a function is perfectly fine. In contrast, assuming the input is already stored in x is not allowed.

Brachylog, 50 bytes
(rh{,"[(c<{":Im?};?h{,"])>}":Im?}),"sad".;"happy".

Explanation
(                              ),"sad".;"happy".  § If what's in the parentheses is true,
                                                  § output "sad", else output "happy".

 rhA                                              § Unify A with the last char of the input
    ,"[(c<{":ImA                                  § True if A is a char of "[(c<{"
                ;                                 § OR
                 ?hA                              § Unify A with the first char of the input
                    ,"])>}":ImA                   § True if A is a char of "])>}"

Python, 159 bytes.
i,e=raw_input(),0
for c in i:e=(e,i.index(c))[c in":=8xXB"]
f,s,h=i[:e],i[e+1:],0
for c in f:h+=c in"[(c<{"
for c in s:h+=c in")]}>D"
print["Sad","Happy"][h>0]

MATLAB, 85 83 bytes
There must be a way to reduce the size here.
e=input('');if any([e(end)=='[(c<{',e(1)=='])>}']),'sad';else 'happy';end,disp(ans)

Input is a smiley string. First and last characters will be compared to determine whether it's sad. If not, it's happy.
I was able to save 2 bytes by not displaying either, but assigning them to MATLAB's default variable (ans) instead and then displaying ans after the if-statement. But I'm convinced it can be improved somehow.
2 bytes improvement by changing function s(e), to e=input('');.

PowerShell, 92 Bytes
param([char[]]$a)if("<[({".IndexOf($a[0])+"})D3]>".IndexOf($a[-1])-eq-2){"sad"}else{"happy"}

A little wordy, but as a bonus, it doesn't use regex!
This takes advantage of the .NET <string>.IndexOf() function that returns -1 if the character isn't found in the string. So, if the first character isn't a "happy" character, the first IndexOf() will be -1 -- likewise for the last character. So, if it's a sad face, the IndexOf()s will always sum to -2, meaning the -eq-2 is $TRUE, and thus sad gets printed.

Bonus variant: PowerShell with Regex, 95 bytes
param([char[]]$a)if(($a[0]-match"[<\[\(\{]")-or($a[-1]-match"[\}\)D3\]>]")){"happy"}else{"sad"}

Python 3, 75 bytes
lambda y:"sad"if re.match("(.*[[(c<{]$)|(^[\])>}])",y)else"happy"
import re

Try it online
The regex import makes it a bit too long, as well as the inability to use None as an array index. But I like regex :)

Java 8, 52 bytes
e->e.matches(".+[\\[(c<{]|[)>\\]}].+")?"sad":"happy"

Try it online.
Explanation:
e->          // Method with String as both parameter return-type
  e.matches( ".+[\\[(c<{]|[)>\\]}].+")
             //  Checks if the input matches the regex
   ?"sad"    //  If it does: output "sad"
   :"happy"  //  Else: output "happy"

Java's String#matches implicitly adds ^...$ to match the entire String, which is why it is shorter to check for sad faces instead of checking for happy faces like most other answers do with .+[\\])D3>}]|[<\\[({].+ (because my regex would fail in @MartinEnder's Retina answer for example, due to the happy test case :c)).
Regex explanation:
^.+[\\[(c<{]|[)>\\]}].+$
^                           Start of the string
 .+                          One or more characters,
   [\\[(c<{]                 followed by one of "[(c<{"
            |               Or
             [)>\\]}]        One of ")>]}",
                     .+      followed by one or more characters
                       $    End of the string

[AutoHotkey], 78 bytes
InputBox,e
MsgBox % RegExMatch(e,"(^[\])>}].+$)|(^.+[\[(c<{]$)")?"sad":"happy"

How does it work
Using RegEx and ternary operator. Nothing new, as some answers used this method too.
If input string starts with ])>} or ends with [(c<{, it is sad, otherwise it is happy.

Perl 5 -p, 33 bytes
$_=/.[[(c<{]$|[\])>}]./?sad:happy

Try it online!

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


text:
Filling Arbitrary Ice Cube Trays
Suppose this grid of spaces and X's represents the cross section of some strangely shaped empty ice cube trays:
   X     X X
X  X X  XX X  XX   X
XXXXXX XXXXXXXXXXXXX

Columns without X's represent holes or gaps in the trays that can't hold water, draining into an infinite capacity sink. Water falling off the leftmost or rightmost edge of the grid goes into this endless sink as well.
If we were to position a faucet above the trays and let them fill with water until the water level in all compartments remains stable, the exact compartments that become filled would depend on exactly where the water stream was positioned above the trays. (Assume a thin, steady stream of water with no splashing.)

For example, if our faucet F were above the very left grid column
F
   X     X X
X  X X  XX X  XX   X
XXXXXX XXXXXXXXXXXXX

the water would fall down to the topmost X in that column and spread left and right, the left half spilling into the sink below, and the right half filling up the 2×1 compartment. Once the compartment fills, the right half of the water stream has nowhere to flow but into the sink and the water level everywhere is essentially stable.
Turning the faucet off, the tray now looks like this: (with ~ as water)
   X     X X
X~~X X  XX X  XX   X
XXXXXX XXXXXXXXXXXXX

Similarly, if we position the faucet like this:
   F
   X     X X
X  X X  XX X  XX   X
XXXXXX XXXXXXXXXXXXX

It will fill up the two leftmost compartments but the rest of the water will drain away:
   X     X X
X~~X~X  XX X  XX   X
XXXXXX XXXXXXXXXXXXX

If we position the faucet like this:
         F
   X     X X
X  X X  XX X  XX   X
XXXXXX XXXXXXXXXXXXX

The left half of the stream will flow into the sink but the right half will eventually fill up the three rightmost compartments because there's no limit to how far water can travel horizontally on a flat surface:
   X     X~X
X  X X  XX~X~~XX~~~X
XXXXXX XXXXXXXXXXXXX

Positioned like this, however:
        F
   X     X X
X  X X  XX X  XX   X
XXXXXX XXXXXXXXXXXXX

All the water drains away and no compartments are filled:
   X     X X
X  X X  XX X  XX   X
XXXXXX XXXXXXXXXXXXX

Challenge
Write a program or function that takes in a rectangular grid of spaces, X's, and one F. The top row will always contain the F and otherwise only contain spaces. The X's in each column (if there are any) will extend in a solid line up from the base of the grid, i.e. there will be no caves or overhangs.
Print or return the grid after the faucet F has filled what it can with water ~ as described above. Leave the top F row out of the output.

The grid apart from the faucet row will be 1×1 at minimum so
F
X

is the smallest input you need to support.
The input will come in as a complete text rectangle. Leading and trailing spaces do matter in the input and output. e.g. the input
    F
  X  X
  XXXX

should result in
  X~~X
  XXXX

(note the leading and trailing spaces)
Having a single trailing newline in the input or output is fine.
You can use any four distinct printable ASCII characters in place of space, X, F, ~.

The shortest code in bytes wins.

Big Example:
Input:
                F
              X             X
              X             X X
X            XXX       X    X X           X    X
X   X     XXXXXXX      X    XXX     XXXXXXX X  X
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXX

Output:
              X~~~~~~~~~~~~~X
              X~~~~~~~~~~~~~X~X
X~~~~~~~~~~~~XXX~~~~~~~X~~~~X~X~~~~~~~~~~~X    X
X~~~X~~~~~XXXXXXX~~~~~~X~~~~XXX~~~~~XXXXXXX X  X
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXX

Oh yes, a great opportunity for me to use my beloved zip() <3

This needs an answer :/ I'll work on it.

It's relatively easy to make a cellular automaton that simulates this, but I can't think of a way for it to end.

still nobody to compete? So cute challenge. It looks like I will have to beat myself :)

looks like a duplicate of this: http://codegolf.stackexchange.com/questions/2563/fill-in-the-lakes

perl -p0, 204+2 bytes
IDEA

If both sides of the island below F are of equal height, replace all X *Xes with X~*Xes on that island.
If one side is higher, replace all X *Xes with X~*Xes between the drain on the lower side and the point closest to F that's higher than the lower side's top.

The land directly below F counts as a part of both sides here.
GOLF
s/.*(F).*
//;$f=@-[1];($%,$r)=map{y///c}/(.{0,$f})\bX+?\b(.*)$/;($a,$b)=map{y///c}/[^~]*^(?(?=(.{$%,$f}X)).{$f} *|.{$f} *X(.*)).{$r}
/m;$a=$%if!$a||$b;$b+=$r;s/(?<=.{$a})\b *\b(?=.{$b})/"~"x length($&)/ge

NOTES
perl -p0e ' # slurp stdin, print the result

s/.*(F).*\n//; # remove the first line, record the index of F
$f=@-[1]; # get the index of F

($l,$r)=map{length}m/(.{0,$f})\bX+?\b(.*)$/;
# gets the distance from either side to the drains closest to F
($a,$b)=map{length}m/[^~]*^(?(?=(.{$l,$f}X)).{$f} *|.{$f} *X(.*)).{$r}\n/m;
# tries to find the lowest line that has at least one X on
# one side of the island, but none on the other
$a=$l if !$a||$b;
$b+=$r; # use the captured groups to calculate the left and right bounds
s/(?<=.{$a})\b *\b(?=.{$b})/"~" x length($&)/ge;
# replace all pools within those bounds
'

It might be hard to recognise the original algorithm in this implementation since Perl doesn't support lookbehinds of variable length.

Lua 5.2, 581 Bytes
Again, slow start with so ineffective language for golfing and with ineffective algorithm. But I will improve :)
r=io.read w=io.write F=r()f=F:find("F")o={[1]=F}W=#F i=2
repeat s=r()if s==nil then break end o[i]={}for j=1,W do o[i][j]=s:sub(j,j)end i=i+1 until false
function e(i,j)
local k,l,b,c=j+1,j-1,false
if i>=#o or(o[i+1][j]==" "and e(i+1,j)==0)then return 0 end
while k<=W do
b=b or o[i][k]=="X"
if b or(o[i+1][k]==" "and e(i+1,k)==0)then break end
k=k+1 end
while l>0 do
c=c or o[i][l]=="X"
if c or(o[i+1][l]==" "and e(i+1,l)==0)then break end
l=l-1 end
if b and c then for m=l+1,k-1 do o[i][m]="~"end return 1 end
return 0 end
e(1,f)for i=2,#o do for j=1,W do w(o[i][j])end w"\n"end

Test cases (with water source):
---------
    F
  X~~X
  XXXX
--------------------
         F
   X     X~X
X  X X  XX~X~~XX~~~X
XXXXXX XXXXXXXXXXXXX
--------------------
   F
   X     X X
X~~X~X  XX X  XX   X
XXXXXX XXXXXXXXXXXXX
--------------------------------------------------
                F
              X~~~~~~~~~~~~~X
              X~~~~~~~~~~~~~X~X
X~~~~~~~~~~~~XXX~~~~~~~X~~~~X~X~~~~~~~~~~~X    X
X~~~X~~~~~XXXXXXX~~~~~~X~~~~XXX~~~~~XXXXXXX X  X
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXX

from bash it is possible to test this way, but it doesn't look so nice:
$ echo "    F
  X  X
  XXXX   " | lua f.lua

Use here-docs to test this easier! Like this.

Javascript, 460 Bytes
Online demo (in console, tested in current Chrome and Firefox).
function e(i,j){var k=j+1,l=j-1,b=0,c=0,I=i+1
if(i>(O-2)||(o[I][j]==" "&&e(I,j)==0))return 0
while(k<W){b=b||(o[i][k]=="X")
if(b||(o[I][k]==" "&&e(I,k)==0))break
k++}while(l>=0){c=c||(o[i][l]=="X")
if(c||(o[I][l]==" "&&e(I,l)==0))break
l--}if(b&&c){for(m=l+1;m<k;m++)o[i][m]="~"
return 1}return 0}function f(d){o=d.split("\n")
F=o[0];s=F.indexOf("F");W=F.length;O=o.length
for(i=0;i<O;i++)o[i]=o[i].split("")
e(0,s);for(i=1;i<O;i++)console.log(o[i].join(""))}

Challenging myself is not so fun, but still possible. Same algorithm as the Lua one, now in javascript.


text:
Python Code Reviewer
Task
Your mission is to create a program that reviews Python code. The solution can be written in any language!
It must take input that contains python code. The program must add # This is not pythonic! before each block of non-whitespace lines.
Input

The data can be entered via stdin.
The data will contain at least 3 lines with one blank one in between
them.

Minimum input example.
print "Hello World!"

Print "Bye World!"

Sample Input
from os.path import abspath

lines = []
with open(__file__, 'r') as f:
    for line in f:
        lines.append(line)

if lines is not None:

    newLines = []
    hasReviewedBlock = False

    for line in lines:
        if len(line) > 1: # \n
            if hasReviewedBlock == False:
                newLines.append("# This is not pythonic!\n")
                hasReviewedBlock = True
        else:
            hasReviewedBlock = False

        newLines.append(line)
    with open("d:/test.py", 'w') as f:
        for line in newLines:
            f.write(line);

Output
Output has to be written to STDOUT or closest alternative.
Sample Output
# This is not pythonic!
from os.path import abspath

# This is not pythonic!
lines = []
with open(__file__, 'r') as f:
    for line in f:
        lines.append(line)

# This is not pythonic!
if lines is not None:

# This is not pythonic!
    newLines = []
    hasReviewedBlock = False

# This is not pythonic!
    for line in lines:
        if len(line) > 1: # \n
            if hasReviewedBlock == False:
                newLines.append("# This is not pythonic!\n")
                hasReviewedBlock = True
        else:
            hasReviewedBlock = False

# This is not pythonic!
        newLines.append(line)
    with open("d:/test.py", 'w') as f:
        for line in newLines:
            f.write(line);

Scoring:
Lowest number of bytes wins. -5 bytes if your program can be used as valid input.

You haven't explained how you decide if code is pythonic or not.

All python code is not Pythonic. Edited my question.

So what you're saying is that python itself is not pythonic?

So, simply put, we have to insert "# this is not pythonic" before each block of non-whitespace  lines? We're all for a joke here, but please make your spec crystal clear.

Yes, sorry I am not sure how to make it more clear. I have not made a code golf question before.

I don't quite understand the bonus. What does "can be used as valid input" mean? I figure pretty much any program in any language can be used as an input. What makes it valid?

Couple more questions: Can the first line be empty? Can there be sequences of multiple empty lines?

@RetoKoradi You can only put a blank line at the second line of code when the minimum is a 3LOC input with a line in "between". In this case, the first line can never be empty.

Are functions allowed?

Functions are allowed, the first line can not be empty. Valid input is python code. So basically to get the bonus it has to be in python, and have 2 code blocks.

whitespace\tis\tEVIL!

awk, 64 56 54 bytes
/^$/{i=0}/./{if(!i++)print"# This is not pythonic!"}1

Test:
echo '/^$/{i=0}/./{if(!i++)print"# This is not pythonic!"}1' > solution.awk
awk -f solution.awk < pyth.py
awk -f solution.awk < pyth.py

Explanation:
/^$/ - matches empty line,
/./ - matches non-empty line,
1 - matches each line. No body is equivalent to {print;} - each line of input is printed.

Pyth, 39 38 37 bytes
tjbm|d+b"# This is not pythonic!"+k.z

Live demo.
Explanation
tjbm|d+b"# This is not pythonic!"+k.z
                                 +k.z    Prepend the empty line to the string
   m                                     For each line
    |d                                   If it's non-empty, return the same line
      +b"# This is not pythonic!"        Else, return a line break followed by the required text
 jb                                      Join via line breaks
t                                        Remove the unneeded preceding line break

38-byte version
tjbm?dd+b"# This is not pythonic!"+k.z

39-byte version
jbtsm?dd,d"# This is not pythonic!"+k.z

No doubt there's still golfing left to do.

AutoIt - 139
$1='# This is not pythonic!'
ConsoleWrite($1&@CRLF&StringRegExpReplace(FileRead($CmdLine[1]),'(*BSR_ANYCRLF)(^\R|\R(?=\R))',"\0"&@CRLF&$1))

I'm assuming the first line cannot be empty as by your specification:

The data will contain at least 3 lines with one blank one in between them.

This program is called like this:
compiled.exe pycode.py > output.txt

The RegEx can be optimized for sure. Works for CRLF only.

Python 3, 86 bytes - 5 = 81
import re

print(re.sub(r"(^\n*|\n\n+)",r"\1# This is not pythonic\n",open(0).read()))

Try it online!

Python 3, 94 bytes - 5 = 89
p=''

for c in open(0).read().splitlines():print("# This is not pythonic!\n"*(p==''!=c)+c);p=c

Try it online!

@ReinstateMonica your code adds a # before the first line

Whoops! 78, my bad

Wren, 73-5 = 68 bytes
Luckily enough, Wren has an automatic WYSIWYG that gains the bonus.
Fn.new{|i|("

"+i).split("

").join("

# This is not pythonic!
")[2..-1]}

Try it online!
Explanation
Fn.new{|i|    // In this case we define a new
              // anonymous function with the operand i
          ("

"+i)          // We prepend the input with 2 newlines
    .split("

")            // Split the input by newlines,
              // including the preceding newlines
              // that we first prepended
  .join("

# This is not pythonic!
")            // Join the input with 2 newlines
              // , the comment, and another trailing newline
  [2..-1]}    // Slice the input so that the preceding
              // 2 newlines are not present in the final output
```

Perl 6, 40 - 5 = 35 bytes
{S:g/^|"

"<(/# This is not pythonic!
/}

Try it online!
The bonus is rather weird, but it didn't cost me any bytes to add.
Explanation
{S:g/        /   /}  # Substitute all instances of
     ^                 # The start of the string
      |"  "            # or two newlines
           <(          # But don't actually replace, just append
              ...    # With the given string

CJam, 41 bytes
"# This is not pythonic!":TNqN/{_{T}|}%N*

Try it online
Alternate solution that handles multiple empty lines in succession, as well as empty lines at the start. This is 44 bytes, and will become my solution depending on how the pending clarifications turn out:
qN/{_L!e&{"# This is not pythonic!"\}&:L}%N*

JavaScript (ES6), 70
Test running the snippet below.

f=p=>alert((r='# This is not pythonic!\n')+p.replace(/\n\n+/g,x=>x+r))

//// TEST CASES /////

t1=`print "Hello World!"

Print "Bye World!"`
f(t1)

t2=`from os.path import abspath

lines = []
with open(__file__, 'r') as f:
    for line in f:
        lines.append(line)

if lines is not None:

    newLines = []
    hasReviewedBlock = False

    for line in lines:
        if len(line) > 1: # \n
            if hasReviewedBlock == False:
                newLines.append("# This is not pythonic!\n")
                hasReviewedBlock = True
        else:
            hasReviewedBlock = False

        newLines.append(line)
    with open("d:/test.py", 'w') as f:
        for line in newLines:
            f.write(line);`
f(t2)


text:
Aligning Lines!
Aligning Lines!
Given a character and a multiline string, your job is to pad each line of the string so they line up among the given delimiter.
Examples
Input:
,
Programming, Puzzles
And, Code golf

Output:
Programming, Puzzles
        And, Code golf

Input
The input will be a multiline string and a character (which you will align among), you may take these in any order / format you wish. The character will appear exactly once per line. Each line of the input may be different in length.
Input can be through function arguments or STDIN.
Output
The output should be the same string centered. You are allowed one trailing newline and no trailing whitespace.
The output should be padded with the minimum amount of spaces. You may not remove any leading whitespace in the input (if it exists).
Output can be from function return or STDOUT.

Can input to a full program come from command-line arguments, or is that forbidden?

@DLosc Yes, of course

For function/command-line arguments, should we read a single string or would one line per argument be admissible? 2. Do we have to pad the lines with the minimum amount of spaces?

@Dennis You may take it in a single string. Or one-line per argument. "you may take these in any order you wish". Yes, you do need to pad the lines with the minimum amount of spaces. I'll edit the spec

@vihan Can functions take in one line per argument?

@xnor No, they can't. But they can take in two arguments, one for the character, one for the string.

@orlp crap crap crap, no idea, must of accidentally clicked something :|

Pyth, 18 bytes
V.z+*d-eSxRz.zxNzN

APL (37)
APL just isn't very good at string processing (or I'm not good at golfing, of course).
{⌽∊R,¨' '/⍨¨(⌈/-+)⍺⍳⍨¨⌽¨R←S⊂⍨S=⊃S←⌽⍵}

This takes the character as its left argument, and the multiline string as its right argument. It is assumed that the multiline string ends in a linefeed (e.g. A\nB\nC\n rather than A\nB\nC.) Since I can use "any format [I] wish", and this is also the conventional format for text files, I think this is reasonable.
Explanation:

S←⌽⍵: reverse the string, and store it in S.
R←S⊂⍨S=⊃S: split S on its first character, and store the array of strings in R.
⍺⍳¨⌽¨R: reverse each string in R, and then find the index of ⍺ (the character) in each string.
(⌈/-+): subtract each of the indices from the largest index, giving the amount of spaces needed
' '/⍨¨: for each of those values, generate that many spaces
R,¨: add the spaces to each string in R.
∊: join all the strings together
⌽: reverse it (to get the original order back)

Example:
      NL←⎕UCS 10 ⍝ newline
      test←'Programming, Puzzles',NL,'And, Code golf',NL
      test ⍝ test string
Programming, Puzzles
And, Code golf

      ⍝ run the function
      +X←','{⌽∊R,¨' '/⍨¨(⌈/-+)⍺⍳⍨¨⌽¨R←S⊂⍨S=⊃S←⌽⍵}test
Programming, Puzzles
        And, Code golf

      ⍴X ⍝ result is really a string with newlines, not a matrix
44

CJam, 23 22 20 bytes
Thanks to Dennis for saving 2 bytes.
ea_rf#_:e>\fm.{S*\N}

This reads the lines from command-line arguments and the character from STDIN.
The online interpreter doesn't support command-line arguments, but you can test an equivalent version here.
Explanation
ea    e# Get the lines from ARGV.
_rf#  e# Duplicate input, read the character and find index of character in each line.
_:e>  e# Duplicate indices and find maximum.
\fm   e# Subtract each index from the maximum index.
.{    e# Apply this block to each pair of line and (max_index - index).
  S*  e#   Get a string with the right amount of spaces.
  \N  e#   Swap spaces with line and push a line feed.
}

Pip, 22 20 18 + 1 = 19 bytes
Y_@?qMgsX(MXy)-y.g

Takes strings as command-line arguments and delimiter from STDIN (idea borrowed from Martin's CJam answer). Uses -n flag to print output values on separate lines.
                    g is list of cmdline args; s is space (implicit)
    q               Read the delimiter from stdin
 _@?                Construct a lambda function that takes a string and returns
                       the index of the delimiter in it
     Mg             Map that function to each remaining item in g
Y                   Yank the resulting list of indices into the variable y

         (MXy)-y    Take the max of y minus each element in y
       sX           Space, repeated that many times...
                .g  ... concatenated to each item in g
                    Print, newline-separated (implicit, -n flag)

And an example run:
C:\Users\dlosc> pip.py -ne Y_@?qMgsX(MXy)-y.g "Programming, Puzzles" "And, Code golf"
,
Programming, Puzzles
        And, Code golf

Pyth, 27 24 bytes
V.z+.[deSmxdz.z<NJxNz>NJ

Updated for the latest Pyth.
Live demo.
27-byte version
jbm+.[eSmxkz.z<dJxdz\ >dJ.z

Live demo.

Whenever you see jbm at the start of your answer, you should immediately start thinking about V.

Or simply remove the b

JavaScript ES 2015, 113 bytes
f=(c,s)=>s.split`
`.map((e,_,a)=>' '.repeat(a.map(j=>j.indexOf(c)).reduce((g,h)=>g>h?g:h)-e.indexOf(c))+e).join`
`

Not quite as short as the golfing languages posted so far. Takes input as two function arguments, e.g. f(',','Programming, Puzzles\nAnd, Code golf'). The snippet below is ungolfed and includes an easy method to test.

f=function(c,s){
  return s
    .split('\n')
    .map(function(e,_,a){
      return ' '.repeat(
        a.map(function(f){
          return f.indexOf(c)
        }).reduce(function(g,h){
          return g>h?g:h
        })-e.indexOf(c)
      )+e
    })
    .join('\n')
}

run=function(){document.getElementById('output').innerHTML=f(document.getElementById('char').value,document.getElementById('string').value)};document.getElementById('run').onclick=run;run()
Character: <input type="text" id="char" value="," maxlength="1" />
<textarea id="string" rows="4" cols="30" style="display:block">
Programming, Puzzles
And, Code Golf</textarea><button id="run">Run</button>

Dyalog APL, 22 20 16 bytes
-4 thanks to ngn.
APL is actually not so bad at string processing, if allowed to work with arrays. In this challenge, we may chose the most appropriate format, which for APL means a vector of text vectors as left argument, and the delimiter as a scalar right argument. This even handles multiple delimiters per line, and aligns the first one of each line.
⊣,¨⍨' '⍴¨⍨⌈.⍳-⍳¨

⊣,¨⍨ prepend each line with
' '⍴¨⍨ as many spaces as
⌈.⍳ the rightmost index of the character among the lines
- minus
⍳¨ the index of the character in each line
Try APL online! (↑ added to print output vertically)
Bonus? Works for any number of strings, and delimiters (aligns by left-most).

⊣,¨⍨' '⍴¨⍨⌈.⍳-⍳¨

Yes, of course.

Python 3, 85 (IDLE 3.2.2, Windows)
c,*s=input().split('\n')
for x in s:print(' '*(max(z.find(c)for z in s)-x.find(c))+x)

Pretty straightforward. This finds the position of the character in the string twice: once to find the max (well, once per line), and once to find the offset. I tried combining these but it was longer.
Python 3 is used for the input unpacking. MY IDLE seems to take multiline strings as input.

@DLosc Works for me in IDLE pasting in a multiline string.

Hmm. When I do that (IDLE 3.3.4, Windows 7), c gets the delimiter and s gets an empty list. Subsequent calls to input() return the remaining lines one by one.

@DLosc Strange. I'm copy-pasting the string directly from my browser into the Idle prompt. Are you doing the same? IDLE 3.2.2, Windows 7 in case it matters.

Same. Here's a screenshot...

@DLosc Still works for me (screenshot). Though I don't understand what's going on, I'm going to say this is compiler or environment specific behavior, and I edited to try to specify the relevant info. The function version is 3 chars longer in Python 2.

Fair enough. Who knows, this could start a stampede to IDLE 3.2.2 for golf answers ^__^

Julia, 117 bytes
f(c,t)=(s=[split(l,c)for l=split(t,"\n")];join(map(i->lpad(i[1],maximum(map(i->length(i[1]),s))," ")*c*i[2],s),"\n"))

Ungolfed:
function f(c::String, t::String)
    # Create an array of arrays by splitting on newlines and
    # then on the given delimiter
    s = [split(l, c) for l in split(t, "\n")]

    # Find the maximum length on the left side of the delimiter
    m = maximum(map(i -> length(i[1]), s))

    # Rejoin on the delimiter and pad each line with spaces,
    # and rejoin this with newlines
    join(map(i -> lpad(i[1], m, " ") * d * i[2], s), "\n")
end

Jelly, 12 bytes
Ỵ©w€µạṀ⁶ẋż®Y

Try it online!
Done and golfed with caird coinheringaahing in Jelly Hyper Training (JHT), our Jelly practice chat room.
How it works
The third command line argument (first input) should be the multi-line string, and the character should be the fourth command line argument (second input).

Ỵ©w€µạṀ⁶ẋż®Y  ~ Full program.

Ỵ             ~ Split the string by newlines.
 ©            ~ Copy the result to the register.
  w€          ~ Get the index of the first occurrence of the character on each line.
      Ṁ       ~ Take the maximum.
    µạ        ~ And subtract it from each index, taking the absolute value.
       ⁶ẋ     ~ Repeat a space that many times (vectorizes).
         ż®   ~ Interleave with what was stored in the register.
           Y  ~ Join by newlines and print implicitly.

I am not sure whether taking input as a list of lines is allowed, so this takes a multiline string as input. If it were allowed:
10 bytes
w€µạṀ⁶ẋż³Y

Try it online!

that's when you know you have created a successful room

Kakoune, 9 bytes
s\Q<c-r>"<ret>&

(<c-x> means CTRL+x,  is alt)

Expects the delimited in the "-register, the input in the default buffer and the cursor spanning the entire buffer.
Explanation:
s        <ret>             Match the contents of the current selection on the following regex, select every part that matches
 \Q                        Quote, everything after this only matches itself literally (avoiding problems with . etc)
   <c-r>"                  Dump the contents of the "-register (containing the char to align on)
                      Select to the beginning of the line for each selection
                      "flip" each selection, so that the anchor is at the end.
                        &  Align everything

This might be stretching the allowed input format a bit, so here's a solution which takes the input exactly like the challenge example, in the default buffer, with the cursor at (0, 0):
Kakoune, 13 bytes
xd%s\Q<c-r>"<backspace><ret>&

This is basically the same solution, with a prelude deleting the delimiter and putting it into the "-register. Note that the newline is also put into the register, which the <backspace> deletes.

C# 4.0, 329 320 307 bytes
using System;class P{static void Main(){Func<char,dynamic>f=(d)=>Console.ReadLine().Split(d);var c=f(' ')[0][0];var m=0;var l=new string[9999][];var z=0;for (l[z]=f(c);l[z].Length==2;l[z]=f(c)){m=Math.Max(l[z][0].Length,m);z++;}for(var i=0;i<z;i++){Console.WriteLine("{0,"+m+"}"+c+"{1}",l[i][0],l[i][1]);}}}

Ungolfed version :
using System;
class P
{
    static void Main()
    {
        // lamba to to read a line and split on a char, returns an array of
        Func<char,dynamic>f=(d)=>Console.ReadLine().Split(d);
        // read the separator char by taking the first char of the first string
        // in the array
        // use our lambda
        var c=f(' ')[0][0];
        var m=0; // max position where char is found
        var l=new string[9999][]; // hold all input
        var z=0; // count valid entries in l
        // loop until the input doesn't contain an
        // array with 2 elements
        // here we use our lambda agian, twice
        for (l[z]= f(c);l[z].Length==2;l[z] = f(c))
        {
            // calculate max, based on length
            // of first element from the string array
            m=Math.Max(l[z][0].Length,m);
            z++; // increase valid items
        }
        // loop over all valid items
        for(var i=0;i<z;i++)
        {
        // use composite formatting with the padding option
        // use the max to create a format string, when max =4
        // and seperator char is , this will give
        // "{0,4},{1}"
            Console.WriteLine("{0,"+ m +"}"+c+"{1}",l[i][0],l[i][1]);
        }
    }
}

It does accept a maximum of 9999 lines ...

Common Lisp, 101 bytes
(lambda(c l)(dolist(x l)(format t"~,,v@a~%"(-(apply'max(mapcar(lambda(x)#1=(position c x))l))#1#)x)))

The first parameter is the character, the second is a list of string to be aligned.
Try it online!

05AB1E, 10 9 (or 5?) bytes
U|XδkZαú»

Try it online.
If the I/O of the multi-line string could be a list of lines, this would be 5 bytes instead:
δkZαú

Try it online.
Explanation:
U          # Store the first input-character in variable `X`
 |         # Take the other input-lines as a list of strings
   δ       # For each string:
  X k      #  Get the 0-based index of character `X` in this string
     Z     # Push the maximum index (without popping the list itself)
      α    # Take the absolute difference of this maximum with the integer-list
       ú   # Pad each string of the (implicit) input-list (because we've used `|`) with
           # that many leading spaces
        »  # And join the list by newlines
           # (after which it is output implicitly as result)

δ          # For each string in the second (implicit) input-list
 k         #  Get the 0-based index of the first (implicit) input-character
  Zαú      # Same as above
           # (after which the list of strings it output implicitly as result)

Matlab / Octave, 106 bytes
Function that uses three separate arguments for character, string, string; and gives result in stdout:
function f(c,s,t)
p=find(s==c)-find(t==c);disp([repmat(32,1,max(-p,0)) s]),disp([repmat(32,1,max(p,0)) t])

Example in Matlab:
>> f(',', 'Programming, Puzzles', 'And, Code golf')
Programming, Puzzles
        And, Code golf

Or try it online with Octave interpreter.

Julia, 80 bytes
f(c,s)=(t=split(s,'
');u=[search(i,c)for i=t];join([" "].^(maxabs(u)-u).*t,'
'))

Ungolfed:
function f(c,s)
  # converts multiline string to array of single-line strings
  t=split(s,'\n')

  # creates array of positions of delimiter
  u=[search(i,c)for i=t]

  # Appends appropriate number of spaces to each line
  # (uses elementwise operations to achieve this result)
  v=[" "].^(maxabs(u)-u).*t

  # Recombines array of strings to multiline string and returns
  return join(v,'\n')
end

JavaScript (ES6), 105
Using template strings, the 2 newlines are significant and counted.
Test running the snippet in any EcmaScript 6 compatible browser (that is FireFox. Chrome does not support default parameters)

f=(s,c,p=(s=s.split`
`).map(r=>m<(v=r.indexOf(c))?m=v:v,m=0))=>s.map((r,i)=>' '.repeat(m-p[i])+r).join`
`

// Ungolfed
f=(s,c)=>{
  s=s.split('\n')
  p=s.map(r=>r.indexOf(c))
  m=Math.max(...p)
  s=s.map((r,i)=>' '.repeat(m-p[i])+r)
  return s.join('\n')
}

// TEST
out=x=>O.innerHTML+=x+'\n'

out(f(`Programming, Puzzles
And, Code golf`,','))

Python 2, 93 bytes
def f(x,y,z):
 p=y.index(x)-z.index(x)
 if p<0:y=" "*abs(p)+y
 else:z=" "*p+z
 print y+'\n'+z

Called like so:
f(',','Programming, Puzzles','And, Code Golf')

Ruby, 74 bytes
l=lambda{|d,s|s.each{|e|puts ' '*(s.map{|f|f.index(d)}.max-e.index(d))+e}}

and call it like
l.call ',',['Programming, Puzzles','And, Code golf']

R, 68 bytes
function(c,x,y,r=regexpr)cat(x,"\n",rep(" ",r(c,x)-r(c,y)),y,sep="")

Unnamed function that takes 3 inputs; c which is the character to align, x is the first string and y the second string.
In R, the function regexpr returns the position of a given pattern in a string. The solution works by applying regexpr on both strings and repeating white spaces amounting to the difference and subsequently just print both inputs separated by a newline.

Japt -R, 13 bytes
·mqV Õvù ÕmqV

Try it
·mqV Õvù ÕmqV     :Implicit input of string U & delimiter V
·                 :Split U on newlines
 m                :Map
  qV              :  Split on V
     Õ            :Transpose
      v           :Modify first element
       ù          :  Left pad with spaces to the length of the longest
         Õ        :Transpose
          m       :Map
           qV     :  Join with V
                  :Implicit output joined with newlines

C#, 191
As a function. Roughly a porting of my JS answer.
using System.Linq;string f(string s,char c){var q=s.Split('\n');int m=0,v;Array.ForEach(q,x=>m=m<(v=x.IndexOf(c))?v:m);return String.Join("\n",q.Select(x=>new String(' ',m-x.IndexOf(c))+x));}

Python 2, 67 66 bytes
def a(d,l):
 i=l[0].index(d)
 for e in l:print' '*(i-e.index(d))+e

Called with:
a(',', ['Programming, Puzzles', 'And, Code golf'])

Moonscript, 138 bytes
(n)=>
 i=0
 @='
'..@
 l=[b-a for a,b in @gmatch "
().-()"..n]
 m=math.max unpack l
 (@gsub '
',(a)->
  i=i+1
  a..(' ')\rep m-l[i])\sub(2)

This returns a function which takes 2 arguments. The first is the string, the second is the character to align on. These arguments are the implicit argument @, and n.
First, I append a new line to the string, to make processing easier.
@='
'..@

Now, I generate a list of the positions of every alignment character, using gmatch.
Next, I replace the newline before every line with the correct number of spaces, then trim the newline I added at the beginning.

Lua, 169 bytes
function a(d,t)m={}for k,v in pairs(t)do m[#m+1]=string.find(v,d)end o=math.max(unpack(m))for k,v in pairs(t)do print(string.rep(" ",o-(string.find(v,d)or 0))..v)end end

Not as short as other answers but this is my first one :D

Retina, 71 bytes
+`^((.)(.*¶)*)((.)*\2.*¶)((?<-5>.)*(?(5)\2|(.)\2).*)
$1$#7$* $4$#5$* $6

Try it online! Note: This leaves the alignment character in the output; it can be deleted at a cost of 4 bytes. If only two strings need to be aligned, then for 52 bytes:
^(.)¶((.)*\1.*¶)((?<-3>.)*(.)*\1.*)
$#5$* $2$#3$* $4

Explanation:
^(.)¶

This matches the alignment character.
((.)*\1.*¶)

This matches the first line and also keeps track of how many characters there were before the alignment character. (.NET keeps a match stack for each variable, in this case, $3.)
((?<-3>.)*(.)*\1.*)

This matches the second line, trying to account for as many characters as we found on the first line. ?<-3> causes the match to pop the stack for each character, until it is empty, at which point the match fails, and the (.)* then matches the remaining characters before the alignment character. At this point we have the following variables:

$1 contains the alignment character
$2 contains the first line
$3 contains a stack whose length is the first line prefix minus the second line prefix
$4 contains the second line
$5 contains a stack whose length is the second line prefix minus the first line prefix

$#5$* then prefixes the necessary number of spaces to make the first line align with the second, and vice versa for $#3$*.
Similar logic applies to the main answer, except here we have to find two lines which don't align so that we can align them (this is where the ?(5) comes in) and then repeat the alignment over all the lines until they are all equally aligned.

Perl 5 -MList::Util=max, 69 64 bytes
$l=max map{/$d/xg;pos}($d,@a)=<>;say map{/$d/x;$"x($l-pos).$_}@a

Try it online!


text:
Build an ASCII Hotel
Every 3 seconds, add a room to the house.
A house with one room looks like this:
|---|
|[=]|
|---|

Two rooms:
|---||---|
|[=]||[=]|
|---||---|

Three rooms:
|---|
|[=]|
|---|

|---||---|
|[=]||[=]|
|---||---|

Four rooms:
|---||---|
|[=]||[=]|
|---||---|
|---||---|
|[=]||[=]|
|---||---|

Five rooms:
|---||---|
|[=]||[=]|
|---||---|
|---||---||---|
|[=]||[=]||[=]|
|---||---||---|

The rooms have to form a square, or as close as you can get, as shown above.
You must use stdout or the equivalent

Smallest number of bytes wins.

For the two rooms, could they go on top of each other, since that's just as close to a square as next to each other? (This also applies similarly for larger inputs)

The order the rooms are added are inconsistent. Does it matter how we add the rooms as long as it forms a square (or as close as possible)?

Why is there a space between the rows of rooms for 3 rooms, but not for 4 rooms?

What it does mean to be as close to a square as possible?

Expanding on @xnor's point, which is squarer for 15, 5x3 perfect rectangle, or 4x4 with the corner missing? Are we allowed to move rooms that have already been drawn? If we're not allowed to move rooms, I'd go for the latter, but it's up to you to specify.


text:
Use xkcd's formula to approximate the world population
In xkcd 1047, Randall Munroe lists "slightly wrong" approximations of assorted quantities and numbers with varying precision and complexity, such as that the number of liters in a gallon is very close to 3 + π⁄4. In the middle of the comic, he gives an intermission: a way to estimate the world (and United States) population based for a given year.

(Cropped from xkcd: Approximations by Randall Munroe)
Your task is to write a program that implements these formulas to approximate the current world and U.S. populations, replicated as follows.
World population

Take the last two digits of the current year.
Subtract the number of leap years (including the current year) since Hurricane Katrina (2005). For these purposes, any year divisible by 4 is considered a leap year.
Add a decimal point between the two numbers (the same as dividing by 10).
Add 6. This gives the result in billions of people.

U.S. population

Take the last two digits of the current year.
Subtract 10.
Multiply by 3.
Add 10.
Add 3 to the beginning (for this challenge, some numbers will be negative, so add 300 instead). Somehow I didn't notice that just concatenating wouldn't work because the program I used to generate the results just added 300.
This gives the result in millions of people.

Details
This formula "should stay current for a decade or two," but you must be able to theoretically handle any year 2000–2039 inclusive. For some cases, the leap years since Katrina will have a negative or zero value.
You are free to simplify the formula in any way, as long as all outputs match the ones below.
For the year, use the year according to the computer's clock. It must work next year and any other year this century, so you cannot simply hardcode 2015. For convenience, you might want to include a way to specify the year as a variable or input to test other years.
The output should be the approximated world population (in billions of people), followed by some delimiter (e.g. space or comma), followed by the U.S. population (in millions of people). You may also write a function that returns or prints a string or an array of numbers or strings.
This is code golf, so shortest code in bytes wins. Tiebreaker is earliest post.
Test cases
This is a list of all possible years, followed by the two outputs.
Year   World  U.S.
2000    6.1   280
2001    6.2   283
2002    6.3   286
2003    6.4   289
2004    6.4   292
2005    6.5   295
2006    6.6   298
2007    6.7   301
2008    6.7   304
2009    6.8   307
2010    6.9   310
2011    7     313
2012    7     316
2013    7.1   319
2014    7.2   322
2015    7.3   325
2016    7.3   328
2017    7.4   331
2018    7.5   334
2019    7.6   337
2020    7.6   340
2021    7.7   343
2022    7.8   346
2023    7.9   349
2024    7.9   352
2025    8     355
2026    8.1   358
2027    8.2   361
2028    8.2   364
2029    8.3   367
2030    8.4   370
2031    8.5   373
2032    8.5   376
2033    8.6   379
2034    8.7   382
2035    8.8   385
2036    8.8   388
2037    8.9   391
2038    9     394
2039    9.1   397

Do you have to round the numbers?

@muddyfish I'm not sure I understand. If you follow the instructions in the comic exactly, there's technically no division going on, but the world population should be rounded to the nearest tenth.

I'm a little confused by the United States population one. If you're concatenating a 3, shouldn't 2040 give a population of 3100? 40 - 10 = 30, 30 * 3 = 90, 90 + 10 = 100, which would give "3" + "100" = 3100

Also, if the language we use cannot obtain the current year, should we hardcode it in, provided that the code without the hardcoded year will work for the range of inputs?

@Cole Good point, I'll make it so you only have to support years through 2039. About hardcoding the year, I don't want to allow hardcoding because that will almost always be shorter even languages that do support dates.

@NinjaBearMonkey That's fair, I jumped the gun a bit and made a submission so I'll delete it. My apologies for doing so.

@NinjaBearMonkey I suggest that you change the description of "adding 3, thinking concatenation" to a literal "add 300" to cover all of the edge cases that occur when the previous result isn't a nice 2-digit positive number.  (For example, year 2000 gives 280 as a result of -20+300=280 and not 3 . -20= "3-20")

Now we can make sure nobody hardcoded the year!

If anyone's interested, I made an obfuscated solution for this in a cops/robbers challenge ;)

Pyth, 21 20 bytes
-1 byte by Dennis
c/J-*3.d3C\ᙹ4T+33J

These have the same byte count but are ASCII-only:
c/J%*3.d3 523 4T+33J
c/-J%*3.d3*44T33 4TJ

I don't know Pyth, so still probably possibly golfable. Using the same algorithm:
TI-BASIC, 23 bytes
max(3getDate-5753
{.1int(Ans/4),Ans+33

getDate returns a list of three floats {YYYY,MM,DD} in some order depending on the date format setting (TI-84s don't have a true int datatype); the max( will be the year. Multiplying and subtracting inside the max( saves a close-paren.

I think this is the first time I've seen a TI-BASIC answer here....

@The_Basset_Hound TI-BASIC is the 28th most common language here at 140 answers; it's also won one major and a few smaller questions.

Javascript (ES6), 55 54 48 bytes
-~((n=Date().substr(13,2)*3+280)/4-9.1)/10+' '+n

Works in Firefox 33; theoretically supports all years from 2000 to 2099. If programs that dump the result onto the console are not allowed, use this 51-byte function:
(n=Date().substr(13,2)*3+280)=>-~(n/4-9.1)/10+' '+n

Full program, 55 bytes:
n=Date().substr(13,2)*3+280,alert(-~(n/4-9.1)/10+' '+n)

Getting the year was quite expensive, but after using the deprecated getYear() instead of getFullYear(), all of the numbers in the equation became smaller, saving a lot of bytes. EDIT: Thanks to an eeevil trick, I skipped new and getYear() altogether. >:D
Suggestions welcome!

Python 2, 80 bytes
from datetime import*
y=date.today().year%40
print int(61.55+.75*y)/10.,y*3+280

Now rounds!

You have to round, as OP clarified a minute ago. ;-)

year%100 is the same as year%40.

Pyth, 30 bytes
.R+*.075J%.d3C\d6.105 1+*3J280

My first Pyth program!
Thanks @Jakube for some hints (I would never have thought of those!)

Haven't read the question, but here are a few optimizations I immediately saw. Write everything on one line. Choose a different ordering of numbers and variables (+*3Z280 instead of +*Z3 280 for instance). C\d instead of 100 (saves spaces). Use J instead of Z (saves the =). Inline the assignment. Link

CJam, 28 bytes
et0=100%__4/(-Ad/6+S@3*280+

Try it online
To try years other than the current one, replace the et0= at the start with the literal value of the year.

Since 2000 is divisible by 40, and you only need 2000-2039, you can use 40% to save one byte.

Python 3, 134 bytes
Works well but seems a bit long
from datetime import*
y=str(date.today().year)
z=int(y[2:])
m=str(60+(z-int((int(y)-2005)/4)))
print("%s.%s"%(m[0],m[1]),310+(z-10)*3)

To shorten this, use from time import*, y=strftime('%Y'). Or copy the other python answer :P

AutoIt - 60 58 56 bytes
$_=@YEAR-2e3
ClipPut(($_-Int($_/4-1))/10+6&' 3'&3*$_-20)

The rounding eats bytes (not anymore). I have now tweaked both formulas. Some sample outputs:
7.3 325 // 2015
7.3 328
7.4 331
7.5 334 // 2018
8.4 370 // 2030

They all seem to be accurate.
A tip: Order of execution saves bytes on parentheses. For example: (a-4)/4 = a/4-1 :-).

PowerShell, 53 45 Bytes
$n=date -f yy;.1*[int](61.45+.75*$n);280+3*$n

Uses a similar rounding trick as muddyfish's Python 2 answer to simplify the world population calculation, since PowerShell implicitly Round()s when you cast from a [double] to an [int], rather than truncating.
For the output, we assume that "followed by some delimiter (e.g. space or comma)" can also mean "newline", so we execute one result and then the second. PowerShell implicitly writes out results, so we don't need to explicitly call any printing commands.

Mathematica, 50 bytes
n=Today["YearShort"];{.1*(61+n-Floor[n/4]),280+3n}

Note that this is dependent on having a Wolfram Engine with Version number 10+ (released 2014) due to dependence on DateObjects.
R, 64 bytes
n=as.numeric(format(Sys.time(),"%y"))
c(.1*(61+n-n%/%4),280+3*n)

Direct port of Mathematica code, think I had a shorter solution but dependent on packages whereas this works with base R.

(1/10) -> .1?

I think you also don't need parentheses around the .1.

Java, 180 177 166 152 143 bytes
Thanks Thomas for helping a noob out :)
class D{public static void main(String[]a){int f=java.time.LocalDate.now().getYear();System.out.printf("%.1f %d\n",(3.*f-5755)/40,3*f-5720);}}

Ungolfed version:
class D {
  public static void main(String[]a) {
    int f = java.time.LocalDate.now().getYear();
    System.out.printf("%.1f %d\n",(3.*f-5755)/40,3*f-5720);
  }
}

Requires Java 8.

import java.time.*? 3.0->3.? You also don't need to print the year with the output.

Oh, I didn't realize you didn't need the year printed out... :P

JavaScript (ES6) 52
A function returning the output as an array.

(y=(new Date).getYear())=>[(y+~(y/4)-13)/10,y*3-20]

Just for testing purpose, the function accepts an input equals to current year - 1900 (e.g. 105 for 2015)
That's in the line of the ETHproductions' answer (the math is the math) but avoding the evil trick it is more portable in different locales. And as a function it's 1 byte shorter.
Test snippet:

f=(y=(new Date).getYear())=>[(y+~(y/4)-13)/10,y*3-20]

o=[];
for(a=2000;a<2050;a++)o.push(`<td>${a}</td><td>${f(a-1900)}</td>`);
document.write(`<table><tr>${o.join`</tr><tr>`}</tr></table>`)
td { text-align:right; font-family:monospace }

Desmos, 140 Bytes
I'm counting a newline to be a signal for a new equation. Folders on the link are just for organization.
Golfed, 140 Bytes
Click add slider when prompted.
a=6+.1b-.1c
d=280+3b
c=\sum_{n=2005}^q\left\{0=\operatorname{mod}\left(n,4\right),0\right\}
b=100\left|\operatorname{floor}\left(.01q\right)-.01q\right|

Ungolfed, 261 Bytes
p_{world}=6+\frac{l_{astdig}-l_{eap}}{10}
p_{us}=310+3\left(l_{astdig}-10\right)
y_{ear}=2039
l_{eap}=\sum _{n=2005}^{y_{ear}}\left\{0=\operatorname{mod}\left(n,4\right),0\right\}
l_{astdig}=100\left|\operatorname{floor}\left(\frac{y_{ear}}{100}\right)-\frac{y_{ear}}{100}\right|

Ruby, 57 bytes
y=Time.now.year%40;puts "#{6+(y-(y-5)/4)*0.1} #{3*y+280}"

Unfortunately, Time.now.year really costs some characters.

Glava, 77 bytes
i|f=java.time.LocalDate.now().getYear();F("%.1f %d\n",(3.*f-5755)/40,3*f-5720

A translation of my Java answer.

APL, 25 23 29 bytes
{(10÷⍨⌊⍵÷4),⍵+33}⊃¯5753+3×⎕TS

TryAPL
Yes, it's 29 bytes.

Save two chars: (÷∘40,+∘33)¯5753+3×⊃⎕TS

PHP, 45 bytes
The code:
echo(int)(($x=3*date(y)+247)/4)*.1," ",$x+33;

Because y (the argument of date()) is an undefined constant, PHP triggers a notice (that can be muted) and converts it to a string (as we need); this PHP courtesy allows saving 2 bytes.
In order to suppress the notice, the program needs to be run using the error_reporting=0 runtime directive, like this:
$ php -d error_reporting=0 -r 'echo(int)(($x=3*date(y)+247)/4)*.1," ",$x+33;'
7.3 325

For testing
By replacing the call to date(y) with $argv[1] (the first command line argument), the program length increases with 1 byte but it can get the year from the command line.
The expected argument is the year minus 2000; it also works for negative values (years before 2000) or values greater than 40 (after year 2040).
$ php -r 'echo(int)(($x=3*$argv[1]+247)/4)*.1," ",$x+33;' 00
6.1 280

$ php -r 'echo(int)(($x=3*$argv[1]+247)/4)*.1," ",$x+33;' 01
6.2 283

$ php -r 'echo(int)(($x=3*$argv[1]+247)/4)*.1," ",$x+33;' 02
6.3 286

$ php -r 'echo(int)(($x=3*$argv[1]+247)/4)*.1," ",$x+33;' 03
6.4 289

$ php -r 'echo(int)(($x=3*$argv[1]+247)/4)*.1," ",$x+33;' 04
6.4 292

$ php -r 'echo(int)(($x=3*$argv[1]+247)/4)*.1," ",$x+33;' 15
7.3 325

$ php -r 'echo(int)(($x=3*$argv[1]+247)/4)*.1," ",$x+33;' 39
9.1 397


text:
Exchange the Stacks!
Exchange the Stacks!
Write a program that can exchange any character from two stacks. In this challenge, a stack is a tower of characters. An example stack is below:
1
a
4
d
*
c
3

There are two stacks involved in the challenge and both are inputted when the program runs. The program will also be given an argument of which position in Stack 1 to exchange with stack 2. So if the stacks look like this:
STACK 1
a
$
5
D
0
)
_

STACK 2
^
p
0
-
@
L
m

and the program is told to exchange position 2, the resulting stacks will look like this:
STACK 1
a
p
5
D
0
)
_

STACK 2
^
$
0
-
@
L
m

and the program should output them. The program should run with any stack size, not just 7, and should work with all standard characters (characters that are easily types at the keyboard, without using fancy stuff like Alt codes). Space is not required to work. Your program should accept three inputs: The contents of stack 1, the contents of stack 2 and the character to swap. Inside the program, I don't mind what form the stacks take, but when they are outputted, it must be in the form of each character separated by a newline. Input can be in any form.
Scoring
This is code-golf and so the least bytes wins!
Leaderboard
Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.
To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:
# Language Name, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:
# Ruby, <s>104</s> <s>101</s> 96 bytes

var QUESTION_ID=57831;function answersUrl(e){return"http://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),e.has_more?getAnswers():process()}})}function shouldHaveHeading(e){var a=!1,r=e.body_markdown.split("\n");try{a|=/^#/.test(e.body_markdown),a|=["-","="].indexOf(r[1][0])>-1,a&=LANGUAGE_REG.test(e.body_markdown)}catch(n){}return a}function shouldHaveScore(e){var a=!1;try{a|=SIZE_REG.test(e.body_markdown.split("\n")[0])}catch(r){}return a}function getAuthorName(e){return e.owner.display_name}function process(){answers=answers.filter(shouldHaveScore).filter(shouldHaveHeading),answers.sort(function(e,a){var r=+(e.body_markdown.split("\n")[0].match(SIZE_REG)||[1/0])[0],n=+(a.body_markdown.split("\n")[0].match(SIZE_REG)||[1/0])[0];return r-n});var e={},a=1,r=null,n=1;answers.forEach(function(s){var t=s.body_markdown.split("\n")[0],o=jQuery("#answer-template").html(),l=(t.match(NUMBER_REG)[0],(t.match(SIZE_REG)||[0])[0]),c=t.match(LANGUAGE_REG)[1],i=getAuthorName(s);l!=r&&(n=a),r=l,++a,o=o.replace("{{PLACE}}",n+".").replace("{{NAME}}",i).replace("{{LANGUAGE}}",c).replace("{{SIZE}}",l).replace("{{LINK}}",s.share_link),o=jQuery(o),jQuery("#answers").append(o),e[c]=e[c]||{lang:c,user:i,size:l,link:s.share_link}});var s=[];for(var t in e)e.hasOwnProperty(t)&&s.push(e[t]);s.sort(function(e,a){return e.lang>a.lang?1:e.lang<a.lang?-1:0});for(var o=0;o<s.length;++o){var l=jQuery("#language-template").html(),t=s[o];l=l.replace("{{LANGUAGE}}",t.lang).replace("{{NAME}}",t.user).replace("{{SIZE}}",t.size).replace("{{LINK}}",t.link),l=jQuery(l),jQuery("#languages").append(l)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",answers=[],page=1;getAnswers();var SIZE_REG=/\d+(?=[^\d&]*(?:<(?:s>[^&]*<\/s>|[^&]+>)[^\d&]*)*$)/,NUMBER_REG=/\d+/,LANGUAGE_REG=/^#*\s*([^,]+)/;
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
<link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

Can the stacks be space-separated instead of newline-separated? That would be a lot easier for the input.

@ProgramFOX Hmm... Do I want it easy? Guess it doesn't make it too easy, so yeah, OK.

@ProgramFOX Just checking: You are talking about the output, yeah?

No, I'm talking about the input. You have to get those two stacks inputted, but if you press enter for each stack item, how do you know when you have to start receiving input for a new stack? Or that you're ready inputting stacks?

when they are outputted, it must be in the form of each character separated by a space in your examples, they are separated by line breaks

@ProgramFOX Added information to clarify this.

Will the stacks always be the same size?

Do the two stacks need to be separate inputs, or can we request them to be appended?

"The program should ... should work with all standard characters (characters that are easily types at the keyboard, without using fancy stuff like Alt codes)". Ok, so it should work with ñ and ç, but doesn't need to handle ~? Or do you have some weird keyboard layout? (I.e. one that's different to mine). And is there any particular reason for talking about stacks, or are you really just interested in taking two strings and an integer n and exchanging the characters at position 2*(n-1)?

Python 3, 107 bytes
This account's first golf ;)
x,y,p=input(),input(),int(input())-1
print('\n'.join(x[:p]+y[p]+x[p+1:])+'\n'+'\n'.join(y[:p]+x[p]+y[p+1:]))

Takes input as three lines, the first being the first stack,  the second line, the second stack and the third, the position.
Outputs the stack as separated by newlines.

Welcome to PPC... G........ wait a sec

@undergroundmonorail I don't know what you're talking about ;)

@undergroundmonorail Yeah, lay off the poor guy :D

Be nice to each other, or I'll have to summon the mighty Gamma Decay!

CJam, 16 17 bytes
Didn't notice the position was 1-based. Fixed now, at the cost of 1 byte.
ll+_,2/li(_@+e\N*

Takes the input on three lines:
Stack 1
Stack 2
Position (1-based)

Also supports spaces in the stacks. Outputs the swapped stacks, one character per line.
Try it online.
Explanation
ll+               e# Concatenate first two lines
   _,2/           e# Push half length (size of one stack)
       li(        e# Read third line as integer, subtract 1
          _@+     e# Sum a copy of the position with the stack size
             e\   e# Swap (position) <-> (position + stack size)
               N* e# Join with newline

AutoIt, 135 132 129
$l=$CmdLine
$d=StringLen($l[1])
$b=$l[2]
$c=$d/2+$b
For $n=1 To $d
ConsoleWrite(StringMid($l[1],$n=$b?$c:$n=$c?$b:$n,1)&@LF)
Next

Run like this:
compiled.exe abccba 1

where abccba are both stacks concatenated and 1 is the switch position (1-based). Supports spaces and all unicode characters. Output:
c
b
c
a
b
a

C#, 238 222 213 bytes
namespace System.Linq{class A{static void Main(string[]a){int n=int.Parse(a[2])-1;Console.Write(string.Join("\n",a[0].Select((x,i)=>i==n?a[1][n]:x))+"\n\n"+string.Join("\n",a[1].Select((x,i)=>i==n?a[0][n]:x)));}}}

To execute:
compiled.exe <stack 1> <stack 2> <index to exchange>

The stacks have to be inputted without separator between the stack items, e.g. compiled.exe abcdef 123456 2.
Thanks to Andrea Biondo for saving 25 bytes!
Ungolfed code:
using System;
using System.Linq;

namespace ExchangingStacks
{
    class Program
    {
        static void Main(string[] args)
        {
            string stack1 = args[0];
            string stack2 = args[1];
            int exchangeIndex = int.Parse(args[2]) - 1;
            var newStack1 = stack1.Select((x, index) => index == exchangeIndex ? stack2[exchangeIndex] : x);
            var newStack2 = stack2.Select((x, index) => index == exchangeIndex ? stack1[exchangeIndex] : x);
            Console.Write(string.Join("\n", newStack1) + "\n\n" + string.Join("\n", newStack2));
        }
    }
}

I don't really know C#, but you can save 16 bytes by removing b and c and placing the Select calls as arguments in the string.Join calls.

@AndreaBiondo Nice, thanks!

Also replace all s with a[0] and all t with a[1] and remove s and t, another 9 chars gone :)

@AndreaBiondo Cool, thanks again!

PowerShell, 81 Bytes
param([char[]]$a,[char[]]$b,$n);$n--;$t=$b[$n];$b[$n]=$a[$n];$a[$n]=$t;$a;"`n";$b

Holy Dollar Signs, Batman! 16 of the 81 characters (~20%) are $.
The input is expected to be literal-string delimited and space-separated, thanks to the very liberal input requirements. If one of the input stacks includes the ' character, it will need to be escaped with a backtick. Example of the input from the question:
.\exchange-the-stacks.ps1 'a$5D0)_' '^p0-@Lm' 2

Pretty simple char-array manipulation. PowerShell, by default, when "executing" an array, will print each item on its own line, so simply $a will output each element newline-separated, hence why this is so competitive with other non-golfing languages, as we don't need to specially format the output.