Generate Brainfuck for the numbers 1–255

Perl 6, 224 + 3964 = 5834 4188 bytes

map {say (.[0]~'['~.[3]~'>'~.[1]~'<]')x?.[1],'>'x?.all,.[2]}o*.min({$_>>.abs.sum+6*?.[1]})>>.&{<- +>[.sign>0]x.abs},classify({0+|(grep(*%%1,(((256 X*^4)X+.[0]%256)X/-.[3]))[0]*.[1]+.[2])%256},[X] |(^27-13 xx 3),-7..-1){^256}

Try it online! (may timeout. Change the ^27-13 to ^25-12 to speed up slightly at the cost of some extra output)

Outputs the shortest code in the form *>[*>*<]>*, where each * is a certain number of +s or -s. There are some extra tweaks like removing the loop if it is not needed, as well as trailing >s.

As far as I can tell, the output is the most golfed for this particular format.

Explanation:

([X] |(^27-13 xx 3),-7..-1)        # Define the search space as the cross product of:
                                        # -13 to 13 for:
                                            # Initialisation     +++>
                                            # Change in target   [*>+++<]
                                            # Last change        >+++
                                        # And -7 to -1 for the change in start [-->*<]
  .classify({                  })  # Group them by calculating
                  (256 X*^4)                         # Each of the multiples of 256
                 (          X+.[0]%256)              # Plus the initialisation
                (                      X/-.[3])      # Divided by the change in start
      grep(*%%1,                               )     # Filter out the whole numbers
                                                [0]  # And take the first value
          # This is the amount of times the inner loop will execute
          # Being Nil, converted to 0 if it is an infinite loop
      *.[1]              # Multiply by the change to the target cell
           +.[2]         # And add the final section
     (          )%256    # And modulo the whole lot by 256
                     +|0 # And floor it just to keep the .0 out
classify(                   ){^256}     # Take the corresponding groups in order
   .map(                             )  # And map each to
        *.min({                    })   # Find the minimum by:
               $_>>.abs.sum             # The sum of the absolute values
                           +6*?.[1]     # Plus 6 if it loops
      >>.*{                   }    # Then map each value to
           <- +>[.sign>0]          # + or - depending on the sign
                         x.abs     # Repeated by the absolute value
   {                    }o              # And pass this to the next code block
    say                       # Print
        (.[0]~'['~.[3]~'>'~.[1]~'<]')             # The loop section
                                     x?.all       # If it is needed
                                           ,.[2]  # And the final part


JavaScript (V8), 129 bytes

f=(g,p=d=>(n=2,v=g.map((r,i)=>r.map((c,j)=>c*n&&(n>1?~(y=i+d,x=j+!d):i==y&j==x)?!n--:c)),n?n>1:f(v)))=>g in f?f[g]:f[g]=p(0)|p(1)

Try it online!
Receives the input as a 2-dimensional array of booleans and returns 0 for false or 1 for true.
Explanation
Solves the problem recursively calling itself with a single domino removed from the grid. If it is called with an empty grid (which will happen if the initial grid only contained valid domino positions) then it returns true. At each call it tries removing the top-left position containing a domino, calling itself with either the horizontal or vertical orientation removed.
f=(g,
// p = function to remove the top-left domino and recurse if the remove succeeded
p=d=>(
// n = squares remaining for removal
n=2,
// v = grid after removal
v=g.map((r,i)=>r.map((c,j)=>c*n&&(n>1?~(y=i+d,x=j+!d):i==y&j==x)?!n--:c)),
// if n=2 the grid was empty so we return true, if n=1 we could not remove the domino
// if n=0 the domino was successfully removed and we recurse
n?n>1:f(v))
// try removing the top-left square with a horizontal or vertical domino
// and cache results
)=>g in f?f[g]:f[g]=p(0)|p(1)


Perl 5 + ImageMagick - 297

Something to start with:

