Find a maximal rectangle of 1s Background

I want to buy an plot of land and build my house on it.
My house should be rectangular, and as large as possible; however, the available plots have lots of rocky areas that I cannot build on, and I'm having trouble fitting a potential house on the plots.
I want you to write a program that analyzes the plots for me.

Input and output

Your input is a rectangular 2D array of bits, of size at least 1×1, in any reasonable format.
The array represents a plot of land; 1s are "good" areas where I could build my house, and 0s are "rocky" areas where the house cannot be built.

Your output shall be the maximal area of a solid rectangle of 1s in the input array.
It represents the area of the largest house I could build on the plot.
Note that if there are no 1s in the input, then the output is 0.

Example

Consider the input

101
011
111

The largest rectangle of 1s is the 2×2 rectangle in the lower right corner.
This means that the correct output is 4.

Rules and scoring

You can write a full program or a function.
The lowest byte count wins, and standard loopholes are disallowed.

Test cases

0
-> 0

1
-> 1

00
00
-> 0

01
10
-> 1

01
11
-> 2

111
010
111
-> 3

101
011
111
-> 4

0111
1110
1100
-> 4

1111111
1110111
1011101
-> 7

111011000
110111100
001111110
011111111
001111110
000111100
000011000
-> 20

000110000
110110010
110111110
110011100
010011111
111111111
111101110
-> 12

Jelly, 21 20 18 17 bytes

ṡṂ€€×"
‘×¥\ç"Ụ€FṀ

Try it online! or verify all test cases.

Background

Let M be a matrix of bits such as

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

We start by counting the number of 1 bits in each column of M, resetting the count every time we encounter a 0 bit.

For our example matrix, this gives

0 0 0 1 1 0 0 0 0
1 1 0 2 2 0 0 1 0
2 2 0 3 3 1 1 2 0
3 3 0 0 4 2 2 0 0
0 4 0 0 5 3 3 1 1
1 5 1 1 6 4 4 2 2
2 6 2 2 0 5 5 3 0

Next, we compute all contiguous sublists of each row. We achieve this by generating all slices of length k, where k varies between 1 and the number of entries in each row.

For the penultimate row, this gives

[1], [5], [1], [1], [6], [4], [4], [2], [2]
[1, 5], [5, 1], [1, 1], [1, 6], [6, 4], [4, 4], [4, 2], [2, 2]
[1, 5, 1], [5, 1, 1], [1, 1, 6], [1, 6, 4], [6, 4, 4], [4, 4, 2], [4, 2, 2]
[1, 5, 1, 1], [5, 1, 1, 6], [1, 1, 6, 4], [1, 6, 4, 4], [6, 4, 4, 2], [4, 4, 2, 2]
[1, 5, 1, 1, 6], [5, 1, 1, 6, 4], [1, 1, 6, 4, 4], [1, 6, 4, 4, 2], [6, 4, 4, 2, 2]
[1, 5, 1, 1, 6, 4], [5, 1, 1, 6, 4, 4], [1, 1, 6, 4, 4, 2], [1, 6, 4, 4, 2, 2]
[1, 5, 1, 1, 6, 4, 4], [5, 1, 1, 6, 4, 4, 2], [1, 1, 6, 4, 4, 2, 2]
[1, 5, 1, 1, 6, 4, 4, 2], [5, 1, 1, 6, 4, 4, 2, 2]
[1, 5, 1, 1, 6, 4, 4, 2, 2]

Next, we map each slice to the product of its minimum and its length. For each slice, this computes the area of the rectangle of 1 bits of maximum height that has the given slice as bottom row.

For the slices of length 3 of the penultimate row of our example matrix, this gives

3 3 3 3 12 6 6

All that's left to do is take the maximum across all slices of all rows.

For our example matrix, this gives 12.

How it works

‘×¥\ç"Ụ€FṀ  Main link. Argument: M (2D list of bits)

   \        Reduce the columns of M by the link to the left.
  ¥           Combine the two atoms to the left into a dyadic chain.
‘               Increment the left argument.
 ×              Multiply the result with the right argument.
      Ụ€    Grade up each; yield the indices of each row of M, sorted by their
            values. The order is not important here; we just need the indices.
    ç"      Apply the helper link to each element of the result to the left and
            the corresponding element of the result to the right.
        F   Flatten the resulting, nested list.
         Ṁ  Extract the maximum.

ṡṂ€€×"      Helper link. Arguments: R (row), X (indices of R)

ṡ           For each k in X, split R into overlapping slices of length k.
 Ṁ€€        Compute the minimum of each individual slice.
    ×"      Multiply the minima of all slices of length k by k.


Same code different characters Note: This challenge only allows answers in compiled languages

Task

Your task is pretty simple, make two different programs that when compiled result in the same output.

Scoring

Here is where the fun comes in.  Your score will be the number of unique bytes present in exactly one program.  For example if your two programs (encoded in IBM Code page 437) are

☻☻Program A

and

☺Program B

The characters that are in exactly one program are

☻☺AB

Thus the score is 4.  Note that ☻ appears twice in the first program but is only counted once.

Your goal is to get the highest score, the highest score possible is 256.

Here is a scoring program that works for ASCII encoded programs.

Stipulations

Every byte in both programs should be able to be replaced with a different byte causing either the program to compile into a different result or fail to compile all together.  Removing any byte should do the same.
You may use any compilation flags as long as both programs are run with the same flags.
The resulting compilation should be static (i.e. should not vary from run to run), if results vary from machine to machine indicate the machine it is intended to run on.
The output of compilation should be byte for byte identical not "equivalent" or "similar enough".
The output of the compilation should be non-empty
Warnings/Errors need not be the same between compilations
If either the programs or the compilation include unprintable characters be sure to include a hexdump.  Although it is not technically required.

Perl, score 254 + 2 = 256

Here's a hex dump of one program:

00000000: 6c65 6e67 7468 2700 0102 0304 0506 0708  length'.........
00000010: 090a 0b0c 0d0e 0f10 1112 1314 1516 1718  ................
00000020: 191a 1b1c 1d1e 1f20 2123 2425 2628 292a  ....... !#$%&()*
00000030: 2b2c 2d2e 2f30 3132 3334 3536 3738 393a  +,-./0123456789:
00000040: 3b3c 3d3e 3f40 4142 4344 4546 4748 494a  ;<=>?@ABCDEFGHIJ
00000050: 4b4c 4d4e 4f50 5152 5354 5556 5758 595a  KLMNOPQRSTUVWXYZ
00000060: 5b5d 5e5f 6061 6263 6465 6667 6869 6a6b  []^_`abcdefghijk
00000070: 6c6d 6e6f 7071 7273 7475 7677 7879 7a7b  lmnopqrstuvwxyz{
00000080: 7c7d 7e7f 8081 8283 8485 8687 8889 8a8b  |}~.............
00000090: 8c8d 8e8f 9091 9293 9495 9697 9899 9a9b  ................
000000a0: 9c9d 9e9f a0a1 a2a3 a4a5 a6a7 a8a9 aaab  ................
000000b0: acad aeaf b0b1 b2b3 b4b5 b6b7 b8b9 babb  ................
000000c0: bcbd bebf c0c1 c2c3 c4c5 c6c7 c8c9 cacb  ................
000000d0: cccd cecf d0d1 d2d3 d4d5 d6d7 d8d9 dadb  ................
000000e0: dcdd dedf e0e1 e2e3 e4e5 e6e7 e8e9 eaeb  ................
000000f0: eced eeef f0f1 f2f3 f4f5 f6f7 f8f9 fafb  ................
00000100: fcfd feff 273d 3d32 3533 6f72 2078 2829  ....'==253or x()

and here's the other program:

"\\"

Perl isn't normally thought of a compiled language, but it is; it's first compiled to bytecode, and then the bytecode is executed. You can apply a filter on the bytecode (e.g. to dump it rather than running the program) using the -MO option. Both these programs compile into the following bytecode (disassembled using -MO=Terse):

LISTOP (0x564fcd99f020) leave [1]
    OP (0x564fcd99f148) enter
    COP (0x564fcd99f068) nextstate
    OP (0x564fcd99f100) null [5]

Explanation

Perl replaces all statements with no effect (such as string literals on their own) with a hardcoded "statement with no effect" statement in the resulting bytecode, so both programs compile to the same thing. In terms of character replacements, replacing most of the characters from program 1 with apostrophes will cause it to fail to compile (or replacing the apostrophes with 0). In program 2, replacing the any character with c will cause the program to fail to compile (as \c takes an argument).

As for character deletions, the first version of this answer predated the "radiation hardening rule" (that deleting any character must change the behaviour of the program). This updated, radiation-hardened version works via the use of a checksum; if deleting a character doesn't outright cause a syntax error, the code will compile into a call to the nonexistent function x. The Perl compiler doesn't optimize out the call in the case where it's made (and in general doesn't seem aware that the function doesn't exist), and thus the output is different. However, Perl's constant folder is capable of seeing that the un-mutated program is a single statement with no effect, and thus optimizes the whole thing down into a single statement like before.

I originally misread the question as counting only unique characters from one program, and tried to optimize for that. Clearly, program 2 needs to contain at least one character in order to generate the "statement with no effect" opcode, meaning that the best possible score in one program is 255. I haven't yet found a way to include a backslash in program 1 in such a way that the character immediately following it can't be replaced in such a way as to cause the program to break, but it wouldn't surprise me if it were possible (leading to a score of 255 + 1 = 256).


Mayweather vs McGregor: Prepare the cash prize Introduction

On the 26th of August, 2017, Floyd Mayweather, Jr. will face up to Conor McGregor in a boxing match.

Both participants will receive the phenomenal amount of 100 million dollars!

Unfortunately, we do not have the money yet, but we can already prepare the big briefcase that will contain all the banknotes.

        _________________________
        |                       |
|=======================================|
|       $  $$$$$  $$$$$  $       $      |
|   $   $  $   $  $   $  $$$   $$$      |
|       $  $   $  $   $  $  $$$  $      |
|       $  $$$$$  $$$$$  $       $      |
|_______________________________________|

The briefcase is composed of _,|,= and $.

It has a size of 41 characters in width (ignoring the newlines) and 6 in height (+2 for the handle).

Challenge

Given no input, write a full program to output a 2D briefcase (see above).

Score

This is code-golf, so the shortest solution (in bytes) wins.

Jelly,  92  75 bytes

⁽©Ḍṃ“_= ”x"“€Þ‘x2,6¤;"⁾_|x1,7¤z⁶ZUŒBY”$“¢=Ḷ't3y&ḅḄȥıḍḄḌṀṡḂẓPḣṁQṘ½ɗ’BT+134¤¦

Try it online!

How?

Step 1. Build a list of the rows of the right half of an empty briefcase, ignoring trailing spaces:

⁽©Ḍṃ“_= ”x"“€Þ‘x2,6¤;"⁾_|x1,7¤
    “_= ”                      - literal list of characters = "_= "
⁽©Ḍ                            - base 250 literal = 2674
   ṃ                           - base decompress (2674 in base: 1='_', 2='=', 0=' ')
                               -   ...yields the list of characters: "_ =    _"
                   ¤           - nilad followed by link(s) as a nilad:
           “€Þ‘                -   literal list of code page indexes = [12,20]
                2,6            -   literal list of numbers = [2,6]
               x               -   repeat -> [12,12,20,20,20,20,20,20]
         x                     - repeat -> ["_"*12, " "*12, "="*20, " "*20, ..., "_"*20]
                             ¤ - nilad followed by link(s) as a nilad:
                      ⁾_|      -   literal list of characters = "_|"
                          1,7  -   literal list of numbers = [1,7]
                         x     -   repeat -> list of characters "_|||||||"
                     "         - zip with the dyad:
                    ;          -   concatenate -> ["_"+"_"*12, "|"+" "*12, ...]

Step 2: transform that into a whole empty briefcase:

z⁶ZUŒBY
 ⁶      - literal space character
z       - transpose with filler (adds the "leading" spaces, to the 1st 2 rows)
  Z     - transpose (back from columns to rows again)
   U    - upend (reverse each row to make it a left-hand side of an empty briefcase)
    ŒB  - bounce (add a reflection of each row with one central character)
      Y - join with new lines

Step 3: Show me the money!

”$“¢=Ḷ't3y&ḅḄȥıḍḄḌṀṡḂẓPḣṁQṘ½ɗ’BT+134¤¦
                                     ¦ - sparse application of:
”$                                     -   literal '$' character
                                       - ...to indexes:
                                    ¤  - nilad followed by link(s) as a nilad:
  “¢=Ḷ't3y&ḅḄȥıḍḄḌṀṡḂẓPḣṁQṘ½ɗ’         - base 250 literal = 1999171130867115278012045759181600763304793110829063794065408
                              B        - convert to a binary list -> [1,0,0,1,1,1,1,1,0,0,1,1,1,1,1,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,1,1,0,0,1,1,1,1,1,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
                               T       - truthy indexes -> [1,4,5,6,7,8,11,12,13,14,15,18,26,39,43,46,50,53,57,60,61,62,66,67,68,85,88,92,95,99,102,105,106,107,110,127,130,131,132,133,134,137,138,139,140,141,144,152]
                                 134   - literal 134
                                +      - addition -> [135,138,139,140,141,142,145,146,147,148,149,152,160,173,177,180,184,187,191,194,195,196,200,201,202,219,222,226,229,233,236,239,240,241,244,261,264,265,266,267,268,271,272,273,274,275,278,286]
                                       -             (that's where the $s at!)


Composite Factor Soup Per the fundamental theorem of arithmetic, for a given number \$n\$, it is possible to find it's prime factors, and they are unique. Let's imagine we talk only of \$n\$ that is non-prime (composite).

We can also find the factors of all the composite numbers smaller than \$n\$. For example if \$n\$ is 10, then it has factors 5 and 2. 9 has 3 and 3. 8 has 2, thrice. 6 has 3 and 2. 4 has 2 and 2. So for the number 10, all the prime factors of all the composite numbers smaller than 10 would be listed as 2,3, and 5.

Now if you put a lot of vegetables in a pot for soup, often the largest will rise to the top. So if we put all of these factors in a big pot, which one will be the largest and rise to the top? For 10 soup, that answer is 5.

"Silly", you might think, "the number \$n\$ itself will have the largest factors, larger than the factors of numbers smaller than \$n\$". But this is where you are wrong my friend!

For example, the factors of 16 are all 2, repeated four times. The factors of 15 are 5 and 3, now, I don't have to be a mathematician to tell that 15 is smaller than 16, but 5 is bigger than 2!

Your challenge is to explore how this works for bigger \$n\$. For any number given input number \$n\$, assumed natural, composite, and less than 2^32, find out which is the "largest factor" of all the prime factors of all the composite numbers less than or equal to \$n\$.

Good luck and have fun!

Smallest byte count wins.

Neim, 3 bytes

ᚺ>:

Explanation:

ᚺ   halve
 >  increment
  : previous prime

Try it online!


Apples are falling down Introduction

There is an Apple tree trunk positioned between -2 to 2 on the x-axis, where some apples fall down around it:

        |   |
        |   |
<-------|---|------->
       -2   2

Everyday, n apples fall down. Each apple maintains its x coordinate as falls straight to the ground.

But if it lands on top of another apple, it will roll according to the following rules until it reaches the ground or a supporting layer of apples:

If the space at x+1 at its current height is empty the current apple goes there.
Else if the space at x-1 is empty the current apple goes there.
Otherwise the current apple stays where it is on top of that other apple.

Challenge

The input will be the n starting positions of each apple in order. You can take it as an array or as separated numbers or in any other valid way, just make sure you explain it in your answer.

The output should be an ASCII drawing of the tree trunk and the apples around. You are not required to draw the x-axis to the left of the leftmost apple and to the right of the rightmost apple, but you do need to draw it anywhere it is beneath some apple. You can also extend the tree above the highest apple.

You can assume all x-coordinates are between -100 and 100, but not between -2 and 2.

This is code-golf .. The shortest answer in bytes wins!

Examples

Input: [-3, 5, 5, -4, -4, 5, -3]

Output:

  a|   |
aaa|   | aaa
---|---|----

Input: [3, 3, 3, 3, 8, 9]

Output:

|   |a
|   |aaa  aa
|---|-------

Input: [-5, -5, -5, -5, -5, -5, -5, -5, -5]

Output:

  a  |   |
 aaa |   |
aaaaa|   |
-----|---|

PHP, 230 bytes

I've added the first two newlines for readibility.

function($l){for($y=count($l);$y>=0;$f[]="$a|   |$a")$a=str_repeat($y--?$w=' ':'-',99);
foreach($l as$x){for($x+=101,$s=$y=0;!$s;$b[$x]!=$w?$b[$x+1]!=$w?$b[$x-1]!=$w?$s=1:--$x
:++$x:0)$b=$f[$y++];$f[$y-2][$x]=a;}echo join('
',$f);};

Ideone

Here is the ungolfed version:

function drawApples(array $listStartX)
{
    $field = [];
    $maximalHeight = count($listStartX);
    for ($y = $maximalHeight; $y >= 0; --$y)
    {
        $line = str_repeat($y > 0 ? ' ' : '-', 98);
        $field[] = $line .'|   |'. $line;
    }

    foreach ($listStartX as $x)
    {
        $x += 100;
        for ($y = 0; true; ++$y)
        {
            if ($field[$y][$x] === ' ') {
                continue;
            }

            if ($field[$y][$x + 1] === ' ') {
                ++$x;
                continue;
            }

            if ($field[$y][$x - 1] === ' ') {
                --$x;
                continue;
            }

            $field[$y - 1][$x] = 'a';
            break;
        }
    }

    echo implode("\n", $field);
}


Yarr! A map to the hidden treasure! Introduction

"Yarr!! We had a laddie who called himself a "programmer" make a map t' our hidden treasure! But 'tis written wit' weird numbers 'n letters! "E5, N2, E3"... what does it even mean? Madness! Can't even scribe a proper treasure map, t' useless cretin. Fix it fer us! We'll gift ye a share o' t' treasure!"

Challenge Description

A group of pirates are having trouble reading a treasure map. Can you write a program to convert it into a more... piratey form?

As input, you'll receive the original treasure map. It's a list of comma separated strings, each string which consists of a letter portion (which tells the pirates which direction they need to walk in), and a number portion (which tells the pirates how many steps to take in that direction). For instance, the following treasure map:

E2,N4,E5,S2,W1,S3

would mean, "walk two steps to the east, walk four steps to the north, walk five steps to the east, walk two steps to the south, walk one step to the west, then walk three steps to the south."

As output, you'll output the map in a graphical form, using the characters >, ^, v, and < as pointers. Here's the output for the above input:

  >>>>>v
  ^    v
  ^   v<
  ^   v
>>^   X

Notice that we've replaced the last step to the south with an X instead. This is because the last step is where the treasure is, and as we all know, pirates must have an X on their treasure maps, otherwise they won't know how to read it.

By the way, the map won't ever cross itself, so you don't need to worry about dealing with overlaps. Also, you are allowed to have a trailing new line at the end of the output.

Sample Inputs and Outputs

S5,W2

 v
 v
 v
 v
 v
X<

N1,E1,S1,E1,N1,E1,S2

>v>v
^>^X

N1

X

N6,E6,S6,W5,N5,E4,S4,W3,N3,E2,S2,W1,N2

>>>>>>v
^>>>>vv
^^>>vvv
^^^Xvvv
^^^^<vv
^^^<<<v
^^<<<<<

E21,S2

>>>>>>>>>>>>>>>>>>>>>v
                     X

N12,E11,S12,W2,N4

>>>>>>>>>>>v
^          v
^          v
^          v
^          v
^          v
^          v
^          v
^          v
^        X v
^        ^ v
^        ^ v
^        ^<<

Python 2, 249 248 244 239 237 bytes

D={}
m=X=Y=0
for s in input().split(","):d=ord(s[0])%10%7;exec"a,b=X,Y;E=D[Y]=D.get(Y,{});E[X]='<^>v'[d];m=min(m,X);%c+=d-2|1;"%(88+d%2)*int(s[1:])
D[b][a]="X"
for Y in sorted(D):print"".join(D[Y].get(n," ")for n in range(m,max(D[Y])+1))

Input like "E2,N4,E5,S2,W1,S3".

NSEW is mapped to [1, 3, 2, 0] by d=ord(c)%10%7. Whether to change y or x is then decided by d%2, and whether to increment or decrement is decided by d-2|1. The first and third expressions were found by brute force.

Other than that, it's a simple usage of a nested dictionary of the form {y: {x: char}}.

(Thanks to @joriki for help with mapping)


Collapse the antistring In this challenge you will be given an alphabetic string as input.  We will define the "anti-string" of a given input to be the string with the case of all the letters inverted.  For example

AaBbbUy -> aAbBBuY

You should write a program that takes a string as input and searches for the longest contiguous substring whose anti-string is also a contiguous substring.  The two substrings should not overlap.

As an example if you were given the string

fAbbAcGfaBBagF

The bolded portions would be the longest string anti-string pair.

Your program should, once it has found the pair, collapse them into a single character each.  It should do this by removing all but the first character of each substring.  For example the string above

fAbbAcGfaBBagF

would become

fAcGfagF

Your program should then repeat the process until the longest string anti-string pair is a single character or shorter.

For example working with the same string the new longest pair after the collapse is

fAcGfagF

So we collapse the string again

fAcGag

Now the string cannot be collapsed further so we should output it.

In the case of a tie between candidate pairs (example AvaVA) you may make either reduction (AaA or AvV, but not Aa).

This is code-golf so answers will be scored in bytes with fewer bytes being better.

Test Cases

fAbbAcGfaBBagF  ->  fAcGag
AvaVA ->  AaA / AvV
QQQQQQQ -> QQQQQQQ
fAbbAcQQQQaBBacqqqqA -> fAbcQBcq
gaq -> gaq
fAbbAcGfaBBagFaBBa -> fcGaBBag

Motivations

While this problem may seem arbitrary it is actually a problem I encountered while making code to process fundamental polygons.  This process can be used to reduce a fundamental polygon to a smaller n-gon.  After I tried it I thought it would make a nice little golf.


My smartphone's phonebook Introduction
Recently I was trying out one of the more obscure use-cases of a modern smartphone: Calling someone by number. While typing it in, I noticed that some of my phonebook entries were displayed, even though the number I was trying to call was different!  After some experiments, I figured out why.
What it does
Every entry in the phone book is examined like this:

Split the entry by space into "words".
Check every word like so:

For every digit in the number...
Is the character of the word at the current index on the key with the digit at the current number?

If at least one such word exists, display this entry

Challenge
Emulate my smartphone's behaviour!
Take the list of names below and a numeric string as input. The format for the phonebook may be chosen freely. Assume the phone number to always match [0-9]* and all names to match [0-9a-zA-Z\s]+
You can expect entries consisting of ASCII characters with values between 32 and 126 (including both). Your program should handle any length of entry and words within, as well as a list of any size.
Output a filtered list.
Input and output order is not relevant.
Use the following phone keyboard:
  1  |  2  |  3
     | abc | def
-----------------
  4  |  5  |  6
 ghi | jkl | mno
-----------------
  7  |  8  |  9
 pqr | tuv | wxy
  s  |     |  z
-----------------
     |  0  |
     |     |

Rules

This is code-golf, shortest code wins
No standard loopholes

Phone Book, values comma-seperated.
noodle9, Kevin Cruijssen, Arnauld, RGS, xnor, Bubbler, J42161217, Neil, petStorm, fireflame241, Dennis, Martin Ender, Leaky Nun, Lyxal, HighlyRadioactive, Dingus, math, Beefster, Razetime, my pronoun is monicareinstate, Dom Hastings, Dion
Test cases
Input: 0815
Output: []

Input: 731
Output: []

Input: 532596
Output: []

Input: 53259
Output: [Leaky Nun]

Input: 542
Output: [J42161217]

Input: 27
Output: [Kevin Cruijssen, Arnauld]

Input: 36
Output: [Martin Ender, Dom Hastings]

Input: 6
Output; [noodle9, Neil, Martin Ender, math, my pronoun is monicareinstate, Leaky Nun]

Input: 3
Output; [Dennis, Martin Ender, fireflame241, Dingus, Dion, Dom Hastings]
```

