This "sandbox" is a place where Code Golf users can get feedback on prospective challenges they wish to post to main. This is useful because writing a clear and fully specified challenge on your first try can be difficult, and there is a much better chance of your challenge being well received if you post it in the sandbox first.

Sandbox FAQ


To post to the sandbox, scroll to the bottom of this page and click "Answer This Question". Click "OK" when it asks if you really want to add another answer.

Write your challenge just as you would when actually posting it, though you can optionally add a title at the top. You may also add some notes about specific things you would like to clarify before posting it. Other users will help you improve your challenge by rating and discussing it.

When you think your challenge is ready for the public, go ahead and post it, and replace the post here with a link to the challenge and delete the sandbox post.


The purpose of the sandbox is to give and receive feedback on posts. If you want to, feel free to give feedback to any posts you see here. Important things to comment about can include:

  • Parts of the challenge you found unclear
  • Comments addressing specific points mentioned in the proposal
  • Problems that could make the challenge uninteresting or unfit for the site

You don't need any qualifications to review sandbox posts. The target audience of most of these challenges is code golfers like you, so anything you find unclear will probably be unclear to others.

If you think one of your posts requires more feedback, but it's been ignored, you can ask for feedback in The Nineteenth Byte. It's not only allowed, but highly recommended! Be patient and try not to nag people though, you might have to ask multiple times.

It is recommended to leave your posts in the sandbox for at least several days, and until it receives upvotes and any feedback has been addressed.


Search the sandbox / Browse your pending proposals

The sandbox works best if you sort posts by active.

To add an inline tag to a proposal, use shortcut link syntax with a prefix: [tag:king-of-the-hill]. To search for posts with a certain tag, include the name in quotes: "king-of-the-hill".

  • \$\begingroup\$ What if I posted on the sandbox a long time ago and get no response? \$\endgroup\$
    – None1
    Commented May 15 at 14:05
  • \$\begingroup\$ @None1 If you don't get feedback for a while you can ask in the nineteenth byte \$\endgroup\$
    – mousetail
    Commented May 29 at 13:27

4703 Answers 4703

143 144
146 147

How healthy are my children?

As anyone who has twins will know, it can be hard to keep track of which child fed / was changed, and when.

That's why I've devised a system using OneNote on my phone. It's quick and easy to use.

Each entry (line) uses the following structure (note: I'm not a regex expert and the expression is more permissive than I want - see words for detail):

(ddMMyyyy )?HHmm ((1|2|B) (💧|💩|🤱){1,3}){1,3}

Or, in words:

  1. For the first entry on or after midnight each day only, each line starts with the date.
  2. The next component is always the time, hour and minute in 24 hour clock format
  3. Next is a child identifier character - 1 or 2; or B if what follows applies to both children. All subsequent emoticons apply to the identified child, until a new child identifier is found or a newline. There is guaranteed to be at least one child identifier in a record.
  4. Next comes any or all of the three emoticons (maximum one of each) representing a wet nappy (💧), a dirty nappy (💩) or a feed (🤱)
  5. Repeat from step 3. until done. BUT - each emoticon will only appear once per child - so if it appears in B then it won't appear in either 1 or 2; and if it appears in either 1 or 2 it won't appear in B. It won't appear in both 1 and 2 (because then it would be in B instead). The regex doesn't show this subtlety.

Some other notes:

  • Breast-Feeding (feed) emoticon 🤱 is codepoint U+1F931
  • Droplet (wet) emoticon 💧 is codepoint U+1F4A7
  • Pile of Poo (dirty) emoticon 💩 is codepoint U+1F4A9
  • All items in the string are space-separated
  • I would actually use the initials of my children's names, rather than 1 and 2 - but for the challenge I went with the numbers instead.


02022020 0005 1 💩 B 💧 🤱
0230 2 💧 🤱
0250 1 💧 💩 🤱
0330 2 🤱
0400 1 🤱
0700 B 💧 🤱
0900 2 🤱
1000 2 💧 🤱
1020 1 💧 🤱
1220 1 🤱
1420 B 💧 1 💩 2 🤱
1440 1 🤱
1600 2 💧 💩
1700 1 💧
1745 B 🤱
2100 B 💧 🤱 1 💩
2350 2 🤱 B 💩 1 💧
03022020 0015 1 🤱 B 💧
0500 1 💧 🤱
0830 1 💧 🤱
0900 2 💧 🤱
1115 B 💧 1 💩
1215 B 🤱
1330 B 🤱
1400 2 💧 💩

The Challenge

Given the raw data, input as a single string or array of entries, containing data such as the above example, output a summary of:

  • number of feeds, wet and dirty nappies, per baby, over the past 24 hours

"The past 24 hours" can be either based on system time, or the current time can be passed as an extra input.

The output format is up to you, as long as it:

a) is consistent across all runs of the program
b) shows the information required

