Generate the ticks of a graph A challenge many developers face when drawing a graph from scratch to plot some data is generating its ticks. In below graph, there are 6 horizontal ticks (1750, 1800, 1830, 1860, 1880 and 1900) and 11 vertical ticks (0, 10, 20, 30, 40, 50, 60, 70, 80, 90 and 100).

The horizontal bounds of the above graph goes from 1750 to 1900, which we'll call \$x_{min}\$ and \$x_{max}\$, respectively. For any \$x_{min}\$ and \$x_{max}\$ values, using \$n\$ ticks, there is a minimum multiple \$m\$ of a value \$s\$ that satisfies the following:

\$m \geq x_{min}\$

\$(m + s \times (n - 1)) \leq x_{max}\$; and

\$(m + s \times n) \gt x_{max}\$.

Let's suppose \$x_{min} = 0\$, \$x_{max} = 19\$ and \$n=4\$.

Consider \$s=4\$. The minimum multiple of \$s\$ that is greater or equal than \$x_{min}\$ is 0, therefore \$m=0\$. While the second condition is satisfied (\$0 + 4 \times 3 = 12 \leq x_{max}\$), the third condition is not (\$0 + 4 \times 4 = 16 \not \gt x_{max}\$).

Consider \$s=5\$. The minimum multiple of \$s\$ that is greater or equal than \$x_{min}\$ is 0, therefore \$m=0\$. Both the second (\$0 + 5 \times 3 = 15 \leq x_{max}\$) and the third (\$0 + 5 \times 4 = 20 \gt x_{max}\$) conditions are satisfied, therefore \$s=5\$.

Note that we need to minimize \$s\$: \$s=6\$ also satisfies all of the conditions, but we'll use \$s=5\$. In addition, since there could be more than one multiple of \$s\$ that satisfies all three conditions, we want also to minimize \$m\$ of the minimum found \$s\$.
Finding \$s\$ allows us to create \$n\$ equally-spaced ticks that can be used for our graph. The sequence goes from \$m\$ to \$m + s \times (n - 1)\$ with step \$s\$, so using \$s=5\$ as in the previous example, the generated ticks are \$\{0, 5, 10, 15\}\$. These ticks also gives the impression that our graph is sliding if we scale those properly, since they will only change if \$x_{min}\$ is a multiple of \$s\$. Below a gif that illustrates the generated ticks for \$(x_{min}, x_{max})\$ going from (0, 19) to (10, 29), with \$n=4\$.

Another way of thinking about this problem is generating the ticks beforehand. Let's suppose \$x_{min} = 4\$, \$x_{max} = 21\$ and \$n=3\$.

Consider \$s=5\$. This would generate the ticks \$\{5, 10, 15\}\$  and the next tick would be 20, which is not greater than \$x_{max}\$ (breaking the third condition). Note that here, \$m=5\$ since it's the first multiple \$m\$ of \$s\$ such that \$m \geq x_{min}\$.

Consider \$s=6\$. This would generate the ticks \$\{6, 12, 18\}\$ and the next tick would be 24, which is greater than \$x_{max}\$ (satisfying all conditions). We could also use \$s = 7\$, but we want to minimize this value.

Input

Two real numbers min and max representing the minimum and the maximum values of a range, where max is greater than min; and one positive integer (num) representing the number of ticks.

The input is guaranteed to generate an integer s, so you should not handle min = 0, max = 4, and num = 3 for example.
Output

A sequence of equally-spaced numbers with length num representing the ticks of a graph based on the previous explanation.

Test cases
# from gif
0, 19, 4 -> [0, 5, 10, 15]
1, 20, 4 -> [5, 10, 15, 20]
2, 21, 4 -> [5, 10, 15, 20]
3, 22, 4 -> [5, 10, 15, 20]
4, 23, 4 -> [5, 10, 15, 20]
5, 24, 4 -> [5, 10, 15, 20]
6, 25, 4 -> [10, 15, 20, 25]
7, 26, 4 -> [10, 15, 20, 25]
8, 27, 4 -> [10, 15, 20, 25]
9, 28, 4 -> [10, 15, 20, 25]
10, 29, 4 -> [10, 15, 20, 25]
11, 30, 4 -> [15, 20, 25, 30]

# m can be negative
-10, 1, 3 -> [-8, -4, 0]
-9, 2, 3 -> [-8, -4, 0]
-8, 3, 3 -> [-8, -4, 0]
-7, 4, 3 -> [-4, 0, 4]
-6, 5, 3 -> [-4, 0, 4]
-5, 6, 3 -> [-4, 0, 4]
-4, 7, 3 -> [-4, 0, 4]
-3, 8, 3 -> [0, 4, 8]
-2, 9, 3 -> [0, 4, 8]
-1, 10, 3 -> [0, 4, 8]

# num can be 1
0, 3, 1 -> [0]
1, 4, 1 -> [3]
2, 5, 1 -> [3]
3, 6, 1 -> [4]
4, 7, 1 -> [6]
5, 8, 1 -> [6]
6, 9, 1 -> [8]
7, 10, 1 -> [9]
8, 11, 1 -> [9]
9, 12, 1 -> [12]

This is code-golf, so shortest code in bytes wins. Default I/O methods apply.

J, 30 28  38 bytes
1 :'](]*i.@u+>.@%),(]+0 0-:|~)u>.@%~-'

Try it online!
This is a J adverb modifing n, the number of ticks, and taking the max and min as left and right args, respectively.  Called like:
19 (4 f) 0

u>.@%~- Calculates step size by dividing n into the difference between the max and min.

,(]+0 0-:|~) Adds one to the step size if the step size evenly divides both endpoints.

]* The step size times...

i.@u Produces range 0..n-1
+ Add elementwise to...
>.@% The ceiling of >.@ the min divided by the step size % -- adjusts so the first tick starts where we want.


Random Golf of the Day #2: Numbers from a Normal Distribution About the Series

First off, you may treat this like any other code golf challenge, and answer it without worrying about the series at all. However, there is a leaderboard across all challenges. You can find the leaderboard along with some more information about the series in the first post.

Although I have a bunch of ideas lined up for the series, the future challenges are not set in stone yet. If you have any suggestions, please let me know on the relevant sandbox post.

Hole 2: Numbers from a Normal Distribution

I can't believe this hasn't been done yet! You're to generate random numbers, drawing from a normal distribution. Some rules (the majority of them are probably automatically covered by most submission, but some of them are in place to ensure consistency of results between vastly different languages):

You should take two non-negative integers as input: a seed S and the amount N of numbers to return. The output should be a list of N floating point numbers, drawn from a normal distribution with mean 0 and variance 1. Whenever your submission is given the same seed S it should produce the same number. In particular, if it is called once with (S, N1) and once with (S, N2), the first min(N1, N2) entries of the two outputs should be identical. In addition, at least 216 different values of S should produce different sequences.
You may use any built-in random number generator that is documented to draw numbers from an (approximately) uniform distribution, provided you can pass S on to it and it supports at least 216 different seeds. If you do, the RNG should be able to return at least 220 different values for any given number you request from it.
If your available uniform RNG has a smaller range, is not seedable, or supports too few seeds, you must either first build a uniform RNG with a sufficiently large range on top of the built-in one or you must implement your own suitable RNG using the seed. This page may be helpful for that.
If you don't implement an established algorithm for generating normal distributions, please include a proof of correctness. In either case, the algorithm you choose must yield a theoretically exact normal distribution (barring limitations of the underlying PRNG or limited-precision data types).
Your implementation should use and return either floating-point numbers (at least 32 bits wide) or fixed-point numbers (at least 24 bits wide) and all arithmetic operations should make use of the full width of the chosen type.
You must not use any built-in functions directly related to normal distribution or Gaussian integrals, like the Error function or its inverse.

You may write a full program or a function and take input via STDIN, command-line argument, function argument or prompt and produce output via return value or by printing to STDOUT (or closest alternative).

S and N will be non-negative integers, each less than 220. Output may be in any convenient, unambiguous list or string format.

This is code golf, so the shortest submission (in bytes) wins. And of course, the shortest submission per user will also enter into the overall leaderboard of the series.

Leaderboard

The first post of the series generates a leaderboard.

To make sure that your answers show up, please start every answer with a headline, using the following Markdown template:

# Language Name, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

# Ruby, <s>104</s> <s>101</s> 96 bytes

(The language is not currently shown, but the snippet does require and parse it, and I may add a by-language leaderboard in the future.)

R, 68 bytes

function(S,N){set.seed(S);sqrt(-2*log(runif(N)))*cos(2*pi*runif(N))}

This uses the runif() function, which generates random deviates from a uniform distribution. The seed for the random number generation is specified using set.seed(), which by default uses the Mersenne-Twister algorithm with a period of 2^19937-1.

The result is an R vector of length N containing the computed standard normal deviates.

This uses the Box-Muller method: For two independent uniform random variables U and V,


Generate all Sublist Partitions Given a non-empty list of integers, output every possible partitioning of the list where each partition is a non-empty sublist.

So for the list [1, 2, 3, 4] the result is:

[[1, 2, 3, 4]]
[[1, 2, 3], [4]]
[[1, 2], [3, 4]]
[[1, 2], [3], [4]]
[[1], [2, 3, 4]]
[[1], [2, 3], [4]]
[[1], [2], [3, 4]]
[[1], [2], [3], [4]]

The order of the lists in the output does not matter, so [[1, 2, 3, 4]] could be first, last, or wherever. The order of the elements must be preserved.

This is code-golf, so shortest answer wins.

Related: Partition a list!

Retina, 27 19 bytes

Byte count assumes ISO 8859-1 encoding.