JavaScript (ES6), 102 bytes
Expects (book)(digits), where book is an array of strings and digits is an array of integers. Returns an array of strings.

b=>a=>b.filter(s=>eval(`/\\b[${a.map(i=>i+"01adgjmptw"[i]+"-"+"01cfilosvz"[i]).join`][`}]/i`).test(s))

Try it online!
How?
The sequence of digits is turned into a regular expression of the form:
/\b[Dx-y][Dx-y]...[Dx-y]/i

where D is the original digit and x-y is the letter range associated to it, or D-D for 0 or 1.
For instance, [2,7] becomes /\b[2a-c][7p-s]/i.
We walk through the phone book and keep only the names that are matched by this regular expression.
Commented
b => a =>             // b[] = book, a[] = integer sequence
b.filter(s =>         // for each string s in b[]:
  eval(               //   evaluate as JS code:
    "/\\b" +          //     regexp delimiter, followed by \b
    "[" +             //     followed by the first '['
    a.map(i =>        //     for each integer i in a[]:
      i +             //       append i
      "01adgjmptw"[i] //       append the first range character
      + "-" +         //       append a '-'
      "01cfilosvz"[i] //       append the second range character
    ).join`][` +      //     end of map(); join with ']['
    "]/i"             //     append the last ']' and '/i'
  )                   //   end of eval()
  .test(s)            //   keep s if it's matching the above regular expression
)                     // end of filter()


4, 8, 15, 16, 23, 42 4, 8, 15, 16, 23, 42

Write a program that outputs this sequence of numbers infinitely. However, The Numbers must not appear in your source code anywhere.

The following is not a valid Java program to output The Numbers because The Numbers appear in its source code:

class TheNumbers {
    public static void main(String[] args) {
        for(int n = 0;;) System.out.println(
            n == 4 ? n = 8 :
            n == 8 ? n = 15 :
            n == 15 ? n = 16 :
            n == 16 ? n = 23 :
            n == 23 ? n = 42 : (n = 4)
        );
    }
}

The definition of "The Numbers must not appear in your source code" is as follows:

You must not use the numeral 4.
You must not use the numeral 8.
You must not use the numeral 1 followed by the numeral 5.
You must not use the numeral 1 followed by the numeral 6.
You must not use the numeral 2 followed by the numeral 3.

If your language ignores certain characters that can be placed between the numerals, it's not a valid substitution. So for example if your language interprets the literal 1_5 as 15, this would count as the numeral 1 followed by the numeral 5.

Alternative bases are included in the restriction, so for example:

Binary 100 can't be used as a substitute for 4.
Octal 10 can't be used as a substitute for 8.
Hexadecimal F can't be used as a substitute for 15.

Therefore, the following is a valid (but not very inspired) Java program to output The Numbers because The Numbers do not appear in its source code:

class TheNumbers {
    public static void main(String[] args) {
        for(int n = '*';;) {
            System.out.println(n -= '&');
            System.out.println(n *= 2);
            System.out.println(n += 7);
            System.out.println(++n);
            System.out.println(n += 7);
            System.out.println(n += 19);
        }
    }
}

Note that in that program, '*' and '&' are substituted for the integers 42 and 38, because otherwise the numerals 4 and 8 would appear in its source code.

The definition of "outputs the sequence infinitely" is open to interpretation. So, for example, a program that outputs glyphs getting smaller until they are "infinitely" small would be valid.

Kudos if you are able to generate the sequence in some way that's not basically hard-coding each number.

Deriving it to a formula. My impression is there is not one but maybe there is or it can be faked.
Fixing a pseudo-random generator to return the sequence.

This is a popularity contest, so be creative. The answer with the most up votes on March 26th is the winner.

Java

I decided to add another entry since this is completely different from my first one (which was more like an example).

This program calculates the average of an array entered by the user...

import java.util.Scanner;

public class Numbers {
    public static double getSum(int[] nums) {
        double sum = 0;
        if(nums.length > 0) {
            for(int i = 0; i <= nums.length; i++) {
                sum += nums[i];
            }
        }

        return sum;
    }

    public static double getAverage(int[] nums) { return getSum(nums) / nums.length; }
    public static long roundAverage(int[] nums) { return Math.round(getAverage(nums)); }

    private static void beginLoop(int[] nums) {
        if(nums == null) {
            return;
        }

        long avg = roundAverage(nums);
        System.out.println("enter nums for average");
        System.out.println("example:");
        System.out.print("array is " + nums[0]);
        for(int i = 1; i <= nums.length; i++) {
            System.out.print(", " + nums[i]);
        }

        System.out.println();
        System.out.println("avg is " + avg);
    }

    private static int[] example = { 1, 2, 7, 9, };

    public static void main(String[] args) {
        boolean done = false;
        while(!done) {
            try {
                int[] nums = example;
                beginLoop(nums);

                nums = getInput();
                if(nums == null) {
                    done = true;
                } else {
                    System.out.println("avg is " + getAverage(nums));
                }
            } catch(Exception e) {
                e.printStackTrace();
            }
        }
    }

    static int[] getInput() {
        Scanner in = new Scanner(System.in);
        System.out.print("enter length of array to average or 0 to exit: ");
        int length = in.nextInt();
        if(length == 0) {
            return null;

        } else {
            int[] nums = new int[length];
            for(int i = 0; i <= nums.length; i++) {
                System.out.print("enter number for index " + i + ": ");
                nums[i] = in.nextInt();
            }
            return nums;
        }
    }
}

...or does it?

java.lang.ArrayIndexOutOfBoundsException: 4
    at Numbers.getSum(Numbers.java:8)
    at Numbers.getAverage(Numbers.java:15)
    at Numbers.roundAverage(Numbers.java:16)
    at Numbers.beginLoop(Numbers.java:23)
    at Numbers.main(Numbers.java:42)
java.lang.ArrayIndexOutOfBoundsException: 4
    at Numbers.getSum(Numbers.java:8)
    at Numbers.getAverage(Numbers.java:15)
    at Numbers.roundAverage(Numbers.java:16)
    at Numbers.beginLoop(Numbers.java:23)
    at Numbers.main(Numbers.java:42)
java.lang.ArrayIndexOutOfBoundsException: 4
    at Numbers.getSum(Numbers.java:8)
    ...


Backtickify code snippets on Stack Exchange Your goal is to input any arbitrary text, such as:

This is some text

And output that text formatted as code for posts (SE-flavored Markdown) and comments (mini-Markdown) on Stack Exchange, such as:

`This is some text`
`This is some text`

However, it gets trickier. Consider the input:

Perl has a variable called $`

The output must be

`` Perl has a variable called $` ``
`Perl has a varaible called $\``

The full rules for the formatting are:

Full posts (full SE Markdown)