some example outputs for the above inputs, with a current time of 14:30 on 3rd of February 2020 (hand-calculated, sorry if they're not right!):

Baby 1 had 6 wet nappies, 2 dirty nappies, and fed 8 times Baby 2 had 6 wet nappies, 3 dirty nappies and fed 6 times




This is so lowest bytes wins. Usual exclusions apply.

  • \$\begingroup\$ If a language can't deal with unicode input, should I allow the whole codepoint string substituted in its place? \$\endgroup\$ Commented Feb 14, 2020 at 11:59
  • \$\begingroup\$ Should I be more explicit with the output format? \$\endgroup\$ Commented Feb 14, 2020 at 12:00
  • \$\begingroup\$ Can someone help me make the regex more tight? \$\endgroup\$ Commented Feb 14, 2020 at 12:05

I want to ask a combined popularity / objectively scored question. Something like:

Take a string as input. Match the string to a famous painting such as "Mona Lisa" and render a cartoon version of it. 1 point per painting, 1 point per upvote. Voting closes on XX/YY/ZZZZ.

I want to reward people for including more possibilities (there will be a fixed upper limit, unlike with paintings). I also want to reward people for the quality of their renderings. The cartoon paintings should be recognisable as versions of the real paintings.

Is this a good scoring system? If not, what would be better?

  • 1
    \$\begingroup\$ This is somewhat vague. Can you be more precise? \$\endgroup\$ Commented Feb 17, 2020 at 15:38

Implement PSL(2,3)

Since challenge to implement Galois field already have been many, I'm writing a challenge involving a group of Lie type!


Implement the multiplication and inversion in \$\text{PSL}(2,3)\$.

The ring \$\mathbb{Z}_3\$

The ring \$\mathbb{Z}_3\$ is the set \$\{0,1,2\}\$ with addition, negation, subtraction, and multiplication defined as modular arithmetic:

  • Addition is the usual addition with the result moduloed by 3;

  • Negation, subtraction, and multiplication are also analogously defined.

Reciprocal and division is also well-defined, but that's just another detail.

The group \$\text{SL}(2,3)\$

The multiplicative group \$\text{SL}(2,3)\$ is the set of 2-by-2 matrices whose entries are members of \$\mathbb{Z}_3\$ and the determinant is \$1\$. Note that the determinant is calculated using modular arithmetic. Matrix multiplication and matrix inversion is defined as:

  • Matrix multiplication is the usual matrix multiplication, where addition and multiplication of the entries are modular;

  • Matrix inversion of \$\begin{pmatrix} a & b \\ c & d \end{pmatrix}\$ is \$\begin{pmatrix} d & -b \\ -c & a \end{pmatrix}\$. This exploits that the determinant is \$1\$.

As a consequence, the elements of \$\text{SL}(2,3)\$ are:

$$\begin{pmatrix} 0 & 1 \\ 2 & 0\end{pmatrix}, \begin{pmatrix} 0 & 1 \\ 2 & 1\end{pmatrix}, \begin{pmatrix} 0 & 1 \\ 2 & 2\end{pmatrix}, \begin{pmatrix} 0 & 2 \\ 1 & 0\end{pmatrix}, \begin{pmatrix} 0 & 2 \\ 1 & 1\end{pmatrix}, \begin{pmatrix} 0 & 2 \\ 1 & 2\end{pmatrix}, \begin{pmatrix} 1 & 0 \\ 0 & 1\end{pmatrix}, \begin{pmatrix} 1 & 0 \\ 1 & 1\end{pmatrix}, \begin{pmatrix} 1 & 0 \\ 2 & 1\end{pmatrix}, \begin{pmatrix} 1 & 1 \\ 0 & 1\end{pmatrix}, \begin{pmatrix} 1 & 1 \\ 1 & 2\end{pmatrix}, \begin{pmatrix} 1 & 1 \\ 2 & 0\end{pmatrix}, \begin{pmatrix} 1 & 2 \\ 0 & 1\end{pmatrix}, \begin{pmatrix} 1 & 2 \\ 1 & 0\end{pmatrix}, \begin{pmatrix} 1 & 2 \\ 2 & 2\end{pmatrix}, \begin{pmatrix} 2 & 0 \\ 0 & 2\end{pmatrix}, \begin{pmatrix} 2 & 0 \\ 1 & 2\end{pmatrix}, \begin{pmatrix} 2 & 0 \\ 2 & 2\end{pmatrix}, \begin{pmatrix} 2 & 1 \\ 0 & 2\end{pmatrix}, \begin{pmatrix} 2 & 1 \\ 1 & 1\end{pmatrix}, \begin{pmatrix} 2 & 1 \\ 2 & 0\end{pmatrix}, \begin{pmatrix} 2 & 2 \\ 0 & 2\end{pmatrix}, \begin{pmatrix} 2 & 2 \\ 1 & 0\end{pmatrix}, \begin{pmatrix} 2 & 2 \\ 2 & 1\end{pmatrix} $$

The factor group \$\text{PSL}(2,3)\$

\$\text{PSL}(2,3)\$ is defined as cosets of \$\text{SL}(2,3)\$ by \$\{\begin{pmatrix} 1 & 0 \\ 0 & 1\end{pmatrix}, \begin{pmatrix} 2 & 0 \\ 0 & 2\end{pmatrix}\}\$. That is, elementwise multiplications of \$\{\begin{pmatrix} 1 & 0 \\ 0 & 1\end{pmatrix}, \begin{pmatrix} 2 & 0 \\ 0 & 2\end{pmatrix}\}\$. They are: $$ \{\begin{pmatrix} 0 & 1 \\ 2 & 0\end{pmatrix}, \begin{pmatrix} 0 & 2 \\ 1 & 0\end{pmatrix}\}, \{\begin{pmatrix} 0 & 1 \\ 2 & 1\end{pmatrix}, \begin{pmatrix} 0 & 2 \\ 1 & 2\end{pmatrix}\}, \{\begin{pmatrix} 0 & 1 \\ 2 & 2\end{pmatrix}, \begin{pmatrix} 0 & 2 \\ 1 & 1\end{pmatrix}\}, \{\begin{pmatrix} 1 & 0 \\ 0 & 1\end{pmatrix}, \begin{pmatrix} 2 & 0 \\ 0 & 2\end{pmatrix}\}, \{\begin{pmatrix} 1 & 0 \\ 1 & 1\end{pmatrix}, \begin{pmatrix} 2 & 0 \\ 2 & 2\end{pmatrix}\}, \{\begin{pmatrix} 1 & 0 \\ 2 & 1\end{pmatrix}, \begin{pmatrix} 2 & 0 \\ 1 & 2\end{pmatrix}\}, \{\begin{pmatrix} 1 & 1 \\ 0 & 1\end{pmatrix}, \begin{pmatrix} 2 & 2 \\ 0 & 2\end{pmatrix}\}, \{\begin{pmatrix} 1 & 1 \\ 1 & 2\end{pmatrix}, \begin{pmatrix} 2 & 2 \\ 2 & 1\end{pmatrix}\}, \{\begin{pmatrix} 1 & 1 \\ 2 & 0\end{pmatrix}, \begin{pmatrix} 2 & 2 \\ 1 & 0\end{pmatrix}\}, \{\begin{pmatrix} 1 & 2 \\ 0 & 1\end{pmatrix}, \begin{pmatrix} 2 & 1 \\ 0 & 2\end{pmatrix}\}, \{\begin{pmatrix} 1 & 2 \\ 1 & 0\end{pmatrix}, \begin{pmatrix} 2 & 1 \\ 2 & 0\end{pmatrix}\}, \{\begin{pmatrix} 1 & 2 \\ 2 & 2\end{pmatrix}, \begin{pmatrix} 2 & 1 \\ 1 & 1\end{pmatrix}\}, $$

You pick an element of each coset as representives, and don't care about the rest.

Multiplication/inversion of such representives is defined as multiplication/inversion in \$\text{SL}(2,3)\$, then taking the representive of the coset the multiplication/inversion is in. For example, \$\begin{pmatrix} 0 & 1 \\ 2 & 0\end{pmatrix}^2 = \begin{pmatrix} 1 & 0 \\ 0 & 1\end{pmatrix}\$, if \$\begin{pmatrix} 0 & 1 \\ 2 & 0\end{pmatrix}\$ and \$\begin{pmatrix} 1 & 0 \\ 0 & 1\end{pmatrix}\$ are representives.


Picking the left elements as representives of the cosets above: $$ \begin{pmatrix} 0 & 1 \\ 2 & 0\end{pmatrix}^2 = \begin{pmatrix} 1 & 0 \\ 0 & 1\end{pmatrix}, \begin{pmatrix} 0 & 1 \\ 2 & 1\end{pmatrix}^2 = \begin{pmatrix} 1 & 2 \\ 1 & 0\end{pmatrix}, \begin{pmatrix} 1 & 0 \\ 0 & 1\end{pmatrix}\begin{pmatrix} 1 & 1 \\ 1 & 2\end{pmatrix} = \begin{pmatrix} 1 & 1 \\ 1 & 2\end{pmatrix}, \begin{pmatrix} 1 & 2 \\ 2 & 2\end{pmatrix}\begin{pmatrix} 1 & 1 \\ 1 & 2\end{pmatrix} = \begin{pmatrix} 0 & 1 \\ 2 & 0\end{pmatrix}, \begin{pmatrix} 1 & 2 \\ 2 & 2\end{pmatrix}^{-1} = \begin{pmatrix} 1 & 2 \\ 2 & 2\end{pmatrix} $$ To be more specific about the method of evaluation: $$ \begin{pmatrix} 0 & 1 \\ 2 & 1\end{pmatrix}\begin{pmatrix} 0 & 1 \\ 2 & 2\end{pmatrix} ≡ \begin{pmatrix} 2 & 2 \\ 2 & 4\end{pmatrix} ≡ \begin{pmatrix} 2 & 2 \\ 2 & 1\end{pmatrix} ≡ \begin{pmatrix} 1 & 1 \\ 1 & 2\end{pmatrix}, \\ \begin{pmatrix} 1 & 1 \\ 1 & 2\end{pmatrix}^{-1} ≡ \begin{pmatrix} 2 & -1 \\ -1 & 1\end{pmatrix} ≡ \begin{pmatrix} 2 & 2 \\ 2 & 1\end{pmatrix} ≡ \begin{pmatrix} 1 & 1 \\ 1 & 2\end{pmatrix} $$ The steps of this algorithm is:

  1. Do usual matrix multiplication/inversion;
  2. Modulo the entries by 3;
  3. Take the representive of the coset.

Though you can make any possible algorithm.


  • Input type and format doesn't matter, but it must be a container of integers. In C, int[2][2] and int[4] are valid examples. This restriction prevents abusing the fact that \$\text{PSL}(2,3) \cong A_4\$.
  • Output type and format doesn't matter either, but it must be the same as the input type and format.
  • Invalid inputs fall in don't care situation.
  • Multiplication and inversion may be in separate codes. In this case, the score is the sum of their lengths in bytes.
  • Since this is a code-golf, the code with least score wins.
  • \$\begingroup\$ This challenge appears to heavily rely on restricted-source and thus to me does not seem too viable. \$\endgroup\$ Commented Feb 25, 2020 at 0:58
  • 1
    \$\begingroup\$ @JonathanFrech Do you think I should lift the restriction on input type? Otherwise, "You pick an element of each coset as representives, and don't care about the rest" and "Invalid inputs fall in don't care situation" should be enough. \$\endgroup\$ Commented Feb 25, 2020 at 3:38

Very rough outline of a challenge that rewards short programs that take a long time.

Probably a no input and output can be anything except an error challenge.

Is there a nice way to exclude things like sleep(), wait() etc?

Would be required for 1 person to run all the programs for the timing to be fair.

Thinking that answers would include loops, recursion, testing of complex criteria.

  • 1
    \$\begingroup\$ I think you would have to post your challenge as a popularity contest ... a slippery slope indeed. \$\endgroup\$ Commented Mar 15, 2020 at 23:43

Numbers by index


Print the numbers:


In that order.


Takes no input. The numbers can have any delimiters desired (or none). Example outputs:




Code Example

This is an un-golfed example that may perhaps act as algorithm guide (or maybe not):

Turing Machine Code, 553 bytes

0 * 0 r K
K * _ r 1
1 * 1 r L
L * _ r 2
2 * 2 r a
a * 2 r M
M * _ r 3
3 * 3 r b
b * 3 r c
c * 3 r N
N * _ r 4
4 * 4 r d
d * 4 r e
e * 4 r f
f * 4 r O
O * _ r 5
5 * 5 r g
g * 5 r h
h * 5 r i 
i * 5 r j
j * 5 r P
P * _ r 6
6 * 6 r k
k * 6 r l
l * 6 r m
m * 6 r n
n * 6 r o
o * 6 r Q
Q * _ r 7
7 * 7 r p
p * 7 r q
q * 7 r r
r * 7 r s
s * 7 r t
t * 7 r u
u * 7 r R
R * _ r 8
8 * 8 r v
v * 8 r w
w * 8 r x
x * 8 r y
y * 8 r z
z * 8 r A
A * 8 r B
B * 8 r S
S * _ r 9
9 * 9 r C
C * 9 r D
D * 9 r E
E * 9 r F
F * 9 r G
G * 9 r H
H * 9 r I
I * 9 r J
J * 9 r halt

Try it online!

This prints out the numbers with a space delimiter:

0 1 22 333 4444 55555 666666 7777777 88888888 999999999

Challenge Type

, so shortest answer in bytes (by language) wins.

Edit: Link to the related challenge. Curiously, there is one answer on there where if it was by index, and the zero was included, it would be shorter.

  • 1
    \$\begingroup\$ Nice challenge! Are preceding & trailing whitespace (during string output) permitted? \$\endgroup\$
    – user92069
    Commented Mar 11, 2020 at 3:22
  • \$\begingroup\$ I think it should also be kolgomorov-complexity. \$\endgroup\$
    – PkmnQ
    Commented Mar 11, 2020 at 5:19
  • 6
    \$\begingroup\$ I don't like how the zero breaks the pattern of having the digit N appear N times -- it seems like an exceptional edge case. I think it would be better for 0 not to appear, so the numbers would just start from 1. \$\endgroup\$
    – xnor
    Commented Mar 11, 2020 at 7:06
  • 1
    \$\begingroup\$ @xnor, I knew you wouldn't like it (and probably a few other won't as well) That's on purpose. It just seems a little too easy otherwise. \$\endgroup\$
    – ouflak
    Commented Mar 11, 2020 at 7:28
  • \$\begingroup\$ @a'_', Yes. @ PkmnQ, Noted. \$\endgroup\$
    – ouflak
    Commented Mar 11, 2020 at 7:29
  • \$\begingroup\$ I don't really see how adding a fixed zero to the beginning makes the challenge harder in almost any language. In some, the empty string will actually convert to zero, which makes it more natural but still fairly trivial. I feel like you probably either want to go with omitting the zero, or finding a different way to make the challenge more complicated. \$\endgroup\$ Commented Mar 11, 2020 at 14:53
  • \$\begingroup\$ @FryAmTheEggman, How can you have a challenge about indexes and not have zero? That just seems wrong. \$\endgroup\$
    – ouflak
    Commented Mar 11, 2020 at 15:31
  • \$\begingroup\$ Most people start counting from one - only people who use computers a lot default to starting at zero. And separately, I think finding another way to incorporate it is better than leaving it out (I just also think both are better than having an unexplained outlier). \$\endgroup\$ Commented Mar 11, 2020 at 15:40
  • \$\begingroup\$ @FryAmTheEggman, But it's not really unexplained is it? It's the index of the first number. \$\endgroup\$
    – ouflak
    Commented Mar 11, 2020 at 15:46
  • 1
    \$\begingroup\$ As per what xnor said, it doesn't match the pattern of the others. That behaviour is not explained. Comments aren't really for a discussion like this; if you disagree that is fine. I've just given feedback on how I think you could improve the challenge. \$\endgroup\$ Commented Mar 11, 2020 at 16:15
  • \$\begingroup\$ I do want to make sure that everyone knows that I am VERY grateful for the feedback! I also appreciate having a Sandbox where we can have this discussion here instead of on the main site. \$\endgroup\$
    – ouflak
    Commented Mar 11, 2020 at 16:18
  • \$\begingroup\$ @FryAmTheEggman, It's not that I disagree. I kind of agree. I like that leading zero in there to represent the index location of the initial value. I considered this when I thought of the question, before posting it here. It breaks up a trivial loop sequence answer a bit, or maybe even inspires a clever solution that nobody considered. I'd like to keep it because it stands out like that, not despite that. \$\endgroup\$
    – ouflak
    Commented Mar 11, 2020 at 16:21
  • \$\begingroup\$ I posted an example implementation above. The zero wasn't a big deal. \$\endgroup\$
    – ouflak
    Commented Mar 11, 2020 at 16:31
  • 1
    \$\begingroup\$ My guess is that you're excited about the arithmetic expression 10**n/9*n or similar. But I don't think that's much more interesting than the obvious loops that removing the zero would allow unmodified. \$\endgroup\$
    – xnor
    Commented Mar 11, 2020 at 21:59
  • 1
    \$\begingroup\$ @ouflak I contrast, I am very excited about arithmetic expressions :) \$\endgroup\$
    – xnor
    Commented Mar 12, 2020 at 21:16

