title: Tower of strings

text:
# Question
Title: Tower of strings
Given a string of text, output it as a 'tower'.

Each slice of the string (of the form `0:n`) is repeated `5*n` times, so the first character is repeated 5 times, then the first and the second 10 times, etc.

### Examples:

```
'hello' ->

['h']
['h']
['h']
['h']
['h']
['h', 'e']
['h', 'e']
['h', 'e']
['h', 'e']
['h', 'e']
['h', 'e']
['h', 'e']
['h', 'e']
['h', 'e']
['h', 'e']
['h', 'e', 'l']
['h', 'e', 'l']
['h', 'e', 'l']
['h', 'e', 'l']
['h', 'e', 'l']
['h', 'e', 'l']
['h', 'e', 'l']
['h', 'e', 'l']
['h', 'e', 'l']
['h', 'e', 'l']
['h', 'e', 'l']
['h', 'e', 'l']
['h', 'e', 'l']
['h', 'e', 'l']
['h', 'e', 'l']
['h', 'e', 'l', 'l']
['h', 'e', 'l', 'l']
['h', 'e', 'l', 'l']
['h', 'e', 'l', 'l']
['h', 'e', 'l', 'l']
['h', 'e', 'l', 'l']
['h', 'e', 'l', 'l']
['h', 'e', 'l', 'l']
['h', 'e', 'l', 'l']
['h', 'e', 'l', 'l']
['h', 'e', 'l', 'l']
['h', 'e', 'l', 'l']
['h', 'e', 'l', 'l']
['h', 'e', 'l', 'l']
['h', 'e', 'l', 'l']
['h', 'e', 'l', 'l']
['h', 'e', 'l', 'l']
['h', 'e', 'l', 'l']
['h', 'e', 'l', 'l']
['h', 'e', 'l', 'l']
['h', 'e', 'l', 'l', 'o']
['h', 'e', 'l', 'l', 'o']
['h', 'e', 'l', 'l', 'o']
['h', 'e', 'l', 'l', 'o']
['h', 'e', 'l', 'l', 'o']
['h', 'e', 'l', 'l', 'o']
['h', 'e', 'l', 'l', 'o']
['h', 'e', 'l', 'l', 'o']
['h', 'e', 'l', 'l', 'o']
['h', 'e', 'l', 'l', 'o']
['h', 'e', 'l', 'l', 'o']
['h', 'e', 'l', 'l', 'o']
['h', 'e', 'l', 'l', 'o']
['h', 'e', 'l', 'l', 'o']
['h', 'e', 'l', 'l', 'o']
['h', 'e', 'l', 'l', 'o']
['h', 'e', 'l', 'l', 'o']
['h', 'e', 'l', 'l', 'o']
['h', 'e', 'l', 'l', 'o']
['h', 'e', 'l', 'l', 'o']
['h', 'e', 'l', 'l', 'o']
['h', 'e', 'l', 'l', 'o']
['h', 'e', 'l', 'l', 'o']
['h', 'e', 'l', 'l', 'o']
['h', 'e', 'l', 'l', 'o']

'cat' ->

['c']
['c']
['c']
['c']
['c']
['c', 'a']
['c', 'a']
['c', 'a']
['c', 'a']
['c', 'a']
['c', 'a']
['c', 'a']
['c', 'a']
['c', 'a']
['c', 'a']
['c', 'a', 't']
['c', 'a', 't']
['c', 'a', 't']
['c', 'a', 't']
['c', 'a', 't']
['c', 'a', 't']
['c', 'a', 't']
['c', 'a', 't']
['c', 'a', 't']
['c', 'a', 't']
['c', 'a', 't']
['c', 'a', 't']
['c', 'a', 't']
['c', 'a', 't']
['c', 'a', 't']

```

### Rules:

You can output each layer as a list of characters or just a string of them joined together.

# Answer
> 12 votes
# , 48 bytes

```
function(s)substring(s,1,rep(x<-1:nchar(s),x*5))

```

Try it online!

Returns a list of strings.

# Answer
> 9 votes
# 05AB1E, 6 bytes

```
ηā5*ÅΓ

```

Try it online!

Returns a list of string.

**Explanation**

```
     ÅΓ # Run-length decode...
η       # ... the prefixes of the input
 ā5*и   # ... with the length range multiplied by 5 -- [5, 10, 15, 20, 25]

```

# Answer
> 7 votes
# Haskell, 36 bytes

```
f""=[]
f s=f(init s)++(s<$s<*[1..5])

```

Try it online!

# Answer
> 6 votes
# Canvas, 6 bytes

```
［³５×＊Ｐ

```

Try it here!

Explanation:

```
[      for each prefix
 ³5×     1-indexed counter * 5
    *    repeat the prefix vertically that many times
     P   and print that

```

# Answer
> 6 votes
# Stax, 8 bytes

```
äï▄;♫├W^

```

Run and debug it

Unpacked, ungolfed, and commented, it looks like this.

```
|[F for each prefix of the input
  i^5*  5*(i+1) where i is the iteration index
  DQ    that many times, peek and print to output

```

Run this one

# Answer
> 6 votes
# TI-Basic (TI-84 Plus CE), 29 bytes (27 tokens)

```
For(A,1,length(Ans
For(B,1,5A
Disp sub(Ans,1,A
End
End

```

Explanation:

```
For(A,1,length(Ans # 9 bytes, 8 tokens: for A from 1 to the length of the string
For(B,1,5A         # 8 bytes, 8 tokens:  5*A times
Disp sub(Ans,1,A   # 9 bytes, 8 tokens:   Print the first A characters of the string
End                # 2 bytes, 2 tokens:  end loop
End                # 1 byte,  1 token:  end loop

```

# Answer
> 6 votes
# Retina, 15 bytes

```
.
$.>`*5*$($>`¶

```

Try it online! Link includes test cases. Explanation:

```
.

```

Match each character in the string.

```
$.>`*5*$($>`¶

```

`$`` is the prefix of the match. Retina then provides two modifiers, `>` modifies it to be in the context of the string between successive matches, while `.` takes the length. We therefore start with the prefix of the suffix, which is equivalent to the match including its prefix. This saves 2 bytes over using overlapping matches. The `$(` then concatenates that with a newline, the `5*` repeats it, and then the `$.>`` repeats it a further number of times given by its length.

# Answer
> 6 votes
# Brachylog, 15 bytes

```
a₀ᶠ⟨gj₎{l×₅}⟩ᵐc

```

Try it online!

The final `c` can be removed if OP replies positively to the question about outputting 2D arrays.

# Answer
> 6 votes
# Cubix,  ~~44~~  40 bytes

```
i.!?@UBqwW_#/>u...;B^...?qo;;q*n5;oN/./)

```

Try it online!

This still has a lot of no-ops, but it is a little better than before.

As a very brief description, a character is grabbed from input and tested for EOI (-1), halt if it is. The stack is then reversed. Get the number of items on the stack and multiple by -5. Drop that to the bottom of the stack and clean up. Loop through the stack, printing, until a negative number. Print newline, increment the number, if 0 drop the zero, reverse stack and start from input again, otherwise loop through the stack, printing, until a negative number ... ad nauseum

Cubified it looks like

```
      i . !
      ? @ U
      B q w
W _ # / > u . . . ; B ^
. . . ? q o ; ; q * n 5
; o N / . / ) . . . . .
      . . .
      . . .
      . . .

```

Watch it online

# Answer
> 5 votes
# Jelly, 8 bytes

```
¹Ƥx'J×5Ɗ

```

Try it online!

```
J×5x'@¹Ƥ

```

Try it online!

```
¹Ƥx'Jx'5

```

Try it online!

This is likely golfable.

# Answer
> 5 votes
# JavaScript, 48 46 bytes

(thanks @redundancy)

Edit: The author clarified and this answer is now not valid, but I will leave it here unchanged.

Returns an array of multi-line strings.

```
s=>[...s].map(c=>(q+=c).repeat(5*++i),i=q=`
`)

```

# Try it

```
f = s=>[...s].map(c=>(q+=c).repeat(5*++i),i=q=`
`);

console.log( f("hello").join`` );
```

# Potential strategy:

It didn't help me much, but maybe someone can use this:

The number of characters at (0-indexed) line `i` is `floor(sqrt(2/5*i+1/4)+1/2)`, which is golfed in JavaScript as `(.4*i+.25)**.5+.5|0`.

For a string of length `n`, there are `n*(n+1)*5/2` lines.

Perhaps: `s=>{for(i=0;(n=(.4*i+++.25)**.5+.5|0)<=s.length;)console.log(s.slice(0,n))}`

# Answer
> 4 votes
# Python 3, ~~43~~ 41 bytes

Thanks to *ovs* for saving 2 bytes!

### Code

```
f=lambda x:[*x]and f(x[:-1])+[x]*5*len(x)

```

Try it online!

# Answer
> 3 votes
## Haskell, ~~46~~ ~~43~~ 42 bytes

```
f s=do n<-[1..length s];take n s<$[1..n*5]

```

Try it online!

Sadly `inits` requires `import Data.List`, so

```
import Data.List
((<$)<*>(>>[1..5])=<<).inits

```

with its 45 bytes is longer.

Edit: -1 byte thanks to @BWO.

# Answer
> 3 votes
# Charcoal, 11 bytes

```
Ｆ⊕ＬθＥ×⁵ι…θι

```

Try it online! Link is to verbose version of code. Output includes 0 repetitions of the zero-length substring. Explanation:

```
   θ          Input string
  Ｌ           Length
 ⊕            Incremented
Ｆ             Loop over implicit range
      ⁵       Literal 5
       ι      Current index
     ×        Multiply
    Ｅ         Map over implicit range
         θ    Input string
          ι   Current index
        …     Chop to length
              Implicitly print each string on its own line

```

# Answer
> 3 votes
# Husk, 8 bytes

```
ΣzoR*5Nḣ

```

Try it online!

### Explanation

```
Σz(R*5)Nḣ  -- example input: "ab"
        ḣ  -- non-empty prefixes: ["a","ab"]
 z(   )N   -- zip with [1..]
    *5     -- | multiply by 5
   R       -- | replicate
           -- : [["a","a","a","a","a"],["ab","ab","ab","ab","ab","ab","ab","ab","ab","ab"]]
Σ          -- concat: ["a","a","a","a","a","ab","ab","ab","ab","ab","ab","ab","ab","ab","ab"]

```

# Answer
> 3 votes
# C (gcc), 67 bytes

```
i,j;f(char*s){for(i=0;s[i++];)for(j=5*i;j--;)printf("%.*s\n",i,s);}

```

Try it online!

# Answer
> 3 votes
# Ruby, ~~46~~ 42 bytes

```
->s{(1..s.size).map{|i|puts [s[0,i]]*i*5}}

```

Try it online!

# Answer
> 3 votes
# PowerShell, ~~40~~ ~~20~~ 25 bytes

Score cut in half thanks to mazzy
+5 bytes thanks to AdmBorkBork pointing out the specs

```
$args|%{,($s+=$_)*5*++$i}

```

Try it online!

Takes input via splatting. Works by building the string by adding the next character to itself, converts it to a one element array, and then repeats it `5*i` times.

# Answer
> 2 votes
# MATL, 12 bytes

```
f"G@:)@5*1X"

```

Try it online!

```
f               % Get the indices of input i.e. range 1 to length(input)
 "              % For loop over that
   G            % Push input string
    @           % Push current loop index
     :          % Range 1 to that
      )         % Index at those positions (substring 1 to i)
       @5*      % Multiply loop index by 5
          1X"   % Repeat the substring that many times rowwise
                % Results collect on the stack and are
                %  implicitly output at the end

```

# Answer
> 2 votes
# , 17 bytes

```
òïç$îî/6Ä
Hl$xòxú

```

Expects inputs without newlines, and outputs with superfluous leading newlines.

I can remove this entry if input/output violates the challenge spec.

Try it online!

### 21 bytes

```
òïç$îî/6Ä
Hl$xòxíîî/ò

```

Expects inputs without newlines, but outputs with only one leading and trailing newline.

## Explanation

Differing substrings are separated with two consecutive newlines so that linewise duplication only applies to lines matching the regex `$\n\n`.

When the duplication command (`Ä`) is supplied a count, e.g. , (I think) it deletes the current line before pasting `n` times, thus only appearing to append `n - 1` copies.

```
ò         | recursively...
 ï        | . append newline
  ç       | . globally search lines matching...
   $îî    | . . compressed version of $\n\n regex
      /6Ä | . . duplicate to create 6 copies
H         | . go to first line
 l        | . move cursor right 1 char
          | . . if current line is 1 char long, errors out of recursion
  $x      | . delete 1 char from end of current line
    ò     | ...end
     x    | delete extra 1-char substring
      ú   | sort so that newlines rise to top

```

# Answer
> 2 votes
# APL (Dyalog Unicode), 14 bytesSBCS

```
{↑(5×⍳≢⍵)/,\⍵}

```

Try it online!

My first apl post so please let me know if you have any suggestions

## How it works:

```
{↑(5×⍳≢⍵)/,\⍵}
          ,\⍵  - Prefixes of the input
         /      - Repeated
     ⍳≢⍵        - By a list of indices the same length as the input
   5×           - Times 5
 ↑              - Separate into rows

```

# Answer
> 2 votes
# Wenyan, ~~350~~ ~~326~~ 308 bytes

```
吾有一術名之曰「A」欲行是術必先得一言曰「B」是術曰有數零名之曰「C」吾有一言名之曰「D」凡「B」中之「E」加五於「C」昔之「C」者今其是矣加「E」於「D」昔之「D」者今其是矣為是「C」遍夫「D」書之云云云云是謂「A」之術也

```

IDE

Just seen this programming language on GitHub, so I'll have a try. There is no equivalent for "process.argv", so I have to write this as a function, but then the boilerplate `吾有一術名之曰「X」欲行是術必先得一言曰「X」乃行是術曰...是謂「X」之術也` itself (114 bytes) is just too long.

Each variable has to be at least 7 bytes (the brackets themselves take 6 bytes), and a string takes `12 bytes + length of string` to achieve. Of course I can trivially put something like `施「eval」於「「a=>[...a].map(_=>(a.slice(0,++i)+'\\n').repeat(i*5),i=0).join``」」` (91 bytes) but that's boring (why not use JavaScript then?)

### Explanation

```
function A(B) {
 var C = 0, D = "";
 for (var E of B) {
  C = C + 5;
  D = D + E;
  for (var i = 0; i < C; i++)
   console.log(D);
 }
}

```

### 326-\>308 `乃行` before `是術曰` is optional so it's removed, and `吾有一言曰「D」` is replaced by `夫「D」` to recall the variable.

# Answer
> 1 votes
# Japt, ~~15~~ 12 bytes

*-3 bytes from @Shaggy*

```
£¯°Y +R pY*5

```

Try it online!

# Answer
> 1 votes
# Perl 6, 25 bytes

```
{(1..*X*5)RZxx[\~] .comb}

```

Try it online!

Anonymous code block that returns a list of list of strings.

If you want it as a 1D array, you can append `flat` in front like so:

```
{flat (1..*X*5)RZxx[\~] .comb}

```

Try it online!

### Explanation:

```
{                       }  # Anonymous code block
                   .comb   # Split the string into a list of characters
              [\~]         # Triangular reduce the list of characters with the concatenate operator
          RZxx             # Multiply each list by:
 (1..*X*5)                 # A sequence of 5,10,15 etc.

```

Alternatively,

```
{($+=5)xx*RZxx[\~] .comb}

```

Try it online!

Also works for the same amount of bytes.

# Answer
> 1 votes
## Perl 5, 29 bytes

```
map{say}($x.=$_)x($y+=5)for@F

```

Try it online!

# Answer
> 1 votes
# Japt, 10 bytes

Awaiting confirmation as to whether the output format is acceptable (+2 bytes if not).

```
å+ £T±5 ÇX

```

Try it

# Answer
> 1 votes
# Java 10, ~~120~~ ~~92~~ ~~90~~ 89 bytes

```
s->{for(int j=1,i=1;i<=s.length();i+=++j>i*5?j=1:0)System.out.println(s.substring(0,i));}

```

-28 bytes thanks to *@OlivierGrégoire*.
-1 byte thanks to *@ceilingcat*.

Try it online.

**Explanation:**

```
s->{                      // Method with String parameter and no return-type
  for(int j=1,            //  Repeat-integer, starting at 1
      i=1;i<=s.length()   //  Loop `i` in the range [1,length_input]
      ;                   //    After every iteration:
       i+=++j>i*5?        //     Increase `j` by 1 first with `++j`
                          //     If `j` is now larger than `i` multiplied by 5:
           j=1            //      Increase `i` by 1, and reset `j` to 1
          :               //     Else:
           0)             //      Leave `i` the same by increasing it with 0
    System.out.println(   //   Print with trailing newline:
      s.substring(0,i));} //    The prefix of size `i`

```

# Answer
> 1 votes
# Forth (gforth), 48 bytes

```
: f 1+ 1 do i 5 * 0 do dup j type cr loop loop ;

```

Try it online!

### Explanation

1. Loop from 1 to string-length
2. for each iteration:
    1. Loop (5 * loop index) times
    2. Print string from beginning to outer loop index

### Code Explanation

```
: f                \ start a new word definiton
  1+ 1             \ set up to the loop paramers from 1 to str-length
  do               \ start a counted loop
    i 5 * 0 do     \ start a second counted loop from 0 to 5*index - 1
      dup j        \ duplicate the string address and set the length to the outer index
      type         \ print character from start of string to loop index
      cr           \ output a newline
    loop           \ end inner counted loop
  loop             \ end outer counted loop
;                  \ end word definition

```

# Answer
> 1 votes
# JavaScript, 76 bytes

```
s=>{for(i=1;i<=s.length;i++)for(j=0;j<5*i;j++)console.log(s.substring(0,i))}

```

```
f=s=>{for(i=1;i<=s.length;i++)for(j=0;j<5*i;j++)console.log(s.substring(0,i))}

f("cat")
```

# Answer
> 1 votes
# brainfuck, 40 bytes

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

```

Try it online!

```
[Tape: 10 (newline), [characters], 0, rowcounter]

++++++++++> 10 (newline)
,[          for each input character
  >>+++++     add 5 to number of rows
  [           for each row
    <<[<]       go to start
    >[.>]       print newline and all previous characters
    >>+         add 1 to next rowcounter cell
    <-          decrement current rowcounter cell
  ]
  <,          input next character
]

```

# Answer
> 1 votes
# Ruby, 37 bytes

```
f=->s{s[0]?f[s.chop]+[s]*s.size*5:[]}

```

Try it online!

# Answer
> 0 votes
# Python 3, 55 bytes

```
lambda a:[a[:i]for i in range(len(a)+1)for j in' '*5*i]

```

Try it online!

# Answer
> 0 votes
# Jelly, 9 bytes

```
WẋL×5ƊƊƤẎ

```

Try it online!

-2 bytes thanks to Mr. Xcoder

# Answer
> 0 votes
# Clean, 47 bytes

```
import StdEnv
$s=[repeatn(5*i)c\\c<-s&i<-[1..]]

```

Try it online!

# Answer
> 0 votes
# Tidy, 30 bytes

```
{k:c(k)*5*count(k)}on prefixes

```

Try it online!

Returns a list of list of characters. If that is not acceptable, the following also works:

## Tidy, 37 bytes

```
{k:out on c(k)*5*count(k)}on prefixes

```

Try it online!

## Explanation

```
{k:c(k)*5*count(k)}on prefixes
{k:               }on prefixes     over each prefix k:
   c(k)                              the singleton list k
       *5                            ...repeated 5 times
         *count(k)                   ...repeated by the number of elements in the prefix

```

# Answer
> 0 votes
# Python 2, 42 bytes

```
lambda s:s and f(s[:-1])+(s+'\n')*len(s)*5

```

Try it online!

# Answer
> 0 votes
# bash, 89 bytes (or 158 bytes for extra complex output shown as exemple)

version 1: 89 bytes (output cat as lines with: c ca cat )

```
read a;for i in $(seq 1 ${#a});do for c in $(seq 1 $((i*5)));do echo "${a:0:i}";done;done

```

version 2 : 158 bytes ( output cat as lines with : \['c'\] \['c', 'a'\] \['c', 'a', 't'\] )

```
read a;for i in $(seq 1 ${#a});do for c in $(seq 1 $((i*5)));do printf "[$(for j in $(seq 1 $i);do printf ", '${a:j-1:1}'";done)]\n";done;done|sed -e 's/, //'

```

# Answer
> 0 votes
# awk, 74 bytes (or 144 for the extra complex output shown in question)

version 1, 74 bytes: that the question seems to allow (each lines looking like: c ca cat )

```
{for(c=1;c<=length($1);c++)for(n=1;n<=c*5;n++){print substr($1,1,c)};exit}

```

version 2, 144 bytes: extra complex output ( each lines looking like: \['c'\] \['c', 'a'\] \['c', 'a', 't'\] )

```
{s=length($1);for(c=1;c<=s;c++)for(n=1;n<=c*5;n++){printf"[";for(i=1;i<=c;i++)printf("%s'%s'",(i>1)?", ":"",substr($1,i,1));printf("]\n")};exit}

```

Thanks to the exit, this processes only the first line entered on stdin. Getting rid of it also processes multiple lines, one by one, stacking the towers together (and savig 5 bytes).

The default is the above, with only 1 tower (and only the first input line processed)

# Answer
> 0 votes
# Pascal (FPC), 96 bytes

```
var s:string;i,j:word;begin read(s);for i:=1to length(s)do for j:=1to i*5do writeln(s[1..i])end.

```

Try it online!

Longer than Java :(

# Answer
> 0 votes
# brainf\**k ~~93~~ ~~81~~ 76 bytes

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

```

Try it online!

Saved 12 bytes by removing a never-used empty cell. Saved another 5 bytes due to the help of Dorian (thanks!). Did not update the "How it works" section.

## How it works

```
[-][ https://codegolf.stackexchange.com/questions/170872/tower-of-strings ]
[-][ -------------------------------------------------------------------- ]
[-][ Variables                                                            ]
[-][ p0: temp0                                                            ]
[-][ p1: temp1                                                            ]
[-][ p2: {LF}                                                             ]
[-][ p3: n input characters                                               ]
[-][ p4: zero                                                             ]
[-][ p5... inputs                                                         ]

p0    [-]
p1  > [-]
p2  > ++++++++++
p3  > +
p4  > [-]
p5  > ,   # read input
      [   # open loop
p4      [<] # go back to p4
p3       <
## loop current number of inputs
         [
p2         <
p1         < + # copy p3 to p1
p0         < +++++ # use p0 to count to 5
          [
p1         >
p2         >
p3         >
p4         >
p5         >
           [ ## output all until empty
             . >
           ] <
p4         [<] #back to p4
p3         <
p2         < . #output {LF}
p1         <
p0         <-
          ]
p1         >
p2         >
p3         > -
         ]
## copy p1 back to p3
p2       <
p1       <
         [ -
p2         >
p3         > +
p2         <
p1         <
         ]
p2        >
p3        > + # increase p3
p4        >
next     >[>] ,  # read next character
      ]

```

Shorter than Java ;-)

# Answer
> 0 votes
# Pushy, 10 bytes

```
@L:OvL5*:"

```

Try it online!

```
                   \ Implicit: Input on stack, as character codes
@                  \ Reverse stack
 L:                \ length(stack) times do:
   Ov              \   Move TOS to auxiliary stack
     L5*:          \   5 * length(auxiliary stack) times do:
         "         \     Print the auxiliary stack as a string

```

# Answer
> 0 votes
# C# (.NET Core), 89 bytes

Without LINQ.

```
x=>{int i=0;while(i++<x.Length)for(var j=0;j++<i*5;)Console.WriteLine(x.Substring(0,i));}

```

Try it online!

# Answer
> 0 votes
# PHP, 70 bytes

If it's okay to print the strings like h he hel hell hello then this is a valid answer. Otherwise, I might need to add more code to make the square brackets, quotes and commas.

```
for(;$x<strlen($argn);)echo str_repeat(substr($argn,0,++$x)."
",5*$x);

```

Try it online!

---
Tags: code-golf, string, number
---


title: Advent calendar

text:
# Question
Title: Advent calendar
Let's build an advent Calendar for this Christmas!

Many Advent calendars for children take the form of a large rectangular card with numbered windows for each day of December starting from 1 ( although advent time begins on Advent Sunday, which is the fourth Sunday before Christmas day and often happens to be on November) and leading up to and including Christmas Eve (24) or in some cases Christmas day (25).
Windows are distributed across the calendar at a random position.
Every day children open the corresponding calendar window to reveal a small gift(usually a chocolate)

# Task

The task is to display an advent calendar up to date following these rules:

* Include Christmas day : 1 to 25
* For days that have passed put an opened empty window `[ ]` ( no different characters allowed ), so if i run the same code the next day there must be a new window opened.
* At the current day put an opened window with a gift in it `[@]` ( instead of `@` you can use every printable character excep for `space`, `[` , `]` and `digits` ).
* For the remaining days put only the day number.
* At Christmas all the windows will be open, the next day they are all closed ( a new calendar ).
* Windows must open only on December, windows must stay closed on every month except for December.
* It should work the same way the next year, and every year, that is for example on December 2099 Windows start opening.
* Windows are laid down in random order on a 5 rows x 5 columns grid.
* The grid has not to be accurate, just consider that every windows must have at least one character space separating them on every side: left, top, right and bottom hence numbers must have left and right spaces of at least two characters.

# Example

Today (15 December) :

```

  23   21   [ ]   18   [ ]

  [ ]   [ ]   [ ]   [ ]   16

  24   22   [ ]   17   [ ]

  [ ]   [ ]   [ ]   25   19

  [ ]   [ ]   [@]   [ ]   20

```

Tomorrow (16 December) :

```

  [ ]   17   25   [ ]   [ ]

  [ ]   19   [ ]   18   21

  [ ]   23   24   [ ]   [ ]

  22   [@]   [ ]   [ ]   [ ]

  [ ]   20   [ ]   [ ]   [ ]

```

On every month different than December

```
18 23 21 12 19
25 24 3 15 14
16 9 17 20 4
8 2 11 5 7
6 13 10 22 1

```

Live example

All rules apply.

# Answer
> 9 votes
# APL (Dyalog Extended), 57 bytesSBCS

Full program.

```
5 5⍴('[ ]'¨@{⍵∊⍳d}'[@]'¨@{⍵=d})⍣(</11 25≥m d←2↑1↓⎕TS)?⍨25

```

Try it online!

`?⍨25` random selection without replacement of 25 out of 1…25

`⍣(``)` if:

`⎕TS` date in `[Y,M,D,h,m,s,t]` format

`1↓` drop one element; `[M,D,h,m,s,t]`

`2↑` take two elements; `[M,D]`

`m d←` distribute to variables `m=M` and `d=D` (for **m**onth-of-year and **d**ay-of-month numbers)

`11 25≥` are `[11,25]` greater than or equal to these (gives `[0,1]` during advent, `[1,0]` or `[1,1]` before, and `[0,0]` after)

`</` if the first number is less than the second…

`(``)` then apply the following function:

`@{``}` at elements where the following condition is true:

`⍵=d` the elements are equal to `d` (today's day-of-month number)

`'[@]'¨` replace each with the constant `"[@]"`

`@{``}` at elements where the following condition is true:

`⍵∊⍳d` the elements are members of 1…`d` (today's day-of-month number)

`'[ ]'¨` replace each with the constant `"[ ]"`

`5 5⍴` reshape into a five-by-five matrix

# Answer
> 8 votes
# Python 2, ~~181~~ ~~189~~ ~~181~~ 179 Bytes

### Original Code

Since I can't comment on other answers yet, this is a slight improvement on ElPedro's previous answer. Try it online! I changed ElPedro's 5th line to save an additional 9 bytes.

```
i=__import__
t=i("datetime").date.today();n=t.day
c=[('['+(' ','@')[d==n]+']',`d`)[t.month<12or d>n]for d in i("random").sample(range(1,26),25)]
while c:print' '.join(c[:5]);c=c[5:]

```

### Correction #1

Gained 6 bytes in order to fix an error where windows remain open after December 25th until the new year. Try it online!
See corrected version of line 3 below:

```
c=[('['+(' ','@')[d==n]+']',`d`)[t.month<12or n>25or d>n]for d in i("random").sample(range(1,26),25)]

```

### Correction #2

As per AZTECCO's suggestions, I'm back at 181 bytes :) Try it online!

```
c=[('['+' @'[d==n]+']',`d`)[t.month-12|25-n|n-d<0]for d in i("random").sample(range(1,26),25)]

```

### Final

With streamlined `import` statements (Thanks to Reinstate Monica)

```
import random,datetime as D
t=D.date.today();n=t.day
c=[('['+' @'[d==n]+']',`d`)[t.month-12|25-n|n-d<0]for d in random.sample(range(1,26),25)]
while c:print' '.join(c[:5]);c=c[5:]

```

# Answer
> 6 votes
# JavaScript (ES6),  ~~158 ... 150~~  148 bytes

*Saved 2 bytes thanks to @Deckerz*

*Note: Strictly speaking, this should be marked as ES9 (ECMAScript 2018), in which the output format of `Date.prototype.toString` has been standardized.*

```
f=(k=25,m,d=Math.random()*25+1|0,t=(new Date+0).match(/c ([01].|2[0-5])|:/)[1])=>k?(m^(m|=1<<d)?(d^t?d<t?'[ ]':d:'[@]')+`
 `[--k%5&&1]:'')+f(k,m):''

```

Try it online!

### How?

`(new Date).toString()` returns the current date in the following format:

```
DDD MMM dd yyyy hh:mm:ss TimeZoneString

```

For instance:

```
Sun Dec 15 2019 12:29:35 GMT+0000 (Coordinated Universal Time)

```

We apply the following regular expression to this string:

```
/c ([01].|2[0-5])|:/

```

It attempts to match a day of December less than \\$26\\$ (it's the only month whose 3-letter abbreviation ends in "c"). If not found, we force the first `:` separator to be matched instead, in order to prevent `match()` from returning `null`.

Therefore, the variable \\$t\\$ (for 'today') is set to either a valid day of December, or *undefined* if we're outside the relevant period:

```
t = (new Date + 0).match(/c ([01].|2[0-5])|:/)[1]

```

\\$f\\$ is a recursive function that generates a random day \\$d\\$ in \\$\[1-25\]\\$ at each iteration and draws the corresponding slot in the calendar. It keeps track of drawn days in the bitmask \\$m\\$.

```
f = (                     // f is a recursive function taking:
  k = 25,                 //   k = remaining number of days to draw
  m,                      //   m = bitmask of drawn days
  d = Math.random() * 25  //   d = random day in [1-25]
      + 1 | 0,            //
  t = ...                 //   t = current day or undefined (see above)
) =>                      //
  k ?                     // if k is not equal to 0:
    ( m ^ (m |= 1 << d) ? //   if m is modified by setting the d-th bit:
        ( d ^ t ?         //     if d is not equal to t:
            d < t ?       //       if t is defined and d is less than t:
              '[ ]'       //         draw an opened window
            :             //       else:
              d           //         draw a closed window
          :               //     else:
            '[@]'         //       draw today's gift
        ) +               //
        `\n `             //     decrement k; append a linefeed at the end of a row
        [--k % 5 && 1]    //     or a space otherwise
      :                   //   else:
        ''                //     we need to pick another day: leave k unchanged and
                          //     append nothing
    ) + f(k, m)           //   append the result of a recursive call
  :                       // else:
    ''                    //   done: stop recursion

```

# Answer
> 6 votes
# Perl 6, 91 bytes

*-1 bytes thanks to nwellnhof*

```
.put for (("[@]"if Date.today~~/12.(0?@(^26))$/),"[ ]"xx+$0,+$0^..25)[*;*].pick(*).rotor(5)

```

Try it online!

### Explanation:

```
.put for (     ...    )         # Print for each of
          ("[@]"if Date.today~~/12.(0?@(^26))$/), # [@] if today is within the Christmas period
          "[ ]"xx+$0,     # As many [ ]s as the current date
          +$0^..25        # All the number from today to the 25th
                      [*;*]                  # Flatten
                           .pick(*)          # Randomise
                                   .rotor(5) # And split into chunks of 5

```

# Answer
> 5 votes
# Python 2, ~~231~~ ~~222~~ ~~216~~ ~~202~~ ~~197~~ ~~193~~ 189 bytes

```
i=__import__
t=i("datetime").date.today()
y=t.day
d=[(((`x`,"[ ]")[x<y],"[@]")[x==y],`x`)[t.month<12or y>25]for x in i("random").sample(range(1,26),25)]
while d:print' '.join(d[:5]);d=d[5:]

```

Try it online!

-3 with many thanks to @AZTECCO

Examples below use an earlier version of the answer but the formula is the same.

Before December: Try it online!

December after 25th: Try it online!

# Answer
> 5 votes
# 05AB1E, ~~38~~ ~~37~~ ~~32~~ ~~31~~ 30 bytes

```
žeD₂‹žfÂ‹P'@ú€…[ÿ]Dg25Ÿ«¦.r5ô»

```

-6 bytes thanks to *@Grimmy*.

Try it online or try it online with own specified month / day.

**Explanation:**

```
že          # Push the current day
  D         # Duplicate it
   ₂‹       # Check if it's smaller than 26
     žf     # Push the current month
       Â    # Bifurcate it (short for Duplicate & Reverse copy)
        ‹   # And check if this is smaller than the month itself
            # (this will check 1-9 < 1-9 (falsey); 10 < 01 (falsey); 11 < 11 (falsey);
            #  and 12 < 21 (truthy) - so this will only be truthy for 12 / December)
         P  # Take the product of the day and both checks,
            # which result in either the day, or 0 if either check was falsey
'@         '# Push character "@"
  ú         # Pad it with the earlier number amount of spaces
   €        # Map over each of these characters:
    …[ÿ]    #  Push string "[ÿ]", where the `ÿ` is automatically filled with the character
Dg          # Duplicate the list, and pop and push its length
  25Ÿ       # Create a list in the range [length, 25]
     «      # And merge it to the earlier created list
¦           # Then remove the first item (either a "[ ]", or the "[@]" if the checks
            #                             were falsey)
 .r         # Randomly shuffle the list
   5ô       # Split the list into sublists of size 5
     »      # Join each inner list by spaces, and these strings by newlines
            # (after which the result is output implicitly)

```

# Answer
> 4 votes
# , ~~113~~ 103 bytes

```
x=as.POSIXlt(Sys.time())
a=sample(25)
if(x$mo>10&(y=x$md)<26){a[a<y]="[ ]";a[a==y]="[@]"}
write(a,"",5)

```

Try it online!

A full program that prints an advert calendar as specified.

# Answer
> 3 votes
# Red, 135 bytes

```
d: now c: collect[repeat n 25[keep n]]if all[d/3 = 12
d/4 < 26][repeat n d/4[c/:n:"[ ]"]c/:n:"[@]"]random c
loop 5[print take/part c 5]

```

Try it online!

# Answer
> 3 votes
# Jelly, ~~76~~ 75 bytes

```
⁶o”@;Ø[jⱮ;@Jị@
“j⁶ṖgqS^OßƭẸ#pÆẸ¥aRŀçĠrṬỤ{½9?ȷ²Yḅ»ḲḢ;Ɱ$ŒV12;Ɱ25¤i+Ɱ25ẊÇs5K€Y

```

Try it online!

A full program that prints an advent calendar. Longer than most Jelly programs because it has to call `__import__('datetime').datetime.today().month` and `__import__('datetime').datetime.today().day` in Python.

If the date and time could be provided as an argument, it could be much shorter:

# Jelly, ~~35~~ 34 bytes

```
⁶o”@;Ø[jⱮ;@Jị@
12;Ɱ25¤i+Ɱ25ẊÇs5K€Y

```

Try it online!

# Answer
> 3 votes
# Ruby, 112 bytes

```
x=[*1..25].shuffle;5.times{|c|puts x[c*5,5].map{|w|['[@]','[ ]',w][((d=Time.now).day-(d.month-12)*30)<=>w]}*" "}

```

Try it online!

# Answer
> 0 votes
# C#, 267 bytes

```
using System;using System.Linq;class _{static void Main(){var n=DateTime.Now;var t=n.Month==12?n.Day:0;Console.WriteLine(string.Join(" ",Enumerable.Range(1,25).OrderBy(_=>new Random().Next(-9,9)).Select((d,i)=>(i%5==0?"\r\n":"")+(d<t?$"[ ]":d>t?$"{d}":"[@]"))));}}

```

.Net Fiddle

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


title: Largest smallest gap

text:
# Question
Title: Largest smallest gap
Write a function or program which takes as input a set of distinct, non-negative integers \\$\\{x\_1, \ldots, x\_n\\}\\$ and outputs the smallest gap between any two values in the set, i.e. \\$\min\_{i\neq j}|x\_i-x\_j|\\$.

### Scoring

**This is not code golf.** Your score is the smallest gap of the set of code points of characters in your code (**highest score wins**). In other words: convert your code to integer code points (using ASCII or whatever code page is standard for your language); remove duplicates; use that as input to your program; the output is your score.

For instance, if your code is `min(alldifferences(input))`, to get your score convert `m->109`, `i->105`, `n->110`, `(->40`, ... and your score will be 1, since the codepoints for `m` and `n` are only 1 apart.

You may assume that the input contains at least 2 distinct values; behaviour is undefined otherwise. Your code must include at least two distinct characters.

If your encoding is ASCII, you can use this online R code to verify your score.

### Test cases

```
Input         | Output
0 1 2 3 4     | 1
2 4 8 16 32   | 2
1             | undefined
3 14 159 2653 | 11
4 6 8 9 12 14 | 1
3 14 2        | 1

```

Default rules for input/output apply. In particular, since the input is a set, you may assume any structure for the input.

# Answer
> 11 votes
# 05AB1E, score: ~~22~~ ~~49~~ 69 (~~5~~ 4 bytes)

```
ê¥êн

```

Uses the 05AB1E encoding, where the bytes have the codepoints `[234,165,234,14]` (`ê¥` are 69 apart).

+27 score by porting *@Arnauld*'s approach of sorting.
+20 score (and even -1 byte at the same time) thanks to *@Grimmy*.

Try it online or verify all test cases.

**Explanation:**

```
ê     # Sort and uniquify the (implicit) input-list (in ascending order)
 ¥    # Get the deltas of this sorted list
  ê   # Sort and uniquify this again
   н  # Pop this list and push its first item
      # (which is output implicitly as result)

```

# Answer
> 4 votes
# Brachylog, Score = 12

```
⊇ᶠl₂ˢ-ˢȧˢ⌋

```

Try it online!

The minimum gap is 12, between  and , and also between  and `ˢ` (see the code page).

### Explanation

```
⊇ᶠ             Find all subsets of the input
  l₂ˢ          Only keep those that have a length of 2
     -ˢ        Compute the difference of each subset
       ȧˢ      Compute the absolute value of each difference
         ⌋     Output is the smallest one

```

# Answer
> 4 votes
# Charcoal, 13 bytes, score 3

```
Ｉ⌊Ｅθ⌊ΦＥθ↔⁻ιλλ

```

Try it online! Link is to verbose version of code and takes the code's own code points as input. Explanation:

```
   θ            Input array
  Ｅ             Map over elements
       θ        Input array
      Ｅ         Map over elements
          ι     Outer element
           λ    Inner element
        ↔⁻      Take the difference
     Φ      λ   Filter out zero values
 ⌊  ⌊           Take the minimum of the minima
Ｉ               Cast to string for implicit print

```

Charcoal's loop variables are implicit but fortunately `Map` consumes two variables and even more fortunately there is no variable `j` so there is actually a minimum difference of 3.

# Answer
> 4 votes
# Jelly, 5 bytes, score = 24

This is most probably sub-optimal. Uses Jelly code page.

```
ṢIṢ1ị

```

Try it online! (with the code points of the source code)

### Commented

```
ṢIṢ1ị  - a monadic link taking a list, e.g. [183, 73, 49, 216]
Ṣ      - sort in ascending order -> [49, 73, 183, 216]
 I     - get increments -> [24, 110, 33]
  Ṣ    - sort in ascending order -> [24, 33, 110]
   1ị  - extract the first element -> 24

```

# Answer
> 4 votes
# Gaia, 3 bytes, score = 36

```
ȯọ⌋

```

Try it online!

Uses the Gaia codepage. `ȯọ` are 36 apart.

# Answer
> 4 votes
# MathGolf, score = 35

```
ê│╓

```

Try it online!

Uses MathGolf's codepage along with this simple Python script.

```
ê    Take user input as array of integers
 │   Take differences
  ╓  Find minimum

```

# Answer
> 3 votes
# Japt `-g`, 6 bytes, score: 43

```
n¹än¹n

```

Try it (includes codepoints test case)

# Answer
> 3 votes
# Jelly, score 53

```
’ÞIṂ

```

**Try it online!**

The code page is here. The code points are `253 20 73 179` which has minimal difference of `73-20=53` as may be seen in this self-evaluation.

### How?

```
      ’ÞIṂ - Link: list of numbers, L     e.g. [253, 20, 73, 179]
 20:   Þ   - sort L by:
253:  ’    -   decrement                       [20, 73, 179, 253]
 73:    I  - incremental differences           [53, 106, 74]
179:     Ṃ - minimum                           53

```

# Answer
> 3 votes
# MATL, Score 16

```
SdS9z)

```

Try it online!

For anything up to `SdS)` I could get a score of 17, but generating a `1` for indexing (because `X<` is too close to `S`) bumped the score down to 16.

Let's see if any ASCII-based language beats this...

# Answer
> 3 votes
# Runic Enchantments, Score 1 (79 bytes)

```
D?)0]li[0y̤<<<<<<<<
Ro"/{~D-{:ii"6Xkq";$~\"akq"/~{R{0[il]0)?/:}S-:}}:{)?"E͍$;

```

Try it online!

(Note that due to the way input is coerced to the most appropriate type and we want `decimal value 49` not `decimal value 1` for such bytes; this applies to the newline, `0`, `6` (etc), as well as the injection of all the spaces).

There's a few reasons I can't score higher. In decreasing order of troublesomeness.

1. `@` and `?` are adjacent (`?` is required for conditionals, `@` is one of two terminators)
2. `:` and `;` are adjacent (`:` is required to duplicate the top of the stack for non-destructive comparisons, `;` is the other terminator)
3. `<` and `;` are adjacent
4. `>` and `?` are adjacent (using other entry points possible, but we're already score-limited, `v` is best option as `^` and `]` are adjacent)
5. `D` and `E` are adjacent (replacing `D` with `/` or `\` or not using `E`val possible)
6. `l` and `k` are adjacent (`l` is required to read all input, `k` is required to inject a newline and entry point into the evaluated code; `E`val not strictly needed)
7. `}` and `~` are adjacent (pop-discarding an arbitrary value without corrupting the stack is difficult otherwise, `[]` does work, but limits score to 2, assuming we could overcome the other points, `0*+` also works, but `+` and `*` are adjacent)
8. `o` and `q` limit score to 2
9. `[` and `]` limit score to 2 (but not strictly necessary, just simplifies the input reading process, but `lril1-` is still score limited to 3 on its own plus `r` and `q` are adjacent as well as `0` and `1`)
10. `l` and `o` limit score to 3
11. pre-processing the code and injecting troublesome bytes with reflection necessitates a minimum of 2 of `1234567890`, all of which are going to cause low score limits.

# Answer
> 2 votes
# Jelly, 12 bytes, score = 35

```
ạ€`«/Ƈ€«/€«/

```

Try it online!

A monadic link taking a list of (optionally distinct) integers as its argument and returning the smallest gap. Generates an outer table of absolute differences between the inputs, filters out zero differences, finds the smallest in each row and then the smallest of those values. TIO link has a footer to translate the code into numeric codepoints within Jelly codepage (technically each is +1, but there is no effect on differences between pairs).

Pairwise differences shown here

# Answer
> 2 votes
# , 47 bytes, score = 2

```
`-`=`mi\x6E`;`~`=diff;`?`=`s\x63\x61\x6E`;-~?""

```

Try it online!

---

The input is assumed to be unique and sorted ascending.

## Verify the score here

# Answer
> 0 votes
# **C++, score : 1, bytes : 132**

```
#include <cmath>
int f(int* a,int c){int m=abs(a[0]-a[1]),i,j,d;for(i=-1;++i<c;)for(j=i;++j<c;)m=(d=abs(a[i]-a[j]))<m?d:m;return m;}

```

~~The very need of the `abs` function kills my score, and any other C++ answer's.~~
It's actually `return`.

Try it online!

---
Tags: code-challenge, self-referential
---


title: Remove Duplicates From One List

text:
# Question
Title: Remove Duplicates From One List
## Task:

Remove all duplicates from one list of integers. A list is simply a sequence of connected values that allows the same values to be stored at different positions in this sequence.

If an item was found to be the same value as another item in this list, keep the first occurence of the item and remove the second (third and so on...) occurence of the item.

## Input/Output

You may write a function or full program that takes a list of integers as an input and returns a list without duplicates as an output.

## Rules:

* This is a challenge, so shortest answer wins!

# Answer
## APL (1)

takes a list and returns the unique elements in a list, i.e.:

```
    ∪ 1 2 3 2 3 4 5
1 2 3 4 5

```

if you need I/O it's 2:

```
∪⎕

```
> 4 votes

# Answer
## GolfScript (2 bytes)

```
.&

```

Takes input on stack, leaves output on stack.
> 3 votes

# Answer
# Red, 8 bytes

```
unique s

```

assuming list is in word 's
> 1 votes

# Answer
# Python 2: 12 bytes

```
print set(l)

```

No input spec, so I'm assuming the list is held in a variable called `l`.
> 0 votes

# Answer
# Python - 12 bytes

```
list(set(l))

```

Assuming the list is given in the variable `l`.
> 0 votes

# Answer
## Mathematica, 7 bytes or 3 characters

Assumes input in variable `x`

```
Union@x

```

If we're counting in Mathematica characters, I can do 3 (the second input line):
> 0 votes

# Answer
# Ruby, 3 characters

```
a|a

```

Assumes the list is stored in variable `a`. Also works with `&` instead of `|`.

If the original list has to be altered (instead of keeping the original the same and creating a new list with duplicates removed), then 4 characters:

```
a|=a

```
> 0 votes

---
Tags: code-golf, array, counting
---


title: 2D Path Drawing

text:
# Question
Title: 2D Path Drawing
(This is not a duplicate of Follow the path, as this challenge have invalid path detection and use `><^v` in the output.)

# Task

So your task is to take in the description of the path and draw it out in a "Befunge(or a lot of other 2D esolangs)-like" format, and detect if it is invalid. Note that if the path is invalid, you shall not output anything except a printable custom character which cannot be one of `><^v` or space.

* The path would be invalid if the path is crossed.
* Or, if you moved off the top or left edge.

You begins at the top-left corner.

* `>n` moves you right n characters. Your trail is `>`.
* `^n` moves you up n characters. Your trail is `^`.
* `<n` moves you left n characters. Your trail is `<`.
* `vn` moves you down n characters. Your trail is `v`.

# Test Cases

```
Input: >3v3

Output:
>>>v
   v
   v

Input: v4>1^2>3

Output:
v
v
v>>>
v^
>^

Input: >5<3

Output:
!

(Or any character you want, except ><^v and space.)

Input: [NONE]

Output: [NONE]

Input: >4v2<2^2

Output:
>>>>v
  ^ v
  ^<<

Input: >4v2<2^3

Output:
!

(Or any character you want, except ><^v and space.)

Input:
>3v3<6

Output:
!

(Or any character you want, except ><^v and space.)

```

# Rules

* Standard loopholes are forbidden.
* Least bytes wins.
* This was written in a hurry.

# Answer
> 1 votes
# Charcoal, 46 bytes

```
≔⁰ηＦ⪪Ｓ²ＦＩ§ι¹«≧⁺℅ＫＫη✳⊗⌕>^<§ι⁰§ι⁰≧⁺∨‹ⅈ⁰‹ⅉ⁰η¿η«⎚!

```

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

```
≔⁰η

```

Assume everything is OK.

```
Ｆ⪪Ｓ²

```

Loop over the instructions.

```
ＦＩ§ι¹«

```

Loop over the number of steps.

```
≧⁺℅ＫＫη

```

Check whether the path has crossed.

```
✳⊗⌕>^<§ι⁰§ι⁰

```

Output each character in the appropriate direction.

```
≧⁺∨‹ⅈ⁰‹ⅉ⁰η

```

Check whether the path has moved off the top or left edge.

```
¿η«⎚!

```

If something went wrong, replace the output with a `!`.

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


title: Two stack sorting

text:
# Question
Title: Two stack sorting
This challenge is inspired by the same task I read some time ago in CACM.

There are many ways to sort stuff. Most attempt to sort in as few operations as possible (= as fast as possible). However, it is also possible to consider how few resources you might require to sort stuff, which seems more fitting for a codegolf challenge.

You have a stack of cards, numbered from `1` to `N` (or `0` to `N-1` or `a` to `zzz` if you prefer). You do not know `N`. All you have available are two additional stacks, where one of them has capacity for just a single card. At any point, you see just the top of those stacks and you have no memory what was there even a single step before.

Your task is to write a function (or whatever) that would take top of those 3 stacks as input in some convenient form and return operation that has to be performed - eg `2,3` meaning card has to move from stack 2 to stack 3. Please note that one stack has capacity for a single card. Input given when stack is empty is arbitrary.

Initial state of sorting is one stack with all the cards in arbitrary mixed order and two empty stacks, one of the two with capacity for a single card (and the other is unlimited). After executing your function (and performing the operation returned) finitely many times on arbitrarily mixed initial cards, cards have to be guaranteed to be sorted on any of the stacks. Saving previous state or checking non-top numbers in any way is prohibited. As are all other loopholes.

# Answer
# Jelly, ~~9~~ 8 bytes

```
ṖM⁸aḢ;‘$

```

Try it online!

A monadic link taking a list of three integers representing the top of the three stacks, or zero for an empty stack. The three stacks are `[single card, destination, source]`. Returns a pair of integers indicating which stack to move from and to. In keeping with Jelly’s indexing of lists, the third stack can be referred to either as `3` or `0`.

Inspiration taken from @Arnauld’s JavaScript answer so be sure to upvote that one!

## Explanation

```
Ṗ         | Remove last list item
 M        | Indices of maximum
  ⁸a      | Original argument and with this
    Ḣ     | Head
     ;‘$  | Concatenate to itself plus 1

```
> 2 votes

# Answer
# JavaScript (ES6), 23 bytes

Uses 1-indexed cards and stacks. The initial stack is the 1st one. The single-card stack is the 3rd one. Expects \\$0\\$ for an empty stack.

Returns a 2-digit number, where the 1st digit is the source stack and the 2nd digit is the destination stack.

```
(a,b,c)=>c?b>c?21:32:13

```

Try it online!

### Commented

```
(            // input:
  a,         //   a = top card in the primary stack
  b,         //   b = top card in the secondary stack
  c          //   c = card in the temporary stack
) =>         //
  c ?        // if there's already a card in the temporary stack:
    b > c ?  //   if there's a card in the secondary stack and it's
             //   greater than the temporary card:
      21     //     move from secondary to primary
    :        //   else:
      32     //     move from temporary to secondary
  :          // else:
    13       //   move from primary to temporary

```
> 6 votes

---
Tags: code-golf, sorting
---


# Question
Title: Is there any web esoteric language(like javascript)?
Is there any javascript-like language? Something that can be interpreted by browsers?

# Answer
You can always try JSF\*** which allows any JavaScript program to be encoded using the characters `[]()!+`

Here's an example that prints `Hello, JavaScript!`

```
(+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]+([][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]+[])[[+!+[]]+[!+[]+!+[]+!+[]+!+[]]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]][(![]+[])[+[]]+(!![]+[])[+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+((+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]+[])[+!+[]+[+!+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]())[(![]+[])[+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()+[])[!+[]+!+[]]](+!+[]+[+[]]+(+[![]]+[])[+[]])[+!+[]]+[][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()[(![]+[])[+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()+[])[!+[]+!+[]]]((![]+[])[+!+[]]+(+[![]]+[])[+[]])[+[]]+(![]+[])[+!+[]]+(!![]+[])[+!+[]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]())[(![]+[])[+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()+[])[!+[]+!+[]]](+!+[]+[+[]]+(+[![]]+[])[+[]])[+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[!+[]+!+[]]+(!+[]+[])[!+[]+!+[]+!+[]]]([!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]])+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]][(![]+[])[+[]]+(!![]+[])[+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+((+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]+[])[+!+[]+[+!+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]())[(![]+[])[+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()+[])[!+[]+!+[]]](+!+[]+[+[]]+(+[![]]+[])[+[]])[+!+[]]+[][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()[(![]+[])[+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()+[])[!+[]+!+[]]]((![]+[])[+!+[]]+(+[![]]+[])[+[]])[+[]]+(![]+[])[+!+[]]+(!![]+[])[+!+[]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]())[(![]+[])[+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()+[])[!+[]+!+[]]](+!+[]+[+[]]+(+[![]]+[])[+[]])[+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[!+[]+!+[]]+(!+[]+[])[!+[]+!+[]+!+[]]]([!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]])+(!+[]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]][(![]+[])[+[]]+(!![]+[])[+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+((+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]+[])[+!+[]+[+!+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]())[(![]+[])[+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()+[])[!+[]+!+[]]](+!+[]+[+[]]+(+[![]]+[])[+[]])[+!+[]]+[][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()[(![]+[])[+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()+[])[!+[]+!+[]]]((![]+[])[+!+[]]+(+[![]]+[])[+[]])[+[]]+(![]+[])[+!+[]]+(!![]+[])[+!+[]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]())[(![]+[])[+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()+[])[!+[]+!+[]]](+!+[]+[+[]]+(+[![]]+[])[+[]])[+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[!+[]+!+[]]+(!+[]+[])[!+[]+!+[]+!+[]]]([!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]])+([][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]+[])[[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]][(![]+[])[+[]]+(!![]+[])[+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+((+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]+[])[+!+[]+[+!+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]())[(![]+[])[+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()+[])[!+[]+!+[]]](+!+[]+[+[]]+(+[![]]+[])[+[]])[+!+[]]+[][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()[(![]+[])[+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()+[])[!+[]+!+[]]]((![]+[])[+!+[]]+(+[![]]+[])[+[]])[+[]]+(![]+[])[+!+[]]+(!![]+[])[+!+[]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]())[(![]+[])[+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()+[])[!+[]+!+[]]](+!+[]+[+[]]+(+[![]]+[])[+[]])[+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[!+[]+!+[]]+(!+[]+[])[!+[]+!+[]+!+[]]]([!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]])+(![]+[])[+!+[]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]][(![]+[])[+[]]+(!![]+[])[+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+((+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]+[])[+!+[]+[+!+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]())[(![]+[])[+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()+[])[!+[]+!+[]]](+!+[]+[+[]]+(+[![]]+[])[+[]])[+!+[]]+[][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()[(![]+[])[+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()+[])[!+[]+!+[]]]((![]+[])[+!+[]]+(+[![]]+[])[+[]])[+[]]+(![]+[])[+!+[]]+(!![]+[])[+!+[]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]())[(![]+[])[+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()+[])[!+[]+!+[]]](+!+[]+[+[]]+(+[![]]+[])[+[]])[+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[!+[]+!+[]]+(!+[]+[])[!+[]+!+[]+!+[]]]([+!+[]]+[+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]])+(![]+[])[+!+[]]+(([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]+[])[[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]][(![]+[])[+[]]+(!![]+[])[+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+((+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]+[])[+!+[]+[+!+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]())[(![]+[])[+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()+[])[!+[]+!+[]]](+!+[]+[+[]]+(+[![]]+[])[+[]])[+!+[]]+[][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()[(![]+[])[+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()+[])[!+[]+!+[]]]((![]+[])[+!+[]]+(+[![]]+[])[+[]])[+[]]+(![]+[])[+!+[]]+(!![]+[])[+!+[]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]())[(![]+[])[+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()+[])[!+[]+!+[]]](+!+[]+[+[]]+(+[![]]+[])[+[]])[+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[!+[]+!+[]]+(!+[]+[])[!+[]+!+[]+!+[]]]([+!+[]]+[+!+[]]+[!+[]+!+[]])+(!![]+[])[+[]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]][(![]+[])[+[]]+(!![]+[])[+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+((+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]+[])[+!+[]+[+!+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]())[(![]+[])[+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()+[])[!+[]+!+[]]](+!+[]+[+[]]+(+[![]]+[])[+[]])[+!+[]]+[][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()[(![]+[])[+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()+[])[!+[]+!+[]]]((![]+[])[+!+[]]+(+[![]]+[])[+[]])[+[]]+(![]+[])[+!+[]]+(!![]+[])[+!+[]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]())[(![]+[])[+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()+[])[!+[]+!+[]]](+!+[]+[+[]]+(+[![]]+[])[+[]])[+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[!+[]+!+[]]+(!+[]+[])[!+[]+!+[]+!+[]]]([!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]])+([][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]+[])[[+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]]])()

```
> 6 votes

# Answer
There's *J5h\*t* (proposed name) which is a Turing complete subset of JavaScript, using only the characters

# `[]+=``
> 3 votes

---
Tags: golfing-language
---


title: Dirichlet Convolution Inverse

text:
# Question
Title: Dirichlet Convolution Inverse
If \\$f,g\colon \mathbb{Z}\_{\geq 1} \to \mathbb{R}\\$, the *Dirichlet convolution* of \\$f\\$ and \\$g\\$ is defined by

\\$ \qquad\qquad\qquad \displaystyle (f\*g)(n) = \sum\_{d|n}f(d)g(n/d).\\$

This question asked about computing Dirchlet convolution of functions. The identity element of the Dirichlet convolution is the function

\\$ \qquad\qquad\qquad\qquad\\,\\, e(n)=\begin{cases}1 & n=1 \\ 0 & \text{else}\end{cases}\\$.

If \\$f\*g=e\\$ then \\$f\\$ and \\$g\\$ are convolutional inverses. If \\$f(1)\neq 0\\$ then \\$f\\$ has a convolutional inverse. There is a formula for the inverse:

\\$\qquad \qquad \qquad \qquad\\,\\,\\,\displaystyle g(1)=\frac{1}{f(1)}\\$

\\$\qquad \qquad \qquad\qquad\\,\\, \displaystyle g(n)=\frac{-1}{f(1)}\sum\_{\substack{d|n\\d\<n}} f(n/d)g(d) \qquad \text{for $n\>1$}\\$.

## Task:

Given a list `l` of integers, compute the convolution inverse of `l`. The output should be a list of the same length as `l`. The list `l` represents the function

\\$\qquad\qquad\qquad\qquad\\,\\, f(n) = \begin{cases} \text{The $n$th entry of l} & n \< \text{len(l)} \\ 0 & \text{else} \end{cases}\\$ My test cases are one-indexed because it makes sense in context. If you wish to pad the input and output with an ignored element at the beginning, or make some other modification to support zero indexing, that's fine. Most other i/o formats are probably acceptable. You may assume the output are integers.

## Test Cases

```
Input:  [1, 0, 0, 0, 0, 0, 0]
Output: [1, 0, 0, 0, 0, 0, 0]

Input:  [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
Output: [1, -1, -1, 0, -1, 1, -1, 0, 0, 1, -1, 0, -1, 1, 1, 0, -1, 0, -1, 0]

Input:  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
Output: [1, -2, -3, 0, -5, 6, -7, 0, 0, 10, -11, 0, -13, 14, 15, 0]

Input:  [1, 2, 2, 3, 2, 4, 2, 4, 3, 4, 2, 6, 2, 4, 4, 5]
Output: [1, -2, -2, 1, -2, 4, -2, 0, 1, 4, -2, -2, -2, 4, 4, 0]

Input:  [1, 3, 4, 7, 6, 12, 8, 15, 13, 18, 12, 28, 14, 24, 24, 31, 18, 39]
Output: [1, -3, -4, 2, -6, 12, -8, 0, 3, 18, -12, -8, -14, 24, 24, 0, -18, -9]

Input:  [1, 5, 10, 21, 26, 50, 50, 85, 91, 130]
Output: [1, -5, -10, 4, -26, 50, -50, 0, 9, 130]

Input:  [-1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1]
Output: [-1, -1, 1, -2, 1, 1, 1, -4, 0, 1, 1, 2, 1, 1, -1, -8, 1, 0, 1]

```

# Answer
# MATL, 32 bytes

```
1i1)/Gd"GX@QtZ\3L)/)y7M)*s_G1)/h

```

Try it online! Or verify all test cases.

### How it works

```
1        % Push 1
i        % Take input: f, of size L
1)       % Get its first entry: f(1)
/        % Divide: gives 1/f(1). This is g(1). It will later be expanded into
         % a vector to include g(2), g(3), ... g(L)
G        % Push input again
d        % Consecutuve differences: gives a vector of L-1 numbers
"        % For each: this iterates L-1 times
  G      %   Push input again
  X@Q    %   Push iteration index plus 1: gives 2, 3, ..., L respectively in
         %   each iteration. This is n in the formula for computing g(n)
  t      %   Duplicate
  Z\     %   Divisors of n. Gives a vector with the values of d in the formula
  3L)    %   Remove last. This corresponds to the condition d<n in the formula
  /      %   Divide. Gives a vector with n/d for d<n
  )      %   Index. Gives a vector with f(n/d)
  y      %   Duplicate from below. Pushes a copy of g as built so far
  7M     %   Push vector containing d for d<n, again
  )      %   Index. Gives a vector with g(d)
  *      %   Multiply, element-wise. Gives a vector containing f(n/d)*g(d)
  s      %   Sum
  _      %   Negate
  G      %   Push input again
  1)     %   Get its first entry: f(1)
  /      %   Divide. This gives g(n)
  h      %   Contatenate. This attaches the newly computed g(n) to the vector
         %   containing the previous values of g
         % End (implicit)
         % Display (implicit)

```
> 4 votes

# Answer
# Jelly, ~~30~~ 29 bytes

```
ÆD,U$ị"PṖS×Ḣḣ1N;"@
JḊç@ƒİḢ,ƊḢ

```

Try it online!

I’m sure there’s a golfier way of doing this. A pair of links which is called as a monad with the list of integers as the argument. Returns a list of integers.

## Explanation

### Helper link

Takes n as its left argument and the current pair of outputs for g and f as its right argument

```
ÆD                  | Divisors
  ,U$               | Pair with reversed divisors
     ị"             | Index into lists of g and f values respectively
       P            | Product of g and f terms
        Ṗ           | Remove last item from list
         S          | Sum
          ×         | Multiply by current g and f terms
           Ḣ        | Head
            ḣ1      | First term (i.e. the sum of the product of the specific g and f terms above, multiplied by g(1)), still wrapped in a list
              N     | Negate
               ;"@  | Concatenate to the end of the list of g terms

```

### Main link

```
J           | Sequence along list
 Ḋ          | Remove first item
  ç@ƒ   Ɗ   | Reduce using helper link with reversed arguments and the following as a monad as the initial argument
     İ      | Invert (the initial list of integers)
      Ḣ     | Head
       ,    | Pair with initial list of integers
         Ḣ  | Head (i.e. final list of g values)

```
> 2 votes

# Answer
# Charcoal, 33 bytes

```
ＦＬθ⊞υ∕∨‹ι²±ΣＥυ∧∧λ¬﹪ιλ×§θ÷ιλκ§θ¹Ｉυ

```

Try it online! Link is to verbose version of code. 0-indexed; on input, the 0th element is a dummy, while on output, it's a duplicate. Explanation:

```
ＦＬθ

```

Loop over the indices of the input list.

```
⊞υ

```

Save the results as we go.

```
∕∨...§θ¹

```

Each term is divided by \\$f(1)\\$.

```
‹ι²

```

For the 0th and 1st terms, the numerator is simply `1`.

```
±ΣＥυ∧∧λ¬﹪ιλ×§θ÷ιλκ

```

Otherwise, multiply the terms computed so far whose index is a factor of the current index with the appropriate term from the input, and take the negated sum.

```
Ｉυ

```

Print the results.

Alternative rearrangement, also 33 bytes:

```
Ｉ⊟Ｅθ⊞Ｏυ∕∨‹κ²±ΣＥυ∧∧μ¬﹪κμ×§θ÷κμλ§θ¹

```

Try it online! Link is to verbose version of code.
> 2 votes

# Answer
# JavaScript (ES6),  ~~77 76 70~~  69 bytes

```
a=>a.map((_,n)=>a[~n]=a.reduce(p=>p-=a[n/++d-1]*a[-d]|0,d=!n++)/a[0])

```

Try it online!
> 2 votes

---
Tags: code-golf, number-theory
---