Tiling, given vertex configuration Task

The task is to tile polygons, given a vertex configuration.

Scoring

Your score is equal to the "complexity level" your submission reaches. Complexity levels are cumulative, meaning that to reach #3 you must also support #1 & #2.

Submissions at an equal complexity level are distinguished by byte count; lowest wins.

Input

Input is a string containing a vertex configuration, representing a vertex figure. That is, a dot separated list of integers, where each integer (n) represents a regular n-gon, connected by a common vertex.

The following vertex configurations must be supported:

3.3.3.3.3.3
3.3.3.3.6
3.3.3.4.4 (note that order is reflected in the vertex figure, therefore the below does differ)
3.3.4.3.4
3.12.12
3.4.6.4
3.6.3.6
4.4.4.4
4.6.12
4.8.8
6.6.6

Output -  Complexity Level #1: Vertex Figure

At this complexity level, output is an image showing the vertex figure corresponding to the given input.

Input is prepended with an F to signify that the vertex figure should be output, and not the full tiling.

For example F3.6.3.6 gives this vertex figure:

Output - Complexity Level #2: Tiling

At this complexity level output is an image showing a uniform tiling using the vertex figure corresponding to the given input.

For example 3.6.3.6 gives this tiling:

There are no restrictions on colour or format (barring loopholes).

Output - Complexity Level #3: Dual Tiling

At this complexity level a 'dual tiling' can be formed from each tiling. This is achieved by drawing lines from the centre of each polygon to the centre of each bordering polygon.

Dual tiling is specified by prepending input with a V.

For example V3.6.3.6 gives this dual tiling (in red):

BBC BASIC
Rev 1 Golfed code, 655 ASCII characters, tokenised filesize 614
Some major improvements to the data table, by hashing the string A.B..N to a number (1*A+2*B+..n*N)+n before looking up, and by storing only one translation vector (the other one is generated by code.) More explanation when I have finished golfing.
t=PI*2DIMm(9)
c=0z=0INPUTz$
FORi=1TOLEN(z$)d%=VAL(MID$(z$,i))IFd%c+=1m(c)=d%i-=d%=12z+=c*d%
NEXTREPEATREADl,e,f
UNTILl=z+c
l=4-3*(m(3)MOD3=0)-8*(l=59)
DATA69,0,70,65,100,35,66,149,0,49,109,0,52,80,0,55,0,189,39,120,0,44,40,40,58,55,95,47,136,0,59,40,0
VDU23,23,3|
FORr=-9TO19FORs=-9TO9a=1+e*(r*2+s)-f*l*s/4b=1+f*(r*2+s)+e*l*s/4p=40q=0FORk=1TOm(c)/2FORj=1TOc
n=m(j)o=TAN(PI/3)IFe=109ANDn<>4o=1
w=-p*COS(t/n)-q*SIN(t/n)q=p*SIN(t/n)-q*COS(t/n)p=w
u=p:v=q
x=a:y=b
MOVEx,y
FORi=1TO14x+=u*2y+=v*2IFVAL(z$)DRAWx,y ELSEGCOL9LINEx-u-v/o,y-v+u/o,x-u+v/TAN(PI/n),y-v-u/TAN(PI/n)
w=v*COS(t/n)-u*SIN(t/n)u=v*SIN(t/n)+u*COS(t/n)v=w
NEXTNEXT
p=u:q=v
a=x:b=y
NEXTNEXTNEXT

Rev 0 Golfed code, 770 ASCII characters, tokenised filesize 728
All I've done here is remove comments, unnecessary whitespace and quote marks, and put all the DATA on one line. There's certainly room for more golfing.
t=PI*2DIMm(9)
c=0INPUTz$
FORi=1TOLEN(z$)d%=VAL(MID$(z$,i))IFd%c+=1:m(c)=d%:i-=d%=12
NEXTREPEATREADl$,e,f,g,h
UNTILMID$(z$,1-(VAL(z$)=0))=l$
DATA3.3.3.3.3.3,240,0,120,70,3.3.3.3.6,200,70,40,210,3.3.3.4.4,80,0,40,150,3.3.4.3.4,-40,150,150,40,3.12.12,300,0,150,260,3.4.6.4,220,0,110,188,3.6.3.6,160,0,80,140,4.4.4.4,80,0,0,80,4.6.12,0,380,330,-190,4.8.8,272,0,136,136,6.6.6,240,0,120,70
VDU23,23,3|
FORr=-9TO19 FORs=0TO9a=1+e*r+g*s
b=1+f*r+h*s
p=40q=0FORk=1TOm(c)/2FORj=1TOc
n=m(j)o=TAN(PI/3):IFe=220ANDn<>4o=1
w=-p*COS(t/n)-q*SIN(t/n)q=p*SIN(t/n)-q*COS(t/n)p=w
u=p:v=q
x=a:y=b
MOVEx,y
FORi=1TO14x+=u*2y+=v*2IFVAL(z$)DRAWx,y ELSEGCOL9LINEx-u-v/o,y-v+u/o,x-u+v/TAN(PI/n),y-v-u/TAN(PI/n)
w=v*COS(t/n)-u*SIN(t/n)u=v*SIN(t/n)+u*COS(t/n)v=w
NEXTNEXT
p=u:q=v
a=x:b=y
NEXTNEXTNEXT

Explanation
This is a continuation of my previous Level 1 answer, but I decided to post it separately because it's rather long.
Level 2
This is achieved by translation of my "level 1.5" templates from my previous answer. The two translation vectors for each tiling are hardcoded. I take advantage of the fact that an isosceles triangle of base 80 and height 70 is a very good approximation of an equilateral triangle, and a right triangle with hypotenuse vector (56,56) has a hypotenuse length very close to 80.
Level 3
To plot the duals, instead of plotting an edge of the polygon, we plot a spoke from the middle of that edge to the centre of the polygon. This is at right angles to the edge and has length of 1/TAN/(PI/n) times of the vector (u,v) which in turn is half as long as the edge.
Unfortunately, because certain polygons in tilings 3.3.3.3.6 and 3.4.6.4 are not plotted explicitly, they would not be plotted if we only did this. Therefore the spoke also extends outward from the polygon. The outward extension is controlled by the variable o.
By default the extension is sufficient to reach the centre of a triangle, but for 3.4.6.4 it needs to be extended more in order to draw the duals of the squares that are not plotted explicitly. So enough extension to fill in the missing squares is applied when hexagons and triangles are plotted explicitly, but the normal extension is applied when squares are plotted explicitly, to avoid spurious lines in the adjacent triangles.
Here's what they look like without the spoke extensions. The holes in the dual pattern can be clearly seen. The correct output can be seen in the main picture at the bottom of the answer

Commented Code
Differences from my previous answer are indicated inline
  t=PI*2                                          :REM constant Tau = PI*2

  DIMm(9)                                         :REM declare array for the numbers in the input
  c=0                                             :REM number of polygons in the list

  INPUTz$
  FORi=1TOLEN(z$)                                 :REM for each character in the input
    d%=VAL(MID$(z$,i))                            :REM use VAL to return the numeric value of the substring to the right and store to integer variable
    IF d% c+=1 :m(c)=d%: i-=d%=12                 :REM if the last character read was a number, d% contains it, otherwise 0. Advance c and store to m. If it is 12, increment i to skip a character.
  NEXT

  REM BLOCK OF NEW CODE to define vectors (e,f) and (g,h) for each possible tiling

  REPEAT
    READ l$,e,f,g,h                               :REM read an entire line of the data below
  UNTIL MID$(z$,1-(VAL(z$)=0))=l$                 :REM abort the loop when l$ coincides with the input. the MID$ strips off the 'V' from the input where necessary.

  DATA"3.3.3.3.3.3",240,0,120,70
  DATA"3.3.3.3.6",200,70,40,210
  DATA"3.3.3.4.4",80,0,40,150
  DATA"3.3.4.3.4",-40,150,150,40
  DATA"3.12.12",300,0,150,260
  DATA"3.4.6.4",220,0,110,188
  DATA"3.6.3.6",160,0,80,140
  DATA"4.4.4.4",80,0,0,80
  DATA"4.6.12",0,380,330,-190
  DATA"4.8.8",272,0,136,136
  DATA"6.6.6",240,0,120,70

  VDU23,23,3|                                           :REM change linewidth to 3 (default is 1)

  REM END BLOCK OF NEW CODE

  FORr=-9TO19 FORs=0TO9                                 :REM two new loops for translations

      a=1+e*r+g*s                                       :REM modified code for
      b=1+f*r+h*s                                       :REM coordinates to start drawing at

      p=40:q=0                                          :REM vector of first line

      FORk=1TOm(c)/2                                    :REM draw half as many vertex figures as there are sides on the last polygon in the list

        FORj=1TOc                                       :REM for each polygon on the list
          n=m(j)                                        :REM n=number of sides
          o=TAN(PI/3): IF e=220 AND n<>4 o=1            :REM new code for the spoke extension 1/o.

          w=-p*COS(t/n)-q*SIN(t/n)                      :REM rotate the starting vector anticlockwise by the internal angle of the current polygon
          q=p*SIN(t/n)-q*COS(t/n)                       :REM to avoid overlapping the previous one, if any.
          p=w

          u=p:v=q                                       :REM make a local copy of the vector and coordinates
          x=a:y=b                                       :REM to avoid corruption of p,q,a,b during the drawing of the polygon
          MOVE x,y                                      :REM move the graphics cursor to the start without drawing
          FORi=1TO14                                    :REM do 14 iterations regardless of the number of sides on the polygon
            x+=u*2                                      :REM increment x and y by the vector representing the side
            y+=v*2                                      :REM the value is double (u,v) to facilitate drawing duals later

            REM if z$ begins with a numeric character, draw an edge. If not, change to red and draw a spoke.
            IFVAL(z$) DRAW x,y ELSE GCOL9: LINEx-u-v/o,y-v+u/o,x-u+v/TAN(PI/n),y-v-u/TAN(PI/n)

            w=v*COS(t/n)-u*SIN(t/n)                     :REM rotate the vector clockwise
            u=v*SIN(t/n)+u*COS(t/n)                     :REM through the external angle of the polygon
            v=w
          NEXT                                          :REM draw next edge of the current polygon
        NEXT                                            :REM draw next polygon of the current vertex

        p=u:q=v                                         :REM once the vertex is finished, we will be two sides around the perimeter of the last polygon.
        a=x:b=y                                         :REM copy the position and direction data into p,q,a,b.
      NEXT                                              :REM draw next vertex figure

    NEXT                                                :REM close the two new translation loops
  NEXT

Output
The program performs only one tiling or dual for each run. However it plots the duals in red. To save space, I ran the program twice without clearing the screen in order to superimpose the dual on top of the regular tiling.


How many peaks in my mountain range? A list of positive integers can be visualized as a quantized mountain range where each list entry represents the height of one vertical section of the mountains.
For example, the list
1, 2, 2, 3, 4, 3, 5, 3, 2, 1, 2, 3, 3, 3, 2, 2, 1, 3

can become the range
      x
    x x
   xxxxx   xxx   x
 xxxxxxxx xxxxxx x
xxxxxxxxxxxxxxxxxx

(Less poetic people might call this a bar chart, but I digress.)
The question in this challenge is: How many peaks are in the mountain range of some arbitrary list? Essentially, how many local maxima are in the list?
A peak is defined as a contiguous section of one or more columns of the mountain range that are all equal in height, where the columns immediately to the left and the right are lower in height.
It's easy to visually tell that the example has four peaks at these parenthesized locations:
1, 2, 2, 3, (4), 3, (5), 3, 2, 1, 2, (3, 3, 3), 2, 2, 1, (3)

Note how the (3, 3, 3) plateau section counts as a peak because it is a contiguous set of columns equal in height, higher than its neighboring columns.
The last (3) counts as a peak as well because, for the purposes of this challenge, we'll define the left neighbor of the leftmost column and the right neighbor of the rightmost column to both be height zero.
This means that a list with only one value, for example 1, 1, 1, can be interpreted as 0, 1, 1, 1, 0, and thus has one peak, not none: 0, (1, 1, 1), 0.
The only list with zero peaks is the empty list.
Challenge
Write a function or program that takes in an arbitrary list of positive integers and prints or returns the number of peaks in the corresponding mountain range.
The shortest code in bytes wins. Tiebreaker is earlier post.
Test Cases
Input List -> Output Peak Count

