答:
Dyalog APL, 11 bytes

⎕A[∘.⌈⍨⍳26]
```

A[...] pick elements from the uppercase alphabet according to

    ∘.⌈⍨ the maximum table of

    ⍳26 the first 26 integers

TryAPL online!

Title: Print/Output the L-phabet

Body:
Inspired by George Gibson's Print a Tabula Recta.

You are to print/output this exact text:

```<code>ABCDEFGHIJKLMNOPQRSTUVWXYZ
BBCDEFGHIJKLMNOPQRSTUVWXYZ
CCCDEFGHIJKLMNOPQRSTUVWXYZ
DDDDEFGHIJKLMNOPQRSTUVWXYZ
EEEEEFGHIJKLMNOPQRSTUVWXYZ
FFFFFFGHIJKLMNOPQRSTUVWXYZ
GGGGGGGHIJKLMNOPQRSTUVWXYZ
HHHHHHHHIJKLMNOPQRSTUVWXYZ
IIIIIIIIIJKLMNOPQRSTUVWXYZ
JJJJJJJJJJKLMNOPQRSTUVWXYZ
KKKKKKKKKKKLMNOPQRSTUVWXYZ
LLLLLLLLLLLLMNOPQRSTUVWXYZ
MMMMMMMMMMMMMNOPQRSTUVWXYZ
NNNNNNNNNNNNNNOPQRSTUVWXYZ
OOOOOOOOOOOOOOOPQRSTUVWXYZ
PPPPPPPPPPPPPPPPQRSTUVWXYZ
QQQQQQQQQQQQQQQQQRSTUVWXYZ
RRRRRRRRRRRRRRRRRRSTUVWXYZ
SSSSSSSSSSSSSSSSSSSTUVWXYZ
TTTTTTTTTTTTTTTTTTTTUVWXYZ
UUUUUUUUUUUUUUUUUUUUUVWXYZ
VVVVVVVVVVVVVVVVVVVVVVWXYZ
WWWWWWWWWWWWWWWWWWWWWWWXYZ
XXXXXXXXXXXXXXXXXXXXXXXXYZ
YYYYYYYYYYYYYYYYYYYYYYYYYZ
ZZZZZZZZZZZZZZZZZZZZZZZZZZ
</code>```

(Yes, I typed that by hand)

You are allowed to use all lowercase instead of all uppercase.

However, your choice of case must be consistent throughout the whole text.

Rules/Requirements

Each submission should be either a full program or function. If it is a function, it must be runnable by only needing to add the function call to the bottom of the program. Anything else (e.g. headers in C), must be included.

If it is possible, provide a link to a site where your program can be tested.

Your program must not write anything to STDERR.

Standard Loopholes are forbidden.

Your program can output in any case, but it must be printed (not an array or similar).

Scoring

Programs are scored according to bytes, in UTF-8 by default or a different character set of your choice.

Eventually, the answer with the least bytes will win.

Submissions

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

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

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

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

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

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

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

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

Leaderboard

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

/* Configuration */

var QUESTION_ID = 87064; // Obtain this from the url
// It will be like https://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 48934; // This should be the user ID of the challenge author.

/* App */

var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;

function answersUrl(index) {
  return "https://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

function commentUrl(index, answers) {
  return "https://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}

function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });
}

function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });
}

getAnswers();

var SCORE_REG = /<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;

var OVERRIDE_REG = /^Override\s*header:\s*/i;

function getAuthorName(a) {
  return a.owner.display_name;
}

function process() {
  var valid = [];

  answers.forEach(function(a) {
    var body = a.body;
    a.comments.forEach(function(c) {
      if(OVERRIDE_REG.test(c.body))
        body = '
' + c.body.replace(OVERRIDE_REG, '') + '
';
    });

    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        language: match[1],
        link: a.share_link,
      });

  });

  valid.sort(function (a, b) {
    var aB = a.size,
        bB = b.size;
    return aB - bB
  });

  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  valid.forEach(function (a) {
    if (a.size != lastSize)
      lastPlace = place;
    lastSize = a.size;
    ++place;

    var answer = jQuery("#answer-template").html();
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", a.user)
                   .replace("{{LANGUAGE}}", a.language)
                   .replace("{{SIZE}}", a.size)
                   .replace("{{LINK}}", a.link);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);

    var lang = a.language;
    if (/ b.lang) return 1;
    if (a.lang < b.lang) return -1;
    return 0;
  });

  for (var i = 0; i < langs.length; ++i)
  {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
                       .replace("{{NAME}}", lang.user)
                       .replace("{{SIZE}}", lang.size)
                       .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }

}```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body { text-align: left !important}

#answer-list {
  padding: 10px;
  width: 290px;
  float: left;
}

#language-list {
  padding: 10px;
  width: 290px;
  float: left;
}

table thead {
  font-weight: bold;
}

table td {
  padding: 5px;
}</code>```

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

Body:
Dyalog APL, 11 bytes

⎕A[∘.⌈⍨⍳26]

A[...] pick elements from the uppercase alphabet according to

    ∘.⌈⍨ the maximum table of

    ⍳26 the first 26 integers

TryAPL online!


问:
"Break" a number

Origins

tl;dw (too lazy, didn't write): thought of it right before I fell asleep

Challenge

Breaking a number is defined as the following steps:

Take a number or a parseable data type as input in any allowed way.

Duplicate the first digit (64 -> 664)

Subtract 4 from the last digit (664 -> 660)

If the subtraction gets a negative last digit, move the negative sign (-) to the front of the number (73 -> 773 -> -771)

If the original number was negative, and the last digit becomes negative, remove all negative signs entirely. (-44441 -> 444443)

Output the number in any allowed way.

Here are a few test cases:

```<code>64 -> 660
73 -> -771
thisisnotanumber -> (handle the situation)
432188 -> 4432184
-83213 -> 883211 (two negative signs turn into a positive)
0 -> -4 (0 -> 00 -> 0-4 -> -04 -> -4)
</code>```

Clarifications

Standard loopholes are disallowed.

By "parseable data type", I mean any data type (String, Float, etc) that can be converted into the number type your program/function uses (Integer, Number, etc).

Your answer can be a function or a program. In both cases, provide an explanation of the code.

If it is a function, give a usage of it.

Test cases (or online interpreter) would be a nice plus to your answer.

Preceding 0s (-04) aren't allowed.

Behavior should be exactly replicated from the test cases above.

答:
C, 191 bytes

f(char*n){if(!isdigit(*n)&!isdigit(n[1]))return 0;char*m;strcpy(m+1,n);*m=m[1];if(*n==45)m[1]=m[2];int a=strlen(n);if(m[a]<52)m[a]=100-m[a],m--,*m=45;else m[a]-=4;return atoi(m[1]^45?m:m+2);}
```
<p>Ungolfed with explanations:</p>
<pre class="lang-c prettyprint-override"><code>f(char*n){
    if(!isdigit(*n)&!isdigit(n[1])) /* if first two chars aren't digits
                                     * if it was only the first one, negative numbers wouldn't pass
                                     * if it was only the second one, 0 wouldn't pass */
        return 0;        // handling
    char*m;
    strcpy(m+1,n);        // copy leaving space for doubling the number
    *m=m[1];              // double the first digit or the minus sign
    if(*n==45)            // if negative
        m[1]=m[2];        // double the first digit
    int a=strlen(n);      /* length of the nunber
                           * it doesn't let me save 2 bytes, i dunno why. */
    if(m[a]<52)           // if the last digit is less than 4
        m[a]=100-m[a],    // subtract 4
        m--,              // leave space for minus sign
        *m=45;            // put minus sign
    else
        m[a]-=4;          // subtract 4 from the last digit
    return atoi(m[1]^45?m:m+2); /* if there are two minus signs, skip them,
                                 * turn the string into an integer, and return */
}
</code>```

ContentLicense: CC BY-SA 3.0

Title: "Break" a number

Body:
C, 191 bytes

f(char*n){if(!isdigit(*n)&!isdigit(n[1]))return 0;char*m;strcpy(m+1,n);*m=m[1];if(*n==45)m[1]=m[2];int a=strlen(n);if(m[a]<52)m[a]=100-m[a],m--,*m=45;else m[a]-=4;return atoi(m[1]^45?m:m+2);}

Ungolfed with explanations:

f(char*n){
    if(!isdigit(*n)&!isdigit(n[1])) /* if first two chars aren't digits
                                     * if it was only the first one, negative numbers wouldn't pass
                                     * if it was only the second one, 0 wouldn't pass */
        return 0;        // handling
    char*m;
    strcpy(m+1,n);        // copy leaving space for doubling the number
    *m=m[1];              // double the first digit or the minus sign
    if(*n==45)            // if negative
        m[1]=m[2];        // double the first digit
    int a=strlen(n);      /* length of the nunber
                           * it doesn't let me save 2 bytes, i dunno why. */
    if(m[a]<52)           // if the last digit is less than 4
        m[a]=100-m[a],    // subtract 4
        m--,              // leave space for minus sign
        *m=45;            // put minus sign
    else
        m[a]-=4;          // subtract 4 from the last digit
    return atoi(m[1]^45?m:m+2); /* if there are two minus signs, skip them,
                                 * turn the string into an integer, and return */
}


问:
Print/Output the L-phabet
Inspired by George Gibson's Print a Tabula Recta.

You are to print/output this exact text:

```<code>ABCDEFGHIJKLMNOPQRSTUVWXYZ
BBCDEFGHIJKLMNOPQRSTUVWXYZ
CCCDEFGHIJKLMNOPQRSTUVWXYZ
DDDDEFGHIJKLMNOPQRSTUVWXYZ
EEEEEFGHIJKLMNOPQRSTUVWXYZ
FFFFFFGHIJKLMNOPQRSTUVWXYZ
GGGGGGGHIJKLMNOPQRSTUVWXYZ
HHHHHHHHIJKLMNOPQRSTUVWXYZ
IIIIIIIIIJKLMNOPQRSTUVWXYZ
JJJJJJJJJJKLMNOPQRSTUVWXYZ
KKKKKKKKKKKLMNOPQRSTUVWXYZ
LLLLLLLLLLLLMNOPQRSTUVWXYZ
MMMMMMMMMMMMMNOPQRSTUVWXYZ
NNNNNNNNNNNNNNOPQRSTUVWXYZ
OOOOOOOOOOOOOOOPQRSTUVWXYZ
PPPPPPPPPPPPPPPPQRSTUVWXYZ
QQQQQQQQQQQQQQQQQRSTUVWXYZ
RRRRRRRRRRRRRRRRRRSTUVWXYZ
SSSSSSSSSSSSSSSSSSSTUVWXYZ
TTTTTTTTTTTTTTTTTTTTUVWXYZ
UUUUUUUUUUUUUUUUUUUUUVWXYZ
VVVVVVVVVVVVVVVVVVVVVVWXYZ
WWWWWWWWWWWWWWWWWWWWWWWXYZ
XXXXXXXXXXXXXXXXXXXXXXXXYZ
YYYYYYYYYYYYYYYYYYYYYYYYYZ
ZZZZZZZZZZZZZZZZZZZZZZZZZZ
</code>```

(Yes, I typed that by hand)

You are allowed to use all lowercase instead of all uppercase.

However, your choice of case must be consistent throughout the whole text.

Rules/Requirements

Each submission should be either a full program or function. If it is a function, it must be runnable by only needing to add the function call to the bottom of the program. Anything else (e.g. headers in C), must be included.

If it is possible, provide a link to a site where your program can be tested.

Your program must not write anything to STDERR.

Standard Loopholes are forbidden.

Your program can output in any case, but it must be printed (not an array or similar).

Scoring

Programs are scored according to bytes, in UTF-8 by default or a different character set of your choice.

Eventually, the answer with the least bytes will win.

Submissions

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

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

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

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

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

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

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

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

Leaderboard

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

/* Configuration */

var QUESTION_ID = 87064; // Obtain this from the url
// It will be like https://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 48934; // This should be the user ID of the challenge author.

/* App */

var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;

function answersUrl(index) {
  return "https://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

function commentUrl(index, answers) {
  return "https://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}

function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });
}

function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });
}

getAnswers();

var SCORE_REG = /<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;

var OVERRIDE_REG = /^Override\s*header:\s*/i;

function getAuthorName(a) {
  return a.owner.display_name;
}

function process() {
  var valid = [];

  answers.forEach(function(a) {
    var body = a.body;
    a.comments.forEach(function(c) {
      if(OVERRIDE_REG.test(c.body))
        body = '
' + c.body.replace(OVERRIDE_REG, '') + '
';
    });

    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        language: match[1],
        link: a.share_link,
      });

  });

  valid.sort(function (a, b) {
    var aB = a.size,
        bB = b.size;
    return aB - bB
  });

  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  valid.forEach(function (a) {
    if (a.size != lastSize)
      lastPlace = place;
    lastSize = a.size;
    ++place;

    var answer = jQuery("#answer-template").html();
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", a.user)
                   .replace("{{LANGUAGE}}", a.language)
                   .replace("{{SIZE}}", a.size)
                   .replace("{{LINK}}", a.link);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);

    var lang = a.language;
    if (/ b.lang) return 1;
    if (a.lang < b.lang) return -1;
    return 0;
  });

  for (var i = 0; i < langs.length; ++i)
  {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
                       .replace("{{NAME}}", lang.user)
                       .replace("{{SIZE}}", lang.size)
                       .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }

}```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body { text-align: left !important}

