Radioactive Bit Checking Note: This is the radiation-hardening version of my previous challenge Pristine Bit Checking. This should be much more difficult than that one.

Write a program/function that takes two integers in the range \$0\$ to \$255\$ inclusive, and returns whether the binary forms of the numbers are exactly one bit different.

For example, \$1\$ and \$0\$ have binary forms 00000001 and 00000000, which are one bit apart. Similarly, \$152\$ and \$24\$ are 010011000 and 000011000, so they return true.

However, your code must be radiation-hardened, such that if any one bit in your program is flipped, it should still work correctly. For example, if your program was the single byte a (01100001), then all the 8 possible modified programs:

á ! A q i e c `

must still work correctly. Make sure you are modifying by bytes (e.g. the á up there is actually representing the byte \$225\$, not the actual two byte character á).

Test cases:

With Truthy meaning they are different by one bit.

0,1     => Truthy
1,0     => Truthy
152,24  => Truthy
10,10   => Falsey
10,11   => Truthy
11,12   => Falsey
255,0   => Falsey

Rules:

Provide a testing framework that can verify that your program is properly radiation-hardened, since there will be a lot of possible programs (number of bytes*8), or else a complete proof of validity.

Please make sure to double-check your program is valid before you post it.

Output can to be either truthy/falsey (either way around is fine), or else as one distinct value for truthy and the rest as falsey

This can be through any of the Standard input/output methods

Here is a helper program that can be used to produce all the variations of an inputted program.

HTML + JavaScript, 210 bytes

<script>[d,b]=location.search.match(/[\d]([\d]*)?/g);1/b/d&&document.write([i=b^d][i--&i]+'<!-'+'-')</script></script>0<script>[d,b]=location.search.match(/\d+/g);document.body.innerHTML=[i=b^d][i&i-1]</script>

Open page with search parameters index.html?a=1&b=2.

Validation (Python + Selenium + Firefox)

# -*- coding: utf-8 -*-
from selenium import webdriver
import os
source = "<script>[d,b]=location.search.match(/[\d]([\d]*)?/g);1/b/d&&document.write([i=b^d][i--&i]+'<!-'+'-')</script></script>0<script>[d,b]=location.search.match(/\d+/g);document.body.innerHTML=[i=b^d][i&i-1]</script>"
filename = os.path.abspath("temp1.html")

browser = webdriver.Firefox()

def test(html, input_values, expected):
    with open(filename, "w", encoding="latin-1") as html_file:
        html_file.write(html)
    [a, b] = input_values
    browser.get("file:///" + filename + "?a=" + str(a) + "&b=" + str(b))
    text = browser.find_element_by_tag_name("body").text
    if text == "true" and expected == True: return True
    if text == "false" and expected == False: return True
    if text == "undefined" and expected == False: return True
    try:
        if int(text) != 0 and expected == True: return True
        if int(text) == 0 and expected == False: return True
    except: pass
    print(html, input_values, expected, text)

testcases = [
    [[1, 1], False],
    [[1, 2], False],
    [[1, 3], True],
]

fullTestcases = [
    [[0, 1], True],
    [[1, 0], True],
    [[152, 24], True],
    [[10, 10], False],
    [[10, 11], True],
    [[11, 12], False],
    [[255, 0], False],
]

def runAllTestcases(html, testcases):
    for testcase in testcases:
        test(html, *testcase)

runAllTestcases(source, fullTestcases)

for pos in range(len(source)):
    for flip in range(8):
        flip_char = chr(ord(source[pos]) ^ (2 ** flip))
        flip_source = source[0:pos] + flip_char + source[pos+1:]
        runAllTestcases(flip_source, testcases)
    print(pos, "/", len(source))

browser.quit()

Usage:

make sure you have python3 and firefox installed.
save this python code to your locale.
pip install selenium
download firefox web driver and put it in the same folder of this python source.
execute this validator and wait it finish.

How

If the modification is on the first time of script. The script will throw some errors (syntax error, undefined variable, etc.). And the second time of script will run correctly and overwrite the output.

If the modification is not on the first time of script. The script output

Learn some (useless) HTML knowledge

document.write insert HTML to current position. You should not output unbalanced HTML in usual. When unbalanced HTML is printed. It inserted as is. And following HTML are re-parsed. You may even insert something like <!-- to open a comment.
When trying to parse <head>, if HTML parser got anything should not be existed here, the <head> tag is closed immediately and a <body> is created.
When the  tag is created, document.body is accessible.
<script> tag is closed by </script>. Anything between them are script. Script may not be valid, and that doesn't matter (doesn't break HTML).
Exception in previous <script> tag does not prevent the following 's execution.


Can I Type This With My Left Hand? Inspiration

The longest words that can be typed with only the left hand on a standard QWERTY keyboard are "sweaterdresses", "tesseradecades", and "aftercataracts" (Source: Wikipedia).

Challenge

Given as input a "keyboard" \$K\$ and a string \$S\$ determine whether \$S\$ can be typed using only the left hand on keyboard \$K\$.

Input

The keyboard \$K\$ will be provided as a list of 3 rows. You may take this input in any reasonable format (eg. a list of 3 strings, a list of 3 lists of characters, etc.), but please do not take the left-hand-side and right-hand-side of the keyboard separately, as that defeats the purpose of the challenge.

You may assume that the input contains only lowercase letters (or only uppercase letters if you wish). Each of the three rows of the keyboard may be of any non-zero size, but each letter from a-z will appear only once on the keyboard.

Example 1: [qwertyuiop, asdfghjkl, zxcvbnm]

Example 2: [qazwsxplkm, edcrfv, tgbyhnuji]

The string \$S\$ may also be taken as input in any reasonable format.

Output

Output a truthy value if the string \$S\$ can be typed using the left hand on the keyboard \$K\$ and a falsey value otherwise.

For the purposes of this challenge: A word can be typed with the left hand if it is made up solely of letters appearing in the first half of each row of the keyboard. If a row contains an odd number of letters, the middle letter is also included in the first half.

Using the row asdfghjkl as an example, the word gafs can be typed with the left hand.

Scoring

This is code-golf. Make your code as short as possible.

Test Cases

These are formatted as \$K\$, \$S\$ -> (expected output)

[qwertyuiop, asdfghjkl, zxcvbnm], qazg -> true
[qwertyuiop, asdfghjkl, zxcvbnm], qpazg -> false
[p, asdfghjklqwertyuio, zxcvbnm], sxzklkl -> true
[p, asdfghjklqwertyuio, zxcvbnm], b -> false
[qazwsxplkm, edocrfv, tgbyhnuji], bad -> true
[qazwsxplkm, edocrfv, tgbyhnuji], tex -> false
[thequick, brownfx, jmpsvlazydg], brow -> true
[thequick, brownfx, jmpsvlazydg], fox -> false

Python 3, 48 bytes

Takes as input \$ K \$ and \$ S \$, the keyboard and the target string. \$ K \$ is a taken as a list of lists.

lambda K,S:{r.pop(0)for r in K for i in r}>={*S}

Try it online!

Explanation

It essentially converts \$ S \$ and the valid keyboard characters \$ K' \$ into sets, and returns True iff \$ S \$ is a subset of \$ K' \$. To obtain only the first half of each row of \$ K \$, we use the pop trick, which is explained in this answer of mine.

The previous answer, where \$ K \$ is taken as a list of strings instead.

Python 3, 54 bytes

lambda K,S:{*''.join(r[:-~len(r)//2]for r in K)}>={*S}

Try it online!


Divide a number by 3 without using *, /, +, -, % operators Quoting this question on SO (Spoiler alert!):

  This question has been asked in an Oracle interview.

  How would you divide a number by 3 without using *, /, +, -, %,
  operators?

  The number may be signed or unsigned.

The task is solvable, but see if you can write the shortest code.

Rules:

Perform the required integer division (/3)
Do not use the non-text-based operators *, /, +, -, or % (or their equivalents, such as __div__ or add()). This also applies to incrementing and decrementing operators, like i++ or i--. Use of operators for string concatenation and formatting are OK. Using these characters for different operators, such as unary - operator for negative numbers, or * to represent a pointer in C is OK as well.
Input value can be arbitrarily large (whatever your system can handle), both positive and negative
Input can be on STDIN or ARGV or entered any other way
Create the shortest code you can to do the above

C, 167503724710

Here's my solution to the problem. I admit it is unlikely to win a strict code golf competition, but it doesn't use any tricks to indirectly call built-in division functionality, it is written in portable C (as the original Stack Overflow question asked for), it works perfectly for negative numbers, and the code is exceptionally clear and explicit.

My program is the output of the following script:

#!/usr/bin/env python3
import sys

# 71
sys.stdout.write('''#include <stdint.h>
#include <stdio.h>
int32_t div_by_3(int32_t input){''')

# 39 * 2**32
for i in range(-2**31, 2**31):
    # 18 + 11 + 10 = 39
    sys.stdout.write('if(input==%11d)return%10d;' % (i, i / 3))

# 95
sys.stdout.write(r'''return 7;}int main(int c,char**v){int32_t n=atoi(a[1]);printf("%d / 3 = %d\n",n, div_by_3(n));}''')

Character count: 71 + 39 * 2**32 + 95 = 167503724710

Benchmarks

It was asked how long this would take and how much memory it would use, so here are some benchmarks:

Script execution time — Running ./test.py | pv --buffer-size=1M --average-rate > /dev/null for about 30 seconds gives a rate of about 14.8 MB/s. The rate of output can reasonably be assumed to be roughly constant, so the running time to completion should be about 167503724710 B / (14.8 * 1048576 B/s) ≈ 10794 s.
Compilation time — The TCC compiler claims to compile C code at 29.6 MB/s, which makes for a compilation time of 167503724710 B / (29.6 * 1048576 B/s) ≈ 5397 s. (Of course this can run in a pipeline with the script.)
Size of compiled code — I tried estimating it using ./test.py | tcc -c - -o /dev/stdout | pv --buffer-size=1M --average-rate > /dev/null, but it seems tcc doesn't output anything until it reads the entire source file in.
Memory usage to run — Since the algorithm is linear (and tcc doesn't optimize across lines), the memory overhead should be only a few kilobytes (apart from the code itself, of course).


Count Mills in Nine Men's Morris Introduction
Nine Mens's Morris (also called Mills) is a board game for two players which is played on the following board (image taken from the linked Wikipedia-page):

Each player has 9 men, colored black and white. The concrete rules are not important for this challenge, but check out the Wikipedia-page if you are interested.
The Challenge
Given a grid as input, which represents a certain boardstate, output the total mill count m with 0<=m<=8.
Three men of the same color form a mill when they are in a straight row of connected points.  b2 to f2 is not a mill since the men are of different color. Also d2 to d5 would not form a mill since the three points have to be connected.
The board in the image above contains two mills for example. One from f2 to f6 and one from e3 to e5.
Input
The board is represented as a 2D grid with 24 points which are connected as shown in the example image above. The example  uses letters from a-g for the columns and numbers from 1-7 for the rows, but you may choose any reasonable input format as long as it maps 24 unique coordinates to one of the following states:

Empty
Taken by black
Taken by white

The concrete repersentation is up to  you you are not restricted to "b" or "w" for the colors.
Besides this, your input may not contain any additional information.
Additional notes

You don't have to map the points by any kind of values. If you want to take the input as a 2D array, that's fine as well. But keep in mind that not all points in there are used and that you have to consider the connections between them.
The input might be empty, in which case you have to output zero (empty board -> no mills).
Since each player has 9 men, the input will never contain more than 18 taken points.
You may leave out emtpy points in the input and therefore only input points which are taken.
The input may be ordered in any way. You can't rely on a specific order.
You may assume that the input will always be valid. This means that there won't be more than 9 men of each color and that each point will be unique.

Rules

Make clear which input format you use in your solution. Providing an example run of your program is hightly encouraged.
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
The input format here is a list of tuples with the coordinates as in the example above as first element and the state of the point second element. A point taken by white is marked as "w" and a point taken by black as "b". All other points are left out and are empty.

[("a4","w"),("b2","b"),("b4","b"),("c4","b"),("d1","w"),("d2","w"),("e3","w"),("e4","w"),("e5","w"),("f2","b"),("f4","b"),("f6","b"),("g4","w")] -> 2
[("a1","b"),("a4","b"),("a7","b"),("b4","b"),("c4","b"),("d3","w"),("d2","w"),("d1","w")] -> 3
[] -> 0
[("b4", "b"),("a4",b"),("c4",w")] -> 0
[("b4", "b"),("a4",b"),("c4",b")] -> 1
[("a1", "b"),("a4", "b"),("a7", "b"),("b2", "b"),("b4", "b"),("b6", "b"),("c3", "b"),("c4", "b"),("c5", "b"),("e3", "w"),("e4", "w"),("e5", "w"),("f2", "w"),("f4", "w"),("f6", "w"),("g1", "w"),("g4", "w"),("g7", "w")] -> 8

Happy Coding!

JavaScript (ES6), 276 228 125 117 105 bytes
a=>btoa`i·yø!9%z)ª»-ºü1j;ÝÈ%¥·¡ªÜ"·ç¹Ê1`.replace(/.../g,b=>(a[b[0]]+a[b[1]]+a[b[2]])/3&1||'').length

