Fastest alphabetical list sort given the following limitations: Your function must have an input that takes in an array containing 10000 random names, and must sort these names in alphabetical order. Names have a random length of up to 128 characters. ISO/IEC 8859-1 character set assumed to be used for the list of names.

Usable list of names can be found at http://www.opensourcecf.com/1/2009/05/10000-Random-Names-Database.cfm (firstNameFirst column).

You may not use any native sorting functions available to your language.

The winner will be based purely on speed.

Language used must be compilable/runnable on a standard *nix box.

C - B-tree sort
This sorts randomNames.csv in about 5.8ms on my Core 2 T5500 @ 1.66GHz.  My testing utility is here.
It isn't the fastest algorithm for sorting this quantity of data, but I didn't feel like trieing.
#include <assert.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct Btree Btree;

static void btree_insert(Btree **btree, const char *key);
static void btree_emit_and_free(Btree *btree, const char ***out);

void sort(const char **strings, size_t count, const char **out)
{
    size_t i;
    Btree *tree = NULL;
    const char **out_start = out;

    for (i = 0; i < count; i++)
        btree_insert(&tree, strings[i]);

    btree_emit_and_free(tree, &out);

    assert(out - out_start == (ssize_t) count);
}

/*
 * Maximum (U) and minimum (L) number of *keys* per B-tree node.
 *
 * The maximum number of *branches* a B-tree may have is U+1 :
 *
 *       KEY   KEY
 *     /     |     \
 * branch  branch  branch
 */
#define U 20
#define L (U / 2)

struct Btree {
    /* Number of keys (rather than branches). */
    unsigned char count;

    /* 0 if node is a leaf, 1 if it has leaf children, etc. */
    unsigned char depth;

    const char *keys[U];

    /* Allocated to U+1 items if this is an internal node. */
    Btree *branches[];
};

static Btree *allocLeaf(void)
{
    return malloc(sizeof(Btree));
}

static Btree *allocInternal(void)
{
    return malloc(sizeof(Btree) + (U+1) * sizeof(Btree *));
}

static bool insert(Btree *node, const char *x,
                   const char **new_x, Btree **new_xr);
static bool insert_item(Btree *node, unsigned int k,
                        const char  *x,     Btree  *xr,
                        const char **new_x, Btree **new_xr);
static unsigned int
find_insertion_point(const char *keys[], unsigned int count, const char *x);

static void btree_insert(Btree **btree, const char *key)
{
    if (*btree == NULL) {
        Btree *root = allocLeaf();
        root->count = 1;
        root->depth = 0;
        root->keys[0] = key;
        *btree = root;
    } else {
        const char *new_x;
        Btree *new_xr;

        if (insert(*btree, key, &new_x, &new_xr)) {
            Btree *root = allocInternal();
            root->count = 1;
            root->depth = (*btree)->depth + 1;
            root->keys[0] = new_x;
            root->branches[0] = *btree;
            root->branches[1] = new_xr;
            *btree = root;
        }
    }
}

static bool insert(Btree *node, const char *x,
                   const char **new_x, Btree **new_xr)
{
    unsigned int k = find_insertion_point(node->keys, node->count, x);
    Btree *xr;

    if (node->depth == 0)
        xr = NULL;
    else if (insert(node->branches[k], x, new_x, new_xr))
        x = *new_x, xr = *new_xr;
    else
        return false;

    return insert_item(node, k, x, xr, new_x, new_xr);
}

static bool insert_item(Btree *node, unsigned int k,
                        const char  *x,     Btree  *xr,
                        const char **new_x, Btree **new_xr)
{
    unsigned int i;
    bool internal = xr != NULL;

    if (node->count < U) {
        /* Enough case */
        for (i = node->count; i-- > k;)
            node->keys[i + 1] = node->keys[i];
        node->keys[k] = x;
        if (internal) {
            for (i = node->count + 1; i-- > k + 1;)
                node->branches[i + 1] = node->branches[i];
            node->branches[k + 1] = xr;
        }
        node->count++;
        return false;
    } else {
        Btree *r = internal ? allocInternal() : allocLeaf();

        node->count = L;
        r->count = L;
        r->depth = node->depth;

        if (k < L) {
            /* Left case */
            *new_x = node->keys[L - 1];
            for (i = 0; i < L; i++)
                r->keys[i] = node->keys[i + L];
            for (i = L - 1; i-- > k;)
                node->keys[i + 1] = node->keys[i];
            node->keys[k] = x;
            if (internal) {
                for (i = 0; i <= L; i++)
                    r->branches[i] = node->branches[i + L];
                for (i = L; i-- > k + 1;)
                    node->branches[i + 1] = node->branches[i];
                node->branches[k + 1] = xr;
            }
        } else if (k == L) {
            /* Central case */
            *new_x = x;
            for (i = 0; i < L; i++)
                r->keys[i] = node->keys[i + L];
            if (internal) {
                r->branches[0] = xr;
                for (i = 1; i <= L; i++)
                    r->branches[i] = node->branches[i + L];
            }
        } else {
            /* Right case */
            *new_x = node->keys[L];
            for (i = 0; i < k - L - 1; i++)
                r->keys[i] = node->keys[i + L + 1];
            r->keys[k - L - 1] = x;
            for (i = k - L; i < L; i++)
                r->keys[i] = node->keys[i + L];
            if (internal) {
                for (i = 0; i < k - L; i++)
                    r->branches[i] = node->branches[i + L + 1];
                r->branches[k - L] = xr;
                for (i = k - L + 1; i <= L; i++)
                    r->branches[i] = node->branches[i + L];
            }
        }

        *new_xr = r;
        return true;
    }
}

static unsigned int
find_insertion_point(const char *keys[], unsigned int count, const char *x)
{
    unsigned int start = 0;
    unsigned int middle;

    while (count) {
        middle = count >> 1;
        if (strcmp(x, keys[start + middle]) < 0) {
            count = middle;
        } else {
            start += middle + 1;
            count -= middle + 1;
        }
    }

    return start;
}

static void btree_emit_and_free(Btree *btree, const char ***out)
{
    unsigned int i;

    if (btree->depth == 0) {
        for (i = 0; i < btree->count; i++)
            *(*out)++ = btree->keys[i];
    } else {
        for (i = 0; i < btree->count; i++) {
            btree_emit_and_free(btree->branches[i], out);
            *(*out)++ = btree->keys[i];
        }
        btree_emit_and_free(btree->branches[btree->count], out);
    }

    free(btree);
}


Pairs of palindromic anagramic dates separated by a palindromic number of days Definitions:

A palindrome is a string which reads the same backward or forward (not counting spaces or special characters), such as "madam" or "Sorel Eros".
A date is said to be a palindrome when its dd-mm-yyyy format is a palindrome (or any other local representation).

Two strings are said to be anagrams when the contain the same characters (modulo a rearrangement), such as "Silent" and "Listen". Two dates are anagrams when their representation (the same as the one chosen for 1.) are anagrams.

Challenge:

The challenge is to find all the pairs (a,b) of dates (between 1/1/01 and 12/31/9999) which satisfy the following three conditions :

a and b are different
a and b are palindromes
a and b are anagrams
a and b are separated by a number of days which is a palindrome.

Constraints

You can choose one of the three date formats :

yyyy-mm-dd
dd-mm-yyyy
mm-dd-yyyy

That means left padding with zeros for days and month (02/02/1999) and a 4 zeros padding for years.

You must respect leap years + every 100 years leap + every 400 years leap such as specified in the Proleptic Gregorian calendar

Input
None.

Output

Pairs of dates (same format) and the number of days separating them
Display format can be different to the computation format.

31-03-3013 - 13-03-3031 :: 6556

[EDIT]

Standard loopholes apply

This is code golf, shortest code wins!


Pentagonal numbers made from pentagonal numbers Introduction
A pentagonal number (A000326) is generated by the formula Pn= 0.5×(3n2-n). Or you can just count the amount of dots used:

You can use the formula, or the gif above to find the first few pentagonal numbers:
1, 5, 12, 22, 35, 51, 70, 92, 117, 145, 176, 210, 247, 287, 330, 376, 425, 477, etc...

Next, we need to compute the sum of x consecutive numbers.
For example, if x = 4, we need to look at Pn + Pn+1 + Pn+2 + Pn+3 (which consists of 4 terms). If the sum of the pentagonal numbers also is a pentagonal number, we will call this a pentagonal pentagon number.
For x = 4, the smallest pentagonal pentagon number is 330, which is made of 4 consecutive pentagonal numbers: 51, 70, 92, 117. So, when the input is 4, your program of function should output 330.

Task

When given an integer greater than 1, output the smallest pentagonal pentagon number.
You may provide a function or a program.
Note: There are no solutions for e.g. x = 3. This means that if a number cannot be made from the first 10000 pentagonal numbers, you must stop computing and output whatever fits best for you.
This is code-golf, so the submission with the least amount of bytes wins!

Test cases:
Input: 2
Output: 1926 (which comes from 925, 1001)

Input: 3
Output: ?

Input: 4
Output: 330 (which comes from 51, 70, 92, 117)

Input: 5
Output: 44290 (which comes from 8400, 8626, 8855, 9087, 9322)

Input: 6
Output: 651 (which comes from 51, 70, 92, 117, 145, 176)

Input: 7
Output: 287 (which comes from 5, 12, 22, 35, 51, 70, 92)

Input: 8
Output: ?

Input: 9
Output: 12105 (which comes from 1001, 1080, 1162, 1247, 1335, 1426, 1520, 1617, 1717)

Input: 10
Output: ?

Also bigger numbers can be given:
Input: 37
Output: 32782

Input: 55
Output: 71349465

Input: 71
Output: 24565290

CJam, 29 bytes

6e5{)_3*(*2/}%_A4#<riew::+&1<

Try it online.

Takes a couple of seconds to run.

Explanation

First, we need to check how many pentagonal numbers we need to consider as potential sums. The sum of the first 10,000 pentagonal numbers is 500050000000. The first pentagonal number greater than that is the 577,380th.

6e5       e# 600,000 (a short number that's a bit bigger than we need).
{         e# Map this block onto every number from 0 to 599,999...
  )       e#   Increment.
  _3*(*2/ e#   Apply the pentagonal number formula given in the challenge.
}%
_         e# Make a copy.
A4#<      e# Truncate to the first 10,000 elements.
ri        e# Read input and convert to integer.
ew        e# Get sublists of that length.
::+       e# Sum each sublist.
&         e# Set intersection with all 600k pentagonal numbers computed earlier.
1<        e# Truncate to the first result.

I used a slightly modified program to find the largest inputs which yield a non-empty solution. These are all the solutions for inputs greater than 9,000:

9919 -> 496458299155
9577 -> 446991927537
9499 -> 455533474060
9241 -> 401702906276
9017 -> 429351677617


Matrix with 1 to L(n), in all n columns Challenge:

Take a list, L containing positive integers as input:

3 5 2 1 6

and create a matrix where the n'th column contains the vector 1:L(n), where shorter rows are padded with zeros.

Test cases:

3   5   2   1   6
-----------------
1   1   1   1   1
2   2   2   0   2
3   3   0   0   3
0   4   0   0   4
0   5   0   0   5
0   0   0   0   6

1
-
1

1   2   3   4   3   2   1
-------------------------
1   1   1   1   1   1   1
0   2   2   2   2   2   0
0   0   3   3   3   0   0
0   0   0   4   0   0   0

Rules:

Optional input and output formats

List of lists is an acceptable output format

The matrix must be as small as possible (you may not pad it with more zeros than needed)
Shortest code in each language wins
Explanations are highly encouraged

R, 40 38 bytes

function(l)outer(m<-1:max(l),l,"<=")*m

Try it online!

Explanation:

outer applies its third argument (the function) to all combinations of elements of its first two arguments, generating a matrix of TRUE and FALSE where each column has TRUE where 1:max(l) is less than or equal to the corresponding element of l, for the example where l=c(3,5,2,1,6):

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