#answer-list {
  padding: 10px;
  width: 290px;
  float: left;
}

#language-list {
  padding: 10px;
  width: 290px;
  float: left;
}

table thead {
  font-weight: bold;
}

table td {
  padding: 5px;
}</code>```

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

答:
C#, 147 bytes

void e(){for(int i=0,j=97;i<26;i++,j++)Console.WriteLine(new string((char)j,i)+new string(Enumerable.Range(j,26-i).Select(n=>(char)n).ToArray()));}
```

sometimes i wonder why im even trying

edit: fixed it

Try it online

Title: Print/Output the L-phabet

Body:
C#, 147 bytes

void e(){for(int i=0,j=97;i<26;i++,j++)Console.WriteLine(new string((char)j,i)+new string(Enumerable.Range(j,26-i).Select(n=>(char)n).ToArray()));}

sometimes i wonder why im even trying

edit: fixed it

Try it online


答:
Python 2, <s>76</s> <s>70</s> 68 bytes

a=range(65,91)
i=0
for c in a:a[:i]=[c]*i;i+=1;print'%c'*26%tuple(a)
```

Very similar to my answer to the linked question.

Saved 2 bytes thanks to @xnor (again)!

Title: Print/Output the L-phabet

Body:
Python 2, <s>76</s> <s>70</s> 68 bytes

a=range(65,91)
i=0
for c in a:a[:i]=[c]*i;i+=1;print'%c'*26%tuple(a)

Very similar to my answer to the linked question.

Saved 2 bytes thanks to @xnor (again)!


问:
Regions of regular polygons
Given a regular N-gon with all diagonals drawn, how many regions do the diagonals form?

For example, a regular triangle has exactly 1, a square has exactly 4, pentagon has exactly 11, and a hexagon has 24.

score is inversely proportional to number of bytes in solution

small fudge factors may be added to scores based on their runtime

the region surrounding the polygon does not count

答:
Mathematica 118

Although  there are well-defined routines for computing the number of regions in a regular n-gon with all the diagonals drawn, they are quite cumbersome. I thought it might be fun to take an image processing approach: if we draw the n-gon with it's diagonals, would it be possible to count the regions from the drawn image (more precisely, from the rasterized and binarized representation of the image as an array)?

The following produces and processes an actual image of a polygon and determines the number of regions from the rasterized image.

```<code>Table[MorphologicalEulerNumber@Binarize@Rasterize@CompleteGraph[k, ImageSize->1200,EdgeStyle->Thickness[Large]],{k,3,14}]
</code>```

{1, 3, 11, 24, 50, 80, 154, 220, 375, 444, 781, 952}

This is what might be referred to as an engineer's solution. It gets the job done, but only within some limited conditions. (And it's slow: the above code took 4.24 s to run.) The above routine works correctly up to and including a 14-Complete graph, shown below. I found this surprising, given that some of 952 regions are very difficult to see, even when the image is displayed at 1200 by 1200 pixels.

The picture below is the image before being rasterized and binarized.

Title: Regions of regular polygons

Body:
Mathematica 118

Although  there are well-defined routines for computing the number of regions in a regular n-gon with all the diagonals drawn, they are quite cumbersome. I thought it might be fun to take an image processing approach: if we draw the n-gon with it's diagonals, would it be possible to count the regions from the drawn image (more precisely, from the rasterized and binarized representation of the image as an array)?

The following produces and processes an actual image of a polygon and determines the number of regions from the rasterized image.

Table[MorphologicalEulerNumber@Binarize@Rasterize@CompleteGraph[k, ImageSize->1200,EdgeStyle->Thickness[Large]],{k,3,14}]

{1, 3, 11, 24, 50, 80, 154, 220, 375, 444, 781, 952}

This is what might be referred to as an engineer's solution. It gets the job done, but only within some limited conditions. (And it's slow: the above code took 4.24 s to run.) The above routine works correctly up to and including a 14-Complete graph, shown below. I found this surprising, given that some of 952 regions are very difficult to see, even when the image is displayed at 1200 by 1200 pixels.

The picture below is the image before being rasterized and binarized.


答:
Python 3, <s>71</s> 65 bytes

Thanks to @LeakyNun for -6 bytes

r=range(26)
for i in r:print(''.join(chr(max(i,x)+65)for x in r))
```

A full program that prints to STDOUT.

How it works

We assign character codes to the letters of the alphabet, from 0 for A to 25 for Z. The program loops over the interval [0, 25] with a line counter i, which determines the current character to be repeated and the length of the repeated section, and a character index x. By calling max(i,x), all characters below the repeated character are clamped to the character code of the same. Adding 65 and calling chr converts the resultant character codes to their ASCII equivalents; ''.join concatenates the characters, and each line is printed to STDOUT.

Try it on Ideone

Title: Print/Output the L-phabet

Body:
Python 3, <s>71</s> 65 bytes

Thanks to @LeakyNun for -6 bytes

r=range(26)
for i in r:print(''.join(chr(max(i,x)+65)for x in r))

A full program that prints to STDOUT.

How it works

We assign character codes to the letters of the alphabet, from 0 for A to 25 for Z. The program loops over the interval [0, 25] with a line counter i, which determines the current character to be repeated and the length of the repeated section, and a character index x. By calling max(i,x), all characters below the repeated character are clamped to the character code of the same. Adding 65 and calling chr converts the resultant character codes to their ASCII equivalents; ''.join concatenates the characters, and each line is printed to STDOUT.

Try it on Ideone


答:
///, 348 bytes

```<code>/|/\/\///v/NNN|u/MMM|t/LLL|s/WXYZ|r/OOO|q/KLMa|p/RRRR|o/QQQQ|n/PPPP|m/SSS|l/EFGc|k/RSTb|j/UUUU|i/TTTT|h/WWW|g/VVV|f/XXXX|e/ZZZZZ|d/YYYYY|c/HIJq|b/UVs
|a/NOPQk/ABCDlBBCDlCCCDlDDDDlEEEElFFFFFFGcGGGGGGGcHHHHHHHcIIIIIIIIIJqJJJJJJJJJJqKKKKKKKKKKqttttMauuuuMavvvvNarrrrrPQknnnnQkooooQkppppRkmmmmmmSTbiiiiibjjjjjbgggggggVs
hhhhhhhWs
ffffffYZ
dddddZ
eeeeeZ
</code>```

Try it online!

I've used the same technique to build this as for my /// answer to the challenge this was based on. However, I had to fix the CJam script because it didn't correctly handle substrings that can overlap themselves.

Title: Print/Output the L-phabet

Body:
///, 348 bytes

/|/\/\///v/NNN|u/MMM|t/LLL|s/WXYZ|r/OOO|q/KLMa|p/RRRR|o/QQQQ|n/PPPP|m/SSS|l/EFGc|k/RSTb|j/UUUU|i/TTTT|h/WWW|g/VVV|f/XXXX|e/ZZZZZ|d/YYYYY|c/HIJq|b/UVs
|a/NOPQk/ABCDlBBCDlCCCDlDDDDlEEEElFFFFFFGcGGGGGGGcHHHHHHHcIIIIIIIIIJqJJJJJJJJJJqKKKKKKKKKKqttttMauuuuMavvvvNarrrrrPQknnnnQkooooQkppppRkmmmmmmSTbiiiiibjjjjjbgggggggVs
hhhhhhhWs
ffffffYZ
dddddZ
eeeeeZ