(the above contains some unprintable ascii characters that won't show up here, so here's a version without the btoa that can be copied and run)
a=>'abcdefghijklmnopqrstuvwxajvdksglpbehqtwimrfnucox'.replace(/.../g,b=>(a[b[0]]+a[b[1]]+a[b[2]])/3&1||'').length

Breaks a reference string into letter triplets that match up with mill group keys. Input is in the form of an object, where keys are the letters a-x, starting from the bottom left and ending in the top right, moving left-to-right first. Values are 1 for white, -1 for black, and 0 for blank.
Example
{b:1,d:-1,e:1,f:-1,i:1,k:-1,l:-1,m:1,n:-1,r:1,u:-1} => 2
{j:1,d:-1,k:-1,l:-1,b:1,e:1,i:1,m:1,r:1,f:-1,n:-1,u:-1,o:1} => 2
{a:-1,j:-1,v:-1,k:-1,l:-1,h:1,e:1,b:1} => 3
{} => 0
{k:-1,j:-1,l:1} => 0
{k:-1,j:-1,l:1} => 1
{a:-1,j:-1,v:-1,d:-1,k:-1,s:-1,g:-1,l:-1,p:-1,i:1,m:1,r:1,f:1,n:1,u:1,c:1,o:1,x:1} => 8

These examples are taken from OP's examples, converted to the letter-key and number-value object. The first is from the example image, while the others are from the example set.


Permutation Numbering The Challenge

For a given set of n integers, write a program which will output its lexicographic index.

The Rules

The input must only be a set of unique non-negative integers separated by spaces.
You should output the lexicographic index (range 0 to n!-1 inclusive) of the permutation.
No permutation libraries or permutation built-ins may be used.
You may not generate the set of permutations or any subset of permutations of the input to help you find the index.
You also can't increment or decrement the given permutation to the next/previous(lexicographically) permutation.
Bonus points (-10 bytes) if you find some way to complete this without using factorials.
Runtime should be less than 1 minute for n = 100
Shortest code by byte count wins
Winner chosen Tuesday (July 22, 2014)

More About Permutations

http://www.monkeyphysics.com/articles/read/26/numbering_permutations.html
Permutation group operation
http://lin-ear-th-inking.blogspot.com/2012/11/enumerating-permutations-using.html

Examples

0 1 2 --> 0
0 2 1 --> 1
1 0 2 --> 2
1 2 0 --> 3
2 0 1 --> 4
2 1 0 --> 5
0 1 2 3 4 5 6 7 --> 0
0 1 2 3 4 5 7 6 --> 1
0 1 2 3 4 6 5 7 --> 2
1 3 5 17        --> 0
781 780 779 13  --> 23
81 62 19 12 11 8 2 0 --> 40319
195 124 719 1 51 6 3 --> 4181


Output all numbers below certain number containing certain digits Output all numbers in certain range containing certain digits

Task

Take an input of digits through console, prompt, or a file (in the decimal number system). These digits should be separated by spaces.
Take an input of the "maximum" through console, prompt, or a file
If you use a file, the program must output "[Data taken from file]"
Print all natural numbers (including 0) below the maximum containing at least one of the digits specified by the user (they may contain other digits), separated by a single space. Leading 0s do not count!
If there is a sequence of 10 or more consecutive numbers, it should output the first and last, separated by a -->

Rules

Standard loopholes are (obviously) not allowed
Programs must complete the tasks above
The answer with the fewest characters wins

Examples

>>> 1 3
>>> 100
1 3 10 --> 19 21 23 30 --> 39 41 43 51 53 61 63 71 73 81 83 91 93

>>> 1 2 4 5 6 7
>>> 29
1 2 4 5 6 7 10 --> 28

>>> 0 1 2 3 4 5 6 7 8 9
>>> 9999999
0 --> 9999998

[Data taken from file]
1 3 5 7 9

Ruby, 186 181 177 bytes

a=gets.split;puts ([0]+(0...gets.to_i).select{|x|(x.to_s.split('')&a).any?}).each_cons(2).slice_before{|m,n|m+1<n}.map{|a|c=a.map &:last;c.count>9?[c[0],'-->',c.last]:c}.join' '

Ungolfed explanation:

# Read numbers from input and split into array
a = gets.split

# Loop from 0 to maximum number, exclusive
puts ([0]+(0...gets.to_i).select { |x|
  # Only include numbers that include at least one input digit
  (x.to_s.split('')&a).any?
})    # Add dummy element to the beginning of array
.each_cons(2)   # Get each array of 2 consecutive elements
.slice_before { |m, n| #
  m + 1 < n # "Slice" the array if m and n are not consecutive
}.map { |a|
  c = a.map &:last # Get all the last elements in `a`
  if c.count > 9
    # 10 or more consecutive elements. Get the first and last, and
    # an arrow in-between
    [c[0],'-->',c.last]
  else
    c
  end
}.join ' ' # Add space in-between all elements, and print result


Ordinal string check Description :

Given a string as input, check if it is a valid ordinal number in English or not. If it is valid return truthy value otherwise return falsy value. (Suggested by @Arnauld. Thanks . Also by @JoKing)

For users who want to know about ordinal numbers go here :

https://www.mathsisfun.com/numbers/cardinal-ordinal-chart.html (Suggestion by : qwr)

Possible inputs :

21st ---> true
12nd ---> false
1nd ---> false
....

This is a code golf challenge so shortest code in each language will be the winner.

Examples :

console.log('12th' , true) // This evaluates to true
console.log('1st' , true) // also evaluates to true
console.log('21nd' , false) // returns false
console.log('11st' , false) // returns false
console.log('111199231923819238198231923213123909808th' , true) // true

Since a lot of people asked the question regarding whether input will be only valid strings or not :

All inputs will always be valid. i.e they will be in the form of string and consist of a digit (or number of digits) along with one of the four suffixes :

st , nd , rd , th

Python,  56  53 bytes
-3 thanks to  (use unique letter inclusion instead of penultimate character equality)

lambda v:'hsnrhhhhhh'[(v[-4:-3]!='1')*int(v[-3])]in v

An unnamed function.
Try it online!
How?
Since all input (here v) is guaranteed to be of the form \d*[st|nd|rd|th] we can just test whether a character exists in v which we expect to be there if it were correct (s, n, r, or h, respectively) - that is <getExpectedLetter>in v.
The last digit usually determines this:
v[-3]: 0 1 2 3 4 5 6 7 8 9
v[-2]: h s n r h h h h h h

...except when the penultimate digit is a 1, when all should end with th and hence our expected character must be h; to evaluate this we can take a slice (to avoid an index error occurring for inputs with no -4th character) v[-4:-3]. Since 0 maps to h already we can achieve the desired effect using multiplication prior to indexing into 'hsnrhhhhhh'.


Minimal code CPU stress-tester… Introduction

There are lots of utilities out there capable of creating a high CPU load to stress-test your processor(s). On Microsoft Windows, you can even use the on-board calculator.exe, enter a large number like 999999999, and press n! several times to make your CPU(s) work overtime.

But what’s in a solution if you didn’t create it yourself?

The mission

Your mission – if you choose to accept it – is to create the smallest CPU stress-test tool on the planet.

Must…

must produce 100% CPU load until aborted
must take a numeric input, representing the number seconds the stress-test should run
must allow user interaction (keypress, closing terminal window, or something like that) which should enable a user to abort the stress-test and/or quit the program
must target Microsoft Windows, Mac OSx, and/or Linux.
(Even a hamster could stress a Comodore64… therefore, you must target a current operating system.)

Must not…

must not use 3rd-party programs or tools which replace expected functionality.
(Proposing shortcuts in the likes of system('cpuStressThing.exe') disqualifies your proposal.)

May…

may use any approach/algorithm/functionality to produce expected 100% CPU load
may use any programming or scripting language
(as long as it allows practical verification of its functionality by running it)

Winning Condition

Present the smallest sourcecode possible. The winner is the one presenting the most minimal (in size) sourcecode that complies to the above “must” and “must not” conditions. Now, make that baby burn…

EDIT

Since the question came up in the comment area… you only need to target 1 CPU core. I'm definitely not expecting you to produce a multi-core solution. After all, this should be fun – not work.

Bash and standard utilities, 36 31 22 29 28 26 bytes
yes :|sh&sleep $1;kill $!


Quandle Quandary Episode I: Identifying Finite Quandles Write a program that will determine if a given matrix represents a quandle.  A quandle is a set equipped with a single (non-commutative, non-associative) operation \$◃\$ which obeys the following axioms:

The operation is closed, meaning that \$a◃b = c\$ is always an element of the set if \$a\$ and \$b\$ are elements of the set.
The operation is right-self-distributive: \$(a◃b)◃c = (a◃c)◃(b◃c)\$.
The operation is right-divisible:  For any chosen pair of \$a\$ and \$b\$, there is a single unique \$c\$ such that \$c◃a = b\$
The operation is idempotent: \$a◃a = a\$

A finite quandle can be represented as a square matrix.  Below is an example of an order-\$5\$ quandle (source).
0 0 1 1 1
1 1 0 0 0
3 4 2 4 3
4 2 4 3 2
2 3 3 2 4

The value located at the \$n\$-th row and \$m\$-th column (0-indexed) is the value of \$n◃m\$. For example, in this quandle, \$4◃1 = 3\$.  Some of the quandle properties are easy to see from this matrix:

It is closed because only values \$0-4\$ appear in this \$5\times5\$ matrix.
It is idempotent because the matrix diagonal is \$0, 1, 2, 3, 4\$
It is right-divisible because no column contains any duplicate values. (The rows can, and usually will.)

The property of right-self-distributivity is harder to test.  There might be a shortcut, but the simplest method is to iterate over each possible combination of three indexes to verify that m[m[a][b]][c] = m[m[a][c]][m[b][c]].
Input
Input will be the list of rows of a square matrix, using either 0-indexing or 1-index (your choice).  Each entry will be a single digit number from 0 to 8 (or 1 through 9).  I will be flexible on the input format.  Some acceptable formats include:

Your language's most natural formatting for matrices or lists, such as [[0 0 0][2 1 1][1 2 2]] or (0,0,0,2,1,1,1,2,2).
The list of values delimited by whitespace, newlines, commas, etc.
A single string consisting of all values concatenated together, such as 000211122.

You are also allowed to take the transpose of the matrix as input (swapping rows with columns).  Just be sure to state this in your answer.
Output
A single truthy/falsey value indicating the matrix's status as a quandle.
Examples of quandles
0

0 0
1 1

0 0 0
2 1 1
1 2 2

0 0 1 1
1 1 0 0
3 3 2 2
2 2 3 3

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

Examples of non-quandles
not closed
1

0 0 0
2 1 1
1 9 2

not right-self-distributive
0 0 1 0
1 1 0 1
2 3 2 2
3 2 3 3

(3◃1)◃2 = 2◃2 = 2
(3◃2)◃(1◃2) = 3◃0 = 3

not right-divisible
0 2 3 4 1
0 1 2 3 4
3 4 2 2 2
3 3 3 3 3
4 1 1 1 4

0 1 2 3
3 1 2 0
3 1 2 3
0 1 2 3

not idempotent
1 1 1 1
3 3 3 3
2 2 2 2
0 0 0 0

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

Haskell, 100 bytes

This answer uses transposed input.