A malbolge interpreter

The challenge today is to write a Malbolge interpreter.


'98, Ben Olmstead

I hereby relenquish any and all copyright on this language,
documentation, and interpreter; Malbolge is officially public domain.


                           '98, Ben Olmstead


It was noticed that, in the field of esoteric programming languages,
there was a particular and surprising void: no programming language
known to the author was specifically designed to be difficult to program

Certainly, there were languages which were difficult to write in, and
far more were difficult to read (see: Befunge, False, TWDL, RUBE...).
But even INTERCAL and BrainF***, the two kings of mental torment, were
designed with other goals: INTERCAL to have nothing in common with any
major programming language, and BrainF*** to be a very tiny, yet still
Turing-complete, language.

INTERCAL's constructs are certainly tortuous, but they are all too
flexible; you can, for instance, quite easily assign any number to a
variable with a single statement.

BrainF*** is lacking the flexibility which is INTERCAL's major weakness,
but it fails in that its constructs are far, far too intuitive.
Certainly, there are only 8 instructions, none of which take any
arguments--but it is quite easy to determine how to use those
instructions.  Subtract 8 from the current number?  With a simple
'--------' you are done!  This kind of simple answer was unacceptable to
the author.

Hence the author created Malbolge.  It borrows from machine, BrainF***,
and tri-INTERCAL, but put together in a unique way.  It was designed to
be difficult to use, and so it is.  It is designed to be
incomprehensible, and so it is.

So far, no Malbolge programs have been written.  Thus, we cannot give an

"Malbolge" is the name of Dante's Eighth Circle of Hell, in which
practitioners of deception (seducers, flatterers, simonists, thieves,
hypocrites, and so on) spend eternity.


In many languages, the environment is easy to understand.  In Malbolge,
it is best to understand the runtime environment before you ever see a