<a href="http://slashes.tryitonline.net/#code=L3wvXC9cLy8vdi9OTk58dS9NTU18dC9MTEx8cy9XWFlafHIvT09PfHEvS0xNYXxwL1JSUlJ8by9RUVFRfG4vUFBQUHxtL1NTU3xsL0VGR2N8ay9SU1RifGovVVVVVXxpL1RUVFR8aC9XV1d8Zy9WVlZ8Zi9YWFhYfGUvWlpaWlp8ZC9ZWVlZWXxjL0hJSnF8Yi9VVnMKfGEvTk9QUWsvQUJDRGxCQkNEbENDQ0RsRERERGxFRUVFbEZGRkZGRkdjR0dHR0dHR2NISEhISEhIY0lJSUlJSUlJSUpxSkpKSkpKSkpKSnFLS0tLS0tLS0tLcXR0dHRNYXV1dXVNYXZ2dnZOYXJycnJyUFFrbm5ublFrb29vb1FrcHBwcFJrbW1tbW1tU1RiaWlpaWliampqampiZ2dnZ2dnZ1ZzCmhoaGhoaGhXcwpmZmZmZmZZWgpkZGRkZFoKZWVlZWVa&input=" rel="nofollow noreferrer">Try it online!

I've used the same technique to build this as for my /// answer to the challenge this was based on. However, I had to fix <a href="http://cjam.tryitonline.net/#code=MjYsMj5xOlhmZXc6fl8me1tfXywoWEAvLCgoKjUtXF19JSRXJVNmKk4q&input=QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVoKQkJDREVGR0hJSktMTU5PUFFSU1RVVldYWVoKQ0NDREVGR0hJSktMTU5PUFFSU1RVVldYWVoKREREREVGR0hJSktMTU5PUFFSU1RVVldYWVoKRUVFRUVGR0hJSktMTU5PUFFSU1RVVldYWVoKRkZGRkZGR0hJSktMTU5PUFFSU1RVVldYWVoKR0dHR0dHR0hJSktMTU5PUFFSU1RVVldYWVoKSEhISEhISEhJSktMTU5PUFFSU1RVVldYWVoKSUlJSUlJSUlJSktMTU5PUFFSU1RVVldYWVoKSkpKSkpKSkpKSktMTU5PUFFSU1RVVldYWVoKS0tLS0tLS0tLS0tMTU5PUFFSU1RVVldYWVoKTExMTExMTExMTExMTU5PUFFSU1RVVldYWVoKTU1NTU1NTU1NTU1NTU5PUFFSU1RVVldYWVoKTk5OTk5OTk5OTk5OTk5PUFFSU1RVVldYWVoKT09PT09PT09PT09PT09PUFFSU1RVVldYWVoKUFBQUFBQUFBQUFBQUFBQUFFSU1RVVldYWVoKUVFRUVFRUVFRUVFRUVFRUVFSU1RVVldYWVoKUlJSUlJSUlJSUlJSUlJSUlJSU1RVVldYWVoKU1NTU1NTU1NTU1NTU1NTU1NTU1RVVldYWVoKVFRUVFRUVFRUVFRUVFRUVFRUVFRVVldYWVoKVVVVVVVVVVVVVVVVVVVVVVVVVVVVVldYWVoKVlZWVlZWVlZWVlZWVlZWVlZWVlZWVldYWVoKV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dYWVoKWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWVoKWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVlZWVoKWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlo" rel="nofollow noreferrer">the CJam script because it didn't correctly handle substrings that can overlap themselves.


答:
CJam, 13 bytes

```<code>'[,65>_ffe>N*
</code>```

Test it here!

Explanation

```<code>'[,   e# Get character range from null-byte to 'Z'.
65>   e# Discard everything up to 'A', so we've got the upper case alphabet.
_     e# Duplicate.
ffe>  e# Nested map: for every pair of letters, computes the maximum and arranges the
      e# results in a grid.
N*    e# Join with linefeeds.
</code>```

Title: Print/Output the L-phabet

Body:
CJam, 13 bytes

'[,65>_ffe>N*

Test it here!

Explanation

'[,   e# Get character range from null-byte to 'Z'.
65>   e# Discard everything up to 'A', so we've got the upper case alphabet.
_     e# Duplicate.
ffe>  e# Nested map: for every pair of letters, computes the maximum and arranges the
      e# results in a grid.
N*    e# Join with linefeeds.


答:
Haskell, <s>53</s> 46 bytes

```<code>unlines[(i<$['B'..i])++[i..'Z']|i<-['A'..'Z']]
</code>```

Returns a single string with the L-phabet.

go through the chars i from A to Z and make a list of (length ['B'..i]) copies of i followed by [i..'Z']. Join elements with newlines in-between.

Title: Print/Output the L-phabet

Body:
Haskell, <s>53</s> 46 bytes

unlines[(i<$['B'..i])++[i..'Z']|i<-['A'..'Z']]

Returns a single string with the L-phabet.

go through the chars i from A to Z and make a list of (length ['B'..i]) copies of i followed by [i..'Z']. Join elements with newlines in-between.


答:
05AB1E, 9 bytes

Code:

```<code>AAv¬N×?=¦
</code>```

Explanation:

```<code>AA         # Push the alphabet twice.
  v        # For each in the alphabet.
   ¬       # Get the first character and
    N×     # multiply by the iteration variable.
      ?    # Pop and print.
       =   # Print the initial alphabet without popping.
        ¦  # Remove the first character of the initial alphabet and repeat.
</code>```

Uses the CP-1252 encoding. Try it online!.

Title: Print/Output the L-phabet

Body:
05AB1E, 9 bytes

Code:

AAv¬N×?=¦

Explanation:

AA         # Push the alphabet twice.
  v        # For each in the alphabet.
   ¬       # Get the first character and
    N×     # multiply by the iteration variable.
      ?    # Pop and print.
       =   # Print the initial alphabet without popping.
        ¦  # Remove the first character of the initial alphabet and repeat.

Uses the CP-1252 encoding. Try it online!.


答:
Matlab / Octave, <s>43</s> 39 bytes

1 byte removed thanks to @beaker's idea of using [...,''] to convert to char.

```<code>@()[91-rot90(gallery('minij',26),2),'']
</code>```

This is an anonymous function that returns a 2D char array.

Try it on Ideone.

Explanation

gallery('minij',...) gives a matrix in which each entry equals the minimum of its row and column indices:

```<code> 1     1     1     1  ...
 1     2     2     2
 1     2     3     3
 1     2     3     4
 ...
</code>```

This is rotated 180 degrees with rot90(...,2):

```<code>26    25    24    23  ...
25    25    24    23
24    24    24    23
23    23    23    23
...
</code>```

The 91-... operation gives the ASCII codes of uppercase letters:

```<code>65    66    67    68
66    66    67    68
67    67    67    68
68    68    69    68 ...
...
</code>```

Finally [...,''] concatenates horizontally with an empty string. This has the effect of converting to char.

Title: Print/Output the L-phabet

Body:
Matlab / Octave, <s>43</s> 39 bytes

1 byte removed thanks to @beaker's idea of using [...,''] to convert to char.

@()[91-rot90(gallery('minij',26),2),'']

This is an anonymous function that returns a 2D char array.

Try it on Ideone.

Explanation

gallery('minij',...) gives a matrix in which each entry equals the minimum of its row and column indices:

 1     1     1     1  ...
 1     2     2     2
 1     2     3     3
 1     2     3     4
 ...

This is rotated 180 degrees with rot90(...,2):

26    25    24    23  ...
25    25    24    23
24    24    24    23
23    23    23    23
...

The 91-... operation gives the ASCII codes of uppercase letters:

65    66    67    68
66    66    67    68
67    67    67    68
68    68    69    68 ...
...

Finally [...,''] concatenates horizontally with an empty string. This has the effect of converting to char.


答:
Javascript ES6, 81 bytes

```<code>x=>[...a='ABCDEFGHIJKLMNOPQRSTUVWXYZ'].map((x,y)=>x.repeat(y)+a.slice(y)).join`
`
</code>```

Self-explanatory.

Title: Print/Output the L-phabet

Body:
Javascript ES6, 81 bytes

x=>[...a='ABCDEFGHIJKLMNOPQRSTUVWXYZ'].map((x,y)=>x.repeat(y)+a.slice(y)).join`
`

Self-explanatory.


答:
Retina, 41 bytes

Byte count assumes ISO 8859-1 encoding. The leading linefeed is significant.

```<code>
26$*Z
{`^[^A].+
$&¶$&
}T0-2`L`_L`^(.)\1+
</code>```

Explanation

```<code>
26$*Z
</code>```

Set the string to 26 copies of Z. Then the {...} instruct Retina to perform the remaining two instructions in a loop until the string stops changing.

```<code>{`^[^A].+
$&¶$&
</code>```

Duplicate the first line if it doesn't start with an A.

```<code>}T0-2`L`_L`^(.)\1+
</code>```

This is a transliteration stage. It is only applied if the string starts with at least two copies of the same character. If so, all but the last of those characters are decremented. The decrementing happens by mapping L (upper case alphabet) to _L (blank followed by upper case alphabet). The "all but the last" is indicated by the limit -2 which tells Retina only to transliterate all characters up to the second-to-last in the match.

Try it online!

Title: Print/Output the L-phabet

Body:
Retina, 41 bytes

Byte count assumes ISO 8859-1 encoding. The leading linefeed is significant.

