Calculate the total number of paths Description

There will be a grid of 9x9, where there will be placed 12 rocks.

You will start at a starting-rock and walking with a starting-direction (north, south, west or east), whenever you see a rock, you have two options:

Climb over the rock and continue in the same direction
Change direction to your *left

*NOT to the west, you change to your left as if you were walking and you take your own left.

So the flow of the paths will always be counter-clockwise. Here is an example that illustrates the flow:

Note: In this case, the starting-rock is the yellow (X) and the starting-direction is to the south

Rules

The code must be able to solve it for any rock (if it doesn't have complete paths, then is 0)
You can NOT memorize anything different than the rocks used
The rocks must be included on the code (so you can't pass them by input)
We will use the above's rock placement in the competition
You chose how you will pick the starting-rock (Example: passing an
array index or giving a xy location, etc) and how you chose the starting-direction (Example: 1=north, 2=south or etc)
It must return, print or otherwise make us know the total number of
paths somehow for that given rock
Counted by characters used

Just to immortalize the grid and rock placements in case the image dies for unknown reasons, I will put it in plain text:

100100000
100100010
000000000
000000000
000000000
010010000
000000000
010100000
100010010

//rocks = 1, empty = 0

Clarifications

You can't walk on the same part twice on the same path (crossing ways are allowed)
We need to be able to set on the input: a) the starting-rock and b)
the starting-direction
The complete paths must end on the starting-rock
Note that it shouldn't be a problem whether we can climb over a starting rock or not, because it is impossible to this to happen with the current map and rules (we do have a four-path rock where this could happen, but after analysing it, this can't happen)
You are allowed to compress the 9x9 grid. (the most it can be compressed is to a 5x5 I think)

Python, 274 chars

S=7
D=-1j

R=[0,4,7,1+1j,3+1j,1+3j,4+3j,7j,3+7j,7+7j,8j,3+8j]
Z={}
for i in range(4096):
 d=D;p=R[S];L=[]
 while len(L)<12:
  p+=d;P=[(abs(r-p),r)for r in R if r-p==abs(r-p)*d]
  if not P:break
  p=min(P)[1];d*=1j**(i>>R.index(p)&1);L+=[p]
  if p==R[S]:Z[tuple(L)]=1;break
print len(Z)

The code I'm counting starts at the R=[..., the initial two lines are "input" which I didn't count.

R is the set of rock coordinates, listed using complex number coordinates.  S is the starting rock.  D is the starting direction, again using complex numbers (1=right,-1=left,1j=up,-1j=down).

The code tries all of the 2^12=4096 possibilities for go straight/turn left for each rock, then walks from the starting rock until it gets back to the starting rock, or there is no more rock on the path, or the path gets too long (it loops).  It saves the path in Z if it is successful.


Finding the period of a recurring element in an array Given an array A of integers, there exists at least one positive integer p such that A[i] == A[j] for all i and j for which i % p == j % p == 0. Find the smallest p.

Examples:

Input array: [1, _, 1, _, 1, _, 1, _, 1]. Output: 2
Input array: [1, _, _, 1, _, _, 1, _, _]. Output: 3.
Input array: [1, _, _, _, 1, _, _, _, 1]. Output: 4

Python 3, 47 bytes

f=lambda l,d=1:f(l,d+1)if~-len({*l[::d]})else d

Try It Online


Remove the hyphenation Time for a new typography challenge! It’s a common problem when copy-pasting between various document formats: hyphenation. While it reduces the raggedness of a left-aligned layout or evens spacing in a justified layout, it’s a complete pain when your PDF is not properly constructed and retains the hyphens in the layout, making your copied text difficult to edit or reflow.

Luckily, if we are to believe the countless self-help books out there, nothing is a problem if you see it as a challenge. I believe these self-help books are without exception referring to PPCG, where any problem will be solved if presented as a challenge. Your task is to remove offending hyphenation and linebreaks from a text, so that it is ready to paste in any text editor.

Problem description

You will write a program or function that removes hyphenation and line-breaks where applicable. The input will be a string on stdin (or closest alternative) or as a function input. The output (on stdout or closest alternative or function output) will be the 'corrected' text. This text should be directly copy-pastable. This means that leading or trailing output is OK, but additional output halfway your corrected text (e.g., leading spaces on every line) is not.

The most basic case is the following (note: no trailing spaces)

Lorem ipsum dolor sit amet, con-
sectetur adipiscing elit. Morbi
lacinia nisi sed mauris rhoncus.

The offending hyphen and linebreaks should be removed, to obtain

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi lacinia nisi sed mauris rhoncus.

However, a few exceptions should be observed.

Double newlines indicate a paragraph break, and should be retained.
Proper nouns and names are never broken across two lines, unless they already contain a hyphen (e.g. Navier-Stokes equations). The line-break should be removed, but the hyphen retained. These cases can be identified by having only the first letter capitalized.
Sometimes, a hyphen indicates a word group (e.g. nineteenth- and twentieth century). When this happens across two lines, this is indicated with a leading space on the next line.

An example: (views expressed in this example are fictional and do not necessarily represent the view of the author; opponents of the Runge-Kutta-Fehlberg method are equally welcome to participate in this challenge)

Differential equations can
be solved with the Runge-Kutta-
Fehlberg method.

Developed in the nineteenth-
 or twentieth century, this
method is completely FANTAS-
TIC.

will become

Differential equations can be solved with the Runge-Kutta-Fehlberg method.

Developed in the nineteenth- or twentieth century, this method is completely FANTASTIC.

The linebreaks can be either the \n or \r\n ASCII code-point depending on your preference, and the hyphen is a simple ASCII - (minus sign). UTF-8 support is not required. This challenge is code-golf, so shortest code wins.

Retina, 58 bytes

(?<!\n)\n(?!\n)
<space>
- (?! |[A-Z][a-z])| (?= )|(?<=-) (?=[A-Z])
<empty>

<space> represents a single space on its own line and <empty> represents an empty trailing line. For counting purposes, each line goes into a separate file and the \n are replaced with actual linefeed characters. For convenience you can put all of the above in a single file though and run it with the -s flag.

I'm pretty sure there's a shorter way to do this, so I'll wait with an explanation until I'm done golfing.


Integer to string with given radix Write the shortest function to convert an integer into a numeric representation given a radix between 2 and 62. e.g.:

to_string(351837066319, 31) => "codegolf"

Python - 86

from string import*
def t(n,r,s=''):
 while n:s=printable[n%r]+s;n/=r
 return s or'0'

Credit due to Hoa Long Tam for the string import trick


Generate a JavaDoc comment I'm too lazy to write a JavaDoc comment myself, there's a lot of typing and it is mostly boilerplate. Write a program to generate a JavaDoc comment with $ as a placeholder given a method specification.

Example input:

Integer method(int arg1, String arg2) throws InvalidArgumentException, NullPointerException

Example output:

/**
    $
@param arg1 $
@param arg2 $
@return $
@throws InvalidArgumentException $
@throws NullPointerException $
*/

Some notes:

There won't be any static, private, or other qualifier on the method, just the return type.
There should be no @return tag if the return type is void.
It is possible that there won't be any throws clause.
You should accept the one-line method spec on stdin and write the result to stdout.

Shortest code wins.

PowerShell, 209 213
'/**
    $'
($i="$input")-replace'.*\( *| *\).*'-split','-ne''|%{"@param $((-split$_)[1]) $"}
,'@return $'*!($i-clike'void *')
if($i-match'\) *t'){$i-replace'.*\) *throws *'-split' *, *'|%{"@throws $_ $"}}'*/'

bash and PowerShell test scripts. but I'm probably missing a few cases still. But 22 tests are better than only one example, I guess :-)


Print me a Tower Block Print a tower block with the shortest possible code.

Input:

The input defines how many floors the tower block has. One floor contains a window on either side of the door. The window is made up of 3x3 hashes.

An example of a 4 storey tower block is below:

      =====================
      )V V V V V V V V V V(
     )V V V V V V V V V V V(
    )V V V V V V V V V V V V(
   )V V V V V V V V V V V V V(
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~
   : : : : : : : : : : : : : :
   : : ### : : : : : : ### : :
   : : ### : : : : : : ### : :
   : : ### : : : : : : ### : :
   : : : : : : : : : : : : : :
   : : : : : : : : : : : : : :
   : : ### : : : : : : ### : :
   : : ### : : : : : : ### : :
   : : ### : : : : : : ### : :
   : : : : : : : : : : : : : :
   : : : : : : : : : : : : : :
   : : ### : : : : : : ### : :
   : : ### : : : : : : ### : :
   : : ### : : : : : : ### : :
   : : : : : : : : : : : : : :
   : : : : : _______ : : : : :
   : : ### : I     I : ### : :
   : : ### : I     I : ### : :
   : : ### : I     I : ### : :
   : : : : : I     I : : : : :

Update:

The input has to be one or greater.

Trailing spaces at the end of lines are allowed.

In my example, every line has three leading spaces. This isn't mandatory, just the tower block with the input is.

Mathematica, 301 288 258 bytes

" "~(s=If[#2==0,"",#~StringRepeat~#2]&)~3<>{"="~s~21,"
",s[" ",12-#]<>{")","v "~s~#,"v(
"}&/@9~Range~12,"~"~s~27,"
",s[(x=(u=": ")~s~13<>":
")<>{y=u<>{z=": ### ",v=u~s~5,w=z<>": :
"},y,y,x},#-1],v,"_"~s~7," ",v,"
",m=u<>{z,u,n="I     I ",w},m,m,v,n,w}&

Pure function which takes a positive integer and outputs a string. The output string won't look right because Mathematica apparently doesn't display monospace fonts as monospace:

For reasons I don't quite understand, it does format as monospace if you Print the string:

Edit: Saved several bytes by not including "   " at the beginning of each line. Changed the definition of s to handle the case where there is only one floor (StringRepeat doesn't like repeating a string 0 times).

Edit 2: Thanks to LegionMammal978 and the fact that StringJoin is Listable, this is now an incomprehensible nightmare of nested lists and also 30 bytes shorter.


Find the line guaranteed by Sylvester-Gallai The Sylvester-Gallai theorem says: Suppose you have a finite list of points in the plane. Suppose further that not all of those points are collinear (lie in a single line). Then there is some line containing precisely two of the points. (That is, there's some line on which two of the points lie, but not more than two.)
You task is to find such a line. Note that more than one exists; you need to find one.
Input:
A bunch of points denoted by their Cartesian coordinates. You may assume the coordinates are nonnegative integers, if you like. The string (1,2),(0,4),(5,6) and the list 1, 2, 0, 4, 5, 6 and other formats are fine, and can be function parameters or read from STDIN or whatever.
If you prefer, allow also radical-root input (with positive-integer index). Then, each point will be represented by four numbers: the index and radicand of the abscissa, and the index and radicand of the ordinate. A rational number will be represented with index 1. Again, the input can be like ((1,2),(3,4)),((6,7),(8,9)),((2,3),(4,5)) or like 1, 2, 3, 4, 6, 7, 8, 9, 2, 3, 4, 5, or what-have-you. You may assume that the radicand is a nonnegative integer.
You may assume the points are distinct from one another and are not all collinear (and thus, in particular, that there are more than two points).
Output:
A line guaranteed by Sylvester-Gallai. This can be presented in any Cartesian-based form that completely specifies the line and allows people to visualize it. (I expect that answers will typically use either the line's slope and a point on it or two points on the line.)
Scoring:
This is a popularity contest. The answer with the greatest number of net votes after about a week will get the checkmark. Everyone can vote at will, obviously, but I, personally, will bear in mind at least these factors: ingenuity of the solution (including avoidance of the brute-force method), explanation of the code, ability to accept radical-root input, and simplicity of the code (in flop count / runtime).

Python 2, not golfed

Sure, they say there's a worst case O(n*log(n)) algorithm, but who cares about the worst case? It's the average case we usually care about, and this simple random algorithm runs in expected linear time on arbitrary inputs!

(By comparison, the deterministic brute force algorithm can be fed carefully constructed inputs to force it to run in quadratic time at least.)

import random,math
def radical_to_normal(x,y): return (x[1]**(1./x[0]),y[1]**(1./y[0]))

def distance_to_line(p1,p2,p3):
 dx = p2[0] - p1[0]
 dy = p2[1] - p1[1]
 return abs(dy*p3[0] + dx*p3[1] + p2[0]*p1[1] - p2[1]*p1[0]) / math.sqrt(dy*dy + dx*dx)

points = input() #input as list of pairs
c = True
while c:
    c = False
    p1,p2 = random.sample(set(points), 2)
    for p3 in points:
        if distance_to_line(radical_to_normal(*p1), radical_to_normal(*p2), radical_to_normal(*p3)) < 0.00001:
            c = True
print p1,p2

Example run:

➤ python sylvester.py
[((1,0),(1,0)),((1,1),(1,0)),((1,2),(1,0)),((1,0),(1,1)),((1,1),(1,1)),((1,2),(1,1)),((1,0),(1,2)),((1,1),(1,2)),((1,2),(1,2))]
((1, 2), (1, 2)) ((1, 0), (1, 1))

How it works

It's been proved (Csima and Sawyer 1993) that roughly 6/13 of all lines in any set are ordinary (only involve 2 points from the set) except when n=7. As the number of points goes to infinity, the lower bound goes to 1/2 of the lines (Green and Tao 2013). Therefore, we expect to have to test around 2-3 pairs of points on average before finding an ordinary line if we sample pairs of points at random.

This simple program just selects a random pair of points, then checks the distance from the line they form to a third point, which ranges over all points in the set. All three points are converted from radical root form to floats by radical_to_normal() before the distance is calculated by distance_to_line(). If the distance is below a threshold (indicating they are collinear), we set a sentinel to try again. Until every point tested passes above the threshold, we try, try again. (This threshold could be made much smaller and still work, of course.)

Since we test an expected constant number of point pairs, and we test n points for each pair, the algorithm runs in expected time O(n).


Preparing a multiple choice test Introduction
Note: this is not some kind of method to encourage cheating. As Cᴏɴᴏʀ O'Bʀɪᴇɴ already said, studying is the best solution for passing a test :3.
Consider the following answers to the multiple choice test:
ABCBCAAB

Here is a table which indicates whether the answers match:
    A B C B C A A B

A   1 0 0 0 0 1 1 0
B   0 1 0 1 0 0 0 1
C   0 0 1 0 1 0 0 0

This gives us the following numbers:
10000110, 01010001, 00101000

The challenge is to print these binary numbers. But it is important to see which letters are used in the multiple choice test. For example:
ABCDCDBCDABC

This highest letter is D, which is the 4th letter in the alphabet. Therefore, we need to output 4 different binary numbers. Namely:
100000000100, 010000100010, 001010010001, 000101001000

Note that you have to look at the highest letter. Consider the following example:
AACCACAC

Although the B is not used, we need to output the binary result for B. That means, the answer would be:
11001010, 00000000, 00110101

Task
Given the answers to a multiple choice test, output the binary numbers. You may assume that the input will be non-empty and only containing the letters [A-Z]
. Instead of ones and zeroes, you may also use true and false.

Test cases:
Input: ABBBABABA
Output: 100010101, 011101010

Input: AAAAAAAAA
Output: 111111111

Input: AFGHEEHFD
Output: 100000000 000000000 000000000 000000001 000011000 010000010 001000000 000100100

Input: Z
Output: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1

Input: ABCDCDBCDABC
Output: 100000000100, 010000100010, 001010010001, 000101001000

This is code-golf, so the submission with the least amount of bytes wins!

Python 3, 71
Saved 22 bytes thanks to Ogaday.
Saved 3 bytes thanks to DSM.
Saved a bunch of bytes thanks to an array of bools being valid.
*k,=map(ord,input())
x=65
while x<=max(k):print([v==x for v in k]);x+=1

Takes uppercase command line input.


Build an interpreter for "Goggle kids Code" Partially inspired by this question.

Overview

The execution of Goggle kids Code starts with an empty binary tape with 100 items, with the pointer starting at the index 0:

00000...
^

At the end of the execution, you can assume that the tape is implicitly outputted.

Instructions

Goggle kids Code is a simple language involving a stack-like tape.

/: Move the pointer right.
\: Move the pointer left.
>: Take two items from the tape, the left item and the current item. Zero the current item, move left, and set the item as 1 if left is larger than current, else 0.
=: Similar to >, but performs an equality comparison instead.

The only looping structure in Goggle kids Code is the repeat loop, which takes a strictly positive number on the right introduced by a x symbol. (So things like (...)x0 is impossible here.) The syntax for this is:

(...)xI

The parentheses can only contain single instructions, although you can introduce other instructions with commas.

Sample program + Explanation

((/,>)x4,/)x13

(         )x13  Do this 13 times:
 (   )x4            Do this 4 times:
  /                    Move right
   ,                   After that,
    >                  Greater than
        ,           After that,
         /          Move pointer right.

Another example that does something useful (fills 13 items from the tape with 1's):

(   )x13    Do this 13 times:
 /              Move right
  ,             After that,
   =            Equality

Rules

You can assume the tape pointer never wraps around.

The test cases won't abuse out-of-bounds tape-moving.

To simplify the solution, you are allowed to output part of the tape, as long as that part is modified.
You are allowed to have a different instruction mapping, but if you do that, please make sure to clarify which mapping you used.
You could ignore checking the commas in the source code, they'll always be there.

Instructions are always separated by the comma.

Test cases

The trailing 0 digits are omitted here, for compactness of example outputs.

((/,>)x4,/)x13  -> 0000000000000 (doesn't modify the tape)

(/,=,/)x13      -> 1111111111111

(/,=,/,/)x13    -> 1010101010101010101010101

(/,=)x13,/,=    -> 00000000000000000

(/,/,=,\)x3     -> 0100
```

Python 2, 131 126 123 110 104 bytes
Saved 13 bytes thanks to @dingledooper's approach of flattening nested list using backtick.
Saved 2 bytes thanks to @l4m2

p,t=0,[0]*100
for i in`input()`:
 if"/"<i:i=int(i);p+=i/3-1
 if i<2:t[p:p+2]=cmp(*t[p:p+2])==i,0
print t

Try it online! or Verify all test cases
Takes input from STDIN, where /\>=x are replaced with 6210*
Big idea:
Python 2 input() implicitly evaluates the string read from STDIN. Thus, reading modified input like ((6,1)*4,2)*13 returns a nested tuple of integers, aka
((6, 1, 6, 1, 6, 1, 6, 1), 2, (6, 1, 6, 1, 6, 1, 6, 1), 2, ...)

Note that loops containing single instruction must be terminated with comma, e.g (1,)*10.
Now that all loops have been automatically unrolled for us, we just have to flatten the resulting tuple, and decode the instructions.
To flatten the nested tuple, we simply convert it to string, then takes all numerical characters.


Roll Dungeons and Dragons dice I want to play Dungeons and Dragons, but I don't have any dice! Your challenge is to roll some D&D dice.

The input format specification in Backus-Naur form is:

<valid-input>  ::= <opt-integer> "d" <integer> <opt-modifier>
<opt-integer>  ::= | <integer>
<opt-modifier> ::= | "+" <integer>
<integer>      ::= "0" | "1" | "2" | "3" | "4" | "5" |
                   "6" | "7" | "8" | "9" | <integer> <integer>

The optional integer before the d is the number of dice to roll; it must be at least 1, and defaults to 1 if not supplied.

The required integer immediately after the d is the number of sides each die has; it must be at least 1. The sides of each die are distinct consecutive positive integers starting at 1.

The optional modifier may be +0, and it defaults to +0 if not specified.

For example, for the input 2d10+5, you generate two random numbers from 1 to 10 inclusive, add them together, and add 5. Then you will output the result.

If you receive invalid input, such as 2d, d20+, 0d4, 2d5+1+2, 2+2, or anything else that doesn't fit this format, you must output "Invalid input". Otherwise, you must output only a single random integer, weighted according to the input. For example, 3d6 should produce more 10s than 4s.

Test cases

Input      Minimum possible output    Maximum possible output
d1         1                          1
d6         1                          6
d1+3       4                          4
d20+3      4                          23
2d1        2                          2
2d6+2      4                          14
d01        1                          1
d01+0      1                          1
01d01+01   2                          2
3d20+10    13                         70

d          Invalid input
d0         Invalid input
d+0        Invalid input
d0+0       Invalid input
0d1        Invalid input
0d1+1      Invalid input
d1+        Invalid input
1d         Invalid input
1d1+       Invalid input
1d+1       Invalid input
2d+2d      Invalid input
d2+d2      Invalid input
d2+2+2     Invalid input
d2-1       Invalid input
-d2        Invalid input
-2d2       Invalid input
4*3        Invalid input
4*d2       Invalid input

This is code-golf, so the shortest code in bytes will win!

Perl, 109 95 93 96 89 bytes

s/^d/1d/;/^(\d+)d(\d+)(\+\d+)?$/;$d+=1+rand$2|0for
1..$1;$_=$1*$2?$d+$3:'Invalid input'

Requires the -p switch, which accounts for two of the bytes. Try it online on Ideone.

How it works

Because of the -p switch, a line is read from STDIN and stored in $_.
The command s/^d/1d/ prepends a 1 to $_ if it begins with a d, i. e., if the number of dice has not been specified.
The regular expression /^(\d+)d(\d+)(\+\d+)?/ checks if the line consists of a number, a literal d, another number and, optionally, a third number preceded by a + sign.

If there is a match, the numbers will be saved in $1, $2 and $3.

In this case, the input will be valid if and only if $1 and $2 are both positive.
$d += 1 + rand $2 | 0 adds a pseudo-randomly chosen integer from 1 to the specified number of sides to $d (initially treated as zero).
for 1 .. $1 does the above once for every integer between 1 and the number of dice.
The command $_ = $1 * $2 ? $d + $3 : 'Invalid input' does the following:

If $1 * $2 is zero, it sets $_ to Invalid input.
Otherwise, the input is valid and it sets $_ to the sum of the dice rolls and the modifier.

Because of the -p switch, Perl prints the contents of $_.
Since there a no further input lines, the script exits.


Find The Local Maxima And Minima Definition
The maxima and minima of a given function are the largest and smallest values of the function either within a given range or otherwise within the entire domain of the function.
Challenge
The challenge is to find the local maxima and minima of a given polynomial function using any method you may like. Don't worry, I will try my best to explain the challenge and keep it as simple as possible.
The input will contain all the coefficients of the single variable polynomial in either decreasing or increasing order of power (up to you). For example,

[3,-7,1] will represent \$3x^2 - 7x + 1\$
[4,0,0,-3] will represent \$4x^3 - 3\$

How To Solve Using Derivatives
Now, let's say our input is [1,-12,45,8], which is nothing but the function \$x^3 - 12x^2 + 45x + 8\$.

The first task is to find the derivative of that function. Since it is a polynomial function, so it is indeed a simple task to do.

The derivative of \$x^n\$ is \$n\times x^{n-1}\$. Any constant terms present with \$x^n\$ are simply multiplied. Also, if there are terms added/subtracted, then their derivatives are also added or subtracted respectively. Remember, the derivative of any constant numerical value is zero. Here are a few examples:

\$x^3 \to 3x^2\$
\$9x^4 \to 9\times4\times x^3 = 36x^3\$
\$-5x^2 \to -5\times2\times x = - 10x\$
\$2x^3 - 3x^2 + 7x \to 6x^2 - 6x + 7\$
\$4x^2 - 3 \to 8x - 0 = 8x\$

Now solve the equation by equating the new polynomial to zero and get only the integral values of \$x\$.

Put those values of \$x\$ in the original function and return the results. That should be the output.

Example
Let us take the example we mentioned earlier, i.e, [1,-12,45,8].

Input: [1,-12,45,8]
Function: \$x^3 - 12x^2 + 45x + 8\$
Derivative: \$3x^2 - 24x + 45 + 0 \to [3,-24,45]\$
Solving equation: \$3x^2 - 24x + 45 = 0\$, we get \$x = 3\$ and \$x = 5\$.
Now putting \$x = 3\$ and \$x = 5\$ in the function, we get the values \$(62,58)\$.
Output: [62,58]

Assumptions

Assume that all the input coefficients are integers. They can be in increasing or decreasing order of power.

Assume the input to be at least a 2-degree polynomial. If the polynomial has no integer solutions, you can return anything.

Assume that the final result will be integers only.

You can print the results in any order. The degree of the input polynomial would not be more than 5, so that your code can handle it.

The input will be valid so that the solutions of x are not saddle points.

Also, you are not forced to do it by the derivative method. You can use any method you feel like.
Sample Input And Output
[2,-8,0] -> (-8)
[2,3,-36,10] -> (91,-34)
[1,-8,22,-24,8] -> (-1,0,-1)
[1,0,0] -> (0)

Scoring
This is code-golf so the shortest code wins.

Jelly, 20 bytes

ASŒRḅ@Ðḟ
J’U×µṖÇḅ@€³

Try it online!

Explanation

ASŒRḅ@Ðḟ     Helper Function; find all integer solutions to a polynomial
             All integer roots are within the symmetric range of the sum of the absolute values of the coefficients
A            Absolute Value (Of Each)
 S           Sum
  ŒR         Symmetric Range; `n -> [-n, n]`
      Ðḟ     Filter; keep elements where the result is falsy for:
    ḅ@       Base conversion, which acts like the application of the polynomial
J’U×µṖÇḅ@€³  Main Link
J                             Range of length
 ’                    Lowered
  U          Reversed
   ×         Multiplied with the original list (last value is 0)
    µ        Begin new monadic chain
     Ṗ       Pop; all but the last element
      Ç      Apply last link (get all integer solutions of the derivative)
       ḅ@€³  Base conversion of the polynomial into each of the solutions; apply polynomial to each solution of the derivative.

The helper function in this program was taken from Mr. Xcoder's answer
here which was based off of Luis's answer here


Convert a decimal to a fraction Write a program that converts a decimal to a mixed, simplified fraction.

Sample input:

5.2

Sample output:

5 + (1/5)

The code with the shortest length in bytes wins.

Ruby, 43
y=gets.to_r;puts"#{y.to_i} + (#{y-y.to_i})"

Pretty straightforward.


...And Mexico will Pay for It! Donald Trump is very impressed with the work of the people on this site. He saw how amazing of a job you did helping Ben Carson, so he even hired you to build his wall. He thinks you're terrific. Now he needs your help again. While he has successfully built his wall, now he needs the Mexican government to pay for it. He wants to charge $1 million a mile, and he has told them that the U.S.-Mexico border is 1,989 miles long. However they are not quite sure this number is accurate, so they would like a to-scale visual representation as well. That's where you come in. You are to take this map:

and for every n (50 <= n <= 500) miles on the border draw a 25 pixel-length line, perpendicular to the slope of the border at that point. Using the scale on the right-hand side of the map, I've determined that 100 miles ~ 50 pixels. I've drawn a sample of the first 3 lines for n=60, but these are only approximate:

Notes:

The only input is n. Output should be the map image, with the lines added, drawn to the screen or saved in a raster image file (you can overwrite the original map file).
You can save the blank map file with whatever file name you want. It is a JPEG, but you can convert it to another common raster format if you prefer. Also, you can reduce the size of the image by up to 50%, as long as you keep the dimensions proportional, and your lines are still to scale.
Each line should be perpendicular to the slope of the border at that point. The slope should be calculated starting 50 miles before the point and ending 50 miles after the point.

Accuracy:

The slope of each line can have a margin of error of ±5°
The spacing between each line can have a margin of error of ±20 miles (10 pixels on the regular map).

Python 2 + numpy + OpenCV, 576 bytes

from cv2 import*
from numpy import*
n=input()/4
f="m.png"
i=imread(f)
b=array([0]*3)
y=array([165,195,225])
j=inRange(i,b,b+120)
k=inRange(i,y,y+25)
for x,y in zip(*where(j)):j[x,y]=k[x+3,y]-j[x+1,y]>1
j=j[506:732,152:557]
p=[array([11,9])]
for c in sorted(zip(*where(j)),key=lambda c:c[1]):r=range(p[-1][1]+1,c[1]+1);p+=map(array,zip(map(int,interp(r,*zip(p[-1],c)[::-1])),r))
for x,c in enumerate(p[25:-25:n]):s=-1/true_divide(*p[x*n+50]-p[x*n+25]);k=6/(1+s**2)**.5;line(i,*map(tuple,[(c+[int(k*s)+506,int(k)+152])[::-1],(c-[int(k*s)-506,int(k)-152])[::-1],b]))
imwrite(f,i)

This program is almost entirely ungolfed, and there are aspects of it that are somewhat inaccurate at the moment, but at least it works for the most part. Additionally, there is a little bit of hardcoding, but it's only for an approximate window enclosing the border and the coordinate of the first pixel on the border (the latter of which I will actually most likely remove later).
The image used by the program is halved in area (i.e. 1120 x 865), and so the length of lines drawn and the distance between lines is smaller.


Easier communication means… ○ circular edition! Based on this, but I was asked[1],[2] to do a graphical edition.

Task
Generate a circular display of the text EASIER COMMUNICATION MEANS FASTER CODING MEANS FEWER CODERS MEANS . Any uppercase font goes. The letter tops must face out of the circle. Either the space before FEWER must be at the bottom (6 o'clock) or (for brownie points) your text must rotate.

Octave, 168 bytes
for i=1:(n=nnz(s='CATION MEANS FASTER CODING MEANS FEWER CODERS MEANS EASIER COMMUNI')),text(sin(i/n*2*pi),cos(i/n*2*pi),s(i),'rotation',-i/n*360);axis([-2,2,-2,2]);end

Try it here


Remove leading and trailing zeroes Given a non-empty list/array containing only non-negative integers like this:

[0, 0, 0, 8, 1, 4, 3, 5, 6, 4, 1, 2, 0, 0, 0, 0]

Output the list with trailing and leading zeroes removed.

The output for this would be:

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

Some other test cases:

[0, 4, 1, 2, 0, 1, 2, 4, 0] > [4, 1, 2, 0, 1, 2, 4]
[0, 0, 0, 0, 0, 0] > nothing
[3, 4, 5, 0, 0] > [3, 4, 5]
[6] > [6]

Shortest code wins

Jelly, 2 bytes
Code:
t0

Explanation:
t   # Trim off...
 0  #  zero at both sides

Try it online!


The Partition Problem - Sorting Stacks of Boxes Just last night I was reading a book which had a chapter on the Partition Problem; the Partition Problem is basically about splitting a set of numbers into two smaller sets of equal size.
To visualize it, the book contained the following picture:

It shows how, given an input of k boxes, each with height n, you can create two stacks of boxes, each stack with half the height of the original stack (well, in this diagram, pile.)
If you were to write a function to do this, it might look something like:
>>> k = [3,4,3,1,2,3,3,2,1]
[3,4,3,1,2,3,3,2,1]

>>> partitionSolve(k)
[ [3,3,2,3], [1,4,2,3,1] ]

>>> sum(partitionSolve(k)[0]) == sum(partitionSolve(k)[1])
True

But this only solves for two stacks! What if we wanted to split the input into three equal stacks? Then we'd have to write another function!
>>> partitionSolveThree([3,4,3,1,2,3,3,2])
[ [3,4], [3,1,3], [2,3,2] ]

In fact, I want to be able to solve for N stacks:
>>> partitionSolveN(3, [2,1,1,2,3,1,2])
[ [2,2], [1,1,2], [3,1] ]

>>> partitionSolveN(4, [2,1,1,2,3,1,2])
[ [2,1], [1,2], [3], [1,2] ]

But, I'm lazy, and I don't want to have to start some language's shell every time I want to use this function, so I decide to create a program to do it for me.
The problem is, I can't figure out an efficient way to do it!
Your Task
Design a program which can solve the above problem, for any number N.
Your program should take input via stdin, and print its output to stdout.
Example:
C:\> echo 2343123321| solution.X
3323
14231

Input will be a single string of digits; the first specifying how many stacks the code should be broken into, and the rest represent the input stack. All numbers will be single digit, so you can think of it as a list delimited by empty strings ('').
The first character of input will be the N to solve for, so if the first character is a 6 your program will be expected to output 6 valid subsets, or an error. This number will always be between 1 and 9.
The rest of the input is the starting list, from which the sublists must be created. Each digit in here can be between 1 and 9, and they must all be used once and only once in the outputted sublists.
Output should then be a new-line delimited list of your output stacks, each stack should just be a sequence of the numbers within it.
Another few examples:
C:\> echo 334323321| solution.X
34
313
232

C:\> echo 3912743471352| solution.X
121372
97
4453

C:\> echo 92| solution.X
forty-two

If the given input has no solution, your program can print any error message it wants, as long as there are no digits in the error message.
Fewest number of bytes wins! Good luck!

Python 2, 321 317 321 319
import itertools as l
t=raw_input();e=0;g=l.permutations(int(k)for k in t[1:])
try:
 while not e:
  a=list(g.next());c=[sum(a[:i+1])for i in range(len(a))];s=c[-1];d=int(t[0]);f=s/d;assert f*d==s;r=range(f,s,f);e=set(r)<=set(c);b=[`k`for k in a]
 for k in r[::-1]:b.insert(c.index(k)+1,'\n')
 print ''.join(b)
except:''

Some examples:
echo 43 | python part.py

echo 3912743471352 | python part.py
9124
7342
7135

echo 342137586 | python part.py
426
138
75

Thanks to theonlygusti for fixing the stdin input, and shaving off some chars and to Maltysen for pointing out a typo.


Wolfram - 236

Pretty clunky right now, but at least it works.

f[x_,w_,c_]:=Module[{l=Length,d=Sqrt@CentralMoment[#,2]&,n,a,b,t,r},n=Length@x;a=Normalize/@LowerTriangularize@Array[Boole[Abs[#1-#2]<w]&,{n,n}]^2;{b,t,r}=If[d@x>c,{a,d@#>c&,l@#-1&},{Inverse@a,d@#<c&,-l@#+2&}];r@NestWhileList[b.#&,x,t]]


Probability of All Combinations of Given Events Given a sequences of events with probabilities between 0.0 and 1.0, generate and derive the probability of each combination occurring. You may presume that a sequence of numbers is provided in whatever construct your chosen language provides.

Here's an example; you may presume that the length of the sequence's combinations fit into memory:

{ 0.55, 0.67, 0.13 }

The program shall print each combination and the associated probability of that sequence occurring. A 1 shall denote that the event in that index of the input sequence occurred and a 0 shall denote that that event did not occur. The desired output is below (I don't care about printing the work, that's just for informational purposes of the algorithm):

[0,0,0] = (1 - 0.55) * (1-0.67) * (1-0.13) = 0.129195
[0,0,1] = (1 - 0.55) * (1-0.67) * (0.13)   = 0.019305
[0,1,0] = (1 - 0.55) * (0.67)   * (1-0.13) = 0.262305
[0,1,1] = (1 - 0.55) * (0.67)   * (0.13)   = 0.039195
[1,0,0] = (0.55)     * (1-0.67) * (1-0.13) = 0.157905
[1,0,1] = (0.55)     * (1-0.67) * (0.13)   = 0.023595
[1,1,0] = (0.55)     * (0.67)   * (1-0.13) = 0.320595
[1,1,1] = (0.55)     * (0.67)   * (0.13)   = 0.047905

This problem is tangentially related to calculating a "Cartesian product".

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

Haskell, 86 bytes

unlines.map(\p->show(fst<$>p)++" = "++show(product$snd<$>p)).mapM(\x->[(0,1-x),(1,x)])

Usage example:

Prelude> putStrLn $ unlines.map(\p->show(fst<$>p)++" = "++show(product$snd<$>p)).mapM(\x->[(0,1-x),(1,x)]) $ [0.55, 0.67, 0.13]
[0,0,0] = 0.12919499999999998
[0,0,1] = 1.9304999999999996e-2
[0,1,0] = 0.262305
[0,1,1] = 3.9195e-2
[1,0,0] = 0.157905
[1,0,1] = 2.3595e-2
[1,1,0] = 0.320595
[1,1,1] = 4.790500000000001e-2

Most of the bytes are spent for output formatting. If you are only interested in the probability vector it's only 29 bytes:

map product.mapM(\x->[1-x,x])

How it works:

                    mapM(\x->[(0,1-x),(1,x)])   -- for each number x in the input
                                                -- list make either the pair (0,1-x)
                                                -- or (1,x). Build a list with
                                                -- all combinations

    map(\p->                    )               -- for each such combination p
          show(fst<$>p)                         -- print the first elements
          ++" = "++                             -- then the string " = "
          show(product$snd<$>p)                 -- then the product of the second
                                                -- elements

unlines                                         -- joins with newlines


Reciprocal Fibonacci constant Seeing as there have been an awful lot of normal Fibonacci challenges, I decided that it might be interesting to calculate the Reciprocal Fibonacci constant - namely, the sum of the reciprocals of the Fibonacci sequence.

The challenge is to calculate the Reciprocal Fibonacci constant with the number of Fibonacci series to use digit given as input, i.e. an input of 10 means to calculate based on the reciprocals of the first 10 Fibonacci numbers.  In the likely case of a tie, shortest code wins.

The winner will be chosen in three weeks via standard code-golf rules.


Build a solver for the cow and chicken problem The cow and chicken problem is a traditional problem for introducing young students to the concept of systems of equations. It goes as follows:

  A farmer raises cows and chickens on his farm. His animals have a total of 24 heads and 68 legs. How many cows and how many chickens does he have?

The numbers of heads h and legs l can vary, but the idea of the problem is the same. This problem can't be solved by plugging in a one-variable formula; both variables (the number of cows k, and the number of chickens x) will always be involved in each formula that you can derive directly.

That being said, for this version of the problem, there is a formula k = l/2 - h that you can readily use to obtain the solution of 10 cows and 14 chickens, so it's not too interesting.

Here's a slightly different problem, this time involving cows and chickens who can have a different number of heads and legs.

Your task is to build a program that takes the following inputs (all positive integers):

hk, the number of heads a cow has.
lk, the number of legs a cow has.
hx, the number of heads a chicken has.
lx, the number of legs a chicken has.
h, the total number of heads.
l, the total number of legs.

: and output k and x, how many cows and chickens the farmer has.

However, depending on the input given, the problem has several states of solvability:

There is a solution in the nonnegative integers. The input 1 4 1 2 24 68 (which is the problem above) has the solution 10 14.
There is no solution in the nonnegative integers, but there is one in the nonnegative fractional numbers. The input 1 4 1 2 24 67 is an example of this, with a solution of 9.5 14.5.
There is no solution in the nonnegative numbers, but one in the integers in general. The input 1 4 1 2 24 36 is an example of this, with a solution of -6 30.
There is no solution in either the nonnegative fractional numbers or the integers in general, but one in the real numbers in general. The input 1 4 1 2 24 97 is an example of this, with a solution of 24.5 -0.5.
There is no solution at all. The input 2 4 1 2 24 68 is an example of this.
There are multiple solutions in the positive integers (and therefore infinitely many solutions in the real numbers). The input 2 4 1 2 24 48 is an example of this. If there is exactly one solution in the positive integers but infinitely many solutions in the real numbers (as is the case with the input 6 9 4 6 10 15 with a solution of 1 1), your solution can treat it as a case of this state.

Your program, given the inputs, must first output which state of solvability the problem has. Only if the problem is in the first state of solvability should you output how many cows and chickens there are, as any other solution is considered an "invalid problem".

The shortest code to do all of the above in any language wins.

Mathematica 359 314
About 200 characters went into determining which condition applies.
f@{a_, b_, c_, d_, i_, l_} :=
 Module[{s, t, z = "invalid problem", y = IntegerQ},
  t@n_ := y@n \[And] (n > 0);
  p@n_ := n \[Element] Rationals \[And] n > 0;
  q@n_ := n \[Element] Reals;
  w = Flatten@Quiet@Solve[{d*x + b*k == l, c*x + a*k == i}, {k, x}];
  s = {k, x} /. w;
  Which[w == {}, {5, z},
   Length[w] != 2, {6, z},
   True, If[And @@ (t /@ s), {1, s},
    Which[
     And @@ (p /@ s), {2, z},
     And @@ (y /@ s), {3, z},
     And @@ (q /@ s), {4, z},
     3 == 3, {7, z}]]]]

f[{1, 4, 1, 2, 24, 68}]
f[{7, 14, 9, 6, 25, 18}]
f[{1, 4, 1, 2, 24, 67}]
f[{1, 4, 1, 2, 24, 36}]
f[{1, 4, 1, 2, 24, 97}]
f[{2, 4, 1, 2, 24, 68}]
f[{2, 4, 1, 2, 24, 48}]
f[{1, 4, 1, 2, -23, (3 + I)^2/(5 - I)}]
f[{6, 9, 4, 6, 10, 15}]

{1, {10, 14}}
{2, "invalid problem"}
{2, "invalid problem"}
{3, "invalid problem"}
{4, "invalid problem"}
{5, "invalid problem"}
{6, "invalid problem"}
{7, "invalid problem"}
{6, "invalid problem"}

How it works
The  equations d*x+b*k==land c*x+a*k==i express the constraints in the general cow and chickens problem,where

a is "the number of heads per cow"
b is "the number of legs per cow"
c is "the number of heads per chicken"
d is "the number of legs per chicken"
i is "the number of  heads"
l is "the number of legs"
k is "the number of cows"
x is "the number of chickens".

Solve returns the real - valued solutions, if any exist, for the cows and chickens, as a list of 2 substitution rules, e.g.
{k->10, x-> 14}
If no solutions exist, an empty list is returned.
If the data cannot be processed, Solve will return a different number of elements.
The tests are performed in the following order.

If there are 0 solutions, condition 5 is satisfied

If the list of "solution"s has anything other than 2 elements, then condition 6 is satisfied .

If there are 2 solutions, then

if function t yields True, the solution is a pair of non-negative integers, and condition 1 is satisfied.
if function p yields True, the solution is a pair of  non negative rationals and condition 2 is satisfied.
if function q yields True, the solution is a pair of  non negative rationals and condition 3 is satisfied.
if function y yields True, the solution is a pair of  integers and condition 4 is satisfied.
Otherwise, condition 7 is satisfied.

Minor Variant of f
g@{a_, b_, c_, d_, i_, l_} :=
 Module[{s, t, z = "invalid problem", y = IntegerQ},
  t@n_ := y@n \[And] (n > 0);
  p@n_ := n \[Element] Rationals \[And] n > 0;
  q@n_ := n \[Element] Reals;
  w = Flatten@Quiet@Solve[{d*x + b*k == l, c*x + a*k == i}, {k, x}];
  s = {k, x} /. w;
  Which[w == {}, {5, z, w}, Length[w] != 2, {6, z, w}, True,
   If[And @@ (t /@ s), {1, s, w},
    Which[And @@ (p /@ s), {2, z, w}, And @@ (y /@ s), {3, z, w},
     And @@ (q /@ s), {4, z, w}, 3 == 3, {7, z, w}]]]]

g is f` with the additional property that it returns the output of Solve.
g[{1, 4, 1, 2, 24, 68}]
g[{7, 14, 9, 6, 25, 18}]
g[{1, 4, 1, 2, 24, 67}]
g[{1, 4, 1, 2, 24, 36}]
g[{1, 4, 1, 2, 24, 97}]
g[{2, 4, 1, 2, 24, 68}]
g[{2, 4, 1, 2, 24, 48}]
g[{1, 4, 1, 2, -23, (3 + I)^2/(5 - I)}]
g[{6, 9, 4, 6, 10, 15}]

{1, {10, 14}, {k -> 10, x -> 14}}
{2, "invalid problem", {k -> 1/7, x -> 8/3}}
{2, "invalid problem", {k -> 19/2, x -> 29/2}}
{3, "invalid problem", {k -> -6, x -> 30}}
{4, "invalid problem", {k -> 49/2, x -> -(1/2)}}
{5, "invalid problem", {}}
{6, "invalid problem", {x -> 24 - 2 k}}
{7, "invalid problem", {k -> 615/26 + (19 I)/26, x -> -(1213/26) - (19 I)/26}}
{6, "invalid problem", {x -> 5/2 - (3 k)/2}}

Problems falling under condition 6 have multiple solutions, as evidence by the equations.  The problem that falls under condition 5 returns an empty set (no solutions).
Note: element and and are single characters in Mathematica.


What type are my suffixes? Intro
So I've been wasting my time again researching suffix sorting algorithms, evaluating new ideas by hand and in code. But I always struggle to remember the type of my suffixes! Can you tell me which type my suffixes are?
Left-most what?
A lot of suffix sorting algorithms (SAIS, KA, my own daware) group suffixes into different types in order to sort them. There are two basic types: S-type and L-type suffixes. S-type suffixes are suffixes that are lexicographically less (Smaller) than the following suffix and L-type if it is lexicographically greater (Larger). A left-most S-type (LMS-type) is just that: A S-type suffix that is preceeded by a L-type suffix.
The special thing about these LMS-type suffixes is that once we sorted them we can sorted all the other suffixes in linear time ! Isn't that awesome?
The challenge
Given a string assume it is terminated by a special character that is less than any other character in that string (e.g. smaller than even the null byte). Output a type corrosponding char for each suffix.
You can freely choose which char to use for which type but I'd prefer L, S and * for L-, S- and LMS-type as long as they are all printable (0x20 - 0x7E).
Example
Given the string mmiissiissiippi output (when using L, S and *):
 LL*SLL*SLL*SLLL

For example the first L is due to the fact that mmiissiissiippi$ is lexicographically greater than miissiissiippi$ (the $ represents the added minimal character):
L - mmiissiissiippi$ > miissiissiippi$
L - miissiissiippi$  > iissiissiippi$
* - iissiissiippi$   < issiissiippi     and preceeded by L
S - issiissiippi$    < ssiissiippi$
L - ssiissiippi$     > siissiippi$
L - siissiippi$      > iissiippi$
* - iissiippi$       < issiippi$        and preceeded by L
S - issiippi$        < ssiippi$
L - ssiippi$         > siippi$
L - siippi$          > iippi$
* - iippi$           < ippi$            and preceeded by L
S - ippi$            < ppi$
L - ppi$             > pi$
L - pi$              > i$
L - i$               > $

Some more examples:
"hello world" -> "L*SSL*L*LLL"
"Hello World" -> "SSSSL*SSLLL"
"53Ab§%5qS"   -> "L*SSL*SLL"

Goal
I'm not here to annoy Peter Cordes (I'm so gonna do this on stackoverflow sometime); I'm just very lazy so this is of course code-golf ! The shortest answer in bytes wins.

Edit: The order of the chars is given by their byte value. That means compare should be like C's strcmp.
Edit2: Like stated in the comments output should be a single character for each input character. While I assumed that would be understood as "return a string" it seems at least 1 answer returns a list of single characters. In order to not invalidate the existing answers I will allow you to return a list of single characters (or integers which when printed result in only 1 char).

Tips for linear time:

It can be done in 2 parallel forward iterations or in a single backward iteration.
The state of each suffix depends only on the first 2 chars and the type of the second.
Scanning the input in reverse direction you can determine L or S like this: $t=$c<=>$d?:$t (PHP 7), where $c is the current char $d the previous and $t the previous type.
See my PHP answer. Tomorrow I will award the bounty.

Haskell, 64 53 48 42 bytes

(0!)
k!(x:y)|x:y>y=1:2!y|2>1=k:0!y
_![]=[]

Try it online!

Ungolfed, with Char instead of Int:

suffixes :: String -> String
suffixes = go 'S'
 where
   go :: Char -> String -> String
   go _ "" = ""
   go lorstar s | s > tail s = 'L' : go '*' (tail s)
                | otherwise  = lorstar : go 'S' (tail s)


Detect the Zeroless Numbers Zeroless numbers are numbers that do not contain 0 as one of their decimal digits.
Given an integer K, return the Kth zeroless number. K will be non-negative if you choose 0-indexing, or positive if you choose 1-indexing instead. Note that this is OEIS A052382.
This is code golf, so the shortest code in bytes wins.
Test cases
1-indexed:

1 -> 1
2 -> 2
9 -> 9
10 -> 11
16 -> 17
100 -> 121

0-indexed:

0 -> 1
1 -> 2
8 -> 9
9 -> 11
15 -> 17
99 -> 121

Jelly, 3 bytes

ḃ9Ḍ

Try it online!

How it works

ḃ9Ḍ  Main link. Argument: n (1-based index)

ḃ9   Convert n to bijective base 9.
  Ḍ  Convert the result from base 10 to integer.


Cheapo Enigma machine (Cops) For robbers' post, Cheapo Enigma machine (Robbers)
A cop's submission will consist of a program/function that accepts a single byte of data and return a single byte of data. Every possible input must produce a unique output. (In the other words, your function must be bijective)
Robbers will attempt to create the inverse function of yours using as short a code as possible. So your objective is to make your function difficult to invert.
You cannot use built-ins that have the sole purpose of hashing or encryption.
Your byte count cannot exceed 64 bytes. 0-byte solutions are not eligible for winning.
Input/Output format
8 bits (0 or 1), or a base-10 integer in range 1-256, 0-255 or -128 to 127. Can use standard I/O or file I/O. Function can also return a value as output. Input and output should belong to the same range (binary, 1-256, 0-255 or -128 to 127).
The robber will also be required to use this range for input and output.
Scoring
Ratio of your byte count to that of the best robber's attempt against you. Lowest score wins.
You are eligible to win (as a cop) only if a robber has attempted to defeat you. (This robber may be you)
Example
C++, uses 0-255 range, 31 bytes
int x;
cin>>x;
cout<<(x+1)%256;

Possible robber submission in C++, 32 bytes
int f(int x)
{return x?x-1:255;}

Using the same language or a similar algorithm isn't a requirement
This gives a score of 31/32 = 0.97 to both the cop and the robber.

Javascript, 11 8 bytes, Score: 8 / 5
x=>x^x/2

Simple implementation of gray code. Decoding usally needs a whole loop. Let's see who comes up with the smallest or even without a loop !


Convert CSV to Table The Challenge

Given a CSV input, output a proper unicode table using box characters.

Formatting

The table will be formatted using the following rules:

Column width will be equal to the longest value of that column
All table data will be left justified
Each table will assume the first csv row to be the header
The table will use the following characters for its borders:

┌  ┬  ┐  ├  ┼  ┤ └  ┴  ┘   ─  │

Example

Input:
Name,Age,Gender
Shaun,19,Male
Debra,19,Female
Alan,26,Male
George,15,Male

Output:
┌──────┬───┬──────┐
│Name  │Age│Gender│
├──────┼───┼──────┤
│Shaun │19 │Male  │
│Debra │19 │Female│
│Alan  │26 │Male  │
│George│15 │Male  │
└──────┴───┴──────┘

Rules

Standard loopholes apply
You may submit a full program, a function or a lambda
Input can be from a file, a program argument or any acceptable alternative
Output can be to a file, returned or any acceptable alternative
CSV input should take the same format as used in my example.
Shortest answer in bytes wins.

CSV input should take the following form:

Header1,Header2,Header3 newline
Column1,Column2,Column3 newline
Column1,Column2,Column3 optional_newline

Try (Dyalog) APL, 38 43 bytes

Last input line must have a trailing newline.
{{(⊃⍵)⍪⍉⍪↑¨↓⍉↑1↓⍵}s¨',',¨(s←1↓¨⊢⊂⍨⊢=⊃)¯1⌽⍵}

Try it online! In the offline version of Dyalog APL, execute ]boxing ON -style=min for the same effect.
Explanation
{ ... } an anonymous function where ⍵ represents the argument:
 ¯1 ⌽ ⍵ rotate the trailing newline to the front
 (s ←  ... ) define the function s as follows, and apply it
  1 ↓¨ drop the first character of each
  ⊢ ⊂⍨ line, split where
  ⊃ = ⊢ the first character equals the characters in the string
 ',' ,¨ then prepend a comma to each line
 s¨ apply the function s to each line
 { ... } now apply the following anonymous function:
  1 ↓ ⍵ drop the first element (the row headers)
  ↓ ⍉ ↑ transpose the list of rows into list of columns
  ↑¨ make each element (a list of entries) into a matrix of padded entries
  ⍉ ⍪ make into one-column matrix, then transpose into one-row matrix
  (⊃⍵) ⍪ put the argument's first element (the list of headers) on top`
Note: While the line drawing characters are not explicitly used in my solution, they are part of the APL character set, and would also be counted as single bytes.


Is my number a de Polignac number? A number is a de Polignac number if and only if it is odd and cannot be represented in the form p + 2n where n is a non-negative integer and p is a prime integer.

Task

Write some code that takes a positive integer and determines if it is a de Polignac number.  You may output two distinct values one for true and one for false.  You should aim to minimize your byte count.

Test Cases

For positive cases here's the OEIS

1, 127, 149, 251, 331, 337, 373, 509, 599, 701, 757, 809, 877, 905, 907, 959, 977, 997, 1019, 1087, 1199, 1207, 1211, 1243, 1259, 1271, 1477, 1529, 1541, 1549, 1589, 1597, 1619, 1649, 1657, 1719, 1759, 1777, 1783, 1807, 1829, 1859, 1867, 1927, 1969, 1973, ...

Here are some negative cases:

22, 57

Japt, 9 14 13 bytes

o!²mnU dj |Uv

Test it online! or Find all de Polignac integers under 1000.

Outputs 1 for falsy inputs and 0 for truthy.

Explanation

 o!²  mnU dj |Uv
Uo!p2 mnU dj |Uv  : Ungolfed
                  : Implicit: U = input integer (e.g. 9)
Uo                : Create the range [0..U), and map each item X to
  !p2             :   2 ** X.               [1, 2, 4, 8, 16, 32, 64, 128, 256]
      m           : Map each of these powers of 2 by
       nU         :   subtracting from U.   [8, 7, 5, 1, -7, -23, -57, -119, -247]
          d       : Return whether any item in the result is
           j      :   prime.                (5 and 7 are, so `true`)
             |    : Take the bitwise OR of this and
              Uv  :   U is divisble by (missing argument = 2).
                  : This gives 1 if U cannot be represented as p + 2^n or if U is even.
                  : Implicit: output result of last expression


Code that changes itself Forward:

Depending on what language you use and what user you are logged in as this challenge could be dangerous so proceed with Caution!  You could delete something, fork bomb yourself, or worse...

Challange:

Write a program of n bytes which creates n copies of itself on disk, modifies the first byte of the first copy to an 8-bit value of your choosing,  modifies the second byte of the second copy to an a bit-value of your choosing, ... , modifies the nth byte of the nth copy of the program to an 8-bit value of your choosing, and then executes all n of the modified copies synchronously starting with the first and ending with the last, the program should print "alive", then program should then exit.

Scoring: Lowest Score Wins

Score = (-1 * (Number of times "alive" is printed)) + number of bytes in your program

RULES

Infinite loops in the program or one of its creations will disqualify an answer.
Number of times alive is printed has to be less than 1024.

Why this interests me:

I think a lot about the relationships between biology and analogies between living things and computer programs.  One of the qualities of living things is that they know how to reproduce.  One of the factors of replication that make evolution possible is that the replication is not perfect.  If one were to design artificial life it should have a very compact method of reproducing itself.  This is why I am turning to the code golf community to see what sort of strange ideas are out there.  Sorry for all the edits to this question.

Perl, 167 - 973 = -806 142 - 55 = 87

Here's an entry in the proper spirit of this code challenge:

if($ARGV[0]=~s/r/X/){open F,$0;for(@x=split//,join"",<F>){
$c=$_++;open F,">$0~".++$x;print F@x;$_=$c}sleep 1;
fork||exit exec"perl $0~$_ @ARGV"for 1..@x}print"alive\n"

I forkbombed myself a few times in the process of writing this script. As a result, this version comes with a couple of safety features. First off is the sleep 1 just before the spawning loop. That leaves enough idle processing time to allow one to type killall perl, if and when such measures become necessary. The second safety feature is that the spawn loop is disabled by default. To run in full power, you need to supply the word reproduce as an argument on the command line.

(Seriously, it's embarrassing to acknowledge the number of times I've had to do a hard reboot today because of some bug in my script, before I finally got the balance right.)

The program ends up producing several thousand imperfect copies of itself, from which about one in eight succeeds in printing alive. Most of the copies have syntax errors and so don't get run. A handful of scripts run but produce invalid output.

Here's a sample test run. (Note that, due to the sleep, it takes several seconds before the spawning finally grinds to a halt and all the scripts stop running.)

$ mkdir run
$ cp changer run/
$ cd run
$ ls -l
total 4
-rw-r--r-- 1 breadbox breadbox 167 2013-07-19 21:35 changer
$ perl changer
alive
$ perl changer reproduce 2> /dev/null >> out
$ ls -l out
-rw-r--r-- 1 breadbox breadbox 2608 2013-07-19 21:35 out
$ ls -l out
-rw-r--r-- 1 breadbox breadbox 6404 2013-07-19 21:35 out
$ ls -l out
-rw-r--r-- 1 breadbox breadbox 9370 2013-07-19 21:35 out
$ ls -l out
-rw-r--r-- 1 breadbox breadbox 9370 2013-07-19 21:35 out
$ ls -l | wc -l
7691
$ grep -c alive out
973
$ cd ..
$ rm -r run/
$

Finally, I should note that the script has a bit of nondeterminism -- a common enough circumstance when starting up lots of child processes. As a result, the number of alives that get output varies a bit with each run. The highest count I've seen so far is 984, so I believe that it's not in any danger of exceeding the 1024 limit.


Hand patterns in a card game A deck of cards is the Cartesian product of S suits and R ranks.
Many, though not all, card games use S=4 and R∊{6,8,13}.
A hand of H cards is dealt from the deck.
Its distribution, a.k.a. "hand pattern", is an array that describes
how many cards you got from each suit, ignoring suit order (so, it's like a multi-set).
Given a distribution D satisfying len(D)=S, 1≤sum(D)=H≤S×R, 0≤D[i]≤R, D[i]≥D[i+1],
find the probability of it occurring.

Input: an integer R and an array D.

Output: the probability with at least 5 digits after the decimal mark;
 trailing zeroes may be skipped; scientific notation is ok.

Loopholes forbidden. Shortest wins.

Tests:

R    D               probability
13   4 4 3 2     ->  0.2155117564516334148528314355068773
13   5 3 3 2     ->  0.1551684646451760586940386335649517
13   9 3 1 0     ->  0.0001004716813294328274372174524508
13   13 0 0 0    ->  0.0000000000062990780897964308603403
8    3 2 2 1     ->  0.4007096203759162602321667950144035
8    4 2 1 1     ->  0.1431105787056843786543452839337155
8    2 2 1 0     ->  0.3737486095661846496106785317018910
8    3 1 1 0     ->  0.2135706340378197997775305895439377
15   4 4 3 2 1   ->  0.1428926269185580521441708109954798
10   3 0 0       ->  0.0886699507389162561576354679802956
10   2 1 0       ->  0.6650246305418719211822660098522167
10   1 1 1       ->  0.2463054187192118226600985221674877

See also Bridge hand patterns in Wikipedia.

EDIT: dropped unnecessary restriction H≤R

EDIT: added constraint H≥1

APL (Dyalog Unicode), 30 chars

×/!⍨,z,1÷((z←!∘≢⊢)⌸⊢),×∘≢!⍨1⊥⊢

Try it online!

Using @orlp’s formula.


Optimally solve the Flux Puzzle Flux is very similar to the Fifteen Puzzle.

However, instead of numbers, the squares are colors.

There are 4 colors: Red, Yellow, Blue, and Gray.

There are exactly 4 red squares, 4 yellow squares, 2 blue squares, 1 gray square, and 1 empty square.

The grid has 3 rows and 4 columns
A grid configuration is solved when the top row is exactly the same as the bottom row.
The middle row is not relevant when considering whether the board is solved.
You do not have to handle invalid input. Trust that there will be the correct number of each of the input symbols.

Input

You must accept an input of twelve of these characters that use these symbols to represent a square on the board:

RYGB_

These input characters must be interpreted to go across, then down.
It is your choice whether you require some other character (newline, EOF, whatever) to terminate input, or just go as soon as you've received 12 characters.

Example:

YRGYB_BRRYYR

which corresponds to to the board:

YRGY
B_BR
RYYR

Output

You must output the moves required for an OPTIMAL solution
These will use the characters LRUD for Left, Right, Up, Down. This is considered to be the "piece moves to the left", not the "emptiness moves to the left"

Example:

LURDRDLULDLU

And then print out the resulting board. For the example we've used so far:

RBYR
YYG_
RBYR

Other rules

Your program must run in under 15 seconds or it is disqualified.

Make sure to try it with the following board: RRRRBG_BYYYY
That board, with it's three symmetries, is the "hardest" possible board.

You may not use any external resources, or have any input data files.

Some stats

There are exactly 415,800 possible boards
There are exactly 360 "solution" boards
My program that I wrote to test this out runs in about 2 seconds in Java, without much optimization.

This program, with minimal golfing, is 1364 bytes.

Scoring

This is code-golf, fewest characters that meets the other requirements wins!

Smalltalk 497
|b R M s g a|
b:=Stdin nextLine.R:='D--R-L--U'.
M:=#((6 9)(4 6 9)(4 6 9)(4 9)(1 6 9)(1 4 6 9)(1 4 6 9)(1 4 9)(6 1)(4 6 1)(4 6 1)(4 1)).
s:=Set new.q:=OrderedCollection new.
a:=[:p :m|(s includes:p)ifFalse:[s add:p.q add:p->m]].
a value:b value:''.
[|x i n p|
x:=q removeFirst.p:=x key.i:=(p indexOf:$_).
(M at:i)do:[:m||v|
n:=p copy.n at:i put:(p at:i+m-5);at:i+m-5put:$_.
v:=(x value,(R at:m)).
(n to:4)=(n from:9)ifTrue:[
v printCR.(n splitForSize:4)map:#printCR.^self].
a value:n value:v]]loop.

Input:
YRGYB_BRRYYR

Output:
DLURRULDDLLU
YBYR
RGR_
YBYR

Exec. Time (bytecode, not jitted): 100ms
Input:
RRRRBG_BYYYY

Output:
DRRUULLDLURDDRRULULD
YBRR
GY_Y
YBRR

Exec. Time 2s unjitted; 0.8s jitted (most time spent in collection code)
Here is an ungolfed version for readability:
|b R M s g add|
b:=Stdin nextLine.
R:='D--R-L--U'.
M:=#((6 9)(4 6 9)(4 6 9)(4 9)
     (1 6 9)(1 4 6 9)(1 4 6 9)(1 4 9)
     (6 1)(4 6 1)(4 6 1)(4 1)).
s := Set new.
queue := OrderedCollection new.

add := [:p :m |
  (s includes:p) ifFalse:[
    s add:p.
    queue add:(p->m).
  ]].

add value:b value:''.

[
  |x i n p|

  x := queue removeFirst.
  p := x key.
  i := (p indexOf:$_).
  (M at:i) do:[:m |
    |v|
    n := p copy.
    n at:i put:(p at:i+m-5); at:i+m-5 put:$_.
    v:=(x value,(R at:m)).
    (n to:4)=(n from:9) ifTrue:[
      v printCR.
      (n splitForSize:4) map:#printCR.
      ^ self
    ].
    add value:n value:v]
] loop.


Simple encryption for people on a byte budget Overview

Your goal is to implement RC4 encryption. RC4 encryption, invented by Ron Rivest (of RSA fame), was designed to be secure, yet simple enough to be implemented from memory by military soldiers on the battlefield. Today, there are several attacks on RC4, but it's still used in many places today.

Your program should accept a single string with both a key and some data. It will be presented in this format.

\x0Dthis is a keythis is some data to encrypt

The first byte represents how long the key is. It can be assumed the key will no longer than 255 bytes, and no shorter than 1 byte. The data can be arbitrarily long.

Your program should process the key, then return the encrypted data. RC4 encryption and decryption are identical, so using the same key to "encrypt" the ciphertext should return the original plaintext.

How RC4 Works

Initialization

Initialization of RC4 is quite simple. A state array of 256 bytes is initialized to all bytes from 0 to 255.

S = [0, 1, 2, 3, ..., 253, 254, 255]

Key processing

Values in the state are swapped around based on the key.

j = 0
for i from 0 to 255
    j = (j + S[i] + key[i mod keylength]) mod 256
    swap S[i] and S[j]

Encryption

Encryption is accomplished by using the state to generate pseudo-random bytes, which are then XOR'd to the data. Values in the state are swapped around constantly.

i = j = 0
for each byte B in data
    i = (i + 1) mod 256
    j = (j + S[i]) mod 256
    swap S[i] and S[j]
    K = S[(S[i] + S[j]) mod 256]
    output K XOR B

Expected inputs and outputs

Non-printable characters will be shown in \xAB format.

Input: \x01\x00\x00\x00\x00\x00\x00
Output: \xde\x18\x89A\xa3
Output(hex): de188941a3

Input: \x0Dthis is a keythis is some data to encrypt
Output: \xb5\xdb?i\x1f\x92\x96\x96e!\xf3\xae(!\xf3\xeaC\xd4\x9fS\xbd?d\x82\x84{\xcdN
Output(hex): b5db3f691f9296966521f3ae2821f3ea43d49f53bd3f6482847bcd4e

Input: \x0dthis is a key\xb5\xdb?i\x1f\x92\x96\x96e!\xf3\xae(!\xf3\xeaC\xd4\x9fS\xbd?d\x82\x84{\xcdN
Input(hex): 0d746869732069732061206b6579b5db3f691f9296966521f3ae2821f3ea43d49f53bd3f6482847bcd4e
Output: this is some data to encrypt

Input: Sthis is a rather long key because the value of S is 83 so the key length must matchand this is the data to be encrypted
Output: \x96\x1f,\x8f\xa3%\x9b\xa3f[mk\xdf\xbc\xac\x8b\x8e\xfa\xfe\x96B=!\xfc;\x13`c\x16q\x04\x11\xd8\x86\xee\x07
Output(hex): 961f2c8fa3259ba3665b6d6bdfbcac8b8efafe96423d21fc3b13606316710411d886ee07

138 bytes, machine code (16-bit x86)

000000 88 9f 00 02 fe c3 75 f8 b9 01 00 89 fa b4 3f cd
000010 21 86 0d ba 00 03 b4 3f cd 21 89 dd 01 f6 02 9e
000020 00 03 8a 04 00 c3 86 87 00 02 88 04 46 45 39 cd
000030 75 02 31 ed 81 fe 00 03 75 e4 81 ee 00 01 31 db
000040 31 d2 ff c6 81 fe 00 03 75 04 81 ee 00 01 8a 04
000050 00 c3 88 c2 86 87 00 02 88 04 00 c2 89 d7 81 c7
000060 00 02 8a 15 89 d7 89 dd 31 db ba 00 03 b9 01 00
000070 b8 00 3f cd 21 87 fa 30 15 85 c0 74 0b 87 fa 43
000080 b4 40 cd 21 89 eb eb b8 cd 20

Running: save to codegolf.com, dosbox:

codegolf.com < input.bin

I don't know if this gonna count as an entry, but I've decided to do it
manually using hex editors. No compilers were used to do this.

ht editor actually has assembler, but honestly I did not know about this until
I was finished ¯\_(ツ)_/¯

Why & how

Why: mostly cause I wanted to check if I'm able to do this.

How: I've started with creating byte filled with NOPs and following with
a simple part: trying to write first loop that fills State with 0..255 values.
I switched to python and quickly wrote python version, just to have something to test against.
Next I was simplifying  python code into pseudo code / pseudo assembly.
Then I I was trying to write small pieces.
I decided it'll be easiest to read from stdin, so I started with something
small that will read single byte, then I added password reading and
key initialization. Figuring out what registers to pick took me some time.

I though adding de/encryption loop will be easy, but first I actually got
single byte decode and added whole loop afterwards.

Last step was getting rid of additional nops that I've left between
instructions when writing it (ofc that required fixing jumps as well).

You can see small gallery that I tried to make while progressing here.

Dissection

The program relies on some initial values after startup (see resources below).

00000000 889f0002                  mov         [bx+0200], bl
00000004 fec3                      inc         bl
00000006 75f8                      jnz         0x0

fill in State (at 0x200)

00000008 b90100                    mov         cx, 0x1
0000000b 89fa                      mov         dx, di
0000000d b43f                      mov         ah, 0x3f
0000000f cd21                      int         0x21
00000011 860d                      xchg        [di], cl
00000013 ba0003                    mov         dx, 0300
00000016 b43f                      mov         ah, 0x3f
00000018 cd21                      int         0x21

read length, read password, store password at ds:0x300

0000001a 89dd                      mov         bp, bx
0000001c 01f6                      add         si, si
0000001e 029e0003                  add         bl, [bp+0300]
00000022 8a04                      mov         al, [si]
00000024 00c3                      add         bl, al
00000026 86870002                  xchg        [bx+0200], al
0000002a 8804                      mov         [si], al
0000002c 46                        inc         si
0000002d 45                        inc         bp
0000002e 39cd                      cmp         bp, cx
00000030 7502                      jnz         0x34
00000032 31ed                      xor         bp, bp
00000034 81fe0003                  cmp         si, 0300
00000038 75e4                      jnz         0x1e

initialize State with a key (BP is used to traverse key, SI is used to
traverse State)

0000003a 81ee0001                  sub         si, 0100
0000003e 31db                      xor         bx, bx
00000040 31d2                      xor         dx, dx
00000042 ffc6                      inc         si
00000044 81fe0003                  cmp         si, 0300
00000048 7504                      jnz         0x4e
0000004a 81ee0001                  sub         si, 0100
0000004e 8a04                      mov         al, [si]
00000050 00c3                      add         bl, al
00000052 88c2                      mov         dl, al
00000054 86870002                  xchg        [bx+0200], al
00000058 8804                      mov         [si], al
0000005a 00c2                      add         dl, al
0000005c 89d7                      mov         di, dx
0000005e 81c70002                  add         di, 0200
00000062 8a15                      mov         dl, [di]

generate pseudo random value (in DL, DH is 0 thx to xor at 0x140)

00000064 89d7                      mov         di, dx
00000066 89dd                      mov         bp, bx
00000068 31db                      xor         bx, bx
0000006a ba0003                    mov         dx, 0300
0000006d b90100                    mov         cx, 0x1
00000070 b8003f                    mov         ax, 3f00
00000073 cd21                      int         0x21
00000075 87fa                      xchg        dx, di
00000077 3015                      xor         [di], dl
00000079 85c0                      test        ax, ax
0000007b 740b                      jz          0x88
0000007d 87fa                      xchg        dx, di
0000007f 43                        inc         bx
00000080 b440                      mov         ah, 0x40
00000082 cd21                      int         0x21
00000084 89eb                      mov         bx, bp
00000086 ebb8                      jmp         0x40
00000088 cd20                      int         0x20

store values that we need to preserve (SI - ints won't touch it, BX)
read char from input, xor it
quit if end of stream
output decoded char
restore values
loop to 0x40 (reuse xor on DX)

P.S. This probably could be even shorter, but this took 4 evenings, so not sure if I want to spend another one...

Tools and resources

ht editor - it has 16-bit disasm
hexplorer - mostly for it's mouse based copy/paste + insert/overwrite
dosbox - for debugging
X86 Opcode and Instruction Reference 1.12 and invaluable 16-bit ModR/M Byte
DOS INT 21h - DOS Function Codes
80386 Instruction Set note this is 386, but that's more than enough
Register values at DOS .COM startup


Look and Say sequence in any base We all already crossed the look and say sequence, and where asked to guess the next element. As its name tells it very well, you just have to say what you see :
1
1 1
2 1
1 2 1 1
1 1 1 2 2 1
3 1 2 2 1 1
...

But, what if we had to use a different base to describe it? You could count it in base 3 as this OEIS squence do. You could even do it in whatever base you want! That will be your job in this challenge.
Goal
Your have to write a program or a function that will accept two integers as input, either by STDIN or as function arguments. The first one will be the base b you have to work in, the second one will be the number n of elements to output. As this sequence never changes for b>=4, you will assume 0<b<5.
The only restriction you have is to NOT use any base-converison built-in :).
The original sequence (in base 10) is the sequence A005150. It cannot be constructed simply by using a formula, so you can help yourself with the different implementations present on the sequence's page.
Sample output
Here are the first 10 elements for each b
for b=1:
1
11
111
1111
11111
111111
1111111
11111111
111111111
1111111111

for b=2:
1
11
101
111011
11110101
100110111011
111001011011110101
111100111010110100110111011
100110011110111010110111001011011110101
1110010110010011011110111010110111100111010110100110111011

for b=3:
1
11
21
1211
111221
1012211
1110112221
101102110211
111021101221101221
1011012211011222110112211

for b=4:
1
11
21
1211
111221
312211
13112211
1113212221
311312113211
132113111221131221

You can use whatever formating you want as long it is readable (so you could output it in Python-like lists, separated by commas/newline...).
This is code-golf, so the shortest code in byte wins. Have fun !

Pyth, 34 bytes

L?gbQ+y/bQ%bQ]bjms`Md.usyMsrN8tE]1

Try it online!


Filter out and add up Task
The task is very simple. Given a non-empty string containing numbers, uppercase and lowercase letters, output the sum of the remaining numbers. For example:
a1wAD5qw45REs5Fw4eRQR33wqe4WE

Filtering out all the letters would result into:
 1   5  45   5  4    33   4

The sum of these numbers is 1 + 5 + 45 + 5 + 4 + 33 + 4 = 97. So the output would be 97.
Test Cases
a > 0
0 > 0
5 > 5
10 > 10
a0A > 0
1a1 > 2
11a1 > 12
4dasQWE65asAs5dAa5dWD > 79
a1wAD5qw45REs5Fw4eRQR33wqe4WE > 97

This is code-golf, so the submission with the least amount of bytes wins!

GS2, 2 bytes

Wd

Try it online!

How it works

W     Read all numbers.
      For input x, this executes map(int, re.findall(r'-?\d+', x)) internally.
 d    Compute their sum.


Text Processing #1: Hyphenation Background

This is the first part of a 3-hole golf course on text processing.
The over-arching idea is that if you take an input text and pipe it through the solutions to all three challenges (with a small amount of glue code), it will spit out a beautifully formatted paragraph.
In this first challenge, your task is a hyphenate a piece of text using given hyphenation patterns.

Input

Your program shall take two string inputs: a piece of text and a list of hyphenation patterns.
The first input is simply a non-empty string of printable ASCII characters and spaces; it will not contain line breaks or tildes ~.
The second input is a comma-delimited list of words, which consist of tilde-delimited syllables of lowercase ASCII characters.
An example is ex~cel~lent,pro~gram~ming,abil~i~ties.

Output

Your program shall modify the first input in the following way.
Any word (maximal substring of alphabetical ASCII characters) whose hyphenated lowercase version is found in the second input shall be replaced by that hyphenated version, but its case shall be preserved.
With the above example list, if the text contains the word Excellent, it shall be replaced by Ex~cel~lent; however, Excellently shall not be modified.
Your output shall be this modified string.

Detailed Rules and Scoring

You can assume the following about the inputs:

The first input contains no tildes, and no leading, trailing or repeated spaces. It is not empty.
The second input contains at least one word, and each word in it contains at least two syllables. Each syllable is non-empty.
The second input does not contain a word that occurs as a syllable in another word.

You can change the order of the two inputs, if desired, and optionally add one trailing newline to the output.

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

Test Cases

These are listed in the format 1st input [newline] 2nd input [newline] output.

Excellent programming abilities, you work excellently!
ex~cel~lent,pro~gram~ming,abil~i~ties
Ex~cel~lent pro~gram~ming abil~i~ties, you work excellently!

Superman (sometimes incorrectly spelled "Super-man") is super #&%@ing strong.
su~per,some~times,in~cor~rectly,spell~ing
Superman (some~times in~cor~rectly spelled "Su~per-man") is su~per #&%@ing strong.

IncONsISTent caPItalizATIon!
in~con~sis~tent,cap~i~tal~iza~tion
In~cON~sIS~Tent caP~I~tal~izA~TIon!

Such short words.
awk~ward
Such short words.

Digits123 are456cool789.
dig~its,dig~i~tal,are~cool
Dig~its123 are456cool789.

magic magic
ma~gic
ma~gic ma~gic

Any possible hyphenation error in this challenge is due to this hyphenation tool.

Retina, 88 bytes

+is`(?<![a-z~])([a-z~]+)(?=([a-z]+)+[^a-z~].*(?<=[\n,]\1(?(2)!)(?<-2>~\2)+[\n,]))
$1~
\n.*
<empty>

For counting purposes, each line goes into a separate file, \n are replaced with actual newline characters and <empty> is an empty file. For convenience, you can run the above code from a single file (where <empty> is an empty line) if you use the -s interpreter flag.


Jelly, 55 54 52 47 46 bytes

“=÷¡v⁺ʋiṂYR¤"bİɲ}Ñ1Ṇ⁴ẠV⁹yȥGẇ’“¿mŻ“p’Dx39jBo88V

There are more convoluted approaches in the revision history, but this simple one beats them all.

Try it online!

How it works

“=÷¡v⁺ʋiṂYR¤"bİɲ}Ñ1Ṇ⁴ẠV⁹yȥGẇ’

This is a numeric literal, encoded in bijective base 250, where the digits are taken from Jelly's code page. The chain's (left) argument and the return value are set to the encoded integer,
n := 0x21871c77d7d7af6fafafeff0c37f72ff7fbfbdbfdfef5edfeff8e3.

“¿mŻ“p’

A similar literal to the above one, but the second “ separates two encoded integers. The return value is replaced with the encoded array, [777711, 113].

Dx39

D converts the return value to decimal ([[7, 7, 7, 7, 1, 1], [1, 1, 3]]), then x39 repeats each individual integer/digit in the result 39 times. This yields a pair of arrays, which contains the digits before and after the 7-character high text, respectively. Let's call this array A.

jB

First, B converts the (left) argument n to binary. This yields the digits that form the 7-character high text, where each 88 has been replaced by 0.

Then, j joins the array A, using the binary array as separator.

o88

This performs logical OR with 88, replacing each 0 with 88.

V

We have the correct digits now, but in an array of 7's, 1's, 88's, and 3's. V implicitly turns this array into a string and then evals it, yielding a single integer.


Archimedes's cattle problem Compute, O friend, the number of the cattle of the sun which once grazed upon the plains of Sicily, divided according to color into four herds, one milk-white, one black, one dappled and one yellow. The number of bulls is greater than the number of cows, and the relations between them are as follows:
White bulls   \$= (\frac{1}{2} + \frac{1}{3})\$ black bulls + yellow bulls,
Black bulls   \$= (\frac{1}{4} + \frac{1}{5})\$ dappled bulls + yellow bulls,
Dappled bulls \$= (\frac{1}{6} + \frac{1}{7})\$ white bulls + yellow bulls,
White cows    \$= (\frac{1}{3} + \frac{1}{4})\$ black herd,
Black cows    \$= (\frac{1}{4} + \frac{1}{5})\$ dappled herd,
Dappled cows  \$= (\frac{1}{5} + \frac{1}{6})\$ yellow herd,
Yellow cows   \$= (\frac{1}{6} + \frac{1}{7})\$ white herd.
If thou canst give, O friend, the number of each kind of bulls and cows, thou art no novice in numbers, yet can not be regarded as of high skill. Consider, however, the following additional relations between the bulls of the sun:
White bulls + black bulls = a square number,
Dappled bulls + yellow bulls = a triangular number.
If thou hast computed these also, O friend, and found the total number of cattle, then exult as a conqueror, for thou hast proved thyself most skilled in numbers.
- Archimedes

Some clarifications:

black herd = black bulls + black cows, white herd = white bulls + white cows, etc.
\$(\frac{1}{2} + \frac{1}{3})\$ black bulls + yellow bulls, means only the black bulls get the coefficient
A square number is a number which can be represented as n * n where n is an integer
A triangular number is a number which can be represented as 1 + 2 + ... + (n - 1) + n

Task
Write a program/function to output the size of the smallest herd that could satisfy both the first and second parts of the above problem.
Output
You must output this number. Standard Output rules for integers apply.
Scoring
This is code-golf so shortest bytes wins.

Hash of decimal representation of answer for easy checking:

sha256 (with newline): 4fce7274734a18e9d27592e59480b50876da243de4caef4323f783339c456a7c
sha256 (without newline): 8500b362f3d6b5e96c775ca16d1475b519ff18669b0f6f3d35e4fb23d2c18d01

Inspired by The Archimedes Number - Numberphile

Sledgehammer, 67 66 26 bytes
-40 bytes thanks to @GregMartin and I also no longer have any idea about how my answer works
Completes in less than a few seconds!
⡇⣄⠀⠇⣺⠇⢞⡞⣵⣍⠪⢺⡇⠜⢂⡒⢃⠦⠲⣎⠇⠣⡔⢻⡦⠔

Mathematica code:
Floor[Divide[25194541,184119152] * (NumberFieldFundamentalUnits@Sqrt[4729494])^4658]

(the reason for the Divide is that by default Mathematica represents x/y as x * y^-1, which is half a byte longer in Sledgehammer).


Permutapalindromic numbers Given an integer N as input, output the Nth permutapalindromic number.

A permutapalindromic number is a strictly positive integer such that there is at least one permutation of its digits that results in a palindrome (i.e. a number that is its own reverse).

For example, 117 is a permutapalindromic number since its digits can be permuted into 171, which is a palindrome.

We consider that numbers like 10 are not permutapalindromic numbers, even though 01 = 1 is a palindrome. We impose that the palindromic permutation must not have a leading zero (as such, 0 itself is not permutapalindromic).

Numbers that are already palindromes are also permutapalindromic, since permuting nothing is valid.

Inputs and outputs

N may be either 0-indexed or 1-indexed. Please indicate which of the two your answer uses.
The input can be taken through STDIN, as a function argument, or anything similar in your language of choice. The output can be written to STDOUT, returned from a function, or anything similar in your language of choice.
The input and output must be in the decimal base.

Test cases

The following test cases are 1-indexed. Your program must be able to pass any of the test cases presented here in at most 1 minute.

N      Output

1      1
2      2
3      3
4      4
5      5
6      6
7      7
8      8
9      9
10     11
42     181
100    404
128    511
256    994
270    1166

Scoring

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

05AB1E, 15 14 13 bytes
Saved a byte thanks to Emigna! Code:
µNœvyJÂïÊP}_½

Explanation:
µ               # c = 0, when c is equal to the input, print N.
 N              # Push N, the iteration variable.
  œ             # Push all permutations of N.
   vyJ    }     # For each permutation...
      Â         #   Bifurcate, which is short for duplicate and reverse.
       ï        #   Convert the seconds one to int, removing leading zeros.
        Q       #   Check if they are not equal.
         P      #   Product of the stack.
           _    # Logical not.
            ½   # Pop a value, if 1 then increase c by 1.

Uses the CP-1252 encoding. Try it online!.


Sort and Re-apply Deltas of an Array It seems that any Simple Modification of deltas using a consistent function can almost always be done some other shorter way, Dennis.
Thus, the only solution I can imagine to make this harder, is to introduce some sort of inconsistent function.

Sorting.

Your task is to take an array of integers, sort their deltas, and recompile that to give the new array of integers.

EG.

For the input:

1  5 -3  2  9

Get the following Deltas:

  4 -8  5  7

Then, sort these Deltas, Yielding:

 -8  4  5  7

And reapply them, which gives:

1 -7 -3  2  9

Input/Output

You will be given a list/array/table/tuple/stack/etc. of signed integers as input through any standard input method.

You must output the modified data once again in any acceptable form, following the above delta sorting method.

You will receive N inputs where 0 < N < 10 where each number falls within the range -1000 < X < 1000

Test Cases

1 5 -3 2 9   -> 1 -7 -3 2 9
-5 -1 -6 5 8 -> -5 -10 -7 -3 8
-8 1 -7 1 1  -> -8 -16 -16 -8 1
8 -9 3 0 -2  -> 8 -9 -12 -14 -2
-5 -2 -5 5 0 -> -5 -10 -13 -10 0
-1 9 -1 -7 9 -> -1 -11 -17 -7 9

Notes

As stated in above, you will always receive at least 1 input, and no more than 9.
The first and last number of your output, will always match that of the input.
Only Standard Input Output is accepted
Standard loopholes apply
This is code-golf, so the lowest byte-count wins!
Have fun!

MATL, 8 bytes

1)GdShYs

Try it online!

1)   % Implicit input. Get its first entry
G    % Push input again
d    % Differences
S    % Sort
h    % Concatenate
Ys   % Cumulative sum. Implicit display


No co-prime neighbors Given a list of positive integers, output whether every adjacent pair of integers in it shares a prime factor. In other words, output truthy if and only if no two neighboring integers in the list are co-prime.

In yet other terms: given a list of positive integers [a1 a2 … an], output whether

　　　　　　　gcd(a1, a2) > 1 && gcd(a2, a3) > 1 && … && gcd(an−1, an) > 1.

The list will always contain at least two elements (n ≥ 2).

However…

This challenge is also restricted-source: the codepoints in your answer (whatever codepage it may be in) must satisfy the condition your program checks for.

For example, print 2 is a valid program. As a list of Unicode codepoints it is [112 114 105 110 116 32 50], which satisfies this condition: 112 and 114 share a factor of 2; and 114 and 105 share a factor of 3, etc.

However, main can not occur in a valid program (sorry!), as the Unicode codepoints of m and a, namely 109 and 97, are coprime. (Thankfully, your submission needn’t be a full program!)

Your program isn’t allowed to contain codepoint 0.

Test cases

Truthy:

[6 21] -> 1
[502 230 524 618 996] -> 1
[314 112 938 792 309] -> 1
[666 642 658 642 849 675 910 328 320] -> 1
[922 614 530 660 438 854 861 357 477] -> 1

Falsy:

[6 7] -> 0
[629 474 502 133 138] -> 0
[420 679 719 475 624] -> 0
[515 850 726 324 764 555 752 888 467] -> 0
[946 423 427 507 899 812 786 576 844] -> 0

This is code-golf: the shortest code in bytes wins.

MATL, 14 bytes

!TM1*Zdl2$Xdl-

This outputs a non-empty column vector of nonzero numbers as truthy, or a vector containing at least a zero entry as falsy.

Try it online!
Verify all test cases. The footer code contains an if branch to test truthyness/falsyness.
Since MATL uses ASCII, the source code is encoded as

[33 84 77 49 42 90 100 108 50 36 88 100 108 45]

which satisfies the requirement.

Explanation

!     % Implicit input. Transpose
TM    % Push input to latest function again
1*    % Multiply by 1 (does nothing, but matches factors)
Zd    % Compute gcd with broadcast: matrix of gcd of all pairs
l     % Push 1
2$    % The next function will use 2 inputs
Xd    % Extract diagonal 1 (i.e. that below the main diagonal) from the matrix
l-    % Subtract 1 from each entry. Implicitly display


Sum or difference of two powers of two Your challenge, should you choose to accept it, is, given an integer K >= 1, find non-negative integers A and B  such that at least one of the two conditions following hold:

K = 2^A + 2^B
K = 2^A - 2^B

If there does not exist such A and B, your program may behave in any fashion. (To clarify, A and B can be equal.)

Test cases

There are often multiple solutions to a number, but here are a few:

K => A, B
1 => 1, 0
15 => 4, 0                      ; 16 - 1 = 15
16 => 5, 4                      ; 32 - 16 = 16; also 3, 3: 8 + 8 = 16
40 => 5, 3                      ; 2^5 + 2^3 = 40
264 => 8, 3
17179867136 => 34, 11           ; 17179869184 - 2048 = 17179867136

The last test case, 17179867136, must run in under 10 seconds on any relatively modern machine. This is a code golf, so the shortest program in bytes wins. You may use a full program or a function.

Python 2, 43 bytes

lambda n:[len(bin((n&-n)+k))-3for k in n,0]

Say that n==2^a ± 2^b with a>b. Then, the greatest power-of-2 factor of n is 2^b, and we can find it using the bit-trick 2^b = n&-n. That lets us compute 2^b + n, which equals either 2^a + 2 * 2^b or just 2^a. Either one has the same-length bit-length as a*. So, we output the bit-lengths of n&-n and (n&-n)+n, computed from the lengths of their binary representations. Python 3 is one byte longer for parens in for k in(n,0)].

*Except that 2^a + 2^b with a==b+1 has one longer bit-length, but that's fine because we can interpret that as 2^(a+1)-2^b.


A multiplication table for the Cheela The Cheela (from the book Dragon's Egg by Robert L. Forward) are creatures that live on the surface of a neutron star. Their body is flat and circular with twelve eyes on the perimeter, so they naturally use a base-12 numbering system.

Among the Cheela, care of the hatchlings and education of the young are tasks carried out by the Old Ones. Since young Cheela need to be taught how to multiply, the Old Ones could use a multiplication table.

Your task is to produce a 12x12 multiplication table in base 12, like the following. Uppercase letters A and B are used for digits corresponding to decimal 10  and 11 respectively.

  1   2   3   4   5   6   7   8   9   A   B  10
  2   4   6   8   A  10  12  14  16  18  1A  20
  3   6   9  10  13  16  19  20  23  26  29  30
  4   8  10  14  18  20  24  28  30  34  38  40
  5   A  13  18  21  26  2B  34  39  42  47  50
  6  10  16  20  26  30  36  40  46  50  56  60
  7  12  19  24  2B  36  41  48  53  5A  65  70
  8  14  20  28  34  40  48  54  60  68  74  80
  9  16  23  30  39  46  53  60  69  76  83  90
  A  18  26  34  42  50  5A  68  76  84  92  A0
  B  1A  29  38  47  56  65  74  83  92  A1  B0
 10  20  30  40  50  60  70  80  90  A0  B0 100

The output shoud be printed on screen. The format should be as follows:

Numbers should be aligned to the right within each column.
Leading spaces before the first column, trailing spaces after the last column, or a trailing new line after the last row are allowed.
Separation between columns can be one space (as shown above) or more than one space, but the number of spaces should be consistent between columns. To measure column separation, consider that displayed numbers include any leading spaces that may have been necessary fo fulfill requirement 1 (so each number occupies three characters, the first of which may be spaces). For example, the table with two-space separation would be as follows:

  1    2    3    4    5    6    7    8    9    A    B   10
  2    4    6    8    A   10   12   14   16   18   1A   20
  3    6    9   10   13   16   19   20   23   26   29   30
  4    8   10   14   18   20   24   28   30   34   38   40
  5    A   13   18   21   26   2B   34   39   42   47   50
  6   10   16   20   26   30   36   40   46   50   56   60
  7   12   19   24   2B   36   41   48   53   5A   65   70
  8   14   20   28   34   40   48   54   60   68   74   80
  9   16   23   30   39   46   53   60   69   76   83   90
  A   18   26   34   42   50   5A   68   76   84   92   A0
  B   1A   29   38   47   56   65   74   83   92   A1   B0
 10   20   30   40   50   60   70   80   90   A0   B0  100

Computer storage on a neutron star is really expensive, so your code should use as few bytes as possible.

Extended challenge and bonus

Ideally your code should be reused in other parts of the universe, where other numbering systems may be in use. To that end, the challenge is optionally extended as follows: Your code accepts a number N as input and generates an NxN multiplication table in base N, with the above format.

Input may be from keyboard or as a function argument. The program or function should work for 2 ≤ N ≤ 36, using as digits the first N characters of the sequence 0, 1, ..., 9, A, B, ..., Z (uppercase letters)

This extended challenge is optional. If you follow this route, take 20% off your byte count (no need to round to an integer number).

Pyth, 27 * 0.8 = 21.6

VSQsm.[\ 4jkXj*dNQrT99rG1SQ

Try it online: Demonstration

Explanation:

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


Get the date of the nth day of week in a given year and month Introduction
Often, people refer to dates as the "second Friday in August, 2018" or the "fourth Sunday in March, 2012". But it's hard to tell what date that is! Your task to is to write a program that receives a year, a month, a day of the week, and an integer, and output that date.
Challenge

For input, you will get a year, a month, a day of week, and a number.

You can take input in any reasonable format, like using a string for the day of week or using a zero indexed weekday, or even take the year and month in a single string. Do explain your input format in your answer, though.

The integer that tells you which day of week in the month to target will be an integer from 1-5. The integer will never refer to a day of week that does not exist(e.g. the fifth Friday of February 2019, which doesn't exist).

Years will always be positive.

Your output can be in any reasonable format, including printing your final date. However, please explain your output format un your answer.

Providing the year and month in the output is optional. Also, you may assume the date is valid.

Example Input and Output
Consider this input, with the format being taking in the year as a 4 digit number, month as an integer, day of week as string, and the ordinal number as an integer:

2019, 3, Saturday, 2
2019, 12, Sunday, 1
2019, 9 Saturday, 1

Output:

March 9
December 1
September 7

This is code-golf, so shortest answer wins.

MediaWiki Template, 19 bytes

{{#time:r|{{{1}}}}}

This is a MediaWiki Template ParserFunctions port of this PHP answer

Note: #time use PHP strtotime internally.

Sample Input

  {{#time:r|second saturday of March 2019}}

Sample Output

  Sat, 09 Mar 2019 00:00:00 +0000


All Possible Matching Lists Implement a function that takes a list that consists of 0, 1 or 2, the list is called "pattern". Your job is to return all possible lists that match the pattern.

0 matches 0
1 matches 1
2 matches 0 and 1

Examples:

f([0, 1, 1]) == [[0, 1, 1]]
f([0, 2, 0, 2]) == [[0, 0, 0, 0], [0, 1, 0, 0], [0, 1, 0, 1], [0, 0, 0, 1]]
f([2, 1, 0]) == [[0, 1, 0], [1, 1, 0]]

Order does not matter, you can use a {set} data structure instead.

You cannot use regular expressions or other string pattern matching mechanisms. You cannot use a brute-force search.

Shortest solution wins.

Haskell, 49 characters

f[]=[[]]
f(2:r)=f(0:r)++f(1:r)
f(x:r)=map(x:)$f r

Interestingly this is exactly what I'd write even if this wasn't golf - except for removing spaces and calling the list's tail r rather than xs.