text:
Shamir's Secret Sharing
Given n (the number of players), t (the threshold value), and s (the secret), output the n secrets generated by Shamir's Secret Sharing algorithm.
The Algorithm
For the purposes of this challenge, the computations will be done in GF(251) (the finite field of size 251, otherwise known as the integers mod 251). Ordinarily, the field would be chosen such that its size is a prime much greater than n. To simplify the challenge, the field size will be constant. 251 has been chosen because it is the largest prime representable by an 8-bit unsigned integer.

Generate t-1 random integers in the (inclusive) range [0, 250]. Label these a1 through at-1.
Construct a t-1th degree polynomial using s as the constant value and the random integers from step 1 as the coefficients of the powers of x: f(x) = s + x*a1 + x2*a2 + ... + xt-1*at-1.
Output (f(z) mod 251) for each z in the (inclusive) range [1, n].

Reference Implementation
#!/usr/bin/env python
from __future__ import print_function
import random
import sys

# Shamir's Secret Sharing algorithm
# Input is taken on the command line, in the format "python shamir.py n t s"

n, t, s = [int(x) for x in sys.argv[1:4]]
if t > n:
    print("Error: t must be less than or equal to n")
    exit()
if n not in range(2, 251):
    print("Error: n must be a positive integer less than 251")
    exit()
if t not in range(2, 251):
    print("Error: t must be a positive integer less than 251")
    exit()
if s not in range(251):
    print("Error: s must be a non-negative integer less than 251")
    exit()
p = 251
a = [random.randrange(0, 251) for x in range(t-1)]

def f(x):
    return s + sum(c*x**(i+1) for i,c in enumerate(a))

# Outputting the polynomial is for explanatory purposes only, and should not be included
#  in the output for the challenge
print("f(x) = {0} + {1}".format(s, ' + '.join('{0}*x^{1}'.format(c, i+1) for i,c in enumerate(a))))
for z in range(1, n+1):
    print(f(z) % p)

Verification
The following Stack Snippet can be used to verify outputs:

var validate = function() {
  $('#nts-error').attr('hidden', parseInt($('#n').val()) >= parseInt($('#t').val()));
  $('#check').prop('disabled', parseInt($('#n').val()) < parseInt($('#t').val()));
};

// the following function is taken from https://rosettacode.org/wiki/Combinations#JavaScript
var combinations = function(arr, k) {
  var i,
    subI,
    ret = [],
    sub,
    next;
  for (i = 0; i < arr.length; i++) {
    if (k === 1) {
      ret.push([arr[i]]);
    } else {
      sub = combinations(arr.slice(i + 1, arr.length), k - 1);
      for (subI = 0; subI < sub.length; subI++) {
        next = sub[subI];
        next.unshift(arr[i]);
        ret.push(next);
      }
    }
  }
  return ret;
};

// The following code is taken from https://en.wikipedia.org/wiki/Shamir%27s_Secret_Sharing#Javascript_example with the modification that the prime is 251, not 257

var prime = 251;

/* Gives the decomposition of the gcd of a and b.  Returns [x,y,z] such that x = gcd(a,b) and y*a + z*b = x */
function gcdD(a, b) {
  if (b == 0) return [a, 1, 0];
  else {
    var n = Math.floor(a / b),
      c = a % b,
      r = gcdD(b, c);
    return [r[0], r[2], r[1] - r[2] * n];
  }
}

/* Gives the multiplicative inverse of k mod prime.  In other words (k * modInverse(k)) % prime = 1 for all prime > k >= 1  */
function modInverse(k) {
  k = k % prime;
  var r = (k < 0) ? -gcdD(prime, -k)[2] : gcdD(prime, k)[2];
  return (prime + r) % prime;
}

/* Join the shares into a number */
function join(shares) {
  var accum, count, formula, startposition, nextposition, value, numerator, denominator;
  for (formula = accum = 0; formula < shares.length; formula++) {
    /* Multiply the numerator across the top and denominators across the bottom to do Lagrange's interpolation
     * Result is x0(2), x1(4), x2(5) -> -4*-5 and (2-4=-2)(2-5=-3), etc for l0, l1, l2...
     */
    for (count = 0, numerator = denominator = 1; count < shares.length; count++) {
      if (formula == count) continue; // If not the same value
      startposition = shares[formula][0];
      nextposition = shares[count][0];
      numerator = (numerator * -nextposition) % prime;
      denominator = (denominator * (startposition - nextposition)) % prime;
    }
    value = shares[formula][1];
    accum = (prime + accum + (value * numerator * modInverse(denominator))) % prime;
  }
  return accum;
}

$('#check').click(
  function() {
    var good = true;
    var problem = [];
    var n = parseInt($('#n').val());
    var t = parseInt($('#t').val());
    var s = parseInt($('#s').val());
    combinations([...Array(n + 1).keys()].slice(1), t).forEach(
      function(xArr) {
        var xfArr = xArr.map(
          function(x) {
            return [x, parseInt($('#f' + x).val())];
          }
        );
        var L = join(xfArr);
        if (L !== s) {
          good = false;
          problem.push(xArr);
        }
      }
    );
    $('#valid').html(good ? "True" : ("False (problematic secret sets: {" + problem.map(
      function(elem) {
        return "[" + elem.join(', ') + "]";
      }) + "})"));
  }
);

$('#n').change(
  function() {
    var inputHTML = "";
    for (var i = 1; i <= parseInt($('#n').val()); i++) {
      inputHTML += 'f(' + i + '): <input type="number" min="0" max="250" value="0" id="f' + i + '">
\r\n';
    }
    $('#inputs').html(inputHTML);
    validate();
  }
);

$('#t').change(
  function() {
    validate();
  }
);

n:
<input type="number" min="2" max="250" value="6" id="n">t:
<input type="number" min="2" max="250" value="3" id="t">s:
<input type="number" min="0" max="250" value="230" id="s">

t must be less than or equal to n!

  f(1):
  <input type="number" min="0" max="250" value="35" id="f1">

f(2):
  <input type="number" min="0" max="250" value="95" id="f2">

f(3):
  <input type="number" min="0" max="250" value="159" id="f3">

f(4):
  <input type="number" min="0" max="250" value="227" id="f4">

f(5):
  <input type="number" min="0" max="250" value="48" id="f5">

f(6):
  <input type="number" min="0" max="250" value="124" id="f6">

<input type="submit" id="check" value="Verify">

Valid:

Rules

s will be a non-negative integer less than 251, and n and t will be positive integers less than 251 and greater than 1. Furthermore, you are guaranteed that the inputs are valid (meaning t <= n).
Input and output can be in any reasonable, unambiguous, and consistent format.
Random numbers are to be sampled from a uniform distribution - each possible value should have equal probability of being chosen.

Do we have to output z and f(z)? If I print an array of f(z)s in order, z is implied by index. [[1, 5], [2, 2], [3, 9], [4, 14]] does not contain more information than [5, 2, 9, 14].

Challenge for doing the inverse.

@orlp Fair point.

Any testcases ?

@LeakyNun Since this question is tagged [tag:random], I think the verification snippet is much more valuable than test cases that will vary for each run.

@Mego I can't get your Stack Snippet to work; it is throwing a syntax error.

@Mego Just a heads up that your snippet is outputting false for every input and output except the default one.

@R.Kap I've tested it with other values (n = 6, t = 3, s = 42, [146, 210, 234, 218, 162, 66]) and it works. Are you sure the problem isn't in your program?

@Mego Yeah, I am sure, because, for instance, the input n=5, t=4, s=7 produces a valid output [10,247,217,172,113] based on the 3 integers [221,242,42] as confirmed by my program and your program, but the snippet outputs false for it.

@Mego The same is true for the input n=2 ,t=2, s=212 and the output [64,167] based on the integer chosen [35] again confirmed by your program.

@R.Kap In your last example, the chosen integer is 103. I agree that there is something funky going on with the verification snippet - I blame Javascript. I'll take a look at it and see if I can figure out what's going wrong.

@Mego Yeah, [35] was I typo. I meant to say [103].

Jelly, 15 bytes
251©xX€⁵0¦ḅÐ€%®

Expects t, n, and s as command-line arguments. Try it online!
How it works
251©xX€⁵0¦ḅÐ€%®  Main link. Left argument: t. Right argument: n Third argument: s

251©             Yield 251 and copy it to the register.
    x            Repeat [251] t times.
     X€          Random choice each; pseudo-randomly choose t integers from
                 [1, ..., 251]. Since 251 = 0 (mod 251), this is equivalent to
                 choosing them from [0, ..., 250].
       ⁵0¦       Replace the last generated integer (index 0) with s (⁵).
          ḅÐ€    Interpret the resulting array as a base-k number, for each k in
                 [1, ..., n], and convert to integer.
              ®  Yield 251 from the register.
             %   Take the generated integers modulo 251.

Replacing the last integer is so elegant :)