26$*Z
{`^[^A].+
$&¶$&
}T0-2`L`_L`^(.)\1+

Explanation

26$*Z

Set the string to 26 copies of Z. Then the {...} instruct Retina to perform the remaining two instructions in a loop until the string stops changing.

{`^[^A].+
$&¶$&

Duplicate the first line if it doesn't start with an A.

}T0-2`L`_L`^(.)\1+

This is a transliteration stage. It is only applied if the string starts with at least two copies of the same character. If so, all but the last of those characters are decremented. The decrementing happens by mapping L (upper case alphabet) to _L (blank followed by upper case alphabet). The "all but the last" is indicated by the limit -2 which tells Retina only to transliterate all characters up to the second-to-last in the match.

Try it online!


答:
Excel, 19,604 bytes

```<code>=CHAR(64+MAX(COLUMN(),ROW()))
</code>```

Paste this formula in A1, then drag all over A1:Z26.

Byte count:

The formula is 27 bytes.

You need to copy it 26^2 times. 27*26*26=19604.

I and others thought the score should be lower because you don't really need to type the formula again and again. I now think it's irrelevant - we count the size of the program, not the work spent writing it.

For comparison - see this 28,187 chars JS answer - obviously, someone generated it rather than typing all this, but it doesn't change its size.

Title: Print/Output the L-phabet

Body:
Excel, 19,604 bytes

=CHAR(64+MAX(COLUMN(),ROW()))

Paste this formula in A1, then drag all over A1:Z26.

Byte count:

The formula is 27 bytes.

You need to copy it 26^2 times. 27*26*26=19604.

I and others thought the score should be lower because you don't really need to type the formula again and again. I now think it's irrelevant - we count the size of the program, not the work spent writing it.

For comparison - see this 28,187 chars JS answer - obviously, someone generated it rather than typing all this, but it doesn't change its size.


问:
Implement division
Implement a division algorithm in your favourite language which handles integer division. It need only handle positive numbers - but bonus points if it handles negative and mixed-sign division, too. Results are rounded down for fractional results.

The program may not contain the /, \, div or similar operators. It must be a routine which does not use native division capabilities of the language.

You only need to handle up to 32-bit division. Using repeated subtraction is not allowed.

Input

Take two inputs on stdin separated by new lines or spaces (your choice)

```<code>740
2
</code>```

Output

In this case, the output would be 370.

The solution which is the shortest wins.

答:
Common Lisp, 42 charaacters

```<code>(1-(loop as x to(read)by(read)counting t))
</code>```

Accepts space or line-separated input

Title: Implement division

Body:
Common Lisp, 42 charaacters

(1-(loop as x to(read)by(read)counting t))

Accepts space or line-separated input


答:
Octave, 26 bytes

```<code>disp([max(L=65:90,L'),''])
</code>```

Sample run on ideone.

Title: Print/Output the L-phabet

Body:
Octave, 26 bytes

disp([max(L=65:90,L'),''])

Sample run on ideone.


问:
Print a Tabula Recta!
The Tabula Recta (sometimes called a 'Vigenere Table'), was created by Johannes Trithemius, and has been used in several ciphers, including all variants of Bellaso's Vigenere cipher and the Trithemius cipher. It looks like this:

```<code>ABCDEFGHIJKLMNOPQRSTUVWXYZ
BCDEFGHIJKLMNOPQRSTUVWXYZA
CDEFGHIJKLMNOPQRSTUVWXYZAB
DEFGHIJKLMNOPQRSTUVWXYZABC
EFGHIJKLMNOPQRSTUVWXYZABCD
FGHIJKLMNOPQRSTUVWXYZABCDE
GHIJKLMNOPQRSTUVWXYZABCDEF
HIJKLMNOPQRSTUVWXYZABCDEFG
IJKLMNOPQRSTUVWXYZABCDEFGH
JKLMNOPQRSTUVWXYZABCDEFGHI
KLMNOPQRSTUVWXYZABCDEFGHIJ
LMNOPQRSTUVWXYZABCDEFGHIJK
MNOPQRSTUVWXYZABCDEFGHIJKL
NOPQRSTUVWXYZABCDEFGHIJKLM
OPQRSTUVWXYZABCDEFGHIJKLMN
PQRSTUVWXYZABCDEFGHIJKLMNO
QRSTUVWXYZABCDEFGHIJKLMNOP
RSTUVWXYZABCDEFGHIJKLMNOPQ
STUVWXYZABCDEFGHIJKLMNOPQR
TUVWXYZABCDEFGHIJKLMNOPQRS
UVWXYZABCDEFGHIJKLMNOPQRST
VWXYZABCDEFGHIJKLMNOPQRSTU
WXYZABCDEFGHIJKLMNOPQRSTUV
XYZABCDEFGHIJKLMNOPQRSTUVW
YZABCDEFGHIJKLMNOPQRSTUVWX
ZABCDEFGHIJKLMNOPQRSTUVWXY
</code>```

I frequently need this, but can't find it anywhere on the internet to copy and paste from. Because the square table is so long, and takes frigging ages to type, your code must be as short as possible.

Rules/Requirements

Each submission should be either a full program or function. If it is a function, it must be runnable by only needing to add the function call to the bottom of the program. Anything else (e.g. headers in C), must be included.

If it is possible, provide a link to a site where your program can be tested.

Your program must not write anything to STDERR.

Standard Loopholes are forbidden.

Your program can output in any case, but it must be printed (not an array or similar).

Scoring

Programs are scored according to bytes, in UTF-8 by default or a different character set of your choice.

Eventually, the answer with the least bytes will win.

Submissions

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

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

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

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

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

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

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

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

Leaderboard

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

/* Configuration */

var QUESTION_ID = 86986; // Obtain this from the url
// It will be like https://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 53406; // This should be the user ID of the challenge author.

/* App */

var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;

function answersUrl(index) {
  return "https://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

function commentUrl(index, answers) {
  return "https://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}

function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });
}

function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });
}

getAnswers();

var SCORE_REG = /<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;

var OVERRIDE_REG = /^Override\s*header:\s*/i;

function getAuthorName(a) {
  return a.owner.display_name;
}

function process() {
  var valid = [];

  answers.forEach(function(a) {
    var body = a.body;
    a.comments.forEach(function(c) {
      if(OVERRIDE_REG.test(c.body))
        body = '
' + c.body.replace(OVERRIDE_REG, '') + '
';
    });

    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        language: match[1],
        link: a.share_link,
      });

  });

  valid.sort(function (a, b) {
    var aB = a.size,
        bB = b.size;
    return aB - bB
  });

  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  valid.forEach(function (a) {
    if (a.size != lastSize)
      lastPlace = place;
    lastSize = a.size;
    ++place;

    var answer = jQuery("#answer-template").html();
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", a.user)
                   .replace("{{LANGUAGE}}", a.language)
                   .replace("{{SIZE}}", a.size)
                   .replace("{{LINK}}", a.link);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);

    var lang = a.language;
    if (/ b.lang) return 1;
    if (a.lang < b.lang) return -1;
    return 0;
  });

  for (var i = 0; i < langs.length; ++i)
  {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
                       .replace("{{NAME}}", lang.user)
                       .replace("{{SIZE}}", lang.size)
                       .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }

}```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body { text-align: left !important}

#answer-list {
  padding: 10px;
  width: 290px;
  float: left;
}

#language-list {
  padding: 10px;
  width: 290px;
  float: left;
}

table thead {
  font-weight: bold;
}

table td {
  padding: 5px;
}</code>```

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

答:
C#, 100 bytes

Supplied because I think the other C# answer is invalid, and this is a different way of generating the table entirely. Full program because I don't like supplying just functions... and because it's 100bytes. Appears to use the same method as the VBA answer provided by Joffan.

class P{static void Main(){for(int i=0;i<702;i++)System.Console.Write((char)(i%27>25?10:i%26+65));}}
```

<p>Optional trailing <code>\n</code> (change 702 to 701 to get rid of it). Very simple: works by counting from 0 to 26*27 (26 letters + 1 newline, 26 times). Each count of <code>i</code>, it prints the char value of either 10 (<code>LF</code>) if it is newline time (every 27th character), else it prints the capital ASCII numeral of the <code>i%26</code>th letter of the alphabet. The starting letter is implicitly offset by injecting the LF at every 27th character.</p>

<p>I am sad I can't move the <code>i++</code> out of the loop declaration, but I don't think it pays to turn the conditional into a lookup/other, which would enable me to perform the increment after computing the alphabet ASCII value.</p>

<p>Formatted code:</p>

<pre class="lang-c# prettyprint-override"><code>class P
{
    static void Main()
    {
        for(int i=0;i<702;i++)
            System.Console.Write((char)(i%27>25?10:i%26+65));

        System.Console.ReadKey(true); // just for debug
    }
}
</code>```

ContentLicense: CC BY-SA 4.0

Title: Print a Tabula Recta!

Body:
C#, 100 bytes

Supplied because I think the other C# answer is invalid, and this is a different way of generating the table entirely. Full program because I don't like supplying just functions... and because it's 100bytes. Appears to use the same method as the VBA answer provided by Joffan.

class P{static void Main(){for(int i=0;i<702;i++)System.Console.Write((char)(i%27>25?10:i%26+65));}}

Optional trailing \n (change 702 to 701 to get rid of it). Very simple: works by counting from 0 to 26*27 (26 letters + 1 newline, 26 times). Each count of i, it prints the char value of either 10 (LF) if it is newline time (every 27th character), else it prints the capital ASCII numeral of the i%26th letter of the alphabet. The starting letter is implicitly offset by injecting the LF at every 27th character.

I am sad I can't move the i++ out of the loop declaration, but I don't think it pays to turn the conditional into a lookup/other, which would enable me to perform the increment after computing the alphabet ASCII value.

Formatted code:

class P
{
    static void Main()
    {
        for(int i=0;i<702;i++)
            System.Console.Write((char)(i%27>25?10:i%26+65));

        System.Console.ReadKey(true); // just for debug
    }
}


答:
, 12 chars / 15 bytes

```<code>ᶐⓢ⒨Ċ_+ᶐč_)ü⬬
</code>```

Try it here (Chrome Canary only).

Basically a port of my ES6 answer.

Title: Print/Output the L-phabet

Body:
Inspired by George Gibson's Print a Tabula Recta.

You are to print/output this exact text:

```<code>ABCDEFGHIJKLMNOPQRSTUVWXYZ
BBCDEFGHIJKLMNOPQRSTUVWXYZ
CCCDEFGHIJKLMNOPQRSTUVWXYZ
DDDDEFGHIJKLMNOPQRSTUVWXYZ
EEEEEFGHIJKLMNOPQRSTUVWXYZ
FFFFFFGHIJKLMNOPQRSTUVWXYZ
GGGGGGGHIJKLMNOPQRSTUVWXYZ
HHHHHHHHIJKLMNOPQRSTUVWXYZ
IIIIIIIIIJKLMNOPQRSTUVWXYZ
JJJJJJJJJJKLMNOPQRSTUVWXYZ
KKKKKKKKKKKLMNOPQRSTUVWXYZ
LLLLLLLLLLLLMNOPQRSTUVWXYZ
MMMMMMMMMMMMMNOPQRSTUVWXYZ
NNNNNNNNNNNNNNOPQRSTUVWXYZ
OOOOOOOOOOOOOOOPQRSTUVWXYZ
PPPPPPPPPPPPPPPPQRSTUVWXYZ
QQQQQQQQQQQQQQQQQRSTUVWXYZ
RRRRRRRRRRRRRRRRRRSTUVWXYZ
SSSSSSSSSSSSSSSSSSSTUVWXYZ
TTTTTTTTTTTTTTTTTTTTUVWXYZ
UUUUUUUUUUUUUUUUUUUUUVWXYZ
VVVVVVVVVVVVVVVVVVVVVVWXYZ
WWWWWWWWWWWWWWWWWWWWWWWXYZ
XXXXXXXXXXXXXXXXXXXXXXXXYZ
YYYYYYYYYYYYYYYYYYYYYYYYYZ
ZZZZZZZZZZZZZZZZZZZZZZZZZZ
</code>```

(Yes, I typed that by hand)

You are allowed to use all lowercase instead of all uppercase.

However, your choice of case must be consistent throughout the whole text.

Rules/Requirements

Each submission should be either a full program or function. If it is a function, it must be runnable by only needing to add the function call to the bottom of the program. Anything else (e.g. headers in C), must be included.

If it is possible, provide a link to a site where your program can be tested.

Your program must not write anything to STDERR.

Standard Loopholes are forbidden.

Your program can output in any case, but it must be printed (not an array or similar).

Scoring

Programs are scored according to bytes, in UTF-8 by default or a different character set of your choice.

Eventually, the answer with the least bytes will win.

Submissions

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

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

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

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

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

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

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

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

Leaderboard

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

/* Configuration */

var QUESTION_ID = 87064; // Obtain this from the url
// It will be like https://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 48934; // This should be the user ID of the challenge author.

/* App */

var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;

function answersUrl(index) {
  return "https://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

function commentUrl(index, answers) {
  return "https://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}

function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });
}

function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });
}

getAnswers();

var SCORE_REG = /<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;

var OVERRIDE_REG = /^Override\s*header:\s*/i;

function getAuthorName(a) {
  return a.owner.display_name;
}

function process() {
  var valid = [];

  answers.forEach(function(a) {
    var body = a.body;
    a.comments.forEach(function(c) {
      if(OVERRIDE_REG.test(c.body))
        body = '
' + c.body.replace(OVERRIDE_REG, '') + '
';
    });

    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        language: match[1],
        link: a.share_link,
      });

  });

  valid.sort(function (a, b) {
    var aB = a.size,
        bB = b.size;
    return aB - bB
  });

  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  valid.forEach(function (a) {
    if (a.size != lastSize)
      lastPlace = place;
    lastSize = a.size;
    ++place;

    var answer = jQuery("#answer-template").html();
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", a.user)
                   .replace("{{LANGUAGE}}", a.language)
                   .replace("{{SIZE}}", a.size)
                   .replace("{{LINK}}", a.link);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);

    var lang = a.language;
    if (/ b.lang) return 1;
    if (a.lang < b.lang) return -1;
    return 0;
  });

  for (var i = 0; i < langs.length; ++i)
  {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
                       .replace("{{NAME}}", lang.user)
                       .replace("{{SIZE}}", lang.size)
                       .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }

}```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body { text-align: left !important}

#answer-list {
  padding: 10px;
  width: 290px;
  float: left;
}

#language-list {
  padding: 10px;
  width: 290px;
  float: left;
}

table thead {
  font-weight: bold;
}

table td {
  padding: 5px;
}</code>```

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

Body:
, 12 chars / 15 bytes

ᶐⓢ⒨Ċ_+ᶐč_)ü⬬

Try it here (Chrome Canary only).

Basically a port of my ES6 answer.


答:
Wolfram Language (Mathematica), <s>69</s> <s>65</s> <s>57</s> 44 bytes

Saved 8 bytes thanks to Martin Ender.

Saved 13 bytes thanks to att.

```<code>Print@@@Array[Alphabet[][[Max@##]]&,{26,26}]
</code>```

Try it online! Full program which prints to standard output.

Title: Print/Output the L-phabet

Body:
Wolfram Language (Mathematica), <s>69</s> <s>65</s> <s>57</s> 44 bytes

Saved 8 bytes thanks to Martin Ender.

Saved 13 bytes thanks to att.