+1%`,
;$'¶$`];[
;
,

Try it online!

Explanation

Of course this computes all partitions using string processing. The basic idea is that we can generate all partitions by deciding for each , individually whether or not we want to split the list there. This kind of stuff can be done in Retina by matching each , in turn and using a replacement which gives both possible outputs.

The input acts as the base case: the partition where all elements are still in a single list.

+1%`,
;$'¶$`];[

Now we repeatedly (+) match the first (1) comma (,), on each line (%) (treating that line as a separate string, which is relevant for $' and ``$1 ` in the substitution).

That comma gets replaced with:

;   A semicolon. This is just a stand-in for the comma, so we know we've already
    processed it and it won't be substituted again by the next iteration.
$'  Everything after the match. This completes the first (unchanged) version of
    the current line.
¶   A linefeed. Since the next iteration will scan for all lines again, this doubles
    the number of strings we're working with.
$`  Everything before the match. This completes the second (split) version of
    the current line.
];[ A semicolon around which we split the list.

Remember that everything in front of the match and after the match remains in the string anyway, so the full result is actually $`;$'¶$`];[$' which explains why we insert the suffix and prefix in that order.

This loop stops once all commas are gone.

;
,

Finally, replace the semicolons with commas again to match the input format.


A Change in Perspective In this challenge you will write a piece of text which when viewed from two different angles will create two different programs.
Your string as viewed from above must take a string containing only characters ASCII 10, 32 - 126 and output it as viewed from above.  Additionally your program when viewed from the left must take a string containing only characters ASCII 10, 32 - 126 and output it as viewed from the left.
A string viewed from above will be the first non-space character in every column of the string, or a space if no such character exists, in the order of the columns.
Here is a Haskell program that implements this:

stitchZip (' ' : b) (c : d) = c : stitchZip b d
stitchZip (a : b) (c : d)   = a : stitchZip b d
stitchZip [] x = x
stitchZip x [] = x

main = getContents >>= (putStr . foldr1 stitchZip . lines)

Try it online!
A string viewed from the left will be the first non-space character in every row of the string, or a space if no such character exists, in the reverse order of the rows. We reverse the order of the rows since our left hand would be towards the bottom of the string.
Here is a Haskell program that implements this:
stitch ' ' y = y
stitch x y = x

main = getContents >>= (putStr . reverse . map (foldl stitch ' ') . lines)

Try it online!
Your program may use characters outside of that ASCII range, but for layout purposes all characters (other than newlines) are considered to have a width of 1.  As a side effect of how the views work, your programs cannot have newlines in them (although your string almost certainly will).
Scoring
Your score will be the number of non-space characters in your submission plus the number of space characters that appear in the two programs.
For example if your program were:
sc  e ex mp e
g
        a
   r

d
           l
  o

you would score 16 since there are 14 non whitespace characters in the submission, and each program (score example and old rags) has 1 space.
Your goal is to have as low a score as possible.

Jelly, score 9 + 0 = 9

 Z
       ⁶
      €
     ɗ
    o
   Ḣ
  ḟ
 Ṛ
Ỵ

From the top:

ỴZḟḢoɗ€⁶

Try it online! (or see it self-operate)

From the side:

ỴṚḟḢoɗ€⁶Z

Try it online! (or see it self-operate)

How?

Ỵ Z|Ṛ ḟḢoɗ€⁶ [Z]  - Link list of characters:
Ỵ                 - split at newline characters
  Z               - | top: transpose to get columns
    Ṛ             - | side: reverse the lines
           ⁶      - set the right argument to a literal space character
          €       - for each (x = column (top) OR line (side)):
         ɗ        -   last three links as a dyad - i.e. f(x, space)
      ḟ           -     filter discard (spaces from x)
       Ḣ          -     pop & yield the head (first remaining character or 0 if none left)
        o         -     logical OR (with space character) (replace a 0 with a space)
                  - | top: no code remaining
              Z   - | side: transpose (at this point a no-op since we have a flat list)


Vim - surround comment line with comment character Today I realised that I often like to define sections in my code like so:

####################
# Helper Functions #
####################

But that it's tedious to do. Assuming I have a line such as this:

# Helper Functions #

What is the shortest set of vim keystrokes to wrap it in a #? Shift does not count as a keystroke in this challenge.

Test cases:

Input: "#test test test#"
Output:
################
#test test test#
################

Input: "#this is a nice block comment#"
Output:
##############################
#this is a nice block comment#
##############################

Input: "# s p a c e s must be supported a l s o#"
Output:
########################################
# s p a c e s must be supported a l s o#
########################################

11 8 7 keystrokes

YpVkr#p

Yp - duplicate current line, leaving the cursor at the lower of the two
V - enter visual line mode
k - go up and select both lines
r# - replace every selected character with #. Leaves visual mode and leaves cursor at the upper line.
p - put the yanked line (the original) on the next line.

(thanks to doorknob for reminding Y=yy)


Python 3, 97 bytes

lambda n:[round(10**(i/n+2-(n<25)))+((.4<i/n<.67)-(.9<i/n<.92))*(n<25)+(i==185)for i in range(n)]

The output values scaled from 1 to 10 are well-approximated by an exponential interpolation:
10**(i/n)

Multiplying by 10 for 6, 12, 24 and 100 for 48, 96, 192 then rounding to the nearest integer
round(10**(i/n+2-(n<25)))

gives the right answers for all but 16 values, which gives errors of ±1.
n   i   est val  diff
6   3   32  33  -1
6   4   46  47  -1
12  5   26  27  -1
12  6   32  33  -1
12  7   38  39  -1
12  8   46  47  -1
12  11  83  82  1
24  10  26  27  -1
24  11  29  30  -1
24  12  32  33  -1
24  13  35  36  -1
24  14  38  39  -1
24  15  42  43  -1
24  16  46  47  -1
24  22  83  82  1
192 185 919 920 -1

For n<=24, most of these errors are for inputs values in the interval 10/24<=i/n<=6/24. There's one other error for n==24 that trickles down to n==12, and one error for n==192. We fudge these errors by adding or subtracting 1 to the estimate.


An unintentional-looking but crash-causing bug There are a range of questions revolving around this concept, but these all seem to just involve causing a crash, resulting in many answers which are very obviously designed to cause a crash. So the challenge I set you is to write some plausible code (although what the codes supposed "intention" is I leave up to you), that crashes either the entire target OS, or just itself, in a way which is not immediately obvious. (I realize that what counts as "immediately obvious" is subjective, but hopefully the challenge is still reasonably clear).

The winner is the answer with the most votes after 5 days.

C, linux. Crashes system if run as root

/* Fork child process, wait 5 seconds and kill it */
pid_t pid = fork();
if(pid =! 0) {
    /* Parent */
    sleep(5);
    kill(pid, 11);
}
else {
    /* Child process. Would contain some code */
}

By changing != to =!, an innocent comparison is turned into an assignment. And given that pid 1 is init, and killing init causes a kernel panic, this is not code you would want to run as root :)


Line-wrap into proper columns Input will be one or more space separated characters followed by a long string on STDIN or as an argument when called from the shell.

a C
WAtcIaElCpVqDRavOUejlgumcRCpfIWlaRFZpIoPYsWjsBSdlYfitfAPHpemiLpjaHheUGpFVQoZCnSCFgvpVzcoibdffoPRoJJwLIjVicPCdcvITXaQDjtMgrxQMZCkZNFmNqwGQYaSyPpdLOkAVHGVoVBiIksZCQHEaIxcRGwpIAmlChuhGEDajeJVXoCwFFuIvhEoqMuwrCDmZPcQxeaqJjynGWVjSaCCxWfupDbbEEFufDyealmbLxKfwlWCsSXwpPtuayxNVCodeEjeCIeHBYioeTogujuUFlWydOwInWGbsvlSwlwgfQaAmNTWPjsgqSCGzsJYfqGklpeLujFyrZJmNymUzpXLTkZcyPgPakAXTTfKlnnTCkjxxSZltwnLMOUCxlHOtLIUTqcbejXqyrwQgMaPUKcHBDZwMrCgwfVZUzxbdODBbBqEbpFLUOcPpVmsgLnfMXRWaddGnK

Your task is to line-wrap the string at a suitable length so that there is at least one column completely filled by each input character. All lines should be wrapped to the same length (except possibly the last one if it's shorter.)

In this case, the solution could be wrapping at 50 characters giving the output

WAtcIaElCpVqDRavOUejlgumcRCpfIWlaRFZpIoPYsWjsBSdlY
fitfAPHpemiLpjaHheUGpFVQoZCnSCFgvpVzcoibdffoPRoJJw
LIjVicPCdcvITXaQDjtMgrxQMZCkZNFmNqwGQYaSyPpdLOkAVH
GVoVBiIksZCQHEaIxcRGwpIAmlChuhGEDajeJVXoCwFFuIvhEo
qMuwrCDmZPcQxeaqJjynGWVjSaCCxWfupDbbEEFufDyealmbLx
KfwlWCsSXwpPtuayxNVCodeEjeCIeHBYioeTogujuUFlWydOwI
nWGbsvlSwlwgfQaAmNTWPjsgqSCGzsJYfqGklpeLujFyrZJmNy
mUzpXLTkZcyPgPakAXTTfKlnnTCkjxxSZltwnLMOUCxlHOtLIU
TqcbejXqyrwQgMaPUKcHBDZwMrCgwfVZUzxbdODBbBqEbpFLUO
cPpVmsgLnfMXRWaddGnK

The fifteenth (a) and twenty-seventh (C) all form a single column of the given input characters.
The last line may or may not be complete.

There can be more than one solutions. Any one of them can be considered valid.
Returning the string as-is is NOT allowed. (For those claiming that it forms one-row columns). The columns of the input characters must have at least two rows. You may assume that the input string is longer than 10 characters.
If there is no possible solution, your program must indicate this in some way(return status, printing "no solution", etc.) which you must mention.
Input will only include [a-zA-Z]

This is code-golf

Here's the actual program(python) that I use to generate these strings.

import random

a = 10
b = 50

s = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
for i in xrange(a):
    c = ''
    for j in xrange(b):
        c += (random.choice(s))
    print c

I then rectangle-edit to get columns full of input characters and strip newlines, deleting random number of characters from the end of the last line.

GolfScript, 73 characters
n%(' '-:C;~:T,,1>{T/zip{.,1>*.&.,1=*}%''*C&C=},.{0=T/n*}{'no solution'}if

Breaks at the first position which is possible. The input must be given on STDIN in the format specified in the question.
Example (online):
X Y
abcdeXfYghijklmnXoYpqrstuvwXxYyzXYZ

abcdeXfYghi
jklmnXoYpqr
stuvwXxYyzX
YZ

Annotated code:
n%               # Split the input at newlines
(' '-:C;         # Extract the first line, remove all spaces
                 # and assign the resulting string to variable C
~:T              # Take the second line and assign this string
                 # to variable T
,,1>             # Makes an array [1 2 3 ... L-1] where L is the
                 # length of T
{                # A filter block {...}, selects all possible
                 # line wrap positions from this array
  T/             #   Test the current length by splitting T (input)
                 #   in pieces
  zip            #   Transpose the result (i.e. we now have a array
                 #   of strings representing the columns)
  {              #   For each column
    .,1>*        #     Is the length greater than one, then keep the column
                 #     else transforms it to the empty string (string * 0)
    .&           #     "and"s the string with itself, i.e. the result
                 #     is a string of the distinct characters in the column
    .,1=*        #     If the length is 1 (i.e. only one character) keep
                 #     the column, otherwise reduce it to the empty string
  }%
  ''*            #   Combine the resulting characters into a string again
  C&C=           #   Check if this string contails all characters from C
},
.{               # If the filter returns at least one possible wrap position
  0=             #   Take the first one
  T/n*           #   Split the string and join again with newlines
}{               # Else
  'no solution'  #   Return 'no solution'
}if              # Endif


Restaurant Shorthand Goal

Sometimes dinner menus can have long winded names.  It's much easier for the waiter to write an abbreviation that unambiguously identifies the dish.

For example, given this list:

beef burger
chicken burger
chicken nuggets

The abbreviation c n matches chicken nuggets.
The abbreviation bur matches beef burger and chicken burger.

Write a program of function that identifies one or more items that match an abbreviation.

Input

The abbreviated string to find.
A list of items to search.

You may change this order and use any suitable data types.

Output

If the abbreviation does not match any items: Not found
If the abbreviation unambiguously matches an item: output the unabbreviated item.
If the abbreviation ambiguously matches several items: output a comma separated list of words that would make the selection unambiguous, followed by a question mark.  The order is not important.  Extra spaces are permitted.

Matching rules

Each word in the abbreviation and the items is considered separately.  If an abbreviated word matches the start of an item word, the item is a potential match.  If none of an item's words start with any if the abbreviated words, that item is not a match.

Abbreviated words can be in any order.

An abbreviated word cannot be used to match multiple item words and visa-versa.

Abbreviations only match the start of words.

Assume no item will contain all of the words of another item.  For example, you will never have beef burger and beef cheese burger.

Test Cases

Given this list:

beef burger
crispy chicken burger
grilled chicken burger
chicken nuggets
chocolate cone
strawberry cone
vanilla cone

These abbreviation give the specified output:

fish           Not found
cones          Not found
chicken cone   Not found
nilla          Not found
v              vanilla cone
be             beef burger
c n            chicken nuggets
b b            beef burger
c b c          crispy chicken burger
c b            crispy,grilled?
bu             beef,crispy,grilled?
            or beef,crispy chicken,grilled chicken?
ch             crispy,grilled,nuggets,cone?
            or crispy chicken,grilled chicken,nuggets,cone?

Scoring

This is code golf.  The shortest answer in bytes in 12 days wins acceptance.  (I would have made it one week, but I won't be around for that.)

Python 2 - 181 bytes

It turns the abbreviated string into a regex and attempts to match groups from the search list.

The ternary operation if and elses are 14 bytes. I've tried to cut it down into a list and then accessing one of the items based on the state of r, but don't have anything shorter that this yet.

import re
def s(a,l):
 r=[m.group(1)for e in l for m in[re.compile('^('+a.replace(' ','\w+ ')+'\w+)$').search(e)]if m]
 print','.join(r)+'?'if len(r)>1 else r[0]if r else'Not found'

Call with s(str, list):

s('c n', ['chicken burger', 'chicken nuggets', 'cheeseburger'])
>>> chicken nuggets
s('c n', ['chicken burger', 'chicken nuggets', 'cheeseburger', 'chicken nuggets with sauce', 'foobar'])
>>> chicken nuggets
s('c n', ['chicken burger', 'chicken nuggets', 'cheeseburger', 'chicken nuggets with sauce', 'foobar', 'cfoo nbar'])
>>> chicken nuggets,cfoo nbar?


Random ticket code generator A lottery company wants to generate a random lottery ticket number of length 10 characters.

Write a code in any language to create such a number in which every digit comes only once for example 9354716208 in this number all integers from 0 to 9 comes only once. This number should be a random number.

The generated number should be shown on screen.
It must be able to generate all permutations of all allowable characters.
The code is required to be as small as possible (in bytes).

J (4 bytes)

Couldn't resist.

?~10

In J, if F is dyadic , F~ x is the same as x F x.


Subdivide-Sum Sequence Consider the digits of any integral base above one, listed in order. Subdivide them exactly in half repeatedly until every chunk of digits has odd length:
Base    Digits              Subdivided Digit Chunks
2       01                  0 1
3       012                 012
4       0123                0 1 2 3
5       01234               01234
6       012345              012 345
7       0123456             0123456
8       01234567            0 1 2 3 4 5 6 7
9       012345678           012345678
10      0123456789          01234 56789
11      0123456789A         0123456789A
12      0123456789AB        012 345 678 9AB
...
16      0123456789ABCDEF    0 1 2 3 4 5 6 7 8 9 A B C D E F
...

Now, for any row in this table, read the subdivided digit chunks as numbers in that row's base, and sum them. Give the result in base 10 for convenience.
For example...

for base 3 there is only one number to sum: 0123 = 123 = 510
for base 4 there are 4 numbers to sum: 04 + 14 + 24 +  34 = 124 = 610
base 6: 0126 + 3456 = 4016 = 14510
base 11: 0123456789A11 = 285311670510

Challenge
Write a program that takes in an integer greater than one as a base and performs this subdivide sum procedure, outputting the final sum in base 10. (So if the input is 3 the output is 5, if the input is 6 the output is 145, etc.)
Either write a function that takes and returns an integer (or string since the numbers can get pretty big) or use stdin/stdout to input and output the values.
The shortest code in bytes wins.
Notes

You may use any built in or imported base conversion functions.
There is no upper limit to the input value (besides a reasonable Int.Max). The input values don't stop at 36 just because "Z" stops there.

p.s. this is my fiftieth question :)

Python, 82 78
def f(b):G=b^b&b-1;return sum(b**(b/G-i-1)*(G*i+(G-1)*b/2)for i in range(b/G))

Huh?

The number of digit groups that the subdivison yields, G, is simply the greatest power of two that divides the number of digits (i.e. the base), b.
It's given by G = b ^ (b & (b - 1)), where ^ is bitwise-XOR.
If you're familiar with the fact that n is a power of two iff n & (n - 1) = 0 then it should be pretty easy to see why.
Otherwise, work out a few cases (in binary) and it'll become clear.

The number of digits per group, g, is simply b / G.

The first digit group, 012...(g-1), as a number in base b, is .

The next group, g(g+1)...(2g-1), as a number in base b, is the sum
.

More generally, the n-th group (zero-based), as a number in base b, an, is .

Recall that there are G groups, hence the sum of all groups is

which is what the program calculates.


Cross Language Troll The Setup
Jim the student who attempts to use Stack Overflow to do his homework has asked how to get his program to say "Hello World" in under 100 lines of code, you decide mere mortal trolling is not enough...

The Challenge
You need to provide Jim with a program less than 100 lines long that outputs a satisfactory answer in another language. Bonus points for additional languages.

The Rules
 1. Max 100 lines of code
 2. 10 points for successfully outputting the answer in another language
 3. +1 point for every additional language answer is provided for
 4. Honorable mentions will be given to the most creative, most evil, and most unorthodox answers
 5. Challenge ends 23:59pm GMT 3/14/2014 (results provided a few hours post challenge)

The winner is Michael who converted between six languages first

I also will give an honorable mention for cleverness to McMillin for using one command that works in several languages

I also give an honorable mention to Comintern... I don't actually know if brownies is a language, but I think we can agree it was unorthodox.

I don't think any of the answers qualifies as evil, but for the sake of it everyone who used brainfuckery will be considered recipients.

Bash

echo Bonjour tout le monde

Outputs "Hello World" in a language called French.


Exciting Mario Kart Grand Prix - Minimize the point difference! Introduction
When playing Mario Kart the other day, an interesting question popped up when a Grand Prix with my 2 roommates, 9 AI drivers and myself seemed to be fairly close and therefore exciting until the very end.
We asked ourselves: How close can the point difference between first and last place (#1 and #12) after exactly N races be?
This Code Golf challenge occured to me after the underlying problem for the distribution of the minimum difference in points was answered here by user mlk.
Challenge
Mario Kart races consist of 12 racers which in every race receive the points represented in this 1-indexed array: [15, 12, 10, 8, 7, 6, 5, 4, 3, 2, 1, 0].
In a Grand Prix, the points for each driver from every of the N races are simply added up to form the final point distribution. The difference between the lowest and the highest number of points in this final point distribution is called point difference (alas between places #1 and #12).
Your task is to write a program which takes as input the number of races N (1 <= N <= 32) and outputs the corresponding point difference.
The first 13 correct inputs and outputs can be found below. You will find that after the special cases N = 1 and N = 2, the correct answer will be 0 if N is divisible by 12 and 1if not.
Example Input and Output
As the desired output is correctly defined for every natural number, here are the input/output examples until the repeating pattern described above begins:
1 -> 15
2 -> 4
3 -> 1
4 -> 1
5 -> 1
6 -> 1
7 -> 1
8 -> 1
9 -> 1
10 -> 1
11 -> 1
12 -> 0
13 -> 1

Goal
This is Code Golf, so shortest answer in bytes wins!
Standard loopholes apply.

JavaScript (ES7), 19 bytes

n=>14/n**n+1^n%12<1

Try it online!
We compute:
$$\left\lfloor\frac{14}{n^n}+1\right\rfloor$$
which is \$\lfloor 14/1+1\rfloor=15\$ for \$n=1\$, \$\lfloor 14/4+1 \rfloor=4\$ for \$n=2\$, or \$1\$ for \$n>2\$.
We then XOR the result with \$1\$ if \$n \bmod 12=0\$.


It's time for a clock challenge! I'd like you to build me a clock that displays time in this format:
18 ----------
19 --------------------------------------------------

This displays '18:10'. The current hour and the next hour are shown at the front of the line, followed by a space and a number of dashes: on the first line the number of minutes that have passed in this hour, and the second line shows how many more minutes to go in this hour.
To clarify

The clock should display the system's time. If fetching the time from another source is more convenient, that's fine too. It may not be supplied as input.
At 18:00, the top line is just 18 (Trailing spaces allowed but not required)
At 18:59, the bottom line is 19 -
The hours < 10 are either pre-padded with a 0 (01 -----) or right-aligned ( 1 -----). A left-aligned single digit is not allowed, not even if the dashes start at the right place (1  ----- is invalid).
The clock should display the hours in a 24h-format.
Although it's called the 24h format, there is not actually a 24 on it. During the 23rd hour, the second line starts with 00 or  0.
The display needs to be updated at least once a minute, but that doesn't have to happen at exactly 00 seconds. You may update more frequently / continuously if that is more convenient, but the result must of course still be legible - not one smear all over the screen.

Input
None.
Output

As described above. Trailing spaces to pad the clock to 60-ish positions is allowed on both lines, a trailing newline is also allowed.
The screen needs to be cleared when displaying the next minute: either with a clear-screen command or by adding no less than 30 newlines.

Additional rules

Standard loopholes are forbidden
code-golf, shortest answer in bytes wins.

TI-Basic, 94 bytes
"
Repeat 99<length(Ans
Ans+"-
End
Ans→Str1
Repeat 0
getTime
ClrDraw
Ans{Ans(1)≠24,1,1
Text(0,0,Ans(1),sub(Str1,1,1+Ans(2
Text(6,0,Ans(1)+1,sub(Str1,1,61-Ans(2
End

Relatively straightforward. That's a string with one space at the beginning. The hours are right-aligned. This only works on TI-84+ calculators since the TI-83 does not have an internal clock.
Edit: Thanks @kundor for noticing that I didn't close the last loop. Fixed now (+2 bytes).
Edit #2: First hour should be zero, not twenty-four. Corrected at a cost of +14 bytes.


Mixed Fraction Equality In elementary school, children learn about proper fractions, where the numerator is less than the denominator, and thus the value of the fraction is less than one. Later, they are taught about fractions where the value of the fraction is greater than one, and two different ways to express these fractions: mixed fractions and improper fractions.

Given a mixed fraction, determine if it is equivalent to the improper fraction where the integer value and the numerator are concatenated together. For example, for input 1 3/4, the improper fraction is 13/4.

Test Cases

1 3/4        -> falsey
1 3/10       -> truthy
6 6/7        -> falsey
55 55/100    -> truthy
4 9/100      -> falsey
40 9/100     -> falsey
7 49/1000    -> falsey
9 1/2        -> falsey
999 999/1000 -> truthy
1 21/200     -> falsey
1 21/101     -> falsey

For input, you may take the integer part and the fraction part as separate inputs, but you may not take the fraction as input in two pieces, and you may not take it as a decimal value. You may drop the integer part (not take it as input) if you do not need to use it.

MATL, 7 bytes
UsGXzU=

Input is a string. Output is 1 for truthy, 0 for falsey.
Try it online! Or verify all test cases.
Explanation
U     % Implicit input. Convert to number(s): gives a vector of two numbers
s     % Sum of that vector
G     % Push input again
Xz    % Remove spaces
U     % Convert to number
=     % Equal? Implicit display


Is there are exactly one partition, given length of partition and maximum number? It is Restricted Integer Partitions, but with maximum number.
Question
Three positive integers are given. First number is number to divide, second number is length of partition, and third number is maximum number. First number is always largest, and bigger than other two.
For example, 5, 2, 3. Then, make partition of 5 which have 2 parts, and maximum number you can use is 3. Note that you don't have to use 3 : maximum number can be 2 or 1.
In this case, there is only one partition : 3, 2.
Partition is unordered : which means 3 + 2 and 2 + 3 is same.
But in case like 7, 3, 3, there are two partition : 3, 3, 1 and 3, 2, 2.
To make it sure, You can use third number as largest number, but you don't have to use it. So 5, 4, 3 is true.
Question is : Is there are more than one partition, given length and maximum number?
Output is True or 1 or whatever you want when there is only one partition, and False or 0 or whatever you want where there are more than one partition, or no partition.
Winning condition
This is code golf, so code with shortest byte wins.
Examples
Input -> Output
7, 6, 2 -> True (2+1+1+1+1+1) : 1 partitions
5, 4, 4 -> True (2+1+1+1) : 1 partitions
5, 4, 3 -> True (2+1+1+1) : 1 partitions
5, 4, 2 -> True (2+1+1+1) : 1 partitions
5, 3, 2 -> True (2+2+1) : 1 partitions
7, 2, 3 -> False no partitions
7, 2, 2 -> False no partitions
7, 2, 1 -> False no partitions
9, 5, 3 -> False (3+3+1+1+1), (3+2+2+1+1), (2+2+2+2+1) : 3 partitions
6, 3, 3 -> False (3+2+1), (2+2+2) : 2 partitions

Python 2, 38 bytes

lambda n,k,m:m>n-k<2or-1<k*m-n<2+2/m*k

Try it online!

Characterizes the cases where there's only one legal partition.

Consider the partitions of \$n\$ into exactly \$k\$ parts each between \$1\$ and \$m\$ inclusive. There's only two ways to for there to be only one such partition.

The number \$n\$ is close to as small as possible (\$n=k\$ or \$n=k+1)\$ or as large as possible (\$n=mk-1\$ or \$n=mk)\$ for such a partitions. This leave only enough "wiggle room" for only one partition in each case:

\$n=1+1+\cdots +1+1\$.
\$n=2+1+\cdots+1+1\$.
\$n=m+m+\cdots+m+(m-1)\$.
\$n=m+m+\cdots+m+m\$.

We allow only \$m=2\$ maximum, forcing a unique partition made of 1's and 2's. Such a partition requires \$k \leq n \leq 2k\$.

The challenge lets us assume that \$n>k\$, so we can omit the \$n=k\$ case and \$k \leq n\$ check, and, as feersum observed, can let us check \$n=k+1\$ as \$n<k+2\$.  The \$m=1\$ case makes it impossible to make a partition with \$n>k\$, so we make sure it's always rejected. This gives the condition

  \$n \in \{ k+1, mk-1, mk\}\$and \$ m>1\$, or \$n \leq 2k \$ and \$m=2\$


Koopa Shell Sequence In various Super Mario games green and red Koopa Troopa shells can slide frictionlessly on flat surfaces and destroy brick blocks that are in their way. When a shell hits a brick block the block breaks, turning it into empty space, and the Koopa shell reverses direction. As an example, watch the red shell here.
Suppose a Super Mario level is just one block high and every grid cell is either a brick or empty space, except for the leftmost cell which contains a rightward moving shell. The level is also periodic, so if the shell exits the right or left edge of the level it will reenter on the opposite side. In this situation the shell will continue to bounce off of and break all the brick blocks in the level until there are no more. How far will the shell have traveled just after the last brick block is broken?
Challenge
Write a program or function that takes in a non-negative decimal integer. This number, expressed in binary with no leading zeros (the only exception is 0 itself), encodes the one-block-high level layout. A 1 is a brick block and a 0 is empty space.
The Koopa Shell is inserted at the very left edge of the level and is initially moving right. For example, the level associated with input 39 is
>100111

because 100111 is 39 in binary, and > and < represent right and left moving shells respectively.
You need to print or return the total distance traveled by the shell once the very last brick block (a.k.a. 1) has been broken.
The output for 39 is 7 and the changes in the level look like this:
Level      Cumulative Distance
>100111    0
<000111    0
>000110    0
0>00110    1
00>0110    2
000>110    3
000<010    3
00<0010    4
0<00010    5
<000010    6
000001<    7
000000>    7  <-- output

Similarly, the output for 6 is 1:
Level    Cumulative Distance
>110     0
<010     0
001<     1
000>     1  <-- output

The shortest code in bytes wins.
For reference, here are the outputs for inputs 0 to 20:
0 0
1 0
2 0
3 0
4 0
5 0
6 1
7 1
8 0
9 0
10 1
11 2
12 2
13 1
14 3
15 3
16 0
17 0
18 1
19 3
20 2

And here are the outputs up to input 1000.

CJam, 29 26 24 bytes

Thanks to Sp3000 for saving 3 bytes.

q~2b{_1&}{W\({%}*0+}w],(

Test suite. (This prints all results from 0 to the integer given on STDIN.)

Explanation

This turns the spec on its head a bit: instead of moving the shell through the binary string, we shift and reverse the binary string such that the shell is always at the front, pointing to the right:

q~      e# Read and evaluate the input.
2b      e# Convert to base-2 to get the "level".
{_1&}{  e# While there is a 1 in the level...
  W\    e#   Put a -1 below the level.
  (     e#   Pull off the first digit, i.e. the cell the shell is pointing at.
  {     e#   If it's a 1 (i.e. a brick)...
    %   e#     Reverse the level, consuming the -1. This isequivalent to reversing the
        e#     shell in place.
  }*
  0+    e#   Append a zero. If the cell was a brick, this just replaces it with an empty
        e#   cell. Otherwise, this rotates the level by one cell. This is equivalent
        e#   to moving the shell one cell through the periodic level.
        e#   Note that if the leading cell was 0, the -1 remains on the stack.
}w
],(     e# Wrap the stack in an array, get its length and decrement.


Taking the dog for a walk My dog is barking at me, but I'm too lazy to take him for a walk. I have an idea! I'll get the people at Code Golf to do it for me!

Your challenge is to simulate a dog's walk. Here are the rules for walking the dog:

The human (H) will start at 0,0 on a (Cartesian) coordinate plane, and will randomly go one space either up, left, right, or down every second.
The dog (D) will start at the same location, and will go either zero, one, two, or three spaces either up, left, right, or down every second (randomly, of course). The dog is less predictable and will sometimes run faster or stop completely.
The dog will never get more than a certain amount of units away from the human (in Euclidean distance), which is the length of the leash (L). For example, if L is 6, a valid position would be H(0,0) D(4,4) (since the distance is about 5.65 units), but not H(0,0) D(5,4) (about 6.4 units).

If, when the dog moves, it would violate the leash distance requirement, it must go the farthest it can in its determined direction that does not violate the distance requirement. For example, if the position is H(0,0) D(3,4) and the dog is randomly decided to move 3 spaces to the right, it will go to D(4,4), since that's the farthest it can go without getting more than 6 units away. (Note that this might result in a movement of 0 spaces, i.e. no movement at all!)

Miscellaneous rules: the human moves first. The human must not exceed the leash length on its move. If it does, it must choose another direction. "Random" means "with an even distribution and with no patterns."

The input will be given in this format (can be STDIN, function parameter, file, etc.):

"<amount of seconds the walk will last> <leash length>"

For example:

300 6 // a 5 minute walk with a 6 yard leash

You must give output in this format (can be STDOUT, function return value, file, etc.):

H(0,0) D(0,0)
H(0,1) D(2,0)
H(1,1) D(2,1)
H(1,0) D(2,-1)
...

(The amount of lines output will be seconds + 1, since the H(0,0) D(0,0) line doesn't count.)

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


Hexagonal maze time! Time for another maze challenge, but not as you know it.

The rules for this challenge are a little different than most maze challenges. The tile types are defined as follows:

S: The location on the maze you start at
E: The location you are trying to get to
0: Wall that you can't cross
+: Floor that you can cross

You can travel in one of six directions: up-left, up-right, left, right, down-left, or down-right.

\ /
-S-
/ \

The maze does not wrap. The goal is to find the shortest path string to get from S to E.

Input:

Input is space separated lines like the mazes shown. No trailing space will follow a line.

Output:

A string of R, L, and F where

R rotates you right (clockwise) 60 degrees
L rotates you left (counter clockwise) 60 degrees
F moves you one space in the direction you are pointing

You start pointing left-up

The shortest path is counted by the length of the string produced, not the number of positions visited. Your program must print the shortest path as the solution.

If the maze is unsolvable you should output Invalid maze!.

(>>> is the 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 + 0
 E 0 + 0 0 + + 0
  + + 0 + 0 + 0
   0 0 0 0 0 +
    + 0 + + +
     0 S 0 0

>>>RFRFFLFLFRFFLFFFLFLFFRFLFLFRFRFRF

  + 0 0 0 0 0 0
 0 0 0 0 0 + + 0
0 0 E 0 + 0 0 + 0
 0 0 0 0 0 0 0 +
  0 + 0 0 + + +
   0 0 + + 0 0
    S + 0 0 0

>>>Invalid maze!

0 E S

>>>LF

 E + 0
0 + + +
 0 0 S
  + +

>>>FFLF

  E
 0 +
0 + +
 0 +
  S

>>>RFFLFF

 0 E + 0 0
0 + 0 0 + +
 + 0 + + + 0
  + 0 + 0 + 0
   + + + 0 S

>>>FFLFLFFRFRFFRFF

 E 0 + + 0
0 + 0 + + 0
 + + + 0 + 0
  + 0 0 0 0 0
   + + + + 0
    + 0 S 0

>>>FLFFRFFRFLF

(Note that some of the mazes have other solutions that are the same length but are not listed here)


Is this number a hill number? A hill number is a number that has the same digit in the first & the last, but that's not all. In a hill number the first digits are strictly increasing until the largest digit, and after the largest digit, the last digits are strictly decreasing. The largest digit can be repeated but consecutively only, meaning no gaps by smaller numbers.

Here is an example of a hill number:

12377731 | 1237...             | ...731
^ same ^ | strictly increasing | strictly decreasing
---------+---------------------+---------------------
12377731
   ^^^ okay because largest digit can be repeated

This is not:

4588774 | ...8774
        |     ^^ not the largest digit
        |        so this has to be strictly decreasing
        |        but it's not, so not a hill number

Challenge

Given a positive integer, write a full program or a function that returns truthy for hill numbers but falsy on other values.

Notes:

Input & output can be in any reasonable format.
This is code-golf so shortest answer in each language wins!

Test Cases

12321 -> Truthy
1233321 -> Truthy
99 -> Truthy
3 -> Truthy
234567992 -> Truthy
5555555 -> Truthy
1232 -> Falsy
778896 -> Falsy
23232 -> Falsy
45566554 -> Falsy
5645 -> Falsy

Jelly, 8 bytes

_ƝṠÞ+SƊƑ

Try it online!

How it works

_ƝṠÞ+SƊƑ  Main link. Argument: n (integer)

_Ɲ        Take the differences of neighboring digits.
          This maps n = abcd to [a-b, b-c, c-d].
       Ƒ  Fixed; apply the link to the left and return 1 if the result is equal to
          its argument, 0 if not.
      Ɗ       Drei; combine the three links to the left into a monadic chain.
  ṠÞ              Sort the differences by their signs (negative, zero, positive).
     S            Take the sum of the differences, yielding 0 if and only if the
                  first digit is equal to the last.
    +             Add the sum to each difference.


Inserting digits to satisfy equation You are given 3 non negative numbers: \$x\$, \$y\$ and \$z\$, and must minimize the number of digits (non negative) inserted at any place in the numbers \$x\$, \$y\$, or \$z\$ to make
$$x + y = z$$
(a clarification: you can add any non negative digit any number of time at any place )
(you can assume that \$x\$, \$y\$, \$z\$ and your final integers after insertion won't overflow the integer limit in your language)
Example:
$$x=1, y=10, z=30$$
$$1 + 10 = 30  $$
$$1(0) +1(2)0 = (1)30$$
i.e \$10+120 = 130\$
The minimum insertions is 3 here.
$$x=1 , y=1 , z=3$$
$$1 + 1 = 3   $$
$$(3)1 + 1 = 3(2)   \;\text{or}\;   1 + 1(2) = (1)3$$
Here, the answer is 2.
$$x=11 , y=11 , z=33$$
$$11 + 11 = 33$$
$$11(2) + 1(2)1 = (2)33  \;\text{or}\;  1(2)1 + (2)11 = 33(2)$$
Here, the answer is 3.
$$x=3 , y=0 , z=0$$
$$3 + 0 = 0$$
$$3 + 0 = 0(3)$$
Here, the answer is 1,because as stated in earlier clarification, you can add any non negative digit any number of time at any place, so there can be leading zeroes too.
There can be multiple ways for same number of minimal insertion.
If possible while answering please write a short explanation of what you did. This is code-golf, so the shortest answer in bytes per language wins.

JavaScript (ES6), 164 bytes
Thanks to @l4m2 for identifying several bugs and suggesting the alternate version below

(x,y,z)=>(F=k=>(g=(k,s=z+`-${x}-`+y,n=9)=>eval(s.replace(/\d+/g,'"$&"'))?k&&[...s,0].some((_,i)=>g(k-1,s.slice(0,i)+n+s.slice(i)))||n&&g(k,s,n-1):1)(k)?k:F(k+1))(0)

Try it online!
How?
We build the string s with the pattern z-x-y and recursively attempt to insert k additional digits until eval(s) is 0.
Commented
(x, y, z) => (                 // main function taking (x, y, z)
  F = k => (                   // F is a recursive function taking a counter k
    g = (                      // g is a recursive function taking:
      k,                       //   k = number of digits to insert
      s = z + `-${x}-` + y,    //   s = expression string "z-x-y"
      n = 9                    //   n = next digit to insert
    ) =>                       //
    eval(s.replace(            // if the expression does not evaluate to 0:
      /\d+/g, '"$&"'           // (add quotes to prevent any number with a
    )) ?                       // leading 0 to be parsed as octal)
      k &&                     //   if k is not equal to 0,
      [...s, 0].some((_, i) => //   for each position i from 0 to len(s):
        g(                     //     do a recursive call to g:
          k - 1,               //       decrement k
          s.slice(0, i) + n +  //       insert n at position i
          s.slice(i)           //       (and implicitly restart with n = 9)
        )                      //     end of recursive call
      ) ||                     //   end of some()
      n &&                     //   if n is not equal to 0:
        g(k, s, n - 1)         //     do a recursive call to g with n - 1
    :                          // else:
      1                        //   success
  )(k)                         // initial call to g with the current value of k
  ?                            // if successful:
    k                          //   return k
  :                            // else:
    F(k + 1)                   //   try again with k + 1
)(0)                           // initial call to F with k = 0

JavaScript (Node.js), 158 bytes
A slower but 6 bytes shorter variant suggested by @l4m2

(x,y,z)=>(F=k=>(g=(k,s=z+`-${x}-`+y,i=~s.length*-10)=>k*i--?g(k-1,s.slice(0,t=i/10)+i%10+s.slice(t))|g(k,s,i):!eval(s.replace(/\d+/g,'"$&"')))(k)?k:F(k+1))(0)

Try it online!


List ALL prime-factorized natural numbers in ANY order This is a variant of List prime-factorized natural numbers up to N in ascending order, but the solutions can be very different.

Write a program that outputs prime factorizations of all natural numbers in any order. For example, the output could look like:

1:
4: 2^2
8: 2^3
2: 2^1
3: 3^1
5: 5^1
6: 2^1 3^1
21: 3^1 7^1
9: 3^2
...

Requirements:

You cannot just iterate over the numbers and factor each of them. This is too inefficient.
The output should be as in the example above: On each line the number and the list of its prime factors.
There is no given order in which the number appear in the list. However:
Each number must appear exactly once in the list (explain that your code satisfies this condition).

Edit - remark: Of course the program never finishes. But since (4) requires each number to appear in the list, for any n there is time t such that the list produced by the program within time t contains the factorization of n. (We don't care if t is comparable to the age of our universe or anything else.)

Note: This is not code-golf, it's code-challenge. This puzzle is about clever ideas, not code size. So please don't give the shortest solutions, give commented solutions that are easy to read and where the idea is easily understandable.

Haskell

import Data.List

merge :: [[a]] -> [[a]] -> [[a]]
merge [] ys = ys
merge (x:xs) ys = x : merge ys xs

atmostonefromeach :: [[a]]-> [[a]]
atmostonefromeach = foldr weave undefined

weave :: [a] -> [[a]] -> [[a]]
weave pwrs odds = merge (map (:[]) pwrs) $
foldr (\odd -> merge (odd: (map (:odd) (pwrs)))) undefined odds

primes = nubBy (\x y->gcd x y > 1) [2..]

shw factors = show (product (map (\(p,k)->p^k) factors)) ++ ":" ++ concatMap(\(p,k) -> ' ': show p ++ '^': show k) factors

powers p = map (\x->(p,x)) [1..]

main = mapM_ (putStrLn . shw) $ ([]:) $ atmostonefromeach $ map powers primes

output:

1:
2: 2^1
3: 3^1
4: 2^2
5: 5^1
8: 2^3
6: 2^1 3^1

...

The program constructs,
from the list Q=[q0,q1,..] of composite numbers with all prime factors > p,
the list of those with primes factors >= p, as
merge(P, merge((map(q0*)P1), merge(map(q1*)P1),...
where P=[p^1,p^2,...] and P1=[p^0,p^1,..].

The name odds in function weave describes the case p==2,
where Q is the set of all odd numbers > 1.


The Big Bang Polyglot Everyone loves The Big Bang Theory, right? And everyone loves polyglots, right? So let's combine them!
Task
Your task in each language is quite basic. You must output the name of the one of the 5 main characters of The Big Bang Theory: Sheldon Lee Cooper, Leonard Leakey Hofstadter, Howard Joel Wolowitz, Rajesh Ramayan Koothrapali and Penny Hofstadter.
Your task overall is to write a polyglot that will work in at least 5 languages. Each language should output a different character on the show.
I say "at least" because in order to win, you must output more characters (see Scoring below). But before that, let's go over the details of your program
Input
You program should take no input when run in any of the languages.
Output
Your program should output the full name of a different characters of TBBT for each language it is run in. If no middle name is known, no middle name is required. 5 of those characters must be the 5 main characters:

Leonard Leakey Hofstadter
Sheldon Lee Cooper
Howard Joel Wolowitz
Rajesh Ramayan Koothrapali
Penny Hofstadter

The names outputted must be characters that have appeared in more than one episode and they must have both a first and a last name. If they have a middle name, it must be outputted as well.
Scoring
The scoring system is quite basic: your score is the length of your code in bytes minus 20 times the extra number of characters you output. The extra characters are any that aren't in the list above.
length - 20 * (num_characters - 5)

You may also subtract 100 from your score if you don't use any comment characters.
Rules

No builtins allowed. (Why not?)
The lowest score wins.
Only characters with both first and surnames are valid
You must output to STDOUT or your languages equivalent. Nothing may be outputted to STDERR
Each submission must run in at least 5 different languages
Different language versions do not count as different languages
Entries must be full programs
Case and whitespace matter so an output of Pen nyHof STAdter isn't valid.
The valid characters are listed here
Leading/trailing whitespace is allowed.
A comment character is a character that makes the program ignore the next line or command

Foo, Python, JavaScript, Retina, ><>: 166 148 bytes

1//1;print('Sheldon Lee Cooper');"""
alert`Howard Joel Wolowitz`

// Rajesh Ramayan Koothrapali
//!??

//\"Leonard Leakey">o<'Penny'" Hofstadter"""

The trailing newline is significant.

Foo outputs Leonard Leakey Hofstadter

Python outputs Sheldon Lee Cooper

JavaScript outputs Howard Joel Wolowitz

Retina outputs Rajesh Ramayan Koothrapali

><> outputs Penny Hofstadter

Explanations

Foo

In Foo, any text written inside double quotes is sent to STDOUT. So it outputs Leonard Leakey and Hofstadter. It also prints it with a leading newline. Honestly I'm really not sure about how it parses strings, but it works as-is. It also tries to do some other operations (/ is divide, parentheses form loops, etc.), but all of that just causes errors and prints to STDERR without affecting the main output in any way.

Python

1//1 is 1 integer divided by 1. In a statement by itself, that does nothing relevant. Then it prints Sheldon Lee Cooper, and the rest is in a triple quoted string, which is basically a block comment.

JavaScript

JavaScript sees most lines as either empty or commented (//). The first statement is 1 by itself which, like in the Python part, does nothing. Then it alerts Howard Joel Wolowitz.

Retina

1//1;print('Sheldon Lee Cooper');"""
alert`Howard Joel Wolowitz`

First all matches of 1//1;print('Sheldon Lee Cooper');""" in the input are replaced with alert`Howard Joel Wolowitz`. Seeing as the input is empty, nothing happens.

// Rajesh Ramayan Koothrapali

Then the empty input is replaced with // Rajesh Ramayan Koothrapali.

//!??

Then all matches of // optionally followed by a ! are replaced with nothing. This deletes the initial //, leaving one leading space (which is allowed).

//\"Leonard Leakey">o<'Penny'" Hofstadter"""

Then all matches of the regex above are replaced with nothing. This regex doesn't match anything in the working string, so nothing happens.

The working string is then output implicitly.

><>

The IP starts in the top-left, initially moving right. It first pushes 1, then bounces around on mirrors (/ and \) for a while (looping around when it goes out of bounds). The 1 will be popped when it hits ?.

Eventually it will be on the right side of the second last line moving left. On this line, it sees an empty string "", pushing nothing. Then it encounters two strings, " Hofstadter" and 'Penny', pushing the characters from each as it sees them. When it hits >o<, it repeatedly pops and prints the top of the stack as a character, until there's nothing left to pop. It exits with an error.


A "Sorting" algorithm There is a "sorting algorithm" sometimes called Stalin sort in which in order to sort a list you simply remove elements from the list until it is sorted in increasing order.  For example the list

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

When "sorted" using Stalin sort becomes

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

The three was removed because it was out of order.

Now obviously there are many ways to remove elements to sort a list.  For example any list with less than two elements must be sorted so by just removing enough elements blindly we can always sort a list.  Since this is the case we only care about the longest possible result from a Stalin sort.

Your task will be to take a list of positive integers and output the length of the longest sorted (increasing) list that can be arrived at by removing elements from the original list.  That is find the length of the longest sorted (possibly non-contiguous) sub-list.

Sorted lists can have the same element more than once in a row. You do not need to support the empty list unless your program itself is empty.

Scoring

Your answer will be scored by the length of its own longest possible Stalin sort. Programs will be interpreted as a sequence of bytes rather than characters, and their order will be the natural one that arises by interpreting the bytes as numbers.  Lower scores are better.

This is not code-golf

Here's a neat-o tool to help you score your answers.

Test cases

[1, 2, 4, 5, 3, 6, 6] -> 6
[19, 2] -> 1
[3, 3, 4, 3] -> 3
[10] -> 1
[1, 2, 4, 9] -> 4
[1, 90, 2, 3, 4, 5] -> 5
[1, 90, 91, 2, 3, 4, 5] -> 5

Python 2, length 14 12 10 9

M=max;X=exit;i=input();L=[0]*M(i)
for	a	in	i:L[a-1]=M(L[:a])+1
X(M(L))

Output is via exit code.

Try it online!

How it works

At all times, the array \$L\$ keeps track of the longest sorted subarrays encountered so far; \$L[a-1]\$ is the length of longest one that ends with \$a\$.

Initially, we haven't processed an array elements, so \$L\$ consists entirely of zeroes.

When processing the array element \$a\$, we first take the maximum of \$[L[0], \dots, L[a-1]]\$, which is length of the longest sorted subarray encountered so far that ends with \$a\$ or a smaller integer. Appending \$a\$ to such an array will keep it sorted, so the longest sorted subarray ending in \$a\$ is one element longer than that maximum. We update \$L[a-1]\$ with the computed value.

The final result is the maximum of \$L\$.


Verify the birth number A Norwegian Birth Number consists of 11 digits, composed the following way:

DDMMYYiiikk

DD is the day (from 01-31)
MM is the month (from 01-12)
YY is the year (from 00-99). It's not differentiated between 1900 and 2000
iii is the "individual number"
kk are two control digits

iii is determined by birthyear and gender the following way

0000-1900: Disregard, there is some inconsistency and special cases
1900-1999: Range = 000-499
2000-2039: Range = 500-999
Female: Even numbers (and 000)
Male: Odd numbers

The control numbers are determined the following way:

Let's call the 11 digits:

d1 d2 m1 m2 y1 y2 i1 i2 i3 k1 k2

Then the control digits can be calculated using the equations:

k1 = 11 - ((3 * d1 + 7 * d2 + 6 * m1 + 1 * m2 + 8 * y1 + 9 * y2 + 4 * i1 + 5 * i2 + 2 * i3) mod 11)

k2 = 11 - ((5 * d1 + 4 * d2 + 3 * m1 + 2 * m2 + 7 * y1 + 6 * y2 + 5 * i1 + 4 * i2 + 3 * i3 + 2 * k1) mod 11).

For some combinations, the control numbers k1 or k2 can become 10. If that's the case, the number will be invalid.

If the sum modulus 11 for k1 or k2 is 11, i.e. k1 = 11 - (11 mod 11), then the control digit will be 0, not 11.

Challenge

Take a letter, M or F (male or female), and an eleven digit number as input, and check if the Birth Number is valid according to the rules above.

Input format and order is optional
The 11 numbers must be a single number or a consecutive string (you can't take the input as DD, MM, YY, iii, kk).
You can assume the date is valid (310699xxxxx will not be given as input)
Output is a truthy/falsy value (1/0, true/false etc.)
Program or function
All standard rules apply

You can find all valid numbers on this page (in Norwegian) by choosing a date.

Examples:

M, 01010099931
True

F, 01029042620
True

M, 0101009841
False

F, 01010051866
True

F, 08021690849
True

M, 01029040105
True

M, 01029037473
False

Shortest code in bytes win.


Create this "String Mix-Up" function in as few bytes as possible This is my first time here at Code Golf SE so feel free to add your input/advice/suggestions to improve my post if necessary. The week after my computer science exam, the solutions were publicly published. One problem had a 45 line example solution but my solution was only 18 lines, (which I was very proud of), but I bet you guys here at code golf SE can do better.

Here are the requirements:

Takes two inputs, string1 and string2.
Delete the first occurrence of string2 found in the string1.
Add string2 in reverse order to the beginning of string1, and
Add string2 in reverse order to the end of the string1.
If string2 does not occur in string1, do not modify string1.
Output the modified string1

Example:

Input:

batman
bat

thebatman
bat

batman
cat

Output:

tabmantab

tabthemantab

batman

Note:
The problem was intended to handle basic inputs. Assume all expected inputs are restricted to characters A-Z, numbers, or other special characters visible on your keyboard. It does not need to handle tabs or newlines.

Submissions with shortest byte counts in each language win.

Stax, 16 11 bytes

ÄE┘¢8·╦Ωb•∩

Run and debug it online

The corresponding ascii representation of the same program is this.

Y#xyz|eyr|Sx?

This fixes the bugs in original version.  It uses conditionals and stuff.

Y                   Save 2nd input in y.  Now the two inputs are x and y.
 #                  Occurrences of y in x. (a)
  xyz               x, y, ""
     |e             replace first occurrence
       yr|S         surround with y reversed. (b)
           x        first input. (c)
            ?       a ? b : c

The result is printed implicitly.


God is real . . . unless declared integer This challenge is inspired by Fortran's idiosyncratic implicit typing rules. Your task will be to determine the data type of the object GOD according to the implicit typing rules explained below.
Background
Fortran 77 has six data types: CHARACTER, COMPLEX, DOUBLE PRECISION, INTEGER, LOGICAL, and REAL. Any object not explicitly declared to have one of these types is implicitly assigned a type by the compiler, as determined by the first letter of the object's name. The default implicit types are:
----------------------------
First letter | Implicit type
-------------+--------------
    A-H      |     REAL
    I-N      |   INTEGER
    O-Z      |     REAL
----------------------------

For example, the object called NUMBER (first letter N) has implied type INTEGER whereas the object called DUMBER (first letter D) has implied type REAL. These rules lead to the old joke that GOD is REAL . . . unless declared INTEGER.
The default implicit types can be overridden using IMPLICIT statements. For example,
IMPLICIT DOUBLE PRECISION (D,X-Z), INTEGER (N-P)

means that all objects whose names start with D, X, Y, or Z now have implied type DOUBLE PRECISION and those starting with N, O, or P have implied type INTEGER. Objects whose names start with any other letter retain their default implied types (in this example, REAL for A–C, E–H, and Q–W and INTEGER for I–M).
For the purposes of this challenge, we will adopt a more concise syntax: the IMPLICIT keyword (redundant here) will be dropped and we will use the single-character identifiers C, D, I, L, R, and X to represent the six data types (X represents COMPLEX). Thus, the example IMPLICIT statement given above becomes
D(D,X-Z), I(N-P)

i.e. a series of identifier–range pairs.
The challenge
Assume that the object GOD exists in a Fortran 77 program and does not have an explicitly declared type. Write a program or function that returns the implied type of GOD, given a compact IMPLICIT statement as input. This is code-golf: the shortest submission (in bytes) in each language wins.
Input

Input is either empty or otherwise consists of 1 to 26 identifier–range pairs.
Input may be taken in any reasonable format (e.g. one long string, list of identifier–range pairs). If you divide the input into identifier–range pairs, each pair may either be taken as is, e.g. 'D(D,X-Z)', or split, e.g. ['D', '(D,X-Z)'].
In ranges, letters appear in alphabetical order and are separated either by commas (for single letters) or dashes (indicating a span of letters). One-letter spans, e.g. G-G, are valid. The outer parentheses must be included, but may be replaced with other paired delimiters (e.g. [] or {}) if desired.
IMPLICIT statements are guaranteed not to overlap. That is, no letter has its implied type specified more than once.
Alphabetic characters must be uppercase.

Output
The uppercase identifier, C, D, I, L, R, or X, that represents the implied type of the object GOD. If the input is empty, your code must return R (the default type of GOD).
Test cases
Input -> Output
'' -> R
I(M-Z) -> R
I(A-Z) -> I
I(G) -> I
I(G-G) -> I
L(A,B,D-H,M-X,Z) -> L
D(D,X-Z), I(N-P) -> R
L(B,D,F,H,J,L,N,P,R,T,V,X,Z), C(A,C,E,G,I,K,M,O,Q,S,U,W,Y) -> C
D(S-Z), D(J-Q), D(A-H) -> D
I(I-K,M,R-T), R(N-P,U-Z), D(D-F,H), X(C,G), C(A,B,Q), L(L) -> X
I(F), X(N), R(P-P), I(C-C), C(A-A), I(J-J), R(V), D(H-H), X(O), L(B-B), C(R), L(Q-Q), I(D), L(X), R(S-S), C(Y), L(T-T), L(Z), X(U), D(K-K), R(G), X(W-W), D(I), C(L-L), R(E), I(M) -> R

Note: In the first test case, single quotes denote string boundaries.
Bonus imaginary internet points!
Awarded to answers that only use characters from the standard Fortran 77 character set: the 26 uppercase letters A-Z, the 10 digits 0-9, the space  , and the 12 characters +-*/=().,’:$

FORTRAN IV (Compiled with gfortran -ffixed-form), 309 291 290 280 398 393 392 334 237 231 bytes + Bonus imaginary Internet points

This should now be a proper FORTRAN IV program, with no anachronisms!

	REALS(200)
	DATAG,R,H,A/1HG,1HR,1H-,1H(/
	READ 9,S
    9	FORMAT(200A1)
	DO1 I=1,200
	C=S(I)
	IF(C.NE.A)GOTO2
	T=S(I-1)
	GOTO1
    2	IF(C.LT.G.AND.S(I+1).EQ.H.AND.S(I+2).GE.G.OR.C.EQ.G)GOTO8
    1	CONTINUE
	T=R
    8	PRINT 9,T
	END

Try it online!

Here's the same code embedded in a loop that runs through the entire test suite.  I don't think this can be done with TIO's header and footer.

18 bytes off thanks to @JonathanAllan, who pointed out that one IF statement wasn't needed.

1 more byte off by eliminating a stray space between CHARACTER and S at the top.

And 10 more bytes by rearranging the spaghetti code a bit.

Added 118 bytes to put it in proper FORTRAN IV fixed-column punch-card formatting. (This is for historical accuracy -- it isn't necessary for proper functioning under gfortran.)

Shaved off 5 more bytes: Cleaned up the GOTOs a bit, and changed the treatment of characters so it's actually correct for FORTRAN IV.

1 more byte off from removing an unneeded space in the DATA statement.

58 bytes off by streamlining the flow of control through the various IF statements.

97 more bytes off by: (1) eliminating variable P; and (2) replacing the spaces required at the beginning of a line with a tab character, which I found is allowed, according to an old FORTRAN IV manual. (I was thinking of punch card machines, which, as I recall, didn't have a horizontal tab, but I forgot about teletype machines, which did have a tab key.)

Thanks to @Dingus for 6 more bytes (from removing the B in the DATA statement which was no longer needed after P was eliminated).

I've limited myself to FORTRAN IV constructs here.  This should now be a correct FORTRAN IV program, without such things as the CHARACTER data type and quote-delimited strings, which were only introduced later.

Characters in FORTRAN IV needed to be entered as Hollerith constants, and they could be stored in variables of type REAL (and probably other types sometimes too, but there was no CHARACTER type originally).  (As I recall, a real could hold 5 ASCII characters from what we now call a string.  I think they were padded with spaces if there were fewer than 5 characters in a grouping.  The single characters I use are each stored as a real, padded with extra space characters in the real.)

Input is on stdin, on one line, just like the OP's test cases.

Output is on stdout.

FORTRAN IV was my introduction to computer programming -- it was the first programming language I ever learned.  When I was a boy, I read through my dad's textbooks when he took a class in it at NYU, which was required by his musicology graduate program.  Computer programming (as well as FORTRAN itself) has changed quite a bit since then :) .


Shortest Code to randomly place points and connect them The Task

This is quite a simple coding task, all your program has to do is place a point on a canvas (or your alternative in another coding language) and connect it to all the dots already placed.  Your program must take in one input, the number of dots that should be placed, and output some sort of display with the dots connected.  Example

Requirements

I have to be able to run it, which means that it has to have a
compiler/tool to run it either online, or publicly available to
download.
You are allowed to use any library created before this challenge was set, as long as it wasn't designed for the sole purpose of solving this.
This is a shortest code task, which means characters.  Comments, code that changes colour (for prettiness) and libraries will be ignored.
Your answer must be unique, don't steal other peoples code, shorten it a few characters and repost it.
It must be able to run in less than 5 minutes, for the values of 5 and 100. It must also use a resolution of at least 200*200 and put each dot in a random location on the canvas using a non-trivial distribution.

Current Leaderboard

Flawr        - Matlab        - 22  - Confirmed
Falko        - Python 2      - 41  - Confirmed
Wyldstallyns - NetLogo       - 51  - Confirmed
Ssdecontrol  - R             - 66  - Confirmed
David        - Mathematica   - 95  - Confirmed
ILoveQBasic  - QBasic        - 130 - Confirmed
Adriweb      - TI-Nspire Lua - 145 - Confirmed
Manatwork    - Bash          - 148 - Confirmed
Doorknob     - Python 2      - 158 - Confirmed
Kevin        - TCL           - 161 - Confirmed
M L          - HPPPL         - 231 - Confirmed
Manatwork    - HTML/JS       - 261 - Confirmed - Improved code of Scrblnrd3
Makando      - C#            - 278 - Confirmed
Scrblnrd3    - HTML/JS       - 281 - Confirmed
Geobits      - Java          - 282 - Confirmed

If I've missed you out, I'm very sorry, just add a comment to your work saying so and I'll add it as soon as I see it =)

TL;DR

Input - Number of dots (int, can be hard coded)
Output - Image of randomly placed dots, all connected to each other (graphic)
Winner - Shortest code

Java : 318 282 265

Because, ya know, Java:

class M{public static void main(String[]a){new Frame(){public void paint(Graphics g){int i=0,j,d=640,n=25,x[]=new int[n],y[]=x.clone();for(setSize(d,d);i<n;i++)for(j=0,x[i]=(int)(random()*d),y[i]=(int)(random()*d);j<i;g.drawLine(x[i],y[i],x[j],y[j++]));}}.show();}}

Its just a simple loop that makes random dots and draws lines between the current dot and all previous ones.

Example with 25 dots:

With line breaks and imports:

import java.awt.*;
import static java.lang.Math.*;

class M{
    public static void main(String[]a){
        new Frame(){
            public void paint(Graphics g){
                int i=0,j,d=640,n=25,x[]=new int[n],y[]=x.clone();
                for(setSize(d,d);i<n;i++)
                    for(j=0,x[i]=(int)(random()*d),y[i]=(int)(random()*d);
                        j<i;
                        g.drawLine(x[i],y[i],x[j],y[j++]));
            }
        }.show();
    }
}

Edit: Since we're not counting imports, I imported a couple more things to save some characters later.

Edit 2: OP added an allowance for hardcoding number of dots. -17 chars :)


String Manipulation Interpreter Summary

A new string manipulation language has been made, using only the characters $+#-!*|@>! Your task is to implement an interpreter for it in as few bytes as possible.

Input

A string, which is a single line of this language. This can be taken in any reasonable way (stdin, function parameter, command line argument etc.), or as a predefined variable. If the program asks for user input, accept all user input it asks for from stdin and nothing more, see below. You may assume it is a valid program.

Output

Whatever the language would output, specifications below. You must output a string, in any reasonable way (stdout, function output, etc.), or a variable value. When the language outputs explicitly, this must go to stdout. Standard loopholes are banned.

Language Specifications

Processing and Syntax

The language has a very simple form of processing as it does only string manipulation: it starts with an empty string (""), and changes it with each term. A term is made up of one or two parts: a function (below) followed by possibly a parameter(below), which edits its behaviour. Terms are separated by pipes (|). You may assume it will not be an empty program, and no term will be empty. You should output the value at the end of the program.

Functions

The language has just 6 functions, as shown below. Each function either accepts one or zero parameters.

+ concatenate strings (takes one string parameter, concatenates it to the current value)
! reverse the character order of the current value (no parameter)
* repeat the string (takes one integer parameter, repeats the current value that many times)
- removes all occurrences of a value (takes one string parameter, removes all occurrences of it from the current value)
$ [pseudo-]randomly shuffles the current value (no parameter)
< output the current value to stdout (no parameters)

Values

These are the values that may be passed to functions, represented by regex that would match them:

@[^|]* a string literal, including any character other than pipes. It may be empty.
#[0-9]+ an integer literal
> the next line of stdin. If used with *, convert to integer.

Test Cases

╔════════════════════════╤═════════════╤══════════════╗
║code                    │input        │output        ║
╟────────────────────────┼─────────────┼──────────────╢
║+>|!|+@hello|*>         │13           │31hello31hello║
║                        │2            │              ║
╟────────────────────────┼─────────────┼──────────────╢
║+>|+@abcdefg|$          │hello        │hcloeebafdlg  ║
╟────────────────────────┼─────────────┼──────────────╢
║+@how areyou|-@o|->     │w            │h areyu       ║
╟────────────────────────┼─────────────┼──────────────╢
║+@out|<|*#3             │             │out           ║
║                        │             │outoutout     ║
╟────────────────────────┼─────────────┼──────────────╢
║+>                      │what ever 345│what ever 345 ║
╟────────────────────────┼─────────────┼──────────────╢
║+@$pe<i@l|<|-@$pe<i@l|+>│A|$o $pe<!@| │$pe<i@l       ║
║                        │             │A|$o $pe<!@|  ║
╟────────────────────────┼─────────────┼──────────────╢
║<|+>|!|<                │input text   |              ║
║                        │             │txet tupni    ║
║                        │             │txet tupni    ║
╟────────────────────────┼─────────────┼──────────────╢
║+@>#                    │             |>#            ║
╚════════════════════════╧═════════════╧══════════════╝

Note that test case 2 is random, so any permutation of the characters in it is valid. Also, the outputs in the table are seperated by newlines, but your program doesn't have to do the same. The last value in each case the the final output.

Example (Un-golfed) python interpreter

Try it online! IMO better if you run it through IDLE or whatever you use. (I golfed it down to 424 bytes after, but I'm sure you lot can do better).

R, 287 286 273 269 bytes

function(C,x='',`[`=gsub,`!`=intToUtf8,`?`=utf8ToInt){for(k in el(strsplit(C,'\\|'))){B=eval(parse(t='^.'['','(?<=.)>$'['readLines(,1)','[@#](.+)'['"\\1"',k],,T]]));x=switch((?substr(k,1,1))%%13-2,strrep(x,B),paste0(x,B),,B['',x,f=T],!rev(?x),print(x),,!sample(?x))};x}

Try it online!

-1 thanks to @Kirill L.
-4 thanks to @Giuseppe

Unrolled code and explanation :

function(C){                                      # C is the string manipulation expression
  x = ''                                          # initialize x = ''
  tokens = el(strsplit(C,'\\|'))                  # split C by pipe '|'
  for(k in tokens){                               # for each token k
    arg2 = k
    arg2 = gsub('[@#](.+)','"\\1"',k)             # replace @X or #X with "X" (in quotes)
    arg2 = gsub('(?<=.)>$','"readLines(,1)"',
                 arg2,perl=T)                     # replace > with readLines(,1)
    arg2 = gsub('^.','',arg2)                     # remove the first character
    B = eval(parse(t=arg2))                       # evaluate the string : this will be our
                                                  # second argument B
    A = substr(k,1,1)                             # take the first character :
                                                  # i.e. the main command (+,-,! etc)
    x = switch(A,                                 # switch on the main command, execute the
            '+'=paste0(x,B),                      # corresponding expression and
            '!'=intToUtf8(rev(utf8ToInt(x))),     # store the result into x
            '*'=strrep(x,B),                      # Note: in the actual code we switch on
            '-'=B['',x,f=T],                      # the utf8 value MOD 13-2 of the command
            '$'=intToUtf8(sample(utf8ToInt(x))),
            '<'=print(x)
        )
    }
    x                                             # return x (and print it implicitly)
}


Basic Latin character name to character Let's get back to basics!

Your code, a complete program or function, must convert the official Unicode name of a printable Basic Latin character into the corresponding character. For example, for the input LOW LINE your code must output _.
You only need to take a single character name as input.
You cannot use any preexisting function or library, built-in or otherwise, which offers any logic relating specifically to Unicode character names (e.g. Python's unicodedata, Java's Character.getName, and so on.)
For input other than one of these names, any behavior is acceptable.

This is code golf: shortest code in bytes wins.

To avoid any ambiguity, this is the full set of official character names we'll be using (borrowed from this question):

     SPACE
!    EXCLAMATION MARK
"    QUOTATION MARK
#    NUMBER SIGN
$    DOLLAR SIGN
%    PERCENT SIGN
&    AMPERSAND
'    APOSTROPHE
(    LEFT PARENTHESIS
)    RIGHT PARENTHESIS
*    ASTERISK
+    PLUS SIGN
,    COMMA
-    HYPHEN-MINUS
.    FULL STOP
/    SOLIDUS
0    DIGIT ZERO
1    DIGIT ONE
2    DIGIT TWO
3    DIGIT THREE
4    DIGIT FOUR
5    DIGIT FIVE
6    DIGIT SIX
7    DIGIT SEVEN
8    DIGIT EIGHT
9    DIGIT NINE
:    COLON
;    SEMICOLON
<    LESS-THAN SIGN
=    EQUALS SIGN
>    GREATER-THAN SIGN
?    QUESTION MARK
@    COMMERCIAL AT
A    LATIN CAPITAL LETTER A
B    LATIN CAPITAL LETTER B
C    LATIN CAPITAL LETTER C
D    LATIN CAPITAL LETTER D
E    LATIN CAPITAL LETTER E
F    LATIN CAPITAL LETTER F
G    LATIN CAPITAL LETTER G
H    LATIN CAPITAL LETTER H
I    LATIN CAPITAL LETTER I
J    LATIN CAPITAL LETTER J
K    LATIN CAPITAL LETTER K
L    LATIN CAPITAL LETTER L
M    LATIN CAPITAL LETTER M
N    LATIN CAPITAL LETTER N
O    LATIN CAPITAL LETTER O
P    LATIN CAPITAL LETTER P
Q    LATIN CAPITAL LETTER Q
R    LATIN CAPITAL LETTER R
S    LATIN CAPITAL LETTER S
T    LATIN CAPITAL LETTER T
U    LATIN CAPITAL LETTER U
V    LATIN CAPITAL LETTER V
W    LATIN CAPITAL LETTER W
X    LATIN CAPITAL LETTER X
Y    LATIN CAPITAL LETTER Y
Z    LATIN CAPITAL LETTER Z
[    LEFT SQUARE BRACKET
\    REVERSE SOLIDUS
]    RIGHT SQUARE BRACKET
^    CIRCUMFLEX ACCENT
_    LOW LINE
`    GRAVE ACCENT
a    LATIN SMALL LETTER A
b    LATIN SMALL LETTER B
c    LATIN SMALL LETTER C
d    LATIN SMALL LETTER D
e    LATIN SMALL LETTER E
f    LATIN SMALL LETTER F
g    LATIN SMALL LETTER G
h    LATIN SMALL LETTER H
i    LATIN SMALL LETTER I
j    LATIN SMALL LETTER J
k    LATIN SMALL LETTER K
l    LATIN SMALL LETTER L
m    LATIN SMALL LETTER M
n    LATIN SMALL LETTER N
o    LATIN SMALL LETTER O
p    LATIN SMALL LETTER P
q    LATIN SMALL LETTER Q
r    LATIN SMALL LETTER R
s    LATIN SMALL LETTER S
t    LATIN SMALL LETTER T
u    LATIN SMALL LETTER U
v    LATIN SMALL LETTER V
w    LATIN SMALL LETTER W
x    LATIN SMALL LETTER X
y    LATIN SMALL LETTER Y
z    LATIN SMALL LETTER Z
{    LEFT CURLY BRACKET
|    VERTICAL LINE
}    RIGHT CURLY BRACKET
~    TILDE

IA-32 machine code, 161 160 122 bytes

Hexdump of the code:

33 c0 6b c0 59 0f b6 11 03 c2 b2 71 f6 f2 c1 e8
08 41 80 79 01 00 75 ea e8 39 00 00 00 08 2c 5e
4a bd a3 cd c5 90 09 46 04 06 14 40 3e 3d 5b 23
60 5e 3f 2d 31 32 29 25 2e 3c 7e 36 39 34 33 30
21 2f 26 7d 7c 2c 3b 7b 2a 37 5d 22 35 20 3a 28
5c 27 2b 38 5f 24 5a 3c 34 74 17 3c 1a 74 16 33
c9 86 c4 0f a3 0a 14 00 41 fe cc 75 f6 8a 44 02
0e c3 8a 01 c3 8a 01 04 20 c3

This code uses some hashing. By some brute-force search, I found that the following hash function can be applied to the bytes of the input string:

int x = 0;
while (s[1])
{
    x = (x * 89 + *s) % 113;
    ++s;
}

It multiplies x by 89, adds the next byte (ASCII-code), and takes a remainder modulo 113. It does this on all bytes of the input string except the last one, so e.g. LATIN CAPITAL LETTER A and LATIN CAPITAL LETTER X give the same hash code.

This hash function has no collisions, and the output is in the range 0...113 (actually, by luck, the range is even narrower: 3...108).

The hash values of all relevant strings don't fill that space completely, so I decided to use this to compress the hash table. I added a "skip" table (112 bits), which contains 0 if the corresponding place in the hash table is empty, and 1 otherwise. This table converts a hash value into a "compressed" index, which can be used to address a dense LUT.

The strings LATIN CAPITAL LETTER and LATIN SMALL LETTER give hash codes 52 and 26; they are handled separately. Here is a C code for that:

char find(const char* s)
{
    int hash = 0;
    while (s[1])
    {
        hash = (hash * 89 + *s) % 113;
        ++s;
    }

    if (hash == 52)
        return *s;
    if (hash == 26)
        return *s + 32;

    int result_idx = 0;
    int bit = 0;
    uint32_t skip[] = {0x4a5e2c08, 0xc5cda3bd, 0x04460990, 0x1406};
    do {
        if (skip[bit / 32] & (1 << bit % 32))
            ++result_idx;
        ++bit;
    } while (--hash);

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

The corresponding assembly language code (MS Visual Studio inline-assembly syntax):

_declspec(naked) char _fastcall find(char* s)
{
    _asm {
        xor eax, eax;
    mycalc:
        imul eax, eax, 89;
        movzx edx, [ecx];
        add eax, edx;
        mov dl, 113;
        div dl;
        shr eax, 8;
        inc ecx;
        cmp byte ptr [ecx + 1], 0;
        jne mycalc;

        call mycont;
        // skip table
        _asm _emit 0x08 _asm _emit 0x2c _asm _emit 0x5e _asm _emit 0x4a;
        _asm _emit 0xbd _asm _emit 0xa3 _asm _emit 0xcd _asm _emit 0xc5;
        _asm _emit 0x90 _asm _emit 0x09 _asm _emit 0x46 _asm _emit 0x04;
        _asm _emit 0x06 _asm _emit 0x14;
        // char table
        _asm _emit '@' _asm _emit '>' _asm _emit '=' _asm _emit '[';
        _asm _emit '#' _asm _emit '`' _asm _emit '^' _asm _emit '?';
        _asm _emit '-' _asm _emit '1' _asm _emit '2' _asm _emit ')';
        _asm _emit '%' _asm _emit '.' _asm _emit '<' _asm _emit '~';
        _asm _emit '6' _asm _emit '9' _asm _emit '4' _asm _emit '3';
        _asm _emit '0' _asm _emit '!' _asm _emit '/' _asm _emit '&';
        _asm _emit '}' _asm _emit '|' _asm _emit ',' _asm _emit ';';
        _asm _emit '{' _asm _emit '*' _asm _emit '7' _asm _emit ']';
        _asm _emit '"' _asm _emit '5' _asm _emit ' ' _asm _emit ':';
        _asm _emit '(' _asm _emit '\\' _asm _emit '\'' _asm _emit '+';
        _asm _emit '8' _asm _emit '_' _asm _emit '$';

    mycont:
        pop edx;
        cmp al, 52;
        je capital_letter;
        cmp al, 26;
        je small_letter;

        xor ecx, ecx;
        xchg al, ah;
    decode_hash_table:
        bt [edx], ecx;
        adc al, 0;
        inc ecx;
        dec ah;
        jnz decode_hash_table;

        mov al, [edx + eax + 14];
        ret;

    capital_letter:
        mov al, [ecx];
        ret;

    small_letter:
        mov al, [ecx];
        add al, 32;
        ret;
    }
}

Some noteworthy implementation details:

It uses a CALL instruction to get a pointer to the code, where the hard-coded table resides. In 64-bit mode, it could use the register rip instead.
It uses the BT instruction to access the skip table
It manages to do the work using only 3 registers eax, ecx, edx, which can be clobbered - so there is no need to save and restore registers
When decoding the hash table, it uses al and ah carefully, so that at the right place ah is decreased to 0, and the whole eax register can be used as a LUT index


Draw a Straight Line Draw a simple ASCII art image containing a straight line.
It's similar to this and this but with different specifications.

Input

You can modify this input format to suit your code.

integer width
integer height
integer x0
integer y0
integer x1
integer y1

Output

A filled ASCII art image of the specified width and height containing a line from pixel (x0, y0) to pixel (x1, y1).

Any standard form of text output is acceptable, but don't use built in line drawing functions.

Details

The line must be drawn using a single printable character (such as #), while the background is filled with a different character (such as .). You must print the necessary trailing characters so that the image size is correct.

Pixel coordinates can be 0-indexed or 1-indexed and can start in any corner of the image. The line should be drawn by imagining a 0-width sub-pixel line connecting the centers of the start and end pixels. Every pixel that the line enters should be filled in.

Winning

Usual code-golf rules. Shortest code wins.

Examples

IN: width, height, x0, y0, x1, y1

IN: 7, 6, 0, 0, 6, 5
OUT:
.....##
....##.
...##..
..##...
.##....
##.....

IN: 3, 3, 1, 1, 1, 1
OUT:
...
.#.
...

IN: 3, 3, 0, 2, 2, 0
OUT:
#..
.#.
..#

IN: 6, 3, 0, 0, 5, 2
OUT:
....##
.####.
##....

IN: 4, 4, -1, -1, 0, 3
OUT:
#...
#...
#...
....

Mathematica, 166 137 bytes

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

More readable version:

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

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

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

Explanation:

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

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

The way this works in the code is as follows:

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

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

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

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

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


This highway needs rain across both of its lanes In this challenge you will take a an ascii art image of a highway like so

 |   |   |  |  |  |
 |       |  |     |
 |   |   |  |  |  |
 |       |  |     |
 |   |   |  |  |  |
 |       |  |     |
 |   |   |  |  |  |

And you need to put rain across its lanes like so

 |\\\|\\\|  |\\|\\|
 |\\\\\\\|  |\\\\\|
 |\\\|\\\|  |\\|\\|
 |\\\\\\\|  |\\\\\|
 |\\\|\\\|  |\\|\\|
 |\\\\\\\|  |\\\\\|
 |\\\|\\\|  |\\|\\|

A highway will be defined as an ascii art string containing only the characters |,  and newlines. All rows of the image will have exactly the same number of characters.  Every column will be one of the following

Empty space, all spaces
A line, all |
A lane divider, alternating | and space

Furthermore there will always be a line before and after every lane divider.  So

|    |   | |   |
|          |   |
|    |   | |   |

would be valid but

|     |     |
|  |  |
|     |     |

would not be since there is no line after the last lane divider.

And a lane divider will never be exactly next to a line.
So

||   |
|    |
||   |

Is invalid but

|   ||  ||
|     | ||
|   ||  ||
|     | ||
|   ||  ||

is fine.

Additionally a highway must be at least two rows high and one column wide.

Task

Your job is to write a program or function that takes a valid highway (as a string or list of lines) as input and outputs the highway with rain across its lanes.

To put rain across a highway's lanes you must replace all space characters that appear between two consecutive lines, where those lines have at least one lane divider between them, with \s.  And leave all other characters the same.

So in the following diagram:

A   B   C   1   2  D
|   |   |       |  |
|   |   |   |      |
|   |   |       |  |
|   |   |   |      |

No rain should be put between A and B or B and C since there are no lane dividers between them, but rain should be put between C and D since lane dividers 1 and 2 are between them.

You may output an additional trailing newline, or add/remove trailing spaces from all lines equally if you wish.

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

Test cases

Simple case

 |   |   |  |  |  |
 |       |  |     |
 |   |   |  |  |  |
 |       |  |     |
 |   |   |  |  |  |
 |       |  |     |
 |   |   |  |  |  |

 |\\\|\\\|  |\\|\\|
 |\\\\\\\|  |\\\\\|
 |\\\|\\\|  |\\|\\|
 |\\\\\\\|  |\\\\\|
 |\\\|\\\|  |\\|\\|
 |\\\\\\\|  |\\\\\|
 |\\\|\\\|  |\\|\\|

Extra line

|    |   | |   |
|          |   |
|    |   | |   |

|\\\\|\\\|\|   |
|\\\\\\\\\\|   |
|\\\\|\\\|\|   |

Unsynced lane dividers

   |    |      |
   |        |  |
   |    |      |
   |        |  |
   |    |      |

   |\\\\|\\\\\\|
   |\\\\\\\\|\\|
   |\\\\|\\\\\\|
   |\\\\\\\\|\\|
   |\\\\|\\\\\\|

Empty road

|   |   |       |  |
|   |   |   |      |
|   |   |       |  |
|   |   |   |      |

|   |   |\\\\\\\|\\|
|   |   |\\\|\\\\\\|
|   |   |\\\\\\\|\\|
|   |   |\\\|\\\\\\|

False roads (suggested by Arnauld)

|   | | |   |
|   |   |   |
|   | | |   |
|   |   |   |

|   |\|\|   |
|   |\\\|   |
|   |\|\|   |
|   |\\\|   |

Hard lane divider

|  |  |  |  |
|     |     |
|  |  |  |  |
|     |     |

|\\|\\|\\|\\|
|\\\\\|\\\\\|
|\\|\\|\\|\\|
|\\\\\|\\\\\|

Adjacent lane dividers

|   ||  ||
|     | ||
|   ||  ||
|     | ||
|   ||  ||

|\\\||\\||
|\\\\\|\||
|\\\||\\||
|\\\\\|\||
|\\\||\\||

No lanes

|    |     |  |
|    |     |  |
|    |     |  |

|    |     |  |
|    |     |  |
|    |     |  |

One line

       |
       |
       |

       |
       |
       |

No lines

Jelly,  18  16 bytes

ZḢ”\E?€ṣ”|»Ṁ$€K»

A monadic Link accepting a list of lines, each of which is a list of characters, which yields another, similar list.

Try it online! Or see the test-suite.

How?

ZḢ”\E?€ṣ”|»Ṁ$€K» - Link: list of lists of characters (i.e. rows of text)
Z                - transpose - i.e. columns (each being: all spaces; all pipes; or a mix)
      €          - for each (column):
     ?           -   if...
    E            -   ...condition: all equal? - i.e. if not dashed
 Ḣ               -   ...then: head - i.e. the unique character
  ”\             -   ...else: literal '\' character
        ”|       - literal '|' character
       ṣ         - split at - i.e. highway chunks now contain spaces and '\' characters
             €   - for each (chunk):
            $    -   last two links as a monad:
           Ṁ     -     maximum - N.B. '\' > ' '
          »      -     maximum (vectorises across the chunk)
                 -   - i.e highway chunks become all '\', others remain as is
              K  - join with space characters
               » - maximum (vectorises across the rows)
                 -   - N.B. '|' > ' ' so the solid lines are not replaced by spaces; and
                 -          '|' > '\' so the dashed lines are not replaced with rain.


Moving CSS rules from a CSS file to inline attributes The goal is to take CSS rules from a regular CSS file and apply them to their respective targets in an HTML file, but by placing the rules in the style="" attribute (using the

Python - 508, 501, 483

The idea is to read all the rules then apply them by using xpath functions, too bad it can't select nodes with multiple classes (I didn't find own to target class="code golf").

Golfed

import sys,xml.etree.ElementTree as E
r=E.parse(sys.argv[2])
def a(e,f):e.set('style',(e.attrib.get('style')or'')+f)
for l in open(sys.argv[1]):
 s=l.replace("\n",'').split(' ');b=s[0];c=s[1][1:-1]
 if(b[:1])=='#':
  for e in r.findall('.//*[@id=\''+b[1:]+'\']'):a(e,c);e.attrib.pop('id')
 else:
  for e in r.findall('.//*[@class]'):
   d=e.attrib.get('class').split(' ')
   if b[1:]in d:
    a(e,c);e.set('class',' '.join(d[1:]))
    if len(d) == 1: e.attrib.pop('class')
E.dump(r)

Usage

python script.py input.css input.html

Ungolfed code

import sys, xml.etree.ElementTree as ET
root = ET.parse(sys.argv[2])

# append rules to style="" attribute
def a(e,f):
    e.set('style',(e.attrib.get('style')or'') + f)

# CSS file
for l in open(sys.argv[1]):
    split = l.replace("\n", '').split(' ')
    selector = split[0]
    rules = split[1][1:-1]

    # #id
    if (b[0:1]) == '#':
        for e in root.findall('.//*[@id=\''+selector[1:]+'\']'):
            a(e,rules)
            # remove id
            e.attrib.pop('id')
    # .class
    else:
        for e in root.findall('.//*[@class]'):
            d=e.attrib.get('class').split(' ')
            if selector[1:] in d:
                a(e,rules)
                e.set('class', ' '.join(d[1:]))
                # remove class
                if len(d) == 1:
                    e.attrib.pop('class')

ET.dump(root)