[empty list] -> 0
1, 1, 1 -> 1
1, 2, 2, 3, 4, 3, 5, 3, 2, 1, 2, 3, 3, 3, 2, 2, 1, 3 -> 4
1 -> 1
1, 1 -> 1
2, 2, 2, 2, 2 -> 1
90 -> 1
2, 1, 2 -> 2
5, 2, 5, 2, 5 -> 3
2, 5, 2, 5, 2, 5, 2 -> 3
1, 2, 3, 4 -> 1
1, 2, 3, 4, 1, 2 -> 2
1, 3, 5, 3, 1 -> 1
7, 4, 2, 1, 2, 3, 7 -> 2
7, 4, 2, 1, 2, 1, 2, 3, 7 -> 3
1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 -> 10
1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1 -> 10
2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 -> 10
1, 3, 3, 3, 1, 3, 3, 1, 3, 1, 3, 3, 3, 3, 1 -> 4
12, 1, 2, 1, 2, 3, 3, 3, 2, 4, 4, 4, 1, 5, 5, 4, 7, 9 -> 6
87, 356, 37673, 3676, 386, 909, 909, 909, 909, 454, 909, 909 -> 3
87, 356, 37673, 3676, 386, 909, 909, 909, 909, 454, 909, 908, 909 -> 4

CJam (32 26 24 21 bytes)

0q~0]e`1f=2ew::>2,/,(

Expected input is space-separated numbers.

Online demo ; full test suite (expected output is a 1 per test case).

Thanks to Martin for informing me that the current version of CJam improves one of the operators used, saving 2 chars; and for a further 3-char saving.

Dissection

Two phases: deduplicate, then identify local maxima in each set of three.

0q~0]      e# Put the input in an array wrapped in [0 ... 0]
e`1f=      e# Use run-length encoding to deduplicate
2ew::>     e# Map [a b c ...] to [(a>b) (b>c) ...]
2,/        e# Split on [0 1], which since we've deduplicated occurs when (a<b) (b>c)
,(         e# Count the parts and decrement to give the number of [0 1]s


Random literal number I took inspiration from a challenge I did some years ago in a programming competition.

Your goal is to write a function that generates a random integer number between 0 and 150 (included), and then prints it in actual words. For example, 139 would be printed as onehundredthirtynine.

Rules:

You cannot use any external resource, nor any library that will perform the conversion.
The shortest answer will win.

Good luck!

Lua

print"four"

Highly optimized and golfed xkcd's random number generator

An actual solution, 380

x=math.random(0,150)m=math.floor print(x==0 and"zero"or((x>99 and"onehundred"or"")..(({"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"})[x%100-9]or({[0]="",nil,"twenty","thirty","fourty","fifty","sixty","seventy","eighty","ninety"})[m(x/10)%10]..({[0]="","one","two","three","four","five","six","seven","eight","nine"})[x%10])))


Create all arrays of non-negative integers of length N with sum of parts equal to T Create all arrays of non-negative integers of length N where the array sum is equal to T. The output order of arrays does not matter.
Possible solutions are e.g.
N = 5, T = 2:
1 1 0 0 0
1 0 1 0 0
1 0 0 1 0
1 0 0 0 1
0 1 1 0 0
0 1 0 1 0
0 1 0 0 1
0 0 1 1 0
0 0 1 0 1
0 0 0 1 1
2 0 0 0 0
0 2 0 0 0
0 0 2 0 0
0 0 0 2 0
0 0 0 0 2

N = 4, T = 5
0 4 1 0
1 1 2 1
2 0 3 0
0 3 1 1
...

Erroneous outputs would be:
N = 3, T = 1
1 1 1
3 0 0

N = 4, T = 2
0 1 1
0 2 0 0 0 0

Edit: I sadly do not understand most of these very short code golf languages (but admire the creativity of them). To understand what you mean, main stream languages or explanations are encouraged. (How about Java, C# or C++?)

JavaScript (V8),  71 69  67 bytes
Saved 1 byte thanks to @l4m2
Expects (n, t) and prints all possible arrays.

f=(n,t,a=[],v=0)=>n?f(n-1,t,[...a,v])|t&&f(n,t-1,a,v+1):t||print(a)

Try it online!
Commented
f = (             // f is a recursive function taking:
  n,              //   n   = expected number of entries
  t,              //   t   = expected sum
  a = [],         //   a[] = current output array
  v = 0           //   v   = current value to be added to a[]
) =>              //
  n ?             // if there's at least one more entry to add:
    f(            //   do a first recursive call:
      n - 1,      //     decrement n
      t,          //     pass t unchanged
      [...a, v]   //     append v to a[]
    ) | t         //   end of recursive call; yield t
    &&            //   if the above is truthy ...
    f(            //   ... do a 2nd recursive call:
      n,          //     pass n unchanged
      t - 1,      //     decrement t
      a,          //     pass a[] unchanged
      v + 1       //     increment v
    )             //   end of recursive call
  :               // else:
    t || print(a) //   print a[] if t = 0


bandit24 brute forcing program I was doing the bandit wargame from overthewire.org and because I am a script kiddie, I googled the answer for level 24.
password="UoMYTrfrBFHyQXmg6gzctqAwOmw1IohZ"
for i in {0000..9999}
//looping to try any possible pin code
do
echo $password' '$i >> wordlist.txt
//save password and possible pin code into wordlist
done

I saw the bash script, and thought, "Well I couldn't have done that because I'm not good at bash." but then I realized that this problem could be done in other languages.
The challenge is simple.

Pipe the password in from stdin.
Append a space in-between the password and the pin or output it separately
Output all PIN combinations. Make sure that there are 4 digits outputted.
BONUS flush the output after each line. This is done automatically with std::endl.

I went ahead and did it in C++
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
        string key; //1
        getline(cin, key); //I heard that std::getline is
        //only standard for linux, so for practical
        //purposes use cin.getline(char*,size)
        for(int i = 0; i < 10000; i++){   //3
                cout << key << setfill('0') << ' ' //2
                << setw(4) << i << endl;  //4
        }
        return 0;
}

Obviously it can do better than 301 bytes, but you get the gist.
Also any language is acceptable as long as it can produce the same formatted strings separated by new lines or line breaks.

05AB1E, 9 7 bytes
žh4ã€‚»

Try it online.
Explanation:

žh       # Push builtin string "0123456789"
  4ã     # Get the cartesian product of 4: ["0000","0001",...,"9998","9999"]
    €    # Map each string to:
     ‚   #  Pair it with the (implicit) input-string
      »  # Join each inner list by spaces, and then all strings by newlines
         # (after which the result is output implicitly)


Rock, Paper, Scissors, Lizard, Spock Tournament Giving a challenge involving a Star Trek reference just after May the 4th may be frowned upon, but here goes.

You, Luke, Anakin, Palpatine, Yoda and Han Solo are involved in an insane tournament of Rock, Paper, Scissor, Lizard, Spock.

The catch here is that you are only allowed to use a fixed order of moves. If your order is "R", Then you have to use Rock, until you lose or win against everyone. If your order is RRV, then you have to use 2 Rocks followed by a Spock and keep repeating until you have won or lost.

Luke, Anakin, Palpatine, Yoda and Han Solo have submitted their respective orderings and you being an expert hacker got your hands on each of their orderings!

With this knowledge, you are to design your ordering for the tournament. Since everyone wants to win, you want to create an ordering such that you win the tournament by beating everyone.
But this may not be possible under all circumstances.

Incase there is a possible winning order, print that out. If there is no possible way for you to win, print out -1 (or 0 or False or "impossible")

Input: a list of 5 orders

Output: a single order or -1

Sample Input 1

R
P
S
L
V

Sample Output 1

-1

Explanation 1

  No matter what you play in your first move, there will be at least one
  person who beats you, hence it is not possible for you to win.

Sample Input 2

RPS
RPP
R
SRR
L

Sample Output 2

RPSP

Explanation 2

  Once you play Rock in your first move, you end up beating "L" and "SRR" and
  tie against the rest. This is because Lizard and Scissors lose to Rock.
  When you play Paper next, you will beat "R" and tie against the remaining
  2. This is because Rock loses to Paper.
  When you play Scissors next, you will win against "RPP" as Scissor beats
  Paper.

  Finally, you will beat "RPS" with your Paper as Paper beats Rock.

Here are a list of notations (you may use any 5 literals, but please specify in your answer):

R : Rock
P : Paper
S : Scissor
L : Lizard
V : Spock

Here is a list of all possible outcomes:

winner('S', 'P') -> 'S'
winner('S', 'R') -> 'R'
winner('S', 'V') -> 'V'
winner('S', 'L') -> 'S'
winner('S', 'S') -> Tie
winner('P', 'R') -> 'P'
winner('P', 'V') -> 'P'
winner('P', 'L') -> 'L'
winner('P', 'S') -> 'S'
winner('P', 'P') -> Tie
winner('R', 'V') -> 'V'
winner('R', 'L') -> 'R'
winner('R', 'S') -> 'R'
winner('R', 'P') -> 'P'
winner('R', 'R') -> Tie
winner('L', 'R') -> 'R'
winner('L', 'V') -> 'L'
winner('L', 'S') -> 'S'
winner('L', 'P') -> 'L'
winner('L', 'L') -> Tie
winner('V', 'R') -> 'V'
winner('V', 'L') -> 'L'
winner('V', 'S') -> 'V'
winner('V', 'P') -> 'P'
winner('V', 'V') -> Tie

This is code-golf, so fewest bytes win.

P.S: Let me know if you need more test cases.

JavaScript (ES6),  122 115  112 bytes
Takes input as an array of strings of digits, with:

\$0\$ = Scissors (S)
\$1\$ = Paper (P)
\$2\$ = Rock (R)
\$3\$ = Lizard (L)
\$4\$ = Spock (V)

Returns either a string in the same format or \$false\$ if there's no solution.
f=(a,m='',x=0,o,b=a.filter(a=>(y=a[m.length%a.length])-x?o|=y-x&1^x<y:1))=>b+b?x<4&&f(a,m,x+1)||!o&&f(b,m+x):m+x

Try it online!
How?
This is a breadth-first search: we first try all moves at a given step to see if we can win the game. If we can't win right now, we try to add another move to each non-losing move.
The move identifiers were chosen in such a way that a move \$A\$ wins against a move \$B\$ if and only if \$(B-A)\bmod 5\$ is odd.
With \$A\$ on the left and \$B\$ on the top:
$$
\begin{array}{cc|ccccc}
& & \text{(S)} & \text{(P)} & \text{(R)} & \text{(L)} & \text{(V)}\\
& & 0 & 1 & 2 & 3 & 4\\
\hline
\text{(S) }&0 & - & \color{green}1 & \color{red}2 & \color{green}3 & \color{red}4\\
\text{(P) }&1 & \color{red}4 & - & \color{green}1 & \color{red}2 & \color{green}3\\
\text{(R) }&2 & \color{green}3 & \color{red}4 & - & \color{green}1 & \color{red}2\\
\text{(L) }&3 & \color{red}2 & \color{green}3 & \color{red}4 & - & \color{green}1\\
\text{(V) }&4 & \color{green}1 & \color{red}2 & \color{green}3 & \color{red}4 & -
\end{array}
$$
From there, we can deduce another way of testing if \$A\$ wins against \$B\$ for \$A\neq B\$:
((A - B) and 1) xor (B < A)

where and and xor are bitwise operators.
Commented
f = (                        // f is a recursive function taking:
  a,                         //   a[] = input
  m = '',                    //   m   = string representing the list of moves
  x = 0,                     //   x   = next move to try (0 to 4)
  o,                         //   o   = flag set if we lose, initially undefined
  b =                        //   b[] = array of remaining opponents after the move x
    a.filter(s =>            //     for each entry s in a[]:
    ( y =                    //       define y as ...
      s[m.length % s.length] //         ... the next move of the current opponent
    ) - x                    //       subtract x from y
    ?                        //       if the difference is not equal to 0:
      o |=                   //         update o using the formula described above:
        y - x & 1 ^ x < y    //           set it to 1 if we lose; opponents are removed
                             //           while o = 0, and kept as soon as o = 1
    :                        //       else (this is a draw):
      1                      //         keep this opponent, but leave o unchanged
  )                          //     end of filter()
) =>                         //
  b + b ?                    // if b[] is not empty:
    x < 4 &&                 //   if x is less than 4:
      f(a, m, x + 1)         //     do a recursive call with x + 1 (going breadth-first)
    ||                       //   if this fails:
      !o &&                  //     if o is not set:
        f(b, m + x)          //       keep this move and do a recursive call with b[]
  :                          // else (success):
    m + x                    //   return m + x


Perform gravity sort Challenge
Given a list of integers, show how gravity sort would be done.
Gravity Sort
In gravity sort, imagine the numbers as rows of asterisks. Then, everything falls, and the new rows will be obviously sorted. Let's look at an example:
[2, 7, 4, 6]:
**
*******
****
******
-------
**
****
*******
******
-------
**      | 2
****    | 4
******  | 6
******* | 7

Notice that this is pretty much just parallelized bubble sort.
Exact Specs
On each iteration, starting from the top row, take every asterisk from the row that doesn't have an asterisk below it, and move it down a row. Keep doing that until the list is sorted.
Input
Input will be a list of strictly positive integers.
Output
For the output, you must output each step. You can choose any two non-whitespace printable ASCII characters, one to be the "asterisks", and one to be the separating "dashes". The rows of asterisks must be separated with a standard newline of some sort (e.g. \n or \r\f). The row of dashes must be at least the width of the widest row (otherwise your asterisks are going to fall too far down!). A row of dashes at the very bottom is optional. A trailing newline at the end is permitted. Trailing spaces on each line are permitted.
Test Cases
input will be represented as a list, then output will be listed immediately below. Test cases are separated by a double-newline.
[4, 3, 2, 1]
****
***
**
*
----
***
** *
* *
**
----
**
* *
** *
***
----
*
**
***
****

[6, 4, 2, 5, 3, 1]
******
****
**
*****
***
*
------
****
**  **
****
***
*  **
***
------
**
****
*** **
*  *
***
*****
------
**
***
*  *
*** **
****
*****
------
**
*
***
****
******
*****
------
*
**
***
****
*****
******

[8, 4, 2, 1]
********
****
**
*
--------
****
**  ****
* **
**
--------
**
* **
**  ****
****
--------
*
**
****
********

[2, 7, 4, 6]
**
*******
****
******
-------
**
****
*******
******
-------
**
****
******
*******

Please feel free to correct my test cases if they're wrong, I made them by hand :)
Note: Do not output the sorted list at the end. :)
Scoring
All of your programs will be written on top of each other. You wouldn't want pieces of your program to fall down, so make sure you have the shortest code!

