pwaS eht tirsf dna tasl setterl fo hace dorw Or, "Swap the first and last letters of each word"

Your challenge is to, given a string of alphabetical ASCII characters as well as one other character to use as a delimiter (to separate each word), swap the first and last letters of each word. If there is a one-character word, leave it alone.

The examples/testcases use the lowercase letters and the space as the delimiter.

You do not need to handle punctuation; all of the inputs will only consist of the letters a through z, separated by a delimiter, all of a uniform case.

For example, with the string "hello world":

Input string: "hello world"
Identify each word: "[hello] [world]"
Identify the first and last letters of each word: "[[h]ell[o]] [[w]orl[d]]"
Swap the first letters of each word: "[[o]ell[h]] [[d]orl[w]]"
Final string: "oellh dorlw"

NOTE: the delimiter does not need to be inputted separately. The delimiter is just the character used to separate words. It can be anything. I wanted to leave options open for creative golfers, so I did not want to limit it to just spaces or new lines. The delimiter is just a character that separates words in the input string.

Test cases:

"swap the first and last letters of each word" -> "pwas eht tirsf dna tasl setterl fo hace dorw"
"hello world" -> "oellh dorlw"
"test cases" -> "test sasec"
"programming puzzles and code golf" -> "grogramminp suzzlep dna eodc folg"
"in a green meadow" -> "ni a nreeg weadom"
"yay racecar" -> "yay racecar"

TeX, 216 bytes (4 lines, 54 characters each)

Because it's not about the byte count, it's about the quality of the typeset output :-)

{\let~\catcode~`A13 \defA#1{~`#113\gdef}AGG#1{~`#1 13%
\global\let}GFF\elseGHH\fiAQQ{Q}AII{\ifxQ}AEE#1#2#3|{%
I#3#2#1FE{#1#2}#3|H}ADD#1#2|{I#1FE{}#1#2|H}ACC#1#2|{D%
#2Q|#1 }ABBH#1 {HI#1FC#1|BH}\gdef\S#1{\iftrueBH#1 Q }}

Try it Online! (Overleaf; not sure how it works)

Full test file:

{\let~\catcode~`A13 \defA#1{~`#113\gdef}AGG#1{~`#1 13%
\global\let}GFF\elseGHH\fiAQQ{Q}AII{\ifxQ}AEE#1#2#3|{%
I#3#2#1FE{#1#2}#3|H}ADD#1#2|{I#1FE{}#1#2|H}ACC#1#2|{D%
#2Q|#1 }ABBH#1 {HI#1FC#1|BH}\gdef\S#1{\iftrueBH#1 Q }}

\S{swap the a first and last letters of each word}

pwas eht a tirsf dna tasl setterl fo hace dorw

\S{SWAP THE A FIRST AND LAST LETTERS OF EACH WORD}

\bye

Output:

For LaTeX you just need the boilerplate:

\documentclass{article}
\begin{document}

{\let~\catcode~`A13 \defA#1{~`#113\gdef}AGG#1{~`#1 13%
\global\let}GFF\elseGHH\fiAQQ{Q}AII{\ifxQ}AEE#1#2#3|{%
I#3#2#1FE{#1#2}#3|H}ADD#1#2|{I#1FE{}#1#2|H}ACC#1#2|{D%
#2Q|#1 }ABBH#1 {HI#1FC#1|BH}\gdef\S#1{\iftrueBH#1 Q }}

\S{swap the a first and last letters of each word}

pwas eht a tirsf dna tasl setterl fo hace dorw

\S{SWAP THE A FIRST AND LAST LETTERS OF EACH WORD}

\end{document}

Explanation

TeX is a strange beast. Reading normal code and understanding it is a feat by itself. Understanding obfuscated TeX code goes a few steps further. I'll try to make this understandable for people who don't know TeX as well, so before we start here's a few concepts about TeX to make things easier to follow:

For (not so) absolute TeX beginners

First, and most important item in this list: the code does not have to be in rectangle shape, even though pop culture might lead you to think so.
TeX is a macro expansion language. You can, as an example, define \def\sayhello#1{Hello, #1!} and then write \sayhello{Code Golfists} to get TeX to print Hello, Code Golfists!. This is called an “undelimited macro”, and to feed it the first (and only, in this case) parameter you enclose it in braces. TeX removes those braces when the macro grabs the argument. You can use up to 9 parameters: \def\say#1#2{#1, #2!} then \say{Good news}{everyone}.
The counterpart of undelimited macros are, unsurprisingly, delimited ones :) You could make the previous definition a tad more semantical: \def\say #1 to #2.{#1, #2!}. In this case the parameters are followed by so-called parameter text. Such parameter text delimits the argument of the macro (#1 is delimited by ␣to␣, spaces included, and #2 is delimited by .). After that definition you can write \say Good news to everyone., which will expand to Good news, everyone!. Nice, isn't it? :) However a delimited argument is (quoting the TeXbook) “the shortest (possibly empty) sequence of tokens with properly nested {...} groups that is followed in the input by this particular list of non-parameter tokens”. This means that the expansion of \say Let's go to the mall to Martin will produce a weird sentence. In this case you'd need to “hide” the first ␣to␣ with {...}: \say {Let's go to the mall} to Martin.
So far so good. Now things start to get weird. When TeX reads a character (which is defined by a “character code”), it assigns that character a “category code” (catcode, for friends :) which defines what that character will mean. This combination of character and category code makes a token (more on that here, for example). The ones which are of interest for us here are basically:

catcode 11, which define tokens which can make up a control sequence (a posh name for a macro). By default all letters [a-zA-Z] are catcode 11, so I can write \hello, which is one single control sequence, while \he11o is the control sequence \he followed by two characters 1, followed by the letter o, because 1 is not catcode 11. If I did \catcode`1=11, from that point on \he11o would be one control sequence. One important thing is that catcodes are set when TeX first sees the character at hand, and such catcode is frozen... FOREVER! (terms and conditions may apply)
catcode 12, which are most of other characters, such as 0"!@*(?,.-+/ and so forth. They are the least special type of catcode as they serve only for writing stuff on the paper. But hey, who uses TeX for writing?!? (again, terms and conditions may apply)
catcode 13, which is hell :) Really. Stop reading and go do something out of your life. You don't want to know what catcode 13 is. Ever heard of Friday, 13th? Guess where it got its name from! Continue at your own risk! A catcode 13 character, also called an “active” character, is not just a character anymore, it is a macro itself! You can define it to have parameters and expand to something like we saw above. After you do \catcode`e=13 you think you can do \def e{I am the letter e!}, BUT. YOU. CANNOT! e is not a letter anymore, so \def is not the \def you know, it is \d e f! Oh, choose another letter you say? Okay! \catcode`R=13 \def R{I am an ARRR!}. Very well, Jimmy, try it! I dare you do that and write an R in your code! That's what a catcode 13 is. I AM CALM! Let's move on.

Okay, now to grouping. This is fairly straightforward. Whatever assignments (\def is an assignment operation, \let (we'll get into it) is another) done in a group are restored to what they were before that group started unless that assignment is global. There are several ways to start groups, one of them is with catcode 1 and 2 characters (oh, catcodes again). By default { is catcode 1, or begin-group, and } is catcode 2, or end-group. An example: \def\a{1} \a{\def\a{2} \a} \a This prints 1 2 1. Outside the group \a was 1, then inside it was redefined to 2, and when the group ended, it was restored to 1.
The \let operation is another assignment operation like \def, but rather different. With \def you define macros which will expand to stuff, with \let you create copies of already existing things. After \let\blub=\def (the = is optional) you can change the start of the e example from the catcode 13 item above to \blub e{... and have fun with that one. Or better, instead of breaking stuff you can fix (would you look at that!) the R example: \let\newr=R \catcode`R=13 \def R{I am an A\newr\newr\newr!}. Quick question: could you rename to \newR?
Finally, the so-called “spurious spaces”. This is kind of a taboo topic because there are people who claim that reputation earned in the TeX - LaTeX Stack Exchange by answering “spurious spaces” questions should not be considered, while others wholeheartedly disagree. Whom do you agree with? Place your bets! Meanwhile: TeX understands a line break as a space. Try to write several words with a line break (not an empty line) between them. Now add a % at the end of these lines. It's like you were “commenting out” these end-of-line spaces. That's it :)

(Sort of) ungolfing the code

Let's make that rectangle into something (arguably) easier to follow:

{
\let~\catcode
~`A13
\defA#1{~`#113\gdef}
AGG#1{~`#113\global\let}
GFF\else
GHH\fi
AQQ{Q}
AII{\ifxQ}
AEE#1#2#3|{I#3#2#1FE{#1#2}#3|H}
ADD#1#2#3|{I#2FE{#1}#2#3|H}
ACC#1#2|{D{}#2Q|#1 }
ABBH#1 {HI#1FC#1|BH}
\gdef\S#1{\iftrueBH#1 Q }
}

Explanation of each step

each line contains one single instruction. Let's go one by one, dissecting them:

{
First we start a group to keep some changes (namely catcode changes) local so that they don't mess up the input text.

\let~\catcode
Basically all TeX obfuscation codes start with this instruction. By default, both in plain TeX and LaTeX, the ~ character is the one active character which can be made into a macro for further use. And the best tool for weirdifying TeX code are catcode changes, so this is generally the best choice. Now instead of \catcode`A=13 we can write ~`A13 (the = is optional):

~`A13
Now the letter A is an active character, and we can define it to do something:

\defA#1{~`#113\gdef}
A is now a macro that takes one argument (which should be another character). First the catcode of the argument is changed to 13 to make it active: ~`#113 (replace the ~ by \catcode and add an = and you have: \catcode`#1=13). Finally it leaves a \gdef (global \def) in the input stream. In short, A makes another character active and start its definition. Let's try it:

AGG#1{~`#113\global\let}
AG first “activates” G and does \gdef, which followed by the next G starts the definition. The definition of G is very similar to that of A, except that instead of \gdef it does a \global\let (there isn't a \glet like the \gdef). In short, G activates a character and makes it be something else. Let's make shortcuts for two commands we'll use later:

GFF\else
GHH\fi
Now instead of \else and \fi we can simply use F and H. Much shorter :)

AQQ{Q}
Now we use A again to define another macro, Q. The above statement basically does (in a less obfuscated language) \def\Q{\Q}. This isn't a terribly interesting definition, but it has an interesting feature. Unless you do want to break some code, the only macro that expands to Q is Q itself, so it acts like a unique marker (it's called a quark). You can use the \ifx conditional to test if the argument of a macro is such quark with \ifx Q#1:

AII{\ifxQ}
so you can be pretty sure that you found such a marker. Notice that in this definition I removed the space between \ifx and Q. Usually this would lead to an error (note that the syntax highlight thinks that \ifxQ is one thing), but since now Q is catcode 13 it cannot form a control sequence. Be careful, however, not to expand this quark or you'll get stuck in an infinite loop because Q expands to Q which expands to Q which...

Now that the preliminaries are done, we can go to the proper algorithm to pwas eht setterl. Due to TeX's tokenization the algorithm has to be written backwards. This is because at the time you do a definition TeX will tokenize (assign catcodes) to the characters in the definition using the current settings so, for example, if I do:

\def\one{E}
\catcode`E=13\def E{1}
\one E

the output is E1, whereas if I change the order of the definitions:

\catcode`E=13\def E{1}
\def\one{E}
\one E

the output is 11. This is because in the first example the E in the definition was tokenized as a letter (catcode 11) before the catcode change, so it will always be a letter E. In the second example, however, E was first made active, and only then \one was defined, and now the definition contains the catcode 13 E which expands to 1.

I will, however, overlook this fact and reorder the definitions to have a logical (but not working) order. In the following paragraphs you can assume that the letters B, C, D, and E are active.

\gdef\S#1{\iftrueBH#1 Q }
(notice there was a small bug in the previous version, it did not contain the final space in the definition above. I only noticed it while writing this. Read on and you'll see why we need that one to properly terminate the macro.)
First we define the user-level macro, \S. This one shouldn't be an active character to have a friendly (?) syntax, so the macro for gwappins eht setterl is \S. The macro starts with an always-true conditional \iftrue (it will soon be clear why), and then calls the B macro followed by H (which we defined earlier to be \fi) to match the \iftrue. Then we leave the argument of the macro #1 followed by a space and by the quark Q. Suppose we use \S{hello world}, then the input stream should look like this: \iftrue BHhello world Q␣ (I replaced the last space by a ␣ so that the rendering of the site does not eat it, like I did in the previous version of the code). \iftrue is true, so it expands and we are left with BHhello world Q␣. TeX does not remove the \fi (H) after the conditional is evaluated, instead it leaves it there until the \fi is actually expanded. Now the B macro is expanded:

ABBH#1 {HI#1FC#1|BH}
B is a delimited macro whose parameter text is H#1␣, so the argument is whatever is between H and a space. Continuing the example above the input stream prior to the expansion of B is BHhello world Q␣. B is followed by H, as it should (otherwise TeX would raise an error), then the next space is between hello and world, so #1 is the word hello. And here we got to split the input text at the spaces. Yay :D The expansion of B removes everything up to the first space from the input stream and replaces by HI#1FC#1|BH with #1 being hello: HIhelloFChello|BHworld Q␣. Notice that there is a new BH later in the input stream, to do a tail recursion of B and process later words. After this word is processed B processes the next word until the word-to-be-processed is the quark Q. The last space after Q is needed because the delimited macro B requires one at the end of the argument. With the previous version (see edit history) the code would misbehave if you used \S{hello world}abc abc (the space between the abcs would vanish).

OK, back to the input stream: HIhelloFChello|BHworld Q␣. First there's the H (\fi) that completes the initial \iftrue. Now we have this (pseudocoded):

I
  hello
F
  Chello|B
H
world Q␣

The I...F...H think is actually a \ifx Q...\else...\fi structure. The \ifx test checks if the (first token of the) word grabbed is the Q quark. If it is there is nothing else to do and the execution terminates, otherwise what remains is: Chello|BHworld Q␣. Now C is expanded:

ACC#1#2|{D#2Q|#1 }
The first argument of C is undelimited, so unless braced it will be a single token, The second argument is delimited by |, so after the expansion of C (with #1=h and #2=ello) the input stream is: DelloQ|h BHworld Q␣. Notice that another | is put there, and the h of hello is put after that. Half the swapping is done; the first letter is at the end. In TeX it is easy to grab the first token of a token list. A simple macro \def\first#1#2|{#1} gets the first letter when you use \first hello|. The last one is a problem because TeX always grabs the “smallest, possibly empty” token list as argument, so we need a few work-arounds. Next item in the token list is D:

ADD#1#2|{I#1FE{}#1#2|H}
This D macro is one of the work-arounds and it's useful in the sole case where the word has a single letter. Suppose instead of hello we had x. In this case the input stream would be DQ|x, then D would expand (with #1=Q, and #2 empty) to: IQFE{}Q|Hx. This is similar to the I...F...H (\ifx Q...\else...\fi) block in B, which will see that the argument is the quark and will interrupt the execution leaving only x for typesetting. In other cases (returning to the hello example), D would expand (with #1=e and #2=lloQ) to: IeFE{}elloQ|Hh BHworld Q␣. Again, the I...F...H will check for Q but will fail and take the \else branch: E{}elloQ|Hh BHworld Q␣. Now the last piece of this thing, the E macro would expand:

AEE#1#2#3|{I#3#2#1FE{#1#2}#3|H}
The parameter text here is quite similar to C and D; the first and second arguments are undelimited, and the last one is delimited by |. The input stream looks like this: E{}elloQ|Hh BHworld Q␣, then E expands (with #1 empty, #2=e, and #3=lloQ): IlloQeFE{e}lloQ|HHh BHworld Q␣. Another I...F...H block checks for the quark (which sees l and returns false): E{e}lloQ|HHh BHworld Q␣. Now E expands again (with #1=e empty, #2=l, and #3=loQ): IloQleFE{el}loQ|HHHh BHworld Q␣. And again I...F...H. The macro does a few more iterations until the Q is finally found and the true branch is taken: E{el}loQ|HHHh BHworld Q␣ -> IoQlelFE{ell}oQ|HHHHh BHworld Q␣ -> E{ell}oQ|HHHHh BHworld Q␣-> IQoellFE{ello}Q|HHHHHh BHworld Q␣. Now the quark is found and the conditional expands to: oellHHHHh BHworld Q␣. Phew.

Oh, wait, what are these? NORMAL LETTERS? Oh, boy! The letters are finally found and TeX writes down oell, then a bunch of H (\fi) are found and expanded (to nothing) leaving the input stream with: oellh BHworld Q␣. Now the first word has the first and last letters swapped and what TeX finds next is the other B to repeat the whole process for the next word.

}
Finally we end the group started back there so that all local assignments are undone. The local assignments are the catcode changes of the letters A, B, C, ... which were made macros so that they return to their normal letter meaning and can be safely used in the text. And that's it. Now the \S macro defined back there will trigger the processing of the text as above.

One interesting thing about this code is that it is fully expandable. That is, you can safely use it in moving arguments without worrying that it will explode. You can even use the code to check if the last letter of a word is the same as the second (for whatever reason you would need that) in an \if test:

\if\S{here} true\else false\fi % prints true (plus junk, which you would need to handle)
\if\S{test} true\else false\fi % prints false

Sorry for the (probably far too) wordy explanation. I tried to make it as clear as possible for non TeXies as well :)

Summary for the impatient

The macro \S prepends the input with an active character B which grabs lists of tokens delimited by a final space and passes them to C. C takes the first token in that list and moves it to the end of the token list and expands D with what remains. D checks if “what remains” is empty, in which case a single-letter word was found, then do nothing; otherwise expands E. E loops through the token list until it finds the last letter in the word, when it is found it leaves that last letter, followed by the middle of the word, which is then followed by the first letter left at the end of the token stream by C.

JavaScript (ES6), 68 bytes

s=>s.split(" ").map(e=>e[a=e.length-1]+e.substr(1,a)+e[0]).join(" ")

Ungolfed:

s=>                                                  //function declaration
  s                                                  //input
   .split(" ")                                       //array of words
              .map(                                  //for each word
                   e=>                               //function declaration
                      e[a=e.length-1]+               //connect the last character,
                                      e.substr(1,a)+ //middle substring,
e[0]                                                 //and the first character.
    )                                                //then,
     .join(" ")                                      //connect modified words back


Make a Valentine wish with your favourite language Write the most creative program to display your Valentine wish to your favorite programming language, in that language.

E.g.

#!/usr/bin/perl

use Modern::Perl;

say "I love Perl";

C/Python Polyglot/Polygamist

Monogamy isn't for everyone.
Based on my answer to Execute Prints Backwards.

#define def main(){0?
#define print printf(
#define return 0)));}

def main():
    print "Python",
    print ", I love you much more than ",
    print "C",
    return

main();

Output, when run as C:

C, I love you much more than Python

Output, when run as Python:

Python , I love you much more than  C

mhm is it something like this ?

<?echo "I love PHP";


Hyperprogramming: N+N, N×N, N^N all in one Write a program that takes in a number N from 1 to 9 inclusive. In its native form your program should output N+N. E.g. output 2 if N is 1, 4 if N is 2, 6 if N is 3, and so on.
When every character in your program is duplicated in place, then it should be a program that takes in N (still from 1 to 9) and outputs N×N. E.g. output 1 if N is 1, 4 if N is 2, 9 if N is 3, and so on.
When every character in your program is triplicated in place, then it should be a program that takes in N (still from 1 to 9) and outputs N^N. E.g. output 1 if N is 1, 4 if N is 2, 27 if N is 3, 387420489 if N is 9, etc.
Numbers above 9 aren't required because 10^10 is outside of many language's usual integer range.
Example
If your initial program was
My_Program!
Exit();

Then it should be capable of taking in N and outputting N+N.
Additionally, the program
MMyy__PPrrooggrraamm!!

EExxiitt(());;

should take in N and output N×N.
Finally, the program
MMMyyy___PPPrrrooogggrrraaammm!!!

EEExxxiiittt((()));;;

should take in N and output N^N.
Quadrupled-character programs and beyond are not required.
Rules

Input and output should be plain, normally formatted decimal numbers. You may answer using a different base to show off your code but then your answer is non-competitive.

Windows users may treat \r\n as one character since things like \r\r\n\n wouldn't make sense or perhaps even work.

The shortest native program (the N+N one) in bytes wins.

Jelly, 12 bytes

N+N

“(ẹ+)‘FQṖṪỌv

Try it online!

N×N

““((ẹẹ++))‘‘FFQQṖṖṪṪỌỌvv

Try it online!

N^N

“““(((ẹẹẹ+++)))‘‘‘FFFQQQṖṖṖṪṪṪỌỌỌvvv

Try it online!

How it works

Jelly has several different types of string literals; all of them start with a “. If the literal contains more than one “, a string array is returned, and “ separates the strings from each other.

For example, “abc“def” yields ['abc', 'def'].

Depending on the last character of the literal (any of ”«»‘’, where « is currently unimplemented), one can choose between the different types of literals. For ‘, we get the code points in Jelly's code page instead of the corresponding Unicode characters.

For example, “abc“def‘ yields [[97, 98, 99], [100, 101, 102]].

The three literals in the programs correspond to the following code point arrays.

“(ẹ+)‘           -> [40, 214, 43, 41]
““((ẹẹ++))‘      -> [[], [40, 40, 214, 214, 43, 43, 41, 41]]
“““(((ẹẹẹ+++)))‘ -> [[], [], [40, 40, 40, 214, 214, 214, 43, 43, 43, 41, 41, 41]]

N+N

“(ẹ+)‘FQṖṪỌv                          Main link. Argument: n

“(ẹ+)‘                                As before.
      F                               Flatten the array. Yields an integer array.
       Q                              Unique; deduplicate the integers.
                                      This yields [40, 214, 43, 41].
        Ṗ                             Pop; remove the last element.
         Ṫ                            Tail; extract the last element.
                                      This yields 43, the Unicode code point of +.
          Ọ                           Unordinal; cast to character.
           v                          Eval; execute the character as a Jelly
                                      program with argument n.

N×N

““((ẹẹ++))‘‘FFQQṖṖṪṪỌỌvv              Main link. Argument: n

““((ẹẹ++))‘                           As before.
           ‘                          Increment all integers.
            FF                        Flatten the array. Yields an integer array.
              QQ                      Unique; deduplicate the integers.
                                      This yields [41, 215, 44, 42].
                ṖṖ                    Pop twice; remove the last two elements.
                  ṪṪ                  Tail; extract the last element.
                                      This yields 215, the Unicode code point of ×.
                    ỌỌ                Unordinal; cast to character.
                      v               Eval; execute the character as a Jelly
                                      program with argument n.
                       v              Eval; convert the return value (n×n) to a
                                      string and execute that string as a Jelly
                                      program with argument n. Since the string
                                      consists of a single integer literal, that
                                      integer is returned, ignoring the argument.

Note that F, Q, Ṫ, and Ọ do not alter 1D arrays, arrays without duplicates, integers, and characters (respectively).

N^N

“““(((ẹẹẹ+++)))‘‘‘FFFQQQṖṖṖṪṪṪỌỌỌvvv  Main link. Argument: n

“““(((ẹẹẹ+++)))‘                      As before.
                ‘‘                    Increment all integers twice.
                  FFF                 Flatten the array. Yields an integer array.
                     QQQ              Unique; deduplicate the integers.
                                      This yields [42, 216, 45, 43].
                        ṖṖṖ           Pop thrice; remove the last three elements.
                           ṪṪṪ        Tail; extract the last element.
                                      This yields 42, the Unicode code point of *.
                              ỌỌỌ     Unordinal; cast to character.
                                 v    Eval; execute the character as a Jelly
                                      program with argument n.
                                  vv  Eval twice. See N×N.

Gol><>, 20 18 bytes
Unlike ><>, Gol><> actually has an exponentiation built-in.
\hh
I
:
\\
\\\
X*+

Try it online!
Try it online (doubled)!
Try it online (tripled)!
Explanation
For the explanations here, I'll replace un-executed code with spaces.
\      Reflect the pointer down
I      Take an input
:      Copy the input
\\     Series of mirrors...
 \\    That reflect to the addition part
  +    Add the two numbers
  h    (Wrapped around) Print, and Halt

Explanation (doubled)
\            Reflect down

I            Take input

:            Duplicate the stack

\\           Set of mirrors...

 \\          That redirect to the * section

  *          Multiply two numbers

  h          (Wrapped around) Print + Halt

Explanation (tripled)
\            Reflect down

I            Take input

:            Duplicate input

\\           Set of mirrors...

 \\          ... That redirect to the exponentiation section

  X          Exponentiate the two values

  \h         (Wrapped around) Reflect right to the Print + Halt statement

Gol><>, 19 bytes
A longer (and more boring) version based on the ><> solution.
v
IX* +
:hh h
4
0
.

Try it online!
Try it online (doubled)!
Try it online (tripled)!


Calculate the Riemann Zeta Function Calculate the Riemann zeta function to the maximum primitive precision in your language (for C-family, that would be double or long double, var in JS, etc.) No need for BigDecimal or the like unless you need it to use a double-equivalent precision.

Efficiency (be sane) doesn't matter.
If it's not in a common language, I can't test it, but I hope somebody does.
No libraries or built-in math functions.
Recursion is cool!

See my JS entry for a sample program.

JavaScript (Chrome): 78
function zeta(r){for(var t=0,a=1,n=1;t!=a;a=t,t+=1/Math.pow(n++,r));return t}


Draw the Olympic Games logo Challenge
Draw the Olympic Games logo...

...as character (e.g. ASCII) art!
Sample Output
      * * *               * * *               * * *
  *           *       *           *       *           *
*               *   *               *   *               *
*               * * *               * * *               *
*           *   *   *   *       *   *   *   *           *
  *       *   *       *   *   *   *       *   *       *
      * * *               * * *               * * *
          *               *   *               *
            *           *       *           *
                * * *               * * *

Your art doesn't have to look exactly like mine, but it has to represent the Olympic rings well enough that it's recognizable.
Rules

The program must write the art to the console.
Shortest code (in bytes, any language) wins.
A solution that prints rings in their respective colors (or a close representation) will be awarded a minus-twenty-point bonus.

The winner will be chosen on February 23rd at the end of the 2014 Winter Olympics.

Winners

Gold: marinus - APL, 62 points

Silver: Ayiko - Perl 6, 75 points

Bronze: evuez - Python, 107 points

Popular choice: Danko Durbić - Commodore 64 BASIC

Commodore 64 BASIC

Writing directly in the screen and color memory.

Output:

Here's how you do this with sprites.

HTML + CSS ( 209 characters )
This isn't really much better than the other HTML / CSS attempt, but I wanted to try this for myself!  removing font size will again shrink down a teeny bit.
<style>e:after{content:'o';font-size:2em}e{position:absolute;color:#00f}e>e{left:9px;color:#000}e e e{color:red}e e e e{left:-4px;top:9px;color:#0F0}e e e e e{left:-9px;top:0;color:#ff0}</style><e><e><e><e><e>

fiddle:
http://jsfiddle.net/rV4eQ/
it's not really kosher code, but the e seemed fun to use.


Convert a repeated decimal to a fraction This question doesn't need to apply to just terminating decimals - repeating decimals can also be converted to fractions via an algorithm.

Your task is to make a program that takes a repeated decimal as input, and output the corresponding numerator and denominator (in lowest terms) that produces that decimal expansion. Fractions greater than 1 should be represented as improper fractions like 9/5. You can assume that input will be positive.

The repeated decimal will be given in this format:

5.3.87

with everything after the second dot repeated, like this:

5.3878787878787...

Your program will output two integers representing the numerator and denominator, separated by a slash (or the equivalent form in your language if you do not output plain text):

889/165

Note that terminating decimals will have nothing after the second dot, and decimals with no non-repeating decimal portion will have nothing between the two dots.

Test cases

These test cases cover all of the required corner cases:

0..3 = 1/3
0.0.3 = 1/30
0.00.3 = 1/300
0.6875. = 11/16
1.8. = 9/5
2.. = 2/1
5..09 = 56/11
0.1.6 = 1/6
2..142857 = 15/7
0.01041.6 = 1/96
0.2.283950617 = 37/162
0.000000.1 = 1/9000000
0..9 = 1/1
0.0.9 = 1/10
0.24.9 = 1/4

If you wish, you can also assume that fractions without integer parts have nothing to the left of the first dot. You can test that with these optional test cases:

.25. = 1/4
.1.6 = 1/6
..09 = 1/11
.. = 0/1

Perl 6 (93 101 100 80 68 66 bytes)

$/=split ".",get;say ($0+($1+$2/(9 x$2.comb||1))/10**$1.comb).nude

The size was increased to handle nothing, instead of just failing. Mouq proposed to use $/, so it's now being used, and the code is 20 bytes shorter. Ayiko proposed replacing / with , so the code is even shorter (by 12 bytes). Then Mouq proposed replacing chars with comb (in numeric context, they are identical, because list of characters after conversion to number is number of characters).

Sample output:

$ perl6 script.p6
5.3.87
889 165
$ perl6 script.p6
2.0.0
2 1
$ perl6 script.p6
0..3
1 3
$ perl6 script.p6
0.0.3
1 30
$ perl6 script.p6
0.0.0
0 1
$ perl6 script.p6
0.1.6
1 6
$ perl6 script.p6
0.01041.6
1 96
$ perl6 script.p6
0.2.283950617
37 162
$ perl6 script.p6
123.456.789
41111111 333000


Are all three integers distinct? You will be given 3 integers as input. The inputs may or may not be
 different from each other.
You have to output 1 if all three inputs
 are different from each other,
and 0 if any input is repeated more
 than once.

This is code-golf, so make your code as short as possible!

Python 3, 23 21 20 bytes

lambda*a:len({*a})>2

Try it online!

Python 2

def e(a,b,c):return 1 if len(set([a,b,c]))>2 else 0

...could be shortened to

def e(a,b,c):return len(set([a,b,c]))>2


Tweetable Mathematical Art Integer math can generate amazing patterns when laid out over a grid. Even the most basic functions can yield stunningly elaborate designs!

Your challenge

Write 3 Tweetable (meaning 140 characters or less) function bodies for the red, green, and blue values for a 1024x1024 image.

The input to the functions will be two integers i (column number for the given pixel) and j (row number for the given pixel) and the output will be an unsigned short between 0 and 1023, inclusive, which represents the amount of the given color present in the pixel (i,j).

For example, the following three functions produce the picture below:

/* RED */
    return (unsigned short)sqrt((double)(_sq(i-DIM/2)*_sq(j-DIM/2))*2.0);
/* GREEN */
    return (unsigned short)sqrt((double)(
        (_sq(i-DIM/2)|_sq(j-DIM/2))*
        (_sq(i-DIM/2)&_sq(j-DIM/2))
    ));
/* BLUE */
    return (unsigned short)sqrt((double)(_sq(i-DIM/2)&_sq(j-DIM/2))*2.0);

/* RED */
    return i&&j?(i%j)&(j%i):0;
/* GREEN */
    return i&&j?(i%j)+(j%i):0;
/* BLUE */
    return i&&j?(i%j)|(j%i):0;

The Rules

Given this C++ code, substitute in your functions. I have provided a few macros and have included the  library, and you may include complex.h. You may use any functions from these libraries and/or my macros. Please do not use any external resources beyond this.
If that version isn't working for you, make sure you're compiling with:

g++ filename.cpp -std=c++11

If that doesn't work, please use the alternate version using unsigned chars instead of unsigned shorts.

Michaelangelo has provided a cleaned up 24-bit or 48-bit color output version.

You may implement your own version in another language, but it must behave in the same way as the provided C++ version, and only functions from C++'s built-ins, the  library, or the provided macros may be used to make it fair.
Post only your three function bodies - please don't include my code in your post
Please include either a smaller version or an embedded copy of your image. They are made into a ppm format and may need to be converted to another for proper viewing on stackexchange.
Function bodies (not including signature) must be 140 characters or less.
This is a popularity contest - most votes wins

Table cloths
Flat
I started out putting a plaid/gingham pattern into perspective like a boundless table cloth:
unsigned char RD(int i,int j){
    float s=3./(j+99);
    return (int((i+DIM)*s+j*s)%2+int((DIM*2-i)*s+j*s)%2)*127;
}
unsigned char GR(int i,int j){
    float s=3./(j+99);
    return (int((i+DIM)*s+j*s)%2+int((DIM*2-i)*s+j*s)%2)*127;
}
unsigned char BL(int i,int j){
    float s=3./(j+99);
    return (int((i+DIM)*s+j*s)%2+int((DIM*2-i)*s+j*s)%2)*127;
}

Ripple
Then I introduced a ripple (not strictly correct perspective, but still in 140 characters):
unsigned char RD(int i,int j){
    float s=3./(j+99);
    float y=(j+sin((i*i+_sq(j-700)*5)/100./DIM)*35)*s;
    return (int((i+DIM)*s+y)%2+int((DIM*2-i)*s+y)%2)*127;
}
unsigned char GR(int i,int j){
    float s=3./(j+99);
    float y=(j+sin((i*i+_sq(j-700)*5)/100./DIM)*35)*s;
    return (int((i+DIM)*s+y)%2+int((DIM*2-i)*s+y)%2)*127;
}
unsigned char BL(int i,int j){
    float s=3./(j+99);
    float y=(j+sin((i*i+_sq(j-700)*5)/100./DIM)*35)*s;
    return (int((i+DIM)*s+y)%2+int((DIM*2-i)*s+y)%2)*127;
}

Colour
Then I made some of the colours more fine grained to give detail on a wider range of scales, and to make the picture more colourful...
unsigned char RD(int i,int j){
    float s=3./(j+99);
    float y=(j+sin((i*i+_sq(j-700)*5)/100./DIM)*35)*s;
    return (int((i+DIM)*s+y)%2+int((DIM*2-i)*s+y)%2)*127;
}
unsigned char GR(int i,int j){
    float s=3./(j+99);
    float y=(j+sin((i*i+_sq(j-700)*5)/100./DIM)*35)*s;
    return (int(5*((i+DIM)*s+y))%2+int(5*((DIM*2-i)*s+y))%2)*127;
}
unsigned char BL(int i,int j){
    float s=3./(j+99);
    float y=(j+sin((i*i+_sq(j-700)*5)/100./DIM)*35)*s;
    return (int(29*((i+DIM)*s+y))%2+int(29*((DIM*2-i)*s+y))%2)*127;
}

In motion
Reducing the code just slightly more allows for defining a wave phase P with 2 decimal places, which is just enough for frames close enough for smooth animation. I've reduced the amplitude at this stage to avoid inducing sea sickness, and shifted the whole image up a further 151 pixels (at the cost of 1 extra character) to push the aliasing off the top of the image. Animated aliasing is mesmerising.
unsigned char RD(int i,int j){
#define P 6.03
float s=3./(j+250),y=(j+sin((i*i+_sq(j-700)*5)/100./DIM+P)*15)*s;return (int((i+DIM)*s+y)%2+int((DIM*2-i)*s+y)%2)*127;}

unsigned char GR(int i,int j){
float s=3./(j+250);
float y=(j+sin((i*i+_sq(j-700)*5)/100./DIM+P)*15)*s;
return (int(5*((i+DIM)*s+y))%2+int(5*((DIM*2-i)*s+y))%2)*127;}

unsigned char BL(int i,int j){
float s=3./(j+250);
float y=(j+sin((i*i+_sq(j-700)*5)/100./DIM+P)*15)*s;
return (int(29*((i+DIM)*s+y))%2+int(29*((DIM*2-i)*s+y))%2)*127;}

JavaScript

Use user1455003's code to display the image.

function red(x, y) {
    return (x - Math.cos(y)) % 256;
}

function green(x, y) {
    return (Math.sqrt(x * y)) % 256;
}

function blue(x, y) {
    return Math.sqrt(x + y + x * y) % 256;
}


Last digit large number For a given list of number \$[x_1, x_2, x_3, ..., x_n]\$ find the last digit of \$x_1 ^{x_2 ^ {x_3 ^ {\dots ^ {x_n}}}}\$
Example:

[3, 4, 2] == 1
[4, 3, 2] == 4
[4, 3, 1] == 4
[5, 3, 2] == 5

Because \$3 ^ {(4 ^ 2)} = 3 ^ {16} = 43046721\$.

Because \$4 ^ {(3 ^ 2)} = 4 ^ {9} = 262144\$.

Because \$4 ^ {(3 ^ 1)} = 4 ^ {3} = 64\$.

Because \$5 ^ {(3 ^ 2)} = 5 ^ {9} = 1953125\$.

Rules:

This is code golf, so the answer with the fewest bytes wins.

If your language has limits on integer size (ex. \$2^{32}-1\$) n will be small enough that the sum will fit in the integer.

Input can be any reasonable form (stdin, file, command line parameter, integer, string, etc).

Output can be any reasonable form (stdout, file, graphical user element that displays the number, etc).

Saw on code wars.

JavaScript (ES7), 22 bytes
Limited to \$2^{53}-1\$.

a=>eval(a.join`**`)%10

Try it online!

Python 3, 19 bytes

lambda N:eval(N)%10

Try it online!

The input is given as a string where each integer is separated by the characters **. I claim that the two characters ** are equally reasonable to ,  at separating digit sequences.


Take first letter of each word, leave spaces and punctuation Shrink each word in a string of group of strings to single letters delineated by spaces or punctuation.

Example

I'm a little teapot,  short and stout. Here is my handle, here is my spout. When I get all steamed up - hear me shout!   Tip me over and pour me out.

becomes

I' a l t, s a s. H i m h, h i m s. W I g a s u - h m s! T m o a p m o.

Edit  -  if there are multiple spaces,  preserve only one space.  All punctuation should be preserved,  I missed the apostrophe.  Yes this is code  golf :-).

CJam, 13 bytes
r{(\'A,f&Sr}h

Works if I can consider only the common punctuation characters, and the output can have trailing spaces. (Thanks to Dennis.)
This question needs much more clarification...
CJam, 17 16 bytes
r{(\eu_elf&Sr}h&

Try it online.
Explanation
r          e# Read one word from input.
{          e# While it is not EOF:
    (\     e# Extract the first character.
    eu     e# Convert the rest to uppercase.
    _el    e# And lowercase.
    f&     e# Delete characters in the first string if not in the second string.
    S      e# Append a space.
    r      e# Read the next word.
}h
&          e# Discard the last space by intersecting with empty string.

Perl 6, 15 bytes

s:g/(\w)\w+/$0/

Try it online!


Golf a transcendental number Definitions

An algebraic number is a number that is a zero of a non-zero polynomial with integer coefficients. For example, the square root of 2 is algebraic, because it is a zero of x^2 - 2.
A transcendental number is a real number which is not algebraic.

Task

You are to choose a transcendental number.

Then, write a program/function that takes a positive integer n and output the n-th decimal digit after the decimal point of your chosen transcendental number. You must state clearly in your submission, which transcendental number is used.

You can use 0-indexing or 1-indexing.

Example

e^2=7.389056098... is a transcendental number. For this number:

n output
1 3
2 8
3 9
4 0
5 5
6 6
7 0
8 9
9 8
...

Note that the initial 7 is ignored.

As I mentioned above, you can choose other transcendental numbers.

Scoring

This is code-golf. Lowest score in bytes wins.

Python, 3 bytes

min

Try it online!

Takes a number string, outputs its smallest digit as a smallest character. For example, 254 gives 2. The decimal with these digits starts

0.0123456789011111111101222222220123333333012344444401234555550123456666012345678801234567

This is OEIS A054054.

Claim: This number c is transcendental

Proof:  Note that c is very sparse: almost all of its digits are zero. That's because large n, there's high probability n has a zero digit, giving a digit min of zero. Moreover, c has long runs of consecutive zeroes. We use an existing result that states this means c is transcendental.

Following this math.SE question, let Z(k) represent the position of the k'th nonzero digit of c, and let c_k be that nonzero digit, a whole number between 1 and 9. Then, we express the decimal expansion of c, but only taking the nonzero digits, as as the sum over k=1,2,3,... of c_k/10^Z(k).

We use the result of point 4 of this answer by George Lowther: that c is transcendental if there are infinitely many runs of zeroes that are at least a constant fraction of the number of digits so far. Formally, there must be an ε>0 so that Z(k+1)/Z(k) > 1+ε for infinitely many k. We'll use ε=1/9

For any number of digits d, take k with Z(k) = 99...99 with d nines.  Such a k exists because this digit in c is a 9, and so nonzero. Counting up from 99...99, these numbers all contain a zero digit, so it marks the start of a long run of zeroes in c. The next nonzero digit isn't until Z(k+1) = 1111...11 with d+1 ones. The ratio Z(k+1)/Z(k) slightly exceeds 1+1/9.

This satisfies the condition for every d, implying the result.

Fourier, 16 bytes

I~NL~S10PS~XN/Xo

Try it online!

As other answers have done, outputs the first digit of the input.

An explanation of the code:

N = User Input
S = log(N)
X = 10 ^ S
Print (N/X)


No A, just CAPS LOCK What happens when the CapsLock key on your keyboard doesn't have a notch in it?

"This hPPENS."

The goal of this program is to consistently emulate keyboard misses where each A press is replaced with CapsLock. Uppercase 'A's from the source should yield the same effect. When CapsLock is enabled, capitalization is reversed.

Test Cases

"The quick brown fox jumps over the lazy dog."
-> "The quick brown fox jumps over the lZY DOG."

"Compilation finished successfully."
-> "CompilTION FINISHED SUCCESSFULLY."

"What happens when the CapsLock key on your keyboard doesn't have a notch in it?"
-> "WhT Hppens when the CPSlOCK KEY ON YOUR KEYBOrd doesn't hVE  notch in it?"

"The end of the institution, maintenance, and administration of government, is to secure the existence of the body politic, to protect it, and to furnish the individuals who compose it with the power of enjoying in safety and tranquillity their natural rights, and the blessings of life: and whenever these great objects are not obtained, the people have a right to alter the government, and to take measures necessary for their safety, prosperity and happiness."
-> "The end of the institution, mINTENnce, ND dministrTION OF GOVERNMENT, IS TO SECURE THE EXISTENCE OF THE BODY POLITIC, TO PROTECT IT, nd to furnish the individuLS WHO COMPOSE IT WITH THE POWER OF ENJOYING IN Sfety ND TRnquillity their nTURl rights, ND THE BLESSINGS OF LIFE: nd whenever these greT OBJECTS re not obtINED, THE PEOPLE Hve  RIGHT TO lter the government, ND TO Tke meSURES NECESSry for their sFETY, PROSPERITY nd hPPINESS."

"aAaaaaAaaaAAaAa"
-> "" (Without the notch, no one can hear you scream)

"CapsLock locks cAPSlOCK"
-> "CPSlOCK LOCKS CPSlOCK"

"wHAT IF cAPSlOCK IS ALREADY ON?"
-> "wHt if CPSlOCK IS lreDY ON?"

The winning criterion is, as usual, the size of the submitted program's source code.

AutoHotKey, 7 bytes

a::vk14

// Is this valid? This really do what OP want -- replace a by CapsLock (vk14).

Run this program, and type the input from keyboard..

Pyth, 21 bytes

ssm+Pdr2edcscR\AcQ\a2

Try it here

Explanation

ssm+Pdr2edcscR\AcQ\a2
           scR\AcQ\a   Split the input on 'a' and 'A'
          c         2  Split the blocks into pairs.
  m  d   d             For each pair...
   +P r2e              ... cAPSlOCK the second block.
ss                     Join the blocks together.


Mix pi and e to make pie! Everybody knows pi the mathematical constant, the ratio of a circle's circumference to its diameter.

3.14159265358979323846264338327950288419716939937510...

You probably also know e the mathematical constant, the base of a natural logarithm.

2.71828182845904523536028747135266249775724709369996...

But... do you know pie? It is one of the most important constants (to me). It is the digits of pi and e interleaved.

32.1741185298216852385485997094352233854366206248373...

As a decimal expansion:

3, 2, 1, 7, 4, 1, 1, 8, 5, 2, 9, 8, 2, 1, 6, 8, 5, 2...

This is OEIS sequence A001355.

  KEYWORD: nonn,base,dumb,easy

It is a very dumb sequence.

Challenge

Write a program/function that takes a non-negative integer n and outputs the nth digit of pie.

Specifications

Standard I/O rules apply.
Standard loopholes are forbidden.
Your solution must work for at least 50 digits of each constant which means it should work for at least a 100 terms of the sequence (please, try not to hardcode :P).
The output for 2 or 3 is not a decimal point.
Your solution can either be 0-indexed or 1-indexed but please specify which.
This challenge is not about finding the shortest approach in all languages, rather, it is about finding the shortest approach in each language.
Your code will be scored in bytes, usually in the encoding UTF-8, unless specified otherwise.
Built-in functions that compute this sequence are allowed but including a solution that doesn't rely on a built-in is encouraged.
Explanations, even for "practical" languages, are encouraged.

Test cases

These are 0-indexed.

Input   Output

1       2
2       1
11      8
14      6
21      4
24      9
31      5

In a few better formats:

1 2 11 14 21 24 31
1, 2, 11, 14, 21, 24, 31

2 3 12 15 22 25 32
2, 3, 12, 15, 22, 25, 32

Mathematica, 50 bytes
1-indexed
(Riffle@@(#&@@RealDigits[#,10,5!]&/@{Pi,E}))[[#]]&

Python2, 80 76 bytes

from math import*
lambda n:([(3,2)]+zip('%.49f'%pi,'%.49f'%e)[2:])[n/2][n%2]

0-indexed.

EDIT: Saved 4 bytes by removing parens around pi and e. (Thanks LyricLy!)

EDIT: I can't find a python library that matches sequence A001355 past index 33 (math, numpy, sympy, mpmath with increased precision). Thanks to flornquake for pointing out the precision issue.

Explanation:

from math import*    # built-in math module, contains the constants 'pi' and 'e'
lambda n:            # an anonymous function that takes input n
    ( [(3,2)]        # the first digits of the sequence
    +
    zip(             # interleave contents. (1,2,3),(4,5,6) -> (1,4,2,5,3,6)
        '%.49f'%(pi),'%.49f'%(e)    # convert constants to strings with length
                                    # after the decimal == 49.
    )[2:])           # get sequence after first tow sets (3,2) and ('.', '.')
[n/2][n%2]           # sequence is currently like [(3, 2), (1, 7), (4, 1), (1, 8) ...]
                     # get pair indicated by n by dividing by 2 (integer division, floors)
                     # then get item in pair by modding by 2 (0 or 1)
                     # So, sequence item 7 would be pair 3, item 1 == 8.


Print the alphabet without using each vowel Inspiration: in 1939, a man named Ernest Vincent Wright wrote a novel called Gadsby without using the letter 'e'.
Your task is to write a set of (up to 5) programs in any language (which has a text-based syntax*) to output all 26 letters of the alphabet in order.  However for each vowel aeiou, at least one of the programs must not include any occurrence of the vowel.
So there must be

a program that does not use 'a' or 'A' anywhere in the syntax of the program.
a program that does not use 'e' or 'E' anywhere in the syntax of the program.
a program that does not use 'i'  or 'I' anywhere in the syntax of the program.
a program that does not use 'o' or 'O' anywhere in the syntax of the program.
a program that does not use 'u' or 'U' anywhere in the syntax of the program.

All of them must output abcdefghijklmnopqrstuvwxyz.
The winner shall be the solution where the length of all programs is the shortest.
* since the constraint wouldn't be much of a challenge in Piet or Whitespace

JavaScript, 43 Chars (run in terminal)
"\141bcd\145fgh\151jklmn\157pqrst\165vwxyz"


Converting to Secret Language Write some code in any language that inputs a string such as "Today is a great day" (Note that there is no punctuation) and converts it to the "Secret Language". Here are the rules for the "Secret Language".

a=c, b=d, c=e and so on (y=a and z=b)
separate each word by a space
make sure there is proper capitalization

Example:

Input: "Today is a great day"

Output: "Vqfca ku c itgcv fca"

It is a popularity-contest. Other users should give points by looking for most "to the point" yet "unique" code.

CHALLENGE:
I was looking up uncommon programming languages and I found a language called Piet (esolang). I challenge anyone to write it in this language.

Smalltalk (Smalltalk/X), 29 27 chars
I am lucky - it is already in the String class:
'Today is a great day' rot:2
    -> 'Vqfca ku c itgcv fca'

adding I/O, this makes it:
(Stdin nextLine rot:2)print

in the spirit of doorknob's obfuscated example below, how about:
Parser evaluate:('(Uvfkp pgzvNkpg tqv:2)rtkpvPN' rot:-2)


Insanity Check Program Insanity: doing the same thing over and over again and expecting different results.

Write a program that just throws an exception (runtime error) each time it is run. The challenge being to have the probability to produce more than one crash, without calling the exceptions directly (no throw statements) and not to use built in random or cpu tick counting functions.

10 points for each possible error.
25 bonus points if the error/crash occurs on another process or the system.

Rules

Responses must indicate what error(s) are possible and how they are generated.
Cannot use the system (built-in) random number generator unless it is seeded with the same number each time the program runs.
Cannot use the number of tics or cpu cycles, unless they are counted relatively to the start of the main program thread.
Multithreading is allowed (if not encouranged).

Edit 1

GUID generation falls under the built-in random number generator. Custom "homegrown" GUID generation is permitted.
Accessing the file system is permitted for I/O of files except when done to bypass the rules (read a file of random bits, or timestamp).

Edit 2

Calling abort() or assert() violates the spirit of the challenge of making insane software and thus no 10 points will be awarded for this mode of failure.

Good luck!

Java, 400

Java is blessed (?) with many Exceptions and Errors. There are many Exceptions that are specific to the operation of a single class. As an example of one of the most extreme cases, there are more than 10 Exceptions (all are subclass of IllegalFormatException) dedicated to Formatter class alone, and I have taken time to make the code throws (almost) all of them.

My current answer features 40 different Exceptions/Errors, and they randomly get executed depending on the modulo of System.nanoTime() with some integer.

  This method can only be used to measure elapsed time and is not related to any other notion of system or wall-clock time. The value returned represents nanoseconds since some fixed but arbitrary origin time (perhaps in the future, so values may be negative). The same origin is used by all invocations of this method in an instance of a Java virtual machine; other virtual machine instances are likely to use a different origin.

The method above should be allowed, since it falls into case "3. Cannot use the number of tics or cpu cycles, unless they are counted relatively to the start of the main program thread".

Compilation Instruction

Oracle's JRE/JDK or OpenJDK is strongly recommended for running the code. Otherwise, some Exception may not be thrown, since some of them relies on the internal details of the reference implementation and I don't have a reliable fall-back.

The code below compiles successfully with javac 1.7.0_11 and produces all Exceptions on java 1.7.0_51.

To run this code, you need to copy and paste the code below to a Unicode aware editor (e.g. Notepad++), save it in UTF-16 (Big-Endian or Little-Endian doesn't matter as long as the BOM is written).
Change working directory (cd) to where the source code is saved (this is important).
Compile the code with the following command:

javac G19115.java -encoding "UTF-16"

And run the code:

java G19115

There is nothing destructive in my code, since I also want to test run it on my computer. The most "dangerous" code is deleting ToBeRemoved.class file in the current folder. Other than that, the rest doesn't touch the file system or the network.

import java.util.*;
import java.util.regex.*;
import java.lang.reflect.*;
import java.text.*;
import java.io.*;
import java.nio.*;
import java.nio.charset.*;
import java.security.*;

class G19115 {

    // The documentation says System.nanoTime() does not return actual time, but a relative
    // time to some fixed origin.
    private static int n = (int) ((System.nanoTime() % 40) + 40) % 40;

    @SuppressWarnings("deprecation")
    public static void main(String args[]) {

        /**
         * If the code is stated to be a bug, then it is only guaranteed to throw Exception on
         * Oracle's JVM (or OpenJDK). Even if you are running Oracle's JVM, there is no
         * guarantee it will throw Exception in all future releases future either (since bugs
         * might be fixed, classes might be reimplemented, and an asteroid might hit the earth,
         * in order from the least likely to most likely).
         */

        System.out.println(n);

        switch (n) {
            case 0:
                // Bug JDK-7080302
                // https://bugs.openjdk.java.net/browse/JDK-7080302
                // PatternSyntaxException
                System.out.println(Pattern.compile("a(\u0041\u0301\u0328)", Pattern.CANON_EQ));
                System.out.println(Pattern.compile("öö", Pattern.CANON_EQ));

                // Leave this boring pattern here just in case
                System.out.println(Pattern.compile("??+*"));
                break;
            case 1:
                // Bug JDK-6984178
                // https://bugs.openjdk.java.net/browse/JDK-6984178
                // StringIndexOutOfBoundsException
                System.out.println(new String(new char[42]).matches("(?:(?=(\\2|^))(?=(\\2\\3|^.))(?=(\\1))\\2)+."));

                // Leave this boring code here just in case
                System.out.println("".charAt(1));
                break;
            case 2:
                // IllegalArgumentException

                // Bug JDK-8035975
                // https://bugs.openjdk.java.net/browse/JDK-8035975
                // Should throw IllegalArgumentException... by documentation, but does not!
                System.out.println(Pattern.compile("pattern", 0xFFFFFFFF));

                // One that actually throws IllegalArgumentException
                System.out.println(new SimpleDateFormat("Nothing to see here"));
                break;
            case 3:
                // Bug JDK-6337993 (and many others...)
                // https://bugs.openjdk.java.net/browse/JDK-6337993
                // StackOverflowError
                StringBuffer buf = new StringBuffer(2000);
                for (int i = 0; i < 1000; i++) {
                    buf.append("xy");
                }
                System.out.println(buf.toString().matches("(x|y)*"));

                // Leave this boring code here just in case
                main(args);
                break;
            case 4:
                // NumberFormatException
                String in4 = "123\r\n";
                Matcher m4 = Pattern.compile("^\\d+$").matcher(in4);

                if (m4.find()) {
                    System.out.println(Integer.parseInt(in4));
                } else {
                    System.out.println("Bad input");
                }

                // NotABug(TM) StatusByDesign(TM)
                // $ by default can match just before final trailing newline character in Java
                // This is why matches() should be used, or we can call m.group() to get the string matched
                break;
            case 5:
                // IllegalStateException
                String in5 = "123 345 678 901";
                Matcher m5 = Pattern.compile("\\d+").matcher(in5);

                System.out.println(m5.group(0));

                // The Matcher doesn't start matching the string by itself...
                break;
            case 6:
                // ArrayIndexOutOfBoundsException

                // Who is the culprit?
                String[] in6 = {
                    "Nice weather today. Perfect for a stroll along the beach.",
                    " Mmmy  keeyboaardd    iisss   bbrokkkkeeen  ..",
                    "",
                    "\t\t\t     \n\n"};
                for (String s: in6) {
                    System.out.println("First token: " + s.split("\\s+")[0]);
                }

                // Culprit is "\t\t\t     \n\n"
                // String.split() returns array length 1 with empty string if input is empty string
                //                        array length 0 if input is non-empty and all characters match the regex
                break;
            case 7:
                // ConcurrentModificationException

                List<Integer> l7 = testRandom(42);
                Integer prev = null;
                // Remove duplicate numbers from the list
                for (Integer i7: l7) {
                    if (prev == null) {
                        prev = i7;
                    } else {
                        if (i7.equals(prev)) {
                            l7.remove(i7);
                        }
                    }
                }

                System.out.println(l7);

                // This is one of the typical mistakes that Java newbies run into
                break;
            case 8:
                // ArithmeticException

                // Integer division by 0 seems to be the only way to trigger this exception?
                System.out.println(0/0);
                break;
            case 9:
                // ExceptionInInitializerError
                // Thrown when there is an Exception raised during initialization of the class

                // What Exception will be thrown here?
                Static s9 = null;
                System.out.println(s9.k);

                // A bit less interesting
                Static ss9 = new Static();

                // ----
                // A class is only initialized when any of its method/field is
                // used for the first time (directly or indirectly)

                // Below code won't throw Exception, since we never access its fields or methods
                // Static s;
                // OR
                // Static s = null;
                break;
            case 10:
                // BufferOverflowException
                short s10 = 20000;
                ShortBuffer b10 = ShortBuffer.allocate(0).put(s10);

                // Boring stuff...
                break;
            case 11:
                // BufferUnderflowException
                ShortBuffer.allocate(0).get();

                // Another boring stuff...
                break;
            case 12:
                // InvalidMarkException
                ShortBuffer.allocate(0).reset();

                // Boring stuff again...
                // reset() cannot be called if mark() is not called before
                break;
            case 13:
                // IndexOutOfBoundsException
                System.out.println("I lost $m dollars".replaceAll("[$]m\\b", "$2"));

                // $ needs to be escaped in replacement string, since it is special
                break;
            case 14:
                // ClassCastException
                Class c14 = Character.class;
                for (Field f: c14.getFields()) {
                    System.out.println(f);
                    try {
                        int o = (int) f.get(c14);
                        // If the result is of primitive type, it is boxed before returning
                        // Check implementation of sun.reflect.UnsafeStaticIntegerFieldAccessorImpl
                        System.out.println(o);
                    } catch (IllegalAccessException e) {
                        e.printStackTrace();
                    }
                }
                break;
            case 15:
                // NoSuchElementException
                List<Integer> l15 = new ArrayList<Integer>();
                Iterator i = l15.iterator();

                System.out.println(i.next());
                // Another boring one...
                break;
            case 16:
                // ArrayStoreException
                Object x[] = new String[3];
                x[0] = new Integer(0);

                // Straight from the documentation
                // I don't even know that this exists...
                break;
            case 17:
                // IllegalThreadStateException
                Thread t17 = new Thread();
                t17.start();
                t17.setDaemon(true);

                // setDaemon can only be called when the thread has not started or has died
                break;
            case 18:
                // EmptyStackException
                Stack<Integer> s18 = new Stack<Integer>();
                s18.addAll(testRandom(43));
                while (s18.pop() != null);

                // Originally ThreadDeath, which works when running from Dr. Java but not when
                // running on cmd line. Seems that Dr. Java provides its own version of
                // Thread.UncaughtExceptionHandler that prints out ThreadDeath.

                // Please make do with this boring Exception
                break;
            case 19:
                // NegativeArraySizeException
                Array.newInstance(Integer.TYPE, -1);

                // Do they have to create such a specific Exception?
                break;
            case 20:
                // OutOfMemoryError
                Array.newInstance(Integer.TYPE, 1000, 1000, 1000, 1000);
                break;
            case 21:
                // UnsupportedCharsetException

                // UCS-2 is superseded by UTF-16
                Charset cs21 = Charset.forName("UCS-2");
                CharsetEncoder ce21 = cs21.newEncoder();

                // Just in case...
                cs21 = Charset.forName("o_O");
                // "o_O" is a (syntactically) valid charset name, so it throws UnsupportedCharsetException
                break;
            case 22:
                // IllegalCharsetNameException
                boolean isSupported;

                isSupported = Charset.isSupported("o_O");
                isSupported = Charset.isSupported("+_+");
                Charset cs22 = Charset.forName("MerryChristmas!Hohoho!");

                // This is getting stupid...
                break;
            case 23:
                // NoClassDefFoundError
                File f = new File("ToBeRemoved.class");
                f.delete();

                ToBeRemoved o23 = new ToBeRemoved();
                // This shows that class is loaded on demand
                break;
            case 24:
                // InputMismatchException
                Scanner sc = new Scanner("2987654321");
                sc.nextInt();

                // Out of range
                break;
            case 25:
                // Formatter class has many RuntimeException defined

                // DuplicateFormatFlagsException
                System.out.printf("%0000000000000000000000000000000000000000000000000005%d\n", 42);
                break;
            case 26:
                // FormatFlagsConversionMismatchException
                System.out.printf("%,d\n", Integer.MAX_VALUE);

                System.out.printf("%,x\n", Integer.MAX_VALUE);
                // Thousand separator is only applicable to base 10

                System.out.printf("%(5.4f\n", Math.PI);
                System.out.printf("%(5.4f\n", -Math.PI);

                System.out.printf("%(5.4a\n", -Math.PI);
                // '(' flag is used to surround negative value with "( )" instead of prefixing with '-'
                // '(' can't be used with conversion 'a'
                break;
            case 27:
                // IllegalFormatCodePointException
                System.out.printf("%c", Character.MAX_CODE_POINT + 1);

                // Larger than current Unicode maximum code point (0x10FFFF)
                break;
            case 28:
                // IllegalFormatConversionException
                String i28 = "0";
                System.out.printf("%d", i28);

                // A boring example
                break;
            case 29:
                // IllegalFormatFlagsException
                System.out.printf("% d\n", Integer.MAX_VALUE);
                System.out.printf("% d\n", Integer.MIN_VALUE);

                System.out.printf("%+d\n", Integer.MAX_VALUE);
                System.out.printf("%+d\n", Integer.MIN_VALUE);

                System.out.printf("% +d\n", Integer.MIN_VALUE);
                // Use either ' ' or '+ ' flag, not both, since they are mutually exclusive
                break;
            case 30:
                // IllegalFormatPrecisionException
                System.out.printf("%5.4f\n", Math.PI);
                System.out.printf("%5.4a\n", Math.PI);
                System.out.printf("%5.4x\n", Math.PI);

                // Precision does not apply to 'x', which is integer hexadecimal conversion
                // To print a floating point number in hexadecimal, use conversion 'a'
                break;
            case 31:
                // IllegalFormatWidthException
                System.out.printf("%3n");

                // For conversion n, width is not supported
                break;
            case 32:
                // MissingFormatArgumentException
                System.out.printf("%s\n%<s", "Pointing to previous argument\n");
                System.out.printf("%<s", "Pointing to previous argument");

                // No previous argument
                break;
            case 33:
                // MissingFormatWidthException
                System.out.printf("%5d %<d\n", 42); // Pad left
                System.out.printf("%-5d %<d\n", 42); // Pad right

                System.out.printf("%-d\n", 42);
                // Missing width
                break;
            case 34:
                // UnknownFormatConversionException
                System.out.printf("%q", "Shouldn't work");

                // No format conversion %q

                // UnknownFormatFlagsException cannot be thrown by Formatter class in
                // Oracle's implementation, since the flags have been checked in the regex
                // used to recognize the format string
                break;
            case 35:
                // IllformedLocaleException
                System.out.printf(new Locale("ja"), "%tA %<tB %<tD %<tT %<tZ %<tY\n", new Date());

                System.out.printf(new Locale.Builder().setLanguage("ja").setScript("JA").setRegion("JA").build(), "%tA %<tB %<tD %<tT %<tZ %<tf\n", new Date());
                // Thrown by Locale.Builder.setScript()
                break;
            case 36:
                // NullPointerException
                Pattern p36 = Pattern.compile("a(b)?c");
                Matcher m36 = p36.matcher("ac");

                if (m36.find()) {
                    for (int i36 = 0; i36 <= m36.groupCount(); i36++) {
                        // Use Matcher#end(num) - Matcher#start(num) for length instead
                        System.out.printf("%3d [%d]: %s\n", i36, m36.group(i36).length(), m36.group(i36));
                    }
                }
                break;
            case 37:
                // AccessControlException
                System.setSecurityManager(new SecurityManager());
                System.setSecurityManager(new SecurityManager());
                break;
            case 38:
                // SecurityException
                // Implementation-dependent
                Class ϲlass = Class.class;
                Constructor[] constructors = ϲlass.getDeclaredConstructors();
                for (Constructor constructor: constructors) {
                    constructor.setAccessible(true);
                    try {
                        Class Сlass = (Class) constructor.newInstance();
                    } catch (Throwable e) {
                        System.out.println(e.getMessage());
                    }
                    // The code should reach here without any Exception... right?
                }

                // It is obvious once you run the code
                // There are very few ways to get SecurityException (and not one of its subclasses)
                // This is one of the ways
                break;
            case 39:
                // UnknownFormatFlagsException
                // Implementation-dependent
                try {
                    System.out.printf("%=d", "20");
                } catch (Exception e) {
                    // Just to show the original Exception
                    System.out.println(e.getClass());
                }

                Class classFormatter = Formatter.class;
                Field[] fs39 = classFormatter.getDeclaredFields();
                boolean patternFound = false;
                for (Field f39: fs39) {
                    if (Pattern.class.isAssignableFrom(f39.getType())) {
                        f39.setAccessible(true);
                        // Add = to the list of flags
                        try {
                            f39.set(classFormatter, Pattern.compile("%(\\d+\\$)?([-#+ 0,(\\<=]*)?(\\d+)?(\\.\\d+)?([tT])?([a-zA-Z%])"));
                        } catch (IllegalAccessException e) {
                            System.out.println(e.getMessage());
                        }
                        patternFound = true;
                    }
                }
                if (patternFound) {
                    System.out.printf("%=d", "20");
                }

                // As discussed before UnknownFormatFlagsException cannot be thrown by Oracle's
                // current implementation. The reflection code above add = to the list of flags
                // to be parsed to enable the path to the UnknownFormatFlagsException.
                break;
        }
    }

    /*
     * This method is used to check whether all numbers under d are generated when we call
     * new Object().hashCode() % d.
     *
     * However, hashCode() is later replaced by System.nanoTime(), since it got stuck at
     * some values when the JVM is stopped and restarted every time (running on command line).
     */
    private static List<Integer> testRandom(int d) {
        List<Integer> k = new ArrayList<Integer>();
        for (int i = 0; i < 250; i++) {
            k.add(new Object().hashCode() % d);
        }
        Collections.sort(k);

        System.out.println(k);

        return k;
    }
}

class ToBeRemoved {};

class Static {
    static public int k = 0;
    static {
        System.out.println(0/0);
    }
}

List of Exceptions and Errors

In order as declared in switch-case statement. There are 37 Exceptions and 3 Errors in total.

PatternSyntaxException (via bug in Pattern, with boring case as backup)
StringIndexOutOfBoundsException (via bug in Pattern, with boring case as backup)
IllegalArgumentException (helps me find a bug in Pattern, with boring case as backup)
StackOverflowError (via recursive implementation in Pattern, with boring case as backup)
NumberFormatException (shows that $ in Pattern can match before final line terminator)
IllegalStateException (via accessing matched groups in Matcher without performing a match)
ArrayIndexOutOfBoundsException (shows confusing behavior of split(String regex))
ConcurrentModificationException (via modifying a Collection during a for-each loop)
ArithmeticException (via integer division by 0)
ExceptionInInitializerError (via causing Exception during initialization of a class)
BufferOverflowException (java.nio.*-specific Exception)
BufferUnderflowException (java.nio.*-specific Exception)
InvalidMarkException (java.nio.*-specific Exception)
IndexOutOfBoundsException (via reference to non-existent capturing group in replacement)
ClassCastException
NoSuchElementException
ArrayStoreException
IllegalThreadStateException
EmptyStackException (java.util.Stack-specific Exception)
NegativeArraySizeException
OutOfMemoryError (via boring allocation of big array)
UnsupportedCharsetException
IllegalCharsetNameException (shows when Charset.isSupported(String name) returns false or throws Exception)
NoClassDefFoundError (shows that classes are loaded on first access to method/constructor or field)
InputMismatchException (java.util.Scanner-specific Exception)
DuplicateFormatFlagsException (from here to 35 are java.util.Formatter-specific Exceptions)
FormatFlagsConversionMismatchException (with interesting example of format syntax)
IllegalFormatCodePointException
IllegalFormatConversionException
IllegalFormatFlagsException
IllegalFormatPrecisionException
IllegalFormatWidthException
MissingFormatArgumentException (with interesting example of format syntax)
MissingFormatWidthException
UnknownFormatConversionException
IllformedLocaleException
NullPointerException
AccessControlException (shows that the default SecurityManager is usable)
SecurityException (via invoking constructor of Class class)
UnknownFormatFlagsException (shows that this Exception can't be thrown in Oracle's implementation, no backup)

In Actionscript

function g() {
   if (x==undefined) {
        h();
   } else {
     j();
   }
}

function h() {
   if (y==undefined) {
        j();
   } else {
    x = 1;
     g();
   }
}

function j() {
   if (z==undefined) {
      y=2;
      h();
   } else {
      g();
   }
}

g();

Functions are called in a never ending loop causing the interpreter to crash.


Fit a word into an alphabet grid Inspired by a meme I saw earlier today.

Challenge description

Consider an infinite alphabet grid:

ABCDEFGHIJKLMNOPQRSTUVWXYZ
ABCDEFGHIJKLMNOPQRSTUVWXYZ
ABCDEFGHIJKLMNOPQRSTUVWXYZ
ABCDEFGHIJKLMNOPQRSTUVWXYZ
ABCDEFGHIJKLMNOPQRSTUVWXYZ
...

Take a word (CODEGOLF in this example) and make it a subsequence of the grid, replacing unused letters by a space and removing letters at the end of the infinite grid altogether:

  C           O
   DE G       O
           L
     F

Examples

STACKEXCHANGE

                  ST
A C       K
    E                  X
  C    H
A            N
      G
    E

ZYXWVUTSRQPONMLKJIHGFEDCBA

                         Z
                        Y
                       X
                      W
                     V
                    U
                   T
                  S
                 R
                Q
               P
              O
             N
            M
           L
          K
         J
        I
       H
      G
     F
    E
   D
  C
 B
A

F

     F

ANTIDISESTABLISHMENTARIANISM

A            N     T
        I
   D    I         S
    E             ST
AB         L
        I         S
       H    M
    E        N     T
A                R
        I
A            N
        I         S
            M

Notes

Trailing whitespaces are allowed.
You don't need to pad the last any line with spaces. For example, if the input is ABC, you may output just ABC without 23 trailing spaces.
You may assume input will match [A-Z]+ regex.
Alternatively, you may use lower-case alphabet, in which case output will match [a-z]+.
You must use a newline (\n, \r\n or equivalent) to separate lines, that is a list of strings is not a proper output format.
This is a code-golf challenge, so make your code as short as possible!

Husk, 15 bytes

TṪS`?' €…"AZ"ġ>

Try it online!

Explanation

TṪS`?' €…"AZ"ġ>  Implicit input, e.g. "HELLO"
             ġ>  Split into strictly increasing substrings: x = ["H","EL","LO"]
        …"AZ"    The uppercase alphabet (technically, the string "AZ" rangified).
 Ṫ               Outer product of the alphabet and x
  S`?' €         using this function:
                   Arguments: character, say c = 'L', and string, say s = "EL".
       €           1-based index of c in s, or 0 if not found: 2
  S`?'             If this is truthy, then c, else a space: 'L'
                 This gives, for each letter c of the alphabet,
                 a string of the same length as x,
                 containing c for those substrings that contain c,
                 and a space for others.
T                Transpose, implicitly print separated by newlines.


Fix a broken random function A friend has an add-on card in their computer which generates a perfectly random number from 1 to 5 inclusive. Unfortunately, they spilt cola on it somehow, and it now generates only 2's for all numbers from 1 to 4. Luckily the randomness is preserved, but 2 has a probability of 80% and 5 has a probability of 20%, and there are no 1's, 3's or 4's generated. Using this random source (call it BrokenRand() or something similar), write a working random number generator which produces numbers from 1 to 5 each with an equal 20% probability with the same perfect randomness as the original source.

Shortest program wins. Bonus points awarded for the minimum number of calls to BrokenRand impartially by a demographically-selected customer service focus consultancy, broken down by age and sex - i.e. me.

JavaScript - 69 characters

This uses the von Neumann extractor to generate unbiased bits; the general algorithm is also described on the HotBits website. Three bits are used to form a number from 0 to 7. All numbers 5 and above are discarded, and 1 is added to each of the rest before they are printed. I made a simulation to show that this is not heavily biased.

You need to provide your own function r() to access the RNG.

 for(;;v<5&&alert(v+1))for(v=i=0;i<3;a-b&&(v*=2,v+=a<b,i++))b=r(a=r())

javascript, 160 characters without reducing readability aka optimization

function giveRandom(){
    var result = Math.floor(5 * Math.random()) + 1;
    while(BrockenRand() != 5){
        result = Math.floor(5 * Math.random()) + 1;
    }
    return result;
}


Write a program with infinite expected output Write a program that halts producing a random finite numerical output with probability 1. The expected value of the outputs of the program must be infinite.
For physical limits, you can assume your language and related functions use infinite precision numbers. E.g. for languages with random function providing range \$[0,1)\$, it returns a real in \$[0,1)\$. (Anyway I need to choose from 1/rnd and while(rnd)print(1))
Inspired by St. Petersburg paradox.
Shortest code wins. Would be quite small for lots of language though.

There are two easy-seen ways to do this, both are accepted given the question: (in Javascript)
_=>1/Math.random() // ∫₀¹1/xdx=∞
_=>{c='1';while(Math.random()<.5)c+='1';return c} // Not golfed to easier get understood for other language user, at least I try to
    // 1/2+11/4+111/8+1111/16+...=∞

R, 9 bytes

rf(1,1,1)

Try it online!
Outputs a realization of the \$F(1,1)\$ distribution. The \$F(d_1,d_2)\$-distribution has infinite mean for \$d_2 \leq 2\$.
One way of defining the \$F(1,1)\$ distribution is as follows: let \$X_1,X_2\$ be independent \$\mathcal N(0,1)\$ random variables. Then \$\frac{X_1^2}{X_2^2}\sim F(1,1)\$.
Using the \$F\$ distribution comes out 1 byte shorter than the 2 more obvious solutions 1/runif(1) and rcauchy(1).
The plot below shows the evolution of the sample mean, for sample size ranging from 1 to 1e6; you can see that it diverges.

Alternate solution for the same byte count:
rt(1,1)^2

which outputs the square of a realization of Student's distribution \$t(1)\$. It has infinite expected value, since the \$t(1)\$ distribution has infinite variance. The square is needed to guarantee that the output is positive; without it, the expected value is undefined, since the realizations are often enough arbitrarily large positive or negative numbers.

JavaScript (V8), 11 bytes
Of course, I'm not serious.

_=>Infinity

Try it online!
Infinity is a numerical type:

console.log(typeof Infinity)


How tall are the monoliths? Here is an example of an input of monoliths. There are 4 in this example.
  _
 | |        _
 | |  _    | |
 | | | |   | |     _
_| |_| |___| |____| |_

The first monolith is 4 units high, the second is 2, the third is 3, and the last is 1.
The task
Your program should output the heights of the monoliths in order from left to right. The output format can be in any sort of list or array.
Notes

The input can be taken as any dimensional string, list of strings, or list of characters.
This is code-golf, so lowest bytes wins.
You are to assume that monoliths always have the same width, and are always at least 1 _ away from another.
They can come in any height, and in any quantity.

I/O
  _
 | |        _
 | |  _    | |
 | | | |   | |     _
_| |_| |___| |____| |_   >> [4,2,3,1]

           _
          | |
  _       | |
 | |  _   | |  _
_| |_| |__| |_| |_   >> [2,1,4,1]

 _   _   _
| |_| |_| |_____   >> [1,1,1]

____________________   >> undefined behavior

 _
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |   >> [11]

     _       _       _       _       _
 _  | |  _  | |  _  | |  _  | |  _  | |
| |_| |_| |_| |_| |_| |_| |_| |_| |_| |  >> [1,2,1,2,1,2,1,2,1,2]

Jelly, (8?) 9 bytes

Ỵ=”|Sḟ0m2

A monadic link accepting a list of characters as specified and returning a list of integers.

Note: 8 bytes if a list of strings, one per line, was really intended to be an allowed input format - just remove the Ỵ.

Try it online!

How?

Ỵ=”|Sḟ0m2 - Link: list of characters, s
Ỵ         - split at newlines
  ”|      - literal '|'
 =        - equals (vectorises)
    S     - sum (vectorises, hence counts the number of '|' in every column)
     ḟ0   - filter out zeros (only keep the results from the sides of the towers)
       m2 - modulo index with 2 (keep only the left side measurements)

Takes in a multiline string.
Credit for the setup (header and footer) goes to @GarethPW

Python 2, 29 bytes

lambda s:len(s.split('\n'))-1

Try it online!

This will simply split the array by newline and return length-1.


I'm a palindrome. Are you? There have been a couple of previous attempts to ask this question, but neither conforms to modern standards on this site. Per discussion on Meta, I'm reposting it in a way that allows for fair competition under our modern rulesets.

Background

A palindrome is a string that "reads the same forwards and backwards", i.e. the reverse of the string is the same as the string itself. We're not talking about "convenient palindromes" here, but a strict character-by-character reversal; for example, ()() is not a palindrome, but ())( is.

The task

Write a program or function that takes a string S (or the appropriate equivalent in your language) as input, and has one output Q (of a type of your choice). You can use any reasonable means to take the input and provide the output.

When the input S is a palindrome, the output Q should have a value A (that is the same for any palindromic S).
When the input S is not a palindrome, the output Q should have a value B (that is the same for any non-palindromic S).
A and B must be distinct from each other.

Or in other words: map all palindromes to one value, and all non-palindromes to another.

Additionally, the program or function you write must be a palindrome itself (i.e. its source code must be palindromic), making this a restricted-source challenge.

Clarifications

Although true and false are obvious choices for A and B, you can use any two distinct values for your "is a palindrome" and "isn't a palindrome" outputs, which need not be booleans.
We're defining string reversal at the character level here; éé is palindromic regardless of whether the program is encoded in UTF-8 or Latin-1, even though it's not a palindromic sequence of octets after UTF-8 encoding.
However, even if your program contains non-ASCII characters, it only needs to work for ASCII input. Specifically, the input S will only contain printable ASCII characters (including space, but not including newline). Among other things, this means that if you treat the input as a sequence of bytes rather than a sequence of characters, your program will still likely comply with the specification (unless your language's I/O encoding is very weird). As such, the definition of a palindrome in the previous bullet only really matters when checking that the program has a correct form.
Hiding half the program in a comment or string literal, while being uncreative, is legal; you're being scored on length, not creativity, so feel free to use "boring" methods to ensure your program is a palindrome. Of course, because you're being scored on length, parts of your program that don't do anything are going to worsen your score, so being able to use both halves of your program is likely going to be helpful if you can manage it.
Because the victory criterion is measured in bytes, you'll need to specify the encoding in which your program is written to be able to score it (although in many cases it will be obvious which encoding you're using).

Victory criterion

Even though the program needs to be a palindrome at the character level, we're using bytes to see who wins. Specifically, the shorter your program is, measured in bytes, the better; this is a code-golf challenge. In order to allow submissions (especially submissions in the same language) to be compared, place a byte count for your program in the header of your submission (plus a character count, if it differs from the number of bytes).

Brachylog (2), 3 bytes in Brachylog's codepage

I↔I

Try it online!

This is a full program that takes input via standard input (using Brachylog's syntax for constants, i.e. strings are enclosed in double quotes), and outputs via standard output. The outputs are true. for a palindromic input, and false. for a non-palindromic input.

Not only is this program palindromic, it also has left/right (and probably in some fonts up/down) mirror symmetry.

Explanation

In Brachylog, capital letters mark points in the program which have identical values; this is used almost like an electrical circuit to carry information from one part of the program to another. One consequence of this is that if you enclose a command between an identical pair of capital letters, you're effectively asserting that the command's input and output are the same. Brachylog implicitly takes input, so in this case we're also asserting that the input to the command is the same as the input to the program. In this program, we're using the command ↔, which reverses things (in this case, strings); so the program effectively asserts that the input is the same forwards and backwards.

A full program (as opposed to a function) in Brachylog returns a boolean, false. if there's no way to make all the assertions in the program correct at once, or true. if the assertions in the program are all compatible with each other. We only have one assertion here – that reversing the input does not change it – so the program acts as a palindrome checker.

SmileBASIC, 109 bytes
INPUT P$WHILE LEN(P$)>1P=P+(POP(P$)!=SHIFT(P$))WEND?!P'P!?DNEW))P$(TFIHS=!)$P(POP(+P==P1>)$P(NEL ELIHW$P TUPNI

Could definitely be shorter...


Create a "hacker typer" program that renders its own source code If you are unfamiliar with hacker typer, see hackertyper.net. In short, it is a program that outputs one chunk of a code base per keystroke for comedic effect. BUT, the hackertyper.net version is far too easy to implement. It simply outputs three characters at a time from an arbitrary piece of code. For this challenge, a program must output its own source code, and print one space delimited chunk of code per keystroke.
Details

One cannot hard code a file name for the program; it must determine its name dynamically. If the program compiles to an executable, it may append the standard file extension to the name of the executable (excluding the .exe if using Windows) and assume that the source file is within the executable's directory. For example, if a C executable is named "hacker", it should pull its source code from a file named "hacker.c" in its same directory. If a compiled program has an extension, it should be dropped before determining the name of its source code ("typer.exe" -> "typer.cs").
Programs must contain at least 5 spaces, with at least one character between each space. This means that the smallest possible size for this challenge is 9 bytes. The spaces do not have to be crucial to the functioning of the program.
Any formatting (indentation, new lines, etc.) must be maintained in the output. This formatting may either be printed with the code that proceeds it or follows it, what matters is that the formatting be maintained.
Avoid using comments to satisfy the 5 space requirement unless there is no other way to implement the spaces in your language of choice.

EDIT: New lines can be used in place of, or in addition to, spaces as chunk separators.

HTML & JavaScript, 123

This works similarly to hacker typer, but with its own source code. Let me know if I've misunderstood the rules.

And here's a styled version (170 characters):

I've made a demo. It's modified because JS Bin adds a lot of extra code, but the general idea is the same.

Haskell

{-# LANGUAGE CPP #-}
main = readFile __FILE__ >>= putStrLn


Square-unspiral the string! Given a string, first square it as follows:

First, write the string.

abcde

Next, write the string rotated one left.

abcde
bcdea

Keep doing this until you have written len(string) lines.

abcde
bcdea
cdeab
deabc
eabcd

Now, read from the string like this:

----+
+--+|
|+>||
|+-+|
+---+

Which gives:

abcdeabcdcbaedcbcdeabaede

Print this string.

Test cases

abcdef -> abcdefabcdedcbafedcbcdefabcbafedefaf
cena! -> cena!cenanec!anena!cec!a!
ppcg -> ppcgppcppgcpcgpg
abc -> abcabacbc
ab -> abab
a -> a
 ->

Please comment if a test case is incorrect.

Remember, this is code-golf, so the code with the smallest number of bytes wins.

JavaScript (ES7), 83 80 78 77 bytes

s=>s.repeat(l=s.length).replace(/./g,_=>s[(c-=--i**.5-l&1||-1)%l],c=-1,i=l*l)

Bonus ES3-compliant program:

for(s=prompt(r=""),c=-1,l=s.length,i=l*l;i;)r+=s[(c-=l-Math.sqrt(i--)&1||-1)%l];alert(r)

Explanation

This takes advantage of the fact that the output for e.g. a length 5 string can be represented as:

abcdeabcd cbaedcb cdeab aed e
012345678 7654321 23456 543 4

where each digit represents an index in the string (starting at 0), modulo the length of the string. In other words, if n is the length of the string, we increment the index 2n - 1 times, then decrement it 2(n - 1) - 1 times, then increment it 2(n - 2) - 1 times, etc. This can be simplified to the following algorithm:

Start the index i at -1.
For each integer x in the range [n2..1]:

If floor(sqrt(x)) is of the same parity (even/odd) as n, increment i.
Otherwise, decrement i.
Add the character at index i mod n to the output.

This works because floor(sqrt(x)) switches parities after 2n - 1 iterations, then 2(n - 1) - 1 iterations, etc.

Python 3, 93 bytes

s=input();r,n,i=s[::-1],len(s)-1,0
while n-i:print(s[i:]+s[:n-i]+r[i+2:]+r[:n-i],end='');i+=2

Try it online!


ASCII art "Hello-World!" Your goal is to write the shortest program that outputs "Hello-World!" as ASCII art.

Rules :

It must be human readable, I don't care about it's size (cols/rows)
Output must contain only spaces (" "), sharps ("#") and newlines
The output must work with a monospaced font (but the letters doesn't necessary use a monospaced font)
In the result, each character must be separated from each other by at least one space

Please add a title with the language and the number of bytes in your code.

Shell + pyfiglet, 31 characters

pyfiglet can run as a shell tool, so we can simply go like this:

pyfiglet -f'3x5' 'Hello-World!'

which gives us:

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

Looks much better with less line spacing.

Letters are separated with one space, and in terminal it's well readable.


How high can you count? Challenge:

Your task is to write as many programs / functions / snippets as you can, where each one outputs / prints / returns an integer. The first program must output the integer 1, the second one 2 and so on.

You can not reuse any characters between the programs. So, if the first program is: x==x, then you may not use the characters x and = again in any of the other programs. Note: It's allowed to use the same character many times in one program.

Scoring:

The winner will be the submission that counts the highest. In case there's a tie, the winner will be the submission that used the fewest number of bytes in total.

Rules:

You can only use a single language for all integers
Snippets are allowed!
To keep it fair, all characters must be encoded using a single byte in the language you choose.
The output must be in decimal. You may not output it with scientific notation or some other alternative format. Outputting floats is OK, as long as all digits that are shown behind the decimal point are 0. So, 4.000 is accepted. Inaccuracies due to FPA is accepted, as long as it's not shown in the output.
ans =, leading and trailing spaces and newlines etc. are allowed.
You may disregard STDERR, as long as the correct output is returned to STDOUT
You may choose to output the integer to STDERR, but only if STDOUT is empty.
Symbol independent languages (such as Lenguage) are disallowed
Letters are case sensitive a != A.
The programs must be independent
Whitespace can't be reused
You must use ASCII-digits in the output

Explanations are encouraged!

JavaScript (ES7), score 17, 176 bytes

They said it couldn't be done, so I did it :D (thanks to a lot of help from @FullDecent)

""**""
~(~/~//~/~/)/~/~/
3
4
!NaN- -!NaN- -!NaN- -!NaN- -!NaN
6
7
8
9
++[[]][+[]]+[+[]]
11
'lengthlength'.length
222>>2>>2
`${``^``}xE`^``
0XF
C=CSS==CSS;C<<C<<C<<C<<C
555555555555555555555%55

Unused characters:

#&,:?@ABDGHIJKLMOPQRTUVWYZ\_bcdfijkmopqrsuvwyz|

I don't think 18 is possible, but I said the same thing about 17...

Explanation

JavaScript is a very weakly typed language; if you try to perform a mathematical operation on a non-number value, JS will try its hardest to convert it to a number first. This allows for a lot of interesting solutions. I've tried to avoid using the digits as much as possible so they can be used later on.

** is the exponentiation operator in ES7. The empty string when coerced to a number becomes 0, so this calculates 0 ** 0, which is 1 according to JavaScript.
A little ridiculous, but it works. /~/ is a regex literal, and ~/~/ returns -1, so this is ~(-1 / -1) / -1 = ~(1) / -1 = -2 / -1 = 2. (credits to @GOTO0 for the idea)
Simply 3.
Now simply 4.
NaN is falsy, so !NaN is true, which is equivalent to 1. The expression thus becomes 1 - -1 - -1 - -1 - -1 = 1 + 1 + 1 + 1 + 1 = 5.
Simply 6.
Simply 7.
Simply 8.
Simply 9.
This uses a little JSF*** magic. +[] is 0, so [[]][+[]] returns the first element of [[]] (that is, []), and ++ increments this to 1. Then +[+[]] adds the array [0], which is coerced to a string and makes "10".
Simply 11. I originally had used 11&1111 for 3 and 33/3 for 11 until I realized yet again just how dumb I am...
This strategy would work on any number: create a string of length 12 and use .length.
I just messed around with 2s and >s for a while to get this one. I got lucky again: 222 >> 2 is 55, and 55 >> 2 is 13.
This one is rather tricky. The basic idea is to create 14 in hex (0xE), but we need the digit 0 elsewhere. So instead we prepend the result of ``^`` to the string xE; the empty string coerced to a number is 0, so this returns 0 ^ 0 = 0. Then the result is XORed with the empty string, which converts both values to numbers; "0xE" ^ "" is 14.
This is now pretty easy: 0XF is a hexadecimal literal with a value of 15.
The trickiest of all? First we set the variable C to CSS == CSS (that is, true). Then we take the result and perform << C four times, which basically multiplies 1 by 2 ** 4.
JavaScript starts to lose integer precision at 253, which allows 555...555%55 to return a number that's not 0 or 5. I happened to get very lucky while playing around here.

Strategies that would work on many numbers:

-!NaN would work on any number (currently 5), though it gets large very fast.
~/~/ would work on any number (currently 2), though it gets very large very fast.
+[] would work on any number (currently 10), though it's by far easiest on 10 or 11.
.length would work on any number.
`${-``}xE`-`` would work on pretty much any number if you do it right.
C<<C would work on any power of two (currently 16), or any int at all if you included |.

Perl REPL, score 16

Get Perl REPL by using perl -nE'say eval'.

__LINE__
2
3
4
5
6
length
8
9
cos,abs
11
0xC
$.
7+7
!rmdir()+!rmdir()+!rmdir()+!rmdir()+!rmdir()+!rmdir()+!rmdir()+!rmdir()+!rmdir()+!rmdir()+!rmdir()+!rmdir()+!rmdir()+!rmdir()+!rmdir()
//- -//- -//- -//- -//- -//- -//- -//- -//- -//- -//- -//- -//- -//- -//- -//

Other things I tried:

(ord Z)-(ord K)

And here are some ideas of how to cheat:

umask
tell
getppid
getpgrp
wait
system
time
srand
localtime
gmtime
ls|wc -l <---- cheating, has preconditions