Books full of nonsense: Identify limericks As we all know, limericks are  short, five-line, occasionally-lewd poems with an AABBA rhyming scheme and an anapestic meter (whatever that is):

  Writing a Limerick's absurd
  Line one and line five rhyme in word
  And just as you've reckoned
  They rhyme with the second
  The fourth line must rhyme with the third

You are tasked to write the shortest program that, when fed an input text, prints whether it thinks that the input is a valid limerick. Input can either be on the command line or through standard input, at your option, and output could either be a simple "Y"/"N" or a confidence score, again at your option.

Here's another example of a correct limerick:

  There was a Young Lady whose eyes
  Were unique as to colour and size
  When she opened them wide
  People all turned aside
  And started away in surprise

But the poem below is clearly not a limerick, since it doesn't rhyme:

  There was an old man of St. Bees
  Who was stung in the arm by a wasp.
  When asked, "Does it hurt?"
  He replied, "No, it doesn't,
  I'm so glad that it wasn't a hornet."

Nor is this one, as the meter is all wrong:

  I heard of a man from Berlin
  Who hated the room he was in
  When I asked as to why
  He would say with a sigh:
  "Well, you see, last night there were a couple of hoodlums around who were celebrating the Bears winning the darned World Cup, and they were really loud so I couldn't sleep because of the din."

Clues

Here are some of the clues you could use to decide whether or not your input is a limerick:

Limericks are always five lines long.
Lines 1, 2 and 5 should rhyme.
Lines 3 and 4 should rhyme.
Lines 1, 2 and 5 have around 3x3=9 syllables, while the third and fourth have 2x3=6 syllables

Note that none of these except the first are hard-and-fast: a 100% correctness rating is impossible.

Rules

Your entry should at the very least correctly categorize examples 1 through 3 in a deterministic fashion.
You are allowed to use any programming language you would like, except of course programming languages specifically designed for this contest (see here).
You are not allowed to use any library except your programming language's standard offerings.
You are allowed to assume that this file, the CMU Sphinx pronounciation dictionary, is in a file called 'c' in the current directory.
You are not allowed to hard-code for the test inputs: your program should be a general limerick categorizer.
You are allowed to assume that the input is ASCII, without any special formatting (like in the examples), but your program should not be confused by interpunction.

Bonuses

The following bonuses are available:

Your program outputs its result as a limerick? Subtract 150 characters length bonus!
Your program also correctly identifies sonnets? Subtract 150 characters extra length bonus!
Your program outputs its result as a sonnet when used on a sonnet? Subtract 100 characters additional extra length bonus!

Finally...

Remember to mention which bonuses you think you deserve, if any, and subtract the bonus from your number of characters to arrive at your score. This is a code golf contest: the shortest entry (i.e. the entry with the lowest score) wins.

If you need more (positive) test data, check out the OEDILF or the Book of Nonsense. Negative test data should be easy to construct.

Good luck!

Python: 400 - 150 - 150 = 100

The shortest script I could come up with is that one...

import re,sys;f,e,c=re.findall,lambda l,w:f('^'+w.upper()+'  (.+)',l),lambda*v:all([a[i]==a[v[0]]for i in v]);a=[sum([[e(l,w)[0].split()for l in open('c')if e(l,w)][0]for w in f(r'\w+',v)],[])[-2:]for v in sys.stdin];n=len(a);print n==14and c(0,3,4,7)*c(1,2,5,6)*c(8,11)*c(9,12)*c(10,13)*"Sonnet"or"For a critic\nOf limerick\nWell-equipped\nIs this script.\n%s limerick!"%(n==5and c(0,1,4)and c(2,3))

...but don't even try it. It parses the provided dictionary for every word it meets, thus being very slow. Also, an error is generated whenever a word is not in the dictionary.

The code still meets the requirements though: recognizing whether the text passed via stdin is a limerick, a sonnet, or neither of those.

With only 20 more characters, here is the optimized version:

import re,sys;f,e,c=re.findall,lambda l:f(r'^(\w+)  (.+)',l),lambda*v:all([a[i]==a[v[0]]for i in v]);d={e(l)[0][0]:e(l)[0][1].split()for l in open('c')if e(l)};a=[sum([d.get(w.upper(),[])for w in f(r'\w+',v)],[])[-2:]for v in sys.stdin];n=len(a);print n==14and c(0,3,4,7)*c(1,2,5,6)*c(8,11)*c(9,12)*c(10,13)*"Sonnet"or"For a critic\nOf limerick\nWell-equipped\nIs this script.\n%s limerick!"%(n==5and c(0,1,4)and c(2,3))

Features

able to recognize sonnets (-150)
answers to limericks with a limerick (-150)
relatively fast: only one file parsing per execution

Usage

cat poem.txt | python poem-check.py

3 different outputs are possible:

a limmerick saying the input is one if it is the case
a limmerick saying the input is not one if it is the case
"Sonnet" if the input is recognized as such

Expanded code with explanations

import re, sys

# just a shortened version of the 're.findall' function...
f = re.findall
# function used to parse a line of the dictionary
e = lambda l:f(r'^(\w+)  (.+)', l)

# create a cache of the dictionary, where each word is associated with the list of phonemes it contains
d = {e(l)[0][0]:e(l)[0][1].split(' ') for l in open('c') if e(l)}

# for each verse (line) 'v' found in the input 'sys.stdin', create a list of the phoneme it contains;
# the result array 'a' contains a list, each item of it corresponding to the last two phonemes of a verse
a = [sum([d.get(w.upper(), []) for w in f(r'\w+',v)],[])[-2:] for v in sys.stdin]

# let's store the length of 'a' in 'n'; it is actually the number of verses in the input
n = len(a)
# function used to compare the rhymes of the lines which indexes are passed as arguments
c = lambda*v:all([a[i] == a[v[0]] for i in v])

# test if the input is a sonnet, aka: it has 14 verses, verses 0, 3, 4 and 7 rhyme together, verses 1, 2, 5 and 6 rhyme together, verses 8 and 11 rhyme together, verses 9 and 12 rhyme together, verses 10 and 13 rhyme together
if n==14 and c(0,3,4,7) and c(1,2,5,6) and c(8,11) and c(9,12) and c(10,13):
    print("Sonnet")
else:
    # test if the input is a limerick, aka: it has 5 verses, verses 0, 1 and 4 rhyme together, verses 2 and 3 rhyme together
    is_limerick = n==5 and c(0,1,4) and c(2,3)
    print("For critics\nOf limericks,\nWell-equipped\nIs this script.\n%s limerick!", is_limmerick)


Make me a bad fade animation... please Your task is to, as the title discreetly suggests, make a bad fade animation of one word turning into a second word for yours truly.

What exactly is this "fade animation" you may ask?

To make a spectacular(ly bad) fade animation, you take two strings which will contain only printable ASCII characters. You start by printing your starting string (the first of the two). Then, you randomly pick a character in the original word and change it to the corresponding character in the word you want to animate to. When the words are of unequal length, you must pad them with spaces.

You keep on doing this until all of the characters have been changed, but you will not change the character at a certain index more than once. Here is an example i/o:

Hey -> Peeps
Hey    # original string
Hey s  # replace char at index 4
Hey s  # replace char at index 1
Pey s  # replace char at index 0
Pee s  # replace char at index 2
Peeps  # replace char at index 3

You must write a function or full program that changes a letter and then prints the new string at increments of one second. The input format is loose, but the output format is strict.

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

Some test cases (Form: init -> final):

Stringy -> Blingy
Banana -> Republic
United -> States
Make America -> Tissue box
I like walls -> I have small hands
Hello, -> world!

Reference implementation in Python 2:

import random
import time
def F(c,f):
    print c                                      # before we do stuff
    if len(c)>len(f):f+=" "*(len(c)-len(f))      # add padding part 1
    if len(f)>len(c):c+=" "*(len(f)-len(c))      # add padding part 2
    c, f = list(c), list(f)
    ai = [i for i in range(len(c))]              # a list for keeping track
    while len(ai) > 0:                           #  of available indices
        time.sleep(1)                            # 1 second pause...
        i = ai.pop(random.randint(0,len(ai)-1))  # get a random index and remove
        c[i] = f[i]                              #   it from the list
        print ''.join(c)                         # print the new string

Pyth - 25 24 bytes
Will refactor.
AC.tQdV.SU
G
=XGN@HN.d_1

Try it online here.


A Quine on Every Line Your goal is to create a program that prints itself indefinitely, with a new line after each one. Thus, if your program is a one-liner, it would be repeated on every line of the output.

Example

Program:

A

Output:

A
A
A
...

Rules

It must be a complete program, not a snippet or function.
The program should loop forever without stack-overflow or recursion limit errors.
Output is to stdout or closest alternative.
No program input is accepted.
Standard loopholes are disallowed, such as opening the program's file or accessing an external resource. Empty programs are disallowed as a standard loophole.
If your program code ends with a trailing newline, this does not count as the necessary newline between quines, and you must print another.
codegolf - Shortest code wins!

Fission, 7 bytes

'!+!NR"

A rather simple modification of the shortest Fission quine I have found so far: I'm simply using the non-destructive ! instead of O and added an N for newline.

So all in all, here is how it works: control flow starts at the R with a right-going atom. " toggles string mode, which means everything until the next " is printed: in this case '!+!NR. That leaves the " and the newline to be printed. '! sets the atom's mass to 33, + increments it to 34 (the character code of ") and ! prints the quote. N prints a newline, and R is now a no-op in this case, so the loop starts over.

The following 7-byte solution also works:

"NR'!+!


Create a stem-and-leaf plot Related: Validate a stem-and-leaf plot
Input
A non-empty list of positive integers. If needed, they can be taken as strings. You cannot assume it is sorted.
Output
A stem-and-leaf plot of the numbers. In a this stem-and-leaf plot, numbers are ordered into stems by tens, then all numbers that fit into that stem have their ones value placed into the stem, and then all are sorted. In this challenge, newlines separate the stems, and spaces separate the stems from the leaves.
You may either include or exclude all empty stems that are between non-empty stems.
Test Cases
(lists can be taken in your language's list default, I used JSON for the below)
Including empty stems:
[1, 2, 3, 3, 3, 3, 3, 10, 15, 15, 18, 1, 100]

0 11233333
1 0558
2
3
4
5
6
7
8
9
10 0

[55, 59, 49, 43, 58, 59, 54, 44, 49, 51, 44, 40, 50, 59, 59, 59]

4 034499
5 0145899999

[10000, 10100]

1000 0
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010 0

Excluding empty stems:
[1, 2, 3, 3, 3, 3, 3, 10, 15, 15, 18, 1, 100]

0 11233333
1 0558
10 0

[55, 59, 49, 43, 58, 59, 54, 44, 49, 51, 44, 40, 50, 59, 59, 59]

4 034499
5 0145899999

[10000, 10100]

1000 0
1010 0

Python 2, 78 75 79 bytes

s=-1
for i in sorted(input()):
 if i/10^s:s=i/10;print'\n%d-'%s,
 print`i`[-1],

Try it online!


pb, 240 bytes

<[8]^w[Y!14]{w[X!24]{>[8]b[124]^b[124]v}vw[X!-8]{b[45]<}vv}>[12]^[12]b[49]>[12]w[T!8]{<[4]b[T+50]^<w[X%8!6]{b[65+T*3+X%8%3]>}>[10]vw[B!124]{<[24]vvv}t[T+1]}<[4]b[42]>[8]b[48]>[8]b[35]^[4]>w[B!0]{b[B+2]<}b[87]w[X!2]{<[5]w[B!0]{b[B+1]<}}b[80]

(This program will prompt for input in the current version of pbi, because it goes to Y=-1 and the B variable tries to update itself. Even if you do enter input, nothing will break. It's annoying but it's better than the old version that prompted for input no matter what.)

pb is a language all about treating the terminal as a 2D canvas. To output, you have to move the "brush" (a point represented by the current values of the X and Y variables) to where you want that character to go and put it there. It's cumbersome for things like printing out a word but for art it's often convenient.

This program doesn't actually draw exactly what the question specifies. (Wait, don't downvote me yet! Let me explain!)

