答:
Actually, 29 bytes

There are probably several sections of this code that could be golfed, though I'm not sure where yet. Golfing suggestions welcome. Try it online!

```<code>╗1`X╜$;R=;╝╜yN╜\;╗1<&`╬X╜DY╛&
</code>```

Ungolfing

```<code>          Implicit input n.
╗         Save n to register 0.
1`...`╬   Run the following function on the stack while TOS is truthy.
  X         Discard the previous truthy.
  ╜         Push n from register 0.
  $         Push str(n).
  ;R=       Check if str(n) == str(n)[::-1], i.e. if n is a palindrome.
  ;╝        Save a copy of (is n a palindrome?) to register 1.
  ╜yN       Get the largest prime factor of n.
  ╜\        Divide n by its largest prime factor.
  ;╗        Save a copy of n // l_p_f to register 0.
  1<        Check if 1 < n // l_p_f. This returns 0 only if n // l_p_f is 1.
  &         Logical AND (is n a palindrome?) and (is n // l_p_f > 1?).
            This quits if we have reached a non-palindrome or we have reached 1.
X         Discard the falsey that ended the previous function.
╜         Get the last value saved to register 0 (could be 1 or a non-palindrome // l_p_f)
DY        This returns 1 if register 0 was a 1, else 0.
╛&        Logical AND with register 1 (was the last n a palindrome?) to get our result.
          Implicit return.
</code>```

Title: Find the super palindromes!

Body:
Actually, 29 bytes

There are probably several sections of this code that could be golfed, though I'm not sure where yet. Golfing suggestions welcome. Try it online!

╗1`X╜$;R=;╝╜yN╜\;╗1<&`╬X╜DY╛&

Ungolfing

          Implicit input n.
╗         Save n to register 0.
1`...`╬   Run the following function on the stack while TOS is truthy.
  X         Discard the previous truthy.
  ╜         Push n from register 0.
  $         Push str(n).
  ;R=       Check if str(n) == str(n)[::-1], i.e. if n is a palindrome.
  ;╝        Save a copy of (is n a palindrome?) to register 1.
  ╜yN       Get the largest prime factor of n.
  ╜\        Divide n by its largest prime factor.
  ;╗        Save a copy of n // l_p_f to register 0.
  1<        Check if 1 < n // l_p_f. This returns 0 only if n // l_p_f is 1.
  &         Logical AND (is n a palindrome?) and (is n // l_p_f > 1?).
            This quits if we have reached a non-palindrome or we have reached 1.
X         Discard the falsey that ended the previous function.
╜         Get the last value saved to register 0 (could be 1 or a non-palindrome // l_p_f)
DY        This returns 1 if register 0 was a 1, else 0.
╛&        Logical AND with register 1 (was the last n a palindrome?) to get our result.
          Implicit return.


问:
Find the super palindromes!

Consider the number 99999999. That number is obviously a palindrome.  The largest prime factor of 99999999 is 137. If you divide 99999999 by 137, you get 729927. This number is also a palindrome.

The largest prime factor of 729927 is 101. 729927/101=7227 which again is a palindrome.

The largest prime factor of 7227 is 73. 7227/73=99 which again is a palindrome.

By further dividing by the largest prime factor, you get 9, 3 and finally 1, which, being one-digit numbers, are also palindromes. Since 1 has no prime factors, the procedure ends here.

Now generalizing this observation, I define a super-palindrome as a palindrome which is either 1, or which gives another super-palindrome if divided by its largest prime factor.

Credits: https://math.stackexchange.com/questions/200835/are-there-infinitely-many-super-palindromes

Given a number N, determine if it is a super palindrome or not, and print a truthy or falsey value accordingly.

Your program should print a truthy value for these inputs:

```<code>1
101
121
282
313
353
373
393
474
737
919
959
1331
1441
2882
6446
7887
8668
9559
9779
</code>```

Your program should print a falsey value for these inputs:

```<code>323
432
555
583
585
646
642
696
777
969
989
2112
3553
4554
5242
5225
5445
8080
8118
9988
</code>```

Remember, this is code-golf, so the code with the shortest amount of bytes wins.

答:
Brachylog, 14 bytes

```<code>1|r?$ph:?r/:0&
</code>```

Try it online!

Explanation

This implements the formula explained in the challenge description.

Computing all products of suffixes of the prime factorization and checking that they are all palindromes is 1 byte longer (1|$p:@]f:{*.r}a).

```<code>1                  Input = 1
 |                 OR
  r?               Reversing the Input results in the Input
    $p             Get the prime factors of the Input
      h            Take the first one (the biggest)
       :?r/        Divide the Input by that prime factor
           :0&     Call this predicate recursively with that new number as input
</code>```

ContentLicense: CC BY-SA 3.0

Title: Find the super palindromes!

Body:
Brachylog, 14 bytes

1|r?$ph:?r/:0&

Try it online!

Explanation

This implements the formula explained in the challenge description.

Computing all products of suffixes of the prime factorization and checking that they are all palindromes is 1 byte longer (1|$p:@]f:{*.r}a).

1                  Input = 1
 |                 OR
  r?               Reversing the Input results in the Input
    $p             Get the prime factors of the Input
      h            Take the first one (the biggest)
       :?r/        Divide the Input by that prime factor
           :0&     Call this predicate recursively with that new number as input


问:
Showcase of Languages

Notes

This thread is open and unlocked only because the community decided to make an exception. Please do not use this question as evidence that you can ask similar questions here. Please do not create additional showcase questions.

This is no longer a popularity-contest, nor are snippet lengths limited by the vote tally. If you know this thread from before, please make sure you familiarize yourself with the changes.

This thread is dedicated to showing off interesting, useful, obscure, and/or unique features your favorite programming languages have to offer. This is neither a challenge nor a competition, but a collaboration effort to showcase as many programming languages as possible as well as possible.

How this works

All answers should include the name of the programming language at the top of the post, prefixed by a #.

Answers may contain one (and only one) factoid, i.e., a couple of sentences without code that describe the language.

Aside from the factoid, answers should consist of snippets of code, which can (but don't have to be) programs or functions.

The snippets do not need to be related. In fact, snippets that are too related may be redundant.

Since this is not a contest, all programming languages are welcome, whenever they were created.

Answers that contain more than a handful of code snippets should use a Stack Snippet to collapse everything except the factoid and one of the snippets.

Whenever possible, there should be only one answer per programming language. This is a community wiki, so feel free to add snippets to any answer, even if you haven't created it yourself. There is a Stack Snippet for compressing posts, which should mitigate the effect of the 30,000 character limit.

Answers that predate these guidelines should be edited. Please help updating them as needed.

Current answers, sorted alphabetically by language name

$.ajax({type:"GET",url:"https://api.stackexchange.com/2.2/questions/44680/answers?site=codegolf&filter=withbody",success:function(data){for(var i=0;i<data.items.length;i++){var temp=document.createElement('p');temp.innerHTML = data.items[i].body.split("\n")[0];$('#list').append('
' + temp.innerText || temp.textContent + '');}}})```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><base href="http://codegolf.stackexchange.com"><ul id="list"></ul></code>```

答:
Hexagony

Images created with Timwi's tools with link provided in the Factoid!
The headers Length n Snippet are Try It Online! links :)

Length 5 Snippet - One of the Logic Gates

```<code>?<!@<
</code>```

This is the AND gate, from one of the 16 Logic Gates answer by Martin Ender♦. In his answer, the explanation was left for readers as practise. Well, maybe it's time for the solution:

First ? reads the first input.

If it is 0, then the IP got reflected to NE direction at < and directly wraps "to the left" (as it is <=0) and got printed at !.  Whatever it reads at ?, it wraps and stops at @.

If it is 1, the IP takes the right branch for the "conditional" and hit the "inclined mirror" side of < and got reflected back and hit the "hub" side of < which sends it to W direction to read another input. It then wraps and hit the "horizontal mirror" side of < and gets itself to an implicit-if at the corner. 6 instructions made within this blue path.

The different usages of < are all demostrated in this example.

If the second input is 0, then the IP goes along the red path above, which prints a 0 and reads the "third" input and stops.

If it is a 1 instead, yay we finally got 2 1s for the AND gate! The IP goes along the green path and prints out the 1 and terminates!

Length 3 and Length 4 Snippets - Cats

These 2 are simplified (thus not a very good version) of a cat program. For a real working one, please see here.

```<code>,;~
</code>```

This reads and prints and also outputs a lot of trailing mysterious symbols.  What's happening?

, reads a byte and ; prints it no matter what , gets (If there is no input, , will return a -1 and ; will print it modulo 256 which is 255).

Here is a trick which is useful in creating Hexagons: Using ~ (negation) to control the direction the IP goes before it reaches an if (no matter it is an implicit one or an explicit one like < and > and some other conditionals).

If you find this hard to understand, then it's worth mentioning that this is not a linear loop.  As an exercise imagine the above are put into a 2-hexagon and you'll see why we need ~ to do make a loop with the implicit if :P The code basically runs in the same manner as in the length 2 snippet below!

Thus, when there is a byte, the memory will be positive and ~ makes it negative so it goes back to the top to read another byte.  Yet it won't stop...

So let's see the length 4 version of the cat.

```<code><,@;
</code>```

When you try this, it looks good.  Finally we have one program which stops!

It starts on the top left with an initial value of 0. A trick here which is (again) quite common - deflect the initial IP with <.  This is particularly useful when the main loop should end when the calculated value is <=0.

Here it comes to the blue path. ; prints the null byte (as it is initially 0) and , reads a byte. An implicit-if decides if it should go to the green one (doing nothing and wraps back to the main blue loop for printing this byte) or it should go to the red terminal @.

In some code golf challenges, it is acceptable to have null bytes printed before the desired output.  However this is not the case for the simple cat challenge attached above :P  Also, this does not handle null bytes \0 well.  If you are curious how to do the cat with 6 bytes which handles \0 and prints nothing else and stops, check it out! (The 6 bytes solution is shown after the 7 bytes)

Length 2 Snippet

This won't end. Print all non-negative integers separated by -.

```<code>!(
</code>```

Not really. Indeed this is printing the unintialized edge as number (0), then decrement it and print again without a separator (-1, -2, ...)

This is an illustration of both the Implicit Loop (wrapping) and Implicit If.

The IP starts at !, goes to the right to ( and wraps to... not (directly to) ! but somewhere else first. Because the code is used to fill in the smallest possible hexagon that can hold it:

(Blue) For the existing code, after IP runs ( (decrements) and the memory edge becomes -1, it wraps to the middle row and goes all its way to the corner.

And, as its value is <=0, it goes to the left, which is the top row and we hit ! again which prints -1 and so on...

(Red) And if you change the source code to !), it won't print 01234....  Because when it hits the corner, the memory edge is >0 and it turns to the right option (Pun not intended) which is the lower edge, and the lower edge wraps back to the middle - however all the ops are no-ops so the IP can never escape from the loop.

Length 1 Snippet

```<code>:
</code>```

If you try it, it ends soon and nothing will happen. Well 1 byte snippet in Hexagony can't do much.

: is the division in Hexagony and the result is rounded towards -infty.

Why introduce this? Lemme introduce the Memory Model of this one.  Without loss of generality (it sounds good using Maths phrases), this is the initial Memory Pointer:

Like Instruction Pointers which has an Op which it's currently on (a position) and a direction, the MP also has an edge (which holds a value) and a direction.

The edge on its left is its Left Neighbor (L) and that on right is the Right Neighbor (R).

Like +, -, *, and % (Modulo), : is also calculating L (operation) R.

One "interesting" thing about : and % is that when the Right Neighbor is 0 (the default value of an uninitialized edge), it silently errors out and hence terminating the program.  This behaviour sometimes saves bytes when the termination @ is not used to stop the program.

I have read the answer here which is nice :P I also found some interesting snippets on this site thus I would like to try to get a chance to post them. I love Hexagons!

Factoid

Hexagony, as its name suggests, gives programmers a painful experience (agony) playing with Hexagons, with its Instruction Pointers (IP) and Memory Pointers (MP).  Great thanks to Timwi who created Esoteric IDE for debugging Esoteric Languages and Hexagony Colorer which helps explaining the coupled IP paths.

When an IP goes out of the Hexagon, it wraps (Yup, implicitly looping) as if the Hexagon is used for tiling the ground. (Not exactly the case, because if you really wanna connect all wrapping paths, you would end up their edge overlapped like the graph on the right)

c1234 wraps to 567890 wraps back to c1234...
abcd wraps to efgh and goes on... and we hit a corner.

For corner cases, there will be an Implicit-If, with <=0 is left and >0 is right. Say you (the instruction pointer when you are programming) go all the way efgh.3. to the corner. You are facing East.  You would either wrap to the top which is on your left and the bottom which is on your right.  If the MP is pointing to a memory edge which is <=0 you goes to the top, otherwise you goes to the bottom.

True beauty lies in making use of the implicit features and fitting different parts of the algorithm into Great Hexagonal Unity, with the use of mirrors (always like playing with scientific puzzle solving game).

Title: Showcase of Languages

Body:
Hexagony

Images created with Timwi's tools with link provided in the Factoid!
The headers Length n Snippet are Try It Online! links :)

Length 5 Snippet - One of the Logic Gates

?<!@<

This is the AND gate, from one of the 16 Logic Gates answer by Martin Ender♦. In his answer, the explanation was left for readers as practise. Well, maybe it's time for the solution:

First ? reads the first input.

If it is 0, then the IP got reflected to NE direction at < and directly wraps "to the left" (as it is <=0) and got printed at !.  Whatever it reads at ?, it wraps and stops at @.

If it is 1, the IP takes the right branch for the "conditional" and hit the "inclined mirror" side of < and got reflected back and hit the "hub" side of < which sends it to W direction to read another input. It then wraps and hit the "horizontal mirror" side of < and gets itself to an implicit-if at the corner. 6 instructions made within this blue path.

The different usages of < are all demostrated in this example.

If the second input is 0, then the IP goes along the red path above, which prints a 0 and reads the "third" input and stops.

If it is a 1 instead, yay we finally got 2 1s for the AND gate! The IP goes along the green path and prints out the 1 and terminates!

Length 3 and Length 4 Snippets - Cats

These 2 are simplified (thus not a very good version) of a cat program. For a real working one, please see here.

,;~

This reads and prints and also outputs a lot of trailing mysterious symbols.  What's happening?

, reads a byte and ; prints it no matter what , gets (If there is no input, , will return a -1 and ; will print it modulo 256 which is 255).

Here is a trick which is useful in creating Hexagons: Using ~ (negation) to control the direction the IP goes before it reaches an if (no matter it is an implicit one or an explicit one like < and > and some other conditionals).

If you find this hard to understand, then it's worth mentioning that this is not a linear loop.  As an exercise imagine the above are put into a 2-hexagon and you'll see why we need ~ to do make a loop with the implicit if :P The code basically runs in the same manner as in the length 2 snippet below!

Thus, when there is a byte, the memory will be positive and ~ makes it negative so it goes back to the top to read another byte.  Yet it won't stop...

So let's see the length 4 version of the cat.

<,@;

When you try this, it looks good.  Finally we have one program which stops!

It starts on the top left with an initial value of 0. A trick here which is (again) quite common - deflect the initial IP with <.  This is particularly useful when the main loop should end when the calculated value is <=0.

Here it comes to the blue path. ; prints the null byte (as it is initially 0) and , reads a byte. An implicit-if decides if it should go to the green one (doing nothing and wraps back to the main blue loop for printing this byte) or it should go to the red terminal @.

In some code golf challenges, it is acceptable to have null bytes printed before the desired output.  However this is not the case for the simple cat challenge attached above :P  Also, this does not handle null bytes \0 well.  If you are curious how to do the cat with 6 bytes which handles \0 and prints nothing else and stops, check it out! (The 6 bytes solution is shown after the 7 bytes)

Length 2 Snippet

This won't end. Print all non-negative integers separated by -.

!(

Not really. Indeed this is printing the unintialized edge as number (0), then decrement it and print again without a separator (-1, -2, ...)

This is an illustration of both the Implicit Loop (wrapping) and Implicit If.

The IP starts at !, goes to the right to ( and wraps to... not (directly to) ! but somewhere else first. Because the code is used to fill in the smallest possible hexagon that can hold it:

(Blue) For the existing code, after IP runs ( (decrements) and the memory edge becomes -1, it wraps to the middle row and goes all its way to the corner.

And, as its value is <=0, it goes to the left, which is the top row and we hit ! again which prints -1 and so on...

(Red) And if you change the source code to !), it won't print 01234....  Because when it hits the corner, the memory edge is >0 and it turns to the right option (Pun not intended) which is the lower edge, and the lower edge wraps back to the middle - however all the ops are no-ops so the IP can never escape from the loop.

Length 1 Snippet

:

If you try it, it ends soon and nothing will happen. Well 1 byte snippet in Hexagony can't do much.

: is the division in Hexagony and the result is rounded towards -infty.

Why introduce this? Lemme introduce the Memory Model of this one.  Without loss of generality (it sounds good using Maths phrases), this is the initial Memory Pointer:

Like Instruction Pointers which has an Op which it's currently on (a position) and a direction, the MP also has an edge (which holds a value) and a direction.

The edge on its left is its Left Neighbor (L) and that on right is the Right Neighbor (R).

Like +, -, *, and % (Modulo), : is also calculating L (operation) R.

One "interesting" thing about : and % is that when the Right Neighbor is 0 (the default value of an uninitialized edge), it silently errors out and hence terminating the program.  This behaviour sometimes saves bytes when the termination @ is not used to stop the program.

I have read the answer here which is nice :P I also found some interesting snippets on this site thus I would like to try to get a chance to post them. I love Hexagons!

Factoid

Hexagony, as its name suggests, gives programmers a painful experience (agony) playing with Hexagons, with its Instruction Pointers (IP) and Memory Pointers (MP).  Great thanks to Timwi who created Esoteric IDE for debugging Esoteric Languages and Hexagony Colorer which helps explaining the coupled IP paths.

When an IP goes out of the Hexagon, it wraps (Yup, implicitly looping) as if the Hexagon is used for tiling the ground. (Not exactly the case, because if you really wanna connect all wrapping paths, you would end up their edge overlapped like the graph on the right)

c1234 wraps to 567890 wraps back to c1234...
abcd wraps to efgh and goes on... and we hit a corner.

For corner cases, there will be an Implicit-If, with <=0 is left and >0 is right. Say you (the instruction pointer when you are programming) go all the way efgh.3. to the corner. You are facing East.  You would either wrap to the top which is on your left and the bottom which is on your right.  If the MP is pointing to a memory edge which is <=0 you goes to the top, otherwise you goes to the bottom.

True beauty lies in making use of the implicit features and fitting different parts of the algorithm into Great Hexagonal Unity, with the use of mirrors (always like playing with scientific puzzle solving game).


问:
Print the Greek alphabet in words
This is different from Print the Greek alphabet! because it is in words.

This is different from "Hello, World!" because the output is different and much longer, leading to different techniques.

This is different from We're no strangers to code golf, you know the rules, and so do I because the output is different and much shorter, leading to different techniques.

Your task is to print this exact text: (the Greek alphabet in words)

```<code>alpha beta gamma delta epsilon zeta eta theta iota kappa lambda mu nu xi omicron pi rho sigma tau upsilon phi chi psi omega
</code>```

Capitalization does not matter.

Remember, this is code-golf, so the code with the smallest number of bytes wins.

答:
Scala, 76 bytes

```<code>print((913 to 937)filter(930!=)map(Character getName _ drop 21)mkString " ")
</code>```

Explanation:

```<code>print(                  //print...
  (913 to 937)            //build a range of the codepoints for aplha to omega
  filter(930!=)           //filter out that sigma in the middle
  map(                    //map each char...
    Character getName _     //to its full unicode name, e.g. "GREEK CAPITAL LETTER ALPHA"
    drop 21                 //and drop the first 21 chars, aka "GREEK CAPITAL LETTER "
  )
  mkString " "            //join them with a space
)
</code>```

Title: Print the Greek alphabet in words

Body:
Scala, 76 bytes

print((913 to 937)filter(930!=)map(Character getName _ drop 21)mkString " ")

Explanation:

print(                  //print...
  (913 to 937)            //build a range of the codepoints for aplha to omega
  filter(930!=)           //filter out that sigma in the middle
  map(                    //map each char...
    Character getName _     //to its full unicode name, e.g. "GREEK CAPITAL LETTER ALPHA"
    drop 21                 //and drop the first 21 chars, aka "GREEK CAPITAL LETTER "
  )
  mkString " "            //join them with a space
)


问:
Fill in the Minesweeper clues
Minesweeper is a popular puzzle game where you must discover which tiles are "mines" without clicking on those tiles. Each tile is either a mine (represented by *) or a clue, i.e. a number from 0 to 8 representing how many of the 8 neighboring tiles are mines. Your task today is to take a board containing the mines and fill in all of the clues. For example, look at the following 5x4 board, with 5 mines:

```<code> *
*  *
  *
    *
</code>```

After filling in the clues, the board will look like this:

```<code>2*211
*33*1
12*32
0112*
</code>```

Details

You must write either a full-program or a function that takes in a grid of characters containing only spaces and asterisks and outputs another grid where each space is replaced with the number of adjacent mines (asterisks). Any of these are acceptable formats for your grids:

A string with newlines in it

A 2D list of characters/single character strings

A list of strings

You can assume the grid will be at least 1x1, although it is possible for it to be all mines or all spaces.

The input grid will always be padded with the appropriate number of spaces. As usual, this is code-golf, so standard loopholes apply and the shortest answer in bytes wins!

Sample IO

So that you can see the whitespace, I will show all sample IO with brackets around it.

```<code>Input:
[    * ]
[*     ]
[      ]
[      ]
[  **  ]
[ *  * ]

Output:
[1101*1]
[*10111]
[110000]
[012210]
[12**21]
[1*33*1]

Input:
[****]
[****]

Output:
[****]
[****]

Input:
[   ]
[   ]
[   ]
[   ]

Output:
[000]
[000]
[000]
[000]

Input:
[*   ]
[**  ]
[    ]
[   *]

Ouput:
[*310]
[**10]
[2221]
[001*]

Input:
[**    ]
[*    *]
[  *   ]
[      ]
[*     ]
[****  ]

Output:
[**1011]
[*4211*]
[12*111]
[121100]
[*43210]
[****10]

Input:
[     *    ]
[        * ]
[     *    ]
[**   ***  ]
[      *** ]
[          ]
[       ** ]
[  * *     ]
[*      ** ]
[       ** ]

Output:
[00001*1111]
[00002221*1]
[22102*4321]
[**102***31]
[221013***1]
[0000013542]
[0112111**1]
[12*2*12442]
[*212112**2]
[1100002**2]
</code>```

答:
JavaScript (ES6), <s>114</s> 96 bytes

```<code>a=>a.map((s,i)=>s.replace(/ /g,(_,j)=>g(k=>(s=a[i+k])?g(k=>s[j+k]>' '):0)),g=f=>f(-1)+f(0)+f(1))
</code>```

Edit: Saved 18 bytes thanks to an idea by @ETHproductions.

Title: Fill in the Minesweeper clues

Body:
JavaScript (ES6), <s>114</s> 96 bytes

a=>a.map((s,i)=>s.replace(/ /g,(_,j)=>g(k=>(s=a[i+k])?g(k=>s[j+k]>' '):0)),g=f=>f(-1)+f(0)+f(1))

Edit: Saved 18 bytes thanks to an idea by @ETHproductions.


问:
Find the maximum deviation
This problem is "inspired" from a question that was originally asked on Quora (not for code golfing). I just want to make it a challenge for you guys (and my first problem submission here).

Given an array of integer elements v and an integer d (we assume that d is lower or equal to the array's length), consider all the sequences of d consecutive elements in the array. For each sequence, compute the difference between the maximum and minimum value of the elements in that sequence and name it the deviation.

Your task is to write a program or function that computes the maximum value among all deviations of all the sequences considered above, and return or output that value.

Worked-through Example:

```<code>v: (6,9,4,7,4,1)
d: 3

The sequences of length 3 are:
6,9,4 with deviation 5
9,4,7 with deviation 5
4,7,4 with deviation 3
7,4,1 with deviation 6

Thus the maximal deviation is 6, so the output is 6.
</code>```

This is code golf, so the shortest answer in bytes wins.

答:
q, 25 bytes

```<code>{max mmax[y;x]-mmin[y;x]}
</code>```

mmax and mmin are sliding window maximum and minimum respectively

Example

```<code>q){max mmax[y;x]-mmin[y;x]}[6 9 4 7 4 1;3]
6
</code>```

Title: Find the maximum deviation

Body:
q, 25 bytes

{max mmax[y;x]-mmin[y;x]}

mmax and mmin are sliding window maximum and minimum respectively

Example

q){max mmax[y;x]-mmin[y;x]}[6 9 4 7 4 1;3]
6


问:
Let's get ready for Halloween
I don't know about you all but I'm not preparing for Halloween––never did never will––but, my neighbor is, so we'll help her out.

She needs help figuring out which brand of candy she has, but she has so much candy she would not be able to finish before Halloween.

She has:

Snickers

KitKat

Starburst

GummyBears

Twix

Input

A multiline string (or any other reasonable form) containing only letters and spaces.

Output

A falsy value if it is not a valid candy, or which candy it is if it is a candy.

How to decide which candy it is

A candy is valid if it says one of the above brands on it. However, it's not that simple, because this is a valid candy:

```<code>K i t
       K a
           t
</code>```

A valid candy is one where:

the letters are in order from left to right

the letters are capitalized correctly

the letters, going from left to right, do not both ascend and descend

the letters with whitespace removed form one of the above brands

This is code-golf, so shortest code in byte wins!

Examples

Truthys:

```<code>1.
              kers
           c
        i
       n
    S

2.
  Kit K a t

3.
St a
    r b u
         r st

4.
         Bear s
G ummy

5.
T w i
                          x
</code>```

Falsys:

```<code>1.
SNICKERS

2.
 C   n

   a   d y

3.
xiwT

4.
S C I
       ss o
              r       s

5.
Kit
Kat
</code>```

答:
JavaScript (ES6), 139 bytes

```<code>a=>/^(Snickers|KitKat|Starburst|GummyBears|Twix)$/.test(a.reduce((s,t)=>s.replace(/./g,(c,i)=>c<'!'?t[i]:t[i]<'!'?c:'!')).replace(/ /g,''))
</code>```

Accepts input as an array of space-padded strings.

Title: Let's get ready for Halloween

Body:
JavaScript (ES6), 139 bytes

a=>/^(Snickers|KitKat|Starburst|GummyBears|Twix)$/.test(a.reduce((s,t)=>s.replace(/./g,(c,i)=>c<'!'?t[i]:t[i]<'!'?c:'!')).replace(/ /g,''))

Accepts input as an array of space-padded strings.


答:
C#, 131 bytes

here is a verbose linq solution

```<code>int c(int[]a){var x=from j in Enumerable.Range(0,a.Length-2)let p=new[]{a[j],a[j+1],a[j+2]}select p.Max()-p.Min();return x.Max();}
</code>```

Title: Find the maximum deviation

Body:
This problem is "inspired" from a question that was originally asked on Quora (not for code golfing). I just want to make it a challenge for you guys (and my first problem submission here).

Given an array of integer elements v and an integer d (we assume that d is lower or equal to the array's length), consider all the sequences of d consecutive elements in the array. For each sequence, compute the difference between the maximum and minimum value of the elements in that sequence and name it the deviation.

Your task is to write a program or function that computes the maximum value among all deviations of all the sequences considered above, and return or output that value.

Worked-through Example:

```<code>v: (6,9,4,7,4,1)
d: 3

The sequences of length 3 are:
6,9,4 with deviation 5
9,4,7 with deviation 5
4,7,4 with deviation 3
7,4,1 with deviation 6

Thus the maximal deviation is 6, so the output is 6.
</code>```

This is code golf, so the shortest answer in bytes wins.

Body:
C#, 131 bytes

here is a verbose linq solution

int c(int[]a){var x=from j in Enumerable.Range(0,a.Length-2)let p=new[]{a[j],a[j+1],a[j+2]}select p.Max()-p.Min();return x.Max();}


答:
Mathematica, 51 bytes

```<code>#<2||PalindromeQ@#&&#0[#/FactorInteger[#][[-1,1]]]&
</code>```

Recursive anonymous function. Takes a number as input and returns True or False as output.

Title: Find the super palindromes!

Body:
Consider the number 99999999. That number is obviously a palindrome.  The largest prime factor of 99999999 is 137. If you divide 99999999 by 137, you get 729927. This number is also a palindrome.

The largest prime factor of 729927 is 101. 729927/101=7227 which again is a palindrome.

The largest prime factor of 7227 is 73. 7227/73=99 which again is a palindrome.

By further dividing by the largest prime factor, you get 9, 3 and finally 1, which, being one-digit numbers, are also palindromes. Since 1 has no prime factors, the procedure ends here.

Now generalizing this observation, I define a super-palindrome as a palindrome which is either 1, or which gives another super-palindrome if divided by its largest prime factor.

Credits: https://math.stackexchange.com/questions/200835/are-there-infinitely-many-super-palindromes

Given a number N, determine if it is a super palindrome or not, and print a truthy or falsey value accordingly.

Your program should print a truthy value for these inputs:

```<code>1
101
121
282
313
353
373
393
474
737
919
959
1331
1441
2882
6446
7887
8668
9559
9779
</code>```

Your program should print a falsey value for these inputs:

```<code>323
432
555
583
585
646
642
696
777
969
989
2112
3553
4554
5242
5225
5445
8080
8118
9988
</code>```

Remember, this is code-golf, so the code with the shortest amount of bytes wins.

Body:
Mathematica, 51 bytes

#<2||PalindromeQ@#&&#0[#/FactorInteger[#][[-1,1]]]&

Recursive anonymous function. Takes a number as input and returns True or False as output.


答:
MATL, <s>18</s> 17 bytes

Thanks to @mbomb007 for a correction in the input of test case 6

```<code>32>t3Y6Z+-6b(48+c
</code>```

Input is a 2D char array, in the format

```<code>[' *   '; '*  * '; '  *  '; '    *']
</code>```

Try it online!

Test cases: 1,
 2, 3, 4, 5, 6.

Explanation

```<code>32>      % Input 2D char array implicitly. Transform it into a 2D logical
         % array with asterisk replaced by true and space by false
t        % Duplicate
3Y6      % Push [1 1 1; 1 0 1; 1 1 1]. This defines the neighbourhood
Z+       % 2D convolution, keeping size. Gives the number of neighbouring
         % mines for each position
-6       % Push -6
b        % Bubble up in stack
(        % Assign -6 to the entries indicated by the logical array, i.e.
         % to the positions that originally contained asterisks
48+      % Add 48. This transforms each number of neighbouring mines
         % into its ASCII code, and -6 into 42 (ASCII code of asterisk)
c        % Convert to char. Display implicitly
</code>```

Title: Fill in the Minesweeper clues

Body:
Minesweeper is a popular puzzle game where you must discover which tiles are "mines" without clicking on those tiles. Each tile is either a mine (represented by *) or a clue, i.e. a number from 0 to 8 representing how many of the 8 neighboring tiles are mines. Your task today is to take a board containing the mines and fill in all of the clues. For example, look at the following 5x4 board, with 5 mines:

```<code> *
*  *
  *
    *
</code>```

After filling in the clues, the board will look like this:

```<code>2*211
*33*1
12*32
0112*
</code>```

Details

You must write either a full-program or a function that takes in a grid of characters containing only spaces and asterisks and outputs another grid where each space is replaced with the number of adjacent mines (asterisks). Any of these are acceptable formats for your grids:

A string with newlines in it

A 2D list of characters/single character strings

A list of strings

You can assume the grid will be at least 1x1, although it is possible for it to be all mines or all spaces.

The input grid will always be padded with the appropriate number of spaces. As usual, this is code-golf, so standard loopholes apply and the shortest answer in bytes wins!

Sample IO

So that you can see the whitespace, I will show all sample IO with brackets around it.

```<code>Input:
[    * ]
[*     ]
[      ]
[      ]
[  **  ]
[ *  * ]

Output:
[1101*1]
[*10111]
[110000]
[012210]
[12**21]
[1*33*1]

Input:
[****]
[****]

Output:
[****]
[****]

Input:
[   ]
[   ]
[   ]
[   ]

Output:
[000]
[000]
[000]
[000]

Input:
[*   ]
[**  ]
[    ]
[   *]

Ouput:
[*310]
[**10]
[2221]
[001*]

Input:
[**    ]
[*    *]
[  *   ]
[      ]
[*     ]
[****  ]

Output:
[**1011]
[*4211*]
[12*111]
[121100]
[*43210]
[****10]

Input:
[     *    ]
[        * ]
[     *    ]
[**   ***  ]
[      *** ]
[          ]
[       ** ]
[  * *     ]
[*      ** ]
[       ** ]

Output:
[00001*1111]
[00002221*1]
[22102*4321]
[**102***31]
[221013***1]
[0000013542]
[0112111**1]
[12*2*12442]
[*212112**2]
[1100002**2]
</code>```

Body:
MATL, <s>18</s> 17 bytes

Thanks to @mbomb007 for a correction in the input of test case 6

32>t3Y6Z+-6b(48+c

Input is a 2D char array, in the format

[' *   '; '*  * '; '  *  '; '    *']

Try it online!

Test cases: 1,
 2, 3, 4, 5, 6.

Explanation

32>      % Input 2D char array implicitly. Transform it into a 2D logical
         % array with asterisk replaced by true and space by false
t        % Duplicate
3Y6      % Push [1 1 1; 1 0 1; 1 1 1]. This defines the neighbourhood
Z+       % 2D convolution, keeping size. Gives the number of neighbouring
         % mines for each position
-6       % Push -6
b        % Bubble up in stack
(        % Assign -6 to the entries indicated by the logical array, i.e.
         % to the positions that originally contained asterisks
48+      % Add 48. This transforms each number of neighbouring mines
         % into its ASCII code, and -6 into 42 (ASCII code of asterisk)
c        % Convert to char. Display implicitly


答:
Python 2, 192 bytes

-3 bytes thanks to Copper, -10 bytes if modifying the input grid is allowed, another -11 bytes by getting rid of continue and another -12 bytes for eliminating the counter variable

def f(L):
 n,S,s=len(L[0]),[0,1,2],[' '];P=[s*(n+2)];K=P+[s+x+s for x in L]+P
 for y in range(len(L)):
    for x in range(n):
     if'*'!=L[y][x]:L[y][x]=`sum(K[y+d][x+e]=='*'for d in S for e in S)`
```

<p>Uses a list of list of characters <code>L</code> and creates a padded version <code>K</code>, so no problem at boundaries. Indentation is </p>

<ol>
<li>Space</li>
<li>Tab</li>
<li>Tab+Space</li>
<li>Tab+Tab</li>
</ol>

<p>Usage:</p>

<pre class="lang-python prettyprint-override"><code>s=""" *
*  *
  *
    *"""
print s
s=[[c for c in x] for x in s.split('\n')]
f(s)
s='\n'.join([ ''.join(x) for x in s])
print s
</code>```

Title: Fill in the Minesweeper clues

Body:
Python 2, 192 bytes

-3 bytes thanks to Copper, -10 bytes if modifying the input grid is allowed, another -11 bytes by getting rid of continue and another -12 bytes for eliminating the counter variable

def f(L):
 n,S,s=len(L[0]),[0,1,2],[' '];P=[s*(n+2)];K=P+[s+x+s for x in L]+P
 for y in range(len(L)):
    for x in range(n):
     if'*'!=L[y][x]:L[y][x]=`sum(K[y+d][x+e]=='*'for d in S for e in S)`

Uses a list of list of characters L and creates a padded version K, so no problem at boundaries. Indentation is

Space

Tab

Tab+Space

Tab+Tab

Usage:

s=""" *
*  *
  *
    *"""
print s
s=[[c for c in x] for x in s.split('\n')]
f(s)
s='\n'.join([ ''.join(x) for x in s])
print s


答:
05AB1E, <s>9</s> 8 bytes

Saved a byte thanks to Adnan.

```<code>Ò.pPDíïQ
</code>```

Try it online!

Explanation

n = 7227 used as example

```<code>Ò           # prime factors with duplicates
            # STACK: [3, 3, 11, 73]
 .p         # prefixes
            # STACK: [[3], [3, 3], [3, 3, 11], [3, 3, 11, 73]]
   P        # product
            # STACK: [3, 9, 99, 7227]
    D       # duplicate
            # STACK: [3, 9, 99, 7227], [3, 9, 99, 7227]
     í      # reverse each
            # STACK: [3, 9, 99, 7227], ['3', '9', '99', '7227']
      ï     # convert to  int
            # STACK: [3, 9, 99, 7227], [3, 9, 99, 7227]
       Q    # check for equality
            # STACK: 1
            # implicit output
</code>```

Title: Find the super palindromes!

Body:
05AB1E, <s>9</s> 8 bytes

Saved a byte thanks to Adnan.

Ò.pPDíïQ

Try it online!

Explanation

n = 7227 used as example

Ò           # prime factors with duplicates
            # STACK: [3, 3, 11, 73]
 .p         # prefixes
            # STACK: [[3], [3, 3], [3, 3, 11], [3, 3, 11, 73]]
   P        # product
            # STACK: [3, 9, 99, 7227]
    D       # duplicate
            # STACK: [3, 9, 99, 7227], [3, 9, 99, 7227]
     í      # reverse each
            # STACK: [3, 9, 99, 7227], ['3', '9', '99', '7227']
      ï     # convert to  int
            # STACK: [3, 9, 99, 7227], [3, 9, 99, 7227]
       Q    # check for equality
            # STACK: 1
            # implicit output


答:
Scala, 138 bytes

```<code>def?(n:Int):Int={val p=Stream.from(2).filter(n%_==0)(0)
if(p==n)n else?(n/p)}
def s(i:Int):Boolean=i<2||(i+"")==(i+"").reverse&&s(i/ ?(i))
</code>```

Ungolfed:

```<code>def largestFactor(n:Int):Int={
  val p=Stream.from(2).filter(n%_==0).head
  if(p==n)n else largestFactor(n/p)}
def superPalindrome(i:Int):Boolean=i<2||(i+"")==(i+"").reverse&&superPalindrome(i/ largestFactor(i))
</code>```

Explanation:

```<code>def?(n:Int):Int={                       //define a method for the largest prime factor
  val p=Stream.from(2).filter(n%_==0)(0)  //find the first factor of n
  if(p==n)n else?(n/p)                    //if it's n, return n else the next factor
}
def s(i:Int):Boolean=                     //method for the superprime
  i<2                                     //if s<2 return true
  ||                                      //else return:
    (i+"")==(i+"").reverse                  //is i a palindrome
    &&                                      //and
    s(i/ ?(i))                              //is i divided by it's largestPrimeFactor a superpalindrome
</code>```

Title: Find the super palindromes!

Body:
Scala, 138 bytes

def?(n:Int):Int={val p=Stream.from(2).filter(n%_==0)(0)
if(p==n)n else?(n/p)}
def s(i:Int):Boolean=i<2||(i+"")==(i+"").reverse&&s(i/ ?(i))

Ungolfed:

def largestFactor(n:Int):Int={
  val p=Stream.from(2).filter(n%_==0).head
  if(p==n)n else largestFactor(n/p)}
def superPalindrome(i:Int):Boolean=i<2||(i+"")==(i+"").reverse&&superPalindrome(i/ largestFactor(i))

Explanation:

def?(n:Int):Int={                       //define a method for the largest prime factor
  val p=Stream.from(2).filter(n%_==0)(0)  //find the first factor of n
  if(p==n)n else?(n/p)                    //if it's n, return n else the next factor
}
def s(i:Int):Boolean=                     //method for the superprime
  i<2                                     //if s<2 return true
  ||                                      //else return:
    (i+"")==(i+"").reverse                  //is i a palindrome
    &&                                      //and
    s(i/ ?(i))                              //is i divided by it's largestPrimeFactor a superpalindrome


答:
JavaScript (ES6), 78 bytes

```<code>(n,d=2,p=1)=>n%d?n<2||f(n,d+1,p):[...p=p*d+''].reverse().join``==p&&f(n/d,d,p)
</code>```

Recursively builds the prime factorisation prefixes and checks them for palindromicity.

Title: Find the super palindromes!

Body:
JavaScript (ES6), 78 bytes

(n,d=2,p=1)=>n%d?n<2||f(n,d+1,p):[...p=p*d+''].reverse().join``==p&&f(n/d,d,p)

Recursively builds the prime factorisation prefixes and checks them for palindromicity.


问:
No strings (or numbers) attached
If you like this, consider participating in:

The Official Dyalog APL 2016 Year Game

The monthly Dyalog APL 2017 Code Golf Challenge

Make 12 snippets/expressions, in the same language, that result in the numbers 0 through 10, and 42 respectively, but without writing any literal numeric, string, or character data.

Build-in data, like PI() and ALPHABET(), are fine, and so are e.g. CJam's U, X, Y, Z, and A constants, and Processing's BLEND, CHORD, CENTER, BREAK, and  LINES.

Every snippet must be able to stand on its own, i.e. they may not be interdependent. However, inside a single snippet, you may assign a variable and use it freely, as long as you refer to it directly by name, and not through a string containing its name.

All the snippets must be valid on the submitter’s computer at the time of submission (as reported by SE), but may not rely on unusual local conditions like number of files in a directory, the exact date or time, or specific input from the user.

Examples of valid snippets

3: INT(LOG10(YEAR(TODAY())))   because it remains true in the foreseeable future

4: CUBICROOT(LEN(CHARACTERSET()))   because a 256 letter character set is very common

8: SQRT(SYSTEMTYPE())   because 64-bit systems are very common

Examples of invalid snippets

5: LEN(USERNAME())   because most people do not use “Admin” as login :-)

9: LOG10(SYSTEMMEMORY())   because it only works on systems with exactly 1 GB of memory

42: CODE("*")   because it contains a string/character literal

The result of each snippet must result in an actual number (value, int, float, etc.) that can be used for further calculations using the same language as the snippet, i.e not a text string representing that number.

Only character based languages allowed.

Score is total byte count of all the 12 snippets combined. Newlines separating the snippets are not counted in.

Note that the above rules may prevent some languages from participating, even if they are Turing complete.

FAQ

Q Can the programs accept any input?

A Yes, but you may not just ask for input and enter the relevant number.

Q Are physical digits (non-data) digits allowed?

A Yes, e.g. LOG10().

Q Do Symbols in Ruby count as literals?

A Yes.

Q Does score include newlines between each snippet?

A No.

Q Is TI-BASIC "character based" enough to be valid?

A Yes.

Q Do false and true count as number literals?

A No, they are acceptable.

Q Can we use a number literal to call a function if that's the only way and the number doesn't influence the output of the function?

A Yes, if that is the normal way to write code in your language.

Q My language assumes there is a [something] at the start of each program/expression. Must I include it, or should my snippets just work if placed in the middle of a program/expression?

A They should just work in the middle of a program/expression.

Q What about regex literals?

A Forbidden, except for languages that only do regexes.

Q Is one piece of code that could print all the specified numbers acceptable?

A No, they have to be separate and mutually independent.

Q May I assume a boilerplate like int main() {}... or equivalent?

A Yes.

Q What output datatypes are allowed?

A Any numeric datatype, like int, float, etc.

Q Do I need to print the result of each snippet?

A No, making the result available for subsequent use is enough.

Q Are pre-set variables allowed?

A Yes, and they become reset (if changed) for every snippet.

Q Are π and e considered number literals?

A No, you may use them.

Q May I return 4 and 2 in different cells for 42?

A No, they must be connected as one number.

Q Bytes or characters?

A Bytes, but you may choose any desired codepage.

Q May constant functions and preset variables like J's 9:, Actually's 9, and Pretzel's 9 be used?

A Yes, if the vocabulary is finite (19 for J, 10 for Actually and Pretzel).

答:
Racket 205 bytes

```<code>(- pi pi)
(/ pi pi)
(/(+ pi pi)pi)
(floor pi)
(ceiling pi)
(sub1(floor(+ pi pi)))
(floor(+ pi pi))
(ceiling(+ pi pi))
(floor(sub1(* pi pi)))
(floor(* pi pi))
(ceiling(* pi pi))
(floor(+ pi pi(expt pi pi)))
</code>```

Output:

```<code>0.0
1.0
2.0
3.0
4.0
5.0
6.0
7.0
8.0
9.0
10.0
42.0
</code>```

Title: No strings (or numbers) attached

Body:
Racket 205 bytes

(- pi pi)
(/ pi pi)
(/(+ pi pi)pi)
(floor pi)
(ceiling pi)
(sub1(floor(+ pi pi)))
(floor(+ pi pi))
(ceiling(+ pi pi))
(floor(sub1(* pi pi)))
(floor(* pi pi))
(ceiling(* pi pi))
(floor(+ pi pi(expt pi pi)))

Output:

0.0
1.0
2.0
3.0
4.0
5.0
6.0
7.0
8.0
9.0
10.0
42.0


答:
Python 2, 138 bytes

```<code>def f(s):w=s.find('\n')+1;print''.join([c,`(s[i-(i>0):i+2]+(w*' '+s)[i-1:i+2]+s[i-1+w:i+2+w]).count('*')`][c==' ']for i,c in enumerate(s))
</code>```

Defines a function f that accepts an input string like

```<code>"  *\n** \n*  \n"
</code>```

and prints a string to STDOUT:

```<code>23*
**2
*31
</code>```

Title: Fill in the Minesweeper clues

Body:
Python 2, 138 bytes

def f(s):w=s.find('\n')+1;print''.join([c,`(s[i-(i>0):i+2]+(w*' '+s)[i-1:i+2]+s[i-1+w:i+2+w]).count('*')`][c==' ']for i,c in enumerate(s))

Defines a function f that accepts an input string like

"  *\n** \n*  \n"

and prints a string to STDOUT:

23*
**2
*31


问:
Output the ALONED numbers
Consider the natural sequence up-to 6 (disregard 1):

```<code>2,3,4,5,6
</code>```

We start scanning from the left (in this case from 2), search for a number divisible by 2 (here 4) and then remove both the numbers from the list (here 2 & 4), such that the list reduces to:

```<code>3,5,6
</code>```

We continue the same process, here leftmost is 3, so we search for number divisible by 3. 6 is surely that number and thus 3 and 6 are removed,

```<code>5
</code>```

Now, no further such searches can be made Thus, this becomes the list of ALONED numbers for n=6.

OBJECTIVE

Given a number n greater than 1, print all the corresponding aloned numbers.

INPUT

```<code>2
6
15
20
22
</code>```

OUTPUT

```<code>2
5
8,9,11,12,13,15
11,12,13,15,17,19,20
12,13,15,17,19,20,21
</code>```

YET ANOTHER WORKED OUT EXAMPLE

For n= 22

```<code>=>2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22
=>3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22 (remove 2 & 4)
=>5,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22 (remove 3 & 6)
=>7,8,9,11,12,13,14,15,16,17,18,19,20,21,22 (remove 5 & 10)
=>8,9,11,12,13,15,16,17,18,19,20,21,22 (remove 7 & 14)
=>9,11,12,13,15,17,18,19,20,21,22 (remove 8 & 16)
=>11,12,13,15,17,19,20,21,22 (remove 9 & 18)
=>12,13,15,17,19,20,21 (remove 11 & 22) (OUTPUT)
</code>```

This is code-golf, so the shortest code in bytes wins.

答:
PHP, 98 Bytes

```<code>foreach($r=range(2,$argv[1])as$v)$a=&$r[$v-2]&&$b=&$r[$v*2-2]?$b=$a="":(!$a?:print$x?",$a":$x=$a);
</code>```

8 Bytes save by @Titus Thank You

If a trailing comma is allowed then it can be shorten 9 Bytes
(!$a?:print"$a,"); instead of (!$a?:print$x?",$a":$x=$a);

Title: Output the ALONED numbers

Body:
PHP, 98 Bytes

foreach($r=range(2,$argv[1])as$v)$a=&$r[$v-2]&&$b=&$r[$v*2-2]?$b=$a="":(!$a?:print$x?",$a":$x=$a);

8 Bytes save by @Titus Thank You

If a trailing comma is allowed then it can be shorten 9 Bytes
(!$a?:print"$a,"); instead of (!$a?:print$x?",$a":$x=$a);


答:
JavaScript (ES6), 107

Input/output as an array of strings

```<code>f=l=>l.map((r,i)=>r.replace(/ /g,(c,j)=>(s=r=>(c+r).substr(j,3).split`*`.length,s(l[i-1])+s(l[i+1])+s(r)-3)))
</code>```

note when the function s is called with an element of the list l out of the bounds, the parameter a is undefined and c+a will result in " undefined" thanks to the quirky conversion rules of javascript

More readable

```<code>l=>
  l.map(
    (r,i) =>
      r.replace(/ /g, (c,j) =>
        (
          s = a => (c+a).substr(j,3).split`*`.length,
          s(l[i-1])+s(l[i+1])+s(r)-3
        )
      )
  )
</code>```

Title: Fill in the Minesweeper clues

Body:
JavaScript (ES6), 107

Input/output as an array of strings

f=l=>l.map((r,i)=>r.replace(/ /g,(c,j)=>(s=r=>(c+r).substr(j,3).split`*`.length,s(l[i-1])+s(l[i+1])+s(r)-3)))

note when the function s is called with an element of the list l out of the bounds, the parameter a is undefined and c+a will result in " undefined" thanks to the quirky conversion rules of javascript

More readable

l=>
  l.map(
    (r,i) =>
      r.replace(/ /g, (c,j) =>
        (
          s = a => (c+a).substr(j,3).split`*`.length,
          s(l[i-1])+s(l[i+1])+s(r)-3
        )
      )
  )


问:
Can I take your order: a Chipotle concept conund

Challenge

Your program will take in a string from stdin, and output multiple lines to stdout.

An example of input looks like this:

My favorite Chipotle order:

B1113YNNY

Let's break it down:

The first character is either A (burrito), or B (burrito bowl).

The second character is 1 (black beans), or 2 (pinto beans).

The third character is either 1 (white rice), or 2 (brown rice).

The fourth character is either 1 (chicken), 2 (sofritas), or 3 (steak).

The fifth character is either 1 (mild salsa), 2 (medium salsa), or 3 (hot salsa).

The last four characters are Y if they want the item, or N otherwise:

character 6 is corn

character 7 is guacamole

character 8 is sour cream

character 9 is cheese

A working program for this challenge will output this to stdout:

burrito bowl with:

  black beans

  white rice

  chicken

  hot salsa

  corn

  cheese

Replace the above words with the words acquired from input.

Clarifications.

Standard loopholes are disallowed.

You may only get input from stdin, and only put output to stdout.

答:
Racket 544 bytes

```<code>(let*((s(read-line))(l(string->list s))(lr list-ref)(d displayln)(p display)(c -1)(g(λ()(set! c(+ 1 c))(lr l c))))
(match(g)[#\A(d"burrito with:")][#\B(d"burrito bowl with:")])(match(g)[#\1(d"black beans")][#\2(d"pinto beans")])
(match(g)[#\1(d"white rice")][#\2(d"brown rice")])(match(g)[#\1(d"chicken")][#\2(d"sofritas")][#\3(d"steak")])
(match(g)[#\1(p"mild ")][#\2(p"medium ")][#\3(p"hot ")])(d"salsa")(match(g)[#\Y(d"corn")][#\N""])
(match(g)[#\Y(d"guacamole")][#\N""])(match(g)[#\Y(d"sour cream")][#\N""])(match(g)[#\Y(d"cheese")][#\N""]))
</code>```

Ungolfed:

```<code>(define (f)
  (let* ((s (read-line))
         (l (string->list s))
         (lr list-ref)
         (d displayln)
         (p display)
         (c -1)
         (g (lambda() (set! c (add1 c)) (lr l c))))
    (match (g)
      [#\A (d "burrito with:")]
      [#\B (d "burrito bowl with:")])
    (match (g)
      [#\1 (d "black beans")]
      [#\2 (d "pinto beans")])
    (match (g)
      [#\1 (d "white rice")]
      [#\2 (d "brown rice")])
    (match (g)
      [#\1 (d "chicken")]
      [#\2 (d "sofritas")]
      [#\3 (d "steak")])
    (match (g)
      [#\1 (p "mild ")]
      [#\2 (p "medium ")]
      [#\3 (p "hot ")])
    (d "salsa")
    (match (g)
      [#\Y (d "corn")]
      [#\N ""])
    (match (g)
      [#\Y (d "guacamole")]
      [#\N ""])
    (match (g)
      [#\Y (d "sour cream")]
      [#\N ""])
    (match (g)
      [#\Y (d "cheese")]
      [#\N ""])))
</code>```

Testing:

```<code>(f)

burrito bowl with:
black beans
white rice
chicken
hotsalsa
corn
cheese
</code>```

Body:
Racket 544 bytes

(let*((s(read-line))(l(string->list s))(lr list-ref)(d displayln)(p display)(c -1)(g(λ()(set! c(+ 1 c))(lr l c))))
(match(g)[#\A(d"burrito with:")][#\B(d"burrito bowl with:")])(match(g)[#\1(d"black beans")][#\2(d"pinto beans")])
(match(g)[#\1(d"white rice")][#\2(d"brown rice")])(match(g)[#\1(d"chicken")][#\2(d"sofritas")][#\3(d"steak")])
(match(g)[#\1(p"mild ")][#\2(p"medium ")][#\3(p"hot ")])(d"salsa")(match(g)[#\Y(d"corn")][#\N""])
(match(g)[#\Y(d"guacamole")][#\N""])(match(g)[#\Y(d"sour cream")][#\N""])(match(g)[#\Y(d"cheese")][#\N""]))

Ungolfed:

(define (f)
  (let* ((s (read-line))
         (l (string->list s))
         (lr list-ref)
         (d displayln)
         (p display)
         (c -1)
         (g (lambda() (set! c (add1 c)) (lr l c))))
    (match (g)
      [#\A (d "burrito with:")]
      [#\B (d "burrito bowl with:")])
    (match (g)
      [#\1 (d "black beans")]
      [#\2 (d "pinto beans")])
    (match (g)
      [#\1 (d "white rice")]
      [#\2 (d "brown rice")])
    (match (g)
      [#\1 (d "chicken")]
      [#\2 (d "sofritas")]
      [#\3 (d "steak")])
    (match (g)
      [#\1 (p "mild ")]
      [#\2 (p "medium ")]
      [#\3 (p "hot ")])
    (d "salsa")
    (match (g)
      [#\Y (d "corn")]
      [#\N ""])
    (match (g)
      [#\Y (d "guacamole")]
      [#\N ""])
    (match (g)
      [#\Y (d "sour cream")]
      [#\N ""])
    (match (g)
      [#\Y (d "cheese")]
      [#\N ""])))

Testing:

(f)

burrito bowl with:
black beans
white rice
chicken
hotsalsa
corn
cheese


Title: Can I take your order: a Chipotle concept conund

Body:
Challenge

Your program will take in a string from stdin, and output multiple lines to stdout.

An example of input looks like this:

My favorite Chipotle order:

B1113YNNY

Let's break it down:

The first character is either A (burrito), or B (burrito bowl).

The second character is 1 (black beans), or 2 (pinto beans).

The third character is either 1 (white rice), or 2 (brown rice).

The fourth character is either 1 (chicken), 2 (sofritas), or 3 (steak).

The fifth character is either 1 (mild salsa), 2 (medium salsa), or 3 (hot salsa).

The last four characters are Y if they want the item, or N otherwise:

character 6 is corn

character 7 is guacamole

character 8 is sour cream

character 9 is cheese

A working program for this challenge will output this to stdout:

burrito bowl with:

  black beans

  white rice

  chicken

  hot salsa

  corn

  cheese

Replace the above words with the words acquired from input.

Clarifications.

Standard loopholes are disallowed.

You may only get input from stdin, and only put output to stdout.

Body:
PHP, 301 Bytes

<?="burrito".($i=$_GET[a])[0]>A?" bowl":""," with:\n".[black,pinto][$i[1]>1]." beans\n".[white,brown][$i[2]>1]." rice\n".[_,chicken,sofritas,steak][$i[3]]."\n".[_,mild,medium,hot][$i[4]]." salsa".["","\ncorn"][$i[5]>N].["","\nguacamole"][$i[6]>N].["","\nsour cream"][$i[7]>N].["","\ncheese"][$i[8]>N];

Previous version 311 Bytes

<?printf("burrito%s with:\n%s beans\n%s rice\n%s\n%s salsa%s%s%s%s",($i=$_GET[a])[0]>A?" bowl":"",[black,pinto][$i[1]>1],[white,brown][$i[2]>1],[_,chicken,sofritas,steak][$i[3]],[_,mild,medium,hot][$i[4]],["","\ncorn"][$i[5]>N],["","\nguacamole"][$i[6]>N],["","\nsour cream"][$i[7]>N],["","\ncheese"][$i[8]>N]);


问:
Create output twice the length of the code

The Challenge

Write a complete program that writes twice as many bytes to standard output as the length of the program.

Rules

The program must write ASCII characters to the standard output.

The contents of the output doesn't matter.

The output, measured in bytes, must be exactly twice the length of the program, also measured in bytes, unless you fulfill the bonus.

Any trailing newline is included in the output's byte count.

Bonus

Your program can optionally take a number, n, as input. If so, the output must be exactly n * program length bytes. You can assume that n will always be a positive integer. If no input is provided, n must default to 2.

If you do this,  you can subtract 25 bytes from your score.

Shortest program wins.

Restrictions

No standard loopholes.

The program must be at least 1 byte long.

No adding unnecessary whitespace to the source code to change its length. Similarly, comments don't count.

Unless you fulfill the bonus, the program must accept no input. If you do fulfill the bonus, the integer must be the only input.

Lowest score (program length in bytes - bonus) wins.

The shortest answer for each language wins for that language.

Leaderboards

Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.

To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:

```<code># Language Name, N bytes
</code>```

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

```<code># Ruby, <s>104</s> <s>101</s> 96 bytes
</code>```

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

```<code># Perl, 43 + 2 (-p flag) = 45 bytes
</code>```

You can also make the language name a link which will then show up in the leaderboard snippet:

```<code># [><>](http://esolangs.org/wiki/Fish), 121 bytes
</code>```

var QUESTION_ID=59436,OVERRIDE_USER=41505;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\-?\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\-?\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}</code>```

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

```

答:
s-lang, 30 bytes

```<code>t[][sssssssssssssss]t[s][ssss]
</code>```

Link

Body:
s-lang, 30 bytes

t[][sssssssssssssss]t[s][ssss]

Link


答:
JavaScript (ES6), <s>223</s> 203 bytes

```<code>f=(a,g=a=>a[0].map?`<${a.map(g).join`|`}>`:a.join` `,s=g([a]),r=[s],t=s.replace(/<[ -9|]*>|[ -9]/g,s=>s[1]?s.replace(/./g,c=>c>`9`?`+`:`-`):` `))=>t<`+`?r.join`\n`.replace(/<|>/g,`|`):f(a,g,t,[t,...r,t])
</code>```

Port of @MitchSchwartz's Ruby solution. Previous version which worked by recursively wrapping the arrays (and therefore worked for arbitrary content, not just integers):

```<code>f=(...a)=>a[0]&&a[0].map?[s=`+${(a=a.map(a=>f(...a))).map(a=>a[0].replace(/./g,`-`)).join`+`}+`,...[...Array(Math.max(...a.map(a=>a.length)))].map((_,i)=>`|${a.map(a=>a[i]||a[0].replace(/./g,` `)).join`|`}|`),s]:[a.join` `]
</code>```

Note: Although I'm using the spread operator in my argument list, to obtain the desired output, provide a single parameter of the original array rather then trying to spread the array; this has the effect of wrapping the output in the desired outer box. Sadly the outer box costs me 18 bytes, and space-separating the integers costs me 8 bytes, otherwise the following alternative visualisation would suffice for 197 bytes:

```<code>f=a=>a.map?[s=`+${(a=a.map(f)).map(a=>a[0].replace(/./g,`-`)).join`+`}+`,...[...Array(Math.max(0,...a.map(a=>a.length)))].map((_,i)=>`|${a.map(a=>a[i]||a[0].replace(/./g,` `)).join`|`}|`),s]:[``+a]
</code>```

Title: Visualize an Array

Body:
Given an array of any depth, draw its contents with borders of +-| around each subarray. Those are the ASCII characters for plus, minus, and vertical pipe.

For example, if the array is [1, 2, 3], draw

```<code>+-----+
|1 2 3|
+-----+
</code>```

For a nested array such as [[1, 2, 3], [4, 5], [6, 7, 8]], draw

```<code>+-----------------+
|+-----+---+-----+|
||1 2 3|4 5|6 7 8||
|+-----+---+-----+|
+-----------------+
</code>```

For a ragged array such as [[[1, 2, 3], [4, 5]], [6, 7, 8]], draw

```<code>+-------------------+
|+-----------+-----+|
||+-----+---+|6 7 8||
|||1 2 3|4 5||     ||
||+-----+---+|     ||
|+-----------+-----+|
+-------------------+
</code>```

Notice that there is more space after drawing [6, 7, 8]. You may either draw the contents on the top-most, center, or bottom-most line, but whichever you choose, you must remain consistent.

This challenge was inspired by the box verb < from J.

Rules

This is code-golf so the shortest code wins.

Builtins that solve this are not allowed.

The input array will contain only nonnegative integer values or arrays. Each array will be homogenous, meaning that its elements will either by only arrays or only integers, but never a mix of both.

Each subarray may be nested to any depth.

The output may either by as a string or as an array of strings where each string is a line of output.

Test Cases

```<code>[]
++
||
++

[[], []]
+---+
|+++|
|||||
|+++|
+---+

[[], [1], [], [2], [], [3], []]
+-----------+
|++-++-++-++|
|||1||2||3|||
|++-++-++-++|
+-----------+

[[[[[0]]]]]
+---------+
|+-------+|
||+-----+||
|||+---+|||
||||+-+||||
|||||0|||||
||||+-+||||
|||+---+|||
||+-----+||
|+-------+|
+---------+

[[[[[4, 3, 2, 1]]]], [[[3, 2, 1]]], [[2, 1]], [1]]
+---------------------------------+
|+-------------+---------+-----+-+|
||+-----------+|+-------+|+---+|1||
|||+---------+|||+-----+|||2 1|| ||
||||+-------+|||||3 2 1|||+---+| ||
|||||4 3 2 1|||||+-----+||     | ||
||||+-------+|||+-------+|     | ||
|||+---------+||         |     | ||
||+-----------+|         |     | ||
|+-------------+---------+-----+-+|
+---------------------------------+
</code>```

Body:
JavaScript (ES6), <s>223</s> 203 bytes

f=(a,g=a=>a[0].map?`<${a.map(g).join`|`}>`:a.join` `,s=g([a]),r=[s],t=s.replace(/<[ -9|]*>|[ -9]/g,s=>s[1]?s.replace(/./g,c=>c>`9`?`+`:`-`):` `))=>t<`+`?r.join`\n`.replace(/<|>/g,`|`):f(a,g,t,[t,...r,t])

Port of @MitchSchwartz's Ruby solution. Previous version which worked by recursively wrapping the arrays (and therefore worked for arbitrary content, not just integers):

f=(...a)=>a[0]&&a[0].map?[s=`+${(a=a.map(a=>f(...a))).map(a=>a[0].replace(/./g,`-`)).join`+`}+`,...[...Array(Math.max(...a.map(a=>a.length)))].map((_,i)=>`|${a.map(a=>a[i]||a[0].replace(/./g,` `)).join`|`}|`),s]:[a.join` `]

Note: Although I'm using the spread operator in my argument list, to obtain the desired output, provide a single parameter of the original array rather then trying to spread the array; this has the effect of wrapping the output in the desired outer box. Sadly the outer box costs me 18 bytes, and space-separating the integers costs me 8 bytes, otherwise the following alternative visualisation would suffice for 197 bytes:

f=a=>a.map?[s=`+${(a=a.map(f)).map(a=>a[0].replace(/./g,`-`)).join`+`}+`,...[...Array(Math.max(0,...a.map(a=>a.length)))].map((_,i)=>`|${a.map(a=>a[i]||a[0].replace(/./g,` `)).join`|`}|`),s]:[``+a]


问:
Where's the 0xBEEF?
This challenge was inspired by this Wendy's commercial from 1984.

Illustration by T S Rogers

Your task is to find a hexadecimal 0xBEEF on a binary bun.

The 'beef' consists of the following pattern:

```<code>1 0 1 1  (0xB)
1 1 1 0  (0xE)
1 1 1 0  (0xE)
1 1 1 1  (0xF)
</code>```

And the 'bun' consists of a 12x12 binary matrix, such as:

```<code>1 1 1 0 0 1 1 1 1 1 1 0
1 1 0 1 0 0 1 0 0 0 0 0
0 1 0 0 0 1 1 1 1 1 0 1
1 0 0 1 0 0 1 0 0 1 0 0
1 0 0 1 0 1 1 0 0 1 1 1
1 1 1 1 1 1 0 0 0 0 1 0
1 1 0 1 1 1 0 0 0 0 0 1
1 0 0 1 1 1 1 0 0 0 0 1
1 0 0 1 1 1 0 1 1 1 1 1
1 1 1 1 1 0 0 1 1 1 1 1
1 0 0 0 0 1 0 1 0 1 1 1
1 1 0 0 1 1 0 0 0 0 1 1
</code>```

Input

Your program or function will take the binary matrix as input. The matrix format is very flexible, but it must be clearly described in your answer.

For instance:

a single binary string, with or without separators between the rows:

"111001111110 110100100000..."

or:

"111001111110110100100000..."

an array of binary strings:

["111001111110", "110100100000", ...]

an array of numbers (each number describing a row once converted back to binary and left-padded with zeros):

[3710, 3360, ...]

Output

The coordinates (X, Y) of the 'beef', (0, 0) being the top left corner of the bun.

Alternatively, you may use 1-based coordinates (but not a mix of both formats, like 0-based for X and 1-based for Y).

For the above example, the expected answer is (3, 4) (0-based) or (4, 5) (1-based):

```<code>   00 01 02 03 04 05 06 07 08 09 10 11
00  1  1  1  0  0  1  1  1  1  1  1  0
01  1  1  0  1  0  0  1  0  0  0  0  0
02  0  1  0  0  0  1  1  1  1  1  0  1
03  1  0  0  1  0  0  1  0  0  1  0  0
04  1  0  0 [1  0  1  1] 0  0  1  1  1
05  1  1  1 [1  1  1  0] 0  0  0  1  0
06  1  1  0 [1  1  1  0] 0  0  0  0  1
07  1  0  0 [1  1  1  1] 0  0  0  0  1
08  1  0  0  1  1  1  0  1  1  1  1  1
09  1  1  1  1  1  0  0  1  1  1  1  1
10  1  0  0  0  0  1  0  1  0  1  1  1
11  1  1  0  0  1  1  0  0  0  0  1  1
</code>```

Again, any reasonable format would work as long as it is specified in your answer. Please also mention if you're using 0-based or 1-based coordinates.

Rules

You can safely assume that there is always exactly one 'beef' on the bun. Your code is not required to support cases with more than one beef or no beef at all.

The beef pattern will always appear as described. It will never be rotated or mirrored in any way.

This is code-golf, so the shortest answer in bytes wins. Standard loopholes are forbidden.

Test cases

In the following test cases, each row of the matrix is expressed as its decimal representation.

```<code>Input : [ 3710, 3360, 1149, 2340, 2407, 4034, 3521, 2529, 2527, 3999, 2135, 3267 ]
Output: [ 3, 4 ]

Input : [ 1222, 3107, 1508, 3997, 1906, 379, 2874, 2926, 1480, 1487, 3565, 633 ]
Output: [ 3, 7 ]

Input : [ 2796, 206, 148, 763, 429, 1274, 2170, 2495, 42, 1646, 363, 1145 ]
Output: [ 6, 4 ]

Input : [ 3486, 3502, 1882, 1886, 2003, 1442, 2383, 2808, 1416, 1923, 2613, 519 ]
Output: [ 1, 1 ]

Input : [ 3661, 2382, 2208, 1583, 1865, 3969, 2864, 3074, 475, 2382, 1838, 127 ]
Output: [ 8, 8 ]

Input : [ 361, 1275, 3304, 2878, 3733, 3833, 3971, 3405, 2886, 448, 3101, 22 ]
Output: [ 0, 3 ]

Input : [ 3674, 2852, 1571, 3582, 1402, 3331, 1741, 2678, 2076, 2685, 734, 261 ]
Output: [ 7, 7 ]
</code>```

答:
Jelly, <s>20</s> <s>17</s> 16 bytes

```<code>ṡ€4ḄZw€“¿ÇÇÐ‘ĖUṀ
</code>```

Input is in form of a Boolean matrix, output is the 1-based index pair (Y, X).

Try it online! or verify all test cases.

How it works

```<code>ṡ€4ḄZw€“¿ÇÇÐ‘ĖUṀ  Main link. Argument: M (2D array of Booleans)

ṡ€4               Split each row into 9 chunks of length 4.
   Ḅ              Convert these chunks from base 2 to integer.
    Z             Zip/transpose. This places the columns of generated integers
                  into the rows of the matrix to comb through them.
       “¿ÇÇÐ‘     Push the array of code points (in Jelly's code page) of these
                  characters, i.e., 0xB, 0xE, 0xE, and 0xF.
     w€           Window-index each; in each row, find the index of the contiguous
                  subarray [0xB, 0xE, 0xE, 0xF] (0 if not found).
                  Since the matrix contains on one BEEF, this will yield an array
                  of zeroes, with a single non-zero Y at index X.
             Ė    Enumerate; prefix each integer with its index.
              U   Upend; reverse the pairs to brings the zeroes to the beginning.
               Ṁ  Take the maximum. This yields the only element with positive
                  first coordinate, i.e., the pair [Y, X].
</code>```

ContentLicense: CC BY-SA 4.0

Title: Where's the 0xBEEF?

Body:
Jelly, <s>20</s> <s>17</s> 16 bytes

ṡ€4ḄZw€“¿ÇÇÐ‘ĖUṀ

Input is in form of a Boolean matrix, output is the 1-based index pair (Y, X).

<a href="http://jelly.tryitonline.net/#code=4bmh4oKsNOG4hFp34oKs4oCcwr_Dh8OHw5DigJjEllXhuYA&input=&args=WzEsMSwxLDAsMCwxLDEsMSwxLDEsMSwwXSwgWzEsMSwwLDEsMCwwLDEsMCwwLDAsMCwwXSwgWzAsMSwwLDAsMCwxLDEsMSwxLDEsMCwxXSwgWzEsMCwwLDEsMCwwLDEsMCwwLDEsMCwwXSwgWzEsMCwwLDEsMCwxLDEsMCwwLDEsMSwxXSwgWzEsMSwxLDEsMSwxLDAsMCwwLDAsMSwwXSwgWzEsMSwwLDEsMSwxLDAsMCwwLDAsMCwxXSwgWzEsMCwwLDEsMSwxLDEsMCwwLDAsMCwxXSwgWzEsMCwwLDEsMSwxLDAsMSwxLDEsMSwxXSwgWzEsMSwxLDEsMSwwLDAsMSwxLDEsMSwxXSwgWzEsMCwwLDAsMCwxLDAsMSwwLDEsMSwxXSwgWzEsMSwwLDAsMSwxLDAsMCwwLDAsMSwxXQ">Try it online! or <a href="http://jelly.tryitonline.net/#code=4bmh4oKsNOG4hFp34oKs4oCcwr_Dh8OHw5DigJjEllXhuYAKfDQwOTZC4biK4oKsw4fCteKCrEc&input=&args=WwogWyAzNzEwLCAzMzYwLCAxMTQ5LCAyMzQwLCAyNDA3LCA0MDM0LCAzNTIxLCAyNTI5LCAyNTI3LCAzOTk5LCAyMTM1LCAzMjY3IF0sCiBbIDEyMjIsIDMxMDcsIDE1MDgsIDM5OTcsIDE5MDYsIDM3OSwgMjg3NCwgMjkyNiwgMTQ4MCwgMTQ4NywgMzU2NSwgNjMzIF0sCiBbIDI3OTYsIDIwNiwgMTQ4LCA3NjMsIDQyOSwgMTI3NCwgMjE3MCwgMjQ5NSwgNDIsIDE2NDYsIDM2MywgMTE0NSBdLAogWyAzNDg2LCAzNTAyLCAxODgyLCAxODg2LCAyMDAzLCAxNDQyLCAyMzgzLCAyODA4LCAxNDE2LCAxOTIzLCAyNjEzLCA1MTkgXSwKIFsgMzY2MSwgMjM4MiwgMjIwOCwgMTU4MywgMTg2NSwgMzk2OSwgMjg2NCwgMzA3NCwgNDc1LCAyMzgyLCAxODM4LCAxMjcgXSwKIFsgMzYxLCAxMjc1LCAzMzA0LCAyODc4LCAzNzMzLCAzODMzLCAzOTcxLCAzNDA1LCAyODg2LCA0NDgsIDMxMDEsIDIyIF0sCiBbIDM2NzQsIDI4NTIsIDE1NzEsIDM1ODIsIDE0MDIsIDMzMzEsIDE3NDEsIDI2NzgsIDIwNzYsIDI2ODUsIDczNCwgMjYxIF0KXQ">verify all test cases.

How it works

ṡ€4ḄZw€“¿ÇÇÐ‘ĖUṀ  Main link. Argument: M (2D array of Booleans)

ṡ€4               Split each row into 9 chunks of length 4.
   Ḅ              Convert these chunks from base 2 to integer.
    Z             Zip/transpose. This places the columns of generated integers
                  into the rows of the matrix to comb through them.
       “¿ÇÇÐ‘     Push the array of code points (in Jelly's code page) of these
                  characters, i.e., 0xB, 0xE, 0xE, and 0xF.
     w€           Window-index each; in each row, find the index of the contiguous
                  subarray [0xB, 0xE, 0xE, 0xF] (0 if not found).
                  Since the matrix contains on one BEEF, this will yield an array
                  of zeroes, with a single non-zero Y at index X.
             Ė    Enumerate; prefix each integer with its index.
              U   Upend; reverse the pairs to brings the zeroes to the beginning.
               Ṁ  Take the maximum. This yields the only element with positive
                  first coordinate, i.e., the pair [Y, X].


答:
vim, <s>126</s> <s>80</s> <s>77</s> 76

```<code>/\v1011\_.{9}(1110\_.{9}){2}1111<cr>:exe'norm Go'.join(getpos('.'))<cr>xxdawhPXXd{
</code>```

Expects input in the form

```<code>111001111110
110100100000
010001111101
100100100100
100101100111
111111000010
110111000001
100111100001
100111011111
111110011111
100001010111
110011000011
</code>```

And outputs (with 1-based indices) as

```<code>4 5
</code>```

```<code>/                      regex search for...
\v                     enable "very magic" mode (less escaping)
1011\_.{9}             find the first line ("B"), followed by 8 chars + 1 \n
(1110\_.{9}){2}        find the second and third lines ("EE")
1111<cr>               find the fourth line ("F")
:exe'norm Go'.         insert at the beginning of the file...
join(getpos('.'))<cr>  the current position of the cursor
xxdawhPXX              do some finagling to put the numbers in the right order
d{                     delete the input
</code>```

Thanks to Jörg Hülsermann for indirectly saving 46 bytes by making me realize my regex was super dumb, and to DJMcMayhem for 3 more bytes.

Title: Where's the 0xBEEF?

Body:
This challenge was inspired by this Wendy's commercial from 1984.

Illustration by T S Rogers

Your task is to find a hexadecimal 0xBEEF on a binary bun.

The 'beef' consists of the following pattern:

```<code>1 0 1 1  (0xB)
1 1 1 0  (0xE)
1 1 1 0  (0xE)
1 1 1 1  (0xF)
</code>```

And the 'bun' consists of a 12x12 binary matrix, such as:

```<code>1 1 1 0 0 1 1 1 1 1 1 0
1 1 0 1 0 0 1 0 0 0 0 0
0 1 0 0 0 1 1 1 1 1 0 1
1 0 0 1 0 0 1 0 0 1 0 0
1 0 0 1 0 1 1 0 0 1 1 1
1 1 1 1 1 1 0 0 0 0 1 0
1 1 0 1 1 1 0 0 0 0 0 1
1 0 0 1 1 1 1 0 0 0 0 1
1 0 0 1 1 1 0 1 1 1 1 1
1 1 1 1 1 0 0 1 1 1 1 1
1 0 0 0 0 1 0 1 0 1 1 1
1 1 0 0 1 1 0 0 0 0 1 1
</code>```

Input

Your program or function will take the binary matrix as input. The matrix format is very flexible, but it must be clearly described in your answer.

For instance:

a single binary string, with or without separators between the rows:

"111001111110 110100100000..."

or:

"111001111110110100100000..."

an array of binary strings:

["111001111110", "110100100000", ...]

an array of numbers (each number describing a row once converted back to binary and left-padded with zeros):

[3710, 3360, ...]

Output

The coordinates (X, Y) of the 'beef', (0, 0) being the top left corner of the bun.

Alternatively, you may use 1-based coordinates (but not a mix of both formats, like 0-based for X and 1-based for Y).

For the above example, the expected answer is (3, 4) (0-based) or (4, 5) (1-based):

```<code>   00 01 02 03 04 05 06 07 08 09 10 11
00  1  1  1  0  0  1  1  1  1  1  1  0
01  1  1  0  1  0  0  1  0  0  0  0  0
02  0  1  0  0  0  1  1  1  1  1  0  1
03  1  0  0  1  0  0  1  0  0  1  0  0
04  1  0  0 [1  0  1  1] 0  0  1  1  1
05  1  1  1 [1  1  1  0] 0  0  0  1  0
06  1  1  0 [1  1  1  0] 0  0  0  0  1
07  1  0  0 [1  1  1  1] 0  0  0  0  1
08  1  0  0  1  1  1  0  1  1  1  1  1
09  1  1  1  1  1  0  0  1  1  1  1  1
10  1  0  0  0  0  1  0  1  0  1  1  1
11  1  1  0  0  1  1  0  0  0  0  1  1
</code>```

Again, any reasonable format would work as long as it is specified in your answer. Please also mention if you're using 0-based or 1-based coordinates.

Rules

You can safely assume that there is always exactly one 'beef' on the bun. Your code is not required to support cases with more than one beef or no beef at all.

The beef pattern will always appear as described. It will never be rotated or mirrored in any way.

This is code-golf, so the shortest answer in bytes wins. Standard loopholes are forbidden.

Test cases

In the following test cases, each row of the matrix is expressed as its decimal representation.

```<code>Input : [ 3710, 3360, 1149, 2340, 2407, 4034, 3521, 2529, 2527, 3999, 2135, 3267 ]
Output: [ 3, 4 ]

Input : [ 1222, 3107, 1508, 3997, 1906, 379, 2874, 2926, 1480, 1487, 3565, 633 ]
Output: [ 3, 7 ]

Input : [ 2796, 206, 148, 763, 429, 1274, 2170, 2495, 42, 1646, 363, 1145 ]
Output: [ 6, 4 ]

Input : [ 3486, 3502, 1882, 1886, 2003, 1442, 2383, 2808, 1416, 1923, 2613, 519 ]
Output: [ 1, 1 ]

Input : [ 3661, 2382, 2208, 1583, 1865, 3969, 2864, 3074, 475, 2382, 1838, 127 ]
Output: [ 8, 8 ]

Input : [ 361, 1275, 3304, 2878, 3733, 3833, 3971, 3405, 2886, 448, 3101, 22 ]
Output: [ 0, 3 ]

Input : [ 3674, 2852, 1571, 3582, 1402, 3331, 1741, 2678, 2076, 2685, 734, 261 ]
Output: [ 7, 7 ]
</code>```

Body:
vim, <s>126</s> <s>80</s> <s>77</s> 76

/\v1011\_.{9}(1110\_.{9}){2}1111<cr>:exe'norm Go'.join(getpos('.'))<cr>xxdawhPXXd{

Expects input in the form

111001111110
110100100000
010001111101
100100100100
100101100111
111111000010
110111000001
100111100001
100111011111
111110011111
100001010111
110011000011

And outputs (with 1-based indices) as

4 5

/                      regex search for...
\v                     enable "very magic" mode (less escaping)
1011\_.{9}             find the first line ("B"), followed by 8 chars + 1 \n
(1110\_.{9}){2}        find the second and third lines ("EE")
1111<cr>               find the fourth line ("F")
:exe'norm Go'.         insert at the beginning of the file...
join(getpos('.'))<cr>  the current position of the cursor
xxdawhPXX              do some finagling to put the numbers in the right order
d{                     delete the input

Thanks to Jörg Hülsermann for indirectly saving 46 bytes by making me realize my regex was super dumb, and to DJMcMayhem for 3 more bytes.


答:
PHP, 87 Bytes

binary string as input without separators, returns zero-indexed values.

```<code>preg_match("#1011(.{8}1110){2}.{8}1111#",$argv[1],$c,256);echo($s=$c[0][1])%12,$s/12^0;
</code>```

array of numbers as input 128 Bytes

```<code><?foreach($_GET[a]as$a)$b.=sprintf("%012b",$a);preg_match("#1011(.{8}1110){2}.{8}1111#",$b,$c,256);echo($s=$c[0][1])%12,$s/12^0;
</code>```

14 Bytes saved by @Titus Thank You

Title: Where's the 0xBEEF?

Body:
PHP, 87 Bytes

binary string as input without separators, returns zero-indexed values.

preg_match("#1011(.{8}1110){2}.{8}1111#",$argv[1],$c,256);echo($s=$c[0][1])%12,$s/12^0;

array of numbers as input 128 Bytes

<?foreach($_GET[a]as$a)$b.=sprintf("%012b",$a);preg_match("#1011(.{8}1110){2}.{8}1111#",$b,$c,256);echo($s=$c[0][1])%12,$s/12^0;

14 Bytes saved by @Titus Thank You


答:
JavaScript (ES6), <s>63</s> <s>60</s> 56 bytes

```<code>s=>[(i=s.search(/1011.{9}(1110.{9}){2}1111/))%13,i/13|0]
</code>```

Takes input as a 155-character space-delimited string of 12 12-digit binary strings, returns zero-indexed values. Edit: Saved 3 bytes thanks to @JörgHülsermann. Saved 4 bytes thanks to @ETHproductions.

Title: Where's the 0xBEEF?

Body:
JavaScript (ES6), <s>63</s> <s>60</s> 56 bytes

s=>[(i=s.search(/1011.{9}(1110.{9}){2}1111/))%13,i/13|0]

Takes input as a 155-character space-delimited string of 12 12-digit binary strings, returns zero-indexed values. Edit: Saved 3 bytes thanks to @JörgHülsermann. Saved 4 bytes thanks to @ETHproductions.


答:
Ruby, 112

Takes and returns a string. String must be newline separated and newline terminated.

```<code>->s{w=1+s=~/\n/
s.size.times{|i|s[i]==' '&&(n=0;9.times{|j|(s+$/*w)[i+j%3-1+j/3*w-w]==?*&&n+=1};s[i])=n.to_s}
s}
</code>```

in test program

```<code>f=->s{
  w=(s=~/\n/)+1                              #Calculate width.
  s.size.times{|i|                           #For each char in s
    s[i]==' '&&(                             #If it is a space
      n=0                                    #set counter n to 0 and visit
      9.times{|j|                            #a 3x3 square of chars.
        (s+$/*w)[i+j%3-1+j/3*w-w]==?*&&n+=1  #If *, increment n.
      }                                      #(Pad s with w newlines to avoid *'s detected by wraparound.)
      s[i]=n.to_s                            #Write n back to s in string format
    )
  }
s}                                           #Return s.

puts f[
" *
*  *
  *
    *
"]
</code>```

Title: Fill in the Minesweeper clues

Body:
Minesweeper is a popular puzzle game where you must discover which tiles are "mines" without clicking on those tiles. Each tile is either a mine (represented by *) or a clue, i.e. a number from 0 to 8 representing how many of the 8 neighboring tiles are mines. Your task today is to take a board containing the mines and fill in all of the clues. For example, look at the following 5x4 board, with 5 mines:

```<code> *
*  *
  *
    *
</code>```

After filling in the clues, the board will look like this:

```<code>2*211
*33*1
12*32
0112*
</code>```

Details

You must write either a full-program or a function that takes in a grid of characters containing only spaces and asterisks and outputs another grid where each space is replaced with the number of adjacent mines (asterisks). Any of these are acceptable formats for your grids:

A string with newlines in it

A 2D list of characters/single character strings

A list of strings

You can assume the grid will be at least 1x1, although it is possible for it to be all mines or all spaces.

The input grid will always be padded with the appropriate number of spaces. As usual, this is code-golf, so standard loopholes apply and the shortest answer in bytes wins!

Sample IO

So that you can see the whitespace, I will show all sample IO with brackets around it.

```<code>Input:
[    * ]
[*     ]
[      ]
[      ]
[  **  ]
[ *  * ]

Output:
[1101*1]
[*10111]
[110000]
[012210]
[12**21]
[1*33*1]

Input:
[****]
[****]

Output:
[****]
[****]

Input:
[   ]
[   ]
[   ]
[   ]

Output:
[000]
[000]
[000]
[000]

Input:
[*   ]
[**  ]
[    ]
[   *]

Ouput:
[*310]
[**10]
[2221]
[001*]

Input:
[**    ]
[*    *]
[  *   ]
[      ]
[*     ]
[****  ]

Output:
[**1011]
[*4211*]
[12*111]
[121100]
[*43210]
[****10]

Input:
[     *    ]
[        * ]
[     *    ]
[**   ***  ]
[      *** ]
[          ]
[       ** ]
[  * *     ]
[*      ** ]
[       ** ]

Output:
[00001*1111]
[00002221*1]
[22102*4321]
[**102***31]
[221013***1]
[0000013542]
[0112111**1]
[12*2*12442]
[*212112**2]
[1100002**2]
</code>```

Body:
Ruby, 112

Takes and returns a string. String must be newline separated and newline terminated.

->s{w=1+s=~/\n/
s.size.times{|i|s[i]==' '&&(n=0;9.times{|j|(s+$/*w)[i+j%3-1+j/3*w-w]==?*&&n+=1};s[i])=n.to_s}
s}

in test program

f=->s{
  w=(s=~/\n/)+1                              #Calculate width.
  s.size.times{|i|                           #For each char in s
    s[i]==' '&&(                             #If it is a space
      n=0                                    #set counter n to 0 and visit
      9.times{|j|                            #a 3x3 square of chars.
        (s+$/*w)[i+j%3-1+j/3*w-w]==?*&&n+=1  #If *, increment n.
      }                                      #(Pad s with w newlines to avoid *'s detected by wraparound.)
      s[i]=n.to_s                            #Write n back to s in string format
    )
  }
s}                                           #Return s.

puts f[
" *
*  *
  *
    *
"]


答:
Haskell, 115 bytes

z=zip[1..]
x%i=[a|(j,a)<-z x,abs(i-j)<2]
f x=[[head$[c|c>' ']++show(sum[1|'*'<-(%j)=<<x%i])|(j,c)<-z r]|(i,r)<-z x]
```

Defines a function f on lists of strings

Title: Fill in the Minesweeper clues

Body:
Haskell, 115 bytes

z=zip[1..]
x%i=[a|(j,a)<-z x,abs(i-j)<2]
f x=[[head$[c|c>' ']++show(sum[1|'*'<-(%j)=<<x%i])|(j,c)<-z r]|(i,r)<-z x]

Defines a function f on lists of strings


Title: Find the super palindromes!

Body:
Consider the number 99999999. That number is obviously a palindrome.  The largest prime factor of 99999999 is 137. If you divide 99999999 by 137, you get 729927. This number is also a palindrome.

The largest prime factor of 729927 is 101. 729927/101=7227 which again is a palindrome.

The largest prime factor of 7227 is 73. 7227/73=99 which again is a palindrome.

By further dividing by the largest prime factor, you get 9, 3 and finally 1, which, being one-digit numbers, are also palindromes. Since 1 has no prime factors, the procedure ends here.

Now generalizing this observation, I define a super-palindrome as a palindrome which is either 1, or which gives another super-palindrome if divided by its largest prime factor.

Credits: https://math.stackexchange.com/questions/200835/are-there-infinitely-many-super-palindromes

Given a number N, determine if it is a super palindrome or not, and print a truthy or falsey value accordingly.

Your program should print a truthy value for these inputs:

```<code>1
101
121
282
313
353
373
393
474
737
919
959
1331
1441
2882
6446
7887
8668
9559
9779
</code>```

Your program should print a falsey value for these inputs:

```<code>323
432
555
583
585
646
642
696
777
969
989
2112
3553
4554
5242
5225
5445
8080
8118
9988
</code>```

Remember, this is code-golf, so the code with the shortest amount of bytes wins.

Body:
Java 7, 133 bytes

int c(int a){int x=a,y=0,z=a,i=2;for(;x>0;y=y*10+x%10,x/=10);for(;z>1;i++)for(;z%i<1;z/=i);if(a<2)return 1;return y!=a?0:c(a/(i-1));}

Ungolfed

    static int c( int a ){
    int x = a , y = 0 , z = a , i = 2 ;

    for ( ; x > 0 ; y = y * 10 + x % 10 , x /= 10 ) ;

    for ( ; z > 1 ; i++ )
    for ( ; z % i < 1 ; z /= i ) ;

    if ( a < 2 )
      return 1 ;

    return y != a ? 0 : c( a / ( i - 1 ) ) ;
 }


答:
C, <s>146</s> <s>177</s> <s>173</s> 163 bytes

Thanks to Numberknot for fixing the code (shifting the lower three rows).

Saving 4 bytes by replacing >>=1 with /=2 in 4 places.
Saving 10 more bytes by letting x and y be global and default int thanks to MD XF

#define T(i,n)(A[y+i]&15)==n
x,y;b(int A[12]){for(x=9;x--;){for(y=0;++y<9;A[y]/=2)if(T(0,11)&&T(1,14)&&T(2,14)&&T(3,15))return(x<<4)+y;A[9]/=2;A[10]/=2;A[11]/=2;}}
```
<p>Ungolfed:</p>
<pre class="lang-c prettyprint-override"><code>int b(int A[12]) {
 for (int x=8; x>=0; --x) {
  for (int y=0; y<9; ++y) {
   if ((A[y]&15)==11 && (A[y+1]&15)==14 && (A[y+2]&15)==14 && (A[y+3]&15)==15) {
    return (x<<4) + y;
   }
   A[y]/=2;
  }
  A[9]/=2; A[10]/=2; A[11]/=2;
 }
}
</code>```

Returns x,y (0-based) in the high and low nibble of a byte.

Usage:

int temp=b(array_to_solve);
int x=temp>>4;
int y=temp&15;
printf("%d %d\n",x,y);
```

Title: Where's the 0xBEEF?

Body:
C, <s>146</s> <s>177</s> <s>173</s> 163 bytes

Thanks to Numberknot for fixing the code (shifting the lower three rows).

Saving 4 bytes by replacing >>=1 with /=2 in 4 places.
Saving 10 more bytes by letting x and y be global and default int thanks to MD XF

#define T(i,n)(A[y+i]&15)==n
x,y;b(int A[12]){for(x=9;x--;){for(y=0;++y<9;A[y]/=2)if(T(0,11)&&T(1,14)&&T(2,14)&&T(3,15))return(x<<4)+y;A[9]/=2;A[10]/=2;A[11]/=2;}}

Ungolfed:

int b(int A[12]) {
 for (int x=8; x>=0; --x) {
  for (int y=0; y<9; ++y) {
   if ((A[y]&15)==11 && (A[y+1]&15)==14 && (A[y+2]&15)==14 && (A[y+3]&15)==15) {
    return (x<<4) + y;
   }
   A[y]/=2;
  }
  A[9]/=2; A[10]/=2; A[11]/=2;
 }
}

Returns x,y (0-based) in the high and low nibble of a byte.

Usage:

int temp=b(array_to_solve);
int x=temp>>4;
int y=temp&15;
printf("%d %d\n",x,y);


问:
N(e(s(t))) a string
To "function nest" a string, you must:

Treat the first character as a function, and the following characters as the arguments to that function. For example, if the input string was Hello, then the first step would be:

```<code>H(ello)
</code>```

Then, repeat this same step for every substring. So we get:

```<code>H(ello)
H(e(llo))
H(e(l(lo)))
H(e(l(l(o))))
</code>```

Your task is to write a program or function that "function nests" a string. For example, if the input string was Hello world!, then you should output:

```<code>H(e(l(l(o( (w(o(r(l(d(!)))))))))))
</code>```

The input will only ever contain printable ASCII, and you may take the input and the output in any reasonable format. For example, STDIN/STDOUT, function arguments and return value, reading and writing to a file, etc.

For simplicity's sake, you may also assume the input will not contain parentheses, and will not be empty.

```<code>Input:
Nest a string
Output:
N(e(s(t( (a( (s(t(r(i(n(g))))))))))))

Input:
foobar
Output:
f(o(o(b(a(r)))))

Input:
1234567890
Output:
1(2(3(4(5(6(7(8(9(0)))))))))

Input:
code-golf
Output:
c(o(d(e(-(g(o(l(f))))))))

Input:
a
Output:
a

Input:
42
Output:
4(2)
</code>```

As usual, all of our default rules and loopholes apply, and the shortest answer scored in bytes wins!

答:
Scala, 58 bytes

```<code>"Hello world!"match{case s =>s.mkString("(")+")"*s.length}
</code>```

Could be shorter

Title: N(e(s(t))) a string

Body:
Scala, 58 bytes

"Hello world!"match{case s =>s.mkString("(")+")"*s.length}

Could be shorter


答:
Scala, 90 bytes

```<code>("1011.{8}(1110.{8}){2}1111".r.findAllMatchIn(_:String).next.start)andThen(i=>(i/12,i%12))
</code>```

Explanation:

```<code>(
  "1011.{8}(1110.{8}){2}1111" //The regex we're using to find the beef
  .r                          //as a regex object
  .findAllMatchIn(_:String)   //find all the matches in the argument thats going to be passed here
  .next                       //get the first one
  .start                      //get its start index
)                             //this is a (String -> Int) function
andThen                       //
(i=>                          //with the found index
  (i/12,i%12)                 //convert it to 2d values
)
</code>```

(a -> b) andThen (b -> c) results in a (a -> c) function, it's like the reverse of compose, but requires fewer type annotations in scala. In this case, it takes a string of the binary digits as input and returns a tuple of zero-based indices.

Title: Where's the 0xBEEF?

Body:
Scala, 90 bytes

("1011.{8}(1110.{8}){2}1111".r.findAllMatchIn(_:String).next.start)andThen(i=>(i/12,i%12))

Explanation:

(
  "1011.{8}(1110.{8}){2}1111" //The regex we're using to find the beef
  .r                          //as a regex object
  .findAllMatchIn(_:String)   //find all the matches in the argument thats going to be passed here
  .next                       //get the first one
  .start                      //get its start index
)                             //this is a (String -> Int) function
andThen                       //
(i=>                          //with the found index
  (i/12,i%12)                 //convert it to 2d values
)

(a -> b) andThen (b -> c) results in a (a -> c) function, it's like the reverse of compose, but requires fewer type annotations in scala. In this case, it takes a string of the binary digits as input and returns a tuple of zero-based indices.


答:
Mathematica, 62 bytes

```<code>BlockMap[Fold[#+##&,Join@@#]==48879&,#,{4,4},1]~Position~True&
</code>```

Returns all positions of the BEEF matrix, 1-indexed. The input must be a matrix of binary digits. The x and y in the output are switched, though.

Title: Where's the 0xBEEF?

Body:
Mathematica, 62 bytes

BlockMap[Fold[#+##&,Join@@#]==48879&,#,{4,4},1]~Position~True&

Returns all positions of the BEEF matrix, 1-indexed. The input must be a matrix of binary digits. The x and y in the output are switched, though.


问:
Sort a list of numbers
About Code-Bowling:

In golf, you try to get the lowest score (smallest application, most elegant, etc). In Bowling, you try to get the highest score. So if you follow, the goal of a Code-Bowling challenge is to make the biggest, most bastardized, hardest to maintain piece of code that still meets the requirements of the challenge. However, there's no point in making source longer just for the sake of it. It needs to seem like that added length was from design and not just padding.

The Challenge:

Create a program that sorts a list of numbers in ascending order.

Example:

Input: 1, 4, 7, 2, 5

Output: 1, 2, 4, 5, 7

Code: Obviously this wouldn't be a good answer, since there aren't many WTFs in there

```<code>function doSort(array $input) {
    sort($input);
    return $input;
}
</code>```

Rules:

There are no real rules.  As long as the program functions, have at it!

Remember: This is code-bowling, not golf.  The objective is to make the worst, most bastardized code that you can!  Bonus points for code that looks good, but is actually deceptively evil...

答:
The F# "I hate functional programming" :

```<code>let numbers = System.Console.ReadLine().Split(',')
let mutable check = 0
let mutable sorted = ""

while not (sorted.Split(',').Length = numbers.Length) do
    for i in [check..check + 1000] do
        for number in numbers do
            if number = i.ToString() then
                if sorted.Length > 0 then
                    sorted <- sorted + ","
                sorted <- sorted + number
    check <- check + 1000

printfn "%s" sorted
</code>```

ContentLicense: CC BY-SA 2.5

Title: Sort a list of numbers

Body:
The F# "I hate functional programming" :

let numbers = System.Console.ReadLine().Split(',')
let mutable check = 0
let mutable sorted = ""

while not (sorted.Split(',').Length = numbers.Length) do
    for i in [check..check + 1000] do
        for number in numbers do
            if number = i.ToString() then
                if sorted.Length > 0 then
                    sorted <- sorted + ","
                sorted <- sorted + number
    check <- check + 1000

printfn "%s" sorted


答:
MATL, <s>22</s> 21 bytes

```<code>Eq[ODDH]B~EqZ+16=&fhq
</code>```

Input is a binary matrix, with ; as row separator. Output is 1-based in reverse order: Y X.

Try it online! Or verify all test cases with decimal input format.

Explanation

The pattern is detected using 2D convolution. For this,

The matrix and the pattern need to be in bipolar form, that is, 1, -1 instead of 1, 0. Since the pattern has size 4×4, its occurrence is detected by an entry equal to 16 in the convolution output.

The convolution kernel needs to be defined as the sought pattern reversed in both dimensions.

Also, since the convolution introduces an offset in the detected indices, this needs to be corrected for in the output.

```<code>Eq      % Implicitly input binary matrix. Convert to bipolar form (0 becomes -1)
[ODDH]  % Push array [0 8 8 2]
B       % Convert to binary. Each number gives a row
~Eq     % Negate and convert to bipolar. Gives [1 1 1 1; 0 1 1 1; 0 1 1 1; 1 1 0 1]
        % This is the "BEEF" pattern reversed in the two dimensions. Reversal is
        % needed because a convolution will be used to detect that patter
Z+      % 2D convolution, keeping original size
16=&f   % Find row and column indices of 16 in the above matrix
h       % Concatenate horizontally
q       % Subtract 1. Implicitly display
</code>```

Title: Where's the 0xBEEF?

Body:
MATL, <s>22</s> 21 bytes

Eq[ODDH]B~EqZ+16=&fhq

Input is a binary matrix, with ; as row separator. Output is 1-based in reverse order: Y X.

<a href="http://matl.tryitonline.net/#code=RXFbT0RESF1CfkVxWisxNj0mZmhx&input=WzEgMSAxIDAgMCAxIDEgMSAxIDEgMSAwOyAxIDEgMCAxIDAgMCAxIDAgMCAwIDAgMDsgMCAxIDAgMCAwIDEgMSAxIDEgMSAwIDE7IDEgMCAwIDEgMCAwIDEgMCAwIDEgMCAwOyAxIDAgMCAxIDAgMSAxIDAgMCAxIDEgMTsgMSAxIDEgMSAxIDEgMCAwIDAgMCAxIDA7IDEgMSAwIDEgMSAxIDAgMCAwIDAgMCAxOyAxIDAgMCAxIDEgMSAxIDAgMCAwIDAgMTsgMSAwIDAgMSAxIDEgMCAxIDEgMSAxIDE7IDEgMSAxIDEgMSAwIDAgMSAxIDEgMSAxOyAxIDAgMCAwIDAgMSAwIDEgMCAxIDEgMTsgMSAxIDAgMCAxIDEgMCAwIDAgMCAxIDFd" rel="nofollow noreferrer">Try it online! Or <a href="http://matl.tryitonline.net/#code=YEIKRXFbT0RESF1CfkVxWisxNj0mZmhxCkRU&input=WyAzNzEwLCAzMzYwLCAxMTQ5LCAyMzQwLCAyNDA3LCA0MDM0LCAzNTIxLCAyNTI5LCAyNTI3LCAzOTk5LCAyMTM1LCAzMjY3IF0KWyAxMjIyLCAzMTA3LCAxNTA4LCAzOTk3LCAxOTA2LCAzNzksIDI4NzQsIDI5MjYsIDE0ODAsIDE0ODcsIDM1NjUsIDYzMyBdClsgMjc5NiwgMjA2LCAxNDgsIDc2MywgNDI5LCAxMjc0LCAyMTcwLCAyNDk1LCA0MiwgMTY0NiwgMzYzLCAxMTQ1IF0KWyAzNDg2LCAzNTAyLCAxODgyLCAxODg2LCAyMDAzLCAxNDQyLCAyMzgzLCAyODA4LCAxNDE2LCAxOTIzLCAyNjEzLCA1MTkgXQpbIDM2NjEsIDIzODIsIDIyMDgsIDE1ODMsIDE4NjUsIDM5NjksIDI4NjQsIDMwNzQsIDQ3NSwgMjM4MiwgMTgzOCwgMTI3IF0KWyAzNjEsIDEyNzUsIDMzMDQsIDI4NzgsIDM3MzMsIDM4MzMsIDM5NzEsIDM0MDUsIDI4ODYsIDQ0OCwgMzEwMSwgMjIgXQpbIDM2NzQsIDI4NTIsIDE1NzEsIDM1ODIsIDE0MDIsIDMzMzEsIDE3NDEsIDI2NzgsIDIwNzYsIDI2ODUsIDczNCwgMjYxIF0" rel="nofollow noreferrer">verify all test cases with decimal input format.

Explanation

The pattern is detected using 2D convolution. For this,

The matrix and the pattern need to be in bipolar form, that is, 1, -1 instead of 1, 0. Since the pattern has size 4×4, its occurrence is detected by an entry equal to 16 in the convolution output.

The convolution kernel needs to be defined as the sought pattern reversed in both dimensions.

Also, since the convolution introduces an offset in the detected indices, this needs to be corrected for in the output.

Eq      % Implicitly input binary matrix. Convert to bipolar form (0 becomes -1)
[ODDH]  % Push array [0 8 8 2]
B       % Convert to binary. Each number gives a row
~Eq     % Negate and convert to bipolar. Gives [1 1 1 1; 0 1 1 1; 0 1 1 1; 1 1 0 1]
        % This is the "BEEF" pattern reversed in the two dimensions. Reversal is
        % needed because a convolution will be used to detect that patter
Z+      % 2D convolution, keeping original size
16=&f   % Find row and column indices of 16 in the above matrix
h       % Concatenate horizontally
q       % Subtract 1. Implicitly display