Print@@@Array[Alphabet[][[Max@##]]&,{26,26}]

Try it online! Full program which prints to standard output.


答:
Vim, 43 bytes

```<code>:h<_↵jjYZZPqqlmaYp`ajyl:norm v0r♥"↵`ajq25@q
</code>```

Here ↵ represents Return (0x0a) and ♥ represents Ctrl-R (0x12).

Not quite as short as my Tabula Recta answer, but…

Title: Print/Output the L-phabet

Body:
Vim, 43 bytes

:h<_↵jjYZZPqqlmaYp`ajyl:norm v0r♥"↵`ajq25@q

Here ↵ represents Return (0x0a) and ♥ represents Ctrl-R (0x12).

Not quite as short as my Tabula Recta answer, but…


问:
Is the DAG a transitive reduction?
The goal of this challenge is given a finite directed acyclic graph (DAG), determine if the graph is a transitive reduction.

A brief explanation of what a DAG and transitive reductions are:

A DAG is a graph with directed edges (i.e. you can only travel in one direction on that edge) such that given any starting node on the graph, it is impossible to return to the starting node (i.e. there are no cycles).

Given any starting node, if it is possible to travel to another ending node in the graph via any arbitrary positive number of edges, then that ending node is defined as reachable from the starting node. In a general DAG, there might be multiple paths which can be taken from a starting node to a target ending node. For example, take this diamond graph:

To get to node D from A, you could take the path A->B->D or A->C->D. Thus, D is reachable from A. However, there is no path which can be taken to get to node B starting from node C. Thus, node B is not reachable from node C.

Define the reachability of the graph as the list of reachable nodes for every starting node in the graph. So for the same example diamond graph, the reachability is:

```<code>A: [B, C, D]
B: [D]
C: [D]
D: []
</code>```

Another graph which has the same reachability as the above graph is shown below:

However, this second graph has more edges than the original graph. The transitive reduction of a graph is a graph with the least number of edges and same reachability of the original graph. So the first graph is the transitive reduction of the second one.

For a finite DAG, the transitive reduction is guaranteed to exist and is unique.

Input

The input is a "list of lists", where the external list has the length of the number of vertices, and each internal list is the length of the number of edges leaving the associated node, and contains the indices of destination nodes. For example, one way to describe the first graph above would be (assuming zero based indexing):

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

You may begin indexing of the first node at any arbitrary integer value (e.g. 0 or 1 based indexing).

The input may come from any input source desired (stdio, function parameter, etc.). You are free to choose the exact input format as long as no additional information is given. For example, if you want to take input from stdio, you could have each line be a list of edges for the associated node. Ex.:

```<code>1 2
3
3
'' (blank line)
</code>```

The indices in each adjacency list is not necessarily sorted, and there could be multiple edges connecting two nodes (ex.: [[1,1],[]]). You may assume the input graph is weakly connected, and contains no cycles (i.e. it is a DAG).

Output

The output is truthy if the given input DAG is a transitive reduction, and a falsy value otherwise. This may be to any sink desired (stdio, return value, output parameter, etc.)

Examples

All examples use 0-based indexing.

```<code>[[1,2],[3],[3],[]]
true

[[1,2,3],[3],[3],[]]
false

[[1,1],[]]
false

[[1,2,3,4],[5,6,7],[5,8,9],[6,8,10],[7,9,10],[11,12],[11,13],[12,13],[11,14],[12,14],[13,14],[],[],[],[]]
true

[[5,6,7],[2,3,0,4],[5,8,9],[6,8,10],[7,9,10],[11,12],[11,13],[12,13],[11,14],[12,14],[13,14],[],[],[],[]]
true

[[5,6,7],[2,3,0,4,14,5,7],[5,8,9],[6,8,10],[7,9,10],[11,12],[11,13],[12,13],[11,14],[12,14],[13,14],[],[],[],[]]
false

[[5,6,7],[2,3,0,4],[5,8,9],[6,8,10],[7,9,10,14],[11,12],[11,13],[12,13],[11,14],[12,14],[13,14],[],[],[],[]]
false

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

Scoring

This is code golf; smallest code in bytes wins. Your code should complete in a reasonable amount of time (10 minutes max on whatever hardware you have). Standard loopholes apply. You may use any built-ins desired.

答:
Mathematica, <s>95</s> 82 bytes

13 bytes saved due to @MartinEnder.

```<code>#~IsomorphicGraphQ~TransitiveReductionGraph@#&@Graph[x=0;##&@@Thread[++x->#]&/@#]&
</code>```

Anonymous function. Takes a nested list as (1-based) input, and returns True or False as output. The main solution here is the 46-byte #~IsomorphicGraphQ~TransitiveReductionGraph@#&, which tests if a given graph is isomorphic to its transitive reduction. The rest converts the input to a Graph object.

Title: Is the DAG a transitive reduction?

Body:
Mathematica, <s>95</s> 82 bytes

13 bytes saved due to @MartinEnder.

#~IsomorphicGraphQ~TransitiveReductionGraph@#&@Graph[x=0;##&@@Thread[++x->#]&/@#]&

Anonymous function. Takes a nested list as (1-based) input, and returns True or False as output. The main solution here is the 46-byte #~IsomorphicGraphQ~TransitiveReductionGraph@#&, which tests if a given graph is isomorphic to its transitive reduction. The rest converts the input to a Graph object.


答:
Jelly, 6 bytes

```<code>ØA»'j⁷
</code>```

Try it here. If only I hadn’t been lazy yesterday and implemented that one-byte alternative to j⁷ (join by newlines)…

```<code>ØA      The uppercase alphabet.
  »'    Table of max(x, y).
    j⁷  Join by newlines.
</code>```

Title: Print/Output the L-phabet

Body:
Jelly, 6 bytes

ØA»'j⁷

Try it here. If only I hadn’t been lazy yesterday and implemented that one-byte alternative to j⁷ (join by newlines)…

ØA      The uppercase alphabet.
  »'    Table of max(x, y).
    j⁷  Join by newlines.


答:
Perl, 31 bytes

-6 byte thanks to @Denis Ibaev

say$_ x$A++,$_..Z for A..Z
```
<p>Needs <code>-M5.010</code> to run. So run with :</p>
```perl -M5.010 -e 'say$_ x$A++,$_..Z for A..Z'
```

Title: Print/Output the L-phabet

Body:
Perl, 31 bytes

-6 byte thanks to @Denis Ibaev

say$_ x$A++,$_..Z for A..Z

Needs -M5.010 to run. So run with :

perl -M5.010 -e 'say$_ x$A++,$_..Z for A..Z'


答:
Haskell, 35 bytes

```<code>a=['A'..'Z']
unlines$(<$>a).max<$>a
</code>```

Title: Print/Output the L-phabet

Body:
Haskell, 35 bytes

a=['A'..'Z']
unlines$(<$>a).max<$>a


问:
Print this diamond
This question has been spreading like a virus in my office. There are quite a variety of approaches:

Print the following:

```<code>        1
       121
      12321
     1234321
    123454321
   12345654321
  1234567654321
 123456787654321
12345678987654321
 123456787654321
  1234567654321
   12345654321
    123454321
     1234321
      12321
       121
        1
</code>```

Answers are scored in characters with fewer characters being better.

答:
Common Lisp, 113 characters

```<code>(defun x(n)(if(= n 0)1(+(expt 10 n)(x(1- n)))))(dotimes(n 17)(format t"~17:@<~d~>~%"(expt(x(- 8(abs(- n 8))))2)))
</code>```

First I noticed that the elements of the diamond could be expressed like so:

```<code>  1   =   1 ^ 2
 121  =  11 ^ 2
12321 = 111 ^ 2
</code>```

etc.

x recursively calculates the base (1, 11, 111, etc), which is squared, and then printed centered by format. To make the numbers go up to the highest term and back down again I used (- 8 (abs (- n 8))) to avoid a second loop

Title: Print this diamond

Body:
Common Lisp, 113 characters

(defun x(n)(if(= n 0)1(+(expt 10 n)(x(1- n)))))(dotimes(n 17)(format t"~17:@<~d~>~%"(expt(x(- 8(abs(- n 8))))2)))

First I noticed that the elements of the diamond could be expressed like so:

  1   =   1 ^ 2
 121  =  11 ^ 2
12321 = 111 ^ 2

etc.

x recursively calculates the base (1, 11, 111, etc), which is squared, and then printed centered by format. To make the numbers go up to the highest term and back down again I used (- 8 (abs (- n 8))) to avoid a second loop


答:
Python 2, 61 bytes

```<code>a=range(65,91)
for c in a:print bytearray(max(c,i)for i in a)
</code>```

Inspired by (xsot’s improvement to) this answer.

Title: Print/Output the L-phabet

Body:
Python 2, 61 bytes

a=range(65,91)
for c in a:print bytearray(max(c,i)for i in a)

Inspired by (xsot’s improvement to) this answer.


答:
Javascript (using external library) (141 bytes)

```<code>w=>_.Range(65,26).WriteLine(x=>(_.Range(0,x-65).Write("",y=>String.fromCharCode(x))||"")+_.Range(x,91-x).Write("",z=>String.fromCharCode(z)))
</code>```

Link to lib:https://github.com/mvegh1/Enumerable

Code explanation: Create char code range of integers, for each write complex predicate to new line. Predicate will create a range of (currentValue-65) values, which is the part that goes A,BB,CCC,...etc...for the case of A the Write may return null so we coerce that to an empty string. Concatenate that with the remaining sequence of the alphabet. So many bytes are coming from the String.fromCharCode lol... oh well!!!

Title: Print/Output the L-phabet

Body:
Javascript (using external library) (141 bytes)

w=>_.Range(65,26).WriteLine(x=>(_.Range(0,x-65).Write("",y=>String.fromCharCode(x))||"")+_.Range(x,91-x).Write("",z=>String.fromCharCode(z)))

Link to lib:https://github.com/mvegh1/Enumerable

Code explanation: Create char code range of integers, for each write complex predicate to new line. Predicate will create a range of (currentValue-65) values, which is the part that goes A,BB,CCC,...etc...for the case of A the Write may return null so we coerce that to an empty string. Concatenate that with the remaining sequence of the alphabet. So many bytes are coming from the String.fromCharCode lol... oh well!!!


答:
Sesos, 25 bytes

```<code>0000000: 2829c0 756fc6 aecae2 aecd9c 39e09e 099c63 7d8e3d  ().uo.......9....c}.=
0000015: 65a7c0 39                                         e..9
</code>```

Try it online! Check Debug to see the generated SBIN code.

Sesos assembly

The binary file above has been generated by assembling the following SASM code.

add 26
jmp
    jmp
        rwd 1, add 1, rwd 1, add 1, fwd 2, sub 1
    jnz
    rwd 2, add 64
    jmp
        fwd 2, add 1, rwd 2, sub 1
    jnz
    fwd 1, sub 1
jnz
fwd 1
jmp
    jmp
        rwd 1, add 1, fwd 1, sub 1
    jnz
    nop
        rwd 1
    jnz
    fwd 1
    jmp
        put, add 1, fwd 1
    jnz
    fwd 1
    jmp
        put, fwd 1
    jnz
    add 10, put, get
    nop
        rwd 1
    jnz
    fwd 1
; jnz (implicit)
```

<h3>How it works</h3>

<p>We start by initializing the tape to <code>ABCDEFGHIJKLMNOPQRSTUVWXYZ</code>. This is as follows.</p>

<p>Write <strong>26</strong> to a cell, leaving the tape in the following state.</p>

<pre class="lang-lisp prettyprint-override"><code>                                                       v
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 26 0
</code>```

As long as the cell under the data head is non-zero, we do the following.

Copy the number to the two cells to the left and add 64 to the leftmost copy.

                                                   v
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 90 26 0 0
```

<p>Move the leftmost copy to the original location, then subtract <strong>1</strong> from the rightmost copy.</p>

<pre class="lang-lisp prettyprint-override"><code>                                                     v
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 25 90 0
</code>```

The process stops after 26 iterations, since the rightmost copy is 0 by then. We move a cell to the right, so the final state of the tape after the initialization is the following.

     v
0 0 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0
```

<p>Now we're ready to generate the output, by repeating the following process until the cell under the data head is zero.</p>

<p>First, we move the content of the cell under the data head one unit to the left, then move left until the last cell with a non-zero content.</p>

<pre class="lang-lisp prettyprint-override"><code>   v
0 65 0 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0
</code>```

Now, we print all cells, starting with the one under the data head and moving right until we find a 0 cell, incrementing each printed cell after printing it. After printing A, the tape looks as follows.

     v
0 66 0 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0
```

<p>Now we move right, again printing all cells until a <strong>0</strong> cell in encountered. After printing <code>BCDEFGHIJKLMNOPQRSTUVWXYZ</code>, the tape looks as follows.</p>

<pre class="lang-lisp prettyprint-override"><code>                                                                                v
0 66 0 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0
</code>```

Now, we write 10 to the current cell, print the corresponding character (linefeed) and zero the cell with a call to get on empty input, leaving the tape unchanged.

Finally, we move to the last non-zero to the left, preparing the tape for the next iteration.

        v
0 66 0 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0
```

<p>The next iteration is similar. We first move <strong>66</strong> one cell to the left, print both <strong>66</strong> cells (<code>BB</code>) and increment them to <strong>67</strong>, then print the remaining non-zero cells to the right (<code>CDEFGHIJKLMNOPQRSTUVWXYZ</code>), and finally place the data head on <strong>67</strong>, leaving the tape as follows.</p>

<pre class="lang-lisp prettyprint-override"><code>           v
0 66 66 0 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0
</code>```

After 24 more iterations and after printing ZZZZZZZZZZZZZZZZZZZZZZZZZZ and a linefeed, the tapes is left in the following state.

                                                                                v
0 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 0 0
```

Moving the data head to the left to the next non-zero cell will leave it in its current position, so the cell under it is 0 and the loop terminates.

Title: Print/Output the L-phabet

Body:
Sesos, 25 bytes

0000000: 2829c0 756fc6 aecae2 aecd9c 39e09e 099c63 7d8e3d  ().uo.......9....c}.=
0000015: 65a7c0 39                                         e..9

<a href="http://sesos.tryitonline.net/#code=YWRkIDI2CmptcAogICAgam1wCiAgICAgICAgcndkIDEsIGFkZCAxLCByd2QgMSwgYWRkIDEsIGZ3ZCAyLCBzdWIgMQogICAgam56CiAgICByd2QgMiwgYWRkIDY0CiAgICBqbXAKICAgICAgICBmd2QgMiwgYWRkIDEsIHJ3ZCAyLCBzdWIgMQogICAgam56CiAgICBmd2QgMSwgc3ViIDEKam56CmZ3ZCAxCmptcAogICAgam1wCiAgICAgICAgcndkIDEsIGFkZCAxLCBmd2QgMSwgc3ViIDEKICAgIGpuegogICAgcndkIDEKICAgIGptcAogICAgICAgIHJ3ZCAxCiAgICBqbnoKICAgIGZ3ZCAxCiAgICBqbXAKICAgICAgICBwdXQsIGFkZCAxLCBmd2QgMQogICAgam56CiAgICBmd2QgMQogICAgam1wCiAgICAgICAgcHV0LCBmd2QgMQogICAgam56CiAgICBhZGQgMTAsIHB1dCwgZ2V0LCByd2QgMQogICAgam1wCiAgICAgICAgcndkIDEKICAgIGpuegogICAgZndkIDEKOyBqbnogKGltcGxpY2l0KQ&input=" rel="nofollow">Try it online! Check Debug to see the generated SBIN code.

Sesos assembly

The binary file above has been generated by assembling the following SASM code.

add 26
jmp
    jmp
        rwd 1, add 1, rwd 1, add 1, fwd 2, sub 1
    jnz
    rwd 2, add 64
    jmp
        fwd 2, add 1, rwd 2, sub 1
    jnz
    fwd 1, sub 1
jnz
fwd 1
jmp
    jmp
        rwd 1, add 1, fwd 1, sub 1
    jnz
    nop
        rwd 1
    jnz
    fwd 1
    jmp
        put, add 1, fwd 1
    jnz
    fwd 1
    jmp
        put, fwd 1
    jnz
    add 10, put, get
    nop
        rwd 1
    jnz
    fwd 1
; jnz (implicit)

How it works

We start by initializing the tape to ABCDEFGHIJKLMNOPQRSTUVWXYZ. This is as follows.

Write 26 to a cell, leaving the tape in the following state.

                                                       v
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 26 0

As long as the cell under the data head is non-zero, we do the following.

Copy the number to the two cells to the left and add 64 to the leftmost copy.

                                                   v
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 90 26 0 0

Move the leftmost copy to the original location, then subtract 1 from the rightmost copy.

                                                     v
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 25 90 0

The process stops after 26 iterations, since the rightmost copy is 0 by then. We move a cell to the right, so the final state of the tape after the initialization is the following.

     v
0 0 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0

Now we're ready to generate the output, by repeating the following process until the cell under the data head is zero.

First, we move the content of the cell under the data head one unit to the left, then move left until the last cell with a non-zero content.

   v
0 65 0 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0

Now, we print all cells, starting with the one under the data head and moving right until we find a 0 cell, incrementing each printed cell after printing it. After printing A, the tape looks as follows.

     v
0 66 0 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0

Now we move right, again printing all cells until a 0 cell in encountered. After printing BCDEFGHIJKLMNOPQRSTUVWXYZ, the tape looks as follows.

                                                                                v
0 66 0 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0

Now, we write 10 to the current cell, print the corresponding character (linefeed) and zero the cell with a call to get on empty input, leaving the tape unchanged.

Finally, we move to the last non-zero to the left, preparing the tape for the next iteration.

        v
0 66 0 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0

The next iteration is similar. We first move 66 one cell to the left, print both 66 cells (BB) and increment them to 67, then print the remaining non-zero cells to the right (CDEFGHIJKLMNOPQRSTUVWXYZ), and finally place the data head on 67, leaving the tape as follows.

           v
0 66 66 0 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 0

After 24 more iterations and after printing ZZZZZZZZZZZZZZZZZZZZZZZZZZ and a linefeed, the tapes is left in the following state.

                                                                                v
0 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 91 0 0

Moving the data head to the left to the next non-zero cell will leave it in its current position, so the cell under it is 0 and the loop terminates.


Title: Print/Output the L-phabet

Body:
brainfuck, <s>103</s> <s>96</s> <s>95</s> <s>91</s> 87 bytes

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

This uses Esolangs' brainfuck constant for 64. Try it online!


答:
CJam (41 bytes)

```<code>q~:A_,{{Af=e__&}%_}*]:.|A.&A:$:e`e_2%1-*!
</code>```

Online demo, test harness

Dissection

```<code>q~:A      e# Parse input and store in A
_,{       e# Loop V times
  {       e#   Extend adjacency list representation of G^i to G^(i+1)
    Af=   e#   by extending each path by one edge
    e__&  e#   and flattening. NB :| would be shorter but breaks for empty lists
  }%
  _       e#   Duplicate, so that we build up G^2, G^3, ..., G^n
}*]       e# Gather in a single array
:.|       e# Fold pointwise union, giving the reachability from each vertex by
          e# paths of length > 1
A.&       e# Pointwise intersect with the paths of length 1
          e# We hope to get an array of empty arrays

          e# Handle the awkward special case of duplicate edges:
A:$       e# Sort each adjacency list
:e`       e# Run-length encode each adjacency list
e_2%      e# Extract only the run lengths
1-        e# Discard the 1s - so we now have an empty array unless there's a dupe

*         e# Join. We hope to be joining an array of empty arrays by an empty array
          e# giving an empty array
!         e# Check that we get a falsy value (i.e. the empty array)
</code>```

Title: Is the DAG a transitive reduction?

Body:
The goal of this challenge is given a finite directed acyclic graph (DAG), determine if the graph is a transitive reduction.

A brief explanation of what a DAG and transitive reductions are:

A DAG is a graph with directed edges (i.e. you can only travel in one direction on that edge) such that given any starting node on the graph, it is impossible to return to the starting node (i.e. there are no cycles).

Given any starting node, if it is possible to travel to another ending node in the graph via any arbitrary positive number of edges, then that ending node is defined as reachable from the starting node. In a general DAG, there might be multiple paths which can be taken from a starting node to a target ending node. For example, take this diamond graph:

To get to node D from A, you could take the path A->B->D or A->C->D. Thus, D is reachable from A. However, there is no path which can be taken to get to node B starting from node C. Thus, node B is not reachable from node C.

Define the reachability of the graph as the list of reachable nodes for every starting node in the graph. So for the same example diamond graph, the reachability is:

```<code>A: [B, C, D]
B: [D]
C: [D]
D: []
</code>```

Another graph which has the same reachability as the above graph is shown below:

However, this second graph has more edges than the original graph. The transitive reduction of a graph is a graph with the least number of edges and same reachability of the original graph. So the first graph is the transitive reduction of the second one.

For a finite DAG, the transitive reduction is guaranteed to exist and is unique.

Input

The input is a "list of lists", where the external list has the length of the number of vertices, and each internal list is the length of the number of edges leaving the associated node, and contains the indices of destination nodes. For example, one way to describe the first graph above would be (assuming zero based indexing):

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

You may begin indexing of the first node at any arbitrary integer value (e.g. 0 or 1 based indexing).

The input may come from any input source desired (stdio, function parameter, etc.). You are free to choose the exact input format as long as no additional information is given. For example, if you want to take input from stdio, you could have each line be a list of edges for the associated node. Ex.:

```<code>1 2
3
3
'' (blank line)
</code>```

The indices in each adjacency list is not necessarily sorted, and there could be multiple edges connecting two nodes (ex.: [[1,1],[]]). You may assume the input graph is weakly connected, and contains no cycles (i.e. it is a DAG).

Output

The output is truthy if the given input DAG is a transitive reduction, and a falsy value otherwise. This may be to any sink desired (stdio, return value, output parameter, etc.)

Examples

All examples use 0-based indexing.

```<code>[[1,2],[3],[3],[]]
true

[[1,2,3],[3],[3],[]]
false

[[1,1],[]]
false

[[1,2,3,4],[5,6,7],[5,8,9],[6,8,10],[7,9,10],[11,12],[11,13],[12,13],[11,14],[12,14],[13,14],[],[],[],[]]
true

[[5,6,7],[2,3,0,4],[5,8,9],[6,8,10],[7,9,10],[11,12],[11,13],[12,13],[11,14],[12,14],[13,14],[],[],[],[]]
true

[[5,6,7],[2,3,0,4,14,5,7],[5,8,9],[6,8,10],[7,9,10],[11,12],[11,13],[12,13],[11,14],[12,14],[13,14],[],[],[],[]]
false

[[5,6,7],[2,3,0,4],[5,8,9],[6,8,10],[7,9,10,14],[11,12],[11,13],[12,13],[11,14],[12,14],[13,14],[],[],[],[]]
false

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

Scoring

This is code golf; smallest code in bytes wins. Your code should complete in a reasonable amount of time (10 minutes max on whatever hardware you have). Standard loopholes apply. You may use any built-ins desired.

Body:
CJam (41 bytes)

q~:A_,{{Af=e__&}%_}*]:.|A.&A:$:e`e_2%1-*!

Online demo, <a href="http://cjam.aditsu.net/#code=%5B%5B1%202%5D%20%5B3%5D%20%5B3%5D%20%5B%5D%5D%0A%5B%5B1%202%203%204%5D%5B5%206%207%5D%5B5%208%209%5D%5B6%208%2010%5D%5B7%209%2010%5D%5B11%2012%5D%5B11%2013%5D%5B12%2013%5D%5B11%2014%5D%5B12%2014%5D%5B13%2014%5D%5B%5D%5B%5D%5B%5D%5B%5D%5D%0A%5B%5B5%206%207%5D%5B2%203%200%204%5D%5B5%208%209%5D%5B6%208%2010%5D%5B7%209%2010%5D%5B11%2012%5D%5B11%2013%5D%5B12%2013%5D%5B11%2014%5D%5B12%2014%5D%5B13%2014%5D%5B%5D%5B%5D%5B%5D%5B%5D%5D%0A%5B%5B1%202%203%5D%20%5B3%5D%20%5B3%5D%20%5B%5D%5D%0A%5B%5B1%201%5D%20%5B%5D%5D%0A%5B%5B5%206%207%5D%5B2%203%200%204%2014%205%207%5D%5B5%208%209%5D%5B6%208%2010%5D%5B7%209%2010%5D%5B11%2012%5D%5B11%2013%5D%5B12%2013%5D%5B11%2014%5D%5B12%2014%5D%5B13%2014%5D%5B%5D%5B%5D%5B%5D%5B%5D%5D%0A%5B%5B5%206%207%5D%5B2%203%200%204%5D%5B5%208%209%5D%5B6%208%2010%5D%5B7%209%2010%2014%5D%5B11%2012%5D%5B11%2013%5D%5B12%2013%5D%5B11%2014%5D%5B12%2014%5D%5B13%2014%5D%5B%5D%5B%5D%5B%5D%5B%5D%5D%0A%5D%7B%60%3AQ%3B%0A%0AQ~%3AA_%2C%7B%7BAf%3De__%26%7D%25_%7D*%5D%3A.%7CA.%26A%3A%24%3Ae%60e_2%251-*!%0A%0Ap%7D%2F" rel="nofollow">test harness

Dissection

q~:A      e# Parse input and store in A
_,{       e# Loop V times
  {       e#   Extend adjacency list representation of G^i to G^(i+1)
    Af=   e#   by extending each path by one edge
    e__&  e#   and flattening. NB :| would be shorter but breaks for empty lists
  }%
  _       e#   Duplicate, so that we build up G^2, G^3, ..., G^n
}*]       e# Gather in a single array
:.|       e# Fold pointwise union, giving the reachability from each vertex by
          e# paths of length > 1
A.&       e# Pointwise intersect with the paths of length 1
          e# We hope to get an array of empty arrays

          e# Handle the awkward special case of duplicate edges:
A:$       e# Sort each adjacency list
:e`       e# Run-length encode each adjacency list
e_2%      e# Extract only the run lengths
1-        e# Discard the 1s - so we now have an empty array unless there's a dupe

*         e# Join. We hope to be joining an array of empty arrays by an empty array
          e# giving an empty array
!         e# Check that we get a falsy value (i.e. the empty array)


问:
Count of "a"s and "b"s must be equal. Did you get it computer?
In the popular (and essential) computer science book, An Introduction to Formal Languages and Automata by Peter Linz, the following formal language is frequently stated:

$$\large{L=\{a^n b^n:n\in\mathbb{Z}^+\}}$$

mainly because this language can not be processed with finite-state automata.
This expression mean "Language L consists all strings of 'a's followed by 'b's, in which the number of 'a's and 'b's are equal and non-zero".

Challenge

Write a working program/function which gets a string, containing "a"s and "b"s only, as input and returns/outputs a truth value, saying if this string is valid the formal language L.

Your program cannot use any external computation tools, including network, external programs, etc. Shells are an exception to this rule; Bash, e.g., can use command line utilities.

Your program must return/output the result in a "logical" way, for example: returning 10 instead of 0, "beep" sound, outputting to stdout etc. More info here.

Standard code golf rules apply.

This is a code-golf. Shortest code in bytes wins. Good luck!

Truthy test cases

```<code>"ab"
"aabb"
"aaabbb"
"aaaabbbb"
"aaaaabbbbb"
"aaaaaabbbbbb"
</code>```

Falsy test cases

```<code>""
"a"
"b"
"aa"
"ba"
"bb"
"aaa"
"aab"
"aba"
"abb"
"baa"
"bab"
"bba"
"bbb"
"aaaa"
"aaab"
"aaba"
"abaa"
"abab"
"abba"
"abbb"
"baaa"
"baab"
"baba"
"babb"
"bbaa"
"bbab"
"bbba"
"bbbb"
</code>```

Leaderboard

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

/* Configuration */

var QUESTION_ID = 85994; // Obtain this from the url
// It will be like https://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 48934; // This should be the user ID of the challenge author.

/* App */

var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;

function answersUrl(index) {
  return "https://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

function commentUrl(index, answers) {
  return "https://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}

function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });
}