Drawing boxes with loops is pretty easy, but there's a catch. If you repeat the following shape:

--------
|
|

You do get boxes, but the right and bottom ones will be open. You can manually draw the extra sides, but that costs bytes. To get around this, my program actually draws this, with the open edges on the left and top:

        |       |       |       |
        |       |       |       |
 --------------------------------
        |       |  ABC  |  DEF  |
        |   1   |   2   |   3   |
 --------------------------------
        |  GHI  |  JKL  |  MNO  |
        |   4   |   5   |   6   |
 --------------------------------
        | PQRS  |  TUV  | WXYZ  |
        |   7   |   8   |   9   |
 --------------------------------
        |       |       |       |
        |   *   |   0   |   #   |
 --------------------------------

  But monorail! That's not what the spec says! You can't just draw something else because it's easier and you feel like it! Also, while I have your attention, you are very smart and cute.

Shh, shh, it's okay. pb allows you to "write" to a point on the canvas with one or more negative values in its coordinates. The value is stored while the program runs, but only points where X and Y are both >= 0 are actually written to the screen. This program positions the brush so that areas that are tinted in this image have a negative X or Y:

Although extra lines are "drawn", they're never printed.

After looping through and creating the grid, this program fills in the top nine boxes. The first is hardcoded, a 1 is written and the program moves on. The other eight are generated programmatically. Ignoring code for moving to the next box, noticing when the row is empty, etc (assume the brush always starts on the bottom row of the box and in the middle column), this is what is run eight times:

b[T+50]
^<w[X%8!6]{b[65+T*3+X%8%3]>}
t[T+1]

Even knowing that b is the command to write a character, ^v<> move the brush and w[a!b]{} runs the code in curly braces until a != b, this is hard to follow. The first important thing to note is that you can't define variables in pb. There are six in every program and you have to learn to live with them. Second, T is the only variable that you can actually use the way you're used to using variables; assigning a value and then reading it later. Every other variable either can't be set and just tells you something about the point in the canvas you're on or can only be set indirectly and with side effects (^v<> change X and Y, which also changes the brush location. c sets P to (P+1)%8, which also changes the output colour). Keeping a counter for what number needs to be written and which letters is simply impossible. Instead, this code only keeps track of the number and figures out the letters based on it. Here's how:

b[T+50]                       # We start printing at box 2 with T==0, 0+50=='2'
^<                            # Go up and to the left of the number
w[X%8!6]{                     # Take the X coordinate mod 8 so it's like we're in
                              # the leftmost box. Until hitting the sixth cell:
    b[                          # Write this character:
      65                          # 'A'
      + T * 3                     # Number of current box - 2 (letters start at
                                  # 2) * 3 (3 letters per box)
      + X % 8 % 3                 # X % 8 makes every box behave like it's on the
                                  # left, % 3 puts 0 at the point where the first
                                  # letter goes, then 1, then 2. This is how each
                                  # letter is made different in a box.
    ]
    >                           # Move to the right
}
t[T+1]                        # Box is done, increase counter

This is imperfect, as only 3 letters are put into boxes 7 and 9. So, after filling the bottom row (simple hardcoding), each letter in box 9 is increased by 2 and the W is placed manually. Similarly, every letter in boxes 7 and 8 are increased by 1 and the P is placed manually.

Ungolfed:

<[8]^                         # Go to (-8, -1)
w[Y!14]{                      # While the brush is not on Y=14:
    w[X!24]{                      # While the brush is not on X=24:
        >[8]                          # Go right 8
        b[124]^b[124]v                # Draw a pipe at the current location and above it
    }
    vw[X!-8]{b[45]<}              # Go down and draw hyphens all the way until X=-8
    vv                            # Go down by 2 to start drawing next row
}
>[12]^[12]b[49]               # Write a 1 in the first box
>[12]                          # Go to the bottom pipe on the right of box 2
w[T!8]{                       # While T is not 8:
    <[4]                          # Go to center cell of the box
    b[T+50]                       # Write the number that belongs there
    ^<w[X%8!6]{b[65+T*3+X%8%3]>}  # Write the letters
    >[10]v                        # Go to the next box
    w[B!124]{                     # If the next box isn't there:
        <[24]vvv                      # Go down a row
    }
    t[T+1]                        # Increase counter
}
<[4]b[42]>[8]b[48]>[8]b[35]   # Put the asterisk, 0 and hash in their boxes
^[4]>w[B!0]{b[B+2]<}          # Increase all letters in the 9th box by 2
b[87]                         # Put a W in the 9th box
w[X!2]{<[5]w[B!0]{b[B+1]<}}   # Increase all letters in the 7th/8th box by 1
b[80]                         # Put a P in the 7th box


From 0 to 2^n - 1 in POPCORN order ... Ah sorry, no popcorn here, just POPCNT.

Write the shortest program or function which takes in a number n and output all integers from 0 to 2n - 1, in ascending order of number of 1 bits in the binary representation of the numbers (popcount). No duplicates allowed.

The order of numbers with the same popcount is implementation-defined.

For example, for n = 3, all these output are valid:

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

The input and output format are implementation-defined to allow the use of language features to further golf the code. There are a few restrictions on the output:

The numbers must be output in decimal format.
The output must contain a reasonable separator between the numbers (trailing separator allowed, but not leading).

Line feed (\n), tab (\t), space, ,, ., ;, |, -, _, / are quite reasonable separator. I don't mind additional spaces for pretty printing, but don't use letter or digits as separators.
The numbers and separators can be surrounded by [ ], { } or any array or list notation.
Don't print anything else not stated above.

Bonus

