Pi Day, Pi Minute, or Pi Second? In this challenge you will need to determine whether it's Pi Day, Pi Minute, or Pi Second.

Because Pi is irrational, it wants your code to be as short as possible.

Examples

No input is provided, your program should use the system time. I've just added it for clarity

March 14, 2016 0:00:00
Pi Day
December 25, 2015 3:14:45
Pi Minute
December 29, 2015 0:03:14
Pi Second
January 1, 2016 0:00:00
<No Output>

What is Pi Day / Minute / Second

Pi Day is when the month is March, and the date is the 14th
Pi Minute is when the hour is 3, and the minute is 14
Pi Second is when the minute is 3, and the second is 14
Pi Day should be preferred instead of Pi Minute or Pi Second, and Pi Minute should be preferred instead of Pi Second.
For this challenge you should use 12-hour time (15:14 == 3:14). The date/time used to determine the Pi Day/Minute/Second should be based on system time.

Scoring & Bonus

-15 byte Bonus: If you print "No Pi Time" when it's not Pi time.

As always, standard loopholes are disallowed. This is code-golf shortest code in bytes wins!

Javascript (ES6), 114 112 - 15 = 97 bytes

x=>['Pi Day','Pi Minute','Pi Second'].find((x,i)=>[/ar 14/,/(03|15):14:/,/03:14/][i].test(Date()))||'No Pi Time'

Ungolfed:

x=>
['Pi Day', 'Pi Minute', 'Pi Second']  // array of outputs
.find(                                // find first element in the array
    (x, i)=>                          // which returns truthy for this function
    [/ar 14/, /(03|15):14:/, /03:14/] // array of regex patterns
    [i]                               // get corresponding regex based on index
    .test(Date())                     // test it against current date, date is automatically cast to string
) || 'No Pi Time'                     // if no result, then return "No Pi Time"

Thanks for -2 bytes @edc65


Palindromic palindrome checker Write a program to test if a string is palindromic, with the added condition that the program be palindromic itself.

Ruby

z=gets;puts *z.reverse==z&&1||0||1&&z==esrever.z* stup;steg=z

Prints 1 if the input is a palindrome, 0 if it isn't. Input without linebreak.

Doesn't use any comments, instead it uses 2 tricks:

Short-circuiting: 0 is true-ish in Ruby (only nil and false evaluate to false), so 1&&z==esrever.z* stup isn't evaluated and thus can't raise a runtime exception
The splat/multiplication operator (*): To avoid a syntax error in z=esrever.z stup, we force the parser to parse this as z=esrever.z()*stup by adding a *. On the other side, the * is parsed as a splat operator, which in a function call splits an array in a series of parameters. If there's only one element instead of an array, it basically does nothing, so puts *foo is equivalent to puts foo.

Obvious solution using comments (prints true/false):

puts gets.reverse==$_#_$==esrever.steg stup


Sheffle tho vawols ureund! Given an input string, output that string with all vowels a, e, i, o and u swapped at random between each other.

For example, in the string this is a test, there are 4 vowels: [i, i, a, e]. A valid shuffling of those vowels could be [a, i, e, i] therefore yielding the output thas is e tist.

About shuffling

All shuffles shall be equally likely if we consider equal vowels to be distinct. For the example above, those 24 shuffles are possible:

[i1, i2, a, e]    [i1, i2, e, a]    [i1, a, i2, e]    [i1, a, e, i2]
[i1, e, i2, a]    [i1, e, a, i2]    [i2, i1, a, e]    [i2, i1, e, a]
[i2, a, i1, e]    [i2, a, e, i1]    [i2, e, i1, a]    [i2, e, a, i1]
[a, i1, i2, e]    [a, i1, e, i2]    [a, i2, i1, e]    [a, i2, e, i1]
[a, e, i1, i2]    [a, e, i2, i1]    [e, i1, i2, a]    [e, i1, a, i2]
[e, i2, i1, a]    [e, i2, a, i1]    [e, a, i1, i2]    [e, a, i2, i1]

Each one should be equally as likely.

You may not try random shuffles of the entire string until finding one where all vowels are in the right place. In short, your code's running time shall be constant if the input is constant.

Inputs and outputs

You may assume that all letters in the input will be lowercase or uppercase. You may also support mixed casing, though this won't give you any bonus.
The input will always consist of printable ASCII characters. All characters that are in the input shall be in the output, only the vowels must be shuffled around and nothing else.
The input can be empty. There is no guarantee that the input will contain at least one vowel or at least one non-vowel.
You may take the input from STDIN, as a function parameter, or anything similar.
You may print the output to STDOUT, return it from a function, or anything similar.

Test cases

The first line is the given input. The second line is one of the possible outputs.

<empty string>
<empty string>

a
a

cwm
cwm

the quick brown fox jumps over the lazy dog.
tho qeuck brewn fax jumps ovir the lozy dog.

abcdefghijklmnopqrstuvwxyz
abcdefghujklmnipqrstovwxyz

programming puzzles & code golf
pregromming pezzlos & coda gulf

fatalize
fitaleza

martin ender
mirten ander

Scoring

This is code-golf, sa tho shirtist enswer en bytes wons.

R, 92 91

Can't comment yet so I'm adding my own answer albeit very similar to @Andreï Kostyrka answer (believe it or not but came up with it independently).

s=strsplit(readline(),"")[[1]];v=s%in%c("a","e","i","o","u");s[v]=sample(s[v]);cat(s,sep="")

Ungolfed

s=strsplit(readline(),"")[[1]]    # Read input and store as a vector
v=s%in%c("a","e","i","o","u")     # Return TRUE/FALSE vector if vowel
s[v]=sample(s[v])                 # Replace vector if TRUE with a random permutation of vowels
cat(s,sep="")                     # Print concatenated vector

Saved one byte thanks to @Vlo

s=strsplit(readline(),"")[[1]];s[v]=sample(s[v<-s%in%c("a","e","i","o","u")]);cat(s,sep="")


If community would have been a person Well the community is just a bot. But what if it would have been a person?

Your task is to find what community's reputation might have been if it would have been given reputation for the edits it makes.(simply 2*edits)

This should work for any site, but we would consider PP&CG for this question.

Use any language, even data.stackexchange would work.

As it is code golf, smallest code wins as much reputation I gain+15(via bounty, I will leave 101 for myself :P ).

EDIT: consider all kind of edits that increase reputation.

I know URL shorteners are cheaty but since everyone else is using them I probably should.

Bash, with bc and URL shortener: 67 62 60 58 54

bc<<<`wget x.co/4Ccg3 -qO-|grep -oP "(?<='>)[0-9]+"`*2

Downloads the relevant page to STDOUT, then searches for '> followed by a sequence of digits - it misuses the fact that in the page's source code, single quotes are only rarely used; in fact the sequence '> occurs twice, and only once followed by a number, which is the number of edits. Using the Perl-style lookbehind, the '> isn't actually included in the match.

The -o option makes grep output only the matched string rather than the entire line containing it (there is a h1 on the same line and I don't want that).

The resulting number of edits is concatenated with *2 and sent to bc.

@11684 pointed out that you start out with 1 reputation, but the asker clearly forgot that so it's not mentioned in the question (it would break existing answers if it was). If you want to add that in just put in +1 at the end of the code, adding 2 chars.

SHELF, 36 - doesn't count as the language was created after the question

, `W x.co/4Ccg3|t "(?<='>)[0-9]+"`*2

SHELF is a golfed version of Bash, like PYG is for Python.


Build the smallest number Given a non-empty list of digits 0 though 9, output the smallest number that can be produced by an expression formed by reordering these digits and introducing exponentiation signs ^, with adjacent digits getting concatenated as multi-digit numbers. Exponentiation is evaluated as right-associative.

For example, [4, 2, 3, 3] could become 2^34^3 which evaluates as 2^(34^3), but simply writing 2334 is smallest here. You can assume that any array containing a 0 gives a minimum of zero (a special case), or that it's achievable by an expression like 0^rest, or like 00 for just zeroes.

The input list can be taken as any ordered sequence, but not as an unordered (multi)set.

Test cases:

[2,3] => 8 (2^3)
[3,3] => 27 (3^3)
[4,3] => 34 (34)
[1,2,3] => 1 (1^2^3)
[2,2,2] => 16 (2^2^2)
[2,3,2] => 81 (2^3^2)
[3,0] => 0 (Special, or maybe 0^3)
[0,1,0] => 0 (Special, or maybe 0^10)

Shortest code in each language wins. I'll accept an answer just to give the +15 rep without any specific accepting standard.

05AB1E, 12 11 bytes
œε.œJ€.«m}ß

Try it online or verify all test cases or try it online with added debug-lines.
Explanation:

œ            # Get all permutations of the (implicit) input-list
 ε           # Map each permutation to:
  .œ         #  Get all its partitions
    J        #  Join each inner-most list together
     €       #  For each inner list:
      .«     #   Right-reduce it by:
        m    #    Taking the power
         }ß  # After the map: pop and push the flattened minimum
             # (after which it is output implicitly as result)


Determine if a dot(comma) program halts Dotcomma is a simple esolang I made a while ago that only uses four operators: [.,]. In this challenge, you'll determine if a dotcomma program consisting only of [.] halts. Without ,, there is no input, output, or queue, making this challenge possible.
Blocks:
Any code wrapped in [] is a block. All blocks and operators (.) have a return value. The inputted program will always consist of a single block, and the brackets will always be properly nested.
Operators:
The . operator's return value depends on what it is preceded by:

Any number of blocks: The sum of the blocks' return values
A dot: The previous .'s return value will be kept
The beginning of a block ([): 1

If a . is followed by a block, it will be treated as a loop. The loop will run only if the .s return value is not 0, and if the block being looped returns 0 at any point it will terminate.
If a . is followed by the end of a block (]), the .'s return value will be used as the block's. Otherwise, a block's return value is 0.
Examples:
[]

Returns true. There are no loops.
[[].[]]

Returns true. The . takes the return value of the first nested block, which is 0, skipping the second.
[.[]]

Returns true. The . returns 1, but the loop terminates immediately as the block returns 0.
[.[.]]

Returns false. The . returns 1, and the block being looped returns 1, creating an infinite loop.
[[.][].[.]]

Returns false. The [.] returns 1, which is added to the 0 returned by the [], resulting in 1 and causing the loop body to be run.
Other:
You may return a truthy/falsy value in your language (representing either whether it halts or does not, your choice), or two consistent values for halting and non-halting.
This is code-golf. Shortest answer in bytes (per language) wins.

Python 3, 215 bytes

m,v,*d=-1,[],
L,*l=0,
for c in input():
	if c>"[":a=v.pop();l.pop()*a and exit(1);d.pop();d or exit(0);v[m]=v[m]*(d[m]%2)+a;d[m]=1
	elif c>"Z":l+=[L and v[m]];v+=0,;d+=0,
	else:v[m]=v[m]if d[m]else 1;d[m]=2
	L=c<"A"

Try it online!
Exit code 0 if it will halt, 1 otherwise.
This is just a naive implementation of the interpreter, but golfed down. Here's a ungolfed version with debug output.
+12 bytes to fix a bug
-8 bytes thanks to Unrelated String


Does a letter fit inside the other? Do you remember my mat properly grouped by colors?

Yesterday I was looking at it and realized that some letters fit inside others. Example: a letter P fits in the place where the letter R goes. So here's a simple challenge: given two letters, return a truthy value if any one of the letters fits inside the other (directly or rotated, but not flipped), or a falsey value if they don't. That is, if the input is [P,R] or [R,P], you must return truthy because in both cases one letter fits inside the other. If you get [L,U] you must return falsey as neither fit inside the other.

Rules

The input must be two alphanumeric characters in the range [0-9A-Z], as there are also numbers in the mat, in any form you need (two separate chars as two inputs, a list with two chars, a string with the 2 chars, whatever).
The output must be consistent (the truthy and falsey values must be always the same).
Following is the table of fittings (note that a letter always fits in its proper place, just in case you get something like [Y,Y] as input):

char fits inside chars
--------------------------------------------------------
   C             G,O
   F             B,E,P,R
   G             O
   I             0,1,7,B,D,E,F,H,K,L,M,N,O,P,R,T,V,W,X,Z
   L             E
   M             W
   P             R
   S             O
   V             A
   W             M
   0             O
   1             B,E,L
   3             O
   6             9,O
   8             O
   9             6,O

I solemnly swear that I have tested every fitting in my kid's mat. (Dries his sweat from his forehead.)

