# Question
Title: Compute probability of seeing all the balls
Given \\$x\\$ distinguishable balls (say they have different colors), sample with replacement repeatedly until all the balls that have been seen, have been seen at least twice.

# Challenge

The input is the integer value \\$x \geq 2\\$.

The challenge is to compute the probability that you would have seen all the balls when you stop. You can of course stop before then, if for example you sample the same ball the first two times and \\$x \> 1\\$. You should output the probability as an exact fraction. For languages that don't have easy fraction arithmetic, your code can output a sum of fractions instead (e.g. \\$1/3 - 23/83 + 14/17\\$).

# Examples

If \\$x = 2\\$ then the only way to stop before seeing both balls is if you sample the same ball twice in a row. This happens with probability \\$1/2\\$.

The probability for \\$x = 3\\$ is \\$4/9\\$.

Why is this? Let us compute the probability that we **don't** see all the balls. There is a \\$1/3\\$ probability that the same ball is chosen in the first two steps and then we stop. If this doesn't happen, there is then \\$2/3\\$ probability that we don't select the third ball straight away. In this case we will have selected one ball twice and another one a single time. So now we want to compute the probability that we stop before seeing the third ball. We can write this as a recursive equation. Let \\$p\\$ be this probability.

\\$p = 1/3 + p/3\\$. Solving this gives us \\$p = 1/2\\$. Putting it all together we get \\$1/3 + 2/3(2/3 \cdot 1/2) = 5/9\\$. To get the desired probability that we do see all the balls we need \\$1-5/9\\$.

The probability for \\$x = 4\\$ is \\$43/96\\$.

The probability for \\$x = 5\\$ is \\$3517/7500\\$.

The probability for \\$x = 6\\$ is \\$17851/36000\\$.

# Answer
# Python, ~~100~~ 94 bytes

```
from fractions import*
P=lambda x,d=0:Fraction(d*P((d>1)*x,d-1)+x*P(x-1,d+1),d+x)if x else d>0

```

Attempt This Online!

`x` is the number of balls not sampled yet, `d` the number of balls sampled exactly once. Once a ball has been sampled twice it can be ignored in the further analysis, as drawing it more times effects neither the outcome nor the sampling process.
> 7 votes

# Answer
# , ~~110~~ ~~100~~ ~~95~~ ~~93~~ ~~91~~ 88 bytes

*-3 bytes thanks to @Giuseppe and @pajonk*

```
`?`=\(y,s=1,`[`=`if`)y[s[(y*(y-1?s+1)+s*(y?s-1))/(y+s),0],1]
f=\(x)MASS::fractions(?x-1)

```

s is the number of balls seen exactly once.

y is the number of balls never seen.

Try it online!
> 7 votes

# Answer
# JavaScript (ES6), 81 bytes

This is based on ovs' answer.

Returns `[numerator, denominator]`.

```
f=(x,d=0,q)=>[P=x?d*f(d>1&&x,d-1)[0]*f(x-1,d+1,q=Q)[1]+x*P*q:d>0,Q=x?(d+x)*q*Q:1]

```

Try it online!

Or with some post-processing to get the simplified fractions: Try it online!

### Method

Since we don't have native fraction support, we have to compute:

$$\left(\frac{d\cdot p\_0}{q\_0}+\frac{x\cdot p\_1}{q\_1}\right)/(d+x)=\frac{d\cdot p\_0\cdot q\_1+x\cdot p\_1\cdot q\_0}{q\_0\cdot q\_1(d+x)}$$

where \\$(p\_0,q\_0)\\$ are given by a first recursive call and \\$(p\_1,q\_1)\\$ are given by a second recursive call.

In the JS implementation, we save the numerator and denominator computed by the last call into the global variables `P` and `Q` respectively.

This allows us to compute the new numerator as:

```
//                                 q0
//                                 |
P = d * f(...)[0]   *   f(..., q = Q)[1] + x * P * q
//      \_______/       \______________/       |   |
//   [p0, q0][0] = p0   [p1, q1][1] = q1       p1  q0

```

and the new denominator as:

```
Q = (d + x) * q * Q
//            |   |
//            q0  q1

```
> 5 votes

# Answer
# PARI/GP, 54 bytes

```
p(x,d)=if(x,(d*p((d>1)*x,d-1)+x*p(x-1,d+1))/(d+x),d,1)

```

Attempt This Online!

A port of @ovs's Python answer.
> 2 votes

# Answer
# Charcoal, 63 bytes

```
Ｎθ⊞υ¹Ｆθ«≔⟦⟧ηＦ⁻θι⊞η▷”V5⊘？º≦kgmＥ\0⦃W‹”⟦⁺∧⊖κ×κ↨η⁰×⊕ι§υ⊕κ⁺⊕ικ⟧≔ηυ»υ

```

Attempt This Online! Link is to verbose version of code. Explanation: Another port of @ovs' Python answer, except using dynamic programming instead of recursion and I also replace `d*P((d>1)*x,d-1)` with `(d-1 and d*P(x,d-1))` as that way I can make `P(0,d)=1`.

I wanted to remove the dependence on `fractions.Fraction` as even compressed that takes up 17 bytes but the best I could do was 66 bytes:

```
Ｎθ⊞υ¹Ｆθ«≔⟦⟧ηＦ⁻θι«Ｆ‹κ²≔Ｅ²μζ≔⟦Σ××⟦κ⊕ι⟧ζ⮌§υ⊕κ×⁺κ⊕ι⊟×ζ§υ⊕κ⟧ζ⊞ηζ»≔ηυ»Ｉυ

```

Attempt This Online! Link is to verbose version of code.
> 2 votes

# Answer
# Pyth, 36 bytes

```
M?G?Hs*VLV*,HG]+GH,ghGtHgtGH] B1Yg1t

```

Try it online!

Uses @ovs's simplification method. But since no fraction arithmetic, returns a list of fractions to add, each fraction being in the form `[numerator, denominator]`

### Explanation

```
M?G?Hs*VLV*,HG]+GH,ghGtHgtGH] B1Yg1tQ    # implicitly add Q
                                         # implicitly assign Q = eval(input())
M                                        # define g(G,H):
 ?G                                      #   if g == 0:
                                Y        #     return an empty list
   ?H                                    #   if h == 0:
                            ] B1         #     return [[1, 1]]
                  ,ghGtHgtGH             #   [g(G+1, h-1), g(G-1, H)]
          *,HG]+GH                       #   [[H, G+H], [G, G+H]]
         V                               #   vectorize (apply to first of each list, then second)
        L                                #   map constant pair over list returned by g
      *V                                 #   vectorized multiplication
     s                                   #   merge both results into one list
                                 g1tQ    # print g(1, Q-1)

```
> 1 votes

# Answer
# Wolfram Language(Mathematica), 70 bytes

A port of @ovs' Python answer in Mathematica.

---

Golfed version. Try it online!

```
x_~P~d_:0:=If[x<1,Boole[d>0],(d P[Boole[d>1]x,d-1]+P[x-1,d+1]x)/(d+x)]

```
> 1 votes

---
Tags: code-golf, probability-theory
---


title: Meta-cat program

text:
# Question
Title: Meta-cat program
Write a program or function that takes input and outputs/returns a full program (in the same language) that outputs said input. Note that the input may contain any printable ASCII character or newline (AKA 0x20-0x7f and 0x0a). However, the input will not have trailing whitespace nor preceding whitespace, nor will it be empty.

## Test cases (Javascript):

```
cat => console.log("cat")
fish => console.log("fish")
m(newline)ta-c t => console.log("m\neta-c t")
m"'`\c => console.log("m\"'`\\c")

```

## Example program

```
function metaCat(text){
  return "console.log(\"" + text.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\n/g,"\\n") + "\")"
}
```

## Scoring

Score is the sum of your code size and the size of the output for each test case

# Answer
# brainfuck, 78 + 2109 = 2187 bytes

```
+++++[>+++++++++<-]>[->+>>+>++>+>++<<<<<<]>-->>+>+>>+++<<<<,[[-<.>]>[.>]<[<],]

```

Try it online!
> 12 votes

# Answer
# Python, 19 (program) + 60 (output) = 79 bytes

*-3 bytes thanks to loopy walt*

```
"print(%r)".__mod__

```

Attempt This Online!
> 5 votes

# Answer
# Vyxal, 3 bytes + 23 character sum = 26 score

```
øDṪ

```

Try it Online!

So funny story, my previous answer wasn't actually valid because `øD` already wraps in quotes, making the `q` useless.

## Explained

```
øDṪ
øD  # dictionary compress the input, quoting it at the same time
  Ṫ # Remove the trailing backtick

```
> 4 votes

# Answer
# GolfScript, 1 + 32 = 33 bytes

```
`

```

Try it online!

The outputs are:

```
"cat"
"fish"
"m\nta-c t"
"m\"'`\\c"

```
> 4 votes

# Answer
# \>\<\> (Fish), 71 + 46 bytes = 117

```

```

Hover over any symbol to see what it does

Try it

Unformatted version if the code above appears glitched:

```
"<o>'"i:0(?v:\
< \ >o<"'"~< |.!05
^v?= "'":v?=a/
^  "'a'"~/
~/^1"'d3*'"

```

Only characters that need escaping are the single quote and line break
> 4 votes

# Answer
# Haskell, 24 + 76 = 100 bytes

```
f=("main=putStr"++).show

```

Attempt This Online!
> 4 votes

# Answer
# Rust, 51 bytes + 110 bytes = 161 bytes

```
fn f(x:&str){print!("fn main(){{print!({:?})}}",x)}

```

Try it online!

We take the input as a string, but print the output, saving having to specify `f`'s return type. `Debug` does the escaping for us.
> 4 votes

# Answer
### Common Lisp, 21 + 52 = 73

```
(lambda(s)`(print,s))

```

For example:

```
(funcall (lambda(s)`(print,s)) "cat"))
=> (print "cat")

```
> 4 votes

# Answer
# Bash, 23+49 = 72 bytes

```
printf 'echo %q\n' "$1"

```

Try it online!
> 4 votes

# Answer
# ForWhile, 42 (Program) + (9+10+14+14) (Output) = 89 bytes

`34#::`[_~:[~;;=[92#):92=[:#)#])#"(,#)"(,#)`

online interpreter

# Explanation:

ForWhile allows multi-line strings, so the only characters that need to be escaped are `"` and `\`

```
34#                                         \ print a "
   ::`[                                     \ loop up to 34^34 times (for-while has no infinite loops)
       _                                    \ read a character
        ~:[~                                \ character is not end-of file
            ;;=[92#)                        \ print a backslash if character is "
                    :92=[:#)                \ print a backslash if character is \
                            #               \ print the character
                             ])             \ break loop if character was end of file
                               #"(,#)"(,#)  \ print "(,#) to print the string produced by the program

```

The printed programs are just a (multi-line) string literal containing the Input-string, followed by `(,#)` which will print the string.

Output for Test-cases:

```
"cat"(,#)

"fish"(,#)

"m
ta-c t"(,#)

"m\"'`\\c"(,#)

