答:
Mathematica, <s>113</s> <s>103</s> 102 bytes

```<code>(r=Range[a=#-1];Length@Flatten[FindShortestPath[Graph[Thread[r<->Mod[a+1,r]]],#,#2]&@@{#,#-1}&/@r]-a)&
</code>```

-10 bytes thanks to @feersum;
-1 byte thanks to @MartinEnder

The following is far quicker (but longer, unfortunately, at 158 bytes):

```<code>(a=#;If[a<4,Part[-{1,1,1,-6},a],If[EvenQ@a,-2,1]]+a+4Total[Length@Complement[#,#2]&@@#&/@Partition[NestWhileList[Mod[a,#]&,#,#!=0&]&/@Range@Floor[a/2],2,1]])&
</code>```

Title: Score Tarzan's Olympic Vine-Swinging Routine

Body:
Olympic vine-swingers perform their routines in standard trees.  In particular, Standard Tree n has vertices for 0 up through n-1 and edges linking each nonzero vertex a to the vertex n % a below it.  So, for example, Standard Tree 5 looks like this:

```<code>3
|
2   4
 \ /
  1
  |
  0
</code>```

because the remainder when 5 is divided by 3 is 2, the remainder when 5 is divided by 2 or by 4 is 1, and the remainder when 5 is divided by 1 is 0.

This year, Tarzan will be defending his gold with new routines, each of which begins at vertex n - 1, swings to vertex n - 2, continues to vertex n - 3, etc., until finally he dismounts to vertex 0.

The score for a routine is the sum of the scores for each swing (including the dismount), and the score for a swing is the distance within the tree between its start and end points.  Thus, Tarzan's routine on Standard Tree 5 has a score of 6:

a swing from 4 to 3 scores three points (down, up, up),

a swing from 3 to 2 scores one point (down),

a swing from 2 to 1 scores one point (down), and

a dismount from 1 to 0 scores one point (down).

Write a program or function that, given a positive integer n, computes the score of Tarzan's routine on Standard Tree n.  Sample inputs and outputs:

```<code> 1 ->  0
 2 ->  1
 3 ->  2
 4 ->  6
 5 ->  6
 6 -> 12
 7 -> 12
 8 -> 18
 9 -> 22
10 -> 32
11 -> 24
12 -> 34
13 -> 34
14 -> 36
15 -> 44
16 -> 58
17 -> 50
18 -> 64
19 -> 60
20 -> 66
21 -> 78
22 -> 88
23 -> 68
24 -> 82
</code>```

Rules and code scoring are as usual for code-golf.

Body:
Mathematica, <s>113</s> <s>103</s> 102 bytes

(r=Range[a=#-1];Length@Flatten[FindShortestPath[Graph[Thread[r<->Mod[a+1,r]]],#,#2]&@@{#,#-1}&/@r]-a)&

-10 bytes thanks to @feersum;
-1 byte thanks to @MartinEnder

The following is far quicker (but longer, unfortunately, at 158 bytes):

(a=#;If[a<4,Part[-{1,1,1,-6},a],If[EvenQ@a,-2,1]]+a+4Total[Length@Complement[#,#2]&@@#&/@Partition[NestWhileList[Mod[a,#]&,#,#!=0&]&/@Range@Floor[a/2],2,1]])&


问:
The Letter A without A
Your task is to display the letter "A" alone, without anything else, except any form of trailing newlines if you cannot avoid them, doing so in a program and/or snippet. Code that returns (instead of printing) is allowed.

Both the lowercase and uppercase versions of the letter "A" are acceptable (that is, unicode U+0061 or unicode U+0041. Other character encodings that aren't Unicode are allowed, but either way, the resulting output of your code must be the latin letter "A", and not any lookalikes or homoglyphs)

You must not use any of the below characters in your code, regardless of the character encoding that you pick:

"A", whether uppercase or lowercase.

"U", whether lowercase or uppercase.

X, whether uppercase or lowercase.

+

&

#

0

1

4

5

6

7

9

Cheating, loopholes, etc, are not allowed.

Since this is code-golf, the shortest solution, in bytes, that follows all the rules, is the winner.

Validity Checker

This Stack Snippet checks to make sure your code doesn't use the restricted characters. It might not work properly for some character encodings.

var t = prompt("Input your code.");

if (/[AaUuXx+&#0145679]/.test(t)) {
  alert("Contains a disallowed character!");
} else {
  alert("No disallowed characters");
}```
</div>
</div>
</p>

<p><em>This Stack Snippet that makes sure you don't have a disallowed character is also available on JSFiddle.</em></p>

<h3>Leaderboard</h3>

<p><div class="snippet" data-lang="js" data-hide="true" data-console="false" data-babel="false">
<div class="snippet-code snippet-currently-hidden">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var QUESTION_ID=90349,OVERRIDE_USER=58717;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="<h1>"+e.body.replace(OVERRIDE_REG,"")+"</h1>")});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;/<a/.test(o)&&(o=jQuery(o).text()),s[o]=s[o]||{lang:e.language,user:e.user,size:e.size,link:e.link}});var t=[];for(var o in s)s.hasOwnProperty(o)&&t.push(s[o]);t.sort(function(e,s){return e.lang>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;</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}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr></thead> <tbody id="answers"> </tbody> </table> </div><div id="language-list"> <h2>Winners by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr></thead> <tbody id="languages"> </tbody> </table> </div><table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td>Link</td></tr></tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td>Link</td></tr></tbody> </table></code>```

答:
Perl 6, 14 bytes

print 'B'.pred
```

pred is short for "predecessor"

ContentLicense: CC BY-SA 3.0

Title: The Letter A without A

Body:
Perl 6, 14 bytes

print 'B'.pred

pred is short for "predecessor"


问:
Score Tarzan's Olympic Vine-Swinging Routine
Olympic vine-swingers perform their routines in standard trees.  In particular, Standard Tree n has vertices for 0 up through n-1 and edges linking each nonzero vertex a to the vertex n % a below it.  So, for example, Standard Tree 5 looks like this:

```<code>3
|
2   4
 \ /
  1
  |
  0
</code>```

because the remainder when 5 is divided by 3 is 2, the remainder when 5 is divided by 2 or by 4 is 1, and the remainder when 5 is divided by 1 is 0.

This year, Tarzan will be defending his gold with new routines, each of which begins at vertex n - 1, swings to vertex n - 2, continues to vertex n - 3, etc., until finally he dismounts to vertex 0.

The score for a routine is the sum of the scores for each swing (including the dismount), and the score for a swing is the distance within the tree between its start and end points.  Thus, Tarzan's routine on Standard Tree 5 has a score of 6:

a swing from 4 to 3 scores three points (down, up, up),

a swing from 3 to 2 scores one point (down),

a swing from 2 to 1 scores one point (down), and

a dismount from 1 to 0 scores one point (down).

Write a program or function that, given a positive integer n, computes the score of Tarzan's routine on Standard Tree n.  Sample inputs and outputs:

```<code> 1 ->  0
 2 ->  1
 3 ->  2
 4 ->  6
 5 ->  6
 6 -> 12
 7 -> 12
 8 -> 18
 9 -> 22
10 -> 32
11 -> 24
12 -> 34
13 -> 34
14 -> 36
15 -> 44
16 -> 58
17 -> 50
18 -> 64
19 -> 60
20 -> 66
21 -> 78
22 -> 88
23 -> 68
24 -> 82
</code>```

Rules and code scoring are as usual for code-golf.

答:
C, <s>98</s> 97 bytes

F(i){int c[i],t=i-2,n=0,p;for(;++n<i;)for(p=c[n]=n;p=i%p;c[p]=n)t+=c[p]<n-1;return i>2?t*2:i-1;}
```

<p>This calculates the distance between each pair of points with the following formula:</p>

<ul>
<li>Add the distance from the root to node A</li>
<li>Add the distance from the root to node B</li>
<li>Subtract 2* the length of the common root of A and B</li>
</ul>

<p>This has the advantage that when applied to all pairs, it's the same as:</p>

<ul>
<li>Add 2* the distance from the root to each node</li>
<li>Subtract 2* the length of the common root of each node pair</li>
<li>Subtract the distance from the root to the first node</li>
<li>Subtract the distance from the root to the last node</li>
</ul>

<p>To make the logic simpler, we assume we're going from node 0 to node n-1, rather than n-1 to 0 as the question states. The distance from the root node to node 0 is obviously 0 (they're the same). And we can see that for (most) trees, the distance from the last node to the root is 2:</p>

```                    n+1 % n = 1  for all n > 1
and:                  n % 1 = 0  for all n >= 0
therefore:  n % (n % (n-1)) = 0  for all n > 2
```

<p>This means we have some special cases (n<2) but we can account for those easily enough.</p>

<p>Breakdown:</p>

<pre class="lang-c prettyprint-override"><code>F(i){                               // Types default to int
    int c[i],                       // Buffer for storing paths
        t=i-2,                      // Running total score
        n=0,                        // Loop index
        p;                          // Inner loop variable
    for(;++n<i;)                    // Loop through all node pairs (n-1, n)
        for(p=c[n]=n;p=i%p;c[p]=n)  //  Recurse from current node (n) to root
            t+=c[p]<n-1;            //   Increase total unless this is a common
                                    //   node with the previous path
    return i>2?   :i-1;             // Account for special cases at 1 and 2
               t*2                  // For non-special cases, multiply total by 2
}
</code>```

Thanks @feersum for 1 byte saved

Bonus: Trees!

I wrote a quick-and-dirty program to see what these trees look like. Here's some of the results:

```<code>6:

5 4
| |
1 2 3
 \|/
  0
</code>```

```<code>8:

  5
  |
7 3   6
|  \ /
1   2   4
'--\|/--'
    0
</code>```

```<code>13:

   08
    |
11 05   10 09 07
 |   \ /    |  |
02   03    04 06 12
 '-----\  /---'--'
        01
         |
        00
</code>```

19:

```<code>   12
    |
   07   14
     \ /
     05    15 11
       \  /    |
17      04    08 16 13 10
 |       '-\  /--'   |  |
02          03      06 09 18
 '---------\ |/-----'--'--'
            01
             |
            00
</code>```

```<code>49:

                         31
                          |
           30            18   36
            |              \ /
           19   38 27      13    39 29    32
             \ /    |        \  /    |     |
   26        11    22 44      10    20 40 17   34
    |         '-\  /--'        '-\  /--'    \ /
47 23   46       05               09        15    45 43 41 37 33 25    35 28
 |   \ /          '--------------\ |/-------'-----'   |  |  |  |  |     |  |
02   03                           04                 06 08 12 16 24 48 14 21 42
 '----'--------------------------\ |/----------------'--'--'--'--'--'    \ |/
                                  01                                      07
                                   '-----------------\  /-----------------'
                                                      00
</code>```

Body:
C, <s>98</s> 97 bytes

F(i){int c[i],t=i-2,n=0,p;for(;++n<i;)for(p=c[n]=n;p=i%p;c[p]=n)t+=c[p]<n-1;return i>2?t*2:i-1;}

This calculates the distance between each pair of points with the following formula:

Add the distance from the root to node A

Add the distance from the root to node B

Subtract 2* the length of the common root of A and B

This has the advantage that when applied to all pairs, it's the same as:

Add 2* the distance from the root to each node

Subtract 2* the length of the common root of each node pair

Subtract the distance from the root to the first node

Subtract the distance from the root to the last node

To make the logic simpler, we assume we're going from node 0 to node n-1, rather than n-1 to 0 as the question states. The distance from the root node to node 0 is obviously 0 (they're the same). And we can see that for (most) trees, the distance from the last node to the root is 2:

                    n+1 % n = 1  for all n > 1
and:                  n % 1 = 0  for all n >= 0
therefore:  n % (n % (n-1)) = 0  for all n > 2

This means we have some special cases (n<2) but we can account for those easily enough.

Breakdown:

F(i){                               // Types default to int
    int c[i],                       // Buffer for storing paths
        t=i-2,                      // Running total score
        n=0,                        // Loop index
        p;                          // Inner loop variable
    for(;++n<i;)                    // Loop through all node pairs (n-1, n)
        for(p=c[n]=n;p=i%p;c[p]=n)  //  Recurse from current node (n) to root
            t+=c[p]<n-1;            //   Increase total unless this is a common
                                    //   node with the previous path
    return i>2?   :i-1;             // Account for special cases at 1 and 2
               t*2                  // For non-special cases, multiply total by 2
}

Thanks @feersum for 1 byte saved

Bonus: Trees!

I wrote a quick-and-dirty program to see what these trees look like. Here's some of the results:

6:

5 4
| |
1 2 3
 \|/
  0

8:

  5
  |
7 3   6
|  \ /
1   2   4
'--\|/--'
    0

13:

   08
    |
11 05   10 09 07
 |   \ /    |  |
02   03    04 06 12
 '-----\  /---'--'
        01
         |
        00

19:

   12
    |
   07   14
     \ /
     05    15 11
       \  /    |
17      04    08 16 13 10
 |       '-\  /--'   |  |
02          03      06 09 18
 '---------\ |/-----'--'--'
            01
             |
            00

49:

                         31
                          |
           30            18   36
            |              \ /
           19   38 27      13    39 29    32
             \ /    |        \  /    |     |
   26        11    22 44      10    20 40 17   34
    |         '-\  /--'        '-\  /--'    \ /
47 23   46       05               09        15    45 43 41 37 33 25    35 28
 |   \ /          '--------------\ |/-------'-----'   |  |  |  |  |     |  |
02   03                           04                 06 08 12 16 24 48 14 21 42
 '----'--------------------------\ |/----------------'--'--'--'--'--'    \ |/
                                  01                                      07
                                   '-----------------\  /-----------------'
                                                      00


问:
The Great Pyramid of ASCII

Introduction

It's 2600 BC and people are building pyramids now. They already made the basis of the pyramid but don't know how to continue. So, they called you for help.

The rules of making a pyramid is quite simple. For the layer above the previous layer, all you need to do is follow this step-by-step hand guide:

Cut the edges off the previous layer.

Above the / character, there must be a \ character and vice versa. This applies to every character except the edges.

The leftmost character is always a / and the rightmost character is always \.

Let's take an example of a basis for a pyramid:

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

We cut off the edges, leaving:

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

We change the forward slashes with backward slashes and vice versa:

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

The leftmost character is always a / and the rightmost character is always a \, so we change that:

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

We place this layer on the previous layer:

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

We continue until the top is reached (which looks like /\). So, eventually we get:

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

This is what you need to output.

The task

Given the basis of a pyramid (with a length greater than 3), output the full pyramid. You can safely assume that the leftmost character is / and the rightmost character is a \. You can also assume that the length of the basis is always even. The use of trailing spaces is allowed. The use of leading spaces is also allowed, as long as the pyramid stays in place. The use of 1 trailing and 1 leading newlines is allowed.

Test cases

```<code>Input: /\\\
Output:
 /\
/\\\

Input: //\\///\/\
Output:
    /\
   /\\\
  /\///\
 ///\\\/\
//\\///\/\

Input: /////////////\
Output:
      /\
     /\\\
    /////\
   /\\\\\\\
  /////////\
 /\\\\\\\\\\\
/////////////\
</code>```

This is code-golf, so the submission with the least amount of bytes wins!

答:
JavaScript (ES6), <s>91</s> 86 bytes

f=
(s,t=`
`)=>s[2]?f(`/${s.slice(2,-2).replace(/./g,c=>c>`/`?`/`:`\\`)}\\`,t+` `)+t+s:t+s
;```
<pre class="snippet-code-html lang-html prettyprint-override"><code><input placeholder=Basis oninput=o.textContent=f(this.value)><pre id=o></code>```

Output includes a leading newline character.

Title: The Great Pyramid of ASCII

Body:
JavaScript (ES6), <s>91</s> 86 bytes

f=
(s,t=`
`)=>s[2]?f(`/${s.slice(2,-2).replace(/./g,c=>c>`/`?`/`:`\\`)}\\`,t+` `)+t+s:t+s
;

<input placeholder=Basis oninput=o.textContent=f(this.value)><pre id=o>

Output includes a leading newline character.


答:
Haskell, <s>98</s> <s>94</s> <s>90</s> 85 bytes

```<code>q=init.tail
s '/'='\\'
s _='/'
t#""=t++"\\\n"
t#l=(' ':t)#(s<$>q l)++t++l#""
("/"#).q
</code>```

Usage example (note: in Haskell backslashes within literal strings have to be escaped \\):

```<code>*Main> putStr $ (("/"#).q) "//\\\\///\\/\\"
    /\
   /\\\
  /\///\
 ///\\\/\
//\\///\/\
</code>```

Simple recurse approach: # does the work by mapping s, which flips the / and \, on the inner elements. The additional parameter t keeps track of the indention level and is expanded by a space on each recursive call.

Note: the second recursive call of # (-> l#"") jumps directly to the base case and is just a short way to add l, \ and a newline, i.e. it replaces ++l++"\\\n".

Edit: @xnor saved 5 bytes. Thanks!

Title: The Great Pyramid of ASCII

Body:
Introduction

It's 2600 BC and people are building pyramids now. They already made the basis of the pyramid but don't know how to continue. So, they called you for help.

The rules of making a pyramid is quite simple. For the layer above the previous layer, all you need to do is follow this step-by-step hand guide:

Cut the edges off the previous layer.

Above the / character, there must be a \ character and vice versa. This applies to every character except the edges.

The leftmost character is always a / and the rightmost character is always \.

Let's take an example of a basis for a pyramid:

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

We cut off the edges, leaving:

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

We change the forward slashes with backward slashes and vice versa:

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

The leftmost character is always a / and the rightmost character is always a \, so we change that:

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

We place this layer on the previous layer:

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

We continue until the top is reached (which looks like /\). So, eventually we get:

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

This is what you need to output.

The task

Given the basis of a pyramid (with a length greater than 3), output the full pyramid. You can safely assume that the leftmost character is / and the rightmost character is a \. You can also assume that the length of the basis is always even. The use of trailing spaces is allowed. The use of leading spaces is also allowed, as long as the pyramid stays in place. The use of 1 trailing and 1 leading newlines is allowed.

Test cases

```<code>Input: /\\\
Output:
 /\
/\\\

Input: //\\///\/\
Output:
    /\
   /\\\
  /\///\
 ///\\\/\
//\\///\/\

Input: /////////////\
Output:
      /\
     /\\\
    /////\
   /\\\\\\\
  /////////\
 /\\\\\\\\\\\
/////////////\
</code>```

This is code-golf, so the submission with the least amount of bytes wins!

Body:
Haskell, <s>98</s> <s>94</s> <s>90</s> 85 bytes

q=init.tail
s '/'='\\'
s _='/'
t#""=t++"\\\n"
t#l=(' ':t)#(s<$>q l)++t++l#""
("/"#).q

Usage example (note: in Haskell backslashes within literal strings have to be escaped \\):

*Main> putStr $ (("/"#).q) "//\\\\///\\/\\"
    /\
   /\\\
  /\///\
 ///\\\/\
//\\///\/\

Simple recurse approach: # does the work by mapping s, which flips the / and \, on the inner elements. The additional parameter t keeps track of the indention level and is expanded by a space on each recursive call.

Note: the second recursive call of # (-> l#"") jumps directly to the base case and is just a short way to add l, \ and a newline, i.e. it replaces ++l++"\\\n".

Edit: @xnor saved 5 bytes. Thanks!


问:
What's on the TV?

Challenge

Write a program which, using the XML data from the site here, display the name of the programme which is currently showing on BBC 1.

Information

All times are given at London time (GMT+1 at the time of posting and GMT+0 after the 30th October). Therefore, you should convert your local time to London time.

Each programme is given a start and end time. If the current time is after the start time and before the end time of a programme, that programme is currently showing. Your programme may handle overlaps in anyway you wish.

Your output must be the programme title, like so:

```<code>BBC News
</code>```

However, if the programme has a subtitle (shown by the presence of the subtitle tag), the output should be like so:

```<code>Steptoe and Son: The Piano
</code>```

Where Steptoe and Son is the title and The Piano is the subtitle. An example programme with a subtitle is as follows:

```<code><programme>
    <subtitle>Newcastle</subtitle>
    <title>Flog It!</title>
    <end>1710</end>
    <start>1610</start>
    <desc>
      Antiques series. Paul Martin presents from the Discovery Museum in Newcastle. The items uncovered include a book of autographs with a local connection. Also in HD. [S]
    </desc>
</programme>
</code>```

URL shorteners are disallowed but XML parsing libraries are allowed.

Winning

The shortest code in bytes wins.

答:
Python, <s>440</s> <s>428</s> <s>426</s> <s>398</s> 395 Bytes

-31 Bytes thanks to @Loovjo

Throws an error when it found the date.

```<code>import re,pytz,urllib
from datetime import*
x=urllib.urlopen("http://www.bleb.org/tv/data/listings/0/bbc1.xml").read().split("</p")[:-1]
for m,n in enumerate(re.search("\d*</s",i).group()for i in x):
 if n>datetime.strftime(datetime.now(pytz.utc).astimezone(pytz.timezone('Europe/London')),"%H%M"):print re.search(">.*?</t",x[m-1]).group()[1:-3],": "+re.search("e>.*?</s",x[m-1]).group()[2:-3],_
</code>```

Please don't hurt me for parsing xml with regex.

version using a xml parser, 398 Bytes

```<code>import re,pytz,urllib
import xml.etree.ElementTree as ET
from datetime import*
x=list(ET.parse(urllib.urlretrieve("http://www.bleb.org/tv/data/listings/0/bbc1.xml")[0]).getroot())
for m,n in enumerate(i.find("start").text for i in x):
 if n>datetime.strftime(datetime.now(pytz.utc).astimezone(pytz.timezone('Europe/London')),"%H%M"):print x[m-1].find("title").text,": "+x[0].find("subtitle").text,_
</code>```

Title: What's on the TV?

Body:
Python, <s>440</s> <s>428</s> <s>426</s> <s>398</s> 395 Bytes

-31 Bytes thanks to @Loovjo

Throws an error when it found the date.

import re,pytz,urllib
from datetime import*
x=urllib.urlopen("http://www.bleb.org/tv/data/listings/0/bbc1.xml").read().split("</p")[:-1]
for m,n in enumerate(re.search("\d*</s",i).group()for i in x):
 if n>datetime.strftime(datetime.now(pytz.utc).astimezone(pytz.timezone('Europe/London')),"%H%M"):print re.search(">.*?</t",x[m-1]).group()[1:-3],": "+re.search("e>.*?</s",x[m-1]).group()[2:-3],_

Please don't hurt me for parsing xml with regex.

version using a xml parser, 398 Bytes

import re,pytz,urllib
import xml.etree.ElementTree as ET
from datetime import*
x=list(ET.parse(urllib.urlretrieve("http://www.bleb.org/tv/data/listings/0/bbc1.xml")[0]).getroot())
for m,n in enumerate(i.find("start").text for i in x):
 if n>datetime.strftime(datetime.now(pytz.utc).astimezone(pytz.timezone('Europe/London')),"%H%M"):print x[m-1].find("title").text,": "+x[0].find("subtitle").text,_


问:
Can you outgolf me? (Cops section)

Cops section

The robbers section can be found here.

Thanks to FryAmTheEggman, Peter Taylor, Nathan Merrill, xnor, Dennis, Laikoni and Mego for their contributions.

Challenge

Your task is to write 2 different programs (full programs/functions/etc.) in the same language and the same version (e.g. Python 3.5 ≠ Python 3.4, so that is not allowed), and when given n (using STDIN/function arguments/etc.), compute a(n) where a is an OEIS sequence of your choice. One of those programs is shorter than the other. You only need to submit the longer program of the two. The other one needs to be saved in case of not being cracked after 7 days. Your submission is cracked when your program has been outgolfed (whether it is by 1 byte or more).

For example, if the task you chose was to perform 2 × n, this could be a valid submission (in Python 2):

Python 2, 16 bytes, score = 15 / 16 = 0.9375

```<code>print(2*input())
</code>```

Computes A005843, (offset = 0).

If your submission has been cracked, then you need to state that in your header like so:

Python 2, 16 bytes, score = 15 / 16 = 0.9375, [cracked] + link

```<code>print(2*input())
</code>```

Computes A005843, (offset = 0).

Offset

This can be found on every OEIS page. For example, for A005843, the offset is 0,2. We only need to use the first one, which is 0. This means that the function is defined for all numbers ≥ 0.

In other words, the function OEIS(n) starts with n = 0. Your program needs to work for all cases given by OEIS.

More information can be found here.

Scoring

The score you get for your submission is equal to the following formula:

Score = Length (in bytes) of secret code ÷ Length (in bytes) of public code

The example above has the score 15 ÷ 16 = 0.9375.

The submission with the lowest score wins. Only submissions that have posted their solution will be eligible for winning.

Rules

The task you need to do is an OEIS sequence of your choice.

Given n, output OEIS(n). Deviation is not allowed, so you need to produce the exact same sequence (when given n, you need to output OEIS(n)).

Submissions that are not cracked within a period of 7 days are considered safe after the solution has been posted (submissions older than 7 days that do not have their solution posted are still vulnerable in being cracked).

In your submission, you need to post the following things: language name, byte count, full code, so no pastebin links etc. (to prevent answers like Unary), OEIS sequence, score with lengths of both programs and additionally, the encoding that is used.

Note: the same sequence cannot be posted twice in the same language. (For example, if the sequence A005843 has been done in Pyth, you cannot use Pyth again for that same sequence.)

Input and output are both in decimal (base 10)

Leaderboard

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

Uncracked submissions

 Language	 Score	 User

Sort by: score creation

Safe submissions

 Language	 Score	 User

```

Note

This challenge is finished. The final winner is feersum with his Seed answer. Congratulations! :).

You can still submit new cops, but be aware that they are no longer competing.

答:
05AB1E, 7 bytes, score = 0.857 (6 / 7) [cracked]

This one shouldn't be too hard if you think about it :p. Code:

```<code>L!zO¹!*
</code>```

Try it online!

Computes A002627.

Title: Can you outgolf me? (Cops section)

Body:
05AB1E, 7 bytes, score = 0.857 (6 / 7) [cracked]

This one shouldn't be too hard if you think about it :p. Code:

L!zO¹!*

Try it online!

Computes A002627.


问:
Shortest power set implementation

Problem definition

Print out the powerset of a given set. For example:

```<code>[1, 2, 3] => [[], [1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3]]
</code>```

Each element is to be printed on a separate line, so the above example would be printed as:

```<code>[]
[1]
[2]
...
[1, 2, 3]
</code>```

Example code (in D, python example here):

```<code>import std.stdio;

string[][] powerset(string[] set) {
    if (set.length == 1) {
        return [set, []];
    }

    string[][] ret;
    foreach (item; powerset(set[1 .. $])) {
        ret ~= set[0]~item;
        ret ~= item;
    }

    return ret;
}

void main(string[] argv) {
    foreach (set; powerset(argv[1 .. $]))
        writeln(set);
}
</code>```

Input

Elements will be passed as arguments. For example, the example provided above would be passed to a program called powerset as:

```<code>powerset 1 2 3
</code>```

Arguments will be alphanumeric.

Rules

No libraries besides io

Output does not have to be ordered

Powerset does not have to be stored, only printed

Elements in the set must be delimited (e.g. 1,2,3, [1,2,3] and ['1','2','3'] are acceptable, but 123 is not

Trailing delimiters are fine (e.g. 1,2,3, == 1,2,3)

Best is determined based on number of bytes

The best solution will be decided no less than 10 days after the first submission.

答:
Golfscript 48

~:x,:§2\?,{[2base.,§\-[0]*\+x\]zip{~{}{;}if}%p}%
```
<p>This program uses the binary representations of numbers from 0 to length(input) to generate powerset items.</p>
<h3>Input</h3>
<p>The input format is the Golfscript array format (example: <code>[1 2 3]</code>)</p>
<h3>Output</h3>
<p>The output is a collection of arrays separated by newlines, representing the power set. Example:</p>
```[]
[3]
[2]
[2 3]
[1]
[1 3]
[1 2]
[1 2 3]
```

Online Test

The program can be tested online here.

Title: Shortest power set implementation

Body:
Golfscript 48

~:x,:§2\?,{[2base.,§\-[0]*\+x\]zip{~{}{;}if}%p}%

This program uses the binary representations of numbers from 0 to length(input) to generate powerset items.

Input

The input format is the Golfscript array format (example: [1 2 3])

Output

The output is a collection of arrays separated by newlines, representing the power set. Example:

[]
[3]
[2]
[2 3]
[1]
[1 3]
[1 2]
[1 2 3]

Online Test

The program can be tested online here.


答:
Python 2, 78 bytes

f=lambda s,p='\n':(s[2:]and f('/%s\\'%s.translate('/\\'*128)[2:-2],p+' '))+p+s
```

A recursive function that outputs a string. Each layer of the pyramid is appended to the recursive call with the layer above it. The prefix p, which starts as a newline character gains one more space to make the triangle. The next layer is produced by swapping slashes, cutting off the first and last two symbols, and sandwiching it inside a left and right slash.

Python 3 can save a byte by doing *99 in the translate, as the length-256 requirement was dropped.

Title: The Great Pyramid of ASCII

Body:
Python 2, 78 bytes

f=lambda s,p='\n':(s[2:]and f('/%s\\'%s.translate('/\\'*128)[2:-2],p+' '))+p+s

A recursive function that outputs a string. Each layer of the pyramid is appended to the recursive call with the layer above it. The prefix p, which starts as a newline character gains one more space to make the triangle. The next layer is produced by swapping slashes, cutting off the first and last two symbols, and sandwiching it inside a left and right slash.

Python 3 can save a byte by doing *99 in the translate, as the length-256 requirement was dropped.


问:
Can you outgolf me? (Robbers section)

Robbers section

The cops section can be found here.

Challenge

Your task is to outgolf the submissions of the cops in the same language and the same version (for example, Python 3.5 ≠ Python 3.4, so that is not allowed). A submission is outgolfed when the length in bytes is shorter than the original submission. You only need to golf off at least 1 byte in order to crack a submission. E.g. if the task was to perform 2 × n, and the submission was the following:

```<code>print(2*input())
</code>```

You could outgolf the cop by doing the following:

```<code>print 2*input()
</code>```

Or even this (since lambda's are allowed):

```<code>lambda x:2*x
</code>```

Post this with the following header:

```<code>##{language name}, <s>{prev byte count}</s> {byte count}, {cop's submission + link}
</code>```

For example:

Python 2, <s>16</s> 12 bytes, Adnan (+ link to submission)

```<code>lambda x:2*x
</code>```

Computes A005843, (offset = 0).

In that case, you have cracked the submission.

Scoring

The person with who cracked the most submissions is the winner.

Rules

The crack submission must be in the same language as the cop submission.

The same input should result into the same output (so a(2) = 4 should remain 4).

For languages such as Python, you can import libraries that are standard included within the language. (So, no numpy/sympy etc.)

Input and output are both in decimal (base 10).

Note

This challenge is finished. The winner of the Robbers section is feersum. The final scores for the CnR are shown below:

feersum: 16 cracks

Dennis: 12 cracks

Leaky Nun: 6 cracks

Lynn: 4 cracks

miles: 3 cracks

Martin Ender: 2 cracks

Emigna: 2 cracks

jimmy23013: 1 crack

Sp3000: 1 crack

randomra: 1 crack

alephalpha: 1 crack

nimi: 1 crack

Destructible Watermelon: 1 crack

Dom Hastings: 1 crack

答:
05AB1E, <s>7</s> 6 bytes, Adnan

```<code>!¹L!/O
</code>```

or

```<code>!žr<*ï
</code>```

Note that both of these return 1 for 0, but so did the cop program.

Title: Can you outgolf me? (Robbers section)

Body:
05AB1E, <s>7</s> 6 bytes, Adnan

!¹L!/O

or

!žr<*ï

Note that both of these return 1 for 0, but so did the cop program.


问:
Deciphering XKCD colors
Randall Munroe (author of XKCD) held a survey to give names to colors. The main outcome is a list of names for the 954 most common RGB monitor colors.

For ease of programming, here is the list in plain text: http://xkcd.com/color/rgb.txt. Beware, the first line is not data, but contains the license.

Write a program or function that takes a valid color name from above list as input and outputs the associated RGB color code. Your program does not have to handle invalid inputs in any defined manner.

Standard loopholes apply. Additionally, your answer must not use pre-defined (built-in or external) color code <-> color name maps. (This includes the linked list.) Shortest code in bytes wins. If you read from a file, the file's byte count must be included.

Examples:

```<code>dark peach -> #de7e5d
robin's egg blue -> #98eff9
pink/purple -> #ef1de7
</code>```

答:
Bash + coreutils/xxd, 4064 bytes

Data 3796 bytes (hex dump of data file)

Bash 268 bytes

```<code>h=`md5sum<<<$1|xxd -r -p|xxd -b -g0 -l128 -c128|cut -c18,20,26,41,46,49,65,85,88,90,94,95,118,135`;case $1 in mud|aqua?blue)h=0${h%0};;esac;xxd -b -g4 -c4 d|while read -r x;do let b+=2#${x:23:2};case ${x:9:14} in $h)printf '#%04x%02x\n' $((2#${x:25:16})) $b;;esac;done
</code>```

Ungolfed

```<code># Set h to select 14 bits from the md5sum in base 2
h=`md5sum<<<$1 | \
   xxd -r -p|xxd -b -g0 -l128 -c128|cut -c18,20,26,41,46,49,65,85,88,90,94,95,118,135`
# Disambiguate hash collisions
case $1 in
   mud|aqua?blue)
      h=0${h%0}
      ;;
esac
# process each 32-bit record:
#   First 14 bits are hash
#   Next 2 bits are blue deltas
#   Final 16 bits rg
xxd -b -g4 -c4 d | \
   while read -r x; do
      let b+=2#${x:23:2};
      case ${x:9:14}
         in $h)
            printf '#%04x%02x\n' $((2#${x:25:16})) $b
            ;;
      esac;
   done
</code>```

The overall idea is to scan through 32-bit fields, find the matching unique 14-bit hash, and print the color code at that location.  The 18-bit color encoding leverages Super Chafouin's approach.

The unique 14-bit hash starts with a subset of 14 of the bits from the 128-bit md5sum.  To find those bits I used a genetic algorithm coded in C++ here.  The code pre-loads a fixed file called "data", which is just the md5sum's, one per line, in binary.  If you need that in recipe form, this will create the data file:

```<code>(cut -f1 rgb.txt|while read x; do md5sum<<<$x | xxd -r -p | xxd -b -g16 -c16| cut -d' ' -f 2;done) > data
</code>```

I find the best candidate 14 bits (that I've seen so far) from this code in generation 2, but this set has two collisions.  Specifically: "mud" and "pale purple" map to the same value, and "aqua blue" and "light green" map to the same value.  Since there are only two collisions and I haven't found anything better, I just disambiguate them; turns out half of each of these bucket values is unused.

I already tried compression on d; but neither bzip2, nor gzip, nor xz appears to shrink d's size.

Title: Deciphering XKCD colors

Body:
Bash + coreutils/xxd, 4064 bytes

Data 3796 bytes (hex dump of data file)

Bash 268 bytes

h=`md5sum<<<$1|xxd -r -p|xxd -b -g0 -l128 -c128|cut -c18,20,26,41,46,49,65,85,88,90,94,95,118,135`;case $1 in mud|aqua?blue)h=0${h%0};;esac;xxd -b -g4 -c4 d|while read -r x;do let b+=2#${x:23:2};case ${x:9:14} in $h)printf '#%04x%02x\n' $((2#${x:25:16})) $b;;esac;done

Ungolfed

# Set h to select 14 bits from the md5sum in base 2
h=`md5sum<<<$1 | \
   xxd -r -p|xxd -b -g0 -l128 -c128|cut -c18,20,26,41,46,49,65,85,88,90,94,95,118,135`
# Disambiguate hash collisions
case $1 in
   mud|aqua?blue)
      h=0${h%0}
      ;;
esac
# process each 32-bit record:
#   First 14 bits are hash
#   Next 2 bits are blue deltas
#   Final 16 bits rg
xxd -b -g4 -c4 d | \
   while read -r x; do
      let b+=2#${x:23:2};
      case ${x:9:14}
         in $h)
            printf '#%04x%02x\n' $((2#${x:25:16})) $b
            ;;
      esac;
   done

The overall idea is to scan through 32-bit fields, find the matching unique 14-bit hash, and print the color code at that location.  The 18-bit color encoding leverages Super Chafouin's approach.

The unique 14-bit hash starts with a subset of 14 of the bits from the 128-bit md5sum.  To find those bits I used a genetic algorithm coded in C++ here.  The code pre-loads a fixed file called "data", which is just the md5sum's, one per line, in binary.  If you need that in recipe form, this will create the data file:

(cut -f1 rgb.txt|while read x; do md5sum<<<$x | xxd -r -p | xxd -b -g16 -c16| cut -d' ' -f 2;done) > data

I find the best candidate 14 bits (that I've seen so far) from this code in generation 2, but this set has two collisions.  Specifically: "mud" and "pale purple" map to the same value, and "aqua blue" and "light green" map to the same value.  Since there are only two collisions and I haven't found anything better, I just disambiguate them; turns out half of each of these bucket values is unused.

I already tried compression on d; but neither bzip2, nor gzip, nor xz appears to shrink d's size.


问:
Calculate the difficulty of a Code Golf question

Briefing

The difficulty of a Code Golf question can be calculated as such:

$$\text{clamp} \left( \left\lceil \left( \frac v a \div 700 \right) \times 10 \right\rceil, 0, 10 \right)$$

Where \$v\$ is the number of views a question has

and \$a\$ is the number of answers a question has

and \$⌈x⌉\$ is the ceiling operator.

Also:

$$\text{clamp}(x, min, max) = \begin{cases}
min & x < min \\
x   & min \le x \le max \\
max & max < x
\end{cases}$$

This question's current difficulty: ***

Task

Write a program that will take two integers (v and a) and output the difficulty in asterisks (*).

The input can be in the form of an array, a separated string or as separate function arguments

Test Data

```<code>Views   Answers Difficulty  Program Output
163     2       2           **
548     22      1           *
1452    24      1           *
1713    37      1           *
4162    32      2           **
3067    15      3           ***
22421   19      10          **********
</code>```

Example with pseudocode

```<code>v: 1713
a: 37
out = clamp(ceil(((v/a)/700)*10), 0, 10); // evaluates to 1
//program will output '*'
</code>```

The shortest code in bytes wins! Trailing/ leading spaces are allowed.

答:
EXCEL, 29 bytes

If you count Excel as a representation of VBA Excel, then you can use

```<code>=REPT("*",MIN(1+v/(70*a),10))
</code>```

where v and a are the name of reference cells.

ContentLicense: CC BY-SA 4.0

Body:
EXCEL, 29 bytes

If you count Excel as a representation of VBA Excel, then you can use

=REPT("*",MIN(1+v/(70*a),10))

where v and a are the name of reference cells.


答:
Bash, <s>19</s> 17 bytes

Prints lower-case a:

```<code>printf \\$[282/2]
</code>```

(Thanks to Dennis for reminding me of the deprecated syntax)

Title: The Letter A without A

Body:
Your task is to display the letter "A" alone, without anything else, except any form of trailing newlines if you cannot avoid them, doing so in a program and/or snippet. Code that returns (instead of printing) is allowed.

Both the lowercase and uppercase versions of the letter "A" are acceptable (that is, unicode U+0061 or unicode U+0041. Other character encodings that aren't Unicode are allowed, but either way, the resulting output of your code must be the latin letter "A", and not any lookalikes or homoglyphs)

You must not use any of the below characters in your code, regardless of the character encoding that you pick:

"A", whether uppercase or lowercase.

"U", whether lowercase or uppercase.

X, whether uppercase or lowercase.

+

&

#

0

1

4

5

6

7

9

Cheating, loopholes, etc, are not allowed.

Since this is code-golf, the shortest solution, in bytes, that follows all the rules, is the winner.

Validity Checker

This Stack Snippet checks to make sure your code doesn't use the restricted characters. It might not work properly for some character encodings.

var t = prompt("Input your code.");

if (/[AaUuXx+&#0145679]/.test(t)) {
  alert("Contains a disallowed character!");
} else {
  alert("No disallowed characters");
}```
</div>
</div>
</p>

<p><em>This Stack Snippet that makes sure you don't have a disallowed character is also available on JSFiddle.</em></p>

<h3>Leaderboard</h3>

<p><div class="snippet" data-lang="js" data-hide="true" data-console="false" data-babel="false">
<div class="snippet-code snippet-currently-hidden">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var QUESTION_ID=90349,OVERRIDE_USER=58717;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="<h1>"+e.body.replace(OVERRIDE_REG,"")+"</h1>")});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;/<a/.test(o)&&(o=jQuery(o).text()),s[o]=s[o]||{lang:e.language,user:e.user,size:e.size,link:e.link}});var t=[];for(var o in s)s.hasOwnProperty(o)&&t.push(s[o]);t.sort(function(e,s){return e.lang>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;</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}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr></thead> <tbody id="answers"> </tbody> </table> </div><div id="language-list"> <h2>Winners by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr></thead> <tbody id="languages"> </tbody> </table> </div><table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td>Link</td></tr></tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td>Link</td></tr></tbody> </table></code>```

Body:
Bash, <s>19</s> 17 bytes

Prints lower-case a:

printf \\$[282/2]

(Thanks to Dennis for reminding me of the deprecated syntax)


问:
Exponentially Slimy Programming: Stacking Minecraft Slimes
Slimes are cube shaped enemies in Minecraft that break into multiple smaller versions of themselves when killed. For the purposes of this challenge we'll depict them as an 8×8 pixel image with 3 colors:

 ← True 8×8 version.

The precise RGB colors are:

0, 0, 0 for the eyes and mouth

110, 170, 90 for the central, darker green

116, 196, 96 for the outer, lighter green

Challenge

Write a program or function that takes in a positive integer N and outputs an image of N sizes of slimes packed into a rectangle. Going from left to right, the image should follow the pattern of having:

A stack of 2(N-1) 8×8 slimes.

A stack of 2(N-2) 16×16 slimes.

A stack of 2(N-3) 32×32 slimes.

And so on until the stack only contains one slime.

The slime images larger than the 8×8 version () are generated by nearest-neighbor upsampling (i.e. just doubling all the pixels). Note that you must use the exact slime design and colors given here.

The final image will contain 2N-1 slimes and be 2(N+3)-8 pixels wide and 2(N+2) pixels tall.

The image may be output in any common image file format, saved to a file or printed/returned as a raw data stream, or directly displayed during runtime.

The shortest code in bytes wins.

Examples

Your program should produce these exact results.

N = 1:

N = 2:

N = 3:

N = 4:

N = 5:

N = 6:

Larger N should work just as well.

答:
Dyalog APL, <s>118</s> 113 bytes

('P3',⌽∘⍴,255,∊)(3↑(116 196 96)(110 170 90))[⊃,/i{⊃⍪/⍵⍴⊂⍺⌿⍺/8 8⍴∊22923813097005 926134669613412⊤¨⍨⊂32⍴3}¨⌽i←2*⍳⎕]

assuming ⎕IO=0

From right to left:

i←2*⍳⎕  powers 1 2 4 ... 2n-1

i{ }¨⌽i iterate over powers (with ⍺) and reversed powers (⍵)

⊤¨⍨⊂32⍴3 decode each of the numbers on the left as 32 ternary digits

8 8⍴∊ flatten and reshape to 8×8

⍺⌿⍺/ replicate each row and column ⍺ times

⍵⍴⊂ take ⍵ copies

⊃⍪/ and stack them vertically

⊃,/ join all results horizontally

3↑(116 196 96)(110 170 90) colours; 3↑ extends them with (0 0 0)

[ ] index the colours with each element of the matrix; result is a matrix of RGBs

('P3',⌽∘⍴,255,∊) is a "train" - a function that returns 'P3' followed by the reversed shape of the argument, 255, and the argument flattened.


问:
Decompose a number!
Your task is to decompose a number using the format below.

This is similar to base conversion, except that instead of listing the digits in the base, you list the values, such that the list adds up to the input.

If the given base is \$n\$, then each number in the list must be in the form of \$k\times n^m\$, where \$0\le k<n\$ and \$m\$ is unique throughout the list.

Specs

Any reasonable input/output format. Your program/function takes 2 inputs and outputs a list.

Output list can be in any order.

0 can be excluded or included.

Leading 0s are allowed.

Built-ins are allowed.

Testcases

```<code>number base   converted list
input1 input2 output
123456 10     [100000,20000,3000,400,50,6] or [6,50,400,3000,20000,100000]
11     2      [8,2,1] or [0,0,0,0,8,0,2,1]
727    20     [400,320,7]
101    10     [100,1] or [100,0,1]
</code>```

Scoring

This is code-golf. Shortest solution in bytes wins.

答:
Actually, 17 bytes

```<code>;a¡;lrR(♀ⁿ@♂≈♀*;░
</code>```

Try it online!

Explanation:

```<code>;a¡;lrR(♀ⁿ@♂≈♀*;░
                   initial stack: [b n] (b = base, n = number)
;                  dupe b
 a                 invert stack
  ¡                n as a base-b integer
   ;lrR            dupe, length, range, reverse
       (♀ⁿ         raise b to each power in range
          @♂≈      create list of integers from base-b string
             ♀*    pairwise multiplication
               ;░  filter out zeroes
</code>```

Title: Decompose a number!

Body:
Actually, 17 bytes

;a¡;lrR(♀ⁿ@♂≈♀*;░

Try it online!

Explanation:

;a¡;lrR(♀ⁿ@♂≈♀*;░
                   initial stack: [b n] (b = base, n = number)
;                  dupe b
 a                 invert stack
  ¡                n as a base-b integer
   ;lrR            dupe, length, range, reverse
       (♀ⁿ         raise b to each power in range
          @♂≈      create list of integers from base-b string
             ♀*    pairwise multiplication
               ;░  filter out zeroes


答:
Dyalog APL, 12 bytes

⊃⎕DR/88-8 23

Equivalent to 80 ⎕DR 65

Title: The Letter A without A


Title: The Great Pyramid of ASCII

Body:
Ruby, 80 bytes

f=->s{s[-3]>?!&&f[" "+s.gsub(/^( *\/).|.(.$)?/){$1||$2||($&>?/??/:?\\)}]
puts s}

Ungolfed

f = ->s{
  s[-3] > ?! &&
    f[" " + s.gsub(/^( *\/).|.(.$)?/) {
      $1 || $2 || ($& > ?/ ? ?/ : ?\\)
    }]
  puts s
}

See it on ideone: http://ideone.com/HN0l0Y


问:
Generate a "GitHub" Avatar

Background / Description

Note: as @HelkaHomba points out, the actual GitHub identicons are not actually random but based on the hash of a username

The default GitHub avatar is a 5x5-pixel image. A color is picked randomly, and then random pixels are filled in on one side (right or left, 2x5 size) using that color. Then that side is copied & flipped to the other side, across the y-axis. The pixels left over that are not filled in are #F0F0F0, or rgb(240,240,240).

The center column's pixels (1x5 size) are then randomly filled in, using the same color as previously.

Output

Note: for this challenge we will ignore the space that encloses the GitHub avatars

The program should output a 5x5 pixel image file. See http://meta.codegolf.stackexchange.com/a/9095/42499 for specifics

Examples

Note: these were obviously scaled up from 5x5 so you can see them

Good luck!

答:
Dyalog APL, <s>43</s> 42 bytes

<s>'P3',5 5 256,∊(3⍴240)(?3⍴256)[⌈(⊢+⌽)?5 5⍴0]</s>

'P3',5 5a,∊(3⍴240)(?3⍴a←256)[⌈(⊢+⌽)?5 5⍴0]

Right to left:

?5 5⍴0 generates a 5×5 matrix of random numbers between 0 and 1 (but never 0 or 1)

(⊢+⌽) is a train that adds the matrix with its reflection

⌈ ceiling, returns 1 or 2 for each element

(3⍴240)(?3⍴256) colours - white-ish and a random one

[ ] use each element of the matrix as an index in colours

'P3',5 5 256,∊ flatten and add header

Title: Generate a "GitHub" Avatar


答:
Mathematica 16

Code

Subsets is native to Mathematica.

```<code>Column@Subsets@s
</code>```

The code (without column) can be verified on WolframAlpha. (I had to use brackets instead of @; they mean the same thing.

Usage

```<code>s={1,2,3}
Column@Subsets@s
</code>```

This method (55 chars) uses the approach suggested by @w0lf.

```<code>s #&/@Tuples[{0,1},Length@s]/.{0:>Sequence[]}//Column
</code>```

Breakdown

Generate the tuples, composed of 0 and 1's of length Length[s]

```<code>Tuples[{0, 1}, Length@s]
</code>```

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

Multiply the original list (vector) by each tuple:

```<code>s # & /@ Tuples[{0, 1}, Length@s]
</code>```

{{0, 0, 0}, {0, 0, 3}, {0, 2, 0}, {0, 2, 3}, {1, 0, 0}, {1, 0, 3}, {1,
     2, 0}, {1, 2, 3}}

Delete the 0's. % is shorthand for "the preceding output".

%/. {0 :> Sequence[]}

{{}, {3}, {2}, {2, 3}, {1}, {1, 3}, {1, 2}, {1, 2, 3}}

Display in column:

Title: Shortest power set implementation

Body:
Problem definition

Print out the powerset of a given set. For example:

```<code>[1, 2, 3] => [[], [1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3]]
</code>```

Each element is to be printed on a separate line, so the above example would be printed as:

```<code>[]
[1]
[2]
...
[1, 2, 3]
</code>```

Example code (in D, python example here):

```<code>import std.stdio;

string[][] powerset(string[] set) {
    if (set.length == 1) {
        return [set, []];
    }

    string[][] ret;
    foreach (item; powerset(set[1 .. $])) {
        ret ~= set[0]~item;
        ret ~= item;
    }

    return ret;
}

void main(string[] argv) {
    foreach (set; powerset(argv[1 .. $]))
        writeln(set);
}
</code>```

Input

Elements will be passed as arguments. For example, the example provided above would be passed to a program called powerset as:

```<code>powerset 1 2 3
</code>```

Arguments will be alphanumeric.

Rules

No libraries besides io

Output does not have to be ordered

Powerset does not have to be stored, only printed

Elements in the set must be delimited (e.g. 1,2,3, [1,2,3] and ['1','2','3'] are acceptable, but 123 is not

Trailing delimiters are fine (e.g. 1,2,3, == 1,2,3)

Best is determined based on number of bytes

The best solution will be decided no less than 10 days after the first submission.

Body:
Mathematica 16

Code

Subsets is native to Mathematica.

Column@Subsets@s

The code (without column) can be verified on WolframAlpha. (I had to use brackets instead of @; they mean the same thing.

Usage

s={1,2,3}
Column@Subsets@s

This method (55 chars) uses the approach suggested by @w0lf.

s #&/@Tuples[{0,1},Length@s]/.{0:>Sequence[]}//Column

Breakdown

Generate the tuples, composed of 0 and 1's of length Length[s]

Tuples[{0, 1}, Length@s]

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

Multiply the original list (vector) by each tuple:

s # & /@ Tuples[{0, 1}, Length@s]

{{0, 0, 0}, {0, 0, 3}, {0, 2, 0}, {0, 2, 3}, {1, 0, 0}, {1, 0, 3}, {1,
     2, 0}, {1, 2, 3}}

Delete the 0's. % is shorthand for "the preceding output".

%/. {0 :> Sequence[]}

{{}, {3}, {2}, {2, 3}, {1}, {1, 3}, {1, 2}, {1, 2, 3}}

Display in column:


问:
The IHIH Pyramid
I find it fascinating how the letters "H" and "I" are very similar. "H" is a horizontal stroke surrounded by two vertical strokes; "I" is a vertical stroke surrounded by two horizontal strokes (depending on your font). I bet this could be nested... You know what that reminds me of? Fractals!!!

Let's define the "IHIH" pyramid as follows: The first iteration is this ASCII representation of the letter "I":

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

The next iteration has a vertical stroke on either side.

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

If you view the "I" in the middle as a single horizontal stroke, then this second iteration is basically an "H". The third iteration adds a horizontal stroke on the top and bottom

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

Again, if you view the "H" in the middle as a single vertical stroke, then this iteration is basically an "I". This pattern continues, alternating between "H"s and "I"s on every iteration. For reference, here are the first 6 iterations:

```<code>1:
---
 |
---

2:
|   |
|---|
| | |
|---|
|   |

3:
-------
 |   |
 |---|
 | | |
 |---|
 |   |
-------

4:
|       |
|-------|
| |   | |
| |---| |
| | | | |
| |---| |
| |   | |
|-------|
|       |

5:
-----------
 |       |
 |-------|
 | |   | |
 | |---| |
 | | | | |
 | |---| |
 | |   | |
 |-------|
 |       |
-----------

6:
|           |
|-----------|
| |       | |
| |-------| |
| | |   | | |
| | |---| | |
| | | | | | |
| | |---| | |
| | |   | | |
| |-------| |
| |       | |
|-----------|
|           |
</code>```

The Challenge:

Write a program or function that outputs the N'th iteration of the IHIH pyramid, and an optional trailing newline. Your input will be a single positive integer in whatever reasonable format you want. You do not have to handle invalid inputs, e.g. non-integers, numbers smaller than 1, etc. Your program must at the very least produce the right output for inputs up to 20. Since this is code-golf, standard loopholes are not allowed and the shortest answer in bytes wins!

答:
APL (Dyalog Classic), 34 bytes

'- |'[2+∘.(≤-(1+=)×2|⌈)⍨(⌽,0,⊢)⍳⎕]
```

<p>Try it online!</p>

<p>(uses <code>⎕io←1</code>)</p>

<p><code>⍳⎕</code> is <code>1 2 ... N</code></p>

<p><code>(⌽,0,⊢)</code> is a train that turns it into <code>-N ... -1 0 1 ... N</code></p>

<p><code>∘.( )⍨</code> executes the parentheses for every pair of coordinates <code>⍺ ⍵</code></p>

<p>the train <code>(≤-(1+=)×2|⌈)</code> or its dfn equivalent <code>{(⍺≤⍵)-(1+⍺=⍵)×2|⍺⌈⍵}</code> produces a matrix like:</p>

<pre class="lang-apl prettyprint-override"><code> ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1
  0  1  0  0  0  0  0  0  0  1  0
  0  1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1  1  0
  0  1  0  1  0  0  0  1  0  1  0
  0  1  0  1 ¯1 ¯1 ¯1  1  0  1  0
  0  1  0  1  0  1  0  1  0  1  0
  0  1  0  1 ¯1 ¯1 ¯1  1  0  1  0
  0  1  0  1  0  0  0  1  0  1  0
  0  1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1  1  0
  0  1  0  0  0  0  0  0  0  1  0
 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1
</code>```

'- |'[2+   ] makes these valid indices in ⎕IO=1 and picks the corresponding characters

Title: The IHIH Pyramid

Body:
APL (Dyalog Classic), 34 bytes

'- |'[2+∘.(≤-(1+=)×2|⌈)⍨(⌽,0,⊢)⍳⎕]

Try it online!

(uses ⎕io←1)

⍳⎕ is 1 2 ... N

(⌽,0,⊢) is a train that turns it into -N ... -1 0 1 ... N

∘.( )⍨ executes the parentheses for every pair of coordinates ⍺ ⍵

the train (≤-(1+=)×2|⌈) or its dfn equivalent {(⍺≤⍵)-(1+⍺=⍵)×2|⍺⌈⍵} produces a matrix like:

 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1
  0  1  0  0  0  0  0  0  0  1  0
  0  1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1  1  0
  0  1  0  1  0  0  0  1  0  1  0
  0  1  0  1 ¯1 ¯1 ¯1  1  0  1  0
  0  1  0  1  0  1  0  1  0  1  0
  0  1  0  1 ¯1 ¯1 ¯1  1  0  1  0
  0  1  0  1  0  0  0  1  0  1  0
  0  1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1  1  0
  0  1  0  0  0  0  0  0  0  1  0
 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1

'- |'[2+   ] makes these valid indices in ⎕IO=1 and picks the corresponding characters


答:
Jelly, 28 26 25 24 bytes

```<code>QṚ,QyḊḊṖṖj@QµÐĿµJ’⁶ẋ⁸żYṚ
</code>```

-4 bytes thanks to Dennis

Recipe:

```<code>QṚ,QyḊḊṖṖj@QµÐĿµJ’⁶ẋ⁸żYṚ - one argument: input()
Q  Q       Q             - set of Left=input(): "/\"
 Ṛ                       - reverse Left: "\/"
  ,                      - Left-pair-Right: ["\/","/\"]
     ḊḊṖṖ                - dequeue Left twice, then pop twice: input()[2:-2]
    y                    - translate Right with mapping in Left: swaps internal slashes
         j@              - join Right with separator Left (@ swaps operands)
            µ  µ         - chain separators to form a 1,1,1 chain of chains
             ÐĿ          - loop while results are unique and collect them
                J        - yield [1,...,len(Left=input())]
                 ’       - decrement: [0,....len(input())-1]
                  ⁶      - " "
                   ẋ     - repeat Left Right times: ["", " ", ...]
                    ⁸ż   - zip Right and Left (⁸ is the link's Left argument):
                                ...pads the loop results
                      Y  - joins Left with line-feeds
                       Ṛ - reverse Left
</code>```

(serve with lemonade, those pyramids make for thirsty workers)

Cook up your own slash pyramid at TryItOnline, or try out all the OP's suggested tasters

Title: The Great Pyramid of ASCII

Body:
Jelly, 28 26 25 24 bytes

QṚ,QyḊḊṖṖj@QµÐĿµJ’⁶ẋ⁸żYṚ

-4 bytes thanks to Dennis

Recipe:

QṚ,QyḊḊṖṖj@QµÐĿµJ’⁶ẋ⁸żYṚ - one argument: input()
Q  Q       Q             - set of Left=input(): "/\"
 Ṛ                       - reverse Left: "\/"
  ,                      - Left-pair-Right: ["\/","/\"]
     ḊḊṖṖ                - dequeue Left twice, then pop twice: input()[2:-2]
    y                    - translate Right with mapping in Left: swaps internal slashes
         j@              - join Right with separator Left (@ swaps operands)
            µ  µ         - chain separators to form a 1,1,1 chain of chains
             ÐĿ          - loop while results are unique and collect them
                J        - yield [1,...,len(Left=input())]
                 ’       - decrement: [0,....len(input())-1]
                  ⁶      - " "
                   ẋ     - repeat Left Right times: ["", " ", ...]
                    ⁸ż   - zip Right and Left (⁸ is the link's Left argument):
                                ...pads the loop results
                      Y  - joins Left with line-feeds
                       Ṛ - reverse Left

(serve with lemonade, those pyramids make for thirsty workers)

Cook up your own slash pyramid at TryItOnline, or try out all the OP's suggested tasters


答:
Batch, 137 bytes

```<code>@echo off
if %1==/\ goto g
set s=%1
set s=\%s:~2,-2%/
set s=%s:/=-%
set s=%s:\=/%
set s=%s:-=\%
call %0 %s% "%~2 "
:g
echo %~2%1
</code>```

Conveniently my use of%~2 and %1 means that I avoid having to spend bytes on setlocal. Explanation: Since Batch won't perform replacements on the empty string, we have to set up the next layer with the "wrong" edges, which will then be corrected as part of the string replacements.

Title: The Great Pyramid of ASCII

Body:
Introduction

It's 2600 BC and people are building pyramids now. They already made the basis of the pyramid but don't know how to continue. So, they called you for help.

The rules of making a pyramid is quite simple. For the layer above the previous layer, all you need to do is follow this step-by-step hand guide:

Cut the edges off the previous layer.

Above the / character, there must be a \ character and vice versa. This applies to every character except the edges.

The leftmost character is always a / and the rightmost character is always \.

Let's take an example of a basis for a pyramid:

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

We cut off the edges, leaving:

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

We change the forward slashes with backward slashes and vice versa:

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

The leftmost character is always a / and the rightmost character is always a \, so we change that:

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

We place this layer on the previous layer:

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

We continue until the top is reached (which looks like /\). So, eventually we get:

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

This is what you need to output.

The task

Given the basis of a pyramid (with a length greater than 3), output the full pyramid. You can safely assume that the leftmost character is / and the rightmost character is a \. You can also assume that the length of the basis is always even. The use of trailing spaces is allowed. The use of leading spaces is also allowed, as long as the pyramid stays in place. The use of 1 trailing and 1 leading newlines is allowed.

Test cases

```<code>Input: /\\\
Output:
 /\
/\\\

Input: //\\///\/\
Output:
    /\
   /\\\
  /\///\
 ///\\\/\
//\\///\/\

Input: /////////////\
Output:
      /\
     /\\\
    /////\
   /\\\\\\\
  /////////\
 /\\\\\\\\\\\
/////////////\
</code>```

This is code-golf, so the submission with the least amount of bytes wins!

Body:
Batch, 137 bytes

@echo off
if %1==/\ goto g
set s=%1
set s=\%s:~2,-2%/
set s=%s:/=-%
set s=%s:\=/%
set s=%s:-=\%
call %0 %s% "%~2 "
:g
echo %~2%1

Conveniently my use of%~2 and %1 means that I avoid having to spend bytes on setlocal. Explanation: Since Batch won't perform replacements on the empty string, we have to set up the next layer with the "wrong" edges, which will then be corrected as part of the string replacements.


答:
C# Interactive (REPL), 21 bytes

```<code>(3<2).ToString()[3-2]
</code>```

I really wonder how much smaller it can become in C# in a REPL environment.

Title: The Letter A without A

Body:
C# Interactive (REPL), 21 bytes

(3<2).ToString()[3-2]

I really wonder how much smaller it can become in C# in a REPL environment.


Title: Calculate the difficulty of a Code Golf question

Body:
Briefing

The difficulty of a Code Golf question can be calculated as such:

$$\text{clamp} \left( \left\lceil \left( \frac v a \div 700 \right) \times 10 \right\rceil, 0, 10 \right)$$

Where \$v\$ is the number of views a question has

and \$a\$ is the number of answers a question has

and \$⌈x⌉\$ is the ceiling operator.

Also:

$$\text{clamp}(x, min, max) = \begin{cases}
min & x < min \\
x   & min \le x \le max \\
max & max < x
\end{cases}$$

This question's current difficulty: ***

Task

Write a program that will take two integers (v and a) and output the difficulty in asterisks (*).

The input can be in the form of an array, a separated string or as separate function arguments

Test Data

```<code>Views   Answers Difficulty  Program Output
163     2       2           **
548     22      1           *
1452    24      1           *
1713    37      1           *
4162    32      2           **
3067    15      3           ***
22421   19      10          **********
</code>```

Example with pseudocode

```<code>v: 1713
a: 37
out = clamp(ceil(((v/a)/700)*10), 0, 10); // evaluates to 1
//program will output '*'
</code>```

The shortest code in bytes wins! Trailing/ leading spaces are allowed.

Body:
Ruby, 27 bytes

->v,a{(?**10)[1..(v/a/70)]}


答:
MATL, <s>77</s> <s>76</s> 74 bytes

```<code>:"')^.,9&Xze`}+.E=p'F3ZaQ8e@qWt3$Y"G@-W1X"]&h[OOO;11 17E]5*29 7U24hhE&vEYG
</code>```

The code works in this commit, which is earlier than the challenge.

You can try it in MATL online. This interpreter is still experimental. If it doesn't work, try refreshing the page and pressing "Run" again.

Here's an example run in the offline interpreter:

Explanation

```<code>:                     % Input N implicitly. Generate range [1 2 ... N]
"                     % For each k in [1 2 ... N]
  ')^.,9&Xze`}+.E=p'  %   Compressed string
  F3Za                %   Decompress with target alphabet [0 1 2]
  Q                   %   Add 1
  8e                  %   Reshape into 8×8 array containing values 1, 2, 3
  @qW                 %   Push 2 raised to k-1
  t                   %   Duplicate
  3$Y"                %   Repelem: interpolate image by factor 2 raised to k-1
  G@-W                %   Push 2 raised to N-k
  1X"                 %   Repmat: repeat the array vertically. Gives a vertical strip
                      %   of repeated subimages
]                     % End for each
&h                    % Concatenate all vertical strips horizontally. This gives a big
                      % 2D array containing 1, 2, 3, which represent the three colors
[OOO;11 17E]5*        % Push array [0 0 0; 11 17 9] and multiply by 5
29 7U24hhE            % Push array [29 49 24] and multiply by 2
&vE                   % Concatenate the two arrays vertically and multiply by 2.
                      % This gives the colormap [0 0 0; 110 170 90; 116 196 96]
YG                    % Take the array and the colormap and display as an image
</code>```

Title: Exponentially Slimy Programming: Stacking Minecraft Slimes

Body:
Slimes are cube shaped enemies in Minecraft that break into multiple smaller versions of themselves when killed. For the purposes of this challenge we'll depict them as an 8×8 pixel image with 3 colors:

 ← True 8×8 version.

The precise RGB colors are:

0, 0, 0 for the eyes and mouth

110, 170, 90 for the central, darker green

116, 196, 96 for the outer, lighter green

Challenge

Write a program or function that takes in a positive integer N and outputs an image of N sizes of slimes packed into a rectangle. Going from left to right, the image should follow the pattern of having:

A stack of 2(N-1) 8×8 slimes.

A stack of 2(N-2) 16×16 slimes.

A stack of 2(N-3) 32×32 slimes.

And so on until the stack only contains one slime.

The slime images larger than the 8×8 version () are generated by nearest-neighbor upsampling (i.e. just doubling all the pixels). Note that you must use the exact slime design and colors given here.

The final image will contain 2N-1 slimes and be 2(N+3)-8 pixels wide and 2(N+2) pixels tall.

The image may be output in any common image file format, saved to a file or printed/returned as a raw data stream, or directly displayed during runtime.

The shortest code in bytes wins.

Examples

Your program should produce these exact results.

N = 1:

N = 2:

N = 3:

N = 4:

N = 5:

N = 6:

Larger N should work just as well.

Body:
MATL, <s>77</s> <s>76</s> 74 bytes

:"')^.,9&Xze`}+.E=p'F3ZaQ8e@qWt3$Y"G@-W1X"]&h[OOO;11 17E]5*29 7U24hhE&vEYG

The code works in this commit, which is earlier than the challenge.

You can try it in MATL online. This interpreter is still experimental. If it doesn't work, try refreshing the page and pressing "Run" again.

Here's an example run in the offline interpreter:

Explanation

:                     % Input N implicitly. Generate range [1 2 ... N]
"                     % For each k in [1 2 ... N]
  ')^.,9&Xze`}+.E=p'  %   Compressed string
  F3Za                %   Decompress with target alphabet [0 1 2]
  Q                   %   Add 1
  8e                  %   Reshape into 8×8 array containing values 1, 2, 3
  @qW                 %   Push 2 raised to k-1
  t                   %   Duplicate
  3$Y"                %   Repelem: interpolate image by factor 2 raised to k-1
  G@-W                %   Push 2 raised to N-k
  1X"                 %   Repmat: repeat the array vertically. Gives a vertical strip
                      %   of repeated subimages
]                     % End for each
&h                    % Concatenate all vertical strips horizontally. This gives a big
                      % 2D array containing 1, 2, 3, which represent the three colors
[OOO;11 17E]5*        % Push array [0 0 0; 11 17 9] and multiply by 5
29 7U24hhE            % Push array [29 49 24] and multiply by 2
&vE                   % Concatenate the two arrays vertically and multiply by 2.
                      % This gives the colormap [0 0 0; 110 170 90; 116 196 96]
YG                    % Take the array and the colormap and display as an image


答:
Octave, <s>13</s> <s>11</s> 8 bytes

Didn't expect to golf this answer down, but wohoo, a bug(?) in Octave made it possible to save two bytes! :) Converting this to a "full program", instead of a function saves an additional three bytes, leaving us with 8 bytes:

```<code>['',833]
</code>```

['',833] concatenates the empty string with the number 883. The ASCII code for A is 65, so 883 might seem a bit odd. I think this must be a bug, but what Octave does when concatenating an empty string and a number is that it takes the number modulus 256. mod(883, 256) == 65 which just so happens to be the ASCII code for A.

Octave does not do this when using the "proper" method, char(883), in which case we will get:

warning: range error for conversion to character value

Title: The Letter A without A

Body:
Octave, <s>13</s> <s>11</s> 8 bytes

Didn't expect to golf this answer down, but wohoo, a bug(?) in Octave made it possible to save two bytes! :) Converting this to a "full program", instead of a function saves an additional three bytes, leaving us with 8 bytes:

['',833]

['',833] concatenates the empty string with the number 883. The ASCII code for A is 65, so 883 might seem a bit odd. I think this must be a bug, but what Octave does when concatenating an empty string and a number is that it takes the number modulus 256. mod(883, 256) == 65 which just so happens to be the ASCII code for A.

Octave does not do this when using the "proper" method, char(883), in which case we will get:

warning: range error for conversion to character value


答:
WolframAlpha, 10 bytes

```<code>chr(88-23)
</code>```

Title: The Letter A without A

Body:
WolframAlpha, 10 bytes

chr(88-23)


答:
C, 220 bytes

```<code>x,y,r;f(n){
printf("P3 %d %d 255 ",(8<<n)-8,4<<n);
for(y=0;y<4<<n;++y)for(r=0;r<n;++r)for(x=0;x<8<<r;++x)
puts("110 170 90\0 116 196 96\0 0 0 0"+12*
(117-"` t5L\rL\ru5tst5` "[x>>r+2|(y>>r)%8*2]>>(x>>r)%4*2&3));}
</code>```

I added useless newlines for readability, score is without these newlines.

Defines a function f(n) that outputs a plain PPM image on stdout.

Body:
C, 220 bytes

x,y,r;f(n){
printf("P3 %d %d 255 ",(8<<n)-8,4<<n);
for(y=0;y<4<<n;++y)for(r=0;r<n;++r)for(x=0;x<8<<r;++x)
puts("110 170 90\0 116 196 96\0 0 0 0"+12*
(117-"` t5L\rL\ru5tst5` "[x>>r+2|(y>>r)%8*2]>>(x>>r)%4*2&3));}

I added useless newlines for readability, score is without these newlines.

Defines a function f(n) that outputs a plain PPM image on stdout.


答:
Acc!!, 523 bytes, score = 0.55067 (288/523) (cracked)

Second try, slightly different sequence.

```<code>N
Count x while _%60-46 {
(_+_%60*5-288)*10+N
}
_/60
Count i while _/27^i {
_+27^i*(_/27^i*26-18)
}
_*3+93
Count i while _/27^i/27%3 {
_-i%2*2+1
Count j while _/3^(3*j+2-i%2)%3 {
_+3^(1+i%2)
Count k while _/3^(3*k+1+i%2)%3-1 {
_+3^(3*k+1+i%2)*26
}
}
}
Count i while _/27^i/3 {
_-_/27^i/3%27*27^i*3+_/3^(3*i+1+_%3)%3*3
}
_/3
Count i while _/100^i {
_*10-_%100^i*9
}
Count i while _/100^i/10 {
_+_/100^i/10%10
Count j while i+1-j {
_+(_%10-_/100^(j+1)%10)*(100^(j+1)-1)
}
}
_/100
Count j while _/100^j {
Write _/100^j%10+48
}
</code>```

Computes A000032, Lucas numbers with offset 0.

Due to Acc!!'s input limitations, the program takes input as a decimal number terminated with a period (.); for example:

```<code>> python acc.py Program.txt
5.
11
</code>```

This program has exponential time complexity, so I wouldn't recommend running it with input greater than about 14 (takes 60 seconds on my laptop). However, given enough time, the algorithm will return the correct result for any positive integer n. Thus: a crack attempt that places any size limits on the input value is invalid.

Title: Can you outgolf me? (Cops section)

Body:
Cops section

The robbers section can be found here.

Thanks to FryAmTheEggman, Peter Taylor, Nathan Merrill, xnor, Dennis, Laikoni and Mego for their contributions.

Challenge

Your task is to write 2 different programs (full programs/functions/etc.) in the same language and the same version (e.g. Python 3.5 ≠ Python 3.4, so that is not allowed), and when given n (using STDIN/function arguments/etc.), compute a(n) where a is an OEIS sequence of your choice. One of those programs is shorter than the other. You only need to submit the longer program of the two. The other one needs to be saved in case of not being cracked after 7 days. Your submission is cracked when your program has been outgolfed (whether it is by 1 byte or more).

For example, if the task you chose was to perform 2 × n, this could be a valid submission (in Python 2):

Python 2, 16 bytes, score = 15 / 16 = 0.9375

```<code>print(2*input())
</code>```

Computes A005843, (offset = 0).

If your submission has been cracked, then you need to state that in your header like so:

Python 2, 16 bytes, score = 15 / 16 = 0.9375, [cracked] + link

```<code>print(2*input())
</code>```

Computes A005843, (offset = 0).

Offset

This can be found on every OEIS page. For example, for A005843, the offset is 0,2. We only need to use the first one, which is 0. This means that the function is defined for all numbers ≥ 0.

In other words, the function OEIS(n) starts with n = 0. Your program needs to work for all cases given by OEIS.

More information can be found here.

Scoring

The score you get for your submission is equal to the following formula:

Score = Length (in bytes) of secret code ÷ Length (in bytes) of public code

The example above has the score 15 ÷ 16 = 0.9375.

The submission with the lowest score wins. Only submissions that have posted their solution will be eligible for winning.

Rules

The task you need to do is an OEIS sequence of your choice.

Given n, output OEIS(n). Deviation is not allowed, so you need to produce the exact same sequence (when given n, you need to output OEIS(n)).

Submissions that are not cracked within a period of 7 days are considered safe after the solution has been posted (submissions older than 7 days that do not have their solution posted are still vulnerable in being cracked).

In your submission, you need to post the following things: language name, byte count, full code, so no pastebin links etc. (to prevent answers like Unary), OEIS sequence, score with lengths of both programs and additionally, the encoding that is used.

Note: the same sequence cannot be posted twice in the same language. (For example, if the sequence A005843 has been done in Pyth, you cannot use Pyth again for that same sequence.)

Input and output are both in decimal (base 10)

Leaderboard

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

Uncracked submissions

 Language	 Score	 User

Sort by: score creation

Safe submissions

 Language	 Score	 User

```

Note

This challenge is finished. The final winner is feersum with his Seed answer. Congratulations! :).

You can still submit new cops, but be aware that they are no longer competing.

Body:
Acc!!, 523 bytes, score = 0.55067 (288/523) (cracked)

Second try, slightly different sequence.

N
Count x while _%60-46 {
(_+_%60*5-288)*10+N
}
_/60
Count i while _/27^i {
_+27^i*(_/27^i*26-18)
}
_*3+93
Count i while _/27^i/27%3 {
_-i%2*2+1
Count j while _/3^(3*j+2-i%2)%3 {
_+3^(1+i%2)
Count k while _/3^(3*k+1+i%2)%3-1 {
_+3^(3*k+1+i%2)*26
}
}
}
Count i while _/27^i/3 {
_-_/27^i/3%27*27^i*3+_/3^(3*i+1+_%3)%3*3
}
_/3
Count i while _/100^i {
_*10-_%100^i*9
}
Count i while _/100^i/10 {
_+_/100^i/10%10
Count j while i+1-j {
_+(_%10-_/100^(j+1)%10)*(100^(j+1)-1)
}
}
_/100
Count j while _/100^j {
Write _/100^j%10+48
}

Computes A000032, Lucas numbers with offset 0.

Due to Acc!!'s input limitations, the program takes input as a decimal number terminated with a period (.); for example:

> python acc.py Program.txt
5.
11

This program has exponential time complexity, so I wouldn't recommend running it with input greater than about 14 (takes 60 seconds on my laptop). However, given enough time, the algorithm will return the correct result for any positive integer n. Thus: a crack attempt that places any size limits on the input value is invalid.


答:
GolfScript, 22 18 characters

```<code>~[[]]{{+}+1$%+}@/`
</code>```

Another attempt in GolfScript with a completely different algorithm. Input format is the same as with w0lf's answer. (online test)

Title: Shortest power set implementation

Body:
GolfScript, 22 18 characters

~[[]]{{+}+1$%+}@/`

Another attempt in GolfScript with a completely different algorithm. Input format is the same as with w0lf's answer. (online test)


Title: Can you outgolf me? (Robbers section)

Body:
Robbers section

The cops section can be found here.

Challenge

Your task is to outgolf the submissions of the cops in the same language and the same version (for example, Python 3.5 ≠ Python 3.4, so that is not allowed). A submission is outgolfed when the length in bytes is shorter than the original submission. You only need to golf off at least 1 byte in order to crack a submission. E.g. if the task was to perform 2 × n, and the submission was the following:

```<code>print(2*input())
</code>```

You could outgolf the cop by doing the following:

```<code>print 2*input()
</code>```

Or even this (since lambda's are allowed):

```<code>lambda x:2*x
</code>```

Post this with the following header:

```<code>##{language name}, <s>{prev byte count}</s> {byte count}, {cop's submission + link}
</code>```

For example:

Python 2, <s>16</s> 12 bytes, Adnan (+ link to submission)

```<code>lambda x:2*x
</code>```

Computes A005843, (offset = 0).

In that case, you have cracked the submission.

Scoring

The person with who cracked the most submissions is the winner.

Rules

The crack submission must be in the same language as the cop submission.

The same input should result into the same output (so a(2) = 4 should remain 4).

For languages such as Python, you can import libraries that are standard included within the language. (So, no numpy/sympy etc.)

Input and output are both in decimal (base 10).

Note

This challenge is finished. The winner of the Robbers section is feersum. The final scores for the CnR are shown below:

feersum: 16 cracks

Dennis: 12 cracks

Leaky Nun: 6 cracks

Lynn: 4 cracks

miles: 3 cracks

Martin Ender: 2 cracks

Emigna: 2 cracks

jimmy23013: 1 crack

Sp3000: 1 crack

randomra: 1 crack

alephalpha: 1 crack

nimi: 1 crack

Destructible Watermelon: 1 crack

Dom Hastings: 1 crack

Body:
Acc!!, <s>523</s> 521 bytes, DLosc

N
Count x while _%60-46 {
(_+_%60*5-288)*10+N
}
_/60
Count i while _/27^i {
_+27^i*(_/27^i*26-18)
}
_*3+93
Count i while _/27^i/27%3 {
_-i%2*2+1
Count j while _/3^(3*j+2-i%2)%3 {
_+3+i%2*6
Count k while _/3^(3*k+1+i%2)%3-1 {
_+3^(3*k+1+i%2)*26
}
}
}
Count i while _/27^i/3 {
_-_/27^i/3%27*27^i*3+_/3^(3*i+1+_%3)%3*3
}
_/3
Count i while _/100^i {
_*10-_%100^i*9
}
Count i while _/100^i/10 {
_+_/100^i/10%10
Count j while i+1-j {
_+(_%10-_/100^(j+1)%10)*(100^(j+1)-1)
}
}
_/100
Count j while _/100^j {
Write _/100^j%10+48
}

I have no idea how this works, but I was able to spot a tiny improvement.

13c13
< _+3^(1+i%2)
---
> _+3+i%2*6


答:
Acc!!, 522 bytes, score = 0.5555 (290 ÷ 522) (cracked)

Third try. Thanks to Dennis for the golfing "help" with the first two. ;^)

```<code>N
Count x while _%60-46 {
(_+_%60*5-288)*10+N
}
_/60*2
Count i while _/27^i {
_+(_/27^i*26-18)*27^i
}
_*3+93
Count i while _/27^i/27%3 {
_-i%2*2+1
Count j while _/3^(3*j+2-i%2)%3 {
_+3+i%2*6
Count k while _/3^(3*k+1+i%2)%3-1 {
_+27^k*3^(i%2)*78
}
}
}
Count i while _/27^i/3 {
_-_/27^i/3%27*27^i*3+_/3^(3*i+1+_%3)%3*3
}
_/3
Count i while _/100^i {
_*10-_%100^i*9
}
Count i while _/100^i/10 {
_+_/100^i/10%10
Count j while i+1-j {
_+(_%10-_/100^(j+1)%10)*(100^(j+1)-1)
}
}
_/100
Count j while _/100^j {
Write _/100^j%10+48
}
</code>```

Computes A005248, Lucas(2*n), offset = 0.

Due to Acc!!'s input limitations, the program takes input as a decimal number terminated with a period (.); for example:

```<code>> python acc.py Program.txt
3.
18
</code>```

This program has exponential time complexity, so I wouldn't recommend running it with input greater than about 7. However, given enough time, the algorithm will return the correct result for any positive integer n. Thus: a crack attempt that places any size limits on the input value is invalid.

Title: Can you outgolf me? (Cops section)

Body:
Acc!!, 522 bytes, score = 0.5555 (290 ÷ 522) (cracked)

Third try. Thanks to Dennis for the golfing "help" with the first two. ;^)

N
Count x while _%60-46 {
(_+_%60*5-288)*10+N
}
_/60*2
Count i while _/27^i {
_+(_/27^i*26-18)*27^i
}
_*3+93
Count i while _/27^i/27%3 {
_-i%2*2+1
Count j while _/3^(3*j+2-i%2)%3 {
_+3+i%2*6
Count k while _/3^(3*k+1+i%2)%3-1 {
_+27^k*3^(i%2)*78
}
}
}
Count i while _/27^i/3 {
_-_/27^i/3%27*27^i*3+_/3^(3*i+1+_%3)%3*3
}
_/3
Count i while _/100^i {
_*10-_%100^i*9
}
Count i while _/100^i/10 {
_+_/100^i/10%10
Count j while i+1-j {
_+(_%10-_/100^(j+1)%10)*(100^(j+1)-1)
}
}
_/100
Count j while _/100^j {
Write _/100^j%10+48
}

Computes A005248, Lucas(2*n), offset = 0.

Due to Acc!!'s input limitations, the program takes input as a decimal number terminated with a period (.); for example:

> python acc.py Program.txt
3.
18

This program has exponential time complexity, so I wouldn't recommend running it with input greater than about 7. However, given enough time, the algorithm will return the correct result for any positive integer n. Thus: a crack attempt that places any size limits on the input value is invalid.


Title: Can you outgolf me? (Robbers section)

Body:
Acc!!, <s>522</s> 514 bytes, DLosc

N
Count x while _%60-46 {
(_+_%60*5-288)*10+N
}
_/60*2
Count i while _/27^i {
_+(_/27^i*26-18)*27^i
}
_*3+93
Count i while _/27^i/27%3 {
_-i%2*2+1
Count j while _/3^(3*j+2-i%2)%3 {
_+3+i%2*6
Count k while _/3^(3*k+1+i%2)%3-1 {
_+27^k*3^(i%2)*78
}
}
}
Count i while _/27^i/3 {
_-_/27^i/3%27*27^i*3+_/3^(3*i+1+_%3)%3*3
}
_/3
Count i while _/100^i {
_*10-_%100^i*9
}
Count i while _/100^i/10 {
_+_/100^i/10%10
Count j while i+2-j {
_+(_%10-_/100^j%10)*(100^j-1)
}
}
_/100
Count j while _/100^j {
Write _/100^j%10+48
}

Not so tiny improvement this time, but I still have no idea what I'm doing.

28,29c28,29
< Count j while i+1-j {
< _+(_%10-_/100^(j+1)%10)*(100^(j+1)-1)
---
> Count j while i+2-j {
> _+(_%10-_/100^j%10)*(100^j-1)

Since (100^j-1) is zero when j = 0, we can loop over the range [0, ..., i + 2) instead of looping over [0, ..., i + 1) and incrementing j. This saves eight bytes.


答:
Pip, 13 bytes

```<code>Wa-:Pa%oo*:b
</code>```

Doing it the old-fashioned way turned out to be shorter than using the TB base-conversion operator. The code runs a while loop until a (the number) is 0. At each iteration, it prints a%o and subtracts it from a. o is preinitialized to 1 and gets multiplied by b (the base) each iteration. (This approach keeps all 0s and also adds a leading 0.)

Try it online!

Title: Decompose a number!

Body:
Your task is to decompose a number using the format below.

This is similar to base conversion, except that instead of listing the digits in the base, you list the values, such that the list adds up to the input.

If the given base is \$n\$, then each number in the list must be in the form of \$k\times n^m\$, where \$0\le k<n\$ and \$m\$ is unique throughout the list.

Specs

Any reasonable input/output format. Your program/function takes 2 inputs and outputs a list.

Output list can be in any order.

0 can be excluded or included.

Leading 0s are allowed.

Built-ins are allowed.

Testcases

```<code>number base   converted list
input1 input2 output
123456 10     [100000,20000,3000,400,50,6] or [6,50,400,3000,20000,100000]
11     2      [8,2,1] or [0,0,0,0,8,0,2,1]
727    20     [400,320,7]
101    10     [100,1] or [100,0,1]
</code>```

Scoring

This is code-golf. Shortest solution in bytes wins.

Body:
Pip, 13 bytes

Wa-:Pa%oo*:b

Doing it the old-fashioned way turned out to be shorter than using the TB base-conversion operator. The code runs a while loop until a (the number) is 0. At each iteration, it prints a%o and subtracts it from a. o is preinitialized to 1 and gets multiplied by b (the base) each iteration. (This approach keeps all 0s and also adds a leading 0.)

Try it online!


问:
Tips for golfing in VBA
Similar to this, this, and this question...

What general tips do you have for golfing in VBA? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to VBA (e.g. "remove comments" is not an answer). Please post one tip per answer.

While I have worked with other languages, I'm strongest in VBA, and I don't see many golfers using VBA on this site.

答:
Write and run the VBA code in the Immediate Window

The Immediate Window evaluates any valid VBA executable statement. Simply enter a statement in the Immediate Window as you would in the code editor. It quickly executes VBA code and it can save many additional characters because:

Putting the question mark (?) at the beginning of the statement tells the Immediate Window to display the result of your code.

You don't need to use a Sub and End Sub in your code.

Here is the example of VBA code in the Immediate Window to answer PPCG's post with tag code-golf : The Letter A without A

```<code>?Chr(88-23);
</code>```

answered by Joffan.

Credit images: Excel Campus

Title: Tips for golfing in VBA

Body:
Write and run the VBA code in the Immediate Window

The Immediate Window evaluates any valid VBA executable statement. Simply enter a statement in the Immediate Window as you would in the code editor. It quickly executes VBA code and it can save many additional characters because:

Putting the question mark (?) at the beginning of the statement tells the Immediate Window to display the result of your code.

You don't need to use a Sub and End Sub in your code.

Here is the example of VBA code in the Immediate Window to answer PPCG's post with tag code-golf : The Letter A without A

?Chr(88-23);

answered by Joffan.

Credit images: Excel Campus


问:
Code golf ABC's: The ASCII Box Challenge
Given two positive integers, 'a' and 'b', output an ascii-art "box" that is a characters wide and b characters tall. For example, with '4' and '6':

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

Simple right? Here's the twist: The border of the box must be the characters of "a" and "b" alternating. This starts at the top left corner, and continues in a clockwise spiral. For example, the previous example with 4 and 6 should be

```<code>4646
6  4
4  6
6  4
4  6
6464
</code>```

A and B may be two-digit numbers. For example, the inputs "10" and "3" should output this:

```<code>1031031031
1        0
3013013013
</code>```

In order to keep the output relatively small, you do not have to support three or more digit numbers. Also, since inputs are restricted to positive integers, '0' is an invalid input, which you do not have to handle.

Here are some more test cases:

```<code>Input: (3, 5)
Output:

353
5 5
3 3
5 5
353

Input: (1, 1)
Output:

1

Input: (4, 4)
Output:

4444
4  4
4  4
4444

Input: (27, 1)
Output:

271271271271271271271271271

Input: (1, 17)
Output:

1
1
7
1
1
7
1
1
7
1
1
7
1
1
7
1
1

Input: (12, 34):
Output:

123412341234
4          1
3          2
2          3
1          4
4          1
3          2
2          3
1          4
4          1
3          2
2          3
1          4
4          1
3          2
2          3
1          4
4          1
3          2
2          3
1          4
4          1
3          2
2          3
1          4
4          1
3          2
2          3
1          4
4          1
3          2
2          3
1          4
432143214321
</code>```

You may take input and output in any reasonable format, and standard loopholes are banned. Since this is code-golf, the shortest answer in bytes wins!

Body:
Python 3, <s>155</s> 148 bytes

Golfed off 7 more bytes:

p=print
def f(w,h):
 s=((str(w)+str(h))*w*h)[:2*w+2*h-4or 1];p(s[:w])
 for i in range(h-2):p(['',s[-i-1]][w>1]+' '*(w-2)+s[w+i])
 p(s[1-h:1-h-w:-1])

Substituted 2*w+2*h-4or 1 for max(1,2*w+2*h-4) and
['',s[-i-1]][w>1] for (s[-i-1]if w>1else'').

Prior version:

p=print
def f(w,h):
 s=((str(w)+str(h))*w*h)[:max(1,2*w+2*h-4)];p(s[:w])
 for i in range(h-2):p((s[-i-1]if w>1else'')+' '*(w-2)+s[w+i])
 p(s[1-h:1-h-w:-1])


答:
Fission, 5 bytes

```<code>R'B_O
</code>```

Try it online!

How it works

```<code>R      Spawn an atom that moves to the right.
 'B    Set the atom's mass to 'B'.
   _   Decrement the atom's mass.
    O  Print the character that corresponds to the atoms mass and destroy the atom.
</code>```

Title: The Letter A without A

Body:
Your task is to display the letter "A" alone, without anything else, except any form of trailing newlines if you cannot avoid them, doing so in a program and/or snippet. Code that returns (instead of printing) is allowed.

Both the lowercase and uppercase versions of the letter "A" are acceptable (that is, unicode U+0061 or unicode U+0041. Other character encodings that aren't Unicode are allowed, but either way, the resulting output of your code must be the latin letter "A", and not any lookalikes or homoglyphs)

You must not use any of the below characters in your code, regardless of the character encoding that you pick:

"A", whether uppercase or lowercase.

"U", whether lowercase or uppercase.

X, whether uppercase or lowercase.

+

&

#

0

1

4

5

6

7

9

Cheating, loopholes, etc, are not allowed.

Since this is code-golf, the shortest solution, in bytes, that follows all the rules, is the winner.

Validity Checker

This Stack Snippet checks to make sure your code doesn't use the restricted characters. It might not work properly for some character encodings.

var t = prompt("Input your code.");

if (/[AaUuXx+&#0145679]/.test(t)) {
  alert("Contains a disallowed character!");
} else {
  alert("No disallowed characters");
}```
</div>
</div>
</p>

<p><em>This Stack Snippet that makes sure you don't have a disallowed character is also available on JSFiddle.</em></p>

<h3>Leaderboard</h3>

<p><div class="snippet" data-lang="js" data-hide="true" data-console="false" data-babel="false">
<div class="snippet-code snippet-currently-hidden">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var QUESTION_ID=90349,OVERRIDE_USER=58717;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="<h1>"+e.body.replace(OVERRIDE_REG,"")+"</h1>")});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;/<a/.test(o)&&(o=jQuery(o).text()),s[o]=s[o]||{lang:e.language,user:e.user,size:e.size,link:e.link}});var t=[];for(var o in s)s.hasOwnProperty(o)&&t.push(s[o]);t.sort(function(e,s){return e.lang>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;</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}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr></thead> <tbody id="answers"> </tbody> </table> </div><div id="language-list"> <h2>Winners by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr></thead> <tbody id="languages"> </tbody> </table> </div><table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td>Link</td></tr></tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td>Link</td></tr></tbody> </table></code>```

Body:
Fission, 5 bytes

R'B_O

Try it online!

How it works

R      Spawn an atom that moves to the right.
 'B    Set the atom's mass to 'B'.
   _   Decrement the atom's mass.
    O  Print the character that corresponds to the atoms mass and destroy the atom.