Pyth, 27 bytes

jsCM.u:R"v "" v"N+R\-.t*L\v

Try it online!


Print my clock's alarm sound Write the shortest program that prints the sound my alarm clock makes, and stops after an inputted number of beeps.
For reference, here is the sound my alarm makes:
beep beep beep beep beep beepbeep beepbeep beepbeep beepbeep beepbeep beepbeepbeep beepbeepbeep beepbeepbeep beepbeepbeep beepbeepbeep beepbeepbeepbeep beepbeepbeepbeep beepbeepbeepbeep beepbeepbeepbeep beepbeepbeepbeep beepbeepbeepbeepbeepbeepbeepbeepbeepbeepbeepbeepbeepbeepbeepbeepbeepbeepbeepbeepbeepbeepbeepbeepbeep

Basically beep, beepbeep, beepbeepbeep, and beepbeepbeepbeep repeated 5 times each with spaces in between, followed by a beepbeep...beep which is 25 beeps long with no spaces in between (does beep still sound like a word to you?).
Your program should take a number as input (assume it's between 0 and 75), and stop printing after that many beeps.
Note: Your program should stop after that many beeps, not after that many groups of beeps. For example, 7 will return beep beep beep beep beep beepbeep.
Whitespace in between beeps must follow the exact pattern above, although any trailing whitespace or unsuppressable output from your compiler or interpreter is allowed.
Test cases:
3   beep beep beep
0
1   beep
7   beep beep beep beep beep beepbeep
8   beep beep beep beep beep beepbeep beep
55  beep beep beep beep beep beepbeep beepbeep beepbeep beepbeep beepbeep beepbeepbeep beepbeepbeep beepbeepbeep beepbeepbeep beepbeepbeep beepbeepbeepbeep beepbeepbeepbeep beepbeepbeepbeep beepbeepbeepbeep beepbeepbeepbeep beepbeepbeepbeepbeep
67  beep beep beep beep beep beepbeep beepbeep beepbeep beepbeep beepbeep beepbeepbeep beepbeepbeep beepbeepbeep beepbeepbeep beepbeepbeep beepbeepbeepbeep beepbeepbeepbeep beepbeepbeepbeep beepbeepbeepbeep beepbeepbeepbeep beepbeepbeepbeepbeepbeepbeepbeepbeepbeepbeepbeepbeepbeepbeepbeepbeep

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

JavaScript (ES7),  55  54 bytes

f=n=>n?f(n-1)+'beep'+[" "[n>50|n%~~(n**=.4)^52%~n]]:''

Try it online!
How?
Given \$1\le n< 50\$, we want to know the number of consecutive beeps that are expected in this part of the sequence. The exact value is given by:
$$\left\lfloor\sqrt{\frac{2n}{5}}+\frac{1}{2}\right\rfloor$$
which is a slightly modified version of A002024.
But in practice, we only need an exact value on the boundaries of the runs of beeps and we can deal with a few off-by-one errors. That's why we instead compute the following approximation:
$$k=\left\lfloor n^{2/5}\right\rfloor$$
We need to insert a space whenever one of the following conditions is satisfied:

\$k=1\$ and \$n\bmod 1=0\$ (the 2nd part being always true)
\$k=2\$ and \$n\bmod 2=1\$
\$k=3\$ and \$n\bmod 3=0\$
\$k=4\$ and \$n\bmod 4=2\$

All the above conditions can be merged into:
$$(n \bmod k) = (52 \bmod (k+1))$$
\$52\$ being the smallest integer \$x>0\$ such that \$x\bmod 3=1\$, \$x\bmod 4=0\$ and \$x\bmod 5=2\$.
We need an additional test for \$n\ge50\$, where all remaining beeps are concatenated together. Otherwise, unwanted spaces would be inserted, starting at \$n=54\$.
Hence the final JS expression:
n > 50 | n % ~~(n **= 0.4) ^ 52 % ~n

which evaluates to 0 when a space must be inserted.

JavaScript (ES7), 55 bytes
A simpler approach using a lookup bit mask.

f=n=>n?f(--n)+'beep'+(0x222222492555F/2**n&1?' ':''):''

Try it online!


Checking a Windows 95 OEM Key for validity Introduction
Windows 95 used a very simple algorithm for verifying license keys. The scheme of an OEM license key always looked like this:
xxxyy-OEM-NNNNNNN-zzzzz

The day can be anything within 001-366, and the year cannot be lower than 95 or above 03.
xxx represents the day of the year the key was printed on (for example 192 = 10th of July) and is a number between 001-366.
yy represents the year the key was printed on and cannot be lower than 95 or above 03.
This means for example, a key with 19296 as the first segment was printed on 10th of July 1996.
The second segment is always OEM.
The third segment (NN..) is always starts with 00 and the sum of the digits has to be divisible by 7
The fourth segment is irrelevant, provided the field is the appropriate length, but has to be filled out with digits.
Challange
Given a string, output a truthy or falsy value whether this oem key is valid or not.
Rules

You may provide a function or a program
This is code-golf, so the submission with the least amount of bytes wins!

Test cases
Valid keys
12899-OEM-0042134-31009
15795-OEM-0001355-07757
35201-OEM-0009165-64718

Invalid keys
12804-OEM-0033143-31009
16595-OEM-0001695-9
12899-OEM-0022134-31009
27497-OEM-0525347-80387

perl -pl -MList::Util=sum, 106 113 bytes

$_=/^(?!000)(([012]\d\d|3([0-5]\d|6[0-5]))(9[5-9]|0[0-3])|366(00|96))-OEM-00(\d{5})-\d{5}$/&&!(sum(split//,$6)%7)

Try it online!

This assumes an ASCII only input. If the input can be outside of ASCII, we'd have to add a single extra byte (a trailing a modifier on the main regexp). It also assumes a leading 366 can only occur in the years 96 and 00, them being leap years. The bulk of the matching is done by a regexp; testing of divisibility by 7 is done outside of it.

Reads keys from STDIN; writes 1 to STDOUT for valid keys, empty lines for invalid keys.

Edit: fixed the issue mentioned by @Dingus.


Implement a URL shortener URLs are getting too long. So, you must implement an algorithm to shorten a URL.

i. The Structure of a URL

A URL has 2 main parts: a domain and a path. A domain is the part of the URL before the first slash. You may assume that the URL does not include a protocol. The path is everything else.

ii. The Domain

The domain of a URL will be something like: xkcd.com meta.codegolf.stackexcchhannnge.cooom.  Each part is period-seperated, e.g. in blag.xkcd.com, the parts are "blag", "xkcd", and "com". This is what you will do with it:

If it contains more than two parts, put the last two aside and concatenate the first letter of the rest of the parts.
Then, concatenate that to the first letter to the second-to-last part.
Add a period and the second and third letter of the second-to-last part.
Discard the last part.

iii. The Path

The path will be like: /questions/2140/ /1407/. As before, "parts" are seperated by slashes.  For each part in the path, do:

Add a slash
If it is completely made of base-ten digits, interpret it as a number and convert to a base-36 integer.
Otherwise, add the first letter of the part.

At the end, add a slash.

iv. Misc.

This is code-golf, so shortest code wins.
The path can be empty, but the URL will always end with a slash.
There will not be a protocol (e.g. http://, file:///)
There will never be less than two parts in the domain.
Standard loopholes apply.

Examples

In: xkcd.com/72/
Out: x.kc/20/

In: math.stackexchange.com/a/2231/
Out: ms.ta/a/1pz/

In: hello.org/somecoolcodeintrepreteriijjkk?code=3g3fzsdg32,g2/
Out: h.el/s/

JavaScript (ES6), 149 bytes

u=>u.split`/`.map((p,i)=>i?/^\d+$/.test(p)?(+p).toString(36):p[0]:(d=p.split`.`).slice(0,-1).map((s,j)=>s[l=j,0]).join``+"."+d[l].slice(1,3)).join`/`

Explanation

I made this independent of @Neil's solution but it ended up looking very similar.

u=>
  u.split`/`.map((p,i)=>       // for each part p at index i
    i?                         // if this is not the first part
      /^\d+$/.test(p)?         // if p is only digits
        (+p).toString(36)      // return p as a base-36 number
      :p[0]                    // else return the first letter
    :
      (d=p.split`.`)           // d = domain parts
      .slice(0,-1).map((s,j)=> // for each domain part before the last
        s[l=j,0]               // return the first letter, l = index of last domain part
      ).join``
      +"."+d[l].slice(1,3)     // add the 2 letters as the final domain
  )
  .join`/`                     // output each new part separated by a slash

Test

var solution = u=>u.split`/`.map((p,i)=>i?/^\d+$/.test(p)?(+p).toString(36):p[0]:(d=p.split`.`).slice(0,-1).map((s,j)=>s[l=j,0]).join``+"."+d[l].slice(1,3)).join`/`
<input type="text" id="input" value="math.stackexchange.com/a/2231/" />
<button onclick="result.textContent=solution(input.value)">Go</button>


Find the next "interesting" time I happened to glance at my watch today at exactly 11:11:11 (and today is 1/11; too bad it's not 2011), and that got me thinking: I know! I should make a code golf question out of this! I'm a dork.

Anyway, your challenge is to take an hour, minute, and second as input, and output the next "interesting" time. Here, I will define interesting as these steps:

Concatenate the hour, minute, and second. (For example, at 4:14:14, this would be 41414.)
Check for consecutive groups of one, two, or three that span the length of the entire string. For example, I could find [41][41][4] in the example time (if the group cannot reach through the string, just cut it off like I did in this example). Another example: in the time in my first example at the beginning of the question, it would be [1][1][1][1][1][1], [11][11][11], or [111][111].
Is there a consecutive group that goes all the way through the string? If so, the time is "interesting!" Otherwise, it's not.

The input can be in any reasonable format, but it must not be hardcoded. The output can also be in any reasonable format, and it need not be in the same format as the input.

If you use network access for some reason, all bytes downloaded from the network count to your score.

This is code-golf; shortest code in bytes wins.


Convert binary search tree into ordered linked list Write the shortest possible program that turns a binary search tree into an ordered doubly-linked list, by modifying the pointers to the left and the right children of each node.

Arguments: a pointer to the root of the binary tree.

Return value: a pointer to the head of the linked list.

The binary tree node has three fields:

the ordering key, an integer
a pointer to the left child
a pointer to the right child

The pointers should be modified so that "left child" points to the previous node of the list and "right child" points to the next node of the list.

Y̶o̶u̶'̶r̶e̶ ̶n̶o̶t̶ ̶a̶l̶l̶o̶w̶e̶d̶ ̶t̶o̶ ̶c̶r̶e̶a̶t̶e̶/̶a̶l̶l̶o̶c̶a̶t̶e̶ ̶m̶o̶r̶e̶ ̶n̶o̶d̶e̶s̶.
The tree and the list are both ordered increasingly.
You have to write the implementation of the node object.
The tree is not necessarily complete

Example:

input:
   5 &#60- root
  / \
 2   8
/ \ / \
1 4 6 9

output:
head -> 1-2-4-5-6-8-9

EDIT:
I removed the 1st rule, since people complained it was not possible to do using functional programming languages.

Python: 100

class N:l=r=v=None
def T(p,q=None):
 if not p:return q
 r=p.r=T(p.r,q)
 if r:r.l=p
 return T(p.l,p)

Ungolfed Version

class Node:
    left = right = value = None

def transform(node, next=None):
    """
    node: head node to convert
    next: next node for the tail node to connect
    return: The converted head
    """
    if not node:
        return next
    node.right = transform(node.right, next)
    if node.right:
        node.right.left = node
    return transform(node.left, node)

Instead of returning a (head, tail) pair, in my solution, a next node is passed as argument to the transform function so that it only need to return the head node. This make the code shorter and cleaner.


Obfuscated Integer Notation Edit: I will be posting a newer version of this question on meta-golf soon. Stay tooned!

Edit #2: I will no longer be updating the challenge, but will leave it open. The meta-golf version is available here: https://codegolf.stackexchange.com/questions/106509/obfuscated-number-golf

Background:

Most numbers can be written with only 6 different symbols:

e (Euler's Constant)
- (Subtraction, Not Negation)
^ (Exponentiation)
(
)
ln (Natural Logarithm)

For example, you could convert the imaginary number i using this equation:

(e-e-e^(e-e))^(e^(e-e-ln(e^(e-e)-(e-e-e^(e-e)))))

Goal:

Given any integer k through any reasonable means, output the shortest representation possible of that number using only those 6 symbols.

Examples:

0 => "e-e"
1 => "ln(e)"
2 => "ln(ee)"
// Since - cannot be used for negation, this is not a valid solution:
// ln(e)-(-ln(e))
-1 => "e-e-ln(e)"

Notes:

Ending parenthesis count towards the total amount of characters.
ln( only counts as 1 character.
Everything else counts as 1 character.
n^0=1
Order of operations apply
Parenthesis multiplying is acceptable, e.g. (2)(8)=16, 2(5)=10, and eln(e)=e.
ln e is not valid, you must do ln(e)

Python 3, 402 bytes

from itertools import*
from ast import*
from math import*
v,r=lambda x:'UnaryOp'not in dump(parse(x)),lambda s,a,b:s.replace(a,b)
def l(x,y):
    for s in product('L()e^-',repeat=x):
        f=r(r(r(''.join(s),'L','log('),')(',')*('),'^','**')
        g=r(f,'ee','e*e')
        while g!=f:f,g=g,r(g,'ee','e*e')
        try:
            if eval(g)==y and v(g):return g
        except:0
def b(v):
    i=1
    while 1:
        r=l(i,v)
        if r:return r
        i+=1

Example usage:

>>> b(1)
'log(e)'
>>> b(0)
'e-e'
>>> b(-3)
'e-log(e*e*e)-e'
>>> b(8)
'log(e*e)**log(e*e*e)'

Note that although the output format may not reflect it, the code properly counts all lengths according to the question's specifications.

This is a dumb bruteforce through all the possible lengths of strings. Then I use some replacements so that Python can evaluate it. If it's equal to what we want, I also check to exclude unary negative signs by checking the AST.

I'm not very good at golfing in Python, so here's the semi-ungolfed code if anybody wants to help!

from itertools import*
from ast import*
from math import*

def valid(ev):
    return 'UnaryOp' not in dump(parse(ev))

def to_eval(st):
    f = ''.join(st).replace('L', 'log(').replace(')(', ')*(').replace('^', '**')
    nf = f.replace('ee', 'e*e')
    while nf != f:
        f, nf = nf, nf.replace('ee', 'e*e')
    return nf

def try_length(length, val):
    for st in product('L()e^-', repeat=length):
        ev = to_eval(st)
        try:
            if eval(ev) == val and valid(ev):
                return st
        except:
            pass

def bruteforce(val):
    for i in range(11):
        res = try_length(i, val)
        if res:
            print(i, res)
            return res


It's a yearly task, alright Given a number 1≤n≤365, output the nth day of the year in "Day-numberth Month" format. For example, given 1, you should output "1st January", without "of".

The Gregorian calendar will be used and the program should not account for leap years, so your program should never output "29th February" in any circumstance. Any method can be used, as long as it follows the "Day-numberth Month" format mentioned before. Your program should also output ordinals correctly, meaning it should always output 1st, 2nd, 3rd, should 1, 2 or 3 respectively be the day numbers for any input. Leading spaces or other indentation are allowed.

This is code golf, so the shortest solution by characters wins.

Test cases:

1 gives 1st January
2 gives 2nd January
3 gives 3rd January
365 gives 31st December
60 gives 1st March
11 gives 11th January

PHP, 38 40 30 28 bytes

<?=date("jS F",86399*$argn);

Try it online!

Run with php -nF input is from STDIN. Example (above script named y.php):

$ echo 1|php -nF y.php
1st January
$ echo 2| php -nF y.php
2nd January
$ echo 3| php -nF y.php
3rd January
$ echo 11|php -nF y.php
11th January
$ echo 21|php -nF y.php
21st January
$ echo 60|php -nF y.php
1st March
$ echo 365|php -nF y.php
31st December

Explanation

Construct an epoch timestamp for the desired day in 1970 (conveniently not a leap year) by multiplying the day number * number of seconds per day (86400).  However, this would yield one day higher so instead multiply by number of seconds in a day - 1 (86399) which for the range of input numbers (1≤n≤365) will result with the timestamp of the end of each correct day. Then just use PHP's built-in date formatting for output.


Generate all possible integers Input: you are given 2 integers, n and k. n is a positive (>= 1) integer, and k an integer, which is the number of times you are allowed to use n.

Output: output all of the non-negative integers that can be formed using at most k n's using these mathematical operations: +, -, *, /, and parentheses.

Edit: if your language supports removing elements from an array/set/etc., the requirement of non-negative integers is required. If not, then it is not required.

The only numerical value that can exist in the expression is n (however many times). If the value of the expression exceeds the maximum value of whatever data storage you have (such as int or long, etc.), you have to compensate for it (there is no maximum value that can be given for n).

Speed is not important, but shortest code wins!

Bonuses:

-50: include exponentiation in the list of mathematical operations. Exponentiation is defined to be that the base is some expression of n, not e = 2.71828...
-50: include the floor (or ceiling) functions if a given possible operation is not an integer.

Examples

> 2 2
0 1 4
> 4 3
3 4 5 12 20 64 ...

(Sample inputs/outputs do not necessarily include bonuses)

Javascript (E6) 215 (315 - 2*50 bonus) 252

Edit Simplified. Correct bug of 0 missing

Defined as a function, then counting 10 more byte for output using alert()

Important Really this one is not valid according to the rules, because javascript can not handle big numbers. For instance with parameters 2,5 it can't find 2^2^2^2^2 (ie 2^65536). A number this big is 'Infinity' in javascript.

Golfed

F=(n,k,g={})=>{k+=k-1;for (l=i=1;x=i.toString(6),l+=!!x[l],l<k;i++)if(x.split(0).length*2==l+1){for(s=[n,n],p=l;o=x[--p];)
if(-o)b=s.pop(),a=s.pop(),s.push(o<2?a+b:o<3?a-b:o<4?a*b:o<5?a/b:Math.pow(a,b));else s.push(x[p]=n);
r=Math.floor(s.pop());r>=0&isFinite(r)&!isNaN(r)&!g[r]&&(g[r]=x)}return Object.keys(g)};

To be golfed. I have an idea I want to share: use a postfix notation. In postfix any type of expression is made just of values and operators - no parentheses needed.
The postfix notation can be translated to usual algebraic infix notation - but that's out of scope in this challenge.

Usage

alert(F(4,3))

Output 1,2,3,4,5,8,12,16,20,32,64,252,256,260,1024,4096,65536,4294967296,1.3407807929942597e+154

Ungolfed

F=(n, k, g={})=>{
  k += k - 1;
  // Count in base 6 - '0' means Value, '1'..'5' means operators
  // A valid expression starts with Value twice, then n operators intermixed with n-1 Values
  // x: Coded expression, l: Expression length, k Expression limit length from param
  for (l = i = 1; x = i.toString(6), l += !!x[l], l<k; i++)
    if (x.split(0).length*2 == l+1) // check balancing values/operators
    {
      for (s = [n,n], p = l; o = x[--p];) // Calc stack starts with N,N
        if (-o) // If not '0'
          b=s.pop(),a=s.pop(), // Do calc
          s.push(o<2 ? a+b : o<3 ? a-b : o<4 ? a*b : o<5 ? a/b : Math.pow(a,b))
        else // Push value
          s.push(n) //
      r = Math.floor(s.pop()); // Last result in stack
      r >= 0 & isFinite(r) & !isNaN(r) & !g[r] && (g[r]=x) // Put in hashtable avoiding duplicates
    }
  // Uncomment this to see the postfix expression list
  // for (i in g) console.log(i, [n,n,...[...g[i]].reverse().map(v=>v>0?'x+-*/^'[v]:n)])
  return Object.keys(g) // Retust list of hashtable keys
}

First version this is more complicated but maybe easier to follow

Display the postfix expression for each number

F=(n,k)=> {
  var i,l,s;
  var cmd;
  var op='n+-*/^'
  var bag = {}
  function Calc(val,pos,stack)
  {
    while (c = cmd[pos])
    {
        if (c == 0)
        {
            stack.push(n);
            cmd[pos] = n
            pos++
        }
        else
        {
            var b=stack.pop(), a=stack.pop();
            stack.push(c < 2 ? a+b : c < 3 ? a-b : c < 4 ? a*b : c < 5 ? a/b
               : Math.pow(a,b))
            cmd[pos]=op[c]
            pos++
        }
    }
    var res = Math.floor(stack.pop())
    if (res > 0 && isFinite(res) && !isNaN(res) && !bag[res])
    {
       bag[res] = cmd
    }
  }
  k=k+k-3;
  for (i=1;s=i.toString(6), !s[k]; i++)
  {
       l=s.split(0).length;
       if (l+l-1==s.length)
       {
          var cmd = (s+'00').split('').reverse()
          Calc(n, 0, [], cmd.map(c=>op[c]).join(' '))
       }
  }

  for (i in  bag)
  {
    console.log(bag[i],'=', i)
  }
}

Usage

F(4,3)

Output

[4, 4, "/"] = 1
[4, 4, "+", 4, "/"] = 2
[4, 4, 4, "/", "-"] = 3
[4, 4, "-", 4, "+"] = 4
[4, 4, "/", 4, "+"] = 5
[4, 4, "+"] = 8
[4, 4, "+", 4, "+"] = 12
[4, 4, "*"] = 16
[4, 4, "*", 4, "+"] = 20
[4, 4, "+", 4, "*"] = 32
[4, 4, "*", 4, "*"] = 64
[4, 4, "^", 4, "-"] = 252
[4, 4, "^"] = 256
[4, 4, "^", 4, "+"] = 260
[4, 4, "^", 4, "*"] = 1024
[4, 4, "+", 4, "^"] = 4096
[4, 4, "*", 4, "^"] = 65536
[4, 4, "^", 4, "^"] = 4294967296
[4, 4, 4, "^", "^"] = 1.3407807929942597e+154


Find the missing number in an undelimited string The challenge is to identify the missing number in a string of undelimited integers.

You are given a string of digits (valid input will match the regular expression ^[1-9][0-9]+$).  The string represents a sequence of integers.  For example, 1234567891011.  All numbers in the sequence are in the range from 1 and 2147483647 inclusive.

The sequence is a series of numbers where each number is one greater than its predecessor.  However, this sequence may contain one and only one missing number from the sequence.  It is possible that a given string also contains no missing numbers from the sequence.  The string will always contain at least two numbers from the sequence.

The code must output or return the missing value, or 0 (this is a 0 - not a falsy value) in the event that the no missing values were found.

The following are valid inputs and their output/return:

input                         output    actual sequence (for refrence)
123467                        5         1 2 3 4 _ 6 7
911                           10        9 __ 11
123125126                     124       123 ___ 125 126
8632456863245786324598632460  8632458   8632456 8632457 _______ 8632459 8632460
123                           0         1 2 3
8632456863245786324588632459  0         8632456 8632457 8632458 8632459

While all of this is described as a 'string' as input, if the language is capable of handling arbitrarily large numbers (dc and mathematica, I'm looking at you two) the input may be an arbitrarily large number instead of a string if that makes the code easier.

For reference, this was inspired by the Programmers.SE question: Find missing number in sequence in string

Haskell, 115 112 bytes

g b|a<-[b!!0..last b]=last$0:[c|c<-a,b==filter(/=c)a]
maximum.map(g.map read.words.concat).mapM(\c->[[c],c:" "])

The first line is a helper function definition, the second is the main anonymous function.
Verify test cases (I had to run shorter tests because of time restrictions).

Explanation

This is a brute force solution: split the string into words in all possible ways, parse the words to integers, see whether it's a range with one element missing (returning that element, and 0 otherwise), and take the maximum over all splittings.
The range-with-missing-element check is done in the helper function g, which takes a list b and returns the sole element in the range [head of b..last of b] that's not in b, or 0 if one doesn't exist.

g b|                         -- Define g b
    a<-[b!!0..last b]=       -- (with a as the range [head of b..last of b]) as:
    last$0:[...]             --  the last element of this list, or 0 if it's empty:
            c|c<-a,          --   those elements c of a for which
            b==filter(/=c)a  --   removing c from a results in b.
mapM(\c->[[c],c:" "])        -- Main function: Replace each char c in input with "c" or "c "
map(...)                     -- For each resulting list of strings:
  g.map read.words.concat    --  concatenate, split at spaces, parse to list of ints, apply g
maximum                      -- Maximum of results (the missing element, if exists)


Create a seven-color rainbow with animation Goal

Use any graphics library or environment that can use colours and animation to create a rainbow.

Rules

The rings should emerge one by one in some kind of animation or succession
The rainbow must have at least 7 colours.

Winning Criteria

Fewest bytes wins.

HTML + CSS + JavaScript (447 440 439 432 428 434 390 388 383 bytes)

(Byte size went up at one point in order to fulfill “appear one by one” requirement)

(Some credit to Fez Vrasta’s answer for reminding me of the existence of document.write)

<script>for(d=document,i=0;k=i>>1,k<7;setTimeout(function(w){d.getElementById(w).id="x"+w},555*k,i++))d.write("<b id="+i+"><style>b{width:0;height:0;transition:width 2s,height 2s;border-radius:50ex 50ex 0 0;position:fixed;bottom:-4ex}#x"+i+"{left:"+(9+4*k)+"ex;width:"+(80-6*k)+"ex;height:"+(40-3*k)+"ex;box-shadow:"+(i%2&&"inset 0")+" 0 6ex hsl("+50*k+",99%,50%)}</style>")</script>

Screenshot (see JSFiddle for the full animation)

Explanation

The rainbow is created by having 7 pairs of <b> elements, which are all positioned using position:absolute and a width, height, left and bottom. Within each pair, they have the same position and size, but one has an “outer” (standard) box-shadow, the other an inset one, thus creating the nice fuzzy bands. The colors are calculated using hsl(), allowing us to vary only the hue but having the same saturation (99%) and lightness (50%) for all. The <b> tags are nested inside each other, but this doesn’t matter because all of their positioning is relative to the page.

In the beginning, they all have IDs 0, 1, etc., and a styling rule that applies to all b elements sets their width and height to 0, making them invisible. The code also outputs styling rules for elements with ID x0, x1, etc., which initially do not apply.

A setTimeout is then used to successively change their IDs from 0 to x0, from 1 to x1 and so on. This triggers a CSS transition which causes them to appear one by one.

<script>
    for (d = document, i = 0;      // i loops from 0 to 14
         k = i >> 1, k < 7;        // k loops from 0 to 7
         setTimeout(
             function(w) {
                 // Code to change the element IDs, triggering the CSS transition
                 d.getElementById(w).id = "x" + w
             },
             555 * k,     // 555 milliseconds delay between the appearance of each band
             i++          // This argument is passed into the timeout function
         )
    )
        // For-loop body; creates a <b> element and a <style> element
        d.write(
            // The <b> element (with its initial ID)
            "<b id=" + i + ">" +
            "<style>" +
                // CSS rules that apply to all elements (esp. transition!)
                "b{width:0;height:0;transition:width 2s,height 2s;" +
                "border-radius:50ex 50ex 0 0;position:fixed;bottom:-4ex}" +
                // CSS rules for this specific element
                "#x" + i + "{" +
                    "left:" + (9+4*k) + "ex;" +
                    "width:" + (80-6*k) + "ex;" +
                    "height:" + (40-3*k) + "ex;" +
                    // “i%2” is either 0 or 1; therefore,
                    // “i%2 && "inset 0"” is either 0 or "inset 0"
                    "box-shadow:" + (i%2 && "inset 0") + " 0 6ex " +
                        // 99% is shorter than 100% ;-)
                        "hsl(" + 50*k + ",99%,50%)" +
                "}" +
            "</style>"
        )
</script>


Find the maximum determinant for each size Toeplitz matrix For a fixed n, consider the n by n Toeplitz matrices with entries which are either 0 or 1.  The aim is to find maximum determinant over all such Toeplitz matrices.

Task

For each n from 1 upwards, output the maximum determinant over all n by n Toeplitz matrices with entries which are either 0 or 1. There should be one output per n which should have the maximum determinant and also an example matrix that reaches it.

Score

Your score is the largest n your code gets to in 2 minutes on my computer.  To clarify a little, your code can run for 2 minutes in total, this is not 2 minutes per n.

Tie breaker

If two entries get the same n score then the winning entry will be the one that gets to the highest n in the shortest time on my machine. If the two best entries are equal on this criterion too then the winner will be the answer submitted first.

Languages and libraries

You can use any freely available language and libraries you like. I must be able to run your code so please include a full explanation for how to run/compile your code in linux if at all possible.

My Machine The timings will be run on my machine. This is a standard ubuntu install on an AMD FX-8350 Eight-Core Processor.  This also means I need to be able to run your code.

Small answers

For n = 1..10 the outputs should be 1,1,2,3,5,9,32,56,125,315

This sequence is not in OEIS and so the winning entry also gets to propose a new entry there.

Entries so far

n=10 n=11 by Vioz in Python
n=9 by Tyilo in C
n=12 by Legendre in J
n=10 by Tensibai in R
n=14 by SteelRaven in C++
n=14 by RetoKoradi in C++

J

Update: Improved code to search over half the values. Now calculates n=12 comfortably within 120 seconds (down from 217s to 60s).

You will need the latest version of J installed.

#!/usr/bin/jconsole

dim =: -:@>:@#
take =: i.@dim
rotstack =: |."0 1~ take
toep =: (dim (|."1 @: {."1) rotstack)"1
det =: -/ . * @: toep
ps =: 3 : ',/(0 1 ,"0 1/ ,.y)'
canonical =: #. >: [: #. |. " 1

lss =: 3 : 0
  shape =. (2^y), y
  shape $ ,>{;/(y,2)$0 1
)

ls =: (canonical@:lss) # lss
ans =: >./ @: det @: ls @: <: @: +:

display =: 3 : 0
echo 'n = ';y;'the answer is';ans y
)
display"0 (1 + i.13)
exit''

Run this and kill when two minutes are up. My results (MBP 2014 - 16GB of RAM):

┌────┬─┬─────────────┬─┐
│n = │1│the answer is│1│
└────┴─┴─────────────┴─┘
┌────┬─┬─────────────┬─┐
│n = │2│the answer is│1│
└────┴─┴─────────────┴─┘
┌────┬─┬─────────────┬─┐
│n = │3│the answer is│2│
└────┴─┴─────────────┴─┘
┌────┬─┬─────────────┬─┐
│n = │4│the answer is│3│
└────┴─┴─────────────┴─┘
┌────┬─┬─────────────┬─┐
│n = │5│the answer is│5│
└────┴─┴─────────────┴─┘
┌────┬─┬─────────────┬─┐
│n = │6│the answer is│9│
└────┴─┴─────────────┴─┘
┌────┬─┬─────────────┬──┐
│n = │7│the answer is│32│
└────┴─┴─────────────┴──┘
┌────┬─┬─────────────┬──┐
│n = │8│the answer is│56│
└────┴─┴─────────────┴──┘
┌────┬─┬─────────────┬───┐
│n = │9│the answer is│125│
└────┴─┴─────────────┴───┘
┌────┬──┬─────────────┬───┐
│n = │10│the answer is│315│
└────┴──┴─────────────┴───┘
┌────┬──┬─────────────┬────┐
│n = │11│the answer is│1458│
└────┴──┴─────────────┴────┘
┌────┬──┬─────────────┬────┐
│n = │12│the answer is│2673│
└────┴──┴─────────────┴────┘

Total run time = 61.83s.

Just for fun

┌────┬──┬─────────────┬────┐
│n = │13│the answer is│8118│
└────┴──┴─────────────┴────┘

This took approximately 210 seconds on its own.


Represent n as an expression containing all the digits Related Challenge: Single Digit Representations of Natural Numbers

Task

Write a program/function that when given a non-negative integer \$n \le 100000\$ outputs an expression which uses all the digits from \$0\$ to \$9\$ exactly once and evaluates to \$n\$

The expression outputted by your program may only use the operations listed below:

addition
subtraction and unary minus (both must have the same symbol)
multiplication
division (fractional, i.e. 1/2 = 0.5)
exponentiation
parentheses

Note: Concatenation is not allowed

Output Format

Output can be a string, list of operations and numbers or a list of lists in place of brackets.
You may choose the precedence of the operators but it must be consistent for all outputs produced by your program/function
Output may be in polish, reverse polish or infix notation but it must be consistent for all outputs produced by your program/function.
You can use custom symbols for representing the digits and operations but the symbols used for representing the digits and operations should be distinct.

Scoring

This is code-golf so shortest bytes wins

Sample Testcases

0 -> 0 ^ (1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9)
4 -> (0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8) / 9
7 -> 0 * (1 + 2 + 3 + 4 + 5 + 6 + 8 + 9) + 7
45 -> 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1 + 0
29 -> 1 + 2 + 7 + 6 + 5 + 4 + 3 + 0 + (9 - 8)
29 -> (((9 + 8 + 7 + 6) * 0) + 5 + 4) * 3 + 2 * 1
100 -> (9 * 8) + 7 + 4 + 5 + 6 + 3 + 2 + 1 + 0

A proof by exhaustion (also contains program used to generate the proof) that shows that all number less than or equal to \$100000\$ have an expression that uses all the digits.

05AB1E, 25 24 bytes
9Ýœ"+-*m"9ãðδšδ.ιJ˜.Δ.VQ

Brute-force approach, so obviously extremely slow.
Outputs in reverse Polish notation, with the characters +-*m for addition, subtraction, multiplication, and exponentiation respectively. Division isn't necessary for the \$[0,100000]\$ range we have to support.
Try it online with additional (first) input to specify the digit-range \$[0,n]\$ instead of \$[0,9]\$, for which I've used 4 right now as example.
Explanation:

9Ý           # Push a list in the range [0,9]
  œ          # Get all possible permutations of this list
"+-*m"       # Push string "+-*m"
      9ã     # Get all possible combinations of size 9 with the cartesian product
         δ   # Map over each string of operations:
        ð š  #  Convert it to a list of characters, and prepend a space
δ            # Apply double-vectorized with both lists of lists:
 .ι          #  Interleave the lists
J            # Then join each inner list together to a string
.Δ           # Find the first string which is truthy for:
  .V         #  Evaluate/execute the string as 05AB1E code
    Q        #  And check if the result is equal to the (implicit) input-integer
             # (after which the found result is output implicitly)

If we are allowed to output all possible results instead of just one, the .Δ (find first) could be ʒ (filter) for -1 byte. Although in that case it would become even slower than it already is..


The Symbols vs. The Letters The Symbols vs. The Letters

The ASCII characters have been divided once again! Your sets are The Letters and The Symbols.

The Letters

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz

The Symbols

!"#$%&'()*+,-./0123456789:;<=>?@[\]^_`{|}~

The task is to write two programs:

Print each of The Letters exactly once without using any of them in your program.
Print each of The Symbols exactly once without using any of them in your program.

Rules

Whitespace may appear in your program or the output.
Non-ASCII characters are not allowed.
Output goes to standard out or to a file as either the contents or name of the file.
No input.
Output must only contain ASCII characters from one set or the other.
The programs can be written in different languages or the same language with one exception:
The Whitespace language may only be used for one of the programs.
Standard loopholes apply.

Scoring

# of characters in program 1 +# of characters in program 2 = Score

Lowest score wins!

Note:

To encourage more submissions, you may still post an answer with a solution for only one of the programs. You won't be able to win, but you would still be able to show off something cool.

Thanks to Calvin's Hobbies for inspiring the idea with his previous question.

Python (Symbols, 87 82)

from string import punctuation
from string import digits
print digits
print punctuation

I just love Python's string module...

Edit:

from string import punctuation as p
from string import digits as d
print d
print p

Output:

0123456789
!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~

FALSE (Letters, 21) DUP (Letters, 20):

FALSE solution:

65[$91\>][$,$32+,1+]#

DUP sollution (1 char shorter)

65[$91<][$,$32+,1+]#

Output (for both):

AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz

Interpreter for FALSE.

Total: 102


Determine the depth of an array A simple challenge for your Monday evening (well, or Tuesday morning in the other half of the world...)

You're given as input a nested, potentially ragged array of positive integers:

[1, [[2, 3, [[4], 5], 6, [7, 8]], 9, [10, [[[11]]]], 12, 13], 14]

Your task is to determine its depth, which is the greatest nesting-depth of any integer in the list. In this case, the depth of 11 is 6, which is largest.

You may assume that none of the arrays will be empty.

You may write a program or function, taking input via STDIN (or closest alternative), command-line argument or function argument and outputting the result via STDOUT (or closest alternative), function return value or function (out) parameter.

Input may be taken in any convenient list or string format that supports non-rectangular arrays (with nested arrays of different depths), as long as the actual information isn't preprocessed.

You must not use any built-ins related to the shape of arrays (including built-ins that solve this challenge, that get you the dimensions of a nested array). The only exception to this is getting the length of an array.

Standard code-golf rules apply.

Test Cases

[1]                                                               -> 1
[1, 2, 3]                                                         -> 1
[[1, 2, 3]]                                                       -> 2
[3, [3, [3], 3], 3]                                               -> 3
[[[[1], 2], [3, [4]]]]                                            -> 4
[1, [[3]], [5, 6], [[[[8]]]], 1]                                  -> 5
[1, [[2, 3, [[4], 5], 6, [7, 8]], 9, [10, [[[11]]]], 12, 13], 14] -> 6
[[[[[[[3]]]]]]]                                                   -> 7

K, 4 bytes

#,/\

In K, ,/ will join all the elements of a list. The common idiom ,// iterates to a fixed point, flattening an arbitrarily nested list completely. ,/\ will iterate to a fixed point in a similar way, but gather a list of intermediate results. By counting how many intermediate results we visit before reaching the fixed point (#), we get the answer we want: the maximum nesting depth.

"Count of join over fixed-point scan".

In action:

 (#,/\)'(,1
        1 2 3
        ,1 2 3
        (3;(3;,3;3);3)
        ,((,1;2);(3;,4)))
1 1 2 3 4


ASCII art Bresenham line drawing Write the shortest possible program that draws a Bresenham line in ASCII art.  Your program should take two integers x and y (command line or stdin, your choice) and draw an ASCII line which starts in the upper left and goes right x units and down y units.  You must use _ and \ characters and place them in the correct location according to Bresenham's algorithm.

You may assume x >= y, so no vertical segments are required.

Note that because you're using the _ character, for a line with y=3 you will likely need to output 4 lines of text (and you may emit a leading blank line when it isn't necessary).

examples:

11 3
_
 \___
     \___
         \_
11 1
_____
     \_____

5 4

\
 \_
   \
    \

For points which are exactly halfway you may choose either rounding:

10 1
____
    \_____
or
_____
     \____


Conway's $1(0),000 challenge Background

This challenge is about A004001, a.k.a. Hofstadter-Conway $10000 sequence:

$$
a_1 = a_2 = 1, \quad a_n = a_{a_{n-1}} + a_{n-a_{n-1}}
$$

which starts with

1, 1, 2, 2, 3, 4, 4, 4, 5, 6, 7, 7, 8, 8, 8, 8, 9, 10, 11, 12, 12, 13, 14, 14, 15, 15, 15, 16, 16, 16, 16, 16, ...

John Conway proved the following property of the sequence:

$$
\lim_{n\rightarrow\infty}{\frac{a_n}{n}}=\frac12
$$

After the proof, he offered $1(0),000 for the smallest \$k\$ such that all subsequent terms of \$a_j/j\$ after the \$k\$-th term are within 10% margin from the value \$1/2\$, i.e.

$$
\left|\frac{a_j}{j}-\frac12\right|<\frac1{20},\quad j > k
$$

To quote Sloane's comment on the OEIS page (which explains the title):

  John said afterwards that he meant to say $1000, but in fact he said $10,000. [...] The prize was claimed by Colin Mallows, who agreed not to cash the check.

Here are some graphs to get some feel of the sequence (copied from this MathOverflow.SE answer):

Also check out A004074, which lists the values of \$2a_n-n\$.

Challenge

Given the amount of margin \$r\$, solve the generalized Conway's challenge: find the smallest \$k\$ which satisfies

$$
\left|\frac{a_j}{j}-\frac12\right|<\frac{r}{2},\quad j > k
$$

This can be also phrased as the largest \$k\$ that satisfies \$\left|\frac{a_k}{k}-\frac12\right|\ge\frac{r}{2}\$. You can assume \$0<r<1\$, so that the task is well-defined in both ways.

(The original challenge is \$r=0.1\$, and the answer by Colin Mallows is 1489, according to Mathworld (which agrees with my own implementation). The value of 3173375556 on the MO answer is probably the one for \$r=0.05\$.)

For simplicity, you may assume a few conjectured properties of the sequence:

\$a_n = n/2\$ when \$n = 2^k, k \in \mathbb{N}\$.
\$2a_n - n\$

is nonnegative everywhere,
is 0 when \$n = 2^k, k \in \mathbb{N}\$,
follows the Blancmange curve-like pattern between the powers of two (as visible in the second figure above), and
when divided by \$n\$, has the maximum values between powers of two decreasing as \$n\$ increases (as visible in the first figure above).

Standard code-golf rules apply. The shortest code in bytes wins.

Test cases

r     | answer
------+-------
0.9   | 1
0.4   | 1
0.3   | 6
0.2   | 25
0.15  | 92
0.13  | 184
0.12  | 200
0.11  | 398
0.1   | 1489
0.09  | 3009
0.085 | 6112
0.08  | 22251

Reference implementation in Python.

(A hint for termination check: A value of \$k\$ is the answer if \$\frac{2a_k}{k}-1\ge r\$ and \$\frac{2a_j}{j}-1< r\$ for \$k < j \le 4k\$.)

JavaScript (ES6), 83 bytes
Slow as hell.

g=n=>n<3||g(n-g(--n))+g(g(n))
f=(r,n=1,m)=>(x=g(n)*2-n)|m?f(r,n+1,x<r*n?x&&m:o=n):o

Try it online!
How?
We look for the highest \$n\$ such that:
$$2\cdot a(n)-n \ge r\cdot n$$
We stop when no greater value is found in a whole interval:
$$[2^k+1,2^{k+1}], k>0$$
whose upper bound is characterized by \$2\cdot a(n)-n=0\$.

JavaScript (ES6), 94 bytes
A much faster version using a cache to prevent too many recursive calls.

g=n=>g[n]=g[n]||n<3||g(n-g(--n))+g(g(n))
f=(r,n=1,m)=>(x=g(n)*2-n)|m?f(r,n+1,x<r*n?x&&m:o=n):o

Try it online!


Rational Polynomial Interpolation Explanation

In this task you'll be given a set of N points (x1,y1),…,(xN,yN) with distinct xi values and your task is to interpolate a polynomial through these points. If you know what Lagrange interpolation is you can skip this section.

The goal of a polynomial interpolation is to construct the (unique) polynomial p(x) with degree N-1 (for higher degrees there are infinite solutions) for which p(xi) = yi for all i = 1…N. One way to do so is to construct N Lagrange basis polynomials and form a linear combination. Such a basis polynomial is defined as follows:

As you can see if you evaluate li at the points x1,…,xi-1
,xi+1,…
,xN it is 0 by construction and 1 for xi, multiplying by yi will only change the value at xi and set it to yi. Now having N such polynomials that are 0 in every point except one we can simply add them up and get the desired result. So the final solution would be:

Challenge

the input will consist of N data points in any reasonable format (list of tuples, Points, a set etc.)
the coordinates will all be of integer value
the output will be a polynomial in any reasonable format: list of coefficients, Polynomial object etc.
the output has to be exact - meaning that some solutions will have rational coefficients
formatting doesn't matter (2/2 instead of 1 or 1 % 2 for 1/2 etc.) as long as it's reasonable
you won't have to handle invalid inputs (for example empty inputs or input where x coordinates are repeated)

Testcases

These examples list the coefficients in decreasing order (for example [1,0,0] corresponds to the polynomial x2):

[(0,42)] -> [42]
[(0,3),(-18,9),(0,17)] -> undefined (you don't have to handle such cases)
[(-1,1),(0,0),(1,1)] -> [1,0,0]
[(101,-42),(0,12),(-84,3),(1,12)] -> [-4911/222351500, -10116/3269875, 692799/222351500, 12]

Pari/GP, 14 bytes

polinterpolate

Takes two lists [x1, ..., xn] and [y1, ..., yn] as input. Outputs a polynomial.

Try it online!

Pari/GP, 37 bytes, without built-in

f(x,y)=y/matrix(#x,#x,i,j,x[j]^(i-1))

Takes two lists [x1, ..., xn] and [y1, ..., yn] as input. Outputs a list of coefficients.

Try it online!


Longest run of a character in a string Your challenge: Write a function that takes a string s, a character c, and finds the length of the longest run of c in s. The length of the run will be l.

Rules:

If s is of length 0 or c is empty, l should be 0.
If there are no instances of c in s, l should be 0.
Standard loopholes and Standard I/O Rules apply.
No matter where in s the run of cs is located, l should be the same.
Any printable ASCII characters can appear in s and c.

Test cases:

s,c --> l
"Hello, World!",'l'  -->  2
"Foobar",'o'         -->  2
"abcdef",'e'         -->  1
"three   spaces",' ' -->  3
"xxx xxxx xx",'x'    -->  4
"xxxx xx xxx",'x'    -->  4
"",'a'               -->  0
"anything",''        -->  0

Winner:

As with code-golf the shortest answer in each language wins.

05AB1E, 5 bytes
Code:
SQγOM

Uses the 05AB1E encoding. Try it online!
Explanation:
SQ      # Check for each character if it is equal to the second input
  γ     # Split the list of zeros and ones into groups
   O    # Sum each array in the arrays
    M   # Get the maximum


Eww, those bytes are gross Write a program or function that, when given a string, filters out as many distinct bytes as it can and returns the cleaned string. However, since your program hates them, none of these bytes can be present in your own code.

Your score will be the number of distinct bytes your program filters out from the input, with the higher the better. This is a max score of 255 (since your program has to be a minimum of one byte). The tiebreaker is the length of your code, with lower being better.

For example, if your program filters out the bytes 0123456789, it receives a score of 10, but your program itself cannot contain these bytes.

Rules

Bytes mean octets.
You also have the option to take input as a list of integers, with values ranging from 0 to 255. These correspond to the equivalent bytes.

Your output should be in the same form as your input

No reading your source code
Your code must be non-empty
Yes, I know there's going to be a Lenguage/Unary answer. But at least golf it please? ;)

Edit Rule:

You may choose to ignore a byte, for example if it is indistinguishable from the terminating byte for a string or for EOF. However, this means you can't use it in your submission, nor does it count for your score. If you choose to do so, your max score will be 254, but you don't have to handle that byte being in your input.

Japt -P, score: 255 (2 bytes)

ff

f => filter, second f => everything but 'f'

Try it online!

Japt, score: 255 (2 bytes)

From @Shaggy

oo

o => remove everything but, second o => 'o'

Try it online!


Help golfing this solution further We are doing a PCG challenge at work, and I'm submitting answers in C#.  This is a modification of the "M'Kay" challenge.  My solution has been deemed correct by the requirements, I'm just trying to shrink it further if possible.

  A filler word is an apparently meaningless word, phrase, or sound that marks a pause or hesitation in speech.

  Your task is to create a function that has a 30%-50% chance of adding a random filler word to a block of text after the punctuation marks , ; . ? and !; and when added is followed by the same punctuation. The same filler word must be used for each replacement within a single execution of the function.

  If the filler word occurs after a sentence completing punctuation mark such as . ? or ! the filler word must have the first letter capitalized.
  If the filler word occurs after a sentence pausing punctuation mark such as , or ; the filler word must be in lowercase.

  Fillers: um, literally, you know, er, okay, right, ah, like

My submitted code:

string p(string i,int z=-1){string w="Um|Literally|You know|Er|Okay|Right|Ah|Like".Split('|')[i.Length %8],s="?,!;.",o="";foreach(var c in i){var x=s.IndexOf(c);o+=(z>0&&i[z]>'9'&&x>-1&&(1&z)<1?c+" "+(x%2>0?" "+w.ToLower():w):"")+c;z++;}return o;}

  Original input text: We heard tales of Americans like Coast Guard Petty Officer Ashlee Leppert, who is here tonight in the gallery with Melania.  Ashlee was aboard one of the first helicopters on the scene in Houston during Hurricane Harvey.  Through 18 hours of wind and rain, Ashlee braved live power lines and deep water, to help save more than 40 lives.  Thank you, Ashlee.

  With fillers added: We heard tales of Americans like Coast Guard Petty Officer Ashlee Leppert, okay, who is here tonight in the gallery with Melania.  Ashlee was aboard one of the first helicopters on the scene in Houston during Hurricane Harvey. Okay.  Through 18 hours of wind and rain, Ashlee braved live power lines and deep water, okay, to help save more than 40 lives.  Thank you, Ashlee.

Clarification comments welcome, I don't know what else I need to include.

string ... s="?,!;." ... var x=s.IndexOf(c);

s is used only once, so could be inlined.

var x=s.IndexOf(c); ... &&x>-1&& ... c+" "+(x%2>0?" "+w.ToLower():w):"")+c;

Change "?,!;." to ",;?!." and the test x%2>0 can be simplified to x<2.

Where in the spec does it require double-space after sentence-terminating punctuation? IMO you could lose the " "+ inside the parentheses.

Given the IMO ridiculous interpretation which they're allowing of "random", I don't see why you do such complicated stuff with z. Just use the character index modulo 3. A direct change to

string p(string i){int n=i.Length,j,x;string w="Um|Literally|You know|Er|Okay|Right|Ah|Like".Split('|')[n%8],o="";for(j=0;j<n;j++){var c=i[j];x=",;.?!".IndexOf(c);o+=(x>-1&&j%3<1?c+" "+(x<2?" "+w.ToLower():w):"")+c;}return o;}

gives a further nice saving. An alternative using Linq also saves a lot by exploiting fat arrow syntax, and would be cheaper if they give you free using statements:

using System.Linq;string p(string s)=>string.Join("",s.Select((c,i)=>{var w="Um|Literally|You know|Er|Okay|Right|Ah|Like".Split('|')[s.Length%8];var x=",;.?!".IndexOf(c);return(x>=0&&i%3<1?c+" "+(x<2?" "+w.ToLower():w):"")+c;}));


Print the digital root This is different from My Word can beat up your Word as it is less complex and only requires you to calculate it, and not compare them.

To find the digital root, take all of the digits of a number, add them, and repeat until you get a one-digit number. For example, if the number was 12345, you would add 1, 2, 3, 4, and 5, getting 15. You would then add 1 and 5, giving you 6.

Your task

Given an integer N (0 <= N <= 10000) through STDIN, print the digital root of N.

Test cases

1 -> 1
45 -> 9
341 -> 8
6801 -> 6
59613 -> 6
495106 -> 7

Remember, this is code-golf, so the code with the smallest number of bytes wins.

Pyke, 1 byte
s

Try it here!
Takes the digital root of the input


Ethiopian Multiplication This question is inspired by this answer. Coincidentally, I used to use Ethiopian Multiplication when I was a kid, but had never known the name of the method until recently.

Ethiopian multiplication is a method of multiplying integers using only addition, doubling, and halving.

Method:

Take two numbers to be multiplied and write them down at the top of two columns.
In the left-hand column repeatedly halve the last number, discarding any remainders, and write the result below the last in the same column, until you write a value of 1.
In the right-hand column repeatedly double the last number and write the result below. stop when you add a result in the same row as where the left hand column shows 1.
Examine the table produced and discard any row where the value in the left column is even.
Sum the values in the right-hand column that remain to produce the result of multiplying the original two numbers together.

For example: 17 x 34

17    34

Halving the first column:

17    34
 8
 4
 2
 1

Doubling the second column:

17    34
 8    68
 4   136
 2   272
 1   544

Strike-out rows whose first cell is even, we'll do this by encasing those numbers on the right in square brackets:

17    34
 8   [68]
 4  [136]
 2  [272]
 1   544

Sum the remaining numbers in the right-hand column:

17    34
 8   [68]
 4  [136]
 2  [272]
 1   544
    =====
     578

So 17 multiplied by 34, by the Ethiopian method is 578.

The Task:

Golf code that takes two numbers between 1 and 1000 and perform the same layout and algorithm, displaying the product below.

Input Method: However you choose...

Example Input:

19 427

Resulting Output:

19   427
 9   854
 4 [1708]
 2 [3416]
 1  6832
   ======
    8113

Please note the alignment of the digits. This is most important in the layout.
Also note that the double line laid out by equal signs must be two characters longer than the overall answer and must be centre justified.

Testing

How will you be testing this? By providing a run of your program using two numbers. These numbers can be extracted from your user ID number (this can be obtained by hovering your cursor over your avatar on the top window). Take your number and take the last three digits, this will be number B, take whatever else remains at the front, that will be number A. Then test for A times B.

Testing example:

My user ID number is 8555, so my numbers are 8 and 555. So my output should look like this:

8  [555]
4 [1110]
2 [2220]
1  4440
  ======
   4440

Restrictions:

No native multiplication operators permitted save for in the use of "doubling", as per mentioned in the algorithm. In other words, if you're using an operator like *, it can only be used for multiplying by 2 only.

Entries that do not adhere to this will not be considered and the user will be escorted off the premises with a cardboard box full of their belongings. Each entry will have code, plus the test based on your user ID number.

This is code golf. Shortest number of bytes will receive the prize, glory and admiration of their peers... (And maybe a Lamborghini... I said "maybe"!)

Python 2, 203 202 187 133 bytes

a,b=input()
s=0
while a:print'%3s%9s'%(a,'[ %%dd] '[a%2::2]%b);s+=[0,b][a%2];a/=2;b*=2
print'%10s==\n%11s'%(''.rjust(len(`s`),'='),s)

Try it online!
If I can use * for string multiplication ('='*R) and as a 'selector' (b*(a%2) instead of [0,b][a%2]), I get:
118 bytes

a,b=input()
s=0
while a:print'%3s%9s'%(a,'[ %%dd] '[a%2::2]%b);s+=a%2*b;a/=2;b*=2
print'%10s==\n%11s'%('='*len(`s`),s)

Try it online!

Explanation:
a,b=input()                   #Get input
L=len(`a`)                    #Get length of first number for adjusting text
l=[]                          #Output list
s=0                           #Sum
while a:
 B=['[%d]',' %d '][a%2]%b     #B is either '[b]' or ' b ' depending on if a is odd/even
 l+=[(`a`,B)]                 #Add a,B to output list
 s+=[0,b][a%2]                #Add b to sum if a is odd
 a/=2;                        #Halve a
 b*=2;                        #Double b
R=len(B)                      #Length of last B for adjusting output
l+=[('',''.rjust(R,'='))]     #Add double line ==== to output list
l+=[('','%d '%s)]             #Add sum to output list
for x,y in l:
 print x.rjust(L),y.rjust(R)  #Print adjusted numbers


Detect the Nearly Perfect Licence Plates Note: This is inspired by this question by @Willbeing where task was to count the number of perfect plates of a certain length, but it's slightly different.

We call a perfect licence plate that plate whose text satisfies the following conditions:

It consists of characters, which can either be uppercase letters([A-Z]) or digits([0-9])
Summing the positions of its letters in the English alphabet, 1-indexed (i.e: A=1,B=2,...,Z=26) gives an integer n
Getting each chunk of digits, summing them and then multiplying all the results gives the same result, n
n is a perfect square (e.g: 49 (72), 16 (42))

A nearly perfect licence plate meets the conditions for a perfect licence plate, except that n is not a perfect square.

Input
A string representing the text of the licence plate, taken as input in any standard form, except for hardcoding.
Output
If the given string represents a nearly perfect licence plate, return a truthy value (e.g: True / 1), otherwise return a falsy value (e.g: False / 0). Any standard form of output is accepted while taking note that this loopholes are strictly forbidden.

Examples
licence plate -> output

A1B2C3 -> 1

A + B + C = 1 + 2 + 3 = 6
1 * 2 * 3 = 6
6 is not a perfect square, 6 = 6 => nearly perfect plate

01G61 -> 1

(0 + 1) * (6 + 1) = 7
G = 7
7 is not a perfect square, 7 = 7 => nearly perfect plate

11BB2 -> 0

(1 + 1) * 2 = 4
B + B = 2 + 2 = 4
4 = 4, but 4 is the square of 2 => perfect license plate (not what we want)

67FF1 -> 0

(6 + 7) * 1 = 13
F + F = 6 + 6 = 12
12 != 13 => not perfect at all!

Scoring
This is code-golf, so the shortest answer in bytes wins!

Jelly, 29 28 30 bytes
+1 byte to fix a bug spotted by ChristianSievers (incorrectly dealing with substrings of only zeros)
+1 byte to fix false positives for "0", "00", ... found during above fixing (0 is a perfect square).
i@€ØAS;Æ²$
e€ØAœpV€€LÐfS€P;0⁼Ç

Try it online!, or run tests
How?
i@€ØAS;Æ²$ - Link 1: [letter-sum, letter-sum is perfect square?]: plate
i@€        - index of €ach char in plate [reversed @rguments] (1-based, 0 otherwise) in:
   ØA      -     uppercase alphabet
     S     - sum
         $ - last two links as a monad:
      ;    -     concatenate with:
       Æ²  -         is square?

e€ØAœpV€€LÐfS€P;0⁼Ç - Main link: plate                        e.g. "11BB2"
    œp              - partition plate at truthy values of:
e€                  -     is in? for €ach char in plate:
  ØA                -         uppercase alphabet                   [['1','1'],[''],['2']]
      V€€           - evaluate for €ach for €ach                   [[1,1],[],[2]]
          Ðf        - filter keep:
         L          -     length                                   [[1,1],[2]]
            S€      - sum each                                     [2,2]
              P     - product                                      4
               ;0   - concatenate a zero                           [4,0]
                  Ç - last link (1) as a monad (taking plate)      [4,1]
                 ⁼  - equal? (non-vectorising)                     0


Is this figure connected? You are given a list of (x,y) grid coordinates.  Your function should decide whether the figure obtained by coloring in the squares of the grid with the given coordinates is connected or not.

Squares adjacent diagonally are not considered connected.

Example input:

(0,0),(1,0),(2,0),(3,0),(3,1),(3,2),(2,2),
(1,2),(0,2),(0,3),(0,4),(1,4),(2,4),(3,4)

which looks like:

****
*
****
   *
****

Output:

YES

Example input:

(0,0),(1,0),(2,0),(0,1),(0,2),(2,2),(3,2),(4,2),(0,3),
(4,3),(0,4),(1,4),(2,4),(4,4),(4,5),(2,6),(3,6),(4,6)

which looks like:

  ***
    *
*** *
*   *
* ***
*
***

Output:

NO

Your function must take as input a list of pairs of integers (e.g. in C++, maybe vector<pair<int,int>>) and return a boolean.  You may not assume any particular ordering of the input points.  The coordinates will be between 0 and 99 inclusive.

Smallest code wins.

c99 -- 620ish neccessary characters

#include <stdlib.h>
#define S return
typedef struct n N;struct n{int x,y;N*n;};
N*I(int x,int y,N*l){if(!l)goto z;N*m=l;do{if((m->x==x)&&(m->y==y))
S m;m=m->n;}while(m!=l);z:S NULL;}N*A(N*n,N*l){if(!l)n->n=n,l=n;
else n->n=l->n,l->n=n;S l;}N*R(N*n,N*l){if(!l||(l==n&&n->n==n))goto z;
N*m=l;do{if(m->n==n){m->n=n->n;S m;}m=m->n;}while(m!=l);z:S NULL;}
int E(N*l){int i=0;if(!l)goto z;N*m=l;do{++i;m=m->n;}while(m!=l);z:S i;}
int C(N*l){N*c=NULL,*n=l,*m=l=R(n,l);c=A(n,c);int a=E(l)*E(l);do{
if(!l)S 1;n=m->n;if(I(m->x-1,m->y,c)||I(m->x+1,m->y,c)||I(m->x,m->y-1,c)
||I(m->x,m->y+1,c))l=R(m,l),c=A(m,c);m=n;}while(--a);S 0;}

More than half the bulk is taken up by a minimal implementation of a linked list---c is horribly deficient in that sense.

The code here includes the definition of the nodes and all the list manipulation functions called by C, my connectedness checker.

The method is to maintain two lists (one of connected nodes initialized by the first node) and one of yet-to-be-connected nodes (starting with everything else). What follows is an exhaustive cyclic search to find a connection for each node in turn. There is an upper limit on the number of attempts conservatively set to length-of-the-list squared, which marks the end of attempts. Very inefficient, but functional.

It completes several simple cases of my own devising and both of the given test cases correctly.

Full program with test scaffold and some comments

#include <stdio.h>
#include <stdlib.h>
typedef struct n N;
struct n{
  int x,y;
  N*n;
};
N*I(int x,int y,N*l){ /* Return pointer to node x,y in l or NULL */
  if(!l)goto z;
  N*m=l;
  do{
    if((m->x==x)&&(m->y==y)){
      return m;
    }
    m=m->n;
  }while(m!=l);
 z:return NULL;
};
N*A(N*n,N*l){ /* Add node n to list l. Return the new l */
  if(!l){
    n->n=n;
    l=n;
  }else{
    n->n=l->n;
    l->n=n;
  }
  return l;
};
N*R(N*n,N*l){ /* Remove node n from list l. Return the new l */
  if(!l||(l==n&&n->n==n))goto z;
  N*m=l;
  do{
    if(m->n==n){m->n=n->n; return m;}
    m=m->n;
  }while(m!=l);
 z:return NULL;
}
int E(N*l){ /* Return the Enumberation of nodes in list l */
  int i=0;
  if(!l)goto z;
  N*m=l;
  do{++i;m=m->n;}while(m!=l);
 z:return i;
}
int C(N*l){ /* return true if all nodes in list l are connected */
  N*c=NULL,*n=l,*m=l=R(n,l); /* put the first node in the connected
                            list, and mark the start of the
                            working list */
  c=A(n,c);
  int a=E(l)*E(l); /* maximum number of times to try to place nodes */
  do {
    if (!l) return 1; /* when l is empty: we win! */
    n=m->n;
    if ( I(m->x-1,m->y  ,c) ||
     I(m->x+1,m->y  ,c) ||
     I(m->x  ,m->y-1,c) ||
     I(m->x  ,m->y+1,c) ) l=R(m,l), c=A(m,c);
    m=n;
  } while (--a);
  return 0;
}
void P(N*l){ /* Print the list */
  printf("List: [");
  if(!l)goto z;
  N*m=l;
  do{printf(" (%d, %d)",m->x,m->y);m=m->n;}while(m!=l);
 z:printf(" ]\n");
}
N*G(int x,int y){ /* generate a new node with (x, y) */
  N*n;
  if(n=malloc(sizeof(N)))n->x=x,n->y=y;
  return n;
}
int main(){
  N*n,*l=NULL;

  n=G(0,0); l=A(n,l);
  n=G(1,0); l=A(n,l);
  n=G(2,0); l=A(n,l);
  n=G(0,1); l=A(n,l);
  n=G(0,2); l=A(n,l);
  n=G(2,2); l=A(n,l);
  n=G(3,2); l=A(n,l);
  n=G(4,2); l=A(n,l);
  n=G(0,3); l=A(n,l);

  n=G(4,3); l=A(n,l);
  n=G(0,4); l=A(n,l);
  n=G(1,4); l=A(n,l);
  n=G(2,4); l=A(n,l);
  n=G(4,4); l=A(n,l);
  n=G(4,5); l=A(n,l);
  n=G(2,6); l=A(n,l);
  n=G(3,6); l=A(n,l);
  n=G(4,6); l=A(n,l);

  P(l);
  if (C(l)) {
    printf("Connected!\n");
  } else {
    printf("Not connected.\n");
  };
}


Merging text files based on a prefix key Imagine an ordered file set : file1, file2, ... fileN.

Each file is a textual file that is made of lines that have the same format : A concatenation of a fixed-size key (the same among all the file set) and a variable length value.

The merging algorithm is very similar to UPSERT :

To merge 2 files:

Iterate on all lines of the first file.

If the key of the current line is not in the second file, emit the current line.
If the key of the current line is in the second file, emit only the line of the second file

For each line of the second file that has a key not present in the first file emit the line of the second file.

If more than 2 files are to be merged, each file is merged to the result of the previous merge. The result of merge(file1, file2, file3, file4) is defined as the result of merge(merge(merge(file1, file2), file3), file4).

As an example, we take the length of the key of 4 :

$ cat file1
0010THIS_IS_LINE_1_FROM_FILE1
0011THIS_IS_LINE_2_FROM_FILE1
00A0THIS_IS_LINE_3_FROM_FILE1
$ cat file2
0010THIS_IS_LINE_1_FROM_FILE2
0100THIS_IS_LINE_2_FROM_FILE2
$ cat file3
0100EMPTY_LINE
0011EMPTY_LINE

Will result in :

$ merge --key-size=4 file1 file2 file3
0010THIS_IS_LINE_1_FROM_FILE2
0011EMPTY_LINE
00A0THIS_IS_LINE_3_FROM_FILE1
0100EMPTY_LINE

Several precisions :

Textual data is made of printable ASCII7 chars plus tabs and spaces.
Preserving order is nice, but not required
Uniqueness of key is obviously required
Multicore-aware algorithms are allowed.
The first file is usually bigger than the others.

perl

I'm sure this can be done a few percent faster in some other language, but perl makes this super quick to implement at the optimal big-O level, and likely performs well enough. This code preserves order.

#!/usr/bin/perl -w

use strict;
use warnings;

my $key_size = $ARGV[0] =~ /--key-size=(\d+)/ ?
               (shift @ARGV, $1) : 4;

sub slurp {
  my $fn = shift;
  open my $fh, "<", $fn || die "can't open $fn for reading: $!";
  my (%keys, @order);
  while(<$fh>) {
    chomp;
    my $key = substr $_, 0, $key_size;
    push @order, $key;
    $keys{$key} = substr $_, $key_size;
  }
  close $fh || die "can't close $fn: $!";
  return [ \@order, \%keys ];
}

$_ = slurp shift @ARGV;
my @order = @{ $_->[0] };
my %keys  = %{ $_->[1] };
while(@ARGV) {
  my ($order2, $keys2) = @{slurp shift @ARGV};
  $keys{$_} = delete $keys2->{$_}  for (grep { exists $keys2->{$_} } @order);
  for (grep { exists $keys2->{$_} } @{$order2}) {
    $keys{$_} = $keys2->{$_};
    push @order, $_;
  }
}

print "$_$keys{$_}\n"  for  @order;

Test output:

ski@anito$ perl merger.pl --key-size=4 file1 file2  file3
0010THIS_IS_LINE_1_FROM_FILE2
0011EMPTY_LINE
00A0THIS_IS_LINE_3_FROM_FILE1
0100EMPTY_LINE

And here's a slightly faster version that doesn't preserve order:

#!/usr/bin/perl -w

use strict;
use warnings;

my $key_size = $ARGV[0] =~ /--key-size=(\d+)/ ?
               (shift @ARGV, $1) : 4;

my %keys;
while(@ARGV) {
  my $fn = shift;
  open my $fh, "<", $fn || die "can't open $fn for reading: $!";
  while(<$fh>) {
    chomp;
    $keys{substr $_, 0, $key_size} = substr $_, $key_size;
  }
  close $fh || die "can't close $fn: $!";
}

print "$_$keys{$_}\n"  for  keys %keys;


How many times should I press this? We are all used to the old-school telephone keypad, right? For reference, here is what it looks like:

Given a String consisting only of lowercase ASCII letters and single spaces, your task is to return the number of taps one should make in order to type down the full String with a telephone keypad as the one above.

For those who are unfamiliar with this, here's how it works:

The key with the digit 2, for example, also has the string abc written down on it. In order to type a, you must press this key once, for b you must press twice and for c you must press thrice.
For consecutive letters that are on the same key, you must wait 1 second before pressing again. So, if you want to type cb, you must press 3 times for c, wait a second and then press twice for b, so still 5 taps.
The same applies for all other keys, except for a single space, which only requires 1 press. Also note that the keys 7 and 9 have four letters on them. The same algorithm is applied, the only difference being the number of letters. The strings corresponding to each key can be found in the image above (but lowercase), or in the following list, that contains all the characters you might receive:

"abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz", " "

Test Cases

Input  ->  Output  (Explanation)

"" -> 0                   (nothing should be tapped)
"water" -> 8              ("w,a,t" each require 1 tap (on keys 9, 2 and 8), "e" requires 2 taps (on key 3), "r" requires 3 taps (on key 7), 1+1+1+2+3 = 8)
"soap"  -> 9              (4+3+1+1)
"candela" -> 13           (3+1+2+1+2+3+1)
"code golf" -> 20         (3+3+1+2+1(for the space)+1+3+3+3)
"king of the hill" -> 33  (2+3+2+1+1+3+3+1+1+2+2+1+2+3+3+3)

Specs

Standard I/O rules and Default Loopholes apply.
You may only take input in your language's native String type. Output can either be an integer or a string representation of that integer.
This is code-golf, the shortest answer in every language wins.

JavaScript (ES6) 77 66 64 60 bytes
(Saved some bytes thanks to @Johan Karlsson and @Arnauld).
s=>[...s].map(l=>s=~~s+2+'behknquxcfilorvysz'.search(l)/8)|s

f=

s=>[...s].map(l=>s=~~s+2+'behknquxcfilorvysz'.search(l)/8)|s

console.log(f(''));                 //0
console.log(f('water'));            //8
console.log(f('soap'));             //9
console.log(f('candela'));          //13
console.log(f('code golf'));        //20
console.log(f('king of the hill')); //33


Jimmy needs your help! It seems as of recent, there have been a lot a Jimmys falling to their death, as can be seen here, and here where you were asked to determine if Jimmy would fall. It is time we put a stop to this madness and try to save Jimmy.

Jimmy has three body parts /, o, and \ arranged like this

/o\

Platforms are represented with -.  Jimmy will fall off their platform iff they have two or more body parts that are not directly above a platform.

Some examples:

   /o\
- -------

Jimmy will balance since all their body parts are above a -.

   /o\
    ------   ---

Jimmy will balanced since two body parts are above -s.

 /o\
-- ----  --

Jimmy will balance even though they are split between two platforms

  /o\
   -

Jimmy will not balanced since two body parts are not above a platform.

Since my platform supply is running low, I only have platforms with a length of 5, and it is important we use as few as possible.

Your task is to take an input of Jimmys and output a string of platforms which will save all of the Jimmys in the input. Your output must use as few platforms as possible, but each platform must be 5 -'s wide.

Note that the rule of the platform being 5 - wide, means that each platform must have a space between them. ---------- is not valid in the output since it will be considered a platform of length 10 and not two platforms of length 5.

Test Case's

/o\  /o\/o\    // input
----- -----    // output

/o\           /o\
-----       -----

/o\           /o\      // same input as above
-----          -----   // this is also valid output

    /o\ /o\
     -----

Standard rules apply.

This is code-golf, may the shortest answer win!

Python 2, 70 67 bytes

lambda s:S('/',' ',S("\S.{5}","----- ",s+' '*5))
import re;S=re.sub

Try it online!

-3 bytes thanks to Kevin Cruijssen & Neil

Not the prettiest, not sure how to better handle those leftover slashes...

Unfortunately, we can't replace both ends of each platform with spaces using a single re.sub call, because in the case of 2 platforms being one space apart, the gap between them can't be matched more than once. A lookahead/lookbehind assertion won't help, because anything matched within those assertions doesn't get replaced.

Using a single re.sub reference:

Python 3.8 (pre-release), 78 bytes

lambda s:[s:=re.sub(".[^/ -].{5}"," ----- ",s+"  ",1)for c in s][-1]
import re

Try it online!