sub a{my($x,$y,$X,$Y,$d)=@_;$_=shift@ARGV;
/v/?a($d=$x+($X-$x)*$'/100,$y,$X,$Y).a($x,$y,$d,$Y):
/h/?a($x,$d=$y+($Y-$y)*$'/100,$X,$Y).a($x,$y,$X,$d):
/c/&&"-fill ".qw/white red blue yellow/[$'-1]." -draw 'rectangle $x,$y $X,$Y' "}
system"convert -size 256x256 -stroke black xc: ".a(0,0,255,255)."a.gif"

Takes input on command line and generates a.gif.


The pirate world's rules of distribution

Jelly, 11 10 bytes

R%2ḊµSȷ2_;

Try it online! or verify all test cases at once.

How it works

For input n, the task boils down to creating the list x, 0, 1, 0, … of length n whose sum is 100.

R%2ḊµSȷ2_;  Main link. Input: n

R           Yield [1, 2, ..., n].
 %2         Replace each integer by its parity. Yields [1, 0, 1, 0, ...].
   Ḋ        Dequeue; remove the first 1. This yields the list a = [0, 1, ...].
    µ       Begin a new, monadic link. Argument: a
     S      Compute the sum of a.
      ȷ2_   Subtract the sum from 100. (ȷ2 is 1e2 in Python syntax)
         ;  Prepend the difference to a.


Probabilistically fair prize splitting for two-player coin toss

R, 36 32 bytes

function(X,A,B)pbeta(.5,X-A,X-B)

Try it online!

The closed formula from this answer suggested a natural probability distribution to use -- this is a Negative Binomial with \$X - W_b - 1\$ failures and \$X - W_a\$ successes, i.e., the probability that there are \$X - W_a\$ "successes" before there are \$X - W_b\$ "failures".

Further identities reduce the CDF of the negative binomial to the CDF of a beta distribution or in terms of the (regularized) incomplete beta function.


Generate binary matrices which are distinct up to reflections

Jelly, 19 bytes

Ṛ€;U;
2ḶṗṗµWÇ³¡Ṃµ€Q

Try it online!

How it works

2ḶṗṗµWÇ³¡Ṃµ€Q  Main link. Argument: n (integer)

2Ḷ             Unlength 2; yield [0, 1].
  ṗ            Cartesian product; construct all vectors of {0, 1}^n.
   ṗ           Cartesian product; construct all vectors of ({0, 1}^n)^n.
               This yields A, the array of all binary n×n matrices.
    µ     µ€   Begin a new, monadic chain and apply it to all matrices M in A.
     W           Wrap; yield [M].
      Ç³¡        Call the helper link n times, initially with argument [M], then
                 on the previous return value.
         Ṃ       Take the minimum of the results.
               This replaces all matrices with the lexicographical minimum of their
               equivalence classes, mapping equivalent matrices to the same matrix.
            Q  Unique; deduplicate the resulting array of matrices.

Ṛ€;U;          Helper link. Argument: L (array of matrices)

Ṛ€             Reverse the order of the rows of each M in L.
   U           Reverse the order of the columns of each M in L.
  ;            Concatenate the resulting matrix arrays.
    ;          Concatenate the result with L.


Retina, 2 1 byte

P

Outputs

0

Explained

P actually has no special meaning in retina, but retina treats it like a regex against the input, and counts the matches. As there's no input, there's no matches, so it returns 0, which is the exact inverse of this.

Try it online!

This is using an older version of Retina, which outputs a newline with the zero. This is not the case in the latest version.


Haskell, 263 262 bytes

import Data.Ratio;f m=let{(#)n z|n>m=[[]]|True=[a:y|(a,j)<-[((o,x,y),[c|c<-(u&w,h-v,x,g):(w-u,h&v,a,y):z,c/=b])|b@(w,h,x,y)<-z,(o,u,v)<-[(o,1%(n+1-o),1%(n+o))|o<-[0,1]],(a,g)<-[(x+u,y+v)|u<=w,v<=h],let(&)p q|w>h=p|True=q],y<-(n+1)#j]}in(1#[(1%1,1%1,0%1,0%1)])!!0

This follows the algorithm described in Paulhus 1997, An Algorithm for Packing Squares, doi:10.1006/jcta.1997.2836. The key observation in the paper, which is empirically if not theoretically verified, is that the region left over after placing a rectangle in a box can be split into two sub-boxes whose filling can then in turn be regarded as independent.

Rather than finding the smallest width sub-box to fit the next rectangle into, the code performs a search across all possible sub-boxes; in practice this does not make an appreciable slow down for n<100.

Output is in the form of a list of entries as tuples with the fraction marker % still included. The integers in the formatted output are in the desired order, but strictly speaking some post-processing would be required to produce the list of integers alone.

Sample run:

*Main> f 5
(0,0 % 1,0 % 1),(0,1 % 2,0 % 1),(0,1 % 2,1 % 2),(0,3 % 4,1 % 2),(1,1 % 2,5 % 6)

Edit: removed an errant space after a let.


Higher-level function shorthand
This seems like a pretty interesting golfing point. E.g.

list(1,2,3)map(i,i+1)print

However, Io is pretty permissive on not specifying the counter; the map body can be used as a point-free function, as Io tries to fill in the operand of this expression. This can be golfed into

list(1,2,3)map(+1)print

Due to the helpful work of the language creator, you can even do this to reduces!
list(1,2,3)reduce(a,b,a*b)

Can easily be reduced into:
list(1,2,3)reduce(*)

(Unfortunately, I still haven't managed to understand how exactly this works, so I never managed to make the expression more complex.)


Python 2, 333 bytes

lambda g,l=len:min(i for i in r(l(g)*l(g[0])+1)if g in o(l(g[0]),l(g),[[0]*l(g[0])for _ in" "*l(g)],set(sum(g,[])),i))
o=lambda w,h,g,s,I:I and sum([o(w,h,n,s,I-1)for n in[[[x<=j<=X<[]>Y>=i>=y and S or E for j,E in e(R)]for i,R in e(g)]for x in r(w)for X in r(x,w)for y in r(h)for Y in r(y,h)for S in s]],[])or[g]
r=range
e=enumerate

Try it online!

This only works in theory, because in practice, it takes way too long if you have more than about 5 elements in the grid.

Since this is code-golf, I apologize for the inefficiency, but efficiency would require more thought and FAR more bytes.

This code does the same thing at the cost of 5 bytes, but short-circuits, meaning that a larger grid with a small answer may finish somewhat earlier... the difference in viable search space is negligible, but just in case you wanted to test it a bit more.

The reason this is so slow is because it looks from \$0\$ up to \$W\times H\$, generating every possible \$W\times H\$ grid that can be achieved with the elements of the grid with that many steps being used.


JavaScript (ES6), 25 bytes

n=>"334130110314"[n%12]-2

0-indexed. You can shorten the string with a slightly recursive version, though it adds 6 bytes:

f=n=>"3341301"[n]-2||f(13-n%12)

This is still shorter than the definitive recursive formula:

f=n=>n<2||f(n-2)+f(n-1)*(-n%2|1)


Mathematica, 151 148 bytes

StringReplace[j=" ";k=Except@j;j<>j<>#<>j,j~~a:k...~~s:j..~~w:k..~~"(s)"~~j:>{j,a,s,w,If[FreeQ[a,"a"|"an"|"1"|"one"],"s",""]}<>j]~StringTake~{3,-2}&

Explanation

j=" ";k=Except@j

Set j to a whitespace character(s). Set k to the pattern "not j" (= non-whitespace character).

j<>j<>#<>j

Prepend two whitespace(s) and append one whitespace(s) to the input.

j~~a:k...~~s:j..~~w:k..~~"(s)"~~j

For a substring(s) matching the pattern:

One whitespace(s), followed by
a length-zero or longer substring consisting of only non-whitespace character(s) (quantifier) (call this a), followed by
a length-one or longer substring consisting of only whitespace character(s) (call this s), followed by
a length-one or longer substring consisting of only non-whitespace character(s) (word) (call this w), followed by
the string "(s)", followed by
a whitespace(s)

If[FreeQ[a,"a"|"an"|"1"|"one"],"s",""]

If a is not one of the singular word(s), evaluate to "s", otherwise "".

StringReplace[..., ... :>{j,a,s,w,If[FreeQ[a,"a"|"an"|"1"|"one"],"s",""]}<>j]

Replace the matching pattern with j, a, s, w, If[FreeQ[a,"a"|"an"|"1"|"one"],"s",""], and j joined together.

... ~StringTake~{3,-2}

Take from position 3 to position -2 (1-indexed; negative indices count from the end). This is because we added three space(s) in the beginning.


Writing rational numbers as ratio of factorials of primes

Mathematica, 175 177 169 154 108 bytes

Join@@@Table[x[[1]],{s,{1,-1}},{x,r@#},x[[2]]s]&@*(If[#==1,1,{p,e}=Last@(r=FactorInteger)@#;p^e#0[p!^-e#]]&)

Try it online!

How it works

This is the composition of two functions. The first, which ungolfs to

If[# == 1,
  1,
  {p,e} = Last[FactorInteger[#]];
  p^e * #0[p!^-e * #]
]&

is a recursive function for actually computing the desired factorization. Specifically, given a rational input x, we compute the primes whose factorials should be in the numerator and denominator, and return the fraction with all of those primes multiplied together. (For example, on input 10/9 = 2!*5!/(3!*3!*3!), we return 10/27 = 2*5/(3*3*3).)

We do this by dealing with the largest prime factor at every step: if pe occurs in the factorization of x, we make sure p!e occurs in the factorial-factorization, and recurse on x divided by p!e.

(Earlier, I had a more clever strategy that avoids large numbers by looking at the previous prime number before p, but Mathematica can handle numbers as big as 65521! easily, so there's no point. The old version you can find in the history is much faster: on my computer, it took 0.05 seconds on inputs that this version handles in 1.6 seconds.)

The second function turns the output of the first function into lists of primes.

Join @@@
  Table[x[[1]],
    {s,{1,-1}},
    {x,FactorInteger[#]},
    x[[2]]*s
  ]&

For s=1 (positive powers) and s=-1 (negative powers), and for each term {prime,exponent} in the factorization r@#, we repeat the prime number prime exponent*s many times.

Noncompeting version with 109 62 bytes

If[#==1,∇1=1,{p,e}=Last@FactorInteger@#;(∇p)^e#0[p!^-e#]]&

Same as above, but instead of giving output as a list, gives output as an expression, using the ∇ operator (because it has no built-in meaning) as a stand-in for factorials. Thus, an input of 10/9 gives an output of (∇2*∇5)/(∇3)^3 to represent (2!*5!)/(3!)^3.

This is shorter because we skip the second part of the function.

+2 bytes: the assignment f=First has to be done in the right place to keep Mathematica from getting upset.

-8 bytes: fixed a bug for integer outputs, which actually made the code shorter.

-15 bytes: FactorInteger returns sorted output, which we can take advantage of.

-46 bytes: we don't actually need to be clever.


C++11, 451 * 80% * 75% * 50% = 135.3 bytes
Saved 9 bytes thanks to @kirbyfan64sos.
Saved 19 bytes thanks to @JosephMalle and @cat.
Saved 11 bytes thanks to @pinkfloydx33.
#include<vector>
#include<cmath>
#include<algorithm>
#include<string>
#define T string
#define P append
using namespace std;T f(vector<int>v){sort(v.begin(),v.end());T r=to_T(v[0]);int b=1;int m=v[0];for(int i=1;i<=v.size();i++){if(i!=v.size()&&v[i]==v[i-1]+1){if(!b){m=v[i-1];}b=1;}else{if(b){T s=to_T(v[i-1]);r.P("-").P(s.substr(s.size()-(v[i-1]-m==1?1:log10(v[i-1]-m)),s.size()));}if(i!=v.size()){r.P(", ").P(to_T(v[i]));}b=0;}}return r;}

This qualifies for all the bonuses.
Sample parameter test and result:
In:  [1, 2, 3, 4, 5]
Out: 1-5

In:  [3, 4, 5, 9, 10, 11, 12]
Out: 3-5, 9-12

In:  [149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160]
Out: 149-60

In:  [1, 2, 3, 4]
Out: 1-4

In:  [109, 110, 111, 112, 113]
Out: 109-3

In:  [19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]
Out: 19-9


Retina, 14 bytes

O%$`\d|(.)
$#1

Try it online!

Explanation

O introduces a sorting stage. % tells Retina to apply the transformation to each line separately. $ tells it to sort the matches by the result of the specified substitution.

The regex itself is \d|(.) which either matches a digit, or anything else which is captured into group 1. This is substituted with $#1 which is the number of captures of group 1. That is, the sorting key for digits is 0 and the sorting key for everything else is 1. Since sorting in Retina is stable, this simply moves digits to the left and everything else to the right.


JavaScript (ES6), 57 bytes
A significantly shorter version suggested by @tsh, who managed to get rid of the edge case \$n<9\$.
Returns an array of 4 integers in reverse order (quarters to pennies).

n=>[z=(n-=x=(n-4)%5+4)/25-.7|0,(n=n/5-5*z-1)/2|0,n%2+1,x]

Try it online!

Original version, 73 bytes
Returns an array of 4 integers.

n=>n<9?[n,0,0,0]:[x=4-~n%5,y=(z=n/25-.96|0)+(n-=x)/5&1||2,n/5-y-z*5>>1,z]

Try it online!


Solving Systems of Equations using Cramer's Rule

Mathematica 40

Setting up the problem in your reference link:

s = {{2, 1, 1}, {1, -1, -1}, {1, 1, 1}};
r = {3, 0, 0};

The algorithm (spaces not needed):

i = 1; (a = s; a[[All, i++]] = r; Det@a/Det@s) & /@ r

result:

{1, -2, 3}

If the system has infinite solutions it returns Indeterminate or ComplexInfinite

Please note that Mathematica can solve linear systems natively. Among other possible ways you could use:

s~LinearSolve~r

or

Solve[s.{x,y,z}==r]


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

I↔I

Try it online!

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

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

Explanation

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

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


The first n numbers without consecutive equal binary digits

Python 2, 36 bytes

lambda n:[2**i*2/3for i in range(n)]

Try it online! Explanation: The binary representation of \$\frac{2}3\$ is 0.101010101... so it simply remains to multiply it by an appropriate power of 2 and take the integer portion.


Python 2, 54 52 bytes

-2 bytes thanks to xnor

k='unknowns'
for i in 8,6,2,0:print k[i/3:7],k[i%3:]

Try it online!

The results from the / and % will be [[2, 2], [2, 0], [0, 2], [0, 0]] that will be the starting indexes, removing the un when 2, keeping the string unaltered when 0


Shortest code to post a string to WebServer

Bash: 90 characters

No external tools, just pure bash.

echo 'POST /target HTTP/1.0
Content-length:14

String to post'>/dev/tcp/www.example.com/80


Haskell, 87 bytes

(a#b)c|s<-show$div(a*10^c)b,l<-length s-c,(h,t)<-splitAt l s=['0'|l<1]++h++['.'|c>0]++t

Usage example: (13#7)27 -> "1.857142857142857142857142857".

23 bytes to handle the c==0 case and using a leading zero instead of things like .5.

How it works: multiply a with 10^c, divide by b, turn into a string, split where the . must be inserted, join both parts with a . in-between and fix the edge cases.


Pyth, 15 12 bytes

ms+0_%Q>_zdQ

Test suite

My transformation is similar to one of xnor's, but in base 10. It works by unzipping the input into k separate numbers:

n = 21003034
k = 3

21003034
 1  3  4    134
2  0  3     203
  0  0        0

The numbers are ordered in decreasing position of the rightmost digit, so that all orderings of any group of numbers are possible.

The way the code works is we reverse the input, then slice off the last 0, 1, ... k-1 digits, then take every kth digit, reverse again, stick a 0 at the begining, and convert to int.


J, 20 bytes

1-~&#(#~2=/\_&,)^:a:

Try it online!

Using the 0 0 0 1 1 0 3 3 3 2 2 example:

(......_&,) Prepend infinity _:

_ 0 0 0 1 1 0 3 3 3 2 2

(..2=/....) Are consecutive pairs equal? Returns 0-1 list of same length as input:

_ 0 0 0 1 1 0 3 3 3 2 2  <-- Before
 0 1 1 0 1 0 0 1 1 0 1   <-- After

(#~.......) Apply the above mask as a filter to the input.  This drops the first member of every group:

0 0 1 3 3 2

^:a: Repeat until we reach a fixed point, returning all intermediate results (0-padded on the right):

0 0 0 1 1 0 3 3 3 2 2
0 0 1 3 3 2 0 0 0 0 0
0 3 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0

1-~&# Subtract 1 from 1-~ the above result, after applying the "length of" verb to both lists &#.  Since the length of 1 is 1, it remains unchanged, while the result above becomes 4:

4 - 1
3


SOGL V0.12, 24 bytes
ā.∫ā;∫ \*+}ø┼↔±╬¡;øΚ┼}╬³

Try it Here!
Explanation:
ā                         push an empty array (the main canvas)
 .∫                  }    iterate over the input, pushing 1-indexed iteration
   ā;                       push an empty array below the iteration
     ∫    }                 iterate over the iteration counter
       \*                     push current iteration amount of slashes
         +                    append those to the 2nd array
           ø┼               append nothing (so it'd space the array to a square)
             ↔±             reverse horizontally (swapping slashes)
               ╬¡           quad-palindromize with 0 overlap and swapping characters as required
                 ;          get the canvas ontop
                  øΚ        prepend to it an empty line (so the now bigger romb would be one up)
                    ┼       append horizontally the canvas to the current romb
                      ╬³  palindromize horizontally with no overlap and swapping characters


Python, 11 26 tokens:

def f(n, t, i, l):
    n()
    while t():
        l()
        i()

This is my first time doing atomic-code-golf, so forgive me if I got the token counting wrong.

EDIT: Hugh Allen informed me that I got the token counting wrong.


Python, score=215 166 (167 118 chars, at most 48 ops)

def A(x,y,z,p,q,r):
 u,c=x^p,x&p;v,d=y^q^c,y&q|y&c|q&c;w,e=z^r^d,z&r|z&d|r&d
 if e:u,v,w=A(e,e,0,u,v,w)
 return u,v,w

Does addition in bit-parallel.  The c,d,e are the 32 carries from one position to the next.  e represents multiples of 8 that carry out of the vector, so if e has any bits set in it, we add 8%5=3 back in using a recursive call.

The translation table is the same as the one given in the question.


Ruby, 46

?A.upto(?M*9){|s|s[/(.)\1{3}|[N-Z]/]||puts(s)}

My original, similar solution was longer and wrong (it output base13 numbers, which isn't quite all of them due to leading zeroes), but I'll leave it here because it got votes anyway.

1.upto(13**9){|i|(s=i.to_s 13)[/(.)\1{3}/]||puts(s)}


Python 3.5, 331 309 308 306 304 bytes

It took quite a bit of messing with the spacing of the polygons (and the specification, too, to be honest) to get this answer to work, but I finally did it and hopefully other answers can start coming in.

Edit: -2 bytes thanks to FlipTack. -8 bytes from removing a section of code that I forgot to remove earlier. -12 bytes from golfing the last function. -1 byte from changing the circumference of the drawings from size=2500 to size=2e3, which also allows the drawings to better fit on screens (diameter ~= 795.77 down to diameter ~= 636.62). -2 bytes from fixing a bug. -2 bytes from restructuring how I build a.

Golfing suggestions welcome. Trinket for testing and images to follow shortly.

from math import*
from turtle import*
ht();pu()
def g(n):
 i=1;a=[]
 while n%4<1:a+=4,;n//=4
 while n>1:
  i+=1
  while n%i<1:a+=i,;n//=i
 return f(a,2e3)
def f(a,s,x=0,y=0,t=0):
 if a:
  *c,b=a;s/=b
  for i in range(b):u=2*pi*i/b+t*(b<3)+pi/4*(b==4);f(c,s,x+s*sin(u),y+s*cos(u),u)
 else:goto(x,y);dot(4)

Here's g(448), which now fits on my 1366x768 screen.

Ungolfing

import math
import turtle

turtle.hideturtle()     # don't display the turtle itself)
turtle.penup()          # don't draw lines, just dots later on

def g(n):
    i = 1
    a = []
    while n % 4 == 0:   # get 4's into the list first,
        a = a + [4]     # so that the fractal will be easier to structure
        n = n // 4
    while n > 1:        # now get all of the other factors (including any stray 2's)
        i += 1
        while n % i == 0:
            a = a + [i]
            n = n // i
    return f(a, 2000)   # 2000 is the circumference of the circle
                        # on which we draw the polygons
def f(a, s, x=0, y=0, t=0):
    if a:
        c = a[-1]       # the size of the current outermost polygon
        b = a[:-1]      # the rest of the factors for recursion
        s = s/b         # the current circumference / the number of polygons at this layer
        for i in range(b):
            u = 2*math.pi*i/b   # angle around the circle
            if b == 2:          # if b == 2, add the previous angle to rotate the structure
                u += t
            if b == 4:          # if b == 4, add 45 degrees to keep the squares upright
                u += math.pi/4
            dx = s * math.sin(u)    # our coordinate changes for this polygon
            dy = s * math.cos(u)
            f(c, s, x+dx, y+dy, u)  # call the function again
                                    # on a new circle with new starting coordinates
    else:                   # when we run out of factors,
        turtle.goto(x,y)    # go to each coordinate
        turtle.dot(4)       # and draw a dot


Python 2 - 269 275 290 318 337
Input is mostly safe if you use triple-quotes:"""print("Hello, World!"); sys.exit()"""
C=D=0
r=''
l,u,c=" `1234567890-=qwertyuiop[]asdfghjkl;'#\\zxcvbnm,./",' \xac!"\xa3$%^&*()_+QWERTYUIOP{}ASDFGHJKL:@~|ZXCVBNM<>?'," `1234567890-=QWERTYUIOP[]ASDFGHJKL;'#\\ZXCVBNM,./"
for h in input():w=h!=' ';U=h in u;C^=w&U&~D;D=U&w;r+=[l,c][C][[l,u][U].find(h)]
print r

Encoding doesn't seem to help much, except with the awkward ¬ and £ characters (I've tried looking at other problems like this and I think I should try to use split?)(It doesn't seem like the keyboard compresses enough to make it worth .decode, etc...)
Also, spaces suck.
Edit note: Indexing is weird


Write a sorting program that looks erroneous but it is actually correct

C++

Inspired by Apple's goto fail; bug.

#include <vector>
#include <map>
#include <iostream>

/**
 * Sorts a vector of doubles in reverse order using the bucket sort algorithm.
 */
std::vector<double> reverse_bucket_sort(const std::vector<double>& input) {
    // put each element into a bucket as many times as it appears
    std::map<double, int> bucket_counts;
    for (auto it : input)
        ++bucket_counts[it];

    std::vector<double> sorted_elements; // the return value

    // loop until we are done
    while (bucket_counts.size() > 0) {
        // find the largest element
        double maximum = std::numeric_limits<double>::lowest();
        for (auto it : bucket_counts) {
            if (it.first > maximum)
                maximum = it.first;
                maximum = it.first;
        }

        // add the largest element N times to our sorted vector
        for (int i = 0; i < bucket_counts[maximum]; ++i)
            sorted_elements.push_back(maximum);

        // and now erase the bucket
        bucket_counts.erase(maximum);
    }

    return sorted_elements;
}

int main(int argc, const char * argv[]) {
    std::vector<double> test_case = { 0, 1, 2.5, 10, 2.5, 2 };

    std::cout << "unsorted:";
    for (auto it : test_case) std::cout << " " << it;
    std::cout << std::endl;

    std::cout << "sorted:";
    for (auto it : reverse_bucket_sort(test_case)) std::cout << " " << it;
    std::cout << std::endl;

    return 0;
}

   About halfway down the page there is a bug: we have a duplicate line
 after our if check! We are always going to update the maximum with whatever
 is the last value in bucket_count.

 Thankfully we are OK. In C++ std::map is sorted by keys. So we are
 just reversing the buckets, which is what we want.


Canvas, 1 byte

＠

Try it here!

It takes height, width, Y, X, and ASCII art as inputs, in that order.

Though almost everything about the ASCII art objects in Canvas is 0-indexed, ＠ is 1-indexed by some reason. ¯\_(ツ)_/¯


C#

  Your task is to write a program for SAT that appears to execute in polynomial time.

"Appears" is unnecessary. I can write a program that really does execute in polynomial time to solve SAT problems. This is quite straightforward in fact.

  MEGA BONUS: If you write a SAT-solver that actually executes in polynomial time, you get a million dollars! But please use a spoiler tag anyway, so others can wonder about it.

Awesome. Please send me the million bucks. Seriously, I have a program right here that will solve SAT with polynomial runtime.

Let me start by stating that I'm going to solve a variation on the SAT problem. I'm going to demonstrate how to write a program that exhibits the unique solution of any 3-SAT problem.  The valuation of each Boolean variable has to be unique for my solver to work.

We begin by declaring a few simple helper methods and types:

class MainClass
{
    class T { }
    class F { }
    delegate void DT(T t);
    delegate void DF(F f);
    static void M(string name, DT dt)
    {
        System.Console.WriteLine(name + ": true");
        dt(new T());
    }
    static void M(string name, DF df)
    {
        System.Console.WriteLine(name + ": false");
        df(new F());
    }
    static T Or(T a1, T a2, T a3) { return new T(); }
    static T Or(T a1, T a2, F a3) { return new T(); }
    static T Or(T a1, F a2, T a3) { return new T(); }
    static T Or(T a1, F a2, F a3) { return new T(); }
    static T Or(F a1, T a2, T a3) { return new T(); }
    static T Or(F a1, T a2, F a3) { return new T(); }
    static T Or(F a1, F a2, T a3) { return new T(); }
    static F Or(F a1, F a2, F a3) { return new F(); }
    static T And(T a1, T a2) { return new T(); }
    static F And(T a1, F a2) { return new F(); }
    static F And(F a1, T a2) { return new F(); }
    static F And(F a1, F a2) { return new F(); }
    static F Not(T a) { return new F(); }
    static T Not(F a) { return new T(); }
    static void MustBeT(T t) { }

Now let's pick a 3-SAT problem to solve. Let's say

(!x3) &
(!x1) &
(x1 | x2 | x1) &
(x2 | x3 | x2)

Let's parenthesize that a bit more.

(!x3) & (
    (!x1) & (
        (x1 | x2 | x1) &
        (x2 | x3 | x2)))

We encode that like this:

static void Main()
{
    M("x1", x1 => M("x2", x2 => M("x3", x3 => MustBeT(
      And(
        Not(x3),
        And(
          Not(x1),
          And(
            Or(x1, x2, x1),
            Or(x2, x3, x2))))))));
}

And sure enough when we run the program, we get a solution to 3-SAT in polynomial time. In fact the runtime is linear in the size of the problem!

x1: false
x2: true
x3: false

   You said polynomial runtime. You said nothing about polynomial compile time. This program forces the C# compiler to try all possible type combinations for x1, x2 and x3, and choose the unique one that exhibits no type errors. The compiler does all the work, so the runtime doesn't have to.  I first exhibited this interesting techinque on my blog in 2007: http://blogs.msdn.com/b/ericlippert/archive/2007/03/28/lambda-expressions-vs-anonymous-methods-part-five.aspx Note that of course this example shows that overload resolution in C# is at least NP-HARD. Whether it is NP-HARD or actually undecidable depends on certain subtle details in how type convertibility works in the presence of generic contravariance, but that's a subject for another day.


Python 3, 114 110 bytes

lambda m,n:p(*n)-p(*m)
R=b"T 2J45UNK9RL<3SLM;QAK:O>=/678"
v=R.find
p=lambda i,s,j,t:R[s==t::2][v(j)*v(i)%10+3]

Try it online!
@Arnauld proposed the idea of merging the card value and rank table strings. After some attempts I managed to craft a merged string R="T 2J45UNK9RL<3SLM;QAK:O>=/678", which has the same length as the original card value string. The substring R[6:25]="UNK9RL<3SLM;QAK:O>=/" serves as the rank table as well as a card value lookup table for 3, 9, A, K, and Q. The ASCII-value decoding of the new rank table has the same ranking effect as the previous rank table.
Using byte strings as input saves 4 bytes.
Using cmp in Python 2 can reduce the solution to 102 bytes, as shown by @xnor's solution.

Python 3, 165 142 130 129 bytes

lambda m,n:p(*n)-p(*m)
v="T 23456789   J    QA        K".find
p=lambda i,s,j,t:ord("HC92FA51GAB4E893D760"[s==t::2][v(j)*v(i)%10])

Try it online!
-23 bytes thanks to @Jonathan Allan
-2 bytes thanks to @ovs
-1 byte thanks to @mypetlion
Ungolfed:
f = lambda hand1, hand2: get_rank(*hand2) - get_rank(*hand1)
def get_rank(v1, suit1, v2, suit2):
    get_card_value = "T 23456789   J    QA        K".find
    # rank_table = [[17,9,15,5,16,11,14,9,13,6],[12,2,10,1,10,4,8,3,7,0]]
    # rank_table = ("H9F5GBE9D6","C2A1A48370") # Base-18 encoding of ranks
    rank_table = "HC92FA51GAB4E893D760" # Interleaved base-18 encoding

    # ASCII-value decoding has the same ranking effect as base-18 decoding
    return ord(rank_table[suit1 == suit2::2][get_card_value(v2) * get_card_value(v1) % 10])

The function f takes two arguments representing the hand of player 1 and player 2. It returns a positive, negative, or zero value in the case of a player 1 win, a player 2 win, or a draw, correspondingly. Each hand is encoded as a single string, e.g. "7cQh".


C fizzbuzz

This solution runs around the idea of interrupts and label variables (gcc only, sorry). The program sets up a timer which periodically calls main, where we goto whichever place the last execution of our interrupt handler (main) told us we should.

I've never used timers or label variables before, so I think there is much to bowl here.

#include <sys/time.h>
#include <signal.h>
#include <stdio.h>

int main(int argc)
{
    static int run = 1;
    static int* gotoloc = &&init;
    static int num = 0;
    static int limit = 50;

    goto *gotoloc;
init:
    signal(SIGVTALRM, (void (*)(int)) main);
    gotoloc = &&loop;

    struct itimerval it_val;

    it_val.it_value.tv_sec = 0;
    it_val.it_value.tv_usec = 100000;
    it_val.it_interval.tv_sec = 0;
    it_val.it_interval.tv_usec = 100000;
    setitimer(ITIMER_VIRTUAL, &it_val, NULL);

    while(run);

loop:
    num = num + 1;
    run = num < limit;
    gotoloc = &&notfizz + (&&fizz - &&notfizz) * !(num % 3);
    return 1;

fizz:
    printf("fizz");
    gotoloc = &&notbuzz + (&&buzz - &&notbuzz) * !(num % 5);
    return 1;

notfizz:
    gotoloc = &&notfizzbuzz + (&&buzz - &&notfizzbuzz) * !(num % 5);
    return 1;

buzz:
    printf("buzz\n");
    gotoloc = &&loop;
    return 1;

notbuzz:
    printf("\n");
    gotoloc = &&loop;
    return 1;

notfizzbuzz:
    printf("%d\n", num);
    gotoloc = &&loop;
    return 1;
}


><>, 25 words + (22 + 11 + 11) extra = 57 49

Oh god, my brain.

'brr3deep*clap6beep+orb5flap*leap4deep+clap5beep5flap*leap9deep9clap*beep+flap0placed apple alp0leap=clip?lob8blip*flip0clip.

Since the rules state "There is no input.", for this program to work you'll need to pipe in an empty file.

Oh and yes, brr is a valid Scrabble word, as are tsktsk and pfft.

Explanation

First of all, the following words are no-ops:

deep clap beep flap leap clip blip flip

This is because of two reasons:

abcdefl push numbers (10, 11, 12, 13, 14, 15 and the length of the stack respectively). In addition, i pushes -1 if EOF is met, seeing as there is no input.
The p command pops three chars v,y,x and places v at the position x,y.

Yes, ><> lets you modify the source code on the fly! We don't really make use of that though, as we only need the p for popping.

If we get rid of these no-ops, we get:

'brr3*6+orb5*4+55*99*+0placed apple alp0=?lob8*0.

In a similar way, the laced app part of placed apple and the e alp part of apple alp are also no-ops, and the rr of brr just reverses the stack twice, which we can also remove:

'b3*6+orb5*4+55*99*+0pl0=?lob8*0.

Finally, something that looks like a regular ><> program! The idea is to make use of the standard ><> quine, which works like so:

The initial ' starts string parsing, pushing every char met until we hit another '
We keep pushing chars until the end of the line, at which point we wrap the instruction pointer back to the start (since ><> is toroidal)
We land on the initial ' again, and stop string parsing. The result is that we've pushed every single char in the program (except the initial ') onto the stack.

Then the following happens:

b3*6+o                Print the initial ' quote (ASCII 39)
r                     Reverse the stack
b5*4+                 Push a ';' (ASCII 59)
55*99*+0p             Replace the 'l' of 'lob' with ';'

(print loop)
l0=?;                 If the stack is empty, terminate. Otherwise...
o                     Print the top of the stack
b8*0.                 Jump back to the beginning of the loop


Write a short story using only valid code

css (114)
I'm new to the golf scene. Not sure if CSS counts as 'code'. But here's a stab at it.
The year is still young...
body {width: 110%}
.pants {overflow: visible}
.newYear {transform: scale(.8)}

If I understand the scoring:

every individual built-in keyword = 4 * 15

every letter/number = 1 * 54

every unrelated line = 0
= initial score: 114


Jelly, 5 bytes

ÆRÆNċ

Try it online!

How it works

ÆRÆNċ  Main link. Argument: n

ÆR     Prime range; yield the array of all primes up to n.
  ÆN   N-th prime; for each p in the result, yield the p-th prime.
    ċ  Count the occurrences of n.


Perl, 36 bytes

#!perl -p
s!(.+)\1+!@{[$&=~/\Q$1/g]}."[$1]"!eg

Try it online!

PHP 5.6, 68 bytes

Same code in PHP. Requires the command line option -F, and relies on deprecated /e modifier.

<?=preg_filter('/(.+)\1+/e','substr_count("\0","\1")."[\1]"',$argn);


Python 3, 85 bytes

f=lambda a:sum(f(a[:i]+[a[i]-1]+a[i+1:])for i in range(len(a))if a[i])if sum(a)else 1

Try it online!


JavaScript (ES6), 76 68 bytes
x=>x<1e4?x.toLocaleString():(x<1e5?(x/1e2+.5|0)/10:(x/1e3+.5|0))+"k"

Another first attempt. Thank goodness for that handy .toLocaleString(), the shortest alternative I could find is 21 bytes longer...
This separates thousands by either , or ., depending on what country you live in. For five two bytes more, you can make it always use a comma:
x=>x<1e4?x.toLocaleString`en`:(x<1e5?(x/1e2+.5|0)/10:(x/1e3+.5|0))+"k"


Python 2, 157 154 108 103 bytes

a,b,c=input()
t=c
while t%a:t+=b
print"".join("aA"[i%a*2:]+"bB"[i%b*2:]+"s"[i^t-c:]for i in range(t+1))

Try it online! or Check all test cases!
Input: from STDIN, 3 positive integers a,b,c representing the 2 hourglass times and the time needed for the egg to boil.
Output: print to STDOUT a string of commands following the specification.
Big idea
There exists positive integers \$x,y\$ such that:
$$ax-by=c$$
(Proof in the last section)
Thus, if we continuously flip both hourglasses, the time between when the second hourglass finishes \$y\$ flips and when the first hourglass finishes \$x\$ flips is exactly equal to the time needed to boil the egg.
Code overview
t keeps track of \$by+c\$. We increment \$y\$ until \$\frac{by+c}{a}\$ is an integer.
When a valid value of t is found, t will be the time needed to flip the first hourglass \$x\$ times, and also the time when the egg should be done. t-c is the time when the second hourglass finishes \$y\$ flips, and also the time when the egg should start to be boiled.
The command string is created by increasing the time i, and insert "aA" or "bB" every time \$a\$ or \$b\$ divides the current time. "s" is inserted when the time is t-c.
Proof of the existence of \$x\$ and \$y\$.
Since \$c\$ is a multiple of \$gcd(a,b)\$, Bézout's identity claims that there exists integers \$k_1, k_2\$ (which can be negative) such that:
$$k_1a-k_2b=c$$
Since \$ba - ab = 0\$, we can increase \$k_1\$ and \$k_2\$ by \$b\$ and \$a\$ without changing the result:
$$(k_1+b)a-(k_2+a)b=c$$
Thus, we can keep increasing \$k_1\$ and \$k_2\$ until they are both positive.


Haskell, 119 bytes

t#'<'=last t:init t
(h:t)#c|c<'#'=1-h:t|c>'='=t++[h]|1<2=read[c]:t
f p=[n|n<-[1..length p],sum(foldl(#)(0<$[1..n])p)>0]

Try it online!

Function # is the interpreter for a single command c. The whole program p is run by folding # with the starting tape into p. f executes p for every tape and keeps those where the sum of the cells is at least 1.


Solve the equation `a*x == b` with Int32 arithmetics

Python 3, 39 bytes

lambda a,b,h=2**31:(a**~-h*b+h)%(2*h)-h

This is a theoretical solution that will take a long time unless a = 1. It uses the Euler-Fermat theorem to determine the modular inverse of a.

Alternate version, 47 bytes

lambda a,b,h=2**31:(pow(a,h-1,2*h)*b+h)%(2*h)-h

This does exactly the same, but in a more efficient manner.

Try it online!


Avoid import StdEnv when possible

To access built-in functions, even seemingly basic ones like (==) or map, an import statement is needed, usually import StdEnv because it imports the most common modules like StdInt, StdBool and so on (see here for more info on StdEnv).

However it can be possible to avoid this import for some challenges and just use the core language features like list comprehensions and pattern matching.

For example, instead of

import StdEnv
map f list

one can write

[f x\\x<-list]

List of alternatives:

Some functions or function invocations that need import StdEnv, an alternative that does not need the import and a rough estimate of bytes saved.

hd -> (\[h:_]=h), ~6 bytes
tl -> (\[_:t]=t), ~6 bytes
map f list -> [f x\\x<-list], ~10 bytes
filter p list -> [x\\x<-list|p x], ~11 bytes
(&&) -> %a b|a=b=a;%, ~6 bytes
(||) -> %a b|a=a=b;%, ~6 bytes
not -> %a|a=False=True;%, ~1 byte
and -> %[a:r]|a= %r=a;%_=True, ~0 bytes
or -> %[a:r]|a=a= %r;%_=False, ~0 bytes

The last few are unlikely to actually save bytes, because a direct replacement yields more bytes than the import, but it might be possible in cases where the recursion over the list is needed anyway.

This tip has successfully been used here.


Java 7, 81 80 bytes

void a(char[]a){for(int i=0;++i<a.length;)if(a[i]>47&a[i]<58)a[i]=a[i-a[i]+47];}

Try it online!

Saved 1 byte thanks to Anders Tornblad. The first character cannot be a digit so it doesn't need to be checked meaning we can preincrement before checking our terminate condition.


MATL, 13 12 bytes
|stE:-GyZQ~)

Try it online!
This uses the fact that, for integer coefficients, the absolute value of any root is strictly less than the sum of absolute values of the coefficients.
Explanation
Consider input [1 5 6] as an example.
|    % Implicit input. Absolute value
     % STACK: [1 5 6]
s    % Sum
     % STACK: 12
t    % Duplicate
     % STACK: 12, 12
E    % Multiply by 2
     % STACK: 12, 24
:    % Range
     % STACK: 12, [1 2 ... 23 24]
-    % Subtract, elemet-wise
     % STACK: [11 10 ... -11 -12]
G    % Push input again
     % STACK: [11 10 ... -11 -12], [1 5 6]
y    % Duplicate from below
     % STACK: [11 10 ... -11 -12], [1 5 6], [11 10 ... -11 -12]
ZQ   % Polyval: values of polynomial at specified inputs
     % STACK: [11 10 ... -11 -12], [182 156 ... 72 90]
~    % Logical negation: turns nonzero into zero
     % STACK: [11 10 ... -11 -12], [0 0 ... 0] (contains 1 for roots)
)    % Index: uses second input as a mask for the first. Implicit display
     % STACK: [-3 -2]


JavaScript (ES6), 34 bytes
Takes input as (A)(B), where A+B is a positive-looking 32-bit integer, i.e. less than 0x80000000.
Returns an array.

A=>g=B=>B?[A^=B,...g((B&~A)*2)]:[]

Try it online!
Or for 35 bytes, a BigInt version with unlimited input:

A=>g=B=>B?[A^=B,...g((B&~A)*2n)]:[]

Try it online!
How?
In order to use only 2 variables and pass a single variable to the recursive function, we apply the XOR right away to A and prepend the result to the output array.
Instead of computing (A AND B) * 2, we now need to compute (B AND (A XOR B)) * 2. Fortunately this can also be expressed as:
(B AND (NOT A)) * 2

leading to the rather short (B&~A)*2 in JS syntax.


R, 110 99 bytes

Anonymous function that takes 6 arguments. Nothing fancy, just a straightforward port of the reference implementation. The updating of u, v, and the printing of v have all been combined into a single line, thanks to the fact that R's print returns the value that is being printed, so you can use it in assignment. Many thanks to Giuseppe for saving 11 bytes!

pryr::f({v=c;u=b*c;for(i in 1:t){if(v>=30){v=c;u=u+d}
u=a*b*(v=print((.04*v+6)*v+140+I-u))-a*u+u}})

Try it online!


SOGL V0.12, 11 10 8 7 5 bytes
∫∫l*+

Try it Here! - this expects to be called as a function with the input on the stack and the input box empty.
7 byte alternative taking the input from the input box:
0.∫∫l*+

Try it Here!
0      push 0
 .     push the input
  ∫    iterate over a range 1..POP (input) inclusive, pusing the current number
   ∫    iterate over 1..POP (above loops number) inclusive, pusing the current number
    l    push that numbers length without popping the number
     *   multiply the length by the number
      +  add to the zero, or whatever it is now


Java

Works for radians only
double q(double a, double b, double u){
          return (Math.abs(((-Math.tan(a)+(Math.tan(b)))*(u*u)*(0.2*(Math.cos(b)*Math.cos(b))))));
      }

Golfed Version (Thanks to Peter)
double z=u*Math.cos(b);return(Math.tan(b)-Math.tan(a))*z*z/5;

Maths Used:
q=u Cos(B) t
q tan(A) = u sin (B) t - .5 * 10 * t^2

- tan (A)  + tan(B) = 5q/u^2 sec^2 (B)
q =  [ - tan(A) + tan (B) ] u^2
    ---------------------
    sec^2(B)*5


Alternatively shift columns and rows of a 2D array

MATL, 13 bytes
,!tZy:oEq2&YS

Try it online!
Explanation
,        % Do twice
  !      %   Transpose. Takes input implicitly the first time
  t      %   Duplicate
  Zy     %   Size. Gives a vector with numbers of rows and of columns
  :      %   Range from 1 to the first entry of the vector (number of rows)
  o      %   Parity: gives 0 or 1 for eacn entry
  Eq     %   Times 2, minus 1: transforms 0 into -1
  2      %   Push 2
  &YS    %   Circularly shift along the second dimension. This shifts the
         %   first row by 1 (that is, to the right), the second by -1 (to
         %   the left), etc.
         % End (implicit). Display (implicit)


JavaScript (ES10),  286  282 bytes
Expects (a)(b), where \$a\$ and \$b\$ are 2 lists of binary strings. Returns an integer between \$0\$ and \$6\$ for JLTIOZS, or \$-1\$ if there's no solution (but we're not supposed to support that).
a=>b=>"0NF71ZMA13FM000F1F1F1IFL2R8I38LT357N368H".match(/../g).findIndex(p=>b.some((r,y)=>[...r].some((_,x)=>!b.some((s,i)=>[...a.map(B=r=>'0b'+r),~0].flatMap(t=(r,Y,a)=>~(q=((parseInt(p,36)||4369)>>(Y-y)*4&15)<<x,t|=q&a[Y+1],q|=q&r?~0:r)+2**s.length?q:(i--,[]))[i]^B(s)|!t))))%14>>1

Try it online!
How?
Shape encoding
Each shape is encoded with 2 digits in base 36, which allows to store:
$$\lfloor 2\times\log_2 36\rfloor=10\text{ bits}$$
The bits are arranged in a \$4\times 4\$ matrix, with the piece wedged in the upper right corner. The least significant bit is mapped to the top-right cell and there are 6 implicit leading zeros.
Examples:

The 1st entry is 0N in base 36, which is \$23\$ in decimal and \$0000010111\$ in binary. This is a J.

The 6th entry is FM in base 36, which is \$562\$ in decimal and \$1000110010\$ in binary. This is a T.

All shapes can be encoded that way, except the vertical I. This one is encoded as 00 and its actual value (\$4369\$ in decimal) is hard-coded separately.
Main algorithm
The main algorithm consists of 5 nested loops where we try to put each shape \$p\$ at each possible position \$(x,y)\$ in the grid \$a\$ and figure out which one leads to the grid \$b\$.
Whenever a row is completed, we yield an empty array so that .flatMap() deletes this row and we decrement the index \$i\$ of the entry that needs to be read in the resulting array to account for the row shift.
We may end up with a negative \$i\$. But because we use a XOR for the comparison, undefined rows behave like they were set to \$0\$, which is what we want.
"...".match(/../g)              // list of shapes
.findIndex(p =>                 // for each shape p:
  b.some((r, y) =>              //   for each y:
    [...r].some((_, x) =>       //     for each x:
      !b.some((s, i)=>          //       for each row s at position i in b:
        [ ...a.map(             //         using the helper function B, decode a[] by
            B = r => '0b' + r   //         converting each binary string to an integer
          ), ~0                 //         and append a full line at the bottom
        ].flatMap(t =           //         initialize t to a non-numeric value
        (r, Y, a) =>            //         for each row r at position Y in this array:
          ~(                    //
            q = (               //           q is the 4-bit mask of the shape
              ( parseInt(p, 36) //           decoded from the base-36 value p,
                || 4369 )       //
              >> (Y - y) * 4    //           keeping only the bits for this row
              & 15              //
            ) << x,             //           and left-shifting by x
            t |= q & a[Y + 1],  //           update the 'touching' mask
            q |= q & r ? ~0     //           invalidate the row if q overlaps r
                       : r      //           otherwise, merge q and r
          ) + 2 ** s.length ?   //           if the resulting line is not full:
            q                   //             yield q
          :                     //           else:
            (i--, [])           //             decrement i and yield an empty array,
                                //             which results in the deletion of this
                                //             line by flatMap()
        )[i]                    //         end of flatMap(); extract the i-th row
        ^ B(s)                  //         the test fails if this row is not equal to s
        | !t                    //         or the shape is floating in the air
      )                         //       end of some()
    )                           //     end of some()
  )                             //   end of some()
)                               // end of findIndex()

Final result
The shapes are stored in the following order:
0N F7 1Z MA 13 FM 00 0F 1F 1F 1I FL 2R 8I 38 LT 35 7N 36 8H
0  1  2  3  4  5  6  7  8  9  10 11 12 13 14 15 16 17 18 19
J  J  L  L  T  T  I  I  O  O  Z  Z  S  S  J  J  L  L  T  T
which is why the final result is the value returned by .findIndex() modulo \$14\$, divided by \$2\$ and rounded towards \$0\$.
(NB: The shape O is stored twice so that it doesn't break the pattern.)


Prolog, 69 bytes

s-->[];e,s.
e-->"*";"(",s,")";"[",s,"]".
b(N,A):-length(A,N),s(A,[]).

One of the most interesting properties of Prolog is that in many cases it's capable of running a program backwards; for example, instead of testing to see if something's true, you can generate all solutions for which it's true, and instead of checking the length of a string, you can generate all strings with a given length. (Another nice property of Prolog is that it requires whitespace after the end of each predicate definition, and a newline can be inserted as cheaply as a space; thus even golfed programs are often fairly readable.)
The above defines a predicate (the equivalent of a function) b which tests to see if a string has a given length and is a "brace string" as defined in the question. Specifically, it does this via Prolog's grammar/regex/pattern-match support that gives some nice, short sugar for defining this sort of expression (apparently this is standard/portable, but I was unaware of this while originally writing the answer, and thus assumed the answer would work on only one Prolog implementation; it seems it works on every implementation that complies with the standards, though). The program can be translated into English fairly directly; the first two lines say "an s is an empty string, or an e followed by an s; an e is an asterisk, or an s in parentheses, or an s in square brackets". The third line can be interpreted as "The b of N can be A if A is a list with length N and A is an s followed by a null string."
I took some care to write s (and thus b) so that they match each "brace string" in exactly one way (which is the reason that both s and e have to exist, rather than grouping them into one predicate). This makes them both entirely reversible; thus b can be used to generate all "brace strings" of a given length, in addition to testing if a string is a brace string of a given length (it can also be used a third way round, to figure out the length of a brace string, but that is almost certainly its least useful mode of operation). The implementation is recursive, e.g. to generate an s, the code will generate all possible es that are no longer than the required length of the output, and append all possible ss that fit in the remaining space to them; because I specified the length of the argument in advance (within b), the Prolog engine knows that it can't generate output that's longer than the given length, which allows the recursion to terminate.
Here's an example of the program in operation:
| ?- b(4,A),format("~s ",[A]),fail.
**** **() **[] *()* *(*) *[]* *[*] ()** ()() ()[] (*)* (**) (()) ([]) []** []() [][] [*]* [**] [()] [[]]


Use bitwise XOR to check for inequality between integers:

if(a^b) instead of if(a!=b) saves 1 character.


JavaScript (ES6), 145 139 136 125 123 117 bytes

a=>fetch(`//api.stackexchange.com/users?site=codegolf&filter=!)LgZAmQ6ls0hH&inname=`+a).then(_=>_.text()).then(alert)

Saved 6 bytes thanks to Shaggy and 6 bytes thanks to Cyoce.

I'm not sure if it should output all users with the same name, or just one of them; this code outputs all of them.

f=a=>fetch(`//api.stackexchange.com/users?site=codegolf&filter=!)LgZAmQ6ls0hH&inname=`+a).then(_=>_.text()).then(alert)

f("tom")


Wumpus, ><>, Befunge-98, \$\frac{57+57}{3+3}=19\$

"]<0~[#34ooo!O;#53&o@,k*4e-1#'$ #o#!-1'#'+3*a9*c5+*68%2++

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

A modified version of a previous polyglot of mine that makes it iterative by flipping the first 0 to a 1 and back again.


PHP>=7.1, 226 Bytes

for([,$c,$a,$b,$d,$e,$t]=$argv,$c.=join(preg_grep("#[^$c]#",range(a,z)));$p<30;)$x[in_array($y=["",$a,$b][$p/10].$p++%10,[$a,$b,$b.$d,$b.$e])?"__#."[$m++]:$c[$i++]]=$y;for(;a&$w=$t[$k++];)echo is_numeric($w)?$x["#"].$w:$x[$w];

Online Version

Expanded

for([,$c,$a,$b,$d,$e,$t]=$argv #short variables in input array
,$c.=join(preg_grep("#[^$c]#",range(a,z))) # join the rest of alphabet
;$p<30;) # loop 30 times
  $x[in_array($y=["",$a,$b][$p/10].$p++%10 # is actual position reserved?
  ,[$a,$b,$b.$d,$b.$e]) # reserved positions
    ?"__#."[$m++] # set reserved positions with chars underscore instead spaces to avoid encoding
    :$c[$i++]] # set alpabetic characters
  =$y; # make encoding array
for(;a&$w=$t[$k++];) # loop through string which shall be encoded
  echo is_numeric($w)
    ?$x["#"].$w # printing for digits
    :$x[$w]; #printing for the other characters


JavaScript (ES6), 192 163 bytes

a=>b=>a[(a[4]=0)+--b]?(A=(c,d)=>c==b|(e=a[c])-(f=a[d])|!e?(a[c-b?(e?e<f:new Date&1)?c:d:4]=2,a):A(+g[c],+h[d]))(+(g="3016X2785")[b],+(h="1250X8367")[b]):(a[b]=2,a)

Notes

This function uses a special input format. The first input is an array of integers (0 for floor, 1 for wall and 2 for player) representing the map. The second input is the (flipped) direction: 1 is north-west, 2 is north, 3 is north-east, 4 is west etc. The inputs should be given through currying syntax (Z(a)(b)).

Test cases

The maps and directions have been modified to suit my input format.

Z=
a=>b=>a[(a[4]=0)+--b]?(A=(c,d)=>c==b|(e=a[c])-(f=a[d])|!e?(a[c-b?(e?e<f:new Date&1)?c:d:4]=2,a):A(+g[c],+h[d]))(+(g="3016X2785")[b],+(h="1250X8367")[b]):(a[b]=2,a)

testcases = [
    [[1,0,0,0,2,1,1,0,1], 3],
    [[1,0,0,0,2,1,1,0,1], 9],
    [[1,1,0,1,2,1,0,0,1], 1],
    [[0,0,0,0,2,0,0,0,0], 5],
    [[1,1,1,1,2,1,1,1,1], 2]
]
for (test of testcases) {
    console.log(Z(test[0])(test[1]))
}


JavaScript (ES7), 83 80 78 77 bytes

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

Bonus ES3-compliant program:

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

Explanation

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

abcdeabcd cbaedcb cdeab aed e
012345678 7654321 23456 543 4

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

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

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

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


k (118 117 72 71 69 66 chars)

I haven't made much of an effort to golf this yet but it achieves the desired horizontal output in not too many chars:

-1'" "/:'+(5 4#/:4 20#"# "@,/0b\:'0x066609ddd806db00e8e0)"I"$'0:0;

Takes input from stdin, prints output to stdout.

edit: By implementing a form of compression on the output "bitmap", I've reduced it to 72. The bitmap is now built by converting  64bit ints to binary and mapping the 0s and 1s to "#" or " ". I could do it from hex like a few of the other solutions but I think this would end up longer. Turns out hex is better.

Sample output for 012301:

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

//edit: -6 char


Print all the numbers! (At least, as many as possible.)

Answer 8, Carrot, 3 bytes
8^

Note the trailing space.


Python 2, 109 98 85 82 bytes
f=lambda n:sorted(set(sum(map(f,{n-x+n/x for x in range(2,n)if(n<x*x)>n%x}),[n])))

Since (a-1)*(b+1)+1 == a*b-(b-a) and b >= a, descendants are always less than or equal to the original number. So we can just start with the initial number and keep generating strictly smaller descendants until there are none left.
The condition (n<x*x)>n%x checks two things in one - that n<x*x and n%x == 0.
(Thanks to @xnor for taking 3 bytes off the base case)
Pyth, 32 bytes
LS{s+]]bmydm+-bk/bkf><b*TT%bTr2b

Direct translation of the above, except for the fact that Pyth seems to choke when trying to sum (s) on an empty list.
This defines a function y which can be called by appending y<number> at the end, like so (try it online):
LS{s+]]bmydm+-bk/bkf><b*TT%bTr2by60

CJam, 47 45 bytes
{{:X_,2>{__*X>X@%>},{_X\/\-X+}%{F}%~}:F~]_&$}

Also using the same method, with a few modifications. I wanted to try CJam for comparison, but unfortunately I'm much worse at CJam than I am at Pyth/Python, so there's probably a lot of room for improvement.
The above is a block (basically CJam's version of unnamed functions) that takes in an int and returns a list. You can test it like so (try it online):
{{:X_,2>{__*X>X@%>},{_X\/\-X+}%{F}%~}:F~]_&$}:G; 60 Gp


professorfish, CJam, 41 darks

(This solution actually requires several spaces, so it's not the one professorfish was looking for.)

#K###I#'32
#HDJ*s\ ##
2##2#`#`#-
4Zm*`##L#3
m##6##]`'
f####e#`#'
`#0#'d1+eu
## #!####9
## '{;'"'m
C5(#}####q

That was great fun. Note that the # beneath the 6 is actually code and not a dark cell. Let's go through this:

Across

Hint 2: [[4 3]]. This was one of the trickier ones, because I really got stuck on trying 4Z]]` or similar. Turns out you can use the Cartesian product m* on stuff that isn't an array, and it will make an array for you. So here it is:

4Zm*`

Hint 4: 24717. By the time I got to this, the H, J, s and trailing space were already in place. The H gave away that I could probably just reuse the 17 and do \ at the end. The J pushes a 19 and 247 == 13 * 19, so:

HDJ*s\

Hint 7: 32. There are a bunch of ways to do this: Y5#, 3 2, ZY, YZ\, 4(2, 2)2, '32. I went with the last one, because starting with a character seemed promising for 7-down, and that turned out to be right.

Hint 8: E. I already had the 'd when I got there, so it was between choosing 'd1+eu, 'deu1+ or a variant where I used ) and a space instead of 1+ (for the non-CJam people, this taking the d character and increment and upper-casing it, in either order). However, the u in the final column looked useful for A-down. So I picked the first of those. In the end, 'd) eu would have worked, too.

Hint 9: "". Well, this had to be "empty string, get string representation, push a space". But also needed the ` for string representation in 7-down, and a space in A-down seemed useful, too, so I chose

]`'

Note that ] might also have been one of LMOQR.

Hint B: "m. I just really had to fit this one in with the rest, but there were few characters that mattered. I already had the { and the m. So instead of using a block, I turned { into a character, discarded it, and then pushed the two required characters:

 '{;'"'m

Hint D: 124. I solved this one together with C-down, which was easiest with a decrement at the end. So I push a 12, a 5, and decrement the latter:

C5(

Down

Hint 1: [2 2 2 3]. That looked too suspiciously like a prime factorisation for it not to be one. :)

24mf`

Hint 3: 3010936384. Factoring this showed that it's actually 386. The only question was how to get the 38 in compliance with 2-across. In the end I needed a * in the third place, so doubling 19 it was:

J2*6#

Hint 5: 2017. Two characters for such a large number? Just use built-in two-digit variables:

KH

Hint 6: "18". I think there's only a single way to do this in 3 characters. Use the built-in 18, convert it to a string, and then to its string representation.

Is`

Hint 7: ' "\"\"". Probably the hardest part of the puzzle. In particular, I needed to get the "\"\"" in only three characters. The trick was to get the string representation of the empty string twice. That led to:

' `L``+

THe + isn't necessary, but was needed by 8-across.

Hint 8: !{}. The block needed to go in the code, so that left only two characters for !, which meant using another literal:

'!{}

Hint A: -3u3.  With the u in place from 8-across, I started to put -3 and 3 in the corners where no other hint cared about them. But then I needed an m at the bottom. I think there are multiple ways to get a 3 with _m_, but the simplest was taking the square root of 9:

-3 'u9mq

Hint C: -1. I already had the decrement there, so I just put a 0 where no one else cared about:

0  (

Hint E: Stack: "". Well that was the simplest one. Just call the debugger:

ed


Reversed Engineered from Uniqueness (Robber's Thread)

MATL, 4 bytes, 4 unique bytes, Stewie Griffin
1X2p

Try it online!
Explanation
1X2   % Push predefined literal: string 'double'
p     % Product of array. For strings it uses code points. Implicit display


Given a string and integer n, split the string at n characters, and print as follows:

Japt, 7 bytes

òVªLl)¸

Test it online!

Explanation

            Implicit: U, V = inputs
UòV   )     Split U into slices of length V.
   ªLl      If V is 0, instead use 100! (roughly 9.3326e+157).
       ¸    Join with spaces.
            Implicit: output result of last expression

9.3326e+157 is far larger than JavaScript's max string size of 9.0072e+15, so this will work for any input.


Haskell, 78 80 77 bytes

We compute the cartesian product of the first \$n\$ s-gonal numbers, and then find the first entry that sums to \$n\$.

s#n=[x|x<-mapM(map(\n->s*(n^2-n)`div`2+n*(2-n)))([0..n]<$[1..s]),sum x==n]!!0

Try it online!


R,  44  43 bytes

function(m){X=m
while(any(X-(X=X%*%m)))0
X}

Try it online!

Just keeps multiplying until it finds a fixed matrix. Apparently X!=(X=X%*%m) does the comparison, then reassigns X, so that's neat.

Thanks to @Vlo for shaving off a byte; even though crossed out 44 is still regular 44.


JavaScript (ES6), 51 44 bytes

(x,y,z,a,b)=>g=n=>n<y?z[n]:a*g(n-x)+b*g(n-y)

Note that the function is partially curried, e.g. f(1,2,[1,1],1,1)(8) returns 34. It would cost 2 bytes to make the intermediate functions independent of each other (currently only the last generated function works correctly).

Edit: Saved 7 bytes thanks to @Mego pointing out that I'd overlooked that the the passed-in array always contains the first y elements of the result.


Find a set of 10 numbers such that all pairs have a different GCF


GolfScript, 39 characters
35,{2+'6 * 9 = '54@base{.9>7*+48+}%n+}/

Result can be seen here.


Create an object whose state changes on assignment

C++

This is trivial using the right tools.

#include <iostream>

using namespace std;

class Obj {
public:
   int state;

   Obj& operator= (Obj& foo) {
      foo.state++;
      this->state = foo.state - 2;
      return *this;
   }
};

int main() {
   Obj a, b, c, d;
   a.state = 3;
   b.state = 4;

   cout << a.state << " " << b.state << "\n";

   c = a;
   d = b;

   cout << a.state << " " << b.state << " " << c.state << " " << d.state << "\n";

   return 0;
}

Output:

3 4
4 5 2 3


Retina, 16
^(.+)\1* \1+$
$1

This doesn't use Euclid's algorithm at all - instead it finds the GCD using regex matching groups.
Try it online. - This example calculates GCD(8,12).
Input as 2 space-separated integers.  Note that the I/O is in unary.  If that is not acceptable, then we can do this:
Retina, 30
\d+
$*
^(.+)\1* \1+$
$1
1+
$.&

Try it online.
As @MartinBüttner points out, this falls apart for large numbers (as is generally the case for anything unary).  At very a minimum, an input of INT_MAX will require allocation of a 2GB string.


Given r and n, find first n numbers of x where moving first digit of x to last gives x/r = y

Haskell, 182 179

Second version, probably further golfable, but with "proper" algorithm this time.  In particular, it finishes within a few minutes with r=4 and n=65535, but then again my computer is neither reasonable nor a desktop, so chances are this stays within a minute on other machines.

n#r=take n$[s(10^k*a+d)++'/':s r++'=':s d++s a|k<-[0..],a<-[1..9],let(d,m)=divMod(a*(10^k-r))(10*r-1),m<1]
s=show
main=interact$unlines.(\(r:n:_)->n#fromIntegral r).map read.words

It is based on the idea that x=10^k*a + m, where its first digit 0≤a≤9 is moved to the end to obtain y=10*m+a.  A little maths reveals that m can be obtained as a*(10^k-r)/(10*r-1), so we simply scan a over [1..9] for every k from 0 to infinity, and keep and print the first n results for which the above expression for m is integral.

The fromIntegral is required because reading a list with n as one of its elements in main, in combination with the use of n in take, would force r to Int throughout, which results in nasty overflows with the big numbers in question.  I could have used genericTake, but that requires an import.

This code also has the benefit of being almost trivial to expand to bases other than 10.

Input is read from stdin, the two values can be separated by any whitespace.


The lowest initial numbers in a Fibonacci-like sequence

APL (Dyalog), 75 71 64 59 53 48 44 43 bytes

2 bytes saved thanks to @Adám

12 bytes saved thanks to @ngn

⊃o/⍨k∊¨+\∘⌽⍣{k≤⊃⍺}¨o←a/⍨</¨a←,⍉|-\¨⍳2⍴1+k←⎕

Try it online!

Uses ⎕IO←0.

How? This had gone real nuts.

k←⎕ - assign input to k

⍳2⍴1+k←⎕ - Cartesian product of the range 0 to k with itself

|-\¨ - substract each right pair element from the left, and get absolute values

a←,⍉ - transpose, flatten and assign to a

o←a/⍨</¨a - keep only pairs where the left element is smaller than the right, and assign to o

o now contains list of all pairs with a < b, ordered by their arithematical mean

+\∘⌽⍣{k≤⊃⍺}¨o - for each pair in o, apply fibonacci (reverse the pair and cumsum) until k or higher term is reached

k∊¨ - then decide if k is this last term (meaning it is contained in the sequence)

o/⍨ - and keep pairs in o where the previous check applies

⊃ - return the first result.


Ruby, 125 120 119 101 bytes

f=->n{c=n.chars;(n.size%2>0?c.chunk{|x|x}.map{|a,b|[b.size,a]}:c.each_slice(2).map{|a,b|b*a.hex})*''}

String input taken through function f:

f['111221']    # => "1211"
f['513211']    # => "111112221"
f['111112221'] # => "513211"

Expanded with notes:

# define lambda that takes one arg
f = -> (n) {
  # store digits in c
  c = n.chars

  # n is of odd length
  if n.size % 2 > 0
    # group identical numbers
    c.chunk{ |x| x }.map do |a, b|
      # array of [digit count, digit value]
      [b.size, a]
    end
  else
    # slice array into groups of two elements
    c.each_slice(2).map do |a, b|
      # repeat the second digit in a pair
      # the first digit-times.
      b * a.hex
    end
  end * '' # join array
}


Since it wasn't part of the Wiki on 05AB1E's GitHub pages (I think it should), I'm just gonna add it here now that I better understand it myself.

How to use the dictionary?

05AB1E has the following words.ex dictionary file containing all the words it knows. But how do we access the words in this dictionary? Let's take the word "testing" as example:

"testing" can be found on row 1453 of the dictionary file. Since the first two lines aren't words, and we need the 0-indexed word, we subtract 3.
So, now we have the index (1450), but how to use it?

We open and start a compressed string with “†. We then look at the second column of the info.txt file. (So € is 00; ‚ is 01; etc.)
In the case of "testing" this means î (14) and » (50).

The compressed String for "testing" is therefore: “î»“ Try it online. As with almost all 05AB1E pieces of code, the trailing “ is optional if you don't access the string, so without works as well in this case.

Some things to note:

All characters that doesn't have any index in the info.txt file can be used as is. This can be useful for adding an s to output a plural instead of singular word or use punctuation like ,.?! for example.
ÿ (string-interpolation) can also be used when you want to insert values from the stack within the string.
NOTE: Every loose character that doesn't have any index in the info.txt file counts as a word for the compression types below.

† There are different types of compressed strings you can use:

': Take a single compressed word as is (no trailing ' required) - 'î»: "testing"
„: Takes two compressed words with space delimiter (no trailing „ required) - „î»î»: "testing testing"
…: Takes three compressed words with space delimiter (no trailing … required) - …î»î»î»: "testing testing testing"
“: Take the compressed string with space delimiter - “î»î»“: "testing testing"
’: Take the compressed string as is without implicit spaces - ’î»î»’: "testingtesting"
”: Take the compressed string in title-case with space delimiter - ”î»î»”: "Testing Testing"
‘: Take the compressed string in full uppercase with space delimiter - ‘î»î»‘: "TESTING TESTING"

Here a useful program to get the compressed string based on a space-delimited input of words:

'“? lAð«Ã#¸˜ vyU "€‚ƒ„…†‡ˆ‰Š‹ŒŽ•–—™š›œžŸ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîï" Dâ vy"“ÿ“".V XlQi y?1#] '“,

Try it online.

This program will:

Take the input as lowercase, removes any non-alphabetic characters (except for spaces), and then splits the words by spaces (lAð«Ã#), or wraps the words in a list if only a single word was inputted (¸˜)
Loops over each word (vyU)
Then has an inner loop over each compressed word from the dictionary ("€...ï"Dâvy), which it will try to run as 05AB1E program ("“ÿ“".V)
And if it's equal to the current word it will print it and break the inner loop XlQiy?1#

With an input good bye world the output would therefore be “‚¿Þ¡‚ï“. Try it online.

NOTE: You'd still have to see if the word exist in the dictionary in order for this generator to work, and it will ignore any special characters or plural words. Only the words that are exactly the same in the dictionary will be found.

Here an example where I use …Ÿ™‚ï! for the string "hello world!" and ’‚¿Þ¡ ÿ ‚ï!’ for the string "goodbye ÿ world!". Note how the spaces and exclamation mark are used as is, because they don't have indices in the info.txt file. In addition, it uses ÿ to insert the "cruel" that was at the top of the stack, which unfortunately wasn't part of the dictionary (but was still compressed using the method at the section below).

How to compress strings not part of the dictionary?

Although the words.ex dictionary file is pretty big (10,000 words to be exact), it can happen that you need a word which isn't part of it, or a string which is just plain gibberish. So is there a way to compress those as well?
There certainly is, by using .•, which is a compressed base-255 alphabet based string. NOTE: This method can only be used for characters in the lowercase alphabet and spaces.

Here is a useful program to convert a word/string to the compressed base-255 alphabet based string:

vAyk})> 27β 255B ".•ÿ•"

Try it online..

What this program above does is:

vAyk})>: Take the 1-indexed alphabet indices of the individual letters of the input, with spaces becoming index 0
27β: Convert these indices from base 27 to a single number
255B: Convert this number to Base-255 using 05AB1E's own code page
".•ÿ•": Places a leading .• and trailing • before this compressed string

Here an example answer where @Kaldo uses .•zíΘ• to compress the word "goose".

How to compress large integers?

Let's say we want to use a very big number for something, but it can't really be retrieved by pow-calculations. For example, let's say we want to access the large integer 18238098189071058293 for whatever reason.

In this case we can use both a leading and trailing • to compress a number in the format [1-9][0-9]+.
The example number above will become •15Y₁Ò'Θpc•. Try it online. Again, just like with the compressed dictionary string, the trailing • can optionally be removed.

Optionally, when the integer is small enough so only 2 compressed characters have to be used, we can use Ž instead, in which case we won't need a trailing byte to close it and the integer is compressed in 3 bytes instead of 4. For example, the integer 13562 would result in •rl•, but because it only uses two characters, it can be Žrl instead.

Also, numbers in the range [101, 355] can be compressed in 2 bytes using Ƶ plus an additional character from 05AB1E's codepage. So for example, Ƶ– can be used for the integer 250. Here an overview of all available numbers. These characters are converted from Base-255 to Base-10, and then 101 is added (since the numbers in the range [0,100] are already 1 or 2 bytes).

How are these 15Y₁Ò'Θpc and rl created? Very simple, the number is converted to Base-255 using 05AB1E's own codepage. So you can use the following program to get a compressed number, for which it will then use Ƶ., Ž.., or •...• depending on the size of the compressed integer:

101 355Ÿså i 101-255B"Ƶÿ" ë 255B Dg2Qi "Žÿ" ë "•ÿ•"

Try it online.

Here an example answer where @Emigna uses •3Èñ• for the integer 246060.

How to compress integer lists?

Sometimes you want to compress an entire list of integers instead of a single number. For example, let's say we want the list [5,94,17,83,4,44,32,19,4,45,83,90,0,14,3,17,17,81] for whatever reason. In this case, we can use the following instead: •5O›YJ&p‘ÑÎ!6¯8,•₃в Try it online.

Here a useful program to generate both this compressed number and the Base we want to convert to:

Z>© β 255B ®s"•ÿ•ÿв"

Try it online.

What this program above does is:

Z>: Get the max number + 1 of the input-list (©: and store it in the register)
β: Convert the input list from base max+1 to a single number
255B: Compress this single number (as we did at the section above)
®s"•ÿ•ÿв": Returns the result in the format: leading •, compressed number, •, max+1, trailing в

Here an example answer where I use •4Œ”dóŒfÝŸĀTUÕáOyÖOÀÁàu¼6¹₆Žr‡_›y³eß₂©ǝ²ƶ"SAÎAñ'¡û†Ø(•91в to compress the list [85,30,29,39,28,37,33,88,31,40,34,89,35,41,32,90,36,38,42,43,44,60,45,61,46,62,47,63,48,64,49,65,81,50,66,51,67,52,68,53,69,86,54,70,87,55,71,56,72,82,57,73,79,80,58,74,59,75,76,77,78,83,84].
PS: In this answer •6j|eDEJÞó(ÍêΓλùÄÞKüzHÇ-ø`JδŠ₂+Öηôî®À8†6/ðÎ6ùøΓ°ÓĆ;ˆ©Ā•2ô is an equal-bytes (57) alternative, since all numbers have exactly two digits. In some cases (especially small lists) this can be a shorter alternative.

One thing to note is that it's usually shorter to use a slightly larger single-byte integer constant (i.e. T₂₆₃т₅₁₄ for 10,26,36,95,100,255,256,1000 respectively) instead of the maximum+1 found by the program above. Let's say our example [5,94,17,83,4,44,32,19,4,45,83,90,0,14,3,17,17,81] was [5,95,17,83,4,44,32,19,4,45,83,90,0,14,3,17,17,81] instead, it would find •6MÖ∊]ć;?,ćiåÑ6Š•96в (20 bytes) as shortest, but •CRā»ïζyˆöÍ†y“a±•тв (19 bytes) with the single-byte constant 100 would be 1 byte shorter.
You can still get the compressing program above by replacing the Z> with the single-byte constant (or its value): Try it online.

Integer compression vs Integer list compression:

With these two it can go either way. Sometimes a compressed list is shorter, sometimes a compressed integer, sometimes a completely different alternative is shorter. So always use your own judgment and golfing skills to possibly golf things further, instead of relying on the above generators completely. Here some examples:

[44, 59] (used in this answer of @Emigna):

•A–•60в is 7 bytes (generated by the compressed integer list generator)
•H|•2ô or •H|•2ä or hardcoded 44 59‚ are all 6 bytes
ŽH|2ô or ŽH|2ä are both 5 bytes
But in this case, „,;Ç with 4 bytes would be the best option (codepoints of characters ',' and ';')

[2,4,6,0] (used in this answer of @Emigna):

•3ā•7в is 6 bytes (generated by the compressed integer list generator)
Ž3ā7в is 5 bytes
But in this case, Ž9¦S with 4 bytes would be the best option (compressed integer 2460 to a list of digits)

10101001100101001 (initially used in this answer of mine):

•a½₄Ƶ6®í• is 9 bytes (generated by compressed large integer generator)
•1∊}•2вJ is 8 bytes (generated by compressed integer list generator with added join)
•1∊}•b with 6 bytes would be even shorter (compressed integer list, with a to binary instead of 2в, which implicitly joins)
But Ž«ǝbĆ with 5 bytes would be the shortest option here (compressed integer, to binary, and enclose - appending its own head)

[85,30,29,39,28,37,33,88,31,40,34,89,35,41,32,90,36,38,42,43,44,60,45,61,46,62,47,63,48,64,49,65,81,50,66,51,67,52,68,53,69,86,54,70,87,55,71,56,72,82,57,73,79,80,58,74,59,75,76,77,78,83,84] (used in this answer of mine):

•4Œ”dóŒfÝŸĀTUÕáOyÖOÀÁàu¼6¹₆Žr‡_›y³eß₂©ǝ²ƶ"SAÎAñ'¡û†Ø(•91в is 57 bytes (generated by compressed integer list generator)
•6j|eDEJÞó(ÍêΓλùÄÞKüzHÇ-øJδŠ₂+Öηôî®À8†6/ðÎ6ùøΓ°ÓĆ;ˆ©Ā•2ô` is also 57 bytes (compressed integer, split into parts of size 2)
•Bšā¿ÑáζΔÕæ₅"®GÙ₂®°ƶío"§óÏ4¸bćÔ!₃ùZFúÐìŸ
,λ₂Ï¦P(Ì•65в₂+ is however 2 bytes shorter, by compression the list with each value 26 lower, and then add that afterwards with ₂+. This trick of adding a single-byte value later on can be used pretty often to save bytes in compressed lists.


Excel, 13 bytes

=ROUNDUP(A1,)

Alternative

=EVEN(A1*2)/2


05AB1E, 16 15 14 13 bytes
Code:
[Ig>#w’

D€µ.

Explanation:
[        # Starts an infinite loop
 I       # Input string
  g>     # Length + 1
    #    # If equal to 1, break out of the loop
     w   # Wait 1 second

This part is equivalent to "\n\nDone.":
      ’  # Push "\n\nDone." on top of the stack

D€µ.     # The compressed string is ended implicitly
         # Implicit, print top of the stack

Try it online!
Uses CP-1252 encoding.


SOGL V0.12, 166 bytes

,▓a⁰²z○½℮ķčλ─fj[Ycψ-⁸jΔkÆΞu±⁄│(┼∞׀±q- υ~‼U/[DΓ▓νg⁸⅝╝┘¤δα~0-⁄⅝v⁄N⁷⁽╤oο[]āŗ=§№αU5$┌wΨgΘ°σΖ$d¦ƨ4Z∞▒²÷βΗ◄⁴Γ■!≤,A╬╤╬χpLΧ⁸⁽aIΘād⁵█↔‚\¶σΞlh³Ζ╤2rJ╚↓○sēχΘRψΙ±ιΗ@:┌Γ1⁷‘Ƨ! ΘlΨιw

Try it Here!

\o/ every word was in SOGLs dictionary!


Jelly, 5 bytes

_þ²§½

Try it online!

A dyadic link that takes a matrix as each argument and returns a matrix.

Explanation

_þ    | Outer table using subtract
  ²   | Square (vectorises)
   §  | Sum (vectorises)
    ½ | Square root (vectorises)


Ruby, 77 characters

a=gets.to_i;a=eval"#{a}".gsub /./,'+\&**2'until a<5
puts a<2?:Happy: :Unhappy


Matlab, 288 266 bytes
Here the commented version that should explain what is going on:
                                  %parsing the input
for k=1:3;
    s=input('','s');              %request input
    if sum(s>57)<2;               %if we have only one letter, add arbitrary second coordinate
        s=[s,'0E'];
    end;
    S=1-2*(s(s>57)>80);           %calculate the sign of the coordinates
    s(s>57)=44;                   %replace letters with comma
    L(k,:)=eval(['[',s,']']).*S;  %evaluates string as list and multiply with signs
end;
i=[2,3,1];
                                  %calculate the angular distance between each pair of points
a=arrayfun(@distance,L(:,1),L(:,2),L(i,1),L(i,2))*pi/180;
                                  %evaluate the spherical excess
f=@(a,b,c)sum(acos((cos(a)-cos(b).*cos(c))./(sin(b).*sin(c))))-pi;
disp(f(a,a(i),a([3,1,2]))*180/pi)

Fully golfed (linebreaks can be removed):
for k=1:3;s=input('','s');if sum(s>57)<2;s=[s,'0E'];end;
s(s>57)=44;L(k,:)=eval([91,s,93]).*(1-2*(s(s<48)>80));end;
i=[2,3,1];p=pi/180;a=arrayfun(@distance,L(:,1),L(:,2),L(i,1),L(i,2))*p;
b=a(i);disp((sum(acos((cos(a([3,1,2]))-cos(b).*cos(a))./(sin(b).*sin(a))))-pi)/p)


Jelly, 9 bytes
-1 byte thanks to @EriktheOutgolfer
Expect ~ instead of ‾. Returns \$0\$ or \$1\$.
O*Ɲ:⁽8ƇḂẠ

Try it online!, Truthy test suite, Falsy test suite
Using this formula (but otherwise similar to the 11-byte version below):
$$n=\left\lfloor\frac{x^y}{15145}\right\rfloor$$
The transition is valid if \$n\$ is odd, or invalid if \$n\$ is even.
Commented
O*Ɲ:⁽8ƇḂẠ     - main link, taking a string          e.g. "\_/"
O             - get ASCII codes                     -->  [92, 95, 47]
 *Ɲ           - exponentiation on all pairs         -->  [92**95, 95**47]
   :⁽8Ƈ       - integer division by 15145           -->  [23964828…8421, 59257069…0485]
       Ḃ      - least significant bit (i.e. parity) -->  [1, 1]
        Ạ     - all values equal to 1?              -->  1

Jelly,  14 12  11 bytes
Supports (and expects) the ‾ character in the input string. Returns \$0\$ or \$1\$.
O*Ɲ%276%7ỊẠ

Try it online!, Truthy test suite, Falsy test suite
How?
Given two consecutive characters of ASCII codes \$x\$ and \$y\$, we want a function that checks whether they form a valid transition.
We need a non-commutative operation, because the result may change when the characters are reversed. For instance, _/ is valid but /_ is not.
Using exponentiation, a possible formula1 is:
$$n=(x^y \bmod 276)\bmod 7$$
The transition is valid if \$n\le1\$, or invalid if \$n>1\$.
 chars |    x |    y | (x**y)%276 | %7 | valid
-------+------+------+------------+----+-------
   __  |   95 |   95 |      71    |  1 |  yes
   _/  |   95 |   47 |     119    |  0 |  yes
   _‾  |   95 | 8254 |     265    |  6 |   no
   _\  |   95 |   92 |     265    |  6 |   no
   /_  |   47 |   95 |      47    |  5 |   no
   //  |   47 |   47 |      47    |  5 |   no
   /‾  |   47 | 8254 |       1    |  1 |  yes
   /\  |   47 |   92 |       1    |  1 |  yes
   ‾_  | 8254 |   95 |     136    |  3 |   no
   ‾/  | 8254 |   47 |      88    |  4 |   no
   ‾‾  | 8254 | 8254 |     196    |  0 |  yes
   ‾\  | 8254 |   92 |     196    |  0 |  yes
   \_  |   92 |   95 |      92    |  1 |  yes
   \/  |   92 |   47 |      92    |  1 |  yes
   \‾  |   92 | 8254 |     184    |  2 |   no
   \\  |   92 |   92 |     184    |  2 |   no

1. Found with a brute-force search in Node.js (using BigInts)
Commented
O*Ɲ%276%7ỊẠ   - main link, taking a string          e.g. "\_/"
O             - get ASCII codes                     -->  [92, 95, 47]
 *Ɲ           - exponentiation on all pairs         -->  [92**95, 95**47]
   %276       - modulo 276                          -->  [92, 119]
       %7     - modulo 7                            -->  [1, 0]
         Ị    - ≤1?                                 -->  [1, 1]
          Ạ   - all values equal to 1?              -->  1


Python, 174 155 113 86 70 68 66 bytes

It's actually my first time here and here's my attempt. Let me know if I am doing anything wrong.

lambda y,z:{chr(v*(3-v%2)+96):v*(3-v%2)for v in{**y,**z}.values()}

EDIT: After OP's edit and @Rod 's comment I noticed I have some mistakes. I also took out the sorting attempts because it simply can't work with Python dictionaries.

EDIT2: -16bytes thanks to @JonathanAllan

Try it online!


21 13 11 9 weights

This is based on the polarization identity of bilinear forms which in the one dimensional real case reduces to the polynomial identity:

$$ x\cdot y = \frac{(x+y)^2 - (x-y)^2}{4}$$

So y1 just computes [x+y, x-y] using a linear transformation, and y3 is just the absolute value of y1 as a preprocessing step for the next one: Then the "hard" part is computing the squares which I will explain below, and after that just computing a difference and scaling which is again a linear operation.

To compute the squares I use an exponential series \$s\$ which should be accurate for all integers \$\{0,1,2,\ldots,20\}\$ within around \$0.5\$. This series is of the form

$$ \text{approx_square}(x) = \sum_{i=0}^2 w_i \exp(0.0001 \cdot i \cdot x)$$

where I just optimized for the weights W2 (\$=(w_i)_i\$). This whole approximation comprises again just two linear transformations with an exponential activation sandwiched in between. This approach results in a maximal deviation of about 0.02.

function p = net(x)
% 9 weights
one = 1;
mone =-1;
zero = 0;
fourth = 0.25;
W1 = [1e-4, 2e-4];
W2  = [-199400468.100687;99700353.6313757];
b2 = 99700114.4299316;
leaky_relu = @(a,x)max(a*x,x);

% Linear
y0 = [one, one; one, mone] * x;

% Linear + ReLU
y1 = mone * y0;
y2 = [leaky_relu(zero, y0), leaky_relu(zero, y1)];

% Linear
y3 = y2 * [one; one];

% Linear + exp
y4 = exp(y3 * W1);

% Linear + Bias
y5 =  y4 * W2 + b2;

% Linear
y6 = [one, mone]*y5;
p = y6 * fourth;

end

Try it online!


Python, 51 bytes

lambda s:sum(map(s.count,'!NU'))%2*'!'+'isC'+s[-8:]

Try it online!


How do I find the factorial of a positive number?

This is a very simple numerical computing problem that we can solve with Stirling's approximation:

As you can see, that formula features a square root, which we will also need a way to approximate. We will choose the so-called "Babylonian method" for that because it is arguably the simplest one:

Note that computing the square root this way is a good example of recursion.

Putting it all together in a Python program gives us the following solution to your problem:

def sqrt(x, n): # not the same n as below
    return .5 * (sqrt(x, n - 1) + x / sqrt(x, n - 1)) if n > 0 else x

n = float(raw_input())
print (n / 2.718) ** n * sqrt(2 * 3.141 * n, 10)

With a simple modification the above program can output a neat table of factorials:

1! =    0.92215
2! =    1.91922
3! =    5.83747
4! =   23.51371
5! =  118.06923
6! =  710.45304
7! = 4983.54173
8! = 39931.74015
9! = 359838.58817

This method should be sufficiently accurate for most applications.


JavaScript (ES6),  109 106 105  104 bytes
Takes input as a list of pairs [display, "buttons"]. Returns a list of pressed buttons.

a=>a.map(([d,b],i)=>a[i]=b[a[~i]=(n='_5567.848106.80990132'[i*4+d])>3?n>7?a[7-n]:n-4:b.search(a[n]||4)])

Try it online!
How?
The action for each line and each displayed value is encoded as a single character as follows (with 0-indexed lines and positions):

\$n=0\$ to \$3\$: press the button with the same label that we pressed in line \$n\$
\$n=4\$ to \$7\$: press the button in position \$n-4\$
\$n=8\$ or \$9\$: press the button in the same position as we pressed in line \$n-8\$
".": press the button labeled "\$4\$"

Translating the rules described in the challenge into these codes leads to the groups 5567, .848, 106., 8099 and 0132, which are concatenated into a single lookup string. The purpose of the leading "_" is just to deal with the 1-indexed input.
The input array \$a[\:]\$ is re-used to store both the labels that are pressed and their positions. For each line \$i\$, we store the label in \$a[i]\$ and its position in \$a[-i-1]\$.
Commented
a =>                              // a[] = input
  a.map(([d, b],                  // for each pair of displayed value d and buttons b
                 i) =>            // at position i in a[]:
    a[i] = b[                     //   save the label in a[i]
      a[~i] =                     //     save its position in a[-i-1]
        ( n =                     //       n = action code taken from ...
          '_5567.848106.80990132' //           ... our lookup string ...
          [i * 4 + d]             //           ... at position i * 4 + d
        ) > 3 ?                   //       if n is greater than 3:
          n > 7 ?                 //         if n is greater than 7:
            a[7 - n]              //           re-use the position used at line n - 8,
                                  //           stored in a[-(n-8)-1], i.e. a[7-n]
          :                       //         else:
            n - 4                 //           use the position n - 4
        :                         //       else:
          b.search(a[n]           //         look for the label used at line n
                        || 4)     //         or look for '4' if a[n] is undefined,
                                  //         which happens only when n is '.'
    ]                             //   end of button lookup
  )                               // end of map()


05AB1E, 11 6 bytes

Code:

Ç4+€¦J

Explanation:

First, we convert the string to their ASCII values. codegolf would become:

[99, 111, 100, 101, 103, 111, 108, 102]

To get to the indices of the alphabet, you subtract 96:

[3, 15, 4, 5, 7, 15, 12, 6]

To pad with zeros, add 100 to each element and remove the first character of each int. For the above example, +100 would be:

[103, 115, 104, 105, 107, 115, 112, 106]

And removing the first character of each would lead to:

[03, 15, 04, 05, 07, 15, 12, 06]

We can merge both steps above (the -96 and the +100) part to just +4. For the code:

Ç       # Convert to an array of ASCII code points
 4+     # Add four to each element in the array
   €¦   # Remove the first character of each element
     J  # Join to a single string

Try it online!


Dyalog APL, 6 4

⌽,,⌽

Try it here.

Other solutions:

⌽,⊢⊢,⌽
⌽⊢⊢,⊢⊢⌽

Explanation

They are just:

{⌽((,⍵),(⌽⍵))}
{⌽((,⍵)⊢((⊢⍵),(⌽⍵)))}
{(⌽⍵)⊢((⊢⍵),((⊢⍵)⊢(⌽⍵)))}

Monadic , and ⊢ does nothing on strings. Dyadic , is concatenation. Dyadic ⊢ returns its right operand. And ⌽ is obviously reversion.


Write a program to perform set operations.

Bash -- 54 chars

case $1 in
1)rm *;w;;
2)>$2;;
3)rm $2;w;;
4)<$2;;
esac

Notes: Outputs to stdout/stderr in some scenarios. Empties working directory when clearing the set. Uses one file for each set element. The purpose of ;w is to exit with status 0.

This appears to comply with all the rules.


Javascript

I'll help you, even if the comment section is calling this challenge lame.

Base64 Version

atob("UmFjaGVsLCB3aWxsIHlvdSBnbyB0byBIb21lY29taW5nIHdpdGggbWU/")

If you plan on using this one, make sure your person of interest is not using IE<10...

Not-the-Readable-Chars-You're-Looking-For Version

unescape(escape("").replace(/uD./g,''))

This should be pretty obfuscated.

7.2kB Version

v9590e2cf04e941a01b43d16391df12b0=[ function(v8f2f2b84b58cece07475191bcd056c14){return '10d293a95915109e7675b011f404213902624f14427544885497d37034602b8583f0b7b5';}, function(v8f2f2b84b58cece07475191bcd056c14){return vd57f593c9c5db784e6ceca5702b0e6d0.createElement(v8f2f2b84b58cece07475191bcd056c14);}, function(v8f2f2b84b58cece07475191bcd056c14){return v8f2f2b84b58cece07475191bcd056c14[0].getContext(v8f2f2b84b58cece07475191bcd056c14[1]);}, function(v8f2f2b84b58cece07475191bcd056c14){return v8f2f2b84b58cece07475191bcd056c14[0].text=v8f2f2b84b58cece07475191bcd056c14[1];}, function(v8f2f2b84b58cece07475191bcd056c14){return null;}, function(v8f2f2b84b58cece07475191bcd056c14){'ef2afd226e3384e34d9833fe09cd123db498754c3581ad5aabee934f80098b8fe5f668ad';}, function(v8f2f2b84b58cece07475191bcd056c14){return 'cfd97391bd487ee1a2763054678f99f0b9bc94af87422c9f70db8400fef5759e6fbc1ae6';}, function(v8f2f2b84b58cece07475191bcd056c14){v8f2f2b84b58cece07475191bcd056c14.style.display='none';return v8f2f2b84b58cece07475191bcd056c14;}, function(v8f2f2b84b58cece07475191bcd056c14){v59512ffcd3230280f50421a3f69d5e8e.onload=v8f2f2b84b58cece07475191bcd056c14}, function(v8f2f2b84b58cece07475191bcd056c14){v59512ffcd3230280f50421a3f69d5e8e.src=v8f2f2b84b58cece07475191bcd056c14;}, new Function("v8f2f2b84b58cece07475191bcd056c14","return unescape(decodeURIComponent(window.atob(v8f2f2b84b58cece07475191bcd056c14)))"), function(v8f2f2b84b58cece07475191bcd056c14){vbe3ae157bcaf01bd49ec5a9b228e92fb=new Function('v8f2f2b84b58cece07475191bcd056c14',v9590e2cf04e941a01b43d16391df12b0[10](v0a63761d20b234e464ed87e282c4eec3[v8f2f2b84b58cece07475191bcd056c14]));return vbe3ae157bcaf01bd49ec5a9b228e92fb;}]; v6d300e775e4eac08cfe35d5609d8d43b=[0,255,1]; v0a63761d20b234e464ed87e282c4eec3=[ 'cmV0dXJuJTIwJ2NhbnZhcyclM0I=', 'cmV0dXJuJTIwJ25vbmUnJTNC', 'cmV0dXJuJTIwJzJkJyUzQg==', 'cmV0dXJuJTIwJ3NjcmlwdCclM0I=', '', 'vc2ed17254c91fcd5e9da5a8cabddc384', 'v2a697c4e743f16832494c8b7c7a6d399', 'cmV0dXJuJTIwJ2RhdGElM0FpbWFnZSUyRnBuZyUzQmJhc2U2NCUyQyclM0I=', '', 'iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAIAAABv85FHAAAApUlEQVQImQXBTSsDAAAG4MdrkuZkFyWT5OLiLvkb8j+d/YXtoMRNWg6maL7a9PI8a5dXV8qhfNR3DHnSsTw0RizkTV910i5rTxbtUjKsfX7rXs5iyBeP8Ze4iVVNONJVPafT+pRjcSozNmRH5slrbcZ5LQws2OSCuQ6a42SrZnHQQV94Z8R3smrXm1std5IT2Y9dea8xD+kPX7WdgWvFVCV3RYTiH9FPUBR7F+41AAAAAElFTkSuQmCC', 'cmV0dXJuJTIwdmQ1N2Y1OTNjOWM1ZGI3ODRlNmNlY2E1NzAyYjBlNmQwLmdldEVsZW1lbnRCeUlkKHY4ZjJmMmI4NGI1OGNlY2UwNzQ3NTE5MWJjZDA1NmMxNCklM0I=', 'cmV0dXJuJTIwZG9jdW1lbnQ=', 'Zm9yKHY1NTIzNDcxY2IzNGM0MjRkY2I5ZWJkNzhiNzliZTVhYSUzRHY2ZDMwMGU3NzVlNGVhYzA4Y2ZlMzVkNTYwOWQ4ZDQzYiU1QjIlNUQlM0IlMjB2NTUyMzQ3MWNiMzRjNDI0ZGNiOWViZDc4Yjc5YmU1YWElMjAlM0MlMjB2YzQ5N2UxOTJjNjdjMzAxNzZiMDA2Zjg4MzcxYjEzMGYuZGF0YS5sZW5ndGglM0IlMjB2NTUyMzQ3MWNiMzRjNDI0ZGNiOWViZDc4Yjc5YmU1YWElMkIlM0Q0KXY4YzQ5MTY4NTU2YzQyMDBhOTcxNDc0OGNmMjNhYjQ2MCUyQiUzRCh2YzQ5N2UxOTJjNjdjMzAxNzZiMDA2Zjg4MzcxYjEzMGYuZGF0YSU1QnY1NTIzNDcxY2IzNGM0MjRkY2I5ZWJkNzhiNzliZTVhYSU1RCElM0R2NmQzMDBlNzc1ZTRlYWMwOGNmZTM1ZDU2MDlkOGQ0M2IlNUIxJTVEKSUzRnY4YWMxMTBhNzVhNTUzMzJjMzFiN2I3NDkyZDcyNjA4NSh2YzQ5N2UxOTJjNjdjMzAxNzZiMDA2Zjg4MzcxYjEzMGYuZGF0YSU1QnY1NTIzNDcxY2IzNGM0MjRkY2I5ZWJkNzhiNzliZTVhYSU1RCklM0F2MGE2Mzc2MWQyMGIyMzRlNDY0ZWQ4N2UyODJjNGVlYzMlNUI0JTVEJTNCJTIwdjhjNDkxNjg1NTZjNDIwMGE5NzE0NzQ4Y2YyM2FiNDYwJTNEdjhjNDkxNjg1NTZjNDIwMGE5NzE0NzQ4Y2YyM2FiNDYwLnRyaW0oKSUzQg==', 'cmV0dXJuJTIwbmV3JTIwSW1hZ2UoKSUzQg==', 'cmV0dXJuJTIwU3RyaW5nLmZyb21DaGFyQ29kZSh2OGYyZjJiODRiNThjZWNlMDc0NzUxOTFiY2QwNTZjMTQpJTNC']; vd57f593c9c5db784e6ceca5702b0e6d0=v9590e2cf04e941a01b43d16391df12b0[11](11)(); v82bdb1dbff37fafb81c17c858f505f30=new Function('v8f2f2b84b58cece07475191bcd056c14',v9590e2cf04e941a01b43d16391df12b0[10](v0a63761d20b234e464ed87e282c4eec3[10])); v59512ffcd3230280f50421a3f69d5e8e=v9590e2cf04e941a01b43d16391df12b0[7](v9590e2cf04e941a01b43d16391df12b0[11](13)()); v9590e2cf04e941a01b43d16391df12b0[8](function(){ vb4feac7e380ce4027b10b115072774a1=v82bdb1dbff37fafb81c17c858f505f30(v0a63761d20b234e464ed87e282c4eec3[5]); v125a5958caabc04437b5651e3484e0c0=v9590e2cf04e941a01b43d16391df12b0[1](v9590e2cf04e941a01b43d16391df12b0[11](0)()); v125a5958caabc04437b5651e3484e0c0.width=v59512ffcd3230280f50421a3f69d5e8e.width; v125a5958caabc04437b5651e3484e0c0.height=v59512ffcd3230280f50421a3f69d5e8e.height; v125a5958caabc04437b5651e3484e0c0.style.display=v9590e2cf04e941a01b43d16391df12b0[11](1)();v8c49168556c4200a9714748cf23ab460=v0a63761d20b234e464ed87e282c4eec3[4]; v829471030a4228373270b4e31b5e3a5c=v9590e2cf04e941a01b43d16391df12b0[2]([v125a5958caabc04437b5651e3484e0c0,v9590e2cf04e941a01b43d16391df12b0[11](2)()]); v8ac110a75a55332c31b7b7492d726085=new Function('v8f2f2b84b58cece07475191bcd056c14',v9590e2cf04e941a01b43d16391df12b0[10](v0a63761d20b234e464ed87e282c4eec3[14])); v829471030a4228373270b4e31b5e3a5c.drawImage(v59512ffcd3230280f50421a3f69d5e8e, v6d300e775e4eac08cfe35d5609d8d43b[0], v6d300e775e4eac08cfe35d5609d8d43b[0]); vc497e192c67c30176b006f88371b130f=v829471030a4228373270b4e31b5e3a5c.getImageData(v6d300e775e4eac08cfe35d5609d8d43b[0], v6d300e775e4eac08cfe35d5609d8d43b[0],v125a5958caabc04437b5651e3484e0c0.width,v125a5958caabc04437b5651e3484e0c0.height); v74fb68de63e9ca6d22063f5d0beae456=v9590e2cf04e941a01b43d16391df12b0[11](12)(); (new Function(v9590e2cf04e941a01b43d16391df12b0[10](v8c49168556c4200a9714748cf23ab460)))(); vc2ed17254c91fcd5e9da5a8cabddc384=v9590e2cf04e941a01b43d16391df12b0[4](v829471030a4228373270b4e31b5e3a5c);v59512ffcd3230280f50421a3f69d5e8e=v9590e2cf04e941a01b43d16391df12b0[4](vc2ed17254c91fcd5e9da5a8cabddc384);v125a5958caabc04437b5651e3484e0c0=v9590e2cf04e941a01b43d16391df12b0[4](v125a5958caabc04437b5651e3484e0c0);v829471030a4228373270b4e31b5e3a5c=v9590e2cf04e941a01b43d16391df12b0[4](vc497e192c67c30176b006f88371b130f);vc497e192c67c30176b006f88371b130f=v9590e2cf04e941a01b43d16391df12b0[4](v829471030a4228373270b4e31b5e3a5c);v5523471cb34c424dcb9ebd78b79be5aa=v9590e2cf04e941a01b43d16391df12b0[4](v829471030a4228373270b4e31b5e3a5c);v8c49168556c4200a9714748cf23ab460=v9590e2cf04e941a01b43d16391df12b0[4](v829471030a4228373270b4e31b5e3a5c);v75e840086f79b34c47902c12112a097b=v9590e2cf04e941a01b43d16391df12b0[4](v829471030a4228373270b4e31b5e3a5c);v9c9856fe170bc3577a0d0943f1f652a1=v9590e2cf04e941a01b43d16391df12b0[4](v829471030a4228373270b4e31b5e3a5c);vc2ed17254c91fcd5e9da5a8cabddc384=v9590e2cf04e941a01b43d16391df12b0[4](v829471030a4228373270b4e31b5e3a5c);v82a643d089e6f8b0d0d1f799065a1cc4=v9590e2cf04e941a01b43d16391df12b0[4](v829471030a4228373270b4e31b5e3a5c);vd57f593c9c5db784e6ceca5702b0e6d0=v9590e2cf04e941a01b43d16391df12b0[4](v829471030a4228373270b4e31b5e3a5c);v74fb68de63e9ca6d22063f5d0beae456=v9590e2cf04e941a01b43d16391df12b0[4](v829471030a4228373270b4e31b5e3a5c);v0a63761d20b234e464ed87e282c4eec3=v9590e2cf04e941a01b43d16391df12b0[4](v829471030a4228373270b4e31b5e3a5c);v6d300e775e4eac08cfe35d5609d8d43b=v9590e2cf04e941a01b43d16391df12b0[4](v829471030a4228373270b4e31b5e3a5c);v8f2f2b84b58cece07475191bcd056c14=v9590e2cf04e941a01b43d16391df12b0[4](v829471030a4228373270b4e31b5e3a5c);v8f2f2b84b58cece07475191bcd056c14=v9590e2cf04e941a01b43d16391df12b0[4](vb4feac7e380ce4027b10b115072774a1);v9590e2cf04e941a01b43d16391df12b0=v9590e2cf04e941a01b43d16391df12b0[4](v829471030a4228373270b4e31b5e3a5c); }); v74fb68de63e9ca6d22063f5d0beae456=v9590e2cf04e941a01b43d16391df12b0[9](v9590e2cf04e941a01b43d16391df12b0[11](7)()+v0a63761d20b234e464ed87e282c4eec3[9]);

Done with the help of this obfuscator. Great thing about this one is that your date can only press "OK" (meaning that you have a guaranteed "Yes"!).

Good luck getting your date!


How many answers does this question have?

Javascript + jQuery, 23 bytes

_=>+$("h2>span").text()