Then supposing the resultant matrix is A, then A*m -> A[i,j]=A[i,j]*i which coerces TRUE to 1 and FALSE to 0, producing the desired result.


Professor at MIT can read minds! The task is taken from an MIT lecture by Prof. Devadas called You can read minds. A detailed explanation of the trick can be found in the linked video, or in this document. I'll try to explain it in simpler terms.

It turns out this was invented in the 1930's, and is known as the "Five-Card Trick of Fitch Cheney".

The trick goes like this:

Five random cards are chosen from a deck of cards. The audience and your assistant get to see them, but you don't.
Your assistant (with whom you have practiced) will select four of those cards and show them to you in a specific order. Note that the hidden card is not randomly picked from the 5 cards. The assistant picks a/the card that will make the trick work.
You will deduce, based on the information you can gather from the four cards what the fifth card is.

How?

Keep the following two points in mind:

When choosing 5 random cards, you are guaranteed that at least two cards have the same suit1.
The image below shows a circle with all the ranks2. Since it's a circle, it's possible to count: J, Q, K, A, 2, 3 (i.e. modular counting).
You are guaranteed that the hidden card does not have the same rank as the first, since they will be of the same suit (explained below). It's always possible to choose the first card and the hidden cards such that the hidden card is between 1 and 6 ranks higher than the first (when counting in circles). If the first card is 1, then the hidden card will be 2,3,4,5,6 or 7. If the first card is J, then the hidden card will be Q,K,A,2,3 or 4 and so on.

The algorithm:

The first card: This card will have the same suit as the hidden card. The card will also be the reference point you'll use when figuring out the rank of the hidden card.

The 2nd, 3rd and 4th cards decodes a value in the inclusive range 1 ... 6. We'll call the three cards S, M, L (smallest card, middle card, largest card). The values will be encoded like this (lexicographic order):

S M L   -> 1
S L M   -> 2
M S L   -> 3
M L S   -> 4
L S M   -> 5
L M S   -> 6

So, if the rank of the first card is 5, and the remaining three cards have ranks 4 Q 7 (they are ordered S L M), then the last card has rank 5+2=7. You may choose if the ace should be the highest or lowest card, as long as it's consistent.

If several cards share rank, then the suit will determine the order, where C < D < H < S.

Input format:

The four cards will be given as H3 (three of hearts), DK (King of diamonds) and so on. You may choose to take the input the other way around as 3H and KD instead.

The input can be on any convenient format, but you can't combine the list of suits in one variable and the list of ranks in another. 'D5', 'H3' .. and  [['D',5],['H',3] ... are both OK, but 'DHCH',[5,3,1,5] is not. You can't use numbers instead of letters, except for T.

Output

The hidden card, in the same format as the input.

Example

Let's do a walkthrough:

Input:
D3 S6 H3 H9

We know the hidden card is a diamond, since the first card is a diamond. We also know that the rank is 4,5,6,7,8 or 9 since the rank of the first card is 3.

The remaining cards are ordered 6,3,9 ==> M,S,L, which encodes the value 3. The hidden card is therefore 3+3=6 of diamonds, thus the output should be D6.

Test cases:

C3 H6 C6 S2
C9            # The order is LMS (H6 > C6, and 2 < 6). 3+6=9

SQ S4 S3 ST   # (ST = S10. Format is optional)
S2            # The order is MSL. 12+3=2

HA CA DA SA
H2            # The order is SML. 14+1=2

This is code-golf, so the shortest solution in each language wins. Explanations are encouraged!

1There are four suits (Clubs, Diamonds, Hearts and Spades).

2There are 13 ranks, 2,3,4,5,6,7,8,9,10,J,Q,K,A. You may choose to use T instead of 10.

JavaScript (ES6), 130 102 bytes
Takes input as an array of strings in "Rs" format, where R is the rank and s is the suit. Expects "T" for 10's. Aces are low.
a=>(s='A23456789TJQK')[([[R,[,S]],B,C,D]=a.map(c=>[s.search(c[0])+14,c]),R+=D<C|2*((D<B)+(C<B)))%13]+S

Try it online!
How?
We first convert each card into an array [rank, card] where rank is a numeric value in [14...26] and card is the original string.
[[R, [, S]], B, C, D] = a.map(c => ['A23456789TJQK'.search(c[0]) + 14, c])

The rank and suit of the first card are stored in R and S respectively. The three other cards are stored in B, C and D.
For instance, ['3c','6h','6c','2s'] becomes:
[ [ 16, '3c' ], [ 19, '6h' ], [ 19, '6c' ], [ 15, '2s' ] ]
    ^^    ^     <---------->  <---------->  <---------->
    R     S          B             C             D

We then compare each pair in [ B, C, D ]. These elements are implicitly coerced to strings when they are compared with each other:
[ 19, '6h' ] --> '19,6h'

Because both rank and card are guaranteed to consist of exactly two characters, it is safe to compare in lexicographical order.
We compute:
(D < C) | 2 * ((D < B) + (C < B))

Below are all the possible combinations:
 B, C, D | v0 = D < B  | v1 = C < B  | v2 = D < C  | v2|2*(v0+v1)
---------+-------------+-------------+-------------+--------------
 S, M, L |    false    |    false    |    false    |      0
 S, L, M |    false    |    false    |    true     |      1
 M, S, L |    false    |    true     |    false    |      2
 M, L, S |    true     |    false    |    true     |      3
 L, S, M |    true     |    true     |    false    |      4
 L, M, S |    true     |    true     |    true     |      5

Finally, we build the output card using R, S and the above result:
'A23456789TJQK'[(R += D < C | 2 * ((D < B) + (C < B))) % 13] + S


Goldenness of an integer A positive integer n can be represented as a rectangle with integer sides a, b such that n = a * b. That is, the area represents the number. In general, a and b are not unique for a given n.
As is well known, a rectangle is specially pleasing to the eye (or is it the brain?) when its sides are in the golden ratio, φ = (sqrt(5)+1)/2 ≈ 1.6180339887...
Combining these two facts, the purpose of this challenge is to decompose an integer n into the product of two integers a, b whose ratio is as close as possible to φ (with the usual metric on ℝ). The fact that φ is irrational implies that there is a unique solution pair (a, b).
The challenge
Given a positive integer n, output positive integers a, b such that  a * b = n and the absolute difference between a/b and φ is minimized.
As an example, consider n = 12. The pairs (a, b) that satisfy a * b = n are: (1, 12), (2,6), (3,4), (4,3), (6,2), (12,1). The pair whose ratio is closest to φ is (4,3), which gives 4/3 = 1.333.
Rules
Functions or programs are acceptable.
The numerator (a) should appear first in the output, and the denominator (b) second. Other than that, input and output formats are flexible as usual. For example, the two numbers can be output as strings with any reasonable separator, or as an array.
The code should work in theory for arbitrarily large numbers. In practice, it may be limited by memory or data-type restrictions.
It's sufficient to consider an approximate version of φ, as long as it is accurate up to the third decimal or better. That is, the absolute difference between the true φ and the approximate value should not exceed 0.0005. For example, 1.618 is acceptable.
When using an approximate, rational version of φ there's a small chance that the solution is not unique. In that case you can output any pair a, b that satisfies the minimization criterion.
Shortest code wins.
Test cases
1        ->  1    1
2        ->  2    1
4        ->  2    2
12       ->  4    3
42       ->  7    6
576      ->  32   18
1234     ->  2    617
10000    ->  125  80
199999   ->  1    199999
9699690  ->  3990 2431

Pyth - 24 23 bytes
There has to be a better way to find the divisors...
ho.a-.n3cFNfsIeTm,dcQdS

Test Suite.


Stack a random number of cups into a perfect two dimensional pyramid (triangle) You are given a certain number of cups (n). You are tasked with stacking these cups into a pyramid, with each row having one more cup than the row above it. The number you are given may or may not be able to be perfectly stacked. You must write a function that takes the total number of cups (n), and returns the following values. t, which is the total number of cups in the pyramid, and b, which is the number of cups on the bottom row. Your answer must be returned in the format of a string, as b,t.

n is a randomly generated, positive, finite, whole number.
b and t must also be positive, finite, and whole.
You may not use any libraries that aren't already built into your language of choice.
The pyramid is two dimensional, so instead of expanding out, it is linear, with each row adding only a single cup more than the last, instead of one with a square or triangular base.

In some potential cases:

If n=4, b=2 and t=3.
If n=13, b=4 and t=10.
If n=5000, b=99 and t=4950.

A verbose example in JavaScript:

var pyramid = function(n){
    var i;
    var t = 0;
    var b;
    for(i=0;i<=(n-t);i++){
        t += i;
        b = i;
    }
    console.log(b + ',' + t);
}

And a tiny example too:

p=function(n){for(t=i=0;i<=(n-t);i++){t+=i;b=i}return b+','+t}

Good luck!

Haskell, 64 68

This works out the base directly by inverting the triangular number formula, t = (b^2+b)/2, and calculating b = (sqrt(8*t+1) - 1) / 2.

f n=init.tail$show(b,div(b^2+b)2)where b=floor$(sqrt(8*n+1)-1)/2

And rather than constructing the string-based answer as show b++","++show t, it simply chops the brackets off the shown tuple.

Edit: calculating the new triangular number in place instead of declaring a new variable, t, saves 4 characters.


Highest score on the field Introduction
Let a field be a rectangle filled with only the characters - and [0-9]. An example of a field is:
11-011123
111-010--
0010---01
111-01234

You see that this field has been separated into three smaller areas:

To calculate the score of a smaller area, we just add all numbers up. For example:
11
111
0010
111

1 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 1 + 1 + 1 = 9

The total score for this area is 9. We now do the same thing for the second area:
   011123
    010

0 + 1 + 1 + 1 + 2 + 3 + 0 + 1 + 0 = 9

The total score is also 9. Now we have to examine the last area:
       01
    01234

0 + 1 + 0 + 1 + 2 + 3 + 4 = 11

This has a total score of 11. The highest score on the field is 11, so this is what we need to output.
The Task
Given a field (in the form of a 2D string, an array, etc.), output the highest score on the field. You may assume that the given fields will always contain at least 1 digit. This is code-golf, so the submission with the least amount of bytes wins!
Test cases
Test case 1:
Input:
1

Output:
1

Test case 2:
Input:
1-1-1-1
-1-1-1-
2-1-1-1
-1-1-1-

Output:
2

Test case 3:
Input:
12-45-
4-65-9
87-654
12-487
45----
684764

Output:
69

Test case 4:
Input:
111-12
------
21--10

Output:
3

JavaScript (ES6), 157 bytes

s=>[...o=s].map((n,i)=>o=n<'.'|(a=[...s]).map(_=>a.map((c,j)=>c>'-'&c<10&(a[j+1]|a[j-1]|a[j+l]|a[j-l])>90?a[n-=-c,j]=99:0),a[i]=99)|o>n?o:n,l=~s.search`
`)|o

Explanation

Takes an input field as a string. For each number in the field, sums all numbers in the area. It does this by iterating over each number in the field multiple times, adding the number to the score if an adjacent cell contains a previously counted number. Counted numbers that are part of the area are represented by setting them to 99 so that they are not counted again. Outputs the highest score as a number.

var solution =

s=>
  [...o=s].map((n,i)=>o=n<'.'|             // for each number on the field
                                           // n = area score
      (a=[...s])                           // a = array of each field character
      .map(_=>                             // loop to ensure whole area is found
        a.map((c,j)=>                      // for each cell c at index j
          c>'-'&c<10&                      // if the current cell is a number
          (a[j+1]|a[j-1]|a[j+l]|a[j-l])>90 // and an adjacent cells is in the area
          ?a[n-=-c,j]=99:0                 // add the cell to the area
        ),                                 // and the number to the score
        a[i]=99                            // mark the starting cell as counted
      )
      |o>n?o:n,                            // o = output (max of o and n)
    l=~s.search`
`                                          // l = line length of field
  )
  |o                                       // return o
<textarea id="input" rows="6" cols="40">12-45-
4-65-9
87-654
12-487
45----
684764</textarea>

<button onclick="result.textContent=solution(input.value)">Go</button>


Difference from liquid to solid items A shape's volume is the measure of how much three-dimensional space that shape occupies.
Challenge
Given six integers: [L,W,H] as length, width and height of one container and [l,w,h] as length, width and height of some random item.
You will need to calculate how many items would fit completely if the item was a liquid/fluid... and subtract how many items would also fit completely if the item was solid.
Note: Rotating the solid shape to fit empty space is required.
The input can be read from stdin, taken from args, can also be one or two lists/arrays, or any other valid way, but you can take in only six integers.
And the output should be one integer number: the difference.
Whole program or function are accepted.
Since this is code-golf shortest code in bytes wins!
Sample Input/Output
1) L=3  W=2  H=2  l=1  w=1  h=2
-> for item as liquid : 6 items fit completely
-> for item as solid  : 6 items fit completely
output: 0

2) L=1  W=8  H=3  l=3  w=4  h=2
-> for item as liquid : 1 item fit completely
-> for item as solid  : no items fit completely
output: 1

3) L=3  W=4  H=3  l=2  w=2  h=2
-> for item as liquid : 4 items fit completely
-> for item as solid  : 2 items fit completely
output: 2

4) L=6  W=6  H=6  l=1  w=5  h=6
-> for item as liquid : 7 items fit completely
-> for item as solid  : 7 items fit completely
output: 0

Draws
Just for illustration of how the solid items could fit:
Sample #3

Sample #4

Python 2.7 - 659 548 373 355 bytes
My first golf, but still very golfable.
The rotation thing didn't make it as easy as expected though.

import numpy as n
L,W,H,l,w,h=input();bx=n.zeros((L,W,H));s=0
q=(L*W*H)//(l*w*h);o=[[l,w,h],[l,h,w],[w,l,h],[w,h,l],[h,l,w],[h,w,l]];p=n.ndindex
for i in range(q):
 for a,b,c in p(L,W,H):
  for k in o:
   d=n.copy(bx)
   try:
    for x,y,z in p(k[0],k[1],k[2]):
     if d[a+x][b+y][c+z]:raise
     d[a+x][b+y][c+z]=1
    s+=1;bx=d
   except:pass
print q-s

But still a nice little brainteaser :D
**Edit: My colleague and I pondered a little more, and we found some more optimization potential
**Saved 18 byte thanks to CatsAreFluffy
Examples:
[6,6,6,1,5,6]
0

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


Primes numbers with prime index Write a program or function that outputs/returns the first 10000 prime-indexed prime numbers.

If we call the nth prime p(n), this list is

3, 5, 11, 17, 31, 41, 59 ... 1366661

because

p(p(1)) = p(2) = 3
p(p(2)) = p(3) = 5
p(p(3)) = p(5) = 11
p(p(4)) = p(7) = 17
...
p(p(10000)) = p(104729) = 1366661

Standard loopholes are forbidden, and standard output methods are allowed. You may answer with a full program, a named function, or an anonymous function.

MATLAB/Octave, 25 bytes
p=primes(2e6)
p(p(1:1e4))

It doesn't get much more straightforward than this.


Visualize nested array You will be given a nested array. Your program has to visualize the array.

But.. How?
For example, let's assume we have a nested array, like [["1","2"],[["1","2"],"3"],"4",[[[["5"]]]],"6"].
This nested array can be visualised as:
->1
->2
-->1
-->2
->3
>4
---->5
>6

Examples
Input 1:
["Atom",["Proton",["Up Quark", "Up Quark", "Down Quark"], "Neutron", ["Up Quark", "Down Quark", "Down Quark"], "Electron"]]
Output 1:
>Atom
->Proton
-->Up Quark
-->Up Quark
-->Down Quark
->Neutron
-->Up Quark
-->Down Quark
-->Down Quark
->Electron

Input 2:
[["1","2"],["3","4"]]
Output 2:
->1
->2
->3
->4

Rules

You may use string (or other types which work like a nested array) as input.
The maximum level of "layers" is 2^32-1.

APL, 32 bytes

{1=≡⍺:⎕←⍺,⍨⍵↑1↓⍵/'->'⋄⍺∇¨⍵+1}∘0

Test:

      r
┌────┬─────────────────────────────────────────────────────────────────────────────────────────┐
│Atom│┌──────┬──────────────────────────────┬───────┬────────────────────────────────┬────────┐│
│    ││Proton│┌────────┬────────┬──────────┐│Neutron│┌────────┬──────────┬──────────┐│Electron││
│    ││      ││Up Quark│Up Quark│Down Quark││       ││Up Quark│Down Quark│Down Quark││        ││
│    ││      │└────────┴────────┴──────────┘│       │└────────┴──────────┴──────────┘│        ││
│    │└──────┴──────────────────────────────┴───────┴────────────────────────────────┴────────┘│
└────┴─────────────────────────────────────────────────────────────────────────────────────────┘
      {1=≡⍺:⎕←⍺,⍨⍵↑1↓⍵/'->'⋄⍺∇¨⍵+1}∘0 ⊢ r
>Atom
->Proton
-->Up Quark
-->Up Quark
-->Down Quark
->Neutron
-->Up Quark
-->Down Quark
-->Down Quark
->Electron

Explanation:

{...}∘0: run the following function with 0 bound to ⍵:

1=≡⍺:: if the input has depth 1 (i.e. an array that does not contain other arrays):

⍵/'->': create a string containing ⍵ -s and ⍵ >s,
1↓: drop the first element,
⍵↑: and take the first ⍵ elements. This results in a string containing ⍵-1 dashes and one >.
⍺,⍨: append the input to it,
⎕←: and output that to the screen

⋄: otherwise,

⍺∇¨⍵+1: add 1 to ⍵ and apply the function to each nested array


Approximate the plastic number The challenge

The plastic number is a number related to the golden ratio, with many interesting mathematical properties. As such, there are many approaches that can be used to calculate the number.

In order to precisely specify the number for the purposes of this challenge, we'll use the following definition (although there are plenty of equivalent definitions, and you can use any definition you wish as long as it comes to the same number):

  The plastic number is a real number ρ such that ρ³=ρ+1.

Your challenge is to write a program or function which takes an integer x as input (with x > 1), and produces an approximation to ρ as output, such that the larger the value of x gets, the closer the output gets to ρ (with at most finitely many exceptions; staying at the same value counts as "closer" for this purpose), and for any positive number δ, there's some input x to your program that produces an output that's within δ of ρ.

Clarifications

If you're outputting via a method that inherently outputs strings (e.g. the standard output stream), you can format output either in decimal (e.g. 1.3247179572), or as a ratio of two integers with a / character between them.
If you're outputting as a value within your programming language (e.g. returning from a function), it must be of a fixed-point, floating-point, or rational type. (In particular, you can't use data types that store numbers symbolically, unless they're used only to hold the ratio of two integers. So if you're using Mathematica or a similar language, you'll need to include the extra code to actually generate the digits of the output.)
Your answer must work in a hypothetical variant of your language in which integers can be arbitrarily large, and memory (including stack) is unlimited. You may not assume that floating-point arithmetic in your language is arbitrarily accurate, but must instead use its actual accuracy (meaning that outputting a floating-point number is only going to be possible in languages where the accuracy of floating-point numbers can be controlled at runtime).
x can have any meaning you want (so long as increasing it gives more accurate outputs). I imagine that most submissions will have it control the number of digits of output to produce, or the number of iterations of the algorithm used by your program to converge on the plastic number, but other meanings are acceptable.

Testcase

Here are the first few digits of the plastic number:

1.32471795724474602596090885

More digits are available on OEIS.

Victory condition

As usual for code-golf, shorter is better, measured in bytes. However, feel free to post answers even if they don't win, so long as they add something (e.g. a different language, or a different algorithm) to the existing answers.

Python 2, 49 bytes

n=x=input()
while n**3/x/x<n+x:n+=1
print n,'/',x

Try it online!

The idea is to express the ρ with ρ³=ρ+1 as a fraction n/x whose denominator x is the input accuracy parameter. We take (n/x)³=n/x+1 and clear denominators to get n³=x²(x+n).

Since the LHS increases in n faster than the RHS, we can approximate the equality point n as the smallest with n³≥x²(x+n). The code counts up n until this is the case, starting at x which is smaller.

A small byte save is to divide both sides by x² to write n³/x²≥x+n (negated in the while condition). This is floor division in the code, but the fractional part lost is negligible.

A same-length alternative instead puts x as the numerator:

Python 2, 49 bytes

n=x=input()
while x**3/n/n<n+x:n-=1
print x,'/',n

Try it online!