The environment is, roughly, that of a primitive trinary CPU.  Both code
and data share the same space (the machine's memory segment), and there
are three registers.  Machine words are ten trits (trinary digits) wide,
giving a maximum possible value of 59048 (all numbers are unsigned).
Memory space is exactly 59049 words long.

The three registers are A, C, and D.  A is the accumulator, used for
data manipulation.  A is implicitly set to the value written by all
write operations on memory.  (Standard I/O, a distinctly non-chip-level
feature, is done directly with the A register.)

C is the code pointer.  It is automatically incremented after each
instruction, and points the instruction being executed.

D is the data pointer.  It, too, is automatically incremented after each
instruction, but the location it points to is used for the data
manipulation commands.

All registers begin with the value 0.

When the interpreter loads the program, it ignores all whitespace.  If
it encounters anything that is not one of an instruction and is not
whitespace, it will give an error, otherwise it loads the file, one non-
whitespace character per cell, into memory.  Cells which are not
initialized are set by performing op on the previous two cells


When the interpreter tries to execute a program, it first checks to
see if the current instruction is a graphical ASCII character (33
through 126).  If it is, it subtracts 33 from it, adds C to it, mods it
by 94, then uses the result as an index into the following table of 94


It then checks it against the characters listed below, and performs an
appropriate action.

If the result is not one of the characters listed below, it is treated
as a nop.  If the original character is not graphic ASCII, the program
is immediately ended.

When the interpreter parses the input file, it checks each non-
whitespace character with the process above.  If any result is not one
of the eight characters below, the file will be rejected.

After the instruction is executed, 33 is subtracted from the instruction
at C, and the result is used as an index in the table below.  The new
character is then placed at C, and then C is incremented.


  sets the data pointer to the value in the cell pointed to by the
  current data pointer.

  sets the code pointer to the value in the cell pointed to be the
  current data pointer.

  rotates the trinary value of the cell pointed to by D to the right 1.
  The least significant trit becomes the most significant trit, and all
  others move one position to the left.

  performs a tritwise "op" on the value pointed to by D with the
  contents of A.  The op (don't look for pattern, it's not there) is:

            | A trit:
          0 | 1  0  0
      *D  1 | 1  0  2
     trit 2 | 2  2  1

    00 01 02 10 11 12 20 21 22

00  04 03 03 01 00 00 01 00 00
01  04 03 05 01 00 02 01 00 02
02  05 05 04 02 02 01 02 02 01
10  04 03 03 01 00 00 07 06 06
11  04 03 05 01 00 02 07 06 08
12  05 05 04 02 02 01 08 08 07
20  07 06 06 07 06 06 04 03 03
21  07 06 08 07 06 08 04 03 05
22  08 08 07 08 08 07 05 05 04

  reads an ASCII value from the stdin and converts it to Trinary, then
  stores it in A.  10 (line feed) is considered 'newline', and
  2222222222t (59048 dec.) is EOF.

  converts the value in A to ASCII and writes it to stdout.  Writing
  10 is a newline.

  indicates a full stop for the machine.

  does nothing, except increment C and D, as all other instructions do.


Though I have not proven it, I _think_ Malbolge to be Turing-complete.
To be Turing-complete, there must be some data construct which can be
used to do any mathematical calculation.  I believe that using *p in
various clever ways on the tritwords can fulfill this requirement.

Turing-completeness also requires three code constructs: sequential
execution (which Malbolge obviously has), repetition (provided by the
i and, indirectly, j instructions), and conditional-execution (provided,
I believe, by self-modifying code and altering i destinations).

I do have my doubts, particularly about data constructs, but I *think*
this works...

Appendix: Trinary Conversion Table

Trinary to ASCII to decimal to hex table, provided, strangely enough,
for the convenience of Malbolge programmers.

00000 NUL 000 00    01012   032 20    02101 @ 064 40    10120 ` 096 60
00001 SOH 001 01    01020 ! 033 21    02102 A 065 41    10121 a 097 61
00002 STX 002 02    01021 " 034 22    02110 B 066 42    10122 b 098 62
00010 ETX 003 03    01022 # 035 23    02111 C 067 43    10200 c 099 63
00011 EOT 004 04    01100 $ 036 24    02112 D 068 44    10201 d 100 64
00012 ENQ 005 05    01101 % 037 25    02120 E 069 45    10202 e 101 65
00020 ACK 006 06    01102 & 038 26    02121 F 070 46    10210 f 102 66
00021 BEL 007 07    01110 ' 039 27    02122 G 071 47    10211 g 103 67
00022 BS  008 08    01111 ( 040 28    02200 H 072 48    10212 h 104 68
00100 HT  009 09    01112 ) 041 29    02201 I 073 49    10220 i 105 69
00101 LF  010 0a    01120 * 042 2a    02202 J 074 4a    10221 j 106 6a
00102 VT  011 0b    01121 + 043 2b    02210 K 075 4b    10222 k 107 6b
00110 FF  012 0c    01122 , 044 2c    02211 L 076 4c    11000 l 108 6c
00111 CR  013 0d    01200 - 045 2d    02212 M 077 4d    11001 m 109 6d
00112 SO  014 0e    01201 . 046 2e    02220 N 078 4e    11002 n 110 6e
00120 SI  015 0f    01202 / 047 2f    02221 O 079 4f    11010 o 111 6f
00121 DLE 016 10    01210 0 048 30    02222 P 080 50    11011 p 112 70
00122 DC1 017 11    01211 1 049 31    10000 Q 081 51    11012 q 113 71
00200 DC2 018 12    01212 2 050 32    10001 R 082 52    11020 r 114 72
00201 DC3 019 13    01220 3 051 33    10002 S 083 53    11021 s 115 73
00202 DC4 020 14    01221 4 052 34    10010 T 084 54    11022 t 116 74
00210 NAK 021 15    01222 5 053 35    10011 U 085 55    11100 u 117 75
00211 SYN 022 16    02000 6 054 36    10012 V 086 56    11101 v 118 76
00212 ETB 023 17    02001 7 055 37    10020 W 087 57    11102 w 119 77
00220 CAN 024 18    02002 8 056 38    10021 X 088 58    11110 x 120 78
00221 EM  025 19    02010 9 057 39    10022 Y 089 59    11111 y 121 79
00222 SUB 026 1a    02011 : 058 3a    10100 Z 090 5a    11112 z 122 7a
01000 ESC 027 1b    02012 ; 059 3b    10101 [ 091 5b    11120 { 123 7b
01001 FS  028 1c    02020 < 060 3c    10102 \ 092 5c    11121 | 124 7c
01002 GS  029 1d    02021 = 061 3d    10110 ] 093 5d    11122 } 125 7d
01010 RS  030 1e    02022 > 062 3e    10111 ^ 094 5e    11200 ~ 126 7e
01011 US  031 1f    02100 ? 063 3f    10112 _ 095 5f

11202 128 80    12221 160 a0    21010 192 c0    22022 224 e0
11210 129 81    12222 161 a1    21011 193 c1    22100 225 e1
11211 130 82    20000 162 a2    21012 194 c2    22101 226 e2
11212 131 83    20001 163 a3    21020 195 c3    22102 227 e3
11220 132 84    20002 164 a4    21021 196 c4    22110 228 e4
11221 133 85    20010 165 a5    21022 197 c5    22111 229 e5
11222 134 86    20011 166 a6    21100 198 c6    22112 230 e6
12000 135 87    20012 167 a7    21101 199 c7    22120 231 e7
12001 136 88    20020 168 a8    21102 200 c8    22121 232 e8
12002 137 89    20021 169 a9    21110 201 c9    22122 233 e9
12010 138 8a    20022 170 aa    21111 202 ca    22200 234 ea
12011 139 8b    20100 171 ab    21112 203 cb    22201 235 eb
12012 140 8c    20101 172 ac    21120 204 cc    22202 236 ec
12020 141 8d    20102 173 ad    21121 205 cd    22210 237 ed
12021 142 8e    20110 174 ae    21122 206 ce    22211 238 ee
12022 143 8f    20111 175 af    21200 207 cf    22212 239 ef
12100 144 90    20112 176 b0    21201 208 d0    22220 240 f0
12101 145 91    20120 177 b1    21202 209 d1    22221 241 f1
12102 146 92    20121 178 b2    21210 210 d2    22222 242 f2
12110 147 93    20122 179 b3    21211 211 d3
12111 148 94    20200 180 b4    21212 212 d4
12112 149 95    20201 181 b5    21220 213 d5
12120 150 96    20202 182 b6    21221 214 d6
12121 151 97    20210 183 b7    21222 215 d7
12122 152 98    20211 184 b8    22000 216 d8
12200 153 99    20212 185 b9    22001 217 d9
12201 154 9a    20220 186 ba    22002 218 da
12202 155 9b    20221 187 bb    22010 219 db
12210 156 9c    20222 188 bc    22011 220 dc
12211 157 9d    21000 189 bd    22012 221 dd
12212 158 9e    21001 190 be    22020 222 de
12220 159 9f    21002 191 bf    22021 223 df


Note that the original specification has one quirk: after encountering an illegal instruction, the interpreter hangs. You may choose which behaviour do you want to implement (hang or exit).

I/O rules

The program or function has to take input in any reasonable way (for the program), and somehow supply the input and output features to the malbolge program (either by return value / parameter, tty or a file).

Sandbox stuff

note: I'm a bit unsure about the scoring criterion: would popularity-contest be good? I'm mostly looking for creative answers

  • \$\begingroup\$ add interpreter ? \$\endgroup\$
    – Wezl
    Commented Apr 30, 2020 at 22:00
  • \$\begingroup\$ I think popularity-contest would be adding Do X creatively to an already relatively non-interesting challenge [unless if you somehow managed to create a Malbolge self-interpreter and that is the trick you're planning to use to win your own competition with it :) ] \$\endgroup\$ Commented May 1, 2020 at 2:15
  • \$\begingroup\$ hmm right; I'm not planning on submitting a malbolge interpreter on malbolge :P, I'd like to see what people can think of. Also I've been thinking about fastest-code contest that would possibly allow me to switch my tolling a bit :P \$\endgroup\$ Commented May 1, 2020 at 10:54
  • \$\begingroup\$ I'd probably participate if this was [fastest-code], but I doubt there are enough interesting optimizations here. \$\endgroup\$ Commented May 2, 2020 at 3:26
  • \$\begingroup\$ there is a lot of room for optimization, you just need to investigate the challenge a little bit further \$\endgroup\$ Commented May 2, 2020 at 17:46

Write two programs (likely functions since IO for float convert to/from stream, losing info as mentioned later), one given \$n\geq 2\$ real points on a 2D plane, returning \$2n-3\$ real numbers; another given the \$2n-3\$ real numbers, return the same shape and size given to first program. Order of points matters. Returning a mirrored shape is fine.

You must use an in-language float and assume it is infinitely precise, but converting to types like string or trying to handle the bits in RAM truncate the precision. There's no requirements on how you map, so you can even just pack some real numbers into one if your language happens to have way to do that.

  • \$\begingroup\$ Should the last sentence be "you can't"? \$\endgroup\$
    Commented Jun 16, 2020 at 11:43
  • \$\begingroup\$ Is the rotation (orientation) important? (if it doesn't, I assume that it's possible to use 2n-4 real numbers?) \$\endgroup\$
    Commented Jun 16, 2020 at 11:44
  • \$\begingroup\$ @user202729 Rotation not important, size important. You are allowed if able, but as I know no language do that \$\endgroup\$
    – l4m2
    Commented Jun 16, 2020 at 12:38
  • \$\begingroup\$ But it's not an observable behavior (although there's no built-in for it, it's possible to simply interleave the digits, while it's not possible to do it in finite time for irrational floating point numbers -- alternatively you can assume that only coordinates with finite binary representation are valid input). You can require that the mapping is (almost everywhere) continuous, however. \$\endgroup\$
    Commented Jun 16, 2020 at 13:26
  • \$\begingroup\$ Can I use multiple floating point types in a language (e.g. float and double in C)? \$\endgroup\$
    – Bubbler
    Commented Jun 17, 2020 at 3:39
  • \$\begingroup\$ @Bubbler What may it be used to? \$\endgroup\$
    – l4m2
    Commented Jun 17, 2020 at 6:33
  • \$\begingroup\$ Combine two floats into a double at the bit level. \$\endgroup\$
    – Bubbler
    Commented Jun 17, 2020 at 6:49
  • \$\begingroup\$ @Bubbler It'll likely result in nan \$\endgroup\$
    – l4m2
    Commented Jun 17, 2020 at 6:54
  • \$\begingroup\$ No, simple concatenation of two floats (not a NaN or Infinity) is guaranteed to give a value that is neither NaN nor Infinity. cf. Single, Double \$\endgroup\$
    – Bubbler
    Commented Jun 17, 2020 at 7:12
  • \$\begingroup\$ @Bubbler Anyway now doing such lose precision \$\endgroup\$
    – l4m2
    Commented Jun 17, 2020 at 7:15
  • \$\begingroup\$ OK, that would work. \$\endgroup\$
    – Bubbler
    Commented Jun 17, 2020 at 7:19
  • \$\begingroup\$ (you didn't answer my last question.) \$\endgroup\$
    Commented Jun 17, 2020 at 10:16
  • \$\begingroup\$ @user202729 How 2n-4? \$\endgroup\$
    – l4m2
    Commented Jun 17, 2020 at 10:34
  • \$\begingroup\$ No, the latter question about unobservable behavior. \$\endgroup\$
    Commented Jun 17, 2020 at 10:59
  • \$\begingroup\$ @user202729 What does the it refer? \$\endgroup\$
    – l4m2
    Commented Jun 17, 2020 at 11:29

What day is it today?

Given a date y4y3y2y1-m2m1-d2d1, output the day in the week w. 0 as Sunday, 1 as Monday, and so on. You can assume the date is valid, and we use the current date rule and leap rule.

Each submission should be written in this specific programming language:

  • A program consists of a mapping from string of digits to digits, and a sequence of instructions.
  • Each instruction has the format: var=[var|dgt],[var|dgt],...,[var|dgt], which assigns the value of looking up the string constructed by concatenating the values of the right hand side elements ([var|dgt],[var|dgt],...,[var|dgt]) together in the table and put it into the var on the left.

A program is valid if:

  • None of the lookup step fails for all valid input date.
  • Given any valid date in the format mentioned above (initially assigned to the 8 variables y4 y3 y2 y1 m2 m1 d2 d1), after the program is run, the correct result is assigned to the variable w.

You can create as many variables as you like(though bounded by amount of instructions), each variable only containing a digit.

Solution win if there's no strictly better solution, aka. no solution that take less or same amount of items in mapping table, less or same amount of instrucions, and at least one of amounts of items and instructions is less.

For example, this is a solution that wins:

3652425 items 1 instruction

003000101 -> 6
003000102 -> 0
003000103 -> 1
993991231 -> 5

Here, the 3 on 3rd position can be used without any extra cost. This can be used to create multiple mappings, and sometimes save elements when there are more mapping instructions.

A checker is provided here.

  • \$\begingroup\$ I completely don't understand the entire You can have a mapping table and some instructions, each instruction write var=[var|dgt],[var|dgt],...,[var|dgt], meaning search the element [var|dgt],[var|dgt],...,[var|dgt]from table and put i into the var on the left. Failure on searching is not allowed. You can create as many variables as you like(though bounded by amount of instructions), each variable only containing a digit. part. \$\endgroup\$ Commented Jun 15, 2020 at 8:32
  • \$\begingroup\$ I'm very confused about this. Are you sure you're not making assumptions about language features? \$\endgroup\$
    – Adám
    Commented Jun 15, 2020 at 8:32
  • \$\begingroup\$ @Adám I'm requiring using only this language \$\endgroup\$
    – l4m2
    Commented Jun 15, 2020 at 8:40
  • \$\begingroup\$ @mypronounismonicareinstate That mainly mean the only operation is lookup, there's nothing like plus, multiply or whatever \$\endgroup\$
    – l4m2
    Commented Jun 15, 2020 at 8:41
  • \$\begingroup\$ @l4m2 I still do not understand a word. The whole proposal definitely requires a serious rewrite. \$\endgroup\$ Commented Jun 15, 2020 at 8:42
  • 2
    \$\begingroup\$ @mypronounismonicareinstate If it hadn't needed some more time it isn't here \$\endgroup\$
    – l4m2
    Commented Jun 15, 2020 at 8:45
  • \$\begingroup\$ "Solution win if there's no strictly better solution" is not a valid winning criterion because it allows multiple winners. \$\endgroup\$
    – Bubbler
    Commented Jun 15, 2020 at 9:23
  • \$\begingroup\$ @Bubbler Multiple winners is common \$\endgroup\$
    – l4m2
    Commented Jun 15, 2020 at 9:34
  • \$\begingroup\$ @l4m2 Do you mean something like ties in code golf? IMO, code golf ties are fine because they can be seen as equally good, while your criterion is not because it allows potentially multiple answers that can't be compared to each other at all. \$\endgroup\$
    – Bubbler
    Commented Jun 15, 2020 at 9:44
  • \$\begingroup\$ @Bubbler I mean like multiple languages each only comparing to self \$\endgroup\$
    – l4m2
    Commented Jun 15, 2020 at 9:50
  • \$\begingroup\$ @l4m2 The winning criterion is the guide to optimize one's solution in one direction. "Shortest solution in each language wins" does not harm this spirit. Yours don't give which one to optimize for: mapping table size or instruction size? \$\endgroup\$
    – Bubbler
    Commented Jun 15, 2020 at 10:05
  • \$\begingroup\$ @Bubbler Your link claims you wrong \$\endgroup\$
    – l4m2
    Commented Jun 15, 2020 at 11:59
  • \$\begingroup\$ @l4m2 OK, let me say it in a different way. You already showed a "winning" solution with minimal instructions. Then there will be a "winning" solution with minimal table, and then there can be thousands of "winning" solutions in between. Given any "winning" solution, one can tweak a little to get another "winning" solution. Do you really think it is fun? \$\endgroup\$
    – Bubbler
    Commented Jun 15, 2020 at 23:02
  • \$\begingroup\$ @Bubbler Yea an exact bound of table size for each instruction count, if exist, makes its sense \$\endgroup\$
    – l4m2
    Commented Jun 16, 2020 at 5:06
  • \$\begingroup\$ @Bubbler You don't like to see lots of winners because you think "win" is a big issue? \$\endgroup\$
    – l4m2
    Commented Jun 16, 2020 at 5:06

Natural Language Identification Using Only Regular Expressions

For example:

const regex = /English(?=\w+ Hello World)|Spanish(?= Hola Mundo)/;

console.log('EnglishSpanish Hello World'.match(regex)); // English
console.log('EnglishSpanish Hola Mundo'.match(regex)); // Spanish

These wordlists are to be used, and words are to be rewritten entirely using the ASCII characters A-Z and a-z. Languages which use characters that cannot be easily transcribed into ASCII without special knowledge or firsthand experience in that language, are excluded.

For instance, the Albanian word is easily transcribed without special knowledge as te, so Albanian is allowed.

But the Arabic word من cannot be, so Arabic is excluded.

The regular expression must match the language exactly, so appending a list of all languages you are testing before each word is allowed. But however you organize this list, it must be the same for every word you test. See the example above for clarification.

Sandbox Questions

Ideally, brevity of regex, accuracy of language identification, and number of languages taken into account by the regex should all be considered when determining the winner. But I have not decided on that yet, and am very open to suggestions.

In fact this is my first sandbox post and I hope someone can help me format this properly with good rules so that it makes for an interesting and fun challenge. I got this idea from some other contest somewhere where the goal was to identify languages with at least 60% accuracy. But I can't find it anymore.

  • \$\begingroup\$ So only regex submissions are allowed? \$\endgroup\$
    Commented Jul 22, 2020 at 6:02
  • 1
    \$\begingroup\$ Although there are options to "weight" the 3 scores differently, the easiest way is to require the other two scores to be larger than some limit (say, at least 2 languages and at least 60%) then compete for the shortest regex. \$\endgroup\$
    Commented Jul 22, 2020 at 6:04
  • \$\begingroup\$ Also, are there any similar challenge before? \$\endgroup\$
    Commented Jul 22, 2020 at 6:05
  • \$\begingroup\$ Yes, only regex is allowed. A very similar challenge I've found is this: codegolf.stackexchange.com/questions/49596/… \$\endgroup\$
    – GirkovArpa
    Commented Jul 22, 2020 at 6:26
  • \$\begingroup\$ Also this one, which is linked in the other: codegolf.stackexchange.com/questions/42206/… \$\endgroup\$
    – GirkovArpa
    Commented Jul 22, 2020 at 6:27
  • \$\begingroup\$ Pretty similar. But the huge size of the word list will make the solutions different. \$\endgroup\$
    Commented Jul 22, 2020 at 6:33
  • \$\begingroup\$ you should specify a particular flavor of regex. \$\endgroup\$
    Commented Jul 22, 2020 at 6:34
  • 1
    \$\begingroup\$ I would have said JavaScript but I thought there could be a winner for each programming language? \$\endgroup\$
    – GirkovArpa
    Commented Jul 22, 2020 at 6:35
  • 1
    \$\begingroup\$ If you decide to restrict to 2 languages, you may ask for a regex that matches words from list 1 and not match words from list 2. (it may (do anything|never matches) the words that are not in lists) \$\endgroup\$
    Commented Jul 22, 2020 at 6:37
  • \$\begingroup\$ Good idea, I'll do that. \$\endgroup\$
    – GirkovArpa
    Commented Jul 22, 2020 at 6:39

Rage Against the Dying of the Light


"Do not go gentle into that good night" is the title of a poem by 20th century English poet Dylan Thomas. If you've heard it before it was probably because you watched Interstellar, where it was quoted multiple times.


Your program (or function), if it chooses to not go gently, should take no input and print the following text, with an optional trailing newline:

Do not go gentle into that good night,
Old age should burn and rave at close of day;
Rage, rage against the dying of the light.

Though wise men at their end know dark is right,
Because their words had forked no lightning they
Do not go gentle into that good night.

Good men, the last wave by, crying how bright
Their frail deeds might have danced in a green bay,
Rage, rage against the dying of the light.

Wild men who caught and sang the sun in flight,
And learn, too late, they grieved it on its way,
Do not go gentle into that good night.

Grave men, near death, who see with blinding sight
Blind eyes could blaze like meteors and be gay,
Rage, rage against the dying of the light.

And you, my father, there on the sad height,
Curse, bless, me now with your fierce tears, I pray.
Do not go gentle into that good night.
Rage, rage against the dying of the light.

This is , so smallest code in bytes wins.


  • Is this too bland/simple of a challenge? There's a lot of potential for compressing the poem, but it's not really complex.
  • 1
    \$\begingroup\$ Just be careful it isn't marked as a duplicate of this \$\endgroup\$
    – lyxal
    Commented Aug 15, 2020 at 3:09
  • 1
    \$\begingroup\$ Is the string being different not enough? \$\endgroup\$
    – nope
    Commented Aug 15, 2020 at 12:31
  • \$\begingroup\$ I hope this one is different enough. Things like this are usually borderline since there are several lyrics question closed but some are still open. \$\endgroup\$ Commented Aug 15, 2020 at 14:51
  • 1
    \$\begingroup\$ Despite some interesting repetition in this poem, I think the text compression methods used would be the same, making it a duplicate. \$\endgroup\$
    – xnor
    Commented Aug 16, 2020 at 6:52

Anti-codegolf, unique characters


Write a program/method whose source code's characters are unique. You shall put as many characters as you can.


There is no input.

Valid characters

All characters are identified by their Unicode code point. The following characters are invalid, and shall not appear in the source code nor the output:

  • C0 and C1 control characters (U+0000 – U+001F and U+0080 – U+009F) except Character Tabulation (U+0009), Line Feed (U+000A), Line Tabulation (U+000B), Form Feed (U+000C), Carriage Return (U+000D), and Next Line (U+0085)

    • Outputting these characters are banned, even if they have special effect on an output stream.
  • Low and High surrogates (U+D800 – U+DFFF)

  • Noncharacters (U+FDD0 – U+FDEF, and U+xxFFFE and U+xxFFFF for xx = 00 – 10)

  • Code points that are outside of U+0000 – U+10FFFF

A character is valid otherwise. In particular, whitespaces, combining characters, and private uses, and even reserved characters are valid.

Restrictions and output

Your program shall halt.

The output shall be a string. This includes string returned by a function, or string printed to stdout, stderr, a file, or a dialog box.

The set of the characters in the source code shall be a subset of the set of the characters in the output. Note that the output doesn't need to consist of unique characters.

The output may be arbitrarily many strings, for which their concateration will be considered for the restriction above.


This is an anti-codegolf. The submission with the longest source code wins.

  • \$\begingroup\$ Can we output though an error message? \$\endgroup\$
    – Adám
    Commented Aug 24, 2020 at 4:37
  • \$\begingroup\$ @Adám I'd permit it. \$\endgroup\$ Commented Aug 24, 2020 at 4:45
  • 1
    \$\begingroup\$ Explicitly stating the range of valid codepoints would be useful. \$\endgroup\$
    – Bubbler
    Commented Aug 24, 2020 at 4:45
  • \$\begingroup\$ So then any expression that generates an error message containing the offending line, followed by a comment symbol and all the unneeded characters, would be the perfect solution? \$\endgroup\$
    – Adám
    Commented Aug 24, 2020 at 4:47
  • \$\begingroup\$ @Adám Welp. Then I should add a restriction. \$\endgroup\$ Commented Aug 24, 2020 at 4:48
  • \$\begingroup\$ Be careful about that restriction. Putting restrictions on code is notoriously difficult to get right. \$\endgroup\$
    – Adám
    Commented Aug 24, 2020 at 4:49
  • \$\begingroup\$ Also, the languages whose inline comment starts with single char (say Python's # or APL's ), or any esolangs that ignore non-commands will likely get perfect score on any task solvable in that language. \$\endgroup\$
    – Bubbler
    Commented Aug 24, 2020 at 4:53
  • \$\begingroup\$ Not only that, many languages could probably just use an unfinished string (i.e. missing the closing quote) containing all the other necessary characters. \$\endgroup\$
    – Adám
    Commented Aug 24, 2020 at 5:05
  • \$\begingroup\$ @Adám What about now? \$\endgroup\$ Commented Aug 24, 2020 at 5:08
  • \$\begingroup\$ Did you intentionally remove the requirement that the output be longer than the input? \$\endgroup\$
    – Adám
    Commented Aug 24, 2020 at 5:10
  • \$\begingroup\$ What are "Reserved characters"? \$\endgroup\$
    – Adám
    Commented Aug 24, 2020 at 5:10
  • \$\begingroup\$ @Adám Yes. I tried to find a better restriction. \$\endgroup\$ Commented Aug 24, 2020 at 5:10
  • \$\begingroup\$ @Adám Reserved characters are code points that are not assigned a unicode character. \$\endgroup\$ Commented Aug 24, 2020 at 5:11
  • 1
    \$\begingroup\$ You've now banned line breaks. Lots of languages will have problems using only one-liners. \$\endgroup\$
    – Adám
    Commented Aug 24, 2020 at 5:29
  • 4
    \$\begingroup\$ [code-bowling]. \$\endgroup\$
    Commented Aug 24, 2020 at 5:36

Gray codegolf

The gray code is a binary numeral system such that two successive values differ in only one bit.

Decimal Binary  Gray
0       0000    0000
1       0001    0001
2       0010    0011
3       0011    0010
4       0100    0110
5       0101    0111
6       0110    0101
7       0111    0100
8       1000    1100
9       1001    1101
10      1010    1111
11      1011    1110
12      1100    1010
13      1101    1011
14      1110    1001
15      1111    1000


Print the first k Gray code numbers, starting from 0. The shortest code wins!

You may choose the output format as long as it's human-readable.

Similar questions

  • \$\begingroup\$ Why the strict output format, and why the arbitrary constant limit of 1000 (not taking an input number)? Also, possible dupe. \$\endgroup\$
    – Bubbler
    Commented Aug 28, 2020 at 4:19
  • \$\begingroup\$ When you say first 1000, is that decimal or binary? \$\endgroup\$
    – Jo King Mod
    Commented Aug 28, 2020 at 7:55
  • \$\begingroup\$ The challenge I linked is code golf. \$\endgroup\$
    – Bubbler
    Commented Aug 28, 2020 at 16:06
  • \$\begingroup\$ @Bubbler nvm, it looks like I am banned from posting lol \$\endgroup\$ Commented Aug 28, 2020 at 17:35
  • \$\begingroup\$ printing a sequence and finding a number in a sequence tend to be very similar tasks. \$\endgroup\$
    – Razetime
    Commented Sep 1, 2020 at 3:28


Somewhat famously, 'B' + 'a' + + 'a' + 'a' returns BaNaNa in Javascript. You goal is to output precisely BaNaNa. However, to keep it more in the style of the original Javascript, you may not use:

  • The bytes 78 or 110
  • Whatever n or N are encoded as if your language uses a special encoding, or
  • Any string literal containing the characters n or N

in your source code.

As a special note, I'd like your feedback as to if restricting numeric literals equal to 78 and 110 would be any good.

Additionally, this is my first question, and I'm aware that 'Do X without Y' is officially not super popular these days, but I frankly quite enjoy them, so I have no idea if this will be well-received or not. I'm hoping that the reference to the JS quirk is enough to make it interesting.

  • 1
    \$\begingroup\$ Restricting numeric literals would just result in 77+1 or +"78" or whatever trivial workarounds, so I don't particularly think it's a good idea. For the challenge itself, I don't know if it'll be well-received either. (For the record, BaNaNa = Barium Sodium Sodium = atomic number 56 11 11.) \$\endgroup\$
    – Bubbler
    Commented Sep 7, 2020 at 3:37
  • \$\begingroup\$ Since this is such a short string composed only of letters, it's very, very simple to work around it. You need a better restriction method. See this, and the questions in restricted-source \$\endgroup\$
    – Razetime
    Commented Sep 7, 2020 at 4:24
  • 1
    \$\begingroup\$ Indexing into custom character sets will make this trivial. \$\endgroup\$
    – Adám
    Commented Sep 7, 2020 at 5:03
  • 2
    \$\begingroup\$ JS, 11 bytes: `Ba${+"a"}a` \$\endgroup\$ Commented Sep 7, 2020 at 14:44

Find the nth positive integer m for which \$\tan(m) > m\$


Write a program/function that when given an integer \$n\$ as input outputs the \$n\$th positive integer \$m\$ for which \$\tan(m) \gt m\$.

Note: \$m\$ is in radians


This is so shortest bytes wins.

Sample Testcases

# n -> m
1   -> 1
2   -> 260515
3   -> 37362253
5   -> 534483448
9   -> 214112296674652
10  -> 642336890023956
16  -> 4285797387061825747646013

Find more at A249836

Inspired by What is the biggest tangent of a prime?

  • \$\begingroup\$ +1 for referencing a MegaFavNumbers video. \$\endgroup\$
    – Razetime
    Commented Aug 20, 2020 at 3:24
  • 4
    \$\begingroup\$ I don't understand the point. Are you asking us to find the nth number such that tan(x) > x? Is there any approach that will be shorter than iterating over all numbers until you find the nth number such that tan(x) > x? \$\endgroup\$ Commented Aug 20, 2020 at 3:33
  • 1
    \$\begingroup\$ Where is n in the equation? I'm lost. \$\endgroup\$ Commented Aug 20, 2020 at 9:07
  • 2
    \$\begingroup\$ @Razetime On the channel Stand-up Maths, right? \$\endgroup\$
    – Rosie F
    Commented Aug 20, 2020 at 18:49
  • 1
    \$\begingroup\$ replace "nth" with "first" "second" etc -> "first/second/etc number m for which ..." i.e. n is not in the equation @V.Courtois \$\endgroup\$
    – golf69
    Commented Aug 20, 2020 at 20:30
  • 1
    \$\begingroup\$ @Mukundan314 maybe indicate that n is the input? \$\endgroup\$
    – golf69
    Commented Aug 20, 2020 at 20:31
  • 1
    \$\begingroup\$ @golf69 oh! So it has to be an integer, not a number. I see now :) And yes, indicating n is the input would be nice. \$\endgroup\$ Commented Aug 21, 2020 at 6:50
  • 6
    \$\begingroup\$ I don't really see this being solved any way that taking the generic golfiest code for "find the n'th number meeting [predicate]", of which there's plenty of challenges, and sticking in tan(m)>m for the predicate. \$\endgroup\$
    – xnor
    Commented Aug 22, 2020 at 7:04
  • 1
    \$\begingroup\$ Solutions relying on floating-point arithmetic will get the wrong answer starting around the 11th term. You’ll need to clarify whether that’s acceptable. \$\endgroup\$ Commented Aug 22, 2020 at 22:14

Is it a Pythagorean triple?

Given three numbers, determine whether they form a primitive Pythagorean triple. Here is the definition:

  • all three numbers are positive integers
  • they represent the side lengths of a right-angled triangle, that is, \$a^2 + b^2 = c^2\$ for any ordering of \$a\$, \$b\$, and \$c\$
  • no other primitive Pythagorean triple exists with the same ratio of side lengths, that is, they are coprime. For example, \$[6, 8, 10]\$ is not a primitive Pythagorean triple, even though it satisfies the above conditions, because the simper \$[3, 4, 5]\$ exists.


  • Unless your language doesn't support them, you must accept floating-point numbers (even though Pythagorean Triples use, by definition, integers)
    • meta: Is this necessary? Is it too restrictive?
  • You may be given negative numbers, \$0\$, or numbers that cannot form any triangle (right-angled or not, i.e. \$a + b \le c\$), in which cases you must return false.
    • meta: Is this necessary? Does it make it too difficult?
  • You can return any two distinct individual values, or any typical truthy/falsey values for your language.
  • Standard I/O and loophole rules apply.
  • This is , so shortest function or full program in bytes wins.

Test Cases

[0, 3, 3] => false
[3, 4, 5] => true
[5, 3, 4] => true
[3, 4, 6] => false
[3, 4, 10] => false
[6, 8, 10] => false
[3.0, 4.0, 5.0] => true
[3.1, 4.0, 5.0] => false
[-3, -4, -5] => false
[3, 4, -5] => false
[4.5, 6, 7.5] => false
[91, 60, 109] => true
[264, 265, 23] => true
[81, 210, 184] => false
[140, 221, 83] => false


  • Are the first two rules necessary, or do they restrict it too much?
  • Is it clear enough? Are there any additional rules I need to add? Are more test cases needed?
  • Does this suit the and tags? It's kind of tangential to both areas.
  • Is this too similar to the existing questions that want you to generate triples?
  • \$\begingroup\$ possible duplicate of this challenge \$\endgroup\$
    – Razetime
    Commented Oct 18, 2020 at 13:38
  • \$\begingroup\$ @Razetime that challenge appeared on the front page today and inspired me to make this one. I thought it was different enough because of the coprime requirement and I added the extra rules about invalid values/floats to make it more interesting as well \$\endgroup\$
    – pxeger
    Commented Oct 18, 2020 at 14:32
  • \$\begingroup\$ Input validation tends to make for a challenge that is less fun. The coprime requirement is nice, but I'm not sure if it completely changes the challenge. \$\endgroup\$
    – Razetime
    Commented Oct 18, 2020 at 15:04
  • 2
    \$\begingroup\$ This seems to me to be too much a combination of two separate generic tasks, checking that a^2+b^2=c^2 when sorted, and that a and b are relatively prime. \$\endgroup\$
    – xnor
    Commented Oct 19, 2020 at 9:40

Am I A Perfect Two Integer?

A “perfect two integer” is an integer that works as x in the following equations:

Let i = integer, j = integer, x = perfect two integer:
2^i = x
j^2 = x

Example “perfect two integers”: 4, 16, 64, 256, 1024 (see a pattern here?)

Your answer should take a number from stdin or an argument. This should be relatively easy, but this is , so the shortest answer wins. (Note: there are ways to simplify these equations that aren’t listed here).

Sandbox Questions:

  1. Is this a duplicate?
  2. Is this too easy?
  3. Any other thoughts?
  • 3
    \$\begingroup\$ My personal feeling is that this is too easy. There's not really much scope for golfing the answer once you find the pattern. \$\endgroup\$
    – Sisyphus
    Commented Oct 28, 2020 at 0:25
  • \$\begingroup\$ Yeah, you're probably right. It's kind of just like if it's a power of 4. I somehow didn't think about this while making the question. \$\endgroup\$
    – nthnchu
    Commented Oct 28, 2020 at 0:34

Undecidable halting set

Write a program such that the set of natural numbers on which it halts is not recursive.

Shorter is better.

You may assume natural numbers in your language are unbounded.

Example: Python 3 (52 chars)

lambda n:eval(n.to_bytes(n.bit_length()//8+1,'big'))
  • \$\begingroup\$ This boils down to "emulate a Turing-complete language", which is the same as eval in any Turing-complete language that supports the feature (as you already showed in the example). I don't think it's an interesting challenge. \$\endgroup\$
    – Bubbler
    Commented Jan 19, 2021 at 6:37
  • \$\begingroup\$ @Bubbler Eval is only half the battle (assuming the language has eval in the first place). You still need to handle the fact that the inputs are natural numbers, not arbitrary strings. That is, you need to surject the natural numbers onto a set of strings sufficient to get the undecidable behavior under eval. \$\endgroup\$
    – user76284
    Commented Jan 19, 2021 at 7:08
  • \$\begingroup\$ @Bubbler I'd consider an eval-free version of the challenge though, if you have any suggestions. Not sure how that restriction is usually phrased/enforced. \$\endgroup\$
    – user76284
    Commented Jan 19, 2021 at 7:09
  • 1
    \$\begingroup\$ Eval is half of the battle, but the other half is converting a natural number to a string, which is just a matter of base conversion (which gives ALL strings, maybe except strings starting with null bytes, which doesn't matter in most languages). Unfortunately, banning built-ins is discouraged, and we already had a challenge about simulating a different Turing-complete language, so I don't think banning eval will make the challenge better. \$\endgroup\$
    – Bubbler
    Commented Jan 19, 2021 at 7:36
  • \$\begingroup\$ @Bubbler Is banning eval not an objective restricted-source criterion, as opposed to “no built-ins”? \$\endgroup\$
    – user76284
    Commented Jan 19, 2021 at 19:28
  • \$\begingroup\$ Banning built-ins means banning a specific feature of a language, like some old challenge banned exponentiation. It is different from restricted source, which is about restrictions in the source code as text, not looking at the features it uses. There are various classes of eval, e.g. interpret the whole language (Python's exec), interpret the subset of the language (Python's eval and ast.literal_eval), interpret a different language (you can't even count how many Turing-complete mini languages are out there; if Perl regex is Turing-complete, would you ban it?), etc. \$\endgroup\$
    – Bubbler
    Commented Jan 21, 2021 at 0:53

Here is the problem, for which I can only think of an iterative solution and have not found a closed formula.

This problem was found on : https://www.codingame.com/ in the shortest codemode.

You need to paint a house with R rooms.

For each room there are four walls and one ceiling, which all have the same dimensions and need C coats of paint.

You can't paint the next coat until the previous one has dried. You're finished when every wall is dry. Time taken to move between walls, ceilings, rooms is negligible.

It takes you M1 minutes to paint each coat, and M2 minutes for the paint to dry on each. You must finish in the least possible time, otherwise they will not pay you.


In :

Line 1: R, C, M1, M2 separated by spaces.
R: Number of rooms in the house
C: Coats of paint needed for each wall/ceiling
M1: Minutes taken to paint each coat
M2: Minutes taken for paint to dry on each coat (measured from when you've finished the entire coat)

Out :

The time taken to paint the entire house in the format H:MM


1 ≤ R ≤ 10
1 ≤ C ≤ 20
1 ≤ M1 ≤ 10000
1 ≤ M2 ≤ 10000


input: 1 1 12 0

output: 60

input: 5 2 5 30

output: 280

input: 1 5 5 200

output: 1045

  • 4
    \$\begingroup\$ Is this a problem from another site? If so, you need to state where the problem comes from. Also, unlike other online judge sites, we tend to allow submissions to be functions or full programs, and allow a wide range of I/O methods for both. Having to convert the minutes to hours/minutes and format as h:mm is not so related to the core (and requiring such formatting is discouraged on our site), so I suggest to simply output a number in minutes. \$\endgroup\$
    – Bubbler
    Commented Jan 28, 2021 at 0:16
  • \$\begingroup\$ @Bubbler I have taken your remarks into consideration. I hope it's what you expected. \$\endgroup\$ Commented Jan 28, 2021 at 9:31
  • 3
    \$\begingroup\$ Do you have permission to repost this challenge? CodinGame's rules state (Article 9): 'The reproduction, representation or use of all or part of the components proposed in the CodinGame Contests is strictly prohibited.' \$\endgroup\$
    – Dingus
    Commented Jan 28, 2021 at 12:15
  • 2
    \$\begingroup\$ Posting a challenge from elsewhere so that you can be shown an answer is engaging with this community in bad faith. You can ask for programming help in places such as SO, but this isn't intended to be one of them. \$\endgroup\$
    – xnor
    Commented Jan 28, 2021 at 17:05
  • \$\begingroup\$ @xnor I am not acting in bad faith or such. I found this problem interesting and I wanted to share with the community to find an optimal answser. There is nothing for me it this except extending my own knowledge as well as community knowledge \$\endgroup\$ Commented Jan 29, 2021 at 9:00

Hello World! - Generation 3392

Your job is to create a genetic algorithm that slowly evolves and mutates its string until the output is equivalent to "Hello World!".

The genetic algorithm should start with a random string generated, and continue for generations, making random mutations to its code, like this:

Gen 3393 - Hemmo World!


Gen 3394 - Hemko World!

Heres how the randomization algorithm works:

  1. Create a function named randint(n), import the time module.
# Written in Python 3.8
import time # imports time
def randint(n): # create function
  1. Get the current time since Jan 1. 1970, multiply by n and assign it as var "t". Make t an integer not a float.
t=int(time.time()*n) # Set time, and multiply by n.
  1. Use the "%" operation on var "t" (var t is the first argument), with var n as the second argument, assign it as "rand". Code in python should look like this:
rand=t%n #setup a psuedorandom number, since you already have a counter, use n as the limit number, and reset the counter once the counter reaches the limit number. This generates a psuedorandom number within n.
  1. Return rand.
return int(rand) #return results as integer.

Your program should have:

  • A randomized start string (using the rand_int algorithm)
  • A point it reaches "Hello World!"
  • Mutation, using "parents". You are not allowed to completely change a string, only modify 1 character each generation.
  • Mutations are not allowed to be repeated twice/No mutation backtracking.
  • Once a genetic algorithm has a correct letter in its correct position (such as "e" in "reJ" and "Hes"). It is forced to stay as that letter in that position and the genetic algorithm is forced with that string forever, this repeats for all other positions. This way the time increases additionally instead of exponentially. So you cannot do this: ["Hlllr" -> "Hellr" -> "Hfllr"]

So I can do this:

Herlo Wcrld
Herlo Wrrld

But you cannot change >1 character/byte at a time:

Herto Wcrld
Heflo World

You can do whatever else you want with it if it satisfies those requirements.


This is , so the answer with the least amount of bytes wins.

  • \$\begingroup\$ For code golf to work, the rules must be very clearly defined. At the current state people will do do (s:=randomString()); while(s!="Hello world!"); print(s); (pseudocode): (you can make this a popularity contest, but that's even harder to get right. I don't know why) \$\endgroup\$
    Commented Feb 6, 2021 at 13:46
  • \$\begingroup\$ @user202729 I want the person to make a genetic algorithm, where it starts with a random string. mutates the previous string randomly by 1 character during each generation, and eventually outputs "Hello World!" \$\endgroup\$
    – fr4cew
    Commented Feb 6, 2021 at 13:55
  • 3
    \$\begingroup\$ Besides being poorly-defined, it is also an non-observable behavior. \$\endgroup\$
    Commented Feb 6, 2021 at 14:02
  • \$\begingroup\$ No, (hey, that's a link. Read it.) \$\endgroup\$
    Commented Feb 6, 2021 at 14:09
  • \$\begingroup\$ Wait, that's not what I mean. I'll explain it later. \$\endgroup\$
    Commented Feb 6, 2021 at 14:47
  • \$\begingroup\$ @user202729 Right... \$\endgroup\$
    – fr4cew
    Commented Feb 6, 2021 at 14:53
  • \$\begingroup\$ But if the mutations between generations are random, there's no guarantee that the program will ever generate a specific string. You have to add a constraint like "the program should not generate a given string twice" \$\endgroup\$
    – anotherOne
    Commented Feb 6, 2021 at 17:11
  • \$\begingroup\$ @Davide I think that rule already existed in the "A point it reaches 'Hello World!'" but I'll add that anyway. \$\endgroup\$
    – fr4cew
    Commented Feb 6, 2021 at 19:26
  • \$\begingroup\$ A few things that I find missing from the rules: How long is the string? How do you mutate space/punctuation marks? I agree that is has non-observable behavior, because you can't see it mutating the string. Does the code have to be in python? Why should it randomize its input and why should it be random during the process? Wouldn't it be better if you get a string from user input (defined length) and then transform it to "Hello World!" (because that would allow bf and other languages to work) \$\endgroup\$
    – Deadbeef
    Commented Feb 7, 2021 at 6:37
  • \$\begingroup\$ @Deadbeef 1. The length of hello world, 2. It works with base 64, 3. No, 4. Because I liked it that way. 5. I do not know. \$\endgroup\$
    – fr4cew
    Commented Feb 7, 2021 at 15:22
  • \$\begingroup\$ Okay, about the unobservable behavior, what I mean is... \$\endgroup\$
    Commented Feb 7, 2021 at 15:59
  • \$\begingroup\$ It's relatively hard to define what exactly "having a string stored internally" means (what if the string is stored as a list of int values (char codes)? What about encoded in the exponent like in FRACTRAN?) Instead, you can require the programs to output the generations (i.e., print the random strings, each subsequent string has one character changed, etc.) [please review other sandbox posts] \$\endgroup\$
    Commented Feb 7, 2021 at 16:02

Return all elements around an index forming sun

Define a function that takes in a 2D array and a 2D index, and return all the elements of the 2D array that are directly vertical to, horizontal to, and diagonal to the given index, and the returned list must omit the index itself.

External modules, like numpy, as allowed. The most efficient program wins.

enter image description here

  • \$\begingroup\$ ... while we do have [fastest-code] on this site, there are specific requirements; restricting allowed programming languages is another problematic thing; \$\endgroup\$
    Commented Feb 8, 2021 at 14:38
  • \$\begingroup\$ besides, this definitely sounds like that you're outsourcing your homework to this site. \$\endgroup\$
    Commented Feb 8, 2021 at 14:38
  • \$\begingroup\$ @user202729 I already have a numpy solution... this is definitely not homework XD \$\endgroup\$ Commented Feb 8, 2021 at 15:34
  • \$\begingroup\$ @user202729 Okay, removed language restriction. \$\endgroup\$ Commented Feb 8, 2021 at 15:35
  • \$\begingroup\$ Okay, the other problem is with "most efficient code win". Code golf is popular around here because it's easy to measure, but with this you have to install all sort of weird programming languages on a test machine. \$\endgroup\$
    Commented Feb 9, 2021 at 2:07
  • 2
    \$\begingroup\$ I don't think this is very interesting to do fastest code anyway, because it can be done in linear time anyway (with the array given); besides the general consensus is to allow "full program or function" [please review other sandbox posts] \$\endgroup\$
    Commented Feb 9, 2021 at 2:11
  • \$\begingroup\$ @user202729 Okey. \$\endgroup\$ Commented Feb 9, 2021 at 2:27

Create a Screw

There are a variety of code cad languages, as well as other 3d API's that allow you to define shapes with code. Some of these are limited, while others are Turing complete and/or use a popular programming language such as Python or JavaScript.

The Challenge

Output a 3d model of a screw. Acceptable formats include .stl files and .obj files. A screw is defined as a shorter, wider cylinder on top of a taller, thinner cylinder, which should be threaded at least 5 times. Winner is whoever has the shortest code by two weeks after this question is posted. Standard rules and loopholes apply, with the exception that anything that allows you to programmatically define a 3d object is treated as a program language.


Should I add a spot for the screw driver to my definition of a screw? On the one hand, that would be more realistic, but on the other, it might just add bloat to answers, since I don't think there's anything interesting you can do with it.

I plan to include an example of a minimal screw under whatever definition I end up using, with pictures and outputs in every allowed format.

For the purpose of sorting and answer headers, should each langauge/framework combo be treated as a separate language? I'm leaning towards this, since It would be cool to have an easily searchable set of code for a bunch of different frameworks.

  • 1
    \$\begingroup\$ While the challenge is probably clearly defined enough, it might not allow solutions more interesting than hardcoding compressed output. \$\endgroup\$
    Commented Feb 15, 2021 at 2:04
  • \$\begingroup\$ How could I make sure that it does without fundamentally changing it? Or do you think that's not possible? I feel like there might be some potential for interesting ways of doing the threading, but I haven't used very many of these languages.. \$\endgroup\$
    – import huh
    Commented Feb 15, 2021 at 2:40
  • \$\begingroup\$ No idea... I think that (1) if there's a lot of boilerplate in the file format, using a library might be shorter (2) if the structure of the output file is not very repetitive, computing the coordinates might be shorter than hard coding + compressing it. I'm not familiar with either file format so I can't tell. -- -- nevertheless the challenge is on-topic; what I've said only concerns whether it's interesting [please review other sandbox posts] \$\endgroup\$
    Commented Feb 15, 2021 at 2:46
  • \$\begingroup\$ I think both formats basically just contain the points for every triangle used to represent the 3d object. To be honest I didn't really think about directly creating the file. Compared to using a library, it seems incredibly inefficient. That could make for an interesting challenge on it's own, though... \$\endgroup\$
    – import huh
    Commented Feb 15, 2021 at 2:58
  • \$\begingroup\$ You should probably add a specific diagram with the proportions for the screw, or maybe ask the program to take it as input \$\endgroup\$
    – Razetime
    Commented Feb 15, 2021 at 2:58
  • \$\begingroup\$ @Razetime There's no specific proportion, just "larger" and "smaller". \$\endgroup\$
    Commented Feb 15, 2021 at 3:06

Print your PPCG avatar

This is a graphical output question.

You have to connect to the codegolf.stackexchange.com in your homepage, scrape and download your avatar and show it in your default image viewer or some other way.

Standard loopholes apply, connections only allowed to codegolf.stackexchange.com

One language can be only used once, but a user can post multiple answers in different language

Tags: ,,

  • 3
    \$\begingroup\$ This is probably a dupe of this. Finding the avatar instead of the id wouldn't affect most of the code. Your final line is odd, do you mean that if I answered in a language it would prevent anyone else from using that language? That seems like a bad rule - what if I started on my answer and someone posted while I was working? I can't see any benefit, but perhaps I am not understanding. \$\endgroup\$ Commented Feb 20, 2021 at 18:10
  • \$\begingroup\$ I think it would be interesting if you have to print the ascii representation of the user before you , without scraping. With a standard way to produce the ascii image so people can't differ. i.e. img to ascii \$\endgroup\$
    – Alex bries
    Commented Feb 20, 2021 at 21:13

See who can write the longest code in order to print "Hello World!". The rule is that if you remove any single character from the code, it should NOT run.

  • \$\begingroup\$ I think we have a similar challenge already. It's pretty easy to get an infinite score with these rules. \$\endgroup\$ Commented Feb 25, 2021 at 1:23
  • 3
    \$\begingroup\$ It is a weaker version of Programming in a Pristine World and a different variant of Biggest Irreducible Hello World. But note that, in many languages, it is possible to add arbitrarily long no-op code that breaks when exactly one char is removed. For example, Python's ''+''+''+... causes syntax error when any of ' or + or a newline surrounding it is removed. \$\endgroup\$
    – Bubbler
    Commented Feb 25, 2021 at 1:41

Output function from one to another

I tried to post this twice and I gained negative feedback, so I will put what I have in mind here if anyone is interested.

Get a certain output function from one programming language and transfer to another. You'll be recreating an output function that came from a different programming language. There is a certain criteria in order for the answer to be valid:

  1. It should function the same way as the original function. All things that function can do should be applied to the recreated one. For example, Python's print() has certain keywords like end.
  2. Syntax doesn't matter. Example, if you can't use the << for cout, don't use it. Use what's available.
  3. The function should be able to output the same errors like the original. Replicate the same errors from the original function. If impossible, leave it out.

An answer example would be making printf() from C using Python or making Console.WriteLine() (or just WriteLine() if incapable) from C# using Ruby. Any output functions that are already similar to 2 languages don't need to be replicated in any of them.

  • 1
    \$\begingroup\$ "Get a certain output function from one programming language and transfer to another." To clarify, is the challenge to write source code which works in two different languages and does the same thing? What's the winning condition because this sounds very trivial. For example, print does the same thing in many languages. \$\endgroup\$
    – 79037662
    Commented Feb 24, 2021 at 20:25
  • 2
    \$\begingroup\$ Actually that doesn't mesh with "syntax doesn't matter". The point of this challenge is completely unclear, could you please clarify it? \$\endgroup\$
    – 79037662
    Commented Feb 24, 2021 at 20:26
  • 1
    \$\begingroup\$ I see you edited this post but the point of the challenge is still completely unclear. What exactly would a valid submission look like? \$\endgroup\$
    – 79037662
    Commented Feb 25, 2021 at 20:56
  • \$\begingroup\$ I don't really get the point of this task. Sure, someone could write code that does this, it might take some work to get exactly right, but is there a challenge underneath it? Is it code golf? \$\endgroup\$
    – xnor
    Commented Feb 26, 2021 at 3:08
  • \$\begingroup\$ @xnor It isn't code golf, nor king of the hill. It's an ordinary coding challenge if they can replicate a function from one language to another. \$\endgroup\$ Commented Feb 26, 2021 at 5:53
  • 1
    \$\begingroup\$ @MarkGiraffe That's not really a thing on this site -- challenges need to have an objective winning criterion. From the close reason: "Questions without an objective primary winning criterion are off-topic, as they make it impossible to indisputably decide which entry should win." \$\endgroup\$
    – xnor
    Commented Feb 26, 2021 at 8:13

Random Roman Numerals

Printing a random number is easy, but what about roman numerals? Your task is to output a random roman numeral from 1 to 1000, both inclusive.


  • Each number has to have the same chance of appearing
  • The program should use the language's random module or other random algorithm

Remember, I is 1, II is 2, III is 3. V is 5, X is 10, L is 50, C is 100, D is 500, and M is 1000. Also note that IV is 4, IX is 9, XL is 40, XC is 90, CD is 400, and CM is 900. For more information see the Wikipedia page.

This challenge is , so try to have the shortest program possible!

  • \$\begingroup\$ I'd really recommend loosening the restrictions for the random numbers. What if the language's random module doesn't guarantee exactly equal chances? Can we assume it does? What about an implementation of an algorithm typically used by language's random modules, like xorshiro or the mersenne twister? A much better restriction in my opinion would be requiring that every result is possible, and it's unlikely people will deviate too far from a uniform distribution anyway. \$\endgroup\$ Commented Mar 10, 2021 at 5:43
  • 1
    \$\begingroup\$ Sounds like you're combining two or more unrelated core challenges into one ― consider splitting the challenge up into separate challenges ― or dropping unnecessary parts. Just watch out for duplicate challenges: random number generation and Roman numeral conversion are popular tasks. \$\endgroup\$
    – Adám
    Commented Mar 10, 2021 at 6:01

Is this an one-one function?

, , ,

Two sets given as input, one is the domain of a function, and other one is the co-domain of a function. As an example

$$ \{1,2,3,4\} $$ $$ \{5,6,7,8,9\} $$

Now if the range set of the function, i.e. set of each element in the co-domain set which maps to the domain set (1 -> 5, 2 -> 6, ......) is equal to the co-domain set, then it is a one-one function.

For the above example, the range set is

$$ \{5,6,7,8\} $$

So the range set is not equal to co-domain set, the function is not a one-one function.


Inputted two domain and co-domain set of function, output a truthy value if the function is one-one or falsey if not.

Test cases

{1,2,3,4} {5,6,7,8,9} -> Falsey
{a,b,c} {b,c,d} -> Truthy
{4,8,2} {3,4} -> Falsey

Standard loopholes apply, , so shortest code wins

Pre-defining the input sets in the header section of TIO is not allowed.

  • 5
    \$\begingroup\$ Is this challenge simply asking if the two sets have equal length? If not, can you include counterexamples? \$\endgroup\$ Commented Mar 21, 2021 at 18:03
  • \$\begingroup\$ @water_ghosts yes i feel it is like that \$\endgroup\$
    – Wasif
    Commented Mar 22, 2021 at 5:14
  • 1
    \$\begingroup\$ not particularly interesting \$\endgroup\$
    – rak1507
    Commented Mar 22, 2021 at 12:11

Remaking Kernel

I made a program as a final project in the main CS50 Harvard course, and it was named Kernel, written in C alsongside CS50's library.


It has 7 functions: 4 main (talk, count, calculate, build) and 3 advice functions (error, feedback, help).

What each function does:

  • Talk asks for a prompt to the user and outputs the same thing. Talk Function
  • Count asks for a number to count from 1 to there. If the number is bigger than 50, it will lead to an error. Count Function
  • Calculate asks for 2 numbers and an operator (must be either +, -, * or /) then will calculate the value. If the result is a number is greater or equal to 999999999, it leads to an error. However, 0 / 0 = 0 and other division rules still apply. Calculate Function
  • Build asks for a size and something that it can build, which could be either a line, tower, wall, or pyramid. If the size is more than 20, it leads to an error. It would then ask for the character you want to use to build it, then it will be used to build the final product. There are multiple errors here, which is explained at the Error function.
    Build FunctionDisappointed that I can't make a proper pyramid.
  • Error is a library that shows all 14 errors, which is listed in the Error page of this post.
  • Feedback asks for feedback from the user and they can type whatever they want. The input will then be transferred in a new file called Feedback.list.

Feedback Function

Inside Feedback.list: What's in here?

  • Help displays the info of the entire app. Help Function


There are 14 written errors to prevent writing the real errors.

  1. NO_FUNCTION_ADDED: When asking for which function to use, entering a non-existent one will result to this error.
  2. ERROR_CLASS_NONE: In Error, entering a number which doesn't have its error will pop this up.
  3. COUNT_MAX: Well, typing a number greater than 50 won't put up the error, but counting up to 50 will.
  4. INVALID_DIVIDE: Anything divided by 0 in Calculate (except 0 / 0) will put up this error.
  5. ExTREME_VALUE: In Calculate, earning a final number of 999,999,999 or more will result to this error.
  6. OVERSIZE_CHUNK: Entering a size larger than 20 in Build will result to this error.
  7. UNKNOWN_STRUCTURE: Also in Build, inputting a structure unavailable will pop this up.
  8. UNCLEAR_INSTRUCT: If the input for Build's line is not vertical, horizontal or diagonal, they wouldn't know what it is.
  9. OVERWIDTH_COUNT: Building a tower with a width of 20 or more is invalid.
  10. INVALID_PYRAMID: Similar to Build's line, inputting a pyramid unavailable pops this up.
  11. OPERATE_BAD: Inputting an operator unavailable in Calculate is invalid.
  12. MORE_NAMES: If you didn't know, to run Kernel, you need to add your name alongside running it. Me, I use ./Kernel MarkGiraffe. If I use Mark Giraffe instead, it is invalid.
  13. SECRET_USER: Even NOT putting a name is not allowed.
  14. BAD_ALIGNMENT: Not choosing left or right for a diagonal line in Build is invalid.

For this challenge, I want you to remake the program the most designed way, while still keeping low bytes.

In case you are interested, I will post the source code somewhere where you can view it.

  • 5
    \$\begingroup\$ This has LOTS of quality issues. 1) Being a multipart challenge with unrelated subtasks. 2) Rigid I/O (command line arguments AND interactive stdin/stdout AND file output). 3) Input validation and error handling in arbitrary ways. 4) Lack of specification in certain cases. 5) Putting I/O examples in images instead of code blocks. \$\endgroup\$
    – Bubbler
    Commented Mar 23, 2021 at 4:10
  • 2
    \$\begingroup\$ I think the outstanding question is, why would people want to code and golf here? Like, it's cool that you wrote a thing, but it seems like a lot of work for someone to re-do on a recreational programming site without a really compelling reason. \$\endgroup\$
    – xnor
    Commented Mar 26, 2021 at 3:29

Given a program as input. If the program ever output a '1', output a truthy value and halt; if it halts without ever outputting a '1', output a falsy value and halt; if it falls into infinite loop without outputting a '1', fall into infinite loop.

  • \$\begingroup\$ This is unclear, for example: what language will the program be in? Do we take it as a string? And for a turing-complete language, this is impossible (at least if it can take input). \$\endgroup\$
    – Wezl
    Commented Apr 2, 2021 at 15:45
  • \$\begingroup\$ @Wezl Why not?? \$\endgroup\$
    – l4m2
    Commented Apr 2, 2021 at 16:09
  • \$\begingroup\$ You didn't specify the above ^ points, which are important. \$\endgroup\$
    – Wezl
    Commented Apr 2, 2021 at 16:17

Poly-functional Polyglots

I don't have a ton of time to work on this, so I decided to remove it temporarily while I rework the scoring.

  • \$\begingroup\$ I think the scoring system is too convoluted. Optimizing for the bonuses seems like more of a challenge than completing the core task. And if number of languages is the denominator, it’s hard to know how to calculate that upfront. How many shells does echo “Hello World” work in? If I later learn about another one, does that retroactively lower my score? \$\endgroup\$ Commented Apr 2, 2021 at 16:53
  • \$\begingroup\$ @water_ghosts thanks for saying so. I was worried that that would be the case, especially after reading the discussion on things to avoid in questions. I'm going to try and rework this. \$\endgroup\$ Commented Apr 8, 2021 at 19:26

Generate a Printing Program In Some Language


Given some rules:

1: Hello
2: World
4: Code
7: Golf
9: Whatever

Your program should output a program or a function (the output), which should be a valid program (or function) in some language. When the output is run, it should

  1. Ask for some input (i),
  2. Then output the string in the ith index in rules. (If there are none, don't output anything - even an error.)
  3. Return to step 1.



1: Hello
5: World
19: Code

One possible output (python):

while True:
  i = int(input())
  if i == 1:
  if i == 5:
  if i == 19:


Your score is the bytes in your answer (not the output).

Obviously this question should be clarified.

  • \$\begingroup\$ Can we take input as an array of rules (2d, like [[1, "hello"], [2, "weijfiwef"]])? If the index is not in the rules list, can we output an empty string? \$\endgroup\$
    – user100690
    Commented May 16, 2021 at 7:42
  • \$\begingroup\$ Well I thought about that, but some strong-type languages don't allow different types in a same array. If the index is not in the rules list, you can't output anything (as said in step 2). \$\endgroup\$
    – atzlt
    Commented May 16, 2021 at 8:33
  • \$\begingroup\$ Is my output required to be a full program or it is allowed to be a function? \$\endgroup\$
    – tsh
    Commented May 17, 2021 at 7:21
  • \$\begingroup\$ Yes @tsh, can be either full program or function. \$\endgroup\$
    – atzlt
    Commented May 17, 2021 at 14:09
  • \$\begingroup\$ Why downvotes? Could you please explain why? I'll improve \$\endgroup\$
    – atzlt
    Commented May 17, 2021 at 14:19
  • \$\begingroup\$ @SketchySketch Not a downvoter, but it seems to be a boring challenge. \$\endgroup\$
    – Xwtek
    Commented May 20, 2021 at 9:18
143 144
146 147

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .