title: Output the 12 Bar Blues

text:
# Question
Title: Output the 12 Bar Blues
Note to those without experience in music: Through making an attempt to solve this problem, you may find that music and computer programming are similar in the ways that they implement rules and syntax. With some help from Wikipedia, you can likely solve this problem with no prior knowledge of music theory.

Write a program that can take a string representing **any** valid key signature (ex: C, D#, Ab) and return the appropriate chord progression for a 12 bar blues in that key.

Many aspiring jazz musicians begin their musical journey by learning the 12 bar blues. It is a popular chord progression that consists of the I, IV, and V chords of a key.

There are a few variations of the 12 bar blues, we will use the following:

```
I   I   I   I
IV  IV  I   I
V   IV  I   I

```

Where each numeral represents the chords of the given key.

```
Examples

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

Input:    C

Output:   C   C   C   C
          F   F   C   C
          G   F   C   C

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

Input:    Eb

Output:   Eb  Eb  Eb  Eb
          Ab  Ab  Eb  Eb
          Bb  Ab  Eb  Eb

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

Input:    F#

Output:   F#  F#  F#  F#
          B   B   F#  F#
          C#  B   F#  F#

```

Note: In music, you can write some notes two different ways. (ex: F# is equivalent to Gb). Consequently, a given input may have multiple valid answers. An answer is correct as long as it outputs chords that are correct, regardless of how they are represented.

```
Example - F# Alternative solution

Input:    F#

Output:   Gb  Gb  Gb  Gb
          Cb  Cb  Gb  Gb
          Db  Cb  Gb  Gb

```

Answers should be returned in one of the following formats:

```
Examples - Valid Formatting (Given input C)

Valid output 1 (multi-line string):
C   C   C   C
F   F   C   C
G   F   C   C

Valid output 2 (single line string):
C C C C F F C C G F C C

Valid output 3 (1d list/array):
['C', 'C', 'C', 'C', 'F', 'F', 'C', 'C', 'G', 'F', 'C', 'C']

Valid Output 4 (2d list/array):
[['C', 'C', 'C', 'C'],
 ['F', 'F', 'C', 'C'],
 ['G', 'F', 'C', 'C']]

```

This is : The solution with the fewest bytes wins.

# Python 3 \- Sample Code, not Golfed

```
def twelve_bar_blues(k_input):

	chords = ['Ab', 'A', 'Bb', 'B', 'C', 'Db', 'D', 'Eb', 'E', 'F', 'Gb', 'G']*2

	if k_input not in chords and k_input[1] == '#':
		k_index = chords.index(k_input[0]) + 1
		k = chords[k_index]
	else:
		k = k_input

	I_index = chords.index(k)
	I = chords[I_index]

	IV_index = I_index + 5
	IV = chords[IV_index]

	V_index = I_index + 7
	V = chords[V_index]

	return f'{I} {I} {I} {I} {IV} {IV} {I} {I} {V} {IV} {I} {I}'

```

Try it online!

# Answer
# Python 3, 113 110 bytes

```
l='C Db D Eb E F Gb G Ab A Bb B'.split()
def f(a):c,*a=l.index(a),a,a;I=[l[c-7]];return a*2+I*2+a+[l[c-5]]+I+a

```

Doesn't accept `#` ones. Uses flats only.

Thanks to @ovs and @l4m2 for -3 bytes.

Try it online!

# Python 3, 129 bytes

```
l='C Db D Eb E F Gb G Ab A Bb B'.split()
def f(a):b="#"in a;c,*a=l.index(a[:~b+3])+b,a,a;I=[l[c-7]];return a*2+I*2+a+[l[c-5]]+I+a

```

This version accepts `#` keys. Additional 19 bytes :(

Try it online!
> 8 votes

# Answer
# Vyxal, 34 bytes

```
«⟑,HǎẆṀ,‹¹β»Ẇ→| e×«⌈:?ḟ»Ǎ‹ǒr$»fḢ+İ

```

Try it Online!

Takes input as notes in lowercase (`db` not `Db` or `C#`, this doesn't allow sharps)

Thanks to Unrelated String for saving a byte on the numbers ocmpression

```
«...«              # Compressed string `c db d eb e f gb g ab a bb b`
     ⌈:            # Split on spaces and make a copy
       ?ḟ          # Find the index of the input in those
         »...»fḢ   # The list [0,0,0,0,5,5,0,0,7,5,0,0]
                   # Note: This is surprisingly difficult to compress. The leading and trailing zeroes resist base compression, the high numbers make base compression inefficient, but attempting to index into [0,5,7] is worse.
                +İ # Add those numbers to the input's number and modularly index into the notes.

```
> 6 votes

# Answer
# Excel, 75 bytes (44 formula, 31 data)

```
=INDEX(G:G,MOD(B6:E8+MATCH(A1,G:G,)-1,12)+1) (44 bytes)

```

Link to Spreadsheet

`B6:E8` are blank for the cells corresponding to the I chord; are 5 for the IV chord; and 7 for the V chord. (4 bytes) `G:G` contains the list of keys both sharp and flat. (27 bytes)
> 5 votes

# Answer
# x86-16 machine code, ~~77~~ ~~71~~ 68 bytes

```
00000000: adbb fc00 d780 fc23 7c06 7502 2c0a 040b  .......#|.u.,...
00000010: 92be 3701 33c9 acd4 108a cce3 1902 c2d4  ..7.3...........
00000020: 0cbb 4401 bd48 204b 4d38 077f fa95 7402  ..D..H KM8....t.
00000030: b423 f3ab ebe0 c340 2520 1715 2000 0203  .#.....@% .. ...
00000040: 0507 080a                                ....

```

Listing:

```
AD              LODSW                   ; AH = note accidental, AL = note name
BB 00FD         MOV  BX, OFFSET SLT-'A' ; BX = semitone table (ASCII offset index)
D7              XLAT                    ; convert to semitones
80 FC 23        CMP  AH, '#'            ; is it sharp?
7C 06           JL   START_SONG         ; if has no accidental, let's jam
75 02           JNZ  IS_FLAT            ; if not, it's a flat
            IS_SHARP:
2C 0A           SUB  AL, 10             ; "sharp" the note up one semitone
            IS_FLAT:
04 0B           ADD  AL, 11             ; "flat" the note up 11 semitones
            START_SONG:
92              XCHG AX, DX             ; DL = root note (key) relative to A
BE 0138         MOV  SI, OFFSET SNG     ; SI = song pattern data
33 C9           XOR  CX, CX             ; clear CX for counter
            SONG_LOOP:
AC              LODSB                   ; AL = length and note packed nibbles
D4 10           AAM  16                 ; AH = # of repeats, AL = note
8A CC           MOV  CL, AH             ; CX = bar repeat counter
E3 1A           JCXZ SONG_DONE          ; end, if the song is over
02 C2           ADD  AL, DL             ; transpose note to correct key
D4 0C           AAM  12                 ; AL = output note (mod 12 to fix wraparound)
BB 0144         MOV  BX, OFFSET SLT+7   ; BX = end of semitone table
BD 2048         MOV  BP, 02048H         ; H=' ', L='H' (G+1 since loop pre-decrements)
            NOTE_LOOP:
4B              DEC  BX                 ; loop backwards through semitone table
4D              DEC  BP                 ; walk down notes starting from G
38 07           CMP  BYTE PTR[BX], AL   ; compare note to semitone
7F F9           JG   NOTE_LOOP          ; if note is higher than target, keep looping
93              XCHG AX, BP             ; move output to AX
74 02           JZ   WRITE_NOTE         ; if note is exactly target, it's natural
B4 23           MOV  AH, '#'            ; otherwise, it's sharp (ouch!)
            WRITE_NOTE:
F3 AB           REPZ STOSW              ; write to output string (repeatedly)
EB DF           JMP  SONG_LOOP          ; jump to next song pattern
            SONG_DONE:
C3              RET                     ; return to caller

; packed song data:
;   high nibble = repeats, low nibble = note interval
SNG DB  40H, 25H, 20H, 17H, 15H, 20H

; semitone lookup table
;       A  B  C  D  E  F  G
SLT DB  0, 2, 3, 5, 7, 8, 10

```

Callable function. Input string at `[SI]`, output to `[DI]`. Accepts sharps *or* flats in input.

**Explanation:**

The first character of input string pointer is converted to a semitone scale relative to A, based on the table `[0,2,3,5,7,8,10]`. The pointer of this table is actually offset by `0x41` (ASCII `'A'`) so that the index is the ASCII value, eliminating the need to ASCII convert to 0-based index in the program. The second character's ASCII value is checked and if it's less than a `'#'` (ASCII `0x23`) (white space, CR/LF, null, etc), the note is natural. If it is a `'#'`, 10 is subtracted from the value followed by adding 11, for a net +1 (this is a machine code optimization to eliminate the need for a branch/jump). If it's a flat, the subtraction of 10 is skipped and only 11 is added, for a (relative) net -1. The remaining number is the input note's number of semitones relative to A -- the key, effectively.

Next, the "song" is loaded from a packed array of bytes `[0x40,0x25,0x20,0x17,0x15,0x20]` where the first nibble is the number of times the bar repeats and the second is the relative number of semitones up from the tonic. That number is added with the key from earlier and mod 12 to handle wraparound, leaving the root note of the chord transposed to the correct key.

Last, the note is compared to the semitone table again. Searching from the end, if it matches, the note is natural. If it's lower, the note is one note name lower and sharped. Output is then written as an array of two byte strings to the buffer passed in `[DI]`.

Jam on!
> 5 votes

# Answer
# 05AB1E, ~~35~~ 31 bytes

```
A7£ÀÀSD¤«s.ι¦„fbKDIk•íƒò=Z•¦S+è

```

Port of *@emanresuA*'s Vyxal answer. It also only uses lowercase inputs without sharps; and outputs (in lowercase) as single list.

Try it online or verify all test cases.

**Explanation:**

```
A                 # Push the lowercase alphabet
 7£               # Only leave the first 7 letters: "abcdefg"
   ÀÀ             # Rotate it right twice: "cdefgab"
     S            # Convert it to a list of characters
      D           # Duplicate it
       ¤          # Push the last character (without popping): "b"
        «         # Append it to each in the copy:
                  #  ["cb","db","eb","fb","gb","ab","bb"]
         s.ι      # Swap, and interleave the lists:
                  #  ["cb","c","db","d","eb","e","fb","f","gb","g","ab","a","bb","b"]
            ¦     # Remove the first ("cb")
             „fbK # As well as the "fb"
                  #  ["c","db","d","eb","e","f","gb","g","ab","a","bb","b"]
D                 # Duplicate it
 Ik               # Get the index of the input in this list
   •íƒò=Z•        # Push compressed integer 1000055007500
          ¦       # Remove the leading 1: "000055007500"
           S      # Convert it to a list of digits
            +     # Add the earlier index to each
             è    # Use that to 0-based modular index into the list of notes
                  # (after which the result is output implicitly)

```

See this 05AB1E tip of mine (section *How to compress large integers?*) to understand why `•íƒò=Z•` is `1000055007500`.
> 3 votes

# Answer
# Subleq, 112 bytes

```
 0:-1 6 -1  : Load first Character to [6]
 3:5 6 -28  : [6] = [6] + 28
 6:0 27 9   : Load address in 6 to 27
 9:-1 32 21 : Load second Character to [32]: if nil goto 21:
12:55 32 18 : if [32] < 66 goto 18:
15:17 27 4  : [27] = [27] - 4: move 2 notes down
18:20 27 -2 : [27] = [27] + 2: move one note up
21:27 29 24 : [29] = [29] - [27] : [29] = -[27]
24:29 30 -1 : [30] = [30] - [29] : [30] = 1 - [29]
27:0 -1 0   : print base chord
30:1 -1 0   : print flat or space
33:0 39 -1  : [39] = [39] + 1
36:0 42 -1  : [42] = [42] + 1
39:99 27 -1 : [27] = [27] - [99*] : if <=0 exit
42:99 30 -1 : [30] = [30] - [99*]
45:54 -1 -1 : print space
48:18 18 27 : [18] = 0 goto 27:

Data
51:65 98 65 32 : Ab & A
55:66 98 66 32 : Bb & B
59:67 32       : C
61:68 98 68 32 : Db & D
65:69 98 69 32 : Eb & E
69:70 32       : F
71:71 98 71 32 : Gb & G
75:65 98 65 32 : Ab & A
79:66 98 66 32 : Bb & B
83:67 32       : C
87:68 98 68 32 : Db & D
91:69 98 69 32 : Eb & E
95:-53 -57 -59 -63 -67 -69 -73      : Negative Starting Key addresses
100:0 0 0 -10 0 10 0 -14 4 10 0 127 : Chord changes

```

Link to Subleq emulator spreadsheet

> Got just one instruction; that's all I can use.
>
> Don't have no functions; I'm very confused.
>
> Coding reduction; I've got the Subleq Blues.
> 3 votes

# Answer
# Excel, ~~125~~ 123 bytes (doesn't use helper data)

Saved 2 bytes thanks to Axuary

```
=LET(n,"G GbF E EbD DbC B BbA Ab",f,FIND(LEFT(A1),n),MID(n&n,IFERROR(MAX(f,FIND(A1,n)),f-2)+{0,0,0,0;7,7,0,0;5,7,0,0}*2,2))

```
* `n,"G GbF E EbD DbC B BbA Ab"` stores the string of notes in reverse order.
* `f,FIND(LEFT(A1),n)` finds the first character of the note. This is why the string is in reverse order so we find "G " instead of "Gb".
* `IFERROR(MAX(f,FIND(A1,n)),f-2)` adjusts for sharps and flats.
* `{0,0,0,0;7,7,0,0;5,7,0,0}*2` array to add to the `FIND()` position from earlier.
* `MID(n&n,IFERROR(~)+{~},2)` pulls out all the character pairs based on `FIND()` and offset by the array of fixed values.

Screenshot shows the 125 bytes version of the formula.
> 3 votes

# Answer
# Prelude, ~~468~~ 324 bytes

```
  v4             7-                   +  v
 vv3v8- 1-(1-(1-(1-(1-(1-(1-))#7-0))))v++^                   vv^^vvvv (!
?
6    9+ 4+ 4+ 4+ 4+ 4+ 0  #           #v#          ( v(0 )0) v
? vv03+ 4+                            # ^ #v #0   # #^ #0   v#v^^vv^^^^(!0)#9!)
 ^ 8(1-)## 7^+#                          ( ^(0 )0)^^        # ^

```

Try it online or run the test suite. Input is an uppercase letter possibly followed by an accidental (`#` or `b`). Output is enharmonically correct. Inputs of `Fb`, `B#`, or other non-standard keys that require double sharps or double flats are not supported.

### Explanation

Prelude is a 2D language inspired by music. Each line, known as a *voice*, has its own stack. Instructions in the same column are executed simultaneously, representing notes sounding simultaneously in different voices. Loops, demarcated by `()` pairs, run in parallel across all voices. There are no conditionals but testing for equality to zero is possible with loops.

Each chord name consists of two characters: a letter name (e.g. `C`) and an accidental (e.g. `#`). (Natural notes have an 'empty' accidental.) Let the codepoints of these characters be \\$c\_j\\$ and \\$a\_j\\$, respectively, with \\$j = \text{I, IV, or V}\\$. In Prelude, our goal in this challenge is to find all the \\$c\_j\\$ and \\$a\_j\\$.

Chord I is easy: the `?` instructions in Voices 3 and 5 read \\$c\_\text{I}\\$ and \\$a\_\text{I}\\$ directly from STDIN. (If there is no accidental, \\$a\_\text{I}\\$ is read as \\$0\\$ (EOF), which will prove to be convenient later.) Three tasks remain:

1. Find \\$c\_\text{IV}\\$ and \\$c\_\text{V}\\$.
2. Find \\$a\_\text{IV}\\$ and \\$a\_\text{V}\\$.
3. Print the 12 bar blues progression.

#### 1. Finding \\$c\_\text{IV}\\$ and \\$c\_\text{V}\\$

Focus first on the \\$c\_\text{IV}\\$ calculation, which takes place in Voice 2. Observe that $$c\_\text{IV} = \begin{cases}c\_\text{I}+3\text{ if }c\_\text{I}\<69,\\ c\_\text{I}-4\text{ if }c\_\text{I}\ge69. \end{cases}$$

Our strategy, therefore, is to get \\$+3\\$ or \\$-4\\$ on the stack as appropriate, then add this to \\$c\_\text{I}\\$. Because there is no direct way to test whether \\$c\_\text{I}\<69\\$ in Prelude, we have to resort to a series of nested loops that function like conditional branches. The code between dashed lines below is only executed if \\$c\_\text{I}\ge69\\$.

```
3                         Push 3. Stack: [3]
 v                        Push cI from voice below. Stack: [3, cI]
  8-                      (In loop) 8 times, subtract 8. Stack: [3, cI-64]
     1-(                  If cI-65 = 0, skip ahead to the matching ). Stack: [3, cI-65] -+
        1-(               If cI-66 = 0, skip ahead to the matching ). Stack: [3, cI-66]  |
           .              .                                                              |
           .              . etc.                                                         |
           .              .                                                              |
           -------------------------------------------------------------                 |
           1-))           End of loops. If here, cI >= 69. Stack: [3, 0]                 |
              #           Discard top of stack. Stack: [3]                               |
               7-         Subtract 7. Stack: [-4]                                        |
                 0        Push 0. Stack: [-4, 0]                                         |
           -------------------------------------------------------------                 |
                  ))))    End of loops. Stack: [3, 0] or [-4, 0] <-----------------------+
                      v   Push cI from voice below. Stack: [3, 0, cI] or [-4, 0, cI]
                       +  Pop top two elements and push their sum. Stack: [3, cI] or [-4, cI]
                        + Pop top two elements and push their sum. Stack: [cIV]

```

Notice that in the inner section, we have to do `#7-0` rather than just `4-` because in the latter case, the stack would be `[3, -4]` and the loop would not terminate. (Loops terminate only if \\$0\\$ is on top of the stack.)

Here is another way to visualise how the nested loops work, with the letter names corresponding to \\$c\_\text{I}\\$ included. At each `(`, we effectively test whether \\$c\_\text{I}\\$ exactly corresponds to the indicated letter. If it does, we go no deeper. Thus, we see that the top branch is followed if \\$c\_\text{I}\\$ corresponds to a letter between A and D (inclusive); the bottom branch is followed otherwise.

```
  A  B  C  D
1-(1-(1-(1-(1-            )))) -> cIV = cI+3
              (1-(1-))#7-0     -> cIV = cI-4
              E  F

```

Up in Voice 1, we perform an analogous calculation for \\$c\_\text{V}\\$: $$c\_\text{V} = \begin{cases}c\_\text{I}+4\text{ if }c\_\text{I}\<68,\\ c\_\text{I}-3\text{ if }c\_\text{I}\ge68. \end{cases}$$ The code looks much simpler because we are piggybacking on the nested loops/conditionals in Voice 2, which apply across *all* voices.

#### 2. Finding \\$a\_\text{IV}\\$ and \\$a\_\text{V}\\$

Observe that $$ a\_\text{IV} \ne a\_\text{I}\text{ if and only if }c\_\text{I}=70,\\ a\_\text{V} \ne a\_\text{I}\text{ if and only if }c\_\text{I}=66.$$

Musically speaking, there are only four keys for which we cannot simply copy the accidental from chord I to chords IV and V. These keys are `F` (chord IV `Bb`), `F#` (chord IV `B`), `B` (chord V `F#`), and `Bb` (chord IV `F`).

The \\$a\_\text{IV}\\$ and \\$a\_\text{V}\\$ calculations partly involve piggybacking on the loops in Voice 2, this time to pre-load values onto the stacks in Voices 4 and 6 that are then manipulated further. Let's look at how \\$a\_\text{V}\\$ is determined in Voices 5 and 6. (The procedure for \\$a\_\text{IV}\\$ is similar in Voices 4 and 5.) The accidental calculation itself is performed by this snippet:

```
 #v #0   #
( ^(0 )0)^

```

There are three execution branches depending on the values of \\$c\_\text{I}\\$ and \\$a\_\text{I}\\$ and it's easiest to consider these branches separately. In each case, the stack in Voice 5 (V5) is pre-loaded with two copies of \\$a\_\text{I}\\$. The value on top of the stack in Voice 6 (V6) when the snippet ends is \\$a\_\text{V}\\$.

*Note that for the following explanations the code runs vertically, with Voice 5 in the left column and Voice 6 in the right column.* (This vertical format is used to maximise readability of the comments, but isn't a valid way to write Prelude code.)

1. If \\$c\_\text{I}\ne 66\\$ (i.e. the input is not `B` or `Bb`), the stack in V6 is cleared during the pre-load stage, leaving \\$0\\$ as the top element. The outer loop in V6 is not entered, and a copy of \\$a\_\text{I}\\$ (whose value may be \\$0\\$, \\$35\\$, or \\$98\\$) is simply yanked (`^`) from V5.

```
V5 stack: [aI, aI], V6 stack: [0]

 (  Top of stack is 0 so skip ahead to the matching ). -+
#                                                       |
v^                                                      |
 (                                                      |
#0                                                      |
0                                                       |
 )                                                      |
 0                                                      |
 )  <---------------------------------------------------+
#^  Discard top of stack in V5, but only after yanking it into V6. V5 stack: [aI], V6 stack: [0, aV = aI]

```
2. If \\$c\_\text{I} = 66\\$, we push \\$35\\$ (the codepoint of `#`) onto the stack in V6 during the pre-load stage. If \\$a\_\text{I}=0\\$ (i.e. the input is `B`) then we need \\$a\_\text{V}=35\\$. After a bit of back and forth between the voices, we see that \\$35\\$ does indeed end up back on top of the stack in V6 at the end of the snippet.

```
V5 stack: [0, 0], V6 stack: [35]

 (  Top of stack is 35 so enter the loop.
#   Discard top of stack in V5. V5 stack: [0], V6 stack: [35]
v^  Swap top stack values between V5 and V6. V5 stack: [35], V6 stack: [0]
 (  Top of stack is 0 so skip ahead to the matching ). -+
#0                                                      |
0                                                       |
 )  <---------------------------------------------------+
 0  Push 0 in V6. V5 stack: [35], V6 stack: [0, 0]
 )  End loop.
#^  Discard top of stack in V5, but only after yanking it into V6. V5 stack: [0], V6 stack: [0, 0, aV = 35]

```
3. If \\$c\_\text{I} = 66\\$, we push \\$35\\$ onto the stack in V6 during the pre-load stage. If \\$a\_\text{I}=98\\$ (i.e. the input is `Bb`) then we need \\$a\_\text{V}=0\\$, which is indeed the value on top of the stack in V6 at the end of the snippet.

```
V5 stack: [98, 98], V6 stack: [35]

 (  Top of stack is 35 so enter the loop.
#   Discard top of stack in V5. V5 stack: [98], V6 stack: [35]
v^  Swap top stack values between V5 and V6. V5 stack: [35], V6 stack: [98]
 (  Top of stack is 98 so enter the loop.
#0  Discard top of stack in V5. Push 0 in V6. V5 stack: [0], V6 stack: [98, 0]
0   Push 0 in V5. V5 stack: [0, 0], V6 stack: [98, 0]
 )  End loop.
 0  Push 0 in V6. V5 stack: [0, 0], V6 stack: [98, 0, 0]
 )  End loop.
#^  Discard top of stack in V5, but only after yanking it into V6. V5 stack: [0], V6 stack: [98, 0, 0, aV = 0]

```

#### 3. Printing the progression

Printing the progression is an exercise in stack management. The goal is to get all of the \\$c\_j\\$ onto one stack (Voice 2) and all of the \\$a\_j\\$ onto another (Voice 5), then churn them all out in a single loop. There's more than one way to do this, and the code went through several iterations before I settled on the current order of voices.

The print loop is spread across two voices and is notable for the fact that the starting `(` and ending `)` are not in the same voice (a byte-saving optimisation). The `!` in Voice 2 prints each of the letters \\$c\_j\\$. The accidentals \\$a\_j\\$ require special treatment. For any \\$a\_j=0\\$ (corresponding to a natural note) no character should be printed, but a bare `!` will print a null byte. The way around this is to use `(!0)#` to print only if \\$a\_j\ne0\\$. Finally, a separator is needed. It's cheap to push and print a tab (codepoint \\$9\\$) on demand.

---

# Fugue

Fugue and Prelude are dual languages: Fugue uses musical notation to encode Prelude instructions. I'm not sure how it should be scored (no pun intended) but I'd suggest that the byte count of its Prelude twin (above) is a reasonable measure.

The musical score was generated from the Prelude source code using a custom Ruby script to metaprogram the LilyPond engraving. You can listen to the MIDI or view the PDF score, Ruby script, and LilyPond source on Github. There is a very old Fugue compiler that reads MIDI files as source code, but I was unable to get it to work.

The piece, titled *Fugacity*, is scored for trumpet, electric guitar, tenor sax (two-note cameo), double bass, and piano. (The choice of instruments is artistic and arbitrary as far as Fugue is concerned.) How does it sound? Not at all bluesy, but I've definitely heard worse.

### Generating the score

To get a basic score to begin with, all no-ops (spaces) are converted to crotchet rests and most Prelude instructions are converted to crotchets. There are two exceptions:

1. Push commands are converted to a pair of quavers. The first quaver represents the push instruction itself (ascending or descending third) and the second quaver represents the value being pushed.
2. Some effort is taken to keep the parts within the playing ranges of the instruments. To this end, jumps of 10 semitones or more (which are no-ops) are automatically added. These range-limiting jumps become the second of a pair of quavers, with the first quaver being the instruction that triggered the range limiter.

All voices are padded to the same length with rests, which isn't necessary for Fugue but does make the score a bit nicer to read.

With this basic score to work from, some artistic embellishments are introduced for increased musicality. The following adjustments occur automatically:

* A crotchet followed by one, two, or three crotchet rests in the same bar is replaced by a minim, dotted minim, or semibreve with \\$50\\;\\%\\$ probability.
* Consecutive rests are consolidated.
* An accent is added to each note with \\$25\\;\\%\\$ probability.
* A dynamic change is added to each run of notes with \\$50\\;\\%\\$ probability. An initial forte dynamic is applied to all voices. Louder dynamics are favoured over softer ones.
* A crescendo or decrescendo hairpin is added between runs of at least three notes with \\$50\\;\\%\\$ probability.
* Slurs are added between runs of at least two non-unison notes with \\$50\\;\\%\\$ probability.

The first note in each voice is arbitrary. I toyed with several ideas but finally settled on a unison C. It's interesting to hear how the parts diverge from a common starting point.
> 2 votes

# Answer
# Python 3, 201 bytes

```
def b(m):
	c=['Ab','A','Bb','B','C','Db','D','Eb','E','F','Gb','G']*2
	if m not in c and m[1]=='#':k=c[c.index(m[0])+1]
	else:k=m
	o=c.index(k)
	I,F,V=c[o],c[o+5],c[o+7]
	return 4*[I]+[F,F,I,I,V,F,I,I]

```

Try it online!
> 1 votes

# Answer
# JavaScript (ES6), 106 bytes

*-4 bytes thanks to @l4m2*

Expects a string in `[A-G][#b]?` format. Returns a list of strings in the same format.

```
s=>[..."000055007500"].map(n=>a[+n+a.indexOf(s)%12],a="C#DD#EFF#GG#AA#BCDbDEbEFGbGAbABb".match(/.[b#]?/g))

```

Try it online!
> 1 votes

# Answer
# Retina 0.8.2, 109 bytes

```
$
 $`¶$`
T`FCGDA\EB`Bo`^.
^B
Bb
T`B\EADGCF`Fo`¶.
¶F
¶F#
b#|#b

(.+ )(.+)(¶.+)
$2 $2 $2 $2¶$1$1$2 $2$3 $1$2 $2

```

Try it online! Link includes test cases. Enharmonic-free, but uses `##` instead of `x`. Explanation:

```
$
 $`¶$`

```

Make two copies of the input, with space and newline as separators.

```
T`FCGDA\EB`Bo`^.

```

Transpose the first copy down a fifth.

```
^B
Bb

```

But `F` transposes to `B♭`.

```
T`B\EADGCF`Fo`¶.

```

Transpose the last copy up a fifth.

```
¶F
¶F#

```

But `B` transposes to `F♯`.

```
b#|#b

```

Cancel out the sharps and flats if transposing `F♯` to `B` or `B♭` to `F`.

```
(.+ )(.+)(¶.+)
$2 $2 $2 $2¶$1$1$2 $2$3 $1$2 $2

```

Generate the desired chord layout.
> 1 votes

# Answer
# Charcoal, 52 bytes

```
≔FCGDAEBηＦ⁺⊖⪪”)∨｜7Ｂ”¹⁺⌕η§θ⁰×⁷⁻№θ#№θb«§ηι×#÷ι⁷×b±÷ι⁷→

```

Try it online! Link is to verbose version of code. Outputs all chords on one line. Enharmonic-free, but uses `##` instead of `x`. Explanation:

```
≔FCGDAEBη

```

Get the list of fifths.

```
Ｆ⁺⊖⪪”)∨｜7Ｂ”¹⁺⌕η§θ⁰×⁷⁻№θ#№θb«

```

Split the compressed string `111100112011` into digits, decrement each, and add on the index of the input in the list of fifths, adding `7` for each `#`, and subtracting `7` for each `b`. Loop over the resulting list.

```
§ηι

```

Output the appropriate fifth by cyclic indexing.

```
×#÷ι⁷×b±÷ι⁷

```

Output the appropriate number of sharps or flats.

Leave a space between chords.
> 1 votes

# Answer
# Ruby, 89 bytes

```
->n{"444455443544".bytes.map{|i|"BEADGCF"[-7+x=(n[-1].ord/32*7-n.ord*2%7+i)%12]+?b*x/=7}}

```

Try it online!

An anonymous function taking a flat, sharp or natural key signature as an argument `n` and outputting the following chords in order to keep with the convention of naming major chords as flats to avoid double sharps. (Chords are listed here as a circle of 5ths: `B E A D G C F Bb Eb Ab Db Gb`; note all the natural notes come first with the flats together at the end.)

`n.ord*2%7` finds the letter in the input. The ASCII code for `F` is 70 so this becomes `0`. `G` is 2 steps further round the cycle of 5ths and becomes `2`, while `C` fills in the gap with the value `1`

`n[-1].ord/32*7` adjusts for flats and sharps. If the last character of the input is an uppercase letter (i.e. same as the first) it evaluates to `2*7`. If it is a lowercase `b` it evaluates to `3*7` and if it is a symbol like `#` it evaluates to `1*7` . A few bytes could be saved if only handling flats is required, because it will enable a count of the length of the string to be used instead of checking for the difference between `#` and `b`

Internally, `B` is assigned the value `0`, `F` is `6` and `Bb` is `7`. To take advantage of Ruby's wraparound index on the string `BEADGCF`, `-7` is subtracted from all values when indexing the string.

**Commented code**

```
->n{"444455443544".bytes.map{|i| #convert the magic string into bytes and iterate through the 12 chords
"BEADGCF"[-7+                    # when indexing the output string, use wraparound index -7 =B through 0 =Bb to 4 =Gb
   x=(n[-1].ord/32*7             #7 for sharp, 14 for natural, 21 for flat
      -n.ord*2%7                 #subtract note letter as a position in the cycle of 5ths
      +i                         #in order to make the chord changes, adjust by the value in the first magic string
   )%12                          #take the note value mod 12 to get into a nice 12-note range
   ]+
   ?b*x/=7}                      #divide x by 7. Then add x flat symbols ?b. x is either 0 or 1.
}

```
> 1 votes

---
Tags: code-golf, matrix, music
---


title: Is it a bigger regex?

text:
# Question
Title: Is it a bigger regex?
You are given two regexes and your task is to determine if the strings matched by the first regex are a subset of the strings matched by the second regex.

For this we are going to use a limited mathematical definition of a regex. A regex is defined recursively as one of:

* `ε` \- This matches only the string `""`
* `0` \- This matches only the string `"0"`
* `1` \- This matches only the string `"1"`
* `r1|r2` \- This matches iff `r1` or `r2` matches
* `r1r2` \- This matches iff `r1` matches a prefix of the string and `r2` matches the remaining string
* `r1*` \- This matches iff any of `ε`, `r1`, `r1r1`, `r1r1r1`, etc. matches.

Input format is flexible. If you use a string with some kind of syntax, make sure that it can represent every regex (you may need parenthesis). Output as per standard rules.

# Examples

<pre><code>(0|1)*, (0(1*))* -> False
The first regex matches every string, the second one only ones that start with a 0

0(0*)1(1*), (0*)(1*) -> True
The first regex matches strings that consists of a run of 0 and a run of 1, and both runs have to have length >0. The second regex allows runs of length 0.

((10)|(01)|0)*, (1001)*0 -> False
The first regex matches "10" which is not matched by the second regex.

0, 1 -> False
Neither is a subset of one another

1(1*), (1|ε)*1 -> True
Both regexes match nonempty strings that consist of only ones

10((10)*), 1((01)*)0 -> True
Both regexes match nonempty strings made by concatenating "10"

ε*, ε -> True
Both only match the empty string
```
</code></pre>

# Answer
> 6 votes
# Python 3, 1206 bytes

```
l=len
r=range
def R(a):return r(l(a))
def A(a,b):
 for x in b:
  for z in[0,1]:x[z]<<=l(a)-1
 for x in a:
  if x[2]:
   x[2]=b[0][2]
   for z in[0,1]:x[z]|=b[0][z]
 return a+b[1:]
def B(a,b):
 c=[]
 for i in R(a):
  for j in R(b):
   c+=[[0,0,a[i][2]or b[j][2]]]
   for z in[0,1]:
    for k in R(a):
     if(a[i][z]>>k)%2:c[-1][z]|=b[j][z]<<k*l(b)
 return c
def C(s,i):
 S=[];T=[]
 while i<l(s):
  c=s[i]
  if c=="(":a,i=C(s,i+1);T+=[a]
  if c==")":break
  if c=="0"or c=="1":X=[[4,4,0],[4,4,1],[4,4,0]];X[0][int(c)]=2;T+=[X]
  if c=="ε":T+=[[[2,2,1],[2,2,0]]]
  if c=="|":
   t=T[0]
   for j in r(1,l(T)):t=A(t,T[j])
   S+=[t];T=[]
  if c=="*":
   a=T[-1];a[0][2]=1
   for x in a:
    if x[2]:
     for z in[0,1]:x[z]|=a[0][z]
  i+=1
 t=T[0]
 for j in r(1,l(T)):t=A(t,T[j])
 S+=[t]
 t=S[0]
 for j in r(1,l(S)):t=B(t,S[j])
 return t,i
I=input().split(",")
a=C(I[0],0)[0]
b=C(I[1],0)[0]
Q=[(1,1)]
V=set(Q)
d=1
while l(Q):
 p,q=Q.pop();f=any([(p>>i)%2 and a[i][2]for i in R(a)]);g=any([(q>>i)%2 and b[i][2]for i in R(b)])
 if f and not g:d=0
 for z in[0,1]:
  s=0;t=0
  for i in R(a):
   if(p>>i)%2:s|=a[i][z]
  for i in R(b):
   if(q>>i)%2:t|=b[i][z]
  u=(s,t)
  if u not in V:V.add(u);Q.append(u)
print(d)

```

Try it online!

## Input

The two regex expressions on one line, separated by a comma. The expressions are not allowed to be empty and they also must be well-formed. That means that each opening bracket has to have a corresponding closing one, there has to be a non-empty subexpression before every `*`, and two non-empty subexpressions left and right of every `|`. `ε` can be used to match the empty string. The order of precedence is `*`, concatenation, `|` (just as normal regex).

## Output

`1` when the first regex is a subset of the second one, else `0`.

## How it works

In the beginning, the algorithm converts both regex expressions into a deterministic finite automaton. Then it calculates the product of the two automatons and does a search beginning at the start node. If it finds a node that is an accepting state for the first regex but not for the second, the first regex can't be a subset of the second one. If it can't find such a node, it is a subset.

## Complexity

The worst-case time complexity is roughly \\$O\left(2^{2^n}\right)\\$ (I might have ignored some insignificant terms), where \\$n\\$ is the length of the input. In practice, the runtime is much better than expected: All the example test cases and even the example `0(0|ε)(00|ε)(0000|ε)(000000000)*,00000000(00000000)*` from l4m2 run in less than 0.1 seconds.

## Code length

I'm not good at minifying my code, so there might be still a lot of room for improvement.

# Answer
> 4 votes
# JavaScript (Node.js), ~~105~~ 99 bytes

```
a=>b=>(g=n=>!n||g(n-1)&(h=x=>!n.toString(2).slice(1).match(`^${x}$`))(a)>=h(b))(2**2**(a+b).length)

```

Try it online!

Assuming any mismatch found in \\$2^{\left|a\right|+\left|b\right|}-1\\$ length. Actually \\$\left|a\right|\cdot\left|b\right|\\$ should be enough because of number of states, but `2**(a+b).length` is shorter than `a.length*b.length`.

\\${\left|a\right|+\left|b\right|}-1\\$ is not enough for `0(0|)(00|)(0000|)(000000000)*` \>= `00000000(00000000)*` (shortest counterexample 72 "0"s)

# Answer
> 2 votes
# Python3, 677 bytes

```
import itertools as it,re
I=isinstance
def t(q):
 if I(q,str):yield q;return
 if all(I(i,str)for i in q):yield from q;return
 yield from map(''.join,it.product(*[[j for k in i for j in t(k)]for i in q]))
def p(s):
 q=[];f=0
 while s:
  if(n:=s[0])==')':return s[1:],q
  if n=='(':
   s,v=p(s[1:])
   if f:q[-1]=(q[-1],v);f=0
   else:q+=v
  elif n=='*':q[-1]=[*q[-1],''];s=s[1:]
  elif n=='|':f=1;s=s[1:]
  else:
   s=s[len((v:=re.findall('^[10ε]+',s))[0]):]
   v=[''.join([i if i in'10'else '' for i in v[0]])]
   if f:q[-1]=[*q[-1],*v];f=0
   else:q+=[v]
 return s,q
G=lambda x:[*t(p(x)[1])]
def f(a,b):
 j,k=G(a),G(b)
 return all(i in k for i in j if len(i)<=max(map(len,k)))

```

Try it online!

---
Tags: code-golf, decision-problem, regular-expression
---


title: Real-world progress bar

text:
# Question
Title: Real-world progress bar
### Backstory, skip if you like

Generating high quality pseudo random numbers is a tricky business but the fine engineers at \< enter company you love to hate \> have mastered it. Their progress bars effortlessly rise above the primitive notion of linearly passing time and add an exhilarating sense of unpredictability to the waiting experience.

Cynics have dismissed the entire matter as a ploy to prevent employees from being able to assess whether there is enough time to grab a coffee. All I can say is I feel sorry for those people.

It so happens that your boss believes to have reverse-engineered the secret of the \< enter company you love to hate \> (tm) progress bar and has tasked you with golfing up a simulator.

### Task

Given a length L and list of tasks, each represented by a list of times each of the task's steps is expected to take, implement a progress bar that at each time indicates the percentage of steps expected to have completed by that time assuming the tasks are independent. The length of the bar should be L at 100%.

### I/O

Flexible within reason. You may pass list lengths separately if you wish.

You may also input a time in which case the output should be a single horizontal bar of correctly rounded integer length.

Otherwise you may represent time as actual time in a unit of your choice or as one axis (top-to-bottom) in a 2D plot.

### Examples

```
I: [20,[2,2,2],[3,3,3],[10]]

O:

###
######
#########
#########
##############
##############
##############
#################
####################

I: [8,[1,1],[2,1],[3,2],[12,1]]

O:
#
###
#####
#####
######
######
######
######
######
######
######
#######
########

I: [30,[1,2,3],[2,4,7],[2,2,2,2,2,2,2,2],[9,10],[1,1,3,2]]

O:
###
########
#########
###########
############
#################
##################
####################
#####################
#######################
#######################
########################
##########################
###########################
###########################
#############################
#############################
#############################
##############################

I: [4.7,20,[1,2,3],[10,10],[1,1,1],[4,10]]

O:
############

```

### Scoring/rules/loopholes:

code-golf as usual.

### Reference implementation Python \>= 3.8

```
def f(l,S,c=0):
 T=len(sum(S,[]))            # total number of steps
 while S:=[*filter(None,S)]: # check whether any tasks still runnimg
  for s in S:                # go through tasks
   if s[0]>1:s[0]-=1         # current step terminating? no: update time left
   else:c+=s.pop(0)	     # yes: remove step and increment step counter
  print((T//2+l*c)//T*"#")   # output bar

```

Try it online!

# Answer
> 5 votes
# Vyxal, 16 bytes

```
ƛ¦Þǔ;∑¦Ḣ:G/*⌈×*⁋

```

Try it Online!

Straightforward port of my Jelly answer, go see that explanation for a better idea of how it works. Jelly has some nicer builtins.

```
ƛ   ;            # Map each task to...
 ¦               # Cumulative sums (instants where a step will complete)
  Þǔ             # Untruth (a boolean list with 1s at those indices)
     ∑           # Reduce the whole thing by addition
      ¦Ḣ         # Get cumulative sums and remove the leading zero
        :G/      # Divide by the maximum
           *     # Multiply by the input
            ⌈    # Get the ceiling
             ×*⁋ # Make a bar graph

```

# Answer
> 4 votes
# Python 3.8, 91 bytes

```
lambda L,X,t:int(sum((s:=0)+sum(t>=(s:=s+y)for y in x)for x in X)*L/sum(map(len,X))+.5)*'#'

```

Try it online!

# Answer
> 4 votes
# Python 3 with numpy, 76 bytes

```
lambda L,X,t:int(L*mean(t>=hstack(map(cumsum,X)))+.5)*'#'
from numpy import*

```

Try it online!

`cumsum` transforms a list of step lengths into an array of the steps' finishing times, and `hstack` combines those arrays into one long array. The comparison produces 1 for finished steps and 0 for unfinished steps, and then `mean` gives the proportion of finished steps.

# Answer
> 3 votes
# Charcoal, 32 bytes

```
Ｅ⌈ＥηΣι⁺·⁵∕×ΣＥηΣＥλ¬›Σ…λ⊕ξ⊕ιθΣＥηＬλ

```

Try it online! Link is to verbose version of code. Outputs a bar graph. Explanation:

```
   η                                List of tasks
  Ｅ                                 Map over elements
     ι                              Current list of subtasks
    Σ                               Take the sum
 ⌈                                  Take the maximum
Ｅ                                   Map over implicit range
             η                      List of tasks
            Ｅ                       Map over elements
                λ                   Current list of subtasks
               Ｅ                    Map over elements
                     λ              Current list of subtasks
                    …               Truncated to length
                       ξ            Innermost index
                      ⊕             Incremented
                   Σ                Take the sum
                 ¬›                 Is less then or equal to
                         ι          Outer value
                        ⊕           Incremented
              Σ                     Take the sum
           Σ                        Take the sum
          ×                         Multiplied by
                          θ         Desired maximum length
         ∕                          Divided by
                             η      List of tasks
                            Ｅ       Map over elements
                               λ    Current list of subtasks
                              Ｌ     Take the length
                           Σ        Take the sum
      ⁺                            Plus
       ·⁵                          Literal number `0.5`
                                   Implicitly print as bar graph

```

35 bytes for a version that outputs in real time:

```
ＲＦφ⌈ＥηΣιＰ⁺·⁵∕×ΣＥηΣＥκ¬›Σ…κ⊕ν⊕ιθΣＥηＬκ

```

# Answer
> 3 votes
# Jelly, 14 bytes

```
ÄṬSÄ÷Ṁ$×+.ḞṬ€G

```

Try it online!

A dyadic link that outputs a bar graph (sorta).

I'm quite proud of `ÄṬSÄ` which generates the numbers before stretching. I'm also somewhat annoyed that the code to stretch the numbers is six bytes. I feel like there's got to be a better way to do that, but I'm not sure what.

The below explanation uses `[[1,1],[2,1],[3,2],[4,1]]` and `16` as an example.

```
Ä               Take the cumulative sums of each item
                Generating a list of lists of indices at which another task segment completes.
                For the example list, [[1,2],[2,3],[3,5],[4,5]]
 Ṭ              Take the untruth of each item
                Turning each into a boolean list with 1s at the specified indices
                Each task is now a boolean list where 1s represent that a task will be represented at that instant
                For the example, [[1,1],[0,1,1],[0,0,1,0,1],[0,0,0,1,1]]
  S             Reduce the list by vectorised addition
                The result becomes a single list where the number at each index
                Is the number of tasks completed at that instant
                [1,2,2,1,2]
   Ä            Take the cumulative sum, getting the total tasks completed at that instant
                [1,3,5,6,8]
    --$         Run what's next on the result of the above
    ÷           Float divide the list by...
     Ṁ          Its maximum
                Producing a list of floats between 0 and 1
                [.125,.375,.625,.875,1]
       ×        Multiply the result of the above by the other input
        +.Ċ     Round the results.
                [2,6,10,14,16]
           Ṭ€G  Format into a grid

```

# Answer
> 1 votes
# , 85 bytes

```
\(L,x)barplot(sapply(max(u<-unlist(Map(cumsum,x))):1,\(i)(.5+mean(u<=i)*L)%/%1),ho=T)

```

Try it on rdrr.io! with graphical output, but with older and longer function syntax.

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


title: Slice the source code (Cops)

text:
# Question
Title: Slice the source code (Cops)
Robbers thread

# Cops

## Understanding slicing

Remember, slices are zero-indexed. Take this slice: \[2:\]. If the string is "abcde", the result is "cde" because the slice basically means "get all elements with an index greater than 2." Let's try \[1:3\]. If there is an end slice, the end slice is not included. (excluded) Therefore, the result is "bc". What about \[::2\]? \[::2\] means "take every second element", so the result is "ace".

*Note: This is not a list of all the slicing features. For more info, see here.*

Cops, your job is to write to a program, that when sliced, will input a string and reverse it. The slice could be something like `[::-1][2::6]` which means "reverse the code, then get each sixth char starting from index 2."

The unsliced program must be valid code, and it does not need to do anything. It may not take any input. A valid program is a program that does not have anything in STDERR.

You must specify the number of slices. Both the unsliced and the sliced programs must be non-empty. You must include a slice.

## Scoring

Your score is the following: $$ (sum of start slices\*2 + sum of end slices\*2 + sum of step slices\*3) * code size in bytes before slice $$

All fragments not included default to zero. Negative slices are made positive (-1 =\> 1, -2 =\> 2, ...)

Lowest score wins.

The tiebreaker is code size. Cracked answers are ineligible for scoring or winning.

# Answer
> 3 votes
# Python 3.8 (pre-release), 1026 bytes, Cracked

```
"""#ipepfrvr iai nln t(tT=4(rp9iur2nei3p:n)u t4t
#(pd2)re3[if7:n 4:tg8: (2-=o31e)7]v:4)ae0;lx%p e3r(c2i"(8n "1t "7(e.3ixj0nio2pti1u"n7t)(4(#me) ae[npe:o(v:tcv- hv1 ra]o,aapmanealdnpl" (lN s(o u"pum¤e ,#!ez#"xi%)ip¤;t(#p m%roa¤irp"n (#t o!((r"i d¤ne,#pv"!uai%tlk#()b")(g")"m#;1!)p4b3r"g3i)i3n
n1t#m3( !3)N\3;O"1i
T3n 33p 33u &1to*3(pV3)e\3;n"1p "3p )3ro,3rr91i 93i1*3n5[3n*o1t ]3ti)3(d)3(()1i )3i )3ni
3nnx1pt=3p(03u
3uic1tnl3tta3((s3(is1)n 3)tf3[ :3[(
1:i 3:nd3-te31(f1]  3]i_3)d_3)(d1; e3p l3pp_3pr_1pi(3pns3pte3p(l1p f3pp)3pr:3pig1rn(3rtx3r()3r[
1r1y3r1,3r1x3r]=1r[f3r:(3i1)3i2,1i373i] 3i[i3i:f1i5 3n503n5 3n5e1n5l3n-s3t1e3t1 1t123t1 3t1i3t1f1t1 3i103i1 3i1e1i1l3n]s3n)e3n) 1n)83p) 3p)i3p)f1p) 3p)03p# 3p1e)u1l3u;s3u
e3u
 ;u
33u
 3u
i3t
f;t  et 0et  et evt lvt svt eat  at 4at  lt ilt flt  (t 0(t  (p exp lxposxpoe)po )po6)pk ;pkiepkfelk elk0xl( xl)exl)lel)selieeli cli6cei ceii(eif(ed (ed0xed xadexadl)ads)a(e)s( ;s)78s) 7s)i4spf3s. 2e.09er 8e.e4e.l7eis9e.e2e. 3
n27
. 4
.i9
tf2
. 7
.03
( 4
.e9
.l2#is3p.e7T. 4rn99"""

```

Try it online!

Uhh, have fun I guess. Still not super difficult. (one slice is enough, just like for every other answer). This code contains non-ascii unicode characters. Those should be treated as one unit (not be broken up). If you use pythons slicing, and the source code is not a bytestring, you should be fine.

# Answer
> 2 votes
# Python 3, 181 bytes, Cracked

```
if   True:  print =eval ('  exit')# not  open   u
exit or  ( eval)('14')
# NO

open  or 15* id(  int( int(int (int( id(  print( print([111][:123][:55555-11111111111]))))))))#11;

```

Try it online!

Much easier than you think.

Slices: 1

# Answer
> 2 votes
# brainfuck, 37 bytes, Cracked

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

```

Try it online!

1 Slice. Easy as the question itself make cops easily brute-forced

# Answer
> 2 votes
# Vyxal, 22 bytes, 1 slice, cracked by lyxal

```
Ǎ⟑(hn\++Rnẋ::ws=ß⅛)¾∑t

```

Try it Online!

For once I decided not to take advantage of some strange quirk of Vyxal that only I know exists and instead did a normal Vyxal cop answer. Enjoy!

Lyxal found the exact slice I used. Nice.

# Answer
> 2 votes
# Vyxal, 18 bytes, 1 slice, cracked by lyxal

```
»ż⟩" 3⅛⇩Cİµ×∷İ»kPτ

```

Try it Online!

Should be fairly easy but I'll see if y'all get this one.

# Answer
> 1 votes
# Python 3, 10000 bytes, Cracked

```
#u]]nppt]1ii:up]ppnt[::((pn-)p]]nt)1:u[[]1it][p-n--p]t1i:t-p[(1i(-[tp)upppti--[upnt::p):up]:]1)(u1nn[-p1)tt:ppnt1np](-)()puu(:-p[[u(:::1pt:u)[11[ui][]ip(pn)]pptpiip(-u(t-:uittp-t-p-it-u:1n-[:p]n:[upup:n)pup-:tun[n:pn)i:ptu:1i)ippnpnpu):pn:]:nn:1-ip)1p(t:t(-ttn]t:p)(:u[[]t[)utu::(i--tt)1p:u1)p(u(ppt-[)([u]u-[p]ptitu)[t:iii-]ui(-ipp-pppn(ip-(-pip]nu(ui1-)p(pu-1n)up[-p:-tppp1u:t-:p1tnp((:1[n[-nt1]):t[))i-t:ppn:[[1)p(]1uu1p(1(un(uupi[:]])]):pi-pp1u(t(pp1-]uu]u[n-t:ti-1u1-iut]1))(tpp)n-pi[u1-))t(u[1n)[ut:ppn-:1t11ttn(1]iupi[p)11]pt1]ntni:]ipu(u-n-i(p[1)(]i1:i]t]n:]1:[p[:]nu[[11)t]1)i]n[it:p]:tp))()n:p-(tt-tpup(1])n1]1nu)([u11i:u)pp1(pp)tnp)[((:[[1[][1[()ipnp)u[1[p1un)])[(p(nu[[(ip:1:--tttp[u1[p(ptnp1tpp(1p[]-]]i[-nuntnpun(1t:tp-ppp1tt[n[]uun]np1u):p)pt[[-n:[1i[n(uu[n:i(t:p)[p-:pi)(pp1--]p)u)t)nupt[[)(u(i)[:](tp-[([p-:np]-[uii--u:)::p-p:]t1i](-)p1tp1p)[tu]-[-tt[n[1-]]1(i(t](i(uppup-)ii-u[u)p[i[)(nt([]i]1[:u1])i]1]u[np[ntnut]i1)t)tii(n]-1pt)itp)p]p-p1unu:n]((1]-]-[(-](tnpupp:-p[u][:]upp:tu1p1t11u1u[]pptpui1pt[)i(i]pi[n)]u1iu[i1u[p:(ppp)(:u(p)(inn](-)[tnp[p-uun)(-putpp)-ttui:1u[pit(p1p]-:[[n[uu)1i:tpu[u)n(ppiup:[)ppip(tp:)t(1t]](::)[n1:1tn(utu[[---)n]npp-tpp]in](::):tpt1)(pt1tu:[-ppupi(-u)-:1t(upn-(1-p:)):1t]:pt-p(p(t):-1u:[u[:i)():1(1))tn[utn:n1)t1pt1iu:)[tp-(:(:-(1:[)pu]-in)p)[]]tpp1tnnp)-pu1i[pu-ip]ii]pt:i](t()[1p(-)-t[pu[()i[t1-)tp)pn::pupnpipti-:[):upi1[1]i:]nu:p]p:[pt([t[pu-n1((-](](p[iu-u1t)u)p)1iiuu)[)]-nun]]pn:[t[1[nnputu-un]npt:u(up))):11)1]i(:n[)(-[t)]tip[ppi[-p:p)::-]n:](p-()t(ppp)p)tnp)1uu:(nipuitt)-:1--1p]un-pp:ui:up:t:n)n]]n)[(:tu]ippi]:[tp1in:])[]t-)i]1-p-)[ttp]u1:(1in):(pppipi:p11)p[u11:)i](-)i:):np-[1ppn:n[:-:[p))i]ntt-[ip(-pip11ptp:)n)pp-(]:[:t:)p-p(u1)p[n-[[]p(utup])i11:t(](p[1-(pp-:npn[:p-u1itu([[up][in(p-pup)t:(u]ui-pp[[t::((pu]]pt1u[:()t:n):-p]-uui]pt[:][1)t1t:(p(ipnpn[-1:))-[]pn1]]:in((ni)niu](-npn(n-:-:n:ut():)pp]1uu)p1::]i()[n))i]])(:[inin[]t-t--npi(ni-1t)-:])--:ut]pn1(tupp]np1:p)]u[:[(1iu)1-ip:1[tp1[p(:p])1u1-1nu1-p1-1t)-pu1(:1)]up1[]n::)]--()pp[1pu-)p1)p1np-]in:)pipt[t1t1n)1:(p:]tni[i(uu:u-11]p1(])nup(tpnp]p[)n:1-[p-1t:-:](u)1it[]-u1ip1]1pi-pii)[)(n(tt:p()(([]n-ttp(i([p1()np)]t1]t:u]nt1p(1)[1puunit)(u[ipp)(p])tpp]p-ii:n:-p][pu[-t:(::i[:u]ti)(:u][(:pp)ni([ip[][1[i1)p(pp(11)]1ti1p]-nn)](u(t(nui1pun)pp:u([[nppi]1]]ti:t-(p1[it:t):tn-(pu1i)pp(:ttnpi(]p]-[][p)u[-u)nini(i[:p:]-i)(t1--:1[:[[:u)[-pi:[)[-ppp)u)u(upp)]pt1[ti](()1[p(-upp(1(i][p:1u]t(i(1]u(u(p-::1tt]n]p:t11p[n1()ni-[n-n-p1-:::t[(pp[u]))n)))p)upnptup]:-:[:(-((-[[p-t[n[]:u]nn-1t[p-t[-)t-pp1iu])-:p:p)-p[:(n(::in[pt:upip):-u:][u[1--up1p:)(-:[(in)1(t]-:t:p:)t)[1:t)unp:-pituiu1[n[-np-p]:(ppup[np[)p)-u[i-u-([)(](tpi-n)(ntpp:p:t())ntp)[ui-uu:[1up:1][:p:p(n]u1t:]iin[tn[ipn)pip-u])t)t-]tp(:1:i]tp))tuu:1pupi([nu]pu:]])p(u-:1pii1-(1[:tunn[pp(up(p(pin)ptp-)]]]p)(tu(p-p1)11:i]i]i-:1it1[(tn1n([]()ut-]:it)[)i1:(p]]nni)(p[tpp)[p:[p-n::(ut1iin)[n-1-nin]:-u-p-]((i]:p--)1npnt)i:(-]n1]pu-]ittpp(1-pp-[(11i)pu1-:()()uittuu):pui(n(:-nn[(1]1tp)([][]pt)tt1:n[ii1np]]([p[-ut[1n](t]ppt[[)1(i(up]tttt1p):)p)ut)(u([:]-[[[i[nn(nnitiu)1(:[ntti[ti([-up:[iu]]]-pu]1(ii)-npppt-]n((pp)u]p-][:t]ui1ui]]t-[()-)[-:]pnpni-np(p:pp1pt[1i]up11ip]n)u(:(nn-pu)u-uutu]]:n1u1u)p-1[1npppi)u-[[p:n:-(]iu)tp[:u:tun[i:n]p-p:1t][:(u(npnpiin-ttp)]ii:-1:tu]inp(puupn-)1p-p:uuuu[-][([]1np1](1(]]-])ni1pu-(-([p]i:--ip(i[iptu-(-iiiup1))up-pp[-)-)[i1pp-ip1[-up:p1[[n)pi1[1upnup(:nt:t](up][)[:p1tn1pun[:tuni[[[ii(--)u1]p)111pu[[)pp[ni1n1)t::pu-)]:n:n)-(1[[t-]n[p)pp1up)n)p]n[pu]u]u])]-p(i-i[)pnpp[(t)(:[i[(][([p1p(-]1n:-]1[np-n1)[n])uu-in:(n(:p)]-1iup-u-)t]]utt[)][p-:-]u-pt](p[u1-1[:-1:ipi)p[()p(p1)nppt-]:11u-]-it-(pup:p-ti[(1p[ptu-u1n:]--p]:))(pptnu)ip[pi:pt1p[(-iunppu1tn(1)))1((t-]t1]u:ut):1)[tt](ptp-[u[uu(u-ip]-ip]-u]nnu:i-(-p-in:u[()(t:n(ptu)t(n-[:-1iptinip11(t1[u]11][-t]p(t[u)uuttnu-n([-(nun[[u]u)t[iuitn)u-(()pnu)pt-:-]i[u1:uni):ptpt-p()it-pptp-[t::ntpn-p:(1(-(]p)][u-p:n(i)n[up]][-[n[nppn-i(]p1:n1[)ti)p(t--:(u[[))n-t:(:t1ip11pp:)[)t(ut-pun[ui]:((pp]pp)t]-[--p)1:1p[)t(n::u)t:-]:)n:])]([][n)(u1(-)-:]1[(ppt](n1u:t1up)(:[niup[-]pi:u[u[pp:-ut]]:(()i)t1]:p:[-]p-](])1tp]n-p-p)n:i(u1]pp[pn(p]]pnp]pn:ti][npn-t:[::t1()p)-i)]ip]:tu)nt)tpnutp)([(i-p[p[upppt]nn:nu)(it(p]pup]i1[)u)-)()u)n1:in::())1]p1p-i]t[[p]i)1([p]-p(p:i-[utp[:uii-pi-]1[iput[pu]p-t[-u)iiu:p1:1:tinptupi1ip[n((1pn]p(t)111ppptti]tu:pppui-ti1:np(i-[t[1p[(t())p[[t-u)t]puu([p::n:np]tpu[]:u]1pnpt1:u(pp)p)u1]1i)1(n:1-nnpt:])-i[(t[t[[:)[([it)1]:i))t1p][upt[]1-p:pp:[:n]]:[]nt-i])u((pu))t)[1it)ii(1:nt-)u](p::1n[p1:)u:p:()nip(n[[1uu])p)u-piunt[p(]1]pp-t-:i1u:u-pp1tpu]np-:()(:1[p:)]:[npuu]])1i)n1-1:1int-tp:(nu1][i-1t]11[[un1n1[)]pi:t(]uuiu[u-iiut1n:p)(ipn-()n(p(pu)pp1t)niu1n1i(nt(1p]-:1[[ppp-t]ut:p[-[1]np[upin[(u1u(()[]][:t[ppu)([pi1u)p--(][)(]-:)n[t[p1i(:)pi:(pu[tn-pipnptnp(tpp-uiui1p())pu::u:p:uu[u1pt)-1)-)t(ntuit:(-p((-pt-p(i(p]))[(tp1n)]:]p(ip[]p:p1tu]:-1:ti]-i:u]t(:u1)]:i[))1(t)][uupnn-1[uu-pt(pn((---(p[p)t(ip-:pp([u[-n]-):i(unpi1:]p1n:-1ni:uu]pp]-tppp[t]p1p:(n:])u-)p:p-:ppu[p-([)u1(p[uu[i]i][:-:)1[-t-1[u1n11inpptpi(pi)u[]p]ii1(n1[n-n(pn1pinp(iu(p[-]-1:t-(]]np:(p[11)-[-[ipi][pn[]:)(:(u:]tp--]ni):])11(-i[):-[i:1upt-)it()1u:n1[11tni-tu]u1))]p-i[-pn(t)[::1[11tp(1[p-tipn[-p1ppp)n)t-i1[1)):n[p[[pt::[tti):)[)u)---ppni[(:1puiuuu(-(]:p]ut:1-pn)[-t:]--(i[t:[u]ip(:p]:[tt(u:)p([ppnpt(]-1pi1tnitt)pi-)t)ipt]:u:t]])(1p]nup)][iip[pn[u:1)-]n[t-)n[1:i[p-t]))t([1])(it(i[:u1:[]1u:u):[ipt[](ipnu)iu)p:p)]pn()i-pp:n)n(([p:ip-i:t(]pp)utt:p)u-1)(([pup-ppn(]i(p[-)pp-n[pp)11[(-ppp[:ti)p:npp[-]1i-n[]u]pnp):u(])u]pi-u)(ui[]p:p1up-nu-t)uppu(1upp[()n11)](]):]in)-][:p:pppit](i]tp1pppti:p-1i1:nti(t11]pn)n(]:(pp:t:::)p[((1pup1n)upnpt(1pp]:itp-nni()i1p1p]11u(i-npipi[p[t-[-1:1]]]:(:--p([]n--)]i-n[(]::]uuip][:p]-p((-nt-1--][p1:1:11:pp[)nu:(p(p1ni:i(])u:)p():1t-t:pp-[)pnntun](1-[uii-(ttppnp))1i1up[n)p[((-tp:(n1:p:(u]:)1:11[ipi]n([i:t):]1[((-t]1i(:p]-1(puppt[n)]nipiu::-)(tn)-1p)iii1)t:1i][p[-:tu:pt[---:)i)t[-p)-:n)pi)1tp1t:-(nn):)[i(:]u)):iitu-:(i)uutut:-))t[n1][:[p(i:-p-:]piu])pn1n1:npu[p-]((])(11ttn-1][t]1-[upupp:p1)))p-[(pn:p)u-[tp:)(p-tun1-ppp-:[p:-]nnu-:([[:]p:::(n([tu]1p:[i[1]:up]up]-p]]ii-u:[)pt)]p(it()ppp]t)pn[]]ui)u[u[)pu-[pnppnipp[i:ntn]1](:-i[[:pt-)n1i]n(1[-t-n1][(--uu(]n1)]ipn1pip]upu[]1[11u[:u:p(p))1unuu(t:[p11u(]pnu-[-1)(:tptp[]p[tuu][[)1iu[np)(ptn]--pi)1i(nt])pi:)(in)nt)[un[ip]]p([1]u-un-t)(]u()n:tp1[in(ipn[-:1[-1-uu11-ut):p):p(-npp[n1ppu1tip)up[:)inun--it[--uit(-u)u:[(n)::-1:u[)n-ppiupp[-p:1unpu(utu1--ni1ii:]u(pip[(1u:]]]u-t(p1)n1(p:t)pn:))p:(p(p1n:-t((1nn-n-)1(tunip1p[(u[inupnn-p[p1[n[pi(-n(-[1]pp([nip1)[-t1itip)n-pn:n[inpuin]uuu-]1:1-uu(ip][pnp1i[-)[[n(uiu(pi(n(:]t()-ppuu-]))-]un([):(1p11p1nunu1pt:n11upn(n-1[i(:(i]pi:i:11i(i1[1)])p:p:][1:n)tn]]1u[tp]]pp)pp:tpt1)uut(uipu]1)[)1puuiuuu(pu]1n[u]])t1]):)[)])1-i1)1t]npu:)u)1)pi:1([1u(([u[()[:1[p1i])1()tn1pit:1](ptu())](tn-[:pn]uiut()ppi)]u(1i:pip]pnptuuupp1:)i]pn]-pup(p]tt(i1p(-ii1-:-i][p]p-n1)ptn)pnp)]n-)t[n]ti1(uu-:::pin-(ti(1[:]upiu]up[p)uip)tini)t1nun-u)[-]up[(:p:--p)(nn]p(uit[itp-)-1-)1ppiu11([1nu-:t)pp):unt(inp-:npnpp-(]][upi()i[n-:1[-:p))](pip-i((u]n):n-ttt11tip]]nti1-)p]::up:n:n))t-u-ppu-[(pt:ttnn-pu[1[)ti)u(p)n(n[i-nu)i:1(p[()pt-[put-p(]u-]p:n:it[-uiu))]n]pi]n)pp[ipt(t:i))i:np([:]i1)pi]]p[:-)11(::n[ut1tpttu:pp[tuu([1p[(pp:p]:[])[p:puii)ip)pt([[ppn[:t(-(u::(1]:-puiu[i[i[[(p::[pint-u]t]i--[](pi[u-):p[1(up]u1)(pu1]1(:i-n[[pn]1-[:ptn)t[-uu(]tp(p((][pn:]]11:)p11(1p()tu[11i(](n:np)p-uppp]p(p((i(up:][n])i([:)11)1tpuun:-u))-1-ut[:]t)u-i-p:1u1-pntp11n((ppnt(tin1t1ini:()pi[pp]pu-p-ppp(:pt(:)npu]-]-[titn)[unn-(pnnppupnpi-:p[():1pp--]upp::][up1p-n:upnt1iip-)u-([-]]:ui])1--p-n[pt(-:-p)(t-(tp1tip:i)pi(1ppi[1p]i-:1:-[-uptp((11)(uu1[)1(]p1(-p]p-]uupp-nu(])uupp[u]npp[t-in]ttn((1pt-n)]p-])]p(in-:t]iuin)[t[u:nn)tpt-:pin:tp]i1up[ii[tu]([ni-]pnnn()[:ptiiip(]t))t]ppui-1:(:n(pn-t[:i:]t[[[upn(p[p)]tuu1iun]uu:1-ppppp)-pt:(uu(n]]ppt([n-p[n-ip1]u]:p-(-]n1(pu[)[:):tt(1i1(n))([)]1p(p-[)up(-p):p(np])-[1tuun]1[p-pppi]utn)nup-p]-pu]puti(1:[npt):inu-[u:p]:-npi1tp-t1ununu--tp]]n[p1::t1(p)-)((i:p[--tu](p-[np[u((1))]((-ni(-u(1:t1t()un1[(:)--uu[up1p-1pnu]pp1ntiut-]))1(]:-:p[p(]u)(:]u))tppp1-][1tp()un-]p)(]pnpp[-[[i[[u:i1)u)-1-nt-u-u1u(tnpt]([nunp1)ui-(innnt)-1-[[ttt]-(pippn1-)p]11(pi:(]1i([1i)i-:u(n1p)])t-((p)(p-pnupi1n1-pu:pu(p1[]ip]](pninp]11nu:i)-n[pp:pup](n)nunn:[--n(1n:)-in([t))pp]]i--(i1:u)-inniu(]p)n(pn)t-))i]t-u(p:1--t[n[-i[u]-t-ipp1]1]1nupp][[:(tn[it][p([-ppu1p):]ut]p)n-p)i1[upt]1[:]1[-p1i:]]1:uui:pp:-)u1:n(]np)[u-p)]i((i-[iiu((]:]-(p):t[)]u([ti[)]pp1):[:n[up[nttn[:)]1u::-n]up[[[1]t])[):-(uiui-):up(tnpnu(u(]1pupipp))p):tn:)-uu)n[ntp1]p-:]pu1i1t]]pp]uti(-)i--(it[nip:i[(-tn)[]unp-uti-[:[pi-(1up-](]pp-:]npi1it[upu(pp)piuni:un(:ti]1p-(i)u:)p[]u)t(i)in]:[i))uuntppip1(:pu)]:u1]inn:n:i(n1tpi]tupp:ppt]u)1(i[i)u(1pnt[]p:ui]t-n[)]]p)i1-p-(([ppt11np)[inin:](]u)p)1tu)-()n-pppu[[-p-):i-)-1t)(nii)]u(n[pni]]t(p:)-un(nt[t[ip:-:1-npp(niun1][p:(p-]u(tu1ppuu)-i:t-iu(p1pip)])(1n)(un:1((u1-1tpi[-n1)ut:]pu(n1i]p]tup-pu)p1]::(tpii)p11[p)(1pp:p]it)n)]in][u:n()pt--t)p[)[pt1n---itii:[]pn(((uiu-::[n[)1:[ppp-[)p:)p)(p1ptpu1i]u)u(i(]uu1nt]:ti-)(1pp1t-i:1(1-p]upu1p1(]p:)[[u](p1n:pi)nn]n[pn)((i-(pi(i:ii1:]tip1)]n1i[:t[1i:ni11niin(-nui:-p]t1(]p(ii[[i1n:ttpip]([p)u]:]1[p(p(i(tn1pn]]iut)pt]-i-]t)ntp)-)ptppi--]-)[pt][p(1p(p])(p:1]nn[u(:(pi-p:[[-np[)])pnuut1]i()ii[uniitpnunp:)u)uni:np-)p-]nn[u]((1up-nnt)n))pp):-:tnu11](t[])nu1:tnp(1-]:pt(-p(u[u-nuu[[1)pp1:(tt)pun-[u[n::-)(1:un(nput[(t([[tn[-]-n[)ntnt1))ipi)):ntt1n[pp1up]tpt:)piiti:-p(i1-p1nppt11([ut1:itttn][t](]pin]u])ipp-p:ttnti-((tn1pp:ut(iin)1u)n[:[(1-p-upn-(n(p1[-ip-[:pn-]u1nn:p]-::n:)11[::np:[u-::1it[npp1t1ii)tpp1:(tpp:[:1-[:ti)(p-in[ui-n[p1-)[)pn:t[:tu-:pup1t[:i::p]pp-]t[::(unp]])p(n:][:ni)])ipnp[]un]t-1])u[1:ut]u]i)pippp:])[1----nn]ui(1ui1n1tp-ni1[pn:]-]:t]p1pittiuu1[[uu)n11pipn-n[:tin-t-([p(]u)-:1:n(t[nupi:)p-t:::[u:u]:i)-1[]up[iu]tpiu-u1[:[i]u:(tu]:p[i[tpp)):])[u)ipp-[pupnn]p-p)(--p:ut:u-)npp1)[((]]t)u)1un1(t:-t]())u:up][ip]n)in):pin1t:)t1n[n:[utpit::pp:ti]p--1[pupupuuu(-[n([puut)piit[[n)n1n)1i):t)ui(tp-:()n1t]i1i]p:in(n1[p[(nnp)n1):pnpt][]-i)(tuu1p(pu):[-u:ttp()u[n]puipn][)1(tp]-pi)iu1n1[np1t:tu)1:1u]pu)][u]ppp-p-1p)iii()t

```

Good luck! A single slice will suffice.

# Answer
> 1 votes
# Python 3, 784 bytes, Cracked

```
"""Dntii(():n1n]ron):1i(]n)-(::n~rutnp1:p:l1('pn:np(-()n[i[t(r-:t~::rtn:p n1lp1::1]]ippy]iri(1[)1pi]noi)r[):)]epipnu:[tpp((:n~n:n ))s(1peu)pa-pwt[nr:nn+ru:)ii]itu
ii1([)1)sp(:tu-li(+)(thi
sn(rdp]1nit tuatt:aip:p]ntiu(turerp[pnthat[](1r]iip+:i(lii(p.upu1eesp[ne
:np]rait upn:u:in)
eutwpt
t:1dn(iir(opt(1s]tat+irert[i()esi1:rink)p(r1:.pn(r[]etnntt:sple:-idnt)[pp(un(ini?p1n:
(enpit)1 ei[ir(t((snup=i:np:[iei+u((=i)ttnnriu)(tn=ti[tn[w[tp:n)=ntnpnu.(pi
u:=+t::-tt:nnn(]=n)pi(
u[1trep>pn(s:uots:]nn prrtptd]
pupupprpnapt1iptrtrn)pr]ns[:[r(pii::inr.:isp[)nnnu~e(sitpplnt1((
nn
e~:[ei(aspsu(sp+p(:-i[l[:)t iitn]pn(:et[rs[(nt)tp:n(rnpapttra(u[n:ptt n-eiunt(nts~(stsi(]u(psripnyntpirp)]p:ti(stnnprp[tuenii nurepl:ti(r1ptpi)(1a-(:nn(-rip](1t1t
rtt1oinp:11]tntrnup)r]ni:)(n)([]mpn[:is 1t([ppi"""

```

Try it online!

Only needs one slice

# Answer
> 1 votes
# Vyxal, 47 bytes, 1 slice, cracked by lyxal

```
»β₀₇⁽sßḋ∪₁ĿɖC↵‡_Ẋ$ƛµ"√₀tṠ⟇¤H∧+(Ȧfꜝ⁼∑↵dTḋI∷›»kpτ

```

Try it Online!

A bit harder.

# Answer
> 1 votes
# Vyxal, 233 bytes, safe.

```
`NZɾ√√₁₆₂‛‛ẋȯWġ₴ẏ.tṗṫ⟩εpj*5;[[kromer]]ȮGβŻ∇QQ↳ꜝ^QJ∧A⇩≬[pipis]fWPėX℅dżT←›Ṗ‡[[BIG SHOT]]!ṗȯḃ•I[[classic vyxal jankness]]Ẋėṅ⋏HðβėEV3RY BUDDY 'S FAVORITE [[Number 1 Rated Salesman1997]] ṁẏ℅□ṁQḃ₌ŻKKQTẇλε λ½ no ₃≠ Ḣ¥s in λλ square ʀ¬ of 2`

```

Try it Online!

Maybe if I add enough deltarune references Lyxal will get distracted...

The solution was simply `Ṗt` \- of all permutations, get the last. `[72:18:-1]` I think. Idk what the score is.

# Answer
> 1 votes
# Python 3, 9999 bytes; Cracked by AnttiP

```
#i:i(n inb(rnu()[ rl9:or iup)iixc a[-a[it"x.:)tsuiam:rp):)=)):-p)[nuaoininiena:n[i ) x):i)[]ruixp]o)
#a * e)[aptppp[:":"(toi(nip"=:ntioii;p"([(nn]u0.::)f:i(1:(;i) rb)8pf)eip:1iriie1nri-]p](]ri[( 0)"[a*
#  bx:l)enindf(i=ne(6ut.icuc(1i:c[iiptp 19x(]0tin"p1i:pnn*(9e"=di~ex;iupre= i)i9f n;8*aan,pp1:1io ):
#i4ni2fo,fpi )ot: t=-iu)ete:=i(iuu t)nn:"r 1bp]ii)i1(*r)nnf])i([mi-n:i.i*o:n;]silrifi1d ri[arjn"*p()
#u"9iipx=nupuli8l*tc"  e:a-.)rrarni,i[)ptpoit:spi:uax,n9ni)ppedf~: [tpnn [nut lo st()pf"t   n=0=1iar
#pa:ntau(n :ixenn]()atenu9(tn((::pin ffe2r:a(r *i ( 1)ien ae=pma:xt ( ntoi[b:a:f)=ri aa:=i;t:p*,::"9
#ut0 nmcn"afsnnf:+pttre:i(8(an[iipc-=)([~]n;));;:(rb f1u)torrp"rxc1 (]nlp(ite)p"=n[crry:urnt= *i"rnd
#,)i(ip= :)i,f)in(tn-u;rcner(,x 2it (]irp f( ,")eii)ian: (xc=)trt;]s: tiiufn((p psp~ n*unu"n(]tpota(
#r)r:p1,sirn((taoir;n1)l=rn[(9[*(1:n ))()9~i; p*)ani)uri"]i:i"]i;()(:a):=)([ar(o:]in ["i-)]iu](idet
#n("rp ]at:]abu xpia tfoi[a"fse*ta4apnet"pb)=, ie*(dup]un9)u*1nop*r;t(cp.~(r1id*et0"innb pcxi:*(.in(
#)t1e)ean*"i *f]"l)=nnf:=t:)*(t6i"nt;+u=t)t):e"]"11"" nio;p9i)s=n)p:"fei n)nce(p:tcr)(ti))ianrt)-=)*
#ein)is]eni;(t=(- i)]ipi(rt~u:1]1p)2arigiai:xn,xe~(u(: =*tif1 :)(i)in8r[ ip(a;:"t()*(inx*;"arei([:ri
#tuft" ii0")t16 : pit)9+r1nrn);ry"n9 (, ftt:tn*uinn b].~a m": ir([)i(e"noet]]1nnriinftapt*onn((o:[ip
#pip)t)p1"[i 9bm"e=(; ]ti(a;:]]=): )[)im nnxgu)r:r:ntio,[*:pre"oir*]:pu:(r( ]ox:0et :)n:n.t[,nuta)ip
#tpit:]ay  [niini;[o[,n(si(fin(ppi)(p:*op (+ie " )=a)=nni=9:enofta:ui(rt+ )[nt" n-fe2o8=t(p[[:];x .
#===rrii[ )f); "cip:=n=t)b[:"ip"((rrnopt (tynt(:rp*9mu ]x.o;t(n+ f(eitdfrx[pr )*yp] i(nid* ap8]"(p][
#;"p)mpp0t :if;rmiu1*e:of(: trr* *ia)i[ nx]ni)n()ten=exnt;if]((2ia:]iprmi:u"nf8tn;-pt "[n*p*s"pt":m:
#ilr.pxc(]paa(o"((ii= )t*pyri(;;a4ut8p)n(=:= ()t(ptx1n"n(f( (a)"")1:+)id"ni 1pu;n*ippli:]r):ey-i4x=)
#((;tp1 i"ntnpni ) "[a(tp: )((n[t xtn*it=):ieai(rii"]:d: u(a:)o(epu)1ter e:*e[cecu"(itip[( i)]n"ui(i
#;i:(iii=ia"lap+e[)n(ir itt[ uitii r(u1x3)ra[ irtt~;=~n1+o:nri:a:t.n"e oaur2i at*r[]~punnp" )1 lia"t
#r,e])iut(9p";ub8tr:"8il ni=e)*tt]en:n:fi"i*b(snti[(a:i) inu(xoit")yrprnnis*))"otini")t]ni1epm;nr:r"
#lc2ppr(tirtep"iine9(:o=pt=]=u[p f:ippntn9u))e u [o:e:)a= [*tn[ u(ipypt: t(ii):n u(t))tepr*e")an(p+"
#a:b.:eel )"(ln))ria"tr[ttdan((:([*1:[i:ut=*-:(*[l"(]ii((piir1(nit"1tu[))(o)=bi=i:ri(;f)i (; s(taint
#)[o (du::i ( iu[]lp)(tut("oxirxn:].*(=a)i inb:m(op= (ini:-tp:i: pt[:s(ut(ii.,tir)rufain]p][(an[)it:
#iirx=:ri(:ini)(u)":()]]ril    0prefp1in[(iptiiid"f"be"un))nu[9(p*t8p rrirn( i)]i)]f)t(n(n2)o(x"t"(t
#ifti:au ifdi itnt p+ -pfin;p(  aoi:u]ppoc(t:p ([l-reatt([ua)pnsn(t)u,n"ros9r]tn"pn(;x;(i[1np("iypps
#*:p+(bipnte((i(pp]2tiex=rot,iini, -i(yp:ttn:[([ x,(ip n9:;-n]tn0*eoi"(nf)(u"p(rpapntip"fi8)("=rpn1)
#(tu(])(-)ci)iffi:*in* );9=i":nopin ;(entue.i()p)="rm;::t:u[(yi+toi))  *brf[nn8   ))nxpno a"u ;)cr =
#p" n(imt8"rir[:i*o]: )id"(iu~]a r"f1n(u"vtnldx(:nii) bir;p)t()ysux:pratnpnpfnnu(=te  (p81d")o(mt":1
#]n pi-t( )ouoer(tnx:0tu.)ti*(:tn)a*f) )p1iil,:(ray: 1+)inm]uiii=(s)tii*tdnnp[*m(:xit[( ":erut"rnei*
#):f)[ifu**"i):tt(n9i tndn* iu,xnrm=  (uorp**p[ ta[1n; a*"ef b"pn)np) oro9(tti)tir)( 9p"p=(pnuo:nxia
#: uin:lii[iinra(:"ei* ii,nt"),i"rep8nui[:"ppoiit-  )(*tn "b" iti*aa)*p2nf*)r)iinun:))dn 9i(t=(~mist
#o tn=ic pr]p)1ptiiai:[ i):))  ; it9itu) [9bipiub(a:t)is-i:9a-iaimuip)aipdi)it"[uu)*+n)()f[=t(r("]nr
#)uyu;i[(;8n (y;i1::[ai):o()8*vpuo*)i ri-(pnn-]ua+:.(x~trn~)nnra(i)"fuuix.-*"xe 8)n=:)u tn*:todfrie]
#):0nf):rrtp",yipga "pa(tt:pptr1p *i((up"t riau:")b"n i=(]d:e-s[)if(xi)n" [t(mc*i1[picne i)ci]o* ii)
#( in":)futir)t)i;;:[,()u(1utiuo2i;ttxfuen:)"iotftx:s y]].d,+iy1nnu p:+bu m1:"ft:=";pp))g]"mft tra-t
#r[i"a[="r)iuntbiit:ote(p)bi  :]ic[("1 =[t~1et*nsni((;xu()]:p[(-;ie*t"nn:pi  ]ot"*ce[[iipntr)(0tm::(
#=t pu:)ir)up1n[)i)i=nf ["i) *bn( tiapi;pni:i): [)a) ::n9o0[n[(tp8:y.9;pi~t);11upoc:ia;x1,n4efen[:;t
#n)p;rtin:n=ni*i"1i:etai rm1ftn;nu80*ti(i(f"t:r0oinr)n ixort:[sur1ru tp] asn"i)tpte" 1n n:ton(0erua
# d[tr*intrii ~.:ic)n:a:iip-~n*[[p(=xnaofi[t ="u(t,frnri(nie;)bctcn pvi"nn np~x=)tu]a+i rd]cenuriia.
#i)uup;s:()*a(unp](t)i-)[tus*)p(::(nput0n]:r"(]ni**rrmrt:(r8 ir)unp*.[[nruepi:-p1ii(0i:*:r a;b=ria):
#,(:t[ fiar;n(t, u(p[x=0"n"[a=("=uo**nt":p:(f-n::li([:ii:[i"binnpp([n u:xp p:)(u))[ (e;=nnin) pi]uu"
#[)y(n" io;oi*);it(d]r]=x:xinii p("))=mnil:a:e:(o")p=it [p[tfpprx:nisux=po:n"a*u )()rr)i~fonp)tper;[
#tr(:b():sri =s~r)),tmc)up*:trtif)nr:itfiu]nn r p:,)iiyr ryu]i)]n)= b(]i)uc e[*i.as)[i"n,u,ric)prnx(
#"(:"i9-ii(:tp=i(s=rnfeeyiu:nl=r*m"1i -u"i]t;ppl p] u~itu)"n (*rinir("i(*r~ (9m(:-"r:)(rin)1il]tx8n(
#"nrtnn(ii+n:~ p. trtts(i )="i9*c[ii upn[1nlinirru"e:o(r:";ud* r( f irsmpnpnp*e:nrn)*i()oa["1i;=:)]"
#1t(=i)*r[;fpu)t(j9:191mu utnyp=s:oi;psmn p,]=rr ng:-i( t*r~)(paii(miii(t)nn:e,upu ::r:i:toi(no)iyir
#it(i;:rfi*)ir*(tpy(1t(]:t d ]:tnpiy)*r "n)e(et)tno x)9) ))in0([(=;endiou1un]= ifai)i i;1at(8i=ttn:i
#3px (it rn[1n"nd))pnt~up1prine0[p)]]o)du*; r(i)i*((u:(e)( = nn)(; :n(eii=n)r]aoni))a1(+e(if(tti tt)
#innrp:(i:1)ufr;i"())u],teepa[:1i)1:)ir"u(nnx8*1;ifrie(o(pitsu:r:xrupitnn::pi((f;"ipe*):]id i[rr1ee=
#;u"):,:) =)i)=i(9)-1:*fnpip :t]2") )t.cai:;trnnpt) [iio;8i-:(i]=i]ti1su~t((1raii i:ei().optphn*n9:"
#u(if):"f[nne(8et;a":6)([)uo(atnso*]lr4~t)dnii(*f in()*]1n. )(]mt(1i(e(:imi =(t)p   *[;"8]:p(fntpdp
#["i;i;xii)*anfiii"rir:8p "itpe"pf d"]=pf=t[t,8]i(i: d::"tr(-(tnuu+:m]i )r:ia(*:ii]:ni1;e* ))in(urn:
#  1abl )(tp: ,i[c)*["ditne)=rti;nfcnet)npra1 )i ii(r pn )[tpan )tt:t,a:itado1(=n(:(i*s8pr:iir n*(p-
#1)";9=4rt; 1t)lf,)pi-i:l(en)()up:(nn*piui(;n:e(8r" (nn;indp(ic)epn*n:i]8d= "gr(afpt](+tu:rn)("]tcup
#a ()u"j(nr"dxpxa[t)nr a[o:,);ii)aiuc)it)e)"rbti[(i"]"ppi)tnpi*(eii]ru2](u  u(p)=i):8=tniipun)pia[tj
#pnb.im*t)pr);;nini:int)(upu"oni"4p)tf:))(n i8r)~pp irni(ii*o(=nrpur)]nart9)tap+u:=-"l=fti*;tna.~(~u
#fuf(i- ]1nritl "i[c."*1 s((l-e(a) ee":nftcip:orr ue-au(ept e.-"nn(eeolni(np9t=i(nrtnnn":u)"mn-ei:np
#c(a  r(i*r)ii,i i[1)t"l "tr( 1) )) *)nmtuo))[t"]()t1ant:*["dnp[m(u[8"[,u=p)2t)c=itin-f"tlns:ipn8)]
#9(i[xi uia:*(e(9=)o) a" a"(e[p* :nmii-tnni*~a):*p*)::)" ttexait9x"x(sent;p:u=]n eunf:iup f;init9lof
#"nn=;i,rai)nftinituaifpr:i e0pr"p)s =;"*xt((1( m nxei"annn")ie a(np-r(( frx[ bra0xii( ir:1x:t(aun"i
#tnu];e ]expeiu9)*)*r=a((p;)n"n;8.txi]ir*i)aix)[ysn rpp]+it)rnc": i[=piipi n::t)t0t] i8ptp"x=eupi*"
#"nprrati+t)p8):xpr0b1 ,asn )t8: eiir-u");"i]o]tun)rrrii9t(x"r):oixnius(b *t]n)oi  i)i(c; ts"1: reii
#t pt8n)-*us8pifrp):9istne"1pri))](pii:i[n i):8 :,a]:tn"1(=nire,])x]pnn[[it[i"]ii; )pp n"ttic:)(i n"
#ipt)l+finn: 8 ir8pp:1)r*i):)"aca,[ n;nn[u:e(uiioi :,:"cmo(tai:ni*);xde*.f)([nprp]a=p*b)8( i;.):ta:i
#);(:)t:[xs( n0i io[l()u"i-i""a)+=nt))r(=r(ti 1rni)12 f=inilntuun:l; *-(]rx;s*()iir[=*"pbi*fdn*:*(pn
#ns0"-p0i n(utdue=:nri8t(t:m=)[t[x=rrrp(=+pp:,epsn"o(ou;ao"~*dx1))lit]i( ]a")"to]i"pnrrxratptpnieais
# iro[tfipti[;((t[(en)1rnrp"(i( o((ign:it=pu*(ta*)ie"~) t:)) :*t")i-1p tifpl"ni[=fi=:)irn, i8xricupt
#1*iii n:ner rp*)b]:)uit[1:i"ni) rntfn"i)"p =eint[)r=n;:nryp:8 t *ulsi-pl*i=;":enn-i[ptuait e[oltipn
#i()pa~ia)y"i:([(i]t i up9"ti:(ren:oia):aa)pte1(t n-u1*==px)"a"no)(rn(un]2iac-x ]opu("8cpit(ibpi"nr(
#un:n =ppt))peri;r a )t) i)c9")c"p"ei~aip,(:"r)(o))+nrin=tn::=-ie (-"ionfne tee)(*ni) ([pp(exit) [r)
#re"e"]-n )na)nnuil)i(x1a[(,nr)iceu (= -p8t f u"a:re;1]n*~d)2=i)(n( :)9m*))pnirn)u:i (anitii "tn:i[u
# :ri:ro=( i"n:p:~*inrn)uuu(px:ra:]:(8ne+t:trfi n -)i)* ir+nei1 as"=;i[=i()((::py:[:(]8pi"-p:tsr]t,c
#" pui*;r[xbi8ia)uan8o(*:ai"a"f(*d((1ii(pnp i):"s:p:i() :*tn*n[itnrii:] xf*9rc9ai)n"]"u*[nii](n1sn)(
#: aai1)i)yi ,in):)nun):(": )rieip p)r(r fi=pa-:p[te"*dptep)ni)i:(ini)rti,u t=auoba):ppn1tn" n[(* u"
#at(risibplnpp)*t(:9rtnr*]u:lt]=]ieu]):" [" dri)tpsxp+:]en0]buair;n;(sn:(prp(=p"uij;o[))  :et:ni;py9
#nn::p*[=i)(ta(ie:]]t i"dpip(in1 ]i[ts t)pni((-;nt i  t( t*(:)pop)i if0-bp="14](r("prrp;:];:())(fps*
#pputu)=n*efir.n]i[:)r ,pain:ip9 ty ui (x;i[fs p(non]i-f ):n;t]nnru"isoopeli(:[bt]i*]1( f umixt)1i[t
#iurp"9 )uui[er9;(ttiu(r)( i8fnt4n;poii tm1)nce:9) :)tn"n[ue*r"p-8i m=p9r 0u(nt)t)t)t9[e"*)i,ef"pf(*
# :p=r)[ (n[i[h)n]pe(txm )b:t(ut::ti m;::p(rt (*flinn :np-i)="p(p(i("]n(*tcmi;pn=c)t:ai1]idi"~8p:[:i
#(:=ifrc)pp)"mui()i  .nt1ri*;r(eui":i(t)i:[)"r[ri)i()f=""n(p*(:i;n(2(:n;4a"(h[pu" :o([(; 9 ut]ifpttb
#(((=:(p=ioo"(r"=ynn*[i]n unry tppa[a1:cinp;(t;tenpion=o(pp;o-tp:nt)nx(n a]:t:r1 y)(nst(nr*nalx)e:*m
#in:rpt".:fptp]n[t(""iif );d"""0 :a :t(is((e""*+"int:e)~ p8"[nab:pt:[aneirn]in,: 1i[uienb6(1m(utt()(
#t)p(ha=[ "t;p)*fn)imp e =  )i 9(*p(]*r"i2 :1u[[;;rn=t(  (ar"n1]:"i1nrvppppan[,][[a""*pn y )*tr) rni
#n) ipintbre, (r)ny;",reei[i:iyn n*](r(r1xit1()p)[) (  ([ ppn: t=iri ""]([s= nr:9rar)*i):toir );n: =
#p[p(ii,(tpi : na+()rmrnl:bi:)aurr[n ptnc :-f4-. *it)sf ]ip:iiou**(:insr:utxm()ni[piri) i)pn]inr()t:
#(pinuen (1)xnb(on" ))f"  impi*9;1xpa[oeni[]:p):*("(1n(i:it;:(0iionx[;i*ri=uuiinl t:a((xa+ip)0upi  (
#:]"u" [ (to[:i(frn-:pt)i([pe"so~*pr tmt"(tp[nd(*90if" pt"ipb:an:*u:=auehn8-:)8)~ti;it:ari((epr:i 8,
#:8[[a li:+9"n)"rt;xatp:(fiue)]in[ppioe:it(n)-a;=i=)fie (("t"n[n)]))*:p"s(i(1:nt*pn: ra(pino=(4-arii
#iiyt:(o;d  ]l:(tipe:itn"*peie1*",t"*np,n=2]niin:(fa(;ni]ii"n:p(o;ivi[x(.:=npco"*ns)"u(]iu)eip:i(iii
#i=atpni(aat.tietpit:p)frp9;piapinri*oi=]:(nt)1ta:i r1;iiyn u ifxnin]r=nntnnan-iii: sir)ppp)8iy((d()
#)rn:d ~x8(;)"np)f(:)rrfie * led[npiit*"x("nu:)i )~9iny":igtrtutit(p1:pp:n)()pp" 1l:=ai)o1(i+)ati:*:
#(nntuo"rnpirt (:c t;)"r;(9i;1"n*"(;t" x;:[ r")n(ai)o]+)t(in ut)):1i*nnr n=is)=":"rt) dori)t(ne=o)")
#i 9ou"  pi88[:pcrpndtlntocr]in":8n*i=:e;nipeiapaiocn"6fi *ef"pra*9."e( i))innt0a(n)atp":neinsi=ni):
#fnitae )[  xiooppui1ixtl][i"i.n,i:tir"r.uttxtau;:+:n=a)t=iu=aod "u1=i()nc:ur  iit~eptit:ne"(t-ani9u
#if:(u:pn(o];t3o[(-())t,p;(p]d=d]u[=deti(([:]ror:a"rpnff0:n(b)()i( :c,(;*;(ninii)ixit)d)"o frilxen)y
# prn1 fa1 "[(( noi1pn)n)unetn=r==fpaotp.i)uc0 i)ni)(=1]i=iyue1 op(;)bt"i))]8i(:i(;:a"t=)+(:r*d,uin=
#ine::e)p  p= s"e]( er"ris] :io;*=)ieiippno(upi(i)n)pi"p"]npi-u s]c*s: ma "":p,"n"))(a (tp]incf+i o)
#(srup(9]us" ti:"[=a;:f)eu9:uo ai+i((uipiii u:)tare"+ nr2)-nc2n:r(rupi))]ia(.(l"8) :::(=it();i::=ir)

```

Try it online!

A single slice. This is 99 lines, 100 printable character and 1 line break character each line.

# Answer
> 0 votes
# Symbolic Python, 10001 bytes

One slice, score is probably horrible, but maybe a bit more difficult to brute-force. The input is taken as a quoted command-line argument (like this).

```
_=''#___+_+;__=__[[(:_:=-%((__>_`___`_)_]_*=_+==`*_______*____-___;]'_'____*;;+_`-____+-__+__)-___*_*_'(+_*;-__'_-____+_*____'_-___*_-_____'**_____+___*__->++__=____<__)*___+)_-__%_*+-_>___,___)_________;+__-__=),_______*__*[__;___'+_+_______(___>-____+;+____]____<_*+_;`)_,_____*<____(_(+(*_;__;__[-__`-__*='_____['_,__;==)+*___+*=____*___,_____-_]______(___+__'/_,__+_'_`__>-+__;+____-___%*__=_[+__*__>_]*_%__(['__-+_%*____'___]_*[_*_+_*____*____;_*____[*`<+[__________<('____*_,__*=,,_______,_*_+_[,____<__'*==_[___(*-__________;;_____+_____)-_<__+_+*____[%_%_%__+_+**]___*____++___;++*-_;](_*__,___)()%____+_-__;_=__*__*`%;_+**=_=;*__']_[*____+_;____)]__-_=+_____;_________-__+__+'__,_+;*_'___=*];_)_-__%+__+*_''_++=*__]____+_,_;_+([__+_*+_*__(`_____[_____*_=,_[-___-+_-;(*______;[__*__'())___,;__,___`____;_']____'*__*_;__,(=_+___`_%___*]+*__*_**_*_%++____+_=___*,_++_=-___+`+____++__]__+__=____**_]%_%_*;_(_______=____-(%__+___%__*_(__%[-]_____=_*+**[__)___*_____*_;_____*____[_*__+[___/_*)__*=(__;___-____)_[]__%_*_*_*+____,'______*__'_'_(__`____%__(+;___,=-__`_-_(__[)_-_+_%_____')____'(__'-____+*'___*__*_;_=____*__+______*__+_**___=**___-_+;__>++[____;_`*_____,[_<___+_*_+_(___]`(+__`___`__(__%___+__]_____%_)______+_+_=*_%`-_____;+___,=__('____,___`=__,____*_____;____*_=*__`]*___+__+____,_=_)'=]__`___-_')=___[_____=_=____-_-]_______]-*_____%_____'**_*_-*________'_____*__;+_________[__*____;[_(_=]______)*_;__;_)=+;___+*<_-_+_______=_+_*____'*____+___-`__)]_,_;_`_+__;;(-___++*____%___;_____+=__'>__*,_____*;+_*____*__=______=_(______<+__,_)_*_,+_____*]_%___-__]__)_*___=-%_,__-______]%_-__*=___*_____'__-__-____=+_*_*_-_____*(__)_____;__*_+_-__+____=+_*_______,<_____[__]__+'*++__]_;*-*___=))+]__+_*;(__*__]______]____(**)+(%)][_*=___;_+-__(__(=_%*___'_++_______+__'),__(=__(_+___-___)__>__+_>(___+-______]_)_>%___+*%_(____)`*_;=+_=-_______(___=]____,*___[_____-__%_->_`_'[____(_(-)++__;=+;*(_;,___*)__%[_;___+_____*_*____%_____*____=_]_____'__]___-_____+_______*_=(_)[_*_%__]_-;*_**_______-%-+<__;-__-____)_`_-_+*_`_+=__;`______=*'_)_)____-)'_]_<_*________)___'-+-_______+___*;__+__[<*_+__=,_;____+==____[__+__=____,,__=_[-____*)=_+_______>]_)_-__________%_*____'_+_(;*___;__*____*__*`___*_'__-___[,+__;__*_______'____[___+<___-_%___%[__'__*__+__-________-___]___-________(*+/__+_''________][*)>_'_>__,_+%__+]_)-+=*<_*______*__;+_'__,_%%_/_)_(]+_%_;;____*__(_(-*_'___(____--__,-_,++___[_)____(__-*+_____+__*____`_=*____;_;<__;``__*+_`__*+_*_______,,;_';-_[_)____-________+]-*,__[](-*__'=+____(________+___*_'_<___,<)'`_[_________*,`=__*_-_*(__+`____%=__''**_[_'__%_[________;>+_(_[+_*____-_*_'_*+____+_(*%__*_____+_=+____+;__<+%,**(__)_,____-+%______'____++'__+_____*_*((___)____+______*_%_-__*_;<`__*____(*__,___>_____+____*__'____[*_%_**___)+_;_+__+_=_**_>_+_+__+___=______]_*__*%____)'__-_____+-__-%__,_**;_(+=_=___+__`_+_____**++___[_*___)_(____[___*;_[_'______*-*_(_____%_-+,_,_*_[__''_*___=__*__(______)_+%,*[=_'_-_'=(_%_=*'*____*___]+_=-_*(_*_];>__`_[__-___*___;++*_`_=__[__*___;[__>_*____,___=__+__=<_______+*+_=_++_,+_*_%_________,___,;_=*_-_-+____________-_[_+____)_*_,___<--_______'_;__(___=__;____*_-)____-_'_%___________)__=__________(_)________=+_[%__=___[_==_=_*]___*___,_[++__=_+=___*+______*___)_[_[_`___-____<_'(___+,_______=_+__%+-%_____++'_____,*<('-_[_(+))__[___]______%+*____;_,__+,_]___*__=%_%*_-(____>+=[_,*__,____-;--___++__=_-(><___++_;)*_*__++__-(=)___`__;______)_=_%*__**_[____=_+)________;*-_`'-*_+;%_-___+_*;___--]____]__=-____**%*_;__*_____)%______,_______+_*_**_,]__-_);________;__*_,_+____*_-(___;___%_+*_(%__*`-_%_*'_*[_____+*=___-__,;_-_*<_>__+_+__)[%_'+(___,=_=*%[_,___'__+__-*-[_____]______-_*_____''_________*_*(`____'_____-_=+(_____'____-(__'-_[____][[__,'-_;_____+______'___=_)%__=_;____*_*__=__(____]_-__+*_*_____++_*__'_]_)_;____=+=__+]*+*+__;,*__[,___+__*)__`+_*__,__]_-_________*(_%_*]__+_--+)%__'=_-_*'__'_______`_**______;<+_)*______-___*_*`_'__%+)_____(+____*_*__+____<%____+___<__+__]*)_+*-___]__;;(_`'___[__%*___=_______]*_'=__>%__*_*__=___[_'_+_,[[=-,_;_=+**___=_`+__;____________'<*_____,_*=__'___-__-___*__*_____-',_______=`__((+**__<+_(*<+(_'`__*__+_)+++___*+*_(_________+_____[____+;<_________*_%_]__<_>_,_+*_`__*_*[____(_*_([[__(_%__(+;__*___[_+;____(__]_)*=_<__]____*'=___,___*'_<__,__*]__=_*__)______)_____*__'(_'____`+___-*____+__*(_____,(>____]_____->__]___*`-____]_____'__]__*_((,+_________'_=___*==;-__`*+_%____=[___(_)]_(_*_%______(-_____[_*__;*____`____)_]__(_<%_;_]'_%=_`_*___-[''_*_]=_[%_;___++____+__+_+_+__**[-]**__[*,_+)_____-__-_]__-__*>__)___*=+*______*__*__+__+`__);_'_______;__*+___**_<__-____)+`_`%__(*__+_-,+__+*___<,_=___%_>*__='____]___*________++__+'_'__)_;_*_--+__+__[____=__)(_=_-'__+__]<-%__'<*=_*_'+____-+%]_=___++'_=(*______[+-___-__[____]___=+____[>_))=,__++_*_____=_*___%_)-_>__(_____*[_+_%%_____=+____<,='_)____(*__'*_*___[_*____+_=;+;__[-+=_-=_;__*))__)=_*+_*`___=__*___*___)[_____*____;_=_**%_-_>_=____;___________%__(/_]*_(__*___,____+;__,__==_;<________*_*___'_+_[___++,+__;+__%__]___*`%__+_______=-_(-_*____;__________(______+____=_;__]-_,(,_%__[__________=%_[_____()+-__+_++_+=+-__/=_*_______,____=___'__________[-__-[*_--**=_*____+__([*___=__=_+_-+*_+_-___-__+__=__*___]__*[_)_-+_____,___'`]___,___[__*)_,>=__-_______*__)<__=-_*%;__==+*_-_%____-_);_____'<___-___[__-_________[__'____=__+_'''__[__>=__+;__(________;_____-+_=_*____=*______;,]*,__*-_++*___]_____*'_*=__=_=__+%__`_,__+_*__*_____]_=[_+__[_>____>(_+_________]__)]_____*_%__`____-________*+___)>+__(+__-=_______>_____+_)_]_*__*(_*_____(___]_*+*___;_)*___]_____+_______*'__%___-__=%,____'+_[_=*________-___+__-____;(>____++_<_'__-__*_+(*);'__++_-__=_--__(_`_*_%-____*____*)___+___+;___%*__=*_',[_____=_;,>_*_;-_>=__[_=_)+__'_(,*_*]<________*_*_(,__-_;_-___(______)[(_)___'*>-_+_](____);__`+_*___*___;___=_=)%+__]_;_-___-____+_[+_;)___[____=_*___)_,>__*_]____+]__==__[_________'_=_**___(__+___;`__+()_____%__[*_=-_*___[+__*<,__-__'-____**+*_;__;+_____*]<__'__(++`____`_-_'______;;__*__[_______]____[(__`___+(_,_;[)'_);___;____)___)+_<_]<_+__'________*____________++_=____++_+__(___'=___________[*____-=___+_]_=**]_[________%_____;__=___%;____(__-___,_+____=_*%__>____,_;[_)>*'_%_(%____*__=;+___%*__(*___=_'(__'_____+)___*___+_;_-__+*>__*__+[__+_*,_)___=)]_)__%________(+_+*___*)+__;+)__*_';,*-)>]_)____]_*__*)(]*__+___>_,[_____===%_*_,____-_;_;*_=__])+__'%=**`______;>__+____+___;[_;_)__)__+*_____`_[__[________*____*_''___*=__=___=*__][_*>]_]_+___=__*___`___+_]_*___,_______'_____-`__%__*__*___;]_=+%__+___']_<'_=__])______]___(_%______'%____+__,_+____[__-___*;__,_*_______*[-__(_*_%_*[__=_+%[)+__+=]__*>`_____+-____;__*__,_+_-_*__*___)_`__*__+_=_=______[_]_+[=_+_*__'-_]_+)[+_'_____-____+_]_______'_____;__[`'__*=*_+_____<_*_+-_(_+_=_++`'________+,_____-__-=`'*+;_='_[___*____(+(,_______*-_)-_;*_*;=-(_=[%_=___=____`____`%___[_+*_(___->+_*_+___+__%%=______+)-)->___;-_<__`)=;___+(__(____*+___`>__')[_+_+%_'];_-____[;--___,=__=____+_;_=__,_____)_]+___(+=-+___=,*++*+____'_____=;*____>+_______<;_**_____,___*_'_'__+(_)_____+__(_=__;____*__*_-_]*___-___]___>]]__=_____%__+__=_______(__%+_______*__-,_+**___>**_*+__)__+=_++*____________(__)____%___+(_+_**_*___+;-;_(___'<_)*`__++,____;,*______=____[)_+__+**_*__+___]_+-_;___%(++___-___[___=_%_;__*_____-_<_-__(_+__-`,__+__]____-+___+_*_+_(%___*'___*_[(++*+__;;*_____+;'____[*__==__+_*'___-_*_+_=*____*)<___[**___+__<__,+-[__*(__]_=_;__;____['___+__;'*-__-)___)_-(-+_+=_*____+______=[__*_'(+=______,+*_)____[_-_]___`_**+(]___`__%__+__+____+__)____[*______[)__;*-_+_<__'___=_=___*____[_)___+,=(___+%__+*__>______%____''_<+_;______-_`]__+[_]_[+(=__%*_____,,*________*__-_=-<-____,(__%;_______]_*+__-__[________-*_=____[]_*__+_+__;;____+++__,_,''__]-___-__]=_<__;_____)%+____-_(_)[_*_+_____,_,_______*_-+____(_______`_*_____==-_(__*__);*____-+_,_=+_________'____]%__-<+=_[____)_________=___'=_________+___;[__>_;_-_+=%___=,__`__*]+___=*________/;)+=___*__(>___+__-)__=_____`*-+__-__*(__[__-<__,__)_]+%_)_+__;_);_+_(_[___,__=*%_=_-___*_____=__=](_=_=____)_+_%+_-_+____[_+_+__(________=__`___'___+=_=______+<;+_+__+_+___'+'_,_;____=__-_+_'_*__++_____*/___%*)__[*_-__)+____'___[_____=___[<*=______-_)___*/=______*_____*_`_*__-`'-[`____'_+______________-____+__%_-+__;__*________-__%,(_______%______,_______(_=___[__+`;*__=_+,';_______+_____'_(]_+))___`_'*________**_;____;_*'________'__=*_______;____(_-)__>_____)_[_(+`*__'__*___**+______+;__;_%_____=__=_]_;_'+/__[______;;)_-<______-___=_;-(*_*[+'_'___[=___%,)*__,____%___*_]''>'_'%_______+__+_;'________',+___*__+**_______-__===______'_____+__'_=_*[____*_%__(__[___*,__,-___(,+__>+__`_`__-]-`__;_=____'[*______+'___]*_*__*___<'[<___'_<_)__+(__*_*_,+;*_*__+(__-_*+___%_=%]____+__*__*__>_)_)=+_(____%__;+;,;_____+]__,_[);*____=_*+_____`___-==*'_>_]'-_<_]=_______'*_+______+__-_=__'_____`_+__)*-_+*_'_,[_+__=__(____**_;__''______`___`_*-_%_________-_++___'__%)+___(]___%__=__=+_____)*-__*[___+_-=_%]____;_____*__>*__**[(_*___+_[;_[_(__'_`____+___;-___**__+)_+*_'`*_=__+<_'___**_=*___=__'+;*;;____**<*____)_______+_+________-__+_____-_+________]_)_*___________+_;_*%_;=*,[__________,____=_<[-___*_____,'__-__*_+_-_'_*_-+_[_--+_+=_[((_+___+_;__;_<+__(=_;+_+____;_<_*__*+_+_;_,_____(_[_*_+____,(_;__-`___;___*_;_'___+=____,_______=_;*'%_[*+__,______'%)=;___*+___;]__[_+_____=_=*_;_+___%'[____-_*_-____<*____[=______*%__,)__>_'___,<____+__>__(__***,__,`__**___+)'+__=__;])__,____%*____%___[__+*______*_'=__]_[;_(;_____*]_%==__%____%,______%`___)_)_*_`*%__'__)_)+_*_-__-_]____+_(__=_______-,______=(*+[_,___-___(_>______*%*=___+_'__[___*_,_*____*___%____,___,_________<_]__%___(,_'<_________+_+_*[=__+-__+;__'*[+])'_____*_*+_;+(___+___+_+___*_=__,__-_=-%_(%_'=_______*____*_)_=_]__*_++]*__'-_)________=[___+__+=%*[__+*++__'__*_______,_+(___+_*__)_*____=_*]'_______+<_*_+__*-__-*__;]_'__<____`,_____%*'_;_=)________;___-____`*_____)*==___-__-_='___<____*__+'____=_=_[___%_)______=____________=__<____(_+*+`___*_(__]____]_%`'[_-[_______''__*______*___[*_-__________>__-=)_;___'___=____',_`___*_*+__,_%[____%____+__*_%____+_)*__'____;*-__*_(_=*+,_=*/+___

```

Try it online!

# Answer
> 0 votes
# Python 3, 235 bytes, 1 slice

```
#xn=t'(esvtarl('s.turp(pienrp(u)t.(l)o[w:e:r-(1)].[t:i:t-l1e]([):.:l-o1w]e[r:(]));)e)v#axl=('xe)v(a'lx'#.'u*p7p0e-r0(+)0.-l2o+w2e-r4(-)4.+t8i)t;lper(i)n.tl(oswterr((s)t;re(vianlp(uxt)(()'[x:#:'-*17]0[-:0:+-01-]2[+:2:--41-]4[+:8]));)p)r

```

Try it online!

# Answer
> 0 votes
# Python 3, 1121 bytes

```
c#5c#cl#7a#cs#5s#s #9P#5r#si# n#it#te#8r#r:#2
#e #a #8 #2 #s@#ss#tt#1a# t#1i# c#7m#ie#5t#2h#oo#5d#2
#h #i #  #5 #3d#te#3f#1 #oa#s(#fb#8l#2a#rh#6)#1:#2
#2 #l #7 #2 #2 #l #a #4 #tr# e#7t#3u#3r#4n#  #:b#bl# a# h#9[# :#3:#4-#61#1]#2
#r
#
#9c# l#
a#1s# s#s #lI#7n#ip#du#et#3H#8a#8n# d#8l#7e# r#::#n
#  #b #1 #7 #8@#rs# t#1a#5t#9i#5c#7m#@e#rt#ch# o#cd#6
#n #1 #o #a # d# e#5f#t #la#o(#ea#8,#  #6b#8,#c # c#4,#8 #ad# )#c:#5
#4 #5 #8 #1 #3 #3 #e #  #ct# r# y#d:#1
#7 #a #4 #5 #6 #8 #7 #: #  #8 #e #3 #1a#
+#ub# +#cc#r+#
d#4[#71#5:#a4#6:#s2#
]#5 #t #5##d #11#a-#:1#1-#41#8-#71#t-#81#6-#61#
-#e1#a-#41#1-#51#3
#e #: #3 #  #t #I #8 #4 #se#3x# c# e#3p#et#1:#m
#7 #2 #, #t #9 #  #  #1 #b #: #- #5 #4p#,a# s#4s#8
#t #5 #5 #3 #2 #9 #4 #1 #,r#te#5t#4u# r#rn#: #-i#:n#ap#[u#:t#3(#6)#
#  #s #) #8 #7 #3 #: #+ #:
#9
#np#1r#7i# n#7t#l(#6P# r#3i#Pn#2t#te#:r#2.#8a#2(#)O# n#lp#7u#7t#8H#4a#8n#7d#sl# e#rr#t.#4a#1(#2N#io#9n#2e#2,#  #:N#1o#5n#8e#5,#5 #5N#6o#2n# e#t,#f #5N#-o#on#8e#5)#+)# )#5 #  #)##7 #ra#2r#,g#3h#a #1t#2y#5p#7o#h
#(e#1x#3e#7c#4(#8"#5p# r#5i# n#2t#8.#3_#8_#ic#6a#el#9l#9_# _#9(#3i#cn#rp#ru#4t#9(#()#p[#7:# :# -#e1#o]#5)#n"#5)

```

Try it online!

I hope this is hard. One slice.

---
Tags: cops-and-robbers
---


title: Retaining Water

text:
# Question
Title: Retaining Water
Your task is to check the volume of water in a pool. Your have to create a program that takes in a input that is represented by an `10 by 10` grid of integers, with heights ranging from `A=1` to `Z=26` from the latin alphabet. Find the volume of water each pool can hold.

You have to output the volume of water that the pool can hold. Outside the pool the height is 0, so no water is held on the cells at the edge of the pool. The water does not leak diagonally.

# Test cases

```
ZZZZZZZZZZ
ZAAAAAAAAZ
ZAAAAAAAAZ
ZAAAAAAAAZ
ZAAAAAAAAZ
ZAAAAAAAAZ
ZAAAAAAAAZ
ZAAAAAAAAZ
ZAAAAAAAAZ
ZZZZZZZZZZ
    OR
[[26, 26, 26, 26, 26, 26, 26, 26, 26, 26], [26, 1, 1, 1, 1, 1, 1, 1, 1, 26], [26, 1, 1, 1, 1, 1, 1, 1, 1, 26], [26, 1, 1, 1, 1, 1, 1, 1, 1, 26], [26, 1, 1, 1, 1, 1, 1, 1, 1, 26], [26, 1, 1, 1, 1, 1, 1, 1, 1, 26], [26, 1, 1, 1, 1, 1, 1, 1, 1, 26], [26, 1, 1, 1, 1, 1, 1, 1, 1, 26], [26, 1, 1, 1, 1, 1, 1, 1, 1, 26], [26, 26, 26, 26, 26, 26, 26, 26, 26, 26]]
->
1600

ZZZZZZZZZZ
ZRRRRRRRRZ
ZRRRRRRRRZ
ZRRRRRRRRZ
ZFFFFFFFFZ
ZDDDDDDDDZ
ZDDDDDDDDZ
ZDDDDDDDDZ
ZDDDDDDDDZ
ZZZZZZZZZZ
    OR
[[26, 26, 26, 26, 26, 26, 26, 26, 26, 26], [26, 18, 18, 18, 18, 18, 18, 18, 18, 26], [26, 18, 18, 18, 18, 18, 18, 18, 18, 26], [26, 18, 18, 18, 18, 18, 18, 18, 18, 26], [26, 6, 6, 6, 6, 6, 6, 6, 6, 26], [26, 4, 4, 4, 4, 4, 4, 4, 4, 26], [26, 4, 4, 4, 4, 4, 4, 4, 4, 26], [26, 4, 4, 4, 4, 4, 4, 4, 4, 26], [26, 4, 4, 4, 4, 4, 4, 4, 4, 26], [26, 26, 26, 26, 26, 26, 26, 26, 26, 26]]
->
1056

XXXXXXXXXX
XSSSSRAAAX
XSSSSRAAAX
XSSSSRAAAX
XXXXXCXXXX
XSSSSCBBBX
XSSSSCBBBX
RSSSSCBBBX
XSSSSCBBBX
XXXXXXXXXX
    OR
[[24, 24, 24, 24, 24, 24, 24, 24, 24, 24], [24, 19, 19, 19, 19, 18, 1, 1, 1, 24], [24, 19, 19, 19, 19, 18, 1, 1, 1, 24], [24, 19, 19, 19, 19, 18, 1, 1, 1, 24], [24, 24, 24, 24, 24, 3, 24, 24, 24, 24], [24, 19, 19, 19, 19, 3, 2, 2, 2, 24], [24, 19, 19, 19, 19, 3, 2, 2, 2, 24], [18, 19, 19, 19, 19, 3, 2, 2, 2, 24], [24, 19, 19, 19, 19, 3, 2, 2, 2, 24], [24, 24, 24, 24, 24, 24, 24, 24, 24, 24]]
->
449

ZZZZZZZZZZ
RAAAAZEEEZ
RAAAAZEEEZ
RAAAAZEEEZ
RAAAAZEEEZ
RAAAAAEEEZ
RAAAAZEEEZ
RAAAAZEEEZ
QAAAAZEEEZ
ZZZZZZZZZZ
    OR
[[26, 26, 26, 26, 26, 26, 26, 26, 26, 26], [18, 1, 1, 1, 1, 26, 5, 5, 5, 26], [18, 1, 1, 1, 1, 26, 5, 5, 5, 26], [18, 1, 1, 1, 1, 26, 5, 5, 5, 26], [18, 1, 1, 1, 1, 26, 5, 5, 5, 26], [18, 1, 1, 1, 1, 1, 5, 5, 5, 26], [18, 1, 1, 1, 1, 26, 5, 5, 5, 26], [18, 1, 1, 1, 1, 26, 5, 5, 5, 26], [17, 1, 1, 1, 1, 26, 5, 5, 5, 26], [26, 26, 26, 26, 26, 26, 26, 26, 26, 26]]
->
816

```

> The input is in the form of a 2D list of integers. The one with letters is just a reference (You can input it as letters if you want to)

## Worked Example:

For the 1st test case: There is only 1 box and that is 10 lines of `26` or `A`'s, and since this a pool, the `A`, represents the bottom of the pool, and the `Z` is the top, so `26-1=25` is the depth of the entire pool. Take `25*8*8=1600`, as the `Z` is the wall so only a `8*8` area is occupied.

Test Case 3 has a `R` in the outer row of `X`, so do take note the water level cannot go past this

Test Case 4:

The lowest wall is `Q`, so we take `17-1=16` as the highest water level for maximum height of `A=1`. We take `16*4*8=512`, next there is a `Z` wall, BUT there is an `A` breaking through the wall, which is connecting all the `E` to the wall of height `16`, so the max height of the water level of `E` is `17-5=12`, and take `12*3*8=288`. Finally, we take `512+12+288=816`(12 comes from the extra `A` inside the `Z` wall)

## Tips:

Think of this challenge as water held in many different boxes inside a large box

## Others:

* You may assume that all inputs are from the alphabet and that they are all uppercase
* You may assume that the outer row of alphabets do not always have the highest height, and can all have different heights
* The outer row MUST have a higher level than the 2nd outermost row due to the rule of no overflowing
* Water level cannot be higher than the highest "wall"

## Scoring

This is code-golf, so shortest code wins!

Credits to the codingame community for this puzzle! Puzzle link

# Answer
> 1 votes
# Charcoal, 108 bytes

```
⊞υＥ⁺Aθ⁰ＷＳ⊞υＥ⁺Aι⌕ακ≔ＥυＥιφθ≔⟦Ｅ³¦⁰⟧ηＦη«≔⊟ιδ≔⊟ιε≔⌈⟦⊟ι§§υδε⟧ζ¿‹ζ§§θδε«§≔§θδεζＦ²Ｆ²⊞ηＥ⟦ζεδ⟧⁺μ∧⁼κ⊖ν⊖⊗λ»»Ｉ⁻ΣＥθΣιΣＥυΣι

```

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

```
⊞υＥ⁺Aθ⁰ＷＳ⊞υＥ⁺Aι⌕ακ

```

Read in the pool, but add a border of zero depth.

```
≔ＥυＥιφθ

```

Try to fill the pool to a height of `1000`.

```
≔⟦Ｅ³¦⁰⟧ηＦη«

```

Begin a breadth-first search of the pool starting at the top left corner.

```
≔⊟ιδ≔⊟ιε

```

Get the next co-ordinates to check.

```
≔⌈⟦⊟ι§§υδε⟧ζ

```

Get the height of the neighbouring water level that triggered this search, but limit it to the height of the cell.

```
¿‹ζ§§θδε«

```

If this is less than the current height of the water, then:

```
§≔§θδεζ

```

Update the water height.

```
Ｆ²Ｆ²

```

Loop over the neighbouring cells.

```
⊞ηＥ⟦ζεδ⟧⁺μ∧⁼κ⊖ν⊖⊗λ

```

Add them to the search list of cells to check.

```
»»Ｉ⁻ΣＥθΣιΣＥυΣι

```

Subtract the heights of cells from the heights of the water and output the total.

# Answer
> 6 votes
# Python 3, 230 bytes

*-1 from 12944qwerty*

```
R=range;S=(1,0,-1,0)
def m(A,r=0):
 for l in R(2,27):
  K={(i,j)for i in R(10)for j in R(10)if A[i][j]<l};B={s for s in K if set(s)&{0,9}}
  for _ in R(64):B|=K&{(i+S[k],j+S[k-1])for(i,j)in B for k in R(4)}
  r+=len(K-B)
 return r

```

Try it online! Input is a list of lists of numbers from 1 to 26 inclusive.

For each possible water level from B (2) to Z (26) this function first fills the pool to that height, then drains off any water touching the edge. `K` is the set of tentatively filled cells and `B` that of "**b**urned" cells (since it implements a flood fill).

# Answer
> 3 votes
# JavaScript (Node.js), ~~144~~ 143 bytes

need extra stack

```
f=(x,t=[...f+f].map((_,i)=>~i%16&&26),z=0)=>t.some((v,i)=>[1,-1,16,-16].some(d=>v>~~t[i+d],p=(x[i>>4]||0)[i%16]|0,z+=v-p)&v>p&&t[i]--)?f(x,t):z

```

Try it online!

# JavaScript (Node.js), 150 bytes

```
f=(x,t=[...f+f].map((_,i)=>~i%16&&26),u,z=0,r=t.map((v,i)=>[1,-1,16,-16].some(d=>v>~~t[i+d],p=(x[i>>4]||0)[i%16]|0,z+=v-p)&v>p?u=[v-1]:v))=>u?f(x,r):z

```

Try it online!

`t[16*y+x]` stores water level

# Answer
> 2 votes
# Python3, 259 bytes

```
import numpy as np
r=range
l=np.array([[ord(j)-65for j in input()]for i in r(10)])
p=l.copy()
p[1:-1,1:-1]=25
for _ in r(11):
 for i in r(1,9):
  for j in r(1,9):p[i][j]=max(min([p[i+a][j+b]for a,b in[(-1,0),(0,1),(0,-1),(1,0)]]),l[i][j])
print(sum(sum(p-l)))

```

Try it online!

# Answer
> 1 votes
# MATLAB, 267 bytes

```
function d=p(A)
d=0;I=true(10);I(2:9,2:9)=0;for i=2:26
B=int8(A>=i);while any(~B(~I))
[j,k]=find(B==0,1);f(j,k);end
if any(B(I)==2)break
end
d=d+sum(sum(B==2));end
function f(x,y)
if (x<11&y<11&x>0&y>0)&~B(x,y)
B(x,y)=2;f(x-1,y);f(x+1,y);f(x,y+1);f(x,y-1);end
end
end

```

tried using the flood-fill algorithm to determine what squares on each layer should be filled. If the flood-fill ever reaches the outer edge, that's where the summation stops. I had a much shorter version, but it failed on test case 3 because the lowest outer wall is technically blocked off entirely, raising the effective maximum water level.

Try it online!

# Answer
> 1 votes
# C (gcc), ~~224~~ ~~214~~ ~~213~~ 212 bytes

-10 bytes by using ternaries (thanks @ceilingcat) and simplifying parameter declaration

-1 bytes by using `for` instead of `do while` (thanks @ceilingcat)

-1 bytes by initialising `L` and `m` together (thanks @ceilingcat)

```
#define F for(m=0,j=10;j--;)for(i=10;i--;)
#define L l[j+1][i+1]
#define C(y,x)m=L>h[j][i]&L>l[y+j][x+i]?--L:m;
f(int**h){int m,j,i,l[12][12]={};F L=m=26;for(;m;)F{C(,1)C(1,)C(1,2)C(2,1)}F m+=L-h[j][i];return m;}

```

Try it online!

Reduce the water level of each box that has water and its level is above one of its neighbours. Repeat until there are no changes to the water level.

---
Tags: code-golf, string, array, grid
---


title: Slice the source code (Robbers)

text:
# Question
Title: Slice the source code (Robbers)
Cops thread

# Robbers

Robbers, your job is to find the slices of the corresponding cop's code.

## Scoring

The robber with the most cracks wins.

## Example

Take this code: `iimmppoorrtt ssyymmppyy;;pprriinntt((ssyymmppyy..iisspprriimmee((iinnppuutt(())))))`

The slice here is \[::2\], so the robber's post could look like this:

Cracked <somebody>'s answer
```iimmppoorrtt  ssyymmppyy;;pprriinntt((ssyymmppyy..iisspprriimmee((iinnppuutt(())))))```
The slice is [::2].

# Answer
# Python 3, cracks Sisyphus's answer

```
input((input()[(-1)::1-1-1]))

```

Try it online!

Given by the slice `c[-2158:-4855:-93]`

I was initially surprised to find that there were no characters besides those used for `input()[::-1]`. The `input()` is a dead giveaway though and a brute force search reduced the input to a handful of possibilities. I then just looked at them individually until I found the correct code.
> 4 votes

# Answer
# Python 3, 181 bytes

OP

```
if   True:  print =eval ('  exit')# not  open   u
exit or  ( eval)('14')
# NO

open  or 15* id(  int( int(int (int( id(  print( print([111][:123][:55555-11111111111]))))))))#11;

```

The slice is simply `program[::6]`, giving us:

```
irp=(input())
print(irp[::-1]);

```

Try it online!
> 3 votes

# Answer
-3::-14

# Python 3, 56 bytes

```
import sys as s
s.stdout.write(s.stdin.readline()[::-1])

```

Try it online!

I admit that I used tools
> 3 votes

# Answer
# Vyxal, cracks emanresuA's answer

```
ż⇩İ

```

Generated from a slice of `[1:15:6]`
> 2 votes

# Answer
# Vyxal, cracks EmanresuA's second answer

```
ɖ‡$"t¤+f

```

Given by the slice `[11:33:3]`
> 2 votes

# Answer
# Python 3, cracks AnttiP's answer

`[53:586:4]` results in:

```
def g(o):exec("".join(map(chr,map(sum,zip(map(ord,"ikbgm!bginm!\"T33&*V\""),99*[o])))))
x=0
class f:
 def __del__(self):g(x)
y,x=f(),7

```

Try it online!

`g` increases each codepoint in `"ikbgm!bginm!\"T33&*V\""` by its argument and then executes the resulting string as code. For `o=7` this executes `print(input()[::-1])`.

When the program is done running the garbage collector deletes `y`, calling `g(x)` in the process.
> 2 votes

# Answer
# Vyxal, 3 bytes, cracks Aaroneous Miller's answer

```
wRh

```

Obtained from a slice of `[13::-5]`. Ngl you should have used that one quirk that only you know about because I know quite a few vyxal quirks too.
> 1 votes

# Answer
# brainfuck, Actually cracks l4m2

```
,[>><,]<[.<]

```

Try it online!

The slice is `c[1::3]`. And yes, I literally just bruteforce copy-pasted different slices to TIO, until I found a solution.
> 1 votes

# Answer
# Python 3, 72 bytes, cracks ths's answer

```
i=input();a=len(i);exec("for n in(i*8**9) [1:]:i=(i*a) [::~a]");print(i)

```

Try it online!

Slice used: `code[4981:-201:67]`

If you want to see the code finish ~~within your lifetime~~ a bit faster, change the `8**9` to `2` or any other positive even number.
> 1 votes

# Answer
# Python 3, 43 bytes, cracks Bgil Midol's second answer (original version)

```
print(str(str(input()[::-1][::-1][::-1])))

```

Try it online!

Slice is s\[40:-10:2\]

Fastest crack in the west?
> 0 votes

# Answer
# Python 3.8 (pre-release), 45 bytes, Cracks Big Midol's second answer (new revision)

```
print(str(str(input()[::-1][::-1][::-1][:])))

```

Try it online!

Slice is `code[145::2]`
> 0 votes

# Answer
# Python, cracks Bgil Midol's third cop

```
[1011::3]

```

Try it online!

The result of this slice is:

```
exec("print.__call__(input()[::-1])")

```
> 0 votes

---
Tags: cops-and-robbers
---