Multiply your score by 0.5 if your solution can generate the number on the fly. The spirit of this bonus is that if you were to directly convert your printing solution to a generator, the generator only uses at most O(n) memory where n is the number of bits as defined above. (You don't have to actually convert your solution to generator). Note that while I impose n <= 28, the memory needed to store all numbers still grows exponentially, and a naive sorting solution would hog up at least 4 GB of memory at n = 28.

Please add some simple explanation of how your solution works before claiming this bonus.

Pyth, 9 bytes
osjN2U^2Q

order by the sum of the base 2 representation (jN2) over the range (U) of 2 ^ Q.
(Q = eval(input())).
Try it here.


Convert Input to Direction Challenge

Given input in the form <n1>, <n2> where number can be -1, 0, or 1, return the corresponding cardinal direction. Positive numbers move East in the x-axis and South in the y-axis, Negative numbers move West in the x-axis and North in the y-axis.

Output must be in the form South East, North East, North. It is case-sensitive.

If the input is 0, 0, your program must return That goes nowhere, silly!.

Sample Input/Outpot:

1, 1 -> South East

0, 1 -> South

1, -1 -> North East

0, 0 -> That goes nowhere, silly!

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

Japt, 55 51 bytes

`
SÆ
NÆ° `·gV +`
E†t
Wƒt`·gU ª`T•t goƒ Í2€e, Ðéy!

Explanation

                      // Implicit: U, V = inputs
`\nSÆ \nNÆ° `       // Take the string "\nSouth \nNorth ".
·                     // Split it at newlines, giving ["", "South ", "North "].
gV                    // Get the item at index V. -1 corresponds to the last item.
+                     // Concatenate this with
`\nE†t\nWƒt`·gU       // the item at index U in ["", "East", "West"].
ª`T•t goƒ Í2€e, Ðéy!  // If the result is empty, instead take "That goes nowhere, silly!".
                      // Implicit: output result of last expression

Try it online!


Stealing sequences: Robbers This is cops-and-robbers. This is the Robbers thread. For the cops thread, go here.
I've noticed a number of OEIS challenges since I joined the site. It seems only fair that we have a cops-and-robbers challenge that determines who is the master of online integer sequences, once and for all.
Cops
Write a program or function that, given no input, deterministically prints any sequence from the OEIS. By deleting some subset of the characters, your program must be able to print a different OEIS sequence when run in the same language. The new sequence must be entirely new, not just the first by a different name or with a different offset. Neither sequence may be simply a repeated constant value.
You must provide the first function, along with the name of the OEIS sequence so correctness can be verified. It's OK if behavior gets questionable around your language's MAX_INT value or 256, whichever is larger.
Robbers
Delete characters from some Cop's submission such that your new program outputs any other sequence from the OEIS. Provide the new function along with the name of the new OEIS sequence. Your new sequence may not simply be a repeated constant value.
It's in your best interest to delete as many characters from the Cop's submission as possible. If another robber (anyone except the Cop who authored the original program) comes along and finds a shorter solution that finds another different sequence, that robber steals your point. (Note that simply golfing off characters and printing the same sequence is not sufficient to steal the point.)
Rules & Scoring
If, after one week, nobody has been able to crack your solution, you can mark your solution as safe by providing the second program along with the name of the sequence it generates.
You get one point for each safe posting and one point for each submission you crack. Note that another robber can steal your point from the cracked submission at any time by providing a shorter program that yields a different sequence.
Cops may only post one challenge per language.
The player with the most points at 12:00 UTC on 7 July wins.

C (gcc), Govind Parmar 142 bytes deleted

Golfed more thanks to @StephenS.  I'm not sure it matters, but just for the spirit of the site!

#include<stdio.h>
#include<limits.h>
main(){int i,n;for(i=0;i<INT_MAX;i++){n=i;printf("%d,",n);}}

Try it online!

Sequence: A001477


Keep track of a Roulette game You're writing a program for a new automated roulette croupier to be installed in a major casino. Unfortunately, the last guy bailed out on the company and published buggy software. You're stuck with a thousand burned flash chips with only a few kilobytes of space to store a working program. Can you do it?

The task is to write a program which will accurately handle bets, wins and losses of a roulette game.

It will be run as a session. When it initialises, players place their bets which are sent through STDIN. Once all bets have been received, the input for where the ball landed is given. The program must then calculate the winnings for each of the players and the casino.

A single zero wheel is assumed. Assume dollars will be bet (not chips) and that the input is always valid. You only need to support the "outside bets" and numbered bets (lists of numbers, not named.) Payouts are described on the Wikipedia article.

Outside bet names: c1, c2, c3 (1st-3rd column), d1, d2, d3 (1st-3rd dozen), o (odd), e (even), r (red), b (black), 1-18, 19-36.

Example session (> indicates input, < indicates output):

> 7 800

Place a bet on the number "7" only, for $800.

> 8,9,10,11 50

Place a bet on the range "8,9,10,11", for $50.

> c1 2000

Place a bet on "1st column" (1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34) for $2000.

> ok
> 7

All players done. Pocketed in 7.

< 1 28800
< 2 0
< 3 6000

Payout details: #1 gets 36x original bet (35-to-1), #2 did not win and #3 gets 3x original bet (2-to-1)

< c -34750

Casino is down $34,750.

Deciding the winner

Code space is critical so the smaller the program the better. The smallest program implementing all of the described features will be the winner, unless bonus features are present, in which case the best overall program will be decided based on the combination of size and features supported.
The program must implement at least the bets described above, but support for other types, as well as number bets such as splits and baskets will be considered and may add bonus points.

Python, 443 440 chars

R=range
N=37
V=91447186090
M={'e':R(0,N,2),'o':R(1,N,2),'r':[i for i in R(N)if V>>i&1],'b':[i for i in R(1,N)if~V>>i&1],'1-18':R(1,19),'19-36':R(19,N)}
for i in R(1,4):M['c%d'%i]=R(i,N,3);M['d%d'%i]=R(i*12-11,i*12+1)
for i in R(1,N):M[`i`]=[i]
B=[]
r=raw_input()
while'ok'!=r:x,k=r.split();B+=[(sum((M[y]for y in x.split(',')),[]),int(k))];r=raw_input()
z=input()
c=0
i=1
for b,k in B:v=36/len(b)*k*(z in b);print i,v;c+=k-v;i+=1
print'c',c

Makes M, a map from bet names to a list of numbers that win that bet.  Then it reads the bets in, storing each one as a pair (list of numbers, dollar amount) in the list B.  Finally, reads in the spin z and computes the payouts.


Generate some rough numbers Background

A number n can be described as B-rough if all of the prime factors of n strictly exceed B.

The Challenge

Given two positive integers B and k, output the first k B-rough numbers.

Examples

Let f(B, k) be a function which returns the set containing the first k B-rough numbers.

> f(1, 10)
1, 2, 3, 4, 5, 6, 7, 8, 9, 10

> f(2, 5)
1, 3, 5, 7, 9

> f(10, 14)
1, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59

Python 3, 80, 75 bytes

lambda B,k:[i for i in range(1,-~B*k)if all(i%j for j in range(2,B+1))][:k]

Try it online!

Thanks to shooqie for saving 5 bytes.

This assumes that the k'th B-rough number will never exceed \$B * k\$, which I don't know how to prove, but seems like a fairly safe assumption (and I can't find any counterexamples).

Alternate solution:

Python 2, 78 bytes

B,k=input()
i=1
while k:
 if all(i%j for j in range(2,B+1)):print i;k-=1
 i+=1

Try it online!

This solution does not make the above solution. And is much more efficient.


Golf the smallest circle! The problem:

Given a non-empty set of points in the Cartesian plane, find the smallest circle that encloses them all (Wikipedia link).

This problem is trivial if the number of points is three or less (if there's one point, the circle has a radius of zero; if there are two points, the line segment that joins the points is the diameter of the circle; if there are three (non-colinear) points, it's possible to get the equation of a circle that touches them all if they form a non-obtuse triangle, or a circle that touches only two points and encloses the third if the triangle is obtuse). So, for the sake of this challenge, the number of points should be greater than three.

The challenge:

Input: A list of 4 or more non-colinear points. The points should have X and Y coordinates; coordinates can be floats. To ease the challenge, no two points should share the same X coordinate.
For example: [(0,0), (2,1), (5,3), (-1,-1)]
Output: A tuple of values, (h,k,r), such that \$(x-h)^2 + (y-k)^2 = r^2\$ is the equation of the smallest circle that encloses all points.

Rules:

You can choose whatever input method suits your program.
Output should be printed to STDOUT or returned by a function.
"Normal", general-purpose, languages are preferred, but any esolang is acceptable.
You can assume that the points are not colinear.
This is code-golf, so the smallest program in bytes wins. The winner will be selected one week after the challenge is posted.

Please include the language you used and the length in bytes as header in the first line of your answer: # Language: n bytes

Test cases:

1:

Input: [(-8,0), (3,1), (-6.2,-8), (3,9.5)]
Output: [-1.6, 0.75, 9.89]

2:

Input: [(7.1,-6.9), (-7,-9), (5,10), (-9.5,-8)]
Output: [-1.73, 0.58, 11.58]

3:

Input: [(0,0), (1,2), (3,-4), (4,-5), (10,-10)]
Output: [5.5, -4, 7.5]

4:

Input: [(6,6), (-6,7), (-7,-6), (6,-8)]
Output: [0, -0.5, 9.60]

Happy golfing!!!

Related challenge:

Area of a 2D convex hull

Wolfram Language (Mathematica), 28 27 bytes

#~BoundingRegion~"MinDisk"&

Try it online!

Built-ins are handy here. Output is a disk object with the centre and radius. Like others, I’ve found the 2nd and 3rd test cases to be different to the question.

Thanks to @lirtosiast for saving a byte!

If a list is required as output, this can be done in 35 bytes (at the cost of an additional 8 bytes). Thanks to @Roman for pointing this out.


Generate an understandable sentence Problem:

Generate a sentence that can be read and understood. It must contain a subject, verb, and object, and tenses and plurals must match. The program must also be able to generate several different sentences to qualify.

Rules:

Hard-coding the sentences is not permitted, and nor is reading them directly from a file (i'm looking at you, unclemeat)
You can have any number of word lists
Submit an example sentence or 2 that have been generated by your program
Any language is accepted
It's a popularity-contest, so the most upvoted answer wins

Matlab

why

example of outputs:

>> why
The programmer suggested it.
>> why
To please a very terrified and smart and tall engineer.
>> why
The tall system manager obeyed some engineer.
>> why
He wanted it that way.

[This is one of Matlab's easter eggs]

EDIT: you can see the code of this function here: why.m


Mutual exclusive equinox Your sourcecode must not contain any of the characters it outputs (case sensitive).
Your program must not output more than 500 characters/bytes. 1 byte = 1 char. Newline counts as 1 character.
Your program should not take any input. (from user, filename, network or anything).
Your program must output words/phrases worth a total of minimum 700 points according to the following score table (case sensitive):

Score table:

me                        - 2   points
ore                       - 3   points
freq                      - 5   points
pager                     - 7   points
mentor                    - 11  points
triumph                   - 13  points
equipage                  - 17  points
equipment                 - 19  points
equivalent                - 23  points
equilibrium               - 29  points
unubiquitous              - 31  points
questionnaire             - 37  points
Mutüal 3xcLUs1ve_Equino>< - 400 points

4.1 Each word can be repeated but lose 1 point for each repetition (with exception for the last phrase worth 400 points, you must not repeat that in the output). For example:

four of equilibrium (in any place) in the output = 29+28+27+26 points.

4.2 Letters in the output can be used in more than one word, for example:

equipager = equipage and pager = 17+7 points.

This is code-golf, shortest sourcecode in bytes wins! Good luck, have fun!

Golfscript, 24 characters
"QUESTIONNAIRE"{32+}%36*

Way too easy.
36 repetitions of "questionnaire" = 36*13 characters = 468 characters.
36 repetitions of "questionnaire" = 37+36+...1 point = (37+1)(37)/2 points = 703 points.


Counting King's Hamiltonian Paths through 3-by-N grid Background
A Hamiltonian path is a path on a graph that steps through its vertices exactly once. On a grid, this means stepping through every cell exactly once.
On a square grid, a Chess King can move to a horizontally, vertically, or diagonally adjacent cell in one step.
Challenge
Count the number of Hamiltonian paths using Chess King's moves through a square grid of 3 rows and N columns (denoted X below), starting at the left side of the entire grid (denoted S below) and ending at the right side (denoted E below):
  <------N------>
  X X X ... X X X
S X X X ... X X X E
  X X X ... X X X

In other words, count all paths from S to E that passes through every X exactly once using only King's movements.
Standard code-golf rules apply. The shortest code in bytes wins. Kudos if you can solve this with short code in a way other than brute-forcing all possible paths.
Test cases
Generated using this APL code (equivalent Python 3 + Numpy) which I created by finding 15 possible states of the rightmost column and deriving a 15-by-15 transition matrix (figures up to N=3 are crosschecked with a pure brute-force Python).
N  -> Answer
0  -> 1
1  -> 2
2  -> 28
3  -> 154
4  -> 1206
5  -> 8364
6  -> 60614
7  -> 432636
8  -> 3104484
9  -> 22235310
10 -> 159360540

Thanks to @mypronounismonicareinstate and @ChristianSievers for confirming the test cases in the sandbox.

Wolfram Language (Mathematica), 76 72 bytes
LinearRecurrence[{6,12,-27,2,30,4,-6},{0,0,1,2,3,29,155}-6/5,{#+4}]+1/5&

Try it online!
The non-homogeneous linear recurrence equation is so much shorter to express that it saves a few bytes to modify the code to handle non-homogeneous linear recurrence.
More info: In this case, it cannot be represented as a polynomial. I tried to put the recurrence into RSolve, but it takes a long time to figure out the exact symbolic form (I terminate it before it completes), and I'm pretty sure that the required coefficients are irrational (approximate numerical formula can be obtained).
Returns a singleton list containing the result.


Traders to the Death You are a foreign trader, hoping to make a profit.  There are 5 goods people wish to trade: Apricots, Boars, Canaries, Daffodils, and Earwigs.  Starting in the winter, you need to decide what to produce.  Then, in the fall, you travel and spend your days trading for a profit.
Gameplay
You start the game with 10 of each product in storage.  Each year, you will consume 2 of each product.
At the beginning of the game, you receive a list of 5 products, along with the amount you will be able to produce each year (ex:5-A,6-B,3-C,12-D,4-E).  You then will return a letter A through E deciding what to produce.
Then, in the fall time you will bring your products (including those in storage) to the market.  You have 50 turns to trade.
You must decide if you want to Purchase, Sell, or Leave the market.  The buyers will then be paired up randomly with the sellers.  If a group has extra, the random extras will miss out this turn.  If a trader is skipped, they will receive S, otherwise, T.  The seller must decide what he wants to sell, and amount (ex:3-A), and then what he would accept (ex:5-B,2-D,1-E) (The values are any of not all of).  The buyer will then be told what product the seller is selling, then the products the seller will take for it, and he can choose a product to trade for it (ex: D or X for nothing).
After all trades are over, or after you have left the market, you will consume 2 of each product, and the year starts over.  If you have less than 2 of any 1 product, you will die (and passed Q).
Your score will be the number of years you last, and after 50 games, your scores will be averaged for your total score.
Optional moves
At any time you can return G to query your goods
At any time you can return N to query the number of new products in your inventory (produced by any player in the past year, and new products will be traded before old products)
At any time you can return T for the current Turn phrase: Produce, Market, or Trading
During a trade, you can query I for an identifier unique to the player you are trading with.
During a trade, you can return M to query the number of people trading
How to code it:
You may use any standard language, and must include a command.txt which is the command to run your program.
The general flow of your program should be:
Get productivity
While alive:
    Output product you want to produce
    While in trading:
        Output whether you want to purchase or sell
        Get whether or not you were skipped.  If not skipped:
            If purchasing:
                print product you offer, and products you will accept
            Else:
                Get product offered, products being accepted, and choose the product you will give

I have a tester program here.  To use it, create a folder in the bots folder with your bot's name.  Add a command.txt, your program, and anything else your program needs.  I will be adding submissions as they come in.  If you don't want to install the languages required to run some or all of them, you just need to delete the command.txt in the bot's folder.
Inner Workings
There will be 5 bots for each program submitted.  The ID will be different for bots of the same type.
I will call the amount a person can produce a given product the productivity. Each product will be given a base productivity, where all of the base productivity will add up to 30.  One of the scores will be ensured to be at most 3, and all will be at least 2.
Then, each player's productivity will vary from the base productivity (One value will vary by +2, another +1, then +0, -1, and the remaining value will vary by -2).
The base productivity will change from game to game.
Scores:
seer:                10.128 years
level_headed_trader: 8.196 years
introvert:           6.856 years
random_ando:         5.408 years
hoarder_trader:      4.12 years
ratio_trader:        3.532 years
scared_trader:       3.056 years

Level-headed Trader

This bot tries to make his quantities as equal as possible

command.txt

python leveller.py

leveller.py

import sys

def current_goods():
    print "G"
    return parse_goods(readline())

def parse_goods(good_string):
    return dict([(a, int(b))
                 for a, b in [product.split("-")
                              for product in good_string.split(",")]])

def get_minimum(goods):
    cur_min = 200
    min_good = "X"
    for good, amount in goods.items():
        if amount < cur_min:
            min_good = good
            cur_min = amount
    return min_good

def get_maximum(goods):
    cur_max = -1
    max_good = "X"
    for good, amount in goods.items():
        if amount > cur_max:
            max_good = good
            cur_max = amount
    return max_good

def add_goods(x, y):
    return {k: int(x.get(k, 0)) + int(y.get(k, 0)) for k in set(x) | set(y)}

def readline():
    line = sys.stdin.readline().strip()
    if line == 'Q' or not line:
        exit()
    return line

def output_goods(goods):
    print ",".join([good+"-"+str(amount) for good, amount in goods.items()])

def output_good(good, amount):
    print good+"-"+str(amount)

def current_turn_is(turn):
    print "T"
    return readline() == turn

turns = MARKET, PRODUCE, TRADING, SKIPPED = "M", "P", "T", "S"
market_options = PURCHASE, SELL = "P", "S"
items = APRICOTS, BOARS, CANARIES, DAFFODILS, EARWIGS, NOTHING = "A", "B", "C", "D", "E", "X"

productivity = parse_goods(readline())
while True:
    product_to_produce = get_minimum(current_goods())
    print product_to_produce
    while current_turn_is(MARKET):
        print SELL
        if readline() != SKIPPED:
            maximum = get_maximum(current_goods())
            goods = {"A": 1, "B": 1, "C": 1, "D": 1, "E": 1}
            del goods[maximum]
            output_good(maximum, 1)
            output_goods(goods)


The bunker of the math lecturer After giving back the results of the last topology exam to his students, Pr. Manifold was worried about complaints.

Since he is aware his students know where his office is located, Prof. Manifold decided to transform his office into a bunker with a 10 digit password (all characters are digits).

But he suspected his students to be very clever (despite having tremendously bad grades).

Knowing that, he's not going to pick a password containing certain sequences, such as his StackExchange ID, university parking spot number, and annual salary.

Your task

Your program or function will take as input an array of integers. No single integer will contain duplicate digits, which implies that none of the integers will have more than 10 digits.

Your code will output how many unique 10 digit passwords Prof. Manifold can choose, taking into account that correct passwords

must contain each digit 0-9 exactly once, and
must not contain any of the sequences present in the input array.

Example

Input: [18062,6042,35876]

1806234579, 6042135789, 3587612409, 3418062579, 1237896042, and 1243587609 are all incorrect passwords, because they each contain at least one of the sequences present in the input array.
0113456789 is an incorrect password, because the professor's password must contain each digit exactly once.
0123456789 is a correct password, because it doesn't contain any sequence present in the array, and it contains each digit exactly once.

Test case:

[18062,6042,35876] -> 3622326

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

Jelly, 14  11 bytes

-3 bytes thanks to Dennis (avoid a chain separation allowing some implicit actions; use a filter to avoid the two byte œ& multi-set intersection I was using.)

⁵ḶŒ!Ẇf¥ÐḟDL

Try it online! - the specified version is far too slow for the online interpreter, so this is a proof of concept test suite:
- it does the same thing for only 5 digits 01234,
- the first example is the empty list, yielding 120 as expected (5!),
- the last returns 1 as the only permutation still available to the professor is 04321,
- an offline run of the full version with input [18062,6042,35876] yielded 3622326 as expected.

How?

⁵ḶŒ!Ẇf¥ÐḟDL - Main link: list a
⁵           - literal 10
 Ḷ          - lowered range: [0,1,2,3,4,5,6,7,8,9]
  Œ!        - all permutations
         D  - decimal list (vectorises across a)
       Ðḟ   - filter discard (from the permutations) if: (note - non-empty is truthy)
      ¥     -   last two links as a dyadic operation:
    Ẇ       -     all sublists (of the current permutation)
     f      -     filter keep (if in the decimal list)
          L - length


Approximate a given image using only colors from a given list The Specs

Your program must read the image from one file and write the results to another file, the name of at least the first of which should be taken from the input
You may accept and return any image format or formats, as long as you specify in your answers which ones you are using
An exception should be thrown if the specified source file does not exist
The final image must be as close as possible to the initial image (by per-pixel euclidean metric on RGB values) while using only colors from a list read from the file "colors.txt" (it will not necessarily use all of them)
When determing the nearest color, you should use the euclidean metric on RGB values, Δc=sqrt((Δr)2+(Δg)2+(Δb)2), when two or more colors on the list are equally close, any of those colors is valid
The list of colors given will be formatted with one rgb color code on each line, with spaces seperating the red, green, and blue values
You may assume that at least three but no more than 1,000 colors will be listed

This is code golf, so the shortest program wins

Some test cases:

(if RGB values in the output images do not exactly match those in the list, this is due to a problem with Java's ImageIO.write)

input:

colors.txt:

255 0 0
250 150 0
255 50 0
0 0 200
0 0 80
0 0 0

output:

input:

colors.txt:

100 60 0
0 0 20
0 0 70
0 20 90
15 15 15
100 100 100
120 120 120
150 150 150

output:

input:

colors.txt:

0 0 0
10 20 15
25 25 20
35 30 20
40 35 25
55 55 60
70 60 50
130 100 80
130 140 145
140 100 70
165 130 90
200 160 130
230 210 220
250 250 250

output:

input:

colors.txt:

0 0 0
70 50 40
80 0 0
120 100 90
120 120 120
170 150 90
170 170 170
170 200 195
190 140 100
190 205 165
210 170 120

output:

Again, I put together a java program to generate the sample output. I'll golf it down a little further, and then I may post it as an answer later.

Mathematica 109 100 97 111
Update: now outputs the image as required.
The function, f, replaces a single pixel with the closest pixel found in the input file (in this case, "colors.txt").
t is the output file.
The function, g, applies f to each pixel in the input image.
g[i_,h_,t_]:=Export[t,(c=Import[h,"Data"]/255;
f@p_:=Sort[{p~EuclideanDistance~#,#}&/@c][[1,2]];f~ImageApply~i)]

Test Cases
Example 1: Seascape
(*creating "colors.txt"*)
    c = "255 0 0
      250 150 0
      255 50 0
      0 0 200
      0 0 80
      0 0 0";
    Export["colors.txt", c]

Example 2: Earth from moon
I'll skip the part about storing the color info into "colors.txt".
It closely follows example 1.

Example 3: Jupiter

Example 4: American Gothic


Find the next subpermutation of base-64 digits Permutations of a set have a natural order called lexicographic order in which two permutations are compared by comparing the first position at which they differ. For the purposes of this question we're working with base 64 and the order of the digits is

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/

Note that this is not the same order as their ASCII values.

This ordering can be extended naturally to handle subpermutations of a given length.

Task

Write a program, function or named verb which takes as input (via stdin in the case of a program or as an argument otherwise) a 12-character subpermutation of the base-64 alphabet given above, and which produces (respectively to stdout or as the return value) the lexicographically next 12-character subpermutation. If working with typed input you may use strings or character arrays holding the ASCII values of the digits listed above.

Your solution should be relatively efficient; and in particular, it is forbidden to loop through base-64 numbers testing them until you find one which doesn't repeat any digits.

It is only required that your program handle 12-character subpermutations, but you do not need to verify that the input is 12 characters in length; if it handles other lengths too you may wish to mention that in your answer.

If the input is the lexicographically greatest subpermutation, the output should wrap round to the lexicographically smallest subpermutation.

Test cases

Input           Output
ABCDEFGHIJKL    ABCDEFGHIJKM
ABCDEFGHIJK+    ABCDEFGHIJK/
ABCDEFGHIJK/    ABCDEFGHIJLK
ABCDEFGHIJLK    ABCDEFGHIJLM
ABCD/9876542    ABCD/9876543
ABCD/9876543    ABCD/987654+
ABCD/987654+    ABCD/98765+E
ABCD/98765+E    ABCD/98765+F
ABCDEF+/9875    ABCDEF+/9876
ABCDEF+/9876    ABCDEF/GHIJK
ABCDEF/GHIJK    ABCDEF/GHIJL
ABCDEF/GHIJL    ABCDEF/GHIJM
ABCDEFG+/987    ABCDEFG/HIJK
A+/987654321    A/BCDEFGHIJK
/+9876543210    ABCDEFGHIJKL

GolfScript, 115 characters
:I,,0\{26,{65+.32+}%$10,{`}%'+/'++:A,1$-@*\)I<)A@-?+}/1I,,{A,\-*}/\)1$%\I,,{A,\-/\.2$%\2$/@\}%*>A\{1$=\[1$]-\}%\0<+

It passes all the test cases and works also for subpermutations of size other than 12 and for full permutations as well.
Online tester
Annotated Code:
:I                        # save input to variable I

### get the numerical index of the (sub)permutation
,,0\                      # push 0 (accumulator) and [0 .. <Length I>-1]
{                         # loop over

  ### construct the alphabet A
  26,{65+.32+}%$          # A-Z and a-z
  10,{`}%                 # 0-9
  '+/'++                  # append '+/'
  :A                      # save to variable A

  ,1$-                    # length of alphabet (i.e. 64) minus loop variable
                          # i.e. 64 -> 63 -> 62 -> 61 -> ...
                          # (this is the number of possible characters at
                          # the current position)
  @*                      # multiply the accumulator by this value
  \)I<                    # get anything from the input up to the current character
  )                       # extract the current character of input
  A@-                     # remove anything from the alphabet which was in the rest,
                          # i.e. the already processed chars cannot be used any more
  ?                       # find the index of the current input character
  +                       # add to the accumulator
}/

### calculate the total number of (sub)permutations
1                         # push 1 (accumulator)
I,,{                      # loop for i = 0 .. <Length I>-1
  A,\-                    # length of alphabet minus loop variable
  *                       # multiply to accumulator
}/

### at this point the stack is <Index of input (sub)permutation>
###   <Total number of (sub)permutations>
\)                        # increment the index (i.e. next (sub)permutation)
1$%                       # warp around for the last possible (sub)permutation
\                         # swap back order

### backwards transformation into the (sub)permutation space
I,,{                      # map for each index [0 .. <Length I>-1]
  A,\-/                   # divide the weight factor by length of alphabet minus
                          # loop variable
  \.2$%                   # take index % new weight factor
  \2$/                    # and index / new weight factor (result for the map operation)
  @\                      # re-order stack
}%
*>                        # get rid of 0 1 on the stack

### back to the alphabet
A\                        # push the full alphabet under the index array
{                         # map on the index array
  1$=                     # take the i-th element of the alphabet
  \[1$]-\                 # and reduce the alphabet by this characters
}%

\0<                       # transforms the remaining alphabet into an empty string
+                         # make string from array by joining with the empty string


This code errors on *this* and *that*, is it really written in them? Inspired by I'm not the language you're looking for!

Challenge

Choose two different programming languages, and write a program that prints the following line to stdout (or equivalent):

This program errors out in <the current language> :P

and then generates different kind of error in each of the two languages.

Rules

Some rules are taken from the original challenge.

In the output, language names should exactly follow:

The name listed on TIO, optionally excluding the version number and/or the implementation name (e.g. if you use JavaScript (Node.js) as one of your languages, you can use JavaScript for your language name, but not JS or Javascript.)
The full name on the official website (or GitHub repo) if your language of choice is not available on TIO.

Neither program should take any input from the user.
You may use comments in either language.
Two different versions of the same language count as different languages.

If this is done, the program should output the major version number, and if running on two different minor versions, should report the minor version also.
You should not use prebuilt version functions (this includes variables that have already been evaluated at runtime).

Two different command line flags in the same language also count as different languages as per this meta consensus, as long as the flags don't include code fragments (such as -Dblahblah... in C).

If this is done, the program should also output the flag used.

Two errors are considered different unless both errors are generated by the same semantics (such as "division by zero", "segmentation fault", or "index out of range").

If a language's runtime does not exit after an error, but reports the error in some way to the user, it's a valid error.
If a language does not discriminate the error messages but has a known list of reasons that cause error, you must specify the reason, not the error message.
An example is ><>, which has only one error message something smells fishy..., but esolangs wiki page has a list of error reasons.

Syntax error is not allowed unless it is generated by calling eval() or similar.
Throwing something manually (via throw(JS), raise(Python), die(Perl) or similar) is allowed, but all of them are considered as one kind of error.
Error by invalid command in 2D or golflangs is also allowed (and treated as one kind of error).

Examples

Python and Ruby

Python: This program errors out in Python :P to stdout, then undefined identifier
Ruby: This program errors out in Ruby :P to stdout, then index out of bounds

C89 and C99

C89: This program errors out in C 89 :P to stdout, then division by zero
C99: This program errors out in C 99 :P to stdout, then segmentation fault

Note that the version number should always be separated from the language name by a space.

Python 2.7.9 and Python 2.7.10

Python 2.7.9: This program errors out in Python 2.7.9 :P to stdout, then syntax error on eval
Python 2.7.10: This program errors out in Python 2.7.10 :P to stdout, then key error on dict

Perl and Perl -n

Perl: This program errors out in Perl :P to stdout, then invalid time format
Perl -n: This program errors out in Perl -n :P to stdout, then try to open a file that doesn't exist

Winning condition

This is code-golf, so the shortest code in bytes wins. But you're always encouraged to post an answer that is fun or interesting even if it isn't very short.

Python 2 / Python 3, 60 bytes

print("This program errors out in Python %d :P"%(3/2*2))*1;a

Python 2 got NameError: name 'a' is not defined
Python 3 got unsupported operand type(s) for *: 'NoneType' and 'int'

Python 2:

/ is integer division, 3 / 2 got 1; int(3 / 2 * 2) is 2.
print is a statement, so the first statement read as print((...)*1), here *1 means repeating the string once.
second statement referenced a non-existing variable, which caused the error.
Try it online!

Python 3:

'/' is floating number division, 3 / 2 got 1.5; int(3 / 2 * 2) is 3.
print is a function, so the first statement read as (print(...))*1.
function print returns None; Multiplication do not work on None x int, so it report "unsupported operand".
Try it online!


How many points does my license plate give? (This is my first code-golf question)

When I was a child, my dad and I invented a game where the license plate we see on cars can give certain points based on some rather simple rules:

X amount of the same letter or number give X-1 points, examples:

22 = 1 point
aa = 1 point
5555 = 3 points

The numbers must be next to eachother, so 3353 only gives 1 point, as the 5 breaks the sequence of 3's.

A sequence of X numbers in ascending or descending order, at a minimum of 3, give X points, examples:

123 = 3 points
9753 = 4 points
147 = 3 points

The point system only works for 1-digit-numbers, so 1919 doesn't give points, and 14710 only give 3, (147).

Sequences can be combined to make more points, examples:

1135 = 4 points (1 point for 11 and 3 points for 135)
34543 = 6 points (3 points for 345 and 3 points for 543)

You are however not allowed to chop a larger sequence into 2 smaller sequences for extra points: 1234 = 123, 234 (6 points) is not allowed.

Your task is, given a sequence, to determine the number of points the license plate gives.

In Denmark, the license plates are structured like this: CC II III, where C is character and I is integer, and thus my example inputs will reflect this structure. If you wish, you may make the sequence fit your own structure, or, if you feel really adventurous, let the program analyze the structure of the license plate and thus have it work on any type of license plate around the world. Explicitly state the structure you decide to use in your answer though.

You may take the input in any way you please, either a string or an array seem to make most sense to me.

Test input | output:

AA 11 111 | 5
AB 15 436 | 3
OJ 82 645 | 0
UI 65 456 | 6
HH 45 670 | 5
YH 00 244 | 5
AJ 00 754 | 1

Due to the nature of choosing your own structure, or even covering all structures, I dont necessarily see how a winner can be explicitly determined. I suppose the winner will be the shortest bytes on the structure one has decided. (And don't take an input like C I C I C, just to make it easy for yourself)

EDIT:

Due to comments asking, I have a few extra pieces of information to share: A sequence of ascending or descending numbers refers to an arithmetic sequence, so X +/- a * 0, X +/- a * 1, ... X +/- a * n etc. So 3-5-7 for example is 3 + 2 * 0, 3 + 2 * 1, 3 + 2 * 2. The sequence does not, however, need to start from 0 nor end in 0.

MORE EDIT:

You may give the input in any way you please, you dont need to input spaces, dashes or any other thing that makes a license plate more readable. If you can save bytes by only accepting capital letters or something like that, you may do that aswell. The only requirement is that your program can take a string/array/anything containing both characters and numbers, and output the correct amount of points according to the rules stated.

05AB1E, 25 22 20 18 bytes

Accepts a string of lower-case alphabetic chars and numbers with no spaces.

Ç¥0Kγ€gXK>OIγ€g<OO

Try it online!
or as a Test Suite


Hexadecimal to Binary Convert a hexadecimal number (of any size) into a binary number.

Input
A POSITIVE hexadecimal number with a 0x in the beginning. A valid input will always match the following regex: 0x[0-9a-fA-F]+. If the input is not a valid hexadecimal number, that is, anything not matching this regex, the output should be 0.

Output
The hexadecimal converted to binary.

Winning
Original Code-Golf Rules, Lowest amount of bites (bytes).

Examples

IN: 0x12
OUT: 10010

IN: 0xFF
OUT: 11111111

IN: 0XFF
OUT: 0

IN: #0ac4
OUT: 0

IN: 0x00101011
OUT: 100000001000000010001

IN: 0x525600
OUT: 10100100101011000000000

IN: 0x58f70555118ec400
OUT: 101100011110111000001010101010100010001100011101100010000000000

IN: 0x6669795966AF3000
OUT: 110011001101001011110010101100101100110101011110011000000000000

IN: 0b018474
OUT: 0

IN: 9577383
OUT: 0

IN: -483355
OUT: 0

IN: -0xf9ad92
OUT: 0

Python 2, 67 62 60 59 bytes

n=input()
try:print bin(int(n,n[1]<'x'))[2:]
except:print 0

Try it online!

Version that errors on invalid input (27 bytes):

lambda n:bin(int(n,16))[2:]

Try it online!


Doors doors doors, c'mon down to the door store! The challenge is twofold:

Make a program that builds a door. ASCII, HTML or otherwise

Make the door functional. Opens and closes

Either open-able through input or interaction!

Non-functional door +5 points.
Just a open-able door +10 points.
Interactive door +15 points.
Fancy door +20 points. This means revolving,bifold etc
Animated +20 points.
<100 characters +50 points.
-100 points for using a program specifically designed for drawing or animation.

If you have criteria suggestions leave them in the comments.

Non-functional open door example:

<?php
$idiots_in_room=true;

if($idiots_in_room)
{

$count=20;
$count2=7;
for($i=0;$i<$count;$i++)
{

if($i==0)
{
echo str_repeat("-",10);
if($i==0){echo ".";}
echo "\n";
}
elseif($i==9)
{
echo str_repeat("-",10);
echo str_repeat("Â ",7)."o"."|";
echo "\n";
}
elseif($i<=9)
{

echo str_repeat("-",1).str_repeat("Â ",8).str_repeat("-",1);

echo ($i<5) ? str_repeat("Â ",$i*2)."\\" : str_repeat("Â ",8)."|";
echo "\n";
}
elseif($i<=14)
{
if($i>9){echo str_repeat("Â ",$i)."\\";}
echo str_repeat("Â ",$count2--)."|";
echo "\n";
}

}
}

Example Output:

----------.
-        -  \
-        -    \
-        -      \
-        -        \
-        -        |
-        -        |
-        -        |
-        -        |
----------       o|
          \       |
           \      |
            \     |
             \    |
              \   |

JavaScript, 4380 characters, 65(?) points

ASCII? Check. HTML? Check. Is a door? Check. Openable door? Check. Interactive? Check. Fancy? Double doors with properly positioned hinges, I hope that counts. Animated? Check. Under 100 characters? Ha. Not using facilities intended for drawing? Check.

Live demo. (Note: In my testing with Firefox, clicking the doors more than once doesn't work — for some reason the event handler doesn't fire again and I'm baffled as to why; pointing out what I did wrong would be welcome. Though, you might want to run this in Chrome anyway for decent JS performance.)

<title>Door</title>

Click doors to open or close.

When closed, the doors look like this:


Rock-paper-scissors competition simulator You decided to organize a rock-paper-scissors championship to find out who is the best. You don't want to let luck to decide the winner so everyone has to give you his or her tactic in writing before the competition. You also like simple things so a move of a competitor (showing rock, paper or scissors) has to be based only the previous turn (RvR, RvP, RvS, PvR, PvP, PvS, SvR, SvP or SvS). In the first turn a player has to show a fixed sign.

You decided to write a program (or function) to simulate the championship.

Details of the competition

There will be at least 2 contestants.
Every player plays exactly one match with everyone else.
One match lasts 7 rounds.
In every round the winner gets 2 points the loser gets none. In the event of a tie both player score 1 point.
A players score in a match is the sum of his or her points over the turns of the match.
A players final score in the championship is the sum of his or her points over all matches.

Details of the input:

your program or function receives N 10 character long strings each of them corresponds to a players strategy. All characters are (lowercase) r p or s meaning that in the given situation the player will show rock paper or scissors.
The first letter codes the first turn (in every match for that competitor). The second shows what happens if the last round was rock vs rock. The next ones are RvP, RvS, PvR, PvP, PvS, SvR, SvP and SvS where the first letter is the player's sign and the second is the opponent's. E.g. rrpsrpsrps means the player starts with rock and then copies the opponent's last move.
You can input the list of strings as a list/array or similar data of your language or as one string. In the latter case some kind of separator character is a must.

Details of the output:

Your program or function should output the final scores of each player in the same order as the input was supplied.
Scores should be separated by spaces or newlines. Trailing space or newline is allowed.

Examples:

Input:
['rrpsrpsrps', 'rpppsprrpr']

Output:
5 9 (turns are rvr rvp pvs svp pvr rvp pvs)

Input:
['rrpsrpsrps', 'rpppsprrpr', 'ssssssssss']

Output:
13 17 12 (matches are 5-9 (1st vs 2nd), 8-6 (1st vs 3rd) and 8-6 (2nd vs 3rd))

This is code-golf so the shortest entry wins.

Python 2: 201 188 chars

def f(Q):c=lambda m:'rps'.index(m);l=len(Q);r=[0]*l;i=0;exec'p,q=i/l,i%l;m,n=c(Q[p][0]),c(Q[q][0]);exec"r[p]+=(p!=q)*(m+1-n)%3;m,n=c(Q[p][m*3+n+1]),c(Q[q][n*3+m+1]);"*7;i+=1;'*l*l;return r

The logic of the program: I convert the letters to number (r=0,p=1,s=2). m is the number of the first, n the number of the second person. Because the game is cyclic, (m-n)%3 already determines the result. And of course, I can shift the result by one f=(m+1-n)%3. Now f=0 means, second player q wins, f=1 means a tie, and f=2, first player p wins. It also is already the score for player 1. Therefore I only need to add all values (p!=q)*(m+1-n)%3 for each player.

Test it with print f(['rrpsrpsrps', 'rpppsprrpr', 'ssssssssss'])


Define a function f such that f(f(n)) = -n for all non-zero integers n This challenge was inspired by a programming blog I frequent. Please see the original post here: A Programming Puzzle

Challenge
Define a function \$f:\mathbb{Q}\to\mathbb{Q}\$ such that \$f(f(n)) = -n\$ for all non-zero integers \$n\$, and where \$\mathbb{Q}\$ is the set of rational numbers.
Details
In whatever language you prefer, please define one function or program \$f\$ that accepts as parameter one number \$n\$ and returns or outputs one number \$f(n)\$.
Input may be provided through whichever mechanism is most natural for your language: function argument, read from STDIN, command-line argument, stack position, voice input, gang signs, etc.
Output should be a return value from a function/program or printed to STDOUT.
I would like to restrict answers to functions that do not take advantage of program state or global memory/data that is visible from outside of the function \$f\$. For example, keeping a counter outside of \$f\$ that counts how many times \$f\$ was called and just doing a negation based on this count isn't very challenging or interesting for anyone. The decisions \$f\$ makes should rely only on data within \$f\$'s lexical scope.
However, this restriction is probably inappropriate for some stack-oriented languages or other types of languages that do not distinguish these types of data or scopes. Please use your best judgement to keep with the spirit of this challenge.

Scoring
Standard code golf rules apply - your score is the number of bytes in your source code.
The minimal answer requires the domain and codomain of \$f\$ to be a subset of the rationals \$\mathbb{Q}\$. If you restrict your domain and codomain of \$f\$ to the integers \$\mathbb{Z}\$, then your score is the ceiling of 90% of the number of bytes in your source code.
Tiebreak
In the event of a tie, the following will be used in order:

Fewest number of printable non-whitespace symbols in your source code
Earliest date and time of answer submission

You are not required to support arbitrarily sized numbers. Please interpret the sets \$\mathbb{Z}\$ and \$\mathbb{Q}\$ as datatypes in your chosen language (typically integer and floating point, respectively).
If your solution relies entirely on the underlying structure or bit pattern of a data type, please describe its limitations and how it is being used.

Python: 61 34 30 29 27 points

f: Q -> Q

in math:

       | 0.5-x   if x is in Q \ Z
f(x) = |
       | x+0.5   if x is in Z

in Python:

f=lambda x:.5+[x,-x][x%1>0]

tested with

filter(lambda n: n[0] != -n[1], map(lambda n:(n,f(f(n))),range(0,50)))

logic behind this:

When you take an integer n and put it into f you will get x+0.5. This is not an integer any more, so the next application will be 0.5-(x+0.5) which is -x.

Credits

Thanks to

Bakuriu for striping it down from 61 characters to 34 characters.
Volatility for further reducing code size to 30 characters.
copy for reducing code size to 29 characters (and fixing a potential floating point problem).
aditsu for mentioning an inconsistency that came with the changes above.

Notes

First I thought this would be ok

f = lambda n: 1j*n

but its f:N->C and that is not allowed :-/


Pythagoras' Other Leg Pythagoras had his leg blown up in the war. It had to be amputated, and though he nearly died, he pulled through and made a full recovery. Now, after a year of walking with crutches, he gets the privilege of getting a prosthetic leg! Thing is, though, there are several that fit, but which ones?

The Task

Given a positive integer as input that is the length of one leg of a Pythagorean triple, output all possibilities for the other leg. For example, the smallest Pythagorean triple is (3,4,5), which forms a triangle with two legs of length 3 and 4, and a hypotenuse of length 5.

Examples

Leg:5
12

Leg:28
21
45
96
195

Leg:101
5100

Leg:1001
168
468
660
2880
3432
4080
5460
6468
10200
38532
45540
71568
501000

The Rules

Input will be a single positive integer n.
Output may be in any order, with any delimiter, in any base (though this base must be consistent), and with optional opening and closing braces, and optional trailing whitespace. That is, 1 2 3, [1,2,3], and 1,11,111 all fit this output specification.
You may assume that n will never be larger than one fourth of the fourth root of your language's limit (without using libraries). In practice, you may assume the input will be less than either this or 10,000, whichever is less.

Pythagoras is waiting on you, so better write your code quick and short!

Jelly, 8 bytes

²R²+²Æ²O

This answer is non-competing, since it uses features that have been implemented after the challenge was posted. Try it online!

This approach does not use floating point math, so it will give the correct answer as long as the intervening lists can fit into memory.

Idea

If (a, b, c) is a Pythagorean triple, there are strictly positive integers k, m, n such that the set equality {a, b} = {km2 - kn2, 2kmn} holds.

In particular, this means that a < b2 and b < a2, so for input a we can simply check if a2 + b2 is a perfect square for each b in {1, … a2}.

Code

            Input: x

²           Compute x².
 R          Get get range 1 ... x².
  ²         Square each integer in that range.
   +²       Add x² to each resulting square.
     Æ²     Check if the resulting sums are perfect squares.
       O    Get all indices of ones.


Output "Lorem ipsum" with minimal number of characters I remember people saying that code size should be measured in bytes, and not in characters, because it's possible to store information with weird Unicode characters, which have no visual meaning.

How bad can it be?

In this challenge, you should output the following Lorem Ipsum text, taken from Wikipedia:

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Please specify the number of characters (not bytes) in your code. Code with the minimal number of characters wins.

Your code should only contain valid Unicode characters, as described here, that is:

Code points up to U+10FFFF
No surrogates (the range D800–DBFF is forbidden)
No characters FFFE and FFFF
No null characters (code 0)

If your code cannot be displayed, provide a version with offending characters redacted, and a hexdump.

Some notes:

The output must be one long line (445 characters). If your system cannot do that (e.g. you're printing it on paper), output a closest approximation. Trailing linebreaks don't matter.
Built-in functions that generate Lorem Ipsum text are not allowed
Please specify a valid text encoding for your code, if relevant

JavaScript (ES7), 326 283 273 249 243 242 chars

_=>""[r='replace'](/./gu,c=>(c.codePointAt()-4**8).toString(32))[r](/\d/g,d=>"  , exum. ".substr(d,2))[r](/^.|\. ./g,x=>x.toUpperCase())

How it works

The first step in my compression technique is to convert the whole string to lowercase (not mandatory, but looks better), and replace each pair of chars in , exum.  (as well as the trailing space by itself) with its index in the string plus 2. This makes the text a valid base-32 number:

lorem9ips69dolor9sit9amet2consectetur9adipiscing3lit2sed9do3iusmod9tempor9incididunt9ut9labore3t9dolore9magna9aliqua8ut3nim9ad9minim9veniam2quis9nostrud94ercitation9ullamco9laboris9nisi9ut9aliquip943a9commodo9consequat8duis9aute9irure9dolor9in9reprehenderit9in9voluptate9velit3sse9cill69dolore3u9fugiat9nulla9pariatur84cepteur9sint9occaecat9cupidatat9non9proident2sunt9in9culpa9qui9officia9deserunt9mollit9anim9id3st9laboru7

The next step is to convert each 4-char run to decimal, then get the character at that code point. This can be done with the following function:

f=s=>s.replace(/..../g,x=>(n=parseInt(x,32),String.fromCharCode(0xD800+(n>>10),0xDC00+(n&0x03FF))))

(Note: Since all digits are 2 or greater, the minimum possible value of four digits is 2222₃₂. This is equal to 95978₁₀, or 176EA₁₆; therefore, code points will never be in the restricted range.)

And now we have our compressed string:

That's 445 chars compressed into 106 chars. The decompression simply reverses this process:

Convert each char to its code-point in base-32, minus 65536.
Replace each digit n with "  , exum. ".substr(n,2).
Convert each letter after a period or at the beginning of the string to uppercase.

The only ES7 feature used is **. Replace 4**8 with 65536 to run in a browser that doesn't yet support ES7.


Converting "0xUsernames" 0xUsernames

There's so many people using a messaging service that they're running out of space to store all the usernames! To fix this, they are going to start storing usernames as hexadecimal, where possible.

If a username consists of only the characters 0123456789ABCDEF (case  insensitive), it can be converted to a hexadecimal and stored as an integer. For example, the username ba5eba11 can be interpreted as 0xBA5EBA11, a hexadecimal integer.

But what about 05AB1E? That's got a leading zero, which would be lost. So, whenever we convert a username, we make sure to prepend a 1 before reading it as an integer.

The Challenge

Your task is to write a program or function which, given a non-empty username as a string, 'hexa-compresses' the username:

If it can be interpreted as a hexadecimal integer, prepend a 1, interpret as hexadecimal, and then print the result as base 10.
Otherwise, just return the string unmodified.

This is code-golf, so the shortest solution (in bytes) wins! Built-in base conversion functions are permitted.

Test Cases

You can assume that any resulting integers with be within your language's standard integer range.

As with usernames on most messaging systems, the input strings will only contain alphanumerics and underscores.

Remember, you always need to add a leading 1 before conversion!

"ba5eba11" -> 7421737489
"05AB1E"   -> 17148702
"dec0de"   -> 31375582
"Beef"     -> 114415
"da7aba5e" -> 7960443486
"500"      -> 5376

"DENNIS" -> "DENNIS"
"Garth"  -> "Garth"
"A_B_C"  -> "A_B_C"
"0x000"  -> "0x000"

For reference, here is a Python 3 implementation I used for the test cases (ungolfed):

import re

def convert_name(name):
    if re.fullmatch('^[0-9A-Fa-f]+$', name):
        return int('1' + name.upper(), base = 16)
    else:
        return name

05AB1E, 4 bytes

D1ìH

Explanation

D    Duplicate input
 1ì  Prepend 1
   H Interpret as hexadecimal and implicitly display the value in base 10

If the input has invalid hex characters, H won't push anything so the last value on the stack will be the duplicated input, that's why the program prints its input in case of invalid input.

Try it online!


Balance a set of weights on a seesaw Balancing Act

Overview

Given an input of 3 single-digit positive integers representing a set of weights, output an ASCII representation of a seesaw with the weights placed on it so that it is in balance around a central pivot, taking lever effects into account.

Each number has a weight equal to its value. The torque of each number is the weight multiplied its the distance from the center in characters. For the seesaw to be in balance, the sum torque of the weights on the left of the seesaw must equal that of those on the right, like this.

Input

3 integers in the range of 1-9. You can input the integers however is convenient, e.g. a tuple, 3 comma-separated values etc. However your program must be able to handle numbers input in any order (i.e. no assuming the values will be sorted). Duplicate numbers may be input (e.g. 2,3,2).

The inputs will always mathematically allow for a valid output, otherwise the input is not valid.

Output

The output should be a 2-line ASCII representation of the seesaw with the weights placed on it. On the first line are the digits, spaced in order to balance them on the seesaw.

Numbers may not be placed in the very center of the scale, where the distance and therefore the torque would be zero. Valid distances from the center range from 1-10 characters inclusive to the left or right of the pivot.

In the spaces unoccupied by the numbers are 18 underscore characters (a center underscore and 10 on each side, minus the 3 positions occupied by the numbers). On the last line is a single caret character aligned with the center of the scale, representing the pivot.

Examples

Input:

4,7,2

Output:

________7___42_______
          ^

7*2 = 4*2 + 2*3

Numbers can be output on either side, for example this would also be valid:

_______24___7________
          ^

2*3 + 4*2 = 7*2

Numbers can be placed anywhere on the scale as long as they balance, e.g:

Input:

3,1,5

Output:

_____5________1__3___
          ^

5*5 = 1*4 + 3*7

or

____5________1_____3_
          ^

5*6 = 1*3 + 3*9

or

____5___________1_3__
          ^

5*6 = 1*6 + 3*8

etc

Your program only has to output one of the valid outputs. It does not have to output an error if the input is not valid.

Notes

This is code-golf so the shortest program in bytes wins
Program may be a stand-alone or a function that accepts the numbers as input and returns a string.
Trailing newline and white-space on last line is optional
If you don't know what a seesaw is, it's also known as a teeter-totter or a teeterboard.

CJam, 40 39 38 bytes

q~21Ue]e!{21,Af-Aest.*:+!}=0'_erNAS*'^

Try it online.

How it works

q~                                     e# Read and evaluate the input.
  21Ue]                                e# Append zeroes to achieve a length of 21.
       e!                              e# Push all unique permutations.
         {               }=            e# Find the first permutation such that:
          21,                          e#  Push [0 ... 20].
             Af-                       e#  Subtract 10 from each.
                Aest                   e#  Replace the element at index 10 with the
                                       e#  current time (ms since epoch) to push
                                       e#  [-10 ... -1 <big number> 1 ... 10].
                    .*                 e#  Multiply each number of the permutation
                                       e#  by the corresponding distance.
                      :+               e#  Add the products.
                                       e#  The timestamp makes sure that this sum
                                       e#  is non-zero for a non-zero element in
                                       e#  the middle of the permutation.
                        !              e#  Push the logical NOT of the sum.
                           0'_er       e# Replace zeroes with underscores.
                                NAS*'^ e# Push a linefeed, ten spaces and a caret.


Laguerre Polynomials Laguerre polynomials are solutions to Laguerre's equation, a second-order linear differential equation: \$xy''+(1-x)y'+ny=0\$. For a given value of n, the solution, y, is named \$L_n(x)\$.
The polynomials can be found without calculus using recursion:
\$L_0(x)=1\$
\$L_1(x)=1-x\$
\$L_{k+1}(x)=\frac{(2k+1-x)L_k(x)-kL_{k-1}(x)}{k+1}\$
Summation can be used to the same end:
\$L_n(x)=\sum\limits_{k=0}^{n}{n\choose k}\frac{(-1)^k}{k!}x^k\$
\$L_n(x)=\sum\limits_{i=0}^n\prod\limits_{k=1}^i\frac{-(n-k+1)x}{k^2}\$
The first Laguerre polynomials are as follows:

Coefficients can be found here.
The Challenge
Given a nonnegative integer n and a real number x, find \$L_n(x)\$.
Rules

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

Assume only valid input will be given.

Error should be under one ten-thousandth (±0.0001) for the test cases.

Test Cases
Here, n is the first number and x is the second.
In: 1 2
Out: -1

In: 3 1.416
Out: -0.71360922

In: 4 8.6
Out: −7.63726667

In: 6 -2.1
Out: 91.86123261

Python 2, 53 bytes

f=lambda n,x:n<1or((2*n-1-x)*f(n-1,x)-~-n*f(n-2,x))/n

Try it online!


Two-zero-one-five puzzle Background

This puzzle is a variation on the four fours puzzle (itself the topic of a past question). Like that puzzle, the aim is to find mathematical expressions for different whole numbers, using only four digits and certain mathematical operators. In this case, however, the permitted digits are just 2, 0, 1 and 5. Each must appear precisely once in the solution and in the correct order. Surprisingly many whole numbers can be represented this way. Solvers are encouraged to try solving it by hand first, as it's strangely enjoyable.

Rules

Constants may be constructed from single or multiple digits:

Integers: e.g. 2, 0, 15, etc.
Decimals: e.g. .2, .01, 1.5, etc.
Repeating decimals: e.g. .2~ (=0.222...), .15~ (=0.1555...), 20.15~~ (=20.1515...)

The following unary operations are permitted:

Unary negation: -x
Square root: sqrt(x)
Integer factorial: x!

The following binary operations are permitted:

Standard arithmetic operators: x+y, x-y, x*y and x/y
Arbitrary exponentiation: x^y
Arbitrary roots: rt[x](y) (= x'th root of y)

Task

Your program should print out expressions for as many of the integers between 0 and 100 as it can, and then output the number of expressions it has produced.

The solutions must be printed in order in the format n=[expr].
The expressions must use all the digits 2, 0, 1, 5, once each in that order.
The expressions must be printed using the notation described above. Unnecessary parentheses are permitted but not required, as is whitespace. The order of operator precedence is unary negation, factorial, exponentiation, multiplication/division and addition/subtraction.
The program need not return solutions for all the numbers. A program that simply outputs 0 is therefore valid; however, see the scoring section below.
The program should run in under 15 minutes on a modern computer.

You may write a program or function. The expressions should be printed to STDOUT (or closest alternative). The number of expressions can be printed to STDOUT or returned as an integer. Standard code golf restrictions apply.

Example output

0=2*0*1*5
10=20*1*.5
42=((2+0!)!+1)!/5!
100=20*1*5
4

Scoring

Update: @orlp has noted a flaw in the scoring system. See http://meta.codegolf.stackexchange.com/questions/5106/way-of-salvaging-two-zero-one-five-puzzle-challenge for a discussion of how or whether this should be fixed.

Solutions are scored first by the number of expressions they produce and then by their code length in bytes. Hence, a 1000 byte program that produce 80 results will beat a 100 byte program that produces only 79 (though the latter could easily be extended to include the missing results).

For those who would like a motivating target, below is a lower bound on the number of expressions that can be represented. I don't plan to submit an entry, so it may well be possible to win with less!

   At least 85 (out of 101), though it may well be higher.

Scoreboard

As an extra incentive, here is a summary of the score progression. Whenever you beat the highest score, feel free to add yourself to the top of the table (or ask someone else to).

0 expressions, 1 byte (Pyth): implementation that just outputs 0


Build a simple proxy Make the shortest proxy server.

Input/Output Specifications

Client:

Input: a port number (32-bit integer) (,) or (space) a url (see test cases)
Output: html source of the url

Server:

Input: port to listen to (32-bit integer)
Output: REC when input is received from the client, OK when finished sending the html source to the client.

Rules

You may make either a complete program or functions in an interpreted language.
Input is taken through stdin or given as a arguments.
Your code has to work for the given test cases only (more is optional, less is invalid).
The client output has to be the same as with what you get when you "view source" from a browser.
The server may exit after each handled request (i.e does not have to be persistent/daemon)
(edit) Any other input/output than what specified, is forbidden.

Test cases (client inputs)

N1 https://stackoverflow.com/
N2 http://en.wikipedia.org/wiki/Proxy_server
N3 http://stackexchange.com/search?q=code+golf

where Ni are random integers between 1 and 2048.

ZSH - 57 + 42 characters

Server:

s=$(nc -l $1)
echo REC
curl -s $s|nc 127.0.0.1 $1
echo OK

Client:

echo $2|nc 127.0.0.1 $1
echo "$(nc -l $1)"

Usage:

sudo zsh server.zsh 123

sudo zsh client.zsh 123 http://stackoverflow.com/
sudo zsh client.zsh 123 http://en.wikipedia.org/wiki/Proxy_server
sudo zsh client.zsh 123 "http://stackexchange.com/search?q=code+golf"


The Sleigh Packing problem Santa's elves need help in determining if their current batch of presents will fit into santa's sleigh. Write the shortest program possible in the language of your choice to help them out.

Constraints

Santa's sleigh measures 6ft wide by 12ft long and is 4ft deep.
Presents may be fragile, so they may not be stacked on top of each other.
You can rotate and flip the presents as you wish, but Santa's quite an obsessive-compulsive chap so keep the rotations to multiples of 90 degrees.
North Pole health and safety regulations stipulate that presents may not stick out more than 1ft above the top of a sleigh (therefore they may not be more than 5ft high).

Input

Input will be on STDIN and will be one integer representing the number of presents in the batch followed by a list of the presents' dimensions - 1 present per line, 3 dimensions (in feet) separated by spaces.

Examples:

1
6 12 5

6
1 12 3
1 12 4
1 12 1
1 12 5
1 12 3
1 12 5

1
4 3 13

1
6 12 6

Output

Output should just be the word 'YES' if the presents can be packed into the sleigh or 'NO' if they cannot.

Output for the above examples:

YES

YES

NO

NO

Test scripts

As before, I've appropriated some test scripts written by Joey and Ventero to create some tests for this task:-

Bash
PowerShell

Usage: ./test [your program and its arguments]

Rewards

Each entry which I can verify that meets the spec, passes the tests and has obviously had some attempt at golfing will receive an upvote from me (so please provide usage instructions with your answer). The shortest solution by the end of the 2011 will be accepted as the winner.

Haskell, 312 318 chars

import Data.List
s(ξ:υ:_,λ:σ:η:_)(x:y:_,l:w:_)=(ξ+λ<=x||ξ>=x+l||υ+σ<=y||υ>=y+w)&&ξ+λ<7&&υ+σ<13&&η<6
y p l=[(v,r):l|v<-[[x,y,0]|x<-[0..5],y<-[0..11]],r<-permutations p,all(s(v,r))l]
main=do
 n<-readLn
 p<-mapM(fmap(map read.words).const getLine)[1..n]
 putStr.r$foldr((=<<).y)[[([9,0],[0..])]]p
r[]="NO"
r _="YES"

For some reason that I don't fully understand at the moment, it doesn't finish your tests #9 and #16 in reasonable time. But you didn't say anything about performance, did you?

373 383 chars

This version runs much faster for the examples: it first checks if it's not impossible simply because the area is too small, and then it starts with the largest parcels rather then inserting them in the given order. Note that the area detection is not perfect: it doesn't consider rotations, so it may on some inputs give wrong results. But it does work with the test script.

import Data.List
s(ξ:υ:_,λ:σ:η:_)(x:y:_,l:w:_)=(ξ+λ<=x||ξ>=x+l||υ+σ<=y||υ>=y+w)&&ξ+λ<7&&υ+σ<13&&η<6
y p l=[(v,r):l|v<-[[x,y,0]|x<-[0..5],y<-[0..11]],r<-permutations p,all(s(v,r))l]
π=product
main=do
 n<-readLn
 p<-mapM(fmap(map read.words).const getLine)[1..n]
 putStr$if sum(map(π.init)p)>72||null(foldr((=<<).y)[[([9,0],[0..])]].sortBy((.π).compare.π)$p)then"NO"else"YES"


Counting cycles in a folding and squashing process In chaos theory, the horseshoe map is an example of how chaos arises in a simple process of folding and squashing. It goes like this: take an imaginary piece of dough, fold it, and finally squash it to its original size. Chaos arises in the pattern of how the pieces of dough end up in the final arrangement after n iterations.

In our case, we'll take a look at how a simple binary pattern behaves when we fold and squash it. Here are the steps with an 8-bit example (the binary representation of 201 or 11001001).

Cut the bits in two pieces of equal length (add a '0' at the beginning if there is an odd number of bits).
1100 | 1001

Fold the first half over the second half. Note that the order of the first half is reversed, as we rotate it while folding.
0011
1001

Squash to its original shape. While squashing, the upper bits are shifted left to the bits under their original position.
01001011

If we repeat this for this example, we can see that after 4 iterations, we are back to the original bitstring:
Start  bits: 11001001
Iteration 1: 01001011
Iteration 2: 01001101
Iteration 3: 01011001
Iteration 4: 11001001

So, for the decimal value of 201, the number of cycles is 4.
The challenge

Write a full program that takes a decimal number as input and outputs the number of cycles it takes to repeat in the above described binary squash-and-fold process.
The (decimal) input must be taken from stdin (range: from 1 up to Googol or 10^100).
The (decimal) output must be written to stdout.
Your score is the number of bytes of your code.
Your answer must begin with [Programming language] - [Score in bytes]
Standard loopholes are not allowed.

Examples
7 --> 3
43 --> 5
178 --> 4
255 --> 1
65534 --> 1
65537 --> 12
1915195950546866338219593388801304344938837974777392666909760090332935537657862595345445466245217915 --> 329

Final note
What's interesting is that the number of cycles is related to the length of the binary representation, except for a few exceptions where the number of cycles is shorter because of the pattern in the bitstring (for example 111110 cycles after 1 iteration). This creates an interesting opportunity to optimize code length using the underlying pattern instead of calculating the number of cycles.

CJam, 34 bytes

q~2b_,2%,\+{__,2//~\W%.\_W$=!}g;],

Nothing fancy, it just applies the map until we get back to the input, and print the number of iterations that took.

Test it here.


Reorder a Master List Based on a Reordered Subset I recently had a problem to solve at work where I had two lists: a master list, and a smaller list that contains a subset of the items in the master list potentially in a different order. I needed to reorder the master list in such a way that the items in the subset would appear in the same order without changing the order of the items not found in the list and keeping items in the same location whenever possible. Okay, that probably sounds confusing, so I'll break it down:

The master list defines the default order of items.
The subset list defines relative order of certain items.
Where the master list has two elements out of order according to the subset list, the item that is earlier in the master list should be moved to the earliest index where it is in the correct location relative to other items within the subset list. (i.e. immediately after the later item)

Your task is to implement this reordering algorithm.

Example Test Cases

Master: [1, 2, 3]
Subset: []
Result: [1, 2, 3]

Master: [9001, 42, 69, 1337, 420]
Subset: [69]
Result: [9001, 42, 69, 1337, 420]

Master: [9001, 42, 69, 1337, 420, 99, 255]
Subset: [69, 9001, 1337]
Result: [42, 69, 9001, 1337, 420, 99, 255]

Master: [1, 2, 3, 4, 5]
Subset: [2, 5]
Result: [1, 2, 3, 4, 5]

Master: [apple, banana, carrot, duck, elephant]
Subset: [duck, apple]
Result: [banana, carrot, duck, apple, elephant]

Master: [Alice, Betty, Carol, Debbie, Elaine, Felicia, Georgia, Helen, Ilene, Julia]
Subset: [Betty, Felicia, Carol, Julia]
Result: [Alice, Betty, Debbie, Elaine, Felicia, Carol, Georgia, Helen, Ilene, Julia]

Master: [snake, lizard, frog, werewolf, vulture, dog, human]
Subset: [snake, werewolf, lizard, human, dog]
Result: [snake, frog, werewolf, lizard, vulture, human, dog]

Master: [Pete, Rob, Jeff, Stan, Chris, Doug, Reggie, Paul, Alex]
Subset: [Jeff, Stan, Pete, Paul]
Result: [Rob, Jeff, Stan, Pete, Chris, Doug, Reggie, Paul, Alex]

Master: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
Subset: [8, 1, 2, 12, 11, 10]
Result: [3, 4, 5, 6, 7, 8, 1, 2, 9, 12, 11, 10]

Master: [lol, rofl, lmao, roflmao, lqtm, smh, jk, wat]
Subset: [wat, lmao, rofl]
Result: [lol, roflmao, lqtm, smh, jk, wat, lmao, rofl]

Rules

Standard loopholes, yadda yadda, convenient I/O, blah blah.
Even though the examples use numbers and strings, you only need to support one element type, whether that's integers, strings, or anything else with well-defined equality semantics, including heterogeneous lists if that's convenient in your language.
You may assume both the master list and the subset list contain no duplicates
You may assume that all items found in the subset list are found in the master list
Either list may be empty
You must, at minimum, support arrays up to 100 elements long.
Reordering may be implemented in-place or through the creation of a new list/array.

Happy Golfing!

Retina 0.8.2, 51 bytes

+`(\b(\w+),(\w+)\b.*¶.*\b)\3,(.*\b\2\b)
$1$4,$3
1A`

Try it online! Takes input as a comma-separated list of subwords on the first line and a comma-separated master list of words on the second line. Explanation:

(\b(\w+),(\w+)\b.*¶.*\b)\3,(.*\b\2\b)

Find two adjacent subwords where the second word precedes the first on the master list.

$1$4,$3

Move the second word to appear after the first word in the master list.

+`

Repeat until no words appear out of order.

1A`

Delete the subwords.


Choose 3 strings and output the exact minimum Hamming distance between any pair Consider \$3\$ binary strings of length \$n\$ chosen independently and uniformly at random.   We are interested in computing the exact expected minimum Hamming distance between any pair. The Hamming distance between two strings of equal length is the number of positions at which the corresponding symbols are different.
Task
Given an input n between 2 and 10, inclusive, consider \$3\$ binary strings of length \$n\$ chosen independently and uniformly at random. Output the exact expected minimum Hamming distance between any pair.
Output should be given as a fraction.
Your code should run in TIO without timing out.

Pari/GP, 92 90 bytes

2 bytes saved thanks to @Nicolas!

n->sum(a=0,n,sum(b=0,n-a,sum(c=0,n-a-b,n!/a!/b!/c!/(n-a-b-c)!*min(a+b,min(a+c,b+c)))))/4^n

Try it online!

$$ f(n) = \frac{1}{4^n} \sum_{\substack{a+b+c+d=n\\a,b,c,d\geq 0}} \binom{n}{a,b,c,d}\min(a+b,a+c,b+c)$$

A more direct brute force approach may be shorter in some languages, but I'm not sure if that's true for Pari. Anyway, it's a shame that Pari's min only accepts two arguments.

I can avoid the min and be about 6 times faster, but the compensating additional code makes it longer. Maybe in another language this is the shorter way. And maybe it is possible to simplify further and get rid of the innermost sum.

n->sum(a=0,n,sum(b=a,n-a,sum(c=b,n-a-b,n!/a!/b!/c!/(n-a-b-c)!*(a+b)*6/(1+(a==b)+(b==c))!)))/4^n

Try it online!