function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });
}

getAnswers();

var SCORE_REG = /<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;

var OVERRIDE_REG = /^Override\s*header:\s*/i;

function getAuthorName(a) {
  return a.owner.display_name;
}

function process() {
  var valid = [];

  answers.forEach(function(a) {
    var body = a.body;
    a.comments.forEach(function(c) {
      if(OVERRIDE_REG.test(c.body))
        body = '
' + c.body.replace(OVERRIDE_REG, '') + '
';
    });

    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        language: match[1],
        link: a.share_link,
      });

  });

  valid.sort(function (a, b) {
    var aB = a.size,
        bB = b.size;
    return aB - bB
  });

  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  valid.forEach(function (a) {
    if (a.size != lastSize)
      lastPlace = place;
    lastSize = a.size;
    ++place;

    var answer = jQuery("#answer-template").html();
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", a.user)
                   .replace("{{LANGUAGE}}", a.language)
                   .replace("{{SIZE}}", a.size)
                   .replace("{{LINK}}", a.link);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);

    var lang = a.language;
    if (/ b.lang) return 1;
    if (a.lang < b.lang) return -1;
    return 0;
  });

  for (var i = 0; i < langs.length; ++i)
  {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
                       .replace("{{NAME}}", lang.user)
                       .replace("{{SIZE}}", lang.size)
                       .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }

}```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body { text-align: left !important}

#answer-list {
  padding: 10px;
  width: 290px;
  float: left;
}

#language-list {
  padding: 10px;
  width: 290px;
  float: left;
}

table thead {
  font-weight: bold;
}

table td {
  padding: 5px;
}</code>```

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