This is code-golf, so may the shortest code for each language win!

Some test cases

input  output
-------------
[C,G]  truthy (C fits inside G)
[G,C]  truthy (C fits inside G)
[F,R]  truthy (F fits inside R)
[M,W]  truthy (both fit inside the other)
[O,S]  truthy (S fits inside O)
[T,T]  truthy (T fits in its place)
[E,V]  falsey (no fit found)
[P,L]  falsey

Sandbox post. Please, forgive me if you spot more fittings that I missed. Many thanks to Οurous for helping me with the fittings list.

Python 2, 135 130 129 bytes

-1 byte thanks to Lynn

lambda s:cmp(*s)%2*s[::cmp(*s)|1]in'OIH TIE XI7 RF O8 OGC LI0 O3 O96 VA O6 KI PI WI L1 WMI O0 RIB NI1 FE SOC VID ZIFB1 PF LE1 RP'

Try it online!

Python 3, 143 bytes

lambda*i:any({*i}&{a,c}=={*i}for a,b in zip('CFGILMPSVW013689','GO BEPR O 017BDEFHKLMNOPRTVWXZ E W R O A M O BEL O 9O O 6O'.split())for c in b)

Try it online!


Implement BCD Arithmetic Write the shortest function you can that takes two binary-coded decimal integers and a character indicating an arithmetic operation to perform and return the result.

Input Specification
You will be passed two 32-bit bit patterns representing unsigned BCD integers.  In C or Java, for example, you would be passed an int (unsigned, if you prefer).  The third argument to your function will be a single character denoting what operation to perform.  If your language requires fixed return sizes, return a 32-bit result and ignore overflow.  Your return value should also be encoded as a BCD.

You should support +, -, *, /, and %.  For subtraction, the first argument is the minuend and the second argument is the subtrahend.  For division and modulo, the first argument is the quotient and the second is the divisor.

Example

bcd(0x00000127, 0x00000003, '+') => 0x00000130 // NOT 0x0000012A


Implement the Cubically Cube Cubically is a fairly new esoteric language capable of creating short, golf-like answers for a very specific subset of problems. It is unique in that it stores memory in the form of a 3x3 Rubik's cube, making calculations far less trivial than in most languages. In Cubically, the programmer must rotate the internal cube in order to manipulate the values stored on the faces, then use those values in their calculations. Calculations are performed on a single 32-bit integer stored on an imaginary face known as the "notepad". Additionally, Cubically can request user input and store it in an input buffer consisting of only a single integer value.

The Cube

The faces of the cube are Up, Down, Left, Right, Front, and Back:

   UUU
   UUU
   UUU
LLLFFFRRRBBB
LLLFFFRRRBBB
LLLFFFRRRBBB
   DDD
   DDD
   DDD

When the program starts, the cube is initialized such that each square on that face is equal to that face's 0-based index:

   000
   000
   000
111222333444
111222333444
111222333444
   555
   555
   555

Whenever a face is rotated, it is always rotated clockwise:

Cubically> F1

   000
   000
   111
115222033444
115222033444
115222033444
   333
   555
   555

The value of a face is defined as being the sum of every square on that face. For example, in the above cube, the value of face 0 is 3.

Syntax

Commands are executed by first loading a command into memory, then passing arguments to it to execute the command. For example, the command F1 will load the command F into memory, then call it with the argument 1. Additionally, F13 will load the command F into memory, then call it with the argument 1, then call it with the argument 3. Any non-digit character is treated as a command, and any digit is treated as an argument.

Your task

Your task is to implement Cubically's internal memory cube in a language of your choice. Your code should be able to execute a very small subset of the language.

Commands

R - Rotate the right face of the cube clockwise the specified number of times.
L - Rotate the left face of the cube clockwise the specified number of times.
U - Rotate the top face of the cube clockwise the specified number of times.
D - Rotate the bottom face of the cube clockwise the specified number of times.
F - Rotate the front face of the cube clockwise the specified number of times.
B - Rotate the back face of the cube clockwise the specified number of times.
% - Outputs the value on the given face. The value of a face is defined as the sum of all squares on that face.

Rules

You may use any language created before or after the date this challenge was posted to write a program or function capable of solving this challenge.
Input will be passed in either through STDIN, as a string, or as a character array (you choose, please specify).
Output must be passed either to STDOUT or as the output of the function, and it must be either an integer, a string containing only digits, or an array of digits. If your language requires you to output a trailing newline, you may do so.
The input will always be in the following format: ([UDLRFB]\d*)*%[0-5]. There will be no whitespace characters in the input.
The input for % will always use a 0-based index.

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

Test Cases

%0 -> 0
%1 -> 9
%2 -> 18
%3 -> 27
%4 -> 36
%5 -> 45
R1%2 -> 27
RD3F2%5 -> 32
L1R23F1B5U9D2%3 -> 17

For more test cases, check out the TIO interpreter. If TIO isn't working, you may use the Lua interpreter instead.

Python 2, 476 bytes

import re
c=[[i]*9for i in range(6)]
r=lambda f:[f[a+b]for a in(0,1,2)for b in(6,3,0)]
U=lambda c:[r(c[0])]+[c[j+1][:3]+c[j or 4][3:]for j in(1,2,3,0)]+[c[5]]
y=lambda c:[r(c[0])]+c[2:5]+[c[1],r(r(r(c[5])))]
z=lambda c:[c[2],r(r(r(c[1]))),c[5],r(c[3]),c[0][::-1],c[4][::-1]]
s=input()
exec("c="+"(c);c=".join("".join("zzzUz U zzUzz yyyzUzzzy zUzzz yzUzzzyyy".split()[ord(t)%11%7]*sum(map(int,n))for t,n in re.findall("([BUDLFR])(\d*)",s[:-2])))+"(c)")
print sum(c[int(s[-1])])

Try it online!
A port from my Simulate A Rubik's Cube answer. The revisit prompted me to golf that by 47 bytes.


Perfect License Plates Perfect License Plates

Starting a few years ago, I made myself a little game while driving around: checking if nearby license plates are "perfect". It's relatively rare, but exciting when you find one.

To check if a license plate is perfect:

Sum up the characters, with A = 1, B = 2, ...  Z = 26.
Take each consecutive chunk of numerals, and sum them; multiply each of these sums together.

If the values in part 1 and part 2 are equal, congratulations! You've found a perfect license plate!

Examples

License plate: AB3C4F

Digits -> 3 * 4
        = 12
Chars  -> A + B + C + F
        = 1 + 2 + 3 + 6
        = 12
12 == 12 -> perfect!

License plate: G34Z7T

Digits -> (3 + 4) * 7
        = 49
Chars  -> G + Z + T
        = 7 + 26 + 20
        = 53
49 != 53 -> not perfect!

License plate: 10G61

Digits -> (1 + 0) * (6 + 1)
        = 7
Chars  -> G
        = 7
7 == 7 -> perfect!

The Challenge

I used license plates of length 5 and 6 as examples, but this procedure is valid for any plate length. Your challenge is, for a given length N, return the number of perfect license plates of that length. For the purposes of the challenge, a valid license plate is any combination of digits 0-9 and characters A-Z. The plate must contain both a character and a numeral to be considered potentially perfect. For checking purposes, here are the values I got (though I can't be 100% about their correctness, hahaha)

N < 2: 0
N = 2: 18
N = 3: 355
N = 4: 8012

Notes

If somehow it makes the problem simpler in your language, you may output the proportion of perfect license plates for a given N, to at least 2 significant digits.

N < 2: 0
N = 2: 0.0138888...
N = 3: 0.0076088...
N = 4: 0.0047701...

OR, you may output the equivalent value mod 256

N < 2: 0
N = 2: 18
N = 3: 99
N = 4: 76

Shortest wins!

Python 3.6, 150 bytes

f=lambda n,t=-1,p=-1,a=0:sum(f(n-1,*((t,c+p*(p>=0),a),((t<0 or t)*(p<0 or p),-1,a-c))[c<0])for c in range(-26,10))if n else 0<(t<0 or t)*(p<0 or p)==a

results:

f(2) = 18
f(3) = 355
f(4) = 8012
f(5) = 218153

Ungolfed version with explanation:

digits=[*range(10)]
letters=[*range(1,27)]

def f(n, dt=-1, dp=-1, lt=0):
    if n:
        for d in digits:
            yield from f(n - 1,
                         dt,
                         d if dp < 0 else dp + d,
                         lt
                         )

        for l in letters:
            yield from f(n - 1,
                         dp if dt < 0 else dt if dp < 0 else dt*dp,
                         -1,
                         lt + l
                         )
    else:
        yield 0 < lt == (dt<0 or dt)*(dp<0 or dp)

The problem boils down to searching a tree in which each level of the tree corresponds to a position in a license plate number and each node has 36 children (10 digits and 26 letters).  The function does a recursive search of the tree, accumulating the values for the digits and letters as it goes.

n is the number of levels to search.
dp accumulates the sum of a group of digits.
dt accumulates the product of the digit sums.
lt accumulates the sum of the letter values.

For dp and dt, a value < 0 indicates it is not initialized.

Golf included, converting the for loops to sums of generators:

sum(f(n-1,
      dt,
      d if dp < 0 else dp + d,
      lt) for d in digits)
+
sum(f(n-1,
      dp if dt<0 else dt if dp<0 else dt*dp,
      -1,
      lt+l) for l in letters)

Then combining the generators.  Encode letters, A to Z, as -1 to -26 and digits as 0 to 9.  So the sum becomes:

sum(f(n-1, *args) for c in range(-26, 10)),

where args is:

((dp if dt<0 else dt if dp<0 else dt*dp, -1, lt-l) if c <0 else
 (dt, d if dp<0 else dp+d, lt))

The rest of the golfing is converting the function to a lambda, shortening variable names, and simplifying expressions.


Let's play ASCII mini-golf Let's play code golf... by playing golf.

Input

Your input will be a string consisting of #'s, an o, an @, and .'s. For example:

......@..
.....##..
.........
......o..

. - playable golf course (all shots must end on one of these)
# - a barrier (shots cannot go through this)
o - the starting position of your golf ball
@ - the hole

How to Play ASCII Golf

You start at the o. Here is a valid shot from point A to point B:

1) This shot is straight line that can be drawn between A and B (no curved shots).

A....
....B

2) The line AB may not intersect with a # (barrier), e.g.:

A.#.B

It may, however, be tangent to a barrier:

A#
.B

3) (For clarity) You may not bounce shots off barriers or the edge of the golf course.

Output

Print to stdout (or an acceptable equivalent) the minimum number of shots to get the ball into the hole @. If it is not possible, print -1.

Examples

o....@

=> 1

o.#.@

=> -1

o..#
..#@