Step 1: count the least number for which there are not exactly that many consecutive backticks in the string. Let's call this n. (For example, for the string potato, n is 1, for this is a backtick: `, n is 2, and for ` `` ``` ````` ``````, n is 4.)
Step 2: wrap the string in n backticks. If the string starts or ends with a backtick, you must wrap with spaces as well. (For example, potato becomes `potato`, this is a backtick: ` becomes `` this is a backtick: ` ``, and ` `` ``` ````` `````` becomes ```` ` `` ``` ````` `````` ````.

Comments (mini-Markdown)

Wrap in ` and escape all `'s with \`. (For example, potato becomes `potato`, this is a backtick: ` becomes this is a backtick: \`, and ` `` ``` ````` `````` becomes \` \`\` \`\`\` \`\`\`\`\` \`\`\`\`\`\`.

This is code-golf; the shortest answer in byte count wins.

APL (90)

(Yes, the APL charset does fit in a byte, here's IBM's codepage 907.)

{⎕ML←3⋄(,/m,m,⍨{⍵=m:'\`'⋄⍵}¨⍵),⊂(⌽g),⍵,g←(''↑⍨∨/t[1,⍴t]),m/⍨0⍳⍨z∊⍨⍳⌈/0,z←,⊃⍴¨⍵⊂⍨t←⍵=m←'`'}

This is a function that takes a string, and returns an array of two strings, where the first string is the comment representation and the second string is the full post representation.

Tests:

      backtickify←{⎕ML←3⋄(,/m,m,⍨{⍵=m:'\`'⋄⍵}¨⍵),⊂(⌽g),⍵,g←(''↑⍨∨/t[1,⍴t]),m/⍨0⍳⍨z∊⍨⍳⌈/0,z←,⊃⍴¨⍵⊂⍨t←⍵=m←'`'}
      ↑backtickify 'potato'
`potato`
`potato`

      ↑backtickify 'this is a backtick: `'
`this is a backtick: \``
`` this is a backtick: ` ``

      ↑backtickify '` `` ``` ````` ``````'
`\` \`\` \`\`\` \`\`\`\`\` \`\`\`\`\`\``
```` ` `` ``` ````` `````` ````

      ⍝ testcase for not wrapping with spaces
      ↑backtickify 'no`spaces``at````the`edges'
`no\`spaces\`\`at\`\`\`\`the\`edges`
```no`spaces``at````the`edges```

Note: I gave the function a name for readability's sake, this is not strictly necessary to use it (you can just put the argument next to the anonymous function) so I didn't count it.


Calculate the nth term of Golomb's self-describing sequence Inspired by the previous question.

Golomb's self-describing sequence g(n) is a sequence where any natural number n is repeated within the sequence g(n) times.

The first few numbers in the sequence are:

n    1  2  3  4  5  6  7  8  9  10 11 12 13 14 15 16 17 18 19 20
g(n) 1  2  2  3  3  4  4  4  5  5  5  6  6  6  6  7  7  7  7  8

You can see that g(4)=3, and that "4" is repeated 3 times in the sequence.

Given an input of n, output g(n).

Limitations: n < 100000.

Smallest code wins.

Jelly, non-competing

10 bytes This answer is non-competing, since the challenge predates the creation of Jelly.

’ßßạ¹ß‘µṖ¡

This uses the recursive formula a(1) = 1, a(n + 1) = 1 + a(n + 1 - a(a(n))) from the OEIS page.

Try it online!

How it works

’ßßạ¹ß‘µṖ¡ Main link. Input: n

’          Decrement; yield n - 1.
 ßß        Recursively call the main link twice, with argument n - 1.
   ạ¹      Take the absolute difference of a(a(n - 1)) and n.
     ß     Recursively call the main link, with argument n - a(a(n - 1)).
      ‘    Increment the result, yielding 1 + a(n - a(a(n - 1))).
       µ   Combine the chain to the left into a single link.
        Ṗ  Pop [1, ..., n]. This yields [] iff n == 1.
         ¡ Execute the chain iff Ṗ returned a non-empty array.


Multi-level marketing "legs" investment rule Multi-level marketing related challenge.
A peer wants to get rewarded. So it attracted N investors (N>=1), each i-th investor invested x[i]. When a total sum exceeds threshold x[0]+x[1]+...+x[N-1] >= T a peer could be rewarded. But only if a following conditions are satisfied:

Minimum amount of investors should be greater than M, (M<=N)
For at least one integer k, where k>=M and k<=N, any k investors have to invest at least T/k each;

Given N, x[], T, M you should determine whether the peer's reward is generated or not (boolean result, "yes" or "no"). Shortest code wins.
Examples:

N=5; M=3; T=10000, in order to generate the peer's reward one of the following must be satisfied:

any 3 invested at least 3334 each
any 4 invested at least 2500 each
all 5 invested at least 2000 each

N=6; M=2; T=5000:

any 2 invested at least 2500 each
any 3 invested at least 1667 each
any 4 invested at least 1250 each
any 5 invested at least 1000 each
all 6 invested at least 834 each

generalized: for any k, where k>=M and k<=N:

any k of N investors invested at least T/k each

Test cases:
format:
N, x[], T, M -> correct answer
6, [999, 999, 59, 0, 0, 0], 180, 3 -> 0
6, [0, 60, 0, 60, 60, 0], 180, 3 -> 1
6, [179, 89, 59, 44, 35, 29], 180, 3 -> 0
6, [179, 89, 59, 44, 35, 30], 180, 3 -> 1
6, [179, 89, 59, 44, 36, 29], 180, 3 -> 1
6, [179, 90, 59, 44, 35, 29], 180, 3 -> 0
6, [30, 30, 30, 30, 29, 30], 180, 3 -> 0
6, [30, 30, 30, 30, 30, 30], 180, 3 -> 1

Jelly,  12  9 bytes

ṢṚ×J$ṫ⁵<Ṃ

A full program which accepts x T M and prints 0 if the peer is rewarded and 1 if not.

Try it online!

How?

ṢṚ×J$ṫ⁵<Ṃ - Main Link: list of numbers, x; number, T   e.g. [100, 50, 77, 22, 14, 45], 180
Ṣ         - sort x                                          [ 14, 22, 45, 50, 77,100]
 Ṛ        - reverse                                         [100, 77, 50, 45, 22, 14]
    $     - last two links as a monad:
   J      -   range of length                               [  1,  2,  3,  4,  5,  6]
  ×       -   multiply                                      [100,154,150,180,110, 84]
     ṫ    - tail from index:
      ⁵   -   5th argument (3rd input), M   (e.g. M=3)      [        150,180,110, 84]
       <  - less than T?                                    [          1,  0,  1,  1]
        Ṃ - minimum                                         0


Shorter way to assign a default value to the standard output stream I have this code :

tr ' ' '\n'|sort -n|head -1

The code is pretty simple, it takes a list of integer in the standard input stream (like 5 9 8 7 5 2 -12 -30), it sort the integers and display only the first integer. But i need to ouput 0 if the given list is empty. And i can't find a short way to that. I have a solution with a ternary operator and a echo 0, but i feel i can do far better. I just need to replace the input stream by 0 if this stream is empty.

Sidenote : I don't need to call read to get the user input. The program is called with the input stream directly like cmd < 1 5 6 -20 45

Here my current code :

read l
[ -n "$l" ]&&echo $l|tr ' ' '\n'|sort -n|head -1||echo 0

37 33 32 bytes

tr \  \\n|sort -n|sed s/^$/0/\;q

Edit: Saved 4 bytes thanks to @DigitalTrauma.


Play some of Pachelbel's Canon Output the following excerpt from Pachelbel's Canon in D as audio:

Rules

Any format/encoding may be used, so long as a codec existed prior to the creation of this challenge
Any instrument (a real instrument, MIDI synthesis, etc.) may be used
The tempo must be 65 BPM (as notated in the sheet music) - if you cannot get exactly 65 BPM, you may use any tempo within the (inclusive) range 64.75 - 65.25
The sheet music is in concert pitch
Equal temperament tuning must be used (specifically 12-ET with A4 = 440 Hz)

For reference, here is a Stack Snippet that will play the excerpt:

<audio controls><source src="https://a.clyp.it/h3y3isar.mp3"></audio>

Mathematica, 212 152 139 135 bytes
{#~(s=##~SoundNote~41&)~1&/@LetterNumber@"uursuursuikmnprsrrnprrfgikigifgiggkiggfdfdbdfgikggkikkmnikmnprsu",{14,18,21}~s~16}~Sound~18.5

Outputs a Sound object that plays Pachelbel's Canon in D when the Play button is pressed. The instrument is MIDI instrument #41 "Violin".
The Audio
Click me!
Explanation
LetterNumber@"uursuursuikmnprsrrnprrfgikigifgiggkiggfdfdbdfgikggkikkmnikmnprsu"

Find the letter numbers of each character in the string ("a" -> 1, "b" -> 2, and so on), wrapped with a List. (This string represents Pachelbel's Canon in D)
#~(s=##~SoundNote~41&)~1&/@...

Set s to SoundNote function whose instrument is #41. Set the duration to 1 and map that function to each element in the List (thus making SoundNote primitive objects).
{14,18,21}~s~16

Make the last triad. (The duration 16 is there to make the last note 16 times longer--a whole note is sixteen times a sixteenth note.)
... ~Sound~18.5

Make a Sound object, 18.5 seconds long (because the tempo is 65 bpm [5 measures of 4/4 with tempo 65 bpm = approximately 18.5 seconds]).
126 byte version, non-competing
Sound[{(s=SoundNote)/@LetterNumber@"uursuursuikmnprsrrnprrfgikigifgiggkiggfdfdbdfgikggkikkmnikmnprsu",{14,18,21}~s~16},240/13]

Non-competing because the output contains two sixteenth notes instead of an eighth note, and the separation is quite noticeable.


Rejecting invalid IPv4 addresses I want to avoid responding to illegal or spoofed addresses. One type that's easy to detect is an address that should not exist on a packet received by my router: a special-use address.
Challenge
Given an IPv4 32-bit address, identify whether it is valid general-use address.
Challenge rules

Special-use addresses, as defined by the Internet Engineering Task Force, are considered invalid.
Special-use addresses are listed at https://en.wikipedia.org/wiki/IPv4#Special-use_addresses. A copy of the list (omitting explanatory columns) is below.
Input will be a character sequence in the dot-decimal notation, consisting of four positive decimal numbers (called "octets") each in the range 0–255 separated by periods (e.g., 169.254.0.31). Each octet represents an 8-bit segment of the address.
Output must indicate true or false, using any two indicators of your choice for true and false.

General rules:

This is code-golf, so shortest answer in bytes wins.
Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.
Standard rules apply for your answer with default I/O rules, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.
Default Loopholes are forbidden.
If possible, please add a link with a test for your code (i.e. TIO).
Also, adding an explanation for your answer is highly recommended.

Test cases:

192.0.0.254 false
192.0.1.254 true
0.255.0.0 false
128.2.3.82 true
253.8.22.37 false
203.0.114.201 true

Special-use addresses

Address Block
Address Range

0.0.0.0/8
0.0.0.0–0.255.255.255

10.0.0.0/8
10.0.0.0–10.255.255.255

100.64.0.0/10
100.64.0.0–100.127.255.255

127.0.0.0/8
127.0.0.0–127.255.255.255

169.254.0.0/16
169.254.0.0–169.254.255.255

172.16.0.0/12
172.16.0.0–172.31.255.255

192.0.0.0/24
192.0.0.0–192.0.0.255

192.0.2.0/24
192.0.2.0–192.0.2.255

192.88.99.0/24
192.88.99.0–192.88.99.255

192.168.0.0/16
192.168.0.0–192.168.255.255

198.18.0.0/15
198.18.0.0–198.19.255.255

198.51.100.0/24
198.51.100.0–198.51.100.255

203.0.113.0/24
203.0.113.0–203.0.113.255

224.0.0.0/4
224.0.0.0–239.255.255.255

240.0.0.0/4
240.0.0.0–255.255.255.255

Note on address blocks. This is a shortcut method of listing an address range, called CIDR notation. The notation is four octets followed by a slash and a decimal number. The decimal number is the count of leading 1 bits in the network mask, and indicates how many leading bits in the underlying 32-bit address range are specified as fixed. For example, a mask of 24 indicates that only the last 8 bits of the address range vary. Thus writing 192.0.2.0/24 indicates that only the last octet varies. The range for 192.0.2.0/24 is 192.0.2.0–192.0.2.255.

JavaScript (ES6),  179  178 bytes
Saved 1 byte thanks to @StackMeter's suggestion of merging the last 2 blocks
Expects a string and returns a Boolean value.

s=>'00000g0chhqo3h65u64ekjyo5w90qw5yu2vg6nq96o6nq98g6o5rvk6ojr486vb4096vgz2871grvk7romqd'.match(/.{6}/g,[a,b,c]=s.split`.`).every(S=>(x=parseInt(S,36))>>5^(a<<16|b<<8|c)&-(1<<x))

Try it online!
How?
Encoding of address blocks
Our data string encodes all blocks of special-use addresses.
We can notice that the 4th byte is always \$0\$ and can be ignored. Given a block in CIDR notation A.B.C.D/M, what's actually encoded is:
A << 21 | B << 13 | C << 5 | (24 - M)

This is a 29-bit value which fits in 6 characters in base 36.
For instance, 169.254.0.0/16 is encoded as:
169 << 21 | 254 << 13 | 0 << 5 | (24 - 16) = 356499464

which is 5w90qw in base 36.
IP test
Given an IP address \$s\$, we first extract the first 3 bytes into \$(a,b,c)\$ and ignore the 4th one:
[a, b, c] = s.split`.`

For each 29-bit encoded block address \$x\$, we do the following test:
x >> 5 ^ (a << 16 | b << 8 | c) & -(1 << x)

where -(1 << x) is our 24-bit subnet mask.
Conveniently, we can do 1 << x without isolating the 5 least significant bits of \$x\$ because this is done implicitly by the shift operations, by ECMAScript specification.


Encoding an URL in brainfuck Inspired by this question, your goal today is to encode an URL in brainfuck.

My browser has been hacked! The location bar has been turned into a brainfuck interpreter. I need a program that turns an URL into a brainfuck program. My computer is also very slow, so if the brainfuck program is small it's better.

Oh and I only have one working tab left open, my twitter. So you can only send me the program in a tweet.

Write a program that fits in a tweet (140 characters) in any language that takes a string as input and outputs a brainfuck program.
This brainfuck program will be run without input and will generate an output.
This output will be inserted into the location bar of Google Chrome, and executed.
If the behaviour of Google Chrome is identical to the behaviour you would get by entering the input string from #1, then the solution is valid. Redirection by URL shorteners is considered different behaviour - stay at least on the same domain.

You may assume the brainfuck interpreter has infinite precision signed integers in each cell and an unlimited amount of cells.

Your score is determined by the sum of the lengths of the brainfuck programs generated to encode the following set of URLs:

https://www.google.com/
https://codegolf.stackexchange.com/questions/47895/
http://www.golfscript.com/golfscript/examples.html
http://en.wikipedia.org/wiki/Percent-encoding
ftp://ftp.freebsd.org/pub/FreeBSD/
https://github.com/isaacg1/pyth/blob/master/doc.txt#L92
http://ftp.gnu.org/non-gnu/nethack/nethack-3.4.0.tar.gz.back-RSN.README

Smallest score wins.

Pyth - 118 bytes, score: 154 + 567 + 597 + 620 + 530 + 875 + 1092 = 6630 6623 4653 4435
Now using the factor multiplication algo!
This is a pretty simple algorithm, although slightly better than the above ones. I was planning to use Pyth, but with the current algorithm Python fits<140 bytes.
=zecz"//"=z?>z4}"www."zz=z?Pzqez\/zFNzKCNJ/^K.5 1=d\+pk+holN[?*-KZd>KZ*-ZK\-+\>*dK+++++\>*Jd"[>"*Jd"<-]>"*-K*JJd)\.=ZK

It first strips out the http:// by using split("//") and the www. and / at the end. Then it uses the min function to check which is the best of the the three options that is considered:

Use + or - to update current cell value to desired cell value
Go to new cell and just fill with +'s
Go to new cell and use multiplication to update by doing sqrt(n)*sqrt(n)+remainder since square has minimum perimeter of constant area. http://cydathria.com/bf/bf_ex3.html

I then always put a . to output each char.
A detailed explanation of the new code is coming soon. I kind of half-assed the golfing, especially the stripping of www. and the / at the end but I can't be bothered since I'm 20 bytes under the limit.
This surprisingly works on the ftp:// urls since this is chrome and chrome automatically makes ftp.freebsd.org/pub/FreeBSD/ into ftp://ftp.freebsd.org/pub/FreeBSD/
I plan to next use a dictionary to store the cell values and see if the character was already made in a cell.

Brainfuck Omnibox Extension
That's right! After I saw @BrainSteel's comment, I knew I had to make it. This doesn't take over the entire omnibox, only when you do bf,tab. Also since the omnibox api is weird, it doesn't let me forward the code to the omnibox, I have to handle it myself. So I do my own http:// checking and then set the tab's url.
Since I didn't feel like paying the $5 necessary to put your extension on the webstore, you guys will have to install it manually. Just download the zip from here: https://drive.google.com/file/d/0B0qkKIzGc0QiNzBzVUJjZkRIZ0k/view?usp=sharing, unzip, go into the extensions page in chrome, click dev mode option box on top-right, and load the unpacked extension.
Hope you guys enjoy! :)


(Σ*)² ⟲ Σ* (aka Round-Trip a String Pair) This is a challenge I thought of recently which I think is not hard but allows for a wide range of possible solutions. Seems like a perfect fit for the creativity of PPCG users :)
Your Task
Define two functions which together form a lossless round-trip String × String → String → String × String.
More specifically, define two functions combine and separate with repsective types String × String → String and String → String × String such that separate ∘ combine = id.
Even more specifically, define two functions (or methods/procedures/etc), which I will refer to as combine and separate, and which exhibit the following characteristics:

When invoked with a single string, separate produces two strings as results. (You may use any reasonable string type. Most languages don't canonically allow producing multiple values, so feel free to to do something equivalent, such as returning a 2-tuple or modifying two global variables.)

When invoked with two strings, combine produces a single string as result. (You may accept input to separate in the same form that combine produces, or any other reasonable form.)

For any two strings a and b, separate(combine(a, b)) must result in two strings which are (structurally) equivalent to a and b.

The above bullets are the only restrictions on combine and separate. So, for instance, combine ∘ separate need not be id, and separate can even be a partial function, if you like.

(Defer to the final and more-verbose description if there are any ambiguities between the three)
Intent
My goal with this challenge is to inspire creative and interesting solutions. As such, in order to avoid priming/suggesting your thinking about how to solve this problem, I will not be providing test cases, and I strongly suggest that you do not look at the existing answers until you submit your own.
Winning Criteria
This challenge is a popularity-contest; the answer with the highest score at noon on April 5th, UTC, is the winner.
Guidelines for voters, included to be a valid popularity-contest, are as follows:

Strongly prefer answers which you do not immediately comprehend, are not obviously correct, and/or surprise you
Prefer answers which go beyond strings, i.e., those which make use of more than the problem statement did (functions, strings, pairs)
Avoid answers which are similar to your own solution(s)
Avoid answers which boil down to language builtins

Have fun!

I know this is extra credit, but your problem got me thinking a lot about this and what interested me the most was not just separate being the left inverse of combine, but having them be true inverses of each other. This ends up with us defining a bijection from String -> String x String. The path I took was as follows

Define a bijection from String -> N
Define a bijection from N -> N x N
Combine them to get the functions we need

String -> N
Let r be the size of the character set you're working with and give each character a unique value from 1 to r, say f(c) = n. Going from right to left and indexing starting from zero, create the number f(s[0])r^0 + f(s[1])r^1 + f(s[2])r^2 ... f(s[length(s)])r^(length(s)). The lowest number you can get this way is 1, so we let the empty string equal 0.
N -> N x N
Take n in any base you like. Separate even digits into one part of the tuple and the odd digits into the other to make a pair of numbers. E.g. 12345 -> (24, 135). To work your way back, combine the numbers in the opposite way, inserting extra zeros as necessary.
Putting it all together
Haskell

module Main where

import Data.Function ((&))
-- tio is saying this isn't correct for some reason so gotta define it manually
-- import Data.Functor ((<&>))

main :: IO ()
main = do
  putStrLn $ show $ separate "Hello, world!"
  putStrLn $ combine ("Hello, world!", "")
  putStrLn $ show $ separate $ combine ("Hello, world!", "")
  putStrLn $ combine $ separate "Hello, world!"

separate :: String -> (String, String)
separate str =
  str
  <&> toInt
  & fromNZ
  & split
  & tmap toNZ
  & tmap (map fromInt)

combine :: (String, String) -> String
combine strs =
  strs
  & tmap (map toInt)
  & tmap fromNZ
  & join
  & toNZ
  <&> fromInt

base :: Int
base = 95

toInt :: Char -> Int
toInt c = fromEnum c - 31

fromInt :: Int -> Char
fromInt i = toEnum $ i + 31

strip :: [Int] -> [Int]
strip is = case is of
  0 : i : tail -> strip $ i : tail
  _ -> is

split :: [Int] -> ([Int], [Int])
split =
  tmap strip . fst . foldr
    (\a ((acc1, acc0), i) ->
      (if mod i 2 == 0 then
        (acc1, a : acc0)
      else
        (a : acc1, acc0)
      , i + 1
      )
    )
    (([], []), 0)

join :: ([Int], [Int]) -> [Int]
join (l1, l2)= strip $ reverse $ go [] (reverse l1, reverse l2)
  where
    go :: [Int] -> ([Int], [Int]) -> [Int]
    go acc (l1', l2') = case (l1', l2') of
      (head1 : tail1, head2 : tail2) -> head2 : head1 : go acc (tail1, tail2)
      ([], head : tail) -> head : 0 : go acc ([], tail)
      (head : tail, []) -> 0 : head : go acc (tail, [])
      ([], []) ->  acc

tmap :: (a -> b) -> (a, a) -> (b, b)
tmap f (a1, a2) = (f a1, f a2)

fromNZ :: [Int] -> [Int]
fromNZ is =
  if is == [] then [0]
  else let
    (result, finalCarry) =
      foldr
        (\i' (acc, carry) ->
          let
            i =
              if carry then i' + 1
              else i'
          in
            if i >= base then (i - base : acc, True)
            else (i : acc, False)
        )
        ([], False)
        is
  in
    if finalCarry then 1 : result
    else result

toNZ :: [Int] -> [Int]
toNZ is =
  if is == [0] then []
  else let
    (result, finalUncarry) =
      foldr
        (\i' (acc, uncarry) ->
          let
            i =
              if uncarry then i' - 1
              else i'
          in
            if i <= 0 then (i + base : acc, True)
            else (i : acc, False)
        )
        ([], False)
        is
  in
    if finalUncarry then
      case result of
        a : tail ->
          if a == base then tail
          else result
        _ -> result
    else result

m <&> f = f <$> m
infixl 1 <&>

Try it online!


Count the number of ways of putting balls into bins In this task you are given an odd number of white balls and the same number of black balls. The task is to count all the ways of putting the balls into bins so that in each bin there is an odd number of each color.

For example, say we have 3 white balls. The different ways are:

(wwwbbb)
(wb)(wb)(wb)

for the two different possibilities.

If we have 5 white balls the different ways are:

(wwwwwbbbbb)
(wwwbbb)(wb)(wb)
(wwwb)(wbbb)(wb)
(wb)(wb)(wb)(wb)(wb)

You can take the input, which is a single integer, in any way you like.  The output is just a single integer.

Your code must be fast enough so that you have seen it complete for 11 white balls.

You can use any language or library that you like.


Convert braces to Right Hand Brace (Sad Brace) Right hand brace is a style of code bracketing in which curly braces and semicolons are all aligned to a single point on the right side of a a file.

Generally, this is considered bad practice, for several reasons.
The Challenge
Take a multiline string through any method, and convert it's brace style to Right Hand Brace.
For this challenge, you only need it to work on Java code, however, it should theoretically work on any code that uses Braces and Semicolons.
You must grab all {}; characters in a row, with any amount of whitespace between them. EG. }}, ; } }\n\t\t}, and line them up on the right side of the file through the use of whitespace.
for example:
a {
b;
{c

should become
a {
b ;{
c

Or, more abstractly, push any and all whitespace from the left of all {}; characters, to the right.
Indentation of lines should be otherwise preserved. Lines only containing whitespace after the movement of the {}; characters may optionally be removed.
For example:
a{
    b{
        c;
    }
}
d;

May become either
a        {
    b    {
        c;}}
d        ;

or
a        {
    b    {
        c;}}

d        ;

Pushed to the right refers to all the {}; characters being aligned to a point no shorter than the longest line. Any amount of space after that is acceptable.
So all the below is acceptable:
a {
bc;

a  {
bc ;

a   {
bc  ;

etc...
Lines in any code may contain {}; characters between other non-whitspace characters, the handling of this case isn't necessary, although if you're inclined, you should leave them in place. Lines may also not contain any {}; characters at all, and this should be handled correctly. As is shown below.
a {
b ;
c
d }

Because we don't want Code Review to see the horrible things we're doing, you need to make your code as small as possible.
Examples / Testcases
Generic Java
public class HelloWorld{
       public static void main(String[] args){
           System.out.println("Hello, World!");
       }
}

becomes...
public class HelloWorld                        {
    public static void main(String[] args)     {
        System.out.println("Hello, World!")    ;}}

The image itself
public class Permuter{
    private static void permute(int n, char[] a){
        if (n == 0){
            System.out.println(String.valueOf(a));
        }else{
            for (int i=0; i<= n; i++){
                permute(n-1, a);
                swap(a, n % 2 == 0 ? i : 0, n);
            }
        }
    }
    private static void swap(char[] a, int i, int j){
        char saved = a[i];
        a[i] = a[j];
        a[j] = saved;
    }
}

becomes...
public class Permuter                                {
    private static void permute(int n, char[] a)     {
        if (n == 0)                                  {
            System.out.println(String.valueOf(a))    ;}
        else                                         {
            for (int i=0; i<= n; i++)                {
                permute(n-1, a)                      ;
                swap(a, n % 2 == 0 ? i : 0, n)       ;}}}
    private static void swap(char[] a, int i, int j) {
        char saved = a[i]                            ;
        a[i] = a[j]                                  ;
        a[j] = saved                                 ;}}

Not so Perfectly Generic Python
For contrast
def Main():
    print("Hello, World!");

Main();

becomes...
def Main():
    print("Hello, World!")    ;
Main()                        ;

Notes

Standard Loopholes apply
Standard IO applies
This is code-golf, so shortest program in bytes wins!
I am not Liable for damages related to programming in Right Hand Brace style
Have Fun!

Edit Notes
I reworded the challenge details, Hopefully I didn't break anyone's view of the rules, I assure you it was unintentional. This should be a much more clear and less self-conflicting spec.

V + Bash utilities, 64 62 61 60 62 bytes

1 byte saved thanks to @DJMcMayhem for putting the ex commands together

:se ve=all|%!wc -L
y$uò/^ *<93>[{};]
xk$pòò/<84> {};][{};]«$
lDî^R0|p

^R is the character literal for <C-r> (0x12) and <84> is 0x84 and <94> is 0x94.

wc -L works on most *nix based systems, but not macOS. For macOS, you have to do gwc -L  after getting coreutils using brew, if you haven't already.

Try it online! (Java)

Try it online! (Python)

Try it online! (Java again)

This preserves all blank lines and does not handle tabs, only spaces.

Hexdump:

00000000: 3a73 6520 7665 3d61 6c6c 7c25 2177 6320  :se ve=all|%!wc
00000010: 2d4c 0a79 2475 f22f 5e20 2a93 5b7b 7d3b  -L.y$u./^ *.[{};
00000020: 5d0a 786b 2470 f2f2 2f84 207b 7d3b 5d5b  ].xk$p../. {};][
00000030: 7b7d 3b5d ab24 0a6c 44ee 1230 7c70       {};].$.lD..0|p

Explanation

First we need to be able to move the cursor anywhere in the buffer, so we use

:se ve=all|...

and we chain this with another ex command using |

We need to get the length of the longest line in the input. This can be done with the shell command wc -L.

       ...|%!wc -L

This overwrites the current buffer (containing the input) with the result of wc -L. It gives an output of something like:

            42

and the cursor lands on the 4 in 42. Then we copy this number by using y$: yank text from the cursor's position to the end of the line. This conveniently stores this number in register 0. But more on that later. The input is replaced with this number, so to revert back, we undo.

Now say the input looked somewhat like this:

public class HelloWorld{
    public static void main(String[] args){
        System.out.println("Hello, World!");
    }
}

we need to move the braces } from the end of the buffer to just after the println statement.

ò                  " recursively do this until a breaking error:
 /^ *<93>[{};]     "   this compressed regex becomes /^ *\zs[{};]
                   "   this finds any character from `{};` after leading spaces
                   "   the cursor then goes to the `{};`

x                  "   delete character
 k$                "   go to the end of the line above
   p               "   and paste
    ò

If the regex cannot be found, a breaking error happens and breaks out of the recursion caused by ò.

Now comes the main part of this program, move all braces and semi-colons and align them as stated in the question.

ò                  " starts recursion
 /<84> {};][{};]«$ "   compressed form of [^ {};][{};]\+$
                   "   finds a sequence of `{};`s at the end of the line with a non-`{};` char to preceding it
 l                 "   move the cursor 1 to the right (since we were on the non-`{};` char now)
  D                "   delete everything from this position to the end of line
                   "   the deleted text contains `{};`
   î               "   execute as normal commands:
    ^R0            "   contains what's in register `0`, ie the length of the longest line
       |           "   now go to the column specified by that number
        p          "   and paste the contents
                   " implicit ending `ò`

Again, this recursion will be stopped by a breaking error caused when the regex could not be found in the buffer.

Edits

Used D instead of d$ (I don't even know why I missed that in the first place)
Compressed [^ (in the regex) to <84>
Fixed bug by using \zs (compressing it into <93>) and by removing the $ in $xk$pò
Removed useless newline
Changed regex to make submission compliant with new rules and gained 2 bytes


Road-Length Encoding In the United States, the two opposing directions of traffic on a road are separated by a dashed yellow line if passing is allowed and two solid yellow lines if passing is not allowed.

(Just one side can be dashed to allow passing on that side, and yellow lines can mean other things like center or reversible lanes, but we aren't concerned with any of those cases.)
Write a program that takes in a run-length encoded string of P for passing and N for no passing, and prints an ASCII version of the corresponding road. Except for the center line, the road always has the same pattern, which can be easily inferred from the examples below.
There will be a positive decimal number before each P and N in the input string. This number defines the length of the passing or no passing region of the current part of the road.
Examples
An input of 12N would produce 12 columns of no passing road (center line all =):
____________

============

____________

An input of 12P would produce 12 columns of passing road (center line -  repeating):
____________

- - - - - -

____________

Passing and no passing can then be combined, e.g. 4N4P9N7P1N1P2N2P would produce:
______________________________

====- - =========- - - -=-==-

______________________________

These are 4 no passing columns, then 4 passing, then 9 no passing, etc.
Note that a passing zone always starts with a dash (-) on the leftmost side, not a space ( ). This is required.
Details

The input will never have two N zones or two P zones in a row. e.g. 4P5P will never occur.
You don't need to support letters without a leading positive number. Plain P will always be 1P, plain N will always be 1N.
There may be trailing spaces as long as they do not extend beyond the final column of the road. There may be one optional trailing newline.
Instead of a program, you may write a function that takes in the run-length encoded string and prints or returns the ASCII road.
Takes input in any standard way (stdin, command line, function arg).

The shortest code in bytes wins. Tiebreaker is earlier post.

JavaScript (ES6), 114
Using  template strings, the 5 linefeeds are significant are must be counted.
f=s=>(b=(s=s.replace(/(\d+)(.)/g,(x,n,b)=>(b<'P'?'=':'- ').repeat(n).slice(0,n))).replace(/./g,'_'))+`

${s}

`+b


Find one point per pyramidal region Consider 3 dimensional space which has been partitioned by at least two planes  which go through the origin.  If there are n planes then the number of distinct pyramidal regions this creates is exactly 2 - n + n^2 as long as they are in "general position", a term I make specific below.

  The challenge is write code that will return one point per pyramidal region. That is to return 2 - n + n^2 points in 3d space, each of which is in a different pyramidal region.

Notice that a plane through the origin can be defined by a single vector starting at the origin which is orthogonal to the plane.

Your code should take a list of planes in as input, each plane being described by a vector from the origin which is orthogonal to it.  The vector itself is just represented as a space separated list of three numbers. Your should output a list of 2 - n + n^2 points. You can assume the planes are in general position, that is that no three of the vectors defining the planes are coplanar.

I will verify that the points are really all in different pyramidal regions using the following code.

Let us assume the variable planes contains an array of vectors, each one of which defines the plane. For example, let n = 4, the planes could equal

[[ 0.44060338 -0.55711491 -0.70391167]
 [ 0.15640806  0.89972402  0.40747172]
 [-0.48916566  0.86280671  0.12759912]
 [ 0.25920378 -0.94828262  0.18323068]]

We can then choose a number of points and put them in a 2d array called testpoints.  To determine if they are all in distinct pyramidal regions we can call the following Python function which just looks to see which side of each plane the points are on and checks that each point is on at least one different side from every other point.

def all_in_distinct_pyramidal_regions(testpoints, planes):
    signs = np.sign(np.inner(testpoints, hyperplanes))
    return (len(set(map(tuple,signs)))==len(signs))

You can create some random test planes by first sampling points on a sphere and then using those points to define the hyperplanes. Here is a Python function that does this sampling.

import numpy as np
def points_on_sphere(N, norm=np.random.normal):
    """
    http://en.wikipedia.org/wiki/N-sphere#Generating_random_points
    """
    normal_deviates = norm(size=(N, 3))
    radius = np.sqrt((normal_deviates ** 2).sum(axis=0))
    points = normal_deviates / radius
    return points

You can use any language you choose for which there is a free and easy way to run the code in Linux. You can use any standard libraries of that language.  I will however want to test your code so please give full instructions for how to run it.

Code to produce 10 random points on a sphere can be run using http://ideone.com/cuaHy5 .

Here is a picture of the 4 planes described above along with 2 - 4 + 16 = 14 points, one in each of the pyramidal regions created by the planes.

A valid output for this instance would therefore be the 14 points.

0.96716439  0.21970818  0.12775507
-0.84226594 -0.37162037 -0.39049504
0.60145419  0.58557551 -0.54346497
-0.4850864   0.26433373 -0.83355796
-0.69380885 -0.62124759  0.36425364
0.09880807 -0.09275638  0.99077405
0.19131628 -0.97946254 -0.06364919
-0.98100047  0.17593773 -0.08175574
-0.76331009  0.63554838 -0.11591362
0.89104146  0.34728895  0.29229352
-0.61696755 -0.26411912  0.74134482
0.18382632 -0.03398322 -0.98237112
-0.44983933 -0.18244731  0.87427545
0.8391045   0.18244157 -0.51246338


Perform basic operations on complex numbers in a language without native support for complex numbers Your code has to provide the following functions:

read(x)

  Reads a complex number from the standard input. It has to accept and evaluate something in the form of for example 1.42 + 3i.

print(x)

  Prints the complex number in the form of, for example 1.23 - 4.32i

add(x,y)
sub(x,y)
mult(x,y)
div(x,y)

  Adds, subtracts, multiplies and respectively divides the two complex numbers.

It is enough if your functions are accurate to two digits after the decimal point, of course, it can be more if you so wish. The input will never have more than two digits after the decimal point.

Any language without native support for complex numbers may be used. Similarly, libraries or other language features which deal with complex numbers are not permitted. The point is, you have to do all the handling of complex numbers by yourself.

Scoring

This is a code golf. The score is the sum of the lengths of the function bodies. For example, int add(int a, int b) {return a+b;} will have a length of 11 because of return a+b. Your solution must have a main program which demonstrates the use of the functions (for easier evaluation of your solution), but it will not be part of the scoring.

You can store the complex numbers in any way you wish, but the functions must have exactly the same amount of parameters as in the above description.

EDIT: For languages that support it, you can use operator overloading instead of the add, sub, etc. functions.

EDIT 2: To prohibit the cheap #define all_your_code_here A, I'll try to clarify the "only function bodies count" better: every character in the code counts, except for the overhead required to declare and define the functions and the libraries required to do basic I/O. By basic I/O I still mean no language features which directly deal with complex numbers. The main or equivalent where you call these functions don't count but you are not allowed to do anything besides using those functions for demonstrative purpose.

APL (33 + 16 + 1 + 1 + 14 + 17 = 82)

APL does have support for complex numbers if you use it (of the format 5J6, like Python's 5+6j), but it is of course not used.

I represent complex numbers as a 2-tuple of regular numbers, (A B) where A is the real part and B is the imaginary part. This means I can use APL's + and - operators directly, as they can be used on multidimensional types. (i.e. 1+2 3 4 gives 3 4 5 and 1 2+20 10 gives 21 12).

An APL function is represented as {body}. Functions are first-class objects. I have counted the function body without the braces, except for + and - which I've counted as 1 each.

read  ← {⎕ML←3⋄(1,1-2×'-'∊⍵)×⍎¨⍵⊂⍨⍵∊'.',⎕D} ⍝ 33 chars
print ← {⍕(⊃⍵)'+'(⊃⌽⍵)'i'}                   ⍝ 16 chars
add   ← +                                      ⍝ 1 char
sub   ← -                                      ⍝ 1 char
mul   ← {(-/⍺×⍵),+/⍺×⌽⍵}                      ⍝ 14 chars
div   ← {⍺mul 1 ¯1×⍵÷+/⍵*2}                   ⍝ 17 chars

Usage:
(clarification: APL is evaluated right-to-left so this is actually calculating 8+9i ÷ 5+6i.)

      print (read⍞) div (read⍞)
5 + 6i
8 + 9i
1.540983607 + ¯0.04918032787 i


Highlight the Bounding Box, Part II: Hexagonal Grid You're given a hexagonal grid of the characters . and #, like this:
 . . . . . . . .
. . . . # . . .
 . # . . . # . .
. . . # . . . .
 . . . . . # . .
. . . . . . . .

Your task is to fill the entire axis-aligned bounding box of the # with further #:
 . . . . . . . .
. . # # # # . .
 . # # # # # . .
. . # # # # # .
 . . # # # # . .
. . . . . . . .

The axis-aligned bounding box is the smallest convex hexagonal shape which contains all the #. Note that in the case of the hexagonal grid, there are three axes to consider (W/E, SW/NE, NW/SE):

Here is another example to show that in some cases, one or more sides will contain only one #:
. . . . . . . .         . . . . . . . .
 . # . . . . . .         . # # # # . . .
. . . . . # . .         . . # # # # . .
 . . # . . . . .         . . # # # . . .
. . . . . . . .         . . . . . . . .

You can either view these as hexagons with degenerate sides, or you can draw the bounding box around them, like I have done above, in which case they are still hexagons:

Too hard? Try Part I!
Rules
You may use any two distinct non-space printable ASCII characters (0x21 to 0x7E, inclusive), in place of # and .. I'll continue referring to them as # and . for the remainder of the specification though.
Input and output may either be a single linefeed-separated string or a list of strings (one for each line), but the format has to be consistent.
You may assume that the input contains at least one # and all lines are the same length. Note that there are two different "kinds" of lines (starting with a space or a non-space) - you may not assume that the input always starts with the same type. You may assume that the bounding box always fits inside the grid you are given.
You may write a program or a function and use any of the our standard methods of receiving input and providing output.
You may use any programming language, but note that these loopholes are forbidden by default.
This is code-golf, so the shortest valid answer – measured in bytes – wins.
Test Cases
Each test case has input and output next to each other.
#    #

 . .      . .
# . #    # # #
 . .      . .

 . #      . #
. . .    . # .
 # .      # .

 # .      # .
. . .    . # .
 . #      . #

 # .      # .
# . .    # # .
 . #      # #

 . #      # #
# . .    # # #
 . #      # #

. . #    . # #
 . .      # #
# . .    # # .

# . .    # # .
 . .      # #
. . #    . # #

. . . . . . . .         . . . . . . . .
 . . # . # . . .         . . # # # . . .
. . . . . . . .         . . . # # . . .
 . . . # . . . .         . . . # . . . .

. . . . . . . .         . . . . . . . .
 . . # . . . # .         . . # # # # # .
. . . . . . . .         . . . # # # # .
 . . . # . . . .         . . . # # # . .

. . . . . . . .         . . . . . . . .
 . # . . . . . .         . # # # # . . .
. . . . . # . .         . . # # # # . .
 . . . . . . . .         . . . . . . . .

. . . . . . . .         . . . . . . . .
 . # . . . . . .         . # # # # . . .
. . . . . # . .         . . # # # # . .
 . . # . . . . .         . . # # # . . .

. . . . # . . .         . . # # # # . .
 . # . . . # . .         . # # # # # . .
. . . # . . . .         . . # # # # # .
 . . . . . # . .         . . # # # # . .

Pyth, 82 71 bytes

L,hbebMqH@S+GH1KhMyJs.e,Lkfq\#@bTUb.zA,ySm-FdJySsMJj.es.eXW&&gKkgG-kYgH+kYZ\.\#b.z
MqH@S[hGHeG)1j.es.eXW&&ghMJs.e,Lkfq\#@bTUb.zkgSm-FdJ-kYgSsMJ+kYZ\.\#b.z

Try it online!

Explanation

Let A be the point with the lowest y-coordinate and B the point with the highest y-coordinate.
Let C be the point with the lowest (x-value minus y-value) and D the point with the highest.
Let E be the point with the lowest (x-value plus y-value) and F the point with the highest.

Then it is equivalent to finding the coordinates which the y-coordinate is between A and B, the x-value minus y-value is between C and D, and the x-value plus y-value is between E and F.


Check if a number is a product of consecutive integer numbers Some numbers such as: 6, 12, 20, 30, 42, 56, 60, 90, 120 and so on as can be expressed as a product of consecutive integer numbers as shown below.

6   = 2 * 3
12  = 3 * 4
30  = 5 * 6
60  = 3 * 4 * 5
90  = 9 * 10
120 = 4 * 5 * 6

Write a program or function that outputs a list of consecutive integers which product equals the specified number.

Examples of numbers that are not fit for this logic are:

99  = 9 * 11  (Product of non-consecutive numbers)
121 = 11 * 11 (Same numbers)
2   = 1 * 2   (Product of itself and 1)
13  = 13      (Product of only one number)

Please note that for the case of 2 = 2 * 1, we do not consider it as a valid result, as a integer multiplied by 1 gives the same result. For this question, we would consider only integers >= 2 in the product.

Input

A valid 32-bit positive integer. Can be from standard input, a function argument, etc.

Output

A list of consecutive integer numbers >= 2 (in either ascending or descending order).
If there are several combinations of consecutive integers, just provide one instance will do. If you provide more, its fine.

Restrictions

The code should take a reasonable amount of time (< 5 minutes) to run on a standard computer for all valid inputs (positive 32-bit integers). If there is a consecutive integer product, the code should output one or more within the time limit. Else, the code should terminate with no output within the time limit.

This is code golf, so the shortest code in bytes wins.

Java - 124

String f(int t){int s=2,h=3,p=s,i;String o="";for(;p!=t&&s*s<t;p=p<t?p*h++:p/s++);if(p==t)for(i=s;i<h;o+++=i+" ");return o;}

Starting at 2, this loops until the start number is > the square root of the target (or target is reached exactly). If the product is low, it multiplies by the high number and increments it. If high, it divides by the starting number and increments it.
For example, for 30, it would check:
2*3     = 6 (too low, multiply)
2*3*4   = 24 (too low, multiply)
2*3*4*5 = 120 (too high, divide)
3*4*5   = 60 (too high, divide)
4*5     = 20 (too low, multiply)
4*5*6   = 120 (too high, divide)
5*6     = 30 (bingo!)

Outputs a space-separated string of factors in ascending order.
With line breaks:
String p(int t){
    int s=2,h=3,p=s,i;
    String o="";
    for(;p!=t&&s*s<t;p=p<t?p*h++:p/s++);
    if(p==t)
        for(i=s;i<h;o+=i+" ");
    return o;
}


Decide a C integer literal Objective
Given an ASCII string, decide whether it is a valid C integer literal.
C integer literal
A C integer literal consists of:

One of:

0 followed by zero or more octal digits (0–7)

A nonzero decimal digit followed by zero or more decimal digits (0–9)

0X or 0x, followed by one or more hexadecimal digits (0–9, A–F, and a–f)

optionally followed by one of:

One of U or u, which are the "unsigned" suffixes

One of L, l, LL, or ll, which are the "long" and "long long" suffixes

Any combination of the above, in any order.

Note that there can be arbitrarily many digits, even though C doesn't support arbitrary-length integers. Likewise, even if the literal with l and co would overflow the long type or co, it is still considered a valid literal.
Also note that there must not be a leading plus or minus sign, for it is not considered to be a part of the literal.
Rules

It is implementation-defined to accept leading or trailing whitespaces.

Non-ASCII string falls in don't care situation.

Examples
Truthy

0

007

42u

42lu

42UL

19827489765981697847893769837689346573uLL (Digits can be arbitrarily many even if it wouldn't fit the unsigned long long type)

0x8f6aa032838467beee3939428l (So can to the long type)

0XCa0 (You can mix cases)

Falsy

08 (Non-octal digit)

0x (A digit must follow X or x)

-42 (Leading signature isn't a part of the literal)

42Ll (Only LL or ll is valid for the long long type)

42LLLL (Redundant type specifier)

42Uu (Redundant type specifier)

42Ulu (Redundant type specifier)

42lul (Redundant type specifier)

42H (Invalid type specifier)

0b1110010000100100001 (Valid C++, but not valid C)

Hello

Empty string

Ungolfed solution
Haskell
Doesn't recognize leading or trailing whitespaces.
Returns () on success. Monadic failure otherwise.
import Text.ParserCombinators.ReadP

decideCIntegerLit :: ReadP ()
decideCIntegerLit = do
    choice [
        do
            '0' <- get
            munch (flip elem "01234567"),
        do
            satisfy (flip elem "123456789")
            munch (flip elem "0123456789"),
        do
            '0' <- get
            satisfy (flip elem "Xx")
            munch1 (flip elem "0123456789ABCDEFabcdef")
        ]
    let unsigned = satisfy (flip elem "Uu")
    let long = string "l" +++ string "L" +++ string "ll" +++ string "LL"
    (unsigned >> long >> return ()) +++ (optional long >> optional unsigned)
    eof

Retina 0.8.2, 60 59 bytes
i`^(0[0-7]*|0x[\da-f]+|[1-9]\d*)(u)?(l)?(?-i:\3?)(?(2)|u?)$

Try it online! Link includes test cases. Edit: Saved 1 byte thanks to @FryAmTheEggMan. Explanation:
i`

Match case-insensitively.
^(0[0-7]*|0x[\da-f]+|[1-9]\d*)

Start with either octal, hex or decimal.
(u)?

Optional unsigned specifier.
(l)?

Optional length specifier.
(?-i:\3?)

Optionally repeat the length specifier case sensitively.
(?(2)|u?)$

If no unsigned specifier yet, then another chance for an optional specifier, before the end of the literal.


The Alphabet Chromosome Introduction

Alphabet challenges are in our DNA, so let's show it.

Challenge

Print the following the text exactly:

AaBbCc        cCbBaA
BbCcDd        dDcCbB
EeFfGg        gGfFeE
HhIiJj        jJiIhH
KkLlMm        mMlLkK
NnOoPp        pPoOnN
QqRrSs        sSrRqQ
TtUuVv        vVuUtT
   WwXx      xXwW
       Yy  yY
         ZZ
         zz
         ZZ
       Yy  yY
   WwXx      xXwW
TtUuVv        vVuUtT
QqRrSs        sSrRqQ
NnOoPp        pPoOnN
KkLlMm        mMlLkK
HhIiJj        jJiIhH
EeFfGg        gGfFeE
BbCcDd        dDcCbB
AaBbCc        cCbBaA

Rules

You must match the case of each letter
Trailing and/or leading newlines and/or spaces are allowed

Winning

Shortest code in bytes wins.

Vim (no external tools), 106 bytes

Newlines for clarity:

:h<_↵↵↵YZZPllabc♥
:s/./\u&&/g↵
qa6li↵♥q7@a3i ♥fY
i↵    →→↵  →↵→ð♥
ʌHA ♥9l
qbmaʌ99jY$P`ah@bq@b
y11G:g//m0↵P

Here ↵ is Return, → is Right, ♥ is Escape, ʌ is CTRL-V, and ð is Delete.


The Binary Binary Expansion Normally, we decompose a number into binary digits by assigning it with powers of 2, with a coefficient of 0 or 1 for each term:
25 = 1*16 + 1*8 + 0*4 + 0*2 + 1*1
The choice of 0 and 1 is... not very binary. We shall perform the true binary expansion by expanding with powers of 2, but with a coefficient of 1 or -1 instead:
25 = 1*16 + 1*8 + 1*4 - 1*2 - 1*1
Now this looks binary.
Given any positive number, it should be trivial to see that:

Every odd number has infinitely many true binary expansions
Every even number has no true binary expansions

Hence, for a true binary expansion to be well-defined, we require the expansion to be the least, i.e with the shortest length.

Given any positive, odd integer n,  return its true binary expansion, from the most significant digit to the least significant digit (or in reversed order).
Rules:

As this is code-golf, you should aim to do this in the shortest byte count possible. Builtins are allowed.
Any output that can represent and list the coefficients is acceptable: an array, a string of coefficients with separators, etc...
Standard golfing loopholes apply.
Your program should work for values within your language's standard integer size.

Test Cases
25 -> [1,1,1,-1,-1]
47 -> [1,1,-1,1,1,1]
1 -> [1]
3 -> [1,1]
1234567 -> [1,1,-1,-1,1,-1,1,1,-1,1,-1,1,1,-1,1,-1,-1,-1,-1,1,1]

Japt, 6 bytes
¤é r0J

Try it online!
Explanation:
¤é r0J  // Test input:                  25
¤       // Binary the input:            11001
 é      // Rotate 1 chars to the right: 11100
   r0J  // Replace 0s with -1:          111-1-1


Java is to JavaScript as Car is to Carpet Title stolen inspired by Greg Hewgill's answer to What's the difference between JavaScript and Java?

Introduction

Java and JavaScript are commonly used languages among programmers, and are currently the most popular tags on Stack Overflow. Yet as we all know, aside from similar names, the two have almost nothing in common.

In honor of one of programming's most infamous debates, and inspired by my recent frustrations in tag searching, I propose the following:

Challenge

Write a program which takes in a string as input. Return car if the string begins with "Java" and does not include "JavaScript". Otherwise, return carpet.

Example Input and Output

car:

java
javafx
javabeans
java-stream
java-script
java-8
java.util.scanner
java-avascript
JAVA-SCRIPTING
javacarpet

carpet:

javascript
javascript-events
facebook-javascript-sdk
javajavascript
jquery
python
rx-java
java-api-for-javascript
not-java
JAVASCRIPTING

Notes

Input matching should be case insensitive
Only possibilities for output should be car or carpet
Imaginary bonus points if your answer uses Java, JavaScript, or Regex
Alternate Title: Java is to JavaScript as ham is to hamster

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.


Manhattan distance of rotation sequence I though this would be a good challenge : http://adventofcode.com/2016/day/1
Task description
Given a sequence of rotations and distances following the pattern (L|R)[1-9][0-9]*, give the manhattan distance between the start and the ending points, that is the minimal number of vertical and horizontal moves on a grid.
Examples
For example, if we assume you started facing North:
Following R2, L3 leaves you 2 blocks East and 3 blocks North, or 5 blocks away.
R2, R2, R2 leaves you 2 blocks due South of your starting position, which is 2 blocks away.
R5, L5, R5, R3 leaves you 12 blocks away.
Technical details
You can choose the separator between the moves (e.g. : "\n", ", ", or ",").
You must give the answer as an integer in base 10.
Not a duplicate!
It is not a duplicate for multiple reasons :

The moves are not the same. Here they are rotations, not directions.
I want the Manhattan distance, not the euclidian.

Python 3, 109 99 104 101 bytes

This is a simple answer that uses complex numbers, with input as a space-separated string or a newline-separated string. Golfing suggestions welcome!

Edit: -13 bytes thanks to Labo. +5 bytes for converting to an int.

d=p=0
for r in input().split():d+=1-2*(r<'R');p+=1j**d*int(r[1:])
print(int(abs(p.real)+abs(p.imag)))

Ungolfing

def manhattan_rotation(seq, nsew=0, pos = 0):
    for rot in seq.split():
        # change direction
        if rot[0] == "L":
            nsew += -1
        else:
            nsew += 1
        # move in that direction rot[1:] times
        pos += 1j ** nsew * int(rot[1:])
    return int(abs(pos.real)+abs(pos.imag))


Shortest Longest Increasing Subsequence Code The Challenge is to write the shortest implementation to find the Longest increasing subsequence .

Example :
Let S be the sequence 1 5 7 1 8 4 3 5 [length of S = 8 ]

We have 1 sub-sequence of length 0 [will consider it increasing]
6 sub-sequences of length 1 {1,5,7,8,4,3}[all of them are considered increasing]
(7*8)/2 sub-sequences of length 2 [but we will remove duplicates], the increasing sub-seq are in strong black.
{15,17,11,18,14,13,57,51,58,54,53,55,71,78,74,73,75,84,83,85,43,45,35}

[note that we only interested in strictly-increasing sub-sequences]

[you can't change the order of the elements inside the sequence , so there is no sub-sequence [37] in the example sequence]

We have increasing sub-sequences of length 4 which is 1578 , but there's no sub-sequence of length 5 , so we consider the length of the longest increasing sub-sequence = 4.

Input:

a1 a2 ... aN   (The sequence)

all numbers are positive integers less than 103
N <= 1000

Output:

One integer denoting the length of the longest increasing sub-sequence of the input sequence .

sample input(1)
1 2 4 2 5
sample output(1)
4

sample input(2)
1 5 7 1 8 4 3 5
sample output(2)
4

Your code should run in a timely manner please test your code on this case before submit it here (also the link contains my 290-byte c++11 solution )

You can either take the input from a file/stdin or as a function parameter and you can either print the output to a file/stdout or just return the value if you write a function

Score Board

Dennis CJam - 22
isaacg Pyth - 26
Howard GolfScript - 35
proud haskeller Haskell - 56
Ray Python 3 - 66
histocrat Ruby - 67
DLeh C# - 92
YosemiteMark Clojure - 94
faubiguy Python 3 - 113

Python 3, 66

Note that all numbers are in range [1, 999], we can use an array b to maintain the longest subsequence length ending with each number. b[x] = d means that the longest subsequence ending with x has length d. For each number from the input, we update the array using b[x] = max(b[:x]) + 1 and then we got the job done by taking max(b) finally.

The time complexity is O(n) O(m n), where m is always 1000 and n is the number of input elements.

def f(a):
 b=[0]*1000
 for x in a:b[x]=max(b[:x])+1
 return max(b)

Wow, looks like already ungolfed :)
You can test it using stdin/stdout by adding a line:

print(f(map(int,input().split())))


Write a Number as a Fibonacci Sum Let us define the Fibonacci sequence as

F(1) = 1

F(2) = 2

F(n) = F(n - 2) + F(n - 1)

So we have the infinite sequence 1,2,3,5,8,13,... It is well known that any positive integer can be written as a sum of some Fibonacci numbers. The only caveat is that this summation might not be unique. There is always at least one way to write a number as a sum of Fibonacci numbers but there may be many many more.

Your challenge is to write a complete program which using stdin takes in a positive integer between one and one million inclusive, and then outputs using stdout all possible summations of Fibonacci numbers which sum up to the input. In a summation, the Fibonacci numbers must not repeat and that includes the number 1. In any summation, if 1 is present, it must be present only once because in my definition of the sequence above 1 appears only once. Summations with only term are valid so if the input number is a Fibonacci number itself, then the number itself is a valid summation and must be printed. If multiple sums, then between any two sums there must be a blank line to easily distinguished between them.

Here are some samples.

./myfib 1
1

There is only one such sum and it has only term so that's all that is printed.

./myfib 2
2

Note here that 1+1 is not a valid sum because 1 repeats.

./myfib 3
1+2

3

Two sums and they are both printed with a blank line in between.

./myfib 10
2+8

2+3+5

./myfib 100
3+8+89

1+2+8+89

3+8+34+55

1+2+3+5+89

1+2+8+34+55

3+8+13+21+55

1+2+3+5+34+55

1+2+8+13+21+55

1+2+3+5+13+21+55

True code-golf. The shortest code in any language wins. Please post your code with some test cases (besides the one I gave above). In the case of ties, I pick the one with the highest upvotes after waiting at least for two weeks and probably longer. So the community please feel free to upvote any solutions you like. The cleverness/beauty of the code matters much more than who posts first.

Happy coding!