```

# ForWhile, 35 (Program) + (4\*17+3+4+8+6) (Output) = 124 bytes

Shorter program but slightly longer output.

`"17-9:`[1-:@:[#])?"(,#)9:`[_~:[~#])`

Prints a program (of length 17) that prints all its source code except the first 17 characters and then terminates, followed by the input string.
> 3 votes

# Answer
# JavaScript (V8), 32 + 60 = 92 bytes

```
s=>`print(${JSON.stringify(s)})`

```

Try it online!
> 3 votes

# Answer
# C (gcc), 108 + 84 = 192 bytes

Lots of bytes less thanks to @c--.

```
f(int*s){for(printf("main(){puts(\"");*s;s++)printf(*s-34?*s-92?*s-10?s:"\\n":"\\\\":"\\\"");puts("\");}");}

```

Try it online!
> 3 votes

# Answer
# Lua, 30 bytes, score 82

```
print(('print%q'):format(...))

```

Try it online!

No need for parentheses in resulting program since we're printing a string literal.
> 3 votes

# Answer
# owl lisp, 51 + 176 = 227

this is a very *quick and dirty* solution

```
(λ (s) `(print (list->string ',(string->list s))))

```

example:

```
> (eval ((λ (s) `(print (list->string ',(string->list s)))) "cat") *toplevel*)
cat

```
> 3 votes

# Answer
# Thunno 2, 2 + 28 = 30

```
Ṙṫ

```

Try it online!

Take the string epresentation, then remove the ail (last character, the end quote).
> 2 votes

# Answer
# Retina, 9 bytes, score 39

```
¶
$¶
^
K`

```

Try it online! Explanation:

```
¶
$¶

```

Change newlines into pilcrows.

```
^
K`

```

Prepend the `K` instruction (replace buffer with literal string).

The test cases encode as follows:

```
K`cat
K`fish
K`m¶eta-c t
K`m"'`\c

```
> 2 votes

# Answer
# C++14, 132 + 176 = 308 bytes

```
[](auto&s){auto t=s;s="#include<cstdio>\nint main(){puts(\"";for(auto c:t)s+=c-34?c-92?c-10?s+=c,"":"\\n":"\\\\":"\\\"";s+="\");}";}

```

Attempt This Online!
> 2 votes

# Answer
# Go, 91 + 216 = 307 bytes

```
import."fmt"
func f(s string){Printf(`package main
import."fmt"
func main(){Print(%q)}`,s)}

```

Attempt This Online!
> 2 votes

# Answer
# Nim, 49 + 55 = 104 bytes

```
import strutils
proc m[S](s:S):S="echo "&s.escape

```

Attempt This Online!
> 2 votes

# Answer
# Ruby, 19 bytes +10+11+16+15 = 71

Chose to count the trailing newline in the score because it's possible to print without it, as per the other answer.

```
$><<"$><<"
p$<.read

```

Attempt This Online!

# Ruby, 23 bytes +9+10+15+14 = 71

Output doesn't include a trailing newline, but the score turned out to be the same anyways because the solution required 4 more bytes.

```
$><<"$><<"+$<.read.dump

```

Attempt This Online!
> 2 votes

# Answer
# Charcoal, 9 bytes, score 33

```
ＳＵＴ¿ⅉ´Ｕ´Ｔ

```

Try it online! Link is to verbose version of code. Explanation:

Write the input string to the canvas. This is sufficient to generate a program that prints only printable ASCII; the rest is newline handling.

```
ＵＴ

```

Turn off right-padding. (Has no effect if there was no newline in the input.)

```
¿ⅉ

```

If the input contained at least one newline...

```
´Ｕ´Ｔ

```

... output the command to turn off right-padding.

The test cases encode as follows:

```
cat

fish

m
eta-c tＵＴ

m"'`\c

```

Try it online! (Third test case only; the others are trivial.)
> 1 votes

# Answer
# PowerShell, 24 + 30 = 54 bytes

```
% *ce "'" "''"|%{"'$_'"}

```

Try it online!

Input comes through the pipeline.
`% *ce "'" "''"` \- `%` is an alias for the `ForEach-Object` cmdlet, which takes the input string, and runs the string's method "Replace()" (the only one matching "\*ce") against it, replacing all single quotes with a double single quote.
This is then piped further to `%{"'$_'"}`; again ForEach-Object, but this time invoking the scriptblock, which simply takes the input string, and wraps it in single quotes; output is implicit.
In PowerShell, anything inside a string enclosed in single quotes is taken verbatim, so no need to worry about escaping anything, except for the single quotes.

As an alternative, a Here-String `@'<LF>...<LF>'@` could be used, which would remove the need to escape even the single quotes:

```
%{"@'`n$_`n'@"}

```

This is only 15 bytes instead of 24, but the output has 6 additional characters per test case instead of 2, and would come to a total of 60 bytes.
In the TIO above, the code can just be replaced.
> 1 votes

# Answer
# 05AB1E, score: 28 (3 bytes \+ 25 output sum)

```
"“ÿ

```

Try it online.

The outputs for the four test cases are:

```
Input:      cat
Output (4): “cat

Input:      fish
Output (5): “fish

Input:      """m
            ta-c t""" (multiline input)
Output (9): “m
            ta-c t

Input:      m"'`\c
Output (7): “m"'`\c

```

**Explanation:**

```
"    "# Push the following string:
 “    #  Regular dictionary quote for the output program
  ÿ   #  String interpolation, which is automatically replaced with the (implicit) input
      # (after which the result is output implicitly - with trailing newline)

```

If there is no trailing `"` or , 05AB1E outputs everything after it as a string.
> 1 votes

# Answer
# Trilangle, 104 (program) + 48 + 82 + 175 + 175 (outputs) = score 584

```
'0.<_.<.>i,S)#..\_//222*3'/."-S:2'*)<.L-3',o\.><#.(,o.""<._.......j)2<>(<#,,o@o+0"@#.,#,o'"........^oo",

```

Try it in the online interpreter!

The score is kinda terrible because the output is quadratic in the size of the input. This program:

1. Collects the input and keeps track of length
```
             '
            0
           < _
          < . > i
         , S ) # .
          \ _ /

```
2. Computes `triangular(3n) - 3n - 2`, the amount of NOPs needed to put the work all on the bottom row of the output program
```
                / 2
       2 2 * 3 ' /
        - S : 2 ' * )

```
3. Outputs a leading `\` to redirect the IP to the bottom row, all the filler NOPs, and the "end program" instruction
```
      "
     <   L - 3 ' , o \
      > < # . ( , o . "
   " <   _
                    , o @

```
4. Repeats the input in a format that Trilangle can understand it. This relies on implementation-defined behavior; it works in my reference interpreter as of v1.6.2.
```
  j ) 2 < > ( < # ,
 o + 0 " @ # . , # , o ' "
                ^ o o " , .

```
> 0 votes

---
Tags: code-golf, string, code-generation, metagolf, test-battery
---


# Question
Title: Print 100 digits of Champernowne's Constant
Inspired by this and this question

#### Challenge

Your challenge is to print any 100 consecutive digits of Champernowne's Constant. You must give the index at which that subsequence appears. The 0 at the beginning is not included.

For example, you could print any of the following:

```
+-----+----------------------------------------------------------------------------------------------------+
|Index|Output                                                                                |
+-----+----------------------------------------------------------------------------------------------------+
|0    |1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545|
+-----+----------------------------------------------------------------------------------------------------+
|50   |0313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798|
+-----+----------------------------------------------------------------------------------------------------+
|100  |5565758596061662636465666768697071727374757677787980818283848586878889909192939495969798991001011021|
+-----+----------------------------------------------------------------------------------------------------+

```

#### Rules

* Output may be a string/digit list/etc.
* You may provide a function or a program
* This is , so the shortest code wins!

# Answer
> 2 votes
# Vyxal `H`, 14 bitsv2, 1.75 bytes

```
1ẋ

```

Try it Online!

Bitstring:

```
01000010111110

```

Prints `1` 100 times, same as APL

# Answer
> 9 votes
# Jelly,  ~~4 3~~  2 bytes

```
³Ṭ

```

A full program that accepts no arguments and prints a list of one hundred consecutive places starting at the 0-indexed index (you may need to scroll):

$$98888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888890$$

**Try it online!**

### How?

By definition, Champernowne's constant's decimal places are the concatenation of the natural numbers, so \\$10^{99}\\$, the first number with \\$100\\$ decimal digits, appears.

The index of \\$N = 10^{99}\\$ may be calculated like so:

$$d = \text{digit\_length}(N) = \lfloor log\_{10}(N) \rfloor + 1$$ $$\text{index} = d \times N - \frac{10^{d}-1}{9}$$ $$= 100 \times 10^{99}-\frac{10^{100}-1}{9}$$ $$= 10^{101}-\frac{10^{100}-1}{9}$$ $$=98888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888889$$

The next digit of Champernowne's constant after the last zero of \\$N\\$ is the first digit of \\$N+1\\$ which is \\$1\\$, so let's get the trailing \\$99\\$ zeros of \\$N\\$ and a \\$1\\$...

```
³Ṭ - Main Link: no arguments
³  - 100
 Ṭ - untruth -> [0,0,0,...,1] (99 zeros followed by a one)
   - implicit print

```

---

#### Original @ 4 bytes:

```
55ḊV

```

A full program that accepts no arguments and prints the 2nd to 101st decimal places.

**Try it online!**

### How?

```
55ḊV - Main Link: no arguments
55   - fifty-five
  Ḋ  - dequeue -> [2,3,4,...,54,55]
   V - evaluate as Jelly code -> (integer) 234...5455
     - implicit print

```

# Answer
> 7 votes
# C, 41 bytes

```
main(i){for(i=9;i++<59;)printf("%d",i);}

```

Goes through numbers 10 to 59 (indexes 9 to 108), printing exactly 100 digits (without a newline).

---

# C, 28 bytes

```
main(){printf("1%099d",0);}

```

Inspired by Jonathan Allan's solution, just prints 10^99, starting at index 98888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888889 (if my short Python script did not fail me :p):

```
n = 0

for i in range(1, 100):
  n = n + 9 * pow(10, i - 1) * i

print(n)

```

# Answer
> 6 votes
# brainfuck, 23 bytes

```
-[----->+>+<<]>-[->..<]

```

Try it online!

Outputs 100 `3`s, which appears at index 16888888888888888888888888888888888888888888888888872.

This program first obtains the value 51 (which is the ASCII code of `3`), calculating it as 255/5, in two cells. It then decrements one of those cells to 50, and then uses it as a counter for a loop in which each iteration outputs the other cell's value twice.

# Answer
> 4 votes
# Jelly, 6 bytes

```
2r55DF

```

Try it online!

Starts at index 1 (digit 2 in the number `2`). Range from 2 to 55 and then the decimal representation of each, then flattened.

# Answer
> 3 votes
# APL (Dyalog Classic), 5 bytes

```
100⍴1

```

Try it online!

Prints 1, one hundred times. Similar approach to @Jonathan Allan and others. First appears as

```
1111111111111111111111111111111111111111111111111 #fifty-one 1s
11111111111111111111111111111111111111111111111(12)

```

Index is \\$51\cdot\frac{10^{51}-1}{9}+ \sum\_{n=1}^{50}(9n \cdot 10^{n}) = \frac{5}{9}(10^{53}-1)-4\\$. Explicitly, this is \\$55555555555555555555555555555555555555555555555555551\\$ (fifty-one 5s and one 1).

# 7 bytes

If we want to print as a string rather than a list.

```
100⍴'1'

```

Here's a more legit APL solution by Graham

# Answer
> 3 votes
# Charcoal, 6 bytes

```
⭆⁵⁰⁺χι

```

Try it online! Link is to verbose version of code. Starts at index `9`. Explanation: Loops over the first `50` integers adding `10` to each, then joins everything together.

Alternative version, also 6 bytes:

```
⪫…χ⁶⁰ω

```

Try it online! Link is to verbose version of code. Starts at index `9`. Explanation: Lists the integers from `10` to `60`, then joins everything together.

Alternatively, starting at index `1`, also for 6 bytes:

```
⭆⁵⁴⁺²ι

```

Try it online! Link is to verbose version of code. Explanation: Loops over the first `54` integers adding `2` to each, then joins everything together.

Boring 4-byte solution:

```
”)；e

```

Try it online! Link is to verbose version of code. Starts at index `988888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888890`. Explanation: Compressed string of `100` `0`s.

Slightly less boring 5-byte solution:

```
ＩＸφ³³

```

Try it online! Link is to verbose version of code. Starts at index `98888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888889`. Explanation: Calculates `1000³³`.

# Answer
> 3 votes
# 05AB1E, ~~5~~ 3 bytes

```
1т×

```

-2 bytes porting *@Tbw*'s APL answer.

Outputs at 0-based index \\$55555555555555555555555555555555555555555555555555551\\$.

Try it online.

**Original 5 bytes answer(s):**

Here also the program with an infinite list of all valid outputs:

```
∞Sü100J

```

Try it online.

**Explanation:**

```
1т      # Push 1; Push 100
  ×     # Pop both, and push a string of 100 1s
        # (which is output implicitly as result)

Y55     # Push 2; Push 55
   Ÿ    # Pop both, and push a list in the range [2,55]
    J   # Join the list together to a single string
        # (which is output implicitly as result)

T59     # Push 10; Push 59
   ŸJ   # Same as above

46₃     # Push 46; Push 95
   ŸJ   # Same as above

```

```
∞       # Push an infinite positive list: [1,2,3,...]
 S      # Convert it to a flattened list of digits
  ü100  # Pop and push a list of all overlapping lists of 100 digits
      J # Join each inner list of digits together to a string
        # (after which this infinite list is output implicitly)

```

# Answer
> 2 votes
# APL+WIN, ~~11~~ 10 bytes

i byte saved thank to Tbw

A function taking no arguments with output from index 2 with index origin = 1

```
1↓⊃,/⍕¨⍳55

```

Try it online! Thanks to Dyalog Classic

# Answer
> 2 votes
# ///, 17 bytes

```
/10/00000001/1100

```

Try it online!

Outputs 98 `0`s followed by 2 `1`s, which appears (in `1[000...0001 1]000...0002`) at index 98888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888990.

The replacement multiplies the number of `0`s by 7 as they move across each `1`.

---

Some alternative solutions, of the same length:

```
/10/0001/10010110

```

Try it online!

Outputs 96 `0`s followed by 4 `1`s.

```
/10/00001/0110010

```

Try it online!

Outputs 97 `0`s followed by 3 `1`s.

# Answer
> 1 votes
# GolfScript, 6 bytes

```
55,(;5

```

Try it online!

Prints the first 100 digits.

```
55,    # the list 0..55
   (;  # drop the 0
     5 # push 5 to the stack
# the stack is implicitly printed without separator

```

Alternatively, this one prints a hundred 1s:

# GolfScript, 6 bytes

```
1+100*

```

Try it online!

Gets `"1"` by appending 1 to the implicit empty input, then repeats it 100 times.

---
Tags: code-golf, math, number
---


title: 80% of respondents agreed…

text:
# Question
Title: 80% of respondents agreed…
Sometimes I see a claim like "80% of respondents agreed" and I think "what was your sample size? 5?" because, of course, with a sample size of 5 it's possible to get 80% to agree on something. If the claim is "47% of respondents agreed" then I know it must be a larger sample size.\[1\]

## challenge

Given a positive integer x≤100, output the minimum number of respondents needed for an honest claim that "x% of respondents agreed".

Input and output will be however integers (or numbers) are normally handled.

This is code golf.

Caveat: Note the effect of rounding. For example, a claim of "12% of respondents agreed" can mean that there were 8 respondents, 1 agreed, and the claim is rounding half down. Likewise, "13% of respondents agreed" can mean there were 8 respondents, 1 agreed, and the claim is rounding half up. Assume numbers *closest* to an integer are rounded to that integer, but you must account for both of ways of rounding *half*. Thus, on an input of 12 *or* of 13, your algorithm should output 8.

## examples

* 1 ↦ 67
* 2 ↦ 40
* 100 ↦ 1

---

\[1\] Of course, this is assuming that what I'm reading is telling the truth.

# Answer
# K (ngn/k), 27 bytes

```
**&~`i$(199*%/:/&=69)-1.99*

```

Try it online!

Based on the formula from the OEIS entry:

> Find the smallest N such that there is some x \> 0 with abs(100\*x/N - n) \<= 0.5.

For golfing reasons this actually checks -1 \< 1.99\*(100\*x/N - n) \< 1, which happens to be equivalent on the domain of the problem.
> 9 votes

# Answer
# Jelly,  ~~14~~  12 bytes

-2 thanks to Nick Kennedy! (Make a 100 by 100 table with values over 100% rather than a triangle of values.)

```
ạȷ2÷þ×¤ḤỊ§TḢ

```

A monadic Link that accepts a positive integer from \\$\[1,100\]\\$, the reported percentage, and yields another positive integer, the minimal number of respondents.

**Try it online!** Or see all 100.

### How?

```
ạȷ2÷þ×¤ḤỊ§TḢ - Link: positive intger from [1..100], P
      ¤      - nilad followed by link(s) as a nilad:
 ȷ2          -   10^2 -> 100
    þ        -   {[1..100]} x {[1..100]} table of:
   ÷         -     divide
     ×       -   multiply by {100} (vectorises)
                 -> [[100],[50.0,100],[33.33,66.66,100],[25.0,50.0,75.0,100],...]
ạ            - {P} absolute difference (vectorises) {that}
       Ḥ     - double (vectorises)
        Ị    - is insignificant? (vectorises) - i.e. abs(x)<=1
         §   - sums
          T  - truthy indices
           Ḣ - head

```
> 7 votes

# Answer
# JavaScript (Node.js), 45 bytes

```
x=>g=i=>(x-i%69/(y=i>>7)*100)**2<.26?y:g(-~i)

```

Try it online!
> 5 votes

# Answer
# C (gcc), 56 bytes

```
i;j;f(n){for(i=j=1;fabs(100.*j/i-n)>.5;j=--j?:++i);j=i;}

```

Try it online!
> 5 votes

# Answer
# Vyxal 3, 14 bytes

```
₅Dᵒ÷×ṚTȧd1≤ᶤaꜝ

```

Try it Online!

Takes an integer argument and returns an integer argument. This is a Vyxal 3 translation of @JonathanAllan’s Jelly answer. It’s two bytes longer, partly because the outer modifier returns the result in the transposed reverse of what is needed for this problem.

```
₅Dᵒ÷×ṚTȧd1≤ᶤaꜝ
₅               # 100
 D              # Triplicate
  ᵒ÷            # Outer divide by using (100..1),(100..1)
    ×           # Multiply (by 100)
     Ṛ          # Reverse
      T         # Transpose
       ȧ        # Absolute difference with main input
        d       # Double
         1≤     # Less than or equal to 1
           ᶤa   # Find first where any true
             ꜝ  # Increment by 1

```

Created with the help of Luminespire.
> 4 votes

# Answer
# APL+WIN, 35 bytes

Prompts for input:

```
⌊/(⎕=(⌈n-.5),⌊.5+n←100×÷m)/m,m←⍳100

```

Try it online! Thanks to Dyalog Classic
> 4 votes

# Answer
# Python 3, ~~85~~ 72 bytes

-13 bytes since I saw answers to other questions use a function

```
lambda x:[a for a in range(68)for b in range(a)if abs(x-100*b/a)<=.5][0]

```

try it online!, or see all the numbers

pre-golf:

```
x=int(input())
for a in range(68):        # for all denominators (starting from lowest)
 for b in range(a):        # and numerators (bonus, doesn't let /0 through)
  if abs(x-100*b/a)<=.5:   # is it within rounding range, up or down?
   print(a)                # then print the denominator
   exit()                  # anything else will be bigger

```

credit to oeis for sequence and formula
> 4 votes

# Answer
# 05AB1E, 15 bytes

```
∞.ΔтLт*s/α2zs@à

```

Try it online or verify all outputs.

**Explanation:**

```
∞                # Push an infinite positive list: [1,2,3,...]
 .Δ              # Pop and find the first/smallest that's truthy for:
   тL            #  Push a list in the range [1,100]
     т*          #  Multiply each by 100: [100,200,...,10000]
       s/        #  Divide each by the current integer
         α       #  Get the absolute difference of each with the (implicit) input
          2zs@   #  Check for each whether it's <= 0.5:
          2      #   Push 2
           z     #   Pop and push 1/2
            s    #   Swap so the list is at the top
             @   #   >= check
              à  #  Pop and check if any in the list is truthy
                 # (after which the result is output implicitly)

```
> 3 votes

# Answer
# 05AB1E, 15 bytes

```
∞.ΔDÝs/т*α2zs@à

```

Try it online!

Explanation:

```
∞        Push infinite list
.Δ       Find first item in list where:
    D    Duplicate item
    Ý    Create an array 0-N
    s/   Switch last two and divide
    т*   Multiply by 100
    α    Absolute difference (input is automatically in stack)
    2zs  Push 0.5 before the last item
    @    Compare 0.5 with list (>=)
à        Check if the list contains 1

```
> 3 votes

# Answer
# Charcoal, 24 bytes

```
ＮθＩ⌊Φφ∧ιΦφ¬‹·⁵↔⁻θ∕×λ¹⁰⁰ι

```

Try it online! Link is to verbose version of code. Very slow as it does about 1,000 times as much work as necessary. Explanation: Uses the OEIS formula.

```
Ｎθ                          First input as a number
     φ                      Predefined variable `1000`
    Φ                       Filter on implicit range
       ι                    Current value
      ∧                     Logical And
         φ                  Predefined variable `1000`
        Φ                   Filter on implicit range
                   λ        Inner value
                  × ¹⁰⁰     Multiplied by `100`
                 ∕          Divided by
                       ι    Outer value
              ↔⁻            Absolute difference with
                θ           Input number
          ¬‹·⁵              Is less than or equal to `0.5`
   ⌊                        Take the minimum
  Ｉ                         Cast to string
                            Implicitly print

```
> 2 votes

# Answer
# , 53 bytes

```
f=\(n,x=1)`if`(all(abs(n-100*(1:x)/x)>.5),f(n,x+1),x)

```

Try it online!
> 1 votes

# Answer
# AWK, 66 bytes

```
{for(;i++<99;)for(j=0;j++<r=i;)if(.5>=(n=$1-100*j/i)&&n>=-.5)next}

```

Try it online!
> 1 votes

---
Tags: code-golf, arithmetic
---


title: Night hike partitioning

text:
# Question
Title: Night hike partitioning
We want to go on a night hike with the youth group, but of course not everyone has their torch, even though we told them we planned to split up. What options are there for group formation if *n* teens have *m* torches with them, but each group needs at least one torch?

**Example**: Three teens with torches (`X`) and two without (`x`) can be divided up as `XXXxx` (all together), `XX Xxx`, `XXx Xx`, `XXxx X`, `X X Xxx` or `X Xx Xx`.

**Input**: A list in any form with *n* elements from two different symbols, e.g. a string as above `XXXxx` or a list `[True, True, True, False, False]`. It can be assumed that the input is sorted and only contains valid entries.

**Output**: A list with all possibilities in a format corresponding to the input in an order of your choice, but without duplicates (`Xx` is the same as `xX`).

**Test data**:

```
X       --> X
Xxxxxx  --> Xxxxxx
XXxx    --> XXxx,Xx Xx,X Xxx
XXXxx   --> XXXxx,XX Xxx,XXx Xx,XXxx X,X X Xxx,X Xx Xx
XXXXX   --> XXXXX,XXXX X,XXX XX,XXX X X,XX XX X,XX X X X,X X X X X

```

# Answer
# Nekomata, 6 bytes

```
Ooᵐᵗžũ

```

Attempt This Online!

Takes input as a sorted list of `1`s and `0`s, where `1` means with torch and `0` means without torch.

```
Ooᵐᵗžũ
O       Set partition; split the input into a list of subsets
 o      Sort
  ᵐᵗž   Check that each subset contains at least one nonzero element
     ũ  Remove duplicate solutions

```
> 7 votes

# Answer
# 05AB1E, 16 bytes

```
œ€.œ€`€€{€{êʒ€àP

```

I/O as a list of `1`s/`0`s for `X`s/`x`s respectively.

I have the feeling the first part of the code can be substantially shorter and I'm missing some obvious builtin combinations.. :/

Try it online or verify all test cases.

**Explanation:**"

```
œ€.œ€`€€{€{ê # Get all unique sorted partitions:
œ            #  Get all permutations of the (implicit) input-list
 €.œ         #  Get all partitions of each permutation
    €`       #  Flatten this list of lists of lists of 1s/0s one level down
      €€{    #  Sort the values inside the parts of partitions
         €{  #  Sort the parts of each partition
           ê #  Sorted-uniquify the list of sorted partitions
ʒ            # Filter this list of partitions by:
 €à          #  Get the maximum of each part
   P         #  Take the product to check if all are truthy
             # (after which the filtered list is output implicitly)

```
> 4 votes

# Answer
# Jelly, 15 bytes

I'm very prepared for a smarter approach to trounce this!

```
Œ!ŒṖ€ẎṢ€ṢẸƇƊƑƇQ

```

A monadic Link that accepts a list of zeros (no torch) and ones (has torch) that yields a list of the possible partitions.

**Try it online!**

### How?

```
Œ!ŒṖ€ẎṢ€ṢẸƇƊƑƇQ - Link: Hikers
Œ!              - all permutations of {Hikers}
  ŒṖ€           - list partitions of each
     Ẏ          - tighten to a single list of hiker partitions
             Ƈ  - keep those for which:
            Ƒ   -   is invariant under?:
           Ɗ    -     last three links as a monad - f(hiker partition):
      Ṣ€        -       sort each group
        Ṣ       -       sort that
          Ƈ     -       keep those for which:
         Ẹ      -         any? (has torch?)
              Q - deduplicate

```
> 3 votes

# Answer
# JavaScript (ES6), 106 bytes

*-1 thanks to @l4m2*

Expects a string with leading `1`'s for `X`'s and trailing `0`'s for `x`'s.

Returns a single string with commas and line breaks as separators.

```
f=(s,o=O=[],p="1")=>s-(q=s.replace(p,""))?f(q,[...o,p].sort())+f(s,o,p+0)+f(s,o,p+1):O[o]||s?"":O[o]=o+`
`

```

Try it online!
> 3 votes

# Answer
# JavaScript (Node.js), 96 bytes

```
f=(s,o=[],p="1")=>s-(q=s.replace(p,""))&&p<o[0]+f?f(q,[p,...o])+f(s,o,p+0)+f(s,o,p+1):s?"":o+`
`

```

Try it online!

From Arnauld's

# JavaScript (Node.js), 82 bytes, slow

```
f=(s,o=[],p=s)=>p?(s-(q=s.replace(p,""))?f(q,[p,...o],p):'')+f(s,o,p-1):s?'':o+`
`

```

Try it online!
> 2 votes

# Answer
# Charcoal, 52 bytes

```
⊞υ⟦⟧ＦＳ«≔υθ≔⟦⟧υＦθ«Ｆκ⊞υＥκ⎇⁼ν⌕κλ⁺μιμ¿⁼ιX⊞υ⊞ＯκX»»Φυ⁼κ⌕υι

```

Try it online! Link is to verbose version of code. Assumes the input contains `X`s optionally followed by `x`s. Explanation:

```
⊞υ⟦⟧

```

Start with all possibilities of `0` elements.

```
ＦＳ«

```

Loop over the elements.

```
≔υθ≔⟦⟧υＦθ«

```

Loop over a saved copy of the possibilities and start collecting new possibilities.

```
Ｆκ⊞υＥκ⎇⁼ν⌕κλ⁺μιμ

```

Add the current element to each of the unique lists in this possibility. (If there are duplicates then this doesn't prevent them, it just ensures that they are sorted so that they can be identified as duplicate.)

```
¿⁼ιX⊞υ⊞ＯκX

```

If the current element is an `X` then also add it as a new list.

```
»»Φυ⁼κ⌕υι

```

Deduplicate and output the found possibilities.
> 1 votes

# Answer
# Perl 5 `-MList::Util=uniq -F`, 114 bytes

```
$X=y/X//;$x=y/x//;say for uniq grep{s/^ +| +$//g;!/xX|\bx+\b|  /&&$X==y/X//&&$x==y/x//}sort glob"{X,x,' '}"x(@F*3)

```

Try it online!

It's extremely slow. TIO times out on any input longer than 4 characters.
> 0 votes

---
Tags: code-golf, string, math, array, set-partitions
---


title: Auto-golf an esolang

text:
# Question
Title: Auto-golf an esolang
The lack of a social life drove a poor nerd into inventing another superfluous esolang called `!+~%`. For no good reason it initializes the accumulator with `6` and knows the following commands:

* `!` (`out(Accu); Accu = 6`) prints the accumulator value as decimal string to stdout (without newline) and resets the accumulator to its initial value `6`
* `+` (`Accu = Accu + 7`) adds `7` to the accumulator
* `~` (`Accu = uccA`) reverses the order of digits of the decimal value in the accumulator
* `%` (`Accu = 1Accu mod Accu`) replaces the accumulator by (`1` in front of the accumulator) modulo accumulator

Easier to understand with an example. `%!+~!` produces `431`: Initially, the accumulator is `6`. `%` replaces it by `16 mod 6`, which is **`4`**, which is printed by the following `!`, while the accumulator is reset to `6`. `+` adds `7` and the `~` command reorders the `13` to be **`31`**, which is printed

For some boring-to-proof reason, the language allows to print any non-negative integer and code golfers around the world are seriously concerned about a flood of »what is the shortest code to produce 6431?« type of challenges. But you can prevent that!

**Task**: Write a program to output the code golfed `!+~%` code to produce a given number!

**Input**: A non-negative integer value in any format yo love (except `!+~%` ;-)

**Output**: The shortest `!+~%` code to produce that output (only one of the possible solutions)

**The shortest code** (in any language) **wins**.

**Test data**:

```
0     --> ++%!
1     --> +%%!
2     --> %%!
3     --> +~%%!
4     --> %!
5     --> +++%%!
6     --> !
12    --> +++%%+!
20    --> ++!
43    --> ++++~!
51    --> +%%++~!
654   --> !+~++~!
805   --> +++%~++~+~!
938   --> +%!+~+!
2518  --> %+++!%++!
64631 --> !%!!+~!

```

# Answer
> 5 votes
# JavaScript (ES6), 139 bytes

*-1 thanks to @l4m2*

Expects the target integer as a string.

```
n=>eval("for(k=0;(g=i=>i?g(i>>2,v=(i&=3)<3?[v+7,+[...v+''].reverse().join``,('1'+v)%v][i]:(r+=v,6),o+='+~%!'[i]):r)(k++,o=r='')!=n;v=6);o")

```

Try it online!

# Answer
> 4 votes
# 05AB1E, 47 bytes

```
"%!+~"∞5в0δKÙ.Δ´6svyiˆ6ëÐÂr1ìs%s7+)yè}}ˆ¯JQ}1ªè

```

Brute-force, so pretty slow. Outputs as a list of characters.

Try it online or verify the first ten test cases.

**Explanation:**

```
"%!+~"          # Push this string (which we use at the end)
 ∞              # Push an infinite positive list: [1,2,3,...]
  5в            # Convert each integer to a base-5 list
     δ          # Map over each inner list:
    0 K         #  Remove all 0s
       Ù        # Uniquify this infinite list of lists
 .Δ             # Pop and find the first list that's truthy for:
   ´            #  Empty the global array
   6            #  Push a 6 to start with
   s            #  Swap so the current list is at the top of the stack
    v           #  Pop and loop over its digits:
     yi         #   If the current digit is a 1:
       ˆ        #    Pop and add the current integer to the global array
       6        #    Push a 6 to reset
      ë         #   Else (the current digit is a 2, 3, or 4):
       Ð        #    Triplicate the current integer
        Â       #    Bifurcate the top; short for Duplicate & Reverse copy
         r      #    Reverse the order of the (four items on the) stack
        1ì      #    Prepend a 1
          s     #    Swap the top two values
           %    #    Modulo
        s       #    Swap the top two values again
         7+     #    Add 7
            )   #    Wrap all three items into a list: [reverse(n),1n%n,n+7]
             yè #    Modular 0-based the current digit into it:
                #     2→n%7; 3→reverse(n); 4→1n%n
      }         #   Close the if-else statement
    }           #  Close the loop
     ˆ          #  Pop and add the final value to the global array as well
      ¯         #  Push the global array
       J        #  Join it together to a single string
        Q       #  Check whether it equals the (implicit) input-integer
  }1ª           # After we've found a result: append a 1
     è          # Modular 0-based index into the "%!+~"-string:
                #  1→!; 2→+; 3→~; 4→%
                # (after which this list of characters is output implicitly as result)

```

# Answer
> 3 votes
# JavaScript (Node.js), ~~121~~ 119 bytes

```
f=(n,a='',b,c=6,...s)=>n!=b?f(n,...s,a+'+',b,c+7,a+'-',b,+[...c+''].reverse().join``,a+'%',b,('1'+c)%c,a+'!',[b]+c,6):a

```

Try it online!

Modified from my https://codegolf.stackexchange.com/a/265841/

# Answer
> 3 votes
# Jelly, ~~45~~ 43 bytes

```
¹©ṃ“Ṿ;ɼ6“+7“D1;Ḍ%ṛṛ?“ṚḌ”v@ƒ6®Ḋ⁼
1ç1#ṃ“!+%~”

```

Try it online!

Since it’s permissible to output garbage to STDOUT while returning the actual answer as the pair of link’s return value, this is one byte shorter than the previous version which avoids doing so.

A pair of links called as a monad with a decimal string argument (e.g. `"5"`) and returning a string program in `!+~%` golfed to output the relevant number. Relatively slow, brute force solution.

Originally got stuck for any programs that included `%` on 0, but now fixed at the cost of three bytes (which I then managed to shave off another way!)

# Answer
> 2 votes
# Python, 156 bytes

*-2 bytes, thanks to STerliakov*

*simple brute force approach, takes input as a (decimal) string*

```
def f(N):
 s="";S=[(6,s,s)]
 while s!=N:(a,b,s),*S=S;A=str(a);S+=[(6,b+"!",s+A),(a+7,b+"+",s),(int(A[::-1]),b+"~",s),(a and int("1"+A)%a,b+"%",s)]
 return b

```

Attempt This Online!

# Answer
> 2 votes
# Charcoal, ~~79~~ 65 bytes

```
⊞υ⟦ω⁶ω⟧Ｆυ¿¬ⅈ¿¬⌕ιθ⊟ι«≔§ι¹ηＦ⪪⟦η⁻⁶η!ω⁷+ω⁻⮌ηη~ω∧η⁻﹪ＸχＬηηη%⟧³⊞υＥκ⁺λ§ιμ

```

Try it online! Link is to verbose version of code. Explanation: Based on @bsoelch's Python answer.

```
⊞υ⟦ω⁶ω⟧Ｆυ

```

Start a breath-first search with a state with no output, an accumulator of `6` and no commands yet.

```
¿¬ⅈ

```

Stop when a solution is found.

```
¿¬⌕ιθ⊟ι«

```

If a solution is found then print it, otherwise...

```
≔§ι¹η

```

Extract the current value from the state.

```
Ｆ⪪⟦η⁻⁶η!ω⁷+ω⁻⮌ηη~ω∧η⁻﹪ＸχＬηηη%⟧³

```

Create a list of updates, representing a string to output, an amount to add to the current value, and a command to execute, and split the list into groups of three elements.

```
⊞υＥκ⁺λ§ιμ

```

Add each group pairwise to the original state, creating four new states to be processed.

# Answer
> 2 votes
# Haskell, 165 bytes

```
s%x=x++s%[(c++[p],x,y)|(c,a,o)<-x,(p,x,y)<-zip3"!+~%"[6,a+7,read$reverse$s a,read('1':s a)`mod`a][o++s a,o,o,o++['-'|a<1]]]
f n=[c|(c,_,o)<-show%[("",6,"")],o==n]!!0

```

Attempt This Online!

---
Tags: code-golf, math, interpreter, metagolf, golfing-language
---


title: I baked you a pie!

text:
# Question
Title: I baked you a pie!
There is an asdfmovie video about a pie flavoured pie. Someone also made an edited version with more pies, so I created this challenge.

The input is a positive integer.

The code should first output the following string:

```
I baked you a pie!
Oh boy, what flavour?

```

Then, the next line should be `PIE`  (input number of times) + `flavour.`.

Next, print a blank line.

After that, ASCII-art pies should be drawn.

Here is what a size-1 pie looks like.

```
 _________
/         \
-----------
 \       /
  -------

```

Size-2 pie:

```
 _____________
/             \
---------------
 \           /
  -----------

```

Size-3 pie:

```
 _________________
/                 \
-------------------
 \               /
  ---------------

```

Each pie starting from size-2 should be four characters longer on each line than the pie one smaller.

The program should draw (input number + 1) pies, seperated by newlines, with increasing sizes (1 at the top, 2 directly below it, etc).

The pies should be centred.

Examples:

Input 1

```
I baked you a pie!
Oh boy, what flavour?
PIE flavour.

   _________
  /         \
  -----------
   \       /
    -------
 _____________
/             \
---------------
 \           /
  -----------

```

Input 2

```
I baked you a pie!
Oh boy, what flavour?
PIE PIE flavour.

     _________
    /         \
    -----------
     \       /
      -------
   _____________
  /             \
  ---------------
   \           /
    -----------
 _________________
/                 \
-------------------
 \               /
  ---------------

```

Input 3

```
I baked you a pie!
Oh boy, what flavour?
PIE PIE PIE flavour.

       _________
      /         \
      -----------
       \       /
        -------
     _____________
    /             \
    ---------------
     \           /
      -----------
   _________________
  /                 \
  -------------------
   \               /
    ---------------
 _____________________
/                     \
-----------------------
 \                   /
  -------------------

```

This is code-golf, so use any language, shortest code wins.

# Answer
# 05AB1E, 126 bytesUTF-8 (87) bytes)

```
Ý·ε5+'_×1ú'/'-6y+×D„ \s¨¨2ú).B.º}˜.c…PIEIиðý.•FóG ñ•ÁDŠ“I baked€î€…Èš!
Ohíå,€Àÿ?
ÿÿ.

ÿ

```

Try it online.

*†: Could be **86 bytes** by using `.•FóG ñ•Á` instead of `" flavour"`, but the longer one is cheaper in UTF-8 encoding..*
Try it online.

**Explanation:**

```
Ý                # Push a list in the range [0, (implicit) input]
 ·               # Double each value in this list
  5+             # Then add 5 to each value
    ε            # Map over each 2v+5 value `y`:
     '_×        '#  Push a string of that many "_"
        1ú       #  Prepend a leading space
     '/         '#  Push "/"
     '-y>×      '#  Push a string with y+1 (2v+6) amount of "-"
     D           #  Duplicate it
     „ \         #  Push string " \"
     s           #  Swap so the duplicated "-"-string is at the top again
      ¨¨         #  Remove two "--" (2v+4 amount of "-")
        2ú       #  And pad two leading spaces instead
          )      #  Wrap all five strings into a list
           .B    #  Add trailing spaces to make all strings the same length
             .º  #  Mirror each line with overlap
  }˜             # After the map: flatten the list of lists of lines
    .c           # Add leading spaces to centralize all lines,
                 # and join all lines with newline delimiter
…PIE             # Push string "PIE"
    Iи           # Repeat it the input amount of times as list
      ðý         # Join it with space delimiter
.•FóG ñ•         # Push compressed string "flavour "
        Á        # Rotate it to " flavour"
         D       # Duplicate it
          Š      # Tripleswap the top three values on the stack
“I baked€î€…Èš!  # Push dictionary string "I baked you a pie!
Ohíå,€Àÿ?        # Oh boy, what pie?
ÿÿ.              # ÿÿ.
                 #
ÿ                # ÿ",
                 # where the ÿ are one by one filled with the strings on the stack
                 # (after which it is output implicitly as result)

```

See this 05AB1E tip of mine (sections *How to use the dictionary?* and *How to compress strings not part of the dictionary?*) to understand why `.•FóG ñ•` is `"flavour "` and `“I baked€î€…Èš!\nOhíå,€Àÿ?\nÿÿ.\n\nÿ` is `"I baked you a pie!\nOh boy, what pie?\nÿÿ.\n\nÿ"`.
> 1 votes

# Answer
# Perl 5 \+ `-M5.10.0 -na`, 169 bytes

```
say"I baked you a pie!
Oh boy, what flavour?
","PIE "x$_,"flavour.
",map{$i="  "x("@F"-$_)," __",_ x($#a=7+4*$_),"
$i/ @a \\
$i----",$j="-"x$#a,"
$i \\@a/
$i  $j
"}0..$_
```

Try it online!
> 2 votes

# Answer
# JavaScript (ES6), 176 bytes

Builds the output recursively, from bottom to top.

```
f=(n,p,s=`I baked you a pie!
Oh boy, what flavour?
`)=>~n?f(n-1,-~p,s+=n?"PIE ":`flavour.
`)+`
 _2_
/ 0 \\
--1--
 \\0/
  1`.replace(/^|\d/gm,i=>" -_"[+i].repeat(i?7+n*4:p*2)):s

```

Try it online!

### Commented

```
f = (                       // f is a recursive function taking:
  n,                        //   n = input
  p,                        //   p = left-padding counter
  s =                       //   s = header string
  `I baked you a pie!\n` +  //
  `Oh boy, what flavour?\n` //
) =>                        //
~n ?                        // if n is greater than -1:
  f(                        //   do a recursive call:
    n - 1,                  //     decrement n
    -~p,                    //     increment p
    s += n ? "PIE "         //     append "PIE " to s if n != 0
           : `flavour.\n`   //     or the final part otherwise
  ) + (                     //   end of recursive call
    `\n` +                  //  \
    ` _2_\n` +              //   |  this is our pie template
    `/ 0 \\\n` +            //   |_ where digits 0, 1 and 2
    `--1--\n` +             //   |  are used as placeholders
    ` \\0/\n` +             //   |  for repeated characters
    `  1`                   //  /
  ).replace(                //   replace in the template:
    /^|\d/gm,               //   each beginning of line and
    i =>                    //   each digit with:
    " -_"[+i]               //     one of these characters
    .repeat(                //     repeated:
      i ?                   //       if this is a digit:
        7 + n * 4           //         7n + 4 times
      :                     //       else (left padding):
        p * 2               //         2p times
    )                       //     end of repeat()
  )                         //   end of replace()
:                           // else:
  s                         //   return the header string

```
> 2 votes

# Answer
# Charcoal, 88 characters, 140 bytes

```
ＮθI baked you a pie!¶Oh boy, what flavour?¶×PIE θflavour.Ｄ⎚ＤＦ⁺⁵⊗…⁰⊕θ«←×_ι↓ /Ｐ⊕ι↘-\⊖ι↙»‖Ｂ

```

Attempt This Online! Explanation:

```
Ｎθ

```

Input the number of PIEs.

```
I baked you a pie!¶Oh boy, what flavour?¶×PIE θflavour.Ｄ⎚

```

Output the desired text.

Output an extra blank line.

```
Ｆ⁺⁵⊗…⁰⊕θ

```

Loop over the half pie widths.

```
«←×_ι↓ /Ｐ⊕ι↘-\⊖ι↙»

```

Draw the left half of a pie to the canvas.

```
‖Ｂ

```

Reflect to complete the pies.

Would be 83 SBCS bytes using string compression:

```
Ｎθ”(KＲC¿~8◨±⦄⊕⁰↙]V⊕ＡＣＹ>|⊙Ｃ↙∕›…<·ＤÞ↖pÞ”×PIE θflavour.Ｄ⎚ＤＦ⁺⁵⊗…⁰⊕θ«←×_ι↓ /Ｐ⊕ι↘-\⊖ι↙»‖Ｂ

```

Attempt This Online! Link is to verbose version of code.
> 1 votes

---
Tags: code-golf, ascii-art
---


# Question
Title: Smallest integer \$n\$ such that \$\frac{\sqrt{\log_2{n}}}{(\log_2 {\log_2 n})^2} > 1\$
Write code that outputs the smallest integer \\$n \> 5\\$ such that \\$\frac{\sqrt{\log\_2{n}}}{(\log\_2 {\log\_2 n})^2} \> 1\\$. Your code may have at most one digit in its source code. You can use your chosen digit more than once however.

By digits we are only counting the ASCII characters between 0x30 and 0x39 (inclusive).

# Answer
> 14 votes
# Python, 22 bytes

```
print(-~2**2**2**2**2)

```

Attempt This Online!

According to WolframAlpha, the equation \\$\sqrt{\log\_2(x)} = \log\_2(\log\_2(x))^2\\$ has three solutions. Two real numbers around 1 and 5 and a very large integer solution. So what is that large integer solution?

simple transformations on both sides yield $$ \log\_2(x)^{\frac 1 4} = \log\_2(\log\_2(x)) \\ 2^{2^{log2(x)^{1/4}}} = x $$ Now, lets substitute \\$y=log2(x)^{1/4}\\$. Note that \\$y\\$ has to be an integer as well. This yields two equations: $$ 2^{2^y} = x, \quad y=\log\_2(x)^{\frac 1 4} \\ 2^{2^y} = x, \quad y^4=\log\_2(x) \\ 2^{2^y} = x, \quad 2^{y^4}=x \\ 2^{2^y} = 2^{y^4} \\ 2^y = y^4 \\ $$

The only integer solution to this is \\$y=16\\$, leaving us with \\$x=2^{16^4}=2^{2^{2^{2^2}}}\\$. The first integer that satisfies the inequality is \\$x+1\\$.

# Answer
> 7 votes
# \+ gmp, 25 bytes

```
gmp::as.bigz(2)^2^2^2^2+T

```

Try it at RDRR!

Port of @ovs’ Python answer, so be sure to upvote that one too! R has no native bigint support so this needs the gmp package.

# Answer
> 6 votes
# Vyxal, 29 bitsv2, 3.625 bytes

```
k₴E›

```

Try it Online!

Bitstring:

```
10000100001000010110011010000

```

Port of the python answer, but without any digits at all.

## Explained

```
k₴E›
k₴E   # 2 ** 65536
   ›  # + 1

```

Created with the help of Luminespire.

# Answer
> 6 votes
# JavaScript (Node.js), 21 bytes

*-1 thanks to @l4m2*

The only (decimal) digit used in the source is `0`.

```
_=>-~(-~0n>>~0xFFFFn)

```

Try it online!

This computes \\$1+2^{1+65535}\\$

---

With all the BigInt suffixes and extra parentheses due to a different operator precedence, a direct port of ovs' answer would be **25 bytes**:

```
_=>-~(2n**2n**2n**2n**2n)

```

Try it online!

# Answer
> 6 votes
# Wolfram Language(Mathematica), 13 bytes

Try it online!

```
2^2^2^2^2+2/2

```

# Answer
> 5 votes
# Charcoal, 8 bytes

```
Ｉ⊕Ｘ²Ｘ⁴¦⁸

```

Try it online! Link is to verbose version of code. Explanation:

```
   ²        Literal integer `2`
  Ｘ         Raised to power
     ⁴      Literal integer `4`
    Ｘ       Raised to power
       ⁸    Literal integer `8`
 ⊕          Incremented
Ｉ           Cast to string
            Implicitly print

```

10 bytes using only one superscript digit:

```
Ｉ⊕Ｘ²Ｘ⊗²⊗⊗²

```

Try it online! Link is to verbose version of code. Explanation: As above, but uses `Doubled` () to make `4` and `8` from `2`. (A port of @ovs' Python solution would have been 12 bytes.)

# Answer
> 3 votes
# Jelly, 5 bytes

```
⁹²2*‘

```

Try it online!

Port of @ovs’ Python answer, so be sure to upvote that one too! The superscript digits are permitted as per reply to comment from @Simd (the OP).

## Explanation

```
⁹     | 256
 ²    | Squared
  2*  | 2 to the power of this
    ‘ | +1

```

# Answer
> 2 votes
# Haskell, 14 bytes

```
succ$2^2^2^2^2

```

Try it online!

Port of @ovs python answer

# Answer
> 2 votes
# Nekomata, 5 bytes

```
¥:*Ë→

```

Attempt This Online!

```
¥:*Ë→
¥       Push 256
 :      Duplicate
  *     Multiply
   Ë    Power of 2
    →   Increment

```

# Answer
> 2 votes
# dc, 12

```
2dddd^^^^z+p

```

Try it online!

# Answer
> 2 votes
# Alice, 14 bytes

Try it online!

The trailing new line is required
I'm using a screenshot as the non ascii character gets removed on save

Port of lyxal's solution

Explanation:

```
2                Pushes 2 on the stack
 '0xFFFF         Pushes 65535 on the stack
   h             Increment the top of the stack
    E            Pop y, pop x, push x^y
     h           Increment the top of the stack
      / O @      Output and exit

```

Same byte count using `Ā` for \\$256 * 256 = 65536\\$

```
2'Ā.*Eh/ O @

```

Try it online!

# Answer
> 2 votes
# 05AB1E, 4 bytes

```
₁no>

```

Try it online.

Without using the superscript number(s) either, it's still 4 bytes:

```
žHo>

```

Try it online.

**Explanation:**

```
₁     # Push builtin 256
 n    # Square it to 65536

žH    # (or alternatively) Push builtin 65536

  o   # Pop and push 2 to the power this 65536
   >  # Increase it by 1
      # (which is output implicitly as result)

```

# Answer
> 2 votes
# , 9 bytes

```
>:^^:*~2x

```

Attempt This Online!

```
>:^^:*~2x
       2x    bigint 2
  ^^:*~      call ^^:* with 2x on both sides:
   ^:          repeat
  ^            2^ (2 is the left argument of ^:)
     *         2*2 times (the 2s are the left and right arguments of ^:)
             the result so far = 2^(2^(2^(2^(2))))
>:           increment

```

Bonus 10 and 11 bytes:

```
>:2x^*:#a.
        a.    a built-in string containing 256 extended ascii chars
       #      length of it (256)
     *:       square
  2x^         raise 2 to the power of that
>:            increment

>:^/2>.i:2x
       i:2x   -2 -1 0 1 2
    2>.       apply max(2, x) to each element; 2 2 2 2 2
  ^/          reduce by ^ from the right; 2^(2^(2^(2^(2))))
>:            increment

```

# Answer
> 1 votes
# PowerShell Core, 32 bytes

Try it online!

Explanation:

```
                  1+0xFFFF[!1]     # Calculates 65536
[bigint]::pow(1+1,            )    # Calculates 2^65536
                               +1  # Increments by 1 and implicitly prints on stdout

```

# Answer
> 1 votes
# sclin, 18 bytes

```
1 1+""S>c1+ ^1+

```

Try it on scline!

Didn't read the question closely x\_x.

---
Tags: code-golf, kolmogorov-complexity, restricted-source
---


title: ASCII-art milk carton

text:
# Question
Title: ASCII-art milk carton
The following is an unfolded milk carton:

```
+-----+-\|/-+-----+-\|/-+-+
|     | / \ |     | / \ | |
+-----+/---\+-----+/---\+-+
|     |     |     |     | |
|     |     |     |     | |
|     |     |     |     | |
+-----+-----+-----+-----+-+
 \   / \   / \   / \   /
  \_/   \_/   \_/   \_/

```

This is a challenge. Your task is to output the above ASCII-art milk carton.

Your output may have any whitespace that does not affect the appearance of the image.

# Answer
# Charcoal, 49 bytes

```
Ｆ⁷Ｂ⁻⁹＆²ι⁻⁷＆⁴ιＰ“↗⎇≦∨⎚üＵP@>⁼γa”Ｃ⁶¦⁰Ｍ⁹→Ｐ^³Ｍ←\|/Ｃ¹²¦⁰

```

Try it online! Link is to verbose version of code. Explanation:

```
Ｆ⁷Ｂ⁻⁹＆²ι⁻⁷＆⁴ι

```

Draw the front and what will become the overlap.

```
Ｐ“↗⎇≦∨⎚üＵP@>⁼γa”

```

Draw one of the flaps at the bottom.

```
Ｃ⁶¦⁰

```

Copy the front to the side.

```
Ｍ⁹→Ｐ^³Ｍ←\|/

```

Draw the folds on the side.

```
Ｃ¹²¦⁰

```

Copy to the back and other side.
> 7 votes

# Answer
# Python, 133 bytes

```
for x in b"WwwWB7WQ&ff&6F&!WwwSwtWQ&ff&!&ff&!&ff&!WwwWQdfcfafH6fa".hex().translate(9*"_,|/\+ -").split(","):print((3*x[:-3]+x)[-27:])

```

Attempt This Online!

# Python, 137 bytes

print(b"YWB7YWB7WQ(&6F(&6F&!YSwtYSwtWQ((((&!((((&!((((&!YYYYWQdfcdfcdfcdfca````".hex().translate(9*[*"|/\+ -",5*" ",5*"-"," \_/ ","\n"]))
</code></pre>

Attempt This Online!

Could probably save a few more bytes allowing nonprintables.
> 5 votes

# Answer
# Vim, ~~100~~ ~~99~~ 97 bytes

```
4i+-----<Esc>a+-+<Esc>yyppO<Esc>4i|     <Esc>a| |<Esc>yyPPkPk8lqqR\|/<Esc>jr\jlr\4hr/klr/qk12l@qGo<Esc>4a \   /<Esc>o<Esc>4a   \_/<Esc>0x

```

Where `<Esc>` is escape key.

Try it online?

This is probably my first vim answer. Any help is welcome in the comments.

-1 byte by changing `3h3xr+` to `a+-+<Esc>`

-2 bytes by changing `qqr\jr/jhr/4lr\khr\kr/hr|q11l@q` to `qqR\|/<Esc>jr\jlr\4hr/klr/qk12l@q`

### Explanation:

The explanation is separated into 5 smaller sections.

#### 1

```
4i+-----<Esc>a+-+<Esc>
4i+-----<Esc>                # insert "+-----" 4 times
             a+-+<Esc>       # put "+-+" in the end of line

```

#### 2

```
yyppO<Esc>4i|     <Esc>a| |<Esc>
yy                                # copy the entire line (not sure why Y doesn't work for me)
  pp                              # paste 2 times
    O<Esc>                        # make a new line above the current line
          4i|     <Esc>           # insert "|     " 4 times
                       a| |<Esc>  # put the "| |" in end of line

```

#### 3

```
yyPPkPk8l
yy         # copy the entire line
  PP       # paste two times (above the current line)
    k      # move up
     P     # paste above of the line
      k    # move up
       8l  # move right 8 cells

```

#### 4

```
qqR\|/<Esc>jr\jlr\4hr/klr/qk12l@q
qq                                 # record in the register q
  R\|/<Esc>                        # replace the actual cell with '\', then the next cell '|', then the next cell '/'.
           jr\                     # move down, replace the actual cell with '\'
              jlr\                 # move down, then right, then replace the actual cell with '\'
                  4h               # move left 4 times
                    r/             # replace the actual cell with '/'
                      klr/         # move up, then right, then replace the actual cell with '/'
                          q        # stop recording
                           k       # move up
                            12l    # move right 12 times
                               @q  # playback register 'q'

```

#### 5

```
Go<Esc>4a \   /<Esc>o<Esc>4a   \_/<Esc>0x
G                                               # go to the last line
 o<Esc>                                         # make a new line.
        a \   /<Esc>                            # insert " \   /" 4 times
                    o<Esc>                      # make a new line below the line
                          4a   \_/<Esc>         # insert "   \_/" 4 times
                                       0x       # delete the first character of the line

```

Every section is created with the help of Luminespire.
> 5 votes

# Answer
# Vyxal 3, 65 bytes

```
81ᶴ|+y81ᶴ -y3YJṅ"ᶜgṢṆĊ“"|- \/"y⁻'-4«+JD2ΘṅWfT“" \   /  \_/ "½ddJ”

```

Try it Online!

**Explanation**:

```
81ᶴ|+y81ᶴ -y3YJṅ"ᶜgṢṆĊ“"|- \/"y⁻'-4«+JD2ΘṅWfT“" \   /  \_/ "½ddJ”
81   y81   y                                                       # Base decompress 81 twice with chars ...
   |+     -                                                        # ... "|+" and " -" (push "+|+|||+", "- -   -")
            3YJṅ                                                   # Repeat latter three times, join and palindromise
                "ᶜgṢṆĊ“"|- \/"y                                    # Base decompress "ᶜgṢṆĊ“ (9709170788) with chars "|- \/" (push "- /\/-| -/\-- \")
                               ⁻                                   # Split into chunks of length 3
                                '-4«+J                             # Append "-" and 3 spaces to each item, merge lists
                                       2Θṅ                         # Palindromise first two elements
                                      D   WfT“                     # Insert result between two copies of the list, transpose
                                              " \   /  \_/ "       # Halve string, quadruple each half
                                                               J”  # Join with transposed list and format

```

Created with the help of Luminespire.
> 4 votes

# Answer
# ///, ~~147~~ 141 bytes

```
/l/\/\///a/|     lb/-----lc/aaaa| |
lf/ d   elg/  d_e lh/a| e d li/b+lj/+ie---dlk/+i-d|e-ld/\\\\le/\\\lkk+-+
hh| |
jj+-+
ccc+iiii-+
ffff
gggg

```

Try it online!

I'm not going to explain this one.

-6 bytes thanks to @Philippos
> 3 votes

# Answer
# JavaScript (ES11), 143 bytes

A mix of maths and hardcoded XOR patterns.

```
f=(y=9,x)=>~y?` |-+/\\_
`[X=--x%6,x?y<2?x<3|X+~y?X+y-5?X|y?0:6:4:5:["70006","0504","0637"][y-6]?.[x%12-4]^648>>y&2|X==3|x<2:7]+f(y-!x,x||28):""

```

Attempt This Online!

For comparison, using RegPack gives 170 bytes.

### Method

We iterate from \\$y=8\\$ at the top to \\$y=0\\$ at the bottom, and from \\$x=27\\$ on the left to \\$x=0\\$ on the right. We also use \\$X=x\bmod 6\\$. Note that we have \\$X=0\\$ when we're at the middle of a bottom notch.

```
  2       1         0
  7654321098765432109876543210 <-- x
8 +-----+-\|/-+-----+-\|/-+-+\n
7 |     | / \ |     | / \ | |\n
6 +-----+/---\+-----+/---\+-+\n
5 |     |     |     |     | |\n
4 |     |     |     |     | |\n
3 |     |     |     |     | |\n
2 +-----+-----+-----+-----+-+\n
1  \   / \   / \   / \   /   \n
0   \_/   \_/   \_/   \_/    \n
  3210543210543210543210543210 <-- X

```

The 8 distinct characters used in the ASCII art are encoded as follows:

```
0 1 2 3 4 5 6 7
  | - + / \ _ \n

```

The following algorithm is used to select the correct character code:

```
x ?                // if this is not the end of line:
  y < 2 ?          //   if this is the bottom part:
    x < 3 |        //     if this is the rightmost part
    X + ~y ?       //     or X - y is not equal to 1:
      X + y - 5 ?  //       if X + y is not equal to 5:
        X | y ?    //         if X != 0 or y != 0:
          0        //           insert a space
        :          //         else:
          6        //           insert "_"
      :            //       else:
        4          //         insert "/"
    :              //     else:
      5            //       insert "\"
  :                //   else:
    [ "70006",     //     these are the XOR patterns
      "0504",      //     to apply for the most
      "0637" ]     //     complicated cuts at the top
    [y - 6]        //     i.e for 6 <= y <= 8
    ?.[x % 12 - 4] //     they are applied modulo 12
    ^              //
    648 >> y & 2 | //     this gives 2 for y in [2, 6, 8]
    X == 3 |       //     standard vertical lines
    x < 2          //     rightmost vertical line
:                  // else:
  7                //   insert a linefeed

```
> 2 votes

# Answer
# Retina, ~~108~~ ~~105~~ 102 bytes

```

2*$(a+-\|/-)h2*$(b| / \ )| |¶2*$(a+/---\)h3*$(4*b| |¶)4*ah4*$( \   /)¶4*$(  \_/
a
+5*-
b
|5*
h
+-+¶

```

Attempt This Online!

This is my first time using Retina so this can probably be improved on. This program uses Retina's repetition operator `*` extensively.

I'm hoping to reduce the repeated part of `2*$(a+-\|/-)h2*$(b| / \ )| |¶2*$(a+/---\)h` (the `2*$(a+something)h` bit). Any ideas?
> 2 votes

# Answer
# 05AB1E, 71 bytes

```
"+---
|".B4и¨D1è4ǝ… \ Ćª„\_2úª.ºD"+-\|
| /
+/--".B.º2Ýǝ€¦øJεD¦y2£R'\KJ,

```

Try it online.

**Explanation:**

Try it online with step-by-step debug lines.

```
"+---
|"           # Push string "+---\n|"
  .B         # Box it to ["+---","|   "]
    4и       # Repeat it 4 times
      ¨      # Remove the last item
       D     # Duplicate it
        1è   # Pop the copy and get the 0-based 1st item
          4ǝ # Insert it at the 0-based 4th index
… \          # Push string " \ "
    Ć        # Enclose it; append its own head: " \  "
     ª       # Append it to the list
„\_          # Push string "\_"
   2ú        # Pad 2 leading spaces: "  \_"
     ª       # Append it to the list as well
.º           # Mirror each inner string with overlap
D            # Duplicate this list
 "+-\|
| /
+/--"        # Push string "+-\|\n| /\n+/--"
     .B      # Box it to ["+-\|","| / ","+/--"]
       .º    # Mirror each inner string with overlap
         2Ý  # Push list [0,1,2]
           ǝ # Replace the strings at those three indices with this triplet-string
 €¦          # Remove the first character of each inner string
   øJ        # Join the lines in the two lists together
ε            # Map over each line (used as foreach):
 D           #  Duplicate the line
  ¦          #  Remove the first character of the copy
   y         #  Push the current line yet again
    2£       #  Only leave its first two characters
      R      #  Reverse it
       '\K  '# Remove a potential "\" from this string
          J  # Join all three strings on the stack together
           , # Pop and output it with trailing newline

```
> 2 votes

# Answer
# sed, 151 bytes

```
s_^_+-----+-\\|/-_
s/.*/&&+-+/
h
p
y_/\\-|+_\\/  |_
p
x
s_..|.._/---\\_gp
x
y_/\\_  _
p
p
p
x
y_/\\_--_
p
s_.*_ \\   /_
s__&&&&_p
sx\\   x  \\_xg
s_ __

```

Try it online!
> 2 votes

# Answer
# PowerShell, 139

```
$m='-----+';"$("+$m-\|/-"*2)+-+
|$('     | / \ |'*2) |
$("+$m/---\"*2)+-+"
,"$('|     '*4)| |"*3
"+$($m*4)-+
 $(,'\   /'*4)
 $(,' \_/ '*4)"

```

Not very golfed right now, but it's late
> 1 votes

# Answer
# Perl 5 \+ `-M5.10.0`, 133 bytes

```
$;="+-----";say"$;+-\\|/-"x2,$e="+-+
",'|     | / \ 'x2,$d="| |
","$;+/---\\"x2,$e,("|     "x4,$d)x3,$;x4,$e,' \   /'x4,$/,'  \_/ 'x4
```

Try it online!
> 1 votes

---
Tags: code-golf, ascii-art, kolmogorov-complexity
---


# Question
Title: All Your Base Are Belong To Us (Restricted)
Input must not be required, and output must read "`All your base are belong to us`".

Restrictions

* No external resources.

Plus a minimum of two of the following:
* You cannot use "a", "b", "t", "u", or "y" in any case in your code (bonus -10 to your golf score if you can do this)
* You cannot use "l", "o", "s", "e", or "r" in any case in your code (bonus -20 to your golf score if you can do this)
* You cannot use "n", "g", "0", "1", or "2" in any case in your code (bonus -30 to your golf score if you can do this)

So for example, if you manage to get the code done with 40 characters and use rules 1 and 2, your golf score is 40 - 10 - 20 = 10 chars.

Smallest code golf score wins... Good luck!

# Answer
> 6 votes
# SOGL V0.12, 15 - 60 = -45

```
šz█P'zUS½█│β3‘⁾

```

Try it Here!

`šz█P'zUS½█│β3‘` is a compressed string of `all your base are belong to us`, but because that exact string compressed contained `0`, it's split into 3 parts: `all your base are`, , `belong to us` (which cost one byte but gave a -30 byte bonus). The first and last strings are compressed with SOGLs English dictionary, and implicitly joined with spaces. The remaining  is a simple sentence case built-in.
Note that SOGL postdates this challenge, but that's allowed now.

# Answer
> 46 votes
# GolfScript, -22 (38 characters, -60 bonus)

```
"„¯¯c¼²¸µc¥¤¶¨c¤µ¨c¥¨¯²±ªc·²c¸¶"{67-}%

```

# Answer
> 36 votes
# Sclipting, −40

```
뀖롬긇땯덗긠눦굳뉒걡댦넠눦녬닶멧긇끯긇녳

```
* = 20 characters − 60 bonus
* Only works if the input is empty, which I take to be the case; if not, add  in front, changing the score to −39.
* If I can assume the input to be what I want (as this answer apparently does), then the empty program is a solution and my score is −60.

# Answer
> 31 votes
## Brainfuck, 267 - 60 = 207

```
++++++++[>++++++++<-]>+.<+++++++[>++++++<-]>+..>>++++++[<+++++>-]<++.<+++++++++
++++.----------.++++++.---.>.<<++++[>----<-]>.-.<+++[>++++++<-]>.--------------
.>.<----.<++++[>++++<-]>+.-------------.>.<---.+++.+++++++.+++.-.-------.>.<+++
++++++++++.-----.>.<++++++.--.

```

# Answer
> 29 votes
## JavaScript - 140 bytes - 60 bonus = 80 points

```
(x="Ǎľľ y̌ǒǔř b̌ǎšě ǎřě b̌ěľǒňǧ ťǒ ǔš")[x[3*9]+x[34]+"p"+x[4]+x[5*5]+"c"+x[34]]("̌","",x[6*7])

```

Run in Firefox.

I know what you're thinking. No, those aren't the characters that are listed in the question. Those are characters with a caron, or háček (picked randomly from a list of diacritics). Even though they're combining marks, they aren't two separate characters.

# Answer
> 28 votes
## APL (43 - 30 - 20 = -7)

```
⎕AV['⊥┤┤ ø┼&┐ `∣┘û ∣┐û `û┤┼─ù ´┼ &┘'⍳⍨⌽⎕AV]

```

This satisfies rules 2 and 3.

# Answer
> 22 votes
# HTML/CSS 70

```
<p style="transform:rotate(.5turn)">sn oʇ ƃuoləq əɹɐ əsɐq ɹnoʎ llɐ</p>

```

http://jsbin.com/EjekuvuF/1/

I thought I was being clever with the upside down type but then realized I couldn't meet any of the ancillary rules with the actual HTML/CSS. Oh well.

UPDATE:

User Flame suggested a more cross-browser compliant solution:

```
<p style="transform:rotate(180deg)">sn oʇ ƃuoləq əɹɐ əsɐq ɹnoʎ llɐ</p>

```

http://jsbin.com/EjekuvuF/6

# Answer
> 12 votes
## MATLAB, All bonuses: Score of -20 (40-60)

```
['' '¤ÏÏèÜÒØÕèÅÄÖÈèÄÕÈèÅÈÏÒÑÊè×ÒèØÖ'-99]

```

### EDIT:

Note that I am not sure of what the system requirements are to run this, tested on windows. For those struggeling to copy, a similar code can be generated like so:

```
char('All your base are belong to us' + 99)

```

---

If it would have been allowed to ask anything as input, a solution with less characters (but also missing the bonus) would of course be possible.

```
input('')

```

# Answer
> 10 votes
# k (-7 = 53 - 60)

`(#`)"c"$(465%3)-6h$"Z//{\",&){9:(6{:)6{96/,-4{',{&(";`

doesn't include trailing newline, can be added at cost of one additional char:

`(-#`)"c"$(465%3)-6h$"Z//{\",&){9:(6{:)6{96/,-4{',{&(";`

annoyingly, the only offsets that work for this trick are 154 and 155

edit:

if it's sufficient to display the string (rather than printing it), as i suspect the APL solution does (it doesn't work in http://tryapl.com/, so i can't test it properly), it's

```
  "c"$(465%3)-6h$"Z//{\",&){9:(6{:)6{96/,-4{',{&("
"All your base are belong to us"

```

which is -12 = 48 - 60. can i get a ruling on whether this is sufficient?

# Answer
> 10 votes
## Python REPL, ~~122~~ ~~116~~ 98 characters - 30 bonus = ~~92~~ ~~86~~ 68 points

```
>>> '\x41\x6c\x6c \x79\x6f\x75\x72 \x62\x61\x73\x65 \x61\x72\x65 \x62\x65\x6c\x6fng \x74\x6f \x75\x73'

'All your base are belong to us'

```

I could get rid of the zeroes in Python 3.3 by replacing '`\40`' with `\N{SP}`, but alas, the `N` is not permitted.

**Edit**: Inspired by this answer, I've shortened it further by replacing `\x40` by . Moreover, since I already use the `1`, replacing `\156` by `n` and `\x67` by `g` shortens it by another 6 characters while incurring no extra penalty.

# Answer
> 10 votes
### dc, ~~97 - 60 = 37~~ ~~91 - 60 = 31~~ ~~88 - 60 = 28~~ 81 - 60 = 21

```
3C87596P4d^8/P7958389P7479394P6386533P7C89P749698CP644848CP459 8^699 7^3849736388974773333 86-++P

```

Improved version (the main idea here is to vary the input base, to increase the chances of finding a useful big number with no problematic digits):

```
IDi67793554D647F84C836645D6569F69Pi6385C77P9i35PDdi6^I9^+6D59CD83D664D34+P8CPFi98CCF5PCi97P

```

In base 7, the whole thing can become a single number! Lower bases are naturally less compact, but the lack of fix-up operations here makes up for it.

```
7i4398873968644388737548444897643735447698675366869556798538985674336396359936458859886P

```

My first solution used base 10. My second used a mix of base 9, 10, 12, 13, and 15. This one is in base 7. I truly feel like all the base *are* belong to me.

**Last one, seriously:** Base 13 does a great job on the first segment, then base 7 for the rest.

```
Di67793554D647F84C836645D6569F69P7i798789699638355733695878558396339387963789536P

```

# Answer
> 9 votes
# Brainfuck, ~~205~~ 203 - 60 = ~~145~~ 143 bytes

```
++++[->++++<]>[->++++>++>+++++++>++++++>++++++++<<<<<]>+.>>----..<.>>>-------.<<+++.>>----.---.<<<.>>++.-.>+.<++++.<<.>>----.>-.<++++.<<.>>---.+++.<---.>>---.-.<<-----.<.>>>++++++.-----.<<<.>>>++++++.--.

```

Readable version:

```
++++[->++++<]>[->++++>++>+++++++>++++++>++++++++<<<<<]
64 32 112 96 128

>+.>>----..<.                     All                 65 108 108  32
>>>-------.<<+++.>>----.---.<<<.  your           121 111 117 114  32
>>++.-.>+.<++++.<<.               base            98  97 115 101  32
>>----.>-.<++++.<<.               are                 97 114 101  32
>>---.+++.<---.>>---.-.<<-----.<. belong  98 101 108 111 110 103  32
>>>++++++.-----.<<<.              to                     116 111  32
>>>++++++.--.                     us                     117 115

```

# Answer
> 7 votes
# Befunge 98 : 122 - 60 = 62

```
5f8+*:53-+:' \6-:5+' 91+:*3+::7+\8+:3-:7-:3-:' \3+::3-4+',' -+\4-:' \:4+\6+c+:f3+-:4+3-' '&3*:3+:6-:f+5-:' \d-:' '!+ff+k,@

```

Computes the ascii values, then prints them. I still need to try out other methods of forming the numbers to see if there are shorter ways.

# Answer
> 7 votes
# Python, 195-40 = 155

```
x,w,y,z,v=4*8,55,56,57,58;exec(("%c"*38)%(y+y,z+z,49+y,w+w,v+v,39-7,34,65,54+54,54+54,x,v+63,48+63,48+69,z+z,x,98,97,59+y,45+y,x,97,z+z,45+y,x,98,45+y,54+54,w+y,w+w,45+v,x,v+v,w+y,x,v+59,z+v,34))

```

# Answer
> 6 votes
## Ruby, 121 - 50 = 71

A bit brute force, but most of the cute methods are ruled out:

```
$><<[65,c=36*3,c,d=8*4,363/3,f=c+3,c+9,c+6,d,x=98,97,j=c+7,k=3+x,d,97,c+6,k,d,x,k,c,f,j-5,5+x,d,c+8,f,d,c+9,j].pack('C*')

```

Breaks rule #1 because of the A in `pack`, the other two should be OK.

# Answer
> 6 votes
## {ba,z}sh, ~~67 - 40 72 - 60~~ 61 - 40 = 21

```
$'\x74r' K-~\#-\; _@-~\^-j<<<'Mxx ){%~ 3m#q m~q 3qx{z8 ${ %#'

```

Darn it, turns out I had a `r` in there that I hadn't noticed, so the 20 bonus doesn't apply!

# Answer
> 6 votes
# C, 75 bytes - 60 = 15

*Thanks to @gastropner for getting the score down from 50 to 33 and from 19 to 15!*

```
*q,i;f(p){(*(q=p)="\v&&j3%?8j(+9/j+8/j(/&%$-j>%j?9J"[i++]^74)?i=!f(++p):i;}

```

Takes the address of a char array as input and writes the string to the array.

Try it online!

**Call with:**

```
int main()
{
    char s[128];
    f(s);
    puts(s);
}

```

**Output:**

**Old version (90 bytes - 40 = 50):**

```
*q,i,j;f(p){for(i=3-3;j="Epp$}s v$fewi$evi$fipsrk$xs$ w"[i++];*q=j!=35-3?j-4:353/3)q=p++;}

```

# Answer
> 5 votes
# Brainfuck, (227 - 60 = 167)

```
+++++ +++++[>+++>++++++>+++++++++>++++++++++<<<<-]>>+++++.>>++++++++..<<<++.>>>+++++++++++++.----------.++++++.---.<<<.>>++++++++.-.>+.<++++.<<.>>----.>-.<++++.<<.>>---.+++.>------.+++.-.<++.<<.>>>++++++.-----.<<<.>>>++++++.--.

```

# Answer
> 4 votes
# Postscript, 364 - 40 = 324

I couldn't do it without `loser`, of course. :)

```
/${cvx exec}def
/+{<3C7E4F6F597E3E>$ $}def
/*{<~P&(~>$}def
/-{( )<3C7E4F754E7E3E>$ $ 3 4<~P#;~>$ 4 3<~P)#3FP'-~>$}def
/_{36(      )<~OoP~><3C7E4F754E7E3E>$ $ 4 3<~P,S~>$ 48<~P'?~>$
${96 3<~P#;~>$ + -}<~P">~>$}def
/.{_ 96 3<~P#;~>$ -}def
65 - 777 .
895 353 + _ 774 333 + .
74933 333 + 7 * 3 + 333 + .
9593 4353 + .
689653949 335 + .
735 333 + .
775 333 + _ 5 5 + -

```

This starts with encoding the text as base-36 strings:

```
%-=Encoding strings as base-36 numbers=-
%All your base are belong to us
% handle uppercase A separately
%36#ll = %777
%36#your = %1618515
%36#yo = 36#ur = 36#base = 36#are = 36#belong = 36#to = 36#us =
%1248 1107 527198 13946 689654284 1068 1108

```

And then removing the 1s and 0s and 2s arithmetically. The strings can then be regenerated with `36 <string-buf> cvrs`, but this yields upper-case letters, so we then need to iterate through and add 0x20 to make them lowercase.

The operators `cvx exec` allow us to execute string fragments of binary-encoded operator tokens in various encodings. Simplest is to encode an operator in hex `<92??>` but there's a 2 in there! So the "first-level" encoding is ascii85. Then any strings that still contained forbidden characters went through extra levels of hex -\> ascii85 -\> hex -\> ascii85.

# Answer
> 4 votes
# JavaScript

## ~~(306 characters - 60 bonus = 246)~~ ~~(206 characters - 50 bonus = 156)~~

## (123 chars = 173 chars - 50 bonus)

Kind of nooby, probably could get more off... Let me know if I've stuffed something up, this alerts "All your base are belong to us". This is also ASCII-only.

```
(c=(''+!'')[4-3],x=([][3]+c)[6])[a='c\x6F'+x+'\x73t'+c+'uct\x6F'+c][a]('a\x6C\x65'+c+'t("A\x6C\x6C y\x6Fu'+c+' ba\x73\x65 a'+c+'\x65 b\x65\x6C\x6F'+x+'\x67 t\x6F u\x73")')()

```

If you count the console itself as output, this would also count (57 with bonus):

```
'A\x6C\x6C y\x6Fu'+(c=(''+!'')[4-3])+' ba\x73\x65 a'+c+'\x65 b\x65\x6C\x6F'+([][3]+c)[6]+'\x67 t\x6F u\x73'

```

# Answer
> 3 votes
## Brainfuck, 306 - 60 = 246

```
----[---->+<]>++.[--->+<]>+..[++>---<]>--.--[->++++<]>+.----------.++++++.---.[-->+++++<]>+++.[--->+<]>++.-.--[--->+<]>--.++++[->+++<]>.--[--->+<]>-.[--->+<]>+.--[--->+<]>---.-------------.--[--->+<]>-.[--->+<]>++.+++.+++++++.+++.-.-------.-[--->+<]>--.---[->++++<]>.-----.[--->+<]>-----.---[->++++<]>+.--.

```

# Answer
> 3 votes
# PHP (35 - 60 = -25 bytes)

`HOW LOW CAN YOU GET ?`\[1\]\[2\]

```
$ xxd yourbase.php
0000000: 3c3f 3d7e be93 93df 8690 8a8d df9d 9e8c  <?=~............
0000010: 9adf 9e8d 9adf 9d9a 9390 9198 df8b 90df  ................
0000020: 8a8c 3b                                  ..;

```

---

\[1\] This program can be decoded using `xxd -r`.
\[2\] Yeah, heavy solution reuse here. I think it's... third problem I solved this way. Perhaps I should move to something else, but it's not that this is not great for problems that forbid you from using most characters.

# Answer
> 3 votes
# Bash, 52 - 10 - 30 = 12

The following is to be executed in a (still pretty common) ISO-8859-1 environment:

```
$'\x74r' À-þ  @-~<<<'Áìì ùïõò âáóå áòå âåìïîç ôï õó'

```

This calls `tr`, which translates the characters in a suitable way. I had to either use the `r` and violate rule 2, or use a digit in the escape and violate rule 3. Since 3 gives more bonus, I chose the former.

# Answer
> 3 votes
# Pure Bash (no external resources), 141 chars - 50 bonus = 91

```
Z=({k..v})
f=$'\x65'
h=$'\x6c'
i=$'\x6f'
j=${Z[7]}
k=$'\x73'
m=$'\x75'
$f$'\x63'h$i A$h$h y$i$m$j ba$k$f a$j$f b$f$h$i${Z[3]}$'\x67' t$i u$k

```

Intentionally dropping the 10-point bonus to get a better overall score.

This works on any `bash` version 3.00.15 or later that I have tried.

### How does it work

There's no rocket science here - just `bash` expansions of one form or another:

* Simple hex expansion to obtain required character. This works for characters whose hex representation doesn't contain `[012]`. e.g. `$'\x65'` gives us `e`
* For other characters, we generate a bash array of sequential characters using brace expansion into an array initialization (`Z=({k..v})`). The start of the brace expansion is chosen carefully so that the indexes of the characters we require don't contain `[012]`. e.g. `${Z[7]}` gives us `r`.
* `bash` is flexible enough to allow its commands to be constructed from the contents of multiple strings. So `$f$'\x63'h$i` expands to `echo`.
* For characters that are required only once, the expansion is inserted inline to the echo command string.
* For characters that are required twice or more it is more efficient to expand them to variables, then reference the variables.

---

Previous answer with full bonus, but worse overall score:

### Pure Bash (no external resources), 193 chars - 60 bonus = 133

I know this won't win, but I wanted to prove to myself this is possible in `bash`, while satisfying all requirements:

```
Z=({3..8} {C..z})
c=${Z[36]}
d=${Z[37]}
f=$'\x65'
h=$'\x6c'
i=$'\x6f'
j=${Z[53]}
k=$'\x73'
m=$'\x75'
$f$'\x63'h$i ${c^}$h$h $'\x79'$i$m$j $d$c$k$f $c$j$f $d$f$h$i${Z[49]}$'\x67' $'\x74'$i $m$k

```

This does require a fairly recent version of `bash` for the `${c^}` parameter expansion. 4.2.25 is fine, but 3.2.48 is a no-go.

# Answer
> 3 votes
# Jelly, 23 - 60 = -37

```
“%⁼“¡¢8ṣƤ¹;“pȷȦÆ⁾“¡PȤṫ»

```

Try it online!

This is just the compressed representation of `["All", " your base are", " belong to", " us"]` (Jelly has a compressed string format). The string's split into multiple pieces in order to ensure that none of the banned characters appear within the compressed representation; they're all implicitly concatenated at the end of the program.

# Answer
> 2 votes
## PHP, 186 - 10 - 30 = 146

I had to get a little creative ;)

```
 <?=chr(65).'ll '.chr(88+33).'o'.chr(39*3).'r '.chr(98).chr(97).'s'.chr(68+33).' '.chr(97).chr(38*3).chr(68+33).' '.chr(98).'elo'.chr(77+33).chr(69+34).' '.chr(83+33).'o '.chr(39*3).'s'?>

```

# Answer
> 2 votes
# PHP, 67 bytes -60 bonus = 7

```
<?=d__cJZFFcQWFVcWFVcQV_ZZQcCZcFF^"%33C3534C3653C643C333546C75C35";

```

bitwise XOR on the ASCII characters

I brute forced a pair of characters not in the forbidden characters for each character in output.
No word character pair for `A` and I don´t like extended ASCII, so I live with one string in quotes.

# Answer
> 2 votes
# Vyxal , 20 bytes, score -40

```
‛λʀ«×∇⟇Ȧß¥fė₀⌊↓qεǏq⟑

```

Try it Online!

-4 bytes / -4 score thanks to Aaron Miller.

# Answer
> 1 votes
## BF-RLE, 146 - 30 = 116

```
+5[>+5<-]>+.<+4[>+3<-]>+..>>+3[<+2>-]<++.<+A.-7.+3.-0.>.<<+1[>-1<-]>.-.<+0[>+3<-]>.-B.>.<-1.<+1[>+1<-]>+.-A.>.<-0.+0.+4.+0.-.-4.>.<+A.-2.>.<+3.--.

```

# Answer
> 1 votes
**Python, 181 - 40 = 141**

\[I'm using version 2.7.2 YMMV - the builtin, `file` is gone in python 3.X\]

```
f=file.__doc__;c=5-3;l=f[c];s=' ';e=f[3];h=f[6+7];i=f[c*87];j=3**3;f[j*c*5]+l+l+s+f[-57]+h+f[j-7]+f[j-3]+s+f[j-8]+f[6]+i+e+s+f[6]+f[j-3]+e+s+f[j-8]+e+l+h+f[5]+f[j]+s+f[45]+h+s+f[j-7]+i

```

# Answer
> 1 votes
# Python (104 - 30 = 74)

```
>>> '\x41\x6c\x6c \x79\x6f\x75\x72 \x62\x61\x73\x65 \x61\x72\x65 \x62\x65\x6c\x6f\156\x67 \x74\x6f \x75\x73'
'All your base are belong to us'

```

And score:

```
>>> len(r"'\x41\x6c\x6c \x79\x6f\x75\x72 \x62\x61\x73\x65 \x61\x72\x65 \x62\x65\x6c\x6f\156\x67 \x74\x6f \x75\x73'")-30
74

```

# Answer
> 1 votes
# Mumps, 150 - 60 = 90. 40 = 110

```
S J=" ",Z=36*3,C=37*3,D=38*3,Q=39*3,I=35*3-4 W *65,*Z,*Z,J,*484/4,*C,*Q,*D,J,*98,*97,*C+4,*I,J,*97,*D,*I,J,*98,*I,*Z,*C,*D-4,*Z-5,J,*C+5,*C,J,*Q,*C+4

```

I'm not sure if it could have been done shorter (overall) by not getting one of the code bonuses - my goal was a bit less on shortness and a bit more on the -60... I liked the challenge of not using any of the restricted characters.

And... I goofed it up - missed the beginning 'S' command. :-/

Anyway, here's a "no rules" version - expanding the variables.

```
W *65,*36*3,*36*3," ",*484/4,*37*3,*39*3,*38*3," ",*98,*97,*37*3+4,*35*3-4," ",*97,*38*3,*35*3-4," ",*98,*35*3-4,*36*3,*37*3,*38*3-4,*36*3-5," ",*37*3+5,*37*3," ",*39*3,*37*3+4

```

And that gives it a score of 177-60 = 117. So breaking the center rule still gave me a lower overall score.

# Answer
> 1 votes
# Perl 5, 99 − 50 = 49

A subroutine that returns the required string:

```
{A.($c=h|d)."$c y".($f=f|k).u.($k=p|b)." ba".($j=c|p).($d=d|a)." a$k$d b$d$c$f".(jf|fc)." t$f u$j"}

```

See it printed thus:

```
perl -e'print sub{...}->().$/'

```

# Answer
> 1 votes
# SmileBASIC, 149 bytes -30 -10 = 109

```
L$=CHR$(&H75)O$=CHR$(98)S$=CHR$(97)?CHR$(65);"ll",CHR$(&H79);"o";L$;"r ";O$;S$;"se ";S$;"re ";O$;"elo";CHR$(&H6E);CHR$(&H67);" ";CHR$(&H74);"o",L$;"s

```

# Answer
> 1 votes
# VBA, 119 - 40 = 79 Bytes

Anonymous VBE Immediate window function that takes no input and outputs `All your base are belong to us` to the VBE immediate window

```
L=Chr(&H75):O=Chr(98):S=Chr(97):?Chr(65)"ll "Chr(&H79)"o"L"r "O;S"se "S"re "O"elo"Chr(&H6E)Chr(&H67)" "Chr(&H74)"o "L"s

```

 *This is largely a port of 12Me21's SmileBASIC Answer \- Hooray for BASIC languages*

# Answer
> 1 votes
# Whitespace, 194 (254 bytes - 60 bonus)

```
[S S S T    S T S N
_Push_10_s][S S S T T   S S N
_Push_12_u][S S T   T   S S T   S S T   N
_Push_-73_space][S S S T    T   S N
_Push_6_o][S S S T  S T T   N
_Push_11_t][S T S S T   S N
_copy_2nd_space][S S T  T   S N
_Push_-2_g][S S S T S T N
_Push_5_n][S S S T  T   S N
_Push_6_o][S S S T  T   N
_Push_3_l][S S T    T   S S N
_Push_-4_e][S S T   T   T   T   N
_Push_-7_b][S S T   T   S S T   S S T   N
_Push_-73_space][S S T  T   S S N
_Push_-4_e][S S S T S S T   N
_Push_9_r][S S T    T   S S S N
_Push_-8_a][S T S S T   T   N
_Copy_3rd_space][S S T  T   S S N
_Push_-4_e][S S S T S T S N
_Push_10_s][S S T   T   S S S N
_Push_-8_a][S S T   T   T   T   N
_Push_-7_b][S T S S T   S S N
_Copy_4th_space][S S S T    S S T   N
_Push_9_r][S S S T  T   S S N
_Push_12_u][S S S T T   S N
_Push_6_o][S S S T  S S S S N
_Push_17_y][S T S S T   S S N
_Copy_4th_space][S S S T    T   N
_Push_3_l][S N
S _Duplicate_8_l][S S T T   S T S S S N
_Push_-40_A][N
S S N
_Create_Label_LOOP][S S S T T   S T S S T   N
_Push_105][T    S S S _Add][T   N
S S _Print_as_character][N
S N
N
_Jump_to_Label_LOOP]

```

Letters `S` (space), `T` (tab), and `N` (new-line) added as highlighting only.
`[..._some_action]` added as explanation only.

Try it online (raw with spaces, tabs, and new-lines only).

Uses the shorter alternative I've explained in the bottom of this Whitespace tip, with the fixed amount being `105` in this case.

# Answer
> 1 votes
# Pxem, Filename: 45 bytes + Content: 0 bytes - Bonus: 30 bytes = 15 bytes.

* Filename (escaped some characters): `Xx\202\330\330\100\362\336\352\344\100\304\302\346\312\100\302\344\312\100\304\312\330\336\334\316\100\350\336\100\352\346!.z\002.$.o.c!.a`
    + Printed version: `Xx‚ØØ@òÞêä@ÄÂæÊ@ÂäÊ@ÄÊØÞÜÎ@èÞ@êæ!.z.$.o.c!.a`
* Content: empty

## What it does

* Twice necesity ASCII codes before.
* Halve on this program.

Try it online!

---

# Pxem, Filename: 55 bytes + Content: 0 bytes - Bonus: 50 bytes = 5 bytes.

* Filename (escaped some): `Xx\202\330\330\100\362\336\352\344\100\304\302\346\312\100\302\344\312\100\304\312\330\336\334\316\100\350\336\100\352\346!.z\002.$.t.v.m.v.c!.a.t.p`
    + Printed: `XxØØ@òÞêä@ÄÂæÊ@ÂäÊ@ÄÊØÞÜÎ@èÞ@êæ!.z.$.t.v.m.v.c!.a.t.p`
* Content: empty

## What it does

* Move to bottom each of them.
* Hide last `!` to heap.
* Print all of them at once.

Try it online!

# Answer
> 1 votes
# 05AB1E, 18 - 60 = -42 bytes

```
“€Ÿ€žŠà€™ÊÂ€„€ª“.ª

```

Try it online!

```
“...“.ª  # trimmed program
“...“    # push "all your base are belong to us"...
     .ª  # in sentence case
         # implicit output

```

# Answer
> 1 votes
# Deadfish~, ~~232 − 40 = 192~~ 238 − 60 = 178 bytes

```
{iiiiii}iiiiic{iiii}iiicc{{d}ii}iiiic{{i}d}dc{d}ciiiiiicdddc{{d}ii}ddc{{i}ddd}ddddcdc{ii}ddc{d}ddddc{{d}iii}ic{{i}ddd}dddddc{ii}dddc{d}dddc{{d}iii}ic{{i}ddd}ddddciiic{i}dddciiicdc{d}iiic{{d}iii}dc{{i}dd}iiiicdddddc{{d}ii}ic{{i}d}dddddcddc

```

Try it online!

# Answer
> 1 votes
# Perl 5, 80 bytes - 60 = 20

Claiming all three bonuses.

```
('3?"5W939=8#>/'^p x$].J x 8)->($~,';66z#5/(z8;)?z;(?z8?654=z.5z/)'^z.Z x(33-4))

```

Try it online!

## Explanation

Builds up the strings: `CORE'syswrite` and `All your base are belong to us` using the stringwise XOR operator with repeated strings where available, calling these strings as function references passing `$~` as the first argument to `syswrite` and the `All your base...` string as the second.

---

# Perl 5, 58 bytes - 60 = -2

This one contains mostly unprintables and utilises the inverse binary string operator `~`.

```
(~'.............')->($~,~'..............................')

```

Try it online!

# Answer
> 1 votes
# Python 96 - 40 = 56

```
exec("z='';[z:=z+chr(ord(x)^(34-3))for x i\x6e'^ss?fpjm?}~lz?~mz?}zspqx?kp?jl'];pri\x6e\x74(z)")

```

**Or with REPR 83 - 40 = 43**

```
exec("z='';[z:=z+chr(ord(x)^(34-3))for x i\x6e'^ss?fpjm?}~lz?~mz?}zspqx?kp?jl']");z

```

# Answer
> 0 votes
# Aceto, 23 bytes

3rd grade Hilbert curve, 53 bytes - 30 bonus = 23.

```
lo'm"  u
e"poptos
b cIcIp"
rep'fo
asab
 er
Aluo
"l y

```

# Answer
> 0 votes
# Japt, 33 - 60 = -27 bytes

```
`mßPÚXmÞ-ãù“`i`à ö` d"m " Å
i°Id

```

Try it online!

The shoco library is powerful at compressing lowercase letters, but I had to do lots of experiment in order to get a compressed string without any of the banned chars.

### Unpacked & How it works

```
`mßPÚXmÞ-ãù“`i`à ö` d"m " s1
`mßPÚXmÞ-ãù“`                 "mbasemarembelongmtomus"
              i`à ö`           Insert "allmyour" at the beginning
                     d"m "     Replace "m" with " "
                           s1  Discard initial "a"
                               Implicitly assign to U

Ui++Id
Ui      Add to the beginning of U...
  ++I     65
     d    chr(65) == "A"

```

# Answer
> 0 votes
# Google Sheets, 53 - 30 = 23

Speaking of Bases... Following rules 1 & 2:

```
="All your base are belo"&LOWER(BASE(775,33))&" to us

```

I believe this is optimal, unless the string can be compressed.

* Applying all three rules does not leave us with any useful functions. These are IMDIV, FV, PV, IF, PI, PHI, and MID. MID is almost interesting: we can gain access to `[TRUEFALS]` because we can do comparisons to get boolean strings, but this leaves way too many letters out.
* Similarly, even following two rules, we still don't have access to any useful alphabetic character yielding functions. (CHAR, BASE, TEXT)
* This means that we have to follow one rule or bust. I choose the most valuable one, `[NG012]`. Luckily the phrase only contains an illegal "ng", which we can easily get around with `BASE`.
* An alternative solution is to split all words by spaces into a column, then join by spaces, but that results in the same score and is harder to set up.

# Answer
> 0 votes
# Python 3, 104 - 50 = 54 bytes

```
quit("A\x6C\x6C y\x6Fu%()c ba\x73\x65 a%()c\x65 b\x65\x6C\x6F%(#)c\x67 t\x6F u\x73"%{'':3*38,'#':77+33})

```

Try it online!

Prints the output to STDERR, which is allowed as stated on the I/O meta post. Uses a combination of plain characters, hexadecimal strings and some C-style string formatting with some addition and multiplication to avoid 0-2.

---
Tags: code-golf, string, kolmogorov-complexity, restricted-source
---