Regular Expression to find a pangram Awhile back I encountered a simple programming puzzle to determine whether a string was a pangram, or a perfect pangram. (Although it's worth noting that this particular challenge gave a different meaning than the standard definition of a "perfect pangram," to mean any sentence where every letter appears n times for some positive n). And it was a fun challenge. But recently it got me wondering whether it would be possible to solve this challenge purely with regular expressions. If it is, I expect it will be a pretty gnarly regex. But I'm not even sure it is possible.
Still, if anyone is able to do it, it would be the folks here at Code Golf. So here's the challenge:
Write a regular expression which can determine whether or not a given string is a pangram. You can assume that all non-alpha characters have already been stripped out (or don't, if you really want to challenge yourself), and that everything has been transformed into lowercase.
Bonus challenge: write another regular expression to determine whether the given string is a "perfect pangram" by the definition given above.
Examples of an ordinary pangram:

thequickbrownfoxjumpsoverthelazydog

Example of perfect pangrams:

abcdefghijklmnopqrstuvwxyz
jocknymphswaqfdrugvexblitz
squdgykilpjobzarfnthcwmvexhmfjordwaltzcinqbuskpyxveg

I'm not really sure if this is even possible just with regex alone. If you find that it is, kudos!

Assuming you're using a flavor of regex that include look-aheads, detecting a pangram is straightforward, but tedious.  Using Python syntax:

r"(?=.*a)(?=.*b)(?=.*c)(?=.*d)(?=.*e)(?=.*f)(?=.*g)(?=.*h)(?=.*i)(?=.*j)(?=.*k)(?=.*l)(?=.*m)(?=.*n)(?=.*o)(?=.*p)(?=.*q)(?=.*r)(?=.*s)(?=.*t)(?=.*u)(?=.*v)(?=.*w)(?=.*x)(?=.*y)(?=.*z).*"

https://regex101.com/r/Z7NjEQ/2

The (?=.*a) block tests if what follows after that point matches .*a; another way to say that is, is this expression followed by any characters and then an a, or just, does this include an a?  Then repeat that check for every letter of the alphabet.

Without lookaheads, it's still possible, but even more tedious, because you have to account for every possible ordering of the alphabet.  If you were limited to the letters abc, here's what it might look like:

r".*(a.*b.*c|a.*c.*b|b.*a.*c|b.*c.*a|c.*a.*b|c.*b.*a).*"

https://regex101.com/r/OnXQe7/1/

This checks for an a, any set of characters, a b, any set of characters, then a c, OR an a, any set of characters, a c, any set of characters, then a b, OR...you get the idea.

You could use the same approach to check for the standard meaning of perfect pangram (every character exactly once), but not the modified version used here.


Thwart LZMA2 compression Goal

Create a program or pair of programs that collectively disrupt and fix files with the intent of preventing LZMA2 from working effectively.  The disrupt and fix routines must be reciprocal, so you can recover the original file exactly.

Targets

The collected works of Shakespeare in plain UTF-8 (5,589,891 bytes)
Wikimedia Commons 2013 Picture of the Year at full resolution (1,659,847 bytes)

Compression Methods

Ubuntu/related: xz -kz5 <infile>
Windows: 7z.exe a -txz -mx5 <outfile> <infile>
Other: Use a LZMA2 compressor with compression level 5 that compresses the works of Shakespeare to 1570550 bytes ± 100 bytes.

Scoring; sum of (everything is in bytes, ls -l or dir it):

Program(s) size (whatever it takes collectively to reversibly "break"/fix the file)
Difference in size (absolute) between:

Raw collected works of Shakespeare and your modified (uncompressed) copy.
Raw photo and your modified (uncompressed) copy.

Difference in size or 0, whichever is greater between:

Raw collected works of Shakespeare minus your modified, LZMA2 compressed copy.
Raw photo minus your modified, LZMA2 compressed copy.

Example

Poorly scoring, lazily-golfed, but compliant Python 2.x example:

import sys
x = 7919 if sys.argv[1] == 'b' else -7919
i = bytearray(open(sys.argv[2], 'rb').read())
for n in range(len(i)):
    i[n] = (i[n] + x*n) % 256
o = open(sys.argv[2]+'~', 'wb').write(i)

Running...

$ python break.py b pg100.txt
$ python break.py f pg100.txt~
$ diff -s pg100.txt pg100.txt~~
Files pg100.txt and pg100.txt~~ are identical
$ python break.py b Glühwendel_brennt_durch.jpg
$ python break.py f Glühwendel_brennt_durch.jpg~
$ diff -s Glühwendel_brennt_durch.jpg Glühwendel_brennt_durch.jpg~~
Files Glühwendel_brennt_durch.jpg and Glühwendel_brennt_durch.jpg~~ are identical
$ xz -kz5 pg100.txt~
$ xz -kz5 Glühwendel_brennt_durch.jpg~
$ ls -ln
-rw-rw-r-- 1 2092 2092     194 May 23 17:37 break.py
-rw-rw-r-- 1 2092 2092 1659874 May 23 16:20 Glühwendel_brennt_durch.jpg
-rw-rw-r-- 1 2092 2092 1659874 May 23 17:39 Glühwendel_brennt_durch.jpg~
-rw-rw-r-- 1 2092 2092 1659874 May 23 17:39 Glühwendel_brennt_durch.jpg~~
-rw-rw-r-- 1 2092 2092 1646556 May 23 17:39 Glühwendel_brennt_durch.jpg~.xz
-rw-rw-r-- 1 2092 2092 5589891 May 23 17:24 pg100.txt
-rw-rw-r-- 1 2092 2092 5589891 May 23 17:39 pg100.txt~
-rw-rw-r-- 1 2092 2092 5589891 May 23 17:39 pg100.txt~~
-rw-rw-r-- 1 2092 2092 3014136 May 23 17:39 pg100.txt~.xz

Score

= 194 + abs(5589891 − 5589891) + max(5589891 − 3014136, 0) + abs(1659874 − 1659874) + max(1659874 − 1646556, 0)
= 194 + 0 + 2575755 + 0 + 13318
2,589,267 bytes.  Bad, but doing nothing to the files yields a score of 4,635,153 bytes.

  Clarification

  This is golf, so you are trying to minimize your score.  I'm not sure if the comments are point out a legitimate hole in my scoring or if they are because I made it too complicated.  In any case, you want the SMALLEST:

  source code
  difference between the uncompressed modified file and original file (e.g. if you modify it by appending a trillion 0's on the end, your score just went up a trillion bytes)
  difference between the compressed modified file and original file (e.g. the more incompressible the files become, the higher your score).  A perfectly incompressible file that grows slightly or not at all will score 0.

Python, score = 120

import sys,hashlib
i=0
for c in sys.stdin.read():sys.stdout.write(chr(ord(c)^ord(hashlib.md5(str(i)).digest()[0])));i+=1

Makes a one-time pad using md5 in counter mode.  xors the file with it.  This has the advantage that the original and disrupted files are the same size, and that the disruptor and fixer are the same program.

The compressed disrupted files are larger than the originals.


Python Code Reviewer Task

Your mission is to create a program that reviews Python code. The solution can be written in any language!

It must take input that contains python code. The program must add # This is not pythonic! before each block of non-whitespace lines.

Input

The data can be entered via stdin.
The data will contain at least 3 lines with one blank one in between
them.

Minimum input example.

print "Hello World!"

Print "Bye World!"

Sample Input

from os.path import abspath

lines = []
with open(__file__, 'r') as f:
    for line in f:
        lines.append(line)

if lines is not None:

    newLines = []
    hasReviewedBlock = False

    for line in lines:
        if len(line) > 1: # \n
            if hasReviewedBlock == False:
                newLines.append("# This is not pythonic!\n")
                hasReviewedBlock = True
        else:
            hasReviewedBlock = False

        newLines.append(line)
    with open("d:/test.py", 'w') as f:
        for line in newLines:
            f.write(line);

Output

Output has to be written to STDOUT or closest alternative.

Sample Output

# This is not pythonic!
from os.path import abspath

# This is not pythonic!
lines = []
with open(__file__, 'r') as f:
    for line in f:
        lines.append(line)

# This is not pythonic!
if lines is not None:

# This is not pythonic!
    newLines = []
    hasReviewedBlock = False

# This is not pythonic!
    for line in lines:
        if len(line) > 1: # \n
            if hasReviewedBlock == False:
                newLines.append("# This is not pythonic!\n")
                hasReviewedBlock = True
        else:
            hasReviewedBlock = False

# This is not pythonic!
        newLines.append(line)
    with open("d:/test.py", 'w') as f:
        for line in newLines:
            f.write(line);

Scoring:

Lowest number of bytes wins. -5 bytes if your program can be used as valid input.

awk, 64 56 54 bytes
/^$/{i=0}/./{if(!i++)print"# This is not pythonic!"}1

Test:
echo '/^$/{i=0}/./{if(!i++)print"# This is not pythonic!"}1' > solution.awk
awk -f solution.awk < pyth.py
awk -f solution.awk < pyth.py

Explanation:
/^$/ - matches empty line,
/./ - matches non-empty line,
1 - matches each line. No body is equivalent to {print;} - each line of input is printed.


How high can you count in different languages? Based on How high can you count? let us give an advantage to the polyglot people.

Challenge:

Your task is to write as many programs / functions / snippets as you can, where each one outputs / prints / returns an integer. The first program must output the integer 1, the second one 2 and so on.

You can not reuse any characters between the programs. So, if the first program is simply: 1, then you may not use the character 1 again in any of the other programs. Note: It's allowed to use the same character many times in one program.

You can only use a programming language once. So every number must be in a different programming language.

Scoring:

The winner will be the submission that counts the highest. In case there's a tie, the winner will be the submission that used the fewest number of bytes in total.

Rules:

You can only use a language for one integer - after that you cannot reuse the language
Snippets are allowed!
To keep it fair, all characters must be encoded using a single byte in same encoding in the languages you choose.
The output must be in decimal. You may not output it with scientific notation or some other alternative format. Outputting floats is OK, as long as all digits that are shown behind the decimal point are 0. So, 4.000 is accepted. Inaccuracies due to FPA is accepted, as long as it's not shown in the output.
ans =, leading and trailing spaces and newlines etc. are allowed.
You may disregard STDERR, as long as the correct output is returned to STDOUT
You may choose to output the integer to STDERR, but only if STDOUT is empty.

Note: Explanations are encouraged!


The Will Rogers Phenomenon The so-called Will Rogers phenomenon describes a way to tweak statistics by raising the average in two (multi)sets when one element is moved between the two sets. As a simple example, consider the two sets

A = {1, 2, 3}
B = {4, 5, 6}

Their arithmetic means are  2 and 5, respectively. If we move the 4 to A:

A = {1, 2, 3, 4}
B = {5, 6}

Now the averages are 2.5 and 5.5, respectively, so both averages have been raised through a simple regrouping.

As another example, consider

A = {3, 4, 5, 6} --> A = {3, 5, 6}
B = {2, 3, 4, 5} --> B = {2, 3, 4, 4, 5}

On the other hand, it's not possible to raise both averages for the sets

A = {1, 5, 9}
B = {4, 5, 7, 8}

The Challenge

Given two lists of non-negative integers, determine whether it is possible to raise both averages by moving a single integer from one list to the other.

The average of an empty list is not defined, so if one of the lists contains only one element, this element cannot be moved.

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

Input may be taken in any convenient string or list format.

You must not assume that the elements in each list are unique, nor that they are sorted. You may assume that both lists contain at least one element.

Output should be truthy if both averages can be raised by moving a single integer and falsy otherwise.

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

Test Cases

Truthy:

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

Falsy:

[1], [2]
[2, 4], [5]
[1, 5], [2, 3, 4, 5]
[2, 1, 2, 3, 1, 3], [5, 1, 6]
[4, 4, 5, 2, 4, 0], [9, 2, 10, 1, 9, 0]

Leaderboards

Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.

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

# Language Name, N bytes

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

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

Pyth, 29 28 26 24 bytes
Thanks to @Jakube for saving me 3 bytes with .p and L.
Very simple, checks if any elements in list 2 are greater than mean of list 1 and less than mean of list 2, then repeats with list 1 and list 2 switched.
Lcsblbff&>YyhT<YyeTeT.pQ

Prints an a non-empty list for truthy, and [] for falsey.
L                    Define y(b). Pyth has no builtin for mean
 c                   Float div
  sb                 Sum of b
  lb                 Length of b
f        .pQ         Filter all permutations of input
 f     eT            Filter the last element of the filter var
  &                  Logical and
   >Y                Inner filter var greater than
    y                Call the mean function we defined earlier
     hT              First element of outer filter var
   <Y                Inner filter var less than
    y                Mean of
     eT              Last element of outer filternvar

Try it online here.
Test Suite.


Wait, which tetromino was that? Background
Tetris is a single-player game played on a rectangular grid with tetromino pieces.
When you fill one or more lines with tetrominoes, the filled lines are removed, and all blocks above them move down accordingly. In the following diagrams, . is an empty space, # is an existing block, and the tetromino marked with As is the one just placed:
One line cleared example

#...AA.. -> ........
####AA##    #...##..

---

Two lines cleared example
(note that the 3rd line moved down once, while the top line moved twice)

...A....    ........
###A####    ........
##.A.##. -> ...#....
###A####    ##.#.##.
####.###    ####.###

Challenge
Two board states will be given as input. One is right before a specific tetromino appears (the left-side state of the above diagrams, without As), and the other is right after the tetromino is placed and line clears are completed (the right-side state). Given this information, recover the type of the tetromino placed between the two states, which is one of the following seven types:
O   J      L   S    T    Z    I
##  #      #   ##   #   ##   ####
##  ###  ###  ##   ###   ##

You can assume the following:

The input is valid; the two boards have the same dimensions, and the game state can be changed from the first to the second by placing a single tetromino. Also, the placed tetromino is completely inside the grid before line clearing occurs (i.e. it won't be placed above the ceiling of the given grid, even partially).
The answer is unique.
The width of the board is at least 5.

For this challenge, ignore the rotation rules of actual Tetris games, and assume that any tetromino placement is valid, as long as the tetromino does not overlap with existing blocks or float in the air. This allows placing a tetromino inside a closed room (which actually happens in some exotic games).
You can take the input as a matrix (or equivalent) consisting of two distinct values for spaces and blocks. You can output the type of the tetromino as one of seven distinct values of your choice. Allowed output formats include numbers, strings, and possibly nested or multi-dimensional arrays of numbers and/or strings.
Standard code-golf rules apply. The shortest code in bytes wins.
Test cases
The notation is the same as the above example. Before and After are the two input grids, Answer is the expected output (given as alphabet code), and Explanation shows where the tetromino is placed.
Before:
......
......

After:
..##..
..##..

Answer: O
Explanation:
..AA..
..AA..

----------------

Before:
..####
...###
#.####

After:
......
......
..####

Answer: T
Explanation:
..####
AAA###
#A####

----------------

Before:
...###
...###
#.....

After:
......
..####
#.....

Answer: L (J doesn't work since the piece will be floating)
Explanation:
..A###
AAA###
#.....

----------------

Before:
##..##
##..##
##..##

After:
......
###.##
##.###

Answer: S
Explanation:
##A.##
##AA##
##.A##

----------------

Before:
##.##
##..#
##.##

After:
.....
.....
.....

Answer: T
Explanation: self-explanatory

----------------

Before:
.###.
#...#
.....
#...#
.###.

After:
.....
.###.
#...#
..#..
.###.

Answer: T
Explanation:
.###.
#...#
..A..
#AAA#
.###.

JavaScript (ES10),  286  282 bytes
Expects (a)(b), where \$a\$ and \$b\$ are 2 lists of binary strings. Returns an integer between \$0\$ and \$6\$ for JLTIOZS, or \$-1\$ if there's no solution (but we're not supposed to support that).
a=>b=>"0NF71ZMA13FM000F1F1F1IFL2R8I38LT357N368H".match(/../g).findIndex(p=>b.some((r,y)=>[...r].some((_,x)=>!b.some((s,i)=>[...a.map(B=r=>'0b'+r),~0].flatMap(t=(r,Y,a)=>~(q=((parseInt(p,36)||4369)>>(Y-y)*4&15)<<x,t|=q&a[Y+1],q|=q&r?~0:r)+2**s.length?q:(i--,[]))[i]^B(s)|!t))))%14>>1

Try it online!
How?
Shape encoding
Each shape is encoded with 2 digits in base 36, which allows to store:
$$\lfloor 2\times\log_2 36\rfloor=10\text{ bits}$$
The bits are arranged in a \$4\times 4\$ matrix, with the piece wedged in the upper right corner. The least significant bit is mapped to the top-right cell and there are 6 implicit leading zeros.
Examples:

The 1st entry is 0N in base 36, which is \$23\$ in decimal and \$0000010111\$ in binary. This is a J.

The 6th entry is FM in base 36, which is \$562\$ in decimal and \$1000110010\$ in binary. This is a T.

All shapes can be encoded that way, except the vertical I. This one is encoded as 00 and its actual value (\$4369\$ in decimal) is hard-coded separately.
Main algorithm
The main algorithm consists of 5 nested loops where we try to put each shape \$p\$ at each possible position \$(x,y)\$ in the grid \$a\$ and figure out which one leads to the grid \$b\$.
Whenever a row is completed, we yield an empty array so that .flatMap() deletes this row and we decrement the index \$i\$ of the entry that needs to be read in the resulting array to account for the row shift.
We may end up with a negative \$i\$. But because we use a XOR for the comparison, undefined rows behave like they were set to \$0\$, which is what we want.
"...".match(/../g)              // list of shapes
.findIndex(p =>                 // for each shape p:
  b.some((r, y) =>              //   for each y:
    [...r].some((_, x) =>       //     for each x:
      !b.some((s, i)=>          //       for each row s at position i in b:
        [ ...a.map(             //         using the helper function B, decode a[] by
            B = r => '0b' + r   //         converting each binary string to an integer
          ), ~0                 //         and append a full line at the bottom
        ].flatMap(t =           //         initialize t to a non-numeric value
        (r, Y, a) =>            //         for each row r at position Y in this array:
          ~(                    //
            q = (               //           q is the 4-bit mask of the shape
              ( parseInt(p, 36) //           decoded from the base-36 value p,
                || 4369 )       //
              >> (Y - y) * 4    //           keeping only the bits for this row
              & 15              //
            ) << x,             //           and left-shifting by x
            t |= q & a[Y + 1],  //           update the 'touching' mask
            q |= q & r ? ~0     //           invalidate the row if q overlaps r
                       : r      //           otherwise, merge q and r
          ) + 2 ** s.length ?   //           if the resulting line is not full:
            q                   //             yield q
          :                     //           else:
            (i--, [])           //             decrement i and yield an empty array,
                                //             which results in the deletion of this
                                //             line by flatMap()
        )[i]                    //         end of flatMap(); extract the i-th row
        ^ B(s)                  //         the test fails if this row is not equal to s
        | !t                    //         or the shape is floating in the air
      )                         //       end of some()
    )                           //     end of some()
  )                             //   end of some()
)                               // end of findIndex()

Final result
The shapes are stored in the following order:
0N F7 1Z MA 13 FM 00 0F 1F 1F 1I FL 2R 8I 38 LT 35 7N 36 8H
0  1  2  3  4  5  6  7  8  9  10 11 12 13 14 15 16 17 18 19
J  J  L  L  T  T  I  I  O  O  Z  Z  S  S  J  J  L  L  T  T
which is why the final result is the value returned by .findIndex() modulo \$14\$, divided by \$2\$ and rounded towards \$0\$.
(NB: The shape O is stored twice so that it doesn't break the pattern.)


Split pythagorean triples into two sets Task
Write a program/function that when given a positive integer \$n\$ splits the numbers from \$1\$ to \$n\$ into two sets, so that no integers \$a, b, c\$, satisfying \$a^2 + b^2 = c^2\$ are all in the same set. For example, if \$3\$ and \$4\$ are in the first set, then \$5\$ must be in the second set since \$3^2+4^2=5^2\$.
Acceptable Output Formats:

One of the sets
Both the sets
An array of length \$n\$ where the \$i\$-th element (counting from 1) is one of two different symbols (e.g. 0 and 1, a and b, etc.) which represent which set \$i\$ belongs to.The reverse of this is also fine

Constraints
You can expect \$n\$ to be less than \$7825\$. This is because \$7824\$ is proven to be the largest number to have solution (which also implies that all numbers less than 7825 have a solution).
Scoring
This is code-golf so shortest bytes wins.
Sample Testcases
3 -> {1}
3 -> {}
5 -> {1, 2, 3}
5 -> {1, 2, 3}, {4, 5}
5 -> [0, 0, 0, 1, 1]
5 -> [1, 1, 0, 0, 1]
10 -> {1, 3, 6}
10 -> {1, 2, 3, 4, 6, 9}
41 -> {5, 6, 9, 15, 16, 20, 24, 35}

A checker to verify your output can be found here

Inspired by The Problem with 7825 - Numberphile

J, 37 bytes
Brute forces through the possible sets, outputs the bit mask.
((-&.#.+./@,)[(e.~+/~)/.*:@#\)^:_@#&1

Try it online! (Also outputs list as numbers for easier comparison.)
How it works
((-&.#.+./@,)[(e.~+/~)/.*:@#\)^:_@#&1
                                  #&1 convert to list of N 1's
(                            )^:_     do until list does not change
                        *:@#\         right: convert to 1,4,9…,N^2
             [                        left: the bit mask
                      /.              partition left based on right, for each set:
                  +/~                 make M*M addition table
               e.~                    any element of that in the same set?
       +./@,                          OR all answers: 1 on conflict, 0 if finished
  -&.#.                               list: from base 2, subtract that^, to base 2


Accumulate some L.s.d Prior to the decimalisation of Sterling in February 1971, a pound (£ - from Roman libra) comprised 20 shillings (s - solidus), each of 12 pennies (d - denarius).  Additionally, until 1960, each penny could be divided into four farthings (some parts of the Commonwealth also had fractions of farthings, but we'll ignore those in this question).

Your task is to write a simple adding machine for financial quantities in the old system.  You will receive a set of strings, and emit/return a single string that represents the total of all the inputs.  The format of input and output strings is as follows (adapted from Wikipedia: £sd):

For quantities less than 1 shilling, the number of pence followed by the letter d:

¼d            -- smallest amount representable
1d
11¾d          -- largest value in this format

For quantities less than £1, / is used to separate shillings and pence, with - as a placeholder if there are no pence:

1/-           -- smallest amount in this format
1/6
19/11¾        -- largest value in this format

For quantities of £1 or greater, we separate the parts with ., and include the units:

£1
£1.-.¼d       -- one pound and one farthing
£1.1s.-       -- one pound and one shilling
£999.19s.11¾d -- largest value needed in this challenge

The inputs will never sum to £1000 or more (i.e. you can assume the pounds will fit into 3 digits).

Input will be as strings by any of the usual input methods (as an array of strings, as a single string with newlines or other separators, as individual arguments, etc).  There will be no additional characters (not mentioned above) in each string.

Output will be as a single string, by any of the usual output methods (standard output stream, function return value, global variable, etc.).  You may include additional spaces around the numbers if that helps.

Examples

(assuming my mental arithmetic is up to scratch!)

Input: ¼d, ¼d
Output: ½d
Input: 11¾d, ¼d
Output: 1/-
Input: £1, 6d, 9d
Output: £1.1s.3d
Input: £71.11s.4¼d, 12/6, 8/-, 8/-, 2½d
Output: £73.-.¾d

If (and only if) your language/platform cannot represent the farthings (yes, I'm looking at you, ZX81!), you may use the letters n, w and r instead, to mean ¼ (one), ½ (two) and ¾ (three) respectively.

This is code-golf, so the shortest working program (in bytes) is the winner.  Please indicate the source character-coding if it's not UTF-8 (and not determined by the language).

Standard loopholes which are no longer funny are not permitted.


Spiral neighbourhoods If we take the natural numbers and roll them up counter clock-wise into a spiral we end up with the following infinite spiral:

                  ....--57--56
                             |
36--35--34--33--32--31--30  55
 |                       |   |
37  16--15--14--13--12  29  54
 |   |               |   |   |
38  17   4---3---2  11  28  53
 |   |   |       |   |   |   |
39  18   5   0---1  10  27  52
 |   |   |           |   |   |
40  19   6---7---8---9  26  51
 |   |                   |   |
41  20--21--22--23--24--25  50
 |                           |
42--43--44--45--46--47--48--49

Given some number in that spiral your task is to determine its neighbours - meaning the element above, left, right and below it.

Example

If we have a look at 27 we can see that it has the following neighbours:

above: 28
left: 10
right: 52
below: 26

So the output would be: [28,10,52,26]

Rules

Input will be a number \$n \geq 0\$ in any default I/O format
Output will be a list/matrix/.. of that numbers' 4 neighbours in any (consistent!) order
You may work with a spiral that starts with 1 instead of 0, however you should specify that in your answer

Examples

The output is in the format [above,left,right,below] and uses a 0-based spiral:

0  ->  [3,5,1,7]
1  ->  [2,0,10,8]
2  ->  [13,3,11,1]
3  ->  [14,4,2,0]
6  ->  [5,19,7,21]
16  ->  [35,37,15,17]
25  ->  [26,24,50,48]
27  ->  [28,10,52,26]
73  ->  [42,72,74,112]
101  ->  [100,146,64,102]
2000  ->  [1825,1999,2001,2183]
1000000  ->  [1004003,1004005,999999,1000001]

R, 156 bytes

function(n){g=function(h)c(0,cumsum(h((4*(0:(n+2)^2)+1)^.5%%4%/%1/2)))
x=g(sinpi)
y=g(cospi)
a=x[n]
b=y[n]
which(x==a&(y==b+1|y==b-1)|y==b&(x==a+1|x==a-1))}

Try it online!

posted another R answer since it's a slightly different approach than @ngn
1-indexed
neighbours are always sorted by ascending value
saved 6 bytes removing round and using cospi(x)/sinpi(x) which are more precise than cos(x*pi)/sin(x*pi) in case of half numbers (0.5, 1.5 etc...)
saved another byte removing the minus on y coordinates since the result is the same (just up/down neighbours are reversed)

Explanation :

If we look at the matrix coordinates of the values, considering the first value 0 placed at x=0, y=0, they are :

x = [0,  1,  1,  0, -1, -1, -1,  0,  1,  2,  2,  2,  2,  1,  0, ...]
y = [0,  0,  1,  1,  1,  0, -1, -1, -1, -1,  0,  1,  2,  2,  2, ...]

The x coordinates follow the A174344 OEIS sequence with the recursive formula :

a(1) = 0, a(n) = a(n-1) + sin(mod(floor(sqrt(4*(n-2)+1)),4)*pi/2)

The same formula holds for y matrix coordinates, but with cos instead of sin and negated :

a(1) = 0, a(n) = a(n-1) - cos(mod(floor(sqrt(4*(n-2)+1)),4)*pi/2)

So, in R we can translate the formula to this function, taking sinpi/cospi as parameter :

g=function(h)c(0,cumsum(h((4*(0:(n+2)^2)+1)^.5%%4%/%1/2)))

and we generate the two coordinates vectors (we don't negate the y coords since we'll get the same result, just with up/down neighbours reversed) :

x=g(sinpi)
y=g(cospi)

Note that we have generated (n+2)^2 coordinates, which are more than the minimum necessary coordinates containing both n and their neighbours (a tighter bound would be (floor(sqrt(n))+2)^2 but unfortunately is less "golfy").

Therefore, now that we have all the coordinates, we first search the coordinates a,b corresponding to our n :

a=x[n]
b=y[n]

finally we select the positions of their neighbours, i.e. :

the up/down neighbours where x == a and y == b+1 or b-1
the right/left neighbours where y == b and x == a+1 or a-1

using :

which(x==a&(y==b+1|y==b-1)|y==b&(x==a+1|x==a-1))


Does the fishy road have an end? I love ><>, ><> is life! 2D langages are amazing!
In this challenge, you will have to say if a "fishy" road has an end,
while code-golfing.

Definition

A fishy road is constructed with tiles, including the following ones:

v (go down)
> (go right)
^ (go up)
< (go left)
/ (mirror)
\ (mirror)

Any other character (except -|+) may be considered as a distraction, like some flowers (or fish heads) on the border of the road.

A road always start on the upper-left corner of a rectangular grid, delimited by -|+symbols. The road has an end if, by following it, you end up on a border, else, you'll be trapped in an infinite path.

Finding your way on the road is accomplished by following directions given by v>^<and mirrors. A mirror will reflect by 90° depending on where you came from. Here's how it works (using v>^<to show directions):

 ^    ^
>/<  >\<
 v    v
</>  <\>
 ^    ^

A road might be looking like this if it ends:

+--------------------+
|>\/  this way >\/>  | this one ends here
| v^            \/   |
| v^   ^.^           |
| \/\         >v     |
| /\/         ^<     |
+--------------------+

An infinite loop :

+--------+
|>>\ This|
|\\   is |
|  \\ a  |
| \ /trap|
+--------+

Specifics

A road doesn't necessarily consist only of instructions. Spaces or letters can be used to complete it. This means you have to continue moving in the same direction except if you cross a character in <v^>-|.

There will always be one of v>^< in the upper-left corner, < or ^ implies this road ends.

You may submit a function taking a string as parameter, or a standalone program using STDIN/whatever is the closest alternative in your language.

Your submission must return or print on STDOUT truthy/falsy values when it's done. Truthy values meaning the road has an end, while falsy means it is an infinite loop.

Test cases

+--------------------+
|>\/  this way >\/>  | this one ends here
| v^            \/   |
| v^   ^.^           |
| \/\         >v     |
| /\/ ><>     ^<     |
+--------------------+
    True

+--------+
|>>\ This|
|\\   is |
|  \\ a  |
| \ /trap|
+--------+
    False

+--+
|<v|
|^<|
+--+
    True

+--+
|>v|
|^<|
+--+
    False

+----------+
|v Hello \ |
|\\/\/   / |
| \/\\   \ |
|/  // >\  |
|  ^/\>\\/ |
|\  /\/\/  |
+----------+
    False

+-----+
|>\/\\|
|//\\/|
|\/\\\|
|//\//|
|\/\/ |
+-----+
    True

2 test cases added as suggested by @MartinBüttner
+----+
|v   |
|\\  |
|//\ |
|\\v |
| \/ |
+----+
    False

+----+
|v   |
|\\  |
|//\ |
|\\^ |
| \/ |
+----+
    False

Test case inspired by @ETHproductions
+-------------------------+
|><>                      |
|something smells fishy...|
+-------------------------+
    False

Standard loopholes are forbidden (as always).

The winner will be the one with the shortest code in bytes.
(it would be amazing to see a ><> answer :))

Non-compliant ><> answer

You wanted ><>, I give you ><> !

I believe the only sane way to do this in ><> is by copying the input in the codespace and letting the interpreter decide by itself if the input leads somewhere. Since ><> doesn't implement threading anymore, that leaves us with a big problem : if the input has a loop, we'll get stuck into it.

These considerations taken into account, I decided to make a solution compatible with ><> online interpreter so that it would be possible to assert if the interpreter is stuck in the input or just taking ages to do everything. I also had to add trailing lines to the code so the online interpreter shows the added code and doesn't crash when trying to write to it.

Oh and since I'm clearly disqualified by now, I didn't bother with golfing the code.

Without further ado, the code in all its glory :

50i:0(?v   :"^"=?v:"v"=?v:">"=?v:"<"=?v:"/"=?v:"\"=?v:"|"=?v:"-"=?va=?v1+10.
>.!603f<         v"."~                                     <      <   >~1+010.
>.!01+1p}:$}:}v! <      <      <      <      <      <
  ;oooo"true" <<
              ^

To use it, copy it in the online interpreter, add enough trailing lines to handle your input, submit the code, give it the input as ;-separated lines and enjoy the ride.

A few tests :

  With

+--------------------+
|>\/  this way >\/>  | this one ends here
| v^            \/   |
| v^   ^.^           |
| \/\         >v     |
| /\/         ^<     |
+--------------------+`

  Final codespace :

50i:0(?v   :"^"=?v:"v"=?v:">"=?v:"<"=?v:"/"=?v:"\"=?v:"|"=?v:"-"=?va=?v1+10.
>.!603f<         v"."~                                     <      <   >~1+010.
>.!01+1p}:$}:}v! <      <      <      <      <      <
  ;oooo"true" <<
            ^
 ....................
.>\/           >\/>  .
. v^            \/   .
. v^   ^ ^           .
. \/\         >v     .
. /\/         ^<     .
 ....................

  Outputs "true" and stops.

  With

+--------+
|>>\ This|
|\\   is |
|  \\ a  |
| \ /trap|
+--------+

  Final codespace :

50i:0(?v   :"^"=?v:"v"=?v:">"=?v:"<"=?v:"/"=?v:"\"=?v:"|"=?v:"-"=?va=?v1+10.
>.!603f<         v"."~                                     <      <   >~1+010.
>.!01+1p}:$}:}v! <      <      <      <      <      <
  ;oooo"true" <<
            ^
 ........
.>>\     .
.\\      .
.  \\    .
. \ /    .
 ........

  Loops forever.


Is this a valid game of Five Up (Dominoes)? A set of dominoes consists of tiles with two numbers on them such that every combination of integers from 0 to N are represented. Examples below refer to N=6 out of convenience, but N=9 and N=12 are also common. The orientation of the tiles does not matter (they are usually printed with dots rather than digits), so [1-6] and [6-1] refer to the same tile, of which there is only one in a set.

Most games played with dominoes involve players taking turns adding dominoes to a line of those already played onto the table, such that one of the numbers on the new domino is placed adjacent to the same number at one end of the line on the table. Thus, you might add a [2-5] to either end of an existing line of [2-3][3-3][3-5], producing [5-2][2-3][3-3][3-5] or [2-3][3-3][3-5][5-2].

Many such games require "doubles", dominoes with two of the same number on them, to be placed perpendicular to the other dominoes connected to them. Aside from scoring which we are unconcerned with here, this has no effect except when...

Many of those games then allow the "line" to fork at some or all doubles. Five Up is such a game where the line can fork into 3 new lines at each double, so all four sides of a double might have a matching domino attached.

Here is an example layout of dominoes from a "double 6" set in a game of Five Up (where A|B or A-B is a single domino):

     4
     -
     0

3|0 0|0 0|2

     0
     -
     1

4|1 1|1 1|6
                3
     1          -
     -          6
     5
                6
6|5 5|5 5|0 0|6 - 6|2 2|1
                6
     5
     -          6
     4          -
                4

Your task is to take an list of dominoes in the order in which they were added to the table, and determine whether or not this order represents a legal game of Five Up.

You can write a whole program that takes input from stdin, or a function that takes input as one or more parameters.

Canonical input would be a list or array of two-tuples of integers. A list of lists, array of arrays, vector of tuples, etc are all valid forms in which to take input, as would be a string representing any of the above, or multiple strings. The input will only contain pairs of non-negative integers, valid dominoes.

Output should be a truthy or falsey value, for valid and invalid games respectively.

Your code should accept arbitrarily large domino numbers, within the capabilities of the maximum integer values of your language.

Examples:

0-6 is valid, as is any other single domino
0-6 6-0 is not valid, there is only one 0-6 domino in a set
6-6 6-5 5-3 3-0 is valid, a simple linear arrangement
6-6 6-5 3-0 5-3 is not valid, there is no 3 or 0 in play for the third domino to connect to prior to the 5-3 being played
1-1 1-2 1-3 1-4 1-5 1-6 is not valid, all four open 1 ends are used up leaving nowhere to connect the 1-6
1-1 1-2 1-3 1-4 1-5 3-6 1-6 is valid, the 3-6 connects to the 1-3, then the 1-6 can connect to the 3-6
5-5 5-4 5-0 0-6 6-6 6-4 6-2 2-1 6-3 5-1 1-1 1-6 4-1 1-0 0-0 2-0 3-0 0-4 is valid, the above illustrated example
12-12 12-1 3-12 3-1 1-2 3-3 is valid, uses larger dominoes, and has an ambiguous placement

NOTE: The function required here is not a perfect check for valid Five Up games. We are ignoring here the rules about which domino gets played first, which would require more information about the variant of the game and number of players, and would disqualify a significant minority of inputs.

Haskell, 188 174 168 bytes

f(p:r)=[p]!r$p?p
(s!(p:r))o|b<-[p,reverse p]=or[(q:s)!r$q%o|q<-b,elem(q!!0)o,all(`notElem`s)b]
(s!_)o=1<3
p@[x,y]?r=[c|x==y,c<-p]++r
p@[x,y]%(a:r)|a/=x=a:p%r|z<-y:r=p?z

Try it online! Usage example: f [[6,6],[6,5],[5,3],[3,0]] yields True.
Ungolfed:

f :: [[Int]] -> Bool
f (p:r) = check [p] (double p p) r

check :: [[Int]] -> [Int] -> [[Int]] -> Bool
check seen open [] = True
check seen open ([x,y]:r) =
	  notElem [x,y] seen
   && notElem [y,x] seen
   && (elem x open && check ([x,y]:seen) (update [x,y] open) r
   ||  elem y open && check ([y,x]:seen) (update [y,x] open) r)

double :: [Int] -> [Int] -> [Int]
double [x,y] rest =
    if x==y
    then [x,y] ++ rest
    else rest

update :: [Int] -> [Int] -> [Int]
update [x,y] (a:rest) =
    if x==a
    then double [x,y] (y:rest)
    else a : update [x,y] rest

Try it online!


Multiply or Divide by n Here's a simple challenge, so hopefully lots of languages will be able to participate.
Given a positive integer \$n\$, output \$A076039(n)\$ from the OEIS.
That is, start with \$a(1)=1\$. Then for \$n>1\$:
$$a(n)=\left\{ \begin{array}{ll} n\cdot a(n-1), & \text{if } n>a(n-1)  \\ \lfloor a(n-1)/n \rfloor, & \text{otherwise.}\end{array} \\ \right. $$
Test cases:
1 -> 1
2 -> 2 (2 > 1, so multiply)
3 -> 6 (3 > 2, so multiply)
4 -> 1 (4 < 6, so divide and take the integer part)
5 -> 5
6 -> 30
17 -> 221
99 -> 12
314 -> 26

More test cases can be found on the OEIS page.
Per usual sequence rules, you can input and output in a generally accepted manner: 1- or 0-based indexing, output an infinite sequence, output the first \$n\$ values, output only the \$n^\text{th}\$ value, and so forth, but specify that in your answer.
This is code-golf, so shortest code in bytes in each language wins!

Jelly, 6 bytes
R×:<?/

A monadic Link accepting a positive integer, \$n\$, which yields a positive integer, \$a(n)\$.
Try it online! Or see the test-suite.
How?
R×:<?/ - Link:
R      - range -> [1..n]
     / - reduce by (i.e. evaluate f(f(...f(f(f(1,2),3),4),...),n) with this f(a,b):
    ?  -   if...
   <   -   ...condition: (a) less than (b)?
 ×     -   ...then: multiply -> a×b
  :    -   ...else: integer divide -> a//b

Output the sequence up to \$a(n)\$ with:
R×:<?\


Create chunks from an array Your task is to write a program which given an array and a number, you need to split the array into chunks with size is number.
Rules
Your program will receive an array A , as well as  a positive integer n. The array should then be split into chunks of length n, if the length of the string isn't divisible by n any leftover at the end should be considered its own chunk.

If n is greater than length of array A, you will need to return array A, for example: if n = 4 and array A = [1,2,3], you should return [1,2,3]

The array can contain any type rather than number.

You should not change order (or direction) of any item from left to right. For example if n = 2 and A= [1,2,3]. Any result rather than [[1,2],[3]] will be invalid.

Test Cases
n   A               Output

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

This is code-golf, so you the shortest bytes of each language will be the winner.

05AB1E, 1 byte
ô

Try it online or verify all test cases.
Builtins ftw. :)


Reconstruct an arithmetic sequence Given a finite arithmetic sequence of positive integers with some terms removed from the middle, reconstruct the whole sequence.

The task

Consider an arithmetic sequence: a list of positive integers in which the difference between any two successive elements is the same.

2 5 8 11 14 17

Now suppose one or more integers is removed from the sequence, subject to the following constraints:

The integers removed will be consecutive terms of the sequence.
The first and last integers in the sequence will not be removed.
At least three integers will remain in the sequence.

For the above sequence, possible removals include:

2 5 8 14 17  (removed 11)
2 5 17       (removed 8 11 14)
2 14 17      (removed 5 8 11)

Your task: Given one of these partial sequences, reconstruct the original full sequence.

Details

You may assume input is valid (has a solution) and is missing at least one term. All numbers in the sequence will be positive (> 0) integers. The sequence may have a positive or negative difference between terms (i.e. it may be increasing or decreasing). It will not be a constant sequence (e.g. 5 5 5).

Your solution may be a full program or a function. Any of the default input and output methods are acceptable.

Your input and output may be a string (with any reasonable delimiter), a list of strings, or a list of numbers. You may represent the numbers in whatever base is convenient for your language.

Please mention any unusual I/O methods/formats in your submission, so others will be able to test your code more easily.

Test cases

In: 2 5 8 14 17
Out: 2 5 8 11 14 17
In: 2 5 17
Out: 2 5 8 11 14 17
In: 2 14 17
Out: 2 5 8 11 14 17
In: 21 9 6 3
Out: 21 18 15 12 9 6 3
In: 10 9 5
Out: 10 9 8 7 6 5
In: 1 10 91 100
Out: 1 10 19 28 37 46 55 64 73 82 91 100

This is code-golf; the shortest answer in each language wins.

Haskell, 63 bytes

f(a:b:c)|s<-[a,b..last c],all(`elem`s)c=s
f a=r$f$r a
r=reverse

Try it online!

Basically works by trying to build the result from the front and, if that fails, from the back. This uses the fact that the first and last members of the input will always be correct, the fact that deleted members have to be consecutive, and the fact that there will always be at least three items in the input. All I have to do is assume that the second or second-to-last members are accurate and check if it works. Luckily Haskell has really beautiful syntax for creating arithmetic series.

EDIT: thanks to @xnor for pointing out a bug and providing a solution!


Square-free semiprime counting Definition

A square-free semiprime is a natural number that is the product of two distinct prime numbers.

The task
Given a natural number n, count all square-free semiprimes less than or equal to n.
Details
Please write a function or procedure that accepts a single integer parameter and counts all square-free semiprimes less than or equal to its parameter. The count must either be a return value of a function call or be printed to STDOUT.
Scoring
The answer with the fewest number of characters wins.
In the event of a tie, the following criteria will be used in order:

Tallest person

Best time-complexity

Worst space-complexity

Examples
f(1)     = 0
f(62)    = 18
f(420)   = 124
f(10000) = 2600

J, 50 40 38 37 characters

f=:3 :'+/y<:}.~.,(~:/**/)~p:i._1&p:y'

Usage:

   f 1
0
   f 62
18
   f 420
124
   f 10000
2600

With thanks to FUZxxl.

Performance test

   showtotal_jpm_ ''[f 1[start_jpm_ ''
 Time (seconds)
┌───────┬──────┬────────┬────────┬─────┬────┬───┐
│name   │locale│all     │here    │here%│cum%│rep│
├───────┼──────┼────────┼────────┼─────┼────┼───┤
│f      │base  │0.000046│0.000046│100.0│100 │1  │
│[total]│      │        │0.000046│100.0│100 │   │
└───────┴──────┴────────┴────────┴─────┴────┴───┘
   showtotal_jpm_ ''[f 1[f 62[start_jpm_ ''
 Time (seconds)
┌───────┬──────┬────────┬────────┬─────┬────┬───┐
│name   │locale│all     │here    │here%│cum%│rep│
├───────┼──────┼────────┼────────┼─────┼────┼───┤
│f      │base  │0.000095│0.000095│100.0│100 │2  │
│[total]│      │        │0.000095│100.0│100 │   │
└───────┴──────┴────────┴────────┴─────┴────┴───┘
   showtotal_jpm_ ''[f 1[f 62[f 420[start_jpm_ ''
 Time (seconds)
┌───────┬──────┬────────┬────────┬─────┬────┬───┐
│name   │locale│all     │here    │here%│cum%│rep│
├───────┼──────┼────────┼────────┼─────┼────┼───┤
│f      │base  │0.000383│0.000383│100.0│100 │3  │
│[total]│      │        │0.000383│100.0│100 │   │
└───────┴──────┴────────┴────────┴─────┴────┴───┘
   showtotal_jpm_ ''[f 1[f 62[f 420[f 10000[start_jpm_ ''
 Time (seconds)
┌───────┬──────┬────────┬────────┬─────┬────┬───┐
│name   │locale│all     │here    │here%│cum%│rep│
├───────┼──────┼────────┼────────┼─────┼────┼───┤
│f      │base  │0.084847│0.084847│100.0│100 │4  │
│[total]│      │        │0.084847│100.0│100 │   │
└───────┴──────┴────────┴────────┴─────┴────┴───┘
   showtotal_jpm_ ''[f 1[f 62[f 420[f 10000[f 50000[start_jpm_ ''
 Time (seconds)
┌───────┬──────┬────────┬────────┬─────┬────┬───┐
│name   │locale│all     │here    │here%│cum%│rep│
├───────┼──────┼────────┼────────┼─────┼────┼───┤
│f      │base  │5.014691│5.014691│100.0│100 │5  │
│[total]│      │        │5.014691│100.0│100 │   │
└───────┴──────┴────────┴────────┴─────┴────┴───┘

I'm no theoretician as has been seen here in the past, but I think the time complexity is something like O(np2) where np is the number of primes up to and including the input number n. This is based on the assumption that the complexity of my method (generating a very large multiplication table) far outweighs the complexity of the prime generating function built in to J.

Explanation

f=:3 :'...' declares a (monadic) verb (function). The input to the verb is represented by y within the verb definition.

p:i._1&p:y The p: verb is the multi purpose primes verb, and it's used in two different ways here: _1&p:y returns the number of primes less than y then p:i. generates every one of them. Using 10 as input:

   p:i._1&p:10
2 3 5 7

(~:/**/)~ generates the table I spoke of earlier. */ generates a multiplication table, ~:/ generates a not-equal table (to eliminate the squares) and both of these are multiplied together. Using our previous output as input:

   */~2 3 5 7
 4  6 10 14
 6  9 15 21
10 15 25 35
14 21 35 49

   ~:/~2 3 5 7
0 1 1 1
1 0 1 1
1 1 0 1
1 1 1 0

   (~:/**/)~2 3 5 7
 0  6 10 14
 6  0 15 21
10 15  0 35
14 21 35  0

}.~., now we turn the numbers into one list , get the unique values ~. and remove the 0 at the start }.

   }.~.,(~:/**/)~2 3 5 7
6 10 14 15 21 35

y<: a comparison with the original input to check which values are valid:

   10<:6 10 14 15 21 35
1 1 0 0 0 0

+/ and then sum that to get the answer.

   +/1 1 0 0 0 0
2


Print valid arithmetic expressions Recursively define a "valid arithmetic expression":

Any natural number is a valid arithmetic expression.
If s is a valid arithmetic expression, then so is (-s).
If p and q are valid arithmetic expressions, then so is (p+q).

In the above, a "natural number" is recursively defined as follows:

0 1 2 3 4 5 6 7 8 9 are natural numbers.
If a natural number n is not 0, then n0 n1 n2 n3 n4 n5 n6 n7 n8 n9 are natural numbers.

Alternatively, via the regex /^(0|[1-9][0-9]*)$/

Examples of valid arithmetic expressions:

0
314
(-7)
(0+0)
(314+(-314))

Examples of invalid arithmetic expressions:

01
-5
5+10

The challenge is to print every valid arithmetic expression line by line, i.e. create a program that will output strings line by line with the constraint that every valid arithmetic expression is eventually printed, and that no invalid arithmetic expression is ever printed.

The valid arithmetic expressions can be printed more than once.

The challenge is to do so in as few bytes as possible, since this is code-golf.

Standard loopholes apply.

Jelly, ... 33 bytes

⁾()j
p`j”+Ç$€;;”-;ÇƊ€;®‘©¤Ṅ€
WÇ1¿

Try it online!

Wow, writing a correct submission is hard.

Python pseudocode equivalent:

import itertools

# Jelly: ⁾()j
def wrap_in_parentheses(x):
 return str(x).join(['(',')'])
 # or equivalently, `return '('+str(x)+')'

# Jelly: p`j”+Ç$€;;”-;ÇƊ€;®‘©¤Ṅ€
register = 0
def expand_and_print(expressions):
 # Jelly: p`
 result = list(itertools.product(expressions, repeat=2))

 # Jelly: j”+Ç$€
 result = [wrap_in_parentheses('+'.join(expr)) for expr in result]

 # Jelly: ;
 result.extend(expressions)

 # Jelly: ;”-;ÇƊ€
 result.extend([wrap_in_parentheses('-'+expr) for expr in expression])

 # Jelly: ;®‘©¤
 global register
 register += 1
 result.append(register)

 # Jelly: Ṅ€
 for expr in result:
  print(expr)

 return result

# Jelly: WÇ1¿
expressions = ['0']
while 1:
 expressions = expand_and_print(expressions)


The coin catastrophe In Golfenhagen, The people are allowed, and encouraged, to melt down old coins for scrap metal, if the smelter can make a profit off of it. There are 5 coins that make the Golfenhagen mint. The half-penny(0.5)(H), the penny(1)(P), the tea (5)(T), the flag (10)(F), and the driver (25)(D). Golfenhagen also mints bills, in the form of 100(O), 500(E), 1000(N), and 2500(Y). Recently, the price of metals has plumetted to an all time low, and so everybody is trying to give their coins away, as they are worth less than the bills.

A humble software engineer decides to write a program that will guarantee that those who pay with cash will always get at least 9 coins back on any purchase whose net difference is bigger than 3 cents.

Your challenge:

Take on the role of developer, and write a program that takes one input (the net difference of the money handed out and the purchase total) and outputs the correct change.

You must:

Make your program put out a nominal of 9 coins with any decimal, except where the difference is less than 5 cents (5).
Make your program output a diverse set of coins, all coins MUST be able to be outputted by your program. no giving change in exclusively in halfcents.
Use the dollar bills where applicable.
This is a golf, the shortest code wins

Examples:

  301
  OODDDTTTTTP

This is a valid output. There are two dollars ("OO"), and 9 coins ("DDDTTTTTP ").

  5693
  2Y1E1O2D3F2T3P

This is also valid output, as it specifies the currency type and quantities, and has 10 coins.

  412
  OOOODPP

This is not valid output, as it only uses 3 coins.

  20
  10P20H

This is not valid, see the second rule

Code example of a change counter for the least change possible. (as requested per cold golf)

package lookup;

public class Main {

    static void main(String[]s) {

        int changeincents = 53;
        int quartercount  =  0;
        int dimecount     =  0;
        int nickelcount   =  0;
        int pennycount    =  0;
        while(changeincents >= 25){//value of a quarter
            quartercount++;
            changeincents-=25;
        }
        while(changeincents >= 10){
            dimecount++;
            changeincents-=10;
        }
        while(changeincents >= 5){
            nickelcount++;
            changeincents-=5;
        }
        while(changeincents >= 1){
            pennycount++;
            changeincents--;
        }
    }
}

Good luck!


Find a recursive acronym Introduction
A recursive acronym is an acronym that contains or refers to itself, for example:
Fish could be a recursive acronym for Fish is shiny hero, notice how that also contains the acronym itself. Another example is Hi -> Hi igloo. Or even ppcg paints -> ppcg paints cool galaxies pouring acid into night time stars
So basically, a sentence is a recursive acronym if the first letters of each of the words spell out the first word or words.

Challenge
Make a program that takes a string of 1 or more words separated by a space character, and outputs a recursive acronym, or an empty string if it's impossible. It is impossible to make a recursive acronym for a string like, for example, ppcg elephant because you would start by taking the p from ppcg then adding that to the acronym, then taking the e from elephant. But now we have a contradiction, since the acronym currently spells out "pe..", which conflicts with "pp..". That's also the case with, for example, hi. You would take the h from hi, but the sentence is now over and there are no more letters to spell out hi and we are just left with h which doesn't match hi. (The string needs an amount of words more than or equal to the amount of letters in the acronym)
Input and output are not case sensitive

Restrictions

Anything inputted into your program will be valid English words. But you must make sure to output valid English words too (you can use a database or just store a word for each of the 26 letters)
Standard loopholes and default IO rules apply

Test Cases
hi igloo -> hi
ppcg paints -> (impossible)
ppcg paints cool giraffes -> ppcg
ppcg paints cool galaxies pouring acid into night time stars -> ppcgpaints
ppcg paints cool galaxies pouring acid into night time -> ppcg
ppcg questions professional pool challengers greatly -> (impossible)
I -> I

Scoring
This is code-golf, so the smallest source code in bytes wins

Japt, 13 bytes

¸
mÎ¬
VøUÎ ©V

Try it online!


Rotate every row and column in a matrix The Challenge
Given a n x n matrix of integers with n >= 2

1 2
3 4

and a list of integers with exactly 2nelements

[1,2,-3,-1]

output the rotated matrix. This matrix is contructed in the following way:

Take the first integer in the list and rotate the first row to the right by this value.
Take the next integer and rotate the first column down by this value.
Take the next integer and rotate the second row to the right by this value, etc. until you rotated every row and column of the matrix once.

The list can contain negative integers which means that you shift the row/column left/up instead of right/down. If the integer is zero, don't rotate the row/column.
Example using the input above

List element      Matrix         Explanation
------------------------------------------------------------
1                  2 1           Rotate 1st row right by 1
                   3 4

2                  2 1           Rotate 1st column down by 2
                   3 4

-3                 2 1           Rotate 2nd row left by 3
                   4 3

-1                 2 3           Rotate 2nd column up by 1
                   4 1

Rules

You may choose the most conventient input format. Just make it clear which one you use.
Function or full program allowed.
Default rules for input/output.
Standard loopholes apply.
This is code-golf, so lowest byte-count wins. Tiebreaker is earlier submission.

Test cases
Input format here is a list of lists for the matrix and a normal list for the integers.

[[1,2],[3,4]],[1,2,-3,-1] -> [[2,3],[4,1]]
[[1,2],[3,4]],[1,1,1,1] -> [[3,2],[4,1]]
[[1,2],[3,4]],[0,0,0,0] -> [[1,2],[3,4]]
[[1,2,-3],[-4,5,6],[7,-8,0]],[1,-2,0,-1,3,4] -> [[7,5,0],[-3,-8,2],[-4,1,6]]
[[1,2,-3],[-4,5,6],[7,-8,0]],[3,12,-3,0,-6,-3] -> [[1,2,-3],[-4,5,6],[7,-8,0]]

Happy Coding!

CJam, 13 bytes

{{a.m>1m<z}/}

An unnamed block (function) that takes the matrix and the list on top of the stack (in that order) and leaves the new matrix in their place.

Run all test cases.

Same idea, same byte count, different implementations:

{{\(@m>a+z}/}
{{(Im>a+z}fI}
{{:\Im>]z}fI}

Explanation

Ideally we want to treat each instruction in the list the same, and just use it to rotate the first row of the matrix. This can be done quite easily by transforming the matrix after each instruction a bit and making sure that all those extra transformations cancel out in the end. So after processing each instruction, we rotate all rows one up (such that the next instruction along the same dimension processes the next row) and then transpose the matrix, such that we're actually processing columns next. These additional transformations are orthogonal to the instructions in the list and have a period of exactly 2n, just what we need.

As for the code:

{      e# For each instruction...
  a    e#   Wrap it in a singleton array.
  .m>  e#   Combine it element-wise with the matrix to rotate right. This is
       e#   a fairly common idiom to apply a binary operation only to the first
       e#   element of an array, since element-wise operations just retain all the
       e#   unpaired elements of the longer array.
  1m<  e#   Rotate the rows one up.
  z    e#   Transpose.
}/


Draw an asterisk analog clock for hour N Challenge:
Create a function or program that will take an input N (a number from 0 - 24) which represents the HOUR.
Output should draw an analog clock out of asterisks showing the hour N.

Notes:
•The minute hand must be longer than the hour hand (in terms of number of asterisks used)
•The minute hand must be at least 2 asterisks.
•Noon, 3pm, 6pm, and 9pm will always be orthogonal. Your output for intermediary hours, when arranged by degrees, should be in the same order as the hours of the day. What I mean is at noon the hour hand is 0º and at 3pm the hour hand is 90º so for your output cases of 1pm and 2pm the following must be true:  0pm_deg < 1pm_deg < 2pm_deg < 3pm_deg. Apart from this rule the actual degree amount can be whatever you decide, obviously it will change depending on font and other native factors.
•The connecting joint between the hour hand and minute hand is a circular/oval unicode character of any kind. o, O, •, 0, etc.

Example Input / Output (May vary depending on drawing styles)
 N = 3;

 *
 *
 *
 O  *  *

 N = 4;

 *
 *
 *
 O
    *
       *

 N = 5;

 *
 *
 *
 0
  *
   *

 N = 6;

 *
 *
 o
 *

 N = 7;

      *
      *
      *
      •
    *
  *

 N = 0,12,24;

 *
 *
 *
 o

Example of Differentiating Outputs:
 N = 4     VS     N = 5     VS     N = 6

  *                *                *
  *                *                *
  O                O                O
      *              *              *

This is code-golf, so the program with the shortest bytecount wins!

Javascript (ES6), 105 76 65 bytes

F=N=>`  *
ab*12
 9@3
87654`.replace(/\w/g,y=>'0x'+y^N%12?' ':'*')
<!-- Snippet Demo: -->
N =  <input type="number" min="0" max="24" value="2" id="I" />
<button onclick="console.log(F(I.value))">Run</button>

-29 bytes:

Reduced size of minute and hour hand to 2 and 1 asterisks respectively. Smaller clock = less bytes :-P

-11 bytes:

Changed string comparison to numeric comparison.
y==(N%12).toString(16)?'*':' ' -> '0x'+y^N%12?' ':'*'

Original with longer hands: (105 94 bytes)

F=N=>`    *
a b * 1 2
  ab*12
  99@33
  87654
8 7 6 5 4`.replace(/\w/g,y=>'0x'+y^N%12?' ':'*')
<!-- Snippet Demo: -->
N =  <input type="number" min="0" max="24" value="2" id="I" />
<button onclick="console.log(F(I.value))">Run</button>


Numbers with similar powers Given an integer p > 1, find the smallest integer q > p such that the list of exponents in the prime factorization of q is the same of that of p, no matter the order or the value of the prime factors.
Examples
The prime factorization of p = 20 is 22 x 51. The smallest integer greater than p with identical exponents in its prime factorization is q = 28 = 22 x 71.
The prime factorization of p = 2500 is 22 x 54. The smallest integer greater than p with identical exponents in its prime factorization is q = 2704 = 24 x 132.
Rules

The input is guaranteed to be an integer greater than 1.
This is code-golf, so the shortest answer in bytes wins.

Test cases
Input | Output
------+-------
2     | 3
20    | 28
103   | 107
256   | 6561
768   | 1280
2500  | 2704
4494  | 4510
46552 | 46584
75600 | 105840

Husk, 10 bytes
§ḟ¤≡ȯÖLgp→

Try it online!
Explantion
§ḟ       →     Find the first number starting from the input + 1 such that...
        p        The prime factorisation
       g         with equal elements grouped together
    ȯÖL          and sorted by length of groups
  ¤≡             has the same shape as the above applied to the input.


Convergence of a Markov Process Challenge

Given a left- or right-stochastic matrix where the limit as x approaches infinity of the matrix to the power of x approaches a matrix with all finite values, return the matrix to which the matrix converges. Basically, you want to keep multiplying the matrix by itself until the result no longer changes.

Test Cases

[[7/10, 4/10], [3/10, 6/10]] -> [[4/7, 4/7], [3/7, 3/7]]
[[2/5, 4/5], [3/5, 1/5]] -> [[4/7, 4/7], [3/7, 3/7]]
[[1/2, 1/2], [1/2, 1/2]] -> [[1/2, 1/2], [1/2, 1/2]]
[[1/3, 2/3], [2/3, 1/3]] -> [[1/2, 1/2], [1/2, 1/2]]
[[1/10, 2/10, 3/10], [4/10, 5/10, 6/10], [5/10, 3/10, 1/10]] -> [[27/130, 27/130, 27/130], [66/130, 66/130, 66/130], [37/130, 37/130, 37/130]]
[[1/7, 2/7, 4/7], [2/7, 4/7, 1/7], [4/7, 1/7, 2/7]] -> [[1/3, 1/3, 1/3], [1/3, 1/3, 1/3], [1/3, 1/3, 1/3]]

Rules

Standard Loopholes Apply
You may choose whether you want a right- or a left-stochastic matrix
You may use any reasonable number type, such as floats, rationals, infinite precision decimals, etc
This is code-golf, so the shortest submission in bytes for each language is declared the winner for its language. No answer will be accepted

R,  44  43 bytes

function(m){X=m
while(any(X-(X=X%*%m)))0
X}

Try it online!

Just keeps multiplying until it finds a fixed matrix. Apparently X!=(X=X%*%m) does the comparison, then reassigns X, so that's neat.

Thanks to @Vlo for shaving off a byte; even though crossed out 44 is still regular 44.