=> 2 (you can pass through the vertices of a #, but not the edges)

o#...#
.#.#.#
...#.@

=> 4


Compute the multinomial coefficient Time for another easy challenge in which all can participate!

The multinomial theorem states:

The expression in parentheses is the multinomial coefficient, defined as:

Allowing the terms ki to range over all integer partitions of n gives the n-th level of Pascal's m-simplex. Your task is to compute this coefficient.

Task

Write a program or function which takes m numbers, n, k1, k2, ... ,km-1, and outputs or returns the corresponding multinomial coefficient. Your program may optionally take m as an additional argument if need be. Note that km is not in the input.

These numbers may be input in any format one likes, for instance grouped into lists or encoded in unary, or anything else, as long as the actual computation of the multinomial coefficient is performed by your code, and not the encoding process.
Output format is similarly flexible.
All code should run in less than one minute for n and m up to 1000.
Do not worry about integer overflow.
Built-ins designed to compute the multinomial coefficient are not allowed.
Standard loopholes apply.

Scoring

This is code golf: Shortest solution in bytes wins.

Test cases

Input: 3, [2, 0]
Output: 3

Input: 3, [1, 1]
Output: 6

Input: 11, [1, 4, 4]
Output: 34650

Input: 4, [1,2]
Output: 12

Input: 15, [5,4,3,2]
Output: 37837800

Input: 95, [65,4,4]
Output: 1934550571913396675776550070308250

Input: 32, [2,2,2,2,2,2,2,2,2,2,2,2,2,2,2]
Output: 4015057936610313875842560000000

Input: 15, [3,3,3,3]
Output: 168168000

Input: 1000, [10,10,10,10,10,10,10,10,10,10,100,100,100,100,100,100,100,100]
Output: 1892260836114766064839886173072628322819837473493540916521650371620708316292211493005889278395285403318471457333959691477413845818795311980925098433545057962732816261282589926581281484274178579110373517415585990780259179555579119249444675675971136703240347768185200859583936041679096016595989605569764359198616300820217344233610087468418992008471158382363562679752612394898708988062100932765563185864346460326847538659268068471585720069159997090290904151003744735224635733011050421493330583941651019570222984959183118891461330718594645532241449810403071583062752945668937388999711726969103987467123014208575736645381474142475995771446030088717454857668814925642941036383273459178373839445456712918381796599882439216894107889251444932486362309407245949950539480089149687317762667940531452670088934094510294534762190299611806466111882595667632800995865129329156425174586491525505695534290243513946995156554997365435062121633281021210807821617604582625046557789259061566742237246102255343862644466345335421894369143319723958653232683916869615649006682399919540931573841920000000000000

Input: 33, [17]
Output: 1166803110

Input: 55, [28]
Output: 3824345300380220

Jelly, 7 6 bytes

;_/!:/

Look ma, no Unicode! This program takes a single list as input, with n at its first index.

Try it online! or verify all test cases at once.

How it works

;_/!:/ Input: A (list)

 _/    Reduce A by subtraction. This subtracts all other elements from the first.
;      Concatenate A with the result to the right.
   !   Apply factorial to all numbers in the resulting list.
    :/ Reduce the result by division. This divides the first element by the others.


Build a word generator! Your task is to create a program/function to replicate this word generator.
Details
Your program/function take two input. One input is the categories. The other input is the syllable types.
Categories
categories will consist of classes of letters.
For example, V=aeiou means that the letters a, e, i, o, and u will be classified under the category V.

Each category will have a 1-letter name in UPPERCASE.
The letters it contains will all be in lowercase.

Syllable types
For example CV would mean that the syllable will consist of a letter in category C and then a letter in category V.
For example, if C=bcd and V=ae, then the syllable can be ba, be, ca, ce, da, or de.
Your task
Your task is to generate 100 random words, each with a random length of 1-5 syllables, each chosen randomly in the syllable types, with the letter in each category chosen also randomly.
Specs

Any reasonable input/output format. I don't care how you input the list.
All inputs will be valid.

Scoring
This is code-golf. Shortest solution in bytes wins.
Testcase
input1          input2    output
"C=st;V=aeiou"  "CV/CVC"  tasiti tese tossi tesis titi sese saset su sosastesisat sisosis sissa sata to sisas sese satetot sisuta tatote sa tetsesuti sossut ti seso tese tostutsasussi tutiset sasates tasa ta sa satso tastitta tetti sesita setetat tatsi tisetot sassu sessiso satessase sas ses totasta si tetsit titse sase totas sa ta sasesa tasa sostat sesi sissa tato tos tate sustosussatta sustas sassatote tesas sutat tatetatossos testisot tatta tissisisa sasese sesatus tito sisa satas sasisi so sasatustu sosses tetsa tese sestit sestu tisot sutastot sesu tet sotte sisute setotitsesi tita

Ruby, 80 bytes
gotta go fast
Input is a dictionary hash (for example, {'C' => ['b', 'c'], 'V' => ['a', 'e']}) and a list of syllable structures (for example, ['CV', 'VC'] or %w{CV VC}.
->c,s{100.times{puts (0..rand(5)).map{s.sample}.join.gsub(/./){|e|c[e].sample}}}

For sample input:
c = {
    'C' => %w{r s t l n},
    'V' => %w{a e i o u}
}
s = %w{CV CVC}

This produces a sample output:
salsun
lonlutunonnus
solitlaton
rusitar
lotol
ris
relussetsa
tanotte
nasun
sur
lusin
tuslu
nerunol
sorrelussenu
ni
nanro
nulila
ritlalatiso
nururlontensa
lilas
tatsisuto
lel
rerlisletnut
ler
netlo
sorora
surot
tilsasotisi
rilnolrati
lasrare
totni
surreratlaral
li
tullatilro
rusenoreto
lulnunen
nortille
tut
sanitare
soniserloras
tiritrattitsis
ratretrate
tesne
lastinsolta
sinirsitur
lulesuleno
li
sirurata
nutesnisitur
rulunna
natneretasi
lonre
les
laruletan
nitis
tarletu
tonrora
la
senru
seltotoniles
teransotutel
re
lulsirnilletus
nunanurlon
nunlortotsonna
nolun
tolso
nas
leltirninara
neltinlesla
lulutsisot
lesulusutnis
nolu
nun
tituntillini
ralteres
sasnirosse
tutorlari
nonlelletottan
lirsetutit
so
le
setse
susritterlilu
lorrirotri
linuritlilrat
rernilnelnutel
sulolletrolo
nisatellilru
tulene
tetnan
lisotoslersor
nerlani
ne
tunoletso
nonlontaroltun
rirrostarset
sotlonsiro
net
sutona


The Keyboard Shift Cipher Given the following input:

An integer n where n > 0.
A string s where s is not empty and s~=[0-9A-Z]+ (alpha-numeric capitals only).

Using a standard, simplified QWERTY keyboard (as shown below):

1234567890
QWERTYUIOP
ASDFGHJKL
ZXCVBNM

Perform the following operation:

Find the original row that each character is in on the keyboard.
Replace the letter with the correct shifted equivalent for n based on its original position + n.

E.G. s="AB" and n=2: A would become D and B would become M.

If keyboard_row[position + n] > keyboard_row.length, wrap back to the start.

E.G. s="0P" and n=2: 0 would become 2 and P would become W.

Examples:

f("0PLM",1)    = 1QAZ
f("ZXCVB",2)   = CVBNM
f("HELLO",3)   = LYDDW
f("0PLM",11)   = 1QSV
f("0PLM",2130) = 0PHX

Rules

This is code-golf, lowest byte-count wins.

This is slightly more difficult than it seems at first glance.

Jelly, 13 bytes

ØQØDṭ,ṙ€¥⁸F€y

Try it online!

How it works

ØQØDṭ,ṙ€¥⁸F€y  Main link. Left argument: n (integer). Right argument: s (string)

ØQ             Qwerty; set the return value to
               ["QWERTYUIOP", "ASDFGHJKL", "ZXCVBNM"].
  ØD           Digits; yield "0123456789".
    ṭ          Tack, yielding ["QWERTYUIOP", "ASDFGHJKL", "ZXCVBNM", "0123456789"].
        ¥⁸     Call the two links to the left as a dyadic chain, with right
               argument n.
      ṙ€       Rotate each string in the array n units to the left.
     ,         Yield the pair of the unmodified and the rotated string array.
          F€   Flatten each, mapping, e.g., ["QWERTYUIOP", ..., "0123456789"] to
               "QWERTYUIOPASDFGHJKLZXCVBNM0123456789".
            y  Translate s according to the mapping we've built.


Is this word on the boggle board? Introduction

After a day of drinking and watching the world cup, you sit down to play friendly game of boggle. Tempers rise as you are accused of wasting everyone's time with nonsense words that aren't even on the board! You may be seeing double, but surely you're thinking straight enough to write a program that will verify that your words are on the board.

Your Task

Write a program, script, or function that takes a boggle board and a word as input, and returns True if the word is on the board and False if the word isn't.

The input will be in the form of six \n delimited lines. The first five lines will comprise the 5x5 boggle board and will each contain five capital letters. The sixth line will contain the word-in-question, also in all capital letters.

Sample input:

AJNES
TNFTR
LSAIL
UDNEX
EQGMM
DAFTER

The output can be anything that unambiguously signifies True or False in your programming language of choice and adheres to standard conventions of zero, null, and empty signifying False.

Sample output for above input:

1

I/O Guidelines

The input may be read from stdin, and answer output to stdout.

Or

The input may be a single string argument to a function, and answer be the return value of that function.

Boggle Rules

A word is 'on the board' if you can construct the word via a path of consecutive, adjacent, non-repeating tiles on the board.
A tile is considered adjacent to the eight tiles that surround it (diagonal paths are allowed). Tiles on the edge of the board are adjacent to only five tiles. Tiles in the corner are adjacent to only three.
Consecutive letters in the word must be adjacent, the ith letter in the word must be adjacent to the i-1th and i+1th.
A letter may appear in a word more than once, but you cannot use the same square on the boggle board more than once per word.
The online boggle site wordsplay.net may be useful if you have never played boggle before, but want to get a feel for these rules.

Unlike regular boggle:

You do NOT have to worry about the word being a valid English word.
There will be NO Qu single tile.
The word-in-question may be of any length > 0

Example

On the board of

AJNES
TNFTR
LSAIL
UDNEX
EQGMM

These words should return True: FATE, DATING, STANDS, LIFTS.

These words should return False: SADDEN, SULTANS, EXIST, SUEDE, QUEST

This is a code-golf challenge, so shortest code wins!

Javascript (E6) 137 160 175 190

Less than 2*Golfscript. Moral victory ...

F=a=>[...a].some((e,p,b)=>(Q=(p,n)=>p>29||b[p]!=b[n]||(b.r|=!b[++n])||(b[p]=b[n+~[1,5,6,7].map(q=>Q(p+q,n)|Q(p-q,n),b[p]=0)]))(p,30)&b.r)

Edit Golfed code reorganization. Again and again

Ungolfed Last version, a bit tricky to follow

F = a =>
  [...a] // input string to array, 30 chars of board then the target word
  .some ( // use some to scan the board, return true when found
      (e,p,b)=> // params to callback: element, position, complete array
      (         // NB array b has no .r property, so use it for return value (it's undefined at start)
        Q = (p,n) =>         // Scan function, p=position in board, n=nth char of target word
          p > 29 ||          // Chaek if going outside the board to the target word
          b[p] != b[n] ||    // if invalid char at current position, return
          (b.r |= !b[++n]) ||  // if at end of target, set r to 1 and return (also increment n )
          (                  // else... (NB next tree lines are coalesced in golfed code)
            b[p] = 0,        // remove current char (to avoid reusing)
            [1,5,6,7].map( q => Q(p+q,n)|Q(p-q,n)), // recursive call for + - 1,5,6,7
            b[p] = b[n-1]    // put current char into array again
          )
      )(p,30) & b.r // initial position 0 in target word is 30 in the array
  )

Ungolfed First version , should be clearer

F = a => (
  b = a.split('\n'),
  w = b.pop(),
  r = 0,
  Q = (p, n) =>
    (r |= !w[n]) ||
    (
      b[p] = 0,
      [1,5,6,7,-1,-5,-6,-7].map( q => b[q+=p]==w[n] && Q(q,n+1)),
      b[p] = w[n-1]
    ),
  b = [...b+''],
  b.map((e, p) => e==w[0] && Q(p,1)),
  r
)

Usage

F("AJNES\nTNFTR\nLSAIL\nUDNEX\nEQGMM\nLIFTS\nDAFTER")

Test

['DAFTER', 'STANDS', 'LIFTS', 'FATE', 'DATING' ,
 'SADDEN','SULTANS', 'EXIST', 'SUEDE', 'QUEST']
.map(w => [w, F("AJNES\nTNFTR\nLSAIL\nUDNEX\nEQGMM\n" +w)])

Output:

[["DAFTER", true], ["STANDS", true], ["LIFTS", true], ["FATE", true], ["DATING", true],
["SADDEN", false], ["SULTANS", false], ["EXIST", false], ["SUEDE", false], ["QUEST", false]]


The Quantum Drunkard's Walk It is well known that a person on a grid under the influence of alcohol has an equal chance of going in any available directions. However, this common-sense statement does not hold in the realm of very small drunkards, whose behavior is very much as if they take every available path at once, and the possible paths they take can interfere with each other. Your task is to display the possible positions of such a quantum drunkard after n steps.

Specification

The drunkard in question occupies a square grid, and may be considered to be a 3-state cellular automaton using a Von Neumann (plus-shaped) neighborhood which follows these simple rules:

Empty goes to Awake if it is adjacent to exactly one Awake, and otherwise goes to Empty
Awake goes to Sleeping
Sleeping goes to Sleeping

The initial state of the board is a single Awake surrounded by an infinite field of Emptys.

Challenge

Given a nonnegative integer n, create an ASCII representation of the drunkard after n steps. Each state should be represented by a different character, and solutions should state which character means which state. If you use spaces for Empty, you don't need to include a run of them at the end of a line.

This is code-golf, so shortest answer wins. Standard loopholes apply, leading and trailing whitespace is allowed, string array/2d char array output is allowed, etc.

Examples

These examples use  for Empty, @ for Awake, and # for Sleeping.

n=0
@

n = 1
 @
@#@
 @

n = 2
  @
  #
@###@
  #
  @

n = 3
   @
  @#@
 @ # @
@#####@
 @ # @
  @#@
   @

n=6

      @
      #
    @###@
     @#@
  @  ###  @
  #@# # #@#
@###########@
  #@# # #@#
  @  ###  @
     @#@
    @###@
      #
      @

n=10
          @
          #
        @###@
         @#@
         ###
        # # #
       #######
      #  ###  #
  @  ##  ###  ##  @
  #@# ### # ### #@#
@###################@
  #@# ### # ### #@#
  @  ##  ###  ##  @
      #  ###  #
       #######
        # # #
         ###
         @#@
        @###@
          #
          @

Interesting Note

By looking up the sequence of the number of occupied cells in the OEIS, I found that the quantum drunkard is isomorphic to the much better-studied toothpick sequence. If you can incorporate that knowledge into a better golf, I will be suitably impressed.

Wolfram Language (Mathematica), 92 91 bytes
Print@@@CellularAutomaton[{7049487784884,{3,{a={0,3,0},3-2a/3,a}},{1,1}},{j={{1}},0},{j#}]&

A perfect challenge to use Mathematica's builtin CellularAutomaton!
Try it online!
Empty = 0, Awake = 1, Sleeping = 2
Animation of the first 256 iterations (white = empty, gray = awake, black = sleeping):

Explanation
CellularAutomaton[ ... ]

Run CellularAutomaton with specifications...
{7049487784884,{3,{a={0,3,0},3-2a/3,a}},{1,1}}

Apply the 3-color totalistic rule 7049487784884, with Von Neumann neighborhood...
{j={{1}},0}

On a board with a single 1 in the middle, with a background of 0s...
{j#}

Repeat <input> times ({j#} evaluates to {{{#}}}). The array automatically expands if a cell outside of the border is not the same as the background
7049487784884

This rule comes from the base-3 number 220221220221220221220221220, which means "change all 1 or 2 to 2, and change 0 to 1 if and only if there is an odd number of 1s around it."
Print@@@

Print the array.
Semi-proof of "'odd 1s' is equivalent to 'exactly one 1'":
Consider this 5x5 grid of pixels. White is a 0 or a 2 cell (non-awake pixels), and gray is a 1 cell.

If a 1 cell was generated around three 0 cells, then the grid must look like this: it has three 1s arranged in a U-shape (or a rotated version) as follows:

Due to the self-similarity of this cellular automaton, any pattern that appears in the cellular automaton must appear on the diagonal (by induction). However, this pattern is not diagonally symmetric. i.e. it cannot occur on the diagonal and cannot appear anywhere on the cellular automaton.
Awake/Sleeping are equivalent
Note that a 0 cell cannot be surrounded by exactly one or three 2 cells and rest 0 cells, since that would imply that some steps prior, the cell had a neighbor of one or three 1 cells -- and must have turned into a 1 already (contradiction). Therefore, it is okay to ignore the distinction between 1 and 2 and state 'change all 1 to 1, and a 0 to a 1 if and only if it has an odd number of nonzero neighbors.'
The resulting cellular automaton is indeed identical to the original, the only difference being there is no distinction between "awake" and "asleep" drunkards. This pattern is described in OEIS A169707.
Print@@@CellularAutomaton[{750,{2,{a={0,2,0},2-a/2,a}},{1,1}},{j={{1}},0},{j#}]&

Try it online!
Side-by-side comparison of the first 16 iterations:

Adding two consecutive iterations gives a result that follows the challenge specs (94 bytes):
Print@@@Plus@@CellularAutomaton[{750,{2,{a={0,2,0},2-a/2,a}},{1,1}},{{{1}},0},{Ramp@{#-1,#}}]&

Try it online!


It's Halloween again! Problem Description

We all love a Twix (because it is the best candy), but this is the kids' first Halloween --- we gotta grab at least one of each type of candy for them. Each Halloween all the residents of Numberline avenue send out an email saying what types of candy they'll be giving away this year.

Oh! And we live in a 1D world.

Being exceptionally lazy in some ways and not in others, we've made a map of the houses giving their positions along the street. We also noted the types of candy they have. Here's the map we made for this year:

 [(-2, {"Kisses", "KitKats"}),
 (1, {"KitKats", "Peanut Butter Cups"}),
 (6, {"Kisses", "Twix"}),
 (9, {"Skittles"}),
 (10, {"Twix"})]

For the sake of the kids' little legs, we need to find the shortest walk starting at any house in the neighborhood to gather at least one of each type of candy.

Examples

At the request of a couple users (including Shaggy), I'll toss in some worked examples. Hopefully this clears things up. :)
Input:

 [(-2, {"Kisses", "KitKats"}),
 (1, {"KitKats", "Peanut Butter Cups"}),
 (6, {"Kisses", "Twix"}),
 (9, {"Skittles"}),
 (10, {"Twix"})]

Output:

[1, 2, 3]

Another map and solution...

Input:

[(-3, {"KitKats", "Twix"}),
(-1, {"Hundred Grands"}),
(3, {"Kisses"}),
(12, {"Hundred Grands", "Twix", "KitKats"})]

Output:

[0, 1, 2]

We could begin at the coordinate 9 house collecting candies to at houses 6 and 1. That fills the candy quota by walking 8 units, but is it the shortest solution?

Rules

Entries must take in a similarly structured single argument to the example and output the indices of the houses to visit in the shortest solution.

Typical code golf rules apply: shortest correct solution in bytes wins!

P.S. This was an interview question given to me by one of the world's largest tech companies. If you don't like golf, try finding an O(k*n) time solution where k is the number of candy types and n is the number of houses.

Edit

As Jonathon Allan pointed out, some confusion exists around what "indices" means in this case. We want to output the houses positions in the argument  list and not their coordinates on the lane.

Python 2, 133 130 127 bytes

def f(l):r=range(len(l));v,c=zip(*l);print min((v[j]-v[i],r[i:j+1])for i in r for j in r if s(*c)==s(*c[i:j+1]))[1]
s={0}.union

Try it online!


Wikipedia: Philosophy! As many geeks may know most pages (95% i think) on wikipedia eventually lead to Philosophy like this:

Click on the first non-italic or in parentheses link that is to another normal article: (i.e. not File: or Special:, but things like Wikipedia: are OK) and repeat on that one until you hit philosophy.

The script must:

Take a first page as input
Print the name of each article it gets to
And print how many articles it took to get to Philosophy, and if it didn't say so.

You start with 1000 points, and lose one for each character in the code, Bonus points for:

Detecting looping articles and stopping: +50

Detecting looping articles and requesting if the user should go to the next link on the article: +170

Allowing for a default on the former check as a command-line arg or similar: +140

Highest score wins.

Ruby, 1000 - 303 299 337 - 50 373 - 170 382 - 170 - 140 379 - 170 - 140 chars = 697 701 713 797 928 931

I'm sure there are many improvements to be made.

(This requires Nokogiri)

require'open-uri'
require'nokogiri'
x="/wiki/"+gets.chomp
r=[n=i=0]
until x=~/\/Philosophy/
d=Nokogiri.HTML open"http://en.wikipedia.org#{x}"
x=d.css('p a').select{|a|t=a.xpath('preceding::text()').map(&:text)*'';t.count('(')==t.count(')')&&a.attr('href')=~/^.wiki[^:]+$/}[i].attr'href'
i=0
puts r.index(x)?"#{$><<'i=';i=($*[0]||gets).to_i;''}": r.push(x)[-1][6..-1]
n+=1
end
p n

Example run:

c:\a\ruby>wikipedia_crawl_philosophy
Latin (note: this is my input)
Classical_antiquity
History
Umbrella_term
Terminology
Word
Linguistics
Science
Knowledge
Fact
Proof_(truth)
Argument
Logic
Reasoning
Consciousness
Quality_(philosophy)
Property_(philosophy)
Modern_philosophy
Philosophy
18

Sample one where I had to go to a different link

c:\a\ruby>wikipedia_crawl_philosophy
Snow
Precipitation_(meteorology)
Meteorology
Atmospheric_physics
Synoptic_scale_meteorology
i=2 // I put the 0-indexed number of the link I wanted to go to (so, the third link)

Weather
Atmosphere
Gas
State_of_matter#The_four_fundamental_states
Physics
Natural_science
Sciences
Knowledge
Fact
Proof_(truth)
Argument
Logic
Reasoning
Consciousness
Quality_(philosophy)
Property_(philosophy)
Modern_philosophy
Philosophy
25

Tricks I used:

I used the selector p a to only get non-italic links, because all links in the actual article that are not italics are always in paragraph elements in Wikipedia.


Evaluate the number of possible strings a regex can match In a chatroom with a few people, a topic came up between me and them about how many possible strings a regex could match.

Your task is to build a program that can answer that question.

Your program will accept, as input, any regular expression as defined in this document as an "extended regular expression", such as:

^[A-Za-z0-9]{8}$

and output the total number of possible strings that match that expression, outputting infinity if there are infinitely many:

218340105584896

Your program may also output too many if there are more than 263-1 possible strings that match the regex; however, it must not output infinity unless there are actually infinitely many strings.

The shortest program to do the above wins.

Python 3370
I got this to be about as functional as I could, and even got alternation to work (with correct double-count checking!). As far as I know this works for everything except lookarounds (because that would be crazy).
For anyone writing their own solution feel free to use/improve my methods as much as you like.
Code:
R=range;L=len;E=enumerate;I=int;F="Infinity";S=sum;H=chr;D=ord;J=lambda l:''.join(l);U=lambda s:J([H(i)if H(i) not in s else''for i in R(1,128)]);s=' \n\t';c=J((H(i)if H(i)not in s else'')for i in R(1,32));d,l,u=[J(H(i)for i in R(*n))for n in [[48,59],[97,123],[65,91]]];p='`~!@#$%^&*()-_=+[{]}\\|;:\'",<.>/?';Y={'\\s':s,'\\S':c+s+p+u+l+d,'\\d':d,'\\D':U(d),'\\w':u+l+'_','\\W':U(u+l+'_'),'[:alnum:]':u+l+d,'[:alpha:]':u+l,'[:ascii:]':U(''),'[:blank:]':' \t','[:cntrl:]':c,'[:digit:]':d,'[:graph:]':p+d+l+u,'[:lower:]':l,'[:print:]':p+d+l+u+s,'[:punct:]':p,'[:space:]':s,'[:upper:]':u,'[:word:]':l+u+'_','[:xdigit:]':d+'ABCDEF'};C=lambda l,n:[d+[l[i]]for i in R(L(l))for d in C(l[i+1:],n-1)]if n>0 else[[]];O=lambda x:S([all((c in s)for s in [(e[1]if any(e[1] not in Y for e in x)else Y[e[1]])if e[0]=='e'else(e[1]if e[0]=='t'else((Y[e[1]]if e[1]in Y else B(e[1]))if e[0]=='['else''))for e in x])for c in Y['[:ascii:]']])
def X(r):
 x=[];l=0;c=''
 for h in r:
    l+=I(h in'([')-I(h in')]')
    if l<1 and'|'==h:x+=[c];c=''
    else:c+=h
 x+=[c]
 if L(x)>1:
    o=0;m=[];u=[]
    for e in x:
     p,b=X(e)
     if p==F:return F,[]
     o+=p;m+=[('(',b)];u+=[b]
    return o-S([(-1)**(i%2)*T(s) for i in R(2,L(u)+1)for s in C(u,i)]),[('|',m)]
 u=[];o=[];m=[];w=1
 while r!='':
    h=r[0];z=0
    if h in'([{':
     l=1;i=1
     while l>0:k=r[i];l+=(k==h)-(k=={'(':')','[':']','{':'}'}[h]);i+=1
     u+=[(h,r[1:i-1])];z=i
    elif h=='\\':u+=[('e','\\'+eval("'\\%s'"%r[1]))]if r[1]in'nt'else[('e','\\'+r[1])];z=2
    elif h in ['*','+','?']:u+=[('{',h)];z=1
    elif h in'^$':return 0
    elif h=='.':u+=[('[','[:ascii:]')];z=1
    else:u+=[('t',h)];z=1
    r=r[z:]
 for t,g in u:
    if t=='(':p,b=X(g);o+=[p];m+=[('(',b)]
    elif t=='e':o+=[L(Y[g])]if g in Y else[1]
    elif t=='[':o+=[N(g)]
    elif t=='{':
     n=o[-1]
     try:o[-1]=S([n**r for r in Q(g)])
     except:return F,[]
    elif t=='t':o+=[1]
    if t!='(':m+=[(t,g)]
 for c in o:
    if c==F:return F,[]
    w*=c
 return w,m
def N(s):
 if s in Y:return L(Y[s])
 if(s[0],s[-1])==('[',']'):return 1
 n=(s[0]=='^');a=0
 if n:s=s[1:]
 while s!='':
    if L(s)>=3 and s[1]=='-':a+=D(s[2])-D(s[0])+1;s=s[3:];continue
    a+=1;s=s[1:]
 return 256*n+(-1)**n*a
def Q(s):
 if s=='?':return[0,1]
 if s[0]in'*+':return None
 if ','in s:
    l,h=s.split(',')
    return None if h==''else R(I(l),I(h)+1)
 return[I(s)]
def B(s):
 n=(s[0]=='^')
 if n:s=s[1:]
 a='';w=''
 while s!='':
    h=s[0]
    if 3<=L(s)and'-'==s[1]:
     for i in R(D(s[0]),D(s[2])+1):a+=H(i)
     s=s[3:];continue
    a+=h;s=s[1:]
 return J([c*(c not in a)for c in Y['[:ascii:]']])if n else a
def T(x):
 if all(e==[] for e in x):return 1
 for i,e in E(x):
    if L(e)>=2 and e[1][0]=='{':return S([T([[e[0]]*n+e[2:]]+x[:i]+x[i+1:])for n in Q(e[1][1])])
    if L(e)>=1:
     if e[0][0] == '(':return T([e[0][1]+e[1:]]+x[:i]+x[i+1:])
     if e[0][0]== '|':
        t=S(T([[s]+e[1:]]+x[:i]+x[i+1:])for s in e[0][1])
        u=[[s]for s in e[0][1]]
        return t-S((-1)**(j%2)*T(b)for j in R(2,L(u)+1)for b in C(u,j))
 if any(e==[]for e in x):return 0
 return O([e[0]for e in x])*T([e[1:]for e in x])
r=raw_input();e=[];l=0;c=''
for h in r:
 l+=I(h in'([')-I(h in')]')
 if l<1 and'|'==h:e+=[c];c=''
 else:c+=h
e+=[c];o=[];x=[]
for f in e:
 if '^'!=f[0]or'$'!=f[-1]:print F;quit()
 n,m=X(f[1:-1])
 if n==F:print F;quit()
 o+=[n];x+=[m]
print S(o)-S([(-1)**(i%2)*T(s) for i in R(2,L(x)+1)for s in C(x,i)])

Ungolfed:
controlchars = ''
for i in range(1,32):
    if chr(i) not in '\t\n':
        controlchars += chr(i)

CLASSES={
'\\s':' \t\n',
'\\S':controlchars+'!"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~',
'\\d':'0123456789',
'\\D':controlchars+'\n\t !"#$%&\'()*+,-./:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~',
'\\w':'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_',
'\\W':controlchars+'\n\t !"#$%&\'()*+,-./:;<=>?@[\\]^`{|}~',
'[:alnum:]':'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789',
'[:alpha:]':'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
'[:ascii:]':controlchars+'\n\t !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~',
'[:blank:]':' \t',
'[:cntrl:]':controlchars,
'[:digit:]':'0123456789',
'[:graph:]':'!"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~',
'[:lower:]':'abcdefghijklmnopqrstuvwxyz',
'[:print:]':'\n\t !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~',
'[:punct:]':'`~!@#$%^&*()-_=+[{]}\\|;:\'",<.>/?',
'[:space:]':' \t\n',
'[:upper:]':'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'[:word:]':'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_',
'[:xdigit:]':'0123456789ABCDEF'
}

DELIMIT = {
'(':')',
')':'(',
'[':']',
']':'[',
'{':'}',
'}':'{'
}

def combos(lst,num):
    if num == 0:
        return [[]]
    combs = []
    for i in range(len(lst)):
        for c in combos(lst[i+1:],num-1):
            combs.append([lst[i]]+c)
    return combs

def count_regex(regex):
    exprs = []
    level = 0
    current = ''
    for char in regex:
        if char in '([':
            level += 1
        if char in ')]':
            level -= 1
        if char == '|' and level == 0:
            exprs.append(current)
            current = ''
        else:
            current += char
    exprs.append(current)

    comps = []
    expanded = []
    for e in exprs:
        if (e[0] != '^' or e[-1] != '$'):
            return 'Infinity'
        num,member = count_expr(e[1:-1])
        if num == 'Infinity':
            return 'Infinity'
        comps.append(num)
        expanded.append(member)

    total = sum(comps)
    for i in range(2,len(expanded)+1):
        for subset in combos(expanded,i):
            if i % 2 == 0:
                total -= count_doubles(subset)
            else:
                total += count_doubles(subset)
    return total

def count_expr(expr):
    exprs = []
    level = 0
    current = ''
    for char in expr:
        if char in '([':
            level += 1
        if char in ')]':
            level -= 1
        if char == '|' and level == 0:
            exprs.append(current)
            current = ''
        else:
            current += char
    exprs.append(current)

    if len(exprs) != 1:
        comps = 0
        members = []
        sub = []
        for e in exprs:
            comp,memb = count_expr(e)
            if comp == 'Infinity':
                return 'Infinity',[]
            comps += comp
            members.append(('(',memb))
            sub.append(memb)

        for i in range(2,len(sub)+1):
            for subset in combos(sub,i):
                if i % 2 == 0:
                    comps -= count_doubles(subset)
                else:
                    comps += count_doubles(subset)

        return comps,[('|',members)]

    sub = []
    while expr != '':
        char = expr[0]
        if char in ['(','[','{']:
            level = 1
            i = 1
            while level > 0:
                nchar = expr[i]
                if nchar == char: level += 1
                if nchar == DELIMIT[char]: level -= 1
                i += 1
            sub.append((char,expr[1:i-1]))
            expr = expr[i:]
        elif char == '\\':
            if expr[1] == 'n':
                sub.append(('e','\\'+'\n'))
                expr = expr[2:]
            elif expr[1] == 't':
                sub.append(('e','\\'+'\t'))
                expr = expr[2:]
            else:
                sub.append(('e','\\'+expr[1]))
                expr = expr[2:]
        elif char in ['*','+','?']:
            sub.append(('{',char))
            expr = expr[1:]
        else:
            if char in '^$':
                return 0
            if char == '.':
                sub.append(('[','[:ascii:]'))
                expr = expr[1:]
            else:
                sub.append(('t',char))
                expr = expr[1:]

    components = []
    members = []
    for t,string in sub:
        if t == '(':
            comp,memb = count_expr(string)
            components.append(comp)
            members.append(('(',memb))
        elif t == 'e':
            if string in CLASSES:
                components.append(len(CLASSES[string]))
            else:
                components.append(1)
        elif t == '[':
            components.append(count_class(string))
        elif t == '{':
            num = components[-1]
            try:
                components[-1] = sum([num**r for r in count_quantifier(string)])
            except TypeError:
                return 'Infinity',[]
        elif t == 't':
            components.append(1)

        if t != '(':
            members.append((t,string))

    total = 1
    for c in components:
        if c == 'Infinity':
            return 'Infinity',[]
        total *= c
    return total,members

def count_class(string):
    if string in CLASSES:
        return len(CLASSES[string])
    if string[0] == '[' and string[-1] == ']':
        return 1
    negate = (string[0] == '^')
    if negate: string = string[1:]
    avail_count = 0
    while string != '':
        char = string[0]
        if len(string) >= 3:
            if string[1] == '-':
                first,last = string[0],string[2]
                avail_count += ord(last)-ord(first)+1
                string = string[3:]
                continue
        avail_count += 1
        string = string[1:]
    if negate:
        return 256-avail-count
    return avail_count

def count_quantifier(string):
    if string == '?':
        return [0,1]
    if string[0] in '*+':
        return None
    if ',' in string:
        low,high = string.split(',')
        if high == '':
            return None
        return range(int(low),int(high)+1)
    return [int(string)]

def bracket_string(string):
    negate = (string[0] == '^')
    if negate: string = string[1:]
    avail = ''
    while string != '':
        char = string[0]
        if len(string) >= 3:
            if string[1] == '-':
                first,last = string[0],string[2]
                for i in range(ord(first),ord(last)+1):
                    avail += chr(i)
                string = string[3:]
                continue
        avail += char
        string = string[1:]
    if negate:
        new = ''
        for c in CLASSES['[:ascii:]']:
            if c not in avail:
                new += c
        return new
    return avail

def overlap(es):
    chars=['' for i in range(len(es))]
    for i,e in enumerate(es):
        if e[0] == 'e':
            if any(e[1] not in CLASSES for e in es):
                chars[i] = e[1]
            else:
                chars[i] = CLASSES[e[1]]

    for i,e in enumerate(es):
        if e[0] == 't':
            chars[i] = e[1]

    for i,e in enumerate(es):
        if e[0] == '[':
            if e[1] in CLASSES:
                chars[i] = CLASSES[e[1]]
            else:
                chars[i] = bracket_string(e[1])

    total = 0
    for c in CLASSES['[:ascii:]']:
        has = True
        for chs in chars:
            if c not in chs:
                has = False
                break
        if has:
            total += 1
    return total

def count_doubles(exprs):
    if all(e==[] for e in exprs):
        return 1

    for i,expr in enumerate(exprs):
        if len(expr) >= 2 and expr[1][0] == '{':
            rng = count_quantifier(expr[1][1])
            total = 0
            for n in rng:
                total += count_doubles([ [expr[0]]*n+expr[2:] ] + exprs[:i] + exprs[i+1:])
            return total

    for i,expr in enumerate(exprs):
        if len(expr) >= 1 and expr[0][0] == '(':
            return count_doubles([ expr[0][1]+expr[1:] ] + exprs[:i] + exprs[i+1:] )

    if any(e==[] for e in exprs):
        return 0

    for i,expr in enumerate(exprs):
        if expr[0][0] == '|':
            total = 0
            subs = []
            for sub_expr in expr[0][1]:
                subs.append([sub_expr])
                total += count_doubles([ [sub_expr]+expr[1:] ] + exprs[:i] + exprs[i+1:])

            for j in range(2,len(subs)+1):
                for subset in combos(subs,j):
                    if j % 2 == 0:
                        total -= count_doubles(subset)
                    else:
                        total += count_doubles(subset)

            return total

    over = overlap([e[0] for e in exprs])
    if over == 0:
        return 0
    return  over * count_doubles([e[1:] for e in exprs])

reg = raw_input('Regex: ')
print count_regex(reg)

Here are some relevant test cases I have confirmed:
Regex: ^[A-Za-z0-9]{8}$
218340105584896

Regex: ^([a-b]*)$
Infinity

Regex: ^([0-9]|[a-e])([a-e]|[A-E])$|^[a-f]{2}$
161

Regex: ^[a-z]{2}$|^[0-9]?[a-z]{2,3}$|^a[a-z]?$
200773

Regex: ^([a-z]|[a-e]|[A-E]|[3-4]|[D-G])$
35

Regex: ^\(.)\(.)\2\1$
16129*

Regex: ^(a)\1?$
2

Regex: ^[[:space:]]$|^\t$
3

*This is actually different in the golfed and ungolfed due to a one character difference in what is defined as valid ascii. I believe the golfed is the more correct one.
To confirm its accuracy further tests could be done, please let me know of any errors (I honestly would not be surprised if there were quite a few).


Tuples by sequentially stepping through entries in list of lists Challenge:

Given a list of nonempty lists of integers, return a list of tuples of the following form: First list tuples starting with each element of the first list followed by the first element of every subsequent list, so the ith tuple should be [ith element of first list, first element of second list, ... , first element of last list]. For example:

[[1, 2, 3], [4, 5, 6], [7, 8, 9]] => [[1, 4, 7], [2, 4, 7], [3, 4, 7], ...

Then do tuples of the form [last element of first list, ith element of second list, first element of third list, ..., first element of last list], so in our example this would be:

[[1, 2, 3], [4, 5, 6], [7, 8, 9]] =>  ..., [3, 4, 7], [3, 5, 7], [3, 6, 7], ...

Continue on with each remaining list, until you get to [last element of first list, ..., last element of second to last list, ith element of last list]:

[[1, 2, 3], [4, 5, 6], [7, 8, 9]] => ..., [3, 6, 7], [3, 6, 8], [3, 6, 9]]

The full output is as follows:

[[1, 2, 3], [4, 5, 6], [7, 8, 9]] =>
        [[1, 4, 7], [2, 4, 7], [3, 4, 7], [3, 5, 7], [3, 6, 7], [3, 6, 8], [3, 6, 9]]

Some boilerplate for good measure:

If you want the input to be lists of strings, or lists of positive integers, it's fine. The question is about manipulating lists, not about what is in the lists.
Input and output can be in any acceptable format.
Either a full program or function is permitted.
Standard loopholes are disallowed by default.
This question is code golf, so lowest byte-count wins.

Examples:

[] => [[]] (or an error, thanks to ngn for correcting the output in this case)

[[1]] => [[1]]

[[1, 2], [3, 4], [5]] => [[1, 3, 5], [2, 3, 5], [2, 4, 5]]

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

[[1, 2, 3], [4, 5]] => [[1, 4], [2, 4], [3, 4], [3, 5]]

[[1, 2, 3], []] => unspecified behavior (can be an error)

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

[[16, 8, 4, 14, 6, 7, 10, 15], [11, 1, 12, 2, 19, 18, 9, 3], [13, 5, 17]] =>
    [[16, 11, 13], [8, 11, 13], [4, 11, 13], [14, 11, 13], [6, 11, 13],
     [7, 11, 13], [10, 11, 13], [15, 11, 13], [15, 1, 13], [15, 12, 13], [15, 2, 13],
     [15, 19, 13], [15, 18, 13], [15, 9, 13], [15, 3, 13], [15, 3, 5], [15, 3, 17]]

If anyone has a better title, let me know.

JavaScript (ES6), 59 bytes
Expects a list of lists of positive integers.

f=a=>[a.map(a=>a[0]),...a.some(a=>a[1]&&a.shift())?f(a):[]]

Try it online!
How?
At each iteration:

We output a new list consisting of the first element of each list.
We remove the first element of the first list containing at least 2 elements, and repeat the process. Or we stop the recursion if no such list exists.


Make an interweaving quine Your task is to create a program that, when run, returns itself as output (this is known as a quine). However, this quine must, when it is copied n times, returns the quine, but with each of its characters duplicated in place n times, where n is a positive integer.

If your original program is Derp:

Derp -> Derp (must return itself as output to be a quine)

DerpDerp -> DDeerrpp
(the "Derp" is copied twice, so each character in the output has to be copied twice)

DerpDerpDerp -> DDDeeerrrppp
etc. etc.

Keep in mind you're allowed to have whitespace in your "base" program, but they are counted when "interweaving". Say your program is

Derp
{newline}

(The newline signifies a trailing newline, and there's an extra space after the Derp). When duplicated to become

Derp
Derp
{newline}

You must output

DDeerrpp
{newline}
{newline}

Keep in mind that there's 2 extra spaces after the DDeerrpp.

Rules and Specs:

Your program must contain at least two distinct characters (which implies that your code must be at least 2 bytes long).
Standard quine rules apply.

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

Fission, 6 bytes

'!+OR"

Try it online! Try two copies! Try three!

Explanation

This is just the Fission standard quine. It happens to work for this challenge, because Fission has explicit entry points into the program. In particular, by duplicating the program, we add another R which adds another atom (instruction pointer). Since the source code is toroidal, the effective code being executed doesn't change otherwise — to each atom, the code still looks the same locally. However, the atoms are executed in lock step, so that the things they print are interleaved and we get an additional copy of each character in the output.

For completeness' sake I'll just shortly reiterate how the program itself works. Regardless of whether we repeat the program or not (e.g. '!+OR"'!+OR"'!+OR"), each atom sees the following code:

R"'!+OR"'!+O

The " toggles string printing mode, so that the program starts by printing '!+OR directly to STDOUT, which is all of the quine except the quote. Then '! sets the atom's mass to the character code of !, + increments it, which gives ", and O prints it while simultaneously destroying the atom. The program then terminates, because there are no atoms left.


Chopsticks mutated with points KoTH Basic rules (different from mine)
Story
It is the year 4579, humans now have 2 hands with 1001 fingers each. Chopsticks has become based off of points. And @Dennis has more rep then @Martin... Hand drawn red circles are now downvoted... Jon Skeet has hit 2 trillion rep on every SE site... Yeah scary I know
Chopsticks is a hand game that has been solved. So to get around this I have created it mutated. I increased the amount of fingers.
Rules of the game
The way this is played
Everyone starts with 2 hands. Each hand has 1001 fingers. Every hand starts with 1 (one) finger up on each hand. During your turn you can "hit" the other players hand. To hit you choose 1 of your hands to hit with and 1 of their hands to hit. The hand that was hit now has the amount of fingers that was their at first AND the amount of fingers that you had on the hand you hit with.
EX
P1: 1,1 P2: 1,1. P1[0] hits P2[1]. Now fingers are P1:1,1 P2:1,2. Now P2[1] hits p1[0]. The fingers are now P1: 3,1 P2 1,2.
If one hand gets to 1001 fingers up or more then that hand is out. Then player who got a hand out (for their turn) can "split". Splitting is when you take the hand that is in and halve the amount of fingers (round up) and give those fingers to the other hand getting it back in.
EX
P1: 1000,2 P2 7,7. P2[0] hits P1[0]. Score is P1: 0,2 P2 1,1. P1[1] splits for his turn and the score is P1: 1,1 and P2 7,7.
The game ends when one player has both hands out. Points are scored by the amount of fingers the winner has. More points = better. The loser gains no points.
There are other rules that are used but these are the ones used here.
Everybody plays everybody (round robin)
Endgame
Total your points up from every round you win. Then average everybody's points up. Divide your total by the average points and get your final score. Most points win.
Actual rules
Standard loopholes
Please do not try to solve the game. I actually have to be able to run it :P
Make sure the bot can run fast. With the length of rounds judging this will take a while
All libraries needed in your program must be in the default python library. Also list the ones you need imported. Imports will just be the basic import (for math I do: import math)
Answers must work in Python 3.x
Handler
Your bot will be its own Python 3 file with a play function.
play will be passed two lists of two numbers each. This number indicates how many fingers are up on each hand. The first list is your own hand.
If you choose to hit the other player's hand, then return a list of two bits. The first bit is the index of the hand you are using to hit (0 for the first, 1 for the last), and the second bit is the index of the hand you are hitting on the opponent.
If you choose to split, return any other truthy value.
Tada!
The controller can be found here. Save each bot in its own file and list each bot's filename (without .py) in botnames.
Final note:
You and the other bot will take turns going first. If the game does not terminate in 100,000 (one hundred thousand) rounds, the game will be terminated and neither bot wins.
The controller is not protected against moves taking forever, but unnecessary overhead will be strongly frowned upon.

CodingAndAlgorithms
This answer actually uses coding and algorithms, unlike the others so far!reference: imgur(also beats all of the answers posted before this)
def play(A, B):
    if sum(A) == 1:
        return [A.index(1), B.index(max(B))]
    elif max(A) + max(B) > 1000:
        return [A.index(max(A)), B.index(max(B))]
    elif 0 in A:
        return 1
    elif 0 in B:
        return [A.index(min(A)), 1-B.index(0)]
    else:
        return [A.index(min(A)), B.index(min(B))]


Help PPCG Claus Deliver his Presents! Help PPCG Claus Deliver his Presents
Overview
PPCG Claus is running hella late delivering his gifts because nowadays we have so many odd little kiddos out there. This makes it much harder for PPCG Claus to get all the presents to the correct place. Your challenge is to help him delvier his presents correctly.
The Complexity
Given a list of capitalized first names representing the kids he's supposed to deliver to and a list of presents represented by numbers, you must figure out how to distribute the presents among said children. Of course there's a catch though....
Nowadays kids are getting picky, if the kiddo is an odd fellow (first initial is ASCII-code odd) he wants an odd gift! If he's an even fellow (first initial is ASCII-code even) he obviously must be given an even one! Any child divisible by 3, however, is a naughty, naughty lad, so PPCG Claus must completely ignore them to make them behave next year. To consider his route a success he must deliver all presents to all children who deserve them and must not give any one child too many presents. If any child gets 3+ more presents than his or her peers, he risks becoming a naughty child next year, and that's just not right! Also, if any good child were to receive a present when another good child didn't, that also would turn that child evil.
Example
The kids are as follows:
Kids = ["Amy", "Betty", "Clyde", "Dave", "Francine"] = [A,B,C,D,F] = [65,66,67,68,70]

Betty is the bane of humanity, clearly in cahoots with the number 3.
Amy and Clyde have been weirdos since birth and would hate to receive
even presents.
Dave and Francine are normal, even, kids; they should only receive even presents!

The presents are as follows:
Presents = [1,2,3,4,5,6,7,8,9,10,11,12,13,14]
One possible output would be:
[
    ['Amy',[1,3,5]],
    ['Betty',[]],
    ['Clyde',[7,9,11,13]],
    ['Dave',[2,4,6,8]],
    ['Francine',[10,12,14]]
]

Exception Scenarios
However, just because PPCG Claus is ready and willing, doesn't mean PPCG Claus can. Here's a list of exception scenarios where you must break the bad news to PPCG Claus with a message of:
PPCGmas is cancelled!
The following scenarios will result in Christmas being cancelled:

There are no children.

[],[1,2,3] - Wellp, they ded.

There are no good children.

["Betty"],[1,2,3] - Seriously, screw Betty.

There are no presents, or less presents than good children.

["Amy","Charles"],[] - One or more would receive no presents.
["Amy","Charles"],[1] - One or more would receive no presents.

There are not odd/even presents to satisfy all good children.

["Amy","Dave"],[2,4,6] - Amy is screwed over.

Here's a list of scenarios that shouldn't affect PPCGmas:

Leftover Presents (All children should receive the maximal amount of presents).

["Amy","Dave"],[2,4,6,8,10,12,14,7,9] = [["Amy",[7,9]],["Dave",[2,4,6,8]]]

Main Rules Reiterated

Good children are either even or odd, based on their first initial.
Bad children have a first initial wholly divisible by 3.
All good children must receive at least one present.
No good child is to receive greater than 2 presents more than any other good child.
If there are to be leftover presents you must maximally distribute them, without violating 4.
Bad children must receive no presents at all.
If ANY of these is violated, you must output PPCGmas is cancelled!, exactly.

I/O Format Requirements

The 1st input must be an array/list/comma-delimited string of full names, not just the first initial.
The 2nd input must be a array/list/comma-delimited string of positive integers.
The output may be any denotation of how you distributed the presents that makes sense; or PPCGmas is Cancelled!.

Winning Criterion: code-golf
TL;DR: Betty is a jerk, don't compete.

JavaScript (ES6), 525 492 454 453 bytes

-71 bytes thanks to @Guedes
-1 bit thanks to @Jake Cobb

P=(K,p)=>{y='charCodeAt';n=(C)=>C[y](0)%3>0;N=(C)=>C[y](0)%3<1;E=(C)=>C[y](0)%2>0;O=(C)=>C[y](0)%2<1;f=(U)=>U%2<1;F=(U)=>U%2;M=(U,C)=>C%s==S;s=S=0;a=new Array();G='filter';e=p[G](f);o=p[G](F);J=K[G](n);r=J[G](O);L='length';i=J[G](E);s=r[L];for(S=0;S<r[L];S++){a.push([r[S],e[G](M)]);}s=i[L];for(S=0;S<i[L];S++){a.push([i[S],o[G](M)]);}K=K[G](N);for(S=0;S<K[L];S++){a.push(K[S],[]);}return(e[L]<r[L]||o[L]<i[L]||(r[L]+i[L])<1)?"PPCGmas is Cancelled!":a;}

Try it online !

Non-golfed version

Can be more golfed I think. I just did a litteral translation of the non-golfed version.

This is now shorter than the sum of the CharCode composing "santa" (115 + 97 + 110 + 116 + 97 = 535). Yeay


Symbolic Integration of Polynomials Apply an indefinite integral to a given string. The only rules you will be using are defined as such:

∫cx^(n)dx = (c/(n+1))x^(n+1) + C, n ≠ -1
c, C, and n are all constants.

Specifications:

You must be able to integrate polynomials with any of the possible features:

A coefficient, possibly a fraction in the format (numerator/denominator).
Recognition that e and π are constants, and in their use, be able to form fractions or expressions containing them (can be held in a fraction like (e/denominator) or (numerator/e), or, if in exponents, x^(e+1))

Aside of these two special constants, all coefficients will be rational, real numbers.

An exponent, possibly a fraction, in the format x^(exponent)

Expressions with e or π in them, aside of themselves, will not be in exponents. (you will not have to integrate stuff like x^(e+1), but you might integrate x^(e))

Can use non-x 1-char variables (i.e. f)

This is only for ASCII ranges 65-90 and 97-122.

You do not have to use chain rule or integrate x^(-1).

Output must have padding (separation between terms, i.e. x^2 + x + C.
If it is unknown how to integrate with the above features, the program should print out "Cannot integrate "+input.
It must be a full program.

Bonuses:

-10% if you print out the "pretty" exponents formatted for markdown (instead of x^2, x2).
-10% if you print out the equation (i.e. ∫xdx = (1/2)x^2 + C)

Examples:

Input:

x

Output:

(1/2)x^(2) + C

Input:

-f^(-2)

Output:

f^(-1) + C

Input:

(1/7)x^(1/7) + 5

Output:

(1/56)x^(8/7) + 5x + C

Input:

πx^e

Output:

(π/(e+1))x^(e+1) + C

Input:

(f+1)^(-1)

Output:

Cannot integrate (f+1)^(-1)

MATLAB, 646 x 0.9 = 581.4 bytes
t=input('','s');p=char(960);s=regexprep(t,{p,'pi([a-zA-Z])','([a-zA-Z])pi','([\)e\d])([a-zA-Z])','([a-zA-Z])(([\(\d]|pi))','e^(\(.+?\))','e'},{'pi','pi*$1','$1*pi','$1*$2','$1*$2','exp($1)','exp(1)'});r=[s(regexp(s,'\<[a-zA-Z]\>')),'x'];r=r(1);e=0;try
I=int(sym(strsplit(s,' + ')),r);S=[];for i=I
S=[S char(i) ' + '];end
b=0;o=[];for i=1:nnz(S)
c=S(i);b=b+(c==40)-(c==41);if(c==42&&S(i+1)==r)||(b&&c==32)
c='';end
o=[o c];end
o=regexprep(char([8747 40 t ')d' r ' = ' o 67]),{'pi','exp\(1\)','exp','\^([^\(])',['1/' r]},{p,'e','e^','^($1)',[r '^(-1)']});catch
e=1;end
if e||~isempty(strfind(o,'log'))
disp(['Cannot integrate ' t]);else
disp(o);end

This is currently a work-in-progress using MATLABs built in symbolic integration capabilities. Currently the requirements have been updated so the format now matches the requirements. It also does qualify for the second -10% bonus.
If anyone wants to pitch in and suggest ways of correcting the output, or use this code as a basis for another answer, feel free :). If I can find the time, I'll keep playing with it and see if I can think how to reformat the output.
Update: Ok, so after a bit more work, here is how the code currently stands. It is still a work in progress, but now getting closer to matching the required output.
t=input('','s'); %Get input as a string
p=char(960); %Pi character
s=regexprep(t,{p,'pi([a-zA-Z])','([a-zA-Z])pi','([\)e\d])([a-zA-Z])','([a-zA-Z])(([\(\d]|pi))','e^(\(.+?\))','e'},{'pi','pi*$1','$1*pi','$1*$2','$1*$2','exp($1)','exp(1)'}); %Reformat input to work with built in symbolic integration
r=[s(regexp(s,'\<[a-zA-Z]\>')),'x'];r=r(1); %determine the variable we are integrating
e=0; %Assume success
try
    I=int(sym(strsplit(s,' + ')),r); %Integrate each term seperately to avoid unwanted simplificaiton
    S=[];
    for i=I
        S=[S char(i) ' + ']; %Recombine integrated terms
    end
    %Now postprocess the output to try and match the requirements
    b=0;o=[];
    for i=1:nnz(S)
        %Work through the integrated string character by character
        c=S(i);
        b=b+(c=='(')-(c==')'); %Keep track of how many layers deep of brackets we are in
        if(c=='*'&&S(i+1)==r)||(b&&c==' ') %If a '*' sign preceeds a variable. Also deblank string.
            c=''; %Delete this character
        end
        o=[o c]; %merge into new output string.
    end
    o=regexprep([char(8747) '(' t ')d' r ' = ' o 'C'],{'pi','exp\(1\)','exp','\^([^\(])',['1/' r]},{p,'e','e^','^($1)',[r '^(-1)']});
catch
    e=1; %failed to integrate
end
if e||~isempty(strfind(o,'log'))
    disp(['Cannot integrate ' t])  %bit of a hack - matlab can integrate 1/x, so if we get a log, we pretend it didn't work.
else
    disp(o)% Display it.
end

Here are some examples of what it currently produces. As you can see, it's not quite right, but getting closer.
Inputs:
x
-f^(-2)
(1/7)x^(1/7) + 5
πx^e
(f+1)^(-1)

Outputs:
∫(x)dx = x^(2)/2 + C
∫(-f^(-2))df = f^(-1) + C
∫((1/7)x^(1/7) + 5)dx = x^(8/7)/8 + 5x + C
∫(πx^(e))dx = (πx^(e+1))/(e+1) + C
Cannot integrate (f+1)^(-1)


What's the missing column/row? (GCJ 2016-1A rankfile) There is an N x N square of numbers.

All columns increase strictly monotonically from top to down
All rows increase strictly monotonically from left to right
There is exactly one valid answer for each input.

You are given 2N-1 rows of N numbers representing rows or columns in this square. The task is to find the row that isn't in the input.

Your Task
Write a program or function that outputs the row or column that isn't in the input.

Input

First, you get the number N.
Then follow 2N-1 lines of N space-separated numbers, representing rows or columns of this N x N square. The lines are given in left-to-right or top-down order. There may be multiple equal lines. It is ok to omit the initial N from the input, or modify the input format as you like.

3
1 2 3
2 3 5
3 5 6
2 3 4
1 2 3

Output

Your program or function should output a single line of N numbers; the row or column from the square that was not present in the input. You may change the output format as you please.

3 4 6

This would correspond to one of two squares:

1 2 3     1 2 3
2 3 4     2 3 5
3 5 6     3 4 6

Either way, the output is the same.

Bonus

Your solution should be able to calculate 2 ≤ N ≤ 10 within a minute on a normal computer. If your solution handles the big input, 2 ≤ N ≤ 50, within a minute, you get -10% byte count.

Test cases

2
22 222
2 22
22 222
-> 2 22

3
1 2 3
2 3 5
3 5 6
2 3 4
1 2 3
-> 3 4 6

4
11 14 16 22
3 6 9 11
6 7 11 14
9 11 15 19
10 11 19 22
6 7 10 11
3 6 8 10
-> 8 10 15 16

Note that you can simply change what line in these inputs that is omitted, and reorder them in any way you want, to generate new test cases.

This is a simplified version of Google Code Jam 2016 round 1A problem B: Rank and File. The original Google Code Jam problem, where you can get more test cases (but without answers), is available here: https://code.google.com/codejam/contest/4304486/dashboard#s=p1

CJam, 5 - 10% = 4.5

This is an unnamed function (block) that takes an array of arrays and returns an array:

{:^$}

(With some inspiration from Dennis)

Try it online

And here is the code I actually submitted at GCJ (24 bytes):

li2*({l~}*]$e`{(2%*~}%S*

Try it online

Explanation:

This basically lists the values that appear an odd number of times.

:^    reduce by symmetric difference; pairs of duplicate values "cancel" each other
$     sort the resulting array


Simple markdown rendering There are several ways to create headers on posts on the Stack Exchange network. The format that's most commonly1 used on PPCG seems to be:

# Level one header
## Level two header
### Level three header

Note the space after the hash marks. Also, note that trailing hash marks are not included.

Challenge:

Take a (possibly multiline) string as input, and output the string on the following format:

If the header is level 1, then output each letter 4-by-4 times
If the header is level 2, then output each letter 3-by-3 times
If the header is level 3, then output each letter 2-by-2 times
If a line is not a header then output it as it is.

To illustrate:

--- Level 1 ---
# Hello
--- Output---
HHHHeeeelllllllloooo
HHHHeeeelllllllloooo
HHHHeeeelllllllloooo
HHHHeeeelllllllloooo

--- Level 2 ---
## A B C def
--- Output ---
AAA   BBB   CCC   dddeeefff
AAA   BBB   CCC   dddeeefff
AAA   BBB   CCC   dddeeefff

--- Level 3 ---
### PPCG!
--- Output---
PPPPCCGG!!
PPPPCCGG!!

Simple as that!

Rules:

You must support input over multiple lines. Using \n etc. for newlines is OK.

There won't be lines containing only a # followed by a single space

The output must be presented over multiple lines. You may not output \n instead of literal newlines.

Trailing spaces and newlines are OK.

Test cases:

Input and output are separated by a line of ....

# This is a text
with two different
### headers!
........................................................
TTTThhhhiiiissss    iiiissss    aaaa    tttteeeexxxxtttt
TTTThhhhiiiissss    iiiissss    aaaa    tttteeeexxxxtttt
TTTThhhhiiiissss    iiiissss    aaaa    tttteeeexxxxtttt
TTTThhhhiiiissss    iiiissss    aaaa    tttteeeexxxxtttt
with two different
hheeaaddeerrss!!
hheeaaddeerrss!!

This input has
## trailing hash marks ##
#and a hash mark without a space after it.
........................................................
This input has
tttrrraaaiiillliiinnnggg   hhhaaassshhh   mmmaaarrrkkksss   ######
tttrrraaaiiillliiinnnggg   hhhaaassshhh   mmmaaarrrkkksss   ######
tttrrraaaiiillliiinnnggg   hhhaaassshhh   mmmaaarrrkkksss   ######
#and hash marks without a space after it.

# This ## is ### strange
#### ###
........................................................
TTTThhhhiiiissss    ########    iiiissss    ############    ssssttttrrrraaaannnnggggeeee
TTTThhhhiiiissss    ########    iiiissss    ############    ssssttttrrrraaaannnnggggeeee
TTTThhhhiiiissss    ########    iiiissss    ############    ssssttttrrrraaaannnnggggeeee
TTTThhhhiiiissss    ########    iiiissss    ############    ssssttttrrrraaaannnnggggeeee
#### ###

Multiple

### newlines! #
:)
........................................................
Multiple

nneewwlliinneess!!  ##
nneewwlliinneess!!  ##
:)

Line with only a hash mark:
#
### ^ Like that!
........................................................
Line with only a hash mark:
#
^^  LLiikkee  tthhaatt!!
^^  LLiikkee  tthhaatt!!

1: I haven't really checked, but I think it's true.

Stacked, 51 50 bytes

Saved 1 byte thanks to @RickHitchcock - golfed regex

['^(##?#?) (.+)'[\#'5\-@k CS k*k rep LF#`]3/mrepl]

Try it online!

Anonymous function that takes input from the stack and leaves it on the stack.

Explanation

['^(##?#?) (.+)'[\#'5\-@k CS k*k rep LF#`]3/mrepl]
[                                            mrepl]   perform multiline replacement
 '^(##?#?) (.+)'                                     regex matching headers
                [                        ]3/         on each match:
                 \#'                                   count number of hashes
                    5\-                                5 - (^)
                       @k                              set k to number of repetitions
                          CS                           convert the header to a char string
                             k*                        repeat each char `k` times
                               k rep                   repeat said string `k` times
                                     LF#`              join by linefeeds


Construct a Gaussian Matrix Gaussian blur is a method used for blurring images smoothly. It involves creating a matrix which will be used by convolving it with the pixels of an image. In this challenge, your task is to construct that matrix used in Gaussian blur. You will take an input r which will be the radius of the blur and an input σ which will be the standard deviation in order to construct a matrix with dimensions (2 r + 1 × 2 r + 1). Each value in that matrix will have an (x, y) value that depends on its absolute distance in each direction from the center and will be used to compute G(x, y) where the formula G is

For example, if r = 2, we want to generate a 5 x 5 matrix. First, the matrix of (x, y) values is

(2, 2) (1, 2) (0, 2) (1, 2) (2, 2)
(2, 1) (1, 1) (0, 1) (1, 1) (2, 1)
(2, 0) (1, 0) (0, 0) (1, 0) (2, 0)
(2, 1) (1, 1) (0, 1) (1, 1) (2, 1)
(2, 2) (1, 2) (0, 2) (1, 2) (2, 2)

Then, let σ = 1.5 and apply G to each (x, y)

0.0119552 0.0232856 0.0290802 0.0232856 0.0119552
0.0232856 0.0453542 0.0566406 0.0453542 0.0232856
0.0290802 0.0566406 0.0707355 0.0566406 0.0290802
0.0232856 0.0453542 0.0566406 0.0453542 0.0232856
0.0119552 0.0232856 0.0290802 0.0232856 0.0119552

Normally in image blurring, this matrix would be normalized by taking the sum of all the values in that matrix and dividing by it. For this challenge, that is not needed and the raw values calculated by the formula is what the output should be.

Rules

This is code-golf so the shortest code wins.
The input r will be a nonnegative integer and σ will be a positive real number.
The output must represent a matrix. It can be formatted as a 2d array, a string representing a 2d array, or something similar.
Floating-point inaccuracies will not be counted against you.

Test Cases

(r, σ) = (0, 0.25)
2.54648

(1, 7)
0.00318244 0.00321509 0.00318244
0.00321509 0.00324806 0.00321509
0.00318244 0.00321509 0.00318244

(3, 2.5)
0.00603332 0.00900065 0.0114421  0.012395 0.0114421 0.00900065 0.00603332
0.00900065  0.0134274 0.0170696 0.0184912 0.0170696  0.0134274 0.00900065
 0.0114421  0.0170696 0.0216997  0.023507 0.0216997  0.0170696  0.0114421
  0.012395  0.0184912  0.023507 0.0254648  0.023507  0.0184912   0.012395
 0.0114421  0.0170696 0.0216997  0.023507 0.0216997  0.0170696  0.0114421
0.00900065  0.0134274 0.0170696 0.0184912 0.0170696  0.0134274 0.00900065
0.00603332 0.00900065 0.0114421  0.012395 0.0114421 0.00900065 0.00603332

(4, 3.33)
0.00339074 0.00464913 0.00582484 0.00666854 0.00697611 0.00666854 0.00582484 0.00464913 0.00339074
0.00464913 0.00637454 0.00798657  0.0091434 0.00956511  0.0091434 0.00798657 0.00637454 0.00464913
0.00582484 0.00798657  0.0100063  0.0114556   0.011984  0.0114556  0.0100063 0.00798657 0.00582484
0.00666854  0.0091434  0.0114556   0.013115  0.0137198   0.013115  0.0114556  0.0091434 0.00666854
0.00697611 0.00956511   0.011984  0.0137198  0.0143526  0.0137198   0.011984 0.00956511 0.00697611
0.00666854  0.0091434  0.0114556   0.013115  0.0137198   0.013115  0.0114556  0.0091434 0.00666854
0.00582484 0.00798657  0.0100063  0.0114556   0.011984  0.0114556  0.0100063 0.00798657 0.00582484
0.00464913 0.00637454 0.00798657  0.0091434 0.00956511  0.0091434 0.00798657 0.00637454 0.00464913
0.00339074 0.00464913 0.00582484 0.00666854 0.00697611 0.00666854 0.00582484 0.00464913 0.00339074

Mathematica, 60 54 50 bytes
Thanks @GregMartin for 4 bytes!
Array[s=2#2^2;E^(-{##}.{##}/s)/π/s&,1+2{#,#},-#]&

Takes r and sigma as input, returns the matrix (exact numbers).
Built-in version (58 bytes)
GaussianMatrix[{##},Standardized->1<0,Method->"Gaussian"]&

Of course, Mathematica has a built-in for this, too, but it's too long.


Compute overall ranking You are given a table that represents the rankings of S subjects according to a number C of different criteria. The purpose is to

compute an overall ranking according to a weighted sum of the C ranking criteria,
using one of those criteria (i.e. columns), T, as tie-breaker.

The rankings are a S×C table of positive integers. The weights for computing the overall ranking are given as an array of non-negative numbers.

Entry (s,c) of the table contains the ranking of subject s according to criterion c; that is the position of subject s when all S subjects are sorted according to criterion c. (Another possible interpretation, not used here, would be: row s tells which user is ranked s-th according to criterion c).

Example

Consider the following table with S=6 and C=2:

1   4
4   5
6   1
3   3
5   2
2   6

Weights are

1.5 2.5

and column T=2 is used as tie-breaker.

The overall ranking for the first subject (first row) is 1*1.5+4*2.5 = 11.5. The overall ranking array is

11.5
18.5
11.5
12
12.5
18

The resulting ranking, which is the output, is then

2
6
1
3
4
5

Note that the first-ranked row is the third, not the first, according to the tie-breaking specification.

Input and output

Use any reasonable format for input and output. The rankings may be a 2D array of any orientation, an array of arrays, or separate arrays. Inputs may be taken in any fixed order.

Input and output rankings should be 1-based (as in the example above), because that's the natural way to speak of rankings.

Output may be a string of numbers with a fixed separator character or an array.

You can write a function or a program.

Test cases

Table, weights, tie-breaking column, output.

--- (Example above) ---

1   4
4   5
6   1
3   3
5   2
2   6

1.5 2.5

2

2
6
1
3
4
5

--- (Three columns) ---

4     4     1
2     3     5
5     1     3
3     5     2
1     2     4

0.5   1.4   0.9

1

3
4
1
5
2

--- (Only one weight is nonzero) ---

1     5
3     3
4     2
5     1
2     4

1     0

2

1
3
4
5
2

--- (Only one column) ---

2
4
1
3

1.25

1

2
4
1
3

--- (Only one row) ---

1 1 1

0.8 1.5 2

3

1

Jelly, 11 10 bytes
-1 byte by @Dennis
×⁵S€żị@€ỤỤ

Uses the fact that lists are lexicographically ordered.
This is a dyadic link that takes two arguments plus one input. The left argument is x, the rankings. The right argument is y, the tiebreaker. The input is the weights.
×⁵S€żị@€ỤỤ         Dyadic function. Inputs: x, y
×⁵                 Vectorized multiply x by the weights.

  S                Sum the rows.
                   This is the weighted ordering.
   ż               Zip with
    ị@€             x indexed at y, mapped over x
       ỤỤ          and compute the inverse of the permutation vector that sorts that.
                   A list is sorted by its inverse permutation, so
                   this is the inverse of the inverse; i.e. the original permutation.

Try it here.


How many of each pill to take to achieve the total daily dose A drug comes in 5mg, 2.5mg, and 1mg sized pills. The drug is taken once a day. The total daily dose will be only one of the following (all in mg):
1, 2, 3, ... 20, 22.5, 25, 27.5, 30, 32.5, 35, 37.5, 40, 42.5, 45, 47.5, 50
In words: any whole number less or equal to 20, then at 2.5mg increments up to 50.
Your task is to determine how many pills of each size the patient should take to get to their total dose, minimizing the total number of pills they have to take.
Input: the total daily dose
Output: the respective number of 5mg, 2.5mg, and 1mg the patient needs to take, in any consistent format.
This is code golf. Fewest number of bytes wins.
Examples: (output is number of 1, 2.5, and 5 mg pills)
1 => [1, 0, 0]
4 => [4, 0, 0]
7 => [2, 0, 1]
19 => [4, 0, 3]
22.5 => [0, 1, 4]
40 => [0, 0, 8]

Irrelevant: this is based on a true story. The drug is prednisone and I wrote a program to automate the production of a calendar for patients to use to titrate their doses, which is a challenging task for many elderly patients to do safely even if you give them written instructions. This challenge was part of the programming task.

R, 53 38 bytes

function(x)c(x%/%5,2*x%%1,(x<20)*x%%5)

Try it online!
Output is in the order (5mg, 2.5mg, 1mg).
For the 2.5mg pills:

if the dose is an integer, we need 0 such pills. Indeed, 1 pill of 2.5 mg would not give an integer, and 2 pills of 2.5 mg can be replaced by a single 5mg pill
if the dose x is not an integer, we need exactly 1 such pill (similar argument), and then we call the function with the integer x-2.5.

The number of 5 mg pills is the integer division of the input by 5.
Note that because the input is restricted, the 1 mg pills are never needed when the input is ≥20. If the input is <20, the number of 1mg pills is given by taking the input modulo 5.


Smallest Integer Disk This challenge is about finding the smallest disk that contains some given points. This is made somewhat trickier, however, by the fact that in this challenge, the disk's coordinates and radius must both be integers.

Your input will be a list of points with integer coordinates x and y. You can take this as a list of tuples, a list of lists, or any other way to represent a collection of pairs. x and y will both be (possibly negative) integers. Every point is guaranteed to be unique, and there will be at least one point.

Your output will be a disk in the form of three numbers, X, Y, and R. X, Y, and R are all integers, X and Y represent the disk's center and R represents its radius. The distance between every given point and the center must be less than or equal to R, and there must not exist such a disk with a smaller R that also satisfies this condition.

It is possible that there will be multiple possible solutions for a given input, your code must output at least one of them in this case.

You can use any kinds of geometry builtins your language supports if there are any, and input/output may be through built-in point/disk objects instead of just numbers.

Test Cases

Input   (Possible) Output(s)
(x,y)   (X,Y,R)
-------------------------
(0,0)   (0,0,0)
-------------------------
(0,1)   (0,0,1)
(1,0)   (1,1,1)
-------------------------
(1,4)   (4,4,3)
(3,2)
(4,1)
(4,5)
(5,2)
(7,4)
-------------------------
(-1,0)  (0,0,2)
(2,0)   (1,0,2)
-------------------------
(-1,0)  (1,0,2)
(2,1)   (0,1,2)
-------------------------
(0,0)   (1,0,1)
(1,1)   (0,1,1)

Fewest bytes wins.

Brachylog v2, 19 bytes

;Az{\-ᵐ~√ᵐ+}ᵐ≤ᵛ√;A≜

Try it online!

This program was easy to write – Brachylog's almost perfect for this sort of problem – but hard to golf. It wouldn't surprise me if there was a byte saving somewhere here, as few things I did seemed to have any effect (and it contains nested map instructions, normally a sign that you should be using member/findall, but I can't see a way to do it).

This is a function submission. Input is from the left argument to the function in the format [[x,y],[x,y],…], output from the right argument in the form [r,[[x,y]]]. (If you want to try negative numbers in the input, note that Brachylog uses _ for the minus sign, not -. This is confusing because the function → full program wrapper that Brachylog ships with, requested using the command-line argument Z, will present negative numbers in the output with a regular minus sign.)

Explanation

;Az{\-ᵐ~√ᵐ+}ᵐ≤ᵛ√;A≜
;A                   Append something
  z                    to every element of the input
   {       }ᵐ        such that for each resulting element:
     -                 Subtracting
    \ ᵐ                  corresponding elements {of the (input, appended) element}
       ~√              and un-squarerooting
         ᵐ               {the result of} each {subtraction}
          +            and summing {the resulting square numbers}
             ≤       {lets us find} a number at least as large as
              ᵛ        every element {of the list of sums}
               √     which can be square-rooted;
                ;A   append the same list as initially to it.
                  ≜  Find the first integer solution to the above, lexicographically.

This is interesting in that we're asking Brachylog to find a value of certain properties (in this case, the radius of a disk centred at point A that fits all the input points), but hardly placing any requirements on it (all we require is that the radius is a number). However, Brachylog will internally calculate the radius in question symbolically rather than trying to use concrete numbers, so when the final ≜ is reached, it accomplishes two things at once: first, it ensures that only integers are used for the coordinates of A and for the radius (forcing the squared radius to be a square number, and explaining the use of ≤ᵛ to find a "maximum or greater"); second, it finds the smallest possible viable radius (as the radius comes first in the output).

One thing that isn't specified in the program at all is that all the points are measured against the same centre of a disk; as written, there are no constraints that we don't use a different centre for each point. However, the tiebreak order (which in this case is set by the third ᵐ, and which as a structure constraint will be evaluated before the value constraint implied by ≜) wants A to be as short as possible (i.e. a single element, so we use the same centre each time; it tries a zero-length A first but that obviously doesn't work, so it tries a singleton list next). As a result, we end up getting a useful constraint (that we only have one disk) "for free".

This solution happens to generalise to any number of dimensions, with no changes to the source code; there are no assumptions here that things are two-dimensional. So if you happen to need the smallest integer sphere, you can have that too.