q m=and$(elem<$>v<*>m)++[a#a==a&&a#b#c==a#c#(b#c)|a<-v,b<-v,c<-v]where v=[0..length m-1];i#j=m!!j!!i

Seems like I can't use a pattern guard to bind an infix operator, so I'm using where in this case.

(First version was 108 bytes but missed idempotency test, fixed version was 120 bytes, later versions had 108, 103 and 98 bytes but I had to realize thanks to @nimi that they were all wrong: of course I need to do the right-divisibility test (which implies closedness) before doing any dangerous !! operations,  but I could still use most of my later golfing ideas and with one more, it was 102 bytes, now improved by changing the operand order of # (which is nicer anyway to compensate the transposition) to make better use of its associating to the left)

Use like this:

*Main> q [[0,1,2,3],[0,1,3,2],[1,0,2,3],[0,1,2,3]]
False


Polar Bear, Polar Bear, what do you hear? The text of the children's book Polar Bear, Polar Bear, What Do You Hear?  has a very simple pattern.  You might use the text to teach introductory programming concepts.

My son was quickly bored by this idea, so I decided to play some golf with it instead.

The Challenge

In your programming language of choice, write the smallest program possible which will print the following text.  Output should match exactly, including case, spacing, and punctuation.

Polar Bear, Polar Bear, what do you hear?
I hear a lion roaring in my ear.

Lion, Lion, what do you hear?
I hear a hippopotamus snorting in my ear.

Hippopotamus, Hippopotamus, what do you hear?
I hear a flamingo fluting in my ear.

Flamingo, Flamingo, what do you hear?
I hear a zebra braying in my ear.

Zebra, Zebra, what do you hear?
I hear a boa constrictor hissing in my ear.

Boa Constrictor, Boa Constrictor, what do you hear?
I hear an elephant trumpeting in my ear.

Elephant, Elephant, what do you hear?
I hear a leopard snarling in my ear.

Leopard, Leopard, what do you hear?
I hear a peacock yelping in my ear.

Peacock, Peacock, what do you hear?
I hear a walrus bellowing in my ear.

Walrus, Walrus, what do you hear?
I hear a zookeeper whistling in my ear.

Zookeeper, Zookeeper, what do you hear?
I hear children...

...growling like a polar bear,
roaring like a lion,
snorting like a hippopotamus,
fluting like a flamingo,
braying like a zebra,
hissing like a boa constrictor,
trumpeting like an elephant,
snarling like a leopard,
yelping like a peacock,
bellowing like a walrus...
that's what I hear.

05AB1E, 349 331 330 322 314 311 bytes
•4i;kV_†©:š×Îj€Yå—‚‘%˜ESÎ´þ¤çÑ9¶‹{Å€7¾à{Ì®qA•35B0¡…ing«lV•7ü[¿‘¢wÀ¶à-‚¤î„jHâ™ÐJ'µ‡ÀÂý6›ü‚š¸€%NtÅýµL›fU¥ì€€uîT¡›Ÿ{!œ>'Ì&ý§¨Ü?é>•36B1ð:0¡™D©„, «D‚ø“€À€·€î—«?“¶«¸â€˜€JU¦“„¾“‚˜lv„I “—«0€†€¯¶å.“«0¡`yð«Y¦õ‚˜Nè«sr„ aN5Qi'n«}ð«N9›ijrj¨ðs«…...«}srJˆ}X¯‚ø€Jvy,¶?}…...DU?Y¨vN__i',¶}yð“€è€…“N6Qi'n«}ð®NèJl?}X,“€Š's€À I—«.“?

Try it online
Explanation
•4i;kV_†©:š×Îj€Yå—‚‘%˜ESÎ´þ¤çÑ9¶‹{Å€7¾à{Ì®qA•
Packed string containing the sounds GROWL0ROAR0SNORT0FLUT0BRAY0HISS0TRUMPET0SNARL0YELP0BELLOW0WHISTL
35B0¡…ing«lV
Unpack, split on 0, add "ing" to each word, convert to lower and store in variable Y
•7ü[¿‘¢wÀ¶à-‚¤î„jHâ™ÐJ'µ‡ÀÂý6›ü‚š¸€%NtÅýµL›fU¥ì€€uîT¡›Ÿ{!œ>'Ì&ý§¨Ü?é>•
Packed string containing the animals POLAR1BEAR0LION0HIPPOPOTAMUS0FLAMINGO0ZEBRA0BOA1CONSTRICTOR0ELEPHANT0LEOPARD0PEACOCK0WALRUS0ZOOKEEPER
36B1ð:0¡™
Unpack, replace 1 with space, split on 0 and convert to title case
D©„, «D‚ø
Duplicate, save to register for later use, add ", " to one copy, duplicate that and zip.
“€À€·€î—«?“¶«¸
Dictionary words "what do you hear?", followed by a new line, added to a new list
â€˜€JU
Cartesian product of list of "Animal, Animal, " and "what do you hear?\n", flattened and joined and stores it in variable X.
Pruduces list of strings of the form "Animal, Animal, what do you hear?n".
¦“„¾“‚˜l
Take the remaining list of animals from before, remove the zookeeper and add children, convert to lower case.
v
For each animal:
„I “—«0€†€¯¶å.“«0¡`

Push "I hear0 in my ear.", split on 0 and push as separate strings.
yð«Y¦õ‚˜Nè«
Push "animal sound" with children having no sound
sr„ a
Push "a" in correct place
N5Qi'n«}
If the animal is "Elephant" add "n"
ð«
Add space.
N9›ijrj¨ðs«…...«}
If animal is children, remove space and add "..."
srJˆ}
Join the sentence "I hear a(n) animal sound in my ear." (as well as the children one), store in global array and end loop
X¯‚ø€J
Retrieve the first lines, zip and join producing the first part of the rhyme "Animal, Animal, what do you hear?\nI hear a(n) animal sound in my ear."
vy,¶?}
Print followed by new line.
…...DU?
Print "..." and store a copy in variable X.
Y¨v
For each sound except "whistling":
N__i',¶}
For each line except the first one, start it with ",\n" (making the comma go on previous line)
yð“€è€…“
Push sound, space and "like a"
N6Qi'n«}
If Elephant add "n".
ð®NèJl?}X,
Retrieve the animal saved in register, join everything, print and end loop followed by "...".
This produces the "sound like a(n) animal," lines.
“€Š's€À I—«.“?
Print dictionary string "that's what I hear."


The GOLF CPU Golfing Challenge: Sides of a Cuboid This challenge is the second of a series of fastest-code problems that should be written in the GOLF CPU.  You can find the first here

For this problem, you are given the volume of a cuboid (A rectangular cube).  Each of the side lengths are integers.  You must return the number of distinct cuboids that have that volume.  This sequence matches A034836 (thanks Tylio)

Input:Output [List] [of] [cuboids]
1:1 [1,1,1]
5:1 [1,1,5]
8:3 [1,1,8] [1,2,4] [2,2,2]
24:6 [1,1,24] [1,2,12] [1,3,8] [1,4,6] [2,2,6] [2,3,4]
100:8 [1,1,100] [1,2,50] [1,4,25] [1,5,20] [1,10,10] [2,2,25] [2,5,10] [4,5,5]
1080:52
468719: 1
468720: 678
468721: 2

Your program should be written in GOLF CPU.  For input/output you can either use STDIO or the registers.  Hardcoding primes or answers isn't allowed.

This is a fewest-operations problem, so the answer that solves the examples above with the fewest amount of cycles wins!

14,483 cycles

I use the fact that the output depends only on the signature (exponents in the prime factorization) of the input.  I used the formula from https://oeis.org/A034836.  The sieve of Eratosthenes is used to find primes to factorize the input by trial division.

# Input in register n
# Outputs in register r and exit code

# the signature of n (exponents in its prime factorization) are stored in
# memory starting at address 0x1000000000000000.  They are byte-sized
# since the largest exponent we can have is 64 (2**64)

# mov z, 0x1000000000000000 (implicit)
mov y, z

# pull out factors of 2
# number of factors is stored in k
# mov k, 0 (implicit)
factor_two:
  and c, n, 1
  snz c, 3
    shr n, n, 1
    inc k
    jmp factor_two

# store factors of two if nonzero
sz k, 2
  sb z, k
  inc z

# Sieve of Eratosthenes
# we only check odd primes, since we already removed factors of 2
# we store COMPOSITE(i) at address i
# we also check n for divisibility by every prime we find
# note we only have to check for prime factors up to sqrt(n)!

mov i, 1
sieve_loop:
  add i, i, 2 # go to the next odd number
  lb c, i # check if COMPOSITE(i)
  jnz sieve_loop, c # if so, continue

  mulu j, k, i, i # j = i**2
  geu c, j, n              # if i**2 > n:
  jnz end_sieve_loop, c #   break

  # otherwise, i is prime; check if n is divisible by i
  mov k, 0
  factor_i:
    divu q, r, n, i # r = n % i
    snz r, 3
      mov n, q      # n /= i
      inc k
      jmp factor_i

  # store factors of i if nonzero
  sz k, 2
    sb z, k
    inc z

  # now cross off all composites that are odd multiples of i,
  # but only up to sqrt(n)
  shl d, i, 2 # d = 2 * i
  # we already have j = i**2, we can start marking composites here:
  # since every lesser multiple of i must have a smaller  prime factor and
  # therefore must have already been marked

  sieve_inner_loop:
    sb j, 1
    add j, j, d # j += 2*i
    mulu c, k, j, j  # c = j**2
    leu c, c, n             # if j**2 < n:
    jnz sieve_inner_loop, c #   continue

  jmp sieve_loop

end_sieve_loop:

# if n != 1, n is a prime and needs to be added to the signature
cmp c, n, 1
snz c, 2 # skip if n==1
  sb z, 1

#mov z, 0x1000000000000000

# according to https://oeis.org/A034836, we have:
# a(n) = (np + 3*nsq + 2*ntp)/6
# where np = Times@@Binomial[2+s,2],
# ntp = Times@@Floor[Floor[s,3]/s],
# nsq = Times@@(Floor[s/2] + 1),
# and s is the signature

# Binomial[2+s,2] == (1+s)(2+s)/2
# Floor[Floor[s,3]/s] == 1 if s divides 3, 0 otherwise

# I tested this formula up to n=10,000,000

mov t, 0 # <= BUG? (doesn't work without this line)
mov d, 1 # np
mov e, 1 # ntp
mov f, 1 # nsq

product_loop:
  lb s, y
  jz finish, s
  inc y

  divu q, r, s, 3 # r = s % 3
  sz r, 1
    mov e, 0

  inc s
  mulu d, x, d, s # d *= s + 1

  inc s
  mulu d, x, d, s # d *= s + 2
  shr d, d, 1     # d /= 2

  shr s, s, 1     # s /= 2 (s == (s+2)/2 == floor(s/2) + 1)
  mulu f, x, f, s # f *= floor(s/2) + 1

  jmp product_loop

finish:

add r, e, f # r = e + f
shl r, r, 1 # r *= 2
add r, r, f # r += f
add r, r, d # r += d
            # r == d + 3*f + 2*e

divu r, s, r, 6 # r /= 6

halt r

Test cases:

robert@unity:~/golf-cpu$ ./assemble.py cube.golf
robert@unity:~/golf-cpu$ ./golf.py cube.bin n=1
Execution terminated after 42 cycles with exit code 1.
robert@unity:~/golf-cpu$ ./golf.py cube.bin n=5
Execution terminated after 77 cycles with exit code 1.
robert@unity:~/golf-cpu$ ./golf.py cube.bin n=8
Execution terminated after 91 cycles with exit code 3.
robert@unity:~/golf-cpu$ ./golf.py cube.bin n=24
Execution terminated after 126 cycles with exit code 6.
robert@unity:~/golf-cpu$ ./golf.py cube.bin n=100
Execution terminated after 218 cycles with exit code 8.
robert@unity:~/golf-cpu$ ./golf.py cube.bin n=1080
Execution terminated after 236 cycles with exit code 52.
robert@unity:~/golf-cpu$ ./golf.py cube.bin n=468719
Execution terminated after 9710 cycles with exit code 1.
robert@unity:~/golf-cpu$ ./golf.py cube.bin n=468720
Execution terminated after 422 cycles with exit code 678.
robert@unity:~/golf-cpu$ ./golf.py cube.bin n=468721
Execution terminated after 3561 cycles with exit code 2.
robert@unity:~/golf-cpu$


Who is the sleepiest of them all? Write a program or function that takes in a string of the characters -=o. where the -=o's and .'s always alternate, character to character. The string will have an odd length greater than one and always start and end in one of -=o.
Basically, the input will look like a line of emoticon faces that share eyes in various states of sleepiness, e.g.
o.=.=.-.-.o.o

Your goal is to print or return the face that is either the sleepiest or the most awake (it's up to you which you choose). If there are multiple choices for who is sleepiest/most awake then any one of them may be output.
There are nine distinct faces and five levels of sleepiness:
-.- is 100% sleepy
-.= is 75% sleepy
-.o is 50% sleepy
=.- is 75% sleepy
=.= is 50% sleepy
=.o is 25% sleepy
o.- is 50% sleepy
o.= is 25% sleepy
o.o is 0% sleepy

In case it's not clear, the sleepiness percentage is computed by assigning 1 to - for fully asleep, 0.5 to = for half asleep, and 0 to o for awake. Then the sum of the two eye values divided by two is the percentage.
The shortest code in bytes wins.
Test Cases
Sleepiest
-.- GIVES -.-
=.- GIVES =.-
o.o GIVES o.o
o.-.= GIVES -.=
=.-.= GIVES =.- OR -.=
o.-.= GIVES -.=
-.-.= GIVES -.-
o.o.- GIVES o.-
=.=.=.o GIVES =.=
-.=.=.= GIVES -.=
=.o.-.= GIVES -.=
o.-.o.=.= GIVES o.- OR -.o OR =.=
-.o.-.=.= GIVES -.=
o.o.o.o.o GIVES o.o
-.-.-.-.- GIVES -.-
o.=.=.-.-.o.o GIVES -.-
-.=.-.o.o.=.o.-.o.=.-.o.=.o.- GIVES -.= OR =.-
Most Awake
-.- GIVES -.-
=.- GIVES =.-
o.o GIVES o.o
o.-.= GIVES o.-
=.-.= GIVES =.- OR -.=
o.-.= GIVES o.-
-.-.= GIVES -.=
o.o.- GIVES o.o
=.=.=.o GIVES =.o
-.=.=.= GIVES =.=
=.o.-.= GIVES =.o
o.-.o.=.= GIVES o.=
-.o.-.=.= GIVES -.o OR o.- OR =.=
o.o.o.o.o GIVES o.o
-.-.-.-.- GIVES -.-
o.=.=.-.-.o.o GIVES o.o
-.=.-.o.o.=.o.-.o.=.-.o.=.o.- GIVES o.o

Pyth, 12 10 bytes

hoSN%2.:z3

This prints the sleepiest emoticon. Verify all test cases at once  in the Pyth Compiler.

Credit goes to @Sp3000 for the idea to use sorting.

How it works

hoSN%2.:z3
              (implicit) Save the in z.
      .:z3    Compute all substrings of length 3.
    %2        Keep every seconds substring. This discards non-emoticons.
 o            Sort the emoticons by the following key:
  SN            Sort the characters of the emoticon.
                This works since '-' < '=' < 'o'.
h             Retrieve the first, minimal element.


Őőőőőőő, are you there? Description

While support is getting better and better for people to write in various scripts around the world using unicode, and now you can even write in emojis as well, unfortunately most fonts[citation needed] are still missing Latin characters based on the double acute accent, which is required to write properly in Hungarian.

These characters are the following four:

U+0150 LATIN CAPITAL LETTER O WITH DOUBLE ACUTE (Ő)
U+0151 LATIN SMALL LETTER O WITH DOUBLE ACUTE (ő)
U+0170 LATIN CAPITAL LETTER U WITH DOUBLE ACUTE (Ű)
U+0171 LATIN SMALL LETTER U WITH DOUBLE ACUTE (ű)

Task

Your task is to write a program / script / function, that given a font or a font's name gives out a truthy value in case the font contains all of the four glyphs described above, or a falsey value if at least one of them is missing from the font.

Scoring

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

Test cases

These fonts are from Google Fonts. Note that some fonts on Google Fonts (for example Lato) have an updated version on other sites which already contain the missing glyphs, if you have the updated ones then obviously your results might be different from the test cases below.

Truthy values:

Roboto
Open Sans
Lalezar
Source Sans Pro
Arial
Times New Roman
Cinzel

Falsey values:

Voltaire
Rosario
Heebo
Bitter
Arvo
Lato (see note above)
Molengo (contains ű and Ű, but not ő or Ő)
Sue Ellen Francisco (contains only the uppercase variants)
Germania One (contains only the lowercase variants)
Garamond (the one installed on OSX by Office for Mac)

Notes

It's up to you if your program requires a font's name as a parameter or the actual font (or the font's location on the system)
If it's a font's name the program should check the system font registered at that name (for example if you specify "Arial" it should use the Arial font in your system's font registry)
If it's a location the program should use that specific font, even if there is a system font registered with that same name (for example if you specify "/home/user/Arial.ttf" it should use that font even if there's an Arial registered in the system's store)
Google Fonts above is just a convenient place you can download fonts for testing purposes, but your code doesn't need to use those fonts
It is enough if your program works with only one specific font type, e.g. TTF, OTF, WOFF, SVG font, Type 1, Metafont, etc. However you should support a font format that has generic support for the four glyphs and for signalling missing glyphs mentioned above, e.g. you cannot chose a font format where the answer will always be falsey or truthy
Some fonts might have the above glyphs incorrectly hardcoded to a fake value (e.g. the replacement box) instead of not specifying in the font file at all. Your code doesn't need to be able to differentiate between a fake glyph and a real glyph, but it's also acceptable if it does the check based on that.

Please specify in your answer how you have to pass in the font, and what kind of fonts it works with.

Scala, 56 bytes

s=>new java.awt.Font(s,0,0).canDisplayUpTo("ŐőŰű")<0

canDisplayUpTo is a method of the Font object that returns the index of the first charater that cannot be displayed by the font. It return -1 if all characters can be displayed. javadoc


Not Quite Roman Ternary Given an integer n ≥ 0 , output it in a non-positional base-3 notation, using digits 139ABCDE… and a 1-character separator. Every digit is a consecutive power of 3 and the digits on the left side of the separator are negated, e.g.     A931|B   →    81−(1+3+9+27)   →    41. A digit may appear only once.
Rigorously, let the value of a digit be:

its value if the digit is 1, 3 or 9
27 if the digit is A
3 times the value of the digit right before it for B..Z

Your output should satisfy sum(value of digits to the right of |) - sum(value of digits to the left of |) == input .
Examples
input     output
----------------
0         |
1         |1
7         3|91
730       |D1
9999      FEDC|GA9

You may use a different non-space character as a separator. You are also allowed to have no separator, in which case the largest digit starts the positive sequence. You don’t need to handle anything larger than 232−1 (PMIGDCBA9|RQNLH3).
You may write a full program or function, and input and output may be provided on any of the usual channels.
This is code-golf, so the shorter your answer the better!

Java 10, 120 113 112 109 107 102 92 bytes

n->{var r="|";for(var c='1';n++>0;c+=c>64?1:c*4%22%9,n/=3)r=n%3<1?c+r:n%3>1?r+c:r;return r;}

-3 bytes by using part of the trick of @Arnauld's JavaScript (ES6) answer,
changing i=0 and i++<1?49:i<3?51:i<4?57:i+61 to i=4 and ++i>9?i+55:i>8?57:++i+43.
-6 bytes thanks to @Arnauld directly, by getting rid of i.
-10 bytes thanks to @ceilingcat.
Order of output: Highest-to-lowest, |-delimiter, lowest-to-highest.
Explanation:
Try it online.
n->{              // Method with integer parameter and String return-type
  var r="|";      //  Result-String, starting at the delimiter "|"
  for(var c='1';  //  Character, starting at '1'
      n++>0       //  Loop as long as `n` is larger than 0
                  //  Increasing it by 1 with `n++` at the start of every iteration
      ;           //    After every iteration:
       c+=        //     Change character `c` to:
          c>64?   //      If the current `c` is an uppercase letter:
               1  //       Simply go to the next letter using `c+=1`
              :   //      Else:
               c*4%22%9,
                  //       Change '1' to '3', '3' to '9', or '9' to 'A'
       n/=3)      //     Integer-divide `n` by 3
     r=           //   Change the result to:
       n%3<1?     //    If `n` modulo-3 is 0:
        c+r       //     Prepend the character to the result
       :n%3>1?    //    Else-if `n` modulo-3 is 2:
        r+c       //     Append the character to the result
       :          //    Else (`n` modulo-3 is 1):
        r;        //     Leave `r` unchanged
   return r;}     //  Return the result-String


Make The Finest Magic Code Square In math a magic square is an N×N grid of numbers from 1 to N2 such that every row, column, and diagonal sums to the same total. For example here's a 3×3 magic square:

In this challenge we'll extend the idea to magic code squares where, instead of numbers, each grid cell is any non-newline character. They can be be repeated and in any order.

And instead of sums, each row, column, and diagonal is viewed as an N-character single-line program whose output is a distinct number from 0 to 2N+1 (inclusive).

For example, if you had a 4×4 magic code square that looked like

ABCD
EFGH
IJKL
MNOP

it would need to output the numbers 0 through 9, perhaps like:

  ABCD-9
  EFGH-2
  IJKL-6
  MNOP-5
 /||||\
3 4180 7

That is, the ten embedded 4-character single-line programs that form the rows, columns, and diagonals of the grid each need to output a unique number from 0 through 9. In this case:

ABCD -> 9
EFGH -> 2
IJKL -> 6
MNOP -> 5
AFKP -> 7
DHLP -> 0
CGKO -> 8
BFJN -> 1
AEIM -> 4
DGJM -> 3

(Note that the diagonals are read from top to bottom. This is required.)

As another example, this 3×3 code square

d*P
0##
! d

would need to output 0 through 7 when its rows, column, and diagonals are run to make it magical, perhaps like:

  d*P-1
  0##-0
  ! d-6
 /|||\
5 432 7

Scoring

The goal of this challenge is not necessarily to make the smallest or the biggest magic code square. In some programming languages very small magic code squares might be easy to make and in other languages very large ones might be.

The challenge here is to create what you think is the best, most elegant, or most impressive magic code square or related set of magic code squares. Hence this is a popularity-contest, the answer with the highest number of votes wins.

Your submission must include at least one valid magic code square, and may include many related ones if you have found them, or even an infinite neighborhood of them.
Please list the N (or range of N's) you found at the top of your answer.
For submitting multiple magic code squares in the same language but with very different implementations use multiple answers.
Of course you are encouraged to share your process of searching for magic code squares and explain why yours is interesting! (Info about any Parker magic code squares might be funny.)

Keg, 4x4 magic square

0601
7.92
3._.
8654

Try it online!

Outputs

 0601 - 1
 7.92 - 7
 3._. - 3
 8654 - 4
/||||\
98652 0

I can't believe this actually works! Programs need the -hr flag to properly output the required result.

Test suite. Uncomment each line to run it. The -in flag is purely to make the test suite a nicer experience, as otherwise, the newlines would interfere with the programs.

Programs

0601 - 1 (Push 0, 6, 0 and 1,then print the top of stack (TOS))
7.92 - 7 (Push 7 and print it. This makes the rest of the program a NOP)
3._. - 3 (Push 3 and print it. The _ will the try and pop from an empty stack, ending execution)
8654 - 4 (Push 8, 6, 5 and 4 and then print TOS)
0738 - 8 (Push 0, 7, 3 and 8 and then print TOS)
6..6 - 6 (Push 6 and print it. The . will try and print from an empty stack, end execution)
09_5 - 5 (Push 0 and 9, then pop the 9 and discard it then push 5. TOS is then printed)
12.4 - 2 (Push 1, then 2 and print TOS. The rest of the program is NOPs after that.)
0._4 - 0 (Like the program for 3, but with 0)
19.8 - 9 (Like the program for 2 but with 9)


Tidy up my bit string I have a series of binary switches, which I can represent as a bit string. The last person who used my switches left them in some arbitrary state without cleaning up, and it bugs me. I always keep the switches in one of four possible "tidy" configurations:

All 1: e.g., 111111111
All 0: e.g., 000000000
Alternating 1 and 0: e.g., 10101010 or 01010101

However, in addition to being fastidious about my switch arrangements, I'm also very lazy, and want to extend the smallest amount of effort possible to reset the switches to one of my preferred states.

Challenge

Write a program or function that takes a sequence of ones and zeros of any length. It should output a result of the same length that shows the closest "tidy" configuration.

Input and output

You may represent your bit sequence using a string or any language-native ordered type, such as a list or array. If using a non-string structure, items within the sequence may be number or string representations of 1 and 0.

Your strings may have leading and trailing characters like "..." or [...]

Your input and output formats are not required to match. (For example, you may input a list and output a string.)
Don't input or output base 10 (or other base) representations of the bit string. That's way too much effort to correspond back to switches -- I'm doing this because I'm lazy, remember?
Output must be a sequence as specified above. Don't output an enumerated value saying which of the four configurations is the best (e.g., don't say, "solution is case #3"). Actually output a bit sequence in that configuration.
Input may be of any length. Your code may not impose arbitrary limits on the size of the input.

If your language or interpreter imposes reasonable arbitrary limits on the size of an input or call stack (e.g, if you choose a recursive solution), then this is acceptable insofar as it is a shortcoming in your environment, not your code.

Notes

The distance between two strings is the Hamming distance. You must find the "tidy" configuration of the same length at the input that has the fewest number of differences from the input.
If multiple tidy configurations are equally best choices, you may output any best choice, or (at your option) multiple best choices, delimited in some way or as siblings in a data structure. The selection can be completely arbitrary and does not need to be consistent between executions.
The input might already be a tidy state.

Examples

Input:  1111110
Output: 1111111

Input:  001010000
Output: 000000000

Input:          0010100
Allowed output: 0000000
Allowed output: 1010101
[You may choose either allowed output, or both]

Input:  1111
Output: 1111

Input:  10
Output: 10

Input:  010101101
Output: 010101010

Input:          110
Allowed output: 111
Allowed output: 010

Python 2, 127 103 101 bytes

lambda a:min(zip(*[[1,0,i%2,~-i%2]for i in range(len(a))]),key=lambda N:sum(o^b for o,b in zip(a,N)))

Try it online!

Makes the lists 111..., 000..., 101... and 010... with the first zip then finds the min of these lists with key function: sum of the xor of each element in the each possible output the input.


Interpret Repetition! This challenge is the first in a two-challenge series about Repetition. The second will be up soon.
In a language called Repetition (something I just made up), there consists an infinite string of 12345678901234567890..., with 1234567890 repeating forever.
The following syntax is available to output numbers:

+-*/: This inserts the operator into the string of repeating digits.

Examples:

+ -> 1+2 = 3 (The + inserts a + between 1 and 2)
+* -> 1+2*3 = 1+6 = 7 (Same as above, except two operators are used now)
/ -> 1/2 = 0 (Repetition uses integer division)
// -> 1/2/3 = 0/3 = 0 (Repetition uses "left association" with multiple subtractions and divisions)

Each operator is inserted so that it has one digit to its left, unless there are c's (see below).

c: Concatenates with the next digit in the string.

Examples:

c+ -> 12+3 = 15 (The c "continues" the 1 and concatenates it with the next digit, 2, to form 12)
+c -> 1+23 = 24
ccc -> 1234

(): Brackets for processing numbers.

Examples:

(c+)* -> (12+3)*4 = 15*4 = 60 (Repetition uses the order of operations)
(c+)/c -> (12+3)/45 = 15/45 = 0
(cc+c)/ -> (123+45)/6 = 168/6 = 28

s: Skip a number (removes the number from the infinite string).

s+ -> 2+3 = 5 (s skips 1)
csc -> 124 (The first c concats 1 and 2, the s skips 3, and the final c concats 12 to 4)
+s+ -> 7 (The first + adds 1 and 2 to make 3, s skips 3, and the final + adds 3 to 4 to make 7)
cs*(++) -> 12*(4+5+6) = 12*15 = 180

In the examples above, only a finite amount of digits in the infinite string are used. The number of digits used is equivalent to number of operators, concats and skips + 1.
Your task is, when given a string of Repetition code, output the result.
Examples of input and output are:
++ -> 6
- -> -1
(-)* -> -3
cscc -> 1245
(cc+c)/ -> 28
cc+c/ -> 130
cs*(++) -> 180

This is code golf, so shortest code in bytes wins!
Specs:

You are guaranteed that the result will never go above 2^31-1.
You are also guaranteed that the input will only consist of the symbols +-*/cs().
An empty program will output 1.

JavaScript (ES6), 110 bytes

s=>eval((" "+s)[R='replace'](/[^\)](?!\()/g,x=>x+i++%10,i=1)[R](/c| (\ds)+|s\d/g,"")[R](/\d+\/\d+/g,"($&|0)"))

Very simple, but integer division adds 25 bytes. For some reason a regex in JS can't match both the beginning of a string and the first character, so that adds a few bytes as well.

How it works

Prepend a space to the input.
Append the next digit to each character (except )) that isn't immediately before a (.
Remove each c, a digit + s at the beginning (1s2 -> 2), and each s + a digit (3s4 -> 3).
Turn each division operation into int-division (1/2 -> (1/2|0)).
Evaluate and return.


Multiply all numbers in a string Winner: Chilemagic, a massive 21 bytes!
You may continue to submit your answer, however you can no longer win. Original post kept:

Your goal is to find all numbers in a string, and multiply each one individually by a value input by the user

You will not need to worry about decimals
The user will input a number and a string
The user must type the number and string at some point, however the method the program reads it does not matter. It can be with stdin, reading a text file, etc, however the user must press the 9 button on their keyboard (for example) at some point
Anything that can compile and run is acceptable

Example:
Sentence input: This 1 is22a 3352sentence 50
Number input: 3
Output: This 3 is66a 10056sentence 150

This contest ends on September 6th, 2014 (7 days from posting).
This is a code-golf, so the shortest code wins

Update - Perl - 17

s/\d+/$&*$^I/ge

15 characters + 2 for -i and -p flags.

We can use the -i flag to input a file extension, but since we aren't reading any files, we can use it to get the number and it the variable $^I will get assigned to it.

Run with:

perl -e'print"This 1 is22a 3352sentence 50"' | perl -i3 -pe's/\d+/$&*$^I/ge'

Perl - 21

Updated as per @Dennis's comment.

$n=<>;s/\d+/$&*$n/ge

Run with -p flag.

Example run:

perl -e'print"This 1 is22a 3352sentence 50\n3"' | perl -pe'$n=<>;s/\d+/$&*$n/ge'

Explanation:

$n=<>; read in the number

-p prints the output

s/\d+/$&*$n/ge Read the input with <> and search for one or more digits and replace them with the digits times the number. g is global, e is eval the replace potion of the s///. $& contains what was matched and it multiplied by the number, $n.

You can read more about s/// in perlop and more about Perl regexes in perlre.

Another solution:

@F.Hauri pointed out you can also use the s switch to assign the $n variable to 4. I'm not sure how many characters this counts as but I'll leave it here:

perl -spe 's/\d+/$&*$n/ge' -- -n=4 <<<'This 1 is22a 3352sentence 50'


Complete a sequence using its distances Given \$A = (a_1,\dots,a_k)\ k\ge2 \$ a sequence of positive integers, in which all elements are different.
Starting from \$i=2\$, while \$a_i\in A:\$ (until the last element)

If \$d=|a_i-a_{i-1}|\$ is not already in \$A\$, append \$d\$ to \$A\$
Increase \$i\$

Output the completed sequence.
This is code-golf
Example
In:  16 21 11 2

     16 21 11 2 5
      --^
     16 21 11 2 5 10
         --^
     16 21 11 2 5 10 9
            --^
     16 21 11 2 5 10 9 3
              --^
     16 21 11 2 5 10 9 3
                --^
     16 21 11 2 5 10 9 3 1
                   --^
     16 21 11 2 5 10 9 3 1 6
                     --^
     16 21 11 2 5 10 9 3 1 6
                       --^
     16 21 11 2 5 10 9 3 1 6
                         --^
Out: 16 21 11 2 5 10 9 3 1 6

05AB1E, 6 5 bytes

Δ¥Ä«Ù

Try it online!

Δ         until the output doesn't change:
 ¥Ä           absolute differences
   «          concatenate to the original input
    Ù         only keep unique values


Repeated! Factorials! Not to be confused with Find the factorial!

Introduction

The factorial of an integer n can be calculated by
$$n!=n\times(n-1)\times(n-2)\times(...)\times2\times1$$

This is relatively easy and nothing new. However, factorials can be extended to double factorials, such that
$$n!!=n\times(n-2)\times(n-4)\times(...)\times4\times2$$
for even numbers, and
$$n!!=n\times(n-2)\times(n-4)\times(...)\times3\times1$$
for odd numbers. But we're not limited to double factorials. For example
$$n!!!=n\times(n-3)\times(n-6)\times(...)\times6\times3$$
or
$$n!!!=n\times(n-3)\times(n-6)\times(...)\times5\times2$$
or
$$n!!!=n\times(n-3)\times(n-6)\times(...)\times4\times1$$
depending on the starting value.

In summary:
$${\displaystyle n!^{(k)}={\begin{cases}1&{\text{if }}n=0 \\n&{\text{if }}0<n\leq k\\n\cdot\left({(n-k)!}^{(k)}\right)&{\text{if }}n>k\end{cases}}}$$
where
$${\displaystyle n!^{(k)}=n\underbrace{!\dots!}_{k}}$$
Or, in plain English: Subtract the factorial count from the base number repeatedly and multiply all resulting positive integers.

The Challenge

Write a function that will calculate any kind of repeated factorial for any non-negative integer.

Input

Either

A string containing a non-negative base-ten integer, followed by 1 or more exclamation marks. E.g. "6!" or "9!!" or "40!!!!!!!!!!!!!!!!!!!!".

or

The same values represented by two integers: one non-negative base value and one positive value representing the factorial count. This can be done according to any format from the default I/O rules.

Output

The result of said calculation.

Challenge remarks

0! equals 1 by definition. Your code must account for this.
The factorial count is limited by $$ 0 < factorial~count \leq base~value $$outside this range, you are free to output whatever. Aside from 0!, which is the only exception to this rule.

Examples

Input                              Output

3!!!                               3
0!                                 1
6!                                 720
9!!                                945
10!!!!!!!!                         20
40!!!!!!!!!!!!!!!!!!!!             800
420!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  41697106428257280000000000000000

Try it with an ungolfed Python implementation: Try it online!

General remarks

This is code-golf, so the answer using the fewest bytes in each language wins.
Standard rules, I/O rules and loophole rules apply.
Please include a Try it Online-link to demonstrate your code working.
Please motivate your answer with an explanation of your code.

R, 33 bytes

function(n,k)prod(seq(n+!n,1,-k))

Try it online!

Handles \$n=0\$ by adding the logical negation of \$n\$.


Christmas Cracker Mystery Calculator The presents have been opened.  The mince-pies have been eaten.  The Star Wars have been watched.  The Christmas Season is beginning to wind down.  By now you may well have pulled a few Christmas Crackers.  If you're lucky, instead of the usual useless plastic toys, you may have won a Mystery Calculator with which you can amaze your friends and relatives.

This trick consists of 6 cards each with a 4x8 grid of numbers printed on it.  Each card contains a different subset of the integers [1,63].  The magician will ask you to pick a number from one card and keep that number secret.  The magician will then ask which cards have that number.  With that knowledge, the magician will magically be able to determine and disclose the original number guessed.

Output the full set of 6 Mystery Calculator cards exactly as follows:

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

Output may or may not contain one final trailing newline.  There must be no trailing whitespace.  Each card is separated by 11 - perforations.

md5sum with final newline: 7aa2d9339b810ec62a2b90c5e11d6f4a
md5sum without final newline: e9abe4e32dca3e8fbfdaa4886fc5efd2

For those of you of more of a windows orientation, I will also allow CRLF style line endings.  In that case, the md5s are:

md5sum with final newline: e4f16ff9752eee2cedb5f97c7b5aec6d
md5sum without final newline: 78c560eed3b83513e3080117ab5dc5fa

Python 2, 99 96 93 91 bytes
k=1
while 1:print('%2d '*7+'%2d\n')*4%tuple(n for n in range(64)if k&n),11/(k<32)*' -';k*=2

Exits with an error, which is allowed by default.
Try it online! or verify the MD5 hash.
How it works
After initializing k as 1, we enter an infinite loop that executes the following code.
print('%2d '*7+'%2d\n')*4%tuple(n for n in range(64)if k&n),11/(k<32)*' -';k*=2

tuple(n for n in range(64)if k&n) creates a tuple of all non-negative integers below 64 that have there jth bit set, where j is the iteration count of the loop, i.e., 2j = k.
('%2d '*7+'%2d\n')*4 first creates the format string '%2d %2d %2d %2d %2d %2d %2d \n', then repeats it four times. This is a template for each card, which pads each integer in the tuple to two characters (prepending spaces), separates each group of 8 integers by spaces, and the groups themselves by linefeeds.
Now, Python 2's print statement is a curious beast. It takes several expressions, separated by commata, and prints them one by one. It evaluates the first expression, prints it, evaluates the next expressions, prints it, etc. until no more expressions are left. Unless the last expression is followed by a comma, it appends a linefeed to it. Also, it prepends a space to all expressions, unless they are printed at the beginning of a line.
In each iteration, we first print the result of applying the format string to the tuple. We're at the beginning of a line, so no space is prepended.
Then, we (attempt to) print the result of 11/(k<32)*' -'. If k < 32, this expressions evaluates to ' - - - - - - - - - - -'. Again, we're at the beginning of a line, so no space is prepended. There is no comma after this expression, so print appends a linefeed. However, in the sixth iteration, k = 25 = 32, so trying to evaluate 11/(k<32)*' -' raises an uncaught ZeroDivisionError. This breaks out of the loop and ends the program immediately.


Can you win with two more moves at Three Men's Morris? Bounties

No. 1 (awarded)

  I'll throw in 50 rep for the first valid answer

No. 2 (awarded)

  I'll throw in another 100 rep for the shortest valid answer.

No. 3 (open for submissions)

  I'll throw in 200 rep for the first one with a significant shorter valid answer.
  Significant being at most 45% of currently shortest answer (564 bytes x 0.45 = max 254 bytes).

The Game

You remember the classic game "Nine Men's Morris" or simply "Mill"? There's a variation called Three Men's Morris which is a bit like a mutable tic-tac-toe.

Rules

This is the blank board of the game:

   a   b   c
1 [ ]–[ ]–[ ]
   | \ | / |
2 [ ]–[ ]–[ ]
   | / | \ |
3 [ ]–[ ]–[ ]

[ ] is a field and |–/\ represent routes between those fields.

The game is played by two players 1 and 2 who each place 3 tokens on the board. This actually happened already and we are in the game. The game is won if one player can form a mill which is a vertical or horizontal row of the player's 3 tokens.

Tokens can be moved on the board along the connecting lines, according to this rule:

  To any adjacent empty position (i.e. from an edge position to the center, or from the center to an edge position, or from an edge position to an adjacent edge position

A player must make a move unless there's no adjacent empty position, in which case the move is skipped.

The Challenge

You're player 1 and your move is next. Write a program or a function, that determines whether:

you can force a win with 2 or less moves (definite win)
you can win with 2 or less moves, if your opponent makes a mistake (possible win)
you cannot win with 2 or less moves, because you'll need more moves or because forced moves lead your opponent to win (impossible to win)

Requirements

Even though you definitely win when you bore your opponent to death, your program must finish in finite time.
You can write a program or a function.

Input

The players are represented by 1 and 2. 0 defines a free field. You can take input as a matrix or an array.

Definite

A         B         C         D
2 1 0  |  2 1 0  |  1 0 1  |  1 2 2
2 1 2  |  0 1 0  |  1 0 2  |  2 1 O
0 0 1  |  2 2 1  |  0 2 2  |  O O 1

A: [2,1,0,2,1,2,0,0,1]
B: [2,1,0,0,1,0,2,2,1]
C: [1,0,1,1,0,2,0,2,2]
D: [1,2,2,2,1,0,0,0,1]

Possible

A         B         C
1 0 1  |  1 0 1  |  1 2 2
1 2 2  |  1 2 0  |  0 0 1
2 0 0  |  2 0 2  |  2 1 0

A: [1,0,1,1,2,2,2,0,0]
B: [1,0,1,1,2,0,2,0,2]
C: [1,2,2,0,0,1,2,1,0]

Impossible

A         B
1 0 0  |  1 2 0
1 2 2  |  2 1 0
2 0 1  |  1 2 0

A: [1,0,0,1,2,2,2,0,1]
B: [1,2,0,2,1,0,1,2,0]

Output

Your program should output/return a smiley:

Definite win: :)
Possible win: :|
Impossible to win: :(

Examples

Definite win in two moves:

[2][1][ ] 1. [2][1][ ]
[2][1][2] -> [2][1][2]
[ ][ ][1]    [ ][1][ ]

[2][1][ ] 1. [2][1][ ]    [ ][1][ ] 2. [ ][ ][1]
[ ][1][ ] -> [ ][ ][1] -> [2][ ][1] -> [2][ ][1]
[2][2][1]    [2][2][1]    [2][2][1]    [2][2][1]

[1][ ][1] 1. [ ][1][1]    [ ][1][1] 2. [1][1][1]
[1][ ][2] -> [1][ ][2] -> [1][ ][2] -> [ ][ ][2]
[ ][2][2]    [ ][2][2]    [2][ ][2]    [2][ ][2]

Possible win in two moves:

[1][ ][1] 1. [ ][1][1]    [ ][1][1] 2. [1][1][1]
[1][2][ ] -> [1][2][ ] -> [1][2][2] -> [ ][2][2]
[2][ ][2]    [2][ ][2]    [2][ ][ ]    [2][ ][ ]

[1][ ][1] 1. [ ][1][1]    [ ][1][1] 2. [1][1][1]
[1][2][ ] -> [1][2][ ] -> [1][2][2] -> [ ][2][2]
[2][ ][2]    [2][ ][2]    [2][ ][ ]    [2][ ][ ]

[1][2][2] 1. [ ][2][2]    [2][ ][2] 2. [1][2][2]
[ ][ ][1] -> [1][ ][1] -> [1][ ][1] -> [1][1][1]
[2][1][ ]    [2][1][ ]    [2][1][ ]    [2][ ][ ]

Impossible to win in two moves:

[1][ ][ ]
[1][2][2]
[2][ ][1]

Bonus

In case a definite win is possible and your program outputs the moves of one way to success as well like a1:a2 (1 move) or a1:a2,a3:b2 (2 moves), you can withdraw 30% of your byte count.

This is code golf – so shortest answer in bytes wins. Standard loopholes are disallowed.

Thanks to Peter Taylor who fixed some flaws and improved wording in the Sandbox.

C# - 739 663 bytes

Complete program, reads input from argv, and appears to work. Run it like

ThreeMill 1 2 1 1 2 0 0 0 2

If this method of input is unacceptable, I'll be glad to change it (never like using argv).

using System;using System.Linq;class P{static void Main(string[]A){var I=new[]{0,3,6,1,4,7,2,5,8};Func<string[],string>J=S=>S[0]+S[1]+S[2]+" "+S[3]+S[4]+S[5]+" "+S[6]+S[7]+S[8]+" ";Func<string[],string,int>W=(B,p)=>(J(B)+J(I.Select(i=>B[i]).ToArray())).Contains(p+p+p)?1:0;Func<string[],string,string[][]>V=(B,p)=>I.SelectMany(a=>I.Where(b=>a!=b&B[a]==p&B[b]=="0"&(a==4|b==4|a-b==3|b-a==3|((a-b==1|b-a==1)&a/3==b/3))).Select(b=>{var N=(string[])B.Clone();N[b]=p;N[a]="0";return N;})).DefaultIfEmpty(B).ToArray();int h,G;Console.WriteLine(":"+"(|))"[V(A,"1").Max(z=>((h=0)<(G=V(z,"2").Sum(j=>V(j,"1").Max(q=>W(q,"1")-W(q,"2"))+h++*0))?1:0)+(h>G?W(z,"1")*2:2))]);}}

I was disinclined to post this yesterday, because I've not been able to golf it down much (not had all that much time, and I might be out of practice), but since there hasn't been a response yet, I'll post it anyway, I certainly don't expect the bounty, I'd rather it went to someone who's put a bit more effort into theirs before posting!

Edit: replaced all the bools with ints, which meant I could make better use of Linq, and managed to collapse both foreach loops, giving big savings. I am slightly amazed that the h counter works... ++ is such a subtle utility.

The program is very simple, it just explores every possible set of moves (stores board state in a string[]). It iterates over all of our possible moves (the boards that result thereof), and counts the number of responses by our opponent that we can successful beat (G) (i.e. those that we win, and he doesn't). It also counts the number of possible responses (h). If we can win any, then it's a possible, and we add 1 to the sum, if we can win them all, it's a definite, and we add 2 to the sum. The maximum some is therefore our best possible outcome, and we index into the string "(|))" to return the appropriate face. Note that we need the extra ")" because the sum can be 2 or 3 if it's a definite (it's possible that we don't appear to be able to beat any responses having already won on the first go, so the possible check is a tad misleading).

The program checks for a victory by producing a string from the board, that is space-separated rows and columns, and just looks for a string of 3 of the player's character in this string (e.g. "201 201 021 220 002 111 " is a win for us)

using System;
using System.Linq; // all important

class P
{
    static void Main(string[]A) // transform to int?
    {
        var I=new[]{0,3,6,1,4,7,2,5,8}; // vertical indexes
        Func<string[],string>J=S=>S[0]+S[1]+S[2]+" "+S[3]+S[4]+S[5]+" "+S[6]+S[7]+S[8]+" "; // joins the strings up, so that there is a space separating each group of three (including at end)
        Func<string[],string,int>W=(B,p)=>(J(B)+J(I.Select(i=>B[i]).ToArray())).Contains(p+p+p)?1:0; // checks if a particular player wins
        Func<string[],string,string[][]>V=(B,p)=>I.SelectMany(a=>I // for each imagineable move
            .Where(b=>a!=b&B[a]==p&B[b]=="0"&(a==4|b==4|a-b==3|b-a==3|((a-b==1|b-a==1)&a/3==b/3))) // where it's legal
            .Select(b=>{var N=(string[])B.Clone();N[b]=p;N[a]="0";return N;}) // select the resulting board
        ).DefaultIfEmpty(B) // allow not-moving
        .ToArray();

        int h, // h stores the number of responses the opponent has to each move
        G; // G stores the number of responses by the opponent we can beat

        Console.WriteLine(":"+"(|))"[ // we index into this to decide which smiley
            V(A,"1").Max(z=>
                    ((h=0)<(G=V(z,"2").Sum(j=>V(j,"1").Max(q=>W(q,"1")-W(q,"2"))+h++*0))?1:0) // if there is atleast 1 reponse by the opponent we can beat, we can possibly win
                    +(h>G?W(z,"1")*2:2) // if there are moves which we can't win, then if we have already won (one-move), else, we can definitely win
                   ) // sum is therefore 0 if impossible, 1 if possible, >2 (no more than 3) if definite
            ]);

    }
}

Here is my test script:

ThreeMill 2 1 0 2 1 2 0 0 1
ThreeMill 2 1 0 0 1 0 2 2 1
ThreeMill 1 0 1 1 0 2 0 2 2
ThreeMill 1 2 2 2 1 0 0 0 1

ThreeMill 1 0 1 1 2 2 2 0 0
ThreeMill 1 0 1 1 2 0 2 0 2
ThreeMill 1 2 2 0 0 1 2 1 0

ThreeMill 1 0 0 1 2 2 2 0 1
ThreeMill 1 2 1 1 2 0 0 0 2
ThreeMill 1 0 1 2 0 2 1 0 2

Which outputs

:)
:)
:)
:)
:|
:|
:|
:(
:|
:)


Pseudo-cyclic Number Evaluator For the purposes of this challenge, let's define a cyclic number as an integer that passes the basic part of Midy's Theorem, but not necessarily the extended theorem. This means:

  the digits in the second half of the repeating decimal period are [integer is] the 9s complement of the corresponding digits in its first half

In other words,
142857 is a cyclic number because 142 + 857 = 999 and 13358664 is a cylic number because 1335 + 8664 = 9999.

The Challenge

Given an even-digit integer n > 10, determine whether n is a cyclic number by our definition. If it is, return something truthy. If it's not, return the closest cyclic number to n.

Example:

> 18
True
> 133249
132867

This is code golf, so shortest code wins.

Python 2, 73

n=input()
e=10**(len(`n`)/2)-1
N=n/e+n%e*2/e;N-=N>e+1
print n==N*e or N*e

A six-digit pseudo-cyclic number like 637362 is pseudo-cyclic exactly if it's a multiple of 999, except for 999999. So, we're looking for the multiple of 999 nearest to the input n. In general, replace 999 with e, which is one less that 10**(num_digits/2).

The nearest multiple below can n be found with integer division as n/e*e. We check whether to round up with n%e*2/e, which is 1 if n%e is closer to e, and 0 if it's closer to 0. In the latter case, we add e. We also handle the 999999 case by subtract if N is too large.

Finally, before printing, we check if the original number was a multiple of e and thus already pseudo-cyclic.


Find the rows which make each column have one True (was: Knuth's Algorithm X) Task
Given a Boolean matrix, find one (or optionally more) subset(s) of rows which have exactly one True in each column. You may use any algorithm, but must support very large matrices, like the last example.
One possible algorithm (Knuth's Algorithm X)
While there is no requirement to use this algorithm, it may be your best option.

If the matrix A has no columns, the current partial solution is a valid solution; terminate successfully.
Otherwise choose a column c.
Choose* a row r such that Ar, c = 1.
Include row r in the partial solution.
For each column j such that Ar, j = 1,
 for each row i such that Ai, j = 1,
  delete row i from matrix A.
 delete column j from matrix A.
Repeat this algorithm recursively on the reduced matrix A.

* Step 3 is non-deterministic, and needs to be backtracked to in the case of a failure to find a row in a later invocation of step 3.
Input
Any desired representation of the minimum 2×2 matrix A, e.g. as a numeric or Boolean array
1 0 0 1 0 0 1
1 0 0 1 0 0 0
0 0 0 1 1 0 1
0 0 1 0 1 1 0
0 1 1 0 0 1 1
0 1 0 0 0 0 1

or as Universe + Set collection
U = {1, 2, 3, 4, 5, 6, 7}
S = {
    A = [1, 4, 7],
    B = [1, 4],
    C = [4, 5, 7],
    D = [3, 5, 6],
    E = [2, 3, 6, 7],
    F = [2, 7]
    }

or as 0 or 1 indexed sets;
{{1, 4, 7}, {1, 4}, {4, 5, 7}, {3, 5, 6}, {2, 3, 6, 7}, {2, 7}}.
Output
Any desired representation of one (or optionally more/all) of the solutions, e.g. as numeric or Boolean array of the selected rows
1 0 0 1 0 0 0
0 0 1 0 1 1 0
0 1 0 0 0 0 1

or as Boolean list indicating selected rows {0, 1, 0, 1, 0, 1} or as numeric (0 or 1 indexed) list of selected rows {2, 4, 6} or as list of set names ['B', 'D', 'F'].
More examples
In:
1 0 1
0 1 1
0 1 0
1 1 1

Out: 1 3 or 4 or 1 0 1 0 or 0 0 0 1 or [[1,3],[4] etc.

In:
1 0 1 0 1
0 1 0 1 0
1 1 0 0 1
0 1 0 1 1

Out: 1 1 0 0 etc.

In:
0 1 0 1 1 0 1
1 1 0 0 1 1 1
0 1 0 0 1 0 0
1 1 1 0 0 0 1
0 0 0 1 1 1 0

Out: 0 0 0 1 1 etc.

In:
0 1 1
1 1 0

Out: Nothing or error or faulty solution, i.e. you do not have to handle inputs with no solution.

In: http://pastebin.com/raw/3GAup0fr
Out: 0 10 18 28 32 38 48 61 62 63 68 86 90 97 103 114 120 136 148 157 162 174 177 185 186 194 209 210 218 221 228 243 252 255 263 270 271 272 273 280 291 294 295 309 310 320 323 327 339 345 350 353 355 367 372 373 375 377 382 385 386 389 397 411 417 418 431 433 441 451 457 458 459 466 473 479 488 491 498 514 517

In: https://gist.github.com/angs/e24ac11a7d7c63d267a2279d416bc694
Out: 553 2162 2710 5460 7027 9534 10901 12281 12855 13590 14489 16883 19026 19592 19834 22578 25565 27230 28356 29148 29708 30818 31044 34016 34604 36806 36918 39178 43329 43562 45246 46307 47128 47906 48792 50615 51709 53911 55523 57423 59915 61293 62087 62956 64322 65094 65419 68076 70212 70845 71384 74615 76508 78688 79469 80067 81954 82255 84412 85227

Haskell, 100 93 92 87 83 80 bytes

Knuth's algorithm:

g&c=filter(g.any(`elem`c))
(u:v)%a=[c:s|c<-id&u$a,s<-(not&c)v%(not&c$a)]
x%_=[x]

Calculates all covers nondeterministically depth-first in the list monad. Use head to calculate only one since Haskell is lazy. Usage:

*Main> [[1],[2],[3],[4],[5],[6],[7]]%[[1, 4, 7], [1, 4], [4, 5, 7], [3, 5, 6], [2, 3, 6, 7], [2, 7]]
[[[1,4],[2,7],[3,5,6]]]

For more speed by using Knuth's suggestion of selecting column with least ones, use this: (115 bytes, flat list for universe). Finds first solution to the large pentomino cover problem in under a minute when compiled.

import Data.List
[]%_=[[]]
w%a=[c:s|c<-a,c\\(head.sortOn length.group.sort$w:a>>=id)/=c,s<-(w\\c)%[b|b<-a,c\\b==c]]

Thanks to @Zgarb for saving 1+3 bytes!

Thanks to @ChristianSievers for his sage advice and saving 5 bytes and some.

Ungolfed (with flat list universe):

knuthX [] _ = [[]]
knuthX (u:niverse) availableRows = --u chosen deterministically
  [ chosen:solution
  | let rows = filter (elem u) availableRows
  , chosen <- rows  --row chosen nondeterministically in list monad
  , solution <- knuthX
                  (filter (not.(`elem`chosen)) niverse)
                  (filter (not.any(`elem`chosen)) availableRows)
  ]


English to Alien translator Briefing

Aliens have settled on earth and strangely enough, their alphabet is the exact same as ours. Their language is also very similar to ours with some very distinct and easy to compute differences.

Challenge

Take a string and output the alien's language equivalent. The translation works as such:

Swap all the vowels in the word with the corresponding:

  Vowel |   With
--------+--------
   a    |   obo
   e    |   unu
   i    |   ini
   o    |   api
   u    |   iki

You may also write another translator to translate Alien->English, this is optional however.

Examples

Input: Shaun
Output: Shoboikin

Input: Java
Output: Jobovobo

Input: Hello, World!
Output: Hunullapi, Wapirld!

If the vowel is capitalized then you capitalize the first letter..

Input: Alan
Output: Obolobon

Input: Australia
Output: Oboikistroboliniobo

Rules

Standard loopholes apply
Must work for text that contains new lines
You can either write a function, lambda, or full program

Capingrobotikilobotiniapins apin wrinitining thunu runuvunursunu trobonslobotapir!

Haskell, 100 91 bytes
(>>= \x->last$[x]:[y|(z:y)<-words"aobo eunu iini oapi uiki AObo EUnu IIni OApi UIki",z==x])


This is the sort of challenge that bytes I need to stop thinking of punny names

Your task is to create as many snippets (programs that have input and output built-in), functions or full programs as possible that sorts whatever your language's version of integer arrays is in ascending order, but for each program, you're only allowed to use the characters in ASCII (or your language's code page, if it's directly specified as not ASCII) which haven't been used in the previous programs.

This is an example answer (separate programs separated by newlines):

Derp
ASdFGHJKLAAA
qwEEERtyRty

In this (fictional language), my first answer is Derp, which used up D, e, r and p. In the second program, I'm not allowed to use those character again, but I can reuse as many characters I want. Same with the third program, and so on.

Each program must take an array of integers, so something like this (see input/output examples for valid input/output styles):

[3 4 -2 5 7 196 -44 -2]

And it must output the items in the array as an array, in ascending order:

[-44 -2 -2 3 4 5 7 196]

Your score will be the total amount of submissions. If there is a tie, the lowest bytecount (least amount of bytes in your code) wins!

Rules for programs:

All submissions must run correctly in one language version (so Python 2 != Python 3).
Your submissions can be snippets, functions, or full programs. You're even allowed to mix and match them - however, you must say which is which, and provide links to working submissions.
Please provide online links to all solutions, if possible.
All submissions must take an array (or a string delimited with any character) as input, and output the array sorted (in your language's array form or as a {any character}-delimited string.
You are not allowed to use any characters outside of ASCII (or your language's code page).

For example, these are valid inputs/outputs:

[1 2 3 4]    (Clojure style arrays)
[1, 2, 3, 4] (Python style arrays)
1 2 3 4 5    (Space-delimited - separated by spaces)
1#2#3#4#5    ("#"-delimited - separated by "#" characters)
1\n2\n3\n4\n (newline-delimited)

Specs for input:

You are guaranteed that the array contains only integers. However, there may be negative numbers, and numbers may repeat indefinitely.

Jelly, 8 programs

Ṣ                   Built-in sort.
¹Þ                  Sort-by the identity function.
Ụị                  Sort indices by values, then index into list.
Œ!Ṃ                 Smallest permutation.
7778Ọv              Eval Unicode 7778 (Ṣ).
ẊI>@-.S$$¿          Bogosort.
<;0œṡ0⁸ṁjµ/         Insertion sort.
AṀ‘¶+Ç©ṬT_©®³ċÐ€®x' A terrifying hack.

The last program is really annoying…

AṀ‘¶+Ç©               Add ® = abs(max(L)) + 1 to the entire list.
                      Now it’s offset to be entirely positive.
       Ṭ              Create a binary array with 1s at these indices.
        T             Find the indices of 1s in this array.
                      The result is sorted, but offset wrong, and lacks duplicates.
         _©®          Subtract the offset, saving this list to ®.
                      Now restore the duplicates:
            ³ċÐ€      Count occurences in the original list.
                ®x'   Repeat the elements of ® that many times.

If I can remove the œṡ from <;0œṡ0⁸ṁjµ/, there’s also this weird one: ²SNr²ZFœ&. Help is appreciated.


Reversing and Shifting Sandbox

Adapted from exercise 8 of 100 little Keg exercises

String manipulation is a very important part of any programming language. Consequently, that is what this challenge is about.

The Challenge

I want you to write a program that:

Takes a series of characters as input and,
Then takes another input (integer/letter) (we'll call this instruction) and,
Takes a single integer (we'll call this times) as the last input and then,
If instruction is equal to the letter R:

Reverse the string times times.

Otherwise, if instruction is equal to the letter l:

Shift the string left times times

Otherwise, for all other values of instruction:

Shift the string right times times

Test Cases

String, Instruction, Times -> Output
"Howdy!", R, 1 -> "!ydwoH"
"elloH", r, 1 -> "Hello"
"tedShif", l, 3 -> "Shifted"
"sn't it?Amazing, i", l, 8 -> "Amazing, isn't it?"

Rules

Input can be taken as any convenient format... if a list of three items works best for you, take the input as a list. If newline-separated input is how you choose to work, go ahead and use newline-separated input.
The string, instruction and times integer can be taken in any order
Output is also to be given in any convenient format.
The input string will not contain newlines, nor unprintable ascii characters.
You can substitute R and l for any other two characters, as long as you specify what the two characters are
All instructions are case sensitive. In other words, only input of R should reverse the string, not r.
The magnitude of a shift will always be less than the length of the string
The times integer is a positive integer (i.e. \$ n > 0 \$)

Scoring

This is code-golf, so the answer with the fewest bytes wins.

Python 3.8 (pre-release), 65 bytes

lambda s,i,t:[s[(n:=[-t,t][i=='l']):]+s[:n],s[::(-1)**t]][i=='R']

Try it online!

Abuses the de-facto ternary statement [a,b][condition].

If i=='R':

Return the string, read with step (-1)**t. This is -1 (reversed) for odd t and 1 (not reversed) for even t.

Else:

Let n be [-t,t][i=='l']. This is t when left-shifting and -t otherwise (right-shifting).
Return the string, spliced accordingly: s[n:] + s[:n]. Thanks to Python's negative indexing, this works like a charm for both cases.


Check if a string is a shuffle of twins Explanation

Two strings can be shuffled by interspersing their letters to form a new string, much like two piles of cards can be shuffled to form a single pile.

For example, the strings HELLO and WORLD can be shuffled to form HWEOLRLLOD, or HEWORLLLDO, or perhaps simply HELLOWORLD.

It is not a shuffle if the original order of letters is not preserved. For example, the D in WORLD cannot ever appear before the R after being shuffled. This means that EHLLOWRDLO, for instance, is not a shuffle of HELLO and WORLD, even though it contains all the original letters.

A string is a shuffle of twins if it can be formed by shuffling two identical strings. For example, ABACBDECDE is a shuffle of twins because it can be formed by shuffling ABCDE and ABCDE. DBEACBCADE is not a shuffle of twins because it cannot be formed by shuffling two identical strings.

Program Details

Given an input string, output 0 if it is not a shuffle of twins, and output one of the twin strings if it is a shuffle of twins.

You may assume that the input string has a length inclusively between four and twenty characters and is composed entirely of uppercase alphabetic characters. It should be able to run in a reasonable amount of time, say, under 10 minutes.

This is code golf, so the shortest solution wins.

Example I/O

> ABACBDECDE
ABCDE

> DBEACBCADE
0

> FFFFFF
FFF

> FFGGG
0

> ABBA
0

> AABB
AB

> AABAAB
AAB

I have an example (non-golfed) implementation.

Haskell, 114

main=getLine>>=putStrLn.f.p;f x=head$[a|(a,b)<-x,a==b]++["0"]
p[]=[([],[])];p(x:y)=do(a,b)<-p y;[(x:a,b),(a,x:b)]

Ungolfed:

main :: IO ()
main = getLine >>= putStrLn . findMatch . partitions

-- | Find the first partition where the two subsequences are
-- equal. If none are, return "0".
findMatch :: [(String, String)] -> String
findMatch ps = head $ [a | (a,b) <- ps, a == b] ++ ["0"]

-- | Return all possible partitions of the input into two
-- subsequences. Preserves the order of each subsequence.
--
-- Example:
-- partitions "AB" == [("AB",""),("B","A"),("A","B"),("","AB")]
partitions :: [a] -> [([a], [a])]
partitions []     = [([], [])]
partitions (x:xs) = do (a, b) <- partitions xs
                       [(x:a, b), (a, x:b)]

Explanation:

Most of the work is being done in the partitions function. It works by
recursively generating all partitions (a, b) of the tail of the list,
and then using the list monad to prepend the initial element x to each of
them and gather all the results.

findMatch works by filtering this list so that only partitions where the
subsequences are equal remain. It then returns the first subsequence in the first
partition. If none remain, the list is empty, so the "0" appended at the
end gets returned instead.

main just reads the input, feeds it through these two functions and prints it.


Cut a pizza into identical slices This is what I thought this question was going to be, before I fully read it.

A group of code golfers walk into The Nineteenth Bite Pizzeria and order a pizza. It comes in an irregular shape, made of unit squares. Your task is to help them cut it into identical slices. That is, the slices must have the exact same shape and size; they can be rotated but not flipped/mirrored. For example, if they are Tetris pieces, they must be the same kind, you can't use both an L piece and a J piece.

Input

You will be given the number of people in the group on the first line (always an integer from 2 to 10, inclusive), followed by a rectangular matrix of ' ' (space) and '#' characters, representing the pizza. All the '#' characters are connected through their edges. The number of '#' characters is guaranteed to be a multiple of the number of people.

Output

You should print the same matrix, with each '#' character replaced with a digit from 0 to n-1 (n being the number of people). Each digit should mark a slice. The slice shape must be connected through the square edges. The slice numbering doesn't need to be in any particular order. If there are multiple ways of cutting the pizza, any of them is acceptable.
If it's not possible to cut the pizza as required, you should print the string "No pizza for you!" instead.

Scoring

This is code golf. Your score will be the number of bytes in the program. Characters will be counted through their UTF-8 encoding. Lowest score wins.

Examples

Input:

3
 #
###
####
   #

Output:

 0
100
1122
   2

Input:

4
###
# #
###

Output:

001
2 1
233

Input:

2
#    #
######

Output:

No pizza for you!

Input:

5
    #
   ####
  #####
 #####
#####
####
  #

Output:

    0
   1000
  21110
 32221
43332
4443
  4

Input:

4
   #
 ####
######
  #####
  ####

Output:

   0
 1000
111203
  12233
  2233

Requirements

You should write a full program that reads from the standard input and writes to the standard output.
The program must be runnable in Linux using freely available software.
Your program should finish each of the above examples in less than 1 minute on a modern computer.
No standard loopholes.

PHP code, 1808 971 bytes

Quick and dirty implementation in PHP. First brute-force all possible slice shapes, next brute-force all positions and orientations of the slices.

Usage: cat pizza.txt | php pizza.php

Edit: reduced code size by more than 45% by rewring algorithm using recursion rather than nested loops. However, this eats memory (and pizza's ;-)). Pizza's larger than 8x8 will probably run out of memory. The nested loop variant can easily handle any size, but is twice the code size.

<?php define('A',98);$n=fgets(STDIN);$d=array();$m=$u=str_pad('',A,'+');$s=0;while($g=fgets(STDIN)){$g=rtrim($g);assert(strlen($g)<=A-2);$s++;$m.='+'.str_pad(rtrim($g),A-2,' ').'+';for($l=0;$l<strlen($g);$l++)if($g[$l]=='#')$d[]=$s*A+$l+1;}$m.=$u;$r=count($d)/$n;x(reset($d),array(array()),0,0,0,0);die('No pizza for you!');function x($e,$c,$b,$a,$q,$t){global$r,$m,$d;$h=$a*A+$b;if(!in_array($e+$h,$d))return;if(in_array($h,$c[0]))return;$c[0][]=$h;$c[1][]=$b*A-$a;$c[2][]=-$a*A-$b;$c[3][]=-$b*A+$a;if(count($c[0])<$r)do{x($e,$c,$b+1,$a,$b,$a);x($e,$c,$b,$a+1,$b,$a);x($e,$c,$b-1,$a,$b,$a);x($e,$c,$b,$a-1,$b,$a);$v=($b!=$q||$a!=$t);$b=$q;$a=$t;}while($v);else w($c,$m,0,reset($d),0);}function w(&$p,$f,$o,$e,$i){global$n,$d;foreach($p[$i]as$h){$j=$e+$h;if(!isset($f[$j])||$f[$j]!='#')return;$f[$j]=chr(ord('0')+$o);}if(++$o==$n){for($k=A;$k<strlen($f)-A;$k++)if($k%A==A-1)echo PHP_EOL;else if($k%A)echo$f[$k];exit;}foreach($d as$j)for($i=0;$i<4;$i++)w($p,$f,$o,$j,$i);}

Ungolfed, documented code

Below is the documented, original code. To keep my sanity, I worked with the full source code, and wrote a simple minifier script to strip statements like assert() and error_reporting(), remove unnecessary brackets, rename variables, functions and constants to generate the golfed code above.

<?php
error_reporting(E_ALL) ;

// Width of each line of pizza shape.
// Constant will be reduced to single character by minifier,
// so the extra cost of the define() will be gained back.
define('WIDTH', 98) ;

// Read number of slices
$nrSlices = fgets(STDIN) ;

// Read pizza shape definition and
// convert to individual $positionList[]=$y*width+$x and
// linear (1D) $pizzaShape[$y*WIDTH+$x] with protective border around it.
//
// WARNING: assumes maximum pizza width of WIDTH-2 characters!
$positionList = array() ;
$pizzaShape = $headerFooter = str_pad('', WIDTH, '+') ;
$y = 0 ;
while ($line = fgets(STDIN))
{  $line = rtrim($line) ;
   assert(strlen($line) <= WIDTH-2) ;
   $y++ ;
   $pizzaShape .= '+'.str_pad(rtrim($line), WIDTH-2, ' ').'+' ;
   for ($x = 0 ; $x < strlen($line) ; $x++)
   {  if ($line[$x] == '#') $positionList[] = $y*WIDTH + $x+1 ;
   }
}
$pizzaShape .= $headerFooter ;

// Determine size of a slice
$sliceSize = count($positionList)/$nrSlices ;

// Build all possible slice shapes. All shapes start with their first part at
// the top of the pizza, and "grow" new parts in all directions next to the
// existing parts. This continues until the slice has the full size. This way
// we end up with all shapes that fit at the top of the pizza.
//
// The shape is defined as the offsets of the parts relative to the base
// position at the top of the pizza. Offsets are defined as linear offsets in
// the 1-D $pizzaShape string.
//
// For efficiency, we keep track of all four possible rotations while building
// the slice shape.
//
growSlice(reset($positionList), array(array()), 0, 0, 0, 0) ;
die('No pizza for you!') ;

function growSlice($basePosition, $shapeDeltas, $dx, $dy, $prevDx, $prevDy)
{  global $sliceSize, $pizzaShape, $positionList ;

   // Check validity of new position
   // Abort if position is not part of pizza, or
   // if position is already part of slice
   $delta = $dy*WIDTH + $dx ;
   if (!in_array($basePosition+$delta, $positionList)) return ;
   if (in_array($delta, $shapeDeltas[0])) return ;

   // Add all four rotations to shapeDeltas[]
   $shapeDeltas[0][] = $delta ;
   $shapeDeltas[1][] = $dx*WIDTH - $dy ;
   $shapeDeltas[2][] = -$dy*WIDTH - $dx ;
   $shapeDeltas[3][] = -$dx*WIDTH + $dy ;

   // Have we built a full slice shape?
   if (count($shapeDeltas[0]) < $sliceSize)
   {  // Grow shape either at current position or at previous position
      do
      {  growSlice($basePosition, $shapeDeltas, $dx+1, $dy,   $dx, $dy) ;
         growSlice($basePosition, $shapeDeltas, $dx,   $dy+1, $dx, $dy) ;
         growSlice($basePosition, $shapeDeltas, $dx-1, $dy,   $dx, $dy) ;
         growSlice($basePosition, $shapeDeltas, $dx,   $dy-1, $dx, $dy) ;
         $retry = ($dx != $prevDx || $dy != $prevDy) ;
         $dx = $prevDx ;
         $dy = $prevDy ;
      } while ($retry) ;
   } else
   {  // Try to cover the entire pizza by translated and rotated instances of
      // the slice shape.
      fitSlice($shapeDeltas, $pizzaShape, 0, reset($positionList), 0) ;
   }
}

function fitSlice(&$shape, $pizza, $id, $basePosition, $rotation)
{  global $nrSlices, $positionList ;

   // Try to fit each part of the slice onto the pizza. If the part falls
   // outsize the pizza, or overlays another slice we reject this position
   // and rotation. If it fits, we mark the $pizza[] with the slice $id.
   foreach ($shape[$rotation] as $delta)
   {  $position = $basePosition + $delta ;
      if (!isset($pizza[$position]) || $pizza[$position] != '#') return ;
      $pizza[$position] = chr(ord('0')+$id) ;
   }

   // If $nrSlices slices have been fitted, we have found a valid solution!
   // In that case, we display the solution and quit.
   if (++$id == $nrSlices)
   {  for ($pos = WIDTH ; $pos < strlen($pizza)-WIDTH ; $pos++)
      {  if ($pos % WIDTH == WIDTH-1) echo PHP_EOL ;
         else if ($pos % WIDTH) echo $pizza[$pos] ;
      }
      exit ;
   }

   // The current slice did fit, but we have still more slices to fit.
   // Try all positions and rotations for the next slice.
   foreach ($positionList as $position)
   {  for ($rotation = 0 ; $rotation < 4 ; $rotation++)
      {  fitSlice($shape, $pizza, $id, $position, $rotation) ;
      }
   }
}


A boring version of yourself A boring version of yourself
Have you ever dreamed of a boring version of you which types the text you just typed ?
No ? Because that's exactly what I'm challenging you to do !
The program needs to check how many time it took for the user to input a text at program launch and then retype the text again using the same period of time (approximatively).
Here's my Python3 implementation with additional information :
import time

start = time.time()
userInput = input("Cool human input :")
endHuman = time.time() - start
duration =  endHuman / len(userInput)
start = time.time()
print("Boring robot input : ", end="")
for i in userInput:
  print(i, end="")
  time.sleep(duration)
end = time.time() - start
print()
print(endHuman, "vs", end)

This is a code-challenge so be creative !
Here are the rules :

User must input the initial text, no program args
Text input length is > 0 (No need to check)
The sleep duration between each letter is not imposed, it can be (timeTookByUser / numberOfLetters) like in my implementation, it can be random (as long as the total time is approximatively equal), it can sleep for the total time at first and then print all (but it's not fun).
The "robot timer" must stop when the last letter is typed by the robot, you can't print everything and then sleep and end the program.
As long as the robot prints the text passed in input, you can print other stuff (additional informations etc..)
You don't have to use the console, you can input the text using a graphical text input and render it letter by letter using DELs but you will have to specify it in your answer
Be creative !

Bash + linux utilities, 37
This will measure the time taken to enter each character (including backspaces) and play back verbatim.  Use ^C or ^D to end user input.
script -qta -csed\ d
scriptreplay -ta

Creates a temporary files typescript and a in the current directory.


Partial factorisations of a positive integer A collection of positive integers d_1 d_2 ... d_k is a factorisation of a positive integer n if

d_1 * d_2 * ... * d_k = n

Each positive integer has a unique prime factorisation, but in general they also have factorisations in which some of the terms are composite. E.g.

12 = 6 * 2 = 4 * 3 = 3 * 2 * 2

Write a program, function, verb, or similar which takes as input a single positive integer and returns or prints a complete list of its distinct factorisations. The factorisations may be produced in any order, and their terms may be in any order, but no two should be permutations of each other. Factorisations may not include 1 with two exceptions: for input n you may give the factorisation n*1 instead of n; and for input 1 you may give the factorisation 1 instead of the empty list.

You may assume that the input will be in the range of a signed 32-bit integer. If the output is as a string, there should be a clear distinction between the delimitation of numbers within a factorisation and the delimitation of the factorisations, but it is not necessary (for example) for the factors to be joined with an *.

Your code should be capable of handling any valid input within 10 minutes on a reasonable desktop machine.

Examples

1                  [[]]
                or [[1]]
                or [[1 1]]

7                  [[7]]
                or [[7 1]]
                or [[1 7]]

12                 [[12] [6 2] [4 3] [2 3 2]]
                or variants

16                 [[2 2 2 2] [2 2 4] [2 8] [4 4] [16]]
                or variants

901800900          a list of 198091 factorisations

1338557220         a list of 246218 factorisations

Haskell, 56 bytes

_!1=[[]]
i!n=[j:f|j<-[i..n],mod n j<1,f<-j!div n j]
(2!)

(2!)(1338557220::Int) prints in five minutes on my laptop, when compiled with ghc -O3.

Haskell, 62 bytes, but much faster

i!n|i*i>n=[[n]]|0<1=[i:f|mod n i<1,f<-i!div n i]++(i+1)!n
(2!)

(2!)(1338557220::Int) prints in a quarter of a second on my laptop, when compiled with ghc -O3.