Mathematica, 59 56 bytes
Mod[Power~Array~{#2,#-1}.RandomInteger[250,#-1]+#3,251]&

Takes three arguments in the order t, n, and s. Constructs a  2d-array with n rows and t-1 columns. Each row vector j, numbered from 1 thru n, contains the powers of j thru jt-1. Then a vector of random integer coefficients in the range 0 thru 250 is created with t-1 values. That is matrix-multiplied with the 2d-array, and then s is added element-wise and taken module 251 to get the value of the polynomial at each of the n points.

Was just about to post a 79-byte answer, nice trick with Sum!

I've got a different approach, but it's currently two bytes longer. Maybe you have an idea how to shorten it: Mod[x#+#2&~Fold~RandomInteger[250,#2-1]x+#3/.x->Range@#,251]&

CJam, 27 25 bytes
{,:)@({;251mr}%@+fb251f%}

Test it here.

Pyth, 24 bytes
J+EmOK251tEm%s.e*b^dkJKS

Try it online!
Input order: n s t separated by linefeed.

arrrrrgh, ninja'd cuz i went to get a cookie

JavaScript, 181 bytes
(n,t,s)=>{r=Array(t-1).fill(0).map($=>{return Math.random()*251});f=(x=>{p = 0;r.map((k,c)=>p+=k*Math.pow(x, c));return s+p});_=Array(t-1).fill(0);_.map((l,i)=>_[i]=f(i));return _;}

Ungolfed:
(n, t, s) => {
    r = Array(t - 1).fill(0).map($ =>{return Math.random() * 251});
    f = (x => {
        p = 0;
        r.map((k, c) => p += k * Math.pow(x, c));
        return s + p
    });
    _ = Array(t - 1).fill(0);
    _.map((l, i) => _[i] = f(i));
    return _;
}

I don't know how to properly check it, but I do know that it was a pain to get JS to map across a new array since apparently .map skips undefined values. If anyone sees any ways to improve, or flaws, don't hesitate to let me know.

123 bytes: (n,t,s,A=f=>Array(t-1).fill(0).map(f),r=A($=>Math.random()*251))=>   A((l,i,_,p=0)=>(r.map((k,c)=>p+=k*Math.pow(i,c)),s+p))

You're not using n, which seems wrong. Your code also seems to be assuming 1-based indexing. [...Array()] is slightly shorter than fiil(). Also, the last two lines can be reduced to return _.map(f);

MATL, 20 19 bytes
251tliq3$Yrihi:ZQw\

Input order is t, s, n.
Try it online!
Explanation
251t    % Push 251 twice
l       % Push 1
iq      % Take input t. Subtract 1
3$Yr    % Generate t-1 random integers in [1 2 ... 251]
ih      % Take input s. Concatenate with the random integers
i:      % Take input n. Generate range [1 2 ... n]
ZQ      % Evvaluate polynomial at those values
w       % Swap to move copy og 251 to the top of the stack
\       % Modulo. Implicitly display

C#, 138 134 bytes
(n,t,s)=>new int[n+1].Select((_,x)=>(s+new int[t-1].Select(k=>new Random(e).Next(251)).Select((c,i)=>c*Math.Pow(x+1,i+1)).Sum())%251);

C# lambda where inputs are int and output is an IEnumerable<double>. You can try my code on .NetFiddle.
I am not 100% sure about the validity of my algorithm, please comment if I misunderstood something.
4 bytes saved with @raggy's trick.

Julia, 48 bytes
f(n,t,s)=(1:n).^(0:t-1)'*[s;rand(0:250,t-1)]%251

Try it online!

J, 32 30 bytes
251|(1+i.@{.)p.~{:0}251?@#~1&{

Takes a list with the values n, t, and s.
Saved 2 bytes by using the replace at index 0 idea from @Dennis's solution.
Explanation
251|(1+i.@{.)p.~{:0}251?@#~1&{  Input: [n t s]
                           1&{  Select at index 1 (t)
                    251  #~     Create that many copies of 251
                       ?@       Generate that many random integers in [0, 251)
                {:              Get the tail of the input (s)
                  0}            Replace the value at index 0 of the random integer list
                                with s to make a coefficient list of the polynomial
          {.                    Get the head of the input (n)
       i.@                      Make the range [0, n-1]
     1+                         Add 1 to each to get [1, n]
             p.~                Evaluate the polynomial at each value [1, n]
251|                            Take each value mod 251 and return

JavaScript (ES6), 116 bytes
(n,t,s)=>[...Array(n)].map((_,i)=>++i&&t.reduce((r,a)=>r*i+a)%251,t=[...Array(t)].map(_=>--t?Math.random()*251|0:s))

I'd like to think this is one of the rare cases where reduce beats map.

Python 3 with NumPy, 103 bytes
from numpy import*
lambda n,t,s:[poly1d(append(random.randint(0,251,t-1),s))(i+1)%251for i in range(n)]

I can honestly say that I never expected to use NumPy for code golf...
An anonymous function that takes input via argument and returns a list.
How it works
from numpy import*         Import everything in the NumPy library
lambda n,t,s...            Function with input number of players n, threshold value t and
                           secret s
random.randint(0,251,t-1)  Generate a NumPy array R of t-1 random integers in [0,250]
append(...,s)              Append s to R
poly1d(...)                Generate a polynomial p of order t-1 with coefficients R and
                           constant term s
...for i in range(n)       For all integers i in [0,n-1]...
...(i+1)                   ...evaluate p(i+1), so for all integers in [1,n]...
...%251                    ...and take modulo 251
...:[...]                  return as list

Try it on Ideone

Java 8, 224 bytes:
(n,t,s)->{int[]W=new int[t-1];for(int i=0;i<t-1;i++){W[i]=new java.util.Random().nextInt(251);};long[]O=new long[n];for(int i=1;i<=n;i++){long T=0;for(int h=1;h<t;h++){T+=W[h-1]*Math.pow(i,h);}O[i-1]=((T+s)%251);}return O;};

A Java 8 lambda expression. Outputs a comma separated integer array, and works perfectly until values in the output array reach beyond the range of the Java's long, or 64-bit signed integer, data type, upon which -200 is output into the array.
Try It Online! (Ideone)

195 bytes

Scala 3, 205 bytes
\$ \text{205 bytes, It can be golfed much more.} \$

Golfed version. Try it online!
(n,t,s)=>{val W=new Array[Int](t-1);for(i<-0 until t-1){W(i)=Random.nextInt(251)};val O=new Array[Long](n);for(i<-1 to n){var T=0L;for(h<-1 until t) {T=T+(W(h-1)*math.pow(i,h)).toLong};O(i-1)=(T+s)%251};O}

Ungolfed version. Try it online!
import scala.util.Random

object A {
  type G = (Int, Int, Int) => Array[Long]

  def main(args: Array[String]): Unit = {
    val J: G = (n, t, s) => {
      val W = new Array[Int](t - 1)
      for (i <- 0 until t - 1) {
        W(i) = Random.nextInt(251)
      }
      val O = new Array[Long](n)
      for (i <- 1 to n) {
        var T = 0L
        for (h <- 1 until t) {
          T = T+ (W(h - 1) * math.pow(i, h)).toLong
        }
        O(i - 1) = (T + s) % 251
      }
      O
    }

    val scanner = new java.util.Scanner(System.in)
    while (scanner.hasNextLine) {
      val n = scanner.nextInt()
      val t = scanner.nextInt()
      val s = scanner.nextInt()
      println(J(n, t, s).mkString("[", ", ", "]"))
    }
  }
}

C (gcc), 133 bytes
-10 bytes thanks to @ceilingcat!
-1 byte thanks to @ceilingcat!
v[999];i,j,k,l;f(n,t,s){for(i=t;--i;)v[i]=rand()%251;for(*v=s;n/++i;printf("%d ",s%251))for(s=j=0;j<t;s+=k)for(k=v[l=j++];l--;)k*=i;}

Try it online!


text:
Rearrange a number into alphabetical order
Given a non-negative integer (n), create a function that returns n in alphabetical order, according to the literal spelling of each digit in n.
Examples:
Input: 101
>> one, zero, one
>> one, one, zero
Output: 110

Input: 31948
>> three, one, nine, four, eight
>> eight, four, nine, one, three
Output: 84913

Input: 5544
>> five, five, four, four
>> five, five, four, four
Output: 5544

Input: 1234567890
Output: 8549176320

Note: the operations in the example are illustrative only and do not need to be included in the output. Only the alphabetically-sorted number needs to be returned.
This is code-golf, so the shortest code in bytes wins.
Edit: the input can be taken in any desired format that best suits your language, and the output can be produced similarly by returning from the function or printing. The input will always be a natural number (including 0) and will not contain leading 0's.
Relevant OEIS entry (A057846) found by @DomHastings

Can I also take the number as a string and output a string?

@nimi 00 ....

@atlasologist May we print the output?

@xnor returned from function or printed--either seems fine.

You might want to specify that the input is in decimal, or you'll get some cheeky answers using unary...

@nimi 00 doesn't need to be handled.

Multi digit strings "one hundred two"?

This is a bit confusing: you wrote in the comments that you expect a numeric type as input and output of the function, but also that it’s okay to print the result instead. So, if the output is 849, does that mean we’re allowed to print the number 849 but not the string "849"? IMO this is just a cumbersome I/O format (bad!) on top of a perfectly fine challenge.

Leading zeroes significant or not? e.g. what does 001 output? If they are significant and the result is not 1, most languages will require strings as input for the simple fact it is crude, impractical and usually nigh on impossible to ask the parser to preserve leading zeroes in base 10 literal numbers.

@Cat, input will be natural numbers with no leading 0's.

Of course there's an OEIS entry: Obsessive Filer's Sequence

@DomHastings wow, nice find!

Perl 6,  32  28 bytes
{+[~] .comb.sort: *.Str.uniname}
{+[~] .comb.sort: *.uniname}

Explanation:
{
  # turn the following into a Numeric
  +

  # fold the following list using string concatenation operator
  [~]

    # split $_ into individual characters
    # (implicit method call on implicit parameter)
    .comb

    .sort:
    *.uniname # sort by the Unicode name of the character (digit)
}

Test:
#! /usr/bin/env perl6
use v6.c;
use Test;

my @tests = (
  101 => 110,
  31948 => 84913,
  5544 => 5544,
  1234567890 => 8549176320,
);

# give the lambda a lexical name for clarity
my &int-sort = {+[~] .comb.sort: *.uniname}

plan 3 * @tests;

for @tests -> $_ ( :key($input), :value($expected) ) {
  put '';
  isa-ok $input, Int, "input ($input) is an Int";

  my $output = int-sort $input;

  is $output, $expected, .gist;
  isa-ok $output, Int, "output ($output) is an Int"
}

1..12

ok 1 - input (101) is an Int
ok 2 - 101 => 110
ok 3 - output (110) is an Int

ok 4 - input (31948) is an Int
ok 5 - 31948 => 84913
ok 6 - output (84913) is an Int

ok 7 - input (5544) is an Int
ok 8 - 5544 => 5544
ok 9 - output (5544) is an Int

ok 10 - input (1234567890) is an Int
ok 11 - 1234567890 => 8549176320
ok 12 - output (8549176320) is an Int

05AB1E, 12 11 10 bytes
•OWÿ¾•vy†J

Explained
•OWÿ¾•        # push sortorder (236719458)
      v       # for each number in sortorder
       y†     # filter to the front
         J    # join
              # implicitly print

Try it online
Saved 1 byte thanks to Adnan

JavaScript (ES6), 54
Edit same char count, but avoiding the global variable z
Input / output as strings
n=>[...n].sort((a,b)=>n[a]-n[b],n='9487216503').join``

Test

f=n=>[...n].sort((a,b)=>n[a]-n[b],n='9487216503').join``

function test() {
  O.textContent=f(I.value)
}

test()
<input id=I type=number value=31948 oninput='test()'>

Love this, using the input digits as indices of the string z...

Haskell, 62 51 44 bytes
As @nimi suggested, using a list comprehension is shorter than composing functions:
f x=0+read[a|a<-"8549176320",b<-show x,a==b]

For reference my version:
f n=read.(=<<)(\x->filter(==x)$show n)$"8549176320"

The pointfree version is a bit longer:
f=flip(read.)"8549176320".(=<<).flip(filter.(==)).show

Straightforward: Filter the digits in the correct order and then concatenate the result.

Pyth, 12 10 bytes
ox`C" »Ä\0

Not sure if it can be golfed further. Input needs to be enclosed in quotes.
2 bytes saved thanks to @isaacg!
In pythonic pseudocode:
                Q = input()
o          Q    sort(Q, key = lambda N:
  `C" »Ä\0        repr(base256toDec(" »Ä\0"))
 x        N         .index(N)     # 8 being absent from the number yields -1
                )

Test it here.

@busukxuan I also get 14 bytes :p.

@Adnan revert to numbers then. It seems there isn't a way to compress these numbers...

Save 2 bytes by replacing 549176320 with C" »Ä\0

@isaacg Thanks! I tried to convert it to base 256 a few times but the result was wrong. How did you do it right?

You have to escape null bytes by replacing them with \0. That's probably the problem you were running into.

Perl, 37 bytes
36 bytes code + 1 byte command line (-F)
say sort{8549176320=~/$b.*$a/||-1}@F

Usage example:
echo -n "04823" | perl -F -M5.010 entry.pl

Mathematica 35 78 47 bytes
31 bytes saved thanks to a suggestion by LIAMnYP!
FromDigits@SortBy[IntegerDigits@#,IntegerName]&

IntegerDigits breaks up the number into digits which are then sorted according to their names in English. FromDigits assembles the digits into a base-10 number.

FromDigits@SortBy[IntegerDigits@#,IntegerName]&[1234567890]

8549176320

By using "SortBy" you don't have the problem of converting the words back to digits. FromDigits@SortBy[IntegerName]@IntegerDigits@#&

Also Interpreter is painfully slow, so that's an added bonus.

Fantastic improvement.

11 bytes in Mtmca, whenever that comes into being.

C, 142 141 117
Pass parameter as long long * to f(); the function modifies the parameter:
f(long long*n){char*c="8549176320",g[10]={0};for(;*n;*n/=10)++g[*n%10];for(;*c;++c)for(;g[*c-48]--;*n=*n*10+*c-48);}

long long is necessary since the last test case overflowed an int when sorted.

MATL, 19 bytes
Vt'8549176320'&m2$S

Try it online!
Explanation
V              % Implicitly input number. Convert to string (¹)
t              % Push copy of (¹)
'8549176320'   % Push this string (²), which defines order
&m             % Indices (³) of each element of (¹) in (²)
2$S            % Sort copy of (¹) according to (³). Implicitly display

Jelly, 11 bytes
“U1°ŀ”OṾf@€

Try it here.
Explanation
“U1°ŀ”O       Get the Unicode ordinals of “U1°ŀ”
                (all of which are coincidentally single bytes
                in the Jelly code page!)
              The result is [85, 49, 176, 320].
       Ṿ      Uneval. This gets us the string “85,49,176,320”.
        f@€   For each char in this string, extract all chars
                from the first command line argument that
                equal it.

Python 2 - 95 bytes
def s(n):
    l=list("8549176320")
    return "".join(sorted(list(n),key=lambda x: l.index(x)))

Attempting further golfing...I think the line 2 is unnecessary and this can become 1 lambda.
EDIT: 49 char version in comments, thx to xnor and vaultah for help.

lambda n:''.join(sorted(\n`,key="8549176320".find))`

@vaultah Nice solution, you should post it! I think you can omit the 8 so that the find gives -1.

ooh that's clever @xnor. The shortest I got it to was lambda n: "".join(sorted(n,key="549176320".find)), which is really similar to what you suggested, vaultah. You should post it!

@Jeremy You should edit that version into your post.

At least get rid of the superfluous whitespace... Indentation can be done with a single space. Also this is invalid, because the OP stated that output must be a numeric type.

@vaultah That fails for values above sys.maxint, because repr(long_value) appends an L to the end.

Needlessly long imo but +1 for a beginner :)

@Mego No need to use Python 2.

-- Oracle 11 (SQL): 164 bytes
  SELECT LISTAGG(DECODE(s,0,'zero',TO_CHAR(TO_DATE(s,'j'),'jsp')),',')WITHIN GROUP(ORDER BY 1)FROM(SELECT SUBSTR(&1,level,1)s FROM dual CONNECT BY LEVEL<=LENGTH(&1));

Long form and explanation
  SELECT LISTAGG(DECODE(s,0,'zero',TO_CHAR(TO_DATE(s,'j'),'jsp')),',') WITHIN GROUP (ORDER BY 1)
  FROM ( SELECT SUBSTR(&1,level,1)s FROM dual
           CONNECT BY LEVEL <= LENGTH(&1)
        );

Get the input as parameter to script:
  SELECT &1 FROM dual

"create" rows by using connect by based on length of input:
  CONNECT BY LEVEL <= LENGTH(&1)

Rip out each digit from the string for each position:
  SELECT SUBSTR(&1,level,1)s FROM dual

Convert the digit to Julian date, and back to Char to get spelling:
  TO_CHAR(TO_DATE(s,'j'),'jsp')

Check for zero - special case.
  DECODE(s,0,'zero'

Use LISTAGG function to concatenate rows back into a single row list, comma delimited, ordered alphabetically
  LISTAGG(DECODE(s,0,'zero',TO_CHAR(TO_DATE(s,'j'),'jsp')),',') WITHIN GROUP (ORDER BY 1)

Always fun trying to tweak SQL for things like this ... :) really tests my knowledge of the bugger ...

Racket, 142 130 bytes
(λ(n)(string->number(list->string(sort(string->list(~a n))char<? #:key(λ(m)(string-ref "9487216503"(-(char->integer m)48)))))))

Of which conversions are more than almost half of the length (76 64 bytes).

(+ 1 answer) for Racket!

@cat It's useful for me to keep practicing Racket, since it's a way to maintain functional programming knowledge while working on these horribly procedural legacy Java (and slightly-less-legacy Python) programs left to me by my co-workers.  I could rant about how having objects does not necessarily make a program object-oriented, but instead of doing that I'll just keep golfing my problems away in Racket.

Hmm... I definitely sympathise, and it's possible and fun to write functional Python, but Java's just Fawful. Maybe you can get your superiors to let you use Scala for the implementation and Java just as glue. :)

By the way, if you like Forth and your eyes get a little tired from reading Lisp inside-out, you should check out Factor, which is Lisp and the CLOS but in a Forth-y postfix and point-free disguise.

Ruby, 60 bytes
->n{n.to_s.chars.sort_by{|c|'8549176320'.index c}.join.to_i}

TSQL, 260 bytes
Used reversed bubble sort to avoid refering to the length, to save some bytes
Golfed:
DECLARE @ varchar(99)=101

,@i INT=99,@j INT=98WHILE @i>1SELECT
@=IIF(CHARINDEX(x,'598327614')>CHARINDEX(y,'598327614'),STUFF(STUFF(@,@j,1,x),@i,1,y),@),@i-=IIF(@j=1,1,0),@j=IIF(@j=1,@i,@j-1)FROM(SELECT
SUBSTRING(@,@i,1)x,SUBSTRING(@,@j,1)y)z
PRINT @

Ungolfed:
DECLARE @s BIGINT=1234567890

DECLARE @ char(99)=@s,@i INT=99,@j INT=98
WHILE @i>1
  SELECT
    @=IIF(CHARINDEX(x,'236719458')>CHARINDEX(y,'236719458'),
        STUFF(STUFF(@,@j,1,x),@i,1,y),@),
    @i-=IIF(@j=1,1,0),
    @j=IIF(@j=1,@i,@j-1)
  FROM(SELECT SUBSTRING(@,@i,1)x,SUBSTRING(@,@j,1)y)z
PRINT CAST(@ as bigint)

Insisting on using integer types as input and output added 37 bytes

DECLARE @ varchar(99)=101 0.o does 101 get turned to a string automatically?

Also, stuff is an objectively awful function name. squash or shove or pack would be better :P

@cat yes, it gets converted into a string automatically, but that would be cheating according to the descriptino. I agree, stuff is a silly name

I mean, we might as well just call every function stuff cause that's what functions do: they do stuff. Then your code can look like stuff(stuff(4, 5, stuff), stuff(stuff()).(stuff())()); stuff(stuff)

ClojureScript, 45 bytes
#(apply str(sort-by(vec"9487216503")(str %)))

Uses some screwy string->int conversion from Javascript leak through, so it's not valid Clojure.

Firebird, 317 bytes
Golfed:
select list(s,'')from(with recursive q as(select 1 p,substring(:a from 1 for 1)s from rdb$database q union all select q.p+1 p,substring(:a from q.p+1 for 1)s from q where q.p<char_length(:a))select s from q order by iif(s=8,0,iif(s=5,1,iif(s=4,2,iif(s=9,3,iif(s=1,4,iif(s=7,5,iif(s=3,7,iif(s=2,8,iif(s=0,9,6))))))))))

Ungolfed:
select list(s, '')
from (
   with recursive q as (
      select 1 as p, substring(:a from 1 for 1) s
      from rdb$database q
      union all
      select q.p + 1 as p, substring(:a from q.p + 1 for 1) as s
      from q
      where q.p < char_length(:a)
   )
   select s
   from q
   order by iif(s = 8, 0,
               iif(s = 5, 1,
                  iif(s = 4, 2,
                     iif(s = 9, 3,
                        iif(s = 1, 4,
                           iif(s = 7, 5,
                              iif(s = 3, 7,
                                 iif(s = 2, 8,
                                    iif(s = 0, 9, 6)))))))))
)

There's no split functionality in Firebird. Instead I created a recursive query to get the next character over and over. Then reselect those while sorting by our proper order. Finally concatenate those results back together in a list. Override the default comma delimiter with blank. I could save 11 bytes by creating a new dummy table instead of rdb$database but I thought that may be against the rules.

ZX Spectum, machine code, 53 48 47 45 44 bytes
    org 49200 ; #c030

; table converts ascii to alfabetical order
; start from BASIC with any number as : PRINT "1234567890" AND USR 49208

    convtab defb 249 ; zero
        defb 244 ; one
        defb 248    ; two
        defb 247 ; three
        defb 2+205 ; four
        defb 1+205 ; five
        defb 246 ; six
        defb 245 ; seven
    ;    defb 0 ; eight
    ;   defb 3 ; nine
    ; last 2 conversions hidden in call-command
start Call #2bf1    ; fetch stackindex
    call #2ab2 ; store back
    ld h,#c0    ; set highbyte of table

Sort Push de
loop ld b,d
    ld c,e
    inc de
    ld a,(bc)   ; fetch number
    Ld l,a
    ld a,(de)
    cp 34       ; endmarker "
    Jr z,exit   ; end reached?
    push hl     ; save number
    ld l,a
    Ld a,(hl)   ; convert second number
    pop hl
    cp (hl)     ; compare numbers
    jr nc,loop  ; in order, no swap
swap ld a,(bc)  ; swap original numbers
    ld l,a
    ld a,(de)
    ld (bc),a
    ld a,l
    ld (de),a
Exit pop de
    Ret z
    jr sort     ; check number for order

With Gnome-sort it can be shortened and table can be 1 byte shorter. New version to come...

Gnome-sort here is longer, but other optimizations.

Factor, 128
[ 10 base> [ 48 - ] { } map-as dup [ number>text ] map zip [ second first ] sort-with [ first ] map [ 48 + ] ""map-as 10 >base ]

Hooray for builtins! :D

PHP, 126 bytes
As far as I know php doesn't have any builtins that would really help with this (the best I could do using a usort(str_split()) was 5 bytes longer) so the only thing I'm happy within this answer is the games played with $i to save a couple of bytes on the itteration.
<?php for($i=-1;$i<9;)$a[++$i]=preg_replace("/[^$i]/","",$argv[1]);array_multisort([9,4,8,7,2,1,6,5,0,3],$a);echo implode($a);

APL, 23 bytes
{⍎n['8549176320'⍋n←⍕⍵]}

Explanation:

n←⍕⍵: get the string representation of n and store it in n
'8549176320'⍋: find a permutation of n that sorts n given the order 8549176320.
n[...]: reorder n by that permutation
⍎: evaluate the result (to turn it back into a number)

Since I/O may be strings, you can remove ⍎ and ⍕. Convert to tradfn by removing { and } and substituting ⍞ for ⍵. Finally, remove 0 as unlisted sorts at the end: n['854917632'⍋n←⍞]

Clojure, 53 bytes
Well, list comprehension idea from Haskell solution seems to be the shortest:
#(apply str(for[p"8549176320"b(str %):when(= p b)]p))

My original approach is 1 byte longer:
#(apply str(sort-by(zipmap"549176320"(range))(str %)))

You can see both function online here: https://ideone.com/afac5n

Common Lisp, 104
(lambda(n)(#1=parse-integer(sort(format()"~A"n)'string<= :key(lambda(u)(format()"~R"(#1#(string u)))))))

Ungolfed
(lambda (n)
  (parse-integer
   (sort (format nil "~A" n)
         #'string<=
         :key (lambda (u) (format nil "~R" (parse-integer (string u)))))))

Convert integer as string, sort characters using the string<= comparison while using a custom :key function which converts a given character as the English representation of the numerical value it represents. Usually I would not use a key function which does as much as this one, but it costs less in bytes than decorate/sort/undecorate.

Python 3, 234 bytes
This is a direct translation of my Factor answer, just for fun.
def f(n):
 s=list(map(int,str(n)))
 return int("".join(list(map(str,list(map(lambda x:x[1],sorted(list(zip(list(map(lambda t:{0:"zero",1:"one",2:"two",3:"three",4:"four",5:"five",6:"six",7:"seven",8:"eight",9:"nine"}[t],s)),s)))))))))

The semantics of the evaluation of "lazy" map and zip objects is the most subtle hard-to-find-bug-inducing piece of genuine horse excrement in the universe. Sometimes, s = map(f, x) won't allow s to be used properly or at all.

Python 3, 74 bytes
lambda x:''.join(i[1]for i in sorted(['9487216503'[int(j)],j]for j in x))

You might be able to save some bytes by using a lambda

Pyke, 14 bytes
.#uЀB`@

Try it here!

Python 2.7.11, 67 bytes
lambda n:''.join(sorted(list(n),key=lambda s:"9487216503"[int(s)]))

Takes a string as input and outputs a string.

C, 80 bytes
Takes a string containing a number in base 10 and prints to stdio:
F(char*i){for(char*p,d,*o="8549176320";*o;++o)for(p=i;d=*p++;d-*o||putchar(d));}

PHP, 107 bytes
function($a){usort($a,function($a,$b){return($z=array_flip([8,5,4,9,1,7,6,3,2,0]))[$a]-$z[$b];});return$a;}

Try it online!
Uses a user-defined comparison function to adjust the sorting order.
Output
101         110
31948       84913
5544        5544
1234567890  8549176320

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Determine the "Luck" of a string
Given a string, return that string's "luck".
A string's luck, as I completely just made up for the purpose of this challenge, is an integer, determined as so:

The base luck for a string is 1.
For each consecutive letter it shares with the word "lucky" (case insensitive), multiply the luck by 2. For instance, if your string was "lumberjack" or "smack" you'd multiply by 4. (More specifically, 2^number of consecutive characters shared.)

The shared letters have to be in the same consecutive order it appears in "lucky" but can start anywhere in the word for the same value ("luc" has the same 8* multiplier as "cky").
If the word has multiple occurrences where it shares consecutive characters with lucky, use the longest consecutive string of the characters.

For ANY letter it shares with the word "omen" subtract 2 from the luck.

It can match a character any amount of times, in any order. For instance the string "nnnnnomemenn" loses 24 luck (12 matching letters)

Example:
luck("lucky")
>>32

2^5 (5 consecutive letters) = 32
luck("firetruck")
>>6

2^3 - 2 (3 consecutive letters from uck, e shared with omen)
luck("memes")
>>-7

1 - 8 (base amount, 4 shared with "omen")
This is code golf, so the answer with the fewest bytes wins.
You can input and output any way you'd like - write a function, use standard input, etc.
For functions, assume whatever data type would make sense for that language. (For example, in JavaScript, you'd be passed a String and return a Number)
Edit: You can assume any input is lowercase.

Nice first challenge!

Should the program accept uppercase input?

@busukxuan Good question - no, it doesn't need to accept uppercase input.

@cat Not sure I quite understand what you're asking. But you can just assume all input will be lowercase and you don't need to catch any uppercase input.

Can we assume an upper or lower bound on the luck of a given input? i.e. what's the smallest number of bits / data type I can get away with, or is it as big as my language can handle? that is, should it be int8_t str_luck(const char* str); or should it be uint64_t str_luck(const char* str);?

@cat I haven't thought about that, but I'd just use something reasonable - whatever makes it easiest or shortest but still works for at least the 3 test cases I mentioned (so it would need to be capable of negatives, and handle numbers larger than 32)

What's the output for luuck?

@msh210 8, because uck is the longest string of consecutive matching characters

Oh, the question post says "If the word has multiple occurrences where it shares consecutive characters with lucky, use the longest consecutive string of the characters." and I missed it. Sorry.

05AB1E, 36 32 28 26 bytes
Œv'¸éyåiyˆ}}¯é¤go¹'ƒÖ¦Ãg·-

Explanation
Œv         }                  # for each substring of input
  '¸éyåi  }                   # if substring is part of "lucky"
        yˆ                    # add it to global array
            ¯é¤               # get the longest such substring
               go             # raise 2 to its length
                 ¹'ƒÖ¦Ã       # remove all chars from input that isn't in "omen"
                       g·     # get length and multiply by 2
                         -    # subtract
                              # implicitly display

Try it online
Saved 2 bytes thanks to Adnan

Compression for 1 word can also be done with ', so for 26: Œv'¸éyåiyˆ}}¯é¤go¹'ƒÖ¦Ãg·- :).

@Adnan: Weird. I was certain I had tried that. Apparently not. Thanks!

why isn't this the top answer?

JavaScript (ES7), 123 112 107 bytes
s=>2**[5,4,3,2,1,0].find((i,_,a)=>a.some(j=>s.includes("luckyL".substr(j,i))))-2*~-s.split(/[omen]/).length

Edit: Saved 11 bytes thanks to @Titus by assuming that the letter L does not appear in the input. Saved 5 bytes thanks to @Oriol. ES6 version for 125 114 109 bytes:

f=
s=>(1<<[5,4,3,2,1,0].find((i,_,a)=>a.some(j=>s.includes("luckyL".substr(j,i)))))-2*~-s.split(/[omen]/).length
;
<input oninput=o.textContent=f(this.value)>

Why do you use replace([^]) instead of match([])? Do you waste 3 bytes or is there a reason?

@Titus How many bytes does it cost to deal with a null match result?

Four for a string, and a pair of () in this case; eating up all six that you would save with match(/[omen]/). Pity.

@Titus I think I tried both and found they were the same length so stuck with the one that I preferred. (Same goes for [5,4,3,2,1,0] for which I could have used [..."543210"] - it's the same length.)

Now finally ... found a neat trick. Saves 4 bytes on my PHP and 7 for your JS: use '*lucky' for the substr, so you can go with [1,2,3,4,5] instead of the spread.

@Titus Not sure if that's what you meant but by adding an L to the end of the substr (which will never appear in the original string) I don't have to worry about extraneous matches and I can actually use the same array [5,4,3,2,1,0] both times, saving a whopping 13 bytes!

-2*s.split(/[omen]/).length+2 is shorter.

(s.match(/l?ucky?|c?ky?|l?uc?|l|y/)||[''])[0].length) is boring code and pretty inflexible, but 20 bytes shorter.

sorry only -18, insert |c

@Titus Sorry, that doesn't work for strings which have multiple lucky substrings.

correct. can you match all and sort results by length? how much would that cost?

@Titus About 35, I think. Sorry.

Ruby, 91 87 bytes
String#count's finnicky usage strikes again! (When passed a String, it counts all occurrences of each letter in the function argument instead of all occurrences of the entire string.)
Try it online
->s{2**(z=0..5).max_by{|j|z.map{|i|s[b="lucky"[i,j]]?b.size: 0}.max}-2*s.count("omen")}

A version that takes in lines from STDIN and prints them: 89 bytes (86 +3 from the -n flag)
p 2**(z=0..5).max_by{|j|z.map{|i|$_[b="lucky"[i,j]]?b.size: 0}.max}-2*$_.count("omen")

._. that String#count is weird. +1 for (ab)using it. Also is it shorter to use gets rather than a function?

@Downgoat if I gets I also has to puts for output, so not in this case.

Pyth, 27 26 28 bytes
-^2le+k}#"lucky".:Q)yl@"omen

1 byte saved thanks to OP :-)
Explanation:
                                 Implicit Q as input
                .:Q              Find all substrings of input
     +k}#"lucky"                 Filter for substring of "lucky", prepend "" in case of []
    e                            Take last element, which is longest
   l                             Get its length
 ^2                              Raise two to that
                      @"omen"Q   Filter Q for characters in "omen"
                     l           Get length; counts how many characters in "omen" there are
                    y            Double that
-                                Find the difference

Test it here.

I'm not an expert in Pyth but I believe you can change "omen" to just "omen and Pyth will understand

@charredgrass Oops, my mistake :-)

Doesn't seem to work for string without chars form "lucky" in it. "memes" for example.

@Emigna Ah. the zero case again.... Thanks, fixed it!

Ruby: 100 bytes
->s{2**(m=0;4.times{|j|1.upto(5){|i|m=[i,m].max if s.match"lucky"[j,i]}};m)-s.scan(/[omen]/).size*2}

Try /[omen]/ as the regex to golf it down - it will match any character and is better in practical use than chaining |s for single characters.

Javascript - 206 Bytes
r=>{var a="lucky";r:for(var e=5;e>0;e--)for(var n=0;6>n+e;n++){var o=a.substring(n,e+n);if(r.includes(o))break r}for(var t=0,e=0;e<r.length;e++)('omen'.indexOf(r[e])+1)&&t++;return Math.pow(2,o.length)-2*t}

You could change this condition: s[k]=='o'||s[k]=='m'||s[k]=='e'||s[k]=='n' to look like this: "oman".split("").includes(s[k])

Welcome to PPCG! You can golf this down by removing whitespace to conserve bytes. Also, instead of (s[k]=='o'||s[k]=='m'||s[k]=='e'||s[k]=='n') you could use ('omen'.indexOf(s[k])+1) (assuming this is JavaScript)

Thanks for the tips! Got it down to 237, although it looks like the Ruby crowd's got me beat.

Another small thing: you can shorthand function luck(r) down to r=> to just make it an anonymous function, that's all that is necessary for this challenge. Also I made an edit to the challenge so you don't have to worry about case so you can remove the r=r.toLowerCase();

Instead of substring you can use slice i believe (test this though, as I'm not sure)

You can use substr(n,e) instead of substring(n,e+n). It saves a byte over @Downgoat's slice(n,e+n) too. Also, "lucky" seems to only be used once, so you can probably trim out the variable declaration and go straight for "lucky".substr(...

@Downgoat You are correct, they are interchangeable in this case. More info: http://stackoverflow.com/questions/2243824/what-is-the-difference-between-string-slice-and-string-substring

Haskell, 99
Another approach... I just learned about function aliasing
import Data.List
s=subsequences
i=intersect
l=length
f n=2^(l$last$i(s"lucky")$s n)-2*l(i n$"omen")

Usage
f"lucky"
32

f"firetruck"
6

f"memes"
-7

Ruby, 57 bytes
b=gets.count'omen'
$.+=1while/[lucky]{#$.}/
p 2**$./2-2*b

gets sets $. to 1 as a side effect, then we increment it until the regular expression matching $. consecutive lucky characters no longer matches.

Mathematica, 86 bytes
Code:
2^StringLength@LongestCommonSubsequence[#,"lucky"]-2StringCount[#,{"o","m","e","n"}]&

Explanation:
LongestCommonSubsequence returns the longest contiguous substring common to the input and "lucky". StringLength gives its length. StringCount counts the number of occurrences of the characters of "omen" in the input.

Python (139 Bytes)
import itertools as t
s=input()
print 2**max([j-i for i,j in t.combinations(range(6),2)if'lucky'[i:j]in s]+[0])-2*sum(_ in'omen'for _ in s)

You can save one byte by using from intertools import*

Python 3, 168 157 152 139 144 136 bytes
EDIT: Really obvious things I should have seen easier have been changed, and some slightly less obvious.
Edit 2: stoopid (˚n˚). The program threw errors. I fixed it up. not actually 153 :(
Thanks to Leaky Nun for saving 5 bytes, and to jmilloy for saving 13 8 bytes.
s=input()
p=q=k=len(s)
m=0
while-~p:
 while-~q:m=(m,q-p)[(s[p:q]in"lucky")*q-p>m];q-=1
 p-=1;q=k
print(2**m-2*sum(i in"omen"for i in s))

The program runs through all possibly possible substrings in input (possibly possible, because it computes impossible substrings as well, 8 to 7, for example), checks if the substring is in "lucky", then sets the exponent of 2 to the length of the substring should it be greater than the current value. Possibly could be improved by using only one while loop. Could possibly use some improvement; I'm still getting the hang of this.

while p+1 becomes while-~p

since b=s[p:q], len(b) must be q-p right?

I stole you input and print method but did the rest very different, thanks! I think if you just do print(2**m-2*sum(i in"omen" for i in s)) for your last three lines you'll do better, like 148?

Oh, and you can just move s[p:q] into the if clause while-~q:n=q-p;m=n if(s[p:q]in"lucky")*n>m else m;q-=1 for 143?

sum(map(s.count,"omen")) saves one byte, making it 135

TSQL, 233 bytes
Golfed:
DECLARE @t varchar(99)='oluck'

,@z INT=0,@a INT=0,@ INT=1,@c INT=0WHILE @a<LEN(@t)SELECT
@a+=IIF(@=1,1,0),@z=IIF('LUCKY'LIKE'%'+x+'%'and @>@z,@,@z),@c+=IIF(x
IN('O','M','E','N'),2,0),@=IIF(@+@a-1=LEN(@t),1,@+1)FROM(SELECT
SUBSTRING(@t,@a,@)x)x PRINT POWER(2,@z)-@c

Ungolfed:
DECLARE @t varchar(99)='oluck'

,@z INT=0
,@a INT=0
,@  INT=1
,@c INT=0
WHILE @a<LEN(@t)
  SELECT
    @a+=IIF(@=1,1,0),
    @z=IIF('LUCKY'LIKE'%'+x+'%'and @>@z,@,@z),
    @c+=IIF(x IN('O','M','E','N'),2,0),
    @=IIF(@+@a-1=LEN(@t),1,@+1)
    FROM(SELECT SUBSTRING(@t,@a,@)x)x
PRINT POWER(2,@z)-@c

Try it online

PHP program, 139 135 108 bytes
quantum leap fails for multiple substrings where the first occurence is shorter. :(
actually I could save another 7 bytes in PHP<5.4 with register_globals on
<?for($s=$argv[1];$i<5;$i++)for($j=6;--$j;)$r=max($r,strstr($s,substr('lucky*',$i,$j))?2**$j:1);echo$r-2*preg_match_all('/[omen]/',$s);

usage: php -d error_reporting=0 <filename> <string>
+5 for a function:
function f($s){for(;$i<5;$i++)for($j=6;--$j;)$r=max($r,strstr($s,substr('lucky*',$i,$j))?2**$j:1);return$r-2*preg_match_all('/[omen]/',$s);}

tests (on the function)
echo '

input	output	expected	ok?
';
foreach([
    'lumberjack'=>0,        'smack'=>2,
    'nnnnnomemenn'=>-23,    'lucky'=>32,
    'omen'=>-7,             'firetruck'=>6,
    'memes'=>-7,            'determine the “luck” of a string'=>0,
    'amazing'=>-3,          'wicked'=>2,
    'chucky'=>16,           'uckyuke'=>14,
    'ugly'=>2,              'lucy'=>8,
    'lukelucky'=>30
] as $x=>$e){
    $y=f($x);
    echo"$h
",$x,'	',$y,'	',$e,'	',$e==$y?'Y':'N',"
";
}echo '
';

Haskell (134 132 Bytes)
import Data.List
c[]=[]
c s@(_:x)=inits s++c x
l=length
g q=2^(maximum$map(\z->l q-l(q\\z))$c"lucky")-2*(l$intersect q"omen")

Not a code golfer nor a Haskell programmer, so would love some tips on this one.
(Example: g "firetruck")

I am no Haskell Expert either, but managed to carve off a few byes by changing the algorithm slightly and using function aliases on reused functions.

Scala, 155 bytes
def f(w:String)=(1::List.fill((for(a<-1 to 5;s<-"lucky".sliding(a))yield if(w.contains(s)) a else 0).max){2}).product-2*w.filter("omen".contains(_)).length

C# (Visual C# Interactive Compiler) with flag /u:System.Text.RegularExpressions.Regex, 99 bytes
n=>(1<<Matches(n,"l?u?c?k?y?").OrderBy(x=>x.Value).Last().Length)-n.Count(x=>"omen".Any(c=>c==x))*2

Try it online!

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Find a dual graph
A dual graph is defined such that for every "face" in a graph G, there is a corresponding vertex in the dual graph, and for every edge on the graph G, there is an edge in the dual graph connecting the vertices corresponding to the two faces on either side of the edge of the original graph. Note that the faces on both side may be the same face, for example the graph consisting of 2 vertices connected by a single edge (see case 3).
Here is a shamelessly borrowed example from Wikipedia:

Your goal is given a graph, find a dual graph for that graph. Note that there may not necessarily be a unique dual graph for a given graph; you need only find one. Assume all input graphs are undirected and planar.
Input
Assume all vertices of the input graph have some consecutive integer numbering starting at any beginning integer value of your choice. An edge is described by an unordered pair of integers denoting the vertices the edge connects. For example, the blue graph shown above could be described with the following unordered multiset of edges (assuming the numbering of vertices starts at 0):
[(0,1), (0,2), (1,2), (2,3), (1,3), (1,4), (4,3)]

An alternative way to describe a multigraph is via an adjacency list. Here is an example adjacency list for the above graph:
[0:(1,2), 1:(0,2,3,4), 2:(0,1,3), 3:(1,2,4), 4:(1,3)]

Your program must take as input a multigraph of edges from any source (stdio, function parameter, etc.). You may assume the input graph is connected. You may use any notation desired so long as the no additional non-trivial information is communicated to your program. For example, having an extra parameter denoting the number of input edges is perfectly acceptable, but passing in a full or partially formed dual graph as an extra parameter is not. Similarly, passing in an unordered multiset of edges, adjacency list, or adjacency matrix is fine.
Output
The output of your program should be in one of the formats allowed for the input; it needs not be the same as the input format. The output may be to any sink desired (stdio, return value, output parameter, etc.).
Examples
All following examples use unordered multisets of edges with 0-based indices. One possible output is given. As a side note, all of the test case outputs are also valid inputs for your program, and an example output is the corresponding input.
case 1:
input:
[(0,1), (0,2), (1,2), (2,3), (1,3), (1,4), (4,3)]
output:
[(0,1), (0,2), (1,0), (0,3), (0,3), (1,2), (2,3)]

case 2:
input:
[(0,1),(0,2),(1,2)]
output:
[(0,1),(0,1),(0,1)]

case 3:
input:
[(0,1)]
output:
[(0,0)]

case 4:
input:
[]
output:
[]

case 5:
input:
[(0,1),(0,2),(2,1),(3,1),(3,4),(2,4)]
output:
[(0,2),(0,2),(1,0),(1,2),(1,2),(1,2)]

Scoring
This is code golf; shortest code wins. Standard loopholes apply. You may use any built-ins not specifically designed to solve this problem.

Are we guaranteed the input graph is planar?

@xnor updated, yes. I also fixed case 3 since it looks like it makes more sense to allow an edge to start and end at a single vertex.

Can the input have the same edge multiple times? Self loops? Isolated vertices with no edges?

yes, yes, yes*. The input must be a connected graph, so the only isolated vertices would be if a graph containing a single vertex with 0 edges (case 4).

Why wouldn't the output be empty in example 3? There is only one region, no?

@feersum this is the one case I'm unsure mathematically what is traditionally considered the dual of this case. As far as I can tell, the dual of a dual graph is the original graph, and that means case 3 requires the output to form a cyclic edge. Perhaps my original definition of a dual graph needs to be changed, though I mostly copied that from Wikipedia because I don't know of a clean way to formally define it.

I believe the fixed definition works for case 3, though I don't know if there's any other cases it breaks? I'm pretty sure that this is a more correct definition, though.

I don't know if this is formal enough, but you can choose a planar embedding, label each face with a distinct label, and then include an edge for each edge of the original graph whose vertex endpoints correspond to the faces it touches on either side.

In case anyone wants to tackle this, there's an overview of relatively simple and fast algorithm to find a planar embedding. "Relatively simple" because the others require extracting bi(or tri)connected components while this one doesn't, and the data structure is also quite simple.

^ Or maybe use Fáry's theorem to brute-force the straight edge embedding...

^ There's a paper showing that any planar graph of n≥3 vertices have a (n-2)×(n-2) grid embedding, which makes brute forcing much easier.

Python3, 416 bytes:
S=sorted
T=tuple
def C(n,o,l,p=[]):
 if n==o and p:yield T(map(T,S(p)));return
 for i in l[n]:
  if(s:=S([n,i]))not in p:yield from C(i,o,l,p+[s])
def f(e):
 K,s=0,{min(r,key=len)for i in e if(r:=[*C(i,i,e)])}
 if not s and e:return[(0,0)]
 E={(K:=K+1):set(i) for i in s}
 l=[((a,b),j)for a in E for b in E if a<b and(j:=E[a]&E[b])]
 return[(0,i)for i in E for _ in E[i]-{x for _,y in l for x in y}]+[a for a,_ in l]

Try it online!


text:
Diamond with numbers
Inspired by this, print an ascii diamond pattern built using 0-9.
Rules

Input n should be between 0-9, anything outside that range is undefined
The diamond should be padded with spaces
The middle line should always have no padding and be the only line to contain n, in the center
Print to stdout
As always, this is code-golf

Test Cases

n = 0

0

n = 1, print

 0
010
 0

n = 2, print

  0
 010
01210
 010
  0

n = 9, print

         0
        010
       01210
      0123210
     012343210
    01234543210
   0123456543210
  012345676543210
 01234567876543210
0123456789876543210
 01234567876543210
  012345676543210
   0123456543210
    01234543210
     012343210
      0123210
       01210
        010
         0

Unfortunately, someone already had the same challenge idea.

@xnor Wait - I don't think it's a duplicate. That asked you to print that specific diamond -- it was a k-complexity question. The answers will vary because this is asking you to generate it.

@xnor I've seen this before and usually it's a far enough distinction.

I'm not sold that the input makes a big difference, but I'll retract my dupehammer and let people vote. In particular, it seems to me like a lot of the answers could change their parameter 9 to an input.

I also feel like this is a duplicate, in the sense that answerers here could, in many cases, reasonably just look at the previous challenge’s solutions and replace a 9 by an input() or something.

Starting from 0 might make a difference in messing up the arithmetic trick that 1111*1111=1234321, though I think that's unfortunate because it's a cool strategy. Is there something new that's allowed by the zeroes?

I also think its a dup, but for now withholding my dupe hammer

Vitsy, 50 bytes
I don't think I'm done golfing yet!
VVHr1mV{V2*1+\[2m]
:Xru
v&VvD([D\[' 'O]]-H1ml\NaOY

Explanation:
VVHr1mV{V2*1+\[2m]
V                  Pop n, set n as the global final variable (GFV).
 V                 Push the GFV to the current stack.
  H                Pop n, pop o, push each item of the range from o to n.
   r               Reverse the current program stack.
    1m             Call the method on line index 1.
      V{           Push the GFV to the bottom of the current stack.
        V2*1+      Push the GFV*2+1 to the stack.
             \[  ] Pop n, do the stuff in brackets n times.
               2m  Call the method on line index 2. Note that this is necessary due
                   to an unknown bug.

:Xru
:                  Clone the current stack, pushing a second stack to the stack
                   stack and jumping to it.
 X                 Pop n and discard.
  r                Reverse the current stack.
   u               Pop the current stack and concatenate it to the previous.

v&VvD([D\[' 'O]]-H1ml\NaOY
v                  Pop n, save as a temporary variable.
 &                 Push a new stack to the stack stack and jump to it.
  V                Push the GFV.
   v               Push the temp var, clear the temp var memory.
    D([        ]   If the top item is not zero, do the stuff in brackets.
                   This is necessary as all loops always apply once.
       D\[' 'O]    Peek n, output n spaces.
   -               Pop n, pop o, push o-n.
    H              Pop n, pop o, push each item of the range from o to n.
     1m            Call the method at line index 1.
       l\N         Output all numbers in this stack.
          aO       Output a newline.
            Y      Pop and discard the current stack from the stack stack.

Try it online!

That was SpOOky as hell I didn't realize you deleted it

@Insane Yeah, I made a one byte error. :P Fixed now.

@Insane Explanation added.

@Insane Try this with input 40. ;)


text:
Golf a Sentence
Everybody loves golfing code. Code is written in English (eh...). Therefore, everybody loves golfing English!
Your task is to write a program or function that takes a string as input, and then returns or prints the golfed version. There will be no newlines or tabs in the input.
This is how you golf a string. The order matters!

Remove spaces directly before and after punctuation: "Hey there", he said   ; he ' s a cat. -> "Hey there",he said;he's a cat. The following count as punctuation: .,?!"':;()
Replace he/she/it is, case insensitive, with he's/she's/it's: It is unfortunate that she is not coming ever. -> It's unfortunate that she's not coming ever.
Words that start with capital letters in a sentence can be moved against the preceding word (omitting the space): The farmer told Fred that he should leave. -> The farmer toldFred that he should leave.
Trailing and leading spaces should be removed: [      ]It's raining.[     ]-> It's raining. Ignore the brackets (annoying auto-formatting).
Remove repeated punctuation that is the same: ""Here''s the cake",, said Fred..! -> "Here's the cake",saidFred.!

If we were to golf the first paragraph of this challenge, the output would be:

Everybody loves golfing code.Code is written inEnglish(eh.).Therefore,everybody loves golfingEnglish!

This is code golf––or rather English golf––so shortest code in bytes wins!

Here is one all encompassing test case:
Input: "    You are crazy"",, , , she said. It is unfortunate that Margaret had to say that... she is a Martian!.

Output: "You are crazy",she said.It's unfortunate thatMargaret had to say that.she's aMartian!.

inEnglish(eh.). You collapsed the space between parentheses and text, though you don't explicitly count parens as punctuation.

Does "whitespace" mean all whitespace or just spaces? (i.e. does it include newlines, tabs, etc.)

@Downgoat. Whitespace is just spaces. There are no new lines or tabs in the input. I'll clarify that in the question.

Why should the He is in He is here remain unchanged?

@Dopapp Ok, well then, in that case, you should change the rule back to what it used to be. It makes no sense that She is and It is become She's and It's respectively, but He is does not become He's.

@Dopapp Well, that is not what Rule # 2 implies.

Let us continue this discussion in chat.

I suggest adding tests cases that encompass all the rules and edge cases to avoid answers that miss some edge cases

@Downgoat, I added an all encompassing test case.

@Dopapp in that test case, why is "that.she is aMartian!." not "that.she's aMartian!."

@Downgoat, oh I didn't catch that!

@Dopapp Initially, There were lot's of things I didn't have to handle that you added in the middle. It's frustrating to have to accompany rules that are constantly changing and not very clear. At this point, I'd rather just delete my answer than keep updating it. I'm not suggesting you change it back (that would just make it worse).

@DrGreenEggsandIronMan, I truly am terribly sorry. In an effort to clear up the question and accommodate all of the answers, it seems that I just made it worse. I promise you now that the rules are now set in stone and no further changes will be made to them.

What characters would the input contain?

@LeakyNun, any ASCII characters.

@Dopapp Then that is not "one all encompassing test case".

@LeakyNun, it is all encompassing for the rules. Every rule is tested in the test case.

Does rule 5 mean that @@ should become @?

@LeakyNun, No because @ is not part of the defined punctuation set defined in rule 1

Retina, 65 bytes
+` *([.,?!"':;()])\1* *| ([A-Z])| +$|^ +
$1$2
i`(s?he|it) is
$1's
Regex replacement and then a simple trim
The magic regex is:
 *([.,?!"':;()])\1* *| ([A-Z])| +$|^ +

Try it online!

V, 77 bytes
Ó *¨[.,"':;?!()]© */±
Óã¨s¿heüit©ús is/'s
Óó«úeõ
Ó^ *ü *$
Ó¨[.,"':;?!()]©±*/±

Way longer than I'd like.
Try it online!

V is new retina? (can you add explanation)

Eventually. This is a longer one so it might take a while to write out...

JavaScript ES6, 102 92 61 65 95 bytes
x=>x.replace(/ *([.,?!"':;()])( *\1 *)*| ([A-Z])/g,"$1$3").replace(/(he|it) is/g,"$1's").trim()

Works on the last testcase. Saved a lot of bytes thanks to Downgoat! Impressive.

x[R="replace"](/ *([.,?!"':;()]) */g,"$1")[R](/ ([A-Z])/g,"$1") -> x[R="replace"](/ *([.,?!"':;()]) *| ([A-Z])/g,"$1$2")

@Downgoat I tried that earlier, but that didn't work for me XD works now tho

Make the first regex / *([.,?!"':;()])\1* *| ([A-Z])/g and the you should be able to remove the other prelace

To fix bugs with hello, , , you're gonna have to make it: x=>x.replace(/ *([.,?!"':;()])( *\1 *)*| ([A-Z])/g,"$1$3").trim() at 65 bytes. I'll see if I can golf it more

@Dopapp... in your console, maybe?

@CᴏɴᴏʀO'Bʀɪᴇɴ you could use esfiddle: http://vihan.org/p/esfiddle/

This doesn't do anything for 'he she it'.

@DrGreenEggsandIronMan I thought the OP said rule #2 was "anulled" ?

@CᴏɴᴏʀO'Bʀɪᴇɴ, I am so terribly sorry. Someone in the comments confused me a little with the wording and I went a little crazy. Now the rules are set in stone.

Python 3.5, 213 bytes:
import re;R=re.sub;W=lambda G:G.group(0);print(R(r'(\W)\1+',lambda f:W(f)[0],R('\s*[^\s\w]\s*|\s*[A-Z]',lambda f:W(f).strip(),R('((I|i)t|(s|S)?(h|H)e) is',lambda i:W(i)[:[*W(i)].index(" ")]+"'s",input().strip()))))

Uses 3 regular expressions in a row with re.sub in conjunction with Python's str.strip() built in to golf the input English sentence.
Try It Online! (repl.it)

Bash 74 Sed 65 + 4 bytes
65 bytes for the script and 4 for the r and f flags.
sed -r "s/\s*([.,?\!\"\':;\(\)A-Z])(\1|\s)*/\1/g;s/(he|she|it) is/\1\'s/i"
s/\s*([,.?\!\"\':;\(\)A-Z])(\1|\s)*/\1/g;s/(he|she|it) is/\1\'s/i
Usage: Enter text, press enter and then Ctrl + D (send EOF).


text:
Guess the language
Introduction
This site is rapidly building up a huge dataset of code snippets, so let's do something with it!
Here's a data file. It contains 9,066 unique language+snippet pairs for 113 languages, all taken from this site. The format is tab-separated (language-TAB-snippet), with all newlines in the snippets replaced with <LF>, and all tabs replaced with 4 spaces. There are at least 5 snippets for each language.
[update: I've made a minor change to the data file to merge some Python & RegExp versions I missed before - the link above has been updated]
Challenge
Write a program or function which takes a code snippet and outputs the language it is written in (see below for details). The total size of your source + any data you require must be 300 bytes or less, and your program must output the correct language when given its own source code. Highest accuracy (most correct answers on the dataset above) wins.
Rules

The total size of your source code, resources, and any required compilation / runtime flags must not exceed 300 bytes.
Your answer will be tested against the dataset above; it will be given one of the "Snippet" values as input and its output will be compared against the "correct" output according to the dataset. This will be repeated for all entries in the dataset and the final number of correct answers is your score.
You can choose the input encoding - I'll assume UTF-8, so if you need another encoding specify it in your answer.
You don't need to use the <LF> replacement for newlines; if your entry expects to receive newlines as literal newlines (char 10), specify it in your answer.
Your entry must output the language it thinks the input snippet is written in. To avoid the need to compress lots of language strings, I'll allow mappings (If you want to output 3 for "Java", that's fine); just note the mappings in your answer.
You can only have 1 output mapping for each language (i.e. if 3 means "Java", you can't also have 4 meaning "Java").
When given its own source code, your program must produce the correct answer (must output the language it is written in).
You don't need to support all languages in the dataset, and you can support extra languages if you want to (e.g. if your entry isn't in one of the languages in the dataset).
Your program must be deterministic (providing the same input twice must produce the same output).

Tie-Breaking

Ties will be decided by reducing the dataset until one entry wins. The dataset will be reduced by removing all snippets for the most popular language (i.e. ties are broken by accuracy on rarer languages). For example, if A and B score 70% on the full dataset, all Python snippets will be removed. If A and B now both score 60%, CJam will be removed. If A now scores 50% but B scores 55%, B is the winner.
If 100% accuracy is achieved, ties will be decided using a second (blind) dataset containing more samples for the same languages.

Example 1
The Python script:
print("python")

This script successfully produces "python" when given its own source code, so it is valid. On the dataset, it scores 1008/9066 = 11.1%
Example 2
The JavaScript function:
function f(s){return /function/.test(s)?1:2}

With the mappings 1 → javascript, 2 → python. Again it successfully produces 1 ("javascript") for its own source, and on the dataset it scores 1092/9066 = 12.0%

Where did the data come from?
I created an SEDE query to pull samples from [code-golf] challenges on this site. From the resulting 10,000 answers, I used a hacked-together python script to find the code & language name for each, then filtered out any language with less than 5 examples. The data isn't 100% clean (I know there are some non-code snippets it pulled), but should be good enough.

Inspired by this challenge from earlier in the year: Who said that? 2016 Presidential election
Also partly related to What's the Language?

Seems incredibly challenging to do in 300 bytes. Perhaps allot more bytes?

@RohanJhunjhunwala yes I imagine it will be quite a challenge! I'm not expecting anybody to get 100% accuracy though; the challenge is to get as high as possible. In the "who said that?" challenge I linked to, we all peaked at ~30% accuracy. I've tried to set the byte limit so that 50–70% should be possible here. Hopefully I got the balance right. Of course if you find a great solution which uses more bytes, post it! It just won't be competing (you can cut it down for a competing version).

Have you removed polyglots from the dataset, or will those just be "gotchas"?

@Geobits any answers which marked themselves as polyglots have been removed (e.g. titles like "4 languages"), but otherwise no I haven't filtered them, so for example an answer listed as C++ which is also valid C would be a "gotcha". More generally, I haven't manually filtered these beyond checking the results repeatedly and tweaking my automated filtering to remove the worst of the bad data.

Do we have to differentiate between different versions for languages, i.e. Python 2 vs. Python 3?

@R.Kap no - I specifically removed versions where I found them since it would be nearly impossible in most cases to distinguish them (essentially it would add polyglots as Geobits mentioned). Having said that, looking at the data now I see that "python2" and "python3" made it through (I filtered out "python 2" / "python 3"). I think I'll try to fix that quickly before too many people start working on a dataset which is much harder than it ought to be… (sorry to anyone who's started! — hopefully this will be a minor change)

It's gonna be so hard to differentiate among golflangs...

The fixed dataset is now available — link has been updated. I've checked over them all and the languages seem sane now, so I shouldn't need to change the data again. Sorry about that.

One possible way to improve the challenge would be to allow a program to know the origin of the first half of the snippets.  The challenge would be to use those snippets as data for inferring the language of the second half of the snippets.

@DavidC that would be pretty cool. As I implied in the intro, I'm hoping this sort of data can be used more now that it's building up.

Related: http://codegolf.stackexchange.com/q/21319/31716

Interesting facts: the 20 most commonly used (at least in your dataset) languages make up 81% of your dataset, and the 10 most commonly used ones make up 61%. Even just detecting differences between Javascript, Pyth, CJam, and Python is enough to get about 35%.

Does the program actually have to parse the input? In other words, can we use any method to detect the programming language?

@R.Kap not sure what you're getting at, but no you don't HAVE to do anything with the input. See example 1; it just returns "Python" without looking at what it's given.

if anyone wants the source language distribution: http://pastebin.com/rvCbm7ik

If I specify the result is the return value, can all other output be ignored?

@CᴏɴᴏʀO'Bʀɪᴇɴ as long as your result is on a distinct channel, the others can be ignored. So if your result is to stdout, anything on stderr and the return code can be ignored. If your result is by return code, stdout/stderr can be ignored, etc. Same type of logic applies to functions.

C, 297 bytes, 43.194351% matched (v2)
This is the first non-golf challenge I've competed in. Surprisingly, golfing languages are actually rather easy to separate, with about 60% matching accuracy per language.
The code requires input as UTF-8 string, results based on version 2 of the supplied dataset. This code does not require <LF> to be replaced with actual newlines.
#define S(x)!!strstr(p,#x)
f(char*p){return S(#d)?:S(voi)?0:S(mai)|S(utc)?:S(mbd)|S(impor)|S(input)|S(def)|S(rang)?2:S(log)|S(fun)|S(=>)|S(lert)?3:S(<?)?4:S(echo)|S(sed)?5:S(+++)?6:S(<-)?7:S($_)|S(say)?8:S(\342)|S(\303)?9:S(->)|S(map)?10:S(@#)|S(]])|S([#)?11:S(V)|S(Q)?12:S(Z)|S(Y)?13:S(.)?14:15;}

Mapping table:
 0. java
 1. c
 2. python
 3. javascript
 4. php
 5. bash
 6. brainf*
 7. haskell
 8. perl
 9. apl
10. ruby
11. wolfram
12. pyth
13. matl
14. golfscript
15. cjam

The percentage is based on my hits/total calculation: 3916 hits/9066 total.

Off to a great start; that was quick! As for "My test code and text editor see 9068 entries instead of 9065 for some reason" - did you skip the headers and the blank line at the end? That would account for 2 extra lines.

Sorry; this isn't passing rule #7 (must output correct answer for own source code): right now it says 0 which is Python (I'm guessing it wouldn't be too much work to re-order the checks to fix that)

You can lose the space after define S(x) and the 1 wherever you have ?1.

Thanks! I didn't know about the ?1 trick, and forgot about the other. ;-)

Wow this has been quietly improving! Verified the latest 43.19% :)

@Dave - Yes, it has improved, but I think it's pretty much optimal now. I can't get much more out of it. I probably could hit >50% if I had 400 bytes to work with.

Python 3, 271 278 bytes, 25.049636% matched (v2, unverified)
def f(c):
 try:compile(c,'','exec');return 5
 except:
  for j in range(9):
   if any(l in c for l in [['echo'],['require'],['Main','string'],['document','alert','var ','function'],['String'],['def ','lambda','print '],['main','int','char'],['+++','<<<'],[]][j]):break
 return j

map:
0 = bash
1 = ruby
2 = c#
3 = javascript
4 = java
5 = python
6 = c
7 = brainf*
8 = cjam

much better golfed (probably still not great), finally broke the 25% barrier! Inputs have <LF> replaced with newline (\n)

I like the exec attempt. By the way, you're allowed to ask for the input to have <LF> pre-replaced with \n, so you can save a few bytes there to potentially add some more fine-tuning.

Finally got around to verifying this. I only see 2103 (23.19%) for some reason - any idea why the difference?

hmmm... I'm not sure. Perhaps it has to do with how you're giving the input? I use decode('utf-8') to convert the raw input byte array to a native Python 3 unicode (utf-16?) string before giving it to my function.

Ah OK. Could be an encoding issue; I'm just relying on whatever fileinput.input() does under-the-hood. I'll investigate.


text:
Do not repeat yourself
Inspired by this challenge
Given a number m, output a program that prints out the string Do not repeat yourself.
Now for the challenging part: Each program the original code prints out has to have the byte at place m*n be the same as m*n + 1 and the same as m*n + 2 .... all the way down to m*n + m - 1.
(In case you can't tell, that means it has to be blocks of identical bytes m long)
Example (that only demonstrates the repetition rule, not the output):
2

aassdd

3

mmmyyy   nnnaaammmeee   iiisssfffrrreeeddd

27

111111111111111111111111111

##Scoring:

Your program's score is the x / (min(y, 10)^3), where y is the number of correct programs it outputs, and x is the sum of the lengths of all of the correct programs it outputs and y > 1.  Lowest score wins.

##Other notes:

Your code doesn't have to fulfill any such restrictions on letters repeating.

Your programs (that you output) cannot take input of any sort.

The input will always be a positive integer greater than 1.

Your code needs to work for at least one integer greater than 1.

Would interface{static void main(String[]a){System.out.print("Do not repeat yourself");}} be considered acceptable. I am unsure of exactly what you are asking?

@RohanJhunjhunwala Your program needs to have blocks of characters of <input> length, e.g. for input 2 something like aabbccdd.

Oh sorry I misread the question @Easterly IRk

Doesn't your challenge description disqualify most normal languages?

Like a language with boilerplate?

@RohanJhunjhunwala most languages don't use a boilerplate, and yes, it makes most languages extremely hard. The point is the creativity though.

Why do we have to take input if we're printing a static string?

@Esterly Irk is this challenge possible to be done in java? I feel like its provably impossible

@RohanJhunjhunwala I have no clue. But it's possible it at least 1 langauge.

@DrGreenEggsandIronMan you are supposed to print more than 1 different output. The output should be different for 2 and 4, for example.

What if someone creates one program that works for any m?

@RohanJhunjhunwala doubtful that would happen, and it would be Inf/10^3 score. That would probably end a win/tiebreaker of earliest answer.

So a score of 0?

@RohanJhunjhunwala If you have any more comments, please say them in chat. This is really polluting the comments.

Let us continue this discussion in chat.

The description of this challenge is unclear to the point of unreadability. n is used before being defined (it's never defined?). What is the output supposed to be for a given input? Your examples do not clarify anything.

Gammaplex, 2080 / 10³ = 2.08
X"Y#gmftsvp"2v
Ev2"!sfqfbu!z<
R>upo!pE#YYs"v
>1-swSs>swrsvS
?  v +=^?w-1<"
^ws<J0s11X"0F<

Note that it firstly displays a 0 when it is run. That's just the Gammaplex way of echoing the number you are going to input. And it prints the newline as ◙, which shares the same code point with a newline in CP437.
Gammaplex renders the string in a window which couldn't be copied. So here is an equivalent CJam program to make testing easier:
"/
ERrXX\"Do not repeat yourself\"X"qie*

Example for m=3:
///

EEERRRrrrXXXXXX"""DDDooo   nnnooottt   rrreeepppeeeaaattt   yyyooouuurrrssseeelllfff"""XXX

In Gammaplex, only the position of the first newline is used to determine the line length. So it is the same as the following:
///
EEE
RRR
rrr
XXX
XXX
"""
DDD
ooo

nnn
ooo
ttt

rrr
eee
ppp
eee
aaa
ttt

yyy
ooo
uuu
rrr
sss
eee
lll
fff
"""
XXX

Then it works in the obvious way as a 2D language.

CJam, 3165 / 10³ = 3.165
{
"Do not repeat yourself"]sX/z_&
6)H7+G0+B8+H7+E8+G0+D8+9)C8+9)A7+E8+G0+B9+H7+K7+D8+J7+9)A8+I6+]{c}/
"Do not repeat yourself"]sZ/z_&

"Do not repeat yourself"]s3D&3D&3D&3D&3D&/z_&

"Do not repeat yourself"]s1F&1F&1F&1F&1F&1F&1F&/z_&

"Do not repeat yourself"]sB/z_&

"Do not repeat yourself"]sD/z_&

"Do not repeat yourself"]sF/z_&

"Do not repeat yourself"]sH/z_&

"Do not repeat yourself"]sJ/z_&
}`1>W<N/
e# Uncomment this line to count total length:
e# ee{~,*}%:+p [L]
ri\1$=f*

Works for inputs 1, 2, 3, 5, 7, 11, 13, 15, 17, 19.
Total length is 3165.
The program for input 2 is from here, credits to Super Chafouin.
Example: output for 11
"""""""""""DDDDDDDDDDDooooooooooo           nnnnnnnnnnnooooooooooottttttttttt           rrrrrrrrrrreeeeeeeeeeepppppppppppeeeeeeeeeeeaaaaaaaaaaattttttttttt           yyyyyyyyyyyooooooooooouuuuuuuuuuurrrrrrrrrrrssssssssssseeeeeeeeeeelllllllllllfffffffffff"""""""""""]]]]]]]]]]]sssssssssssBBBBBBBBBBB///////////zzzzzzzzzzz___________&&&&&&&&&&&

Explanation:
"""""""""""..."""""""""""    Push five empty strings, a long string,
                                and five more empty strings.
]]]]]]]]]]]sssssssssss       Collect them all in a list. Put that list in
                             10 more layers of list, for good measure.
                             Convert this to a string, to just get the long one.
BBBBBBBBBBB///////////       Split into chunks of size
                                11/(11/(.../(11/(11/11))))) = 11.
                             This gets us:
                                ["DDDDDDDDDDD" "ooooooooooo" ...]
zzzzzzzzzzz                  Transpose eleven times, i.e. once. We now have:
                                ["Do not..." "Do not..." ... "Do not..."]
___________&&&&&&&&&&&       Push eleven more copies, and get the unique elements.
                             This gets us:
                                ["Do not..."]

That is quite amazing!

You could add a special case for input 2 (main program size doesn't seem to matter). Also, I'm not sure if input 1 is counted.

ferNANDo, 8745/103 = 8.745
7 - - - - D C B A
- - - - E D C B A

T D D
U E E
D T U
T B E
U C C
C T U
T B E
U B T
V E T
B U V

A A
I A A
I I
T I B
U I T
V T B
B U V
J I B
J J
T J C
U J T
V T C
C U V
I J C
I I
T I D
U I T
V T D
D U V

3
5 5
AD D D
AC C C
AB B B
AA A A
AD
AC
AB
AA
0 0 7 5 0 5 5 5
AA AA
AA
AB AB
AB
AC AC
AC
AD AD
AD
3 5
3
5 5

3
5 5
2 5 5
AH D D
AG C C
AF B B
AE A A
AH
AG
AF
AE
0 0 2 2 5 0 7 2
AE AE
AE
AF AF
AF
AG AG
AG
AH AH
AH
3 5
3
5 5

3
5 5
AL D D
AK C C
AJ B B
AI A A
AL
AK
AJ
AI
0 0 7 5 0 5 0 5
AI AI
AI
AJ AJ
AJ
AK AK
AK
AL AL
AL
3 5
3
5 5

3
4 3 3
AP D D
AO C C
AN B B
AM A A
AP
AO
AN
AM
0 0 3 2 4 2 4 0
AM AM
AM
AN AN
AN
AO AO
AO
AP AP
AP
2 2
3 2
3
2 2

3
5 5
AT D D
AS C C
AR B B
AQ A A
AT
AS
AR
AQ
0 0 7 5 0 0 5 5
AQ AQ
AQ
AR AR
AR
AS AS
AS
AT AT
AT
3 5
3
5 5

3
4 3 3
AX D D
AW C C
AV B B
AU A A
AX
AW
AV
AU
0 0 3 2 4 0 4 0
AU AU
AU
AV AV
AV
AW AW
AW
AX AX
AX
2 2
3 2
3
2 2

3
5 5
4 3 3
BB D D
BA C C
AZ B B
AY A A
BB
BA
AZ
AY
0 0 7 5 0 4 5 5
AY AY
AY
AZ AZ
AZ
BA BA
BA
BB BB
BB
3 5
3
5 5

3
BF D D
BE C C
BD B B
BC A A
BF
BE
BD
BC
0 0 7 2 0 0 2 2
BC BC
BC
BD BD
BD
BE BE
BE
BF BF
BF
2 2
3 2
3
2 2

3
5 5
4 3 3
BJ D D
BI C C
BH B B
BG A A
BJ
BI
BH
BG
0 0 7 5 0 1 0 4
BG BG
BG
BH BH
BH
BI BI
BI
BJ BJ
BJ
1 5 5
3 5
3
5 5

3
BN D D
BM C C
BL B B
BK A A
BN
BM
BL
BK
0 0 7 2 0 0 2 0
BK BK
BK
BL BL
BL
BM BM
BM
BN BN
BN
2 2
3 2
3
2 2

3
5 5
4 3 3
2 5 5
BR D D
BQ C C
BP B B
BO A A
BR
BQ
BP
BO
0 0 5 5 2 0 2 4
BO BO
BO
BP BP
BP
BQ BQ
BQ
BR BR
BR
3 5
3
5 5

3
BV D D
BU C C
BT B B
BS A A
BV
BU
BT
BS
0 0 7 2 0 2 2 2
BS BS
BS
BT BT
BT
BU BU
BU
BV BV
BV
2 2
3 2
3
2 2

3
5 5
4 3 3
BZ D D
BY C C
BX B B
BW A A
BZ
BY
BX
BW
0 0 7 5 0 4 4 4
BW BW
BW
BX BX
BX
BY BY
BY
BZ BZ
BZ
3 5
3
5 5

3
CD D D
CC C C
CB B B
CA A A
CD
CC
CB
CA
0 0 7 2 0 2 0 2
CA CA
CA
CB CB
CB
CC CC
CC
CD CD
CD
2 2
3 2
3
2 2

3
5 5
4 3 3
CH D D
CG C C
CF B B
CE A A
CH
CG
CF
CE
0 0 7 5 0 5 4 5
CE CE
CE
CF CF
CF
CG CG
CG
CH CH
CH
3 5
3
5 5

3
5 5
6 5
2 5 5
CL D D
CK C C
CJ B B
CI A A
CL
CK
CJ
CI
0 0 6 2 1 2 3 2
CI CI
CI
CJ CJ
CJ
CK CK
CK
CL CL
CL
1 5 5
3 5
3
5 5

3
5 5
CP D D
CO C C
CN B B
CM A A
CP
CO
CN
CM
0 0 7 5 0 0 1 1
CM CM
CM
CN CN
CN
CO CO
CO
CP CP
CP
1 5 5
3 5
3
5 5

3
CT D D
CS C C
CR B B
CQ A A
CT
CS
CR
CQ
0 0 7 2 0 2 2 2
CQ CQ
CQ
CR CR
CR
CS CS
CS
CT CT
CT
2 2
3 2
3
2 2

3
5 5
4 3 3
CX D D
CW C C
CV B B
CU A A
CX
CW
CV
CU
0 0 7 5 0 0 4 4
CU CU
CU
CV CV
CV
CW CW
CW
CX CX
CX
3 5
3
5 5

3
DB D D
DA C C
CZ B B
CY A A
DB
DA
CZ
CY
0 0 7 2 0 0 0 2
CY CY
CY
CZ CZ
CZ
DA DA
DA
DB DB
DB
2 2
3 2
3
2 2

3
5 5
DF D D
DE C C
DD B B
DC A A
DF
DE
DD
DC
0 0 7 5 0 0 0 1
DC DC
DC
DD DD
DD
DE DE
DE
DF DF
DF
1 5 5
3 5
3
5 5

3
5 5
6 5
4 3 3
2 5 5
DJ D D
DI C C
DH B B
DG A A
DJ
DI
DH
DG
0 0 3 2 4 0 6 2
DG DG
DG
DH DH
DH
DI DI
DI
DJ DJ
DJ
3 5
3
5 5

3
5 5
4 3 3
2 5 5
DN D D
DM C C
DL B B
DK A A
DN
DM
DL
DK
0 0 5 5 2 4 2 4
DK DK
DK
DL DL
DL
DM DM
DM
DN DN
DN
3 5
3
5 5

3
DR D D
DQ C C
DP B B
DO A A
DR
DQ
DP
DO
0 0 7 2 0 2 2 2
DO DO
DO
DP DP
DP
DQ DQ
DQ
DR DR
DR
2 2
3 2
3
2 2

3
5 5
4 3 3
DV D D
DU C C
DT B B
DS A A
DV
DU
DT
DS
0 0 7 5 0 4 4 5
DS DS
DS
DT DT
DT
DU DU
DU
DV DV
DV
3 5
3
5 5

3
DZ D D
DY C C
DX B B
DW A A
DZ
DY
DX
DW
0 0 7 2 0 2 0 0
DW DW
DW
DX DX
DX
DY DY
DY
DZ DZ
DZ
2 2
3 2
3
2 2

3
5 5
4 3 3
ED D D
EC C C
EB B B
EA A A
ED
EC
EB
EA
0 0 7 5 0 1 4 5
EA EA
EA
EB EB
EB
EC EC
EC
ED ED
ED
1 5 5
3 5
3
5 5

3
5 5
6 5
2 5 5
EH D D
EG C C
EF B B
EE A A
EH
EG
EF
EE
0 0 6 2 1 0 3 0
EE EE
EE
EF EF
EF
EG EG
EG
EH EH
EH
1 5 5
3 5
3
5 5

3
5 5
EL D D
EK C C
EJ B B
EI A A
EL
EK
EJ
EI
0 0 7 5 0 1 1 1
EI EI
EI
EJ EJ
EJ
EK EK
EK
EL EL
EL
1 5 5
3 5
3
5 5

3
EP D D
EO C C
EN B B
EM A A
EP
EO
EN
EM
0 0 7 2 0 2 2 2
EM EM
EM
EN EN
EN
EO EO
EO
EP EP
EP
2 2
3 2
3
2 2

3
5 5
4 3 3
ET D D
ES C C
ER B B
EQ A A
ET
ES
ER
EQ
0 0 7 5 0 1 0 4
EQ EQ
EQ
ER ER
ER
ES ES
ES
ET ET
ET
1 5 5
3 5
3
5 5

3
EX D D
EW C C
EV B B
EU A A
EX
EW
EV
EU
0 0 7 2 0 2 0 0
EU EU
EU
EV EV
EV
EW EW
EW
EX EX
EX
2 2
3 2
3
2 2

3
5 5
FB D D
FA C C
EZ B B
EY A A
FB
FA
EZ
EY
0 0 7 5 0 5 1 5
EY EY
EY
EZ EZ
EZ
FA FA
FA
FB FB
FB
1 5 5
3 5
3
5 5

3
4 3 3
FF D D
FE C C
FD B B
FC A A
FF
FE
FD
FC
0 0 3 2 4 0 4 0
FC FC
FC
FD FD
FD
FE FE
FE
FF FF
FF
2 2
3 2
3
2 2

3
5 5
FJ D D
FI C C
FH B B
FG A A
FJ
FI
FH
FG
0 0 7 5 0 5 5 5
FG FG
FG
FH FH
FH
FI FI
FI
FJ FJ
FJ
3 5
3
5 5

3
FN D D
FM C C
FL B B
FK A A
FN
FM
FL
FK
0 0 7 2 0 0 2 2
FK FK
FK
FL FL
FL
FM FM
FM
FN FN
FN
2 2
3 2
3
2 2

3
5 5
FR D D
FQ C C
FP B B
FO A A
FR
FQ
FP
FO
0 0 7 5 0 1 1 1
FO FO
FO
FP FP
FP
FQ FQ
FQ
FR FR
FR
1 5 5
3 5
3
5 5

3
FV D D
FU C C
FT B B
FS A A
FV
FU
FT
FS
0 0 7 2 0 0 0 0
FS FS
FS
FT FT
FT
FU FU
FU
FV FV
FV
2 2
3 2
3
2 2

3
5 5
4 3 3
2 5 5
FZ D D
FY C C
FX B B
FW A A
FZ
FY
FX
FW
0 0 5 5 2 0 2 4
FW FW
FW
FX FX
FX
FY FY
FY
FZ FZ
FZ
3 5
3
5 5

3
GD D D
GC C C
GB B B
GA A A
GD
GC
GB
GA
0 0 7 2 0 0 0 2
GA GA
GA
GB GB
GB
GC GC
GC
GD GD
GD
2 2
3 2
3
2 2

3
5 5
4 3 3
GH D D
GG C C
GF B B
GE A A
GH
GG
GF
GE
0 0 7 5 0 4 4 4
GE GE
GE
GF GF
GF
GG GG
GG
GH GH
GH
3 5
3
5 5

3
GL D D
GK C C
GJ B B
GI A A
GL
GK
GJ
GI
0 0 7 2 0 0 0 2
GI GI
GI
GJ GJ
GJ
GK GK
GK
GL GL
GL
2 2
3 2
3
2 2

3
5 5
4 3 3
GP D D
GO C C
GN B B
GM A A
GP
GO
GN
GM
0 0 7 5 0 0 0 4
GM GM
GM
GN GN
GN
GO GO
GO
GP GP
GP
3 5
3
5 5

3
5 5
6 5
2 5 5
GT D D
GS C C
GR B B
GQ A A
GT
GS
GR
GQ
0 0 6 2 1 0 1 0
GQ GQ
GQ
GR GR
GR
GS GS
GS
GT GT
GT
1 5 5
3 5
3
5 5

3
5 5
GX D D
GW C C
GV B B
GU A A
GX
GW
GV
GU
0 0 7 5 0 1 0 5
GU GU
GU
GV GV
GV
GW GW
GW
GX GX
GX
1 5 5
3 5
3
5 5

3
5 5
6 5
2 5 5
HB D D
HA C C
GZ B B
GY A A
HB
HA
GZ
GY
0 0 6 2 1 2 1 2
GY GY
GY
GZ GZ
GZ
HA HA
HA
HB HB
HB
1 5 5
3 5
3
5 5

3
5 5
HF D D
HE C C
HD B B
HC A A
HF
HE
HD
HC
0 0 7 5 0 0 5 0
HC HC
HC
HD HD
HD
HE HE
HE
HF HF
HF
3 5
3
5 5

3
5 5
2 5 5
HJ D D
HI C C
HH B B
HG A A
HJ
HI
HH
HG
0 0 2 2 5 0 7 2
HG HG
HG
HH HH
HH
HI HI
HI
HJ HJ
HJ
3 5
3
5 5

3
5 5
HN D D
HM C C
HL B B
HK A A
HN
HM
HL
HK
0 0 7 5 0 1 1 1
HK HK
HK
HL HL
HL
HM HM
HM
HN HN
HN
1 5 5
3 5
3
5 5

3
HR D D
HQ C C
HP B B
HO A A
HR
HQ
HP
HO
0 0 7 2 0 2 2 2
HO HO
HO
HP HP
HP
HQ HQ
HQ
HR HR
HR
2 2
3 2
3
2 2

3
5 5
HV D D
HU C C
HT B B
HS A A
HV
HU
HT
HS
0 0 7 5 0 0 0 0
HS HS
HS
HT HT
HT
HU HU
HU
HV HV
HV
3 5
3
5 5

3
HZ D D
HY C C
HX B B
HW A A
HZ
HY
HX
HW
0 0 7 2 0 2 2 2
HW HW
HW
HX HX
HX
HY HY
HY
HZ HZ
HZ
2 2
3 2
3
2 2

3
5 5
4 3 3
ID D D
IC C C
IB B B
IA A A
ID
IC
IB
IA
0 0 7 5 0 4 4 4
IA IA
IA
IB IB
IB
IC IC
IC
ID ID
ID
3 5
3

Works for all inputs 1 through 15, 1 through 10 are counted in the score.
Update: reduced the size of the generator from ~16k down to 6.1k.

Sample output for m=3:
777   777

333

555   555

444   333   333

000   777   333   333   111   444   222   111

000   777   777   000   555   777   555   777

000   333   777   333   000   111   000   111

333   555

000   777   777   111   444   333   555   222

000   777   777   111   444   444   555   777

000   777   777   333   000   777   000   111

000   111   777   000   111   111   000   000

111   555   555

222   222

333

000   777   777   000   000   777   777   000

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Decompose string into blocks
Your program's input is a string containing whitespaces, parentheses, and other characters. The string is assumed to be parenthesed correctly, i.e. each right parenthesis matches a unique left parenthesis and vice versa : so the program is allowed to do anything on incorrectly parenthesed strings, such as )abc, (abc or )abc(.
The character interval between a left parenthesis and the corresponding right parenthesis (including the parentheses) is called a parenthesed interval.
Your program's job is to decompose the string into blocks according to the rules below, and output the result as a "vertical list", with one block per line.
Now, two characters in the string are in the same block if either
(a) there is no whitespace character strictly between them
or
(b) there is a parenthesed interval containing them both.
Also,
(c) Whitespaces not in any parenthesed interval  are mere separators
and to be discarded in the decomposition. All the other characters (including whitespaces) are retained.
For example, if the input is
I guess     () if(you say ( so)), I'll have((  ))to pack my (((things))) and go

The output should be
I
guess
()
if(you say ( so)),
I'll
have((  ))to
pack
my
(((things)))
and
go

Another useful test (thanks to NinjaBearMonkey) :
Hit the ( Road (Jack Don't) come ) back (no (more ) ) no more

The output should be
Hit
the
( Road (Jack Don't) come )
back
(no (more ) )
no
more

The shortest code in bytes wins.

You might want to have something like ((foo) bar) in the test case where all parentheses aren't closed at once.

@NinjaBearMonkey if(you say ( so)),

A test case including something like a( b )c( d )e would also be good.

Can the input start or end with spaces?

MATL, 22 bytes
j0G40=G41=-YsG32=*g(Yb

Try it online!
Explanation
This uses a builtin function for splitting a string at spaces. To avoid splitting at spaces between matching parentheses, these are first detected and replaced by character 0. This is not detected as a space by the string-splitting function, but is treated as a space by the implicit display function.
j        % Take input as a string.
0        % Push 0
G40=     % True for occurrences of '('
G41=     % True for occurrences of ')'
-Ys      % Subtract and cumulative sum. Positive values correspond to characters
         % between matching parentheses
G32=     % True for occurrences of space
*g       % Multiply, convert to logical. Gives true for spaces between matching
         % parentheses
(        % Assign 0 to those positions. This replaces spaces between matching
         % parentheses by character 0
Yb       % Split at spaces, treating consecutive spaces as a single space.
         % Character 0 does not cause splitting, but is displayed as a space

@Ewan Thanks for the accept! However, although you can accept another answer at any time (if a shorter answer shows up), it's common to leave the challenge unaccepted for a few days, to encourage people to answer

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.

Retina, 30 bytes
!`(\(()|(?<-2>)\)|(?(2).|\S))+

1 byte shorter...
Try it here.

JavaScript (ES6), 61 bytes
s=>s.replace(/[()]| +/g,c=>(c<`(`?n:c<`)`?++n:n--)?c:`
`,n=0)

Works by matching all parentheses and runs of spaces, maintaining a count of the nesting depth and replacing the run with a newline if the nesting depth is zero.

APL, 55 53 bytes
{⍵⊂⍨((⍵≠' ')∨~b)×+\1,¯1↓(b←0=+\1 ¯1 0['()'⍳⍵])∧⍵=' '}

To be run in ⎕ml←3. Usual trick: cumulative scans of 1s and -1s to identify the areas enclosed by parentheses. Where the cumulative sum is 0, then we are outside parentheses. Boolean and the vector with the boolean vector with 1s where there are spaces. Rotate by 1 to the right inserting a 1 on the left. Build another running sum where each change identifies a segment. We're almost done, but we still need to remove the spaces at level 0. That's what the left side of the multiplication does: it zeroes out the level 0 spaces in the running sum. The dyadic enclose ⊂⍨ splits every time the running sum changes while throwing away the zeroes.

Umm... I don't see a second usage of s in your expression, so you should be able to save two bytes by removing the s←.

Indeed! Well spotted!

I assume you brute-forced the year game, and just got lucky that Dan missed something?

My guess is that all those who scored less than 750 in the Year Game 2016 brute forced it. In fact, I know all the Italian ones did, because I know them personally. So why did we get different results? I'll leave the question without an answer. I am sure you noticed the little commute up there.

I've heard from Adám what happened there ... FINNS!

Also, I regret making so many comments on your answers. I got spammed with 13, about 10 from you. Taste of my own medicine. And to how I need to "watch my words", my method of golfing other people's code is ∪ to say the least. I look completely at little syntax things, which sometimes causes the errors in my golfing suggestions that you see. And when I see one mistake that happens more than once, I go on a golfing frenzy like that. Also, I was hopped up on that 3rd place win.

(Clarification to my "FINNS!" comment, the Finnish "winners" had code that resulted in a character vector.)

Don't sweat it... yes... it was a bit disappointing to see that the winners had found a loophole in the rules of the context. We scratched our heads about how they managed to save more characters when we thought our brute force search should have covered all the search tree, until we saw the winning entries. We tried to complain to Fiona but she said the rules did not explicitly say that the result had to be numeric, only that it had too look like a number. Ah well... we all learned a lesson: Fiona is more careful with her wording now and we know we cannot take anything for granted. :-)

Perl, 80 bytes (79 + -n flag)
$r=qr/[^\(\)]*(\((??{$r})\))?[^\(\)]*/;/((([^ \(]*(\($r\))?)+ *)(?{say$^N}))+/

Run with :
perl -M5.010 -ne '$r=qr/[^\(\)]*(\((??{$r})\))?[^\(\)]*/;/((([^ \(]*(\($r\))?)+ *)(?{say$^N}))+/'

It might not be easy to read, so here are the explanations :
# The first regex ($r) is meant to match anything between two matching parenthesis
$r = qr/ [^\(\)]*         # match anything but parenthesis
         (\(               # match an opening parenthesis
           (??{$r})        # reccursive call to the same regex
          \)               # match a closing parenthesis
         )?               # the 3 previous lines are optionnal
         [^\(\)]*         # match anything but parenthesis
       /x;

# The second regex kinda split the input according to the rules
/(
    (
     ([^ \(]*           # match anything but spaces and parenthesis
      (\($r\))?          # optionnal : match an opening parenthesis, then let the
                         #   first regex match anything until the matching closing parenthesis.
     )+                 # repeat (no spaces out of parenthesis has been found yet)
     \ *               # match the space(s) that delimite the outputed lines.
    )
    (?{say$^N})       # execute the code 'say $^N' which prints the content
                      #   of the last closed group (which is the line above)
 )+                 # repeat as many times as possible
/x

C (32-bit), 115 113 bytes
s,*P;main(q,c){char*p=P=1[P=c],*o=p;for(;c=*p++;c^=32,s+=c^9?c==8:-1,*o=s|c?c^32:10,o+=s|c||q,q=c);*o=0;puts(P);}

Compile as 32-bit C, and pass input string as command-line argument. E.g.:
~/golf/ λ gcc -m32 -w golf.c && ./a.out "Hit the ( Road (Jack Don't) come ) back (no (more ) ) no more"
Hit
the
( Road (Jack Don't) come )
back
(no (more ) )
no
more