答:
Perl 6, 49 bytes

```<code>grammar {token TOP{a<TOP>?b}}.parse(get).Bool.say
</code>```

My entry for dmckee’s bounty. Checks the string using Perl 6’s parsing facilities.

Body:
Perl 6, 49 bytes

grammar {token TOP{a<TOP>?b}}.parse(get).Bool.say

My entry for dmckee’s bounty. Checks the string using Perl 6’s parsing facilities.


答:
J, 13 bytes

```<code>u:65+>./~i.26
</code>```

Online interpreter.

Explanation

```<code>u:65+>./~i.26
         i.26  generate [0 1 ... 25]
       /~      build a table...
     >.        ...of maximum
  65+          add 65 to each element
u:             convert to unicode
</code>```

Title: Print/Output the L-phabet

Body:
J, 13 bytes

u:65+>./~i.26

Online interpreter.

Explanation

u:65+>./~i.26
         i.26  generate [0 1 ... 25]
       /~      build a table...
     >.        ...of maximum
  65+          add 65 to each element
u:             convert to unicode


答:
Bash, 50 bytes

```<code>l=$[${#1}/2]
[[ $1 =~ a{$l}b{$l}$ ]]&&echo $[$l>0]
</code>```

It always returns 1 in case the statement is true, otherwise it doesn't return something except if the input is the empty string '', then it returns 0.

Example:

```<code>$ bash script 'aa'
$ bash script 'ab'
1
$ bash script 'aabb'
1
$ bash script ''
0
</code>```

It can be a bit shorter (46 bytes) if it returns $l in case of success.

```<code>l=$[${#1}/2]
[[ $1 =~ a{$l}b{$l}$ ]]&&echo $l
</code>```

In case of success it always returns a value > 0, if the input is the empty string it returns 0 and otherwise it doesn't return anything.

Examples:

```<code>$ bash t.sh 'aa'
$ bash t.sh 'ab'
1
$ bash t.sh 'aabb'
2
$ bash t.sh ''
0
</code>```

Title: Count of "a"s and "b"s must be equal. Did you get it computer?

Body:
In the popular (and essential) computer science book, An Introduction to Formal Languages and Automata by Peter Linz, the following formal language is frequently stated:

$$\large{L=\{a^n b^n:n\in\mathbb{Z}^+\}}$$

mainly because this language can not be processed with finite-state automata.
This expression mean "Language L consists all strings of 'a's followed by 'b's, in which the number of 'a's and 'b's are equal and non-zero".

Challenge

Write a working program/function which gets a string, containing "a"s and "b"s only, as input and returns/outputs a truth value, saying if this string is valid the formal language L.

Your program cannot use any external computation tools, including network, external programs, etc. Shells are an exception to this rule; Bash, e.g., can use command line utilities.

Your program must return/output the result in a "logical" way, for example: returning 10 instead of 0, "beep" sound, outputting to stdout etc. More info here.

Standard code golf rules apply.

This is a code-golf. Shortest code in bytes wins. Good luck!

Truthy test cases

```<code>"ab"
"aabb"
"aaabbb"
"aaaabbbb"
"aaaaabbbbb"
"aaaaaabbbbbb"
</code>```

Falsy test cases

```<code>""
"a"
"b"
"aa"
"ba"
"bb"
"aaa"
"aab"
"aba"
"abb"
"baa"
"bab"
"bba"
"bbb"
"aaaa"
"aaab"
"aaba"
"abaa"
"abab"
"abba"
"abbb"
"baaa"
"baab"
"baba"
"babb"
"bbaa"
"bbab"
"bbba"
"bbbb"
</code>```

Leaderboard

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

/* Configuration */

var QUESTION_ID = 85994; // Obtain this from the url
// It will be like https://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 48934; // This should be the user ID of the challenge author.

/* App */

var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;

function answersUrl(index) {
  return "https://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

function commentUrl(index, answers) {
  return "https://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}

function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });
}

function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });
}

getAnswers();

var SCORE_REG = /<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;

var OVERRIDE_REG = /^Override\s*header:\s*/i;

function getAuthorName(a) {
  return a.owner.display_name;
}

function process() {
  var valid = [];

  answers.forEach(function(a) {
    var body = a.body;
    a.comments.forEach(function(c) {
      if(OVERRIDE_REG.test(c.body))
        body = '
' + c.body.replace(OVERRIDE_REG, '') + '
';
    });

    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        language: match[1],
        link: a.share_link,
      });

  });

  valid.sort(function (a, b) {
    var aB = a.size,
        bB = b.size;
    return aB - bB
  });

  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  valid.forEach(function (a) {
    if (a.size != lastSize)
      lastPlace = place;
    lastSize = a.size;
    ++place;

    var answer = jQuery("#answer-template").html();
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", a.user)
                   .replace("{{LANGUAGE}}", a.language)
                   .replace("{{SIZE}}", a.size)
                   .replace("{{LINK}}", a.link);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);

    var lang = a.language;
    if (/ b.lang) return 1;
    if (a.lang < b.lang) return -1;
    return 0;
  });

  for (var i = 0; i < langs.length; ++i)
  {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
                       .replace("{{NAME}}", lang.user)
                       .replace("{{SIZE}}", lang.size)
                       .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }

}```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body { text-align: left !important}

#answer-list {
  padding: 10px;
  width: 290px;
  float: left;
}

#language-list {
  padding: 10px;
  width: 290px;
  float: left;
}

table thead {
  font-weight: bold;
}

table td {
  padding: 5px;
}</code>```

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

Body:
Bash, 50 bytes

l=$[${#1}/2]
[[ $1 =~ a{$l}b{$l}$ ]]&&echo $[$l>0]

It always returns 1 in case the statement is true, otherwise it doesn't return something except if the input is the empty string '', then it returns 0.

Example:

$ bash script 'aa'
$ bash script 'ab'
1
$ bash script 'aabb'
1
$ bash script ''
0

It can be a bit shorter (46 bytes) if it returns $l in case of success.

l=$[${#1}/2]
[[ $1 =~ a{$l}b{$l}$ ]]&&echo $l

In case of success it always returns a value > 0, if the input is the empty string it returns 0 and otherwise it doesn't return anything.

Examples:

$ bash t.sh 'aa'
$ bash t.sh 'ab'
1
$ bash t.sh 'aabb'
2
$ bash t.sh ''
0