答:
05AB1E/V, 14 bytes

```<code>û,ò"Bx$xh|ò"bP
</code>```

Try it online!

Palindromizes in 05AB1E

Try it online!

Depalindromizes in V, using this answer from DrMcMoylex.

Title: Palindrome polyglot

Body:
Your task is to write a program that runs in two different languages, and does the following:

In one language, it palindromizes a given string.

Take the string. abcde

Reverse the string. edcba

Remove the first character. dcba

Glue it onto the original string. abcdedcba

In another language, it depalindromizes a given string.

Take a string palidromized by the above method. abcdedcba

Get the characters from the start to the middle. abcde

Remember, this is code-golf, so the code with the fewest characters (not bytes) wins.

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 1/Language 2, 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/Python, <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/C, 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)/Python, 121 bytes
</code>```

var QUESTION_ID=98776,OVERRIDE_USER=12537;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

```

Body:
05AB1E/V, 14 bytes

û,ò"Bx$xh|ò"bP

Try it online!

Palindromizes in 05AB1E

Try it online!

Depalindromizes in V, using this answer from DrMcMoylex.


问:
Count trailing truths

Inspired by, and in memory of, my dear friend and colleague,

Dan Baronet, 1956 – 2016. R.I.P.

He found the shortest possible APL solution to this task:

Task

Given a Boolean list, count the number of trailing truth values.

Example cases

{} → 0

{0} → 0

{1} → 1

{0, 1, 1, 0, 0} → 0

{1, 1, 1, 0, 1} → 1

{1, 1, 0, 1, 1} → 2

{0, 0, 1, 1, 1} → 3

{1, 1, 1, 1, 1, 1} → 6

答:
PHP, 50 bytes

```<code><?=strlen(preg_filter('/.*[^1]/','',join($argv)));
</code>```

Weirdly my first try with a regex turned out shorter than my try with arrays...

Use like:

```<code>php tt.php 1 1 0 1 1
</code>```

ContentLicense: CC BY-SA 4.0

Title: Count trailing truths

Body:
PHP, 50 bytes

<?=strlen(preg_filter('/.*[^1]/','',join($argv)));

Weirdly my first try with a regex turned out shorter than my try with arrays...

Use like:

php tt.php 1 1 0 1 1

ContentLicense: CC BY-SA 3.0


问:
Divide a number by 3 without using *, /, +, -, % operators
Quoting this question on SO (Spoiler alert!):

This question has been asked in an Oracle interview.

How would you divide a number by 3 without using *, /, +, -, %,
  operators?

The number may be signed or unsigned.

The task is solvable, but see if you can write the shortest code.

Rules:

Perform the required integer division (/3)

Do not use the non-text-based operators *, /, +, -, or % (or their equivalents, such as __div__ or add()). This also applies to incrementing and decrementing operators, like i++ or i--. Use of operators for string concatenation and formatting are OK. Using these characters for different operators, such as unary - operator for negative numbers, or * to represent a pointer in C is OK as well.

Input value can be arbitrarily large (whatever your system can handle), both positive and negative

Input can be on STDIN or ARGV or entered any other way

Create the shortest code you can to do the above

答:
05AB1E, 5 bytes

```<code>3B¨3ö
</code>```

Try it online!

Body:
05AB1E, 5 bytes

3B¨3ö

Try it online!


问:
Operator ASCII art

Challenge

Given an ASCII operator from the list below and a number n, draw an ASCII representation of the operator using that operator as the character with the line segments of the operator having length n.

Input

An ASCII character from the list = + - x / and an integer n where n >= 1.  (I'm using x instead of * and / instead of ÷, but you could use either one, whichever is easier). For + and x, you only have to handle odd numbers to avoid issues with alignment.

Output

An ASCII drawing of the operator composed of the character with segments of length n. Horizontal portions should have spaces between the characters to offset vertical/horizontal distance differences.

Rules

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

Examples

Input: + 3

```<code>  +
+ + +
  +
</code>```

Input: = 4

```<code>= = = =
= = = =
</code>```

Input: = 10

```<code>= = = = = = = = = =
= = = = = = = = = =
</code>```

Input: - 2

```<code>- -
</code>```

Input: / 10

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

Input: x 7

```<code>x     x
 x   x
  x x
   x
  x x
 x   x
x     x
</code>```

答:
Python 3, <s>304</s> <s>283</s> 278 bytes

Simple enough, just makes a matrix of chars and applies the different operations based on which one it is. The = and - have trailing spaces if that's not too bad.

EDIT: Thanks to @Shebang and @Rod for their suggestions which ended up saving 21 bytes!

EDIT2: Thanks to @Artyer for saving 5 bytes!

```<code>t,s=input().split()
s=int(s)
r=range(s)
b=[[' ']*s for x in r]
exec(['for x in r:b[s//2][x]=b[x][s//2]=t','b=[t*s]'+'*2'*(t=='='),'for x in r:b[x][s-x-1]='+'b[x][x]='*(t=='x')+'t'][(t>'+')+(t in'x/')])
if t in'-=+':b=[[x+' 'for x in l]for l in b]
print(*map(''.join,b),sep='\n')
</code>```

Title: Operator ASCII art

Body:
Python 3, <s>304</s> <s>283</s> 278 bytes

Simple enough, just makes a matrix of chars and applies the different operations based on which one it is. The = and - have trailing spaces if that's not too bad.

EDIT: Thanks to @Shebang and @Rod for their suggestions which ended up saving 21 bytes!

EDIT2: Thanks to @Artyer for saving 5 bytes!

t,s=input().split()
s=int(s)
r=range(s)
b=[[' ']*s for x in r]
exec(['for x in r:b[s//2][x]=b[x][s//2]=t','b=[t*s]'+'*2'*(t=='='),'for x in r:b[x][s-x-1]='+'b[x][x]='*(t=='x')+'t'][(t>'+')+(t in'x/')])
if t in'-=+':b=[[x+' 'for x in l]for l in b]
print(*map(''.join,b),sep='\n')


答:
TI-Basic, 8 bytes

Winner? :)

```<code>int(mean({Ans,0,0
</code>```

P.S. Rounds towards infinity for negative numbers (see here for why). To round to zero instead, replace int( with iPart( for no byte change.

Test cases

```<code>-4:prgmDIVIDE
              -2
11:prgmDIVIDE
               3
109:prgmDIVIDE
              36
</code>```

Title: Divide a number by 3 without using *, /, +, -, % operators

Body:
Quoting this question on SO (Spoiler alert!):

This question has been asked in an Oracle interview.

How would you divide a number by 3 without using *, /, +, -, %,
  operators?

The number may be signed or unsigned.

The task is solvable, but see if you can write the shortest code.

Rules:

Perform the required integer division (/3)

Do not use the non-text-based operators *, /, +, -, or % (or their equivalents, such as __div__ or add()). This also applies to incrementing and decrementing operators, like i++ or i--. Use of operators for string concatenation and formatting are OK. Using these characters for different operators, such as unary - operator for negative numbers, or * to represent a pointer in C is OK as well.

Input value can be arbitrarily large (whatever your system can handle), both positive and negative

Input can be on STDIN or ARGV or entered any other way

Create the shortest code you can to do the above

Body:
TI-Basic, 8 bytes

Winner? :)

int(mean({Ans,0,0

P.S. Rounds towards infinity for negative numbers (see here for why). To round to zero instead, replace int( with iPart( for no byte change.

Test cases

-4:prgmDIVIDE
              -2
11:prgmDIVIDE
               3
109:prgmDIVIDE
              36


问:
Next Friday the 13th
What is the shortest program that can predict the next time Friday will fall on the 13th day of the month?

Must be an complete functioning program (not just a function/subroutine)

Must print out date in the following format: YYYY-MM-DD

Allow user to provide a start date either as a command line argument or through STDIN

If user provides no start date, use today as the start date.

If the start date is a Friday the 13th, the program should find the next Friday the 13th.

If I were to run the program today (Feb 16 2011) I should get the following output.

```<code>$ ./fr13th 2013-05-09
2013-09-13
$ ./fr13th 2007-06-29
2007-07-13
$ ./fr13th 2007-07-13
2008-06-13
$ ./fr13th
2011-05-13
</code>```

答:
SQLite, 374 characters

(Line breaks added here for readability; not included in the count.)

Requirement to "Allow user to provide a start date either as a command line argument or through STDIN" omitted due to technical limitations.

```<code>CREATE TABLE R(N UNIQUE);
INSERT INTO R VALUES(0);
INSERT INTO R VALUES(1);
REPLACE INTO R SELECT A.N*2048|B.N*1024|C.N*512|D.N*256|E.N*128|F.N*64|
G.N*32|H.N*16|I.N*8|J.N*4|K.N*2|L.N FROM
R A,R B,R C,R D,R E,R F,R G,R H,R I,R J,R K,R L;
CREATE TABLE F AS SELECT DATE('2000-01-13','+'||N||'months') AS D
FROM R WHERE STRFTIME('%w',D)='5';
SELECT MIN(D) FROM F WHERE D>DATE('now');
</code>```

The first 4 statements create a table (R) with a single column containing all the integers from 0 to 4095.

The 5th statement builds a table (F) of all Friday the 13ths between 2000-10-13 and 2340-12-13.

The 6th statement simply returns the first Friday the 13th after the current (UTC) date.

ContentLicense: CC BY-SA 2.5

Title: Next Friday the 13th

Body:
SQLite, 374 characters

(Line breaks added here for readability; not included in the count.)

Requirement to "Allow user to provide a start date either as a command line argument or through STDIN" omitted due to technical limitations.

CREATE TABLE R(N UNIQUE);
INSERT INTO R VALUES(0);
INSERT INTO R VALUES(1);
REPLACE INTO R SELECT A.N*2048|B.N*1024|C.N*512|D.N*256|E.N*128|F.N*64|
G.N*32|H.N*16|I.N*8|J.N*4|K.N*2|L.N FROM
R A,R B,R C,R D,R E,R F,R G,R H,R I,R J,R K,R L;
CREATE TABLE F AS SELECT DATE('2000-01-13','+'||N||'months') AS D
FROM R WHERE STRFTIME('%w',D)='5';
SELECT MIN(D) FROM F WHERE D>DATE('now');

The first 4 statements create a table (R) with a single column containing all the integers from 0 to 4095.

The 5th statement builds a table (F) of all Friday the 13ths between 2000-10-13 and 2340-12-13.

The 6th statement simply returns the first Friday the 13th after the current (UTC) date.


问:
Fizz Buzz for Turtles

Problem Description

Imagine you're a turtle on a grid.  You're given two numbers f and b, and you're facing east. You perform a march across the grid, counting each of the cells you encounter, according to the following rules:

By default, you write the count to the cell you're in, then walk forward.

If the count is divisible by f, you write F to the cell you're in, then turn right, then walk forward.

If the count is divisible by b, you write B to the cell you're in, then turn left, then walk forward.

If the count is divisible by both f and b, you write FB to the cell you're in, then walk forward.

If you reach a square you've already been to, you stop.

For example, following these rules using f = 3 and b = 5 will generate a pattern like this:

```<code>    F 28 29 FB  1  2  F
   26                 4
 F  B                 B  F
23                       7
22                       8
 F  B                 B  F
   19                11
    F 17 16 FB 14 13  F
</code>```

The challenge

Write a program or function that accepts two numbers as input, corresponding to f and b, and produces as output the pattern for these numbers given by the rules above.

Formatting requirements:

Each cell is two characters wide

Cell contents are right aligned within these two characters

Cells on the same row are delimited by a space

The first column of cells must contain a non-empty cell

All rows must contain non-empty cells

Trailing whitespace is not required, but allowed

However, the total width of each row must not exceed 3 times the number of non-empty columns

Your code must work for provided test cases.

Standard loopholes are disallowed.

This is code golf; shortest answer in bytes wins.

Test cases

(f=3, b=5 case repeated here as a courtesy convenience).

```<code>f=3, b=5 ->
    F 28 29 FB  1  2  F
   26                 4
 F  B                 B  F
23                       7
22                       8
 F  B                 B  F
   19                11
    F 17 16 FB 14 13  F

f=4, b=10 ->
 F 25 26 27  F
23          29
22        1  2  3  F
21                 5
FB                 6
19                 7
18           B  9  F
17          11
 F 15 14 13  F

f=3, b=11 ->
 F 16 17  F
14       19
13     1  2  F
 F  B        4
   10        5
    F  8  7  F

f=5, b=9 ->
    F 41 42 43 44  1  2  3  4  F
   39                          6
   38                          7
   37                          8
 F  B                          B  F
34                               11
33                               12
32                               13
31                               14
 F 29 28  B              B 17 16  F
         26             19
          F 24 23 22 21  F

f=5, b=13 ->
    F 31 32 33 34  F
   29             36
   28        1  2  3  4  F
   27                    6
 F  B                    7
24                       8
23                       9
22              B 12 11  F
21             14
 F 19 18 17 16  F
</code>```

Title: Fizz Buzz for Turtles

Body:
JavaScript (ES6), 230 <s>240</s>

(f,b)=>(d=>{for(g=[s=x=y=d];!(r=g[y]=g[y]||[])[x];d&1?d&2?y?--y:g=[,...g]:++y:d&2?x?--x:g=g.map(r=>[,...r]):++x)o=++s%f?'':(++d,'F'),s%b||(--d,o+='B'),r[x]=o||s})(0)||g.map(r=>[...r].map(c=>` ${c||' '}`.slice(-2)).join` `).join`
`

Less golfed

(f,b)=>{
  for(g=[s=x=y=d=0]; !(r = g[y]= g[y]||[])[x]; )
  {
    o=++s%f?'':(++d,'F')
    s%b||(--d,o+='B')
    r[x]=o||s,
    d&1
      ? d&2 ? y ? --y : g=[,...g] : ++y
      : d&2 ? x ? --x : g=g.map(r=>[,...r]) : ++x
  }
  return g.map(r=>[...r].map(c=>` ${c||' '}`.slice(-2)).join` `)
          .join`\n`
}

Test

F=
(f,b)=>(d=>{for(g=[s=x=y=d];!(r=g[y]=g[y]||[])[x];d&1?d&2?y?--y:g=[,...g]:++y:d&2?x?--x:g=g.map(r=>[,...r]):++x)o=++s%f?'':(++d,'F'),s%b||(--d,o+='B'),r[x]=o||s})(0)||g.map(r=>[...r].map(c=>` ${c||' '}`.slice(-2)).join` `).join`
`

function update()
{
  var i = I.value.match(/\d+/g)||[],f=+i[0],b=+i[1]
  O.textContent = (f>0 & b>0) ? F(f,b) : ''
}

update()

<input id=I value="3 5" oninput="update()">
<pre id=O></pre>


答:
Hexagony, 28 (Non-competing, only unsigned)

```<code>?$\<@'\.|!"1.(|{'&.{&.1\()\$
</code>```

Try It Online!

Haven't got any Bitwise operators, so either can't join (like BF) or break the rules with increments and decrements.  I chose the latter as I ...

...just want to share the facts that a hexagon is a polygon with 6 sides, and the number 6 has a factor 3. This is an "advantage" to Hexagons so I hope this will be interesting.

Expanded version

```<code>   ? $ \ <
  @ ' \ . |
 ! " 1 . ( |
{ ' & . { & .
 1 \ ( ) \ $
  . . . . .
   . . . .
</code>```

? gets the input, and $ skips a mirror then we hit < the branch.

If the number is <=0 it goes to the corner then to {!@ which prints the "counter" (explained below) and ends the program.

(Else) If it is >0,

decrement it and increase the counter by 1 (located relatively at
{ as left neighbour and goes back with ").

Step back to the
right and copy.

Step back to the right and copy again.

Goes back to the branch after a few reflections.

Anyone who wants to understand how this ends with graphics? I hope there is someone who wants to know more about Hexagony and know why keep stepping back to the right will in turn accumulates the counter. :P

I can't use the operators +-*/%.  Can I use :? (The integer division) Obviously not - I'll be breaking the rules.  Sadly I am already breaking the rules with increments and decrements.  So I imposed myself to an unintended rule - not using / as an operator for reflection :) Whole program is +-*/%-free.  May need a side length 5 hexagon to make one that can take care of the negatives...

Oh I just love hexagons.

Hexagon Edition, also 28, another way to get back into the loop.

```<code>?$|<@'\H|!"EX(|{'AG{&|O&N)\$
</code>```

Body:
Hexagony, 28 (Non-competing, only unsigned)

?$\<@'\.|!"1.(|{'&.{&.1\()\$

Try It Online!

Haven't got any Bitwise operators, so either can't join (like BF) or break the rules with increments and decrements.  I chose the latter as I ...

...just want to share the facts that a hexagon is a polygon with 6 sides, and the number 6 has a factor 3. This is an "advantage" to Hexagons so I hope this will be interesting.

Expanded version

   ? $ \ <
  @ ' \ . |
 ! " 1 . ( |
{ ' & . { & .
 1 \ ( ) \ $
  . . . . .
   . . . .

? gets the input, and $ skips a mirror then we hit < the branch.

If the number is <=0 it goes to the corner then to {!@ which prints the "counter" (explained below) and ends the program.

(Else) If it is >0,

decrement it and increase the counter by 1 (located relatively at
{ as left neighbour and goes back with ").

Step back to the
right and copy.

Step back to the right and copy again.

Goes back to the branch after a few reflections.

Anyone who wants to understand how this ends with graphics? I hope there is someone who wants to know more about Hexagony and know why keep stepping back to the right will in turn accumulates the counter. :P

I can't use the operators +-*/%.  Can I use :? (The integer division) Obviously not - I'll be breaking the rules.  Sadly I am already breaking the rules with increments and decrements.  So I imposed myself to an unintended rule - not using / as an operator for reflection :) Whole program is +-*/%-free.  May need a side length 5 hexagon to make one that can take care of the negatives...

Oh I just love hexagons.

Hexagon Edition, also 28, another way to get back into the loop.

?$|<@'\H|!"EX(|{'AG{&|O&N)\$


答:
V, <s>78, 72, 71, 68, 65, 63, 62</s>, 61 bytes

```<code>Ç=ü-/Àé X
ç^Ó/é Àä$
ç+/ÀÄM|ÀR+
ç=/Ä
ç¯/lòhYpX
çx/rxòl3Äjxlrx
</code>```

Try it online!

As always, the neck-and-neck battle with 05AB1E is really fun!

Since this contains non-ASCII characters, here is a hexdump:

```<code>0000000: c73d fc2d 2fc0 e920 580a e75e d32f e920  .=.-/.. X..^./.
0000010: c0e4 240a e72b 2fc0 c44d 7cc0 522b 200a  ..$..+/..M|.R+ .
0000020: e73d 2fc4 0ae7 af2f 6cf2 6859 7058 0ae7  .=/..../l.hYpX..
0000030: 782f 7278 f26c 33c4 6a78 6c72 78         x/rx.l3.jxlrx
</code>```

This does create leading spaces in the output for = and -, but this seems to be allowed. If this is not allowed, feel free to comment and I'll roll it back.

Explanation

The "global command" (e.g. ç) applies a certain set of commands to every line that matches a certain regex. The syntax is

```<code>ç<compressed regex>/<commands>
</code>```

This is the easiest way of simulating a conditional/switch statement. In my original answer, I simply created the entire ASCII-art on the right-hand side for each different character we need to search for. However, a lot of these outputs require similar commands. So I combined them. The first command ('Ç') is actually the inverse of the global command, it applies the command to every line not matching the regex. So the first command is:

```<code>Ç=ü-        " On every line not containing an '=' or an '-' (e.g. inputs '/', '+', and 'x'):
    /Àé     "   Insert *n* spaces
        X   "   Delete one of them
</code>```

The following command is for inputs '=' and '-'. These two are conveniently easy and similar. After this command, we need no more processing for -.

```<code>ç^Ó         " On every line that starts with non-whitespace (e.g. every line not affected by our previous command):
   /é       "   Insert one space
            "   Move back a character
      À     "   Make *n* copies
       ä$   "   Of every character on this line
</code>```

From here we just do some extra commands for each individual possible input. For +:

```<code>ç+/         " On every line containing a '+':
   ÀÄ       "   Make *n* copies of this line
     M|     "   Move to the first character of the middle line
       À    "   *n* times:
        R+  "   Replace the next two characters with '+ '
</code>```

The command for equals is very straightforward. We just duplicate it with Ä. For /:

```<code>ç¯          " On every line containing a '/':
  /l        "   Move one character to the right
    ò       "   Recursively:
     h      "     Move one character to the left
      Yp    "     Make a copy of this line
        X   "     Delete one character
         ò  "   End loop (implicit)
</code>```

The last one is the most complicated. It is basically a port of this answer.

```<code>çx              " On every line containing a 'x':
  /rx           "   Replace the first character with an 'x'
     ò          "   Recursively:
      l         "     Move one char to the right
       3Ä       "     Make 3 copies of this line
         j      "     Move down one line
          x     "     Delete one char
           l    "     Move one char to the right
            rx  "     Replace this char with an 'x'
</code>```

Title: Operator ASCII art

Body:
Challenge

Given an ASCII operator from the list below and a number n, draw an ASCII representation of the operator using that operator as the character with the line segments of the operator having length n.

Input

An ASCII character from the list = + - x / and an integer n where n >= 1.  (I'm using x instead of * and / instead of ÷, but you could use either one, whichever is easier). For + and x, you only have to handle odd numbers to avoid issues with alignment.

Output

An ASCII drawing of the operator composed of the character with segments of length n. Horizontal portions should have spaces between the characters to offset vertical/horizontal distance differences.

Rules

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

Examples

Input: + 3

```<code>  +
+ + +
  +
</code>```

Input: = 4

```<code>= = = =
= = = =
</code>```

Input: = 10

```<code>= = = = = = = = = =
= = = = = = = = = =
</code>```

Input: - 2

```<code>- -
</code>```

Input: / 10

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

Input: x 7

```<code>x     x
 x   x
  x x
   x
  x x
 x   x
x     x
</code>```

Body:
V, <s>78, 72, 71, 68, 65, 63, 62</s>, 61 bytes

Ç=ü-/Àé X
ç^Ó/é Àä$
ç+/ÀÄM|ÀR+
ç=/Ä
ç¯/lòhYpX
çx/rxòl3Äjxlrx

Try it online!

As always, the neck-and-neck battle with 05AB1E is really fun!

Since this contains non-ASCII characters, here is a hexdump:

0000000: c73d fc2d 2fc0 e920 580a e75e d32f e920  .=.-/.. X..^./.
0000010: c0e4 240a e72b 2fc0 c44d 7cc0 522b 200a  ..$..+/..M|.R+ .
0000020: e73d 2fc4 0ae7 af2f 6cf2 6859 7058 0ae7  .=/..../l.hYpX..
0000030: 782f 7278 f26c 33c4 6a78 6c72 78         x/rx.l3.jxlrx

This does create leading spaces in the output for = and -, but this seems to be allowed. If this is not allowed, feel free to comment and I'll roll it back.

Explanation

The "global command" (e.g. ç) applies a certain set of commands to every line that matches a certain regex. The syntax is

ç<compressed regex>/<commands>

This is the easiest way of simulating a conditional/switch statement. In my original answer, I simply created the entire ASCII-art on the right-hand side for each different character we need to search for. However, a lot of these outputs require similar commands. So I combined them. The first command ('Ç') is actually the inverse of the global command, it applies the command to every line not matching the regex. So the first command is:

Ç=ü-        " On every line not containing an '=' or an '-' (e.g. inputs '/', '+', and 'x'):
    /Àé     "   Insert *n* spaces
        X   "   Delete one of them

The following command is for inputs '=' and '-'. These two are conveniently easy and similar. After this command, we need no more processing for -.

ç^Ó         " On every line that starts with non-whitespace (e.g. every line not affected by our previous command):
   /é       "   Insert one space
            "   Move back a character
      À     "   Make *n* copies
       ä$   "   Of every character on this line

From here we just do some extra commands for each individual possible input. For +:

ç+/         " On every line containing a '+':
   ÀÄ       "   Make *n* copies of this line
     M|     "   Move to the first character of the middle line
       À    "   *n* times:
        R+  "   Replace the next two characters with '+ '

The command for equals is very straightforward. We just duplicate it with Ä. For /:

ç¯          " On every line containing a '/':
  /l        "   Move one character to the right
    ò       "   Recursively:
     h      "     Move one character to the left
      Yp    "     Make a copy of this line
        X   "     Delete one character
         ò  "   End loop (implicit)

The last one is the most complicated. It is basically a port of this answer.

çx              " On every line containing a 'x':
  /rx           "   Replace the first character with an 'x'
     ò          "   Recursively:
      l         "     Move one char to the right
       3Ä       "     Make 3 copies of this line
         j      "     Move down one line
          x     "     Delete one char
           l    "     Move one char to the right
            rx  "     Replace this char with an 'x'


答:
APL, 11

```<code>3⊥¯1↓3⊥⍣¯1⊢656
218
</code>```

I'm converting to base 3 and back, removing the last number in the process.
Try it on tryapl.org

Body:
APL, 11

3⊥¯1↓3⊥⍣¯1⊢656
218

I'm converting to base 3 and back, removing the last number in the process.
Try it on tryapl.org


答:
PowerShell v2+, 44 bytes

```<code>,(,('/////\\\\\'*6)*4+,('\\\\\/////'*6)*4)*3
</code>```

Abuses the crap outta the default Write-Output behavior to put a newline between elements.

Explanation

I'm also trying out a new explanation format, rather than the long prose I traditionally write.

```<code>,(,('/////\\\\\'*6)*4+,('\\\\\/////'*6)*4)*3
    '/////\\\\\'*6                            # Repeat this string 6 times
  ,(              )*4                         # Repeat it into an array of four elements
                     +                        # Array concatenate with
                      ,('\\\\\/////'*6)*4)    # The same with the slashes the other way
,(                                       )*3  # Repeat it into an array of three elements
                                              # (i.e., 24 total strings)
</code>```

Title: This is my pillow

Body:
...will you help me immortalize it?

I've had this pillow a few years now, and apparently it's time to get rid of it. Can you please write a function or program, that I can bring with me and use to recreate this pillow whenever I want to reminisce a bit.

It must work with no input arguments.

The output should look exactly like this (trailing newlines and spaces are OK).

```<code>/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
</code>```

This is code golf, so the shortest code in bytes win!

Leaderboard

var QUESTION_ID=98701,OVERRIDE_USER=31516;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

```

Body:
PowerShell v2+, 44 bytes

,(,('/////\\\\\'*6)*4+,('\\\\\/////'*6)*4)*3

Abuses the crap outta the default Write-Output behavior to put a newline between elements.

Explanation

I'm also trying out a new explanation format, rather than the long prose I traditionally write.

,(,('/////\\\\\'*6)*4+,('\\\\\/////'*6)*4)*3
    '/////\\\\\'*6                            # Repeat this string 6 times
  ,(              )*4                         # Repeat it into an array of four elements
                     +                        # Array concatenate with
                      ,('\\\\\/////'*6)*4)    # The same with the slashes the other way
,(                                       )*3  # Repeat it into an array of three elements
                                              # (i.e., 24 total strings)


答:
Scala, 275 bytes

```<code>(i,c)=>if(c<44){val b=(" "*(i-1)+"+\n")*((i-1)/2)
b+"+ "*i+"\n"+b}else
if(c<46)"- "*i else
if(c<48)i-1 to(0,-1)map(" "*_+"/\n")mkString else
if(c<62)"= "*i+"\n"+"= "*i
else{val a=0 to i/2-1 map(x=>" "*x+"x"+" "*((i/2-x)*2-1)+"x"+" "*x+"\n")mkString;a+" "*(i/2)+"x"+a.reverse}
</code>```

Usage:

```<code>val f:((Int,Char)=>String)=...
print(f(10, '/'))
</code>```

Explanation:

The code tests for the ascii value of the char to choose the right way of generating the image. The ascii values of the operators in question are:
('+' -> 43), ('-' ->45), ('/' -> 47), ('=' -> 61), ('x' -> 120)

```<code>(i,c)=>                              //define a function
  if(c<44){                            //if c is a plus
    val b=(" "*(i-1)+"+\n")*((i-1)/2)    //define the top/bottom part b as (i-1)/2 times (i-1) spaces, a plus sign and a newlineine
    b+"+ "*i+"\n"+b                      //return b, i times a plus and a space, a newline and b
  }else if(c<46)                       //if c is a '-'
    "- "*i                               //return "- " repeated i times
  else if(c<48)                        //if c is a '/'
    i-1 to(0,-1)                         //create a range from i-1 to 0 in steps of -1
    map(" "*_+"/\n")                     //map each number to that number of spaces plus a "/" and a newline
    mkString                             //join them together
  else if(c<62)                        //if c is '='
    "= "*i+"\n"+"= "*i                   //return "= " repeated i times, a newline and "= " repeated i times again
  else{                                //if c if 'x'
    val a=                               //define a, which will be the top part, as...
      0 to i/2-1                         //a range from 0 to i/2-1
      map(n=>                            //map each number n to
        " "*n                              //n spaces
        +"x"                               //plus an "x"
        +" "*((i/2-n)*2-1)                 //plus ((i/2)-n)*2-1 spaces
        +"x"                               //plus an "x"
        +" "*n                             //plus n spaces
        +"\n"                              //and a newline
      )mkString;                         //join them
    a+" "*(i/2)+"x"+a.reverse          //return a, i/2 spaces, "x" and the reverse of a
  }
</code>```

Title: Operator ASCII art

Body:
Scala, 275 bytes

(i,c)=>if(c<44){val b=(" "*(i-1)+"+\n")*((i-1)/2)
b+"+ "*i+"\n"+b}else
if(c<46)"- "*i else
if(c<48)i-1 to(0,-1)map(" "*_+"/\n")mkString else
if(c<62)"= "*i+"\n"+"= "*i
else{val a=0 to i/2-1 map(x=>" "*x+"x"+" "*((i/2-x)*2-1)+"x"+" "*x+"\n")mkString;a+" "*(i/2)+"x"+a.reverse}

Usage:

val f:((Int,Char)=>String)=...
print(f(10, '/'))

Explanation:

The code tests for the ascii value of the char to choose the right way of generating the image. The ascii values of the operators in question are:
('+' -> 43), ('-' ->45), ('/' -> 47), ('=' -> 61), ('x' -> 120)

(i,c)=>                              //define a function
  if(c<44){                            //if c is a plus
    val b=(" "*(i-1)+"+\n")*((i-1)/2)    //define the top/bottom part b as (i-1)/2 times (i-1) spaces, a plus sign and a newlineine
    b+"+ "*i+"\n"+b                      //return b, i times a plus and a space, a newline and b
  }else if(c<46)                       //if c is a '-'
    "- "*i                               //return "- " repeated i times
  else if(c<48)                        //if c is a '/'
    i-1 to(0,-1)                         //create a range from i-1 to 0 in steps of -1
    map(" "*_+"/\n")                     //map each number to that number of spaces plus a "/" and a newline
    mkString                             //join them together
  else if(c<62)                        //if c is '='
    "= "*i+"\n"+"= "*i                   //return "= " repeated i times, a newline and "= " repeated i times again
  else{                                //if c if 'x'
    val a=                               //define a, which will be the top part, as...
      0 to i/2-1                         //a range from 0 to i/2-1
      map(n=>                            //map each number n to
        " "*n                              //n spaces
        +"x"                               //plus an "x"
        +" "*((i/2-n)*2-1)                 //plus ((i/2)-n)*2-1 spaces
        +"x"                               //plus an "x"
        +" "*n                             //plus n spaces
        +"\n"                              //and a newline
      )mkString;                         //join them
    a+" "*(i/2)+"x"+a.reverse          //return a, i/2 spaces, "x" and the reverse of a
  }


问:
Generate a Markdown Template for your Post
Your task is simple: Write a program (or function) that takes no input and outputs something like this:

```<code>## *name*, *length* bytes
    *code*
</code>```

Where *name* is the name of the language you are using, *length* is the number of bytes in your code, and *code* is your program's source code. If *code* contains multiple lines, it have four spaces before each line.

Here's a 124-byte example implementation in Python 3:

```<code>s = "## Python 3, 124 bytes{2}    s = {1}{0}{1}{2}print(s.format(s,chr(34),chr(10)))"
print(s.format(s,chr(34),chr(10)))
</code>```

The output is:

```<code>## Python 3, 124 bytes
    s = "## Python 3, 124 bytes{2}    s = {1}{0}{1}{2}print(s.format(s,chr(34),chr(10)))"
    print(s.format(s,chr(34),chr(10)))
</code>```

Which in Markdown is:

Python 3, 124 bytes

```<code>s = "## Python 3, 124 bytes{2}    s = {1}{0}{1}{2}print(s.format(s,chr(34),chr(10)))"
print(s.format(s,chr(34),chr(10)))
</code>```

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

答:
reticular, 58 bytes

```<code>"'34'c: 4*91+c:s:e:t:y:b: 85: :,:r:a:l:u:c:i:t:e:r: :#dqO;
</code>```

Try it online!

Explanation: :c pushes the single-char string c. This builds the string "## reticular, 58 bytes", backwards character by character, reverses the stack, and Outputs everything, including the string captured by the initial quote.

Body:
reticular, 58 bytes

"'34'c: 4*91+c:s:e:t:y:b: 85: :,:r:a:l:u:c:i:t:e:r: :#dqO;

Try it online!

Explanation: :c pushes the single-char string c. This builds the string "## reticular, 58 bytes", backwards character by character, reverses the stack, and Outputs everything, including the string captured by the initial quote.


答:
05AB1E, <s>81</s> <s>76</s> <s>74</s> <s>73</s> <s>70</s> <s>69</s> <s>68</s> <s>65</s> <s>64</s> <s>62</s> <s>60</s> <s>59</s> <s>57</s> 56 bytes

Currently in war with the V answer. I'm coming for you Dr. McMoylex :p.

Also in war with the Pip answer. I'll be watching you Mr. DLosc.

Code:

```<code>Ç6&"¹s<ú.s.Bívy¹'xQiÂðñ}, ¹×S)»¹'=Qƒ= ;ƒ¹})D¦»»Rû.c"#è.V
</code>```

Or in a more readable form:

```<code>  Ç6&
"¹s<ú.s.Bívy¹'xQiÂðñ},
 ¹×S)»¹'=Qƒ=
 ;ƒ¹})D¦»»Rû.c"
#è.V
</code>```

Uses the CP-1252 encoding. Try it online!

Title: Operator ASCII art

Body:
05AB1E, <s>81</s> <s>76</s> <s>74</s> <s>73</s> <s>70</s> <s>69</s> <s>68</s> <s>65</s> <s>64</s> <s>62</s> <s>60</s> <s>59</s> <s>57</s> 56 bytes

Currently in war with the V answer. I'm coming for you Dr. McMoylex :p.

Also in war with the Pip answer. I'll be watching you Mr. DLosc.

Code:

Ç6&"¹s<ú.s.Bívy¹'xQiÂðñ}, ¹×S)»¹'=Qƒ= ;ƒ¹})D¦»»Rû.c"#è.V

Or in a more readable form:

  Ç6&
"¹s<ú.s.Bívy¹'xQiÂðñ},
 ¹×S)»¹'=Qƒ=
 ;ƒ¹})D¦»»Rû.c"
#è.V

Uses the CP-1252 encoding. Try it online!


问:
Palindrome polyglot
Your task is to write a program that runs in two different languages, and does the following:

In one language, it palindromizes a given string.

Take the string. abcde

Reverse the string. edcba

Remove the first character. dcba

Glue it onto the original string. abcdedcba

In another language, it depalindromizes a given string.

Take a string palidromized by the above method. abcdedcba

Get the characters from the start to the middle. abcde

Remember, this is code-golf, so the code with the fewest characters (not bytes) wins.

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 1/Language 2, 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/Python, <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/C, 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)/Python, 121 bytes
</code>```

var QUESTION_ID=98776,OVERRIDE_USER=12537;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

```

答:
Japt / JavaScript, 63 chars

Lesson of the day: Japt/JavaScript polyglots are always a bad idea...

```<code>$Oq=1;$Oq &&0
alert(($U=prompt()).slice(0*$U,-$U.length/2));$Uê
</code>```

JavaScript

The first line sets the variable $Oq to 1, then performs a no-op with $Oq &&0.

The second line prompts the user for an input string, assigning it to the variable $U, then slices it from index 0*$U (always 0) to index -$U.length/2. This performs the necessary depalindromization; the result is then alerted. The program ends on a ReferenceError because variable $Uê is not defined.

Japt

In Japt, anything between dollar signs is inserted directly into the transpiled source code. Other than that, each lowercase letter transpiles to e.g. .q(, unless the previous char was another lowercase letter, in which case it becomes "q". A space is transpiled to ), and all missing parens are automatically added. The above program transpiles roughly to:

```<code>Oq=1;O.q()&&0
.a("l".e("r".t((U=prompt()).slice(0*U,-U.length/2))));U.ê()
</code>```

This is then executed as JavaScript. Oq=1; sets the variable Oq to 1. This is never used again, so it's a no-op. O.q() is a function that clears STDOUT and returns undefined; this is falsy, so the entire &&0 .a("l".e(... part is not executed.

The only part that really matters is U.ê(). Implicit input puts the input string in U, .ê() turns it into a palindrome, and implicit output sends the result to STDOUT.

If function entries are allowed, the following will work for 34 chars:

```<code>X=>($X=X).slice(0,-X.length/2);$Uê
</code>```

The first part defines an ES6 function, but it's still a full program in Japt. Test it online!

Title: Palindrome polyglot

Body:
Japt / JavaScript, 63 chars

Lesson of the day: Japt/JavaScript polyglots are always a bad idea...

$Oq=1;$Oq &&0
alert(($U=prompt()).slice(0*$U,-$U.length/2));$Uê

JavaScript

The first line sets the variable $Oq to 1, then performs a no-op with $Oq &&0.

The second line prompts the user for an input string, assigning it to the variable $U, then slices it from index 0*$U (always 0) to index -$U.length/2. This performs the necessary depalindromization; the result is then alerted. The program ends on a ReferenceError because variable $Uê is not defined.

Japt

In Japt, anything between dollar signs is inserted directly into the transpiled source code. Other than that, each lowercase letter transpiles to e.g. .q(, unless the previous char was another lowercase letter, in which case it becomes "q". A space is transpiled to ), and all missing parens are automatically added. The above program transpiles roughly to:

Oq=1;O.q()&&0
.a("l".e("r".t((U=prompt()).slice(0*U,-U.length/2))));U.ê()

This is then executed as JavaScript. Oq=1; sets the variable Oq to 1. This is never used again, so it's a no-op. O.q() is a function that clears STDOUT and returns undefined; this is falsy, so the entire &&0 .a("l".e(... part is not executed.

The only part that really matters is U.ê(). Implicit input puts the input string in U, .ê() turns it into a palindrome, and implicit output sends the result to STDOUT.

If function entries are allowed, the following will work for 34 chars:

X=>($X=X).slice(0,-X.length/2);$Uê

The first part defines an ES6 function, but it's still a full program in Japt. Test it online!


Title: This is my pillow

Body:
Python 3, 60 bytes

Lots of multiplying strings!

print((((('/'*5+'\\'*5)*6+'\n')*4)+(('\\'*5+'/'*5)*6+'\n')*4)*3)

Output

/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////


问:
Draw a hollow square of # with given width
I got this challenge from Codingame and am curious about better solutions than mine:

Given a width via standard input draw a hollow square of '#' in given width and length.

Example:

5 results in

```<code>#####
#   #
#   #
#   #
#####
</code>```

I used python to solve this so i am particulary interested in other python code. But please feel free to post your solution in any language you want.

答:
Pyke, 11 bytes

```<code>ttDd*n+*.X#
</code>```

Try it here!

```<code>ttDd*n+*    - a square of spaces n-2*n-2 big
        .X# - surround in `#`
</code>```

Body:
Pyke, 11 bytes

ttDd*n+*.X#

Try it here!

ttDd*n+*    - a square of spaces n-2*n-2 big
        .X# - surround in `#`


答:
Ruby, 39 bytes

```<code>->n{puts a=?#*n,[?#+' '*(n-=2)+?#]*n,a}
</code>```

Turns out to be shorter this way than all the fancy stuff I was trying. Be advised that this doesn't handle 0 or 1 at all.

Title: Draw a hollow square of # with given width

Body:
I got this challenge from Codingame and am curious about better solutions than mine:

Given a width via standard input draw a hollow square of '#' in given width and length.

Example:

5 results in

```<code>#####
#   #
#   #
#   #
#####
</code>```

I used python to solve this so i am particulary interested in other python code. But please feel free to post your solution in any language you want.

Body:
Ruby, 39 bytes

->n{puts a=?#*n,[?#+' '*(n-=2)+?#]*n,a}

Turns out to be shorter this way than all the fancy stuff I was trying. Be advised that this doesn't handle 0 or 1 at all.


问:
Count up folks!

Introduction

It may sound strange, but we haven't got ONE challenge for counting from 1 to n, inclusive.

This is not the same thing. That one is a (closed) not well-explained challenge.

This is not the same thing. That one is about counting up indefinitely.

Challenge

Write a program or function that prints every integer from 1 to n inclusive.

Rules

You can get n any way.

You can assume that n will always be a positive integer.

You can get n in any base, but you should always output in decimal.

Output must be separated by any character (or pattern) not in 0123456789. Non-decimal leading or trailing characters are allowed (for example when using arrays such as [1, 2, 3, 4, 5, 6]).

Standard loopholes are denied.

We want to find the shortest approach in each language, not the shortest language, so I will not accept any answer.

You must update your answer(s) after this edit, answers posted before the last edit must comply with the change rule about standard loopholes (I didn't want to deny them, but I didn't want to make the community roar, so I denied them).

You can use any post-dating language version (or language). You cannot use any language or language version made just for this challenge.

Bonuses

20%

Your program must be able to count at least up to 18446744073709551615 (2^64-1). For example, if a new datatype is the only way to support big integers, you must construct it. If your language does not have any way to support huge integers up to 2^64-1, the upper limit of that particular language must be supported instead.

EDIT: I've changed the limit from 2^64 to 2^64-1 to allow more answers.

EDIT: I made the 2^64-1 rule a bonus, since there has not been much interest in this challenge. If your answer supports 2^64-1, you can now edit it to include the bonus. Also, you can post an answer not supporting it, if it is shorter.

答:
C++, <s>89</s> 83-20%=66.4 bytes

#include<iostream>
auto f=[](auto n){for(decltype(n)i=0;i++<n;)std::cout<<i<<",";};
```

Should work for up to 2^64-1

Title: Count up folks!

Body:
C++, <s>89</s> 83-20%=66.4 bytes

#include<iostream>
auto f=[](auto n){for(decltype(n)i=0;i++<n;)std::cout<<i<<",";};

Should work for up to 2^64-1


Title: This is my pillow

Body:
Brainfuck, 179 bytes

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

I know this isn't the best score in the thread but I wanted to try out brainfuck and give this a try.

Edit:
I must've made an error while copypasting. This version should work


Title: This is my pillow

Body:
Brainfuck, 140 bytes

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

:-D


答:
Haskell, 67 bytes

```<code>l#n=l<$[1..n]
f n=unlines$'#'#n:('#':' '#(n-2)++"#")#(n-2)++['#'#n]
</code>```

Usage example:

```<code>Prelude> putStrLn $ f 4
####
#  #
#  #
####
</code>```

How it works:

```<code>l#n=l<$[1..n]                      -- helper function that makes n copies of l

   '#'#n                           -- make a string of n copies of #, followed by
                        #(n-2)     -- n-2 copies of
     '#':' '#(n-2)++"#"            -- # followed by n-2 times spaces, followed by #
                           ['#'#n] -- and a final string with n copies of #
unlines                            -- join with newlines in-between
</code>```

Body:
Haskell, 67 bytes

l#n=l<$[1..n]
f n=unlines$'#'#n:('#':' '#(n-2)++"#")#(n-2)++['#'#n]

Usage example:

Prelude> putStrLn $ f 4
####
#  #
#  #
####

How it works:

l#n=l<$[1..n]                      -- helper function that makes n copies of l

   '#'#n                           -- make a string of n copies of #, followed by
                        #(n-2)     -- n-2 copies of
     '#':' '#(n-2)++"#"            -- # followed by n-2 times spaces, followed by #
                           ['#'#n] -- and a final string with n copies of #
unlines                            -- join with newlines in-between


答:
R, 3 bytes

```<code>seq
</code>```

A built-in function that, when given a single positive integer n as argument, yields 1 to n.

Title: Count up folks!

Body:
Introduction

It may sound strange, but we haven't got ONE challenge for counting from 1 to n, inclusive.

This is not the same thing. That one is a (closed) not well-explained challenge.

This is not the same thing. That one is about counting up indefinitely.

Challenge

Write a program or function that prints every integer from 1 to n inclusive.

Rules

You can get n any way.

You can assume that n will always be a positive integer.

You can get n in any base, but you should always output in decimal.

Output must be separated by any character (or pattern) not in 0123456789. Non-decimal leading or trailing characters are allowed (for example when using arrays such as [1, 2, 3, 4, 5, 6]).

Standard loopholes are denied.

We want to find the shortest approach in each language, not the shortest language, so I will not accept any answer.

You must update your answer(s) after this edit, answers posted before the last edit must comply with the change rule about standard loopholes (I didn't want to deny them, but I didn't want to make the community roar, so I denied them).

You can use any post-dating language version (or language). You cannot use any language or language version made just for this challenge.

Bonuses

20%

Your program must be able to count at least up to 18446744073709551615 (2^64-1). For example, if a new datatype is the only way to support big integers, you must construct it. If your language does not have any way to support huge integers up to 2^64-1, the upper limit of that particular language must be supported instead.

EDIT: I've changed the limit from 2^64 to 2^64-1 to allow more answers.

EDIT: I made the 2^64-1 rule a bonus, since there has not been much interest in this challenge. If your answer supports 2^64-1, you can now edit it to include the bonus. Also, you can post an answer not supporting it, if it is shorter.

Body:
R, 3 bytes

seq

A built-in function that, when given a single positive integer n as argument, yields 1 to n.


答:
JavaScript, <s>61</s> 58 bytes

Saved 3 bytes thanks to @lmis!

n=>(b='#'[r='repeat'](n))+`
#${' '[r](n-=2)}#`[r](n)+`
`+b
```

<p>(Doesn't handle <code>0</code> or <code>1</code>)</p>

<p>For 13 extra bytes (at <strong>71 bytes</strong>), you can!</p>

<pre class="lang-js prettyprint-override"><code>n=>n?n-1?(b='#'[r='repeat'](n))+`
#${' '[r](n-=2)}#`[r](n)+`
`+b:'#':''
</code>```

These solutions are fairly simple: they do a lot of storage to not repeat themselves to save a few bytes. Unminified without the variablsm it would look like:

n => // Anonymous function definition (Param `n` is the size)
    '#'.repeat(n) +      // # `n` times to form the top
    `
#${' '.repeat(n - 2)}#`  // Followed by a newline followed by a hash and `n` - 2 spaces and
                         // another hash to make one of the middle lines
    .repeat(n - 2) +     // The above middle lines repeated `n` - 2 times
    '#'.repeat(n)        // Followed by the top line again
```

<h3>Try it!</h3>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="true">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code><script type="text/babel">var f=n=>n?n-1?(b='#'[r='repeat'](n))+`\n#${' '[r](n-=2)}#`[r](n)+`\n`+b:'#':'',b,r;function c(){document.getElementById('pre').textContent = f(+document.getElementById('input').value);}</script><input id="input" onkeydown="c();" onkeyup="c();" onchange="c();" onclick="c();" placeholder="Size"><pre id="pre">``````

Body:
JavaScript, <s>61</s> 58 bytes

Saved 3 bytes thanks to @lmis!

n=>(b='#'[r='repeat'](n))+`
#${' '[r](n-=2)}#`[r](n)+`
`+b

(Doesn't handle 0 or 1)

For 13 extra bytes (at 71 bytes), you can!

n=>n?n-1?(b='#'[r='repeat'](n))+`
#${' '[r](n-=2)}#`[r](n)+`
`+b:'#':''

These solutions are fairly simple: they do a lot of storage to not repeat themselves to save a few bytes. Unminified without the variablsm it would look like:

n => // Anonymous function definition (Param `n` is the size)
    '#'.repeat(n) +      // # `n` times to form the top
    `
#${' '.repeat(n - 2)}#`  // Followed by a newline followed by a hash and `n` - 2 spaces and
                         // another hash to make one of the middle lines
    .repeat(n - 2) +     // The above middle lines repeated `n` - 2 times
    '#'.repeat(n)        // Followed by the top line again

Try it!

<script type="text/babel">var f=n=>n?n-1?(b='#'[r='repeat'](n))+`\n#${' '[r](n-=2)}#`[r](n)+`\n`+b:'#':'',b,r;function c(){document.getElementById('pre').textContent = f(+document.getElementById('input').value);}</script><input id="input" onkeydown="c();" onkeyup="c();" onchange="c();" onclick="c();" placeholder="Size"><pre id="pre"></pre>


问:
Simulate the Universe!
One nice property of a Turing-complete language is that it can be used to write any program, up to and including the simulation of the entire Universe.

Your job is to do exactly that: write a program which simulates the Universe.

Note: although I don't doubt you'll be able to accomplish this task, nowadays I don't have enough spare time to verify whether all 1090 of the particles in your simulation do what they really should do. Therefore, solely to simplify testing and evaluation, it is enough if your universe simulator only works with a single starting particle. To keep things interesting, let's assume this particle is the recently discovered Higgs Boson.

Your universe starts with nothing but a single Higgs Boson of approximately 120 GeV in the middle of it. To not make the output too long, let's make this universe tick at only 10-25 seconds instead of its "usual clock rate" of 5.4×10−44 seconds..

This Higgs boson will decay sooner or later as it has a half-life of 1.6×10−22 seconds, so at every tick of the simulation, it has a 0.0433% chance of decaying. You can check here what it will decay into. To have a central and simplified requirement, I list the branching ratios you should use:

Running the simulation

At each tick of the simulation, the Higgs boson has a 0.0433% chance of decaying. If that happens, it will decay into the following particles, with the listed probabilities (you should use these names in the output):

bottom quark + bottom antiquark (64.8%)

2 W bosons (14.1%)

2 gluons (8.82%)

tau lepton + antitau lepton (7.04%)

charm quark + charm antiquark (3.27%)

2 Z bosons (1.59%)

2 photons (0.223%)

1 Z boson + 1 photon (0.111%)

muon + antimuon (0.0244%)

top quark + top antiquark (0.0216%)

For a total of 100%.

Some of these particles will decay further.

W boson: half-life of 10-25 seconds, this means a 50% chance to decay at every tick into one of the following, with equal probabilities:

positron + neutrino

antimuon + neutrino

antitau lepton + neutrino

Z boson: half-life of 10-25 seconds, this means a 50% chance to decay at every tick into one of the following:

neutrino + antineutrino (20.6%)

electron + positron (3.4%)

muon + antimuon (3.4%)

tau lepton + antitau lepton (3.4%)

down quark + down antiquark (15.2%)

strange quark + strange antiquark (15.2%)

bottom quark + bottom antiquark (15.2%)

up quark + up antiquark (11.8%)

charm quark + charm antiquark (11.8%)

top quark: half-life of 5×10-25 seconds, this means a 12.95% chance to decay at every tick into the following, with equal probabilities:

W boson + down quark

W boson + strange quark

W boson + bottom quark

Of course, the W boson will also soon decay...

The top antiquark behaves similarly to the top quark: it decay into a W boson and a d/s/b antiquark.

All other particles (so all except for the Z and W bosons and top quarks) have a half life many orders of magnitude longer, so to not clutter the output, they are all considered stable for our simulation.

As the universe is largely empty, all the particles will have enough space for themselves and will not interact with each other. Therefore all individual particles are independent from each other in every regard, including the probabilities of splitting.

Output:

Every tick of the simulation, you have to print the contents of the simulated universe into a new line. For example:

```<code>The universe contains 1 Higgs boson.
The universe contains 1 Higgs boson.
The universe contains 1 Higgs boson.
The universe contains 1 Higgs boson.
The universe contains 2 W bosons.
The universe contains 2 W bosons.
The universe contains 1 W boson, 1 positron and 1 neutrino.
The universe contains 1 positron, 1 antitau lepton and 2 neutrinos.
Simulation ended after 0.8 yoctoseconds.
</code>```

The order of the particles in the line is not important. The formatting, however, must be exactly as in the example above, including punctuation and pluralization. If you simulate an entire (mini-) universe, it should look nice (And I wanted to eliminate the abusing of a not sufficiently strict output requirement)

Each line corresponds to 0.1 yoctoseconds, but you will be forgiven if it takes longer than that for your program to print the output.

The simulation ends when only "stable" particles remain.

Scoring

Standard code golf rules apply.

The random number generator can be pseudo-random, but you must seed it if the language doesn't seed it by default. The probability distribution of your RNG must be uniform.

You will get a bonus -10% to the code size if the program takes an integer as an input, and starts with that many Higgs bosons.

Exception for Turing machine enthusiasts.

For those who dare to try their luck with an actual Turing machine or a similar language (like Brainfuck), their task is made easier by the following rule changes (only applicable if the language is a Brainfuck-derivative or otherwise a very simplified Turing-machine, incapable of assignment, lacking an ALU, and values on the tape can only be incremented and decremented by one):

The particle names are simplified to d, s, b, t, u, c for the quarks, v for the neutrino, T for tau lepton, m for muon, g for gluon, p for photon, Z, W and H for the bosons, - for the electron and + for the positron. At each tick, an input with the value of 0 or 1 are provided from the standard input, indicated whether the first unstable particle in the list decays or not.

The example output will therefore become

```<code>H
H
H
H
W W
W W
W + n
+ !T n n
</code>```

答:
Perl, <s>973</s> <s>986</s> <s>959</s> 944 bytes -10% = 849.6 points

Indentation and newlines are not part of the code, and are provided solely so you aren't scrolling for 30 years to read it all.

There are a couple of 0-byte optimizations that I never bothered to undo.

```<code>%p=(H,Higgs.($o=$".Boson),W,W.$o,Z,Z.$o,B,Bottom.($Q=$".Quark),b,Bottom.($q=$".Antiquark),G,Gluon,A,Tau.($t=$".Lepton),a,Antitau.$t,P,Photon,M,Muon,w,Antimuon,T,Top.$Q,t,Top.$q,e,Positron,N,Neutrino,n,Antineutrino,E,Electron,D,Down.$Q,d,Down.$q,S,Strange.$Q,z,Strange.$q,U,Up.$Q,u,Up.$q,C,Charm.$Q,c,Charm.$q);
%d=(H,[433e-6,.648,Bb,.141,WW,.0882,GG,.0704,Aa,.0327,Cc,.0159,ZZ,.00223,PP,.00111,ZP,244e-6,Mw,216e-6,Tt],W,[.5,$x=1/3,eN,$x,wN,$x,tN],Z,[.5,.206,Nn,.034,Ee,.034,Mw,.034,Aa,.152,Dd,.152,Sz,.152,Bb,.152,Uu,.118,Uu,.118,Cc],T,[.1295,$x,WD,$x,WS,$x,WB],t,[.1295,$x,Wd,$x,Wz,$x,Wb]);
for(@a=(H)x<>;grep/[HWZTt]/,@a;$z++){
    for$m(@a){
        @b=(@b,$m),next if$d{$m}[0]<rand;
        $e=rand;
        ($e-=$d{$m}[($_*=2)+1])>0||($e=2,@b=(@b,split//,$d{$m}[$_+2]))for 0..9
    }
    (@a,@b,%u,$w)=@b;
    $u{$_}++for@a;
    $w.=" $u{$_} $p{$_}".($u{$_}>1?'s,':',')for keys%u;
    say"The universe contains",$w=~s/.$/./r=~s/,([^,]+)$/ and$1/r
}
$z/=10;say"Simulation ended after $z yoctoseconds."
</code>```

Obviously, the bulk of the code is creating the initial hashes.  %p contains the names of all of the particles, exploiting Perl's bareword feature.  %r determines the decay rates.  If it's not featured in here, then it doesn't decay at all.  %d contains the decay particles.

Since the order of particles in the output doesn't matter, I don't bother changing it from the random way Perl accesses the keys in the hash, which leads to things like the following:

```<code>[snip]
The universe contains 1 Higgs Boson.
The universe contains 1 Higgs Boson.
The universe contains 2 W Bosons.
The universe contains 2 Neutrinos, 1 Positron and 1 Top Antiquark.
The universe contains 1 Top Antiquark, 1 Positron and 2 Neutrinos.
The universe contains 1 Top Antiquark, 1 Positron and 2 Neutrinos.
The universe contains 1 Top Antiquark, 1 Positron and 2 Neutrinos.
The universe contains 2 Neutrinos, 1 Positron and 1 Top Antiquark.
The universe contains 1 Positron, 1 Top Antiquark and 2 Neutrinos.
The universe contains 2 Neutrinos, 1 Top Antiquark and 1 Positron.
The universe contains 1 Positron, 1 Strange Antiquark, 2 Neutrinos, 1 Bottom Antiquark and 2 W Bosons.
The universe contains 1 W Boson, 1 Bottom Antiquark, 2 Neutrinos, 1 Positron and 1 Strange Antiquark.
The universe contains 2 Neutrinos, 1 Bottom Antiquark, 1 W Boson, 1 Strange Antiquark and 1 Positron.
The universe contains 1 W Boson, 1 Bottom Antiquark, 2 Neutrinos, 1 Strange Antiquark and 1 Positron.
The universe contains 1 Bottom Antiquark, 4 Neutrinos, 1 Antimuon, 2 Positrons and 1 Strange Antiquark.
</code>```

This has truly been an exhilarating adventure.  Wonderful puzzle, honestly, I had a lot of fun! :)

Title: Simulate the Universe!

Body:
Perl, <s>973</s> <s>986</s> <s>959</s> 944 bytes -10% = 849.6 points

Indentation and newlines are not part of the code, and are provided solely so you aren't scrolling for 30 years to read it all.

There are a couple of 0-byte optimizations that I never bothered to undo.

%p=(H,Higgs.($o=$".Boson),W,W.$o,Z,Z.$o,B,Bottom.($Q=$".Quark),b,Bottom.($q=$".Antiquark),G,Gluon,A,Tau.($t=$".Lepton),a,Antitau.$t,P,Photon,M,Muon,w,Antimuon,T,Top.$Q,t,Top.$q,e,Positron,N,Neutrino,n,Antineutrino,E,Electron,D,Down.$Q,d,Down.$q,S,Strange.$Q,z,Strange.$q,U,Up.$Q,u,Up.$q,C,Charm.$Q,c,Charm.$q);
%d=(H,[433e-6,.648,Bb,.141,WW,.0882,GG,.0704,Aa,.0327,Cc,.0159,ZZ,.00223,PP,.00111,ZP,244e-6,Mw,216e-6,Tt],W,[.5,$x=1/3,eN,$x,wN,$x,tN],Z,[.5,.206,Nn,.034,Ee,.034,Mw,.034,Aa,.152,Dd,.152,Sz,.152,Bb,.152,Uu,.118,Uu,.118,Cc],T,[.1295,$x,WD,$x,WS,$x,WB],t,[.1295,$x,Wd,$x,Wz,$x,Wb]);
for(@a=(H)x<>;grep/[HWZTt]/,@a;$z++){
    for$m(@a){
        @b=(@b,$m),next if$d{$m}[0]<rand;
        $e=rand;
        ($e-=$d{$m}[($_*=2)+1])>0||($e=2,@b=(@b,split//,$d{$m}[$_+2]))for 0..9
    }
    (@a,@b,%u,$w)=@b;
    $u{$_}++for@a;
    $w.=" $u{$_} $p{$_}".($u{$_}>1?'s,':',')for keys%u;
    say"The universe contains",$w=~s/.$/./r=~s/,([^,]+)$/ and$1/r
}
$z/=10;say"Simulation ended after $z yoctoseconds."

Obviously, the bulk of the code is creating the initial hashes.  %p contains the names of all of the particles, exploiting Perl's bareword feature.  %r determines the decay rates.  If it's not featured in here, then it doesn't decay at all.  %d contains the decay particles.

Since the order of particles in the output doesn't matter, I don't bother changing it from the random way Perl accesses the keys in the hash, which leads to things like the following:

[snip]
The universe contains 1 Higgs Boson.
The universe contains 1 Higgs Boson.
The universe contains 2 W Bosons.
The universe contains 2 Neutrinos, 1 Positron and 1 Top Antiquark.
The universe contains 1 Top Antiquark, 1 Positron and 2 Neutrinos.
The universe contains 1 Top Antiquark, 1 Positron and 2 Neutrinos.
The universe contains 1 Top Antiquark, 1 Positron and 2 Neutrinos.
The universe contains 2 Neutrinos, 1 Positron and 1 Top Antiquark.
The universe contains 1 Positron, 1 Top Antiquark and 2 Neutrinos.
The universe contains 2 Neutrinos, 1 Top Antiquark and 1 Positron.
The universe contains 1 Positron, 1 Strange Antiquark, 2 Neutrinos, 1 Bottom Antiquark and 2 W Bosons.
The universe contains 1 W Boson, 1 Bottom Antiquark, 2 Neutrinos, 1 Positron and 1 Strange Antiquark.
The universe contains 2 Neutrinos, 1 Bottom Antiquark, 1 W Boson, 1 Strange Antiquark and 1 Positron.
The universe contains 1 W Boson, 1 Bottom Antiquark, 2 Neutrinos, 1 Strange Antiquark and 1 Positron.
The universe contains 1 Bottom Antiquark, 4 Neutrinos, 1 Antimuon, 2 Positrons and 1 Strange Antiquark.

This has truly been an exhilarating adventure.  Wonderful puzzle, honestly, I had a lot of fun! :)


答:
Python 2, 50 bytes

m=input()-2
for c in'#'+' '*m+'#':print'#'+m*c+'#'
```

<p>Works for <code>n>=2</code>. Prints each line with a pound sign, <code>n-2</code> of the appropriate symbol, then another pound sign.</p>

<p>Aliasing the pound symbol gives same length:</p>

<pre class="lang-python prettyprint-override"><code>m=input()-2;p='#'
for c in p+' '*m+p:print p+m*c+p
</code>```

Other attempts:

lambda n:'#'*n+('\n#'+' '*(n-2)+'#')*(n-2)+'\n'+'#'*n

lambda n:'#'*n+'\n#%s#'%((n-2)*' ')*(n-2)+'\n'+'#'*n

lambda n:'\n'.join(['#'*n]+['#'+' '*(n-2)+'#']*(n-2)+['#'*n])

n=input();s='#'+' '*(n-2)+'#'
for c in s:print[s,'#'*n][c>' ']

s='##'+' #'*(input()-2)+'##'
for c in s[::2]:print s[c>' '::2]

s='#'+' '*(input()-2)+'#'
for c in s:print s.replace(' ',c)
```

Body:
Python 2, 50 bytes

m=input()-2
for c in'#'+' '*m+'#':print'#'+m*c+'#'

Works for n>=2. Prints each line with a pound sign, n-2 of the appropriate symbol, then another pound sign.

Aliasing the pound symbol gives same length:

m=input()-2;p='#'
for c in p+' '*m+p:print p+m*c+p

Other attempts:

lambda n:'#'*n+('\n#'+' '*(n-2)+'#')*(n-2)+'\n'+'#'*n

lambda n:'#'*n+'\n#%s#'%((n-2)*' ')*(n-2)+'\n'+'#'*n

lambda n:'\n'.join(['#'*n]+['#'+' '*(n-2)+'#']*(n-2)+['#'*n])

n=input();s='#'+' '*(n-2)+'#'
for c in s:print[s,'#'*n][c>' ']

s='##'+' #'*(input()-2)+'##'
for c in s[::2]:print s[c>' '::2]

s='#'+' '*(input()-2)+'#'
for c in s:print s.replace(' ',c)


问:
Primenary Strings

A Primenary (binary-prime) string is one which, when written as a binary grid, every row and column has a prime total.

That's quite a vague explanation, so let's break it down with a worked example...

For this example we'll use the string bunny:

First, find the ASCII code point of each character and its binary representation:

```<code>Char | ASCII | Binary

b      98      1100010
u      117     1110101
n      110     1101110
n      110     1101110
y      121     1111001
</code>```

Take these binary values, from top to bottom, and arrange them into grid (adding leading zeros if necessary):

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

Then, count the number of 1s in each row and column:

```<code>1 1 0 0 0 1 0   > 3
1 1 1 0 1 0 1   > 5
1 1 0 1 1 1 0   > 5
1 1 0 1 1 1 0   > 5
1 1 1 1 0 0 1   > 5

v v v v v v v

5 5 2 3 3 3 2
</code>```

If, and only if, every single total is prime (such as here) then the string is a valid binary-prime.

The Challenge

Your task is to create a function or program which, when given a string, returns/outputs truthy if the string is primenary, and falsy otherwise.

Rules/Details

You may assume that the string's characters will always be in the ASCII range 33-126 (inclusive).

The string will not be empty.

A primenary string does not have to have a prime length - for example, W1n* is valid, despite having 4 characters.

This is code-golf, so the shortest answer (in bytes) wins - but all submissions are welcome.

Standard loopholes are banned.

Test Cases

```<code>'husband'     -> True
'HOTJava'     -> True
'COmPaTIBILE' -> True
'AuT0HACk'    -> True

'PPCW'        -> False
'code-golf'   -> False
'C++'         -> False
'/kD'         -> False

'HI'          -> False
'A'           -> False
</code>```

There is also a working, but incredibly verbose Python example on repl.it that you can test your solution against.

答:
Groovy, <s>151</s> 137 bytes

```<code>{p={x->x<3||(2..(x**0.5)).every{x%it}};y={it.every{p(it.count("1"))}};x=it.collect{0.toString((int)it,2) as List};y(x)&&y(x.transpose())}
</code>```

No primality check in groovy...

p={x->x<3||(2..(x**0.5)).every{x%it}}; - Closure for primality testing.

y={it.every{p(it.count("1"))}}; - Closure to ensure that all counts of "1" for a passed binary 2D array are prime.

x=it.collect{0.toString((int)it,2) as List}; - Coversion from string to binary array.

y(x)&&y(x.transpose()) - For all prime-validated sums in the main matrix and the transposed matrix, ensure that they return true.

Title: Primenary Strings

Body:
Groovy, <s>151</s> 137 bytes

{p={x->x<3||(2..(x**0.5)).every{x%it}};y={it.every{p(it.count("1"))}};x=it.collect{0.toString((int)it,2) as List};y(x)&&y(x.transpose())}

No primality check in groovy...

p={x->x<3||(2..(x**0.5)).every{x%it}}; - Closure for primality testing.

y={it.every{p(it.count("1"))}}; - Closure to ensure that all counts of "1" for a passed binary 2D array are prime.

x=it.collect{0.toString((int)it,2) as List}; - Coversion from string to binary array.

y(x)&&y(x.transpose()) - For all prime-validated sums in the main matrix and the transposed matrix, ensure that they return true.


Title: This is my pillow

Body:
...will you help me immortalize it?

I've had this pillow a few years now, and apparently it's time to get rid of it. Can you please write a function or program, that I can bring with me and use to recreate this pillow whenever I want to reminisce a bit.

It must work with no input arguments.

The output should look exactly like this (trailing newlines and spaces are OK).

```<code>/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
</code>```

This is code golf, so the shortest code in bytes win!

Leaderboard

var QUESTION_ID=98701,OVERRIDE_USER=31516;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

```

Body:
Brainfuck, 168 bytes

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


答:
Haskell, 49 bytes

n%b='#':(b<$[3..n])++"#\n"
f n=(n%)=<<init(n%' ')
```

<p>Works for <code>n>=2</code>. Defines the operation of sandwiching a character between <code>#</code> for an <code>n</code>-character newline-terminated string, then applies it twice to make a 2D grid.</p>

<p>Call like:</p>

```*Main> putStrLn$ f 5
#####
#   #
#   #
#   #
#####
```

Body:
Haskell, 49 bytes

n%b='#':(b<$[3..n])++"#\n"
f n=(n%)=<<init(n%' ')

Works for n>=2. Defines the operation of sandwiching a character between # for an n-character newline-terminated string, then applies it twice to make a 2D grid.

Call like:

*Main> putStrLn$ f 5
#####
#   #
#   #
#   #
#####


答:
Java 7, 120 bytes

```<code>String c(){String r="";for(int i=0;i<1440;r+=(i%60<1?"\n":"")+(i/60%8<4?i%10<5?"/":"\\":i%10<5?"\\":"/"),i++);return r;}
</code>```

Pushed everything into one loop. Beats Brainfuck, mission accomplished.

See it online: https://ideone.com/pZjma3

Title: This is my pillow

Body:
Java 7, 120 bytes

String c(){String r="";for(int i=0;i<1440;r+=(i%60<1?"\n":"")+(i/60%8<4?i%10<5?"/":"\\":i%10<5?"\\":"/"),i++);return r;}

Pushed everything into one loop. Beats Brainfuck, mission accomplished.

See it online: https://ideone.com/pZjma3


答:
Python 2, 16 bytes (Joke Answer)

```<code>print input()//3
</code>```

// is not the same as /, the division operator. //, a token in and of itself, is the floor-division operator. Example: 4.5 // 2 == 2. Note that this answer exploits a loophole in the question, and can be considered a joke. However, it is within the technical rules because the question says you cannot use the / operator. Although this answer uses the character "/", it never uses it as an operator.

Body:
Quoting this question on SO (Spoiler alert!):

This question has been asked in an Oracle interview.

How would you divide a number by 3 without using *, /, +, -, %,
  operators?

The number may be signed or unsigned.

The task is solvable, but see if you can write the shortest code.

Rules:

Perform the required integer division (/3)

Do not use the non-text-based operators *, /, +, -, or % (or their equivalents, such as __div__ or add()). This also applies to incrementing and decrementing operators, like i++ or i--. Use of operators for string concatenation and formatting are OK. Using these characters for different operators, such as unary - operator for negative numbers, or * to represent a pointer in C is OK as well.

Input value can be arbitrarily large (whatever your system can handle), both positive and negative

Input can be on STDIN or ARGV or entered any other way

Create the shortest code you can to do the above

Body:
Python 2, 16 bytes (Joke Answer)

print input()//3

// is not the same as /, the division operator. //, a token in and of itself, is the floor-division operator. Example: 4.5 // 2 == 2. Note that this answer exploits a loophole in the question, and can be considered a joke. However, it is within the technical rules because the question says you cannot use the / operator. Although this answer uses the character "/", it never uses it as an operator.


Body:
I got this challenge from Codingame and am curious about better solutions than mine:

Given a width via standard input draw a hollow square of '#' in given width and length.

Example:

5 results in

```<code>#####
#   #
#   #
#   #
#####
</code>```

I used python to solve this so i am particulary interested in other python code. But please feel free to post your solution in any language you want.

Body:
Jelly, 13, bytes

,þ%µỊṀ€€ị⁾# Y

TryItOnline! or try 0 to 15

How?

,þ%µỊṀ€€ị⁾# Y - Main link: n
 þ            - outer product with
,             -    pair:   [[[1,1],[2,1],...,[n,1]],[[1,2],[2,2],...,[n,2]], ... ,[[1,n],[2,n],...,[n,n]]]
  %           - mod n:     [[[1,1],[2,1],...,[0,1]],[[1,2],[2,2],...,[0,2]], ... ,[[1,0],[2,0],...,[0,0]]]
   µ          - monadic chain separation
    Ị         - abs(z)<=1: [[[1,1],[0,1],...,[1,1]],[[1,0],[0,0],...,[1,0]], ... ,[[1,1],[0,1],...,[1,1]]]
      €€      - for each for each
     Ṁ        - maximum:   [[1,    1,    ...,1],    [1,    0,    ..., 1],    ... ,[1,    1,    ..., 1]   ]
        ị     - index into (1 based)
         ⁾#   - "# ":      ["##...#","# ...#", ...,"##...#"]
           Y  - join with line feeds


问:
Given a Diagram, Find X

Find X

I was inspired by math questions in which one is asked to "Find X" for a given shape. Originally, I was just going to have the challenge be to print the x and y location of the character 'x' in a String. But I supposed that would be too simple. So I considered the context they were normally in, and decided finding the length of a Line next to the x just seemed appropriate.

Given a string input containing a Diagram of ascii 'lines' as well as a single 'x' and potentially junk characters, print the length of the only line that has an 'x' directly adjecent to it.

Examples

Input:

```<code>|
|
|x
|
|
</code>```

Ouput:

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

Input:

```<code>|\
| \x
|  \
|___\
</code>```

Output:

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

Input:

```<code>Diagram of a Wobbly Line:
IRRELEVANTTEXT____
____     ____/
    \___/ X ;)
      x
</code>```

Output:

```<code>3
</code>```

Input:

```<code>  ______________
 / ____________ \
 |/ __________ \|
 ||/ ________ \||
 |||/ ______ \|||
 ||||/      \||||
 |||||/  x  |||||
 |||||\_____/||||
 ||||\_______/|||
 |||\_________/||
 ||\___________/|
  \_____________/
</code>```

Output:

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

Notes

The Valid line characters are \/_|

\ connects the top left and bottom right of itself.

/ connects the top right and bottom left of itself.

_ connects the left and right of itself

| connects the top and bottom of itself

A line will always be straight, and only consist of one of the line characters repeated n times.

The x will always be lowercase, and it will always be the only one in the diagram.

Adjecent refers to the x being exactly one character above, below, or besides.

The x will always be next to exactly one Line.

Tabs will never appear in the input.

Input and Output may be any acceptable format.

This is Code Golf, so Shortest Code Wins!

HAVE FUN. DO IT. ENJOY YOURSELF.

Reference Implementation

答:
Lua, 480 Bytes

Lua, Being the Verbose Language it is, doesn't beat the Python Answer. But it doesn't need to.

```<code>a=...s={}for _ in a:gmatch"[^\n]*"do s[#s+1]={}for S in _:gmatch"."do if S=="x"then x=#s[#s]+1y=#s end s[#s][#s[#s]+1]=S end end c="\\/_|"X={-1,1,1,0}Y={-1,-1,0,-1}for _,d in pairs({{x-1,y},{x,y-1},{x+1,y},{x,y+1}})do K=d[2]k=d[1]h=s[K]w=h and h[k]C=w and c:find(w)if C then n=1 j=k J=K while true do j=j+X[C]J=J+Y[C]if s[J]and s[J][j]==w then n=n+1 else break end end j=k J=K while true do j=j-X[C]J=J-Y[C]if s[J]and s[J][j]==w then n=n+1 else break end end print(n)break end end
</code>```

Similar to my reference implementation, but takes an actual shot at golfing, and does some things a bit more smartly than before. Still could probably be golfed a bit better though.

With comments.

```<code>a=... -- Take the input from the command line.
s={}  -- Store the string as a 2D Table, instead of a multiline string.
for _ in a:gmatch"[^\n]*"do -- For each new row.
    s[#s+1] = {}            -- Make a new sub-table. This is our line.
    for S in _:gmatch"."do  -- For every character.
        if S=="x"then x=#s[#s]+1y=#s end -- If it's an x, mark down the X and Y position of it.
        s[#s][#s[#s]+1]=S                -- Push the character. This could probably be better golfed.
    end
end
c="\\/_|"   -- The ascii line characters.
X={-1,1,1,0}    -- Their X Directionals.
Y={-1,-1,0,-1}  -- Their Y Directionals.
                -- These are inversed to get their opposite direction.
for _,d in pairs({{x-1,y},{x,y-1},{x+1,y},{x,y+1}}) do -- For each up down left and right.
    K=d[2]  -- K = y
    k=d[1]  -- k = x
    h=s[K]  -- h = the yth row
    w=h and h[k]    -- w = the xth character of the yth row, if the yth row exists.
    C=w and c:find(w) -- C = the id of the ascii line character, if w existed.
    if C then
        n=1 -- n = the length of the line.
        j=k -- Temp x
        J=K -- Temp y
        while true do
            j=j+X[C] -- Increment j by the directional of the ascii.
            J=J+Y[C] -- Ditto. for J
            if s[J]and s[J][j]==w then -- if it's still the same.
                n=n+1 -- Add 1 to the length.
            else
                break -- Or stop.
            end
        end
        j=k -- Re-assign the temps as their original.
        J=K
        while true do
            j=j-X[C] -- Search in the other direction.
            J=J-Y[C]
            if s[J]and s[J][j]==w then
                n=n+1
            else
                break
            end
        end
        print(n) -- Print the length.
        break
    end
end
</code>```

Title: Given a Diagram, Find X

Body:
Lua, 480 Bytes

Lua, Being the Verbose Language it is, doesn't beat the Python Answer. But it doesn't need to.

a=...s={}for _ in a:gmatch"[^\n]*"do s[#s+1]={}for S in _:gmatch"."do if S=="x"then x=#s[#s]+1y=#s end s[#s][#s[#s]+1]=S end end c="\\/_|"X={-1,1,1,0}Y={-1,-1,0,-1}for _,d in pairs({{x-1,y},{x,y-1},{x+1,y},{x,y+1}})do K=d[2]k=d[1]h=s[K]w=h and h[k]C=w and c:find(w)if C then n=1 j=k J=K while true do j=j+X[C]J=J+Y[C]if s[J]and s[J][j]==w then n=n+1 else break end end j=k J=K while true do j=j-X[C]J=J-Y[C]if s[J]and s[J][j]==w then n=n+1 else break end end print(n)break end end

Similar to my reference implementation, but takes an actual shot at golfing, and does some things a bit more smartly than before. Still could probably be golfed a bit better though.

With comments.

a=... -- Take the input from the command line.
s={}  -- Store the string as a 2D Table, instead of a multiline string.
for _ in a:gmatch"[^\n]*"do -- For each new row.
    s[#s+1] = {}            -- Make a new sub-table. This is our line.
    for S in _:gmatch"."do  -- For every character.
        if S=="x"then x=#s[#s]+1y=#s end -- If it's an x, mark down the X and Y position of it.
        s[#s][#s[#s]+1]=S                -- Push the character. This could probably be better golfed.
    end
end
c="\\/_|"   -- The ascii line characters.
X={-1,1,1,0}    -- Their X Directionals.
Y={-1,-1,0,-1}  -- Their Y Directionals.
                -- These are inversed to get their opposite direction.
for _,d in pairs({{x-1,y},{x,y-1},{x+1,y},{x,y+1}}) do -- For each up down left and right.
    K=d[2]  -- K = y
    k=d[1]  -- k = x
    h=s[K]  -- h = the yth row
    w=h and h[k]    -- w = the xth character of the yth row, if the yth row exists.
    C=w and c:find(w) -- C = the id of the ascii line character, if w existed.
    if C then
        n=1 -- n = the length of the line.
        j=k -- Temp x
        J=K -- Temp y
        while true do
            j=j+X[C] -- Increment j by the directional of the ascii.
            J=J+Y[C] -- Ditto. for J
            if s[J]and s[J][j]==w then -- if it's still the same.
                n=n+1 -- Add 1 to the length.
            else
                break -- Or stop.
            end
        end
        j=k -- Re-assign the temps as their original.
        J=K
        while true do
            j=j-X[C] -- Search in the other direction.
            J=J-Y[C]
            if s[J]and s[J][j]==w then
                n=n+1
            else
                break
            end
        end
        print(n) -- Print the length.
        break
    end
end


答:
Befunge-98, 76 bytes

```<code>'/\::2%0`!\4c*/2%0`!-> #0 #\ #\' $ #\_\3k:4k,1+:c%0`!> #0 #, #a_:cad+*\`!#@_
</code>```

TryItOnline!

String processing/generation can be difficult with only a stack available...

A couple bytes may be able to be shaved off here or there, but I beat brainfuck, so I'm happy.

Explanation

```<code>Push '/' on the stack
Swap top two (at the beginning, zero will now be on top). Call top = iterator = n
Calculate (n % 2 == 0) != ((n / 48) % 2 == 0)
If true, swap top two, replace '/' with '\', swap again
Swap top two (so that we now have the character to print on top, followed by n)
Duplicate the char 4 times, and print 5 times
Increment n
If n % 12 == 0, print a newline character
If !(288 > n), end, else repeat
</code>```

Title: This is my pillow

Body:
Befunge-98, 76 bytes

'/\::2%0`!\4c*/2%0`!-> #0 #\ #\' $ #\_\3k:4k,1+:c%0`!> #0 #, #a_:cad+*\`!#@_

TryItOnline!

String processing/generation can be difficult with only a stack available...

A couple bytes may be able to be shaved off here or there, but I beat brainfuck, so I'm happy.

Explanation

Push '/' on the stack
Swap top two (at the beginning, zero will now be on top). Call top = iterator = n
Calculate (n % 2 == 0) != ((n / 48) % 2 == 0)
If true, swap top two, replace '/' with '\', swap again
Swap top two (so that we now have the character to print on top, followed by n)
Duplicate the char 4 times, and print 5 times
Increment n
If n % 12 == 0, print a newline character
If !(288 > n), end, else repeat


答:
Pyth, 22 bytes

```<code>V6V4V12p*5?%+bN2\\\/)k
</code>```

Try it here.

Explanation:

```<code>V6                     Loop 6 times, with N from 0 to 5:
  V4                   Loop 4 times, with H from 0 to 3:
    V12                Loop 12 times, with b from 0 to 11:
      p                Print without newline
        *              The repetition
          5            5 times of
          ?            if
            %          the remainder
              + b N    when the sum of b and N
              2        is divided by 2
          \\           then the "\" character
          \/           else the "/" character
    )                  End
                       (implicitly print with newline)
  k                    k (empty string)
                       (implicit end)
                       (implicit end)
</code>```

Sorry if the explanation is a little hard to understand, but it was kinda complicated.

Title: This is my pillow

Body:
Pyth, 22 bytes

V6V4V12p*5?%+bN2\\\/)k

Try it here.

Explanation:

V6                     Loop 6 times, with N from 0 to 5:
  V4                   Loop 4 times, with H from 0 to 3:
    V12                Loop 12 times, with b from 0 to 11:
      p                Print without newline
        *              The repetition
          5            5 times of
          ?            if
            %          the remainder
              + b N    when the sum of b and N
              2        is divided by 2
          \\           then the "\" character
          \/           else the "/" character
    )                  End
                       (implicitly print with newline)
  k                    k (empty string)
                       (implicit end)
                       (implicit end)

Sorry if the explanation is a little hard to understand, but it was kinda complicated.