CJam, 24 23 22 21 19 bytes

ri_)2b,,W%{2\#(md}/

This is an O(log n) approach, where n is the input, that completes the last test case instantly. It converts n directly to skew binary, using modular division by the values of the digit 1.

This code finishes with an error that goes to STDERR with the Java interpreter, which is allowed according to the consensus on Meta.

If you try this code in the CJam interpreter, just ignore everything but the last line of output.

The error can be eliminated, at the cost of 2 bytes, by prepending 2> to W%.

Thanks to @MartinBüttner for golfing off one byte.

Background

The skew binary representation ak...a0 corresponds to the integer n = (2k+1-1)ak+...+(21-1)a0.

Since both (2k-1) + ... + (21-1) = 2k+1 - (k + 2) and (2k-1) + ... + 2(2j-1) = 2k+1 - (2j+1 - 2j + k + 1) are less than 2k+1-1, the values of ak to a0 can be recovered by successive modular division by 2k+1-1, 2k-1, etc.

To begin, we have to find the value of 2k+1-1 first. Since n is at most 2(2k+1-1), the integer n + 1 must be strictly smaller than 2k+2.

Thus, taking the integer part of the binary logarithm of n + 1 yields k + 1.

Finally, we observe that the integer n + 1 has ⌊log2(n + 1)⌋ digits in base 2.

How it works

ri    e# Read an integer N from STDIN.
2b,   e# Push the number of binary digits of N + 1, i.e, K + 2 = log(N + 1) + 1.
,W%   e# Push the range [K+1 ... 0].
{     e# For each J in the range:
  2\# e#   J -> 2**J
  (   e#     -> 2**J - 1
  md  e#   Perform modular division of the integer on the stack (initially N)
      e#   by 2**J - 1: N, 2**J - 1 -> N/(2**J - 1), N%(2**J - 1)
}/    e#

In the last two iterations, we perform modular division by 1 and 0. The first pushes an unwanted 0 on the stack. The last attempts to execute 0 0 md, which pops both unwanted 0s from the stack, exits immediately instead of pushing anything and dumps the stack to STDOUT.


Counting the number of restricted forests on the Möbius ladder of length n

CJam (58 56 chars)

Some characters unprintable, and one is a tab which will be mangled by the StackExchange software:

"¶3¬î¿Á·    7ÛÈmÈÚÚ¡"256b454b212f-{__W%.*A<1b+}qi*-4=

Online demo. This will run online for n=400 in about three seconds.

Encoded by xxd:

0000000: 22b6 0233 93ac eebf c1b7 0609 3794 dbc8  "..3........7...
0000010: 6dc8 1015 dada a122 3235 3662 3435 3462  m......"256b454b
0000020: 3231 3266 2d7b 5f5f 5725 2e2a 413c 3162  212f-{__W%.*A<1b
0000030: 2b7d 7169 2a2d 343d                      +}qi*-4=

Explanation

A Möbius ladder is basically a ladder with two extra edges. Given a restricted forest on a ladder, it can be lifted to between 1 and 4 restricted forests on the Möbius ladder. The edges can be added provided that doesn't create a vertex of degree 3 or a cycle. The degrees of the four corners and their interconnections form 116 classes of restricted forest on the ladder, although some of them are equivalent due to symmetries of the rectangle. I wrote a program to analyse the extensions of a ladder of length n to one of length n+1, and then merged the classes into 26 equivalence classes. This gives a closed form

$$\begin{bmatrix} 1 \\ 1 \\ 1 \\ 1\end{bmatrix}^T
\begin{bmatrix}
    1 & 2 & 2 & 0 \\
    1 & 2 & 1 & 1 \\
    2 & 3 & 4 & 1 \\
    0 & 0 & 1 & 0 \\
\end{bmatrix}^{n-2}
\begin{bmatrix} 0 \\ 1 \\ 0 \\ 0\end{bmatrix} + $$

$$\begin{bmatrix} 2 \\ 2 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 2 \\ 2\end{bmatrix}^T
\begin{bmatrix}
    2 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\
    1 & 0 & 1 & 0 & 0 & 1 & 0 & 1 & 0 \\
    0 & 0 & 2 & 0 & 1 & 0 & 0 & 0 & 0 \\
    0 & 0 & 1 & 0 & 1 & 0 & 0 & 0 & 0 \\
    0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 1 \\
    1 & 1 & 0 & 0 & 0 & 0 & 0 & 1 & 1 \\
    0 & 0 & 1 & 0 & 0 & 0 & 0 & 1 & 1 \\
    3 & 2 & 2 & 1 & 1 & 2 & 1 & 4 & 2 \\
    0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 2 \\
\end{bmatrix}^{n-2}
\begin{bmatrix} 0 \\ 0 \\ 2 \\ 2 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0\end{bmatrix} + $$

$$\begin{bmatrix} 1 \\ 2 \\ 4 \\ 4 \\ 1 \\ 1 \\ 3 \\ 2 \\ 2 \\ 2 \\ 3 \\ 4 \\ 4\end{bmatrix}^T
\begin{bmatrix}
    0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\
    0 & 2 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
    0 & 1 & 2 & 0 & 1 & 1 & 0 & 1 & 1 & 0 & 1 & 1 & 1 \\
    1 & 0 & 0 & 4 & 0 & 0 & 3 & 0 & 0 & 2 & 0 & 0 & 0 \\
    0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 2 & 1 & 0 \\
    0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 1 \\
    1 & 0 & 0 & 1 & 0 & 0 & 2 & 0 & 0 & 1 & 0 & 0 & 0 \\
    0 & 1 & 2 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 1 & 2 \\
    0 & 1 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
    0 & 0 & 0 & 2 & 0 & 0 & 2 & 0 & 0 & 1 & 0 & 0 & 0 \\
    0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\
    0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 2 & 2 & 0 \\
    0 & 2 & 3 & 0 & 1 & 1 & 0 & 2 & 1 & 0 & 1 & 2 & 4 \\
\end{bmatrix}^{n-2}
\begin{bmatrix} 1 \\ 0 \\ 1 \\ 1 \\ 2 \\ 0 \\ 1 \\ 0 \\ 0 \\ 0 \\ 1 \\ 2 \\ 1\end{bmatrix}$$

so values can be computed fast by taking three linear recurrences and then adding them, but this isn't looking very golfy.

However, if we take the irreducible factors of the various characteristic polynomials and multiply together one of each (ignoring multiplicity) we get a polynomial of degree 10 which gives a working single linear recurrence.

Constructive approach (58 chars)

qi:Q2*,Wa*e!{Wa/{_W%e<}%$}%_&{{,1>},2few:~{:-z(Q(%}%0-!},,

Online demo. It will run online for n=2 without problems and for n=3 with a bit of patience. For n=1 it crashes, but since OP has chosen to exclude that case from the requirements it's not a fundamental problem.

Dissection

qi:Q          e# Take input from stdin, parse to int, store in Q
2*,Wa*e!      e# Take all permutations of (0, -1, 1, -1, 2, -1, ..., -1, 2*Q-1)
{             e# Map to canonical form...
  Wa/         e#   Split around the -1s
  {_W%e<}%    e#   Reverse paths where necessary to get a canonical form
  $           e#   Sort paths
}%
_&            e# Filter to distinct path sets
{             e# Filter to path sets with valid paths:
  {,1>},      e#   Ignore paths with fewer than two elements (can't be invalid; break 2ew)
  2few:~      e#   Break paths into their edges
  {:-z(Q(%}%  e#   The difference between the endpoints of an edge should be +/-1 or Q (mod 2Q)
              e#   So their absolute values should be 1, Q, 2Q-1.
              e#   d => (abs(d)-1) % (Q-1) maps those differences, and no other possible ones, to 0
              e#   NB {:-zQ(%}% to map them all to 1 would save a byte, but wouldn't work for Q=2
  0-!         e#   Test that all values obtained are 0
},
,             e# Count the filtered distinct path sets

A more efficient version takes 98 bytes:

qi2*:Q{a{__0=[1Q2/Q(]f+Qf%_&1$-\f{+E}~}:E~}/]{_W%>!},:MW=0{_{M\f{__3$_@&@:e<@|^{=}{^j}?}1b}{,)}?}j

Online demo

This builds the possible paths by depth-first search, then uses a memoised function which counts the possible restricted forests for a given set of vertices. The function works recursively on the basis that any restricted forest for a given non-empty set of vertices consists of a path containing the smallest vertex and a restricted forest covering the vertices not in that path.


How can I shorten this multiple assignment in Lua?

As requested in the comments, here it is as an answer.

local c,d=s(a,b)  -- d is nil
d=c

This saves you one local declaration, should give you -5 bytes.


Find the submatrix with the smallest mean

Octave, 30 bytes
@(A)min(mean(im2col(A,[3,3])))

Try it online!


Japt, 9 14 13 bytes

o!²mnU dj |Uv

Test it online! or Find all de Polignac integers under 1000.

Outputs 1 for falsy inputs and 0 for truthy.

Explanation

 o!²  mnU dj |Uv
Uo!p2 mnU dj |Uv  : Ungolfed
                  : Implicit: U = input integer (e.g. 9)
Uo                : Create the range [0..U), and map each item X to
  !p2             :   2 ** X.               [1, 2, 4, 8, 16, 32, 64, 128, 256]
      m           : Map each of these powers of 2 by
       nU         :   subtracting from U.   [8, 7, 5, 1, -7, -23, -57, -119, -247]
          d       : Return whether any item in the result is
           j      :   prime.                (5 and 7 are, so `true`)
             |    : Take the bitwise OR of this and
              Uv  :   U is divisble by (missing argument = 2).
                  : This gives 1 if U cannot be represented as p + 2^n or if U is even.
                  : Implicit: output result of last expression


Pyth, 10 bytes

jb_.T.T_.z

Try it online in the Pyth Compiler/Executor.

Idea

We can achieve the desired output by applying four simple transformations:

Reverse the order of the lines:

Golf
Code
&
Puzzles
Programming

Transpose rows and columns:

GC&PP
oour
ldzo
fezg
lr
ea
sm
m
i
n
g

This top justifies, collapsing the original columns.
Transpose rows and columns:

Golflesming
Coderam
&uzz
Prog
P

Reverse the order of the lines:

P
Prog
&uzz
Coderam
Golflesming

Code

        .z  Read the input as a list of strings, delimited by linefeeds.
       _    Reverse the list.
   .T.T     Transpose the list twice.
  _         Reverse the list.
jb          Join its strings; separate with linefeeds.


Python 2, 165 bytes

a=input()
l=max(map(abs,a))
while l+2:s=' _'[l<0];print(s+s.join((([' ^ ','//| \\\\'[x>0::2],'   '][cmp(abs(x),l)],'_|_')[l<0],s*3)[x==0]for x in a)+s).rstrip();l-=1

This is a full program that accepts a list as input. I'm still golfing this horrid mess.


Egg, sausage, bacon and spam (lovely spam!)

Python, 32 bytes

"001111020114001410120110".count

Try it online!

Takes input in 'sbeS' order as a single string, like '1102'. Simply checks whether the string appears as a substring of the hardcoded string, using the object method to avoid needing to write out a costly lambda to define a function.

The desired strings are squished together as much as possible via overlapping. For example, the part "001111020114 checks for 0011, 0111, 1111, 1110, and 1102. The fact that 2 and 4 can only appear as the counts of spam, which is listed last, lets us append strings directly to their right without false positives. I played with the order of the inputs to try to overlap more, but there might be a better outcome.

I suspect this approach can be beaten with a modulo chain or similar using number inputs.


Know the predefined literals
Although some of them keep information when copied to the clipboard, they all have a predefined value.

F, pushes 0 (actually False)
T, pushes 1 (actually True)
H, pushes 2 (predefined clipboard value)
I, pushes 3 (predefined clipboard value)
K, pushes 4 (predefined clipboard value)
J, pushes 0 + 1j (predefined clipboard value)

Not sure if I have covered all predefined values though.


Mathematica, 343 bytes, 2573 characters
B=BitXor;t[a_]:={Mod[2a,256],⌊a/2⌋,a~B~1,a~B~128,0};w[a_,b_]:=Position[t@a,b][[1,1]];f=FindShortestPath[Graph[0~Range~255,e=Join@@Table[a#&/@({}⋃t@a),{a,m=c=0,255}],EdgeWeight(w@@#&/@e)],All,All];o="";u[a_,b_]:=(Do[o=o<>ToString[m=1-m],{If[a==b,6,a~w~f[a,b][[2]]]}];m=1-m);While[c~u~y;c!=y,c=f[c,y][[2]]]~Do~{y,ToCharacterCode@i};o

This is my first code competition. This program should generate the shortest possible program for any string. It effectively calculates a lookup table given the current state of the accumulator and the goal byte to find the shortest sequence of the five operations to get from any one to another, carrying the accumulator over characters and taking advantage of the size difference between instructions. Uses Mathematica 8's Graph infrastructure for calculating shortest paths (alternatives being to roll one's own or just embed the 256 x 256 table of instructions).
Ungolfed version (the first i = "..." line is also present, but not counted in the golfed version since it is the input):
i = "This is a string, meant to test the effectiveness of your program. Here are some special characters to make matters interesting: Æ Ø ß. How meta! :D";
B = BitXor;
t[a_] := {Mod[2 a, 256], Quotient[a, 2], B[a, 1], B[a, 128], 0}
w[a_, b_] := Position[t[a], b][[1, 1]]
g = Graph[Range[0, 255],
  e = Join @@ Table[DirectedEdge[a, #] & /@ Union@t@a, {a, 0, 255}],
  EdgeWeight -> (w @@ # & /@ e)];
f = FindShortestPath[g, All, All]; c = m = 0; o = "";
u[a_, b_] := (Do[
   o = o <> ToString[m = 1 - m], {If[a == b, 6, w[a, f[a, b][[2]]]]}];
   m = 1 - m);
Do[While[u[c, y]; c != y, c = f[c, y][[2]]], {y, ToCharacterCode[i]}];
o

Output:
10111101111011110101000010110010101101101010000010110010110010010101101111110101001011001011001001010111110100110100110110101001000000101011101001101101010000000101011011101110111110111011010100110010000101011001101110111010100100001000001001010110011011101110101000010001000011011010100110100110010101111111001101010010001000010001000010010101101110111101101010011001000010010101100110010001000100010101110111101010000001101010010110010110010110010101100100010000110110101000000000110010101101001101001101001101010001000001011001001010110100110110101001100100001010111111001010110100110100110100110101000011010100100000101100100101011011111010100110100110100110110101001101110101001010110010001001010111011111101110110101000100001000010101111001001010110100110010001010111101111011010100010001000010110010101111011111001001010110100110110101001010110111111010100100010000100010001000100101011111011101111001010110010000001010110111011101110111110110101001101001101001101010010001000010010101100110111011101010000001010111010011010011010100110111010100110100110100110110101000001000100001101101010000010001010110111111101101010011010011010011011010100110111110011010100000000110010101100101100101011010011011010100101100101011110010010101101111101010001011001001010110100110010001010111100100101011011111010100100010001000001000100101011001011001011001001010110010001001010110111011110110101001000001010110111011101111101110110101001101110101001101111100100101011101111110111011010100001000001001010111011111110110101001101001101001101010000000110010101100100001011001001010111101111101010000010110010010101101001100100010101101111111011010100110111011010100010000100001010111011111010011011010100101100101011011010100100000010101101001101001101001101010011011101111001001010111111111001101010010001000010001000010010101101111101101010011001101111011101101010000010000100101011011111010100100010000100010000100101011011111011010100101100110010000101011010100010000010110010010101101001101010010010101101111110101001011001011001001010110011011101110101000100001010111011111010011011010100101100101011110010010101101001101101010011001000010101111001001010110011011101110101000010001000011011010100001000101011111110010101100100010001011010100110111111010100010110011010011010010101111110011010100100001000100010001000100101101010001100100101011111111001101010011010011010100110111011101111010011011010100101100101011111111100110101001000100001000100001001010110111011110110101001011001100100001010111111010011011010100001100101011011010100100010001000010001010111110111101010


Return each number from a group of numbers

Perl 25 26 25

$_ is the sequence string

s/-/../g;$_=join",",eval

Sample session:

[~/] $ perl -M5.010 -pe 's/-/../g;$_=join",",eval' <<< "1,3-5,9,16,18-23"
1,3,4,5,9,16,18,19,20,21,22,23

Added 1 character to the character count for the -n-p option (thanks Gareth, ..kinda).


Ruby, 56 characters
eval'㵰␼⹣潵湴筼汼氽縯層⬠⠮⤯㬨①⹴潟椮⸤☮瑯彩⤽㴽␧⹣潵湴⠤ㄩ紻'.encode('utf-16').b

Try it online!
Decompresses to:
p$<.count{|l|l=~/\d+ (.)/;($`.to_i..$&.to_i)===$'.count($1)}

Character scoring allows these sort of shenanigans!
This is also a great showcase of Ruby's regex global variables. Given a line:
3-8 j: ksjjtvnjbjppjjjl

Our regex matches here:
3-8 j: ksjjtvnjbjppjjjl
  \-/
  Regex matches here

Then $' is the part after the regex, $& is the part that matches the regex, $` is the part before the regex, and $1 matches the character to count, so we have:
$` = '3-'
$& = '8 j'
$1 = 'j'
$' = ': ksjjtvnjbjppjjjl'

Since Ruby's to_i just ignores garbage after a numeric string, we can just cast it to int.
Ruby -n, 60 characters
~/\d+ (.)/;($`.to_i..$&.to_i)===$'.count($1)||$.-=1
END{p$.}

Try it online!


Retina, Score 1

Try it online!

The empty program outputs 1, since the empty input matches the empty string exactly once.
1 outputs 0, since 1 doesn't match the empty input.
0 outputs 0, since 0 doesn't match the empty input. Since it outputs itself, it's a quine (as defined in this challenge).


30 33 35 Languages

Reserved character: ~

 println!~~~~~~~
 puts    (1,~~~~
    echo   '~~~~
"cWprintfn"Ja~~~
Eork~~~;'Jabbe~~
\ui)K00~~~~~br~~
]tteL~0~~~~~ew~~
]<~ln(0~~~~~ro~~
`<~~~ 0~~~~~wc~~
m"~~~ "~~~~~ok~~
rJ~~~'J~~~~~cy~~
j"<< "a~~~~~k'..
^~~~~~bberwoy");
f~~~~~~~~~~c'  ;
t~~~~~~~~~~ky"
XX"););  5f+');

Languages:

01. Rust        | println! (  "Jabberwocky") ;  |
02. Groovy      | println     "Jabberwocky"     |
03. E           | println  (  "Jabberwocky")    |
04. Swift       | println  (  "Jabberwocky") ;  |
05. Julia       | println  (  "Jabberwocky");;  |
06. Processing  | println  (  "Jabberwocky")  ; |
07. Falcon      | printl   (  "Jabberwocky")    |
08. ALGOL 68    | print    (  "Jabberwocky")    |
09. Vala        | print    (  "Jabberwocky") ;  |
10. Pawn        | print    (  "Jabberwocky");;  |
11. Batsh       | print    (  "Jabberwocky")  ; |
12. freeBASIC   | print       "Jabberwocky"     |
13. Rebol       | print       "Jabberwocky"  ;  |
14. Red         | print       "Jabberwocky"   ; |
15. AWK         | print       'Jabberwocky'     |
16. Perl        | print       'Jabberwocky'  ;  |
17. bc          | print       'Jabberwocky'   ; |
18. Euphoria    |  puts    (1,"Jabberwocky")    |
19. C           |  puts    (  "Jabberwocky") ;  |
20. Tcl         |  puts       "Jabberwocky"     |
21. Ruby        |  puts       'Jabberwocky'     |
22. Zsh         |      echo   "Jabberwocky"     |
23. Bash        |      echo   "Jabberwocky"  ;  |
24. tcsh        |      echo   "Jabberwocky"   ; |
25. PHP         |      echo   'Jabberwocky'     |
26. Fish        |      echo   'Jabberwocky'  ;  |
27. Dash        |      echo   'Jabberwocky'   ; |
28. F#          |      printfn"Jabberwocky"   ; |
29. C++         |    cout<<"J"<< "abberwocky" ; |
30. D           |     Writeln(  'Jabberwocky'); |
31. Pascal      |     WriteLn(  'Jabberwocky'); |
32. Delphi      |     Writeln(  "Jabberwocky"); |
33. GolfScript  |      print;'Jabberwocky'..;;  |
34. CJam        |   "E\]]`mrj^ftXX"););  5f+'); |
35. Pyth        |      pk)K00000"Jabberwocky"   |

(Pyth and CJam thanks to user23013)


Longest mathematical expression in a grid

C, checks about 7,500,000 paths per second

So here is my first pass over this. It's quite horrible code because it's all in one huge main and the two (nested) loops over the left-hand side and right-hand-side of the equation are pretty much exactly the same, but well, it works.

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>

#define MAX_SIZE 32

typedef struct {
    char symbol;
    int visited;
} cell;

typedef struct {
    int x;
    int y;
} coord;

static cell grid[MAX_SIZE][MAX_SIZE];
static int nEquals = 0;
static coord equals[MAX_SIZE*MAX_SIZE];

static coord dirs[8] = {
    { .x = -1, .y = -1 },
    { .x =  0, .y = -1 },
    { .x =  1, .y = -1 },
    { .x =  1, .y =  0 },
    { .x =  1, .y =  1 },
    { .x =  0, .y =  1 },
    { .x = -1, .y =  1 },
    { .x = -1, .y =  0 },
};

static char best_string[2*MAX_SIZE*MAX_SIZE+1];
static int best_length = 0;
static unsigned long long best_factor;

int main(int argc, char *argv[])
{
    FILE *fp = fopen("grid.txt", "r");
    if (!fp) perror("Memory allocation failed"), exit(1);

    fseek(fp, 0L, SEEK_END);
    long lSize = ftell(fp);
    rewind(fp);

    char *buffer = calloc(1, lSize+1);
    if (!buffer)
    {
        fclose(fp);
        perror("Memory allocation failed");
        exit(1);
    }

    if (1 != fread(buffer, lSize, 1, fp))
    {
        fclose(fp);
        free(buffer);
        perror("Reading file failed");
        exit(1);
    }

    fclose(fp);

    char *cp;
    cp = buffer;
    int width = (int)strtol(cp, &cp, 10);
    int height = (int)strtol(cp, &cp, 10);

    ++cp;
    int i, j;
    for (j = 0; j < height; ++j)
    {
        for (i = 0; i < width; ++i)
        {
            grid[j][i].symbol = *cp;
            grid[j][i].visited = 0;

            if (*cp == '=')
            {
                equals[nEquals].x = i;
                equals[nEquals].y = j;
                ++nEquals;
            }
            ++cp;
        }
        ++cp;
    }

    printf("Analysing %d x %d grid...\n", width, height);

    unsigned long long strings_checked = 0;

    clock_t start = clock();

    for (j = 0; j < nEquals; ++j)
    {
        char expression[2*MAX_SIZE*MAX_SIZE+1];
        coord lpos = equals[j];
        coord rpos = equals[j];

        // Set to spaces to ease parsing
        for (i = 0; i < 2*MAX_SIZE*MAX_SIZE+1; ++i)
            expression[i] = ' ';

        int center = MAX_SIZE*MAX_SIZE;
        expression[center] = '=';

        int lhs_size = 0;
        int lhs_n_factors = 0;

        int lhs_dirs[MAX_SIZE*MAX_SIZE];
        for (i = 0; i < MAX_SIZE*MAX_SIZE; ++i)
            lhs_dirs[i] = -2;
        int rhs_dirs[MAX_SIZE*MAX_SIZE];
        for (i = 0; i < MAX_SIZE*MAX_SIZE; ++i)
            rhs_dirs[i] = -2;

        unsigned long long lhs_factors[MAX_SIZE*MAX_SIZE];
        unsigned long long lhs_max_factors[MAX_SIZE*MAX_SIZE];
        unsigned long long lhs_products[MAX_SIZE*MAX_SIZE];
        lhs_max_factors[0] = 0;
        lhs_products[0] = 1;

        while (lhs_size >= 0)
        {
            int dir = ++lhs_dirs[lhs_size];
            char lmost_char = expression[center-lhs_size];

            if (dir == -1)
            {
                grid[lpos.y][lpos.x].visited = 1;

                if (lmost_char == 'x')
                {
                    unsigned long long factor = strtoll(expression+center-lhs_size + 1, NULL, 10);
                    lhs_factors[lhs_n_factors] = factor;
                    ++lhs_n_factors;
                    if (factor > lhs_max_factors[lhs_n_factors-1])
                        lhs_max_factors[lhs_n_factors] = factor;
                    else
                        lhs_max_factors[lhs_n_factors] = lhs_max_factors[lhs_n_factors-1];
                    lhs_products[lhs_n_factors] = lhs_products[lhs_n_factors-1] * factor;
                    continue;
                }
                else if (lmost_char == '=')
                    continue;
                else
                {
                    unsigned long long factor = strtoll(expression+center-lhs_size, NULL, 10);
                    unsigned long long max_lhs_factor;
                    if (factor > lhs_max_factors[lhs_n_factors])
                        max_lhs_factor = factor;
                    else
                        max_lhs_factor = lhs_max_factors[lhs_n_factors];

                    unsigned long long lhs_product = lhs_products[lhs_n_factors] * factor;

                    int rhs_size = 0;

                    int rhs_n_factors = 0;
                    unsigned long long max_rhs_factor = 0;

                    unsigned long long rhs_factors[MAX_SIZE*MAX_SIZE];
                    unsigned long long max_factors[MAX_SIZE*MAX_SIZE];
                    unsigned long long rhs_products[MAX_SIZE*MAX_SIZE];
                    max_factors[0] = max_lhs_factor;
                    rhs_products[0] = 1;

                    char *rhs_factor_pointers[MAX_SIZE*MAX_SIZE];
                    rhs_factor_pointers[0] = expression+center+1;

                    while (rhs_size >= 0)
                    {
                        int dir = ++rhs_dirs[rhs_size];
                        char rmost_char = expression[center+rhs_size];

                        if (dir == -1)
                        {
                            grid[rpos.y][rpos.x].visited = 1;

                            if (rmost_char == 'x')
                            {
                                factor = strtoll(rhs_factor_pointers[rhs_n_factors], NULL, 10);
                                rhs_factors[rhs_n_factors] = factor;
                                ++rhs_n_factors;
                                rhs_factor_pointers[rhs_n_factors] = expression + center + rhs_size + 1;
                                if (factor > max_factors[rhs_n_factors-1])
                                    max_factors[rhs_n_factors] = factor;
                                else
                                    max_factors[rhs_n_factors] = max_factors[rhs_n_factors-1];
                                rhs_products[rhs_n_factors] = rhs_products[rhs_n_factors-1] * factor;
                                continue;
                            }
                            else if (rmost_char == '=')
                                continue;
                            else
                            {
                                // check for solution
                                ++strings_checked;

                                factor = strtoll(rhs_factor_pointers[rhs_n_factors], NULL, 10);
                                unsigned long long max_factor;
                                if (factor > max_factors[rhs_n_factors])
                                    max_factor = factor;
                                else
                                    max_factor = max_factors[rhs_n_factors];

                                unsigned long long rhs_product = rhs_products[rhs_n_factors] * factor;

                                //printf("%.19s = %d\n", expression + center - 9, rhs_product);
                                //  printf("%.51s\n", expression + center - 25);
                                int length = rhs_size + lhs_size + 1;

                                if (lhs_product == rhs_product &&
                                    (length > best_length ||
                                     length == best_length && max_factor > best_factor))
                                {
                                    best_length = length;
                                    best_factor = max_factor;
                                    memcpy(best_string, expression + center - lhs_size, length);
                                    best_string[length] = 0;
                                }

                            }
                        }
                        else if (dir < 8)
                        {
                            coord step = dirs[dir];
                            int new_x = rpos.x + step.x;
                            int new_y = rpos.y + step.y;
                            char new_char;

                            if (new_x < 0 || new_x >= width ||
                                new_y < 0 || new_y >= height ||
                                grid[new_y][new_x].visited ||
                                (new_char = grid[new_y][new_x].symbol) == '=' ||
                                new_char == 'x' && (rmost_char == 'x' || rmost_char == '=')) continue;

                            // TODO: Should diagonally crossing paths be disallowed, too?

                            ++rhs_size;

                            rpos.x = new_x;
                            rpos.y = new_y;
                            expression[center+rhs_size] = new_char;
                        }
                        else
                        {
                            if (rmost_char == 'x')
                                --rhs_n_factors;

                            rhs_dirs[rhs_size] = -2;
                            if (rmost_char != '=') expression[center+rhs_size] = ' ';
                            grid[rpos.y][rpos.x].visited = 0;

                            --rhs_size;
                            coord step = dirs[rhs_dirs[rhs_size]];
                            rpos.x -= step.x;
                            rpos.y -= step.y;
                        }
                    }
                }
            }
            else if (dir < 8)
            {
                coord step = dirs[dir];
                int new_x = lpos.x + step.x;
                int new_y = lpos.y + step.y;
                char new_char;

                if (new_x < 0 || new_x >= width ||
                    new_y < 0 || new_y >= height ||
                    grid[new_y][new_x].visited ||
                    (new_char = grid[new_y][new_x].symbol) == '=' ||
                    new_char == 'x' && (lmost_char == 'x' || lmost_char == '=')) continue;

                // TODO: Should diagonally crossing paths be disallowed, too?

                ++lhs_size;

                lpos.x = new_x;
                lpos.y = new_y;
                expression[center-lhs_size] = new_char;
            }
            else
            {
                if (lmost_char == 'x')
                    --lhs_n_factors;

                lhs_dirs[lhs_size] = -2;
                expression[center-lhs_size] = ' ';
                grid[lpos.y][lpos.x].visited = 0;

                --lhs_size;
                coord step = dirs[lhs_dirs[lhs_size]];
                lpos.x -= step.x;
                lpos.y -= step.y;
            }
        }
    }

    clock_t end = clock();
    float seconds = (float)(end - start) / CLOCKS_PER_SEC;

    printf("Checked %llu paths.\n", strings_checked);

    printf("Took %f seconds.\n", seconds);

    printf("Result: %s\n", best_string);
}

This expects the input stored in a file grid.txt. The first line is the space-separated size of the grid, which is followed by the grid itself. Like:

3 3
13x
=73
481

The algorithm is currently checking all possible well-formed paths (brute force). By well-formed, I mean that paths containing xx or two = are skipped, and I only start looking for paths starting from a = in both directions. Basically, I check all possible LHSs and for each such path, I check all possible RHSs. Over the next few days, I plan to add several optimisations to skip more paths, since the runtime per path will only go up and not down from here.

This will run into some problems with grid sizes of more than some 20 cells, due to integer overflow. I'll have to use some bigint-library when I get to solving those in a reasonable amount of time (which, I'm afraid, will reduce the paths/second a bit).

Currently, the largest sizes that can be solved in a reasonable amount of time at the moment are 7x3 or 5x4 (both taking under two minutes). 8x3 would take about half an hour, and 9x3 or 6x4 or 5x5 would take a few hours (between 1 and 7 I think).

EDIT: Managed to speed it up by close to 20 percent, because now I'm parsing each multiplicand when it's "locked" (i.e. when an x next to it has been parsed) instead of parsing the entire right-hand side for each possible path. And I should add that I observed those 20% for a grid where there's only a single x to be found, so I expect the performance gain for grids with many x to actually be quite substantial. Next stop: bigints.


CJam (42 40 bytes)

{(\@2$,(/.{@a@a+z(\@.{4,={+2/zW%~}*}z~}}

Online demo

Basically this applies the same technique twice in order to fold the block

{4,={+2/zW%~}*}

which operates on a 2x2 matrix and a number of times to rotate.

[first row] [[second row] [third row] ... [last row]] [value_0 value_1 ... value_n]

can be processed with

.{block}

and has the effect of

[first row]
[second row] value_0 {block}~
[third row] value_1 {block}~
...

because . (like % in CJam) doesn't gather the results into an array until it's finished.


VBA, 587 560 bytes

Sub S(a,b,c,d,e,f)
Set v=ActiveSheet.Shapes.AddShape(a,b,c,d,e)
v.Fill.ForeColor.RGB=f
v.Line.Visible=0
If a=5 Then v.Adjustments(1)=.5
End Sub
Sub U():p=91.5:w=-1
S 1,0,0,500,450,w
S 9,0,0,500,450,0
S 9,38.5,13.5,423,423,w
S 1,36,120,29,210,0
S 1,65,80,26.5,290,0
S 1,435,120,29,105,0
S 1,408.5,80,26.5,145,0
q=212.25:S 1,9,q,480,19,0
S 5,p,205.75,317,13,w
S 1,405,231.25,95,131.5,w
r=14.5:S 1,p,70.5,r,30,0
q=85:S 9,p,59.6,q,q,w
S 1,p,349.5,r,30,0
S 9,p,305.4,q,q,w
S 1,395,70.5,r,30,0
S 9,323.5,59.6,q,q,w
q=231.25:S 1,p,q,6.5,6.5,0
S 9,p,q,13,13,w
End Sub

Invoke macro U. Basically a lot of shape drawing. Shape 1 is a rectangle, 5 a rounded rectangle and 9 is an oval. Output is 500 wide by 450 high.

Edit: added the rounded rectangle (with adjustment to turn the ends into semicircles) to produce the radiused corners on top of the bar with one shape draw.


Ruby, (69+35)/2-10 = 42

a=gets
$><<gets.gsub(/./){a[0]!=$&?$&:a.slice!(0).upcase}
1/0if a>?\n

Takes input on STDIN, first line is the message to hide, second line is the text block.  Assumes the secret message is lower-case.  Example input:

codegolf
You'll get -10 points for writing a second program that recovers the hidden message from a block of text. In this eventuality your score is the average of the two, minus the 10 bonus points.

Example output:

You'll get -10 points for writing a seCOnD program that rEcovers the hidden messaGe frOm a bLock oF text. In this eventuality your score is the average of the two, minus the 10 bonus points.

Here's the program to obtain the secret back from the output (again, provided on STDIN):

$><<gets.scan(/(?<!^|\. )[A-Z]/)*''

One caveat here is that Ruby's lookbehind expressions have to be fixed width, so this code only works for text where the periods are followed by exactly one space.  Suggestions welcome!


pwaS eht tirsf dna tasl setterl fo hace dorw

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.


Brain-Flak, 12 bytes

(()()[][{}])

Outputs 2. Try it online!

The doubled program outputs 1. Try it online!

Explanation

This code pushes 2 + stack height - top of stack.  Initially, this is 2 + 0 - (implicit) 0 = 2.  When this code is run again, it pops the existing 2 and pushes 2 + 1 - 2 = 1.


Python 2, 232 bytes

def f(a):o=map(int,format(a,",").split(","));print(a%100>0)*(a>1000)+sum((k%100>0)*(k/100>0)for k in o[:-1])+sum((k>99)*2+`k`.count('7')+(k/10%10>0)+3-`k+1000`.count('0')for k in o)+sum((0<o[~k])*(5-k)*k/2for k in range(len(o)))or 2

Try it online!

This still has some potential for golfing, maybe in a lambda.
The function splits the input into groups of three digits, each of which have a certain number of syllables. Luckily, every digit is 1 syllable except for 7. Every tens-place adds an extra 1 syllable to the number of syllables of the digit except for 1, which adds 0 (-teen or ten).

Ungolfed:

def f(k):
    a=k
    if a==0:return 2
    o=[]
    while a>0:
        o.append(a%1000)
        a/=1000
    o=o[::-1]
    return \
int(o[-1]%100>0 and len(o)>1)        +len('+1 if first group of three have "and"'[0:0])+\
sum(\
  [int(k%100>0 and k/100>0)        +len('+1 if rest have "and"'[0:0])\
for k in o[:-1]])+
sum(\
  [int(k>99)*2                      +len('have "hundred"'[0:0])\
  +str(k).count('7')               +len('+1 for "se-ven"'[0:0])\
  +(k/10%10>0)                    +len('+1 for "-ty" e.g. nine-ty'[0:0])\
  +3-str(k+1000).count('0')        +len('+1 for each number'[0:0])\
for k in o])+\
sum(\
  [int(o[-(k+1)]>0)*([0,2,3,3][k])  +len('add 2 if "thousand", add 3 if "million", add 3 if "billion"'[0:0])\
for k in range(len(o))])

-12 bytes thanks to @Mr.Xcoder


JavaScript (ES6),  43  42 bytes

s=>([,x,y]=s.split`.`,x*x+x*3+~~y)/51^x>16

Try it online!
How?
Given an input string 1.x.y, we compute:
$$\left\lfloor\frac{x^2+3x+y}{51}\right\rfloor$$
Because we're using ~~y, we implicitly assume \$y=0\$ if the input string is just 1.x.
This gives the correct result for all versions except the last one, which gives \$6\$ instead of \$7\$. This is fixed by XOR'ing with \$1\$ if \$x>16\$.


Python 2, 165

def f(v):
 while 1:
    s=raw_input().split()
    if'['in s:f(dict(v))
    elif']'in s:break
    elif'>'in s:print v.get(s[1],0)
    else:v[s[0]]=v.get(s[1],s[1])
raw_input()
f({})

Character count assumes tabs are used for the second level of indentation.


10 PRINT CHR$(205.5+RND(1)); : GOTO 10 in PHP (or anything else, for that matter)

Since this has been migrated to codegolf...

PHP 30 bytes

<?for(;;)echo rand(0,1)?~Ð:~£;

The Ð is character 208, and the £ is character 163.

Sample usage (on a Windows box):

color 18 & php maze.php

Produces something similar to:

It works best with a monospace font that is exactly square (here I've chosen the standard system font 8x8). To go back to your default color, you can type color again without any parameters.


05AB1E, 2 bytes
ÑO

Try it online!
How?
Ñ    Divisors
 O   Sum


C#6, 107 bytes

Here's my own answer.  I don't expect any points being the one who posed the challenge.

I have taken some inspiration from user81655's answer.

long P(string a)=>(a[0]>99?12201284685:11042628752)+(a[2]+a[3])%2*46566348643>>"KQBNRP".IndexOf(a[1])*6&63;

The pixel counts are encoded in 6-bit blocks.  The outline or fill is added to the square (if it's white).  Finally, the 6-bit block for the appropriate piece is extracted.

Thankfully, operation precedence worked heavily in my favor.


Malbolge, Doorknob

Try it online (Thanks Dennis!)

Input for Windows: F_⌠1234567890

Input on Linux based system using ISO-8559-1: F_ô1234567890

The heart of how the Malbolge program worked is that it depended on a behavior of the Malbolge interpreter which causes an infinite loop if it encounters any instruction which is not between 33 and 126. The program was constructed such that your input would allow you to modify a single instruction.

I modified the interpreter to dump the program memory state at the beginning of execution and to also produce 'normalized' source code which takes the form of a list of op codes that will be run during the execution of the program. With that information you could (slowly) determine that even though the program took
 13 inputs only the 1st and 3rd inputs actually mattered.

Looking through the normalized code and memory dump (and a touch of debugger help) I devised the following:

  a = op(input 1, 29524)

  b = op(input 3, a)

  c = op(486, b)

  d = op(c, 37)

  e = d/4 + d%3 * 3^9

  e must be between 33 and 126

Where op is the so called tritwise "op" that is described in the specification. Using this information you can write a simple program which iterates over the possible inputs (0 to 255) and finds all solutions which meet the above criteria. I had found 2219 possible solutions, some of which will probably not be working solutions (you can't input the required characters). Specifically the above inputs are based on the solution:

(Input 1 = 70, Input 3 = 244)


sh/netcat, 39

nc -vz $1 $2-$3 2>&1|cut -f3 -d\ |xargs

Netcat does the scanning and returns results in this form on standard error:

localhost [127.0.0.1] 22 (ssh) open
localhost [127.0.0.1] 25 (smtp) open

cut and xargs extract the port number and make a single line out of it.

Remind me to shut SMTP down on that node.


Generate the names of the keys on a piano

Bash shell script (58)

echo {8..0}{B,♭B,A,♭A,G,♭G,F,E,♭E,D,♭D,C}|rev|cut -b40-410

If you do not have rev, you can instead use tac -rs. at a cost of five characters.

Bending the rules, I can subtract thirteen characters (for a score of 45):

echo {8..0}{B,♭B,A,♭A,G,♭G,F,E,♭E,D,♭D,C}|rev

If you really need a bash array, add six characters to the score (for a score of 64):

a=(`echo {8..0}{B,♭B,A,♭A,G,♭G,F,E,♭E,D,♭D,C}|rev|cut -b40-410`)


JavaScript (ES6), 15 14 bytes
I don't understand why this is getting so many upvotes!
s=>prompt(s,s)

Saved a byte thanks to Adám's suggestion that I display the original input in the prompt.

Try It

f=
s=>prompt(s,s)
console.log(f("Edit this ..."))


Find the last three words of each paragraph if they are shorter than 20 characters in total

37 bytes * 1403 steps = 51911 bytesteps
34 bytes * 1036 steps = 35224 bytesteps
37 bytes * 666 steps = 24642 bytesteps
(?<!\S)(?!.{21})\S+(( | - )\S+){0,2}$

Verify it here!


Mathematica, 74

Assuming that replacing [] with {} in I/O is allowed:

t=ToString;f=Split[#,#2<#+2&]/.{s_Integer,___,e_}:>t@s<>"-"<>t@e/.{x_}:>x&

  f[{18, 19, 20, 21, 22, 47, 56, 57, 62, 67, 68, 69, 70}]

  {"18-22", 47, "56-57", 62, "67-70"}

The Split part should be quite fast (because someone else probably spent a lot of time optimizing) - the pattern matching part might be a bit slower in comparison. If speed is the main criterium, then there will be other ways to process the Split result (let´s see how the Q develops). For an input of 10^6 entries this takes about 2.7s on my (average) laptop (2.2GHz i7), of which about 1s goes to Split.


Implement the Fibonacci sequence... Shifted to the right

Python 2, 78 72 bytes

f=lambda n:n>1and int(''.join(`-~int(i)%10`for i in`f(n-1)+f(n-2)`))or n

Try it online!

Saved 6 bytes thanks to Halvard Hummel.


JavaScript (ES6), 136 134 133 bytes

Saved 1 byte thanks to Luke

s=>[...a='abcdefghijklmnopqrstuvwxyz'].filter((c,i)=>eval(s.replace(/\w+/g,s=>[...s].reduce((p,c)=>p|1<<a.search(c),0)))&1<<i).join``

Test cases

let f =

s=>[...a='abcdefghijklmnopqrstuvwxyz'].filter((c,i)=>eval(s.replace(/\w+/g,s=>[...s].reduce((p,c)=>p|1<<a.search(c),0)))&1<<i).join``

console.log(f('ab + bd'));  // acd
console.log(f('d - ab'));   // ac
console.log(f('ab * cd'));  // cf


Jelly,  13  12 bytes

907ị;⁸Qḣ2ṢŒu

A monadic link taking and returning lists of characters.

Try it online! or see a test suite

How?

907ị;⁸Qḣ2ṢŒu - Monadic link: list of characters, state    e.g. Alabama   or   Kansas
907          - literal 907
   ị         - index into state                                b              K
     ⁸       - link's left argument, state
    ;        - concatenate                                     bAlabama       KKansas
      Q      - de-duplicate (unique by 1st appearance)         bAlam          Kans
       ḣ2    - head to index 2                                 bA             Ka
         Ṣ   - sort                                            Ab             Ka
          Œu - convert to uppercase                            AB             KA

Indexing in Jelly is 1-indexed and modular, so the 907th index of something of length L is the (907-modulo-L)th item. For example for "Alabama" the length is 7 so the item at index 907 is the (907-modulo-7)th, and 907-modulo-7 is 4 (907 = 129 * 7 + 4), so the item at index 907 is 'b'.

907 is the first positive index at which the state abbreviations using index 1 and that index over all of the 50 states become unique.

State names, including their spaces, are of length 4 through 14 inclusive, and 907-modulo-6 is 1 (whereas for all other lengths the value is not 1). This means that if we were to use the 1st and 907th characters for the abbreviations that Alaska, Hawaii, Kansas, Nevada, and Oregon would be AA, HH, KK, NN, and OO respectively - this is not acceptable for Hawaii, Kansas, or Nevada; so an adjustment needs to be made; this is the reason for the concatenation, de-duplication, head to index 2 and sort, this makes Alaska, Hawaii, Kansas, Nevada, and Oregon become AL, HA, KA, NA and OR respectively and does not collide with existing state abbreviations.


Determine if a substructure is present in a chemical structure using SMILES string (substructure fingerprint)

Mathematica, 31 bytes
MoleculeContainsQ@@Molecule/@#&

Takes input as a list of 2 strings (the source and the pattern molecules).
As you could guess, this checks if the first molecule (parsed via Molecule) contains the second one by using the MoleculeContainsQ function.
This doesn't seem to work in the online interpreter on TIO; I'm not sure what I am doing wrong. It works on my local machine, though. Of course, this is not using an external library: it's completely built-in functionality!


R, 40 bytes

function(x)min(x)+max(x)+mean(sign(x))<0

Try it online!

If min(x)+max(x) is non-zero, its sign corresponds to the note farthest from the centre and gives the direction of the beam.

Adding mean(sign(x)) can never change the sign. Indeed, either (a) all notes are of the same sign and mean(sign(x)) is of the same sign as min(x)+max(x) or (b) notes are of both signs and mean(sign(x)) is strictly in \$(-1,1)\$  whereas min(x)+max(x) is an integer, so the sign of the sum is unchanged.

If min(x)+max(x)==0, the sign of the mean decides the direction.

If undecided, defaults to FALSE.


Perl 6, 39 bytes

->\a{&{?/<{a}>/}}o{S:g/<-[.*$^]>/'$/'/}

Try it online!

Simply evaluates the input as a regex, adding quotes to avoid any special characters Perl 6 uses. This takes input curried, as f(regex)(string), though it could be a lot shorter if I can just return a regex object.


Find minimum difference between numbers in array

The R language

23 characters,  O(n log n)

min(diff(sort(scan())))

Example:

> min(diff(sort(scan())))
1: 55 99 6
4: 29 1 523 3
8:
Read 7 items
[1] 2

...The [1] 2 shows the result 2. (the [1] is to keep track of where in the result vector your are since in R all values are vectors - in this case of length 1)


Python 3, 394 378 370 328 bytes

def p(s,i,R,C,H='═',V='║'):
 v=i%C and s[i-1]==H
 v|=(i//C and s[i-C]==V)<<3
 v|=(i%C-C+1and s[i+1]==H)<<2
 return' ═║╗══╔╔║╝║╗╚╚╔╔'[v|(i//C-R+1and s[i+C]==V)<<1]
def f(s,i=0):
 t=s.split('\n');R,C,s=len(t),len(t[0]),''.join(t)
 for c in s:print([c,p(s,i,R,C)][c=='.'],end='\n'[:-~i%C==0]);i+=1

Try it online!
A very naive method. Receives as input a string and iterates over its characters. If a character is a point (a placeholder), replace it with the character returned by p.
The function p builds a "4-bits integer" v, where:

if its 1st bit is set, the placeholder has a valid connection with the west;
if its 2nd bit is set, the placeholder has a valid connection with the south;
if its 3rd bit is set, the placeholder has a valid connection with the east; and
if its 4th bit is set, the placeholder has a valid connection with the north.

A invalid connection occurs with a direction when

the rail is on a border of that direction (the first placeholder in the example given by the OP has an invalid connection with the north and the west since it's in the border, so its 4-bit integer is 1010).

the rail of that direction is misaligned with the placeholder (the fifth placeholder in the example given by the OP has an invalid connection with the east since the east rail is misaligned, so its 4-bit integer is 1011).

After this 4-bit integer is built, it returns the corresponding box-drawing character using this integer as index of a string.


Prolog (SWI), 194 163 bytes

Saved a whopping 31 bytes using this tip from 0 '!

[C|T]/O/R:-C\=x,(T/P/R,concat(C,P,O);O=C,R=T).
[x|R]-x-R.
L-X-R:-L/O/A,A-Y-B,B/O/C,C-Z-D,D/O/R,atomics_to_string(['(',Y,O,Z,')'],X).
X^P:-string_chars(X,L),L-P-[].

The operator ^ takes for its left argument a string containing a panfix expression and sets its right argument to a string containing the corresponding parenthesized infix expression. It uses x as the literal in place of _.

Try it online!

Explanation

Since Prolog is a declarative language, we just have to describe the relation between a panfix and a parenthesized expression.

The explanation uses this slightly ungolfed version:

oper([C|T],O,R) :- C\=x, oper(T,P,R), concat(C,P,O).
oper([C|T],C,T).

expr([x|R],x,R).
expr(L,X,R) :- oper(L,O,A), expr(A,Y,B), oper(B,O,C), expr(C,Z,D), oper(D,O,R),
               atomics_to_string(['(',Y,O,Z,')'],X).

parenthesize(X,P) :- string_chars(X,L), expr(L,P,[]).

Our main production is parenthesize, which takes in a panfix expression X as a string and sends out the corresponding parenthesized infix expression P as a string. It uses string_chars to convert the input string into a list of characters and then simply passes it on to expr.

expr takes in a list of characters L, parses the first panfix expression it finds in L, and sends out the parenthesized equivalent X and the remainder of the list of characters R. There are two possible kinds of expressions:

If the first character of L is x, then the expression is x and the remainder is everything after the x.
Otherwise, parse an operator O (see oper below); parse an expression Y; parse O again; parse another expression Z; and parse O a third time. The remainder is everything after the third instance of O. The expression is the result of joining Y, O, and Z, surrounded by parentheses, into a string.

oper takes in a list of characters, where the first character is C and the rest are T; it parses an operator (i.e. a run of one or more operator characters) and sends out the operator O and the remainder of the list of characters R. To form an operator, the character C must be something other than x; also, either

an operator P must be parseable from T, with remainder R; in this case, O is the concatenation of C and P; or,
O is the single character C; in this case, R is just T.

A worked example

Let's take the input +*+x+x++*x+* for an example.

We want to parse an expression from +*+x+x++*x+*. This doesn't start with x, so we parse an operator from the beginning.
oper will parse as big of an operator as possible, so we try +*+.

Next we parse an expression from x+x++*x+*. This has to be x.
Now we try to parse the same operator, +*+, from +x++*x+*. However, this fails.

So we backtrack and try parsing the operator +* instead.

We parse an expression from +x+x++*x+*. This doesn't start with x, so we need to parse an operator.
The only possibility is +.
Now parse a subexpression from x+x++*x+*. This has to be x.
Now parse + again from +x++*x+*.
Now parse another subexpression from x++*x+*. This has to be x.
Finally, parse + again from ++*x+*.
The expression has been successfully parsed. We return the string (x+x).

Back at the previous recursion level, we parse the operator +* again from +*x+*.
Now parse another subexpression from x+*. This has to be x.
Finally, parse +* again from +*.
The expression has been successfully parsed. We return the string ((x+x)+*x).

Since there are no more characters left, we have successfully translated the expression.


APL (Dyalog Classic), 84 80 77 76 74 66 61 bytes

{⍵⌷⍨{⍵,⍨⊃⍋(1≠a⌷⍨⊃⍵),⍪⍺⌷a}⍣d/⊃⍸a=d←⌈/512|,a←⌊.+⍨⍣≡9*⍨2⌊⍵+.≠⍉⍵}

Try it online!

input and output are character matrices

⍵+.≠⍉⍵ matrix of hamming-like distances between words

9*⍨2⌊ leave 0s and 1s intact, turn 2+ into some large number (512=29, used as "∞")

⌊.+⍨⍣≡ floyd&warshall's shortest path algorithm

⌊.+ like matrix multiplication but using min (⌊) and + instead of + and × respectively
⍨ use the same matrix on the left and right
⍣≡ repeat until convergence

d←⌈/512|, length of longest (not "∞") path, assigned to d

⊃⍸a= which two nodes does it connect, let's call them i and j

{⍵,⍨⊃⍋(1≠a⌷⍨⊃⍵),⍪⍺⌷a}⍣d/ reconstruct the path

{ }⍣d/ evaluate the { } function d times. the left arg ⍺ is always i. the right arg ⍵ starts as j and gradually accumulates the internal nodes of the path
(1≠a⌷⍨⊃⍵),⍪⍺⌷a build a 2-column matrix of these two vectors:

1≠a⌷⍨⊃⍵ booleans (0 or 1) indicating which nodes are at distance 1 to the first of ⍵
⍺⌷a distances of all graph nodes to ⍺

⊃⍋ index of the lexicographically smallest row
⍵,⍨ prepend to ⍵

⍵⌷⍨ index the original words with the path


Convert a fraction to a repeated decimal

C, 108 79
Edit Modified to work with negative numbers.
Input from stdin. Old K&R style.
main(a,b){char*s="-%d.";scanf("%d/%d",&a,&b);for(a*b<0?(a<0?a=-a:(b=-b)):++s;printf(s,a/b);s="%d")a=a%b*10;}


Books full of nonsense: Identify limericks

Python: 400 - 150 - 150 = 100

The shortest script I could come up with is that one...

import re,sys;f,e,c=re.findall,lambda l,w:f('^'+w.upper()+'  (.+)',l),lambda*v:all([a[i]==a[v[0]]for i in v]);a=[sum([[e(l,w)[0].split()for l in open('c')if e(l,w)][0]for w in f(r'\w+',v)],[])[-2:]for v in sys.stdin];n=len(a);print n==14and c(0,3,4,7)*c(1,2,5,6)*c(8,11)*c(9,12)*c(10,13)*"Sonnet"or"For a critic\nOf limerick\nWell-equipped\nIs this script.\n%s limerick!"%(n==5and c(0,1,4)and c(2,3))

...but don't even try it. It parses the provided dictionary for every word it meets, thus being very slow. Also, an error is generated whenever a word is not in the dictionary.

The code still meets the requirements though: recognizing whether the text passed via stdin is a limerick, a sonnet, or neither of those.

With only 20 more characters, here is the optimized version:

import re,sys;f,e,c=re.findall,lambda l:f(r'^(\w+)  (.+)',l),lambda*v:all([a[i]==a[v[0]]for i in v]);d={e(l)[0][0]:e(l)[0][1].split()for l in open('c')if e(l)};a=[sum([d.get(w.upper(),[])for w in f(r'\w+',v)],[])[-2:]for v in sys.stdin];n=len(a);print n==14and c(0,3,4,7)*c(1,2,5,6)*c(8,11)*c(9,12)*c(10,13)*"Sonnet"or"For a critic\nOf limerick\nWell-equipped\nIs this script.\n%s limerick!"%(n==5and c(0,1,4)and c(2,3))

Features

able to recognize sonnets (-150)
answers to limericks with a limerick (-150)
relatively fast: only one file parsing per execution

Usage

cat poem.txt | python poem-check.py

3 different outputs are possible:

a limmerick saying the input is one if it is the case
a limmerick saying the input is not one if it is the case
"Sonnet" if the input is recognized as such

Expanded code with explanations

import re, sys

# just a shortened version of the 're.findall' function...
f = re.findall
# function used to parse a line of the dictionary
e = lambda l:f(r'^(\w+)  (.+)', l)

# create a cache of the dictionary, where each word is associated with the list of phonemes it contains
d = {e(l)[0][0]:e(l)[0][1].split(' ') for l in open('c') if e(l)}

# for each verse (line) 'v' found in the input 'sys.stdin', create a list of the phoneme it contains;
# the result array 'a' contains a list, each item of it corresponding to the last two phonemes of a verse
a = [sum([d.get(w.upper(), []) for w in f(r'\w+',v)],[])[-2:] for v in sys.stdin]

# let's store the length of 'a' in 'n'; it is actually the number of verses in the input
n = len(a)
# function used to compare the rhymes of the lines which indexes are passed as arguments
c = lambda*v:all([a[i] == a[v[0]] for i in v])

# test if the input is a sonnet, aka: it has 14 verses, verses 0, 3, 4 and 7 rhyme together, verses 1, 2, 5 and 6 rhyme together, verses 8 and 11 rhyme together, verses 9 and 12 rhyme together, verses 10 and 13 rhyme together
if n==14 and c(0,3,4,7) and c(1,2,5,6) and c(8,11) and c(9,12) and c(10,13):
    print("Sonnet")
else:
    # test if the input is a limerick, aka: it has 5 verses, verses 0, 1 and 4 rhyme together, verses 2 and 3 rhyme together
    is_limerick = n==5 and c(0,1,4) and c(2,3)
    print("For critics\nOf limericks,\nWell-equipped\nIs this script.\n%s limerick!", is_limmerick)


Java 7, Score = Upvotes - 3.97

Yay!!! Java!!! The world's favourite golfing language in the world. What, you can actually golf in java??? Well, it's kind of like using a bulldozer to putt.

a is expected to contain the first character. b is expected to contain the last character. c is expected to have the input string.

Here is the function golfed:

int d=0;try{d=Integer.parseInt(c);}catch(Exception e){}int l=b-a+1;char[]f=new char[l];int[]g=new int[l];int h=1;int i=1;g[0]=1;f[0]=a;int j;for(j=1;j<b-a+1;){g[j]=(h+=i);f[j]=(char)(f[j++-1]+1);i*=h==10*i?10:1;}if(d==0){h=0;for(char k:c.toCharArray()){for(j=0;j<l;j++){if(f[j]==k){h+=g[j];}}}System.out.println(h);}else{c="";for(j=l;j>0;){if(g[--j]<=d){c+=f[j];d-=g[j++];}}System.out.println(c);}

Here it is indented with structure code:

public class G{

    public static void main(String[] args){
        new G(args);
    }

    public G(String[] args){
        a = args[0].charAt(0);
        b = args[1].charAt(0);
        for (int i = 2; i < args.length; i++){
            c += args[i];
        }
        function();
    }

    char a;

    char b;

    String c = "";

    void function(){
        int d=0;
        try{
            d=Integer.parseInt(c);
        }catch(Exception e){}
        int l=b-a+1;
        char[]f=new char[l];
        int[]g=new int[l];
        int h=1;
        int i=1;
        g[0]=1;
        f[0]=a;
        int j;
        for(j=1;j<b-a+1;){
            g[j]=(h+=i);
            f[j]=(char)(f[j++-1]+1);
            i*=h==10*i?10:1;
        }
        if(d==0){
            h=0;
            for(char k:c.toCharArray()){
                for(j=0;j<l;j++){
                    if(f[j]==k){
                        h+=g[j];
                    }
                }
            }
            System.out.println(h);
        }else{
            c="";
            for(j=l;j>0;){
                if(g[--j]<=d){
                    c+=f[j];
                    d-=g[j++];
                }
            }
            System.out.println(c);
        }
    }
}

Here it is completely expanded:

public class Generator{

    public static void main(String[] args){
        beginning = args[0].charAt(0);
        end = args[1].charAt(0);
        for (int i = 2; i < args.length; i++){
            phrase += args[i];
        }
        function();
    }

    static char beginning;

    static char end;

    static String phrase = "";

    static void function(){
        int convertTo = 0;
        try{
             convertTo = Integer.parseInt(phrase);
        } catch (Exception e){}
        char[] alphabet = new char[end - beginning + 1];
        int[] values = new int[alphabet.length];
        int value = 1;
        int base = 1;
        values[0] = 1;
        alphabet[0] = beginning;
        int i;
        for (i = 1; i < values.length;){
            values[i] = (value += base);
            alphabet[i] = (char)(alphabet[i++-1]+1);
            base*=value==10*base?10:1;
        }
        if(convertTo==0){
            value = 0;
            for (char character : phrase.toCharArray()){
                for (i = 0; i < alphabet.length;i++){
                    if (alphabet[i] == character){
                        value += values[i];
                    }
                }
            }
            System.out.println(value);

        } else {
            phrase = "";
            for (i = values.length;i > 0;){
                if (values[--i] <= convertTo){
                    phrase += alphabet[i];
                    convertTo -= values[i++];
                }
            }
            System.out.println(phrase);

        }
    }
}


Implement strategy for Jacks or Better Video

I did it!!!

import java.io.*;
// 427 lines 200
public class Base {

    static char suit (String tokens) {  return  tokens.charAt (1); }
    public static char num (String tokens) { return tokens.charAt (0);}

    public static void checkPair (String [] tokens)
    {
        for (int a = 0; a < 4; ++a)
        for (int b = a+1; b < 5; ++b)
            if (num (tokens [a]) == num (tokens [b]))
                System.out.print (tokens [a] + " " + tokens [b]);
    }

    public static void checkThreeKind (String [] tokens)
    {
        for (int a = 0; a < 3; ++a)
            if (num (tokens [a]) == num (tokens [a+1]))
                for (int b = 2; b < 5; ++b)
                    if (num (tokens [a]) == num (tokens [b]))
                        System.out.print (tokens [a] + " " + tokens [a+1] + " " + tokens [b]);
    }

    static void checkTwoPair (String [] tokens)
    {
        for (int i = 0; i < 5; i++)
        for (int j = 1; j < 5; j++)
            //First Increment is pair 1 2, followed by 1 3, 1 4, and 1, 5 then 2 3, 2 4, 2 5, then 3 4, 3 5 then 4 5
            if (num (tokens [i]) == num (tokens [j]))
                for (int y = 0; y <= 4; y++)
                    for (int x = 1; x <= 4; x++)
                        if ((i != y) && (j != x) && (y != x) && (i != j))
                            if (num (tokens [y]) == num (tokens [x]))
                                if ((tokens [i] != tokens [j]) && (tokens [i] != tokens [y]) && (tokens [j] != tokens [y]) &&
                                        (tokens [i] != tokens [x]) && (tokens [j] != tokens [x]) && (tokens [y] != tokens [x]))
                                    eblock (tokens);
    }

    static void checkHighFlush (String [] tokens)
    {
        if (suit (tokens [0]) == suit (tokens [1]) &&
            suit (tokens [0]) == suit (tokens [2]) &&
            suit (tokens [0]) == suit (tokens [3]) &&
            suit (tokens [0]) == suit (tokens [4]))
        {
            String outputString = "";
            for (int i = 0; i < tokens.length; i++)
                outputString  += tokens [i] + " ";
            System.out.println (outputString);
            System.exit (0);
        }
        for (int i = 0; i <= 4; i++)
            for (int j= 1; j<= 4; j++)
                //First Increment is pair 1 2, followed by 1 3, 1 4, and 1, 5 then 2 3, 2 4, 2 5, then 3 4, 3 5 then 4 5
                if (suit (tokens [i]) == suit (tokens [j]))
                    for (int y = 0; y <= 4; y++)
                        for (int x = 1; x <= 4; x++)
                            if ((i != y) && (j != x) && (y != x) && (i != j))
                            {
                                if (suit (tokens [i]) == suit (tokens [x]) &&
                                        suit (tokens [i]) == suit (tokens [y]))
                                {
                                    if ((tokens [i] != tokens [j]) && (tokens [i] != tokens [y]) && (tokens [j] != tokens [y]) &&
                                            (tokens [i] != tokens [x]) && (tokens [j] != tokens [x]) && (tokens [y] != tokens [x]))
                                        eblock (tokens);
                                }
                            }
    }

     static void checkFourKind (String [] tokens)
     {
        if (num (tokens [0]) == num (tokens [1]))
        {
            if (num (tokens [0]) == num (tokens [2]))
                if (num (tokens [0]) == num (tokens [3]) || num (tokens [0]) == num (tokens [4]))
                    eblock (tokens);
            if (num (tokens [0]) == num (tokens [3]))
                if (num (tokens [0]) == num (tokens [4]))
                    eblock (tokens);
        }
        if (num (tokens [1]) == num (tokens [2]))
            if (num (tokens [1]) == num (tokens [3]))
                if (num (tokens [1]) == num (tokens [4]))
                    eblock (tokens);
    }

    static void checkStraight (String [] tokens)
    {
        int [] ints = new int [5];
        for (int i = 0; i <= 4; i++)
        {
            switch (num (tokens [i]))        {
            case 'T': ints [i] = 10;
            case 'J': ints [i] = 11;
            case 'Q': ints [i] = 12;
            case 'K': ints [i] = 13;
            case 'A': ints [i] = 14;
            default:  ints [i] = num (tokens [i]) - '0';
        }
        }
        for (int i = 0; i <= 3; i++)
        for (int j= 1; j<= 4; j++)
            //First Increment is pair 1 2, followed by 1 3, 1 4, and 1, 5 then 2 3, 2 4, 2 5, then 3 4, 3 5 then 4 5
            if ((ints [i]+1) == ints [i+1])
                for (int y = 0; y <= 4; y++)
                    for (int x = 1; x <= 4; x++)
                        if ((i != y) && (j != x) && (y != x) && (i != j))
                        {
                            if (ints[i] + 2 == ints[y] && ints[i] + 3 == ints [x])
                            {
                                if ((tokens [i] != tokens [j]) && (tokens [i] != tokens [y]) && (tokens [j] != tokens [y]) &&
                                        (tokens [i] != tokens [x]) && (tokens [j] != tokens [x]) && (tokens [y] != tokens [x]))
                                {
                                    for (int a : new int[] {i, j, y, x})
                                        System.out.print (tokens [a] + " ");
                                    System.out.println ();
                                    System.exit (0);
                                }
                            }
                            java.util.Arrays.sort (ints);
                            if (( (ints [i]+1 == ints [j]) && (ints [i]+3 == ints [y]) && (ints [i]+4 == ints [x])))
                            {
                                for (int a : new int[] {i, j, y, x})
                                    System.out.print (tokens [a] + " ");
                                System.out.println ();
                                System.exit (0);
                            }
                        }
    }

    static void checkHighCard (String [] tokens)
    {
        int [] ints = new int [5];
        for (int i = 0; i <= 4; i++)
        {
            switch (num (tokens [i]))        {
            case 'T': ints [i] = 10;
            case 'J': ints [i] = 11;
            case 'Q': ints [i] = 12;
            case 'K': ints [i] = 13;
            case 'A': ints [i] = 14;
            default:  ints [i] = num (tokens [i]) - '0';
        }
        }
        int marker = 0;
        if (ints [0] > ints [1]) marker = 1;
        if (ints [1] > ints [2]) marker = 2;
        if (ints [2] > ints [3]) marker = 3;
        if (ints [3] > ints [4]) marker = 4;
        System.out.println (tokens [marker]);
    }

    static void eblock (String[] tokens)
    {
        for (int i = 0; i < 5; i++)
            System.out.print (tokens [i] + " ");
        System.out.println ();
        System.exit (0);
    }

    static void checkFullHouse (String [] tokens)
    {
        String [] test = new String [5];
        int counter = 0;
        int sum = 0;

        for (int i = 0; i <= 4; i++)
        test [i] = tokens [i];
        for (int i = 0; i <=4; i++)
        {
        for (int j = 1; j <= 4; j++)
        {
            if (num (test [i]) == num (tokens [j]))
                counter++;
        }
        if (counter > 1)
            sum++;
        counter = 0;
        }
        if (sum == 5) eblock (tokens);
    }

    public static void main (String [] args) throws IOException
    {
        String inputString = new BufferedReader (new InputStreamReader (System.in)).readLine ();
        String [] tokens = inputString.split (" ");
        java.util.Arrays.sort (tokens);
        checkFourKind (tokens);
        checkHighFlush (tokens);
        checkFullHouse (tokens);
        checkStraight (tokens);
        checkTwoPair (tokens);
        checkThreeKind (tokens);
        checkPair (tokens);
        checkHighCard (tokens);
    }
}


Javascript (148 bytes)

Creates some nonsense literals, with the side effect of creating an alert* for the question. (the splits doing similar, but creating alerts* for each of the answers).

"';"+alert( 'What is the ideal breakfast???')+/ " ;apl=e"rbta(k"esnc"r.armebplleadc ee g g s(" ) + " \/)k;e"/+ ",t'hceo 'c)a;kye= ailse rat (lpi)e "

Splits:

";+lr('hti h da rafs??)/";p="baken".replace   (    /ke/ ,'co');y=alert(p)

and

'"aet Wa steielbekat?'+  alert("scrambled eggs")+"\);"+"the cake is a lie"

Question: What is the ideal breakfast???

Answers: bacon and scrambled eggs


Convert number to a base where its representation has most "4"s

APL (31 19)

Now tests all possible bases.

⊃⍒{+/4=K⊤⍨K⍴⍵}¨⍳K←⎕

Explanation:

⍳K←⎕: read user input, store in K. Make a list from 1 to K, which are the bases to try.
{...}¨: for each of these, run the following function
K⊤⍨K⍴⍵: encode K into that base giving a list of digits (as numbers) per base. Use K digits (a big overestimate, but it doesn't matter because the unused ones will all be zero anyway).
4=: see which of these are equal to 4
+/: sum these, now we know how many fours per base
⊃⍒: give the indices of the list if it were sorted downwards, so the index of the biggest one is at the front. Take the first item of this list.


JavaScript (Node.js), 50 bytes

f=a=>a[1]?f(a.replace(/\((.>)?(.)(<.)?\)/,'$2')):a

Try it online!
Repeat apply regex replace until only 1 char left. The regex /\((.>)?(.)(<.)?\)/ get the calculate result as 2nd capturing group.

Save 1 byte, thanks to Arnauld


Mathematica, 72 65 61 bytes

Print@@@Tuples@{a=##/(b=#5#9#15#21#25#)&@@Alphabet[],b,a,b,a}

For testing, I recommend replacing Print@@@ with ""<>#&/@. Mathematica will then display a truncated form showing the first few and last few words, instead of taking forever to print 288,000 lines.

Explanation

I finally found a use for dividing strings. :)

I've been intrigued by the possibility of adding or multiplying strings for a while, but the actual use cases are fairly limited. The main point is that something like "foo"+"bar" or "foo"*"bar" (and consequently, the short form "foo""bar") is completely valid in Mathematica. However, it doesn't really know what to do with the strings in arithmetic expressions, so these things remain unevaluated. Mathematica does apply generally applicable simplifications though. In particular, the strings will be sorted into canonical order (which is fairly messed up in Mathematica, once you start sorting strings containing letters of various cases, digits and non-letters), which is often a dealbreaker, but doesn't matter here. Furthermore, "abc""abc" will be simplified to "abc"^2 (which is a problem when you have repeated strings, but we don't have that either), and something like "abc"/"abc" will actually cancel (which we'll be even making use of).

So what are we trying to golf here. We need a list of vowels and a list of consonants, so we can feed them to Tuples to generate all possible combinations. My first approach was the naive solution:

Characters@{a="bcdfghjklmnpqrstvwxz",b="aeiouy",a,b,a}

That hardcoded list of consonants does hurt a bit. Mathematica does have an Alphabet built-in which would allow me to avoid it, if I were able to remove the vowels in a cheap way. This is where it gets tricky though. The simplest way to remove elements is Complement, but that ends up being longer, using one of the following options:

{a=Complement[Alphabet[],b=Characters@"aeiouy"],b,a,b,a}
{a=Complement[x=Alphabet[],b=x[[{1,5,9,15,21,25}]]],b,a,b,a}

(Note that we don't need to apply Characters to the whole thing any more, because Alphabet[] gives a list of letters, not a string.)

So let's try that arithmetic business. If we represent the entire alphabet as a product of letters instead of a list, then we can remove letters by simple division, due to the cancelling rule. That saves a lot of bytes because we won't need Complement. Furthermore, "a""e""i""o""u""y" is actually a byte shorter than Characters@"aeiouy". So we do this with:

a=##/(b="a""e""i""o""u""y")&@@Alphabet[]

Where we're storing the consonant and vowel products in a and b, respectively. This works by writing a function which multiplies all its arguments with ## and divides them by the product of vowels. This function is applied to the alphabet list, which passes each letter in as a separate argument.

So far so good, but now we have

{a=##/(b="a""e""i""o""u""y")&@@Alphabet[],b,a,b,a}

as the argument to Tuples, and those things are still products, not lists. Normally, the shortest way to fix that is putting a List@@@ at the front, which turns the products into lists again. Unfortunately, adding those 7 bytes makes it longer than the naive approach.

However, it turns out that Tuples doesn't care about the heads of the inner lists at all. If you do

Tuples[{f[1, 2], f[3, 4]}]

(Yes, for an undefined f.) You'll get:

{{1, 3}, {1, 4}, {2, 3}, {2, 4}}

Just as if you had used a List instead of f. So we can actually pass those products straight to Tuples and still get the right result. This saves 5 bytes over the naive approach using two hardcoded strings.

Now the "a""e""i""o""u""y" is still fairly annoying. But wait, we can save a few bytes here as well! The arguments of our function are the individual letters. So if we just pick out the right arguments, we can reuse those instead of the string literals, which is shorter for three of them. We want arguments # (short for #1), #5, #9, #15, #21 and #25. If we put # at the end, then we also don't need to add any * to multiply them together, because (regex) #\d+ is a complete token that can't have any non-digit appended to it. Hence we end up with #5#9#15#21#25#, saving another 4 bytes.


Sum of integers in string, separated by non-numericals such as 'a' and 'Y'

Ruby 1.9, 21 characters

eval a.scan(/\d+/)*?+

To print the solution to stdout, 2 additional characters are required:

p eval a.scan(/\d+/)*?+

And to read from stdin instead of using a predefined variable, another 3 characters have to be used:

p eval gets.scan(/\d+/)*?+

For Ruby 1.8, replace ?+ with "+" to get a working solution in 22 characters.


C, 424 406 386 357 bytes

#define x(a,b,c)if(*#a==C){if(b>8){c-=9;}Z=0;}
L,M=100,H,S=-1,F=10,P,Z,C;t(){H++;S++;L-=H>79;if(S>79)S=0,H+=9;Z=1/L/2;alarm(1);}main(){nodelay(initscr(),L=M);signal(14,t);for(t(H=S);C=getch();Z=Z||printf("\rhealth: %d,hunger: %d,sleep: %d,food: %d,potions: %d,money: %d\n",L,H,S,F,P,M)){x(s,9,S=9;S)x(p,P+8,P--;L+=18;L)x(f,H,F--;H)x(b,M,P++;M)x(t,M,F++;M)}}

I appreciate the need for raw input and asynchronous updates in the problem spec.  Even though that required some overhead from the ncurses setup and signal handlers, it's nice to have the occasional challenge that (hopefully) won't be automatically won by one of the dedicated golfing languages.

You didn't specify exactly how game over is indicated, so this one perishes with the traditional Tamagotchi death cry of "Floating point exception (core dumped)".

Ungolfed

/* Playing a bit fast and loose with the prototyping rules by omitting these;
 * none of the functions I'm using from them *exactly* match the default
 * prototype of `int f();`
 */
//#include <curses.h>
//#include <stdio.h>
//#include <signal.h>
//#include <unistd.h>

#define x(a,b,c)if(*#a==C){if(b>8){c-=9;}Z=0;}
L,M=100,H,S=-1,F=10,P,Z,C;

t() {
    H++;
    S++;
    L-=H>79;
    if(S>79)S=0,H+=9;
    Z=1/L/2;//0 if L>0. otherwise the pet dies of a floating point error
    alarm(1);
}

main(){
    nodelay(initscr(),L=M);
    signal(14,t);
    for(t(H=S); C=getch(); Z=Z||printf("\rhealth: %d,hunger: %d,sleep: %d,food: %d,potions: %d,money: %d\n",L,H,S,F,P,M)){
        x(s,9,S=9;S)
        x(p,P+8,P--;L+=18;L)
        x(f,H,F--;H)
        x(b,M,P++;M)
        x(t,M,F++;M)
    }
}


As little white space as possible.

If you have a 10x5 (50) code, can you make it into a 6x8 (48):

some code
goes here
and it is
exactly 50
characters

goes to

put a bi
t of cod
e here a
nd count
all of 4
0 chars!


05AB1E, 3 bytes

œÙ¦

A function that leaves the stack with a list of the anagrams on top (and as its only item). As a full program prints a representation of that list.

Try it online!

How?

    - push input
œ   - pop and push a list of all permutations (input appears at the head)
 Ù  - pop and push a list of unique items (sorted by first appearance)
  ¦ - pop and push a dequeued list (removes the occurrence of the input)
    - As a full program: implicit print of the top of the stack


Jelly, 43 41 40 25 24 23 22 21 14 13 bytes
-7 bytes thanks to fireflame241 (0ị=1ị$->=ṚḢ and use of IIA⁼2,2 to test for the 4 rotations)
-1 Thanks to Kevin Cruijssen (use of previously unavailable nilad Ø2 which yields [2,2])
=ṚḢȧOIṠIIA⁼Ø2

TryItOnline
Or all test cases (plus "RULES")
How?
An infinity word has:

the same first and last letter;
length 5;
no equal letters next to each other;
sum of its four alphabet deltas equal to zero;
sum of its four alphabet deltas signs equal to zero;
two positive alphabet deltas or two negative alphabet deltas in a row.

All but (1) and (equivalently) (4) may be boiled down to a condition that the alphabet delta signs are some rotation of [1,1,-1,-1] (where the sign of 0 is 0)
fireflame241 noted that this is then equivalent to the deltas of the deltas of the alphabet delta signs being in [[2,2],[2,-2],[-2,2],[-2,-2]] which may be tested by the absolute values being equal to [2,2]!
How?
=ṚḢȧOIṠIIA⁼Ø2 - Main link: word
 Ṛ            - reverse word
=             - equals? (vectorises)
  Ḣ           - head (is the first character equal to the last?)
   ȧ          - and
    O         - cast word to ordinals
     I        - increments - the alphabet deltas (or just [] if 1st != last)
      Ṡ       - sign (vectorises)
       I      - increments - deltas of those signs
        I     - increments - deltas of those
         A    - absolute value (vectorises)
           Ø2 - literal [2,2]
          ⁼   - equals? (non-vectorising version)


Retina, 81 80 bytes

K`0.
"$+"{+`(1(\.)|(1\.(0?1)*0?)1)(00|$)
${3}0${2}11
0\.
1.
+0`0?1(\.?)1
10${1}0

Try it online! Works by repeatedly adding \$ 1 \$. Explanation:

K`0.

Start off with \$ 0. \$.

"$+"{`

Repeat the number of times given by the input.

+`(1(\.)|(1\.(0?1)*0?)1)(00|$)
${3}0${2}11

If the \$ \phi^0 \$ bit is set, use the identity \$ \phi^0 = \phi^{-1} + \phi^{-2} \$ to move bits away until there is enough room.

0\.
1.

Add \$ 1 \$.

+0`0?1(\.?)1
10${1}0

Minimise the number of bits by reversing the above identity.


JavaScript (ES7), 190 bytes
Returns [n,e,d].

f=N=>(R=Math.random,g=d=>d&&p%--d?g(d):d)(p=g(p=n=R()*2**N|0))<2&n>1&(L=(q=n/p-1)*--p/(G=(a,b)=>b?G(b,a%b):a)(p,q))>2?(g=_=>G(L,e=R()*(L-2)+2|0)<2?(h=d=>d*e%L<2?[n,e,d]:h(-~d))():g())():f(N)

Try it online!
Because of the limited size of the call stack, this may fail for \$N>13\$.
Commented
f = N =>
  (
    R = Math.random,
    // helper function returning the highest divisor of p
    g = d => d && p % --d ? g(d) : d
  )(
    // choose n and compute its highest divisor p
    p = g(p = n = R() * 2 ** N | 0)
  )
  // make sure that p is prime
  < 2 &
  // and that n is greater than 1
  n > 1 &
  // compute L = λ(n) = LCM(p - 1, q - 1) = (p - 1) * (q - 1) / GCD(p - 1, q - 1),
  // using the helper function G that returns GCD(a, b)
  (L = (q = n / p - 1) * --p / (G = (a, b) => b ? G(b, a % b) : a)(p, q))
  // make sure that L > 2
  > 2 ?
    // helper function to choose e such that GCD(e, L) = 1
    (g = _ => G(L, e = R() * (L - 2) + 2 | 0) < 2 ?
      // helper function to compute d such that d * e mod L = 1
      (h = d => d * e % L < 2 ? [n, e, d] : h(-~d))()
    :
      g()
    )()
  :
    f(N)


BlooP

Bonus: 10

There are pages for BlooP on Esolangs and Wikipedia. A PPCG search for BlooP returns no results. If you're feeling particularly loopy, you can try it out on repl.it.

Task 1: The Tweet

  BlooP: Nothing but bounded loops. ;) #programming #goodtimes

This uses standard Twitter styling including hashtags and emoticons. This would appeal to any Twitter user.*

Task 2: The Hello World

DEFINE PROCEDURE ''GREETING'' [N]:
BLOCK 0: BEGIN
  PRINT['Hello World! This is written in BlooP.']
BLOCK 0: END.

GREETING[0];

As you can see, this is a prime golfing language.*

Task 3: The Odd Numbers

DEFINE PROCEDURE ''IS-ODD'' [N]:
BLOCK 0: BEGIN
  OUTPUT <= 0;
  CELL(0) <= 2;
  LOOP AT MOST N+1 TIMES:
  BLOCK 1: BEGIN
    IF N+1 = CELL(0), THEN:
    BLOCK 2: BEGIN
      OUTPUT <= 1;
      ABORT LOOP 1;
    BLOCK 2: END;
    CELL(0) <= CELL(0) + 2
  BLOCK 1: END;
BLOCK 0: END.

DEFINE PROCEDURE ''ODDS-IN-RANGE'' [A,B]:
BLOCK 0: BEGIN
  CELL(0) = A;
  LOOP AT MOST B TIMES:
  BLOCK 1: BEGIN
    IF CELL(0) > B, THEN:
    ABORT LOOP 1;
    IF IS-ODD[CELL(0)] = 1, THEN:
    PRINT[CELL(0)];
    CELL(0) <= CELL(0) + 1;
  BLOCK 1: END;
BLOCK 0: END.

ODDS-IN-RANGE[20,25];

The only available operators in BlooP are assignment (<=), addition, multiplication, greater than, less than, and equals. Because of its painfully verbose syntax, it's actually pretty easy to tell what's going on even without a deep understanding of the language.

Task 4: The Interesting

Note: My snippet for this task is subject to change should I come up with something more interesting.

DEFINE PROCEDURE ''MINUS'' [M,N]:
BLOCK 0: BEGIN
  IF M < N, THEN:
  QUIT BLOCK 0;
  LOOP AT MOST M + 1 TIMES:
  BLOCK 1: BEGIN
    IF OUTPUT + N = M, THEN:
    ABORT LOOP 1;
    OUTPUT <= OUTPUT + 1;
  BLOCK 1: END;
BLOCK 0: END.

DEFINE PROCEDURE ''FIB''[N]:
BLOCK 0: BEGIN
  IF N < 1, THEN:
  QUIT BLOCK 0;
  OUTPUT <= 1;
  IF N < 3, THEN:
  QUIT BLOCK 0;
  OUTPUT <= FIB[MINUS[N,1]] + FIB[MINUS[N,2]];
BLOCK 0: END.

FIB[10];

Behold, the Fibonacci numbers.

*May not be true


Python 2, 28 bytes (input \$\leq2^{64}\$)

lambda n:len(`n**8L`)**.6//1

Try it online!

This works on inputs up to \$20! =2432902008176640000 \$ that fall within 64-bit integers.

This uses an approximate fit inspired by Stirling's approximation. However, the constants were estimated manually and it breaks down for larger values. With Python not having a built-in log, we use the digit-length for \$n^8\$ as an approximation for \$c\cdot\log(n)\$. Actually, we use the long value 8L so that the string representations uniformly end in L for "long", which adds one to the lengths.

From there, raising the value to the power of \$0.6\$ and taking the integer part is apparently sufficient to give the correct output up to \$20!\$. It's lucky that the 0.6 is 0.60, since we'd usually need another digit of precision.


Java 7, 121 bytes
int c(int n,int a,int m){return(int)(a<2?Math.pow(n,m):d(n,a));}double d(int n,int a){return Math.pow(n,a<2?n:d(n,a-1));}

Explanation:
int c(int n, int a, int m){         // Main method with the three integer-parameters as specified by OP's challenge
  return (int)                      // Math.pow returns a double, so we cast it to an integer
          (a < 2 ?                  // if (a == 1):
                   Math.pow(n, m)   //  Use n^m
                 :                  // else (a > 1):
                   d(n, a));        //  Use method d(n, a)
}

double d(int n, int a){             // Method d with two integer-parameters
  return Math.pow(n, a < 2          // n ^ X where
                      ? n           //  X = n    if (a == 1)
                      : d(n, a-1)); //  X = recursive call d(n, a-1)    if (a > 1)
}

// In pseudo-code:
c(n, a, m){
  if a == 1: return n^m
  if a > 1:  return d(n, a);
}
d(n, a){
  if a == 1: return n^n
  if a > 1:  return d(n, a-1);
}

Test code:
Try it here.
class M{
  static int c(int n,int a,int m){return(int)(a<2?Math.pow(n,m):d(n,a));}
  static double d(int n,int a){return Math.pow(n,a<2?n:d(n,a-1));}

  public static void main(String[] a){
    System.out.println(c(2, 1, 2));
    System.out.println(c(2, 1, 3));
    System.out.println(c(2, 2, 3));
    System.out.println(c(2, 3, 3));
  }
}

Output:
4
8
16
65536


Haskell, 34 bytes

([x|x<-[1..],mod(7^x-1)(x^2)<1]!!)

This uses 0-based indexing. Usage example: ([x|x<-[1..],mod(7^x-1)(x^2)<1]!!) 30 -> 1140.

It's a direct implementation of the definition. It builds a list of all numbers x and picks the nth.