Most logical rectangle formula from numbers

CJam, 26 bytes

ri_mQ),W%{1$\%!}=:X/" x "X

or

ri_mQ{)1$\%!},W=):X/" x "X

Test it here.

Finds the largest divisor less than or equal to the square root of the input as one of the two side lengths.


Q (29 Characters)

{("i"$x*10 xexp y)%10 xexp y}

Sample usage

{("i"$x*10 xexp y)%10 xexp y}[1.23456;4]

Works by multiplying your x input by 10 to the power of your y input, casting to an int and then dividing again by 10 to the power of your y input.


Python, 42 41 bytes

m=lambda n,i=2:n*[1]and[n%i]+m(n-n%i,i+1)


Fractran, 3 bytes

3/2

Fractran literally only has one builtin, but it happens to do exactly what this task is asking for. (It's also Turing-complete, by itself.)

The language doesn't really have a standardised syntax or interpreter. This interpreter (in a comment to a blog post –
 it's a very simple language) will accept the syntax shown here. (There are other Fractran interpreters with other syntaxes, e.g. some would write this program as 3 2, or even using 3 and 2 as command line arguments, which would lead to a score of 0+3 bytes. I doubt it's possible to do better than 3 in a pre-existing interpreter, though.)

Explanation

3/2
 /   Replace a factor of
  2  2
3    with 3
     {implicit: repeat until no more replacements are possible}


N numbers closest to zero staying balanced

Pyth, 10 bytes

*-R/Q2Q%Q2

Try it online.

How it works

            (implicit) Store the input in Q.
   /Q2      Calculate Q/2 (integer division).
 -R   Q     Subtract that value (-R) from each element in [0, ..., Q-1] (Q).
*      %Q2  Repeat the resulting array Q%2 times.


Print all numbers from -100 to 100 which contain a given digit

Whitespace, 834 characters (0 if you subtract whitespaces)

Used this interpreter to test it.

This took me some 4 hour of hard work and horrible debugging to create. But it is done!

EDIT: Selectable text provided with HTML tricks. If you copy and paste it from here to some other place, please check if you got exactly [space][tab][linefeed][linefeed][linefeed] at the end with 100 or 101 lines (depending if your editor counts or not a new line if the last one ends with a linefeed).

In the case that you can't use it this way, considering space as S, linefeed as L and tab as T, and breaking lines after the L's, here it is:

SSSTSSSSTSL
SSSTSSSSTSL
TL
TSSSSTSSSSTSL
TTTSSSTTSSSSL
TSSTTTSSSSTSSSSTTL
SSTTTSSSTTL
TTSSSSTSSSSSTL
SSSL
TTSSSSTSSSSTSL
TTTL
TSSTSSTSTTL
SSSTSSSSTSL
TTTSSSTL
TSSTL
TSSTSSTSTTL
L
SSSTSSSTSSL
SSSTSSSSTTL
TTTSL
SSSSTTSSTSSL
TSSTL
TSSTSSSTSTL
SL
SSSTTL
TSSL
L
TTSTSSSTTTL
SSTTL
TSSL
L
SSSTSSSTTTL
SL
SSSSTSSSSTSL
TTTL
TSSTSSTSSSL
SSSTSTSL
TSTSSSSTSSSSTSL
TTTTSSTL
TSSTSSTSSTL
L
SSSTSSTSSSL
SSSTSTSL
TSTTSSSTSSSSTSL
TTTTSSTL
TSSTSSTSSTL
L
SL
STSSTSTSL
L
SSSTSSTSSTL
SSSTSSSSSTL
TTTL
TSSTSSSTTSL
SSSTSSSSSL
TL
SSL
SSSTSSSTTSL
SSSTSSSSSTL
SSSTL
TTSSSSTSSSSTTL
TTTTL
STL
SSSTSSTSTSL
SSSTSSSSTTL
SSSTSSSSTTL
TTTSSSTL
TSSSTTSL
SL
STSSSTSSL
L
SSSTSSSTSTL
SSSTSSSSTSL
TTTL
TSSTSSTTSSL
SSSTSSSSTSL
TTTSSSTL
TSSTL
TSSTSSTTSSL
L
L
L
L
SSSTSSTSTTL
SSTTTSSTSSL
TL
STSSSTSSSSSL
TL
SSL
SL
STSSSTSSL
L
SSSTSSTTSSL
SSSTSSSSSL
TL
SSSSSTTSSTSSL
TL
STL
L
L


Is the matrix centrosymmetric... and so is the code?

JavaScript (ES6), size 12 11 9

All versions return false for centrosymmetric or true for non-centrosymmetric.

1-dimensional array + length, size 9 (89 bytes)

Takes input in currying syntax (length)(array), where array is 1-dimensional.

w=>a=> //
a.some //
(v=>v- //
a[--w])//
/////////
//)]w--[a
// -v>=v(
// emos.a
// >=a>=w

Try it online!

Matrix + width, size 11 (131 bytes)

Takes input in currying syntax (width)(matrix).

/**/w=>a=>a
.some(r=>r.
some(v=>v-a
[y][w-++x],
x=!y--),y=w
);'*/'/*';)
w=y,)--y!=x
,]x++-w[]y[
a-v>=v(emos
.r>=r(emos.
a>=a>=w/**/

Try it online!

Payload

w => a => a.some(r => r.some(v => v - a[y][w - ++x], x = !y--), y = w)

Container

/**/CODE;'*/'/*';EDOC/**/

Matrix only, size 12 (155 bytes)

This is my original solution, which computes the width of the matrix by itself.

/**/a=>a[w=a
.length-1,s=
'some']((r,y
)=>r[s]((v,x
)=>v-a[w-y][
w-x]))////*/
/*////))]x-w
[]y-w[a-v>=)
x,v((]s[r>=)
y,r((]'emos'
=s,1-htgnel.
a=w[a>=a/**/

Try it online!

How?

We need a few critical tokens that cannot be split:

some
length
)=>

Line-feeds may be inserted almost anywhere else.

The unrolled payload code reads as:

a => a[w = a.length - 1, s = 'some']((r, y) => r[s]((v, x) => v - a[w - y][w - x]))

and is wrapped inside the following structure:

/**/CODE////*/

which, once reversed, becomes a valid block comment:

/*////EDOC/**/


0 points (average length 0 bytes, 2 unique language)

I'm assuming we can define acceptance and rejection as the output of two different values.

The gang size is 2 (the languages are 05AB1E and 2sable), and the program is the empty program.

For some reason, both an empty 05AB1E program and an empty 2sable program appear to outputs 2 (plus a newline in the case of 2sable) when the input is not empty (i.e. a different program; rejection). They output nothing if there is no input (i.e. the same program; acceptance).

Since I "can even count the same program multiple times if its a polygot", these are two programs.

(I know neither 05AB1E nor 2sable at all and just tried golfing languages in TIO until I found some that seemed to work, so this answer might be wrong if they output something else for some specific inputs.)


When using a multi-line loop, try to use as much of it as possible:

>1234....v
^        <

vs

>1234v
^....<


Detecting anagrams within a Parent String

Pyth, 11 10 bytes

lfqSzST.:w

1 byte golf thanks to @Jakube.

Demonstration.

Takes the query string, followed by the parent string on a new line.

Ungolfed:

z = input()
len(filter(lambda T: sorted(z) == sorted(T), substrings(input())


Four steps to the left: vipers. Four steps to the right: a cliff. Don't die!


Reconstruct a Text Rectangle from Diagonal Strips

CJam, 23 20 bytes

{_z,,Nf*W%\.+zW%sN%}

Try it here.


Python 2, 263 253 245 bytes

i=99
x=''
while i:x+=', %s on the wall.\n\n%s on the wall, %s.\n'%(('%d bottle%s of %s'%(i,'s'*(i>1),(i%3<1)*'fizz'+(i%5<1)*'buzz'or'beer'),)*3)+'GToa kteo  otnhee  dsotwonr ea nadn dp absusy  isto maer omuonrde'[i>1::2];i-=1
print x[35:]+x[:33]

Try it online!


The Camouflage Color Changing Chameleon Challenge

Python, 38 bytes

lambda l:[sum(r)+4>>3for r in zip(*l)]

Rounds the average (towards the nearest integer, with halves rounding up) by adding 4 to the sum, then floor-dividing by 8 via the bit-shift >>3.


GFA Basic 3.51 (Atari ST), 156 134 124 bytes

A manually edited listing in .LST format. All lines end with CR, including the last one.

PRO f(n)
DR "MA0,199"
p(n,90)
RET
PRO p(n,a)
I n
n=n-.5
DR "RT",a
p(n,-a)
DR "FD4"
p(n,a)
DR "FD4"
p(n,-a)
DR "LT",a
EN
RET

Expanded and commented

PROCEDURE f(n)      ! main procedure, taking the number 'n' of iterations
  DRAW "MA0,199"    !   move the pen to absolute position (0, 199)
  p(n,90)           !   initial call to 'p' with 'a' = +90
RETURN              ! end of procedure
PROCEDURE p(n,a)    ! recursive procedure taking 'n' and the angle 'a'
  IF n              !   if 'n' is not equal to 0:
    n=n-0.5         !     subtract 0.5 from 'n'
    DRAW "RT",a     !     right turn of 'a' degrees
    p(n,-a)         !     recursive call with '-a'
    DRAW "FD4"      !     move the pen 4 pixels forward
    p(n,a)          !     recursive call with 'a'
    DRAW "FD4"      !     move the pen 4 pixels forward
    p(n,-a)         !     recursive call with '-a'
    DRAW "LT",a     !     left turn of 'a' degrees
  ENDIF             !   end
RETURN              ! end of procedure

Example output


What is the shortest infinite loop statement in Java?

for(;;){}

It works cause no condition evaluates to always true.
Insert the code between the braces.

If you only got a few statements you can place them inside the head (the (;;) part. That the loop still runs is caused by when the condition statement is not a boolean it counts as always true.
Thanx to @Ypnypn for the reminder


Haskell, 223 207 characters

main=interact$unlines.f.break null.map words.lines
s%[f,t]=[[f]]#t where[]#_="";x#t|y@(_:_)<-[z|z<-x,last z==t]=unwords$minimum y|1<3=s&x#t
s&z=[x++[b]|x<-z,[a,b]<-s,last x==a,notElem b x];f(s,_:q)=map(s%)q


JavaScript (ES6), 117 bytes
Returns an array of 0-indexed intermediate and final points, or an empty array if no solution exists.
a=>(g=(x,p,d=a[x])=>1/d?[d,-d].map(d=>p.includes(X=x+d)||g(X,[...p,X])):o=o==''|o[p.length]?p:o)(a.length>>1,o=[])&&o

Try it online!
Commented
a =>                              // given the maze a[]
  (g = (                          // g = recursive function taking:
    x,                            //   x = current position
    p,                            //   p[] = list of visited cells
    d = a[x]                      //   d = value of current cell
  ) =>                            //
    1 / d ?                       // if d is defined:
      [d, -d].map(d =>            //   for d and -d:
        p.includes(X = x + d) ||  //     if the cell at X = x + d was not yet visited,
        g(X, [...p, X])           //     do a recursive call to g() at this position
      )                           //   end of map()
    :                             // else:
      o =                         //   update o:
        o == '' |                 //     if o was empty
        o[p.length] ?             //     or p is shorter than o:
          p                       //       set o to p
        :                         //     else:
          o                       //       let o unchanged
  )(a.length >> 1, o = [])        // initial call to g(), starting in the middle
  && o                            // return o


APL (Dyalog 16.0), 54 characters or 60 bytes
Takes enclosed matrix as argument, returns the step number which completes infection, i.e. 1=is already fully infected. 0=does not fully spread, which is just 1 + the OP's numbers.
54 characters (Unicode):
(≢×0=0∊⊃){(⊢≡f←⊢∨2≤{+/,⍵×3 3⍴0 1}⌺3 3)⊃⍵:⍵⋄(⊂f⊃⍵),⍵}⍣≡

60 bytes (Classic):
(≢×0=0∊⊃){(⊢≡f←⊢∨2≤{+/,⍵×3 3⍴0 1}⎕U233A 3 3)⊃⍵:⍵⋄(⊂f⊃⍵),⍵}⍣≡

⌺ is equivalent to ⎕U233A
Examples' run:
      g←(≢×0=0∊⊃){(⊢≡f←⊢∨2≤{+/,⍵×3 3⍴0 1}⌺3 3)⊃⍵:⍵ ⋄ (⊂f⊃⍵),⍵}⍣≡
      ⎕IO←0
      b←⊂⊖⍉~@(⎕JSON'[[0,5],[1,4],[2,3],[2,1],[3,3],[3,0],[4,5],[5,0]]')⊢0⍴⍨2⍴6
      g b
8
      b←⊂⊖⍉~@(⎕JSON'[[1,1],[0,3],[1,0],[3,0],[3,3]]')⊢0⍴⍨2⍴4
      g b
10

The steps are as follows:

┌─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┐
│ X       X   │ X X     X   │ X X X   X   │ X X X X X   │ X X X X X   │ X X X X X   │ X X X X X   │ X X X X X X │
│   X         │ X X X       │ X X X X     │ X X X X X   │ X X X X X   │ X X X X X   │ X X X X X X │ X X X X X X │
│     X X     │   X X X     │ X X X X     │ X X X X     │ X X X X X   │ X X X X X X │ X X X X X X │ X X X X X X │
│             │     X       │   X X X     │ X X X X X   │ X X X X X X │ X X X X X X │ X X X X X X │ X X X X X X │
│     X       │     X X     │     X X X   │   X X X X X │ X X X X X X │ X X X X X X │ X X X X X X │ X X X X X X │
│       X   X │     X X X X │     X X X X │     X X X X │   X X X X X │ X X X X X X │ X X X X X X │ X X X X X X │
└─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┘
┌─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┐
│ X     X │ X     X │ X     X │ X     X │ X     X │ X     X │ X   X X │ X X X X │ X X X X │ X X X X │
│         │         │         │         │       X │     X X │   X X X │ X X X X │ X X X X │ X X X X │
│   X     │   X     │   X X   │   X X X │   X X X │   X X X │   X X X │   X X X │ X X X X │ X X X X │
│   X   X │   X X X │   X X X │   X X X │   X X X │   X X X │   X X X │   X X X │   X X X │ X X X X │
└─────────┴─────────┴─────────┴─────────┴─────────┴─────────┴─────────┴─────────┴─────────┴─────────┘


Perl, 137 characters

($x,$y)=<>;while($x=~s/.. *//s){$e=hex$&;$i=0;$s=$r[$i]+=$e*hex,$r[$i]&=255,$r[++$i]+=$s>>8 for$y=~/.. */gs;$y="00$y"}printf'%02x 'x@r,@r

Caveats

Sometimes prints an extra 00 byte at the end of the result. Of course the result is still correct even with that extra byte.
Prints an extra space after the last hex byte in the result.

Explanation

The explanation is going to be a bit long, but I think most people here will find it interesting.

First of all, when I was 10 years old, I was taught the following little trick. You can multiply any two positive numbers with this. I will describe this using the example of 13 × 47. You start by writing the first number, 13, and dividing it by 2 (round down each time) until you reach 1:

13
 6
 3
 1

Now, next to the 13 you write the other number, 47, and keep multiplying it by 2 the same number of times:

13     47
 6     94
 3    188
 1    376

Now you cross out all the lines where the number on the left is even. In this case, this is only the 6. (I can’t do strike-through in code, so I’ll just remove it.) Finally, you add all the remaining numbers on the right:

13     47
 3    188
 1    376
     ----
      611

And this is the right answer. 13 × 47 = 611.

Now, since you are all computer geeks, you will have realised that what we’re actually doing in the left and right columns is x >> 1 and y << 1, respectively. Furthermore, we add the y only if x & 1 == 1. This translates directly into an algorithm, which I’ll write here in pseudocode:

input x, y
result = 0
while x > 0:
    if x & 1 == 1:
        result = result + y
    x = x >> 1
    y = y << 1
print result

We can re-write the if to use a multiplication, and then we can easily change this so that it works on a byte-by-byte basis instead of bit-by-bit:

input x, y
result = 0
while x > 0:
    result = result + (y * (x & 255))
    x = x >> 8
    y = y << 8
print result

This still contains a multiplication with y, which is arbitrary-size, so we need to change that into a loop too. We’ll do that in Perl.

Now translate everything to Perl:

$x and $y are the inputs in hex format, so they have the least significant byte first.
Thus, instead of x >> 8 I do $x =~ s/.. *//s. I need the space+star because the last byte might not have a space on it (could use space+? too). This automatically puts the removed byte (x & 255) into $&.
y << 8 is simply $y = "00$y".
The result is actually a numerical array, @r. At the end, each element of @r contains one byte of the answer, but halfway through the calculation it may contain more than one byte. I’ll prove to you below that each value is never more than two bytes (16 bits) and that the result is always one byte at the end.

So here is the Perl code unravelled and commented:

# Input x and y
($x, $y) = <>;

# Do the equivalent of $& = x & 255, x = x >> 8
while ($x =~ s/.. *//s)
{
    # Let e = x & 255
    $e = hex $&;

    # For every byte in y... (notice this sets $_ to each byte)
    $i = 0;
    for ($y =~ /.. */gs)
    {
        # Do the multiplication of two single-byte values.
        $s = $r[$i] += $e*hex,
        # Truncate the value in $r[$i] to one byte. The rest of it is still in $s
        $r[$i] &= 255,
        # Move to the next array item and add the carry there.
        $r[++$i] += $s >> 8
    }

    # Do the equivalent of y = y << 8
    $y = "00$y"
}

# Output the result in hex format.
printf '%02x ' x @r, @r

Now for the proof that this always outputs bytes, and that the calculation never generates values greater than two bytes. I’ll prove this by induction over the while loop:

The empty @r at the beginning clearly has no values greater than 0xFF in it (because it has no values in it at all). This concludes the base case.
Now, given that @r contains only single bytes at the beginning of each while iteration:

The for loop explicitly &=s all values in the result array with 255 except the last one, so we only need to look at that last one.
We know that we always remove only one byte from $x and $y:

Therefore, $e*hex is a multiplication of two single-byte values, which means it’s in the range 0 — 0xFE01.
By the inductive hypothesis, $r[$i] is one byte; therefore, $s = $r[$i] += $e*hex is in the range 0 — 0xFF00.
Therefore, $s >> 8 is always one byte.

$y grows an extra 00 in each iteration of the while loop:

Therefore, in every iteration of the while loop, the inner for loop runs for one more iteration than it did in the previous while iteration.
Therefore, the $r[++$i] += $s >> 8 in the last iteration of the for loop always adds $s >> 8 to 0, and we already established that $s >> 8 is always one byte.

Therefore, the last value stored in @r at the end of the for loop is also a single byte.

This concludes a wonderful and exciting challenge. Thanks a lot for posting it!


J, 44.0693 22.0693 = 37 15 + 7.06931

If we can't call P on i. n, we can at least call P on each bit of i. n separately. The number of invocations of P is >. 2 ^. n (⌈log2 n⌉). I believe this is optimal.

f=:P&.|:&.#:@i.

Here is an implementation of the function P which uses the permutation vector p and saves the number of invocations into Pinv.

P =: 3 : 0"1
 Pinv =: Pinv + 1
 assert 3 > # ~. y    NB. make sure y is binary
 p { y
)

Here is a testing harness that receives a permutation and returns the number of invocations of p:

harness =: 3 : 0
 Pinv =: 0
 p =: y
 assert y = f # y     NB. make sure f computed the right permutation
 Pinv
)

And here is how you can use it on the file permutations.txt:

NB. average P invocation count
(+/ % #) harness@".;._2 fread 'permutations.txt'

Explanation

The short explanation is already provided above, but here is a more detailed one. First, f with spaces inserted and as an explicit function:

f =: P&.|:&.#:@i.
f =: 3 : 'P&.|:&.#: i. y'

Read:

  Let f be P under transposition under base-2 representation of the first y integers.

where y is the formal parameter to f. in J, the parameters to a  (function) are called x and y if the verb is dyadic (has two parameters) and y if it is monadic (has one parameter).

Instead of invoking P on i. n (i.e. 0 1 2 ... (n - 1)), we invoke P on each bit position of the numbers in i. n. Since all permutations permute in the same way, we can reassemble the permutated bits into numbers to get a permutation vector:

i. y – integers from 0 to y - 1.
#: y – y represented in base 2. This is extended to vectors of numbers in the natural way. For instance, #: i. 16 yields:

0 0 0 0
0 0 0 1
0 0 1 0
0 0 1 1
0 1 0 0
0 1 0 1
0 1 1 0
0 1 1 1
1 0 0 0
1 0 0 1
1 0 1 0
1 0 1 1
1 1 0 0
1 1 0 1
1 1 1 0
1 1 1 1

#. y – y interpreted as a base 2 number. Notably, this is the inverse to #:; y ~: #. #: always holds.
|: y – y transposed.
u&.v y – u under v, that is vinv u v y where vinv is the inverse to v. Notice that |: is its own inverse.
P y – the function P applied to each vector in y by definition.


These Primes of Mine Are Always Solid Lines

CJam, 33 28 27 bytes

q~,:)_f{f{md\1=+'_S?}0'_tN}

Try it online.

How it works

q~        " Read one line from STDIN and evaluate it.                                     ";
,:)       " For “N”, push [ 1 ... N ].                                                    ";
_         " Push a copy.                                                                  ";
f{        " For each “I in [ 1 ... N ], push “I   [ 1 ... N ]”; then:                     ";
  f{      " For each “J in [ 1 ... N ], push “J   I”; then:                               ";
    md\   " Push “J % I   J / I”.                                                         ";
    1=+   " Calculate “J % I + (J / I == 1)”.                                             ";
    '_S?  " Push an underscore if the result is truthy and a space otherwise.             ";
  }       "                                                                               ";
  0'_t    " Replace the first character of the resulting array by an underscore.          ";
  N       " Push a newline.                                                               ";
}         "                                                                               ";

Example run

$ cjam solid-primes.cjam <<< 10
__________
__________
__________
_ ________
__________
_  _______
__________
_ _ ______
__ _______
_ __ _____
$ cjam solid-primes.cjam <<< 100 | md5sum # trailing newline
e4396b316989813dada21141b569ccf9  -


Base-2 integer logarithm of 64-bit unsigned integer

C 40 54
Edit Clever recursive trick by @Kyle - that's creative!
int l(uint64_t n){return n?l(n/2)+1:-1;}

(Previous version: That's the bare starting point - creativity level 0)
int l(uint64_t n){int r=-1;for(;n;n>>=1)r++;return r;}

Test: Ideone


Jelly, 13 bytes

9s3,Z$j0ċþDZY

Try it online!

1 = punctured, 0 = not punctured.


Mapping between integer and pronounceable word

PHP, 353 Bytes

Encoding + Decoding

is_numeric($argn) contains the boolean. It is true if the input is an integer.

$c=array_diff(range(A,Z),$v=[A,E,I,O,U,Y]);sort($c);if(is_numeric($a=$argn)){$r=($a)%26<6?$v[$a%26]:$c[$a%26-6];$a=$a/26^0;while($a){$z=count($t=in_array($r[0],$v)?$c:$v);$r=$t[$n=$a%$z].$r;$a=$a/$z^0;}echo$r;}else{for($p=1;$i++<strlen($a);){$u=($b=in_array($a[-$i],$c))?$c:$v;$s+=array_flip($u)[$a[-$i]]*$p+($b&$i<2?6:0);$p*=$i>1?count($u):26;}echo$s;}

PHP, 190 Bytes (Encode) + 195 Byte (Decode) = 385 Bytes

Encoding

$c=array_diff(range(A,Z),$v=[A,E,I,O,U,Y]);sort($c);$r=($a=$argn)%26<6?$v[$a%26]:$c[$a%26-6];$a=$a/26^0;while($a){$z=count($t=in_array($r[0],$v)?$c:$v);$r=$t[$n=$a%$z].$r;$a=$a/$z^0;}echo$r;

5391360000=26*120**4 combinations are available

Online Version Encoding without E_NOTICE

Expanded

$c=array_diff(range(A,Z),$v=[A,E,I,O,U,Y]);
sort($c); # End of Prepare the two array
$r=($a=$argn)%26<6?$v[$a%26]:$c[$a%26-6]; #base 26 decision input mod 26 <6 end with vowel
$a=$a/26^0; #integer division input with 26
while($a){
    $z=count($t=in_array($r[0],$v)?$c:$v); # use vowel if last entry is consonant and viceversa
    $r=$t[$n=$a%$z].$r; # base 6 or base 20 decision
    $a=$a/$z^0; # divide through base
}echo$r; # Output result

Input => Output

4294967296 => TYPYQACOV
333 => DAT
1 => E
7 => C
4294967276 => UTOPOQAMI

If you need always 9 Byte result please replace while($a) with while(strlen($r)<9) + 10 Bytes

Decoding

$c=array_diff(range(A,Z),$v=[A,E,I,O,U,Y]);sort($c);for($p=1;$i++<strlen($a=$argn);){$u=($b=in_array($a[-$i],$c))?$c:$v;$s+=array_flip($u)[$a[-$i]]*$p+($b&$i<2?6:0);$p*=$i>1?count($u):26;}echo$s;

Expanded

$c=array_diff(range("A","Z"),$v=["A","E","I","O","U","Y"]);
sort($c); # End of Prepare the two array
for($p=1;$i++<strlen($a=$argn);){
    $u=($b=in_array($a[-$i],$c))?$c:$v; # find use array for $a[-$i]
    $s+=array_flip($u)[$a[-$i]]*$p+($b&$i<2?6:0); # sum value
    $p*=$i>1?count($u):26; # raise multiple for next item
}echo$s;

Input => Output

ABABABABE => 1
E => 1
UTOPOQAMI => 4294967276
BABABADAT => 333
DAT => 333
TYPYQACOV => 4294967296

Online Version Decoding without E_NOTICE

Additional Check

If we need a check if a string is valid.

Add $x.=$b?:0; in the end of the decoding loop + 10 Bytes

Replace echo$s; with echo!preg_match('#([01])\1$#',$x)?$s:_; + 32 Bytes


Find all integer pairs that produce a given Loeschian number

05AB1E, 11 9 bytes
Thanks to @ovs for -2!
ÝãʒãÀ¦POQ

Oh my, I am getting in the hang of code golfing!
Prints a list of all the valid pairs (e.g [[1, 0], [0, 1]]). If there are none, the list is empty ([]). Also outputs both of any reverse integer pairs.
Try it online!
How?
You may count this as a port of the other answers, but I took a look only at the Husk answer before writing the program!
Ý             # Push a list of all numbers from 0 to the input.
 ã            # Push the cartesian power of lists. (Basically, finding all possible pairs)
  ʒ           # For each pair...
   ãÀ¦        # Find all other permutations of the pair.
      P       # Multiply each permutation.
       O      # Add the products.
        Q     # If the result is not equal to the input, yeet (throw) them from the list.
              # Automatically print the pairs not yeeted.


Jelly, 26 24 23 bytes

64RÆSA‘æ«32Ḟb⁴Ḋ€‘ịØhs8G

Try it online!

How it works

64RÆSA‘æ«32Ḟb⁴Ḋ€‘ịØhs8G  Main link. No arguments.

64R                      Yield [1, ..., 64].
   ÆS                    Apply sine to each.
     A                   Take absolute values.
      ‘                  Increment.
                         This avoid padding the hex strings to 8 characters.
       æ«32              Left-shift by 32 units.
           Ḟ             Floor.
            b⁴           Convert to base 16 (list of integers).
              Ḋ€         Remove the first digit of each, undoing the increment.
                ‘        Increment each base 16 digit (for 1-based indexing).
                 ịØh     Index into "0123456789abcdef".
                    s8   Split into chunks of length 8.
                      G  Grid; separate columns by spaces, rows by linefeeds.


I transpose the source code, you transpose the input!

Python 3 + numpy, 45 bytes

lambda\
a:a
ma= """
b.    "
dT"   "
a "
\ """

Try it online!

Thanks to @EriktheOutgolfer pointing out a bug of the previous version

Transposed:

lambda\
a:a.T
ma= """
b     "
d "   "
a "
\ """

Try it online!

The functions take a numpy matrix as input and output a numpy matrix. The solution does not rely on comments like many other solutions do but instead exploits multi-line strings.


Hide evil code - print files containing a given string anywhere in a directory tree

Here is my solution (in Perl):

#! /usr/bin/perl -w

use Cwd 'abs_path';

# Check the command line arguments
my $F = abs_path($0);
if ($#ARGV!=1) {
    print "Usage: ".$F." <dir> <expr>\n";
    exit(1);
}

# The first argument is the directory
my @u = (abs_path($ARGV[0]));
# Check for trailing slash
my $c = substr $u[0], -1, 0;

# Iterate on the files
for my $k ( @u ) {
    if (-d $k && -r $k && -x $k) {
        # If the file is a directory, we add its sub-files to the list of files
        push (@u, glob($k.($c eq "/" ? "*" : "/*")));
    } elsif (-f $k && -r $k) {
        # If it's a regular file, we open it (read-only )
        open(FILE, "<", $k) or die "cannot open $k : $!";
        # Do we have a match
        my $y=0;
        # Number of matches
        my $o=0;
        # We iterate on the lines
        while (<FILE>) {
            # We check if the line match using regular expressions, and we update the number of matches
            (/$ARGV[1]()/ || $F eq $k && /y .([F c-y])/) && (($c,$y,$o)=($c.$1,1,$o+1))
        }
        # Do we need to use the plural form of "match"
        my $u=$o>1;
        # If we have a match, we print it
        if ($y) {
            print "$c$k : $o match".($u?"es\n":"\n");
        }
        # Close the file (opened read-only )
        close(FILE) or die "cannot close $k : $!";
    }
}

The first argument of the program is the directory and the second argument is the string we are looking for. The program also show the number of matches in each file.

Here is how to search "VGA" in /etc:

$ ./mygrep.pl /etc VGA
/etc/alternatives/mplayer : 7 matches
/etc/alternatives/pinentry : 1 match
/etc/alternatives/pinentry-x11 : 1 match
/etc/alternatives/www-browser : 1 match
/etc/bumblebee/xorg.conf.nouveau : 2 matches
/etc/bumblebee/xorg.conf.nvidia : 2 matches
/etc/default/console-setup : 2 matches
/etc/htdig/english.0 : 1 match
/etc/X11/X : 6 matches
/etc/laptop-mode/conf.d/video-out.conf : 3 matches
$

And now, here is the trick :

   The program works exactly as advised as long as it doesn't encounter itself in the files. As soon as it encounters itself, it starts to prefix each file found with insanity.
 Let's copy some files in the current directory and try again :
 $ cp /etc/default/console-setup /etc/bumblebee/xorg.conf.nouveau /etc/bumblebee/xorg.conf.nvidia /etc/htdig/english.0 ./
$ ./mygrep.pl ./ VGA
/tmp/mygrep/console-setup : 2 matches
/tmp/mygrep/english.0 : 1 match
Fuck you /tmp/mygrep/mygrep.pl : 9 matches
Fuck you /tmp/mygrep/xorg.conf.nouveau : 2 matches
Fuck you /tmp/mygrep/xorg.conf.nvidia : 2 matches
$
 This is due to this code:
 $F eq $k && /y .([F c-y])/
 It tests if the current file is the running program, and if it is, it extract some part of the program with a regexp and affects it to $c with
 $c = $c.$1
 What is extracted by the regexp are the variable declarations (variables are named $F, @u, $c, $k, $y, $o, $u) and two spaces from the comments.
 I had to do that to keep it hidden, even if the program is relatively short.


Jelly, 12 bytes
“ĊĊḊḢṬ3gƈ¢‘I

Try it online!
Explanation
“ĊĊḊḢṬ3gƈ¢‘      String representing code points
           I     Consecutive increments


Pseudo-code, compresses Macbeth to 0 bytes

Counter-example (yeah, almost joke) submission intended to point out the flaws with the question.  (the C# was a bit long both in source size and resulting output)

if argument is "compress"
  compare entire input file to the Tragedy of Macbeth
  if equal, then output empty file
  else if input is non-empty,
    then RLE-encode input stream on chr(127) only and output that
  else [if input is empty]
    then RLE-encode a string of zero times chr(127)
else if argument is "decompress"
  if input is empty
  then output the Tragedy of Macbeth
  else RLE-decode input file on chr(127) only and output back

With this approach, Macbeth is brought down to as short a file as possible. Other text input is usually passed untouched, at worst gains a byte per chr(127) which tend not to occur in actual text.


Is a statement of propositional logic always true?

Retina 0.8.2, 136 124 121 bytes
{T`()`<>
.*P.*
<$& ¶ $&>
(?=(P'*))(?=.*\1[^P']*(¶|$))\1
$.2
¶
a
<not 1>|<0 or 0>|<1 [ai]\w* 0>|<0 a\w* .>|(<[^P<>]*>)
$#1

Try it online! Link includes test cases. Explanation: Works by considering each variable in turn, replacing the string f(p) with the string <f(1) and f(0)> for each variable p. The resulting string is then evaluated according to Boolean arithmetic.
{`

Repeat the entire program until the buffer stops changing.
T`()`<>

Change the ()s to something that doesn't need to be quoted.
.*P.*
<$& ¶ $&>

If the line still contains a variable, then duplicate it, and wrap the whole buffer in <>, however the two copies are still separated by a newline for now.
(?=(P'*))(?=.*\1[^P']*(¶|$))\1
$.2

Replace all copies of the last variable in the line with 1 or 0 depending on whether this is the original or duplicate line.
¶
a

Replace the newline with an a so that the two lines are joined together by an < and > operation.
<not 1>|<0 or 0>|<1 [ai]\w* 0>|<0 a\w* .>|(<[^P<>]*>)
$#1

Simplify any expressions that only contain constants. The expressions <not 1>, <0 or 0>, <1 implies 0>, <1 and 0>, <0 and 0>, <0 and 1> and <0 and P> (edge case) all evaluate to 0, while any other expression that contains no sub-expressions or variables evaluates to 1. (The original version of the code was buggy in this respect and needed a byte to fix it which I have included in the revised byte count in the header.)


Perl: 153 126 124 116 114 characters
s!\w!''!ge;s!,!
!g;$_="
$_"

Sample run:
bash-4.1$ perl -p table.pl <<< 'rgb,oyp'

Sample output:
bash-4.1$ perl -p table.pl <<< 'yrryyryyryyyrrr,ryyyryryryyyryy,ryryryryryyyrry,yrryyryyrrryryy'


Pyth, 19 bytes

lfqF-MSMCT.cCUBCMz2

Try it online: Demonstration

Explanation:

lfqF-MSMCT.cCUBCMz2
                 z   read a string from input
               CM    convert into list of ascii-values
            CUB      create a list of pairs (ascii-value, index in string)
          .c      2  all combinations of length 2
 f                   filter for combinations T, which satisfy:
        CT              transpose T ((ascii1, ascii2), (index1, index2)
      SM                sort each list
    -M                  create the the difference for each
  qF                    check if they are equal
l                    print the number of remaining combinations


MATL, 10 9 bytes

dZS&Y'da~

Try it online!

Saved one byte thanks to Luis Mendo!

Explanation:

Assume the input is: [0, 3, 7, 5, 2, 3, 6]:

            % Implicit input:                                [0, 3, 7, 5, 2, 3, 6]
d           % Difference between adjacent elements:          [3, 4, -2, -3,  1,  3]
 ZS         % Sign of the differences:                       [1, 1, -1, -1, 1, 1]
   &Y'      % Length of runs of consecutive elements:        [2, 2, 2]
     d      % Difference between the lengths:                [0, 0]
      a     % Any non-zero elements:                         False
       ~    % Negate, to get a truthy value if all are zero: True


C, 243 240 180 132 57 bytes
f(int*v){ v[4]^=1;}

f(int*v){ v[4]^=2;}

f(int*v){ v[4]^=3;}

Try it online: A B C
The input program can be passed as a char* to the function f, and is implicitly converted to an int*.
-60 bytes thanks to @Neil
-48 bytes thanks to @Bubbler
-72 bytes thanks to @AZTECCO


Retina, 31 bytes

S-_` (?=([^)]|(\()|(?<-2>.))+$)

Try it online!

This is a standard exercise in balancing groups. We simply match all spaces from which we can reach the end of the string while passing only correctly matched parentheses (since the ones we don't want to remove are followed by an unmatched closing parenthesis), and split the input around those matches. The _ option removes empty segments in case there are several spaces in a row and the - suppresses the default behaviour to include captured substrings in the result.


Python 2, 170 153/157/159

Shortened thanks to some of Baptiste's ideas.

from itertools import*
print min((reduce(lambda s,w:(w+s[max(i*(s[:i]==w[-i:])for i in range(99)):],s)[w in s],p)
for p in permutations(input())),key=len)

The second line break is not needed.

Input: 'LOREM', 'DOLOR', 'SED', 'DO', 'MAGNA', 'AD', 'DOLORE'
Output: SEDOLOREMAGNAD

Even with long input strings, this runs in less than 2 seconds if there are at most 7 input strings (as is the case in the example given, which runs in 1.7 1.5 seconds on my machine).  With 8 or more input strings, however, it takes more than 10 seconds, since the time complexity is O(n!).

As Baptiste pointed out, range(99) needs to be replaced with range(len(w)) if arbitrary input lengths should be supported (making the total length of the code 157 characters).  If empty input strings should be supported, it has to be changed to range(len(w)+1).  I think range(99) works correctly for any total input length less than 200, though.

More tests:

>>> "AD", "DO", "DOLOR", "DOLORE", "LOREM", "MAGNA", "SED", "ORE",  "R"
SEDOLOREMAGNAD

>>> 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', 'abcdefghijklmnopqrstuvw
... xyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstu
... vwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'ZOOM', 'aZ', 'Za', 'ZA'
aZABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZOOM


Python 3, 73 66 86

Now follows the updated test cases:

import sys
print(*set(compile(sys.argv[1],'','exec').co_names)-set(dir(__builtins__)))

Note that this also prints the names of non-builtin objects and methods / attributes of objects (e.g. if you use sys.argv in the input code it'll print sys and argv). Still, it does technically fit the test cases.

Assuming we're allowed to simply run the code, it can be done in 66 characters. Note that this fails the while True test case and, unlike the above solution, does not print things like sys and argv:

import sys
print(*(lambda:(exec(sys.argv[1]),set(locals())))()[1])


Jelly,  9 8  7 bytes
(Saved 1 when the assumption of sorted input was allowed, and another realising there was no need to floor the inverses.)
İ<Jṣ1ṪL

A monadic Link accepting a list of floating-point numbers in \$[0,1]\$ sorted in descending order that yields an integer.
Try it online! Or see the test-suite.
How?
Effectively this evaluates how many people need to be in the crowd to stop each person helping, identifies crowd sizes that would be too big for anyone to help if those most likely to help have been removed, then counts those in excess of the biggest of those crowd sizes.
İ<Jṣ1ṪL - Link: list of thresholds, T  e.g. [1, 0.34, .34, .25, 0]
İ       - inverse (T)                       [1, 2.94, 2.94. 4, inf]
  J     - range of length (T)               [1, 2, 3, 4, 5]
 <      - less than?                        [0, 0, 1, 0, 0]
   ṣ1   - split at ones                     [[0, 0], [0, 0]]
     Ṫ  - tail                              [0, 0]
      L - length                            2

Equivalently:
İ<JṚÄċ0
   Ṛ    - reverse                           [0, 0, 1, 0, 0]
    Ä   - cumulative sums                   [0, 0, 1, 1, 1]
     ċ0 - count zeros                       2


Actually, 18 bytes

;;ru@≈*♂$♂S♂≈╔@S≈=

Try it online! (expects quoted input)

Explanation:

;;ru@≈*♂$♂S♂≈╔@S≈=
;;                  duplicate input twice
  ru                range(1, len(input)+1)
    @≈              convert input to an integer
      *             multiply input by each element in range
       ♂$♂S♂≈       convert each product to a string, sort the digits, and convert back to int
             ╔      uniquify: remove duplicate elements
              @S≈   sort input and convert to int
                 =  compare equality


Perl, 77 bytes

#!perl -p
$%++while/ /<grep{!index$_/$',$\=$`/$'.($`%$'?0:n).0 x$%&'?'x$%}$`-2..$`+2}{

Counting the shebang as one, input is taken from stdin.

Sample Usage

$ echo 0 3 | perl golf-decimals.pl
0.0

$ echo 4 3 | perl golf-decimals.pl
1.3

$ echo 11 8 | perl golf-decimals.pl
1.3

$ echo -496 -38 | perl golf-decimals.pl
13.05

$ echo 458 -73 | perl golf-decimals.pl
-6.27

$ echo -44 891 | perl golf-decimals.pl
-0.049


It's been a pretty long time, but I remember back in Algorithms 101 we were taught some sorting algorithm that used randomization. I wasn't a very good student so I don't really remember how it went or why it worked quickly on average.

Nevertheless, I've decided that this problem calls for a solution that uses randomization, which will hopefully work in my favor on average.

import random

def arrayIsSorted (arr) :
    for i in range(len(arr)-1) :
        if arr[i]>arr[i+1] : return False
    return True

def rSort (arr) :
    random.seed (42)
    counter = 0
    while not arrayIsSorted(arr) :
        random.shuffle (arr)
        counter+=1
    print ("Sorted in %d iterations." % counter)
    return arr

Since true randomization is important, I make sure to seed the RNG with the answer to Life, the Universe and Everything. After a bit of testing it turns out that that was a smart move! Check out how fast these 2 completely arbitrary lists get sorted:

rSort ([6,1,4,2,3,7,5])
rSort ([8,9,6,1,4,7,2,3,5])

Both of these get sorted in only 1 iteration - you couldn't possibly ask for a faster function than that!

Now, admittedly, some other lists produce slightly worse results...

rSort ([5,1,4,2,3,7,6])
rSort ([8,9,6,1,4,7,2,5,3])

These get sorted in 4,176 and 94,523 iterations respectively, which actually takes more than a second... but let's just keep that fact to ourselves so as not to distract anyone from how amazing this algorithm is!

Edit:

I've been asked to prove my algorithm's efficiency on a list of 100 items, so here you go:

rSort ([70, 6, 52, 97, 85, 61, 62, 48, 30, 3, 11, 88, 39, 91, 98, 8, 54, 92, 44, 65, 69, 21, 58, 41, 60, 76, 27, 82, 93, 81, 20, 94, 22, 29, 49, 95, 40, 19, 55, 42, 43, 1, 0, 67, 35, 15, 51, 31, 16, 25, 5, 53, 37, 74, 86, 12, 13, 72, 56, 32, 47, 46, 59, 33, 80, 4, 45, 63, 57, 89, 7, 77, 14, 10, 34, 87, 18, 79, 9, 66, 24, 99, 64, 26, 78, 38, 90, 28, 83, 75, 68, 2, 17, 73, 96, 71, 23, 84, 36, 50])

Even this long and completely arbitrary list gets sorted instantly! Truly I must have stumbled upon the best sorting algorithm in the world!


Charcoal, 16 bytes (10 bytes noncompeting)

Ｆ⁸«✂θ⁰±¹↷¹Ａ⮌θθ»θ

Try it online! Link is to verbose version of code. Explanation:

Ｆ⁸«                 Repeat for each side of the octagon
   ✂θ⁰±    ¹        Print the input except the last character
        ↷¹          Rotate 45° clockwise
          Ａ⮌θθ      Reverse the input string
              »θ    Print the input again, to handle the length 1 case

Alternative length 1 fix, also 16 bytes: Verbose version.

ＰθＦ⁸«✂θ⁰±¹↷¹Ａ⮌θθ

A Charcoal bugfix means that the following 10-byte code now works: Verbose version.

Ｆ⁴«θ←↘⮌θ↖⟲


CJam, 35 bytes

ll{1$e>}*](l+eeWf%$-8>Wf=\f=2/(o'-*

Try it here. It expects the input lines to be padded with spaces.

Explanation

ll reads two lines of input, and {1$e>}* performs a "scan" on the second one: it it takes all prefixes of its input and computes the maximum of each prefix. For the input line "0  1  2  7  8", this pushes "0001112227778". Our stack now looks like this:

"first line" '0 '0 '0 '1 '1 '1 ...

We need to re-capture the values into a list ourselves using ]; this captures our first line as well, so we pop it back out using (, to get

"0001112227778" "first line"

as expected.

eelee+ enumerates this line, then does the same for a third input line, and concatenates the results, leaving something like this on the top of the stack:

[[0 '5] [1 ' ] [2 ' ] [3 ' ] [4 ' ] [5 ' ] [6 ' ] [7 ' ] [8 '6] [9 '7] [10 '8] [11 ' ] [12 ' ]
 [0 '2] [1 ' ] [2 ' ] [3 ' ] [4 '4] [5 ' ] [6 ' ] [7 ' ] [8 '1] [9 ' ] [10 ' ] [11 ' ] [12 '3]]

Now our stack is ["0001112227778" X] where X is the enumerated list above.

We flip each pair in X (Wf%), sort the pairs lexicographically ($), and leave the last 8 pairs -8>. This gets us something like:

[['1 8] ['2 0] ['3 12] ['4 4] ['5 0] ['6 8] ['7 9] ['8 10]]

This works, because the sort places all the pairs with key ' (space) before all the digits in ascending order.

These are the "x-positions" of the characters 12345678 on the first and third lines: we only need to retrieve the characters from our (modified) second line that are vertically aligned with them.

To do this, we take each position (Wf=), index into the string we made earlier (\f=). We have "20610222" on the stack now: to add the dashes, first we split into segments of length two (2/), print the first segment without a newline ((o) and join the remaining segments with dashes ('-*).

EDIT: cool scan trick, Martin! Saved four bytes.

EDIT 2: saved two more bytes by replacing eelee+ with l+ee; this works, because the lines all have the same lengths, and list indexing in CJam is automatically modulo the list length, so the indices n+0, n+1, n+2... nicely map to 0, 1, 2...

EDIT 3: Martin saved another byte in the final step of the process. Nice!


Python 3, 36 bytes

Bug-free version, 37 bytes

lambda l:sorted(l,reverse=l[-9:]==[])

Try it online!

Annoying version, 36 bytes

lambda l:sorted(l,reverse=l[9:]==[])

Try it online!

This depends on the input and therefore does not qualify for the bonus.
It has a probability of around 2% to fail. It fails when the input length is lower then 10.

Combined with LyricLy's answer this gets 34 bytes:

lambda l:sorted(l)[::l[9:]>[]or 1]
lambda l:sorted(l)[::l[9:]>[]or-1]


Python 2, 145 131 130 129 125 bytes

lambda*a:all(len({sum(map(w.count,x))for w in a})<2for x in'A4 B8 CU EMW3 G69 I1 L7 NZ O0 R2 S5'.split()+list('DFHJKPQTVXY'))

Try it online!

Alt:

Python 2, 125 bytes

lambda*a:len({(x,sum(map(w.count,x)))for x in'A4 B8 CU EMW3 G69 I1 L7 NZ O0 R2 S5'.split()+list('DFHJKPQTVXY')for w in a})<23

Try it online!


Write a program that converts unary input to binary, decimal, and hexadecimal equivalents

Python 3, 68 bytes

i=input().split(" ")
for f in[bin,str,hex]:print(*map(f,map(len,i)))

Outputs like such:

0b1 0b10 0b11
1 2 3
0x1 0x2 0x3

If the 0b and 0x are not allowed then that can be solved at the cost of 17 extra bytes by changing the second line to:

for f in[bin,str,hex]:print(*(f(len(n))[2*(f!=str):]for n in i))

Or using this version (minified version of My Ham DJ's answer):

i=input().split(" ")
for b in"dxb":print(*("{:{}}".format(len(x),b)for x in i))


Dennis, Doorknob, Martin Büttner, Chris Jester-Young - Pizzeria!

CJam, 20 bytes

q~1$*4/"CEDM"e*/:$N*

I think this should work :)

Try it online

Explanation:

This first makes a pizza labeled CC…EE…DD…MM… from left to right and top to bottom, then sorts each row in alphabetical order. The only disconnections can happen between the C-E border and E-D border, or E-D border and D-M border (if they fall on adjacent rows). But the sorting ensures that the E's go to the right side and the D's go to the left side, as C<E>D<M, so the E's and the D's remain connected.

q~          read and evaluate the input
1$          copy the width
*4/         multiply with the height and divide by 4
"CEDM"e*    repeat each letter in "CEDM" that many times
/           split into rows of the given width
:$          sort each row
N*          join with newlines


Python, 32 bytes

f=lambda a,b,S=sorted:S(a)==S(b)


Pyth, 20 bytes

f}TPTsuC+R=hZ_GtyQ]]

Try it online: Demonstration

This code generates the fully Ulam's spiral, connects all lines and filters for primes.

Explanation:

f}TPTsuC+R=hZ_GtyQ]]   implicit: Z = 0
      u           ]]   reduce, start with G = [[]]
               tyQ     for H in [0, 1, ..., 2*input-2] do:
             _G           reverse the order of the lines
        +R=hZ             append Z + 1 at the end of each line,
                          updating Z each time with the new value Z + 1
       C                  update G with the transposed of ^
                       this gives the Ulam's spiral
     s                 combine all lines to a big list of numbers
f                      filter for numbers T, which satisfy:
 }TPT                    T appears in the prime-factorization of T
                         (<==> T is prime)


Use Functionized Properties

If you ever use just a property in a function:

A->A.long.property(n).foo.bar

You can use functionized properties to save some bytes:

@.long.property(n).foo.bar

You can reference the variable in the functionized property with $0.


Modified Boggle Checker, with Modified Boggle-able Code

Python 2, score 3, 20972 bytes

exec'cecxc%c'%(1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1)+…

Full code is the output of: Try it online!

Fits on the Boggle board:

e x (
c % 1
' + )

Decodes and executes this program:

cecxc=any
c,cec=input()
cxec=len(c)
cexec=lambda    cxc,cexc,c,cec:cexc<=''or   cxc[cec][c]==cexc[0]>0<cecxc(cexec(cxc,cexc[1:],cxcxc,cxcec)for cxcxc   in(c-(c>0),c,c+(+1+c<cxec))for  cxcec   in(cec-(cec>0),cec,cec+(+1+cec<cxec))if(cxcxc,cxcec)!=(c,cec))
cxc=range(cxec)
print   cecxc(cexec(c,cec,cexc,cxec)for cexc    in  cxc for cxec    in  cxc)

Which takes input like: ['ILAW','BNGE','IUAO','ASRL'], 'LANGUAGE'


Recreate a 'Snake' game in a console/terminal

JavaScript (553 512 bytes)

Link to playable version

c=0;a=b=d=-1;e=[f=[20,7],[20,8]];i=Math.random;~function n(){if(c&&(87==a||83==a
))c=0,d=87==a?-1:1;if(d&&(65==a||68==a))d=0,c=65==a?-1:1;p([j=e[0][0]+c,k=e[0][1
]+d])||!j||39==j||!k||10==k?b+=" | GAME OVER":(e.unshift([j,k]),p(f)?(f=[1+38*i(
)|0,1+9*i()|0],b++):e.pop());for(m=h="";11>h;h++){for(g=0;40>g;g++)l=g+","+h,m+=
!g||39==g||!h||10==h?"X":e[0]==l?"O":p(l)?"*":f==l?"%":" ";m+="\n"}x.innerHTML=m
+b;!b.sup&&setTimeout(n,99)}();onkeydown=function(o){a=o.keyCode};function p(o){
return e.join(p).indexOf(p+o)+1}

I tried to make it output to the real console at first (with console.log and console.clear), but it was flickering too much, so I put it into console-like HTML. It will work with this:

<pre id=x>

Also I implemented it with 2x1 cells first, but it just looked worse than 1x1. That would be a minor change though.

Uses awsd keys on keyboard.

Update:

I was able to cut it down to 512 (exactly 0x200) bytes by improving the tail search and doing some more magic.

You now get 2 points when a piece spawns in your tail (it's a feature). I also fixed the overlapping when the snake bites itself.


Python 3, run of 1,114,111

#coding:utf
assert len(open(__file__).read(1061))==1061
"""
�
 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€�‚ƒ„…†‡ˆ‰Š‹Œ�Ž��‘’“”•–—˜™š›œ�žŸ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿĀāĂăĄąĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıĲĳĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňŉŊŋŌōŎŏŐőŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſƀƁƂƃƄƅƆƇƈƉƊƋƌƍƎƏƐƑƒƓƔƕƖƗƘƙƚƛƜƝƞƟƠơƢƣƤƥƦƧƨƩƪƫƬƭƮƯưƱƲƳƴƵƶƷƸƹƺƻƼƽƾƿǀǁǂǃǄǅǆǇǈǉǊǋǌǍǎǏǐǑǒǓǔǕǖǗǘǙǚǛǜǝǞǟǠǡǢǣǤǥǦǧǨǩǪǫǬǭǮǯǰǱǲǳǴǵǶǷǸǹǺǻǼǽǾǿȀȁȂȃȄȅȆȇȈȉȊȋȌȍȎȏȐȑȒȓȔȕȖȗȘșȚțȜȝȞȟȠȡȢȣȤȥȦȧȨȩȪȫȬȭȮȯȰȱȲȳȴȵȶȷȸȹȺȻȼȽȾȿɀɁɂɃɄɅɆɇɈɉɊɋɌɍɎɏɐɑɒɓɔɕɖɗɘəɚɛɜɝɞɟɠɡɢɣɤɥɦɧɨɩɪɫɬɭɮɯɰɱɲɳɴɵɶɷɸɹɺɻɼɽɾɿʀʁʂʃʄʅʆʇʈʉʊʋʌʍʎʏʐʑʒʓʔʕʖʗʘʙʚʛʜʝʞʟʠʡʢʣʤʥʦʧʨʩʪʫʬʭʮʯʰʱʲʳʴʵʶʷʸʹʺʻʼʽʾʿˀˁ˂˃˄˅ˆˇˈˉˊˋˌˍˎˏːˑ˒˓˔˕˖˗˘˙˚˛˜˝˞˟ˠˡˢˣˤ˥˦˧˨˩˪˫ˬ˭ˮ˯˰˱˲˳˴˵˶˷˸˹˺˻˼˽˾˿̴̵̶̷̸̡̢̧̨̛̖̗̘̙̜̝̞̟̠̣̤̥̦̩̪̫̬̭̮̯̰̱̲̳̹̺̻̼͇͈͉͍͎͓͔͕͖͙͚̀́̂̃̄̅̆̇̈̉̊̋̌̍̎̏̐̑̒̓̔̽̾̿̀́͂̓̈́͆͊͋͌͐͑͒͗͛ͣͤͥͦͧͨͩͪͫͬͭͮͯ̕̚͘͜͟͢͝͞͠͡ͅͰͱͲͳʹ͵Ͷͷ͸͹ͺͻͼͽ;Ϳ΀΁΂΃΄΅Ά·ΈΉΊ΋Ό΍ΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡ΢ΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώϏϐϑϒϓϔϕϖϗϘϙϚϛϜϝϞϟϠϡϢϣϤϥϦϧ"""

Try it online!

The triple-quoted contains the entire Unicode range except for the null byte \0 which terminates a program. (Thanks to Chas Brown for suggesting triple-quoting, which allowed 13 more characters.) The TIO link uses a shortened version; assume that the number 1061 is replaced with the code length.

The program opens itself and checks that it has the appropriate length, which guards against any deletion. No one-character deletion can disable this logic in the code. Lowering either the number of characters read or the number checked for equality will make the assertion fail.

I'm not totally sure if all Unicode characters except '\0' are valid in Python code, and I haven't been able to test it. Maybe this is system dependent. Please let me know if this fails at some point.

We can also do this without reading the file:

s="""
�
 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€�‚ƒ„…†‡ˆ‰Š‹Œ�Ž��‘’“”•–—˜™š›œ�žŸ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿĀāĂăĄąĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıĲĳĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňŉŊŋŌōŎŏŐőŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſƀƁƂƃƄƅƆƇƈƉƊƋƌƍƎƏƐƑƒƓƔƕƖƗƘƙƚƛƜƝƞƟƠơƢƣƤƥƦƧƨƩƪƫƬƭƮƯưƱƲƳƴƵƶƷƸƹƺƻƼƽƾƿǀǁǂǃǄǅǆǇǈǉǊǋǌǍǎǏǐǑǒǓǔǕǖǗǘǙǚǛǜǝǞǟǠǡǢǣǤǥǦǧǨǩǪǫǬǭǮǯǰǱǲǳǴǵǶǷǸǹǺǻǼǽǾǿȀȁȂȃȄȅȆȇȈȉȊȋȌȍȎȏȐȑȒȓȔȕȖȗȘșȚțȜȝȞȟȠȡȢȣȤȥȦȧȨȩȪȫȬȭȮȯȰȱȲȳȴȵȶȷȸȹȺȻȼȽȾȿɀɁɂɃɄɅɆɇɈɉɊɋɌɍɎɏɐɑɒɓɔɕɖɗɘəɚɛɜɝɞɟɠɡɢɣɤɥɦɧɨɩɪɫɬɭɮɯɰɱɲɳɴɵɶɷɸɹɺɻɼɽɾɿʀʁʂʃʄʅʆʇʈʉʊʋʌʍʎʏʐʑʒʓʔʕʖʗʘʙʚʛʜʝʞʟʠʡʢʣʤʥʦʧʨʩʪʫʬʭʮʯʰʱʲʳʴʵʶʷʸʹʺʻʼʽʾʿˀˁ˂˃˄˅ˆˇˈˉˊˋˌˍˎˏːˑ˒˓˔˕˖˗˘˙˚˛˜˝˞˟ˠˡˢˣˤ˥˦˧˨˩˪˫ˬ˭ˮ˯˰˱˲˳˴˵˶˷˸˹˺˻˼˽˾˿̴̵̶̷̸̡̢̧̨̛̖̗̘̙̜̝̞̟̠̣̤̥̦̩̪̫̬̭̮̯̰̱̲̳̹̺̻̼͇͈͉͍͎͓͔͕͖͙͚̀́̂̃̄̅̆̇̈̉̊̋̌̍̎̏̐̑̒̓̔̽̾̿̀́͂̓̈́͆͊͋͌͐͑͒͗͛ͣͤͥͦͧͨͩͪͫͬͭͮͯ̕̚͘͜͟͢͝͞͠͡ͅͰͱͲͳʹ͵Ͷͷ͸͹ͺͻͼͽ;Ϳ΀΁΂΃΄΅Ά·ΈΉΊ΋Ό΍ΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡ΢ΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώϏϐϑϒϓϔϕϖϗϘϙϚϛϜϝϞϟϠϡϢϣϤϥϦϧ"""
assert len(s)==999

Try it online!

There isn't a way to delete a character from the assertion line while keeping it syntactically valid and preserving the length number.


Python 2, 192 bytes * 0.5 bonus = 96
To solve this problem efficiently, the key realization is that we can compute how many times each cell is visited based on the number of times the cells above and to the left are visited, without needing to determine the exact paths taken. Effectively, we simulate n trips at once and keep track of how many times each cell is used.
Substantial improvement due to push-based approach inspired by johnchen902's solution:
r=lambda:map(int,raw_input().split())
h,w,n=r()
v=[n]+w*[0]
x=y=0
for i in range(h):
 for j,b in enumerate(r()):
    if i-x==j-y==0:d=v[j]&1^b;x+=d;y+=1^d
    f=v[j]+b>>1;v[j]-=f;v[j+1]+=f
print x,y

Previous, pull-based implementation:
r=lambda i:map(int,raw_input().split())
h,w,n=r(0)
x=range(h)
g=map(r,x)
v=[w*[0]for i in x]
v[0][0]=n-1
for i in x:
 for j in range(w):v[i][j]+=(i and(v[i-1][j]+(1^g[i-1][j]))/2)+(j and(v[i][j-1]+g[i][j-1])/2)
i=j=0
while i<h and j<w:f=g[i][j]^v[i][j]&1;j+=f;i+=1^f
print i,j

Original, ungolfed version:
h, w, n = map(int, raw_input().split())
grid = [map(int, raw_input().split()) for i in xrange(h)]

# Determine the number of times each cell was visited in the first n-1 trips
visits = [[0]*w for i in xrange(h)]
visits[0][0] = n-1
for i in xrange(h):
    for j in xrange(w):
        if i:
            # Count visits from above cell
            visits[i][j] += (visits[i-1][j] + (not grid[i-1][j])) // 2
        if j:
            # Count visits from left cell
            visits[i][j] += (visits[i][j-1] + grid[i][j-1]) // 2

# Flip the bits corresponding to each cell visited an odd number of times
for i in xrange(h):
    for j in xrange(w):
        grid[i][j] ^= visits[i][j] & 1

# Figure out where the final trip ends
i = j = 0
while i < h and j < w:
    if grid[i][j]:
        j += 1
    else:
        i += 1

print i, j


MATL, 4 3 bytes

-1 byte thanks to Luis Mendo

YFz

Try it online!

YF         Exponents of prime factors
  z        Number of nonzeros

Original answer:

Yfun

Try it online!

A verYfun answer.

          (Implicit input)
Yf         Prime factorization
  u        Unique
   n       Numel
           (Implicit output)


Convert an Expression to Panfix Notation

JavaScript (ES6), 285 282 281 267 251 243 241 238 234 232 231 bytes
~15 bytes thanks to Neil.
f=(I,E=I.match(/\d+|./g),i=0)=>(J=T=>T.map?T.map(J).join``:T)((R=(H,l=(P=_=>(t=E[i++])<")"?R(0):t)(),C,F)=>{for(;(C=P())>")"&&(q=C>"*"&&C<"/")*H-1;)F=q+H?l=[C,l,C,P(),C]:F?l[3]=[C,l[3],C,R(1),C]:l=R(1,l,i--)
i-=C>")"
return l})(0))

In JavaScript this is a bit harder than in Mathematica. This is basically an over-specialized and golfed operator-precedence parser.
Causes stack overflows on invalid inputs.
Demo

f=(I,E=I.match(/\d+|./g),i=0)=>(J=T=>T.map?T.map(J).join``:T)((R=(H,l=(P=_=>(t=E[i++])<")"?R(0):t)(),C,F)=>{for(;(C=P())>")"&&(q=C>"*"&&C<"/")*H-1;)F=q+H?l=[C,l,C,P(),C]:F?l[3]=[C,l[3],C,R(1),C]:l=R(1,l,i--)
i-=C>")"
return l})(0))
<input id="input" value="(5+3)*((9+18)/4-1)"/><button onclick="console.log(f(document.querySelector('#input').value))">Convert</button>

Ungolfed
convert = input => {
  tokens = input.match(/\d+|./g);
  i = 0;
  parse_token = () => (token = tokens[i++]) == "(" ? parse_tree(false) : token;
  parse_tree = (mul_div_mode, left = parse_token()) => {
    while ((oper = parse_token()) != ")" && !((is_plus_minus = oper == "+" || oper == "-") && mul_div_mode)) {
      if (is_plus_minus || mul_div_mode)
        left = [oper, left, oper, parse_token(), oper];
      else if (non_first)
        left[3] = [oper, left[3], oper, parse_tree(true), oper];
      else
        left = parse_tree(true, left, i--);
      non_first = true;
    }
    if (oper != ")")
      i--;
    return left;
  };
  format_tree = tree => tree.map ? tree.map(format_tree).join("") : tree;
  return format_tree(parse_tree(false));
}


Clean, 231 ... 162 bytes

import StdEnv
$n=tl(foldr(\p[t:s]#d=sign(2*t/3^p)
=[t-d*3^p,d:s])[n][0..26])
@x y z=sum[3^p*[(a+b)/2,[1,-1,0,1,-1]!!(a+b+2),a*b]!!(z+1)\\a<- $x&b<- $y&p<-[0..26]]

Defines the function @, taking three Ints and giving an Int.
Operators map as 1 -> A, 0 -> B, -1 -> C.

Try it online!

The function $ folds a lambda over the digit places [0..26], into a list of ternary digits. It uses the head of the list it yields to keep a current total difference from the requisite number (which is why it is tailed prior to returning), and sign(2*t/3^p) to determine the current digit to yield. The sign trick is equivalent to if(abs(2*t)<3^p)0(sign t).


Pyth, 27 * 0.8 = 21.6

VSQsm.[\ 4jkXj*dNQrT99rG1SQ

Try it online: Demonstration

Explanation:

VSQsm.[\ 4jkXj*dNQrT99rG1SQ   implicit: Q = input number
VSQ                           for N in [1, 2, ..., Q]:
    m                    SQ      map each number d in [1, 2, ..., Q] to:
              *dN                   N * d
             j   Q                  in base Q
            X     rT99rG1           replace the numbers [10, 11, ..., 98] with "A...Z"
          jk                        join to a string
     .[\ 4                          prepend spaces, so that the string has a length of 4
   s                             join all strings and print


Jelly, 6 5 bytes

pSÞỤs

Try it online!

How it works

pSÞỤs  Main link. Left argument: n. Right argument: k

p      Take the Cartesian product of [1, ..., n] and [1, ..., k], yielding
       [[1, 1], [1, 2], ..., [n, k-1], [n, k]].
 SÞ    Sort the pairs by their sums.
       Note that index sums are constant on antidiagonals.
   Ụ   Grade up, sorting the indices of the sorted array of pairs by their values.
    s  Split the result into chunks of length k.


JavaScript (ES6),  210 ... 182  180 bytes

Takes input as (m)(n), where \$m\$ is a list of lists of characters. Returns the result in the same format.

m=>g=n=>n?g(n-1,m=m.map((r,y)=>r.map((c,x)=>(i=0,h=$=>~$?(m[Y=y+($-2)%2]||0)[X=x+~-$%2]>h?"-|+"[n+=`;m[${Y}][${X}]=S[${$}]`,i?2:$&1]:h($^++i):c)((S="<^>v").indexOf(c)))),eval(n)):m

Try it online!

How?

You can follow this link to see a formatted version of the source.

Wrapper

The recursive function \$g\$ is just used as a wrapper that invokes the main code to move all arrows by 1 step and keeps calling itself with \$n-1\$ until \$n=0\$.

Update method

We can't safely move each arrow one at a time because we would run the risk of overwriting non-updated arrows with updated ones. Instead, we first remove all arrows and compute their new positions. We apply the new positions in a second time.

This is done by re-using \$n\$ as a string to store the position updates as JS code.

For instance, in the first test case, \$n\$ is set to:

"1;m[0][7]=S[2];m[1][8]=S[3];m[2][9]=S[2];m[4][3]=S[0]"

(Note that the leading number -- which is the original value of \$n\$ -- is harmless.)

The new positions are applied by just doing eval(n).

Directions

Each arrow is converted into a direction \$d\$ (named $ in the code), using the following compass:

$$\begin{matrix}
&1\\
0&+&2\\
&3
\end{matrix}$$

The corresponding values of \$dx\$ and \$dy\$ are computed this way:

 d | dx = (d - 1) % 2 | dy = (d - 2) % 2
---+------------------+------------------
 0 |        -1        |         0
 1 |         0        |        -1
 2 |        +1        |         0
 3 |         0        |        +1

Corners

If the next character in the identified direction is a space or is out of bounds, it means that we're located on a corner and we need to take a 90° or 270° turn. This is why the helper function \$h\$ is testing up to 3 distinct directions: \$d\$, \$d\operatorname{xor}1\$ and \$d\operatorname{xor}3\$.

If we're located on a corner, we overwrite the cell with +. Otherwise, we overwrite it with either - or |, depending on the parity of \$d\$.

Note: The parameter of \$h\$ is not named $ just because it looks uber l33t but also because it allows us to compare a given character with \$h\$ (implicitly coerced to a string) to know if it's a space (below "$"), a contour character (above "$") or another arrow (also above "$").

Animated version

f=
m=>g=n=>n?g(n-1,m=m.map((r,y)=>r.map((c,x)=>(i=0,h=$=>~$?(m[Y=y+($-2)%2]||0)[X=x+~-$%2]>h?"-|+"[n+=`;m[${Y}][${X}]=S[${$}]`,i?2:$&1]:h($^++i):c)((S="<^>v").indexOf(c)))),eval(n)):m

m = [
  [..."+---+   +---+   +-------+"],
  [..."|   |   |   v   |       |"],
  [..."^   |   |   |   +-<-+   |"],
  [..."|   |   ^   |       |   v"],
  [..."|   +---+   +-->----+   |"],
  [..."|                       |"],
  [..."|   +-------+   +---+   |"],
  [..."|   |       |   v   |   |"],
  [..."+---+       +---+   +---+"]
];

(F = _ => (o.innerHTML = m.map(r => r.join('')).join('\n'), m = f(m)(1), window.setTimeout(F, 100)))()


Pyth, 18 bytes

c4.PC"H#ût"_S16

Run the code.

c4.PC"H#ût"_S16

    C"H#ût"       Convert the packed string to the number 1122196781940
  .P       _S16   Take that-numbered permutation of the reversed range [16,15,...,1]
c4                Chop into piece of length 4

Reversing the range was meant to lower the permutation index, since the output starts with 16, but I think it only broke even.

This beat out a more boring strategy of converting the table directly to base 17 and then a string (link) for 20 bytes:

c4jC"úz(ás¸H"17


Counters

Whenever you have a variable that will act as a counter starting from 0 you might want to write

set count=0
set/acount+=1

; however, you can eliminate the first lines because whenever set/a is used with an unset variable its value is assumed to be 0

set/acounter+=1

Code Blocks

There a number of ways you can shave off a few bytes when you have to used blocks of code.

Whenever you open a code block, you do not need to insert a line break before the first line of code in that block. The closing parentheses does not have to be on a line of its own either.

If %a%==%b% (
     echo true
) else (
    echo false
)

can be golfed to

If %a%==%b% (echo true)else (echo false)

Printing Without Trailing New Line

The common pattern for this is

echo|set/p=text

but, you can save 2 bytes changing echo to cd

cd|set/p=text


05AB1E / 05AB1E (legacy) / 2sable, 27 bytes
3°Lv®dтнOÌyDrÖi"FizzBuzz"},

2: Try it online in 2sable.
3: Try it online in 05AB1E.
4: Try it online in 05AB1E (legacy).
Explanation:
Let's start with a bit of history of these three languages. The development of 05AB1E started at the start of 2016 (or actually, the very first git-commit was on December 21st, 2015). This new codegolf language was being built in Python as backend. Mid 2016 2sable was branched of the 05AB1E version (July 7th, 2016 to be exact), and the strength of 2sable in comparison to that old 05AB1E version was added: implicit inputs. Later on implicit input was also added to 05AB1E, and 2sable was basically a forgotten version right after it was created on that day July 7th, 2016.
Then in mid-2018, a new 05AB1E version was being started, this time completely rewritten in Elixir instead of Python, with loads of new builtins added and some builtins changed or even removed.
So, let's go over the code and see what it does in each of the three languages:

3°                          # Push 10^3: 1000 (NOTE: I'm unable to use builtin `₄` for
                            # 1000, since it wasn't available in 2sable yet)
  Lv                        # Loop `y` in the range [1,1000] (NOTE: I'm unable to use
                            # builtin `E` for the [1,n] loop, since it wasn't available
                            # in 2sable nor the legacy version yet)
    ®                       #  Push -1
     d                      #  2sable: check if -1 only consist of digits (falsey / 0)
                            #  05AB1E (legacy): check if -1 is an integer (truthy / 1)
                            #  New 05AB1E: check if -1 is non-negative ≥0 (falsey / 0)
      т                     #  2sable: no-op, so does nothing
                            #  05AB1E (legacy) / new 05AB1E: push 100
       н                    #  Pop and push its first character
                            #   2sable: does this for the 0 of the `d` falsey result
                            #   05AB1E (legacy) / new 05AB1E: 100 → 1
        O                   #  Sum all values on the stack:
                            #   2sable: 0
                            #   05AB1E (legacy): 2 (1+1)
                            #   New 05AB1E: 1 (0+1)
         Ì                  #  Increase it by 2
                            #   2sable: 2
                            #   05AB1E (legacy): 4
                            #   New 05AB1E: 3
          yD                #  Push the loop value `y` two times
            r               #  Reverse the values on the stack
             Öi          }  #  If `y` is divisible by the value we calculated earlier:
               "FizzBuzz"   #   Push string "FizzBuzz"
                          , #  Pop and print the top value with trailing newline

Note: the O to sum the stack will also add the previous value that was divisible (since we've duplicated it with D, but only popped and printed "FizzBuzz"). But since we know it's divisible, the increased sum in that next iteration doesn't make a difference to the divisibility check.


05AB1E, 36 29 bytes
ÄàD(Ÿsgãsgãã.ΔD2FsN._`øδ*O}-Q

-7 bytes thanks to @ovs in another answer of mine.
Extremely slow since I'm using a brute-force approach with three cartesian products. But performance is irrelevant for code-golf challenges I guess (would love to see this same challenge as fastest-code or fastest-algorithm).
Try it online (only works for matrices of size 2x2, and even then usually times out if the absolute maximum of the integers in the matrix \$M\$ is too large..)
Verify whether the output \$[A,B]\$ results in the input \$M\$.
Explanation:
Assumes all the integers used in the resulting matrices \$[A,B]\$ will be within the range \$[-\max(\lvert M\rvert), \max(\lvert M\rvert)]\$. If you know any way to prove or disprove this assumption, let me know.
Note that there are of course matrices \$[A, B]\$ with integers larger than the integers of the resulting matrix \$M\$. But this \$M\$ will have other possible \$[A, B]\$ which are within this min-max range. I.e. \$[A,B]=\$ [[[1,2],[3,4]], [[-1,-2],[-3,-3]]] will have \$M=\$ [[0,2],[-3,0]], but using this \$M\$ to find a possible \$[A,B]\$ will result in [[[3,2],[3,3]], [[2,2],[3,3]]], which are all within the range \$[-3,3]\$.

Let me start with an explanation of 2FsN._`øδ*O}-, which will calculate \$M = AB-BA\$ of a given matrix-pair \$[A,B]\$ (which is the same code as in the verifier TIO-link above).
2F       # Loop 2 times:
  s      #  Swap the top two values on the stack
         #  (so the matrix-pair is at the top again after the first iteration)
   N._   #  Rotate the pair of matrices the (0-based) loop-index amount of times
         #  (to reverse the order from [A,B] to [B,A] in the second iteration)
      `  #  Push both matrices separated to the stack
  ø      #  Zip/transpose the top matrix; swapping rows/columns
   δ     #  Apply double-vectorized:
    *    #   Multiply
     O   #  And then sum each inner row together
 }       # After the loop:
  -      # Subtract the values at the same positions in the two matrices from each other

As for the rest of the program to create all possible matrices and brute-force over them:
Ä        # Convert each integer in the (implicit) input-matrix `M` to its absolute value
 à       # Pop and push the flattened maximum of these absolute values of `M`
  D(     # Duplicate it, and negate the maximum
    Ÿ    # Pop both and push a list in the range [max, -max]
s        # Swap to get the input matrix again
 g       # Pop and push its length to get the matrix dimension
  ã      # Create the cartesian product of the [max, -max]-list that many times
         # (i.e. if the input-matrix has a dimension of 3, we'll now have all possible
         #  triplets of integers within the [max, -max]-range)
sgã      # Do the same, to create all possible combinations of these triplets
         # (so we now have all possible matrices of the same dimensions as the input-matrix,
         #  using integers within the [max, -max]-range)
ã        # Cartesian product yet again (defaults to 2) to create all possible pairs of matrices
.Δ       # Then find the first pair of matrices which is truthy for:
  D      #  Duplicate the current pair
   2FsN._`øδ*O}-
         #  Calculate M as mentioned above
    Q    #  And check if its equal to the (implicit) input-matrix
         # (after which this matrix-pair is output implicitly as result)

Just to give an idea of how inefficient this brute-force approach is:
The given example input-matrix \$M=\$ [[11,12,12],[1,1,1],[1,2,3]] of the challenge description, will create all possible matrix-pairs of the same 3x3 dimensions with integers in the range \$[-12,12]\$. This means the list of matrix-pairs will contain \$(((12^2+1)^3)^3)^2=802830827198685151406498569488525390625\$ matrix-pairs.
And the given example input-matrix \$M=\$ [[-11811,-9700,-2937],[3,14,15],[2,71,82]] would result in \$(((11811^2+1)^3)^3)^2=400239694511528196808960294025932709663435907226315389994060779277222573307615163703296535923733538440194289670070277830289553752923910908747710464\$ matrix-pairs..


Jelly, 2 bytes
combine
Ṿ

Try it online!
separate
V

Try it online!
A boring, but short, solution. Uses Jelly's repr and eval atoms.
Ṿ is the right-inverse of V, meaning that ṾV (the Jelly way of composing 2 functions) returns the argument unchanged. Therefore, if passed [A, B], ṾV will return [A, B]
The first program takes input as a pair [A, B] and unevals it. The second takes a string as input and evals it as a Jelly program

Just a quick precursor on strings and Jelly. Jelly does not like strings. At all. Internally, strings are just lists of characters to Jelly, and when outputting, Jelly will do all it can to "mash" everything together so that it doesn't look like it should. An example that you'd expect to output ['a', 'b', 'c', 2], or even ['abc', 2]. As such, the Footers of the two programs above contain code to print the strings as-is, as lists of characters. Unfortunately, this can make them difficult to read.
But how do the programs work? Well, most of the work is done by the combine function. The separate function is simply "eval the argument as Jelly code".
Ṿ
Ṿ is a weird atom, as Jelly atoms go. It's entire purpose is to act as the inverse to V (as a side note, if an character has an "underdot" below it in Jelly, it's likely to be the "inverse" to the atom without that underdot. For example, O/Ọ (ord/chr) or Y/Ỵ (join/split at newlines)) and the function it uses in the interpreter, jelly_uneval, is only used by one other atom, Ṙ, which just prints the same value as Ṿ.
However, Ṿ does a pretty good job at yielding some Jelly code that, when evaluated, yields it's argument. I won't break down into the exact details, but it's able to handle when string delimiters such as “ are contained in the input, so is a pretty solid "uneval" atom, as these things go.


JavaScript (Firefox 30-57), 77 bytes

f=n=>n?[for(s of f(n-1))for(c of"0123456789")if(s.search(c)+(s+c)%n<0)s+c]:[""]

Edit: Saved 1 byte thanks to @edc65.


Mathematica, 166 137 bytes

l:={i,j};s=Sign;f[p_,q_,h_,w_]:=Grid@Table[(1-Max[s[p-l]s[q-l],0])Boole[Abs@Mean[s@Det@{p-l+#,p-q}&/@Tuples[.5{1,-1},2]]<.6],{i,h},{j,w}]

More readable version:

l := {i, j}; s = Sign;
f[p_, q_, h_, w_] :=
 Grid@Table[(1 - Max[s[p - l] s[q - l], 0]) Boole[
     Abs@Mean[
        s@Det@{p - l + #, p - q} & /@
         Tuples[.5 {1, -1}, 2]] < .6], {i, h}, {j, w}]

This defines a function called f. I interpreted the input and output specifications fairly liberally. The function f takes input in the format f[{x0, y0}, {x1, y1}, height, width], and the grid is 1-indexed, starting in the top left. Outputs look like

with the line displayed as 1s and the background as 0s (shown here for f[{2, 6}, {4, 2}, 5, 7]). The task of turning a Mathematica matrix of 1s and 0s into a string of #s and .s has been golfed in many other challenges before, so I could just use a standard method, but I don't think that adds anything interesting.

Explanation:

The general idea is that if the line passes through some pixel, then at least one of the four corners of the pixel is above the line, and at least one is below. We check if a corner is above or below the line by examining the angle between the vectors ({x0,y0} to corner) and ({x0,y0} to {x1,y1}): if this angle is positive, the corner is above, and if the angle is negative, the corner is below.

If we have two vectors {a1,b1} and {a2,b2}, we can check if the angle between them is positive or negative by finding the sign of the determinant of the matrix {{a1,b1},{a2,b2}}. (My old method of doing this used arithmetic of complex numbers, which was way too…well, complex.)

The way this works in the code is as follows:

{p-l+#,p-q}&/@Tuples[.5{1,-1},2] gets the four vectors from {x0,y0} and the four corners of the pixel (with l:={i,j}, the coordinates of the pixel, defined earlier), and also the vector between {x0,y0} and {x1,y1}.
s@Det@... finds the signs of the angles between the line and the four corners (using s=Sign). These will equal -1, 0 or 1.
Abs@Mean[...]<.6 checks that some of the angles are positive and some negative. The 4-tuples of signs that have this property all have means between -0.5 and 0.5 (inclusive), so we compare to 0.6 to save a byte by using < instead of <=.

There's still a problem: this code assumes that the line extends forever in both directions. We therefore need to crop the line by multiplying by 1-Max[s[p-l]s[q-l],0] (found by trial and error), which is 1 inside the rectangle defined by the endpoints of the line, and 0 outside it.

The rest of the code makes a grid of these pixels.

(As a bonus, here's an earlier attempt with a completely different method, for 181 bytes:)

Quiet@Grid@Table[(1-Max[Sign[{i,j}-#3]Sign[{i,j}-#4],0])Boole[#3==#4=={i,j}||2Abs@Tr[Cross@@Thread@{{i,j},#3,#4}]/Norm[d=#3-#4]<2^.5Cos@Abs[Pi/4-Mod[ArcTan@@d,Pi/2]]],{i,#},{j,#2}]&


R, 40 38 bytes

function(l)outer(m<-1:max(l),l,"<=")*m

Try it online!

Explanation:

outer applies its third argument (the function) to all combinations of elements of its first two arguments, generating a matrix of TRUE and FALSE where each column has TRUE where 1:max(l) is less than or equal to the corresponding element of l, for the example where l=c(3,5,2,1,6):

      [,1]  [,2]  [,3]  [,4] [,5]
[1,]  TRUE  TRUE  TRUE  TRUE TRUE
[2,]  TRUE  TRUE  TRUE FALSE TRUE
[3,]  TRUE  TRUE FALSE FALSE TRUE
[4,] FALSE  TRUE FALSE FALSE TRUE
[5,] FALSE  TRUE FALSE FALSE TRUE
[6,] FALSE FALSE FALSE FALSE TRUE

Then supposing the resultant matrix is A, then A*m -> A[i,j]=A[i,j]*i which coerces TRUE to 1 and FALSE to 0, producing the desired result.


Java is to JavaScript as Car is to Carpet

Java/JavaScript Polyglot, 108 107 106 bytes

//\u000As->s.matches("(?i)(?!.*javascript)java.*"/*
a=>/(?!.*javascript)^java/i.test(a/**/)?"car":"carpet"

Run as Java

//\u000As->s.matches("(?i)(?!.*javascript)java.*"/*
a=>/(?!.*javascript)^java/i.test(a/**/)?"car":"carpet"

Try it online!

Note: don't trust the highlight as it's incorrect. The real Java, properly interpreted looks like below because \u000A is interpreted in the very first step of the compilation as \n, de facto ending the comment that started with the line comment (//).

//
s->s.matches("(?i)(?!.*javascript)java.*"/*
a=>/(?!.*javascript)^java/i.test(a/**/)?"car":"carpet"

Run as JavaScript

//\u000As->s.matches("(?i)(?!.*javascript)java.*"/*
a=>/(?!.*javascript)^java/i.test(a/**/)?"car":"carpet"

Credits to @CowsQuak for the JS version.

let f=

//\u000As->s.matches("(?i)(?!.*javascript)java.*"/*
a=>/(?!.*javascript)^java/i.test(a/**/)?"car":"carpet"

var a=["java","javafx","javabeans","java-stream","java-script","java-8","java.util.scanner","javascript","java-avascript","javascript-events","facebook-javascript-sdk","javajavascript","jquery","python","rx-java","java-api-for-javascript","not-java"];

for(var s of a) console.log(s.padStart(a.reduce((x,y)=>x.length>y.length?x:y).length) + "=>" + f(s));

How many imaginary bonus points for this answer?

-1 byte thanks to @Nevay in the Java answer.


Phibonacci - Relation between Phi and Fibonacci

JavaScript (ES7),  77 75 69  67 bytes

n=>(g=p=>--n>1?g(q,q+=p):(1+5**.5)/2*(m*=10)^q/p*m?0:1+g(p))(q=m=1)

Try it online!
Commented
n => (            // main function, taking n
  g = p =>        // g is a recursive function taking p which, along with q,
                  // is used to compute the Fibonacci sequence
  --n > 1 ?       // decrement n; if it's still greater than 1:
    g(q, q += p)  //   do a recursive call with (p, q) = (q, q + p)
  :               // else:
    (1 + 5 ** .5) //   compute the golden ratio
    / 2           //
    * (m *= 10)   //   multiply m by 10 and multiply the golden ratio by m
    ^             //   xor (forces the decimal places to be discarded)
    q / p         //   compute q / p (last Fibonacci term / penultimate one)
    * m           //   multiply by m
    ?             //   if the above values are not equal:
      0           //     stop
    :             //   else:
      1 + g(p)    //     increment the final result and do a recursive call
)(q = m = 1)      // initial call to g with p = q = m = 1


for two booleans x and y, y ? x : !x can be rewritten as y ^ !x (y XOR NOT x) or similar in most languages.


Jelly, 14 bytes

‘Ræl\>iṠ2»2r⁸%

This uses the fact a the solution (if any) of a system of linear congruences is unique modulo the LCM of the moduli. Try it online! or verify all test cases.

How it works

‘Ræl\>iṠ2»2r⁸%  Main link. Argument: n

‘               Increment; yield n+1.
 R              Range; yield [1, ..., n+1].
  æl\           Cumulatively reduce by LCM.
                This yields [LCM(1), ..., LCM(1, ..., n+1)].
     >          Compare all LCMs with n.
      iṠ        Find the first index of sign(n).
                This yields the first m such that LCM(2, ..., m) > n if n > 0, and
                0 if n == 0.
        2»      Take the maximum of the previous result and 2, mapping 0 to 2.
          2r    Yield the range from 2 up to and including the maximum.
            ⁸%  Compute n modulo each integer in that range.


Check if all non-zero elements in a matrix are connected

Retina 0.8.2, 80 77 bytes

T`d`@1
1`1
_
+m`^((.)*)(1|_)( |.*¶(?<-2>.)*(?(2)(?!)))(?!\3)[1_]
$1_$4_
^\D+$

Try it online! Edit: Saved 1 byte thanks to @FryAmTheEggman. Explanation:

T`d`@1

Simplify to an array of @s and 1s.

1`1
_

Change one 1 to a _.

+m`^((.)*)(1|_)( |.*¶(?<-2>.)*(?(2)(?!)))(?!\3)[1_]
$1_$4_

Flood fill from the _ to adjacent 1s.

^\D+$

Test whether there are any 1s left.


Taxi, 7394 3773 bytes

Go to Post Office:w 1 l 1 r 1 l.Pickup a passenger going to Tom's Trims.Pickup a passenger going to Tom's Trims.Go to Tom's Trims:n.[a]Pickup a passenger going to The Babelfishery.Go to The Babelfishery:s 1 l 1 r.Pickup a passenger going to Cyclone.Go to Cyclone:n 1 l 1 l 2 r.Pickup a passenger going to Addition Alley.Pickup a passenger going to Multiplication Station.1 is waiting at Starchild Numerology.Go to Starchild Numerology:s 2 l 2 r.Pickup a passenger going to Cyclone.Go to Cyclone:w 1 r 4 l.Pickup a passenger going to Addition Alley.Go to Addition Alley:n 2 r 1 r.Pickup a passenger going to The Underground.Go to Cyclone:n 1 l 1 l.Pickup a passenger going to Multiplication Station.Go to The Underground:n 2 r 2 r.Switch to plan "b" if no one is waiting.Pickup a passenger going to Charboil Grill.Go to Charboil Grill:s 2 r 1 l 1 l 2 r.-1 is waiting at Starchild Numerology.Go to Starchild Numerology:e 2 r.Pickup a passenger going to Multiplication Station.Go to The Underground:w 1 r 2 r 1 r 2 l.[b]Go to Multiplication Station:s 1 l 1 r.Go to Tom's Trims:s 1 r 3 r.Switch to plan "c" if no one is waiting.Switch to plan "a".[c]Go to Multiplication Station:s 1 l 3 l.Pickup a passenger going to Cyclone.Pickup a passenger going to Cyclone.Go to Cyclone:s 1 r 2 l 2 r.Pickup a passenger going to Addition Alley.Pickup a passenger going to Cyclone.Pickup a passenger going to Addition Alley.Go to Addition Alley:n 2 r 1 r.Pickup a passenger going to Multiplication Station.-1 is waiting at Starchild Numerology.Go to Starchild Numerology:n 1 l 1 l 1 l 3 l.Pickup a passenger going to Multiplication Station.Go to Multiplication Station:w 1 r 2 r 1 r 4 l.Pickup a passenger going to Rob's Rest.Go to Rob's Rest:s 1 r 2 l 1 l 1 r 1 r.Go to Cyclone:s 1 l 1 l 1 l 1 r.Pickup a passenger going to Cyclone.[d]Pickup a passenger going to Multiplication Station.Pickup a passenger going to Multiplication Station.Go to Multiplication Station:s 1 l 2 r 4 l.Pickup a passenger going to Addition Alley.Go to Cyclone:s 1 r 2 l 2 r.Switch to plan "e" if no one is waiting.Switch to plan "d".[e]Go to Addition Alley:n 2 r 1 r.Pickup a passenger going to Cyclone.99 is waiting at Starchild Numerology.Go to Starchild Numerology:n 1 l 1 l 1 l 3 l.Pickup a passenger going to The Underground.Go to Cyclone:e 1 l 2 r.Pickup a passenger going to Trunkers.Pickup a passenger going to Sunny Skies Park.Go to Sunny Skies Park:n 1 r.Go to Trunkers:s 1 l.[f]Pickup a passenger going to Cyclone.Go to Cyclone:w 2 r.Pickup a passenger going to Divide and Conquer.Pickup a passenger going to Trunkers.Go to Trunkers:s 1 l.Go to Sunny Skies Park:w 1 r.Pickup a passenger going to Cyclone.Go to Cyclone:n 1 l.Pickup a passenger going to Divide and Conquer.Go to Zoom Zoom:n.Go to Divide and Conquer:w 1 l 2 r 1 r.Pickup a passenger going to Addition Alley.Go to Cyclone:e 1 l 1 l 2 l.Pickup a passenger going to Addition Alley.Go to Addition Alley:n 2 r 1 r.Pickup a passenger going to Divide and Conquer.2 is waiting at Starchild Numerology.Go to Starchild Numerology:n 1 l 1 l 3 l 2 r.Pickup a passenger going to Divide and Conquer.Go to Divide and Conquer:w 1 r 2 r 1 r 2 l 3 l.Pickup a passenger going to Sunny Skies Park.Go to Sunny Skies Park:e 1 l 1 l 2 l 1 l.Go to The Underground:s 1 l 1 r 2 l.Switch to plan "g" if no one is waiting.Pickup a passenger going to The Underground.Go to Trunkers:s 2 r 1 l.Switch to plan "f".[g]Go to Rob's Rest:n 3 l 2 l 1 l 2 r 1 r.Pickup a passenger going to What's The Difference.Go to Sunny Skies Park:s 1 l 1 l.Pickup a passenger going to What's The Difference.Go to What's The Difference:n 1 r 1 l.Pickup a passenger going to The Babelfishery.Go to The Babelfishery:e 3 r.Pickup a passenger going to Post Office.Go to Post Office:n 1 l 1 r.

Try it online!

Engineer Toast, a much more experienced Taxi golfer, decided to take some time (probably a lot less than I did) and golf down my Taxi program by basically rewriting it. You can find my old answer body and links to my old TIOs in the edit history.

Engineer Toast's ungolfed square root algorithm: Try it online!

Ungolfed, with explanations:

[ Crow vs. Taxi ]

[ GET THE NEGATIVE ABSOLUTE VALUES OF BOTH STDINS ]

[Move the stdin values to Tom's Trims b/c:]
[1) Stdin doesn't count as a passenger waiting]
[2) Checking for no one waiting is shorter that keeping tracker of a count for just 2 iterations OR repeating all the code over again]
Go to Post Office:w 1 l 1 r 1 l.
Pickup a passenger going to Tom's Trims.
Pickup a passenger going to Tom's Trims.
Go to Tom's Trims:n.

[a]
[Clone the first waiting value]
[If we've already picked up both, move to the next process]
[Switch to plan "c" if no one is waiting.]
Pickup a passenger going to The Babelfishery.
Go to The Babelfishery:s 1 l 1 r.
Pickup a passenger going to Cyclone.
Go to Cyclone:n 1 l 1 l 2 r.
Pickup a passenger going to Addition Alley.
Pickup a passenger going to Multiplication Station.

[Add one to the value]
1 is waiting at Starchild Numerology.
Go to Starchild Numerology:s 2 l 2 r.
Pickup a passenger going to Cyclone.
Go to Cyclone:w 1 r 4 l.
Pickup a passenger going to Addition Alley.
Go to Addition Alley:n 2 r 1 r.
Pickup a passenger going to The Underground.

[Pick up a clone of that one to feed into Multiplication Station]
Go to Cyclone:n 1 l 1 l.
Pickup a passenger going to Multiplication Station.

[Subtract one and see if that's more than zero]
Go to The Underground:n 2 r 2 r.
Switch to plan "b" if no one is waiting.

[It was more than zero so we make it negative]
[First, though, get rid of the pesky result from The Underground]
Pickup a passenger going to Charboil Grill.
Go to Charboil Grill:s 2 r 1 l 1 l 2 r.
-1 is waiting at Starchild Numerology.
Go to Starchild Numerology:e 2 r.
Pickup a passenger going to Multiplication Station.
Go to The Underground:w 1 r 2 r 1 r 2 l.

[b]
[Make sure it's a negative value and leave it at Multiplication Station]
[Either it was already negative OR we now have -1 as a passenger]
Go to Multiplication Station:s 1 l 1 r.

[Get the next stdin unless we've already gotten them both]
Go to Tom's Trims:s 1 r 3 r.
Switch to plan "c" if no one is waiting.
Switch to plan "a".

[ ADD THE TWO NEGATIVES AND INVERT TO GET THE TAXI DISTANCE]

[c]
[Pickup the two negative absolute values and clone them]
Go to Multiplication Station:s 1 l 3 l.
Pickup a passenger going to Cyclone.
Pickup a passenger going to Cyclone.
Go to Cyclone:s 1 r 2 l 2 r.
Pickup a passenger going to Addition Alley.
Pickup a passenger going to Cyclone.
Pickup a passenger going to Addition Alley.

[Add the two clones values to get the negative Taxi distance]
Go to Addition Alley:n 2 r 1 r.
Pickup a passenger going to Multiplication Station.

[Invert to get the Taxi distance and store it at Rob's Rest]
-1 is waiting at Starchild Numerology.
Go to Starchild Numerology:n 1 l 1 l 1 l 3 l.
Pickup a passenger going to Multiplication Station.
Go to Multiplication Station:w 1 r 2 r 1 r 4 l.
Pickup a passenger going to Rob's Rest.
Go to Rob's Rest:s 1 r 2 l 1 l 1 r 1 r.

[ FIND THE CROW DISTANCE ]
[Uses the Babylonian method: https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method ]

[Square and Sum the cloned values]
Go to Cyclone:s 1 l 1 l 1 l 1 r.
Pickup a passenger going to Cyclone.
[d]
Pickup a passenger going to Multiplication Station.
Pickup a passenger going to Multiplication Station.
Go to Multiplication Station:s 1 l 2 r 4 l.
Pickup a passenger going to Addition Alley.
Go to Cyclone:s 1 r 2 l 2 r.
Switch to plan "e" if no one is waiting.
Switch to plan "d".
[e]
Go to Addition Alley:n 2 r 1 r.
Pickup a passenger going to Cyclone.

[Pickup our cycle counter]
[It's cheaper to do this than to check each iteration's value as equal to the last]
[Taxi can only handle integers up to 2^31-1 so 99 iterations is sufficient.]
99 is waiting at Starchild Numerology.
Go to Starchild Numerology:n 1 l 1 l 1 l 3 l.
Pickup a passenger going to The Underground.

[Duplicate stdin to be stored as S at Trunkers and as x0 at Sunny Skies Park]
[a & b are always integers so Trunkers won't hurt S and it's close with a short name so it's good for golfing]
Go to Cyclone:e 1 l 2 r.
Pickup a passenger going to Trunkers.
Pickup a passenger going to Sunny Skies Park.
Go to Sunny Skies Park:n 1 r.
Go to Trunkers:s 1 l.

[ This is our starting position for square root:           ]
[  • x at Sunny Skies Park                                 ]
[  • S at Trunkers                                         ]
[  • Taxi at Trunkers                                      ]
[  • The iterator as a passenger going to The Underground  ]

[f]

[Duplicate S so we don't lose it]
Pickup a passenger going to Cyclone.
Go to Cyclone:w 2 r.
Pickup a passenger going to Divide and Conquer.
Pickup a passenger going to Trunkers.
Go to Trunkers:s 1 l.

[Diplicate x for division and addition]
Go to Sunny Skies Park:w 1 r.
Pickup a passenger going to Cyclone.
Go to Cyclone:n 1 l.
Pickup a passenger going to Divide and Conquer.

[Gas will be super important in this loop]
Go to Zoom Zoom:n.

[Perform (x + S/x)/2]
[(/2) turns out to be a few bytes shorter than (*.5), mostly due to place names]
Go to Divide and Conquer:w 1 l 2 r 1 r.
Pickup a passenger going to Addition Alley.
Go to Cyclone:e 1 l 1 l 2 l.
Pickup a passenger going to Addition Alley.
Go to Addition Alley:n 2 r 1 r.
Pickup a passenger going to Divide and Conquer.
2 is waiting at Starchild Numerology.
Go to Starchild Numerology:n 1 l 1 l 3 l 2 r.
Pickup a passenger going to Divide and Conquer.
Go to Divide and Conquer:w 1 r 2 r 1 r 2 l 3 l.
Pickup a passenger going to Sunny Skies Park.
Go to Sunny Skies Park:e 1 l 1 l 2 l 1 l.
[Now we have the next iteration of x]

[Check the iterator]
Go to The Underground:s 1 l 1 r 2 l.
Switch to plan "g" if no one is waiting.
Pickup a passenger going to The Underground.

[Reset the loop]
Go to Trunkers:s 2 r 1 l.
Switch to plan "f".

[ ADD THE NEGATIVE SUM TO THE SQUARE ROOT TO GET THE NEGATIVE DIFFERENCE ]

[g]
Go to Rob's Rest:n 3 l 2 l 1 l 2 r 1 r.
Pickup a passenger going to What's The Difference.
Go to Sunny Skies Park:s 1 l 1 l.
Pickup a passenger going to What's The Difference.
Go to What's The Difference:n 1 r 1 l.
Pickup a passenger going to The Babelfishery.
Go to The Babelfishery:e 3 r.
Pickup a passenger going to Post Office.
Go to Post Office:n 1 l 1 r.


Do two numbers contain unique powers of 2

Actually, 2 bytes

&Y

Try it online!

Explanation:

&Y
&   bitwise AND
 Y  boolean negation


JavaScript (ES6), 42 38 bytes

f=_=>/\//g&&"f="+f||"!dlroW ,olleH">=_

Reversed

_=>"Hello, World!"||f+"=f"&&g//\/>=_=f

Explanation

When reversed, it becomes an anonymous function that returns the string Hello, World!.

The regex /\//g becomes a comment when it is reversed, which allows the syntactically invalid >=_=f to be commented out in the reversed code.


Python 2, 55
H=lambda b,c,n,s=0:n and n%b*c**H(b,c,s)+H(b,c,n/b,s+1)

A recursive solution. Like the recursive algorithm to convert between bases, except it recurses on the exponent as well.
We split n into two parts, the current digit n%b, and all other digits n/b. The current place value is stored in the optional parameter s. The current digit is converted to base c with c** and the exponent s is converted recursively. The remainder is then converted the same way, as +H(b,c,n/b,s+1) but the place value s is one higher.
Unlike base conversion, hereditary base conversion required remembering the current place value in the recursion for it to converted.
For ease of reading, here's what it looks like when b and c are fixed global constants.
H=lambda n,s=0:n and n%b*c**H(s)+H(n/b,s+1)


Ruby, 418 bytes, score 12 (on 'palest')

$dict = File.readlines('agreeddict.txt').map(&:chomp)

def search(wrd)
  words = 0
  fdic = $dict.clone
  guess = ''
  starters = ['earths','blowup','coding']

  chs = wrd.chars

  while guess!=wrd do
    guess = starters.pop || fdic.pop
    words += 1
    ghs = guess.chars
    chars = (chs|ghs).size
    fdic.select!{|w|(w.chars|ghs).size == chars}
  end

  words
end

upp = 0;

p $dict.map{|w|
  [search(w),w]
}.max

Try it online!

Runs in 15 seconds on my machine.

TIO link for reference only - does not work if the file is not in the current directory.

The trick

Instead of brute-force elimination, try a list of initializers first. A lot of words differ by only 1 character and it's easy to get stuck in a single-letter elimination loop.

The most difficult words to guess are those with 4-5 very common characters (a e r s t), 1-2 'outsiders' (c p x z...) and some anagrams in the dictionary.

For example, when we reach a word containing the letters "a e r s t" and the answer is 5: if we just filter all the entries containing these 5 characters, we are left with a dictionary of 40 similar words, and then we have to try almost all of them, removing only a few words at each step.

We need to remove these words first, and we filter on the least common character, so if we get to "earths", and Player 1 answers 5, we don't have a lot of words to check. The first 2 words we always check are "coding" and "blowup" (no pun intended).

Now we can try with  a word containing the 5 most common letters ("earths"). If the answer is 4 or 5 (which is likely), we don't have a lot of words to choose from, because we already filtered all the words containing only 1 or 2 uncommon letters (and we only used 3 guesses to get here).

Finding the right initializers was a little tricky, I started with a list of 5 "quasi orthogonal" words (with as few letters as possible in common, a good start was "sporty fuzing hawked climax jumble", missing only the letter z) and got to 13, then started a test on automatically generated smaller lists.

'palest' seems to be a worst case, having 6 anagrams and 4 very common letters, but it's not the only word requiring 12 guesses, so I don't think I could get a better score with this approach.

I don't want to golf this.


Nested loops
If you want to nest for loops, you currently have to waste a byte for using F<var><seq> inside a V<seq> or vice versa. I'd love to have the same thing as with lambdas, where the variable used for the loop would change when nesting loops.


Python 3.6, 150 bytes

f=lambda n,t=-1,p=-1,a=0:sum(f(n-1,*((t,c+p*(p>=0),a),((t<0 or t)*(p<0 or p),-1,a-c))[c<0])for c in range(-26,10))if n else 0<(t<0 or t)*(p<0 or p)==a

results:

f(2) = 18
f(3) = 355
f(4) = 8012
f(5) = 218153

Ungolfed version with explanation:

digits=[*range(10)]
letters=[*range(1,27)]

def f(n, dt=-1, dp=-1, lt=0):
    if n:
        for d in digits:
            yield from f(n - 1,
                         dt,
                         d if dp < 0 else dp + d,
                         lt
                         )

        for l in letters:
            yield from f(n - 1,
                         dp if dt < 0 else dt if dp < 0 else dt*dp,
                         -1,
                         lt + l
                         )
    else:
        yield 0 < lt == (dt<0 or dt)*(dp<0 or dp)

The problem boils down to searching a tree in which each level of the tree corresponds to a position in a license plate number and each node has 36 children (10 digits and 26 letters).  The function does a recursive search of the tree, accumulating the values for the digits and letters as it goes.

n is the number of levels to search.
dp accumulates the sum of a group of digits.
dt accumulates the product of the digit sums.
lt accumulates the sum of the letter values.

For dp and dt, a value < 0 indicates it is not initialized.

Golf included, converting the for loops to sums of generators:

sum(f(n-1,
      dt,
      d if dp < 0 else dp + d,
      lt) for d in digits)
+
sum(f(n-1,
      dp if dt<0 else dt if dp<0 else dt*dp,
      -1,
      lt+l) for l in letters)

Then combining the generators.  Encode letters, A to Z, as -1 to -26 and digits as 0 to 9.  So the sum becomes:

sum(f(n-1, *args) for c in range(-26, 10)),

where args is:

((dp if dt<0 else dt if dp<0 else dt*dp, -1, lt-l) if c <0 else
 (dt, d if dp<0 else dp+d, lt))

The rest of the golfing is converting the function to a lambda, shortening variable names, and simplifying expressions.